cezarion 0.19.0-dev.8751 → 0.19.0-dev.8762
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/package.json +3 -3
- package/web/dist/assets/{accounts-section-BJPI6m7z.js → accounts-section-DhS7blSK.js} +1 -1
- package/web/dist/assets/activity-motion-aJkLHTxc.js +1 -0
- package/web/dist/assets/{activity-route-42fC7Mxs.js → activity-route-D2sff_BA.js} +1 -1
- package/web/dist/assets/{agent-config-section-C74gGUgR.js → agent-config-section-C7SMwOgZ.js} +1 -1
- package/web/dist/assets/{agent-defaults-section-lpKgMMNk.js → agent-defaults-section-CvMgsSLY.js} +1 -1
- package/web/dist/assets/{appearance-NUe0p0BF.js → appearance-44RH8bum.js} +1 -1
- package/web/dist/assets/{automations-route-B-f1XBAk.js → automations-route-CygHw9Ni.js} +1 -1
- package/web/dist/assets/{commit-list-U-OxWHN-.js → commit-list-Djmz3j1l.js} +1 -1
- package/web/dist/assets/{diff-DZWO3IkH.js → diff-ByLut7n4.js} +2 -2
- package/web/dist/assets/{diff-controls-CSkIE9yB.js → diff-controls-BEVRwCau.js} +1 -1
- package/web/dist/assets/{diff-view-Zt6DGbX2.js → diff-view-kvjafBI7.js} +1 -1
- package/web/dist/assets/{file-preview-DKpgJH2C.js → file-preview-Ce0Jsxbm.js} +1 -1
- package/web/dist/assets/{git-toolbar-DLTYN21M.js → git-toolbar-Cn1ASnMZ.js} +1 -1
- package/web/dist/assets/{github-Cn5ODryx.js → github-CxYmUkO9.js} +1 -1
- package/web/dist/assets/{global-activity-route-5usGSS4S.js → global-activity-route-ALFcEqug.js} +2 -2
- package/web/dist/assets/{index-BEnkhnIC.js → index-BZr8Y74X.js} +4 -4
- package/web/dist/assets/index-D9L-uSh4.css +1 -0
- package/web/dist/assets/{markdown-B2ioG8t9.js → markdown-BRNtAZkY.js} +1 -1
- package/web/dist/assets/{notifications-section-1cYsj6Kt.js → notifications-section-C_IsaiyD.js} +1 -1
- package/web/dist/assets/{preview-pane-connected-B1k-xMeW.js → preview-pane-connected-DzajVDzR.js} +2 -2
- package/web/dist/assets/{projects-section-B9MczGec.js → projects-section-Cme2qWcF.js} +1 -1
- package/web/dist/assets/{prompt-templates-section-B6B3YiYG.js → prompt-templates-section-DVr3aKc-.js} +1 -1
- package/web/dist/assets/{remote-settings-notice-CNoeqtGO.js → remote-settings-notice-BFeWL9QB.js} +1 -1
- package/web/dist/assets/{repo-git-DfuenTj0.js → repo-git-C3YNr0yL.js} +1 -1
- package/web/dist/assets/{report-reader-CfpyZKZF.js → report-reader-Bm0J3ujk.js} +1 -1
- package/web/dist/assets/{reports-HWxwI40r.js → reports-CNL2zChD.js} +1 -1
- package/web/dist/assets/{resources-section-EsUWF8Gp.js → resources-section-BymE7-3T.js} +1 -1
- package/web/dist/assets/{review-panel-my4q8xfO.js → review-panel-3oSwii0J.js} +1 -1
- package/web/dist/assets/{run-header-DfEfupCk.css → run-header-BXO2nM0A.css} +1 -1
- package/web/dist/assets/run-header-CI49Lba9.js +2 -0
- package/web/dist/assets/{select-BC0GRtWk.js → select-DEqrvCmQ.js} +1 -1
- package/web/dist/assets/{session-context-section-Cc7O57OB.js → session-context-section-oK9zU15I.js} +1 -1
- package/web/dist/assets/{settings-agent-picker-2VsJyFCR.js → settings-agent-picker-BqRDs5nQ.js} +1 -1
- package/web/dist/assets/{settings-shell-DoYsgDvs.js → settings-shell-11SRBczO.js} +1 -1
- package/web/dist/assets/{sidebar-section-CJg8mwiE.js → sidebar-section-DujeUKJ0.js} +1 -1
- package/web/dist/assets/{skills-BJicAwPH.js → skills-B6vquPg1.js} +1 -1
- package/web/dist/assets/{task-changes-59Qa1bEL.js → task-changes-t473lMAF.js} +1 -1
- package/web/dist/assets/{task-commits-BGtVyWPE.js → task-commits-CuXxfPY6.js} +1 -1
- package/web/dist/assets/{task-file-scope-CYLbdb6B.js → task-file-scope-DK1biohR.js} +1 -1
- package/web/dist/assets/{task-files-DKGtV-H2.js → task-files-C0zhDxod.js} +1 -1
- package/web/dist/assets/{task-github-item-KzGyb9nv.js → task-github-item-CFU1Rbv0.js} +1 -1
- package/web/dist/assets/{task-thread-DpmaZvjj.js → task-thread-1BQ5lWbM.js} +2 -2
- package/web/dist/assets/{task-thread-PDeU-fL6.css → task-thread-1mNL_5FP.css} +1 -1
- package/web/dist/assets/{thread-state-BLwfKLzD.js → thread-state-BHI3Jijs.js} +1 -1
- package/web/dist/assets/{use-hand-to-agent-state-Dx4mIAAl.js → use-hand-to-agent-state-BHAhGcZe.js} +1 -1
- package/web/dist/assets/{workflows-a73JJd3t.js → workflows-BMlXKiaH.js} +1 -1
- package/web/dist/assets/{workspace-tools-D1ZIqE9E.js → workspace-tools-CsrBXG_p.js} +1 -1
- package/web/dist/assets/{worktrees-section-CJuySRx_.js → worktrees-section-DvFx6o_A.js} +1 -1
- package/web/dist/index.html +2 -2
- package/web/dist/assets/activity-motion-C0kwg24F.js +0 -1
- package/web/dist/assets/index-CHtuekzK.css +0 -1
- package/web/dist/assets/run-header-BOp4d2LA.js +0 -2
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/project-rail-sortable-BmVI4_-T.js","assets/rolldown-runtime-QTnfLwEv.js","assets/react-runtime-CCIEwYL0.js","assets/project-order-AcHI4Dcl.js","assets/sortable.esm-CAVTYaA3.js","assets/accounts-section-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/project-rail-sortable-BmVI4_-T.js","assets/rolldown-runtime-QTnfLwEv.js","assets/react-runtime-CCIEwYL0.js","assets/project-order-AcHI4Dcl.js","assets/sortable.esm-CAVTYaA3.js","assets/accounts-section-DhS7blSK.js","assets/queries-CYWRnyM5.js","assets/utils-DSMR_WLb.js","assets/bundle-mjs-rHxsej31.js","assets/toaster-B0kvcFif.js","assets/live-protocol-DMhTnCmf.js","assets/chunk-KS7C4IRE-Cg8l-LDN.js","assets/preload-helper-Czpn1I53.js","assets/design-icons-CzEoMH9c.js","assets/createLucideIcon-BHp8sXmF.js","assets/folder-browser-BJ3aXo9k.js","assets/chevron-right-BENZ-1ZN.js","assets/folder-o-AvL3y3.js","assets/button-B7MKxYjT.js","assets/dist-BW234Kg5.js","assets/badge-DQ3U69Ht.js","assets/dialog-B531GGAo.js","assets/dist-Da4ckcJG.js","assets/dist-C5mlVBmd.js","assets/es2015-CQth82uv.js","assets/status-dot-BRzVlF2X.js","assets/bot-TkDIw4y-.js","assets/agents-settings-path-7X6_cvUg.js","assets/centered-state-V15AR_qo.js","assets/settings-select-CCIMGnyA.js","assets/settings-agent-picker-BqRDs5nQ.js","assets/remote-settings-notice-BFeWL9QB.js","assets/agent-config-section-C7SMwOgZ.js","assets/code-editor-B4baSOhz.js","assets/highlighter-DvLzHjjY.js","assets/own-lookup-DS54wXvD.js","assets/agent-defaults-section-CvMgsSLY.js","assets/switch-SP8pw5uU.js","assets/dist-Czz3Y5qH.js","assets/dist-DXO3xwbC.js","assets/textarea-vJt9undk.js","assets/saved-draft-BwzBc-_Y.js","assets/save-cue-Cd3ZAPBS.js","assets/appearance-44RH8bum.js","assets/moon-CRE9nU5R.js","assets/notifications-section-C_IsaiyD.js","assets/projects-section-Cme2qWcF.js","assets/popover-CZV6tz9i.js","assets/dist-BAoXdNsT.js","assets/settings-field-DP9sYv5a.js","assets/prompt-templates-section-DVr3aKc-.js","assets/command-KdW7aO0N.js","assets/skills-pM_PouEs.js","assets/resources-section-BymE7-3T.js","assets/session-context-section-oK9zU15I.js","assets/plus-CxRU2X8C.js","assets/sidebar-section-DujeUKJ0.js","assets/worktrees-section-DvFx6o_A.js","assets/project-router-BvBqllk2.js","assets/project-location-CZNz3wYW.js","assets/open-in-menu-CML2QKil.js","assets/external-link-BE6y205O.js","assets/smartphone-Lr8Ug2z_.js","assets/square-terminal-B6RYYieR.js","assets/dropdown-menu-4e2iKSMT.js","assets/archive-on-merge-field-BT4e_k9f.js","assets/preview-pane-connected-DzajVDzR.js","assets/arrow-right-Dh_Lx3um.js","assets/check-OP-CVgZG.js","assets/chevron-down-CHGyCDBH.js","assets/circle-x-7nTlobAF.js","assets/info-DA1x_4bz.js","assets/loader-circle-CPBhhDbB.js","assets/play-CmVAj_fu.js","assets/tool-display-B9NN44oU.js","assets/thread-state-BHI3Jijs.js","assets/app-window-CSHwDX9N.js","assets/format-BU7D3IfE.js","assets/report-reader-Bm0J3ujk.js","assets/file-preview-Ce0Jsxbm.js","assets/diff-controls-BEVRwCau.js","assets/markdown-BRNtAZkY.js","assets/chunk-BO2N2NFS-DQrpGzb-.js","assets/lib-DrPFkMXk.js","assets/html-report-BX3msvci.js","assets/html-report-frame-uuqkBC0u.js","assets/automations-route-CygHw9Ni.js","assets/label-CH-a6Jyv.js","assets/cez-idle-CdswdDRd.js","assets/run-detail-refresh-BNI7eMgG.js","assets/collapsible-BEV4FO-1.js","assets/select-DEqrvCmQ.js","assets/page-shell-7pLJMOgh.js","assets/page-shell-DQPYcKyL.css","assets/automation-format-DB34jUyF.js","assets/automations-route-CzqZXK0W.css","assets/workspace-tools-CsrBXG_p.js","assets/tasks-table-k18AuMR5.js","assets/task-groups-lh9gz7TP.js","assets/attention-CGsbqL2t.js","assets/settings-shell-11SRBczO.js","assets/settings-shell-AMRJAsgc.css","assets/task-thread-1BQ5lWbM.js","assets/review-panel-3oSwii0J.js","assets/eye-B8okNWXU.js","assets/message-square-B-MD-8rD.js","assets/report-selection-D2RvkiGX.js","assets/use-search-params-writer-ClMScnNe.js","assets/zoomable-image-6RTKhLGE.js","assets/task-file-scope-DK1biohR.js","assets/report-title-D4Mbu2Er.js","assets/run-header-CI49Lba9.js","assets/reference-chip-BdikRjql.js","assets/tab-link-B0pNjKxZ.js","assets/run-header-BXO2nM0A.css","assets/task-thread-1mNL_5FP.css","assets/task-changes-t473lMAF.js","assets/git-toolbar-Cn1ASnMZ.js","assets/diff-stat-C7KB1kDX.js","assets/markdown-BBDDg-4t.js","assets/diff-ByLut7n4.js","assets/image-preview-DCUeM8u3.js","assets/task-files-C0zhDxod.js","assets/task-commits-CuXxfPY6.js","assets/change-counts-npLATh-3.js","assets/commit-list-Djmz3j1l.js","assets/task-github-item-CFU1Rbv0.js","assets/use-hand-to-agent-state-BHAhGcZe.js","assets/use-hand-to-agent-state-BHaqyTxa.css","assets/repo-git-C3YNr0yL.js","assets/nav-row-styles-D5HpOmDZ.js","assets/repo-git-DVXNOJDT.css","assets/github-CxYmUkO9.js","assets/reports-CNL2zChD.js","assets/arrow-up-right-DKGzsMqY.js","assets/reports-CgbU2SrW.css","assets/workflows-BMlXKiaH.js","assets/workflows-FH3RBKvk.css","assets/activity-route-D2sff_BA.js","assets/activity-motion-aJkLHTxc.js","assets/activity-motion-DcKVM8fM.css","assets/global-activity-route-ALFcEqug.js","assets/skills-B6vquPg1.js"])))=>i.map(i=>d[i]);
|
|
2
2
|
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,n,r,t as i}from"./react-runtime-CCIEwYL0.js";import{c as a,i as o,r as s,t as c,u as l}from"./utils-DSMR_WLb.js";import{$t as u,A as d,C as f,Ct as p,Et as m,Gt as h,I as g,It as _,Jt as v,K as y,L as b,Lt as x,M as S,Qt as C,Rt as w,St as T,V as E,Vt as D,W as O,Wt as k,Xt as A,Y as j,Yt as M,Zt as ee,_ as te,at as N,b as P,cn as ne,d as re,dn as F,dt as ie,en as ae,f as I,fn as oe,ft as L,ht as se,in as ce,it as le,k as ue,ln as de,lt as fe,m as pe,mn as me,nn as he,ot as ge,pn as _e,q as ve,rn as R,rt as ye,sn as be,st as xe,t as Se,u as Ce,un as we,v as Te,vt as Ee,xt as De,y as Oe,yt as ke,zt as Ae}from"./queries-CYWRnyM5.js";import{$n as je,A as Me,Ai as Ne,An as Pe,Ar as Fe,C as Ie,Ci as Le,D as Re,Di as ze,Dr as Be,Dt as Ve,Ei as He,Er as Ue,Fi as We,Fn as Ge,Gt as Ke,Hn as qe,I as Je,In as Ye,Jn as Xe,Ln as Ze,M as Qe,Mr as $e,Mt as et,Ni as tt,Nr as nt,Oi as rt,Or as it,Ot as at,P as ot,Pi as st,Pt as ct,Qt as lt,Rt as ut,Si as dt,St as ft,Ti as pt,Tr as mt,Ur as ht,Xr as gt,Yr as _t,Zr as vt,_i as yt,a as bt,bi as xt,bt as St,cn as Ct,en as wt,et as Tt,fr as Et,gi as Dt,gt as Ot,hi as z,i as kt,ii as At,jn as jt,jr as Mt,kn as Nt,kr as Pt,kt as Ft,l as It,lr as Lt,mi as Rt,n as B,pr as zt,q as Bt,qn as Vt,qr as Ht,r as Ut,ri as Wt,st as Gt,t as Kt,tr as qt,tt as Jt,u as Yt,ur as Xt,v as Zt,wr as Qt,xi as $t,xn as en,zn as tn,zt as nn}from"./toaster-B0kvcFif.js";import{B as rn,F as an,I as on,N as sn,P as cn,V as ln,W as un,Y as dn,Z as fn}from"./live-protocol-DMhTnCmf.js";import{t as V}from"./preload-helper-Czpn1I53.js";import{a as pn,c as mn,f as hn,g as gn,h as _n,i as vn,l as yn,m as bn,n as H,o as U,p as xn,r as Sn,s as Cn,t as wn,u as Tn}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{i as En,n as Dn,r as On,t as kn}from"./label-CH-a6Jyv.js";import{t as An}from"./cez-idle-CdswdDRd.js";import{_ as jn,a as Mn,c as Nn,f as Pn,g as Fn,h as In,i as Ln,l as Rn,n as zn,p as Bn,r as Vn,s as Hn,t as Un,u as Wn,v as Gn,y as Kn}from"./tasks-table-k18AuMR5.js";import{$ as qn,A as Jn,B as Yn,C as Xn,D as Zn,E as Qn,F as $n,G as er,I as tr,J as nr,K as rr,L as ir,O as ar,Q as or,R as sr,T as cr,U as lr,V as ur,W as dr,X as fr,Z as pr,c as mr,ct as hr,dt as gr,et as _r,ft as vr,g as yr,h as br,i as xr,it as Sr,j as Cr,k as wr,l as Tr,n as Er,nt as Dr,o as Or,ot as kr,p as Ar,pt as jr,r as Mr,rt as Nr,s as Pr,t as Fr,tt as Ir,u as Lr,ut as Rr,v as zr,x as Br,y as Vr,z as Hr}from"./design-icons-CzEoMH9c.js";import{t as W}from"./createLucideIcon-BHp8sXmF.js";import{i as Ur,n as Wr,r as Gr}from"./open-in-menu-CML2QKil.js";import{t as Kr}from"./check-OP-CVgZG.js";import{t as qr}from"./chevron-down-CHGyCDBH.js";import{_ as Jr,a as Yr,c as Xr,d as Zr,f as Qr,h as $r,i as ei,l as ti,m as ni,n as ri,o as ii,p as ai,r as oi,s as si,u as ci}from"./nav-row-styles-D5HpOmDZ.js";import{n as li,t as ui}from"./folder-browser-BJ3aXo9k.js";import{t as di}from"./external-link-BE6y205O.js";import{t as fi}from"./eye-B8okNWXU.js";import{t as pi}from"./loader-circle-CPBhhDbB.js";import{t as mi}from"./play-CmVAj_fu.js";import{a as hi,i as gi,l as _i,r as vi,s as yi,t as bi}from"./reference-chip-BdikRjql.js";import{n as xi,t as G}from"./button-B7MKxYjT.js";import{a as Si,r as Ci}from"./dist-BW234Kg5.js";import{a as wi,i as Ti,r as Ei,t as Di}from"./dist-C5mlVBmd.js";import{a as Oi,c as ki,d as Ai,f as ji,i as K,l as Mi,o as Ni,p as Pi,r as Fi,s as Ii,t as Li,u as Ri}from"./dropdown-menu-4e2iKSMT.js";import{i as zi,l as Bi,o as Vi,u as Hi}from"./es2015-CQth82uv.js";import{a as Ui,c as Wi,i as Gi,l as Ki,n as qi,o as Ji,r as Yi,s as Xi,t as Zi}from"./dist-Da4ckcJG.js";import{a as Qi,i as $i,n as ea,r as ta,t as na}from"./dist-BAoXdNsT.js";import{i as ra,n as ia,r as aa,s as oa,t as sa}from"./popover-CZV6tz9i.js";import{n as ca,r as la,t as ua}from"./switch-SP8pw5uU.js";import{t as da}from"./badge-DQ3U69Ht.js";import{a as fa,i as pa,n as ma,o as ha,r as ga,s as _a,t as va}from"./dialog-B531GGAo.js";import{t as ya}from"./own-lookup-DS54wXvD.js";import{a as ba,c as xa,i as Sa,l as Ca,o as wa,r as Ta,s as Ea,t as q}from"./project-router-BvBqllk2.js";import{t as Da}from"./attention-CGsbqL2t.js";import{C as Oa,O as ka,S as Aa,T as ja,_ as Ma,a as Na,b as Pa,c as Fa,d as Ia,f as La,g as Ra,h as za,i as Ba,l as Va,m as Ha,n as Ua,o as Wa,p as Ga,r as Ka,s as qa,t as Ja,u as Ya,v as Xa,w as Za,y as Qa}from"./task-groups-lh9gz7TP.js";import{t as J}from"./status-dot-BRzVlF2X.js";import{a as $a,i as eo,l as to,n as no,o as ro,r as io,t as ao,u as oo}from"./report-selection-D2RvkiGX.js";import{t as so}from"./diff-stat-C7KB1kDX.js";import{a as co,i as lo,n as uo,o as fo,r as po,t as mo}from"./format-BU7D3IfE.js";import{a as ho,c as go,i as _o,l as vo,n as yo,o as bo,r as xo,s as So,t as Co}from"./command-KdW7aO0N.js";import{i as wo,r as To,t as Eo}from"./project-order-AcHI4Dcl.js";import{a as Do,c as Oo,d as ko,f as Ao,i as jo,n as Mo,o as No,p as Po,r as Fo,t as Io,u as Lo}from"./skills-pM_PouEs.js";import{r as Ro,t as zo}from"./agents-settings-path-7X6_cvUg.js";import{a as Bo,c as Vo,d as Ho,i as Uo,l as Wo,n as Go,s as Ko,t as qo,u as Jo}from"./page-shell-7pLJMOgh.js";import{t as Yo}from"./centered-state-V15AR_qo.js";import{t as Xo}from"./use-search-params-writer-ClMScnNe.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var Zo=class extends We{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,t,n){let r=new _e({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=Qo(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=Qo(e);if(typeof t==`string`){let n=this.#t.get(t);if(n)if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=Qo(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}else return!0}runNext(e){let t=Qo(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){fn.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>pt(t,e))}findAll(e={}){return this.getAll().filter(t=>pt(e,t))}notify(e){fn.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return fn.batch(()=>Promise.all(e.map(e=>e.continue().catch(ze))))}};function Qo(e){return e.options.scope?.id}var $o=class extends We{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??Le(r,t),a=this.get(i);return a||(a=new yt({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){fn.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>He(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>He(e,t)):t}notify(e){fn.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){fn.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){fn.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},es=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new $o,this.#t=e.mutationCache||new Zo,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=st.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=xt.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(Ne(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=$t(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return fn.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;fn.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return fn.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=fn.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(ze).catch(ze)}invalidateQueries(e,t={}){return fn.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=fn.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(ze)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(ze)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(Ne(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(ze).catch(ze)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(ze).catch(ze)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return xt.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(dt(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{rt(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(dt(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{rt(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=Le(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===tt&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},Y=e(t(),1),ts=n(),ns=un().regex(/^(?:(?:config\.json(?:\.bak)?|agent-accounts\.json|ui-state\.json|server\.json|server\.install\.lock)|(?:remote-settings|server-instances)\/[a-zA-Z0-9-]+\.(?:json|install\.lock)|mcp-tokens\/[a-zA-Z0-9-]+\.json)$/),rs=rn({file:ns,detectedAt:dn(),canRestore:cn()}),is=[`reset`,`outside-write`,`legacy-change`],as=rn({files:sn(an(`reason`,[rs.extend({reason:on(`reset`)}),rs.extend({reason:on(`outside-write`)}),rs.extend({reason:on(`legacy-change`),canImport:cn()})]))});function os(e,t){return!e||typeof e!=`object`||!(`files`in e)||!Array.isArray(e.files)?e:{...e,files:e.files.filter(e=>!(e&&typeof e==`object`&&`reason`in e&&typeof e.reason==`string`&&!t.includes(e.reason)))}}var ss=ln(e=>os(e,is),as);rn({file:ns,detectedAt:dn()}).strict();async function cs(e,t,n){n.throwIfAborted();let r=new Dt(e,{queryKey:t.queryKey,queryFn:t.queryFn,retry:!1,enabled:!1}).subscribe(()=>void 0);n.addEventListener(`abort`,r,{once:!0});try{return await e.fetchQuery({...t,retry:!1})}finally{n.removeEventListener(`abort`,r),r()}}var ls=[`workspace`,`home-recovery`];function us(e){let t=ss.safeParse(e);if(!t.success)throw new Ge(200,`the Squawk server answered /home/recovery with an unexpected body`);return t.data}async function ds(e){return us(await tn(await Ye.api.v1.home.recovery.$get({},Ze(e)),`/home/recovery`))}function fs(){return At({queryKey:ls,queryFn:({signal:e})=>ds({signal:e}),enabled:vt(),staleTime:1/0,retry:!1})}function ps(){let e=z();(0,Y.useEffect)(()=>{let t=!0,n=new AbortController,r,i=async t=>{_t()&&await cs(e,{queryKey:ls,queryFn:({signal:e})=>ds({signal:e}),staleTime:0},t?AbortSignal.any([n.signal,t]):n.signal)},a=n=>{let r;try{r=us(n)}catch{i().catch(()=>{});return}e.cancelQueries({queryKey:ls,exact:!0}).then(()=>{t&&_t()&&e.setQueryData(ls,r)})},o=()=>{_t()&&!r?r=w(`home:recovery`,a):!_t()&&r&&(r(),r=void 0)};o();let s=gt(t=>{o(),t?i().catch(()=>{}):e.cancelQueries({queryKey:ls,exact:!0})}),c=ht(e=>i(e));return()=>{t=!1,n.abort(),c(),s(),r?.()}},[e])}function ms(e,t){let n=t===`config.json`?[h.projects,h.config,h.runsIndex]:t===`agent-accounts.json`?[h.agentProfiles,h.providerStatus]:t===`ui-state.json`?[h.uiState]:[];for(let t of n)e.invalidateQueries({queryKey:t})}function hs(e){let t=z();return F({mutationFn:async t=>us(await tn(await Ye.api.v1.home.recovery[e].$post({json:t}),`/home/recovery/${e}`)),onSuccess:async(e,n)=>{await t.cancelQueries({queryKey:ls,exact:!0}),t.setQueryData(ls,e),ms(t,n.file)}})}var gs=()=>hs(`restore`),_s=()=>hs(`accept`),vs=()=>hs(`import`);function ys(){return ps(),null}function bs(){return new es({defaultOptions:{queries:{refetchInterval:!1,staleTime:5*6e4,gcTime:30*6e4,refetchOnWindowFocus:!1,refetchOnReconnect:!1,retry:(e,t)=>t instanceof Ge&&t.status>=400&&t.status<500?!1:e<1},mutations:{retry:!1}}})}var xs=Y.createContext(null),X=i(),Ss=class extends Y.Component{state={error:null};static getDerivedStateFromError(e){return{error:e instanceof Error?e:Error(String(e))}}componentDidCatch(e,t){console.error(`Squawk cockpit: uncaught render error`,e,t.componentStack)}render(){let{error:e}=this.state;return e?(0,X.jsxs)(`div`,{"data-slot":`app-error`,role:`alert`,style:{display:`flex`,minHeight:`100dvh`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,gap:`12px`,padding:`24px`,textAlign:`center`,font:`14px/1.5 system-ui, sans-serif`},children:[(0,X.jsx)(`h1`,{style:{fontSize:`20px`,fontWeight:600,margin:0},children:`The cockpit hit an error`}),(0,X.jsxs)(`p`,{style:{margin:0,maxWidth:`52ch`},children:[`Reload to carry on. Nothing on disk changed — Squawk’s state lives in`,` `,(0,X.jsx)(`code`,{children:`.ai/cezar/`}),`, and this page never wrote to it.`]}),(0,X.jsx)(`pre`,{"data-slot":`app-error-detail`,style:{margin:0,maxWidth:`100%`,overflowX:`auto`,textAlign:`left`,opacity:.75},children:e.message}),(0,X.jsx)(`button`,{type:`button`,onClick:()=>location.reload(),style:{padding:`6px 14px`,cursor:`pointer`},children:`Reload`})]}):this.props.children}},Cs=W(`activity`,[[`path`,{d:`M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2`,key:`169zse`}]]),ws=W(`archive-restore`,[[`rect`,{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`,key:`1wp1u1`}],[`path`,{d:`M4 8v11a2 2 0 0 0 2 2h2`,key:`tvwodi`}],[`path`,{d:`M20 8v11a2 2 0 0 1-2 2h-2`,key:`1gkqxj`}],[`path`,{d:`m9 15 3-3 3 3`,key:`1pd0qc`}],[`path`,{d:`M12 12v9`,key:`192myk`}]]),Ts=W(`brush`,[[`path`,{d:`m11 10 3 3`,key:`fzmg1i`}],[`path`,{d:`M6.5 21A3.5 3.5 0 1 0 3 17.5a2.62 2.62 0 0 1-.708 1.792A1 1 0 0 0 3 21z`,key:`p4q2r7`}],[`path`,{d:`M9.969 17.031 21.378 5.624a1 1 0 0 0-3.002-3.002L6.967 14.031`,key:`wy6l02`}]]),Es=W(`check-check`,[[`path`,{d:`M18 6 7 17l-5-5`,key:`116fxf`}],[`path`,{d:`m22 10-7.5 7.5L13 16`,key:`ke71qq`}]]),Ds=W(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),Os=W(`chevrons-left`,[[`path`,{d:`m11 17-5-5 5-5`,key:`13zhaf`}],[`path`,{d:`m18 17-5-5 5-5`,key:`h8a8et`}]]),ks=W(`chevrons-right`,[[`path`,{d:`m6 17 5-5-5-5`,key:`xnjwq`}],[`path`,{d:`m13 17 5-5-5-5`,key:`17xmmf`}]]),As=W(`clock-3`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6h4`,key:`135r8i`}]]),js=W(`coins`,[[`path`,{d:`M13.744 17.736a6 6 0 1 1-7.48-7.48`,key:`bq4yh3`}],[`path`,{d:`M15 6h1v4`,key:`11y1tn`}],[`path`,{d:`m6.134 14.768.866-.5 2 3.464`,key:`17snzx`}],[`circle`,{cx:`16`,cy:`8`,r:`6`,key:`14bfc9`}]]),Ms=W(`compass`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z`,key:`9ktpf1`}]]),Ns=W(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),Ps=W(`dollar-sign`,[[`line`,{x1:`12`,x2:`12`,y1:`2`,y2:`22`,key:`7eqyqh`}],[`path`,{d:`M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6`,key:`1b0p4s`}]]),Fs=W(`ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]]),Is=W(`eye-off`,[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`,key:`ct8e1f`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`,key:`151rxh`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`,key:`13bj9a`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),Ls=W(`file-cog`,[[`path`,{d:`M15 8a1 1 0 0 1-1-1V2a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8z`,key:`1ckgky`}],[`path`,{d:`M20 8v12a2 2 0 0 1-2 2h-4.182`,key:`1726p0`}],[`path`,{d:`m3.305 19.53.923-.382`,key:`ao1pio`}],[`path`,{d:`M4 10.592V4a2 2 0 0 1 2-2h8`,key:`1foop0`}],[`path`,{d:`m4.228 16.852-.924-.383`,key:`1fv9zy`}],[`path`,{d:`m5.852 15.228-.383-.923`,key:`1a9hc2`}],[`path`,{d:`m5.852 20.772-.383.924`,key:`1sh9ke`}],[`path`,{d:`m8.148 15.228.383-.923`,key:`4yu6lf`}],[`path`,{d:`m8.53 21.696-.382-.924`,key:`18b0s9`}],[`path`,{d:`m9.773 16.852.922-.383`,key:`ti6xop`}],[`path`,{d:`m9.773 19.148.922.383`,key:`rws47d`}],[`circle`,{cx:`7`,cy:`18`,r:`3`,key:`lvkj7j`}]]),Rs=W(`file-stack`,[[`path`,{d:`M11 21a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1v-8a1 1 0 0 1 1-1`,key:`likhh7`}],[`path`,{d:`M16 16a1 1 0 0 1-1 1H9a1 1 0 0 1-1-1V8a1 1 0 0 1 1-1`,key:`17ky3x`}],[`path`,{d:`M21 6a2 2 0 0 0-.586-1.414l-2-2A2 2 0 0 0 17 2h-3a1 1 0 0 0-1 1v8a1 1 0 0 0 1 1h6a1 1 0 0 0 1-1z`,key:`1hyeo0`}]]),zs=W(`file-text`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),Bs=W(`folder-git-2`,[[`path`,{d:`M18 19a5 5 0 0 1-5-5v8`,key:`sz5oeg`}],[`path`,{d:`M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v5`,key:`1w6njk`}],[`circle`,{cx:`13`,cy:`12`,r:`2`,key:`1j92g6`}],[`circle`,{cx:`20`,cy:`19`,r:`2`,key:`1obnsp`}]]),Vs=W(`folder-search`,[[`path`,{d:`M10.7 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v4.1`,key:`1bw5m7`}],[`path`,{d:`m21 21-1.9-1.9`,key:`1g2n9r`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}]]),Hs=W(`git-pull-request-arrow`,[[`circle`,{cx:`5`,cy:`6`,r:`3`,key:`1qnov2`}],[`path`,{d:`M5 9v12`,key:`ih889a`}],[`circle`,{cx:`19`,cy:`18`,r:`3`,key:`1qljk2`}],[`path`,{d:`m15 9-3-3 3-3`,key:`1lwv8l`}],[`path`,{d:`M12 6h5a2 2 0 0 1 2 2v7`,key:`1yj91y`}]]),Us=W(`grip-vertical`,[[`circle`,{cx:`9`,cy:`12`,r:`1`,key:`1vctgf`}],[`circle`,{cx:`9`,cy:`5`,r:`1`,key:`hp0tcf`}],[`circle`,{cx:`9`,cy:`19`,r:`1`,key:`fkjjf6`}],[`circle`,{cx:`15`,cy:`12`,r:`1`,key:`1tmaij`}],[`circle`,{cx:`15`,cy:`5`,r:`1`,key:`19l28e`}],[`circle`,{cx:`15`,cy:`19`,r:`1`,key:`f4zoj3`}]]),Ws=W(`link`,[[`path`,{d:`M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71`,key:`1cjeqo`}],[`path`,{d:`M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71`,key:`19qd67`}]]),Gs=W(`list-checks`,[[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`path`,{d:`m3 7 2 2 4-4`,key:`1obspn`}]]),Ks=W(`memory-stick`,[[`path`,{d:`M12 12v-2`,key:`fwoke6`}],[`path`,{d:`M12 18v-2`,key:`qj6yno`}],[`path`,{d:`M16 12v-2`,key:`heuere`}],[`path`,{d:`M16 18v-2`,key:`s1ct0w`}],[`path`,{d:`M2 11h1.5`,key:`15p63e`}],[`path`,{d:`M20 18v-2`,key:`12ehxp`}],[`path`,{d:`M20.5 11H22`,key:`khsy7a`}],[`path`,{d:`M4 18v-2`,key:`1c3oqr`}],[`path`,{d:`M8 12v-2`,key:`1mwtfd`}],[`path`,{d:`M8 18v-2`,key:`qcmpov`}],[`rect`,{x:`2`,y:`6`,width:`20`,height:`10`,rx:`2`,key:`1qcswk`}]]),qs=W(`panel-left-close`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`m16 15-3-3 3-3`,key:`14y99z`}]]),Js=W(`panel-left-open`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`m14 9 3 3-3 3`,key:`8010ee`}]]),Ys=W(`pencil`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]),Xs=W(`pin`,[[`path`,{d:`M12 17v5`,key:`bb1du9`}],[`path`,{d:`M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z`,key:`1nkz8b`}]]),Zs=W(`send`,[[`path`,{d:`M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z`,key:`1ffxy3`}],[`path`,{d:`m21.854 2.147-10.94 10.939`,key:`12cjpa`}]]),Qs=W(`settings`,[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),$s=W(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),ec=`cezar:open-command-palette`;function tc(){window.dispatchEvent(new Event(ec))}var nc=`cez-sidebar-width`;function rc(e){let t=typeof e==`number`?e:Number(e);return Number.isFinite(t)?Math.min(420,Math.max(264,Math.round(t))):264}function ic(){try{let e=localStorage.getItem(nc);return e===null?264:rc(e)}catch{return 264}}function ac(e){try{localStorage.setItem(nc,String(rc(e)))}catch{}}var oc=Y.createContext(264),sc=Y.createContext(void 0);function cc(){return Y.useContext(sc)}var lc=Object.freeze({position:`absolute`,border:0,width:1,height:1,padding:0,margin:-1,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,wordWrap:`normal`}),uc=`VisuallyHidden`,dc=Y.forwardRef((e,t)=>(0,X.jsx)(wi.span,{...e,ref:t,style:{...lc,...e.style}}));dc.displayName=uc;var fc=dc,pc=`AlertDialog`,[mc,hc]=Ti(pc,[Ki]),gc=Ki(),_c=e=>{let{__scopeAlertDialog:t,...n}=e,r=gc(t);return(0,X.jsx)(Zi,{...r,...n,modal:!0})};_c.displayName=pc;var vc=`AlertDialogTrigger`,yc=Y.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=gc(n);return(0,X.jsx)(Wi,{...i,...r,ref:t})});yc.displayName=vc;var bc=`AlertDialogPortal`,xc=e=>{let{__scopeAlertDialog:t,...n}=e,r=gc(t);return(0,X.jsx)(Ji,{...r,...n})};xc.displayName=bc;var Sc=`AlertDialogOverlay`,Cc=Y.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=gc(n);return(0,X.jsx)(Ui,{...i,...r,ref:t})});Cc.displayName=Sc;var wc=`AlertDialogContent`,[Tc,Ec]=mc(wc),Dc=Y.forwardRef((e,t)=>{let{__scopeAlertDialog:n,children:r,...i}=e,a=gc(n),o=Si(t,Y.useRef(null)),s=Y.useRef(null);return(0,X.jsx)(Tc,{scope:n,cancelRef:s,children:(0,X.jsx)(Yi,{role:`alertdialog`,...a,...i,ref:o,onOpenAutoFocus:Ei(i.onOpenAutoFocus,e=>{e.preventDefault(),s.current?.focus({preventScroll:!0})}),onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:r})})});Dc.displayName=wc;var Oc=`AlertDialogTitle`,kc=Y.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=gc(n);return(0,X.jsx)(Xi,{...i,...r,ref:t})});kc.displayName=Oc;var Ac=`AlertDialogDescription`,jc=Y.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=gc(n);return(0,X.jsx)(Gi,{...i,...r,ref:t})});jc.displayName=Ac;var Mc=`AlertDialogAction`,Nc=Y.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=gc(n);return(0,X.jsx)(qi,{...i,...r,ref:t})});Nc.displayName=Mc;var Pc=`AlertDialogCancel`,Fc=Y.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,{cancelRef:i}=Ec(Pc,n),a=gc(n),o=Si(t,i);return(0,X.jsx)(qi,{...a,...r,ref:o})});Fc.displayName=Pc;var Ic=_c,Lc=xc,Rc=Cc,zc=Dc,Bc=Nc,Vc=Fc,Hc=kc,Uc=jc,[Wc,Gc]=Ti(`Tooltip`,[Qi]),Kc=Qi(),qc=`TooltipProvider`,Jc=700,Yc=`tooltip.open`,[Xc,Zc]=Wc(qc),Qc=e=>{let{__scopeTooltip:t,delayDuration:n=Jc,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=Y.useRef(!0),s=Y.useRef(!1),c=Y.useRef(0);return Y.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,X.jsx)(Xc,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:Y.useCallback(()=>{r<=0||(window.clearTimeout(c.current),o.current=!1)},[r]),onClose:Y.useCallback(()=>{r<=0||(window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r))},[r]),isPointerInTransitRef:s,onPointerInTransitChange:Y.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})};Qc.displayName=qc;var $c=`Tooltip`,[el,tl]=Wc($c),nl=e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:s}=e,c=Zc($c,e.__scopeTooltip),l=Kc(t),[u,d]=Y.useState(null),f=Bi(),p=Y.useRef(0),m=o??c.disableHoverableContent,h=s??c.delayDuration,g=Y.useRef(!1),[_,v]=Di({prop:r,defaultProp:i??!1,onChange:e=>{e?(c.onOpen(),document.dispatchEvent(new CustomEvent(Yc))):c.onClose(),a?.(e)},caller:$c}),y=Y.useMemo(()=>_?g.current?`delayed-open`:`instant-open`:`closed`,[_]),b=Y.useCallback(()=>{window.clearTimeout(p.current),p.current=0,g.current=!1,v(!0)},[v]),x=Y.useCallback(()=>{window.clearTimeout(p.current),p.current=0,v(!1)},[v]),S=Y.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{g.current=!0,v(!0),p.current=0},h)},[h,v]);return Y.useEffect(()=>()=>{p.current&&=(window.clearTimeout(p.current),0)},[]),(0,X.jsx)($i,{...l,children:(0,X.jsx)(el,{scope:t,contentId:f,open:_,stateAttribute:y,trigger:u,onTriggerChange:d,onTriggerEnter:Y.useCallback(()=>{c.isOpenDelayedRef.current?S():b()},[c.isOpenDelayedRef,S,b]),onTriggerLeave:Y.useCallback(()=>{m?x():(window.clearTimeout(p.current),p.current=0)},[x,m]),onOpen:b,onClose:x,disableHoverableContent:m,children:n})})};nl.displayName=$c;var rl=`TooltipTrigger`,il=Y.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=tl(rl,n),a=Zc(rl,n),o=Kc(n),s=Si(t,Y.useRef(null),i.onTriggerChange),c=Y.useRef(!1),l=Y.useRef(!1),u=Y.useCallback(()=>c.current=!1,[]);return Y.useEffect(()=>()=>document.removeEventListener(`pointerup`,u),[u]),(0,X.jsx)(na,{asChild:!0,...o,children:(0,X.jsx)(wi.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:s,onPointerMove:Ei(e.onPointerMove,e=>{e.pointerType!==`touch`&&!l.current&&!a.isPointerInTransitRef.current&&(i.onTriggerEnter(),l.current=!0)}),onPointerLeave:Ei(e.onPointerLeave,()=>{i.onTriggerLeave(),l.current=!1}),onPointerDown:Ei(e.onPointerDown,()=>{i.open&&i.onClose(),c.current=!0,document.addEventListener(`pointerup`,u,{once:!0})}),onFocus:Ei(e.onFocus,()=>{c.current||i.onOpen()}),onBlur:Ei(e.onBlur,i.onClose),onClick:Ei(e.onClick,i.onClose)})})});il.displayName=rl;var al=`TooltipPortal`,[ol,sl]=Wc(al,{forceMount:void 0}),cl=e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=tl(al,t);return(0,X.jsx)(ol,{scope:t,forceMount:n,children:(0,X.jsx)(Hi,{present:n||a.open,children:(0,X.jsx)(zi,{asChild:!0,container:i,children:r})})})};cl.displayName=al;var ll=`TooltipContent`,ul=Y.forwardRef((e,t)=>{let n=sl(ll,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=tl(ll,e.__scopeTooltip);return(0,X.jsx)(Hi,{present:r||o.open,children:o.disableHoverableContent?(0,X.jsx)(hl,{side:i,...a,ref:t}):(0,X.jsx)(dl,{side:i,...a,ref:t})})}),dl=Y.forwardRef((e,t)=>{let n=tl(ll,e.__scopeTooltip),r=Zc(ll,e.__scopeTooltip),i=Y.useRef(null),a=Si(t,i),[o,s]=Y.useState(null),{trigger:c,onClose:l}=n,u=i.current,{onPointerInTransitChange:d}=r,f=Y.useCallback(()=>{s(null),d(!1)},[d]),p=Y.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=yl(r,vl(r,n.getBoundingClientRect())),a=bl(t.getBoundingClientRect()),o=Sl([...i,...a]);s(o),d(!0)},[d]);return Y.useEffect(()=>()=>f(),[f]),Y.useEffect(()=>{if(c&&u){let e=e=>p(e,u),t=e=>p(e,c);return c.addEventListener(`pointerleave`,e),u.addEventListener(`pointerleave`,t),()=>{c.removeEventListener(`pointerleave`,e),u.removeEventListener(`pointerleave`,t)}}},[c,u,p,f]),Y.useEffect(()=>{if(o){let e=e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=c?.contains(t)||u?.contains(t),i=!xl(n,o);r?f():i&&(f(),l())};return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[c,u,o,l,f]),(0,X.jsx)(hl,{...e,ref:a})}),[fl,pl]=Wc($c,{isInside:!1}),ml=Ci(`TooltipContent`),hl=Y.forwardRef((e,t)=>{let{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:a,onPointerDownOutside:o,...s}=e,c=tl(ll,n),l=Kc(n),{onClose:u}=c;return Y.useEffect(()=>(document.addEventListener(Yc,u),()=>document.removeEventListener(Yc,u)),[u]),Y.useEffect(()=>{if(c.trigger){let e=e=>{e.target instanceof Node&&e.target.contains(c.trigger)&&u()};return window.addEventListener(`scroll`,e,{capture:!0}),()=>window.removeEventListener(`scroll`,e,{capture:!0})}},[c.trigger,u]),(0,X.jsx)(Vi,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:u,children:(0,X.jsxs)(ta,{"data-state":c.stateAttribute,...l,...s,ref:t,style:{...s.style,"--radix-tooltip-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-tooltip-content-available-width":`var(--radix-popper-available-width)`,"--radix-tooltip-content-available-height":`var(--radix-popper-available-height)`,"--radix-tooltip-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-tooltip-trigger-height":`var(--radix-popper-anchor-height)`},children:[(0,X.jsx)(ml,{children:r}),(0,X.jsx)(fl,{scope:n,isInside:!0,children:(0,X.jsx)(fc,{id:c.contentId,role:`tooltip`,children:i||r})})]})})});ul.displayName=ll;var gl=`TooltipArrow`,_l=Y.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=Kc(n);return pl(gl,n).isInside?null:(0,X.jsx)(ea,{...i,...r,ref:t})});_l.displayName=gl;function vl(e,t){let n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(n,r,i,a)){case a:return`left`;case i:return`right`;case n:return`top`;case r:return`bottom`;default:throw Error(`unreachable`)}}function yl(e,t,n=5){let r=[];switch(t){case`top`:r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case`bottom`:r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case`left`:r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case`right`:r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function bl(e){let{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}function xl(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function Sl(e){let t=e.slice();return t.sort((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:+(e.y>t.y)),Cl(t)}function Cl(e){if(e.length<=1)return e.slice();let t=[];for(let n=0;n<e.length;n++){let r=e[n];for(;t.length>=2;){let e=t[t.length-1],n=t[t.length-2];if((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x))t.pop();else break}t.push(r)}t.pop();let n=[];for(let t=e.length-1;t>=0;t--){let r=e[t];for(;n.length>=2;){let e=n[n.length-1],t=n[n.length-2];if((e.x-t.x)*(r.y-t.y)>=(e.y-t.y)*(r.x-t.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var wl=Qc,Tl=nl,El=il,Dl=cl,Ol=ul,kl=_l;function Al({open:e,onOpenChange:t}){let[n,r]=(0,Y.useState)(null),[i,a]=(0,Y.useState)(null),o=T(),s=m(),c=xn(),l=new Set((o.data?.projects??[]).map(e=>e.root)),u=e=>{r(e),a(null),s.reset()},d=li(n,i);return(0,X.jsx)(va,{open:e,onOpenChange:t,children:(0,X.jsxs)(ga,{"data-slot":`add-project-dialog`,className:`sm:max-w-lg`,children:[(0,X.jsxs)(ha,{children:[(0,X.jsx)(_a,{children:`Open local folder`}),(0,X.jsx)(pa,{children:`Pick the folder Squawk should run in. Git repos are marked; any folder works.`})]}),(0,X.jsxs)(ma,{className:`space-y-4`,children:[(0,X.jsx)(ui,{path:n,selected:i,onSelect:a,onEnter:u,emptyHint:`No subfolders here — “Add project” registers this folder.`,decorate:e=>(0,X.jsxs)(X.Fragment,{children:[e.isRepo?(0,X.jsx)(da,{variant:`outline`,className:`shrink-0 text-[12px]`,children:`git`}):null,l.has(e.path)?(0,X.jsx)(da,{variant:`ghost`,className:`shrink-0 text-[12px] text-muted-foreground`,children:`already added`}):null]})}),s.isError?(0,X.jsx)(`p`,{"data-slot":`add-project-error`,className:`min-w-0 break-words text-[13px] text-danger`,children:s.error instanceof Error?s.error.message:`could not add that folder`}):null]}),(0,X.jsxs)(fa,{className:`min-w-0 sm:items-center sm:justify-between`,children:[(0,X.jsx)(`span`,{"data-slot":`add-project-target`,className:`min-w-0 truncate font-mono text-xs text-muted-foreground`,title:d??void 0,children:d??``}),(0,X.jsxs)(`span`,{className:`flex shrink-0 gap-2`,children:[(0,X.jsx)(G,{variant:`outline`,onClick:()=>t(!1),children:`Cancel`}),(0,X.jsx)(G,{"data-slot":`add-project-confirm`,disabled:d===null||s.isPending,onClick:()=>{d===null||s.isPending||s.mutate(d,{onSuccess:({project:e})=>{t(!1),c(`/p/${encodeURIComponent(e.id)}/`)}})},children:s.isPending?`Adding…`:`Add project`})]})]})]})})}function jl(e,t){let[n,r]=(0,Y.useState)(null),i=(0,Y.useMemo)(()=>`${e}${Math.random().toString(36).slice(2)}-${Date.now().toString(36)}`,[]),a=(0,Y.useRef)(i);return a.current=i,(0,Y.useEffect)(()=>On((e,t)=>{if(e!==`checkout-progress`)return;let n=t;n?.checkoutId===a.current&&(n.phase===`cloning`&&n.line?r(n.line):n.phase!==`cloning`&&r(null))}),[]),(0,Y.useEffect)(()=>ht(async e=>{if(!t)return;let n=await wt(i,{signal:e}).catch(()=>null);if(!n)return;let{progress:o}=n;e.aborted||o?.checkoutId!==a.current||r(o?.phase===`cloning`?o.line??null:null)}),[t,i]),{checkoutId:i,progress:n,setProgress:r}}function Ml({className:e,type:t,...n}){return(0,X.jsx)(`input`,{type:t,"data-slot":`input`,className:c(`h-11 w-full min-w-0 rounded-md border border-control-border bg-[var(--task-brand-bg)] px-3 py-1 text-base shadow-none transition-[color,box-shadow] outline-hidden selection:bg-accent-strong selection:text-accent-strong-foreground file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-soft-foreground disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm`,`focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50`,`aria-invalid:border-destructive aria-invalid:ring-destructive/20`,e),...n})}function Nl(e){return e instanceof Error?e.message.match(/https:\/\/github\.com\/orgs\/[A-Za-z0-9._-]+\/sso\?authorization_request=[A-Za-z0-9._~-]+(?![^\s'"<>])/)?.[0]??null:null}function Pl({open:e,onOpenChange:t}){let[n,r]=(0,Y.useState)(``),[i,a]=(0,Y.useState)(``),[o,s]=(0,Y.useState)(!1),c=(0,Y.useRef)(!1),l=T(),u=L(),{mutate:d,isPending:f}=u,p=xn(),m=Nl(u.error),{checkoutId:h,progress:g,setProgress:_}=jl(`co-`,f),v=(0,Y.useMemo)(()=>{let e=n.trim().replace(/\/+$/,``).replace(/\.git$/,``).split(`/`).pop()??``;return e.includes(`:`)?e.split(`:`).pop()??``:e},[n]),y=i.trim()===``?v:i.trim(),b=l.data?.projectsDir??``,x=y===``?``:`${b.replace(/\/+$/,``)}/${y}`,S=(0,Y.useCallback)(()=>{n.trim()===``||f||(c.current=!1,s(!1),_(null),d({url:n.trim(),checkoutId:h,...i.trim()===``?{}:{name:i.trim()}},{onSuccess:({project:e})=>{t(!1),p(`/p/${encodeURIComponent(e.id)}/`)}}))},[d,f,h,i,p,t,n]);return(0,Y.useEffect)(()=>{if(!o)return;let e=()=>{c.current&&(c.current=!1,s(!1),S())},t=()=>{document.visibilityState===`visible`&&e()};return window.addEventListener(`focus`,e),document.addEventListener(`visibilitychange`,t),()=>{window.removeEventListener(`focus`,e),document.removeEventListener(`visibilitychange`,t)}},[o,S]),(0,X.jsx)(va,{open:e,onOpenChange:e=>u.isPending?void 0:t(e),children:(0,X.jsxs)(ga,{"data-slot":`clone-project-dialog`,className:`min-w-0 max-h-[calc(100dvh-2rem)] overflow-x-hidden overflow-y-auto sm:max-w-lg`,children:[(0,X.jsxs)(ha,{children:[(0,X.jsx)(_a,{children:`Clone from GitHub`}),(0,X.jsxs)(pa,{children:[`Squawk clones with `,(0,X.jsx)(`code`,{children:`gh`}),` into your checkout root and adds the result as a project.`]})]}),(0,X.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,X.jsx)(kn,{htmlFor:`clone-url`,children:`Repository`}),(0,X.jsx)(Ml,{id:`clone-url`,"data-slot":`clone-url`,autoFocus:!0,placeholder:`owner/repo or https://github.com/owner/repo`,value:n,disabled:u.isPending,onChange:e=>r(e.target.value),onKeyDown:e=>{e.key===`Enter`&&S()}})]}),(0,X.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,X.jsx)(kn,{htmlFor:`clone-name`,children:`Folder name`}),(0,X.jsx)(Ml,{id:`clone-name`,"data-slot":`clone-name`,placeholder:v===``?`repo`:v,value:i,disabled:u.isPending,onChange:e=>a(e.target.value)}),(0,X.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1`,children:[(0,X.jsx)(`p`,{"data-slot":`clone-target`,className:`min-w-0 flex-1 truncate font-mono text-xs text-soft-foreground`,title:x,children:x}),u.isPending?(0,X.jsx)(G,{"data-slot":`clone-root-settings`,variant:`ghost`,size:`icon-sm`,className:`size-7`,"aria-label":`Edit checkout root`,title:`Edit checkout root`,disabled:!0,children:(0,X.jsx)(or,{className:`size-3.5`,"aria-hidden":`true`})}):(0,X.jsx)(G,{asChild:!0,variant:`ghost`,size:`icon-sm`,className:`size-7`,children:(0,X.jsx)(H,{to:`/settings/global/projects`,"data-slot":`clone-root-settings`,"aria-label":`Edit checkout root`,title:`Edit checkout root`,children:(0,X.jsx)(or,{className:`size-3.5`,"aria-hidden":`true`})})})]})]}),u.isPending?(0,X.jsx)(`p`,{"data-slot":`clone-progress`,className:`truncate font-mono text-xs text-muted-foreground`,children:g??`Starting the clone…`}):null,u.isError?(0,X.jsx)(`div`,{"data-slot":`clone-error`,className:`grid min-w-0 gap-1.5 text-[13px] text-danger`,children:m?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`p`,{children:`GitHub requires SAML authorization for this organization.`}),(0,X.jsxs)(`p`,{children:[(0,X.jsx)(`a`,{"data-slot":`clone-sso-link`,className:`inline-flex min-h-11 items-center font-medium underline underline-offset-2`,href:m,target:`_blank`,rel:`noreferrer`,onClick:()=>{c.current=!0,s(!0)},children:`Authorize this GitHub organization`}),o?` — return here after authorizing, or choose Retry clone.`:` — return to this tab to retry, or choose Retry clone.`]}),(0,X.jsxs)(`details`,{className:`min-w-0`,children:[(0,X.jsx)(`summary`,{className:`min-h-11 content-center`,children:`Error details`}),(0,X.jsx)(`p`,{className:`whitespace-pre-wrap break-all`,children:u.error instanceof Error?u.error.message:null})]})]}):(0,X.jsx)(`p`,{className:`min-w-0 whitespace-pre-wrap break-all`,children:u.error instanceof Error?u.error.message:`could not clone that repository`})}):null,(0,X.jsxs)(fa,{children:[(0,X.jsx)(G,{variant:`outline`,disabled:u.isPending,onClick:()=>t(!1),children:`Cancel`}),(0,X.jsx)(G,{"data-slot":`clone-confirm`,disabled:n.trim()===``||y===``||u.isPending,onClick:S,children:u.isPending?`Cloning…`:u.isError?`Retry clone`:`Clone`})]})]})})}var Fl=[{slug:`github/codespaces-nextjs`,label:`Next.js`,description:`Minimal Next.js app (GitHub)`},{slug:`vercel/chatbot`,label:`Next.js AI chatbot`,description:`Full-featured AI chat app (Vercel)`},{slug:`vercel/nextjs-postgres-nextauth-tailwindcss-template`,label:`Next.js admin dashboard`,description:`Postgres, Auth.js and Tailwind (Vercel)`},{slug:`github/codespaces-react`,label:`React + Vite`,description:`React single-page app (GitHub)`},{slug:`antfu-collective/vitesse`,label:`Vue + Vite`,description:`Opinionated Vue starter (Vitesse)`},{slug:`nuxt-ui-templates/starter-vue`,label:`Vue + Nuxt UI`,description:`Vue + Vite with Nuxt UI (Nuxt)`},{slug:`mugnavo/cove`,label:`Vite+`,description:`TanStack Start on Vite+ (vp), Better Auth`},{slug:`w3cj/hono-open-api-starter`,label:`Hono`,description:`Type-safe JSON API with OpenAPI docs`},{slug:`github/codespaces-express`,label:`Express`,description:`Node.js web server (GitHub)`},{slug:`andrewmcodes/obsidian-beginner-vault-template`,label:`Obsidian vault`,description:`Your own knowledge base in Markdown`},{slug:`chibat/chrome-extension-typescript-starter`,label:`Chrome extension`,description:`TypeScript extension starter`},{slug:`actions/typescript-action`,label:`GitHub Action`,description:`TypeScript action with tests (GitHub)`},{slug:`microsoft/python-package-template`,label:`Python package`,description:`Packaging, tests and CI (Microsoft)`},{slug:`github/codespaces-flask`,label:`Flask`,description:`Python web app (GitHub)`},{slug:`github/codespaces-django`,label:`Django`,description:`Python web framework (GitHub)`},{slug:`github/codespaces-rails`,label:`Ruby on Rails`,description:`Rails app (GitHub)`},{slug:`github/codespaces-jupyter`,label:`Jupyter notebooks`,description:`Data science and ML (GitHub)`}];function Il(e){let t=e.trim().toLowerCase();return t===``||Fl.some(e=>e.slug.toLowerCase()===t)?Fl:Fl.filter(e=>[e.label,e.slug,e.description].some(e=>e.toLowerCase().includes(t)))}function Ll({value:e,onChange:t,disabled:n,id:r}){let i=(0,Y.useId)(),a=Il(e),[o,s]=(0,Y.useState)(-1),l=(0,Y.useRef)(null);(0,Y.useEffect)(()=>s(-1),[e]),(0,Y.useEffect)(()=>{o<0||l.current?.querySelector(`[data-index="${o}"]`)?.scrollIntoView?.({block:`nearest`})},[o]);let u=e=>`${i}-option-${e}`;return(0,X.jsxs)(`div`,{className:`grid min-w-0 gap-1.5`,children:[(0,X.jsx)(Ml,{id:r,"data-slot":`create-project-template`,role:`combobox`,"aria-expanded":`true`,"aria-controls":i,"aria-autocomplete":`list`,"aria-activedescendant":o>=0?u(o):void 0,autoComplete:`off`,spellCheck:!1,placeholder:`owner/repo or https://github.com/owner/repo`,value:e,disabled:n,onChange:e=>t(e.target.value),onKeyDown:e=>{if(e.key===`ArrowDown`||e.key===`ArrowUp`){if(e.preventDefault(),a.length===0)return;let t=e.key===`ArrowDown`;s(e=>e<0?t?0:a.length-1:(e+(t?1:-1)+a.length)%a.length)}else if(e.key===`Enter`&&o>=0){e.preventDefault(),e.stopPropagation();let n=a[o];n&&t(n.slug)}}}),(0,X.jsx)(`ul`,{ref:l,id:i,role:`listbox`,"aria-label":`Suggested templates`,"data-slot":`create-project-template-list`,className:`max-h-48 min-h-0 overflow-y-auto overscroll-contain rounded-md border border-border`,children:a.length===0?(0,X.jsx)(`li`,{className:`px-3 py-2 text-xs text-muted-foreground`,role:`presentation`,children:`No suggestion matches — any GitHub template repository works.`}):a.map((r,i)=>{let a=r.slug.toLowerCase()===e.trim().toLowerCase();return(0,X.jsxs)(`li`,{id:u(i),role:`option`,"aria-selected":a,"data-index":i,"data-value":r.slug,"data-slot":`create-project-template-option`,onMouseDown:e=>e.preventDefault(),onClick:()=>{n||t(r.slug)},className:c(`grid min-h-11 cursor-pointer content-center gap-0.5 px-3 py-1.5 text-start`,`pointer-hover:hover:bg-accent`,i===o&&`bg-accent`,a&&`font-medium`),children:[(0,X.jsxs)(`span`,{className:`truncate text-[13px]`,children:[r.label,` `,(0,X.jsx)(`span`,{className:`font-mono text-xs text-soft-foreground`,children:r.slug})]}),(0,X.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:r.description})]},r.slug)})})]})}function Rl({className:e,...t}){return(0,X.jsx)(`div`,{"data-slot":`skeleton`,className:c(`animate-pulse motion-reduce:animate-none rounded-md bg-accent`,e),...t})}function zl(e){return{available:e.data?.available?e.data.owners:null,unavailableReason:e.isError?`GitHub is unavailable: ${e.error instanceof Error?e.error.message:`could not ask gh`}`:e.data&&!e.data.available?e.data.reason:null}}function Bl(e,t){return e&&t!==null&&t.length>0}function Vl(e,t){return e??t?.[0]?.login??null}function Hl(e){return(e.data?.projectsDir??``).replace(/\/+$/,``)}function Ul({nameValid:e,isPending:t,created:n,github:r,chosenOwner:i,effectiveStart:a,template:o}){return e&&!t&&n===null&&(!r||i!==null&&(a===`empty`||o.trim()!==``))}function Wl({trimmed:e,checkoutId:t,github:n,chosenOwner:r,effectiveStart:i,template:a}){return{name:e,checkoutId:t,...n&&r?{github:{owner:r,...i===`template`?{template:a.trim()}:{}}}:{}}}function Gl({created:e}){return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(kr,{"aria-hidden":`true`,className:`mbs-0.5 size-5 shrink-0 text-semantic-amber`}),(0,X.jsxs)(`div`,{className:`grid min-w-0 gap-2`,children:[(0,X.jsx)(`p`,{className:`font-medium`,children:`The project was created, but its GitHub repository is not finished.`}),(0,X.jsx)(`p`,{className:`min-w-0 whitespace-pre-wrap break-words font-mono text-xs`,children:e.warning})]})]})}function Kl({fieldId:e,name:t,setName:n,trimmed:r,nameValid:i,projectsDir:a,isPending:o,create:s}){let c=`${e}-name-hint`;return(0,X.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,X.jsx)(kn,{htmlFor:`${e}-name`,children:`Name`}),(0,X.jsx)(Ml,{id:`${e}-name`,"data-slot":`create-project-name`,autoFocus:!0,autoComplete:`off`,spellCheck:!1,placeholder:`my-project`,value:t,disabled:o,"aria-invalid":r!==``&&!i,"aria-describedby":r!==``&&!i?c:void 0,onChange:e=>n(e.target.value.replace(/\s/g,`-`)),onKeyDown:e=>{e.key===`Enter`&&s()}}),r!==``&&!i?(0,X.jsx)(`p`,{id:c,"data-slot":`create-project-name-hint`,className:`text-xs text-danger`,children:`Use letters, digits, “.”, “-” and “_” only, starting with a letter or digit — it names the folder and the repository.`}):null,(0,X.jsx)(`p`,{"data-slot":`create-project-path`,className:`min-w-0 truncate font-mono text-xs text-soft-foreground`,title:`${a}/${r}`,children:r===``?`${a}/…`:`${a}/${r}`})]})}function ql({fieldId:e,github:t,setGithubOn:n,isPending:r,available:i}){return(0,X.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,X.jsx)(la,{id:`${e}-github`,"data-slot":`create-project-github`,checked:t,disabled:r||i===null||i.length===0,onCheckedChange:n,className:`mbs-0.5`}),(0,X.jsxs)(`div`,{className:`grid min-w-0 gap-0.5`,children:[(0,X.jsx)(kn,{htmlFor:`${e}-github`,children:`Also create a private GitHub repository`}),(0,X.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Under the account you choose. You can change its visibility on GitHub later.`})]})]})}function Jl({fieldId:e,effectiveStart:t,setStart:n,isPending:r,github:i,template:a,setTemplate:o}){return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`fieldset`,{className:`grid gap-2`,disabled:r,children:[(0,X.jsx)(`legend`,{className:`mbe-2 text-sm font-medium`,children:`Start with`}),(0,X.jsx)(Ql,{slot:`create-project-start-empty`,name:`${e}-start`,checked:t===`empty`,disabled:r,onChange:()=>n(`empty`),title:`Empty repository`,detail:`One empty first commit, no files.`}),(0,X.jsx)(Ql,{slot:`create-project-start-template`,name:`${e}-start`,checked:t===`template`,disabled:r||!i,onChange:()=>n(`template`),title:`From a template`,detail:i?`GitHub generates the repository from a template.`:`Needs the GitHub repository.`})]}),t===`template`?(0,X.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,X.jsx)(kn,{htmlFor:`${e}-template`,children:`Template`}),(0,X.jsx)(Ll,{id:`${e}-template`,value:a,onChange:o,disabled:r})]}):null]})}function Yl({isPending:e,progress:t,failed:n,error:r}){return(0,X.jsxs)(X.Fragment,{children:[e?(0,X.jsx)(`p`,{"data-slot":`create-project-progress`,className:`flex-none truncate font-mono text-xs text-muted-foreground`,children:t??`Starting…`}):null,n?(0,X.jsx)(`p`,{"data-slot":`create-project-error`,role:`alert`,className:`flex-none min-w-0 whitespace-pre-wrap break-words text-[13px] text-danger`,children:r instanceof Error?r.message:`could not create the project`}):null]})}function Xl({created:e,goToProject:t,isPending:n,onCancel:r,ready:i,onCreate:a,failed:o}){return(0,X.jsx)(fa,{className:`flex-none`,children:e?(0,X.jsx)(G,{"data-slot":`create-project-open`,onClick:t,children:`Go to project`}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(G,{variant:`outline`,disabled:n,onClick:r,children:`Cancel`}),(0,X.jsx)(G,{"data-slot":`create-project-submit`,disabled:!i,onClick:a,children:n?`Creating…`:o?`Try again`:`Create project`})]})})}function Zl({open:e,onOpenChange:t}){let[n,r]=(0,Y.useState)(``),[i,a]=(0,Y.useState)(!1),[o,s]=(0,Y.useState)(null),[c,l]=(0,Y.useState)(`empty`),[u,d]=(0,Y.useState)(``),[f,p]=(0,Y.useState)(null),m=T(),h=Ee({enabled:e}),g=se(),{mutate:_,isPending:v}=g,y=xn(),b=(0,Y.useId)(),x=(0,Y.useRef)(!1),{checkoutId:S,progress:C,setProgress:w}=jl(`np-`,v),{available:E,unavailableReason:D}=zl(h),O=Bl(i,E),k=Vl(o,E),A=O?c:`empty`,j=n.trim(),M=en.test(j),ee=Hl(m),te=Ul({nameValid:M,isPending:v,created:f,github:O,chosenOwner:k,effectiveStart:A,template:u}),N=(0,Y.useCallback)(()=>{!te||x.current||(x.current=!0,w(null),_(Wl({trimmed:j,checkoutId:S,github:O,chosenOwner:k,effectiveStart:A,template:u}),{onSettled:()=>{x.current=!1},onSuccess:({project:e,warning:n})=>{if(n){p({projectId:e.id,warning:n});return}t(!1),y(`/p/${encodeURIComponent(e.id)}/`)}}))},[te,_,j,S,O,k,A,u,t,y]);return(0,X.jsx)(va,{open:e,onOpenChange:e=>v?void 0:t(e),children:(0,X.jsxs)(ga,{"data-slot":`create-project-dialog`,className:`flex min-w-0 flex-col overflow-y-clip overflow-x-clip sm:max-w-2xl`,children:[(0,X.jsxs)(ha,{className:`flex-none`,children:[(0,X.jsx)(_a,{children:`New project`}),(0,X.jsx)(pa,{children:`Squawk creates a git repository with one empty commit in your checkout root and adds it as a project.`})]}),f?(0,X.jsx)(`div`,{"data-slot":`create-project-warning`,role:`status`,className:`flex min-h-0 flex-1 gap-3 overflow-y-auto overscroll-contain rounded-md border border-border bg-muted p-4 text-[13px]`,children:(0,X.jsx)(Gl,{created:f})}):(0,X.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-wrap gap-6 overflow-y-auto overscroll-contain`,children:[(0,X.jsxs)(`div`,{className:`grid min-w-[50%] grow-[999] basis-0 content-start gap-5`,children:[(0,X.jsx)(Kl,{fieldId:b,name:n,setName:r,trimmed:j,nameValid:M,projectsDir:ee,isPending:v,create:N}),(0,X.jsx)(ql,{fieldId:b,github:O,setGithubOn:a,isPending:v,available:E}),(0,X.jsx)(Jl,{fieldId:b,effectiveStart:A,setStart:l,isPending:v,github:O,template:u,setTemplate:d})]}),(0,X.jsx)($l,{owners:E,unavailableReason:D,enabled:O&&!v,chosen:k,onChoose:s,groupName:`${b}-owner`})]}),(0,X.jsx)(Yl,{isPending:v,progress:C,failed:g.isError,error:g.error}),(0,X.jsx)(Xl,{created:f,goToProject:()=>{f&&(t(!1),y(`/p/${encodeURIComponent(f.projectId)}/`))},isPending:v,onCancel:()=>t(!1),ready:te,onCreate:N,failed:g.isError})]})})}function Ql({slot:e,name:t,checked:n,disabled:r,onChange:i,title:a,detail:o}){return(0,X.jsxs)(`label`,{className:c(`flex min-h-11 items-start gap-3 rounded-md border border-border p-3`,`has-[:checked]:border-accent-strong has-[:focus-visible]:outline-2 has-[:focus-visible]:outline-offset-2 has-[:focus-visible]:outline-ring`,r?`cursor-not-allowed opacity-60`:`cursor-pointer`),children:[(0,X.jsx)(`input`,{type:`radio`,"data-slot":e,name:t,checked:n,disabled:r,onChange:i,className:`mbs-0.5 size-4 accent-[var(--color-accent-strong)]`}),(0,X.jsxs)(`span`,{className:`grid min-w-0 gap-0.5`,children:[(0,X.jsx)(`span`,{className:`text-[13px] font-medium`,children:a}),(0,X.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:o})]})]})}function $l({owners:e,unavailableReason:t,enabled:n,chosen:r,onChoose:i,groupName:a}){return(0,X.jsxs)(`fieldset`,{"data-slot":`create-project-owners`,disabled:!n,className:`grid min-w-0 grow basis-56 content-start gap-2`,children:[(0,X.jsx)(`legend`,{className:`mbe-2 text-sm font-medium`,children:`Repository owner`}),t===null?e===null?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Rl,{className:`h-14 w-full`}),(0,X.jsx)(Rl,{className:`h-14 w-full`})]}):e.map(e=>(0,X.jsxs)(`label`,{"data-slot":`create-project-owner`,className:c(`flex min-h-11 min-w-0 items-center gap-3 rounded-md border border-border p-2.5`,`has-[:checked]:border-accent-strong has-[:checked]:bg-accent`,`has-[:focus-visible]:outline-2 has-[:focus-visible]:outline-offset-2 has-[:focus-visible]:outline-ring`,n?`cursor-pointer pointer-hover:hover:bg-accent`:`cursor-not-allowed opacity-60`),children:[(0,X.jsx)(`input`,{type:`radio`,name:a,value:e.login,checked:r===e.login,disabled:!n,onChange:()=>i(e.login),className:`sr-only`}),e.avatarUrl?(0,X.jsx)(`img`,{src:e.avatarUrl,alt:``,className:`size-8 shrink-0 rounded-full object-cover`}):(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`grid size-8 shrink-0 place-items-center rounded-full bg-muted text-xs font-medium uppercase`,children:e.login.slice(0,1)}),(0,X.jsxs)(`span`,{className:`grid min-w-0`,children:[(0,X.jsx)(`span`,{className:`truncate text-[13px] font-medium`,children:e.login}),(0,X.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:e.personal?`Personal account`:e.description??`Organization`})]})]},e.login)):(0,X.jsxs)(`p`,{"data-slot":`create-project-github-unavailable`,className:`rounded-md border border-border bg-muted p-3 text-xs text-muted-foreground break-words`,children:[t,`. Local projects still work.`]})]})}function eu({triggerClassName:e,icon:t=Zn,iconClassName:n=`size-4`,side:r,origin:i,label:a,iconFrameClassName:o}={}){let[l,u]=Y.useState(!1),[d,f]=Y.useState(!1),[p,m]=Y.useState(!1);return(0,X.jsxs)(Li,{children:[(0,X.jsx)(Pi,{asChild:!0,children:(0,X.jsxs)(G,{variant:`ghost`,"aria-label":`Add project`,title:`Add project`,"data-origin":i,className:c(`size-9 p-0 text-muted-foreground`,e),children:[o?(0,X.jsx)(`span`,{"aria-hidden":`true`,className:o,children:(0,X.jsx)(t,{className:n,"aria-hidden":`true`})}):(0,X.jsx)(t,{className:n,"aria-hidden":`true`}),a?(0,X.jsx)(`span`,{children:a}):(0,X.jsx)(`span`,{className:`sr-only`,children:`Add project`})]})}),(0,X.jsxs)(Fi,{align:`start`,...s({side:r}),className:`w-56`,children:[(0,X.jsx)(Oi,{className:`text-xs text-soft-foreground`,children:`Add project`}),(0,X.jsxs)(K,{"data-slot":`add-project-new`,onSelect:()=>m(!0),children:[(0,X.jsx)(Zn,{"aria-hidden":`true`}),`New project…`]}),(0,X.jsxs)(K,{"data-slot":`add-project-local`,onSelect:()=>u(!0),children:[(0,X.jsx)(cr,{"aria-hidden":`true`}),`Open local folder…`]}),(0,X.jsxs)(K,{"data-slot":`add-project-clone`,onSelect:()=>f(!0),children:[(0,X.jsx)(tr,{"aria-hidden":`true`}),`Clone from GitHub…`]})]}),l?(0,X.jsx)(Al,{open:!0,onOpenChange:u}):null,d?(0,X.jsx)(Pl,{open:!0,onOpenChange:f}):null,p?(0,X.jsx)(Zl,{open:!0,onOpenChange:m}):null]})}var tu=[`done`,`failed`,`cancelled`];function nu(e){return tu.includes(e)}function ru(e){return!qt(e)&&nu(e.status)&&!Za(e)}function iu(e){return e.reduce((e,t)=>Wa(t)||!Za(t)?e:e+1,0)}function au(e){return e.status===`failed`?`danger`:`success`}var ou={needsYou:0,failedUnread:0,inMotion:0,finishedUnread:0};function su(e){let t={...ou};for(let n of e)n.archived||Wa(n)||(jt(n)?t.needsYou+=1:Pe(n).tone===`running`?t.inMotion+=1:Za(n)&&(n.status===`failed`?t.failedUnread+=1:n.status===`done`&&(t.finishedUnread+=1)));return t}function cu(e){let t=new Map;for(let n of e){let e=t.get(n.projectId);e?e.push(n):t.set(n.projectId,[n])}return new Map([...t].map(([e,t])=>[e,su(t)]))}function lu(e,t,n={}){if(n.unknown)return`${e} · activity unknown`;let r=uu(t).map(e=>e.text);return[e,r.length>0?r.join(` · `):`idle`].join(` · `)}function uu(e){let{needsYou:t,failedUnread:n,inMotion:r,finishedUnread:i}=e??ou,a=[];return t>0&&a.push({tone:`amber`,text:`${t} needs you`}),n>0&&a.push({tone:`red`,text:`${n} failed`}),r>0&&a.push({tone:`violet`,text:`${r} working`}),i>0&&a.push({tone:`green`,text:`${i} finished`}),a}function du(e){let t={...ou};for(let n of e)n&&(t.needsYou+=n.needsYou,t.failedUnread+=n.failedUnread,t.inMotion+=n.inMotion,t.finishedUnread+=n.finishedUnread);return t}function fu(e){let t=e.split(/[-_ .]+/).filter(e=>e!==``);return(t.length>=2?[t[0],t[1]].map(e=>[...e][0]):[...t[0]??``].slice(0,2)).join(``).toLowerCase()}var pu=`w-[228px] rounded-[10px] border-border bg-sidebar p-[5px] text-foreground shadow-[0_10px_28px_#00000047] motion-reduce:animate-none`,mu=`h-8 gap-2.5 rounded-[6px] px-[9px] py-0 text-[13px] focus:bg-sidebar-row-hover focus:text-foreground [&_svg]:size-[15px] [&_svg]:text-soft-foreground focus:[&_svg]:text-foreground max-md:min-h-11`;function hu(){let e=Ea(),t=ke(),n=T(),r=n.data?.bootProject??t.data?.bootProject,i=e??r??null,a=n.data?.projects.find(e=>e.id===i),o=i===r?t.data?.repo:void 0,s=a?.root??o?.root;return{health:t,registry:n,projectId:i,project:a,root:s,name:a?.name??s?.split(/[\\/]/).filter(Boolean).at(-1),branch:o?.branch??a?.branch}}function gu({onNavigate:e}={}){let t=(0,Y.useRef)(null),n=(0,Y.useRef)(null),[r,i]=(0,Y.useState)(0),{health:a,registry:o,projectId:s,root:c,name:l,branch:u}=hu(),d=a.data?.capabilities.localHandoff===!0,f=l??(o.isPending?`Loading project…`:`Project unavailable`),p=[d?c:void 0,u].filter(Boolean).join(` · `);return(0,X.jsxs)(`div`,{"data-slot":`project-header`,className:`flex min-w-0 items-center gap-2.5 px-[14px] pt-[14px] pb-2.5`,children:[(0,X.jsx)(`span`,{ref:t,"aria-hidden":`true`,"data-slot":`project-header-mark`,className:`flex size-7 shrink-0 items-center justify-center rounded-[7px] border border-soft-foreground bg-sidebar-row-selected text-xs leading-none font-semibold text-foreground`,children:l?fu(l):`…`}),(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-px`,children:[(0,X.jsx)(`div`,{"data-slot":`project-header-name`,className:`truncate text-[14px] font-semibold text-foreground`,title:f,children:f}),(0,X.jsx)(`div`,{"data-slot":`project-header-detail`,dir:`rtl`,className:`truncate text-left font-mono text-xs text-soft-foreground`,title:p||void 0,children:(0,X.jsx)(`bdi`,{dir:`ltr`,children:p||(o.isPending?`Loading…`:`Branch unavailable`)})})]}),(0,X.jsx)(xu,{projectId:s,onNavigate:e,triggerRef:n,triggerClassName:`size-7 max-md:size-11`,align:`start`,alignOffset:r,onOpenChange:e=>{e&&t.current&&n.current&&i(t.current.getBoundingClientRect().left-n.current.getBoundingClientRect().left)}})]})}function _u(e,t,n){let r=e.data?.bootProject??t.data?.bootProject,i=e.data?.projects.find(e=>e.id===n),a=n===r?t.data?.repo:void 0;return{bootId:r,project:i,root:i?.root??a?.root}}function vu({marking:e,runs:t,unread:n,projectId:r}){return e||t.isError||t.data===void 0||n.length===0||r===null}function yu({marking:e,runs:t,unread:n}){return e?`Marking…`:t.isError?`Unavailable`:t.data===void 0?`Loading…`:`${n.length} unread`}function bu(e,t){return!e||t?.status===`missing`}function xu({projectId:e,onNavigate:t,triggerRef:n,triggerClassName:r,align:i=`start`,alignOffset:a,side:o,onOpenChange:l}){let u=cc(),d=ke(),f=T(),[p,m]=(0,Y.useState)(!1),{bootId:h,project:g,root:_}=_u(f,d,e),v=ne(e??`default`,e!==null,e===h),y=E(de({projectId:e??`default`,boot:e===h})),b=(0,Y.useRef)(e);b.current=e;let x=d.data?.capabilities.localHandoff===!0,S=(v.data??[]).filter(e=>!Wa(e)&&Za(e));async function C(){m(!0);let t=0;try{for(let n of S){if(b.current!==e)break;try{await y.mutateAsync(n.id)}catch{t+=1}}t>0&&B(`Could not mark ${t} task${t===1?``:`s`} read. Try again.`,{tone:`danger`})}finally{m(!1)}}async function w(){if(_)try{await navigator.clipboard.writeText(_),B(`Project folder copied`)}catch{B(`Could not copy path: ${_}`,{tone:`danger`})}}return(0,X.jsxs)(Li,{...s({onOpenChange:l}),children:[(0,X.jsx)(Pi,{asChild:!0,children:(0,X.jsx)(`button`,{"data-slot":`project-menu-trigger`,ref:n,type:`button`,"aria-label":`Project menu`,className:c(`flex shrink-0 items-center justify-center rounded-[6px] text-soft-foreground hover:bg-sidebar-row-hover hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring data-[state=open]:bg-sidebar-row-selected data-[state=open]:text-foreground`,r),children:(0,X.jsx)(Fs,{"aria-hidden":`true`,className:`size-[15px]`})})}),(0,X.jsxs)(Fi,{align:i,...s({alignOffset:a,side:o}),sideOffset:4,className:pu,children:[(0,X.jsxs)(K,{className:mu,disabled:vu({marking:p,runs:v,unread:S,projectId:e}),onSelect:()=>{C()},children:[(0,X.jsx)(Es,{"aria-hidden":`true`}),` Mark all read`,(0,X.jsx)(`span`,{className:`ml-auto text-xs text-soft-foreground`,children:yu({marking:p,runs:v,unread:S})})]}),(0,X.jsx)(Mi,{className:`mx-0`}),x&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Su,{projectId:e??`default`,disabled:bu(_,g)}),(0,X.jsxs)(K,{className:mu,disabled:!_,onSelect:()=>{w()},children:[(0,X.jsx)(Ns,{"aria-hidden":`true`}),` Copy path`]}),(0,X.jsx)(Mi,{className:`mx-0`})]}),(0,X.jsx)(K,{asChild:!0,className:mu,children:(0,X.jsxs)(q,{to:`/settings`,onClick:t??u,children:[(0,X.jsx)(Qs,{"aria-hidden":`true`}),` Project settings`]})})]})]})}function Su({disabled:e,projectId:t}){let n=O(),r=F({mutationFn:e=>ct(e,t),onError:e=>B(e.message,{tone:`danger`}),onSuccess:()=>B(`Opening project folder`)}),i=(n.data?.targets??[]).filter(e=>Wr(e.id)===void 0);return(0,X.jsxs)(Ri,{children:[(0,X.jsxs)(ji,{className:mu,disabled:e||r.isPending,children:[(0,X.jsx)(di,{"aria-hidden":`true`}),` Open in`]}),(0,X.jsx)(Ni,{children:(0,X.jsxs)(Ai,{className:pu,children:[i.map(e=>{let t=Gr(e);return(0,X.jsxs)(K,{className:mu,"data-target":e.id,onSelect:()=>r.mutate(e.id),children:[(0,X.jsx)(t,{"aria-hidden":`true`}),e.label]},e.id)}),i.length===0&&(0,X.jsx)(K,{className:mu,disabled:!0,children:n.isError?`Apps unavailable`:n.isPending?`Loading apps…`:`No apps available`})]})})]})}var Cu={amber:`text-semantic-amber`,red:`text-semantic-red`,violet:`text-semantic-violet`,green:`text-semantic-green`};function wu({signal:e,known:t,current:n,maxParts:r,slot:i,className:a}){let o=uu(e).slice(0,r);return(0,X.jsx)(`span`,{"data-slot":i,className:c(`flex min-w-0 items-center font-medium`,n?`text-muted-foreground`:`text-soft-foreground`,a),children:t?o.length===0?`idle`:o.map((e,t)=>(0,X.jsxs)(`span`,{className:`flex items-center gap-x-[inherit]`,children:[t>0?(0,X.jsx)(`span`,{"aria-hidden":`true`,children:`·`}):null,(0,X.jsx)(`span`,{"data-tone":e.tone,className:Cu[e.tone],children:e.text})]},e.tone)):`activity unknown`})}function Tu(e,t){let n=e=>e.split(`.`).slice(0,3).map(e=>Number.parseInt(e,10)||0),r=n(e),i=n(t);for(let e=0;e<3;e++){let t=(r[e]??0)-(i[e]??0);if(t!==0)return t>0}return!1}var Eu={amber:`bg-pending text-signal-ink-amber`,red:`bg-danger text-signal-ink`,violet:`bg-status-running text-signal-ink`,green:`bg-success text-signal-ink`};function Du(e,t,n){return e>9&&!(n&&t>1)?24:t===1?20:16}function Ou({position:e,segments:t,className:n,compact:r=!1}){let i=t.filter(e=>e.count>0);return i.length===0?null:(0,X.jsx)(`span`,{"aria-hidden":`true`,"data-slot":`rail-pill-${e}`,className:c(`pointer-events-none absolute -right-[4px] box-border flex h-[19px] overflow-hidden rounded-[10px] border-2 border-background`,e===`top`?`-top-[6px]`:`top-[25px]`,n),children:i.map(({tone:e,count:t})=>(0,X.jsx)(`span`,{"data-segment":e,"data-count":t,style:{width:Du(t,i.length,r)},className:c(`flex items-center justify-center text-xs leading-[14px] font-bold tabular-nums`,Eu[e]),children:t>9?`9+`:t},e))})}function ku(e){return{top:[{tone:`amber`,count:e?.needsYou??0},{tone:`red`,count:e?.failedUnread??0}],bottom:[{tone:`violet`,count:e?.inMotion??0},{tone:`green`,count:e?.finishedUnread??0}]}}var Au=`cez-theme`,ju=`(prefers-color-scheme: light)`,Mu=`dark`;function Nu(e){return e===`light`||e===`dark`||e===`system`?e:Mu}function Pu(e,t){return e===`light`||e===`system`&&t?`light`:`dark`}function Fu(){try{return Nu(localStorage.getItem(Au))}catch{return Mu}}function Iu(e){try{localStorage.setItem(Au,e)}catch{}}function Lu(){return typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(ju).matches}function Ru(e,t){e.classList.toggle(`light`,t===`light`),e.style.colorScheme=t}function zu(e){return`/cezarion-mark-${e}.svg`}function Bu(e){let t=document.querySelector(`link[rel="icon"]`);t&&(t.href=zu(e))}function Vu(e){let t=document.querySelector(`meta[name="theme-color"]`),n=getComputedStyle(e).getPropertyValue(`--card`).trim();t&&n&&(t.content=n)}var Hu=Y.createContext(null);function Uu({children:e}){let[t,n]=Y.useState(Fu),[r,i]=Y.useState(Lu);Y.useEffect(()=>{let e=window.matchMedia?.(ju);if(!e)return;i(e.matches);let t=e=>i(e.matches);return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]);let a=Pu(t,r);Y.useLayoutEffect(()=>{Ru(document.documentElement,a),Bu(a),Vu(document.documentElement)},[a]);let o=Y.useCallback(e=>{n(e),Iu(e)},[]),s=Y.useMemo(()=>({theme:t,resolvedTheme:a,setTheme:o}),[t,a,o]);return(0,X.jsx)(Hu.Provider,{value:s,children:e})}function Wu(){let e=Y.useContext(Hu);if(!e)throw Error(`Squawk: useTheme() must be called inside <ThemeProvider>`);return e}var Gu={light:`dark`,dark:`system`,system:`light`},Ku={light:`light`,dark:`dark`,system:`system`};function qu({className:e,showLabel:t=!1,labelClassName:n}){let{theme:r,setTheme:i}=Wu(),a=Gu[r],o=Nr;return(0,X.jsxs)(G,{type:`button`,variant:`ghost`,size:`icon-sm`,className:e,"data-slot":`theme-toggle`,"data-theme-pref":r,title:`Theme: ${Ku[r]}`,"aria-label":`Theme: ${Ku[r]}. Switch to ${Ku[a]}.`,onClick:()=>i(a),children:[(0,X.jsx)(o,{"aria-hidden":`true`}),t?(0,X.jsxs)(`span`,{className:n,children:[`Theme · `,r.charAt(0).toUpperCase()+r.slice(1)]}):null]})}function Ju(e,t){if(!e?.signals)return null;let n=e.signals;return du(e.projects.filter(e=>e.id!==t).map(e=>n.get(e.id)))}function Yu(e){let t=uu(e??void 0).map(e=>e.text);return t.length>0?`Open projects. Elsewhere: ${t.join(`, `)}`:`Open projects`}function Xu({elsewhere:e}){if(!e)return null;let{top:t,bottom:n}=ku(e),r=`right-[2px] border-card`;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Ou,{position:`top`,segments:t,compact:!0,className:c(r,`top-[3px]`)}),(0,X.jsx)(Ou,{position:`bottom`,segments:n,compact:!0,className:c(r,`top-[24px]`)})]})}function Zu({version:e,latestVersion:t=null}){let{resolvedTheme:n}=Wu(),r=!!(e&&t&&Tu(t,e));return(0,X.jsxs)(`div`,{"data-slot":`drawer-identity`,className:`flex shrink-0 items-center gap-[12px] border-b border-border pt-[env(safe-area-inset-top)] pr-[14px] pb-[14px] pl-[18px]`,children:[(0,X.jsx)(`img`,{src:`/cezarion-mark-${n}.svg`,alt:``,"aria-hidden":`true`,className:`mt-[14px] size-[32px] rounded-lg`}),(0,X.jsx)(`span`,{"data-slot":`drawer-wordmark`,className:`mt-[14px] text-[18px] leading-none font-bold tracking-[-0.02em] text-foreground`,children:`Squawk`}),e?(0,X.jsxs)(`span`,{"data-slot":`drawer-version`,"data-update-available":r?`true`:void 0,title:r?`v${e} — update available: v${t}`:`v${e}`,className:`mt-[14px] min-w-0 truncate text-xs leading-none text-soft-foreground`,children:[r?(0,X.jsx)(J,{tone:`pending`,className:`mr-1 inline-block size-[5px] align-middle`}):null,`v`,e]}):null,(0,X.jsx)($a,{asChild:!0,children:(0,X.jsx)(G,{variant:`ghost`,size:`icon`,"aria-label":`Close menu`,className:`mt-[14px] ml-auto size-[44px] text-foreground`,children:(0,X.jsx)(vr,{className:`size-[19px]`,"aria-hidden":`true`})})})]})}function Qu({project:e,signal:t,known:n,current:r,onNavigate:i}){let{top:a,bottom:o}=ku(t),s=r?`border-sidebar-row-selected`:`border-sidebar`,l=`right-[-4px]`,u=(0,X.jsxs)(H,{to:ba(e.id,`/`),onClick:i,"data-slot":`drawer-project`,"data-project-id":e.id,"aria-current":r?`page`:void 0,className:c(`flex h-[64px] min-w-0 items-center gap-[12px] rounded-[10px] px-[10px] text-foreground hover:bg-sidebar-row-hover focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring`,r&&`flex-1 hover:bg-sidebar-row-selected`),children:[(0,X.jsxs)(`span`,{"aria-hidden":`true`,className:c(`relative flex size-[40px] shrink-0 items-center justify-center rounded-[10px] border text-[13px] leading-none font-semibold`,r?`border-soft-foreground bg-sidebar text-foreground`:`border-transparent bg-muted text-muted-foreground`),children:[fu(e.name),(0,X.jsx)(Ou,{position:`top`,segments:a,className:c(l,s)}),(0,X.jsx)(Ou,{position:`bottom`,segments:o,className:c(l,s,`top-[29px]`)})]}),(0,X.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-[2px]`,children:[(0,X.jsx)(`span`,{className:`truncate text-[14.5px] leading-tight font-semibold`,children:e.name}),(0,X.jsx)(wu,{signal:t,known:n,current:r,slot:`drawer-project-state`,className:`flex-wrap gap-x-[6px] text-xs leading-tight`})]}),r?(0,X.jsx)(mr,{"aria-hidden":`true`,className:`size-[16px] shrink-0 text-foreground`}):null]});return r?(0,X.jsxs)(`div`,{"data-slot":`drawer-project-current`,className:`flex items-center rounded-[10px] bg-sidebar-row-selected pr-[4px]`,children:[u,(0,X.jsx)(xu,{projectId:e.id,onNavigate:i,triggerClassName:`size-[44px]`,align:`end`})]}):u}var $u=`flex h-[48px] w-full items-center gap-[12px] rounded-[10px] px-[10px] text-[14.5px] font-normal text-foreground hover:bg-sidebar-row-hover focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring [&_svg]:size-[18px] [&_svg]:shrink-0 [&_svg]:text-soft-foreground`;function ed({nav:e,currentProjectId:t,onNavigate:n}){return(0,X.jsxs)(`div`,{"data-slot":`drawer-projects`,className:`shrink-0`,children:[(0,X.jsx)(`div`,{className:`px-[18px] pt-[14px] pb-[6px] text-[12px] font-medium text-soft-foreground`,id:`drawer-projects-label`,children:`Projects`}),(0,X.jsx)(`div`,{role:`group`,"data-slot":`drawer-projects-group`,"aria-labelledby":`drawer-projects-label`,className:`flex flex-col gap-[2px] px-[8px] pb-[8px]`,children:e.projects.map(r=>(0,X.jsx)(Qu,{project:r,signal:e.signals?.get(r.id),known:e.signals!==null,current:r.id===t,onNavigate:n},r.id))}),(0,X.jsxs)(`div`,{"data-slot":`drawer-workspace`,className:`flex flex-col gap-[2px] border-t border-border px-[8px] py-[8px]`,children:[(0,X.jsxs)(H,{to:`/tasks`,onClick:n,"data-slot":`drawer-all-projects`,className:$u,children:[(0,X.jsx)(Hr,{"aria-hidden":`true`}),`All projects · task overview`]}),(0,X.jsx)(eu,{origin:`mobile`,icon:Zn,iconClassName:`size-[18px]`,label:`Add project`,triggerClassName:c($u,`h-[48px] justify-start p-0 px-[10px] text-foreground`)})]})]})}function td({onNavigate:e,tools:t}){let{theme:n,setTheme:r}=Wu(),i=Gu[n],a=n.charAt(0).toUpperCase()+n.slice(1);return(0,X.jsxs)(`div`,{"data-slot":`drawer-global`,className:`flex shrink-0 flex-col gap-[2px] border-t border-border px-[8px] pt-[8px] pb-[max(8px,env(safe-area-inset-bottom))]`,children:[t?(0,X.jsxs)(H,{to:`/tools`,onClick:e,"data-slot":`drawer-tools`,"aria-label":t.blocked?`Tools, needs setup`:void 0,"aria-describedby":t.blocked&&t.note?`drawer-tools-note`:void 0,className:c($u,t.note&&`h-auto min-h-[48px] py-[6px]`),children:[(0,X.jsxs)(`span`,{className:`relative flex shrink-0`,children:[(0,X.jsx)(gr,{"aria-hidden":`true`}),t.blocked?(0,X.jsx)(J,{tone:`pending`,"data-slot":`drawer-tools-dot`,className:`absolute -top-[2px] -right-[3px] ring-[1.5px] ring-sidebar`}):null]}),(0,X.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,X.jsx)(`span`,{children:`Tools`}),t.note?(0,X.jsx)(`span`,{id:`drawer-tools-note`,"data-slot":`drawer-tools-note`,className:`text-xs leading-tight text-soft-foreground`,children:t.note}):null]})]}):null,(0,X.jsxs)(H,{to:`/settings/global/appearance`,onClick:e,"data-slot":`drawer-global-settings`,className:$u,children:[(0,X.jsx)(pr,{"aria-hidden":`true`}),`Global settings`]}),(0,X.jsxs)(`button`,{type:`button`,"data-slot":`theme-toggle`,"data-theme-pref":n,"aria-label":`Theme: ${n.toLowerCase()}. Switch to ${i}.`,onClick:()=>r(i),className:$u,children:[(0,X.jsx)(Nr,{"aria-hidden":`true`}),`Theme · `,a]})]})}function nd(e){if(!(e instanceof HTMLElement))return!1;let t=e.tagName;return t===`INPUT`||t===`TEXTAREA`||t===`SELECT`||e.isContentEditable?!0:e.closest(`[contenteditable=""], [contenteditable="true"]`)!==null}function rd(e){return e instanceof HTMLElement&&e.closest(`[cmdk-input]`)!==null}function id(e,t){return!(typeof e.key!=`string`||e.key.toLowerCase()!==t.toLowerCase()||!e.metaKey&&!e.ctrlKey||e.altKey||e.shiftKey||e.repeat||nd(e.target)&&!rd(e.target))}function ad(e,t){let n=Y.useRef(t);Y.useLayoutEffect(()=>{n.current=t}),Y.useEffect(()=>{let t=t=>{id(t,e)&&(t.preventDefault(),n.current(t))};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e])}function od(e,t){return!(typeof e.key!=`string`||e.key.toLowerCase()!==t.toLowerCase()||e.metaKey||e.ctrlKey||e.altKey||e.shiftKey||e.repeat||nd(e.target))}function sd(e,t=typeof navigator>`u`?``:navigator.platform){let n=e.toUpperCase();return/mac|iphone|ipad|ipod/i.test(t)?`⌘${n}`:`Ctrl+${n}`}function cd(e,t){let n=Y.useRef(t);Y.useLayoutEffect(()=>{n.current=t}),Y.useEffect(()=>{let t=t=>{od(t,e)&&n.current(t)};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e])}var ld=e(r(),1),ud=Y.createContext(null);function dd(){return Y.useContext(ud)}function fd({slot:e,children:t}){return(0,ld.createPortal)(t,e)}var pd=`(min-width: 768px)`;function md(){let[e,t]=Y.useState(()=>window.matchMedia?.(pd).matches??!0);return Y.useEffect(()=>{let e=window.matchMedia?.(pd);if(!e)return;let n=()=>t(e.matches);return n(),e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)},[]),e}function hd({delayDuration:e=0,...t}){return(0,X.jsx)(wl,{"data-slot":`tooltip-provider`,delayDuration:e,...t})}function gd({...e}){return(0,X.jsx)(Tl,{"data-slot":`tooltip`,...e})}function _d({...e}){return(0,X.jsx)(El,{"data-slot":`tooltip-trigger`,...e})}function vd({className:e,sideOffset:t=0,children:n,...r}){return(0,X.jsx)(Dl,{children:(0,X.jsxs)(Ol,{"data-slot":`tooltip-content`,sideOffset:t,className:c(`z-50 w-fit origin-(--radix-tooltip-content-transform-origin) motion-safe:animate-in rounded-md bg-contrast px-3 py-1.5 text-xs text-balance text-contrast-foreground fade-in-0 motion-safe:zoom-in-95 motion-safe:data-[side=bottom]:slide-in-from-top-2 motion-safe:data-[side=left]:slide-in-from-right-2 motion-safe:data-[side=right]:slide-in-from-left-2 motion-safe:data-[side=top]:slide-in-from-bottom-2 motion-safe:data-[state=closed]:animate-out data-[state=closed]:fade-out-0 motion-safe:data-[state=closed]:zoom-out-95`,e),...r,children:[n,(0,X.jsx)(kl,{className:`z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] bg-contrast fill-contrast`})]})})}var yd=[`/git`,`/automations`,`/workflows`,`/reports`];function bd({items:e,activeTo:t,needsYou:n=!1,onNavigate:r}){let[i,a]=(0,Y.useState)(!1),o=(0,Y.useRef)(null),s=e.filter(e=>yd.includes(e.to)),l=e.filter(e=>!s.includes(e)),u=s.some(e=>e.to===t);return(0,X.jsx)(hd,{children:(0,X.jsxs)(`nav`,{ref:o,"aria-label":`Main`,"data-slot":`view-tabs`,onKeyDown:e=>{if(![`ArrowLeft`,`ArrowRight`,`Home`,`End`].includes(e.key))return;let t=Array.from(o.current?.querySelectorAll(`[data-view-tab]`)??[]),n=t.indexOf(document.activeElement);n<0||(e.preventDefault(),t[e.key===`Home`?0:e.key===`End`?t.length-1:(n+(e.key===`ArrowRight`?1:-1)+t.length)%t.length]?.focus())},className:`flex shrink-0 items-center justify-between max-md:justify-start max-md:gap-1 max-md:overflow-x-auto border-b border-border px-3 pt-2.5 pb-2`,children:[l.map(e=>{let i=e.to===t,a=e.icon,o=e.to===`/`&&n&&!i;return(0,X.jsxs)(gd,{children:[(0,X.jsx)(_d,{asChild:!0,children:(0,X.jsxs)(q,{to:e.to,onClick:r,"data-view-tab":!0,"aria-label":e.label,"aria-current":i?`page`:void 0,className:c(`relative flex h-[30px] min-w-0 items-center justify-center rounded-[7px] text-soft-foreground hover:bg-sidebar-row-hover hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring max-md:min-h-11 max-md:min-w-11`,i?`shrink-0 gap-1.5 bg-sidebar-row-selected px-[9px] text-[12px] font-semibold text-foreground`:`w-7 shrink-0`),children:[(0,X.jsxs)(`span`,{className:`relative`,children:[(0,X.jsx)(a,{className:`size-[15px] shrink-0`,"aria-hidden":`true`}),o?(0,X.jsx)(`span`,{"aria-label":`Tasks need you`,"data-slot":`nav-needs-you-dot`,className:`absolute -top-1 -right-1 size-[7px] rounded-full border-[1.5px] border-sidebar bg-pending-strong`}):null]}),i?(0,X.jsx)(`span`,{className:`truncate`,children:e.label}):null]})}),(0,X.jsx)(vd,{side:`bottom`,sideOffset:6,style:{pointerEvents:`none`},children:e.label})]},e.to)}),s.length?(0,X.jsxs)(Li,{open:i,onOpenChange:a,children:[(0,X.jsxs)(gd,{children:[(0,X.jsx)(_d,{asChild:!0,children:(0,X.jsx)(Pi,{asChild:!0,children:(0,X.jsx)(`button`,{type:`button`,"data-view-tab":!0,"aria-label":`More views`,"data-active":u?`true`:void 0,className:c(`relative flex h-[30px] w-7 shrink-0 items-center justify-center rounded-[7px] text-soft-foreground hover:bg-sidebar-row-hover hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring max-md:min-h-11 max-md:min-w-11`,(i||u)&&`bg-sidebar-row-selected text-foreground`),children:(0,X.jsx)(Fs,{className:`size-[15px]`,"aria-hidden":`true`})})})}),(0,X.jsx)(vd,{side:`bottom`,sideOffset:6,style:{pointerEvents:`none`},children:`More views`})]}),(0,X.jsx)(Fi,{align:`end`,sideOffset:4,className:`w-48 rounded-[10px] border-border bg-sidebar p-[5px] shadow-[0_10px_28px_#00000047]`,children:s.map(e=>{let n=e.icon,i=e.to===t;return(0,X.jsx)(K,{asChild:!0,className:c(`h-8 max-md:min-h-11 gap-2.5 rounded-md px-[9px] text-[13px] text-foreground focus:bg-sidebar-row-hover`,i&&`bg-sidebar-row-selected font-medium`),children:(0,X.jsxs)(q,{to:e.to,onClick:r,"aria-current":i?`page`:void 0,children:[(0,X.jsx)(n,{className:`size-[15px] text-soft-foreground`}),e.label]})},e.to)})})]}):null]})})}var xd=[{to:`/`,label:`Tasks`,icon:Yn,match:[`/`,`/tasks`],badge:`tasks-unread`},{to:`/activity`,label:`Activity`,icon:Cs,match:[`/activity`]},{to:`/git`,label:`Git`,icon:Jn,match:[`/git`]},{to:`/github`,label:`GitHub`,icon:tr,match:[`/github`],forge:!0},{to:`/automations`,label:`Automations`,icon:jr,match:[`/automations`],automations:!0},{to:`/skills`,label:`Skills`,icon:Ir,match:[`/skills`]},{to:`/workflows`,label:`Workflows`,icon:Rr,match:[`/workflows`]},{to:`/reports`,label:`Reports`,icon:zs,match:[`/reports`]},{to:`/settings`,label:`Settings`,icon:or,match:[`/settings`]}];function Sd({forge:e=!1,automations:t=!1}={}){return xd.filter(n=>(!n.forge||e)&&(!n.automations||t))}function Cd(e,t){return t===`/`?e===`/`:e===t||e.startsWith(t+`/`)}function wd(e){let t=null;for(let n of xd)for(let r of n.match)Cd(e,r)&&(t===null||r.length>t.length)&&(t={to:n.to,length:r.length});return t?.to??null}function Td(e){let t=wd(e);return xd.find(e=>e.to===t)??null}function Ed(e){return/^\/tasks\/[^/]+(?:\/|$)/.test(wa(e))}function Dd(e,t){let n=wa(e);return/^\/git\/?$/.test(n)?new URLSearchParams(t).get(`view`)===`repo`:n.startsWith(`/git/`)}var Od=[`/`,`/activity`,`/github`],kd=[`/git`,`/skills`,`/workflows`,`/reports`,`/settings`,`/automations`];function Ad(e,t,n){let r=wa(e),i=r===`/new`,a=Ed(e);return{activeTo:i?`/new`:wd(r),current:Td(r),currentProjectId:Sa(e),newTask:i,pushed:a,showTabBar:!a&&!Dd(e,t)&&!n,gitRepositoryView:r===`/git`&&new URLSearchParams(t).get(`view`)===`repo`}}var jd=[{to:`/git`,label:`Git`},{to:`/skills`,label:`Skills`},{to:`/workflows`,label:`Workflows`},{to:`/reports`,label:`Reports`},{to:`/settings`,label:`Project settings`}],Md=[`/automations`],Nd=`flex h-[50px] min-h-11 w-full items-center gap-[14px] rounded-[10px] px-[10px] text-[14.5px] text-foreground hover:bg-sidebar-row-hover focus-visible:outline-2 focus-visible:outline-ring [&_svg]:size-[18px] [&_svg]:shrink-0 [&_svg]:text-muted-foreground`;function Pd({open:e,onOpenChange:t,onCloseAutoFocus:n,projectName:r,items:i,activeTo:a}){let o=new Map(i.map(e=>[e.to,e])),s=jd.flatMap(({to:e,label:t})=>{let n=o.get(e);return n?[{to:e,label:t,icon:n.icon}]:[]}),l=Md.flatMap(e=>{let t=o.get(e);return t?[{to:e,label:t.label,icon:t.icon}]:[]}),u=()=>t(!1),d=({to:e,label:t,icon:n})=>{let r=e===a;return(0,X.jsxs)(q,{to:e,onClick:u,"data-slot":`more-row`,"data-more-row":e,"aria-current":r?`page`:void 0,className:c(Nd,r&&`bg-sidebar-row-selected hover:bg-sidebar-row-selected`),children:[(0,X.jsx)(n,{"aria-hidden":`true`}),(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:t}),(0,X.jsx)(Lr,{"aria-hidden":`true`,className:`!size-[15px]`})]},e)};return(0,X.jsx)(eo,{open:e,onOpenChange:t,children:(0,X.jsxs)(ro,{side:`bottom`,"data-slot":`more-sheet`,showCloseButton:!1,onCloseAutoFocus:n,"aria-describedby":void 0,className:`gap-0 rounded-t-[20px] border-border bg-sidebar px-[14px] pt-[10px] pb-[max(14px,env(safe-area-inset-bottom))] md:hidden`,children:[(0,X.jsx)(`div`,{"aria-hidden":`true`,className:`mx-auto mb-[14px] h-[5px] w-[36px] rounded-[3px] bg-border`}),(0,X.jsxs)(`div`,{className:`flex items-baseline gap-[10px] px-[10px] pb-[6px]`,children:[(0,X.jsx)(to,{className:`text-[17px] leading-tight font-bold`,children:`More`}),r?(0,X.jsx)(`span`,{"data-slot":`more-project`,className:`min-w-0 truncate text-[12.5px] text-soft-foreground`,children:r}):null]}),(0,X.jsx)(`div`,{className:`flex flex-col gap-[2px]`,children:s.map(d)}),l.length>0?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`div`,{role:`separator`,className:`mx-[10px] mt-[8px] border-t border-border`}),(0,X.jsx)(`div`,{className:`px-[10px] pt-[12px] pb-[4px] text-[12px] font-medium text-soft-foreground`,children:`Shown when their flag is on`}),(0,X.jsx)(`div`,{className:`flex flex-col gap-[2px]`,children:l.map(d)})]}):null]})})}var Fd=`(min-width: 768px)`;function Id({items:e,activeTo:t,signal:n,projectName:r}){let[i,a]=Y.useState(!1),o=Y.useRef(null),{pathname:s}=hn();Y.useEffect(()=>{a(!1)},[s]),Y.useEffect(()=>{let e=window.matchMedia?.(Fd);if(!e)return;e.matches&&a(!1);let t=e=>{e.matches&&a(!1)};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]);let l=e.filter(e=>Od.includes(e.to)),u=t!==null&&kd.includes(t),{top:d}=ku(n),f=d.some(e=>e.count>0),p=e=>c(`relative flex h-full min-h-11 min-w-11 flex-1 flex-col items-center justify-center gap-[3px] text-xs leading-none focus-visible:outline-2 focus-visible:outline-ring`,e?`font-semibold text-foreground`:`font-medium text-soft-foreground`);return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`nav`,{"aria-label":`Views`,"data-slot":`mobile-tab-bar`,className:`flex h-[54px] items-stretch`,children:[l.map(e=>{let n=e.to===t,r=e.icon,i=e.to===`/`&&f;return(0,X.jsxs)(q,{to:e.to,"data-tab":e.to,"aria-current":n?`page`:void 0,className:p(n),children:[(0,X.jsxs)(`span`,{className:`relative`,children:[(0,X.jsx)(r,{"aria-hidden":`true`,className:`size-[21px]`}),i?(0,X.jsx)(Ou,{position:`top`,segments:d,className:`-top-[6px] -right-[10px] border-sidebar`}):null]}),e.label]},e.to)}),(0,X.jsxs)(`button`,{ref:o,type:`button`,"data-tab":`more`,"aria-haspopup":`dialog`,"aria-expanded":i,"data-active":u?`true`:void 0,onClick:()=>a(!0),className:p(u),children:[(0,X.jsx)(`span`,{className:`relative`,children:(0,X.jsx)(Br,{"aria-hidden":`true`,className:`size-[21px]`})}),`More`]})]}),(0,X.jsx)(Pd,{open:i,onOpenChange:a,onCloseAutoFocus:e=>{o.current?.isConnected&&(e.preventDefault(),o.current.focus())},projectName:r,items:e,activeTo:t})]})}var Ld=`(min-width: 768px)`;function Rd(e){return yn({path:`/tasks/:id`,end:!0},wa(e))!==null}function zd(e){let t=wa(e);return t===`/github`||t.startsWith(`/github/`)}function Bd({children:e,breadcrumb:t,repo:n=null,version:r=null,latestVersion:i=null,sidebarList:a,taskQuickList:o,sessionScope:s,toolsMenu:c,forgeAvailable:l=!0,automationsAvailable:u=!0,banner:d,mobileProjects:f,projectHeader:p,sidebarProjectId:m,needsYou:h,projectRail:g,toolsStatus:_}){let{pathname:v,search:y}=hn(),{activeTo:b,current:x,currentProjectId:S,pushed:C,showTabBar:w,gitRepositoryView:T}=Ad(v,y,oa()),[E,D]=Y.useState(!1),[O,k]=Y.useState(null),A=Y.useRef(null),j=Y.useRef(null),M=Y.useRef(null),ee=Rd(v);Y.useLayoutEffect(()=>{let e=M.current;if(M.current=v,ee||e!==null&&Sa(e)===Sa(v)&&zd(e)&&zd(v))return;let t=j.current;t&&(t.scrollTop=0)},[v,ee,T]);let te=bn(),N=Y.useRef(v);Y.useEffect(()=>{let e=N.current;N.current=v,e!==v&&(te===`REPLACE`&&qd(e,v)||D(!1))},[v,te]),Y.useEffect(()=>{let e=window.matchMedia?.(Ld);if(!e)return;e.matches&&D(!1);let t=e=>{e.matches&&D(!1)};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]);let P=Sd({forge:l,automations:u}),ne={version:r,latestVersion:i};return(0,X.jsx)(eo,{open:E,onOpenChange:D,children:(0,X.jsxs)(`div`,{"data-slot":`app-shell`,className:`flex h-dvh overflow-hidden bg-background text-foreground pl-[env(safe-area-inset-left)] pr-[env(safe-area-inset-right)]`,children:[(0,X.jsx)(Ud,{projectRail:g,activeTo:b,items:P,repo:n,release:ne,sidebarList:a,taskQuickList:o,sessionScope:s,toolsMenu:c,projectHeader:p,sidebarProjectId:m,needsYou:h}),(0,X.jsx)(Kd,{release:ne,taskQuickList:o,sidebarProjectId:m,mobileProjects:f,currentProjectId:S,toolsStatus:_,onNavigate:()=>D(!1),onCloseAutoFocus:e=>{A.current?.isConnected&&(e.preventDefault(),A.current.focus())}}),(0,X.jsxs)(`div`,{className:`group/shell grid min-w-0 flex-1 grid-rows-[auto_auto_1fr_auto] overflow-hidden`,children:[(0,X.jsx)($d,{title:x?.label??`Squawk`,pushed:C?{onSlot:k}:null,repo:n,elsewhere:Ju(f,S),onTrigger:e=>{A.current=e}}),(0,X.jsx)(Vd,{breadcrumb:t,repo:S===null?null:n,label:x?.label}),d?(0,X.jsx)(`div`,{"data-slot":`banner-slot`,className:`row-start-2`,children:d}):null,(0,X.jsx)(`main`,{ref:j,"data-slot":`main`,className:`row-start-3 min-h-0 overflow-y-auto overscroll-contain`,children:(0,X.jsx)(ud.Provider,{value:C?O:null,children:e})}),(0,X.jsx)(Hd,{showTabBar:w,items:P,activeTo:b,mobileProjects:f,currentProjectId:S,repo:n})]})]})})}function Vd({breadcrumb:e,repo:t,label:n}){let r=e?.project??t?.name,i=e?.branch??t?.branch;return(0,X.jsxs)(`header`,{"data-slot":`desktop-breadcrumb`,className:`row-start-1 hidden h-16 min-w-0 items-center gap-3 border-b border-border px-9 text-[13px] text-muted-foreground md:flex`,children:[(0,X.jsx)(cr,{"aria-hidden":`true`,className:`size-4 shrink-0`}),r?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{className:`truncate font-medium text-foreground`,children:r}),(0,X.jsx)(`span`,{"aria-hidden":`true`,children:`/`})]}):null,(0,X.jsx)(`span`,{className:`min-w-0 truncate`,children:e?.page??n??`Squawk`}),i?(0,X.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-2 text-xs`,children:[(0,X.jsx)(qn,{"aria-hidden":`true`,className:`size-4 text-accent-text`}),i]}):null]})}function Hd({showTabBar:e,items:t,activeTo:n,mobileProjects:r,currentProjectId:i,repo:a}){let o=i===null?void 0:r?.signals?.get(i);return(0,X.jsx)(`div`,{"data-slot":`composer`,className:c(`row-start-4 pb-[max(env(safe-area-inset-bottom),var(--kb,0px))]`,e&&`relative max-md:border-t max-md:border-border max-md:bg-sidebar`),children:e?(0,X.jsx)(`div`,{className:`md:hidden`,children:(0,X.jsx)(Id,{items:t,activeTo:n,signal:o,projectName:r?.projects.find(e=>e.id===i)?.name??a?.name??null})}):null})}function Ud({projectRail:e,...t}){let[n,r]=Y.useState(ic),i=Y.useCallback(e=>{let t=rc(e);r(t),ac(t)},[]);return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(oc.Provider,{value:n,children:e}),(0,X.jsx)(Wd,{...t,width:n,onWidthChange:i})]})}function Wd({width:e,onWidthChange:t,...n}){return(0,X.jsxs)(`aside`,{"data-slot":`sidebar`,style:{width:e},className:`relative hidden shrink-0 flex-col border-r border-border bg-sidebar md:flex`,children:[(0,X.jsx)(Yd,{...n}),(0,X.jsx)(Gd,{width:e,onWidthChange:t})]})}function Gd({width:e,onWidthChange:t}){let n=Y.useRef(null),r=t=>{t.button===0&&(n.current={x:t.clientX,width:e},t.currentTarget.setPointerCapture(t.pointerId),t.preventDefault(),t.currentTarget.focus())},i=e=>{let r=n.current;r&&t(rc(r.width+(e.clientX-r.x)))},a=e=>{n.current&&(n.current=null,e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId))};return(0,X.jsx)(`div`,{"data-slot":`sidebar-resize-handle`,role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize the sidebar`,"aria-valuenow":e,"aria-valuemin":264,"aria-valuemax":420,tabIndex:0,onPointerDown:r,onPointerMove:i,onPointerUp:a,onPointerCancel:a,onKeyDown:n=>{let r=n.key===`ArrowLeft`?e-16:n.key===`ArrowRight`?e+16:n.key===`Home`?264:n.key===`End`?420:null;r!==null&&(n.preventDefault(),t(rc(r)))},onDoubleClick:()=>t(264),title:`Drag to resize the sidebar — double-click to reset`,className:`absolute inset-y-0 -right-[2px] z-20 w-[5px] cursor-col-resize touch-none bg-transparent transition-colors hover:bg-[var(--composer-border)] focus-visible:bg-[var(--composer-border)] focus-visible:outline-none`})}function Kd({onNavigate:e,onCloseAutoFocus:t,mobileProjects:n,currentProjectId:r,toolsStatus:i,release:a,taskQuickList:o,sidebarProjectId:s}){return(0,X.jsxs)(ro,{side:`left`,"data-slot":`mobile-nav-drawer`,onCloseAutoFocus:t,overlayClassName:`bg-[var(--nav-scrim)]`,showCloseButton:!1,className:`w-[calc(100%-68px)] max-w-[334px] gap-0 border-border bg-sidebar p-0 sm:max-w-[334px] md:hidden`,"aria-describedby":void 0,children:[(0,X.jsx)(to,{className:`sr-only`,children:`Navigation`}),(0,X.jsx)(Zu,{version:a.version,latestVersion:a.latestVersion}),(0,X.jsxs)(`div`,{"data-slot":`drawer-scroll`,className:`flex min-h-0 flex-1 flex-col overflow-y-auto overscroll-contain`,children:[n?(0,X.jsx)(ed,{nav:n,currentProjectId:r,onNavigate:e}):null,o?(0,X.jsx)(Jd,{projectId:s,onNavigate:e,children:(0,X.jsx)(`div`,{"data-slot":`drawer-tasks`,className:`border-t border-border px-[8px] py-[8px]`,children:o})}):null]}),(0,X.jsx)(td,{onNavigate:e,tools:i})]})}function qd(e,t){return Sa(e)==="default"&&Sa(t)!==null&&Sa(t)!=="default"&&wa(e)===wa(t)}function Jd({projectId:e,onNavigate:t,children:n}){let r=bt(),i=e===void 0?r:{projectId:e,apiBase:`${o}/p/${encodeURIComponent(e)}`};return(0,X.jsx)(Ut.Provider,{value:i,children:(0,X.jsx)(sc.Provider,{value:t,children:n})})}function Yd({activeTo:e,items:t,repo:n,release:r,sidebarList:i,taskQuickList:a,sessionScope:o,toolsMenu:s,projectHeader:l,sidebarProjectId:u,needsYou:d,onNavigate:f}){return(0,X.jsx)(Jd,{projectId:u,onNavigate:f,children:(0,X.jsxs)(`div`,{"data-slot":`sidebar-content`,className:`@container/sidebar flex min-h-0 flex-1 flex-col pt-[env(safe-area-inset-top)] pb-[env(safe-area-inset-bottom)]`,children:[(0,X.jsx)(`div`,{"data-slot":`sidebar-header`,className:`shrink-0`,children:l??(n?(0,X.jsxs)(`div`,{className:`px-[14px] pt-[14px] pb-2.5`,children:[(0,X.jsx)(`div`,{className:`truncate text-sm font-semibold`,children:n.name}),(0,X.jsx)(`div`,{className:`truncate font-mono text-xs text-soft-foreground`,children:n.branch})]}):null)}),(0,X.jsxs)(`div`,{"data-slot":`sidebar-actions`,className:`flex flex-col gap-2 px-3`,children:[(0,X.jsx)(Zd,{}),(0,X.jsx)(G,{asChild:!0,variant:`ghost`,className:c(`relative h-[32px] max-md:min-h-11 rounded-[7px] bg-muted w-full min-w-0 justify-start gap-2 px-2.5 text-[12.5px] font-medium text-foreground hover:bg-sidebar-row-hover hover:text-foreground`,e===`/new`&&`bg-sidebar-row-selected text-foreground font-medium hover:bg-sidebar-row-selected`),children:(0,X.jsxs)(q,{to:`/new`,onClick:f,"data-sidebar-item":`new-task`,"aria-current":e===`/new`?`page`:void 0,children:[(0,X.jsx)(nr,{className:`size-[15px]`,"aria-hidden":`true`}),`New task`,(0,X.jsx)(`kbd`,{"aria-hidden":`true`,className:`sr-only`,children:`C`})]})})]}),o?(0,X.jsx)(`div`,{className:`shrink-0 px-3 pt-2`,children:o}):null,(0,X.jsx)(bd,{items:t,activeTo:e,needsYou:d,onNavigate:f}),(0,X.jsx)(`div`,{"data-slot":`project-task-navigation`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain p-3`,children:(0,X.jsx)(sc.Provider,{value:f,children:i??(0,X.jsx)(`div`,{"data-slot":`task-quick-list`,children:a})})}),(0,X.jsx)(Xd,{toolsMenu:s,release:r})]})})}function Xd({toolsMenu:e,release:t}){return(0,X.jsx)(`div`,{"data-slot":`sidebar-footer`,className:`shrink-0`,children:(0,X.jsxs)(`div`,{"data-slot":`sidebar-footer-controls`,className:`flex h-11 items-center justify-between gap-1 border-t border-border px-3`,children:[(0,X.jsx)(`div`,{"data-slot":`tools-menu`,className:`shrink-0`,children:e}),(0,X.jsx)(`div`,{className:`flex min-w-0 items-center gap-1`,"data-slot":`version-action`,children:t.version?(0,X.jsx)(Qd,{version:t.version,latestVersion:t.latestVersion}):null})]})})}function Zd(){return(0,X.jsxs)(`button`,{type:`button`,"data-slot":`command-palette-hint`,title:`Search — command palette (⌘K / Ctrl+K)`,onClick:()=>tc(),className:`flex h-[32px] max-md:min-h-11 w-full items-center gap-2 rounded-[7px] border border-border bg-background px-2.5 text-left text-[12.5px] font-normal text-soft-foreground transition-colors hover:border-border hover:text-foreground`,children:[(0,X.jsx)(fr,{className:`size-[14px] shrink-0`,"aria-hidden":`true`}),(0,X.jsx)(`span`,{className:`truncate`,children:`Search…`}),(0,X.jsx)(`kbd`,{"aria-hidden":`true`,className:`ml-auto shrink-0 font-sans text-xs font-normal text-soft-foreground`,children:sd(`k`)})]})}function Qd({version:e,latestVersion:t}){let n=!!(t&&Tu(t,e));return(0,X.jsxs)(`span`,{"data-slot":`version-chip`,"data-update-available":n?`true`:void 0,title:n?`v${e} — update available: v${t}`:`v${e}`,className:`flex min-w-0 items-center gap-1 font-mono text-xs text-soft-foreground`,children:[n?(0,X.jsx)(J,{tone:`pending`,className:`size-[5px] shrink-0`}):null,(0,X.jsxs)(`span`,{className:`truncate`,children:[`v`,e]})]})}function $d({title:e,pushed:t,repo:n,elsewhere:r,onTrigger:i}){return t?(0,X.jsx)(ef,{onSlot:t.onSlot}):(0,X.jsx)(`header`,{"data-slot":`mobile-top-bar`,className:`row-start-1 min-w-0 border-b border-border bg-card pt-[env(safe-area-inset-top)] md:hidden`,children:(0,X.jsxs)(`div`,{className:`flex h-[56px] min-w-0 items-center gap-[8px] px-[8px]`,children:[(0,X.jsx)(oo,{asChild:!0,children:(0,X.jsxs)(G,{variant:`ghost`,"aria-label":Yu(r),onClick:e=>i(e.currentTarget),className:`relative h-[44px] w-[64px] shrink-0 justify-start rounded-md p-0 pl-[10px] text-foreground`,children:[(0,X.jsx)(ur,{className:`size-[20px]`,"aria-hidden":`true`}),(0,X.jsx)(Xu,{elsewhere:r})]})}),n?(0,X.jsx)(oo,{asChild:!0,children:(0,X.jsxs)(`button`,{type:`button`,"data-slot":`mobile-project-picker`,"aria-label":`Switch project: ${n.name}`,onClick:e=>i(e.currentTarget),className:`flex h-[44px] min-w-0 flex-1 items-center justify-start gap-[10px] rounded-md text-left focus-visible:outline-2 focus-visible:outline-ring`,children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`flex size-[28px] shrink-0 items-center justify-center rounded-[8px] border border-soft-foreground bg-sidebar-row-selected text-xs leading-none font-semibold text-foreground`,children:fu(n.name)}),(0,X.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,X.jsx)(`span`,{className:`truncate text-[15px] leading-tight font-semibold text-foreground`,children:n.name}),n.branch?(0,X.jsx)(`span`,{className:`truncate font-mono text-xs leading-tight text-soft-foreground`,children:n.branch}):null]}),(0,X.jsx)(Tr,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-soft-foreground`})]})}):null,e===`Squawk`?n?null:(0,X.jsx)(`span`,{className:`flex-1`}):(0,X.jsx)(`span`,{"data-slot":`mobile-route-title`,className:c(`truncate text-[15px] font-semibold text-foreground`,n?`sr-only`:`min-w-0 flex-1 pl-[8px]`),children:e}),(0,X.jsx)(G,{variant:`ghost`,"aria-label":`Search`,"data-slot":`mobile-search`,onClick:()=>tc(),className:`ml-auto size-[44px] shrink-0 p-0 text-foreground`,children:(0,X.jsx)(fr,{className:`size-[19px]`,"aria-hidden":`true`})})]})})}function ef({onSlot:e}){let t=xa();return(0,X.jsx)(`header`,{"data-slot":`mobile-top-bar`,"data-mode":`task`,className:`row-start-1 min-w-0 border-b border-border bg-card pt-[env(safe-area-inset-top)] md:hidden`,children:(0,X.jsxs)(`div`,{className:`flex min-h-[56px] min-w-0 items-center gap-[4px] px-[8px] py-2`,children:[(0,X.jsx)(G,{variant:`ghost`,"aria-label":`Back`,"data-slot":`mobile-back`,onClick:()=>{let e=window.history.state?.idx;t(typeof e==`number`&&e>0?-1:`/`)},className:`size-[44px] shrink-0 p-0 text-foreground`,children:(0,X.jsx)(Ds,{className:`size-[22px]`,"aria-hidden":`true`})}),(0,X.jsx)(`div`,{"data-slot":`mobile-run-bar`,ref:e,className:`flex min-w-0 flex-1 items-center gap-[4px]`})]})})}function tf(e,t){let n=typeof e==`string`?new URLSearchParams(e):e,r=n.get(`runner`),i=r!==null&&(t?.runners.some(e=>e.id===r)??!1),a=n.get(`skillPath`);return{skill:(n.get(`skill`)??``).trim(),...a?{skillPath:a}:{},...i?{runner:r}:{},...n.has(`account`)?{account:n.get(`account`)}:{},ref:(n.get(`ref`)??n.get(`task`)??``).trim()}}function nf(e){let t=new URLSearchParams;e.skill&&t.set(`skill`,e.skill),e.skillPath!==void 0&&t.set(`skillPath`,e.skillPath),e.runner&&t.set(`runner`,e.runner),e.account!==void 0&&t.set(`account`,e.account),e.ref&&t.set(`ref`,e.ref);let n=t.toString();return n?`/new?${n}`:`/new`}var rf=`cez-last-location`;function af(){try{let e=localStorage.getItem(rf);return e===null?null:JSON.parse(e)}catch{return null}}function of(e){try{localStorage.setItem(rf,JSON.stringify(e))}catch{}}var sf=new Set([`projectId`,`pathname`,`search`,`hash`]);function cf(e){return typeof e!=`string`||e.length<1||e.length>64?null:e}function lf(e){return typeof e!=`string`||e.length<1||e.length>2048||!e.startsWith(`/p/`)?null:e}function uf(e){return e!==void 0&&(typeof e!=`string`||e.length>4096||!e.startsWith(`?`))?null:e}function df(e){return e!==void 0&&(typeof e!=`string`||e.length>2048||!e.startsWith(`#`))?null:e}function ff(e){if(typeof e!=`object`||!e||Array.isArray(e))return null;let t=e;if(Object.keys(t).some(e=>!sf.has(e)))return null;let n=cf(t.projectId);if(n===null)return null;let r=lf(t.pathname);if(r===null)return null;let i=uf(t.search);if(i===null)return null;let a=df(t.hash);if(a===null)return null;try{if(Sa(r)!==n)return null}catch{return null}return{projectId:n,pathname:r,...i===void 0?{}:{search:i},...a===void 0?{}:{hash:a}}}function pf(e,t){let n=t.projects.find(t=>t.id===e);return n!==void 0&&n.status!==`missing`}function mf(e,t){if(t===void 0)return null;let n;try{n=Sa(e.pathname)}catch{return null}return n===null||!pf(n,t)?null:ff({projectId:n,pathname:e.pathname,...e.search===``?{}:{search:e.search},...e.hash===``?{}:{hash:e.hash}})}function hf(e,t,n){let r=ff(e);return r===null||!(t===void 0?n!==void 0&&r.projectId===n:pf(r.projectId,t))?null:`${r.pathname}${r.search??``}${r.hash??``}`}function gf(e,t){let n=ff(e);return n!==null&&n.projectId===t.projectId&&n.pathname===t.pathname&&(n.search??``)===(t.search??``)&&(n.hash??``)===(t.hash??``)}var _f=`cez-project-locations`;function vf(){try{let e=localStorage.getItem(_f),t=e===null?null:JSON.parse(e);return typeof t==`object`&&t&&!Array.isArray(t)?t:{}}catch{return{}}}function yf(e){let t=vf()[e];return t===void 0?null:t}function bf(e){try{localStorage.setItem(_f,JSON.stringify({...vf(),[e.projectId]:e}))}catch{}}function xf(e,t,n){let r=ff(t);return r===null||r.projectId!==e||n===void 0||!pf(e,n)?null:`${r.pathname}${r.search??``}${r.hash??``}`}var Sf=2500,Cf=e=>String(ba(e,`/`));function wf(e,t,n){let r={href:Cf(e),verify:!1},i=xf(e,t,n.registry);if(i===null)return r;try{let e=i.replace(/[?#].*$/,``),t=n.matchRoute(e);return t===null?r:{href:i,verify:Object.keys(t.params).some(e=>e!==`projectId`)}}catch{return r}}var Tf=e=>St(we(e.params.id??``,{projectId:e.opts.projectId}),{signal:e.opts.signal});function Ef(e){let t=Number(e);return Number.isSafeInteger(t)&&t>=1?t:null}async function Df(e,t,n){let r=await Bt(e,t,{},n.opts);return r.available?r.item!==null:null}var Of=async e=>(await Tf(e),!0),kf=async e=>(await Tf(e),await ft(e.params.id??``,e.params.sha??``,e.opts),!0);async function Af(e,t){let n=await Tf(e),r=Ef(e.params.n);return r===null?!1:Bn(n,e.repoBase).some(e=>e.kind===t&&e.number===r)?Df(t,r,e):e.repoBase===void 0&&null}var jf=async e=>(await Ie(e.params.sha??``,e.opts),!0);async function Mf(e,t){let n=Ef(e.params.n);return n!==null&&Df(t,n,e)}var Nf=[{matches:e=>e===`/tasks/:id/commits/:sha`,check:kf},{matches:e=>e===`/tasks/:id/issue/:n`,check:e=>Af(e,`issue`)},{matches:e=>e===`/tasks/:id/pr/:n`,check:e=>Af(e,`pr`)},{matches:e=>e.startsWith(`/tasks/:id`),check:Of},{matches:e=>e===`/git/commits/:sha`,check:jf},{matches:e=>e===`/github/issues/:n`,check:e=>Mf(e,`issue`)},{matches:e=>e.startsWith(`/github/prs/:n`),check:e=>Mf(e,`pr`)},{matches:e=>e===`/workflows/:name`,check:async e=>{let{workflows:t,issues:n}=await Re(e.opts);return t.some(t=>t.name===e.params.name)?!0:n.length>0&&null}},{matches:e=>e.startsWith(`/automations/:automationId`),check:async e=>{let t=await Zt(e.opts);return t.available?t.automations.some(t=>t.id===e.params.automationId):null}}];async function Pf(e,t,n,r,i){let a=``;try{let o=i(t);if(o===null)return!1;a=o.pattern;let s=Nf.find(e=>e.matches(o.pattern));return s===void 0?null:await s.check({projectId:e,pattern:a,params:o.params,repoBase:r,opts:{projectId:e,signal:n}})}catch(e){return!If(e,a)&&null}}var Ff=/unknown revision|bad object|bad revision|unknown commit|not a commit hash|needed a single revision/i;function If(e,t){return e instanceof Ge?e.status===404||(t===`/git/commits/:sha`||t===`/tasks/:id/commits/:sha`)&&e.status===409&&Ff.test(e.message):!1}async function Lf(e,t,n){let r=wf(e,t,n);if(!r.verify)return r.href;let i=new AbortController,a=setTimeout(()=>i.abort(),Sf);try{return await Pf(e,r.href.replace(/[?#].*$/,``),i.signal,n.repoBaseOf?.(e),n.matchRoute)===!1?Cf(e):r.href}finally{clearTimeout(a)}}var Rf={key:``,navigate:null,ticket:0};function zf(e,t){e!==Rf.key&&Rf.ticket++,Rf.key=e,Rf.navigate=t}function Bf(){Rf.ticket++}async function Vf(e,t,n){let r=++Rf.ticket,i=Rf.key,a=await Lf(e,t,n);r===Rf.ticket&&i===Rf.key&&Rf.navigate?.(a)}function Hf(){let e=xn(),t=hn();Y.useLayoutEffect(()=>{zf(`${t.key}|${t.pathname}${t.search}${t.hash}`,e)},[e,t.key,t.pathname,t.search,t.hash])}function Uf(){let e=Y.useContext(xs);if(e===null)throw Error(`useProjectSwitch needs a ProjectRouteMatcherContext provider (App provides matchProjectRoute)`);let t=T().data,n=ke().data,r=Y.useCallback(e=>t?.projects.find(t=>t.id===e)?.repoUrl??(e===(n?.bootProject??t?.bootProject)?D(n?.repo?.remote):void 0),[t,n]);Hf();let{pathname:i,search:a,hash:o}=hn(),s=Sa(i),c=`${i}${a}${o}`;return{target:Y.useCallback(n=>n===s?{href:c,verify:!1}:wf(n,yf(n),{registry:t,matchRoute:e}),[t,e,s,c]),go:Y.useCallback(async n=>{if(n===s)return Bf();await Vf(n,yf(n),{registry:t,repoBaseOf:r,matchRoute:e})},[t,r,e,s])}}function Wf(e){return e?.capabilities?.automations===!0}function Gf(){let e=ke().data,t=(0,Y.useRef)(void 0);(0,Y.useEffect)(()=>{e&&(t.current=e)},[e]);let n=e??t.current;return n?Wf(n)?`available`:`unavailable`:`unknown`}function Kf(){return Gf()===`available`}function qf(e){return e.slice(0,8)}function Jf(e){if(!e)return;let t=new Date(e);return Number.isNaN(t.getTime())?void 0:t.toLocaleString()}function Yf({sha:e,variant:t=`chip`,prefix:n,className:r,...i}){let a=e.slice(0,8);return(0,X.jsx)(`span`,{"data-slot":`sha`,title:e,className:c(`font-mono tabular-nums`,t===`chip`?`shrink-0 rounded-sm border border-border bg-card px-1.5 py-px text-xs text-muted-foreground`:`select-all`,r),...i,children:n?`${n}${a}`:a})}function Xf({stat:e,compact:t=!1,className:n}){return(0,X.jsx)(so,{stat:e,compact:t,className:n})}function Zf({value:e,variant:t=`plain`,className:n,...r}){return(0,X.jsx)(`span`,{"data-slot":`count`,className:c(`tabular-nums`,t===`badge`&&`rounded-full bg-muted px-1.5 text-xs leading-[18px] font-medium text-muted-foreground`,t===`accent`&&`rounded-full bg-accent-strong/20 px-1.5 text-xs leading-[18px] font-semibold`,n),...r,children:e})}function Qf({iso:e,now:t,ago:n=!1,prefix:r,fallback:i=``,title:a,className:o,...s}){let l=co(e,t),u=l?n?fo(l):l:i;return u?(0,X.jsx)(`time`,{"data-slot":`relative-time`,dateTime:e,title:a??Jf(e),className:c(`tabular-nums`,o),...s,children:r?`${r}${u}`:u}):null}function $f({value:e,variant:t=`inline`,wrap:n=!1,className:r,...i}){return(0,X.jsx)(`span`,{"data-slot":`path`,title:e,className:c(`font-mono`,t===`chip`?`block max-w-full truncate rounded-[6px] bg-muted px-1.5 py-0.5 text-xs font-medium text-muted-foreground`:n?`break-all`:`block min-w-0 truncate`,r),...i,children:e})}var ep={category:`archive`,label:`Archived`,tone:`neutral`,shape:`filled`,pulse:!1},tp={category:`capability`,label:`Dry run`};function np(e){return e&&e.charAt(0).toUpperCase()+e.slice(1)}var rp={"needs-permission":`Needs permission`,failed:`Failed`,"needs-you":`Needs you`,"needs-review":`Needs review`,running:`Running`,"usage-limit":`Usage limit`,"waiting-on-workers":`Waiting for workers`,"waiting-on-subagents":`Waiting for subagents`,"waiting-for-ci":`Waiting for CI`,"waiting-for-merge":`Waiting for merge`,"waiting-for-command":`Waiting for command`,monitoring:`Monitoring`,"waiting-for-capacity":`Waiting for capacity`,queued:`Queued`,done:`Done`,cancelled:`Cancelled`,unseen:`Unseen`},ip={"needs-permission":`attention`,"needs-you":`attention`,"needs-review":`review`,failed:`execution`,running:`execution`,"usage-limit":`execution`,"waiting-on-workers":`execution`,"waiting-on-subagents":`execution`,"waiting-for-ci":`execution`,"waiting-for-merge":`execution`,"waiting-for-command":`execution`,monitoring:`execution`,"waiting-for-capacity":`execution`,queued:`execution`,done:`execution`,cancelled:`execution`,unseen:`attention`};function ap(e,t,n){return e===`usage-limit`&&n===`provider-error`?`Provider error`:e===`waiting-on-workers`&&t?np(t.replace(/^waiting on\b/i,`Waiting for`)):e===`waiting-on-subagents`&&t||e===`monitoring`&&t&&t.toLowerCase()!==`monitoring`?np(t):rp[e]}function op(e,t){let n=t??Pe(e);return{category:ip[n.rung],label:ap(n.rung,n.label,e.autoResumeReason),tone:n.tone,shape:n.shape,pulse:n.pulse}}function sp(e,t){let n=Nt(e);return{category:ip[e],label:ap(e,t??n.label),tone:n.tone,shape:n.shape,pulse:n.pulse}}var cp={waiting:{category:`execution`,label:`Waiting`,tone:`pending`,shape:`ring`,pulse:!1},review:sp(`needs-review`),running:sp(`running`),queued:sp(`queued`),done:sp(`done`),failed:sp(`failed`),cancelled:sp(`cancelled`)};function lp(e){return cp[e]}function up(e){return lp(e).label}var dp={waiting:{category:`execution`,label:`Scheduled`,tone:`running`,shape:`ring`,pulse:!1},paused:{category:`execution`,label:`Paused`,tone:`neutral`,shape:`filled`,pulse:!1},failed:{category:`execution`,label:`Failed`,tone:`danger`,shape:`filled`,pulse:!1},missed:{category:`attention`,label:`Missed`,tone:`pending`,shape:`filled`,pulse:!1},archived:ep};function fp(e){return e.schedule?.type===`once`?dp[e.onceStatus??(e.enabled?`waiting`:`paused`)]:e.enabled?{category:`execution`,label:`Enabled`,tone:`success`,shape:`filled`,pulse:!1}:{category:`execution`,label:`Paused`,tone:`neutral`,shape:`filled`,pulse:!1}}var pp=/DRY_RUN=1\b/;function mp(e){return e!==void 0&&pp.test(e)}var hp=new Set([`git`]);function gp(e){return mp(e.version)?{availability:{category:`capability`,label:`Simulated`,tone:`neutral`,shape:`ring`,pulse:!1},mode:tp,rawVersion:e.version}:e.available?{availability:{category:`capability`,label:`Installed`,tone:`success`,shape:`filled`,pulse:!1},version:e.version,rawVersion:e.version}:{availability:{category:`capability`,label:`Not installed`,tone:hp.has(e.name)?`danger`:`neutral`,shape:`filled`,pulse:!1},rawVersion:e.version}}var _p={connected:{category:`capability`,label:`Connected`,tone:`success`,shape:`filled`,pulse:!1},disconnected:{category:`capability`,label:`Not connected`,tone:`pending`,shape:`filled`,pulse:!1},"not-installed":{category:`capability`,label:`Not installed`,tone:`neutral`,shape:`filled`,pulse:!1},unknown:{category:`capability`,label:`Could not verify`,tone:`danger`,shape:`filled`,pulse:!1}};function vp(e){return _p[e]}function yp(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:{}}function bp(){let e=z(),t=x(),n=Y.useRef(0),r=Y.useRef(Promise.resolve()),i=Y.useMemo(()=>To(t.data?.sidebar?.projectOrder),[t.data?.sidebar?.projectOrder]),a=Y.useCallback(t=>{let i=e.getQueryData(h.uiState);if(i===void 0)return;let{projectOrder:a,...o}=yp(i.sidebar),s=t===null?o:{...o,projectOrder:t};e.setQueryData(h.uiState,{...i,sidebar:s});let c=++n.current,l=r.current.then(async()=>{let t=await Ct({sidebar:s},{keepalive:!0});c===n.current&&e.setQueryData(h.uiState,t)});r.current=l.catch(t=>{B(t instanceof Error?t.message:String(t),{tone:`danger`}),c===n.current&&e.invalidateQueries({queryKey:h.uiState})})},[e]),o=Y.useCallback(e=>{let t=To(e);t.length===0||!Eo(e.length)||a(t)},[a]),s=Y.useCallback(()=>a(null),[a]);return{order:i,canReorder:t.data!==void 0,setOrder:o,reset:s}}function xp(e){return[...e].sort((e,t)=>Date.parse(t.createdAt)-Date.parse(e.createdAt))}function Sp(e,t,n){let r=t.trim().toLowerCase();if(r===``)return 1;let i=(n?.length?`${e} ${n.join(` `)}`:e).toLowerCase(),a=r.split(/\s+/),o=0;for(let e of a){let t=i.indexOf(e);if(t===-1)return 0;let n=t===0||!/[a-z0-9]/.test(i[t-1]??``);o+=(n?1:.5)/(1+t/48)}return o/a.length}function Cp(e,t){if(t.trim()===``)return e;let n=e=>e.rows.reduce((e,n)=>Math.max(e,Sp(n.value,t,n.keywords)),0);return e.map(e=>({group:e,score:n(e)})).sort((e,t)=>t.score-e.score).map(({group:e})=>e)}function wp(e,t){return{value:`task ${La(e)} ${e.id}`,keywords:[...t?[t]:[],...jp(e),...[e.branch,e.workflow,e.workflowLabel,e.pullRequestUrl,e.referencedPullRequestUrl,e.referencedIssueUrl].filter(e=>!!e)]}}var Tp=e=>({value:`view ${e}`}),Ep=e=>({value:`project ${e.name} ${e.id}`,keywords:[e.root]}),Dp=e=>({value:`skill ${e.id} ${e.name} ${e.path??``}`,...s({keywords:e.description?[e.description]:void 0})}),Op={value:`action toggle theme`},kp=150;function Ap(e,t,n,r=[]){let i=xp(e.filter(e=>!Wa(e))).map(e=>({...e,projectId:t})),a=new Set(i.map(Mp)),o=[...n??[],...r].filter(e=>Wa(e)||a.has(Mp(e))?!1:(a.add(Mp(e)),!0)).sort((e,t)=>t.createdAt.localeCompare(e.createdAt));return[...i,...o]}function jp(e){let t=new Set;for(let n of[e.pullRequestUrl,e.referencedPullRequestUrl,e.referencedIssueUrl]){let e=n?/\/(\d+)\/?$/.exec(n):null;e&&t.add(Number(e[1]))}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);return[...t].flatMap(e=>[String(e),`#${e}`])}var Mp=e=>`${e.projectId??``}/${e.id}`;function Np(e){let t=e.filter(e=>Za(e)).sort((e,t)=>(t.finishedAt??``).localeCompare(e.finishedAt??``)),n=new Set(t.map(Mp));return{recentlyFinished:t,otherTasks:e.filter(e=>!n.has(Mp(e)))}}function Pp(e,t,n=[]){let r=wo(e,n);return[...r.filter(e=>e.id!==t),...r.filter(e=>e.id===t)]}function Fp(){let[e,t]=Y.useState(!1),n=xa();ad(`k`,()=>t(e=>!e));let r=Y.useCallback(()=>{t(!1),n(`/new`)},[n]);return ad(`n`,r),cd(`c`,r),Y.useEffect(()=>{let e=()=>t(!0);return window.addEventListener(ec,e),()=>window.removeEventListener(ec,e)},[]),(0,X.jsx)(yo,{open:e,onOpenChange:t,title:`Command palette`,description:`Search projects, tasks, views, actions, and skills`,showCloseButton:!1,filter:Sp,className:`top-[10vh] translate-y-0 sm:max-w-2xl lg:max-w-3xl xl:max-w-4xl`,children:(0,X.jsx)(Up,{close:()=>t(!1)})})}function Ip({heading:e,tasks:t,projectName:n,showProject:r,now:i,onSelect:a}){return(0,X.jsx)(_o,{heading:e,children:t.map(e=>(0,X.jsx)(Lp,{task:e,projectName:n(e),showProject:r,now:i,onSelect:a},Mp(e)))})}function Lp({task:e,projectName:t,showProject:n,now:r,onSelect:i}){let a=op(e,Pe(e)),o=La(e);return(0,X.jsxs)(bo,{...wp(e,t),"data-slot":`palette-task`,"data-run-id":e.id,"data-project-id":e.projectId??void 0,onSelect:()=>i(e),children:[(0,X.jsx)(J,{tone:a.tone,shape:a.shape,pulse:a.pulse,"aria-label":a.label,role:`img`}),e.delegation?.role===`worker`?(0,X.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:`Worker`}):null,(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:o}),n&&t?(0,X.jsx)(`span`,{"data-slot":`palette-task-project`,className:`shrink-0 truncate text-xs text-soft-foreground`,children:t}):null,(0,X.jsx)(Qf,{iso:e.finishedAt??e.createdAt,now:r,className:`shrink-0 text-xs text-soft-foreground`})]})}function Rp({multiProject:e,health:t}){return[...e?[{label:`All tasks`,to:`/tasks`,icon:Hr,global:!0}]:[],...Sd({forge:t.data?.forge?.available===!0,automations:Wf(t.data)}).map(e=>({label:e.label,to:e.to,icon:e.icon,global:!1}))]}function zp({views:e,go:t,goGlobal:n,orderedProjects:r,activeProjectId:i,goProject:a,otherTasks:o,searching:s,taskProjectName:c,showProjectOnTasks:l,now:u,selectTask:d,orderedSkills:f,skillRunner:p,theme:m,nextTheme:h,setTheme:g,close:_}){let v=[{rows:e.map(e=>Tp(e.label)),node:(0,X.jsx)(_o,{heading:`Views`,children:e.map(e=>{let r=e.icon;return(0,X.jsxs)(bo,{...Tp(e.label),"data-slot":`palette-view`,"data-nav-to":e.to,onSelect:()=>e.global?n(e.to):t(e.to),children:[(0,X.jsx)(r,{"aria-hidden":`true`}),e.label]},e.to)})},`views`)}];return r.length>0&&v.push({rows:r.map(Ep),node:(0,X.jsx)(_o,{heading:`Projects`,children:r.map(e=>{let t=e.id===i,n=e.status===`missing`;return(0,X.jsxs)(bo,{...Ep(e),"data-slot":`palette-project`,"data-project-id":e.id,disabled:n,onSelect:()=>a(e.id),children:[(0,X.jsx)(Qn,{"aria-hidden":`true`}),(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.name}),n?(0,X.jsx)(`span`,{className:`shrink-0 text-xs text-soft-foreground`,children:`folder not found`}):e.branch===void 0?null:(0,X.jsx)(`span`,{className:`shrink-0 font-mono text-xs text-soft-foreground`,children:e.branch}),t?(0,X.jsx)(mr,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-link-foreground`}):null]},e.id)})},`projects`)}),o.length>0&&v.push({rows:s?o.map(e=>wp(e,c(e))):[],node:(0,X.jsx)(Ip,{heading:`Tasks`,tasks:o,projectName:c,showProject:l,now:u,onSelect:d},`tasks`)}),v.push({rows:[Op],node:(0,X.jsx)(_o,{heading:`Actions`,children:(0,X.jsxs)(bo,{...Op,"data-slot":`palette-action`,"data-action":`toggle-theme`,onSelect:()=>{g(h),_()},children:[(0,X.jsx)(Nr,{"aria-hidden":`true`}),`Toggle theme`,(0,X.jsxs)(vo,{className:`tracking-normal`,children:[m,` → `,h]})]})},`actions`)}),f.length>0&&v.push({rows:f.map(Dp),node:(0,X.jsx)(_o,{heading:`Skills`,children:f.map(e=>(0,X.jsxs)(bo,{...Dp(e),"data-slot":`palette-skill`,"data-skill":e.id,onSelect:()=>t(nf({skill:e.id,skillPath:e.path,runner:p})),children:[(0,X.jsx)(`span`,{className:`shrink-0 font-medium`,children:e.name}),e.path?(0,X.jsx)(`span`,{className:`min-w-0 truncate text-xs`,children:e.path}):null,e.description?(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null]},JSON.stringify([e.id,e.path])))},`skills`)}),v}function Bp({search:e,setSearch:t}){return(0,X.jsx)(ho,{placeholder:`Search projects, tasks, views, actions, skills…`,value:e,onValueChange:t})}function Vp({search:e,searching:t,recentlyFinished:n,groups:r,taskProjectName:i,showProjectOnTasks:a,now:o,selectTask:s,go:c}){return(0,X.jsxs)(So,{className:`max-h-[55vh] min-h-[14rem] sm:max-h-[60vh] lg:max-h-[68vh]`,children:[(0,X.jsx)(xo,{children:`Nothing matches.`}),(0,X.jsx)(_o,{children:(0,X.jsxs)(bo,{value:`new task`,"data-slot":`palette-view`,"data-nav-to":`/new`,onSelect:()=>c(`/new`),children:[(0,X.jsx)(nr,{"aria-hidden":`true`}),`New task`,(0,X.jsx)(vo,{children:`C`})]})}),!t&&n.length>0?(0,X.jsx)(Ip,{heading:`Recently finished`,tasks:n,projectName:i,showProject:a,now:o,onSelect:s}):null,Cp(r,e).map(e=>e.node)]})}function Hp({cappedProjects:e}){return e.length===0?null:(0,X.jsxs)(`p`,{"data-slot":`palette-search-truncated`,role:`status`,className:`border-t border-border px-3 py-2 text-xs text-soft-foreground`,children:[`More matches in `,e.join(`, `),`. Type more to narrow them.`]})}function Up({close:e}){let t=xa(),n=xn(),[r,i]=Y.useState(``),a=r.trim()!==``,o=Ea(),{theme:s,setTheme:c}=Wu(),l=ye(),u=v(),d=T(),f=ue(),p=ke(),m=Date.now(),h=d.data,g=h!==void 0&&h.projects.length>1,_=le(g),{order:y}=bp(),b=Y.useMemo(()=>g?Pp(h.projects,o,y):[],[g,h,o,y]),x=Y.useMemo(()=>new Map((h?.projects??[]).map(e=>[e.id,e.name])),[h]),S=o??h?.bootProject??null,[C,w]=Y.useState(``);Y.useEffect(()=>{let e=setTimeout(()=>w(r),kp);return()=>clearTimeout(e)},[r]);let E=N(C),D=a?E.data?.runs:void 0,O=a&&!E.isPlaceholderData?(E.data?.truncated??[]).map(e=>x.get(e)??e):[],k=Y.useMemo(()=>Ap(l.data??[],S,_.data?.runs,D),[l.data,S,_.data,D]),A=Y.useMemo(()=>Np(k),[k]),j=a?[]:A.recentlyFinished,M=a?k:A.otherTasks,ee=g,te=e=>e.projectId===null?null:x.get(e.projectId)??null,P=f.data?.skillUsage,ne=Y.useMemo(()=>No(u.data??[],P),[u.data,P]),re=n=>{e(),t(n)},F=t=>{e(),n(t)},ie=Uf(),ae=t=>{e(),ie.go(t)},I=n=>{e(),t(n.projectId===null?`/tasks/${n.id}`:ba(n.projectId,`/tasks/${n.id}`))},oe=Gu[s],L=zp({views:Rp({multiProject:g,health:p}),go:re,goGlobal:F,orderedProjects:b,activeProjectId:o,goProject:ae,otherTasks:M,searching:a,taskProjectName:te,showProjectOnTasks:ee,now:m,selectTask:I,orderedSkills:ne,skillRunner:u.runner,theme:s,nextTheme:oe,setTheme:c,close:e});return(u.isError||u.list?.source===`unavailable`)&&a&&L.push({rows:[{value:r.trim()}],node:(0,X.jsx)(_o,{heading:`Skills`,children:(0,X.jsxs)(bo,{value:r.trim(),onSelect:()=>re(nf({skill:r.trim(),runner:u.runner})),children:[`Use skill id “`,r.trim(),`” (unchecked)`]})},`unchecked-skill`)}),(0,X.jsxs)(X.Fragment,{children:[Bp({search:r,setSearch:i}),Vp({search:r,searching:a,recentlyFinished:j,groups:L,taskProjectName:te,showProjectOnTasks:ee,now:m,selectTask:I,go:re}),Hp({cappedProjects:O})]})}var Wp=Y.createContext(null);function Gp({children:e}){let[t,n]=Y.useState(`active`),r=Kf(),i=r?t:`active`,a=Y.useMemo(()=>[i,n,r],[i,r]);return(0,X.jsx)(Wp.Provider,{value:a,children:e})}function Kp(){let e=Y.useContext(Wp);if(!e)throw Error(`useListView must be used inside a <ListViewProvider>`);return e}function qp(e){let t=e.filter(e=>!e.isDefault&&e.status===void 0),n=oe({queries:t.map(e=>({queryKey:h.agentAccountStatus(e.id),queryFn:({signal:t})=>lt(e.id,{signal:t}),staleTime:6e4,retry:!1}))}),r=new Map;return t.forEach((e,t)=>{let i=n[t]?.data?.status?.status;i!==void 0&&r.set(e.id,i)}),r}function Jp(e,t,n){let r=e?.projectSelections?.[t??`default`];return r===void 0?n?e?.selections?.[n]:void 0:r}function Yp(){let e=ie().data?.profiles??[],t=qp(e);return e.map(e=>{let n=e.status?.status??t.get(e.id);return{provider:e.provider,id:e.id,label:e.label,...e.configDir===void 0?{}:{configDir:e.configDir},isDefault:e.isDefault,...n===void 0?{}:{status:n}}})}function Xp(e){let t=ie(),n=bt(),r=f(e),i=Yp(),a=r.data?.info?.root;return{accounts:i,repoAccount:Jp(t.data,e??n.projectId,a)}}function Zp(e,t){return e.filter(e=>e.provider===t).length>1}function Qp(e){let t=p(),n=R(),{accounts:r,repoAccount:i}=Xp(e);return{runners:nt(t.data,n.data,r),uninstalled:$e(t.data,n.data),signedOut:Mt(t.data,n.data,r),accounts:Be(t.data,r),repoAccount:i,accountFor:(e,n)=>Ue(t.data,r,e,n,i),runnersOn:e=>Fe(t.data,n.data,r,e),readyOn:(e,n)=>it(t.data,r,e,n)}}function $p(e,t){if(typeof e!=`object`||!e||Array.isArray(e))return{};let n=e,r={};for(let{id:e}of t?.runners??[]){let t=n[e];typeof t==`string`&&t.length>0&&t.length<=128&&(r[e]=t)}return r}function em(e,t,n){if(!e||!n)return[];let r=new Map(e.providers.map(e=>[e.provider,e]));return n.runners.flatMap(({id:e,displayName:n})=>{let i=r.get(e);return i?.status!==`disconnected`||!i.authFailureId||t[e]===i.authFailureId?[]:[{provider:e,label:n,authFailureId:i.authFailureId}]})}function tm(e,t){return{...e,...Object.fromEntries(t.map(({provider:e,authFailureId:t})=>[e,t]))}}function nm({status:e,runners:t,pending:n,error:r,dismissals:i,onDismissAuthFailures:a,accounts:o=[]}){if(n||!e)return null;let s;try{s=Qt(e)}catch{return null}let c=em(s,i,t);if(c.length>0)return(0,X.jsxs)(`div`,{"data-slot":`provider-banner`,role:`alert`,className:`flex min-h-9 items-center gap-2 border-b border-border bg-destructive/10 px-4 text-sm text-foreground`,children:[(0,X.jsx)(J,{tone:`danger`}),(0,X.jsxs)(`span`,{children:[`Provider authentication failed during a task:`,` `,c.map(({label:e})=>e).join(`, `),`.`]}),(0,X.jsx)(q,{to:`/settings/agent-defaults#providers`,className:`ml-auto shrink-0 font-medium underline underline-offset-4 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:`Open agent settings`}),(0,X.jsx)(`button`,{type:`button`,"aria-label":`Dismiss provider authentication alert`,onClick:()=>a(c),className:`shrink-0 rounded-sm p-1 text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:(0,X.jsx)($s,{className:`size-4`,"aria-hidden":`true`})})]});if(r||s.providers.some(e=>e.enabled&&Pt(e,o)))return null;let l=s.providers.some(e=>Pt(e,o)),u=s.providers.some(e=>e.status===`unknown`);return(0,X.jsxs)(`div`,{"data-slot":`provider-banner`,role:`status`,className:`flex min-h-9 items-center gap-2 border-b border-border bg-muted/50 px-4 text-sm text-muted-foreground`,children:[(0,X.jsx)(J,{tone:u?`danger`:`pending`}),(0,X.jsx)(`span`,{children:l?`No agent provider is enabled.`:u?`No connected provider could be verified.`:`No agent provider credentials were found.`}),(0,X.jsx)(q,{to:`/settings/agent-defaults#providers`,className:`ml-auto shrink-0 font-medium text-foreground underline underline-offset-4 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:`Configure providers`})]})}function rm(e){if(!(typeof e!=`object`||!e||Array.isArray(e)))return e}function im(){let e=p(),t=R().data,n=Yp(),r=x(),i=z(),a=(0,Y.useRef)(Promise.resolve()),o=(0,Y.useRef)(0),s=(0,Y.useRef)(0),c=(0,Y.useRef)(rm(r.data));(0,Y.useEffect)(()=>{s.current===0&&(c.current=rm(r.data))},[r.data]);let l=(0,Y.useCallback)(e=>{let n=h.uiState,r=rm(i.getQueryData(n)),l=tm($p(r?.dismissedProviderAuthFailures,t),e),u={...r,dismissedProviderAuthFailures:l};s.current+=1,i.setQueryData(n,u);let d=++o.current;a.current=a.current.then(async()=>{try{let e=await Ct({dismissedProviderAuthFailures:l});c.current=rm(e),d===o.current&&i.setQueryData(n,e)}catch(e){d===o.current&&(c.current===void 0?i.removeQueries({queryKey:n,exact:!0}):i.setQueryData(n,c.current),i.invalidateQueries({queryKey:n}),B(e instanceof Error?e.message:String(e),{tone:`danger`}))}finally{--s.current}})},[i,t]);return(0,X.jsx)(nm,{status:e.data,runners:t,pending:e.isPending,error:e.isError,dismissals:$p(rm(r.data)?.dismissedProviderAuthFailures,t),onDismissAuthFailures:l,accounts:n})}function am(e={displayName:`Squawk`,command:`hsq`,npx:`npx -p @hearsay-tools/squawk hsq`}){return e.command}function om(e){return e.reason===`legacy-change`?e.canImport?`${e.file} changed in the old home. Import keeps live-only changes. Old-home changes win when both homes changed the same key or entry.`:`${e.file} changed in the old home. Import is unavailable. Ignore keeps the live file and skips these old-home changes.`:e.reason===`outside-write`?`${e.file} changed outside Squawk. Restore the previous version or accept the file as found.`:e.file===`config.json`?`The project registry was reset. Restore the previous projects?`:`The account list was reset. Restore the previous accounts?`}function sm({file:e,editable:t}){let n=gs(),r=_s(),i=vs(),a=e.reason===`legacy-change`,o=n.isPending||r.isPending||i.isPending,s=n.error??r.error??i.error,c=t=>{n.reset(),r.reset(),i.reset();let a={file:e.file,detectedAt:e.detectedAt};t===`restore`?n.mutate(a):t===`accept`?r.mutate(a):i.mutate(a)};return(0,X.jsxs)(`div`,{"data-slot":`home-recovery`,"data-home-file":e.file,role:`status`,"aria-live":`polite`,"aria-busy":o,className:`flex flex-wrap items-center gap-x-3 gap-y-2 border-b border-border bg-muted/50 p-3 text-sm text-foreground`,children:[(0,X.jsx)(`span`,{className:`flex-[1_1_24rem] [min-inline-size:0] [overflow-wrap:break-word]`,children:om(e)}),t?(0,X.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[a?e.canImport&&(0,X.jsx)(G,{type:`button`,"data-action":`import`,disabled:o,onClick:()=>c(`import`),children:`Import changes from the old home`}):(0,X.jsx)(G,{type:`button`,"data-action":`restore`,disabled:o||!e.canRestore,onClick:()=>c(`restore`),children:`Restore`}),(0,X.jsx)(G,{type:`button`,variant:`outline`,"data-action":`accept`,disabled:o,onClick:()=>c(`accept`),children:a?`Ignore`:`Accept as found`})]}):t===!1&&(0,X.jsxs)(`p`,{className:`basis-full`,children:[a?e.canImport?`Only the host operator can import or ignore this file.`:`Only the host operator can ignore this file.`:`Only the host operator can restore or accept this file.`,e.file.startsWith(`remote-settings/`)&&(a?(0,X.jsxs)(X.Fragment,{children:[` `,e.canImport&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`code`,{children:[am(),` backup import `,e.file]}),` or `]}),(0,X.jsxs)(`code`,{children:[am(),` backup ignore `,e.file]})]}):(0,X.jsxs)(X.Fragment,{children:[` `,(0,X.jsxs)(`code`,{children:[am(),` backup restore `,e.file]})]}))]}),t&&s&&(0,X.jsx)(`p`,{role:`alert`,className:`basis-full text-danger`,children:s.message})]})}function cm(){let e=fs(),t=ke().data?.capabilities?.localHandoff;return(0,X.jsx)(`div`,{"data-slot":`home-recovery-state`,"data-state":e.isSuccess?`ready`:e.isError?`error`:`pending`,children:e.data?.files.map(e=>(0,X.jsx)(sm,{file:e,editable:!e.file.startsWith(`remote-settings/`)&&t},e.file))})}var lm=`hsq:reloaded-for-version`,um=new WeakMap;function dm(e,t){if(!t)return null;let n=um.get(e);return n===void 0?(um.set(e,t),null):t===n?null:t}function fm(e,t=Cm()){try{return t?.getItem(lm)===e}catch{return!1}}function pm(e,t=()=>window.location.reload()){try{Cm()?.setItem(lm,e)}catch{}t()}var mm=[`textarea`,`input${[`search`,`checkbox`,`radio`,`hidden`,`button`,`submit`,`reset`,`image`,`file`,`range`,`color`].map(e=>`:not([type="${e}"])`).join(``)}`,`[contenteditable=""]`,`[contenteditable="true"]`].join(`, `),hm=new WeakSet,gm=new Set;function _m(e){(0,Y.useEffect)(()=>{if(!e)return;let t=Symbol(`unsent-draft`);return gm.add(t),()=>{gm.delete(t)}},[e])}var vm=new WeakMap;function ym(e){return e instanceof HTMLTextAreaElement||e instanceof HTMLInputElement?e.value:e.textContent??``}function bm(e=document){let t=e=>{let t=e.target;t instanceof Element&&t.matches(mm)&&!vm.has(t)&&vm.set(t,ym(t))},n=e=>{e.target&&hm.add(e.target)};return e.addEventListener(`focusin`,t,!0),e.addEventListener(`input`,n,!0),()=>{e.removeEventListener(`focusin`,t,!0),e.removeEventListener(`input`,n,!0)}}function xm(e){if(!hm.has(e)||e.closest(`[data-persisted-draft], [data-slot="composer"], [data-reports-dirty]`)||(e instanceof HTMLTextAreaElement||e instanceof HTMLInputElement)&&(e.disabled||e.readOnly))return!1;let t=ym(e).trim(),n=vm.get(e);return n===void 0?t!==``:t!==n.trim()}function Sm(e=document){return gm.size>0||Array.from(e.querySelectorAll(mm)).some(xm)}function Cm(){try{return typeof window>`u`?void 0:window.sessionStorage}catch{return}}var wm=2e3;function Tm({reload:e}){let t=ke().data?.version,n=z(),[r,i]=(0,Y.useState)(null),[a,o]=(0,Y.useState)(`reloading`);return(0,Y.useEffect)(()=>bm(),[]),(0,Y.useEffect)(()=>{let e=dm(n,t);e!==null&&i(e)},[n,t]),(0,Y.useEffect)(()=>{if(r===null)return;if(fm(r)){o(`manual`);return}let t=()=>Sm()?(o(`waiting-for-input`),!1):(o(`reloading`),pm(r,e),!0);if(t())return;let n=window.setInterval(()=>{t()&&window.clearInterval(n)},wm);return()=>window.clearInterval(n)},[r,e]),r===null?null:(0,X.jsxs)(`div`,{"data-slot":`version-reload`,"data-phase":a,role:`status`,className:`flex min-h-9 flex-wrap items-center gap-x-3 gap-y-1 border-b border-border bg-muted/50 px-4 py-1 text-sm text-foreground`,children:[(0,X.jsx)(`span`,{children:a===`reloading`?`Squawk was updated to ${r}. Reloading…`:a===`waiting-for-input`?`Squawk was updated to ${r}. It reloads once your unsent message is sent or cleared.`:`Squawk was updated to ${r}. Reload to use the new version.`}),a===`reloading`?null:(0,X.jsx)(G,{type:`button`,size:`sm`,variant:`outline`,className:`ml-auto max-md:min-h-11`,"data-action":`version-reload`,onClick:()=>pm(r,e),children:`Reload now`})]})}var Em=`cez-project-rail-expanded`;function Dm(e,t){return e-232-t>=640}function Om(){try{return localStorage.getItem(Em)===`1`}catch{return!1}}function km(e){try{localStorage.setItem(Em,e?`1`:`0`)}catch{}}var Am=Y.lazy(()=>V(()=>import(`./project-rail-sortable-BmVI4_-T.js`),__vite__mapDeps([0,1,2,3,4])));function jm(e){if(e!==void 0)return e.isDragging?`relative z-10 opacity-40 [-webkit-touch-callout:none]`:`[-webkit-touch-callout:none]`}function Mm({project:e,signal:t,known:n,current:r,target:i,onSwitchProject:a,onSelectProject:o,sort:s}){let l=lu(e.name,t,{unknown:!n});return(0,X.jsxs)(`div`,{ref:s?.setNodeRef,style:s?.style,...s?.listeners,"data-slot":`rail-project`,"data-project-id":e.id,"data-dragging":s?.isDragging?``:void 0,className:c(`relative flex h-[52px] w-full shrink-0 items-center justify-center`,jm(s)),children:[r?(0,X.jsx)(`span`,{"aria-hidden":`true`,"data-slot":`rail-current-bar`,className:`absolute top-1/2 left-0 h-5 w-[3px] -translate-y-1/2 rounded-r-[2px] bg-foreground`}):null,(0,X.jsxs)(`div`,{className:`relative size-9`,children:[(0,X.jsx)(H,{ref:s?.setActivatorNodeRef,"aria-describedby":s?.attributes[`aria-describedby`],to:i.href,onClick:t=>{t.defaultPrevented||t.button!==0||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||(o?.(e.id),i.verify&&a&&(t.preventDefault(),a(e.id)))},"aria-label":l,title:l,"aria-current":r?`page`:void 0,className:c(`flex size-full items-center justify-center rounded-[9px] border text-[12px] leading-none font-semibold focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring`,r?`border-soft-foreground bg-sidebar-row-selected text-foreground`:`border-transparent bg-muted text-muted-foreground hover:text-foreground`),children:fu(e.name)}),(0,X.jsx)(Ou,{position:`top`,segments:ku(t).top}),(0,X.jsx)(Ou,{position:`bottom`,segments:ku(t).bottom})]})]})}var Nm=`motion-safe:rail-text-in`;function Pm({project:e,signal:t,known:n,current:r,target:i,onSwitchProject:a,onSelectProject:o,sort:s}){let l=lu(e.name,t,{unknown:!n}),{top:u,bottom:d}=ku(t),f=r?`border-sidebar-row-selected`:`border-background group-hover:border-sidebar-row-hover`;return(0,X.jsxs)(`div`,{ref:s?.setNodeRef,style:s?.style,...s?.listeners,"data-slot":`rail-project`,"data-project-id":e.id,"data-dragging":s?.isDragging?``:void 0,className:c(`group/row relative w-full shrink-0`,jm(s)),children:[(0,X.jsxs)(H,{to:i.href,onClick:t=>{t.defaultPrevented||t.button!==0||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||(o?.(e.id),i.verify&&a&&(t.preventDefault(),a(e.id)))},"aria-label":l,"aria-current":r?`page`:void 0,className:c(`group flex h-[52px] w-full items-center gap-[10px] rounded-[8px] px-[6px] pr-6 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring`,r?`bg-sidebar-row-selected`:`hover:bg-sidebar-row-hover`),children:[(0,X.jsxs)(`span`,{"aria-hidden":`true`,"data-slot":`rail-mark`,className:c(`relative flex size-9 shrink-0 items-center justify-center rounded-[9px] border text-[12px] leading-none font-semibold`,r?`border-soft-foreground bg-sidebar text-foreground`:`border-transparent bg-muted text-muted-foreground`),children:[fu(e.name),(0,X.jsx)(Ou,{position:`top`,segments:u,className:f}),(0,X.jsx)(Ou,{position:`bottom`,segments:d,className:f})]}),(0,X.jsxs)(`span`,{className:c(`flex min-w-0 flex-1 flex-col gap-px`,Nm),children:[(0,X.jsx)(`span`,{"data-slot":`rail-project-name`,className:c(`truncate text-[13.5px] leading-[18px] font-semibold`,r?`text-foreground`:`text-muted-foreground`),children:e.name}),(0,X.jsx)(wu,{signal:t,known:n,current:r,maxParts:2,slot:`rail-project-state`,className:`h-4 gap-x-[4px] overflow-hidden text-xs leading-4 whitespace-nowrap`})]})]}),s?(0,X.jsx)(Fm,{name:e.name,sort:s}):null]})}function Fm({name:e,sort:t}){return(0,X.jsx)(`button`,{type:`button`,ref:t.setActivatorNodeRef,"data-slot":`rail-project-grip`,...t.attributes,"aria-label":`Reorder ${e}, position ${t.position} of ${t.total}`,className:c(`absolute top-1/2 right-0.5 flex h-10 w-5 -translate-y-1/2 cursor-grab touch-none items-center justify-center rounded text-soft-foreground opacity-0 outline-none transition-opacity hover:text-foreground motion-reduce:transition-none`,`focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50`,`group-hover/row:opacity-100 group-focus-within/row:opacity-100 [@media(hover:none)]:opacity-100`),children:(0,X.jsx)(Us,{"aria-hidden":`true`,className:`size-3.5`})})}function Im(e){return c(`flex shrink-0 items-center rounded-[8px] text-soft-foreground hover:bg-sidebar-row-hover hover:text-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring`,e?`size-auto h-9 w-full justify-start gap-3 px-2.5 text-[13px] font-normal`:`size-9 justify-center`)}var Lm=c(`truncate text-muted-foreground group-hover:text-foreground`,Nm);function Rm({to:e,label:t,slot:n,active:r,expanded:i,children:a}){return(0,X.jsxs)(H,{to:e,"data-slot":n,"aria-label":t,title:i?void 0:t,"aria-current":r?`page`:void 0,className:c(`group`,Im(i),r&&`bg-sidebar-row-selected text-foreground hover:bg-sidebar-row-selected`),children:[a,i?(0,X.jsx)(`span`,{className:Lm,children:t}):null]})}function zm(e){let[t,n]=Y.useState(()=>window.innerWidth);return Y.useEffect(()=>{let e=()=>n(window.innerWidth);return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]),Dm(t,e)}function Bm(){let e=zm(Y.useContext(oc));return(0,X.jsx)(`div`,{"aria-hidden":`true`,"data-slot":`project-rail-placeholder`,style:{width:Om()&&e?232:60},className:`hidden shrink-0 border-r border-border bg-background md:block`})}var Vm=e=>({href:String(ba(e,`/`)),verify:!1});function Hm({expanded:e,resolvedTheme:t,version:n}){let r=n?`Squawk v${n}`:`Squawk`;return e?(0,X.jsxs)(`div`,{"data-slot":`rail-identity`,className:`flex shrink-0 flex-col gap-0.5`,children:[(0,X.jsxs)(`div`,{className:`flex h-[34px] items-center gap-[10px] px-0.5`,children:[(0,X.jsx)(`img`,{src:`/cezarion-mark-${t}.svg`,alt:``,"aria-hidden":`true`,"data-slot":`rail-app-mark`,className:`size-[34px] shrink-0 rounded-[8px]`}),(0,X.jsxs)(`span`,{className:c(`flex min-w-0 items-baseline gap-[10px] whitespace-nowrap`,Nm),"aria-label":r,children:[(0,X.jsx)(`span`,{className:`text-[15px] leading-none font-bold text-foreground`,children:`Squawk`}),n?(0,X.jsxs)(`span`,{"data-slot":`rail-version`,title:`v${n}`,className:`min-w-0 truncate text-xs leading-none text-soft-foreground`,children:[`v`,n]}):null]})]}),(0,X.jsx)(`div`,{"aria-hidden":`true`,className:`h-px w-full bg-border`}),(0,X.jsx)(`div`,{className:c(`px-1 pt-2.5 pb-1 text-xs font-medium text-soft-foreground`,Nm),children:`Projects`})]}):(0,X.jsxs)(`div`,{className:`flex shrink-0 flex-col items-center gap-0.5`,children:[(0,X.jsx)(`img`,{src:`/cezarion-mark-${t}.svg`,alt:r,title:r,"data-slot":`rail-app-mark`,className:`size-[34px] rounded-[9px]`}),(0,X.jsx)(`div`,{"aria-hidden":`true`,className:`mt-0.5 mb-1.5 h-px w-6 bg-border`})]})}function Um({expanded:e}){return e?(0,X.jsx)(eu,{origin:`rail`,icon:nr,iconClassName:`size-[15px] text-soft-foreground`,iconFrameClassName:`flex size-9 shrink-0 items-center justify-center rounded-[9px] border border-border`,label:`Add project`,side:`right`,triggerClassName:c(`h-[44px] w-full shrink-0 justify-start gap-[10px] rounded-[8px] px-[6px] text-[13px] font-normal text-muted-foreground hover:bg-sidebar-row-hover hover:text-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring motion-safe:[&>span:last-child]:rail-text-in`)}):(0,X.jsx)(eu,{origin:`rail`,icon:nr,iconClassName:`size-[15px]`,side:`right`,triggerClassName:`shrink-0 rounded-[9px] border border-border text-soft-foreground hover:bg-muted hover:text-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring`})}function Wm({roomToExpand:e,expanded:t,toggle:n,railId:r,allProjectsActive:i,settingsActive:a}){return(0,X.jsxs)(`div`,{"data-slot":`rail-bottom`,className:c(`flex shrink-0 flex-col gap-0.5 pt-2`,t?`items-stretch`:`items-center`),children:[e?(0,X.jsxs)(`button`,{type:`button`,"data-slot":`rail-expand-toggle`,"aria-expanded":t,"aria-controls":r,"aria-label":t?`Collapse projects`:`Expand projects`,title:t?void 0:`Expand projects`,onClick:n,className:c(`group`,Im(t)),children:[t?(0,X.jsx)(qs,{className:`size-4 shrink-0`,"aria-hidden":`true`}):(0,X.jsx)(Js,{className:`size-4 shrink-0`,"aria-hidden":`true`}),t?(0,X.jsx)(`span`,{className:Lm,children:`Collapse`}):null]}):null,(0,X.jsx)(Rm,{to:`/tasks`,label:`All projects`,slot:`rail-all-projects`,active:i,expanded:t,children:(0,X.jsx)(Hr,{className:`size-4 shrink-0`,"aria-hidden":`true`})}),(0,X.jsx)(Rm,{to:`/settings/global/appearance`,label:`Global settings`,slot:`rail-global-settings`,active:a,expanded:t,children:(0,X.jsx)(pr,{className:`size-4 shrink-0`,"aria-hidden":`true`})}),(0,X.jsx)(qu,{showLabel:t,labelClassName:Lm,className:c(`group`,Im(t),`[&_svg]:size-4`)})]})}function Gm({children:e,rememberFocus:t,restoreFocus:n}){return Y.useLayoutEffect(()=>(n(),t),[t,n]),(0,X.jsx)(X.Fragment,{children:e})}function Km({projects:e,signals:t,version:n,projectTarget:r=Vm,onSwitchProject:i,onSelectProject:a,canReorder:o=!1,onReorder:s}){let{pathname:l}=hn(),{resolvedTheme:u}=Wu(),d=Y.useContext(oc),[f,p]=Y.useState(Om),m=zm(d),h=f&&m,g=()=>{let e=!h;p(e),km(e)},_=Sa(l),v=l===`/tasks`,y=l===`/settings/global`||l.startsWith(`/settings/global/`),b=Y.useId(),x=Y.useRef(null),S=Y.useRef(null),C=Y.useCallback(()=>{let e=document.activeElement;if(!(e instanceof HTMLAnchorElement)||!x.current?.contains(e))return;let t=e.closest(`[data-project-id]`)?.dataset.projectId;t&&(S.current={link:e,projectId:t})},[]),w=Y.useCallback(()=>{let e=S.current;if(S.current=null,!e||e.link.isConnected||document.activeElement!==document.body)return;let t=x.current?.querySelectorAll(`[data-project-id]`)??[];for(let n of t)if(n.dataset.projectId===e.projectId){n.querySelector(`a`)?.focus({preventScroll:!0});break}},[]),T=o&&s!==void 0&&e.length>1,E=(e,n)=>(0,X.jsx)(h?Pm:Mm,{project:e,signal:t?.get(e.id),known:t!==null,current:e.id===_,target:r(e.id),onSwitchProject:i,onSelectProject:a,sort:n},e.id),D=(0,X.jsx)(Gm,{rememberFocus:C,restoreFocus:w,children:e.map(e=>E(e))});return(0,X.jsxs)(`nav`,{id:b,"aria-label":`Projects`,"data-slot":`project-rail`,"data-expanded":h?`true`:`false`,style:{width:h?232:60},className:c(`hidden shrink-0 flex-col overflow-hidden border-r border-border bg-background pt-3 pb-3.5 transition-[width] duration-[160ms] ease-out motion-reduce:transition-none md:flex`,h?`items-stretch px-2.5`:`items-center`),children:[(0,X.jsx)(Hm,{expanded:h,resolvedTheme:u,version:n}),(0,X.jsxs)(`div`,{ref:x,"data-slot":`rail-projects`,className:c(`flex min-h-0 w-full flex-1 flex-col gap-0.5 overflow-y-auto overscroll-contain [scrollbar-width:none]`,h?`items-stretch`:`items-center`),children:[T?(0,X.jsx)(Y.Suspense,{fallback:D,children:(0,X.jsx)(Am,{projects:e,onReorder:s,renderProject:E,onReady:w})}):D,(0,X.jsx)(Um,{expanded:h})]}),(0,X.jsx)(Wm,{roomToExpand:m,expanded:h,toggle:g,railId:b,allProjectsActive:v,settingsActive:y})]})}function qm(){let e=z(),t=T().data?.projects,{order:n,canReorder:r,setOrder:i}=bp(),a=r&&t!==void 0&&Eo(t.length),o=Y.useMemo(()=>t?wo(t,n):void 0,[t,n]),s=le(!0,void 0,Y.useMemo(()=>{let e;return t=>{let n=cu(t.runs);return e&&e.size===n.size&&[...n].every(([t,n])=>{let r=e.get(t);return r&&r.needsYou===n.needsYou&&r.failedUnread===n.failedUnread&&r.inMotion===n.inMotion&&r.finishedUnread===n.finishedUnread})?e:(e=n,n)}},[])).data??null,c=t?.map(e=>e.id).sort().join(`
|
|
3
3
|
`),l=Y.useRef(void 0);return Y.useEffect(()=>{if(c===void 0)return;let t=l.current;if(l.current=c,t===void 0||t===c)return;let n=new Set(t.split(`
|
|
4
4
|
`)),r=new Set(c.split(`
|
|
5
|
-
`)),i=ce(e);for(let e of n)r.has(e)||i.dropProject(e);let a=[...r].filter(e=>!n.has(e));for(let e of a)i.restoreProject(e);a.length>0&&i.reconcile({hold:!0})},[e,c]),Y.useMemo(()=>o?{projects:o,signals:s,canReorder:a,onReorder:i}:null,[o,s,a,i])}var Jm={general:[`Settings`,`General`],webhooks:[`Settings`,`General`,`Webhooks`],providers:[`Settings`,`Agent defaults`,`Providers`],projects:[`Settings`,`Projects`],worktrees:[`Settings`,`Worktrees`],sidebar:[`Settings`,`Sidebar`]};function Ym(e,t=` → `){return Jm[e].join(t)}var Xm=60;function Zm(e){return`title`in e?`Archived "${e.title.length>Xm?`${e.title.slice(0,Xm-1)}…`:e.title}"`:`Archived ${e.count} ${e.count===1?`task`:`tasks`}`}async function Qm(e,t,n){let r=new Set(n),i=(await Promise.allSettled(t.map(async t=>{await Jt(we(t,{projectId:e}),!1),r.has(t)&&await nn(we(t,{projectId:e}),!0)}))).find(e=>e.status===`rejected`);i&&B(i.reason instanceof Error?i.reason.message:`Could not undo the archive.`,{tone:`danger`})}function $m(){let e=document.activeElement;return!e||e===document.body||!e.isConnected}function eh(e,t){if(!e.isConnected)return t();let n=new MutationObserver(()=>{e.isConnected||(n.disconnect(),clearTimeout(r),t())}),r=setTimeout(()=>n.disconnect(),5e3);n.observe(document.body,{childList:!0,subtree:!0})}function th(e,t){if(!$m())return;let n=e?.isConnected?e:t?.isConnected?t:null;n instanceof HTMLElement&&(n.tabIndex<0&&!n.hasAttribute(`tabindex`)&&(n.tabIndex=-1),n.focus({preventScroll:!0}))}function nh(e,t,n){if(!e)return()=>{};let r=t(e);return()=>eh(e,()=>th(r,n))}function rh(e){let t=document.activeElement?.closest(`[data-slot="task-row"]`);return t?.getAttribute(`data-run-id`)===e?t:Array.from(document.querySelectorAll(`[data-slot="task-row"]`)).find(t=>t.getAttribute(`data-run-id`)===e)??null}var ih=e=>e?.querySelector(`a`)??null;function ah(e,t){let n=e?.projectId,r=e?.cacheScope,i=fe(),[o,s]=Y.useState(null),c=e=>i.invalidateAfter(`runs`,de({projectId:n,cacheScope:e})),l=(e,t,r,i)=>B(e,{action:{label:`Undo`,onAction:()=>void Qm(n,r,i).finally(()=>void c(t))}}),u=Y.useRef(new Map);return{archiveOne:e=>{let i=u.current.get(e.id);if(i)return i;let o=r??a(),s=!!e.pinned,d=rh(e.id),f=nh(d,e=>{let t=Array.from(e.closest(`[data-slot="quick-list-bucket"]`)?.querySelectorAll(`[data-slot="task-row"]`)??[]),n=t.indexOf(e);return ih(t[n+1]??t[n-1])},d?.closest(`[data-slot="quick-list-bucket"]`)?.parentElement??null),p=Jt(we(e.id,{projectId:n}),!0).then(()=>(c(o),l(Zm({title:La(e)}),o,[e.id],s?[e.id]:[]),f(),t?.(),!0),e=>(B(e.message,{tone:`danger`}),!1)).finally(()=>u.current.delete(e.id));return u.current.set(e.id,p),p},sweep:(e,i)=>{let o=r??a();s(e);let u=document.activeElement,d=u?.matches(`[data-action="archive-group"]`)?u:null,f=nh(d,e=>ih(e.closest(`[data-slot="quick-list-bucket"]`)?.nextElementSibling?.querySelector(`[data-slot="task-row"]`)??void 0),d?.closest(`[data-slot="quick-list-bucket"]`)?.parentElement??null);Tt(de({projectId:n}),e,i).then(({ids:e,pinnedIds:n})=>{c(o),e.length>0&&l(Zm({count:e.length}),o,e,n),f(),e.length>0&&t?.()},e=>B(e.message,{tone:`danger`})).finally(()=>s(null))},sweeping:o}}var oh=.6,sh=300,ch=100,lh={offset:0,phase:`idle`,past:!1},uh=null;function dh(e,t){uh&&uh.id!==e&&uh.close(),uh={id:e,close:t}}function fh(e){uh?.id===e&&(uh=null)}function ph(){if(!(typeof navigator>`u`||typeof navigator.vibrate!=`function`))try{navigator.vibrate(10)}catch{}}function mh({id:e,enabled:t,onArchive:n}){let[r,i]=Y.useState(lh),a=Y.useRef(null),o=Y.useRef(null),s=Y.useRef(!1),c=Y.useRef(!1),l=Y.useRef(void 0),u=()=>{c.current=!0,clearTimeout(l.current),l.current=void 0},d=()=>{c.current&&(clearTimeout(l.current),l.current=setTimeout(()=>{c.current=!1},sh))};Y.useEffect(()=>()=>clearTimeout(l.current),[]);let f=Y.useRef(r);f.current=r;let p=Y.useRef(n);p.current=n;let m=Y.useCallback(()=>{o.current=null,s.current=!1,fh(e),i(lh)},[e]);Y.useEffect(()=>{!t&&f.current.phase!==`committing`&&m()},[t,m]),Y.useEffect(()=>()=>fh(e),[e]);let h=r.phase===`open`;Y.useEffect(()=>{if(!h)return;let e=()=>m(),t=e=>{let t=a.current;t&&e.target instanceof Node&&t.contains(e.target)||m()};return document.addEventListener(`scroll`,e,{capture:!0,passive:!0}),document.addEventListener(`pointerdown`,t,!0),()=>{document.removeEventListener(`scroll`,e,{capture:!0}),document.removeEventListener(`pointerdown`,t,!0)}},[h,m]);let g=t=>{fh(e),i({offset:-t,phase:`committing`,past:!0});let n=e=>{e===!1&&m()};try{let e=p.current();e&&typeof e.then==`function`&&e.then(n,m)}catch{m()}};return{offset:r.offset,phase:r.phase,past:r.past,surfaceRef:a,bind:{onPointerDown:e=>{if(c.current=!1,!t||f.current.phase===`committing`||e.pointerType===`mouse`&&e.button!==0)return;let n=(a.current??e.currentTarget).getBoundingClientRect();o.current={pointerId:e.pointerId,x0:e.clientX,y0:e.clientY,base:f.current.phase===`open`?-88:0,width:n.width>0?n.width:320,axis:null,wasOpen:f.current.phase===`open`,samples:[{x:e.clientX,t:Date.now()}]}},onPointerMove:t=>{let n=o.current;if(!n||t.pointerId!==n.pointerId)return;let r=t.clientX-n.x0,a=t.clientY-n.y0;if(n.axis===null){if(Math.max(Math.abs(r),Math.abs(a))<10||(n.axis=Math.abs(r)>Math.abs(a)?`x`:`y`,n.axis===`y`))return;try{t.currentTarget.setPointerCapture?.(t.pointerId)}catch{}dh(e,m),u()}if(n.axis!==`x`)return;let c=Math.min(0,Math.max(-n.width,n.base+r)),l=-c>=oh*n.width;l&&!s.current&&ph(),s.current=l,n.samples.push({x:t.clientX,t:Date.now()}),n.samples.length>8&&n.samples.shift(),i({offset:c,phase:`dragging`,past:l})},onPointerUp:t=>{let n=o.current;if(!n||t.pointerId!==n.pointerId)return;if(o.current=null,n.axis!==`x`){n.axis===null&&n.wasOpen&&(u(),d(),m());return}d();let r=f.current.offset,a=Date.now(),c={x:t.clientX,t:a},l=n.samples.find(e=>a-e.t<=ch&&e.t<a),p=l?(c.x-l.x)/(c.t-l.t):0;s.current=!1,f.current.past||p<=-1&&-r>=40?g(n.width):p<1&&-r>=40?(dh(e,m),i({offset:-88,phase:`open`,past:!1})):m()},onPointerCancel:e=>{let t=o.current;!t||e.pointerId!==t.pointerId||(o.current=null,d(),t.axis===`x`&&m())},onClickCapture:e=>{c.current&&(c.current=!1,e.preventDefault(),e.stopPropagation())},onKeyDownCapture:()=>{c.current=!1}},close:m}}function hh(e){let t=e.currentStepId?e.steps.find(t=>t.id===e.currentStepId):void 0;if(t?.backend)return t.backend;if(e.runner)return e.runner;for(let t=e.steps.length-1;t>=0;--t){let n=e.steps[t]?.backend;if(n)return n}return`claude`}function gh(e){return ka(e)?.runner??e.runner??`claude`}function _h(e,t,n,r,i,a){return a?e.workflowDef?.steps.find(n=>n.command===void 0&&n.kind!==`plugin`&&(n.runner??e.runner??`claude`)===t)?.agentProfile??(t===n?e.agentProfile:void 0)??i?.[t]:t===r?ka(e)?.agentProfile:i?.[t]}function vh(e,t,n,r,i=!1){let a=r?.original??gh(e),o=r?.target??a;if(e.delegation?.role===`worker`){let r=_h(e,t,a,o,n,i);if(r!==void 0||i)return r}if(t!==o)return n?.[t];let s=ja(e),c=s.profileId??`default`;return s.sessionId!==void 0&&s.backend===o&&(e.agentProfile??c)===c?c:(o===a?e.agentProfile:void 0)??n?.[t]}function yh(e,t,n){let r=ja(e),i=r.sessionId===void 0?{runner:e.runner??`claude`,account:e.agentProfile}:{runner:r.backend,account:r.profileId??e.agentProfile};return(i.runner===t?i.account:void 0)??n?.[t]}function bh(e,t,n){let r=e.find(e=>e.provider===t&&e.id===n);return r?.isDefault?void 0:r}function xh(e,t,n,r){return bh(n,t,vh(e,t,r))}function Sh(e,t,n,r){let i=mt(t,e);return i?.enabled===!1?{provider:e,usable:!1,reason:`${A(n,e)} is disabled. Enable it in ${Ym(`providers`)}.`}:r&&i?.authFailureId===void 0?r.status===void 0||r.status===`connected`?{provider:e,usable:!0}:{provider:e,usable:!1,reason:`${A(n,e)} account "${r.label}" is not signed in. Sign in in ${Ym(`providers`)}.`}:i?.status===`connected`?{provider:e,usable:!0}:{provider:e,usable:!1,reason:`${A(n,e)} credentials are unavailable. Authorize it in ${Ym(`providers`)}.`}}function Ch(e,t,n,r){return Sh(hh(e),t,n,r)}function wh(e,t,n,r){return Sh(gh(e),t,n,r)}function Th(e){let t=p(),n=R().data,r=hh(e),{accounts:i,repoAccount:a}=Xp(),o=bh(i,r,yh(e,r,a));return t.isSuccess&&t.data&&n?Ch(e,t.data,n,o):{provider:r,usable:!0}}function Eh(e){let t=p(),n=R(),r=gh(e),{accounts:i,repoAccount:a}=Xp(),o=xh(e,r,i,a);return t.isSuccess&&t.data&&n.data?wh(e,t.data,n.data,o):t.isError||n.isError?{provider:r,usable:!1,reason:`Provider authentication could not be verified.`}:{provider:r,usable:!1,reason:`Checking agent providers…`}}function Dh(e){return ja(e).sessionId}function Oh(e){return ja(e).backend}function kh(e){if(Pa(e)||e.cliHandoff===!1)return;let t=e.cliResumeCommand;if(t!==void 0)return e.worktreePath?`cd ${e.worktreePath} && ${t}`:t}function Ah(e,t){let n=Wr(t);return!n||Pa(e)?!1:n===Oh(e)&&Dh(e)!==void 0}function jh(e){return(e.status===`failed`||qt(e))&&(e.waits?.length??0)>0}function Mh(e,t){return t&&e.delegation?.role===`root`&&(e.status===`failed`||qt(e))}function Nh(e){return e.status===`cancelled`&&e.startedAt===void 0&&e.workflowDef!==void 0&&e.steps.every(e=>e.status===`pending`&&e.startedAt===void 0&&!e.sessionId)}function Ph(e){return Aa(e)&&e.removedRunner===void 0}function Fh(e,t=!1){let n=Pa(e),r=Dh(e)!==void 0;return{finish:e.status===`waiting`&&n||e.status===`review`,continueRun:(!n||e.removedRunner!==void 0&&e.status!==`queued`)&&!e.stopping&&e.delegation?.role!==`invalid`&&!(e.delegation?.role===`worker`&&e.delegation.destroy)&&(r||Nh(e)||e.removedRunner!==void 0),terminal:Bh(e,n,r),notes:!0,archive:!n,pin:!e.archived&&!Wa(e),markUnread:Qa(e)&&!Za(e),cancel:n||jh(e)||Mh(e,t),deleteRun:!n}}function Ih(e){return e.status===`waiting`&&e.finishBlocked===null&&Pe(e).bucket===`waiting`}function Lh(e){return`Merge head branch and resolve conflicts in ${e?`PR number ${e}`:`this pull request`}`}function Rh(e){return e===`review`?`Accept the changes without a PR`:`Close the session`}function zh(e,t){let n=e.filter(e=>!e.archived&&e.status===`queued`).sort((e,t)=>e.createdAt.localeCompare(t.createdAt)).findIndex(e=>e.id===t);return n>=0?n+1:void 0}function Bh(e,t,n){return e.cliHandoff!==!1&&!t&&n}var Vh=[50,100,200,400,800,1e3,1e3,1e3,1e3],Hh=e=>new Promise(t=>setTimeout(t,e));function Uh(e){return e instanceof Ge&&e.status===409&&e.message===`run is still active`}async function Wh(e,t=Hh){for(let n=0;;n+=1)try{return await e()}catch(e){let r=Vh[n];if(!Uh(e)||r===void 0)throw e;await t(r)}}function Gh(e){return Pa(e)?`live`:Fh(e).continueRun?`resume`:`unavailable`}function Kh(e,t){let n=ge(e.id,t),r=b(e.id,t),i=Th(e),a=Eh(e),[o,s]=(0,Y.useState)(void 0),[c,l]=(0,Y.useState)(!1),u=(0,Y.useRef)(!1),d=Gh(e),f=d===`resume`?!a.usable:d===`live`&&!i.usable,p=d===`unavailable`?`no-session`:f?`provider`:void 0,m=p===`no-session`?`This session has ended and no agent session was recorded, so the answer cannot be delivered.`:p===`provider`?d===`resume`?a.reason:i.reason:void 0,h=(e,t)=>a.usable?r.mutateAsync({text:e,...t===void 0?{}:{images:t}}):Promise.reject(Error(a.reason??`The run provider is unavailable.`));return{mode:d,blockedBy:p,reason:m,isPending:c||n.isPending||r.isPending,error:o,send:async(t,r)=>{if(p)return m;if(u.current)return`An answer is already being sent.`;u.current=!0,l(!0),s(void 0);try{if(d===`resume`){await Wh(()=>h(t,r));return}try{await n.mutateAsync({text:t,...r===void 0?{}:{images:r}})}catch(n){if(n instanceof Ge&&n.status===409&&Dh(e)!==void 0){try{await Wh(()=>h(t,r))}catch(e){let t=e instanceof Error?e.message:String(e);throw Error(`Session closed. Retry to reopen the session. ${t}`)}return}throw n}return}catch(e){let t=e instanceof Error?e.message:String(e);return s(t),t}finally{u.current=!1,l(!1)}}}}function qh({run:e,projectId:t,prNumber:n}){let r=Kh(e,t),i=vi(),[a,o]=(0,Y.useState)(!1),s=a||r.isPending,c=!!r.blockedBy,l=async()=>{if(s||c)return;let e=r.mode===`resume`;o(!0);try{let t=await r.send(Lh(n));t?B(t,{tone:`danger`}):(B(`${e?`Task reopened`:`Sent to the task`} — resolving conflicts${n?` in PR #${n}`:``}`),i())}finally{o(!1)}};return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(G,{type:`button`,size:`sm`,"data-slot":`reference-conflict-action`,disabled:c||s,onClick:()=>void l(),className:`h-7 w-full text-xs`,children:s?`Sending…`:`Resolve conflicts`}),c&&r.reason?(0,X.jsx)(`span`,{className:`block text-muted-foreground`,children:r.reason}):null]})}function Jh({projectId:e,runId:t,prNumber:n}){let r=ve(e,t);return r.data?(0,X.jsx)(qh,{run:r.data,projectId:e,prNumber:n}):(0,X.jsx)(G,{type:`button`,size:`sm`,disabled:!0,className:`h-7 w-full text-xs`,children:r.isError?`Unavailable`:`Loading…`})}function Yh({runId:e,prNumber:t}){let{projectId:n}=yi();return n===void 0?(0,X.jsx)(Xh,{runId:e,prNumber:t}):(0,X.jsx)(Jh,{projectId:n,runId:e,prNumber:t})}function Xh({runId:e,prNumber:t}){let n=j(e);return n.data?(0,X.jsx)(qh,{run:n.data,prNumber:t}):(0,X.jsx)(G,{type:`button`,size:`sm`,disabled:!0,className:`h-7 w-full text-xs`,children:n.isError?`Unavailable`:`Loading…`})}function Zh({run:e,reference:t,className:n,compact:r=!1,plain:i=!1,inert:a=!1}){let{projectId:o,repoBase:s}=yi(),c=o!==void 0&&t.number!==void 0?Pn(o,e.id,{kind:t.kind,number:t.number,url:t.url},s):void 0;return(0,X.jsx)(bi,{reference:t,taskTitle:La(e),to:c,conflictAction:Mn({...t,number:t.number??0},s)?(0,X.jsx)(Yh,{runId:e.id,prNumber:t.number}):void 0,className:n,compact:r,plain:i,inert:a})}var Qh=220;function $h({references:e,taskTitle:t,visibleCount:n,plain:r=!1,projectId:i,runId:a,repoBase:o}){let[s,c]=Y.useState(!1),l=Y.useRef(!1),u=Y.useRef(!1),d=Y.useRef(null),f=Y.useRef(void 0);Y.useEffect(()=>()=>clearTimeout(f.current),[]);let p=e=>e.pointerType!==`touch`,m=()=>clearTimeout(f.current),h=e=>{p(e)&&(m(),s||(l.current=!0),c(!0))},g=e=>{p(e)&&(m(),f.current=setTimeout(()=>c(!1),Qh))},_=e.length-n,v=e.slice(n).map(t=>{let n=e.some(e=>e!==t&&e.kind===t.kind&&e.number===t.number)&&t.url?new URL(t.url).pathname.split(`/`).slice(1,3).join(`/`):``;return`${t.kind} #${t.number}${n?` (${n})`:``}`}).join(`, `);return _<=0?null:(0,X.jsxs)(sa,{open:s,onOpenChange:c,children:[(0,X.jsx)(ra,{asChild:!0,children:(0,X.jsxs)(`button`,{type:`button`,"data-slot":`reference-overflow`,title:v,"aria-label":`Show all ${e.length} references for ${t}`,onPointerEnter:h,onPointerLeave:g,onPointerDown:e=>{e.stopPropagation(),u.current=s&&l.current,l.current=!1},onClick:e=>{e.stopPropagation(),s&&(u.current||l.current)&&(e.preventDefault(),m(),d.current?.focus()),u.current=!1,l.current=!1},className:`no-hover:min-h-[44px] no-hover:min-w-[44px] max-md:min-h-[44px] max-md:min-w-[44px] shrink-0 rounded-full px-1 text-xs font-medium text-soft-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:[`+`,_]})}),(0,X.jsxs)(aa,{ref:d,align:`start`,collisionPadding:8,className:`w-auto min-w-40 max-h-(--radix-popover-content-available-height) overflow-y-auto overscroll-contain p-1.5`,"data-slot":`reference-overflow-list`,onClick:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation(),onPointerEnter:h,onPointerLeave:g,onOpenAutoFocus:e=>{e.preventDefault(),!l.current&&e.target instanceof HTMLElement&&e.target.focus()},onKeyDownCapture:e=>{e.key===`Escape`&&(e.preventDefault(),l.current=!1,c(!1))},onCloseAutoFocus:e=>{l.current&&e.preventDefault()},children:[(0,X.jsx)(`p`,{className:`px-1 pb-1.5 text-xs text-soft-foreground`,children:`References`}),(0,X.jsx)(`span`,{className:`flex flex-col items-start gap-1`,children:e.map(e=>(0,X.jsx)(bi,{reference:e,taskTitle:t,projectId:i,repoBase:o,to:i===void 0?void 0:Pn(i,a,e,o),plain:r,className:`no-hover:min-h-[44px] max-md:min-h-[44px]`,conflictAction:i&&Mn(e,o)?(0,X.jsx)(Jh,{projectId:i,runId:a,prNumber:e.number}):void 0},Hn(e)))})]})]})}function eg({references:e,maxVisible:t,taskTitle:n,projectId:r,runId:i,repoBase:a,plain:o=!1,compact:s=!1,inertInline:c=!1,fitContainer:l=!1,overflowContainer:u}){let d=Y.useRef(null),[f,p]=Y.useState(t),m=Y.useRef(new Map),h=e.map(Hn).join(`|`);Y.useLayoutEffect(()=>{let n=d.current;if(!l||!n?.parentElement){p(t);return}let r=n.parentElement,i=()=>{[...n.querySelectorAll(`:scope > [data-slot="pr-chip"], :scope > [data-slot="issue-chip"]`)].forEach((t,n)=>{let r=t.getBoundingClientRect().width;r&&m.current.set(Hn(e[n]),r)});let i=r.getBoundingClientRect();if(!i.width)return;let a=Math.min(t,e.length);n.dataset.referenceWidth=String(e.slice(0,a).reduce((e,t)=>e+(m.current.get(Hn(t))??48),0)+Math.max(0,a-1)*4);let o=0;for(let e=n.nextElementSibling;e;e=e.nextElementSibling){if(e.getAttribute(`data-slot`)===`task-row-age`||e.getAttribute(`aria-hidden`)===`true`&&e.nextElementSibling?.getAttribute(`data-slot`)===`task-row-age`)continue;let t=getComputedStyle(e);o+=e.getBoundingClientRect().width+(parseFloat(t.marginLeft)||0)+(parseFloat(t.marginRight)||0)}let s=i.right-n.getBoundingClientRect().left-o,l=n.querySelector(`[data-slot="reference-overflow"]`)?.getBoundingClientRect().width||(c?44:26),d=Math.min(t,e.length);for(;d>0;){let t=u===void 0&&d<e.length,n=(t?d:Math.max(0,d-1))*4;if(e.slice(0,d).reduce((e,t)=>e+(m.current.get(Hn(t))??48),0)+n+(t?l:0)<=s+(d===e.length?u?.getBoundingClientRect().width??0:0))break;d--}p(d)};if(i(),typeof ResizeObserver>`u`)return;let a=new ResizeObserver(i);return a.observe(r),a.observe(n),()=>a.disconnect()},[l,t,h,c,e,u]);let g=Math.min(f,t,e.length),_=(0,X.jsx)($h,{references:e,visibleCount:g,taskTitle:n,projectId:r,runId:i,repoBase:a,plain:o});return(0,X.jsxs)(`span`,{ref:d,"data-slot":`reference-list`,className:`inline-flex max-w-full flex-nowrap items-center gap-1 align-middle`,children:[e.slice(0,g).map(e=>(0,X.jsx)(bi,{reference:e,taskTitle:n,projectId:r,repoBase:a,to:r===void 0?void 0:Pn(r,i,e,a),plain:o,compact:s,inert:c,className:`shrink-0`,conflictAction:r&&Mn(e,a)?(0,X.jsx)(Jh,{projectId:r,runId:i,prNumber:e.number}):void 0},Hn(e))),u===void 0?_:u?(0,ld.createPortal)(_,u):null]})}function tg({pinned:e,onToggle:t,className:n}){return(0,X.jsx)(`button`,{type:`button`,"data-slot":`pin-toggle`,"data-pinned":e?`true`:void 0,"aria-pressed":e,"aria-label":e?`Unpin task`:`Pin task`,title:e?`Unpin from the top of the list`:`Pin to the top of the list`,onClick:n=>{n.stopPropagation(),t(!e)},className:c(`inline-flex size-5 shrink-0 items-center justify-center rounded-sm text-soft-foreground transition-colors motion-reduce:transition-none hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,n,`max-md:min-h-11 max-md:min-w-11 no-hover:min-h-11 no-hover:min-w-11`),children:(0,X.jsx)(Xs,{"data-slot":`pin-icon`,className:`size-[12px]`,fill:e?`currentColor`:`none`,"aria-hidden":`true`})})}var ng=`opacity-0 group-hover/task-row:opacity-100 focus-visible:opacity-100 group-has-[:focus-visible]/task-row:opacity-100 no-hover:opacity-100`,rg=`opacity-0 group-hover/task-row:opacity-100 focus-visible:opacity-100 group-has-[:focus-visible]/task-row:opacity-100`,ig=`transition-opacity motion-reduce:transition-none group-hover/task-row:opacity-0 group-has-[:focus-visible]/task-row:opacity-0 max-md:absolute max-md:top-1/2 max-md:left-0 max-md:-translate-y-1/2 max-md:opacity-100 no-hover:absolute no-hover:top-1/2 no-hover:left-0 no-hover:-translate-y-1/2 no-hover:opacity-100`;function ag({run:e,title:t,unread:n,inertReferences:r,onTogglePin:i,onArchiveRun:a}){return(0,X.jsxs)(`span`,{"data-slot":`task-row-trailing`,className:`relative flex h-[19px] w-[16px] shrink-0 items-center justify-center max-md:h-auto max-md:w-11 max-md:self-stretch no-hover:h-auto no-hover:w-11 no-hover:self-stretch`,children:[n?(0,X.jsx)(J,{tone:au(e),role:`img`,"aria-label":`unread`,title:`Unread — not opened since it finished`,"data-slot":`unread-marker`,className:i?ig:void 0}):null,i?(0,X.jsx)(tg,{pinned:!!e.pinned,onToggle:t=>i(e,t),className:c(`absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2`,ng)}):null,a&&!r&&Oa(e)?(0,X.jsx)(`button`,{type:`button`,"data-action":`archive-run`,"aria-label":`Archive ${t}`,title:`Archive task`,onClick:t=>{t.stopPropagation(),a(e)},className:c(`absolute top-[19.5px] left-1/2 inline-flex size-5 -translate-x-1/2 items-center justify-center rounded-sm text-muted-foreground transition-colors hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none motion-reduce:transition-none`,rg),children:(0,X.jsx)(Fr,{className:`size-[12px] -translate-y-[2.5px]`,"aria-hidden":`true`})}):null]})}function og({inertReferences:e,swipeable:t,swipe:n,title:r,onArchive:i,children:a}){return e?(0,X.jsxs)(`div`,{ref:n.surfaceRef,"data-slot":`task-row-swipe`,"data-swipe":t?`on`:void 0,"data-phase":t?n.phase:void 0,className:c(`relative rounded-[6px]`,t&&`touch-pan-y touch-pinch-zoom overflow-hidden`),children:[n.offset<0?(0,X.jsx)(sg,{width:-n.offset,past:n.past,title:r,onArchive:i}):null,a]}):a}function sg({width:e,past:t,title:n,onArchive:r}){return(0,X.jsx)(`div`,{"data-slot":`task-row-swipe-action`,"data-past":t?`true`:void 0,"aria-hidden":`true`,style:{width:e},className:c(`absolute inset-y-0 right-0 flex items-stretch justify-end overflow-hidden rounded-[6px]`,t?`bg-info text-signal-ink`:`bg-muted text-foreground`),children:t?(0,X.jsxs)(`span`,{className:`flex w-full items-center justify-center gap-2 text-[12px] font-semibold whitespace-nowrap`,children:[(0,X.jsx)(Fr,{className:`size-[16px] shrink-0`,"aria-hidden":`true`}),`Release to archive`]}):(0,X.jsxs)(`button`,{type:`button`,tabIndex:-1,"aria-label":`Archive ${n}`,onClick:e=>{e.stopPropagation(),r()},className:`flex w-[88px] shrink-0 flex-col items-center justify-center gap-1 text-[12px] font-semibold`,children:[(0,X.jsx)(Fr,{className:`size-[16px]`,"aria-hidden":`true`}),`Archive`]})})}var cg=`[&>[data-ellipsis-hidden]]:pointer-events-none`,lg=`data-ellipsis-hidden`,ug=new Map;function dg(e){let t=getComputedStyle(e),n=`${t.fontStyle} ${t.fontWeight} ${t.fontSize} ${t.fontFamily} ${t.letterSpacing}`,r=ug.get(n);if(r!==void 0)return r;let i=document.createElement(`span`);i.textContent=`…`,i.setAttribute(`aria-hidden`,`true`),Object.assign(i.style,{position:`absolute`,visibility:`hidden`,whiteSpace:`pre`,fontStyle:t.fontStyle,fontWeight:t.fontWeight,fontSize:t.fontSize,fontFamily:t.fontFamily,letterSpacing:t.letterSpacing}),document.body.appendChild(i);let a=i.getBoundingClientRect().width;i.remove();let o=a||parseFloat(t.fontSize)||12;return a&&(!document.fonts||document.fonts.status===`loaded`)&&ug.set(n,o),o}function fg(e,t){if(e.scrollWidth<=e.clientWidth)return[];let n=e.getBoundingClientRect(),r=parseFloat(getComputedStyle(e).paddingRight)||0,i=n.left+e.clientLeft+e.clientWidth-r-t+.5;return Array.from(e.children).filter(e=>e.getBoundingClientRect().right>i)}function pg(e,t,n){Y.useLayoutEffect(()=>{let n=e.current;if(!t||!n||typeof ResizeObserver>`u`)return;let r=!0,i=()=>{if(!r)return;let e=new Set(fg(n,dg(n)));for(let t of Array.from(n.children))t.hasAttribute(lg)!==e.has(t)&&t.toggleAttribute(lg,e.has(t))},a=new ResizeObserver(i),o=new Set,s=()=>{for(let e of Array.from(n.children))o.has(e)||(o.add(e),a.observe(e))};a.observe(n),s(),i();let c=typeof MutationObserver>`u`?null:new MutationObserver(()=>{s(),i()});return c?.observe(n,{childList:!0}),document.fonts&&document.fonts.status!==`loaded`&&document.fonts.ready.then(i),()=>{r=!1,a.disconnect(),c?.disconnect();for(let e of Array.from(n.children))e.removeAttribute(lg)}},[e,t,n])}var mg=`(hover: none)`;function hg(){let[e,t]=(0,Y.useState)(()=>typeof window.matchMedia==`function`&&window.matchMedia(mg).matches);return(0,Y.useEffect)(()=>{if(typeof window.matchMedia!=`function`)return;let e=window.matchMedia(mg);t(e.matches);let n=e=>t(e.matches);return e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)},[]),e}var gg=`(min-width: 48rem)`;function _g(){let[e,t]=(0,Y.useState)(()=>typeof window.matchMedia!=`function`||window.matchMedia(`(min-width: 48rem)`).matches);return(0,Y.useEffect)(()=>{if(typeof window.matchMedia!=`function`)return;let e=window.matchMedia(gg),n=()=>t(e.matches);return n(),e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)},[]),e}var vg={"needs-permission":`label`,failed:`label`,"needs-you":`none`,"needs-review":`label`,running:`label`,"usage-limit":`resume`,"waiting-on-workers":`label`,"waiting-on-subagents":`label`,"waiting-for-ci":`label`,"waiting-for-merge":`label`,"waiting-for-command":`until`,monitoring:`next-check`,"waiting-for-capacity":`label`,queued:`queue-position`,done:`none`,cancelled:`none`,unseen:`label`};function yg(e,t,n,r){let i=ap(e.rung,e.label,n.autoResumeReason);switch(vg[e.rung]){case`none`:return;case`queue-position`:return t===null?i:`Queued #${t}`;case`resume`:{let e=lo(n.autoResumeAt,r);return e===`scheduled`?i:`${i}, ${e}`}case`next-check`:{let e=je(n),t=e?.kind===`timer`?new Date(e.at):void 0;return t&&Number.isFinite(t.getTime())?`${i}, next check ${mo(t,new Date(r))}`:i}case`until`:{let e=je(n),t=e?.kind===`process`?new Date(e.deadline):void 0;return t&&Number.isFinite(t.getTime())?`${i}, until ${mo(t,new Date(r))}`:i}case`label`:return i}}function bg({run:e,attention:t,queuePosition:n,inWorkingGroup:r,scope:i,now:a}){let o=Fn(e,void 0,i??void 0),s=n===null?co(e.finishedAt??e.createdAt,a):``,c=r&&t.rung===`running`?void 0:yg(t,n,e,a);return{stateWord:c,references:o,age:s,key:`${s}|${c??``}|${o.map(e=>`${e.kind}-${e.number}-${e.url}`).join(`,`)}|${+!!e.notify}`}}function xg(e){let t=La(e);return{title:t,displayTitle:Ia(t,In(e)?.number)?Ma(t).rest:t}}var Sg=`cez-sidebar-collapsed`,Cg=`cez-sidebar-sections-collapsed`;function wg(e){if(typeof e!=`object`||!e||Array.isArray(e))return{};let t={};for(let[n,r]of Object.entries(e))typeof r==`boolean`&&(t[n]=r);return t}function Tg(e=Sg){try{let t=localStorage.getItem(e);return t===null?{}:wg(JSON.parse(t))}catch{return{}}}function Eg(e,t=Sg){try{localStorage.setItem(t,JSON.stringify(e))}catch{}}var Dg=`cez-sidebar-sections-changed`;function Og(e){let[t,n]=(0,Y.useState)(()=>Tg(Cg)),[r,i]=(0,Y.useState)({}),a=(0,Y.useRef)(t);(0,Y.useEffect)(()=>{let e=e=>{if(e instanceof StorageEvent&&e.key!==null&&e.key!==`cez-sidebar-sections-collapsed`)return;let t=e instanceof CustomEvent?e.detail:Tg(Cg);a.current=t,n(t)};return window.addEventListener(`storage`,e),window.addEventListener(Dg,e),()=>{window.removeEventListener(`storage`,e),window.removeEventListener(Dg,e)}},[]),(0,Y.useEffect)(()=>{if(e===null||Object.keys(r).length===0)return;let t={...a.current};for(let[n,i]of Object.entries(r))t[JSON.stringify([e,n])]=i;i({}),a.current=t,n(t),Eg(t,Cg),window.dispatchEvent(new CustomEvent(Dg,{detail:t}))},[e,r]);let o=t=>JSON.stringify([e,t]);return{isCollapsed:e=>e!==`Archived`&&(r[e]??t[o(e)])===!0,toggle:t=>{if(e===null){i(e=>({...e,[t]:e[t]!==!0}));return}let r=o(t),s={...a.current,[r]:a.current[r]!==!0};a.current=s,n(s),Eg(s,Cg),window.dispatchEvent(new CustomEvent(Dg,{detail:s}))}}}function kg({runs:e,view:t,automations:n,onViewChange:r,currentRunId:i=null,now:a=Date.now(),onTogglePin:o,onArchiveRun:s,onSweep:c,sweeping:l=null,showViewControls:u=!0,rowLimit:d,sidebarLimits:f,projectId:p=null}){let m=cc(),h=za(e,n),g=Ra(e,t,n),_=Na(g,`active`),v=Ba(_,f??d??{overall:null}),y=c?Ag(g):void 0;return(0,X.jsxs)(`div`,{"data-slot":`quick-list`,children:[(0,X.jsxs)(`div`,{"data-slot":`quick-list-header`,className:`flex min-h-11 items-center gap-1.5 pr-[6px] pl-[10px] md:min-h-[26px]`,children:[(0,X.jsx)(`h2`,{className:`text-[13px] font-semibold text-foreground`,children:`Tasks`}),(0,X.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:h[t]}),(0,X.jsxs)(q,{to:`/`,onClick:m,className:`ml-auto flex min-h-11 items-center gap-0.5 text-[12px] text-soft-foreground hover:text-foreground md:min-h-[26px]`,children:[`All`,(0,X.jsx)(Lr,{className:`size-[13px]`,"aria-hidden":`true`})]})]}),u?(0,X.jsx)(`div`,{className:`sticky top-0 z-10 bg-sidebar pt-2 pb-1`,children:(0,X.jsx)(`div`,{className:`inline-flex w-full gap-0.5 rounded-md bg-muted p-[2px]`,children:(0,X.jsx)(Wg,{view:t,automations:n,onSelect:r,counts:h})})}):null,_.length===0?(0,X.jsx)(`p`,{className:`px-3 py-3.5 text-xs text-soft-foreground`,children:t===`automations`?`No automation tasks.`:`No tasks yet — describe one.`}):(0,X.jsx)(jg,{buckets:v,allBuckets:_,sectionProjectId:p,currentRunId:Ha(i,e),now:a,onTogglePin:o,onArchiveRun:s,onSweep:c,sweeping:l,sweepCounts:y,view:t,automations:n})]})}function Ag(e){return{unpinned:Wn(e,`unpinned`),pinned:Wn(e,`pinned`)}}function jg({buckets:e,currentRunId:t=null,now:n=Date.now(),scope:r=null,onTogglePin:i,onArchiveRun:a,onSweep:o,sweeping:s=null,sweepCounts:c,projectName:l,allBuckets:u=e,sectionProjectId:d=r,view:f=`active`,automations:p}){let m=Y.useId(),h=Og(d),g=Y.useRef(null),_=Y.useRef(null);Y.useLayoutEffect(()=>{let e=_.current;if(!e||e.element.isConnected||(_.current=null,document.activeElement!==document.body))return;let t=u.find(t=>t.rows.some(t=>t.run.id===e.id));if(!t)return;let n=Array.from(g.current?.children??[]).find(e=>e.dataset.bucket===t.label);(Array.from(n?.querySelectorAll(`[data-slot="task-row"]`)??[]).find(t=>t.dataset.runId===e.id)?.querySelector(`a`)??n?.querySelector(`[data-slot="section-toggle"]`))?.focus({preventScroll:!0})});let v=(e,o=!1)=>(0,X.jsx)(zg,{inWorkingGroup:o,run:e.run,queuePosition:e.queuePosition,currentRunId:t,now:n,scope:r,onTogglePin:i,onArchiveRun:a});return(0,X.jsx)(`div`,{ref:g,className:`flex flex-col gap-3`,onFocusCapture:e=>{let t=e.target.closest(`[data-slot="task-row"]`);_.current=t?.dataset.runId?{id:t.dataset.runId,element:e.target}:null},onBlurCapture:e=>{e.currentTarget.contains(e.relatedTarget)||(_.current=null)},children:u.map(t=>{let n=t.label===`Archived`,i=h.isCollapsed(t.label),a=e.find(({label:e})=>e===t.label)?.rows??[],u=t.rows.length,d=!n&&!i&&a.length<u,g=`${m}-${t.label.replaceAll(` `,`-`)}`;return(0,X.jsxs)(`div`,{"data-slot":`quick-list-bucket`,"data-bucket":t.label,children:[(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-2 pr-[6px]`,children:[(0,X.jsx)(Ng,{id:g,bucket:t,collapsed:i,cut:d,onToggle:h.toggle}),d?(0,X.jsx)(Mg,{section:t.label,shown:a.length,total:u,scope:r,view:f,automations:p}):null,o&&c?(0,X.jsx)(Hg,{label:t.label,headingId:g,projectName:l,counts:c,onSweep:o,sweeping:s}):null]}),(0,X.jsx)(`div`,{id:`${g}-rows`,hidden:i,children:!i&&a.map(e=>(0,X.jsx)(`div`,{children:v(e,t.label===`Working`)},e.run.id))})]},t.label)})})}function Mg({section:e,shown:t,total:n,scope:r,view:i,automations:a}){let o=cc();return(0,X.jsxs)(q,{to:ba(r,Ga(e,i,a)),onClick:o,"data-slot":`section-cut-link`,"aria-label":`${e}: showing ${t} of ${n}, see all`,title:`The sidebar shows ${t} of ${n} ${e} tasks. Click to see all of them. Change the limit in ${Ym(`sidebar`)}.`,className:`mr-auto -ml-1 flex min-h-[44px] min-w-[44px] shrink-0 items-center rounded-[4px] px-1 text-xs font-normal text-soft-foreground tabular-nums underline decoration-dotted underline-offset-[3px] hover:text-foreground focus-visible:outline-2 focus-visible:outline-link-foreground md:min-h-[26px] md:min-w-0 no-hover:min-h-[44px] no-hover:min-w-[44px]`,children:[t,` of `,n]})}function Ng({id:e,bucket:t,collapsed:n,cut:r,onToggle:i}){let a=t.rows.length;if(t.label===`Archived`)return(0,X.jsx)(`h2`,{id:e,className:`min-w-0 flex-1 text-xs font-medium text-soft-foreground`,children:(0,X.jsxs)(`span`,{className:`px-[10px] pt-[2px] pb-[4px]`,children:[t.label,` `,a]})});let o=t.label,s=t.rows.map(e=>e.run),l=s.length?op(Fa(s)):null,u=s.some(Za),d=n?Lr:Tr;return(0,X.jsx)(`h2`,{id:e,className:c(`min-w-0 text-xs font-medium text-soft-foreground`,r?`shrink-0`:`flex-1`),children:(0,X.jsxs)(`button`,{type:`button`,"data-slot":`section-toggle`,"aria-expanded":!n,"aria-controls":`${e}-rows`,"aria-label":`${o} ${a}`,onClick:()=>i(o),className:c(`flex min-h-[44px] items-center gap-1.5 rounded-[4px] px-[10px] text-left hover:bg-sidebar-row-hover hover:text-foreground focus-visible:outline-2 focus-visible:outline-link-foreground md:min-h-[26px] no-hover:min-h-[44px]`,r?`pr-[4px]`:`w-full`),children:[(0,X.jsx)(d,{className:`size-[12px] shrink-0`,"aria-hidden":`true`}),(0,X.jsx)(`span`,{children:o}),r?null:(0,X.jsxs)(X.Fragment,{children:[` `,(0,X.jsx)(`span`,{className:`font-normal tabular-nums`,children:a})]}),l&&(o===`Needs you`||n)?(0,X.jsx)(J,{tone:l.tone,shape:l.shape,pulse:l.pulse,role:`img`,"aria-label":l.label,title:l.label}):null,n&&u?(0,X.jsx)(`span`,{role:`img`,"aria-label":`unread`,title:`Unread tasks`,className:`size-[5px] shrink-0 rounded-full bg-foreground`}):null]})})}function Pg({view:e,current:t,onSelect:n,count:r,children:i}){let a=e===t;return(0,X.jsxs)(`button`,{type:`button`,"data-slot":`view-tab`,"data-view":e,"aria-pressed":a,onClick:()=>n(e),className:c(`flex min-h-11 min-w-0 flex-1 items-center justify-center gap-1.5 rounded-[7px] text-xs font-medium text-muted-foreground md:min-h-[22px]`,a&&`bg-card font-semibold text-foreground shadow-xs`),children:[i,r>0?(0,X.jsx)(`span`,{className:`font-mono text-xs tabular-nums`,children:r}):null]})}function Fg(){let e=hg(),t=_g();return e||!t}function Ig(e){let t=document.createRange();t.selectNodeContents(e);let n=t.getBoundingClientRect?.().width,r=e.querySelector(`[data-reference-width]`),i=r?Math.max(0,Number(r.dataset.referenceWidth)-r.getBoundingClientRect().width):0;return Math.ceil((n||e.scrollWidth)+i)}function Lg(e,t,n){let[r,i]=Y.useState(!1),[a,o]=Y.useState(0),s=Y.useRef(!1),c=Y.useRef(!1),l=Y.useRef(null),u=Y.useCallback(e=>{s.current=e,i(e)},[]);return Y.useLayoutEffect(()=>{let r=e.current;if(!t||!r||typeof ResizeObserver>`u`){l.current=null,u(!1);return}let i=!0,a=()=>{if(i){if(l.current?.key!==n){if(s.current){u(!1),o(e=>e+1);return}l.current={key:n,width:Ig(r)}}u(l.current.width>r.clientWidth)}};a();let d=new ResizeObserver(a);d.observe(r);let f=new WeakMap,p=new ResizeObserver(e=>{let t=!1;for(let n of e??[]){let e=n.borderBoxSize?.[0]?.inlineSize??n.contentRect.width,r=f.get(n.target);f.set(n.target,e),r!==void 0&&r!==e&&(t=!0)}!t||!i||(l.current=null,a())}),m=new Set,h=()=>{let e=!1;for(let t of[...r.children,...r.querySelectorAll(`[data-slot="reference-list"] [data-slot="pr-chip"], [data-slot="reference-list"] [data-slot="issue-chip"]`)]){let{slot:n}=t.dataset;n===`task-row-age`||t.getAttribute(`aria-hidden`)===`true`||m.has(t)||(m.add(t),f.set(t,t.getBoundingClientRect().width),p.observe(t),e=!0)}return e};h();let g=typeof MutationObserver>`u`?null:new MutationObserver(()=>{!h()||!i||(l.current=null,a())});return g?.observe(r,{childList:!0,subtree:!0}),document.fonts&&document.fonts.status!==`loaded`&&!c.current&&document.fonts.ready.then(()=>{c.current=!0,i&&(l.current=null,a())}),()=>{i=!1,d.disconnect(),p.disconnect(),g?.disconnect()}},[e,t,n,a,u]),t&&r}function Rg(){return(0,X.jsx)(`span`,{"aria-hidden":`true`,children:` · `})}function zg({run:e,queuePosition:t,currentRunId:n,now:r,scope:i,inWorkingGroup:a=!1,onTogglePin:o,onArchiveRun:s}){let l=xa(),u=cc(),d=Fg(),f=!!s&&d&&Oa(e),p=mh({id:e.id,enabled:f,onArchive:()=>s?.(e)}),m=ba(i,`/tasks/${e.id}`),h=Pe(e),g=e.id===n,{title:_,displayTitle:v}=xg(e),y=Za(e),b=bg({run:e,attention:h,queuePosition:t,inWorkingGroup:a,scope:i,now:r}),[x,S]=Y.useState(null);return(0,X.jsx)(og,{inertReferences:d,swipeable:f,swipe:p,title:_,onArchive:()=>void s?.(e),children:(0,X.jsxs)(`div`,{"data-slot":`task-row`,"data-run-id":e.id,"data-active":g?`true`:void 0,onClick:e=>{e.currentTarget.contains(e.target)&&(e.target.closest(`a, button, input`)||(l(m),u?.()))},...f?p.bind:{},style:p.offset?{transform:`translateX(${p.offset}px)`}:void 0,className:c(`selection-row group/task-row flex cursor-pointer items-start gap-2.5 rounded-[6px] py-1.5 pr-2 pl-2.5 hover:bg-sidebar-row-hover`,f&&`select-none`,f&&p.phase!==`dragging`&&`motion-safe:transition-transform motion-safe:duration-200 motion-safe:ease-out`,g&&`bg-sidebar-row-selected hover:bg-sidebar-row-selected`),children:[(0,X.jsx)(`span`,{"data-slot":`task-row-dot`,className:`flex h-[19px] w-[12px] shrink-0 items-center justify-center`,children:(0,X.jsx)(J,{tone:h.tone,shape:h.shape,pulse:h.pulse,"aria-label":op(e,h).label,title:op(e,h).label,role:`img`})}),(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,X.jsx)(Bg,{run:e,to:m,title:_,displayTitle:v,isActive:g,unread:y,swipeable:f,onNavigate:u}),(0,X.jsx)(Vg,{run:e,meta:b,title:_,scope:i,isActive:g,inertReferences:d,overflowContainer:x})]}),b.references.length?(0,X.jsx)(`span`,{ref:S,"data-slot":`protected-reference-overflow`,className:c(`shrink-0 self-end empty:hidden`,d&&`-my-1.5 self-center`)}):null,e.delegation?.role===`worker`?(0,X.jsxs)(`span`,{className:`sr-only`,children:[`Worker · `,op(e,h).label]}):null,(0,X.jsx)(ag,{run:e,title:_,unread:y,inertReferences:d,onTogglePin:o,onArchiveRun:s})]})})}function Bg({run:e,to:t,title:n,displayTitle:r,isActive:i,unread:a,swipeable:o,onNavigate:s}){return(0,X.jsxs)(q,{to:t,onClick:s,title:n,"aria-current":i?`page`:void 0,draggable:!o&&void 0,className:`flex h-[19px] min-w-0 items-center gap-2 rounded-[2px] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-link-foreground`,children:[(0,X.jsx)(`span`,{"data-slot":`task-row-title`,className:c(`min-w-[7rem] flex-1 truncate text-[13px] leading-[1.45] font-medium text-muted-foreground`,a&&`font-semibold text-foreground`,i&&`text-foreground`),children:r}),e.diffStat?(0,X.jsx)(so,{stat:e.diffStat,className:`hidden shrink-0 text-[12px] @min-[23rem]/sidebar:inline`}):null]})}function Vg({run:e,meta:t,title:n,scope:r,isActive:i,inertReferences:a,overflowContainer:o}){let{stateWord:s,references:l,age:u,key:d}=t,f=yi(),p=Y.useRef(null),m=Lg(p,!!u,d);pg(p,!a&&l.length>0,`${d}|${+!!m}`);let h=[];return s&&h.push((0,X.jsx)(`span`,{"data-slot":`task-row-state`,children:s},`state`)),l.length&&h.push((0,X.jsx)(eg,{references:l,maxVisible:2,taskTitle:n,projectId:r??f.projectId,repoBase:f.repoBase,runId:e.id,plain:!0,compact:!0,inertInline:a,fitContainer:!0,overflowContainer:o},`references`)),u&&!m&&h.push((0,X.jsx)(`span`,{"data-slot":`task-row-age`,className:`tabular-nums`,children:u},`age`)),(0,X.jsxs)(`div`,{ref:p,"data-slot":`task-row-meta`,className:c(`h-[16px] min-w-0 truncate text-xs leading-[1.4] font-normal text-soft-foreground`,cg,i&&`text-muted-foreground`),children:[e.notify===!0?(0,X.jsx)(`span`,{"data-slot":`task-row-notify`,role:`img`,"aria-label":`Notifying the task webhook`,title:`Notifying the task webhook`,className:`mr-[4px] inline-block shrink-0 align-[-1px]`,children:(0,X.jsx)(Zs,{"aria-hidden":`true`,className:`size-[10px]`})}):null,h.length?h.flatMap((e,t)=>t?[(0,X.jsx)(Rg,{},`sep-${t}`),e]:[e]):e.notify===!0?null:`\xA0`]})}function Hg({label:e,headingId:t,projectName:n,counts:r,onSweep:i,sweeping:a}){let o=e===`Finished`?`unpinned`:null;if(!o||r[o]===0)return null;let s=a===o,c=`Archive all`;return(0,X.jsxs)(`button`,{type:`button`,"data-action":`archive-group`,"data-scope":o,disabled:s,"aria-busy":s?`true`:void 0,"aria-label":n?`${c}, ${n}`:void 0,"aria-describedby":t,onClick:()=>i(o),className:`relative inline-flex shrink-0 items-center gap-1 rounded-[4px] px-1.5 py-0.5 font-sans text-xs leading-[1.4] text-muted-foreground hover:bg-sidebar-row-hover hover:text-foreground focus-visible:outline-2 focus-visible:outline-link-foreground disabled:opacity-60 max-md:before:absolute max-md:before:top-1/2 max-md:before:left-0 max-md:before:h-11 max-md:before:w-full max-md:before:-translate-y-1/2 max-md:before:content-[''] no-hover:before:absolute no-hover:before:top-1/2 no-hover:before:left-0 no-hover:before:h-11 no-hover:before:w-full no-hover:before:-translate-y-1/2 no-hover:before:content-['']`,children:[(0,X.jsx)(Fr,{className:`size-[11px]`,"aria-hidden":`true`}),c]})}function Ug({showViewControls:e=!0,projectId:t,boot:n=!1}){let r=cc(),i=t??a(),o=ne(i,!0,n),s=Oe(i,!0,n).data?.sidebarLimits??{},c=y(de({projectId:i,boot:n})),l=ah(de({projectId:i,boot:n}),r),u=ke(),[d,f,p]=Kp(),m=Ca(`/tasks/:id/*`),h=Ca(`/tasks/:id`),g=io(3e4),_=I(),v=t??_,b=De(v),x=Ba(Na(Ra(o.data??[],d,p),`active`),s),S=v===void 0?[]:x.flatMap(e=>e.rows.flatMap(({run:e})=>Fn(e,b).filter(e=>Mn(e,b)).map(e=>({projectId:v,kind:e.kind,number:e.number}))));return o.data?(0,X.jsx)(gi,{projectId:v,repoBase:b,requests:S,children:(0,X.jsx)(kg,{showViewControls:e,sidebarLimits:s,projectId:v==="default"?u.data?.bootProject??null:v??null,runs:o.data,view:d,automations:p,onViewChange:f,currentRunId:m?.params.id??h?.params.id??null,now:g,onTogglePin:(e,t)=>c.mutate({id:e.id,pinned:t}),onArchiveRun:l.archiveOne,onSweep:e=>l.sweep(e,p?d===`automations`:void 0),sweeping:l.sweeping})}):null}function Wg({view:e,automations:t,onSelect:n,counts:r}){let i=(0,X.jsx)(J,{tone:`pending`,pulse:!0,"data-slot":`waiting-dot`,"aria-label":`Needs you`});return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(Pg,{view:`active`,current:e,onSelect:n,count:r.active,children:[`Active`,r.activeWaiting>0&&e!==`active`?i:null]}),t?(0,X.jsxs)(Pg,{view:`automations`,current:e,onSelect:n,count:r.automations,children:[`Automations`,r.automationsWaiting>0&&e!==`automations`?i:null]}):null]})}var Gg=e=>e.available?null:e.hint??null,Kg=(e,t)=>u(t).includes(e.name);function qg(e,t){let n=e.checks.filter(e=>Kg(e,t));if(n.length&&!n.some(e=>e.available))return`no agent CLI found — install one to run tasks`;let r=n.find(t=>t.name===e.defaultRunner);return r&&!r.available?`default runner (${e.defaultRunner}) not found`:null}function Jg(e,t){let n=`Squawk v${e.version}`;if(t===void 0)return n;let r=qg(e,t);if(r)return`${n} · ${r}`;let i=e.checks.filter(e=>!e.available).map(e=>e.name);return i.length?`${n} · optional: ${i.join(`, `)} not installed`:n}function Yg(e){return e.forge?.available?null:e.forge?`GitHub is unreachable — ${e.forge.reason??`unknown reason`}. The GitHub tab is hidden until it comes back.`:`No GitHub remote detected — the GitHub tab is hidden. Every plain-git feature still works.`}function Xg({health:e,runners:t,sessionScope:n}){if(!e)return null;let r=qg(e,t);return(0,X.jsxs)(Li,{children:[(0,X.jsx)(Pi,{asChild:!0,children:(0,X.jsxs)(`button`,{type:`button`,"data-slot":`tools-menu-trigger`,"aria-label":`Tools`,title:Jg(e,t),className:`relative flex items-center gap-1.5 rounded-[6px] px-2 py-1.5 text-[12px] font-normal text-soft-foreground transition-colors hover:bg-sidebar-row-hover hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring data-[state=open]:bg-sidebar-row-selected data-[state=open]:text-foreground`,children:[(0,X.jsx)(gr,{className:`size-[15px]`,"aria-hidden":`true`}),r?(0,X.jsx)(J,{tone:`pending`,className:`absolute top-1 left-5 size-1.5`}):null,`Tools`]})}),(0,X.jsxs)(Fi,{side:`top`,align:`start`,"data-slot":`tools-menu-content`,className:`w-[240px]`,children:[n?(0,X.jsx)(`div`,{className:`px-2 py-2`,children:n}):null,(0,X.jsx)(Oi,{className:`text-xs font-semibold tracking-[.04em] text-soft-foreground uppercase`,children:`Installed tools`}),e.checks.map(e=>e.available?(0,X.jsx)(Zg,{check:e},e.name):(0,X.jsx)(Qg,{check:e},e.name)),Yg(e)?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Mi,{}),(0,X.jsx)(`p`,{"data-slot":`forge-note`,className:`px-2 py-1.5 text-xs leading-snug text-muted-foreground`,children:Yg(e)})]}):null,(0,X.jsx)(Mi,{}),(0,X.jsx)(K,{asChild:!0,children:(0,X.jsx)(H,{to:`/tools`,children:`Tools diagnostics`})}),(0,X.jsx)(K,{asChild:!0,children:(0,X.jsxs)(H,{to:zo,"data-slot":`tools-settings`,className:`gap-2 text-[13px] text-muted-foreground`,children:[(0,X.jsx)(or,{className:`size-3.5`,"aria-hidden":`true`}),`Tool settings`]})})]})]})}function Zg({check:e}){let t=gp(e);return(0,X.jsxs)(`div`,{"data-slot":`tool-row`,"data-tool":e.name,"data-available":`true`,className:`flex items-center gap-2 rounded-sm px-2 py-1.5`,children:[(0,X.jsx)(J,{tone:t.availability.tone,shape:t.availability.shape}),(0,X.jsx)(`span`,{className:`font-mono text-[13px] font-medium`,children:e.name}),t.mode?(0,X.jsx)(`span`,{"data-slot":`tool-dry-run`,title:t.rawVersion,className:`ml-auto shrink-0 rounded-full border border-border bg-muted px-2 py-0.5 text-xs font-medium text-muted-foreground`,children:t.mode.label}):(0,X.jsx)(`span`,{"data-slot":`tool-version`,className:`ml-auto font-mono text-xs font-medium text-muted-foreground tabular-nums`,children:t.version??t.availability.label})]})}function Qg({check:e}){let t=Gg(e),n=gp(e);return(0,X.jsx)(K,{asChild:!0,children:(0,X.jsxs)(H,{to:Ro(e.name),"data-slot":`tool-row`,"data-tool":e.name,"data-available":`false`,className:`flex-col items-stretch gap-1`,children:[(0,X.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(J,{tone:n.availability.tone,shape:n.availability.shape}),(0,X.jsx)(`span`,{className:`font-mono text-[13px] font-medium`,children:e.name}),(0,X.jsx)(`span`,{"data-slot":`tool-version`,className:`ml-auto text-xs font-medium text-muted-foreground`,children:n.availability.label})]}),(0,X.jsxs)(`span`,{className:`flex items-end justify-between gap-3 pl-[15px]`,children:[t?(0,X.jsx)(`span`,{"data-slot":`tool-hint`,className:`min-w-0 text-xs leading-snug text-muted-foreground`,children:t}):null,(0,X.jsx)(`span`,{"data-slot":`tool-setup`,className:`ml-auto shrink-0 text-xs font-semibold text-accent-text`,children:`Set up →`})]})]})})}function $g(e){return e?.trim()||null}function e_({projectName:e,pageLabel:t}){let n=$g(e),r=$g(t);return n&&r?`${n} — ${r} · Squawk`:n?`${n} · Squawk`:r?`${r} · Squawk`:`Squawk`}function t_(e){let t=e_(e);(0,Y.useEffect)(()=>{document.title=t},[t])}function n_({...e}){return(0,X.jsx)(Ic,{"data-slot":`alert-dialog`,...e})}function r_({...e}){return(0,X.jsx)(Lc,{"data-slot":`alert-dialog-portal`,...e})}function i_({className:e,...t}){return(0,X.jsx)(Rc,{"data-slot":`alert-dialog-overlay`,className:c(`fixed inset-0 z-50 bg-black/50 motion-safe:data-[state=closed]:animate-out data-[state=closed]:fade-out-0 motion-safe:data-[state=open]:animate-in data-[state=open]:fade-in-0 motion-reduce:data-[state=open]:animate-none motion-reduce:data-[state=closed]:animate-none`,e),...t})}function a_({className:e,...t}){return(0,X.jsxs)(r_,{children:[(0,X.jsx)(i_,{}),(0,X.jsx)(zc,{"data-slot":`alert-dialog-content`,className:c(`fixed inset-bs-[50%] start-[50%] z-50 grid max-h-[calc(100dvh-2rem)] overflow-y-auto overscroll-contain w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border bg-card p-6 shadow-modal duration-200 outline-hidden motion-safe:data-[state=closed]:animate-out data-[state=closed]:fade-out-0 motion-safe:data-[state=closed]:zoom-out-95 motion-safe:data-[state=open]:animate-in data-[state=open]:fade-in-0 motion-safe:data-[state=open]:zoom-in-95 motion-reduce:data-[state=open]:animate-none motion-reduce:data-[state=closed]:animate-none sm:max-w-md`,e),...t})]})}function o_({className:e,...t}){return(0,X.jsx)(`div`,{"data-slot":`alert-dialog-header`,className:c(`flex flex-col gap-2 text-center sm:text-start`,e),...t})}function s_({className:e,...t}){return(0,X.jsx)(`div`,{"data-slot":`alert-dialog-footer`,className:c(`flex flex-col-reverse gap-2 sm:flex-row sm:justify-end`,e),...t})}function c_({className:e,...t}){return(0,X.jsx)(Hc,{"data-slot":`alert-dialog-title`,className:c(`text-lg leading-none font-semibold`,e),...t})}function l_({className:e,...t}){return(0,X.jsx)(Uc,{"data-slot":`alert-dialog-description`,className:c(`text-sm text-muted-foreground`,e),...t})}function u_({className:e,...t}){return(0,X.jsx)(Bc,{"data-slot":`alert-dialog-action`,className:c(xi({variant:`contrast`}),e),...t})}function d_({className:e,...t}){return(0,X.jsx)(Vc,{"data-slot":`alert-dialog-cancel`,className:c(xi({variant:`outline`}),e),...t})}function f_(e){let t=wa(e);return/^\/git\/branches(?:\/|$)/.test(t)?`branches`:/^\/git\/not-landed(?:\/|$)/.test(t)?`not-landed`:/^\/git\/cleanup(?:\/|$)/.test(t)?`cleanup`:/^\/git\/changes(?:\/|$)/.test(t)?`changes`:/^\/git(?:\/commits(?:\/[^/]+)?)?\/?$/.test(t)?`main`:null}var p_={main:`/git`,"not-landed":`/git/not-landed`,cleanup:`/git/cleanup`,branches:`/git/branches`,changes:`/git/changes`},m_=`/git?view=repo`,h_={second:1,minute:60,hour:3600,day:86400,week:7*86400,month:30*86400,year:365*86400};function g_(e,t,n=Date.now()){let r=t?co(t,n):``;if(r)return r;let i=/^(\d+) (second|minute|hour|day|week|month|year)s?(?:, (\d+) (second|minute|hour|day|week|month|year)s?)? ago$/.exec(e.trim());return i?uo(Number(i[1])*h_[i[2]]+(i[3]?Number(i[3])*h_[i[4]]:0)):e}function __(e,t){let n=t?Date.parse(t):NaN;return Number.isFinite(n)?new Date(n).toLocaleString():e}function v_(e){let t=new Date(e);return t.setHours(0,0,0,0),t.getTime()}var y_=new Intl.DateTimeFormat(`en-US`,{weekday:`short`,month:`short`,day:`numeric`}),b_=new Intl.DateTimeFormat(`en-US`,{month:`short`,day:`numeric`,year:`numeric`});function x_(e,t){let n=Date.parse(e);if(Number.isNaN(n))return`Earlier`;let r=v_(t);if(n>=r)return`Today`;if(n>=v_(r-1))return`Yesterday`;let i=new Date(n);return(i.getFullYear()===new Date(t).getFullYear()?y_:b_).format(i)}function S_(e,t=Date.now()){let n=[];for(let r of e){let e=x_(r.at,t),i=n.at(-1);i?.label===e?i.commits.push(r):n.push({label:e,commits:[r]})}return n}function C_(e,t=Date.now()){return e.filter(e=>x_(e.at,t)===`Today`).length}function w_(e,t){return(e.baseBranch??t.branch)===t.branch?e.tracking:null}function T_(e,t=Date.now()){let n=e.fetchedAt?co(e.fetchedAt,t):``;return n?`fetched ${fo(n)}`:`never fetched`}function E_(e,t,n){return!e?.repo||t!=="default"&&t!==e.bootProject?e:{...e,repo:{...e.repo,branch:n}}}function D_(e,t){let n=z(),r=[e,`repo`],i=[e,`health`],[a,o]=(0,Y.useState)(null),s=e=>B(e.message,{tone:`danger`}),c=()=>Promise.all([n.invalidateQueries({queryKey:r}),n.invalidateQueries({queryKey:i}),n.invalidateQueries({queryKey:h.projects})]),l=F({mutationFn:t=>Qe(t,e)}),u=async(e=!1)=>{let n=a?.branch??t.branch;try{let t=await l.mutateAsync(e?{branch:n,confirm:!0}:{branch:n});if(`risks`in t){o(t);return}o(null),B(t.summary),await c()}catch(e){o(null),B(e instanceof Error?e.message:String(e),{tone:`danger`}),await c()}},d=F({mutationFn:t=>It({name:t},e),onSuccess:async t=>{B(t.created?`Created and switched to ${t.branch}`:`Switched to ${t.branch}`),await c(),n.setQueryData(r,e=>e?.info?{...e,info:{...e.info,branch:t.branch}}:e),n.setQueryData(i,n=>E_(n,e,t.branch))},onError:s}),f=F({mutationFn:t=>ot({baseBranch:t},e),onSuccess:t=>{B(t.baseBranch?`New tasks now start from ${t.baseBranch}`:`New tasks now start from the checked-out branch`),n.invalidateQueries({queryKey:r}),n.invalidateQueries({queryKey:[e,`config`]})},onError:s});return{hasRemote:!!t.remote,pull:u,pulling:l.isPending,confirmation:a,dismissConfirmation:()=>{l.isPending||o(null)},switchBranch:d,setBase:f}}var O_={sidebar:{card:`gap-[8px] rounded-[8px] p-[10px]`,branchRow:`gap-[6px]`,branchIcon:`size-[14px]`,branch:`text-[12.5px]`,chevron:`size-[12px]`,pull:`h-[24px] gap-[4px] rounded-[6px] px-[8px] text-xs [&>svg]:size-[12px]`,line:`text-xs`,lineChevron:`size-[11px]`,dirty:`gap-[6px] pt-[6px] text-xs [&>svg]:size-[12px]`},screen:{card:`gap-[10px] rounded-[10px] p-[12px]`,branchRow:`gap-[8px]`,branchIcon:`size-[16px]`,branch:`text-[14px]`,chevron:`size-[14px]`,pull:`h-[36px] gap-[6px] rounded-[8px] px-[14px] text-[13px] [&>svg]:size-[14px]`,line:`text-[12px]`,lineChevron:`size-[12px]`,dirty:`h-[40px] gap-[8px] pt-[4px] text-[13px] [&>svg:first-child]:size-[14px] [&>svg:last-child]:size-[15px]`}};function k_({scope:e,repo:t,info:n,variant:r,onNavigate:i}){let a=O_[r],o=D_(e,n),s=t.baseBranch??n.branch,l=t.status.length,u=w_(t,n),d=o.switchBranch.isPending,f=(0,Y.useRef)(null);return(0,X.jsxs)(`section`,{"aria-label":`Checkout`,"data-slot":`git-checkout`,"data-variant":r,className:c(`flex flex-col border border-border`,a.card),children:[(0,X.jsxs)(`div`,{className:c(`flex min-w-0 items-center`,a.branchRow),children:[(0,X.jsxs)(Li,{children:[(0,X.jsxs)(Pi,{"data-slot":`git-branch-menu`,"aria-label":`Branch ${n.branch}. Switch branch`,disabled:d,className:c(`group flex min-w-0 flex-1 items-center rounded-[4px] text-left outline-none focus-visible:outline-2 focus-visible:outline-ring disabled:opacity-60`,a.branchRow,r===`screen`&&`min-h-11`),children:[(0,X.jsx)(Jn,{"aria-hidden":`true`,className:c(`shrink-0 text-muted-foreground`,a.branchIcon)}),(0,X.jsx)(`span`,{"data-slot":`git-checkout-branch`,className:c(`min-w-0 flex-1 truncate font-mono font-semibold text-foreground`,a.branch),children:n.branch}),(0,X.jsx)(Tr,{"aria-hidden":`true`,className:c(`shrink-0 text-soft-foreground group-hover:text-foreground`,a.chevron)})]}),(0,X.jsxs)(Fi,{align:`start`,className:`w-64`,children:[(0,X.jsx)(Oi,{className:`text-xs text-soft-foreground`,children:`Switch branch`}),(0,X.jsx)(Ii,{value:n.branch,onValueChange:e=>{e!==n.branch&&o.switchBranch.mutate(e)},children:t.branches.map(e=>(0,X.jsx)(ki,{value:e,"data-branch":e,className:`font-mono text-[12.5px]`,children:(0,X.jsx)(`span`,{className:`truncate`,children:e})},e))}),(0,X.jsx)(Mi,{}),(0,X.jsx)(K,{asChild:!0,children:(0,X.jsx)(q,{to:p_.branches,"data-slot":`git-branch-menu-all`,onClick:i,children:`Create or find a branch…`})})]})]}),(0,X.jsxs)(`button`,{ref:f,type:`button`,"data-action":`repo-pull`,disabled:!o.hasRemote||o.pulling,title:o.hasRemote?`Pull ${n.branch}`:`No remote configured. Add a Git remote before pulling.`,onClick:()=>void o.pull(),className:c(`inline-flex shrink-0 items-center bg-muted font-medium text-foreground hover:brightness-110 focus-visible:outline-2 focus-visible:outline-ring disabled:opacity-50 disabled:hover:brightness-100`,a.pull),children:[o.pulling?(0,X.jsx)(pi,{"aria-hidden":`true`,className:`motion-safe:animate-spin`}):(0,X.jsx)(Er,{"aria-hidden":`true`}),`Pull`]})]}),u?(0,X.jsx)(A_,{tracking:u,className:a.line}):null,(0,X.jsxs)(Li,{children:[(0,X.jsxs)(Pi,{"data-slot":`base-branch-picker`,"aria-label":`New tasks start from ${s}. Change the base branch`,disabled:o.setBase.isPending,className:c(`group flex min-w-0 items-center gap-[4px] self-start rounded-[4px] text-soft-foreground outline-none hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring disabled:opacity-60`,a.line,r===`screen`&&`min-h-[32px]`),children:[(0,X.jsx)(`span`,{className:`shrink-0`,children:`New tasks start from`}),(0,X.jsx)(`span`,{"data-slot":`base-branch`,className:`min-w-0 truncate font-mono text-muted-foreground group-hover:text-foreground`,children:s}),(0,X.jsx)(Tr,{"aria-hidden":`true`,className:c(`shrink-0`,a.lineChevron)})]}),(0,X.jsxs)(Fi,{align:`start`,className:`w-64`,children:[(0,X.jsx)(Oi,{className:`text-xs text-soft-foreground`,children:`New tasks start from`}),(0,X.jsxs)(Ii,{value:t.baseBranch??``,onValueChange:e=>o.setBase.mutate(e===``?null:e),children:[(0,X.jsx)(ki,{value:``,"data-branch":``,className:`text-[12.5px]`,children:`The checked-out branch (default)`}),t.branches.map(e=>(0,X.jsx)(ki,{value:e,"data-branch":e,className:`font-mono text-[12.5px]`,children:(0,X.jsx)(`span`,{className:`truncate`,children:e})},e))]})]})]}),l>0?(0,X.jsxs)(q,{to:p_.changes,"data-slot":`git-uncommitted`,onClick:i,className:c(`flex min-w-0 items-center border-t border-border text-muted-foreground hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring`,a.dirty),children:[(0,X.jsx)(kr,{"aria-hidden":`true`,className:`shrink-0 text-inbox-count-foreground`}),(0,X.jsxs)(`span`,{className:`min-w-0 flex-1 truncate`,children:[l,` uncommitted file`,l===1?``:`s`]}),(0,X.jsx)(Lr,{"aria-hidden":`true`,className:`shrink-0 text-soft-foreground`})]}):null,(0,X.jsx)(j_,{checkout:o,returnFocus:f})]})}function A_({tracking:e,className:t}){let n=e.ref.split(`/`)[0]||e.ref,r=T_(e);return(0,X.jsx)(`p`,{"data-slot":`git-freshness`,className:c(`flex min-w-0 items-center gap-[4px] text-soft-foreground`,t),children:e.behind>0?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`span`,{"data-slot":`git-behind`,className:`shrink-0 font-medium text-inbox-count-foreground`,children:[e.behind,` behind `,n]}),(0,X.jsxs)(`span`,{className:`min-w-0 truncate`,children:[`· `,r]})]}):(0,X.jsxs)(`span`,{className:`min-w-0 truncate`,children:[`up to date · `,r]})})}function j_({checkout:e,returnFocus:t}){return(0,X.jsx)(n_,{open:e.confirmation!==null,onOpenChange:t=>!t&&e.dismissConfirmation(),children:(0,X.jsxs)(a_,{onCloseAutoFocus:e=>{e.preventDefault(),t.current?.focus()},children:[(0,X.jsxs)(o_,{children:[(0,X.jsxs)(c_,{children:[`Pull `,e.confirmation?.branch,` anyway?`]}),(0,X.jsx)(l_,{asChild:!0,children:(0,X.jsxs)(`div`,{className:`space-y-2`,children:[e.confirmation?.risks.includes(`active_runs`)?(0,X.jsx)(`p`,{children:`An active session is using this repository. Pulling can change files while it works.`}):null,e.confirmation?.risks.includes(`dirty_tree`)?(0,X.jsx)(`p`,{children:`The checkout has dirty files. Git may refuse the pull to protect them.`}):null]})})]}),(0,X.jsxs)(s_,{children:[(0,X.jsx)(d_,{className:`h-11`,disabled:e.pulling,children:`Cancel`}),(0,X.jsx)(u_,{className:`h-11`,disabled:e.pulling||e.confirmation===null,onClick:t=>{t.preventDefault(),e.pull(!0)},children:e.pulling?`Pulling…`:`Pull anyway`})]})]})})}var M_={main:Cr,"not-landed":Hs,cleanup:Ts,branches:Jn};function N_(e,t){switch(e){case`main`:return t?`Recently on ${t}`:`Recent commits`;case`not-landed`:return`Not landed`;case`cleanup`:return`Cleanup`;case`branches`:return`All branches`;case`changes`:return`Uncommitted changes`}}var P_=[`main`,`not-landed`,`cleanup`,`branches`];function F_({branch:e,counts:t,variant:n,active:r,onNavigate:i}){let a=n===`screen`;return(0,X.jsx)(`nav`,{"aria-label":`Git sections`,"data-slot":`git-sections`,className:a?ei:$r,children:P_.map(n=>{let o=M_[n],s=!a&&r===n,l=t[n];return(0,X.jsxs)(q,{to:a&&n===`main`?m_:p_[n],"data-git-section":n,"aria-current":s?`page`:void 0,onClick:i,className:c(a?si:c(ai,`text-[12.5px]`),ni,s&&`bg-sidebar-row-selected text-foreground font-medium hover:bg-sidebar-row-selected`),children:[(0,X.jsx)(o,{"aria-hidden":`true`,className:a?ii:Qr}),(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:N_(n,e)}),l?(0,X.jsx)(`span`,{"data-slot":`git-section-count`,className:a?oi:ti,children:l}):null,a?(0,X.jsx)(Lr,{"aria-hidden":`true`,className:ri}):null]},n)})})}async function I_(e,t){return tn(await Ye.api.v1.p[`:projectId`].repo.branches.counts.$get({param:{projectId:t??a()}},Ze(e)),`/repo/branches/counts`)}function L_(e){return At({queryKey:[e,`repo`,`branches`,`counts`],queryFn:({signal:t})=>I_({signal:t},e)})}function R_(e,t,n){let r=P(e),i=L_(e),a=r.data?.totalBytes??null,o=i.data?.counts??null,s=t&&n===`screen`?C_(t.log):0;return{main:s>0?`${s} today`:null,"not-landed":o?.notLanded?String(o.notLanded):null,cleanup:a?Ln(a):r.data&&a===null&&o?.cleanup?String(o.cleanup):null,branches:t?String(i.data?.allBranches??t.branches.length):null}}function z_({scope:e}){let t=Te(e),{pathname:n}=hn(),r=cc(),i=t.data?.info?t.data:null,a=R_(e,i,`sidebar`);return(0,X.jsxs)(`div`,{"data-slot":`git-sidebar`,role:`region`,"aria-label":`Git`,className:Xr,children:[i?.info?(0,X.jsx)(k_,{scope:e,repo:i,info:i.info,variant:`sidebar`,onNavigate:r},e):t.isPending?(0,X.jsx)(`div`,{"data-slot":`git-checkout-placeholder`,"aria-hidden":`true`,className:`h-[94px] rounded-[8px] border border-border`}):null,t.isPending?null:(0,X.jsx)(F_,{branch:i?.info?.branch??null,counts:a,variant:`sidebar`,active:f_(n),onNavigate:r})]})}var B_=[`assigned`,`no-task`,`has-task`,`all`],V_=[`review`,`mine`,`failing`,`all`],H_=50,U_=`is:open review-requested:@me`,W_=`is:open status:failure`;function G_(e,t){return e===`prs`&&(t===`review`||t===`failing`)}function K_(e){return e===`review`?U_:e===`failing`?W_:null}function q_(e,t){return t===null?null:(e===`issues`?B_:V_).includes(t)?t:`all`}function J_(e,t,n,r=``){let i=`${n===void 0?e===`issues`?`/github`:`/github/prs`:`${e===`issues`?`/github/issues`:`/github/prs`}/${n}`}${r}`;return t===null?i:`${i}?filter=${encodeURIComponent(t)}`}function Y_(e,t){let n=t??`all`;return n===`all`?e===`issues`?`all`:`all-prs`:n}function X_(e){return e===`all`?{view:`issues`,filter:`all`}:e===`all-prs`?{view:`prs`,filter:`all`}:{view:e===`review`||e===`mine`||e===`failing`?`prs`:`issues`,filter:e}}var Z_=[{id:`assigned`,label:`Assigned to me`},{id:`no-task`,label:`No task yet`},{id:`has-task`,label:`Has a task`},{id:`all`,label:`All open`}],Q_=[{id:`review`,label:`Review requested`},{id:`mine`,label:`Mine`},{id:`failing`,label:`Checks failing`},{id:`all-prs`,label:`All open`}],$_=Object.fromEntries([...Z_,...Q_].map(e=>[e.id,e.label]));function ev(e){return e===null?``:`${e.value}${e.bound===`atLeast`?`+`:``}`}function tv(e,t){if(t?.bound===`atLeast`)return e===`review`||e===`failing`?`At least ${t.value}: GitHub search returns at most ${H_} results.`:`At least ${t.value}: only the loaded pages are counted. Scroll to load more.`}var nv=(e,t)=>e!==void 0&&t!==void 0&&e.toLowerCase()===t.toLowerCase();function rv(e){try{let t=new URL(e).pathname.split(`/`).filter(Boolean);return t.length>=2?`${t[0]}/${t[1]}`.toLowerCase():null}catch{return null}}function iv(e,t,n){return new Set(e.filter(e=>!e.archived).flatMap(e=>av(e,t,n)))}function av(e,t,n){let r=t?.toLowerCase();return Fn(e,void 0,n).filter(e=>e.kind===`Issue`&&(!e.url||r!==void 0&&rv(e.url)===r)).map(e=>e.number)}function ov(e,t,n,r){let i=new Map;for(let a of e)!Wa(a)&&av(a,n,r).includes(t)&&i.set(a.id,a);return[...i.values()].sort((e,t)=>Date.parse(t.createdAt)-Date.parse(e.createdAt)||e.id.localeCompare(t.id))}function sv(e,t){let n=new Map(t.map(e=>[e.number,e]));return e.map(e=>n.get(e.number)??e)}function cv(e){return e?.available?{value:e.items.length,bound:e.truncated?`atLeast`:`exact`}:null}function lv({gh:e,tasks:t,review:n,failing:r}){let i={assigned:null,"no-task":null,"has-task":null,all:null,review:cv(n),mine:null,failing:cv(r),"all-prs":null};if(!e?.available)return i;let a=!pe(e,`issues`),o=!pe(e,`prs`),s=(e,t)=>({value:e,bound:t?`atLeast`:`exact`}),c=t?e.issues.filter(e=>t.has(e.number)).length:null;return{...i,all:s(e.issuesTotal??e.issues.length,!1),"all-prs":s(e.prsTotal??e.prs.length,!1),assigned:e.viewerLogin?s(e.issues.filter(t=>t.assignees?.some(t=>nv(t,e.viewerLogin))).length,a):null,mine:e.viewerLogin?s(e.prs.filter(t=>nv(t.author,e.viewerLogin)).length,o):null,"has-task":c===null?null:s(c,a),"no-task":c===null?null:s(e.issues.length-c,a)}}var uv={assigned:hr,"no-task":Jr,"has-task":Pr,all:Ar,review:fi,mine:$n,failing:yr,"all-prs":Ar};function dv(e,t){return e===`assigned`||e===`mine`?t.identity:e===`no-task`||e===`has-task`?t.tasks:null}function fv({model:e,variant:t,activeId:n,onNavigate:r}){let i=t===`screen`;return(0,X.jsx)(X.Fragment,{children:[{key:`issues`,label:`Issues`,rows:Z_},{key:`prs`,label:`Pull requests`,rows:Q_}].map(t=>(0,X.jsxs)(`nav`,{"aria-label":t.label,"data-slot":`github-filter-group`,"data-group":t.key,className:i?ei:c(ci,t.key===`prs`&&`pt-[6px]`),children:[(0,X.jsx)(`h3`,{className:i?Yr:Zr,children:t.label}),t.rows.map(({id:t,label:a})=>{let o=uv[t],s=n===t,l=dv(t,e.blocked),u=e.counts[t],d=ev(u),f=c(i?si:c(ai,`text-[12.5px]`),l?`cursor-not-allowed opacity-60`:ni,s&&`bg-sidebar-row-selected text-foreground font-medium hover:bg-sidebar-row-selected`),p=(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(o,{"aria-hidden":`true`,className:i?ii:Qr}),(0,X.jsx)(`span`,{className:`truncate`,children:a}),d?(0,X.jsx)(`span`,{"data-slot":`gh-filter-count`,title:tv(t,u),className:i?oi:ti,children:d}):null,i?(0,X.jsx)(Lr,{"aria-hidden":`true`,className:c(ri,!d&&`ml-auto`)}):null]});if(l)return(0,X.jsxs)(`div`,{"data-gh-filter":t,"aria-disabled":`true`,title:l,className:f,children:[p,(0,X.jsx)(`span`,{className:`sr-only`,children:l})]},t);let{view:m,filter:h}=X_(t);return(0,X.jsx)(q,{to:J_(m,h),"data-gh-filter":t,"aria-current":s?`page`:void 0,onClick:r,className:f,children:p},t)})]},t.key))})}function pv(e){let t=Ce(e,50).data,n=t?.available===!0,r=ne(e,!0,e==="default"),i=re(e,`pr`,U_,n),a=re(e,`pr`,W_,n),o=(0,Y.useMemo)(()=>r.data?iv(r.data,t?.repo,e):null,[r.data,t?.repo,e]);return{gh:t,counts:(0,Y.useMemo)(()=>lv({gh:t,tasks:o,review:i.data,failing:a.data}),[t,o,i.data,a.data]),blocked:{identity:t?.available===!0&&!t.viewerLogin?`GitHub login unavailable.`:null,tasks:r.isError&&!r.data?`Task list unavailable.`:null}}}function mv(e){return/^\/github\/prs(?:\/|$)/.test(wa(e))?`prs`:`issues`}function hv({scope:e}){let t=pv(e),{pathname:n}=hn(),[r]=gn(),i=cc(),a=mv(n);return(0,X.jsx)(`div`,{"data-slot":`github-sidebar`,role:`region`,"aria-label":`GitHub`,className:Xr,children:(0,X.jsx)(fv,{model:t,variant:`sidebar`,activeId:Y_(a,q_(a,r.get(`filter`))),onNavigate:i})})}var gv=(0,Y.lazy)(()=>V(()=>import(`./accounts-section-BJPI6m7z.js`).then(e=>({default:e.GlobalAgentsSection})),__vite__mapDeps([5,1,2,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31]))),_v=(0,Y.lazy)(()=>V(()=>import(`./agent-config-section-C74gGUgR.js`).then(e=>({default:e.AgentConfigSection})),__vite__mapDeps([32,1,2,7,8,6,9,10,18,19,20,28,31,33,34,12,35]))),vv=(0,Y.lazy)(()=>V(()=>import(`./agent-defaults-section-lpKgMMNk.js`).then(e=>({default:e.AgentDefaultsSection})),__vite__mapDeps([36,1,2,6,7,8,9,10,13,18,19,37,23,38,39,25,26,14,28,40,29,30,21,22,24,41,42]))),yv=(0,Y.lazy)(()=>V(()=>import(`./appearance-NUe0p0BF.js`).then(e=>({default:e.AppearanceSection})),__vite__mapDeps([43,2,1,7,8,6,9,10,14,44,18,19]))),bv=(0,Y.lazy)(()=>V(()=>import(`./notifications-section-1cYsj6Kt.js`).then(e=>({default:e.NotificationsSection})),__vite__mapDeps([45,1,2,6,7,8,9,10,37,19,23,38,39]))),xv=(0,Y.lazy)(()=>V(()=>import(`./projects-section-B9MczGec.js`).then(e=>e.r).then(e=>({default:e.ProjectsSection})),__vite__mapDeps([46,1,2,7,8,6,9,10,11,12,13,18,19,47,23,24,48,39,28,29,42,49]))),Sv=(0,Y.lazy)(()=>V(()=>import(`./prompt-templates-section-B6B3YiYG.js`).then(e=>({default:e.PromptTemplatesSection})),__vite__mapDeps([50,1,2,7,8,6,9,10,13,18,19,47,23,24,48,39,51,22,21,52,28,40,41,42,49]))),Cv=(0,Y.lazy)(()=>V(()=>import(`./resources-section-EsUWF8Gp.js`).then(e=>({default:e.ResourcesSection})),__vite__mapDeps([53,2,1,6,7,8,9,10,11,12,13,18,19,37,23,38,39,28,29,41,42,49]))),wv=(0,Y.lazy)(()=>V(()=>import(`./session-context-section-Cc7O57OB.js`).then(e=>({default:e.SessionContextSection})),__vite__mapDeps([54,1,2,7,8,6,9,10,55,14,18,19,20,28,33,34,12,35]))),Tv=(0,Y.lazy)(()=>V(()=>import(`./sidebar-section-CJg8mwiE.js`).then(e=>({default:e.SidebarSection})),__vite__mapDeps([56,1,2,7,8,6,9,10,18,19]))),Ev=(0,Y.lazy)(()=>V(()=>import(`./worktrees-section-CJuySRx_.js`).then(e=>({default:e.WorktreesSection})),__vite__mapDeps([57,2,1,6,7,8,9,10,13,18,19,58,11,12,28,31,41,42,49,59,60,14,26,61,17,62,63,64,23,24,48,39,35]))),Dv=(0,Y.lazy)(()=>V(()=>import(`./archive-on-merge-field-BT4e_k9f.js`).then(e=>({default:e.TasksSection})),__vite__mapDeps([65,1,2,6,7,8,9,10,29,13]))),Ov=[{id:`sidebar`,title:`Sidebar`,description:`Overall and per-section task limits for this project.`,icon:wr,component:Tv,scope:`project`},{id:`agent-defaults`,title:`Agent defaults`,description:`Default runner, models and system prompt.`,icon:Pr,component:vv,scope:`project`},{id:`agent-config`,title:`Agent config`,description:`Edit the coding agents’ own config files, per scope.`,icon:Ls,component:_v,scope:`project`},{id:`session-context`,title:`Session context`,description:`Text Squawk puts at the start of every agent session it launches.`,icon:Rs,component:wv,scope:`project`},{id:`worktrees`,title:`Worktrees`,description:`How many finished task worktrees this project keeps on disk.`,icon:Bs,component:Ev,scope:`project`},{id:`prompt-templates`,title:`Prompt templates`,description:`Reusable snippets for follow-up instructions.`,icon:zs,component:Sv,scope:`project`},{id:`appearance`,title:`Appearance`,description:`Theme, density and reading width.`,icon:er,component:yv,scope:`global`},{id:`notifications`,title:`Notifications`,description:`Browser notifications when an agent needs you.`,icon:Or,component:bv,scope:`global`},{id:`resources`,title:`Resources`,description:`Parallel tasks and per-task memory limit, across every project.`,icon:wr,component:Cv,scope:`global`},{id:`tasks`,title:`Tasks`,description:`Automatic task archiving after pull requests merge.`,icon:Bs,component:Dv,scope:`global`},{id:`agents`,title:`Agents`,description:`Install, version and sign-in for each agent, and the agent and models a project uses when it has chosen none.`,icon:sr,component:gv,scope:`global`},{id:`projects`,title:`Projects`,description:`The workspace registry and where GitHub checkouts land.`,icon:ar,component:xv,scope:`global`}];function kv(e){return Ov.filter(t=>t.scope===e)}function Av(e,t){return e===`global`?`/settings/global/${t}`:`/settings/${t}`}var jv=Av(`global`,`appearance`);function Mv({projectId:e,projectName:t}){return(0,X.jsx)(`div`,{"data-slot":`settings-sidebar`,className:Xr,children:[`project`,`global`].map(n=>{let r=n===`project`?`This project${t?` · ${t}`:``}`:`Global · every project`,i=n===`project`?`/p/${encodeURIComponent(e)}/settings`:`/settings/global`,a=kv(n).map(e=>({id:e.id,title:e.title,icon:e.icon,to:`${i}/${e.id}`})),o=n===`project`?[{id:`general`,title:`General`,icon:or,to:i},...a]:a;return(0,X.jsxs)(`nav`,{"aria-label":r,"data-slot":`settings-nav`,"data-scope":n,className:c(`flex flex-col gap-px`,n===`global`&&`pt-[6px]`),children:[(0,X.jsx)(`h3`,{title:r,className:Zr,children:r}),o.map(({id:e,title:t,icon:n,to:r})=>(0,X.jsxs)(Sn,{to:r,end:!0,"data-section":e,className:({isActive:e})=>c(ai,ni,e&&`bg-sidebar-row-selected text-foreground font-medium hover:bg-sidebar-row-selected`),children:[(0,X.jsx)(n,{"aria-hidden":`true`,className:Qr}),(0,X.jsx)(`span`,{className:`truncate`,children:t})]},e))]},n)})})}var Nv=[{pattern:`/`,pageLabel:`Tasks`},{pattern:`/tasks`,pageLabel:`All tasks`},{pattern:`/tools`,pageLabel:`Workspace tools`},{pattern:`/new`,pageLabel:`New task`},{pattern:`/activity`,pageLabel:`Activity`},{pattern:`/git/not-landed`,pageLabel:`Git / Not landed`},{pattern:`/git/branches`,pageLabel:`Git / All branches`},{pattern:`/git/changes`,pageLabel:`Git / Uncommitted changes`},{pattern:`/git/cleanup`,pageLabel:`Git / Cleanup`},{pattern:`/git/*`,pageLabel:`Git`},{pattern:`/github/*`,pageLabel:`GitHub`},{pattern:`/automations/new`,pageLabel:`Automations / New automation`},{pattern:`/automations/:automationId`,pageLabel:`Automations / Edit automation`},{pattern:`/automations/*`,pageLabel:`Automations`},{pattern:`/skills`,pageLabel:`Skills`},{pattern:`/reports`,pageLabel:`Reports`},{pattern:`/workflows/*`,pageLabel:`Workflows`},{pattern:`/settings/*`,pageLabel:`Settings`}];function Pv(e){let t=wa(e),n=yn({path:`/tasks/:id/*`,end:!0},t);return n?{pageLabel:null,taskId:n.params.id??null}:{pageLabel:Nv.find(({pattern:e})=>yn({path:e,end:!0},t))?.pageLabel??null,taskId:null}}function Fv(e){let t=e?.repo;if(!t)return null;let n=t.root.replace(/[\\/]+$/,``).split(/[\\/]/).pop();return n?{name:n,branch:t.branch}:null}var Iv=e=>qa(e).waiting>0;function Lv(e,t,n){let r=t?.bootProject??n?.bootProject??null,i=e??r??`default`;return{bootProjectId:r,sidebarProjectId:i,sidebarBoot:i===r,isBootProject:e!==null&&e===r,activeProject:t?.projects.find(t=>t.id===e)}}function Rv(e,t,n,r,i,a){let o=e===`/tools`||e===`/settings/global`||e.startsWith(`/settings/global/`);return{globalSettings:o,projectName:o?null:t?.name??(n?Fv(r)?.name??null:null),titleRun:a,pageLabel:a?La(a):i.pageLabel}}function zv(e,t){return e?e.forge===`github`:t?.forge?.available===!0}function Bv(e,t,n,r,i,a){return/^\/settings(?:\/|$)/.test(e)?(0,X.jsx)(Mv,{projectId:n,projectName:i?.projects.find(e=>e.id===n)?.name??(r?Fv(a)?.name??null:null)}):/^\/github(?:\/|$)/.test(e)&&t?(0,X.jsx)(hv,{scope:de({projectId:n,boot:r}).cacheScope}):/^\/git(?:\/|$)/.test(e)?(0,X.jsx)(z_,{scope:de({projectId:n,boot:r}).cacheScope}):void 0}function Vv(e,t,n,r,i){return e===`/tools`?Fv(i):t?null:n?{name:n.name,branch:n.id===r?i?.repo?.branch??``:``}:Fv(i)}function Hv(e,t,n,r,i){let a=Sa(e)===null,o=n?`Tasks / ${i}`:e===`/tools`?`Tools`:i??(r.taskId===null?`Not found`:`Tasks`);return{project:a?`Workspace`:t,page:o,branch:n?.worktreePath?`Isolated worktree`:void 0}}function Uv(e,t,n,r){return e?(0,X.jsx)(Km,{...e,projectTarget:t.target,onSwitchProject:e=>void t.go(e),version:r}):n?(0,X.jsx)(Bm,{}):null}function Wv({children:e}){let{pathname:t}=hn(),n=Ea(),r=ke(),i=R(),a=(0,Y.useRef)(void 0);(0,Y.useEffect)(()=>{r.data&&(a.current=r.data)},[r.data]);let o=r.data??a.current,s=Wf(o),c=T(),l=c.data,u=qm(),d=Uf(),f=Pv(t),{bootProjectId:p,sidebarProjectId:m,sidebarBoot:h,isBootProject:g,activeProject:_}=Lv(n,l,r.data),v=ne(m,!0,h,Iv).data??!1,y=(0,Y.useCallback)(e=>{let t=e.find(e=>e.id===f.taskId);return t?{title:t.title,titleSummary:t.titleSummary,titleOrigin:t.titleOrigin,worktreePath:t.worktreePath}:void 0},[f.taskId]),b=ne(n??``,_!==void 0&&f.taskId!==null,l?.bootProject===n,y).data,{globalSettings:x,projectName:S,titleRun:C,pageLabel:w}=Rv(t,_,g,r.data,f,b);t_({projectName:S,pageLabel:w});let E=zv(_,r.data),D=Bv(wa(t),E,m,h,l,r.data),O=o?.version??null;return(0,X.jsxs)(Gp,{children:[(0,X.jsx)(Bd,{repo:Vv(t,x,_,p,r.data),breadcrumb:Hv(t,S,C,f,w),version:O,latestVersion:o?.latestVersion??null,forgeAvailable:E,automationsAvailable:s,banner:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Tm,{}),(0,X.jsx)(cm,{}),(0,X.jsx)(im,{})]}),sidebarList:D,taskQuickList:(0,X.jsx)(Ug,{projectId:m,boot:h}),sidebarProjectId:m,projectHeader:(0,X.jsx)(gu,{}),mobileProjects:u,needsYou:v,toolsMenu:(0,X.jsx)(Xg,{health:r.data,runners:i.data}),toolsStatus:r.data?{blocked:qg(r.data,i.data)!==null,note:Yg(r.data)}:null,projectRail:Uv(u,d,c.isPending,O),children:e}),(0,X.jsx)(Fp,{})]})}var Gv=`cez-accent`,Kv=`cez-density`,qv=`cez-width`,Jv=`cezarion`,Yv=`comfortable`,Xv=`narrow`;function Zv(e){return Jv}function Qv(e){return e===`comfortable`||e===`compact`||e===`ultra`?e:Yv}function $v(e){return e===`narrow`||e===`wide`?e:Xv}function ey(e){let t=e&&typeof e==`object`?e:{};return{accent:Zv(t.accent),density:Qv(t.density),width:$v(t.width)}}function ty(){try{return{accent:Zv(localStorage.getItem(Gv)),density:Qv(localStorage.getItem(Kv)),width:$v(localStorage.getItem(qv))}}catch{return{accent:Jv,density:Yv,width:Xv}}}function ny(e){try{localStorage.setItem(Gv,e.accent),localStorage.setItem(Kv,e.density),localStorage.setItem(qv,e.width)}catch{}}function ry(e,t){t.accent===`cezarion`?delete e.dataset.accent:e.dataset.accent=t.accent,t.density===`comfortable`?delete e.dataset.density:e.dataset.density=t.density,t.width===`narrow`?delete e.dataset.width:e.dataset.width=t.width}var iy=Y.createContext(null);function ay({children:e}){let t=z(),n=x(),[r,i]=Y.useState(ty),a=n.data;Y.useEffect(()=>{if(a===void 0)return;let e=ey(a.appearance);i(e),ny(e)},[a]),Y.useLayoutEffect(()=>{ry(document.documentElement,r)},[r]);let o=Y.useCallback(e=>{i(e),ny(e),Ct({appearance:e}).then(e=>t.setQueryData(h.uiState,e)).catch(e=>{B(e instanceof Error?e.message:String(e),{tone:`danger`}),t.invalidateQueries({queryKey:h.uiState})})},[t]),s=Y.useCallback(e=>o({...r,accent:e}),[o,r]),c=Y.useCallback(e=>o({...r,density:e}),[o,r]),l=Y.useCallback(e=>o({...r,width:e}),[o,r]),u=Y.useMemo(()=>({accent:r.accent,density:r.density,width:r.width,setAccent:s,setDensity:c,setWidth:l}),[r,s,c,l]);return(0,X.jsx)(iy.Provider,{value:u,children:e})}function oy(){let e=Y.useContext(iy);if(!e)throw Error(`Squawk: useAppearance() must be called inside <AppearanceProvider>`);return e}function sy(){let e=hn(),t=T();return Hf(),(0,Y.useEffect)(()=>{let n=mf(e,t.data);n!==null&&(gf(af(),n)||of(n),gf(yf(n.projectId),n)||bf(n))},[e.hash,e.pathname,e.search,t.data]),null}function cy(e){return{enabled:(e&&typeof e==`object`?e:{}).enabled===!0}}function ly(){let e=globalThis.Notification;if(typeof e!=`function`)return`unsupported`;let t=e.permission;return t===`granted`||t===`denied`?t:`default`}function uy(e,t){let n=new Map,r=[];for(let i of t??[]){let t={status:i.status,wantsAttention:Da(i)};n.set(i.id,t);let a=e.get(i.id);a!==void 0&&(a.status===t.status&&a.wantsAttention===t.wantsAttention||t.wantsAttention&&r.push(i))}return{entering:r,statuses:n}}function dy(e){return e.enabled&&e.hidden&&e.permission===`granted`}function fy(e){let t=Pe(e).label;return{title:e.titleSummary??e.title,body:`Task ${t}`,tag:`cezar-run-${e.id}`}}function py(){let e=z(),t=cy(x().data?.notifications).enabled,n=(0,Y.useRef)(t);return n.current=t,(0,Y.useEffect)(()=>{let t=e.getQueryCache(),r=new Map,i=new Map,a=new Map,o=new Set,s=new Map,c=0,l=e=>e.length===3&&typeof e[0]==`string`&&e[1]===`runs`&&e[2]===`list`,u=()=>{let e=new Set([...r.values()].flatMap(e=>[...e.keys()]));for(let t of i.keys())e.has(t)||(i.delete(t),a.delete(t),o.delete(t))},d=(e,t,s=!1,l=1/0)=>{let d=r.get(e),{statuses:f}=uy(new Map,t),p=t.filter(e=>{if((a.get(e.id)??0)>l)return!1;let t=d?.get(e.id),n=f.get(e.id),r=l===1/0?t:i.get(e.id);return t!==void 0&&r!==void 0&&(r.status!==n.status||r.wantsAttention!==n.wantsAttention)}),{entering:m,statuses:h}=uy(i,p);for(let[e,t]of f)!d?.has(e)&&!o.has(e)&&(a.get(e)??0)<=l&&(i.set(e,t),a.set(e,++c));for(let[e,t]of h){let n=i.get(e);n?.status===t.status&&n.wantsAttention===t.wantsAttention||(i.set(e,t),a.set(e,++c),o.add(e))}if(r.set(e,f),u(),!s&&m.length!==0&&dy({enabled:n.current,hidden:document.visibilityState===`hidden`,permission:ly()}))for(let e of m)my(e)};for(let e of t.getAll().sort((e,t)=>e.state.dataUpdatedAt-t.state.dataUpdatedAt))l(e.queryKey)&&Array.isArray(e.state.data)&&d(e.queryHash,e.state.data,!0);return t.subscribe(e=>{if(l(e.query.queryKey)){if(e.type===`removed`)r.delete(e.query.queryHash),s.delete(e.query.queryHash),u();else if(e.type===`updated`&&(e.action.type===`fetch`&&s.set(e.query.queryHash,c),e.action.type===`success`&&Array.isArray(e.query.state.data))){let t=e.action.manual?1/0:s.get(e.query.queryHash)??0;d(e.query.queryHash,e.query.state.data,!1,t),e.action.manual||s.delete(e.query.queryHash)}}})},[e]),null}function my(e){let t=globalThis.Notification;if(typeof t!=`function`)return;let n=fy(e);try{new t(n.title,{body:n.body,tag:n.tag})}catch{}}function hy(){return(0,X.jsx)(Uo,{route:`activity`,density:`sparse`,rootProps:{"aria-busy":`true`},header:{title:`Activity`},children:(0,X.jsx)(`p`,{"data-slot":`activity-loading`,role:`status`,className:`text-xs text-muted-foreground`,children:`Loading activity…`})})}function gy(){return(0,X.jsx)(Jo,{route:`github`,density:`sparse`,flushPadding:!0,children:(0,X.jsx)(Yo,{icon:(0,X.jsx)(pi,{className:`motion-safe:animate-spin`}),tone:`neutral`,title:`Loading GitHub…`,subtitle:`Fetching open issues and pull requests.`})})}function _y({skill:e,emphasized:t}){return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{className:c(`shrink-0 font-mono text-xs`,t&&`font-semibold`),children:e.name}),e.description?(0,X.jsx)(`span`,{title:e.description,className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null,e.path?(0,X.jsx)(`span`,{title:e.path,className:`min-w-0 truncate text-xs text-soft-foreground`,children:e.path}):null]})}var vy=80,yy=2e3,by=50,xy=200,Sy=50,Cy=[{id:`add-tests`,label:`Add tests`,text:`Also add or update tests covering this change.`},{id:`explain-change`,label:`Explain the change`,text:`Explain what changed and why before finishing.`},{id:`keep-minimal`,label:`Keep it minimal`,text:`Keep the change as small and targeted as possible — no unrelated refactors.`},{id:`update-docs`,label:`Update docs`,text:`Also update any relevant documentation or comments.`},{id:`check-edge-cases`,label:`Double-check edge cases`,text:`Double-check edge cases and error handling before finishing.`}];function wy(e){return!!e&&typeof e==`object`}function Ty(e){if(e===void 0||!Array.isArray(e))return Cy.map(e=>({...e}));let t=new Set,n=[];for(let r of e){if(!wy(r))continue;let e=typeof r.id==`string`?r.id.trim():``;if(e===`create-automation`)continue;let i=typeof r.label==`string`?r.label.trim():``,a=typeof r.text==`string`?r.text.trim():``;if(!e||!i||!a||t.has(e))continue;t.add(e);let o=Ey(r.skills);if(n.push({id:e,label:i.slice(0,vy),text:a.slice(0,yy),...o.length>0?{skills:o}:{}}),n.length>=by)break}return n}function Ey(e){if(!Array.isArray(e))return[];let t=new Set;for(let n of e){if(typeof n!=`string`)continue;let e=n.trim();if(!(!e||t.has(e))&&(t.add(e.slice(0,xy)),t.size>=Sy))break}return[...t]}function Dy(e,t){if(t.length===0)return[];let n=new Set(t);return e.filter(e=>e.skills?.some(e=>n.has(e)))}function Oy(e,t){return Dy(e,t).map(e=>e.text).join(`
|
|
5
|
+
`)),i=ce(e);for(let e of n)r.has(e)||i.dropProject(e);let a=[...r].filter(e=>!n.has(e));for(let e of a)i.restoreProject(e);a.length>0&&i.reconcile({hold:!0})},[e,c]),Y.useMemo(()=>o?{projects:o,signals:s,canReorder:a,onReorder:i}:null,[o,s,a,i])}var Jm={general:[`Settings`,`General`],webhooks:[`Settings`,`General`,`Webhooks`],providers:[`Settings`,`Agent defaults`,`Providers`],projects:[`Settings`,`Projects`],worktrees:[`Settings`,`Worktrees`],sidebar:[`Settings`,`Sidebar`]};function Ym(e,t=` → `){return Jm[e].join(t)}var Xm=60;function Zm(e){return`title`in e?`Archived "${e.title.length>Xm?`${e.title.slice(0,Xm-1)}…`:e.title}"`:`Archived ${e.count} ${e.count===1?`task`:`tasks`}`}async function Qm(e,t,n){let r=new Set(n),i=(await Promise.allSettled(t.map(async t=>{await Jt(we(t,{projectId:e}),!1),r.has(t)&&await nn(we(t,{projectId:e}),!0)}))).find(e=>e.status===`rejected`);i&&B(i.reason instanceof Error?i.reason.message:`Could not undo the archive.`,{tone:`danger`})}function $m(){let e=document.activeElement;return!e||e===document.body||!e.isConnected}function eh(e,t){if(!e.isConnected)return t();let n=new MutationObserver(()=>{e.isConnected||(n.disconnect(),clearTimeout(r),t())}),r=setTimeout(()=>n.disconnect(),5e3);n.observe(document.body,{childList:!0,subtree:!0})}function th(e,t){if(!$m())return;let n=e?.isConnected?e:t?.isConnected?t:null;n instanceof HTMLElement&&(n.tabIndex<0&&!n.hasAttribute(`tabindex`)&&(n.tabIndex=-1),n.focus({preventScroll:!0}))}function nh(e,t,n){if(!e)return()=>{};let r=t(e);return()=>eh(e,()=>th(r,n))}function rh(e){let t=document.activeElement?.closest(`[data-slot="task-row"]`);return t?.getAttribute(`data-run-id`)===e?t:Array.from(document.querySelectorAll(`[data-slot="task-row"]`)).find(t=>t.getAttribute(`data-run-id`)===e)??null}var ih=e=>e?.querySelector(`a`)??null;function ah(e,t){let n=e?.projectId,r=e?.cacheScope,i=fe(),[o,s]=Y.useState(null),c=e=>i.invalidateAfter(`runs`,de({projectId:n,cacheScope:e})),l=(e,t,r,i)=>B(e,{action:{label:`Undo`,onAction:()=>void Qm(n,r,i).finally(()=>void c(t))}}),u=Y.useRef(new Map);return{archiveOne:e=>{let i=u.current.get(e.id);if(i)return i;let o=r??a(),s=!!e.pinned,d=rh(e.id),f=nh(d,e=>{let t=Array.from(e.closest(`[data-slot="quick-list-bucket"]`)?.querySelectorAll(`[data-slot="task-row"]`)??[]),n=t.indexOf(e);return ih(t[n+1]??t[n-1])},d?.closest(`[data-slot="quick-list-bucket"]`)?.parentElement??null),p=Jt(we(e.id,{projectId:n}),!0).then(()=>(c(o),l(Zm({title:La(e)}),o,[e.id],s?[e.id]:[]),f(),t?.(),!0),e=>(B(e.message,{tone:`danger`}),!1)).finally(()=>u.current.delete(e.id));return u.current.set(e.id,p),p},sweep:(e,i)=>{let o=r??a();s(e);let u=document.activeElement,d=u?.matches(`[data-action="archive-group"]`)?u:null,f=nh(d,e=>ih(e.closest(`[data-slot="quick-list-bucket"]`)?.nextElementSibling?.querySelector(`[data-slot="task-row"]`)??void 0),d?.closest(`[data-slot="quick-list-bucket"]`)?.parentElement??null);Tt(de({projectId:n}),e,i).then(({ids:e,pinnedIds:n})=>{c(o),e.length>0&&l(Zm({count:e.length}),o,e,n),f(),e.length>0&&t?.()},e=>B(e.message,{tone:`danger`})).finally(()=>s(null))},sweeping:o}}var oh=.6,sh=300,ch=100,lh={offset:0,phase:`idle`,past:!1},uh=null;function dh(e,t){uh&&uh.id!==e&&uh.close(),uh={id:e,close:t}}function fh(e){uh?.id===e&&(uh=null)}function ph(){if(!(typeof navigator>`u`||typeof navigator.vibrate!=`function`))try{navigator.vibrate(10)}catch{}}function mh({id:e,enabled:t,onArchive:n}){let[r,i]=Y.useState(lh),a=Y.useRef(null),o=Y.useRef(null),s=Y.useRef(!1),c=Y.useRef(!1),l=Y.useRef(void 0),u=()=>{c.current=!0,clearTimeout(l.current),l.current=void 0},d=()=>{c.current&&(clearTimeout(l.current),l.current=setTimeout(()=>{c.current=!1},sh))};Y.useEffect(()=>()=>clearTimeout(l.current),[]);let f=Y.useRef(r);f.current=r;let p=Y.useRef(n);p.current=n;let m=Y.useCallback(()=>{o.current=null,s.current=!1,fh(e),i(lh)},[e]);Y.useEffect(()=>{!t&&f.current.phase!==`committing`&&m()},[t,m]),Y.useEffect(()=>()=>fh(e),[e]);let h=r.phase===`open`;Y.useEffect(()=>{if(!h)return;let e=()=>m(),t=e=>{let t=a.current;t&&e.target instanceof Node&&t.contains(e.target)||m()};return document.addEventListener(`scroll`,e,{capture:!0,passive:!0}),document.addEventListener(`pointerdown`,t,!0),()=>{document.removeEventListener(`scroll`,e,{capture:!0}),document.removeEventListener(`pointerdown`,t,!0)}},[h,m]);let g=t=>{fh(e),i({offset:-t,phase:`committing`,past:!0});let n=e=>{e===!1&&m()};try{let e=p.current();e&&typeof e.then==`function`&&e.then(n,m)}catch{m()}};return{offset:r.offset,phase:r.phase,past:r.past,surfaceRef:a,bind:{onPointerDown:e=>{if(c.current=!1,!t||f.current.phase===`committing`||e.pointerType===`mouse`&&e.button!==0)return;let n=(a.current??e.currentTarget).getBoundingClientRect();o.current={pointerId:e.pointerId,x0:e.clientX,y0:e.clientY,base:f.current.phase===`open`?-88:0,width:n.width>0?n.width:320,axis:null,wasOpen:f.current.phase===`open`,samples:[{x:e.clientX,t:Date.now()}]}},onPointerMove:t=>{let n=o.current;if(!n||t.pointerId!==n.pointerId)return;let r=t.clientX-n.x0,a=t.clientY-n.y0;if(n.axis===null){if(Math.max(Math.abs(r),Math.abs(a))<10||(n.axis=Math.abs(r)>Math.abs(a)?`x`:`y`,n.axis===`y`))return;try{t.currentTarget.setPointerCapture?.(t.pointerId)}catch{}dh(e,m),u()}if(n.axis!==`x`)return;let c=Math.min(0,Math.max(-n.width,n.base+r)),l=-c>=oh*n.width;l&&!s.current&&ph(),s.current=l,n.samples.push({x:t.clientX,t:Date.now()}),n.samples.length>8&&n.samples.shift(),i({offset:c,phase:`dragging`,past:l})},onPointerUp:t=>{let n=o.current;if(!n||t.pointerId!==n.pointerId)return;if(o.current=null,n.axis!==`x`){n.axis===null&&n.wasOpen&&(u(),d(),m());return}d();let r=f.current.offset,a=Date.now(),c={x:t.clientX,t:a},l=n.samples.find(e=>a-e.t<=ch&&e.t<a),p=l?(c.x-l.x)/(c.t-l.t):0;s.current=!1,f.current.past||p<=-1&&-r>=40?g(n.width):p<1&&-r>=40?(dh(e,m),i({offset:-88,phase:`open`,past:!1})):m()},onPointerCancel:e=>{let t=o.current;!t||e.pointerId!==t.pointerId||(o.current=null,d(),t.axis===`x`&&m())},onClickCapture:e=>{c.current&&(c.current=!1,e.preventDefault(),e.stopPropagation())},onKeyDownCapture:()=>{c.current=!1}},close:m}}function hh(e){let t=e.currentStepId?e.steps.find(t=>t.id===e.currentStepId):void 0;if(t?.backend)return t.backend;if(e.runner)return e.runner;for(let t=e.steps.length-1;t>=0;--t){let n=e.steps[t]?.backend;if(n)return n}return`claude`}function gh(e){return ka(e)?.runner??e.runner??`claude`}function _h(e,t,n,r,i,a){return a?e.workflowDef?.steps.find(n=>n.command===void 0&&n.kind!==`plugin`&&(n.runner??e.runner??`claude`)===t)?.agentProfile??(t===n?e.agentProfile:void 0)??i?.[t]:t===r?ka(e)?.agentProfile:i?.[t]}function vh(e,t,n,r,i=!1){let a=r?.original??gh(e),o=r?.target??a;if(e.delegation?.role===`worker`){let r=_h(e,t,a,o,n,i);if(r!==void 0||i)return r}if(t!==o)return n?.[t];let s=ja(e),c=s.profileId??`default`;return s.sessionId!==void 0&&s.backend===o&&(e.agentProfile??c)===c?c:(o===a?e.agentProfile:void 0)??n?.[t]}function yh(e,t,n){let r=ja(e),i=r.sessionId===void 0?{runner:e.runner??`claude`,account:e.agentProfile}:{runner:r.backend,account:r.profileId??e.agentProfile};return(i.runner===t?i.account:void 0)??n?.[t]}function bh(e,t,n){let r=e.find(e=>e.provider===t&&e.id===n);return r?.isDefault?void 0:r}function xh(e,t,n,r){return bh(n,t,vh(e,t,r))}function Sh(e,t,n,r){let i=mt(t,e);return i?.enabled===!1?{provider:e,usable:!1,reason:`${A(n,e)} is disabled. Enable it in ${Ym(`providers`)}.`}:r&&i?.authFailureId===void 0?r.status===void 0||r.status===`connected`?{provider:e,usable:!0}:{provider:e,usable:!1,reason:`${A(n,e)} account "${r.label}" is not signed in. Sign in in ${Ym(`providers`)}.`}:i?.status===`connected`?{provider:e,usable:!0}:{provider:e,usable:!1,reason:`${A(n,e)} credentials are unavailable. Authorize it in ${Ym(`providers`)}.`}}function Ch(e,t,n,r){return Sh(hh(e),t,n,r)}function wh(e,t,n,r){return Sh(gh(e),t,n,r)}function Th(e){let t=p(),n=R().data,r=hh(e),{accounts:i,repoAccount:a}=Xp(),o=bh(i,r,yh(e,r,a));return t.isSuccess&&t.data&&n?Ch(e,t.data,n,o):{provider:r,usable:!0}}function Eh(e){let t=p(),n=R(),r=gh(e),{accounts:i,repoAccount:a}=Xp(),o=xh(e,r,i,a);return t.isSuccess&&t.data&&n.data?wh(e,t.data,n.data,o):t.isError||n.isError?{provider:r,usable:!1,reason:`Provider authentication could not be verified.`}:{provider:r,usable:!1,reason:`Checking agent providers…`}}function Dh(e){return ja(e).sessionId}function Oh(e){return ja(e).backend}function kh(e){if(Pa(e)||e.cliHandoff===!1)return;let t=e.cliResumeCommand;if(t!==void 0)return e.worktreePath?`cd ${e.worktreePath} && ${t}`:t}function Ah(e,t){let n=Wr(t);return!n||Pa(e)?!1:n===Oh(e)&&Dh(e)!==void 0}function jh(e){return(e.status===`failed`||qt(e))&&(e.waits?.length??0)>0}function Mh(e,t){return t&&e.delegation?.role===`root`&&(e.status===`failed`||qt(e))}function Nh(e){return e.status===`cancelled`&&e.startedAt===void 0&&e.workflowDef!==void 0&&e.steps.every(e=>e.status===`pending`&&e.startedAt===void 0&&!e.sessionId)}function Ph(e){return Aa(e)&&e.removedRunner===void 0}function Fh(e,t=!1){let n=Pa(e),r=Dh(e)!==void 0;return{finish:e.status===`waiting`&&n||e.status===`review`,continueRun:(!n||e.removedRunner!==void 0&&e.status!==`queued`)&&!e.stopping&&e.delegation?.role!==`invalid`&&!(e.delegation?.role===`worker`&&e.delegation.destroy)&&(r||Nh(e)||e.removedRunner!==void 0),terminal:Bh(e,n,r),notes:!0,archive:!n,pin:!e.archived&&!Wa(e),markUnread:Qa(e)&&!Za(e),cancel:n||jh(e)||Mh(e,t),deleteRun:!n}}function Ih(e){return e.status===`waiting`&&e.finishBlocked===null&&Pe(e).bucket===`waiting`}function Lh(e){return`Merge head branch and resolve conflicts in ${e?`PR number ${e}`:`this pull request`}`}function Rh(e){return e===`review`?`Accept the changes without a PR`:`Close the session`}function zh(e,t){let n=e.filter(e=>!e.archived&&e.status===`queued`).sort((e,t)=>e.createdAt.localeCompare(t.createdAt)).findIndex(e=>e.id===t);return n>=0?n+1:void 0}function Bh(e,t,n){return e.cliHandoff!==!1&&!t&&n}var Vh=[50,100,200,400,800,1e3,1e3,1e3,1e3],Hh=e=>new Promise(t=>setTimeout(t,e));function Uh(e){return e instanceof Ge&&e.status===409&&e.message===`run is still active`}async function Wh(e,t=Hh){for(let n=0;;n+=1)try{return await e()}catch(e){let r=Vh[n];if(!Uh(e)||r===void 0)throw e;await t(r)}}function Gh(e){return Pa(e)?`live`:Fh(e).continueRun?`resume`:`unavailable`}function Kh(e,t){let n=ge(e.id,t),r=b(e.id,t),i=Th(e),a=Eh(e),[o,s]=(0,Y.useState)(void 0),[c,l]=(0,Y.useState)(!1),u=(0,Y.useRef)(!1),d=Gh(e),f=d===`resume`?!a.usable:d===`live`&&!i.usable,p=d===`unavailable`?`no-session`:f?`provider`:void 0,m=p===`no-session`?`This session has ended and no agent session was recorded, so the answer cannot be delivered.`:p===`provider`?d===`resume`?a.reason:i.reason:void 0,h=(e,t)=>a.usable?r.mutateAsync({text:e,...t===void 0?{}:{images:t}}):Promise.reject(Error(a.reason??`The run provider is unavailable.`));return{mode:d,blockedBy:p,reason:m,isPending:c||n.isPending||r.isPending,error:o,send:async(t,r)=>{if(p)return m;if(u.current)return`An answer is already being sent.`;u.current=!0,l(!0),s(void 0);try{if(d===`resume`){await Wh(()=>h(t,r));return}try{await n.mutateAsync({text:t,...r===void 0?{}:{images:r}})}catch(n){if(n instanceof Ge&&n.status===409&&Dh(e)!==void 0){try{await Wh(()=>h(t,r))}catch(e){let t=e instanceof Error?e.message:String(e);throw Error(`Session closed. Retry to reopen the session. ${t}`)}return}throw n}return}catch(e){let t=e instanceof Error?e.message:String(e);return s(t),t}finally{u.current=!1,l(!1)}}}}function qh({run:e,projectId:t,prNumber:n}){let r=Kh(e,t),i=vi(),[a,o]=(0,Y.useState)(!1),s=a||r.isPending,c=!!r.blockedBy,l=async()=>{if(s||c)return;let e=r.mode===`resume`;o(!0);try{let t=await r.send(Lh(n));t?B(t,{tone:`danger`}):(B(`${e?`Task reopened`:`Sent to the task`} — resolving conflicts${n?` in PR #${n}`:``}`),i())}finally{o(!1)}};return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(G,{type:`button`,size:`sm`,"data-slot":`reference-conflict-action`,disabled:c||s,onClick:()=>void l(),className:`h-7 w-full text-xs`,children:s?`Sending…`:`Resolve conflicts`}),c&&r.reason?(0,X.jsx)(`span`,{className:`block text-muted-foreground`,children:r.reason}):null]})}function Jh({projectId:e,runId:t,prNumber:n}){let r=ve(e,t);return r.data?(0,X.jsx)(qh,{run:r.data,projectId:e,prNumber:n}):(0,X.jsx)(G,{type:`button`,size:`sm`,disabled:!0,className:`h-7 w-full text-xs`,children:r.isError?`Unavailable`:`Loading…`})}function Yh({runId:e,prNumber:t}){let{projectId:n}=yi();return n===void 0?(0,X.jsx)(Xh,{runId:e,prNumber:t}):(0,X.jsx)(Jh,{projectId:n,runId:e,prNumber:t})}function Xh({runId:e,prNumber:t}){let n=j(e);return n.data?(0,X.jsx)(qh,{run:n.data,prNumber:t}):(0,X.jsx)(G,{type:`button`,size:`sm`,disabled:!0,className:`h-7 w-full text-xs`,children:n.isError?`Unavailable`:`Loading…`})}function Zh({run:e,reference:t,className:n,compact:r=!1,plain:i=!1,inert:a=!1}){let{projectId:o,repoBase:s}=yi(),c=o!==void 0&&t.number!==void 0?Pn(o,e.id,{kind:t.kind,number:t.number,url:t.url},s):void 0;return(0,X.jsx)(bi,{reference:t,taskTitle:La(e),to:c,conflictAction:Mn({...t,number:t.number??0},s)?(0,X.jsx)(Yh,{runId:e.id,prNumber:t.number}):void 0,className:n,compact:r,plain:i,inert:a})}var Qh=220;function $h({references:e,taskTitle:t,visibleCount:n,plain:r=!1,projectId:i,runId:a,repoBase:o}){let[s,c]=Y.useState(!1),l=Y.useRef(!1),u=Y.useRef(!1),d=Y.useRef(null),f=Y.useRef(void 0);Y.useEffect(()=>()=>clearTimeout(f.current),[]);let p=e=>e.pointerType!==`touch`,m=()=>clearTimeout(f.current),h=e=>{p(e)&&(m(),s||(l.current=!0),c(!0))},g=e=>{p(e)&&(m(),f.current=setTimeout(()=>c(!1),Qh))},_=e.length-n,v=e.slice(n).map(t=>{let n=e.some(e=>e!==t&&e.kind===t.kind&&e.number===t.number)&&t.url?new URL(t.url).pathname.split(`/`).slice(1,3).join(`/`):``;return`${t.kind} #${t.number}${n?` (${n})`:``}`}).join(`, `);return _<=0?null:(0,X.jsxs)(sa,{open:s,onOpenChange:c,children:[(0,X.jsx)(ra,{asChild:!0,children:(0,X.jsxs)(`button`,{type:`button`,"data-slot":`reference-overflow`,title:v,"aria-label":`Show all ${e.length} references for ${t}`,onPointerEnter:h,onPointerLeave:g,onPointerDown:e=>{e.stopPropagation(),u.current=s&&l.current,l.current=!1},onClick:e=>{e.stopPropagation(),s&&(u.current||l.current)&&(e.preventDefault(),m(),d.current?.focus()),u.current=!1,l.current=!1},className:`no-hover:min-h-[44px] no-hover:min-w-[44px] max-md:min-h-[44px] max-md:min-w-[44px] shrink-0 rounded-full px-1 text-xs font-medium text-soft-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:[`+`,_]})}),(0,X.jsxs)(aa,{ref:d,align:`start`,collisionPadding:8,className:`w-auto min-w-40 max-h-(--radix-popover-content-available-height) overflow-y-auto overscroll-contain p-1.5`,"data-slot":`reference-overflow-list`,onClick:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation(),onPointerEnter:h,onPointerLeave:g,onOpenAutoFocus:e=>{e.preventDefault(),!l.current&&e.target instanceof HTMLElement&&e.target.focus()},onKeyDownCapture:e=>{e.key===`Escape`&&(e.preventDefault(),l.current=!1,c(!1))},onCloseAutoFocus:e=>{l.current&&e.preventDefault()},children:[(0,X.jsx)(`p`,{className:`px-1 pb-1.5 text-xs text-soft-foreground`,children:`References`}),(0,X.jsx)(`span`,{className:`flex flex-col items-start gap-1`,children:e.map(e=>(0,X.jsx)(bi,{reference:e,taskTitle:t,projectId:i,repoBase:o,to:i===void 0?void 0:Pn(i,a,e,o),plain:r,className:`no-hover:min-h-[44px] max-md:min-h-[44px]`,conflictAction:i&&Mn(e,o)?(0,X.jsx)(Jh,{projectId:i,runId:a,prNumber:e.number}):void 0},Hn(e)))})]})]})}function eg({references:e,maxVisible:t,taskTitle:n,projectId:r,runId:i,repoBase:a,plain:o=!1,compact:s=!1,inertInline:c=!1,fitContainer:l=!1,overflowContainer:u}){let d=Y.useRef(null),[f,p]=Y.useState(t),m=Y.useRef(new Map),h=e.map(Hn).join(`|`);Y.useLayoutEffect(()=>{let n=d.current;if(!l||!n?.parentElement){p(t);return}let r=n.parentElement,i=()=>{[...n.querySelectorAll(`:scope > [data-slot="pr-chip"], :scope > [data-slot="issue-chip"]`)].forEach((t,n)=>{let r=t.getBoundingClientRect().width;r&&m.current.set(Hn(e[n]),r)});let i=r.getBoundingClientRect();if(!i.width)return;let a=Math.min(t,e.length);n.dataset.referenceWidth=String(e.slice(0,a).reduce((e,t)=>e+(m.current.get(Hn(t))??48),0)+Math.max(0,a-1)*4);let o=0;for(let e=n.nextElementSibling;e;e=e.nextElementSibling){if(e.getAttribute(`data-slot`)===`task-row-age`||e.getAttribute(`aria-hidden`)===`true`&&e.nextElementSibling?.getAttribute(`data-slot`)===`task-row-age`)continue;let t=getComputedStyle(e);o+=e.getBoundingClientRect().width+(parseFloat(t.marginLeft)||0)+(parseFloat(t.marginRight)||0)}let s=i.right-n.getBoundingClientRect().left-o,l=n.querySelector(`[data-slot="reference-overflow"]`)?.getBoundingClientRect().width||(c?44:26),d=Math.min(t,e.length);for(;d>0;){let t=u===void 0&&d<e.length,n=(t?d:Math.max(0,d-1))*4;if(e.slice(0,d).reduce((e,t)=>e+(m.current.get(Hn(t))??48),0)+n+(t?l:0)<=s+(d===e.length?u?.getBoundingClientRect().width??0:0))break;d--}p(d)};if(i(),typeof ResizeObserver>`u`)return;let a=new ResizeObserver(i);return a.observe(r),a.observe(n),()=>a.disconnect()},[l,t,h,c,e,u]);let g=Math.min(f,t,e.length),_=(0,X.jsx)($h,{references:e,visibleCount:g,taskTitle:n,projectId:r,runId:i,repoBase:a,plain:o});return(0,X.jsxs)(`span`,{ref:d,"data-slot":`reference-list`,className:`inline-flex max-w-full flex-nowrap items-center gap-1 align-middle`,children:[e.slice(0,g).map(e=>(0,X.jsx)(bi,{reference:e,taskTitle:n,projectId:r,repoBase:a,to:r===void 0?void 0:Pn(r,i,e,a),plain:o,compact:s,inert:c,className:`shrink-0`,conflictAction:r&&Mn(e,a)?(0,X.jsx)(Jh,{projectId:r,runId:i,prNumber:e.number}):void 0},Hn(e))),u===void 0?_:u?(0,ld.createPortal)(_,u):null]})}function tg({pinned:e,onToggle:t,className:n}){return(0,X.jsx)(`button`,{type:`button`,"data-slot":`pin-toggle`,"data-pinned":e?`true`:void 0,"aria-pressed":e,"aria-label":e?`Unpin task`:`Pin task`,title:e?`Unpin from the top of the list`:`Pin to the top of the list`,onClick:n=>{n.stopPropagation(),t(!e)},className:c(`inline-flex size-5 shrink-0 items-center justify-center rounded-sm text-soft-foreground transition-colors motion-reduce:transition-none hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,n,`max-md:min-h-11 max-md:min-w-11 no-hover:min-h-11 no-hover:min-w-11`),children:(0,X.jsx)(Xs,{"data-slot":`pin-icon`,className:`size-[12px]`,fill:e?`currentColor`:`none`,"aria-hidden":`true`})})}var ng=`opacity-0 group-hover/task-row:opacity-100 focus-visible:opacity-100 group-has-[:focus-visible]/task-row:opacity-100 no-hover:opacity-100`,rg=`opacity-0 group-hover/task-row:opacity-100 focus-visible:opacity-100 group-has-[:focus-visible]/task-row:opacity-100`,ig=`transition-opacity motion-reduce:transition-none group-hover/task-row:opacity-0 group-has-[:focus-visible]/task-row:opacity-0 max-md:absolute max-md:top-1/2 max-md:left-0 max-md:-translate-y-1/2 max-md:opacity-100 no-hover:absolute no-hover:top-1/2 no-hover:left-0 no-hover:-translate-y-1/2 no-hover:opacity-100`;function ag({run:e,title:t,unread:n,inertReferences:r,onTogglePin:i,onArchiveRun:a}){return(0,X.jsxs)(`span`,{"data-slot":`task-row-trailing`,className:`relative flex h-[19px] w-[16px] shrink-0 items-center justify-center max-md:h-auto max-md:w-11 max-md:self-stretch no-hover:h-auto no-hover:w-11 no-hover:self-stretch`,children:[n?(0,X.jsx)(J,{tone:au(e),role:`img`,"aria-label":`unread`,title:`Unread — not opened since it finished`,"data-slot":`unread-marker`,className:i?ig:void 0}):null,i?(0,X.jsx)(tg,{pinned:!!e.pinned,onToggle:t=>i(e,t),className:c(`absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2`,ng)}):null,a&&!r&&Oa(e)?(0,X.jsx)(`button`,{type:`button`,"data-action":`archive-run`,"aria-label":`Archive ${t}`,title:`Archive task`,onClick:t=>{t.stopPropagation(),a(e)},className:c(`absolute top-[19.5px] left-1/2 inline-flex size-5 -translate-x-1/2 items-center justify-center rounded-sm text-muted-foreground transition-colors hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none motion-reduce:transition-none`,rg),children:(0,X.jsx)(Fr,{className:`size-[12px] -translate-y-[2.5px]`,"aria-hidden":`true`})}):null]})}function og({inertReferences:e,swipeable:t,swipe:n,title:r,onArchive:i,children:a}){return e?(0,X.jsxs)(`div`,{ref:n.surfaceRef,"data-slot":`task-row-swipe`,"data-swipe":t?`on`:void 0,"data-phase":t?n.phase:void 0,className:c(`relative rounded-[6px]`,t&&`touch-pan-y touch-pinch-zoom overflow-hidden`),children:[n.offset<0?(0,X.jsx)(sg,{width:-n.offset,past:n.past,title:r,onArchive:i}):null,a]}):a}function sg({width:e,past:t,title:n,onArchive:r}){return(0,X.jsx)(`div`,{"data-slot":`task-row-swipe-action`,"data-past":t?`true`:void 0,"aria-hidden":`true`,style:{width:e},className:c(`absolute inset-y-0 right-0 flex items-stretch justify-end overflow-hidden rounded-[6px]`,t?`bg-info text-signal-ink`:`bg-muted text-foreground`),children:t?(0,X.jsxs)(`span`,{className:`flex w-full items-center justify-center gap-2 text-[12px] font-semibold whitespace-nowrap`,children:[(0,X.jsx)(Fr,{className:`size-[16px] shrink-0`,"aria-hidden":`true`}),`Release to archive`]}):(0,X.jsxs)(`button`,{type:`button`,tabIndex:-1,"aria-label":`Archive ${n}`,onClick:e=>{e.stopPropagation(),r()},className:`flex w-[88px] shrink-0 flex-col items-center justify-center gap-1 text-[12px] font-semibold`,children:[(0,X.jsx)(Fr,{className:`size-[16px]`,"aria-hidden":`true`}),`Archive`]})})}var cg=`[&>[data-ellipsis-hidden]]:pointer-events-none`,lg=`data-ellipsis-hidden`,ug=new Map;function dg(e){let t=getComputedStyle(e),n=`${t.fontStyle} ${t.fontWeight} ${t.fontSize} ${t.fontFamily} ${t.letterSpacing}`,r=ug.get(n);if(r!==void 0)return r;let i=document.createElement(`span`);i.textContent=`…`,i.setAttribute(`aria-hidden`,`true`),Object.assign(i.style,{position:`absolute`,visibility:`hidden`,whiteSpace:`pre`,fontStyle:t.fontStyle,fontWeight:t.fontWeight,fontSize:t.fontSize,fontFamily:t.fontFamily,letterSpacing:t.letterSpacing}),document.body.appendChild(i);let a=i.getBoundingClientRect().width;i.remove();let o=a||parseFloat(t.fontSize)||12;return a&&(!document.fonts||document.fonts.status===`loaded`)&&ug.set(n,o),o}function fg(e,t){if(e.scrollWidth<=e.clientWidth)return[];let n=e.getBoundingClientRect(),r=parseFloat(getComputedStyle(e).paddingRight)||0,i=n.left+e.clientLeft+e.clientWidth-r-t+.5;return Array.from(e.children).filter(e=>e.getBoundingClientRect().right>i)}function pg(e,t,n){Y.useLayoutEffect(()=>{let n=e.current;if(!t||!n||typeof ResizeObserver>`u`)return;let r=!0,i=()=>{if(!r)return;let e=new Set(fg(n,dg(n)));for(let t of Array.from(n.children))t.hasAttribute(lg)!==e.has(t)&&t.toggleAttribute(lg,e.has(t))},a=new ResizeObserver(i),o=new Set,s=()=>{for(let e of Array.from(n.children))o.has(e)||(o.add(e),a.observe(e))};a.observe(n),s(),i();let c=typeof MutationObserver>`u`?null:new MutationObserver(()=>{s(),i()});return c?.observe(n,{childList:!0}),document.fonts&&document.fonts.status!==`loaded`&&document.fonts.ready.then(i),()=>{r=!1,a.disconnect(),c?.disconnect();for(let e of Array.from(n.children))e.removeAttribute(lg)}},[e,t,n])}var mg=`(hover: none)`;function hg(){let[e,t]=(0,Y.useState)(()=>typeof window.matchMedia==`function`&&window.matchMedia(mg).matches);return(0,Y.useEffect)(()=>{if(typeof window.matchMedia!=`function`)return;let e=window.matchMedia(mg);t(e.matches);let n=e=>t(e.matches);return e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)},[]),e}var gg=`(min-width: 48rem)`;function _g(){let[e,t]=(0,Y.useState)(()=>typeof window.matchMedia!=`function`||window.matchMedia(`(min-width: 48rem)`).matches);return(0,Y.useEffect)(()=>{if(typeof window.matchMedia!=`function`)return;let e=window.matchMedia(gg),n=()=>t(e.matches);return n(),e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)},[]),e}var vg={"needs-permission":`label`,failed:`label`,"needs-you":`none`,"needs-review":`label`,running:`label`,"usage-limit":`resume`,"waiting-on-workers":`label`,"waiting-on-subagents":`label`,"waiting-for-ci":`label`,"waiting-for-merge":`label`,"waiting-for-command":`until`,monitoring:`next-check`,"waiting-for-capacity":`label`,queued:`queue-position`,done:`none`,cancelled:`none`,unseen:`label`};function yg(e,t,n,r){let i=ap(e.rung,e.label,n.autoResumeReason);switch(vg[e.rung]){case`none`:return;case`queue-position`:return t===null?i:`Queued #${t}`;case`resume`:{let e=lo(n.autoResumeAt,r);return e===`scheduled`?i:`${i}, ${e}`}case`next-check`:{let e=je(n),t=e?.kind===`timer`?new Date(e.at):void 0;return t&&Number.isFinite(t.getTime())?`${i}, next check ${mo(t,new Date(r))}`:i}case`until`:{let e=je(n),t=e?.kind===`process`?new Date(e.deadline):void 0;return t&&Number.isFinite(t.getTime())?`${i}, until ${mo(t,new Date(r))}`:i}case`label`:return i}}function bg({run:e,attention:t,queuePosition:n,inWorkingGroup:r,scope:i,now:a}){let o=Fn(e,void 0,i??void 0),s=n===null?co(e.finishedAt??e.createdAt,a):``,c=r&&t.rung===`running`?void 0:yg(t,n,e,a);return{stateWord:c,references:o,age:s,key:`${s}|${c??``}|${o.map(e=>`${e.kind}-${e.number}-${e.url}`).join(`,`)}|${+!!e.notify}`}}function xg(e){let t=La(e);return{title:t,displayTitle:Ia(t,In(e)?.number)?Ma(t).rest:t}}var Sg=`cez-sidebar-collapsed`,Cg=`cez-sidebar-sections-collapsed`;function wg(e){if(typeof e!=`object`||!e||Array.isArray(e))return{};let t={};for(let[n,r]of Object.entries(e))typeof r==`boolean`&&(t[n]=r);return t}function Tg(e=Sg){try{let t=localStorage.getItem(e);return t===null?{}:wg(JSON.parse(t))}catch{return{}}}function Eg(e,t=Sg){try{localStorage.setItem(t,JSON.stringify(e))}catch{}}var Dg=`cez-sidebar-sections-changed`;function Og(e){let[t,n]=(0,Y.useState)(()=>Tg(Cg)),[r,i]=(0,Y.useState)({}),a=(0,Y.useRef)(t);(0,Y.useEffect)(()=>{let e=e=>{if(e instanceof StorageEvent&&e.key!==null&&e.key!==`cez-sidebar-sections-collapsed`)return;let t=e instanceof CustomEvent?e.detail:Tg(Cg);a.current=t,n(t)};return window.addEventListener(`storage`,e),window.addEventListener(Dg,e),()=>{window.removeEventListener(`storage`,e),window.removeEventListener(Dg,e)}},[]),(0,Y.useEffect)(()=>{if(e===null||Object.keys(r).length===0)return;let t={...a.current};for(let[n,i]of Object.entries(r))t[JSON.stringify([e,n])]=i;i({}),a.current=t,n(t),Eg(t,Cg),window.dispatchEvent(new CustomEvent(Dg,{detail:t}))},[e,r]);let o=t=>JSON.stringify([e,t]);return{isCollapsed:e=>e!==`Archived`&&(r[e]??t[o(e)])===!0,toggle:t=>{if(e===null){i(e=>({...e,[t]:e[t]!==!0}));return}let r=o(t),s={...a.current,[r]:a.current[r]!==!0};a.current=s,n(s),Eg(s,Cg),window.dispatchEvent(new CustomEvent(Dg,{detail:s}))}}}function kg({runs:e,view:t,automations:n,onViewChange:r,currentRunId:i=null,now:a=Date.now(),onTogglePin:o,onArchiveRun:s,onSweep:c,sweeping:l=null,showViewControls:u=!0,rowLimit:d,sidebarLimits:f,projectId:p=null}){let m=cc(),h=za(e,n),g=Ra(e,t,n),_=Na(g,`active`),v=Ba(_,f??d??{overall:null}),y=c?Ag(g):void 0;return(0,X.jsxs)(`div`,{"data-slot":`quick-list`,children:[(0,X.jsxs)(`div`,{"data-slot":`quick-list-header`,className:`flex min-h-11 items-center gap-1.5 pr-[6px] pl-[10px] md:min-h-[26px]`,children:[(0,X.jsx)(`h2`,{className:`text-[13px] font-semibold text-foreground`,children:`Tasks`}),(0,X.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:h[t]}),(0,X.jsxs)(q,{to:`/`,onClick:m,className:`ml-auto flex min-h-11 items-center gap-0.5 text-[12px] text-soft-foreground hover:text-foreground md:min-h-[26px]`,children:[`All`,(0,X.jsx)(Lr,{className:`size-[13px]`,"aria-hidden":`true`})]})]}),u?(0,X.jsx)(`div`,{className:`sticky top-0 z-10 bg-sidebar pt-2 pb-1`,children:(0,X.jsx)(`div`,{className:`inline-flex w-full gap-0.5 rounded-md bg-muted p-[2px]`,children:(0,X.jsx)(Wg,{view:t,automations:n,onSelect:r,counts:h})})}):null,_.length===0?(0,X.jsx)(`p`,{className:`px-3 py-3.5 text-xs text-soft-foreground`,children:t===`automations`?`No automation tasks.`:`No tasks yet — describe one.`}):(0,X.jsx)(jg,{buckets:v,allBuckets:_,sectionProjectId:p,currentRunId:Ha(i,e),now:a,onTogglePin:o,onArchiveRun:s,onSweep:c,sweeping:l,sweepCounts:y,view:t,automations:n})]})}function Ag(e){return{unpinned:Wn(e,`unpinned`),pinned:Wn(e,`pinned`)}}function jg({buckets:e,currentRunId:t=null,now:n=Date.now(),scope:r=null,onTogglePin:i,onArchiveRun:a,onSweep:o,sweeping:s=null,sweepCounts:c,projectName:l,allBuckets:u=e,sectionProjectId:d=r,view:f=`active`,automations:p}){let m=Y.useId(),h=Og(d),g=Y.useRef(null),_=Y.useRef(null);Y.useLayoutEffect(()=>{let e=_.current;if(!e||e.element.isConnected||(_.current=null,document.activeElement!==document.body))return;let t=u.find(t=>t.rows.some(t=>t.run.id===e.id));if(!t)return;let n=Array.from(g.current?.children??[]).find(e=>e.dataset.bucket===t.label);(Array.from(n?.querySelectorAll(`[data-slot="task-row"]`)??[]).find(t=>t.dataset.runId===e.id)?.querySelector(`a`)??n?.querySelector(`[data-slot="section-toggle"]`))?.focus({preventScroll:!0})});let v=(e,o=!1)=>(0,X.jsx)(zg,{inWorkingGroup:o,run:e.run,queuePosition:e.queuePosition,currentRunId:t,now:n,scope:r,onTogglePin:i,onArchiveRun:a});return(0,X.jsx)(`div`,{ref:g,className:`flex flex-col gap-3`,onFocusCapture:e=>{let t=e.target.closest(`[data-slot="task-row"]`);_.current=t?.dataset.runId?{id:t.dataset.runId,element:e.target}:null},onBlurCapture:e=>{e.currentTarget.contains(e.relatedTarget)||(_.current=null)},children:u.map(t=>{let n=t.label===`Archived`,i=h.isCollapsed(t.label),a=e.find(({label:e})=>e===t.label)?.rows??[],u=t.rows.length,d=!n&&!i&&a.length<u,g=`${m}-${t.label.replaceAll(` `,`-`)}`;return(0,X.jsxs)(`div`,{"data-slot":`quick-list-bucket`,"data-bucket":t.label,children:[(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-2 pr-[6px]`,children:[(0,X.jsx)(Ng,{id:g,bucket:t,collapsed:i,cut:d,onToggle:h.toggle}),d?(0,X.jsx)(Mg,{section:t.label,shown:a.length,total:u,scope:r,view:f,automations:p}):null,o&&c?(0,X.jsx)(Hg,{label:t.label,headingId:g,projectName:l,counts:c,onSweep:o,sweeping:s}):null]}),(0,X.jsx)(`div`,{id:`${g}-rows`,hidden:i,children:!i&&a.map(e=>(0,X.jsx)(`div`,{children:v(e,t.label===`Working`)},e.run.id))})]},t.label)})})}function Mg({section:e,shown:t,total:n,scope:r,view:i,automations:a}){let o=cc();return(0,X.jsxs)(q,{to:ba(r,Ga(e,i,a)),onClick:o,"data-slot":`section-cut-link`,"aria-label":`${e}: showing ${t} of ${n}, see all`,title:`The sidebar shows ${t} of ${n} ${e} tasks. Click to see all of them. Change the limit in ${Ym(`sidebar`)}.`,className:`mr-auto -ml-1 flex min-h-[44px] min-w-[44px] shrink-0 items-center rounded-[4px] px-1 text-xs font-normal text-soft-foreground tabular-nums underline decoration-dotted underline-offset-[3px] hover:text-foreground focus-visible:outline-2 focus-visible:outline-link-foreground md:min-h-[26px] md:min-w-0 no-hover:min-h-[44px] no-hover:min-w-[44px]`,children:[t,` of `,n]})}function Ng({id:e,bucket:t,collapsed:n,cut:r,onToggle:i}){let a=t.rows.length;if(t.label===`Archived`)return(0,X.jsx)(`h2`,{id:e,className:`min-w-0 flex-1 text-xs font-medium text-soft-foreground`,children:(0,X.jsxs)(`span`,{className:`px-[10px] pt-[2px] pb-[4px]`,children:[t.label,` `,a]})});let o=t.label,s=t.rows.map(e=>e.run),l=s.length?op(Fa(s)):null,u=s.some(Za),d=n?Lr:Tr;return(0,X.jsx)(`h2`,{id:e,className:c(`min-w-0 text-xs font-medium text-soft-foreground`,r?`shrink-0`:`flex-1`),children:(0,X.jsxs)(`button`,{type:`button`,"data-slot":`section-toggle`,"aria-expanded":!n,"aria-controls":`${e}-rows`,"aria-label":`${o} ${a}`,onClick:()=>i(o),className:c(`flex min-h-[44px] items-center gap-1.5 rounded-[4px] px-[10px] text-left hover:bg-sidebar-row-hover hover:text-foreground focus-visible:outline-2 focus-visible:outline-link-foreground md:min-h-[26px] no-hover:min-h-[44px]`,r?`pr-[4px]`:`w-full`),children:[(0,X.jsx)(d,{className:`size-[12px] shrink-0`,"aria-hidden":`true`}),(0,X.jsx)(`span`,{children:o}),r?null:(0,X.jsxs)(X.Fragment,{children:[` `,(0,X.jsx)(`span`,{className:`font-normal tabular-nums`,children:a})]}),l&&(o===`Needs you`||n)?(0,X.jsx)(J,{tone:l.tone,shape:l.shape,pulse:l.pulse,role:`img`,"aria-label":l.label,title:l.label}):null,n&&u?(0,X.jsx)(`span`,{role:`img`,"aria-label":`unread`,title:`Unread tasks`,className:`size-[5px] shrink-0 rounded-full bg-foreground`}):null]})})}function Pg({view:e,current:t,onSelect:n,count:r,children:i}){let a=e===t;return(0,X.jsxs)(`button`,{type:`button`,"data-slot":`view-tab`,"data-view":e,"aria-pressed":a,onClick:()=>n(e),className:c(`flex min-h-11 min-w-0 flex-1 items-center justify-center gap-1.5 rounded-[7px] text-xs font-medium text-muted-foreground md:min-h-[22px]`,a&&`bg-card font-semibold text-foreground shadow-xs`),children:[i,r>0?(0,X.jsx)(`span`,{className:`font-mono text-xs tabular-nums`,children:r}):null]})}function Fg(){let e=hg(),t=_g();return e||!t}function Ig(e){let t=document.createRange();t.selectNodeContents(e);let n=t.getBoundingClientRect?.().width,r=e.querySelector(`[data-reference-width]`),i=r?Math.max(0,Number(r.dataset.referenceWidth)-r.getBoundingClientRect().width):0;return Math.ceil((n||e.scrollWidth)+i)}function Lg(e,t,n){let[r,i]=Y.useState(!1),[a,o]=Y.useState(0),s=Y.useRef(!1),c=Y.useRef(!1),l=Y.useRef(null),u=Y.useCallback(e=>{s.current=e,i(e)},[]);return Y.useLayoutEffect(()=>{let r=e.current;if(!t||!r||typeof ResizeObserver>`u`){l.current=null,u(!1);return}let i=!0,a=()=>{if(i){if(l.current?.key!==n){if(s.current){u(!1),o(e=>e+1);return}l.current={key:n,width:Ig(r)}}u(l.current.width>r.clientWidth)}};a();let d=new ResizeObserver(a);d.observe(r);let f=new WeakMap,p=new ResizeObserver(e=>{let t=!1;for(let n of e??[]){let e=n.borderBoxSize?.[0]?.inlineSize??n.contentRect.width,r=f.get(n.target);f.set(n.target,e),r!==void 0&&r!==e&&(t=!0)}!t||!i||(l.current=null,a())}),m=new Set,h=()=>{let e=!1;for(let t of[...r.children,...r.querySelectorAll(`[data-slot="reference-list"] [data-slot="pr-chip"], [data-slot="reference-list"] [data-slot="issue-chip"]`)]){let{slot:n}=t.dataset;n===`task-row-age`||t.getAttribute(`aria-hidden`)===`true`||m.has(t)||(m.add(t),f.set(t,t.getBoundingClientRect().width),p.observe(t),e=!0)}return e};h();let g=typeof MutationObserver>`u`?null:new MutationObserver(()=>{!h()||!i||(l.current=null,a())});return g?.observe(r,{childList:!0,subtree:!0}),document.fonts&&document.fonts.status!==`loaded`&&!c.current&&document.fonts.ready.then(()=>{c.current=!0,i&&(l.current=null,a())}),()=>{i=!1,d.disconnect(),p.disconnect(),g?.disconnect()}},[e,t,n,a,u]),t&&r}function Rg(){return(0,X.jsx)(`span`,{"aria-hidden":`true`,children:` · `})}function zg({run:e,queuePosition:t,currentRunId:n,now:r,scope:i,inWorkingGroup:a=!1,onTogglePin:o,onArchiveRun:s}){let l=xa(),u=cc(),d=Fg(),f=!!s&&d&&Oa(e),p=mh({id:e.id,enabled:f,onArchive:()=>s?.(e)}),m=ba(i,`/tasks/${e.id}`),h=Pe(e),g=e.id===n,{title:_,displayTitle:v}=xg(e),y=Za(e),b=bg({run:e,attention:h,queuePosition:t,inWorkingGroup:a,scope:i,now:r}),[x,S]=Y.useState(null);return(0,X.jsx)(og,{inertReferences:d,swipeable:f,swipe:p,title:_,onArchive:()=>void s?.(e),children:(0,X.jsxs)(`div`,{"data-slot":`task-row`,"data-run-id":e.id,"data-active":g?`true`:void 0,onClick:e=>{e.currentTarget.contains(e.target)&&(e.target.closest(`a, button, input`)||(l(m),u?.()))},...f?p.bind:{},style:p.offset?{transform:`translateX(${p.offset}px)`}:void 0,className:c(`selection-row group/task-row flex cursor-pointer items-start gap-2.5 rounded-[6px] py-1.5 pr-2 pl-2.5 hover:bg-sidebar-row-hover`,f&&`select-none`,f&&p.phase!==`dragging`&&`motion-safe:transition-transform motion-safe:duration-200 motion-safe:ease-out`,g&&`bg-sidebar-row-selected hover:bg-sidebar-row-selected`),children:[(0,X.jsx)(`span`,{"data-slot":`task-row-dot`,className:`flex h-[19px] w-[12px] shrink-0 items-center justify-center`,children:(0,X.jsx)(J,{tone:h.tone,shape:h.shape,pulse:h.pulse,"aria-label":op(e,h).label,title:op(e,h).label,role:`img`})}),(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,X.jsx)(Bg,{run:e,to:m,title:_,displayTitle:v,isActive:g,unread:y,swipeable:f,onNavigate:u}),(0,X.jsx)(Vg,{run:e,meta:b,title:_,scope:i,isActive:g,inertReferences:d,overflowContainer:x})]}),b.references.length?(0,X.jsx)(`span`,{ref:S,"data-slot":`protected-reference-overflow`,className:c(`shrink-0 self-end empty:hidden`,d&&`-my-1.5 self-center`)}):null,e.delegation?.role===`worker`?(0,X.jsxs)(`span`,{className:`sr-only`,children:[`Worker · `,op(e,h).label]}):null,(0,X.jsx)(ag,{run:e,title:_,unread:y,inertReferences:d,onTogglePin:o,onArchiveRun:s})]})})}function Bg({run:e,to:t,title:n,displayTitle:r,isActive:i,unread:a,swipeable:o,onNavigate:s}){return(0,X.jsxs)(q,{to:t,onClick:s,title:n,"aria-current":i?`page`:void 0,draggable:!o&&void 0,className:`flex h-[19px] min-w-0 items-center gap-2 rounded-[2px] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-link-foreground`,children:[(0,X.jsx)(`span`,{"data-slot":`task-row-title`,className:c(`min-w-[7rem] flex-1 truncate text-[13px] leading-[1.45] font-medium text-muted-foreground`,a&&`font-semibold text-foreground`,i&&`text-foreground`),children:r}),e.diffStat?(0,X.jsx)(so,{stat:e.diffStat,className:`hidden shrink-0 text-[12px] @min-[23rem]/sidebar:inline`}):null]})}function Vg({run:e,meta:t,title:n,scope:r,isActive:i,inertReferences:a,overflowContainer:o}){let{stateWord:s,references:l,age:u,key:d}=t,f=yi(),p=Y.useRef(null),m=Lg(p,!!u,d);pg(p,!a&&l.length>0,`${d}|${+!!m}`);let h=[];return s&&h.push((0,X.jsx)(`span`,{"data-slot":`task-row-state`,children:s},`state`)),l.length&&h.push((0,X.jsx)(eg,{references:l,maxVisible:2,taskTitle:n,projectId:r??f.projectId,repoBase:f.repoBase,runId:e.id,plain:!0,compact:!0,inertInline:a,fitContainer:!0,overflowContainer:o},`references`)),u&&!m&&h.push((0,X.jsx)(`span`,{"data-slot":`task-row-age`,className:`tabular-nums`,children:u},`age`)),(0,X.jsxs)(`div`,{ref:p,"data-slot":`task-row-meta`,className:c(`h-[16px] min-w-0 truncate text-xs leading-[1.4] font-normal text-soft-foreground`,cg,i&&`text-muted-foreground`),children:[e.notify===!0?(0,X.jsx)(`span`,{"data-slot":`task-row-notify`,role:`img`,"aria-label":`Notifying the task webhook`,title:`Notifying the task webhook`,className:`mr-[4px] inline-block shrink-0 align-[-1px]`,children:(0,X.jsx)(Zs,{"aria-hidden":`true`,className:`size-[10px]`})}):null,h.length?h.flatMap((e,t)=>t?[(0,X.jsx)(Rg,{},`sep-${t}`),e]:[e]):e.notify===!0?null:`\xA0`]})}function Hg({label:e,headingId:t,projectName:n,counts:r,onSweep:i,sweeping:a}){let o=e===`Finished`?`unpinned`:null;if(!o||r[o]===0)return null;let s=a===o,c=`Archive all`;return(0,X.jsxs)(`button`,{type:`button`,"data-action":`archive-group`,"data-scope":o,disabled:s,"aria-busy":s?`true`:void 0,"aria-label":n?`${c}, ${n}`:void 0,"aria-describedby":t,onClick:()=>i(o),className:`relative inline-flex shrink-0 items-center gap-1 rounded-[4px] px-1.5 py-0.5 font-sans text-xs leading-[1.4] text-muted-foreground hover:bg-sidebar-row-hover hover:text-foreground focus-visible:outline-2 focus-visible:outline-link-foreground disabled:opacity-60 max-md:before:absolute max-md:before:top-1/2 max-md:before:left-0 max-md:before:h-11 max-md:before:w-full max-md:before:-translate-y-1/2 max-md:before:content-[''] no-hover:before:absolute no-hover:before:top-1/2 no-hover:before:left-0 no-hover:before:h-11 no-hover:before:w-full no-hover:before:-translate-y-1/2 no-hover:before:content-['']`,children:[(0,X.jsx)(Fr,{className:`size-[11px]`,"aria-hidden":`true`}),c]})}function Ug({showViewControls:e=!0,projectId:t,boot:n=!1}){let r=cc(),i=t??a(),o=ne(i,!0,n),s=Oe(i,!0,n).data?.sidebarLimits??{},c=y(de({projectId:i,boot:n})),l=ah(de({projectId:i,boot:n}),r),u=ke(),[d,f,p]=Kp(),m=Ca(`/tasks/:id/*`),h=Ca(`/tasks/:id`),g=io(3e4),_=I(),v=t??_,b=De(v),x=Ba(Na(Ra(o.data??[],d,p),`active`),s),S=v===void 0?[]:x.flatMap(e=>e.rows.flatMap(({run:e})=>Fn(e,b).filter(e=>Mn(e,b)).map(e=>({projectId:v,kind:e.kind,number:e.number}))));return o.data?(0,X.jsx)(gi,{projectId:v,repoBase:b,requests:S,children:(0,X.jsx)(kg,{showViewControls:e,sidebarLimits:s,projectId:v==="default"?u.data?.bootProject??null:v??null,runs:o.data,view:d,automations:p,onViewChange:f,currentRunId:m?.params.id??h?.params.id??null,now:g,onTogglePin:(e,t)=>c.mutate({id:e.id,pinned:t}),onArchiveRun:l.archiveOne,onSweep:e=>l.sweep(e,p?d===`automations`:void 0),sweeping:l.sweeping})}):null}function Wg({view:e,automations:t,onSelect:n,counts:r}){let i=(0,X.jsx)(J,{tone:`pending`,pulse:!0,"data-slot":`waiting-dot`,"aria-label":`Needs you`});return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(Pg,{view:`active`,current:e,onSelect:n,count:r.active,children:[`Active`,r.activeWaiting>0&&e!==`active`?i:null]}),t?(0,X.jsxs)(Pg,{view:`automations`,current:e,onSelect:n,count:r.automations,children:[`Automations`,r.automationsWaiting>0&&e!==`automations`?i:null]}):null]})}var Gg=e=>e.available?null:e.hint??null,Kg=(e,t)=>u(t).includes(e.name);function qg(e,t){let n=e.checks.filter(e=>Kg(e,t));if(n.length&&!n.some(e=>e.available))return`no agent CLI found — install one to run tasks`;let r=n.find(t=>t.name===e.defaultRunner);return r&&!r.available?`default runner (${e.defaultRunner}) not found`:null}function Jg(e,t){let n=`Squawk v${e.version}`;if(t===void 0)return n;let r=qg(e,t);if(r)return`${n} · ${r}`;let i=e.checks.filter(e=>!e.available).map(e=>e.name);return i.length?`${n} · optional: ${i.join(`, `)} not installed`:n}function Yg(e){return e.forge?.available?null:e.forge?`GitHub is unreachable — ${e.forge.reason??`unknown reason`}. The GitHub tab is hidden until it comes back.`:`No GitHub remote detected — the GitHub tab is hidden. Every plain-git feature still works.`}function Xg({health:e,runners:t,sessionScope:n}){if(!e)return null;let r=qg(e,t);return(0,X.jsxs)(Li,{children:[(0,X.jsx)(Pi,{asChild:!0,children:(0,X.jsxs)(`button`,{type:`button`,"data-slot":`tools-menu-trigger`,"aria-label":`Tools`,title:Jg(e,t),className:`relative flex items-center gap-1.5 rounded-[6px] px-2 py-1.5 text-[12px] font-normal text-soft-foreground transition-colors hover:bg-sidebar-row-hover hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring data-[state=open]:bg-sidebar-row-selected data-[state=open]:text-foreground`,children:[(0,X.jsx)(gr,{className:`size-[15px]`,"aria-hidden":`true`}),r?(0,X.jsx)(J,{tone:`pending`,className:`absolute top-1 left-5 size-1.5`}):null,`Tools`]})}),(0,X.jsxs)(Fi,{side:`top`,align:`start`,"data-slot":`tools-menu-content`,className:`w-[240px]`,children:[n?(0,X.jsx)(`div`,{className:`px-2 py-2`,children:n}):null,(0,X.jsx)(Oi,{className:`text-xs font-semibold tracking-[.04em] text-soft-foreground uppercase`,children:`Installed tools`}),e.checks.map(e=>e.available?(0,X.jsx)(Zg,{check:e},e.name):(0,X.jsx)(Qg,{check:e},e.name)),Yg(e)?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Mi,{}),(0,X.jsx)(`p`,{"data-slot":`forge-note`,className:`px-2 py-1.5 text-xs leading-snug text-muted-foreground`,children:Yg(e)})]}):null,(0,X.jsx)(Mi,{}),(0,X.jsx)(K,{asChild:!0,children:(0,X.jsx)(H,{to:`/tools`,children:`Tools diagnostics`})}),(0,X.jsx)(K,{asChild:!0,children:(0,X.jsxs)(H,{to:zo,"data-slot":`tools-settings`,className:`gap-2 text-[13px] text-muted-foreground`,children:[(0,X.jsx)(or,{className:`size-3.5`,"aria-hidden":`true`}),`Tool settings`]})})]})]})}function Zg({check:e}){let t=gp(e);return(0,X.jsxs)(`div`,{"data-slot":`tool-row`,"data-tool":e.name,"data-available":`true`,className:`flex items-center gap-2 rounded-sm px-2 py-1.5`,children:[(0,X.jsx)(J,{tone:t.availability.tone,shape:t.availability.shape}),(0,X.jsx)(`span`,{className:`font-mono text-[13px] font-medium`,children:e.name}),t.mode?(0,X.jsx)(`span`,{"data-slot":`tool-dry-run`,title:t.rawVersion,className:`ml-auto shrink-0 rounded-full border border-border bg-muted px-2 py-0.5 text-xs font-medium text-muted-foreground`,children:t.mode.label}):(0,X.jsx)(`span`,{"data-slot":`tool-version`,className:`ml-auto font-mono text-xs font-medium text-muted-foreground tabular-nums`,children:t.version??t.availability.label})]})}function Qg({check:e}){let t=Gg(e),n=gp(e);return(0,X.jsx)(K,{asChild:!0,children:(0,X.jsxs)(H,{to:Ro(e.name),"data-slot":`tool-row`,"data-tool":e.name,"data-available":`false`,className:`flex-col items-stretch gap-1`,children:[(0,X.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(J,{tone:n.availability.tone,shape:n.availability.shape}),(0,X.jsx)(`span`,{className:`font-mono text-[13px] font-medium`,children:e.name}),(0,X.jsx)(`span`,{"data-slot":`tool-version`,className:`ml-auto text-xs font-medium text-muted-foreground`,children:n.availability.label})]}),(0,X.jsxs)(`span`,{className:`flex items-end justify-between gap-3 pl-[15px]`,children:[t?(0,X.jsx)(`span`,{"data-slot":`tool-hint`,className:`min-w-0 text-xs leading-snug text-muted-foreground`,children:t}):null,(0,X.jsx)(`span`,{"data-slot":`tool-setup`,className:`ml-auto shrink-0 text-xs font-semibold text-accent-text`,children:`Set up →`})]})]})})}function $g(e){return e?.trim()||null}function e_({projectName:e,pageLabel:t}){let n=$g(e),r=$g(t);return n&&r?`${n} — ${r} · Squawk`:n?`${n} · Squawk`:r?`${r} · Squawk`:`Squawk`}function t_(e){let t=e_(e);(0,Y.useEffect)(()=>{document.title=t},[t])}function n_({...e}){return(0,X.jsx)(Ic,{"data-slot":`alert-dialog`,...e})}function r_({...e}){return(0,X.jsx)(Lc,{"data-slot":`alert-dialog-portal`,...e})}function i_({className:e,...t}){return(0,X.jsx)(Rc,{"data-slot":`alert-dialog-overlay`,className:c(`fixed inset-0 z-50 bg-black/50 motion-safe:data-[state=closed]:animate-out data-[state=closed]:fade-out-0 motion-safe:data-[state=open]:animate-in data-[state=open]:fade-in-0 motion-reduce:data-[state=open]:animate-none motion-reduce:data-[state=closed]:animate-none`,e),...t})}function a_({className:e,...t}){return(0,X.jsxs)(r_,{children:[(0,X.jsx)(i_,{}),(0,X.jsx)(zc,{"data-slot":`alert-dialog-content`,className:c(`fixed inset-bs-[50%] start-[50%] z-50 grid max-h-[calc(100dvh-2rem)] overflow-y-auto overscroll-contain w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border bg-card p-6 shadow-modal duration-200 outline-hidden motion-safe:data-[state=closed]:animate-out data-[state=closed]:fade-out-0 motion-safe:data-[state=closed]:zoom-out-95 motion-safe:data-[state=open]:animate-in data-[state=open]:fade-in-0 motion-safe:data-[state=open]:zoom-in-95 motion-reduce:data-[state=open]:animate-none motion-reduce:data-[state=closed]:animate-none sm:max-w-md`,e),...t})]})}function o_({className:e,...t}){return(0,X.jsx)(`div`,{"data-slot":`alert-dialog-header`,className:c(`flex flex-col gap-2 text-center sm:text-start`,e),...t})}function s_({className:e,...t}){return(0,X.jsx)(`div`,{"data-slot":`alert-dialog-footer`,className:c(`flex flex-col-reverse gap-2 sm:flex-row sm:justify-end`,e),...t})}function c_({className:e,...t}){return(0,X.jsx)(Hc,{"data-slot":`alert-dialog-title`,className:c(`text-lg leading-none font-semibold`,e),...t})}function l_({className:e,...t}){return(0,X.jsx)(Uc,{"data-slot":`alert-dialog-description`,className:c(`text-sm text-muted-foreground`,e),...t})}function u_({className:e,...t}){return(0,X.jsx)(Bc,{"data-slot":`alert-dialog-action`,className:c(xi({variant:`contrast`}),e),...t})}function d_({className:e,...t}){return(0,X.jsx)(Vc,{"data-slot":`alert-dialog-cancel`,className:c(xi({variant:`outline`}),e),...t})}function f_(e){let t=wa(e);return/^\/git\/branches(?:\/|$)/.test(t)?`branches`:/^\/git\/not-landed(?:\/|$)/.test(t)?`not-landed`:/^\/git\/cleanup(?:\/|$)/.test(t)?`cleanup`:/^\/git\/changes(?:\/|$)/.test(t)?`changes`:/^\/git(?:\/commits(?:\/[^/]+)?)?\/?$/.test(t)?`main`:null}var p_={main:`/git`,"not-landed":`/git/not-landed`,cleanup:`/git/cleanup`,branches:`/git/branches`,changes:`/git/changes`},m_=`/git?view=repo`,h_={second:1,minute:60,hour:3600,day:86400,week:7*86400,month:30*86400,year:365*86400};function g_(e,t,n=Date.now()){let r=t?co(t,n):``;if(r)return r;let i=/^(\d+) (second|minute|hour|day|week|month|year)s?(?:, (\d+) (second|minute|hour|day|week|month|year)s?)? ago$/.exec(e.trim());return i?uo(Number(i[1])*h_[i[2]]+(i[3]?Number(i[3])*h_[i[4]]:0)):e}function __(e,t){let n=t?Date.parse(t):NaN;return Number.isFinite(n)?new Date(n).toLocaleString():e}function v_(e){let t=new Date(e);return t.setHours(0,0,0,0),t.getTime()}var y_=new Intl.DateTimeFormat(`en-US`,{weekday:`short`,month:`short`,day:`numeric`}),b_=new Intl.DateTimeFormat(`en-US`,{month:`short`,day:`numeric`,year:`numeric`});function x_(e,t){let n=Date.parse(e);if(Number.isNaN(n))return`Earlier`;let r=v_(t);if(n>=r)return`Today`;if(n>=v_(r-1))return`Yesterday`;let i=new Date(n);return(i.getFullYear()===new Date(t).getFullYear()?y_:b_).format(i)}function S_(e,t=Date.now()){let n=[];for(let r of e){let e=x_(r.at,t),i=n.at(-1);i?.label===e?i.commits.push(r):n.push({label:e,commits:[r]})}return n}function C_(e,t=Date.now()){return e.filter(e=>x_(e.at,t)===`Today`).length}function w_(e,t){return(e.baseBranch??t.branch)===t.branch?e.tracking:null}function T_(e,t=Date.now()){let n=e.fetchedAt?co(e.fetchedAt,t):``;return n?`fetched ${fo(n)}`:`never fetched`}function E_(e,t,n){return!e?.repo||t!=="default"&&t!==e.bootProject?e:{...e,repo:{...e.repo,branch:n}}}function D_(e,t){let n=z(),r=[e,`repo`],i=[e,`health`],[a,o]=(0,Y.useState)(null),s=e=>B(e.message,{tone:`danger`}),c=()=>Promise.all([n.invalidateQueries({queryKey:r}),n.invalidateQueries({queryKey:i}),n.invalidateQueries({queryKey:h.projects})]),l=F({mutationFn:t=>Qe(t,e)}),u=async(e=!1)=>{let n=a?.branch??t.branch;try{let t=await l.mutateAsync(e?{branch:n,confirm:!0}:{branch:n});if(`risks`in t){o(t);return}o(null),B(t.summary),await c()}catch(e){o(null),B(e instanceof Error?e.message:String(e),{tone:`danger`}),await c()}},d=F({mutationFn:t=>It({name:t},e),onSuccess:async t=>{B(t.created?`Created and switched to ${t.branch}`:`Switched to ${t.branch}`),await c(),n.setQueryData(r,e=>e?.info?{...e,info:{...e.info,branch:t.branch}}:e),n.setQueryData(i,n=>E_(n,e,t.branch))},onError:s}),f=F({mutationFn:t=>ot({baseBranch:t},e),onSuccess:t=>{B(t.baseBranch?`New tasks now start from ${t.baseBranch}`:`New tasks now start from the checked-out branch`),n.invalidateQueries({queryKey:r}),n.invalidateQueries({queryKey:[e,`config`]})},onError:s});return{hasRemote:!!t.remote,pull:u,pulling:l.isPending,confirmation:a,dismissConfirmation:()=>{l.isPending||o(null)},switchBranch:d,setBase:f}}var O_={sidebar:{card:`gap-[8px] rounded-[8px] p-[10px]`,branchRow:`gap-[6px]`,branchIcon:`size-[14px]`,branch:`text-[12.5px]`,chevron:`size-[12px]`,pull:`h-[24px] gap-[4px] rounded-[6px] px-[8px] text-xs [&>svg]:size-[12px]`,line:`text-xs`,lineChevron:`size-[11px]`,dirty:`gap-[6px] pt-[6px] text-xs [&>svg]:size-[12px]`},screen:{card:`gap-[10px] rounded-[10px] p-[12px]`,branchRow:`gap-[8px]`,branchIcon:`size-[16px]`,branch:`text-[14px]`,chevron:`size-[14px]`,pull:`h-[36px] gap-[6px] rounded-[8px] px-[14px] text-[13px] [&>svg]:size-[14px]`,line:`text-[12px]`,lineChevron:`size-[12px]`,dirty:`h-[40px] gap-[8px] pt-[4px] text-[13px] [&>svg:first-child]:size-[14px] [&>svg:last-child]:size-[15px]`}};function k_({scope:e,repo:t,info:n,variant:r,onNavigate:i}){let a=O_[r],o=D_(e,n),s=t.baseBranch??n.branch,l=t.status.length,u=w_(t,n),d=o.switchBranch.isPending,f=(0,Y.useRef)(null);return(0,X.jsxs)(`section`,{"aria-label":`Checkout`,"data-slot":`git-checkout`,"data-variant":r,className:c(`flex flex-col border border-border`,a.card),children:[(0,X.jsxs)(`div`,{className:c(`flex min-w-0 items-center`,a.branchRow),children:[(0,X.jsxs)(Li,{children:[(0,X.jsxs)(Pi,{"data-slot":`git-branch-menu`,"aria-label":`Branch ${n.branch}. Switch branch`,disabled:d,className:c(`group flex min-w-0 flex-1 items-center rounded-[4px] text-left outline-none focus-visible:outline-2 focus-visible:outline-ring disabled:opacity-60`,a.branchRow,r===`screen`&&`min-h-11`),children:[(0,X.jsx)(Jn,{"aria-hidden":`true`,className:c(`shrink-0 text-muted-foreground`,a.branchIcon)}),(0,X.jsx)(`span`,{"data-slot":`git-checkout-branch`,className:c(`min-w-0 flex-1 truncate font-mono font-semibold text-foreground`,a.branch),children:n.branch}),(0,X.jsx)(Tr,{"aria-hidden":`true`,className:c(`shrink-0 text-soft-foreground group-hover:text-foreground`,a.chevron)})]}),(0,X.jsxs)(Fi,{align:`start`,className:`w-64`,children:[(0,X.jsx)(Oi,{className:`text-xs text-soft-foreground`,children:`Switch branch`}),(0,X.jsx)(Ii,{value:n.branch,onValueChange:e=>{e!==n.branch&&o.switchBranch.mutate(e)},children:t.branches.map(e=>(0,X.jsx)(ki,{value:e,"data-branch":e,className:`font-mono text-[12.5px]`,children:(0,X.jsx)(`span`,{className:`truncate`,children:e})},e))}),(0,X.jsx)(Mi,{}),(0,X.jsx)(K,{asChild:!0,children:(0,X.jsx)(q,{to:p_.branches,"data-slot":`git-branch-menu-all`,onClick:i,children:`Create or find a branch…`})})]})]}),(0,X.jsxs)(`button`,{ref:f,type:`button`,"data-action":`repo-pull`,disabled:!o.hasRemote||o.pulling,title:o.hasRemote?`Pull ${n.branch}`:`No remote configured. Add a Git remote before pulling.`,onClick:()=>void o.pull(),className:c(`inline-flex shrink-0 items-center bg-muted font-medium text-foreground hover:brightness-110 focus-visible:outline-2 focus-visible:outline-ring disabled:opacity-50 disabled:hover:brightness-100`,a.pull),children:[o.pulling?(0,X.jsx)(pi,{"aria-hidden":`true`,className:`motion-safe:animate-spin`}):(0,X.jsx)(Er,{"aria-hidden":`true`}),`Pull`]})]}),u?(0,X.jsx)(A_,{tracking:u,className:a.line}):null,(0,X.jsxs)(Li,{children:[(0,X.jsxs)(Pi,{"data-slot":`base-branch-picker`,"aria-label":`New tasks start from ${s}. Change the base branch`,disabled:o.setBase.isPending,className:c(`group flex min-w-0 items-center gap-[4px] self-start rounded-[4px] text-soft-foreground outline-none hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring disabled:opacity-60`,a.line,r===`screen`&&`min-h-[32px]`),children:[(0,X.jsx)(`span`,{className:`shrink-0`,children:`New tasks start from`}),(0,X.jsx)(`span`,{"data-slot":`base-branch`,className:`min-w-0 truncate font-mono text-muted-foreground group-hover:text-foreground`,children:s}),(0,X.jsx)(Tr,{"aria-hidden":`true`,className:c(`shrink-0`,a.lineChevron)})]}),(0,X.jsxs)(Fi,{align:`start`,className:`w-64`,children:[(0,X.jsx)(Oi,{className:`text-xs text-soft-foreground`,children:`New tasks start from`}),(0,X.jsxs)(Ii,{value:t.baseBranch??``,onValueChange:e=>o.setBase.mutate(e===``?null:e),children:[(0,X.jsx)(ki,{value:``,"data-branch":``,className:`text-[12.5px]`,children:`The checked-out branch (default)`}),t.branches.map(e=>(0,X.jsx)(ki,{value:e,"data-branch":e,className:`font-mono text-[12.5px]`,children:(0,X.jsx)(`span`,{className:`truncate`,children:e})},e))]})]})]}),l>0?(0,X.jsxs)(q,{to:p_.changes,"data-slot":`git-uncommitted`,onClick:i,className:c(`flex min-w-0 items-center border-t border-border text-muted-foreground hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring`,a.dirty),children:[(0,X.jsx)(kr,{"aria-hidden":`true`,className:`shrink-0 text-inbox-count-foreground`}),(0,X.jsxs)(`span`,{className:`min-w-0 flex-1 truncate`,children:[l,` uncommitted file`,l===1?``:`s`]}),(0,X.jsx)(Lr,{"aria-hidden":`true`,className:`shrink-0 text-soft-foreground`})]}):null,(0,X.jsx)(j_,{checkout:o,returnFocus:f})]})}function A_({tracking:e,className:t}){let n=e.ref.split(`/`)[0]||e.ref,r=T_(e);return(0,X.jsx)(`p`,{"data-slot":`git-freshness`,className:c(`flex min-w-0 items-center gap-[4px] text-soft-foreground`,t),children:e.behind>0?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`span`,{"data-slot":`git-behind`,className:`shrink-0 font-medium text-inbox-count-foreground`,children:[e.behind,` behind `,n]}),(0,X.jsxs)(`span`,{className:`min-w-0 truncate`,children:[`· `,r]})]}):(0,X.jsxs)(`span`,{className:`min-w-0 truncate`,children:[`up to date · `,r]})})}function j_({checkout:e,returnFocus:t}){return(0,X.jsx)(n_,{open:e.confirmation!==null,onOpenChange:t=>!t&&e.dismissConfirmation(),children:(0,X.jsxs)(a_,{onCloseAutoFocus:e=>{e.preventDefault(),t.current?.focus()},children:[(0,X.jsxs)(o_,{children:[(0,X.jsxs)(c_,{children:[`Pull `,e.confirmation?.branch,` anyway?`]}),(0,X.jsx)(l_,{asChild:!0,children:(0,X.jsxs)(`div`,{className:`space-y-2`,children:[e.confirmation?.risks.includes(`active_runs`)?(0,X.jsx)(`p`,{children:`An active session is using this repository. Pulling can change files while it works.`}):null,e.confirmation?.risks.includes(`dirty_tree`)?(0,X.jsx)(`p`,{children:`The checkout has dirty files. Git may refuse the pull to protect them.`}):null]})})]}),(0,X.jsxs)(s_,{children:[(0,X.jsx)(d_,{className:`h-11`,disabled:e.pulling,children:`Cancel`}),(0,X.jsx)(u_,{className:`h-11`,disabled:e.pulling||e.confirmation===null,onClick:t=>{t.preventDefault(),e.pull(!0)},children:e.pulling?`Pulling…`:`Pull anyway`})]})]})})}var M_={main:Cr,"not-landed":Hs,cleanup:Ts,branches:Jn};function N_(e,t){switch(e){case`main`:return t?`Recently on ${t}`:`Recent commits`;case`not-landed`:return`Not landed`;case`cleanup`:return`Cleanup`;case`branches`:return`All branches`;case`changes`:return`Uncommitted changes`}}var P_=[`main`,`not-landed`,`cleanup`,`branches`];function F_({branch:e,counts:t,variant:n,active:r,onNavigate:i}){let a=n===`screen`;return(0,X.jsx)(`nav`,{"aria-label":`Git sections`,"data-slot":`git-sections`,className:a?ei:$r,children:P_.map(n=>{let o=M_[n],s=!a&&r===n,l=t[n];return(0,X.jsxs)(q,{to:a&&n===`main`?m_:p_[n],"data-git-section":n,"aria-current":s?`page`:void 0,onClick:i,className:c(a?si:c(ai,`text-[12.5px]`),ni,s&&`bg-sidebar-row-selected text-foreground font-medium hover:bg-sidebar-row-selected`),children:[(0,X.jsx)(o,{"aria-hidden":`true`,className:a?ii:Qr}),(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:N_(n,e)}),l?(0,X.jsx)(`span`,{"data-slot":`git-section-count`,className:a?oi:ti,children:l}):null,a?(0,X.jsx)(Lr,{"aria-hidden":`true`,className:ri}):null]},n)})})}async function I_(e,t){return tn(await Ye.api.v1.p[`:projectId`].repo.branches.counts.$get({param:{projectId:t??a()}},Ze(e)),`/repo/branches/counts`)}function L_(e){return At({queryKey:[e,`repo`,`branches`,`counts`],queryFn:({signal:t})=>I_({signal:t},e)})}function R_(e,t,n){let r=P(e),i=L_(e),a=r.data?.totalBytes??null,o=i.data?.counts??null,s=t&&n===`screen`?C_(t.log):0;return{main:s>0?`${s} today`:null,"not-landed":o?.notLanded?String(o.notLanded):null,cleanup:a?Ln(a):r.data&&a===null&&o?.cleanup?String(o.cleanup):null,branches:t?String(i.data?.allBranches??t.branches.length):null}}function z_({scope:e}){let t=Te(e),{pathname:n}=hn(),r=cc(),i=t.data?.info?t.data:null,a=R_(e,i,`sidebar`);return(0,X.jsxs)(`div`,{"data-slot":`git-sidebar`,role:`region`,"aria-label":`Git`,className:Xr,children:[i?.info?(0,X.jsx)(k_,{scope:e,repo:i,info:i.info,variant:`sidebar`,onNavigate:r},e):t.isPending?(0,X.jsx)(`div`,{"data-slot":`git-checkout-placeholder`,"aria-hidden":`true`,className:`h-[94px] rounded-[8px] border border-border`}):null,t.isPending?null:(0,X.jsx)(F_,{branch:i?.info?.branch??null,counts:a,variant:`sidebar`,active:f_(n),onNavigate:r})]})}var B_=[`assigned`,`no-task`,`has-task`,`all`],V_=[`review`,`mine`,`failing`,`all`],H_=50,U_=`is:open review-requested:@me`,W_=`is:open status:failure`;function G_(e,t){return e===`prs`&&(t===`review`||t===`failing`)}function K_(e){return e===`review`?U_:e===`failing`?W_:null}function q_(e,t){return t===null?null:(e===`issues`?B_:V_).includes(t)?t:`all`}function J_(e,t,n,r=``){let i=`${n===void 0?e===`issues`?`/github`:`/github/prs`:`${e===`issues`?`/github/issues`:`/github/prs`}/${n}`}${r}`;return t===null?i:`${i}?filter=${encodeURIComponent(t)}`}function Y_(e,t){let n=t??`all`;return n===`all`?e===`issues`?`all`:`all-prs`:n}function X_(e){return e===`all`?{view:`issues`,filter:`all`}:e===`all-prs`?{view:`prs`,filter:`all`}:{view:e===`review`||e===`mine`||e===`failing`?`prs`:`issues`,filter:e}}var Z_=[{id:`assigned`,label:`Assigned to me`},{id:`no-task`,label:`No task yet`},{id:`has-task`,label:`Has a task`},{id:`all`,label:`All open`}],Q_=[{id:`review`,label:`Review requested`},{id:`mine`,label:`Mine`},{id:`failing`,label:`Checks failing`},{id:`all-prs`,label:`All open`}],$_=Object.fromEntries([...Z_,...Q_].map(e=>[e.id,e.label]));function ev(e){return e===null?``:`${e.value}${e.bound===`atLeast`?`+`:``}`}function tv(e,t){if(t?.bound===`atLeast`)return e===`review`||e===`failing`?`At least ${t.value}: GitHub search returns at most ${H_} results.`:`At least ${t.value}: only the loaded pages are counted. Scroll to load more.`}var nv=(e,t)=>e!==void 0&&t!==void 0&&e.toLowerCase()===t.toLowerCase();function rv(e){try{let t=new URL(e).pathname.split(`/`).filter(Boolean);return t.length>=2?`${t[0]}/${t[1]}`.toLowerCase():null}catch{return null}}function iv(e,t,n){return new Set(e.filter(e=>!e.archived).flatMap(e=>av(e,t,n)))}function av(e,t,n){let r=t?.toLowerCase();return Fn(e,void 0,n).filter(e=>e.kind===`Issue`&&(!e.url||r!==void 0&&rv(e.url)===r)).map(e=>e.number)}function ov(e,t,n,r){let i=new Map;for(let a of e)!Wa(a)&&av(a,n,r).includes(t)&&i.set(a.id,a);return[...i.values()].sort((e,t)=>Date.parse(t.createdAt)-Date.parse(e.createdAt)||e.id.localeCompare(t.id))}function sv(e,t){let n=new Map(t.map(e=>[e.number,e]));return e.map(e=>n.get(e.number)??e)}function cv(e){return e?.available?{value:e.items.length,bound:e.truncated?`atLeast`:`exact`}:null}function lv({gh:e,tasks:t,review:n,failing:r}){let i={assigned:null,"no-task":null,"has-task":null,all:null,review:cv(n),mine:null,failing:cv(r),"all-prs":null};if(!e?.available)return i;let a=!pe(e,`issues`),o=!pe(e,`prs`),s=(e,t)=>({value:e,bound:t?`atLeast`:`exact`}),c=t?e.issues.filter(e=>t.has(e.number)).length:null;return{...i,all:s(e.issuesTotal??e.issues.length,!1),"all-prs":s(e.prsTotal??e.prs.length,!1),assigned:e.viewerLogin?s(e.issues.filter(t=>t.assignees?.some(t=>nv(t,e.viewerLogin))).length,a):null,mine:e.viewerLogin?s(e.prs.filter(t=>nv(t.author,e.viewerLogin)).length,o):null,"has-task":c===null?null:s(c,a),"no-task":c===null?null:s(e.issues.length-c,a)}}var uv={assigned:hr,"no-task":Jr,"has-task":Pr,all:Ar,review:fi,mine:$n,failing:yr,"all-prs":Ar};function dv(e,t){return e===`assigned`||e===`mine`?t.identity:e===`no-task`||e===`has-task`?t.tasks:null}function fv({model:e,variant:t,activeId:n,onNavigate:r}){let i=t===`screen`;return(0,X.jsx)(X.Fragment,{children:[{key:`issues`,label:`Issues`,rows:Z_},{key:`prs`,label:`Pull requests`,rows:Q_}].map(t=>(0,X.jsxs)(`nav`,{"aria-label":t.label,"data-slot":`github-filter-group`,"data-group":t.key,className:i?ei:c(ci,t.key===`prs`&&`pt-[6px]`),children:[(0,X.jsx)(`h3`,{className:i?Yr:Zr,children:t.label}),t.rows.map(({id:t,label:a})=>{let o=uv[t],s=n===t,l=dv(t,e.blocked),u=e.counts[t],d=ev(u),f=c(i?si:c(ai,`text-[12.5px]`),l?`cursor-not-allowed opacity-60`:ni,s&&`bg-sidebar-row-selected text-foreground font-medium hover:bg-sidebar-row-selected`),p=(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(o,{"aria-hidden":`true`,className:i?ii:Qr}),(0,X.jsx)(`span`,{className:`truncate`,children:a}),d?(0,X.jsx)(`span`,{"data-slot":`gh-filter-count`,title:tv(t,u),className:i?oi:ti,children:d}):null,i?(0,X.jsx)(Lr,{"aria-hidden":`true`,className:c(ri,!d&&`ml-auto`)}):null]});if(l)return(0,X.jsxs)(`div`,{"data-gh-filter":t,"aria-disabled":`true`,title:l,className:f,children:[p,(0,X.jsx)(`span`,{className:`sr-only`,children:l})]},t);let{view:m,filter:h}=X_(t);return(0,X.jsx)(q,{to:J_(m,h),"data-gh-filter":t,"aria-current":s?`page`:void 0,onClick:r,className:f,children:p},t)})]},t.key))})}function pv(e){let t=Ce(e,50).data,n=t?.available===!0,r=ne(e,!0,e==="default"),i=re(e,`pr`,U_,n),a=re(e,`pr`,W_,n),o=(0,Y.useMemo)(()=>r.data?iv(r.data,t?.repo,e):null,[r.data,t?.repo,e]);return{gh:t,counts:(0,Y.useMemo)(()=>lv({gh:t,tasks:o,review:i.data,failing:a.data}),[t,o,i.data,a.data]),blocked:{identity:t?.available===!0&&!t.viewerLogin?`GitHub login unavailable.`:null,tasks:r.isError&&!r.data?`Task list unavailable.`:null}}}function mv(e){return/^\/github\/prs(?:\/|$)/.test(wa(e))?`prs`:`issues`}function hv({scope:e}){let t=pv(e),{pathname:n}=hn(),[r]=gn(),i=cc(),a=mv(n);return(0,X.jsx)(`div`,{"data-slot":`github-sidebar`,role:`region`,"aria-label":`GitHub`,className:Xr,children:(0,X.jsx)(fv,{model:t,variant:`sidebar`,activeId:Y_(a,q_(a,r.get(`filter`))),onNavigate:i})})}var gv=(0,Y.lazy)(()=>V(()=>import(`./accounts-section-DhS7blSK.js`).then(e=>({default:e.GlobalAgentsSection})),__vite__mapDeps([5,1,2,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31]))),_v=(0,Y.lazy)(()=>V(()=>import(`./agent-config-section-C7SMwOgZ.js`).then(e=>({default:e.AgentConfigSection})),__vite__mapDeps([32,1,2,7,8,6,9,10,18,19,20,28,31,33,34,12,35]))),vv=(0,Y.lazy)(()=>V(()=>import(`./agent-defaults-section-CvMgsSLY.js`).then(e=>({default:e.AgentDefaultsSection})),__vite__mapDeps([36,1,2,6,7,8,9,10,13,18,19,37,23,38,39,25,26,14,28,40,29,30,21,22,24,41,42]))),yv=(0,Y.lazy)(()=>V(()=>import(`./appearance-44RH8bum.js`).then(e=>({default:e.AppearanceSection})),__vite__mapDeps([43,2,1,7,8,6,9,10,14,44,18,19]))),bv=(0,Y.lazy)(()=>V(()=>import(`./notifications-section-C_IsaiyD.js`).then(e=>({default:e.NotificationsSection})),__vite__mapDeps([45,1,2,6,7,8,9,10,37,19,23,38,39]))),xv=(0,Y.lazy)(()=>V(()=>import(`./projects-section-Cme2qWcF.js`).then(e=>e.r).then(e=>({default:e.ProjectsSection})),__vite__mapDeps([46,1,2,7,8,6,9,10,11,12,13,18,19,47,23,24,48,39,28,29,42,49]))),Sv=(0,Y.lazy)(()=>V(()=>import(`./prompt-templates-section-DVr3aKc-.js`).then(e=>({default:e.PromptTemplatesSection})),__vite__mapDeps([50,1,2,7,8,6,9,10,13,18,19,47,23,24,48,39,51,22,21,52,28,40,41,42,49]))),Cv=(0,Y.lazy)(()=>V(()=>import(`./resources-section-BymE7-3T.js`).then(e=>({default:e.ResourcesSection})),__vite__mapDeps([53,2,1,6,7,8,9,10,11,12,13,18,19,37,23,38,39,28,29,41,42,49]))),wv=(0,Y.lazy)(()=>V(()=>import(`./session-context-section-oK9zU15I.js`).then(e=>({default:e.SessionContextSection})),__vite__mapDeps([54,1,2,7,8,6,9,10,55,14,18,19,20,28,33,34,12,35]))),Tv=(0,Y.lazy)(()=>V(()=>import(`./sidebar-section-DujeUKJ0.js`).then(e=>({default:e.SidebarSection})),__vite__mapDeps([56,1,2,7,8,6,9,10,18,19]))),Ev=(0,Y.lazy)(()=>V(()=>import(`./worktrees-section-DvFx6o_A.js`).then(e=>({default:e.WorktreesSection})),__vite__mapDeps([57,2,1,6,7,8,9,10,13,18,19,58,11,12,28,31,41,42,49,59,60,14,26,61,17,62,63,64,23,24,48,39,35]))),Dv=(0,Y.lazy)(()=>V(()=>import(`./archive-on-merge-field-BT4e_k9f.js`).then(e=>({default:e.TasksSection})),__vite__mapDeps([65,1,2,6,7,8,9,10,29,13]))),Ov=[{id:`sidebar`,title:`Sidebar`,description:`Overall and per-section task limits for this project.`,icon:wr,component:Tv,scope:`project`},{id:`agent-defaults`,title:`Agent defaults`,description:`Default runner, models and system prompt.`,icon:Pr,component:vv,scope:`project`},{id:`agent-config`,title:`Agent config`,description:`Edit the coding agents’ own config files, per scope.`,icon:Ls,component:_v,scope:`project`},{id:`session-context`,title:`Session context`,description:`Text Squawk puts at the start of every agent session it launches.`,icon:Rs,component:wv,scope:`project`},{id:`worktrees`,title:`Worktrees`,description:`How many finished task worktrees this project keeps on disk.`,icon:Bs,component:Ev,scope:`project`},{id:`prompt-templates`,title:`Prompt templates`,description:`Reusable snippets for follow-up instructions.`,icon:zs,component:Sv,scope:`project`},{id:`appearance`,title:`Appearance`,description:`Theme, density and reading width.`,icon:er,component:yv,scope:`global`},{id:`notifications`,title:`Notifications`,description:`Browser notifications when an agent needs you.`,icon:Or,component:bv,scope:`global`},{id:`resources`,title:`Resources`,description:`Parallel tasks and per-task memory limit, across every project.`,icon:wr,component:Cv,scope:`global`},{id:`tasks`,title:`Tasks`,description:`Automatic task archiving after pull requests merge.`,icon:Bs,component:Dv,scope:`global`},{id:`agents`,title:`Agents`,description:`Install, version and sign-in for each agent, and the agent and models a project uses when it has chosen none.`,icon:sr,component:gv,scope:`global`},{id:`projects`,title:`Projects`,description:`The workspace registry and where GitHub checkouts land.`,icon:ar,component:xv,scope:`global`}];function kv(e){return Ov.filter(t=>t.scope===e)}function Av(e,t){return e===`global`?`/settings/global/${t}`:`/settings/${t}`}var jv=Av(`global`,`appearance`);function Mv({projectId:e,projectName:t}){return(0,X.jsx)(`div`,{"data-slot":`settings-sidebar`,className:Xr,children:[`project`,`global`].map(n=>{let r=n===`project`?`This project${t?` · ${t}`:``}`:`Global · every project`,i=n===`project`?`/p/${encodeURIComponent(e)}/settings`:`/settings/global`,a=kv(n).map(e=>({id:e.id,title:e.title,icon:e.icon,to:`${i}/${e.id}`})),o=n===`project`?[{id:`general`,title:`General`,icon:or,to:i},...a]:a;return(0,X.jsxs)(`nav`,{"aria-label":r,"data-slot":`settings-nav`,"data-scope":n,className:c(`flex flex-col gap-px`,n===`global`&&`pt-[6px]`),children:[(0,X.jsx)(`h3`,{title:r,className:Zr,children:r}),o.map(({id:e,title:t,icon:n,to:r})=>(0,X.jsxs)(Sn,{to:r,end:!0,"data-section":e,className:({isActive:e})=>c(ai,ni,e&&`bg-sidebar-row-selected text-foreground font-medium hover:bg-sidebar-row-selected`),children:[(0,X.jsx)(n,{"aria-hidden":`true`,className:Qr}),(0,X.jsx)(`span`,{className:`truncate`,children:t})]},e))]},n)})})}var Nv=[{pattern:`/`,pageLabel:`Tasks`},{pattern:`/tasks`,pageLabel:`All tasks`},{pattern:`/tools`,pageLabel:`Workspace tools`},{pattern:`/new`,pageLabel:`New task`},{pattern:`/activity`,pageLabel:`Activity`},{pattern:`/git/not-landed`,pageLabel:`Git / Not landed`},{pattern:`/git/branches`,pageLabel:`Git / All branches`},{pattern:`/git/changes`,pageLabel:`Git / Uncommitted changes`},{pattern:`/git/cleanup`,pageLabel:`Git / Cleanup`},{pattern:`/git/*`,pageLabel:`Git`},{pattern:`/github/*`,pageLabel:`GitHub`},{pattern:`/automations/new`,pageLabel:`Automations / New automation`},{pattern:`/automations/:automationId`,pageLabel:`Automations / Edit automation`},{pattern:`/automations/*`,pageLabel:`Automations`},{pattern:`/skills`,pageLabel:`Skills`},{pattern:`/reports`,pageLabel:`Reports`},{pattern:`/workflows/*`,pageLabel:`Workflows`},{pattern:`/settings/*`,pageLabel:`Settings`}];function Pv(e){let t=wa(e),n=yn({path:`/tasks/:id/*`,end:!0},t);return n?{pageLabel:null,taskId:n.params.id??null}:{pageLabel:Nv.find(({pattern:e})=>yn({path:e,end:!0},t))?.pageLabel??null,taskId:null}}function Fv(e){let t=e?.repo;if(!t)return null;let n=t.root.replace(/[\\/]+$/,``).split(/[\\/]/).pop();return n?{name:n,branch:t.branch}:null}var Iv=e=>qa(e).waiting>0;function Lv(e,t,n){let r=t?.bootProject??n?.bootProject??null,i=e??r??`default`;return{bootProjectId:r,sidebarProjectId:i,sidebarBoot:i===r,isBootProject:e!==null&&e===r,activeProject:t?.projects.find(t=>t.id===e)}}function Rv(e,t,n,r,i,a){let o=e===`/tools`||e===`/settings/global`||e.startsWith(`/settings/global/`);return{globalSettings:o,projectName:o?null:t?.name??(n?Fv(r)?.name??null:null),titleRun:a,pageLabel:a?La(a):i.pageLabel}}function zv(e,t){return e?e.forge===`github`:t?.forge?.available===!0}function Bv(e,t,n,r,i,a){return/^\/settings(?:\/|$)/.test(e)?(0,X.jsx)(Mv,{projectId:n,projectName:i?.projects.find(e=>e.id===n)?.name??(r?Fv(a)?.name??null:null)}):/^\/github(?:\/|$)/.test(e)&&t?(0,X.jsx)(hv,{scope:de({projectId:n,boot:r}).cacheScope}):/^\/git(?:\/|$)/.test(e)?(0,X.jsx)(z_,{scope:de({projectId:n,boot:r}).cacheScope}):void 0}function Vv(e,t,n,r,i){return e===`/tools`?Fv(i):t?null:n?{name:n.name,branch:n.id===r?i?.repo?.branch??``:``}:Fv(i)}function Hv(e,t,n,r,i){let a=Sa(e)===null,o=n?`Tasks / ${i}`:e===`/tools`?`Tools`:i??(r.taskId===null?`Not found`:`Tasks`);return{project:a?`Workspace`:t,page:o,branch:n?.worktreePath?`Isolated worktree`:void 0}}function Uv(e,t,n,r){return e?(0,X.jsx)(Km,{...e,projectTarget:t.target,onSwitchProject:e=>void t.go(e),version:r}):n?(0,X.jsx)(Bm,{}):null}function Wv({children:e}){let{pathname:t}=hn(),n=Ea(),r=ke(),i=R(),a=(0,Y.useRef)(void 0);(0,Y.useEffect)(()=>{r.data&&(a.current=r.data)},[r.data]);let o=r.data??a.current,s=Wf(o),c=T(),l=c.data,u=qm(),d=Uf(),f=Pv(t),{bootProjectId:p,sidebarProjectId:m,sidebarBoot:h,isBootProject:g,activeProject:_}=Lv(n,l,r.data),v=ne(m,!0,h,Iv).data??!1,y=(0,Y.useCallback)(e=>{let t=e.find(e=>e.id===f.taskId);return t?{title:t.title,titleSummary:t.titleSummary,titleOrigin:t.titleOrigin,worktreePath:t.worktreePath}:void 0},[f.taskId]),b=ne(n??``,_!==void 0&&f.taskId!==null,l?.bootProject===n,y).data,{globalSettings:x,projectName:S,titleRun:C,pageLabel:w}=Rv(t,_,g,r.data,f,b);t_({projectName:S,pageLabel:w});let E=zv(_,r.data),D=Bv(wa(t),E,m,h,l,r.data),O=o?.version??null;return(0,X.jsxs)(Gp,{children:[(0,X.jsx)(Bd,{repo:Vv(t,x,_,p,r.data),breadcrumb:Hv(t,S,C,f,w),version:O,latestVersion:o?.latestVersion??null,forgeAvailable:E,automationsAvailable:s,banner:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Tm,{}),(0,X.jsx)(cm,{}),(0,X.jsx)(im,{})]}),sidebarList:D,taskQuickList:(0,X.jsx)(Ug,{projectId:m,boot:h}),sidebarProjectId:m,projectHeader:(0,X.jsx)(gu,{}),mobileProjects:u,needsYou:v,toolsMenu:(0,X.jsx)(Xg,{health:r.data,runners:i.data}),toolsStatus:r.data?{blocked:qg(r.data,i.data)!==null,note:Yg(r.data)}:null,projectRail:Uv(u,d,c.isPending,O),children:e}),(0,X.jsx)(Fp,{})]})}var Gv=`cez-accent`,Kv=`cez-density`,qv=`cez-width`,Jv=`cezarion`,Yv=`comfortable`,Xv=`narrow`;function Zv(e){return Jv}function Qv(e){return e===`comfortable`||e===`compact`||e===`ultra`?e:Yv}function $v(e){return e===`narrow`||e===`wide`?e:Xv}function ey(e){let t=e&&typeof e==`object`?e:{};return{accent:Zv(t.accent),density:Qv(t.density),width:$v(t.width)}}function ty(){try{return{accent:Zv(localStorage.getItem(Gv)),density:Qv(localStorage.getItem(Kv)),width:$v(localStorage.getItem(qv))}}catch{return{accent:Jv,density:Yv,width:Xv}}}function ny(e){try{localStorage.setItem(Gv,e.accent),localStorage.setItem(Kv,e.density),localStorage.setItem(qv,e.width)}catch{}}function ry(e,t){t.accent===`cezarion`?delete e.dataset.accent:e.dataset.accent=t.accent,t.density===`comfortable`?delete e.dataset.density:e.dataset.density=t.density,t.width===`narrow`?delete e.dataset.width:e.dataset.width=t.width}var iy=Y.createContext(null);function ay({children:e}){let t=z(),n=x(),[r,i]=Y.useState(ty),a=n.data;Y.useEffect(()=>{if(a===void 0)return;let e=ey(a.appearance);i(e),ny(e)},[a]),Y.useLayoutEffect(()=>{ry(document.documentElement,r)},[r]);let o=Y.useCallback(e=>{i(e),ny(e),Ct({appearance:e}).then(e=>t.setQueryData(h.uiState,e)).catch(e=>{B(e instanceof Error?e.message:String(e),{tone:`danger`}),t.invalidateQueries({queryKey:h.uiState})})},[t]),s=Y.useCallback(e=>o({...r,accent:e}),[o,r]),c=Y.useCallback(e=>o({...r,density:e}),[o,r]),l=Y.useCallback(e=>o({...r,width:e}),[o,r]),u=Y.useMemo(()=>({accent:r.accent,density:r.density,width:r.width,setAccent:s,setDensity:c,setWidth:l}),[r,s,c,l]);return(0,X.jsx)(iy.Provider,{value:u,children:e})}function oy(){let e=Y.useContext(iy);if(!e)throw Error(`Squawk: useAppearance() must be called inside <AppearanceProvider>`);return e}function sy(){let e=hn(),t=T();return Hf(),(0,Y.useEffect)(()=>{let n=mf(e,t.data);n!==null&&(gf(af(),n)||of(n),gf(yf(n.projectId),n)||bf(n))},[e.hash,e.pathname,e.search,t.data]),null}function cy(e){return{enabled:(e&&typeof e==`object`?e:{}).enabled===!0}}function ly(){let e=globalThis.Notification;if(typeof e!=`function`)return`unsupported`;let t=e.permission;return t===`granted`||t===`denied`?t:`default`}function uy(e,t){let n=new Map,r=[];for(let i of t??[]){let t={status:i.status,wantsAttention:Da(i)};n.set(i.id,t);let a=e.get(i.id);a!==void 0&&(a.status===t.status&&a.wantsAttention===t.wantsAttention||t.wantsAttention&&r.push(i))}return{entering:r,statuses:n}}function dy(e){return e.enabled&&e.hidden&&e.permission===`granted`}function fy(e){let t=Pe(e).label;return{title:e.titleSummary??e.title,body:`Task ${t}`,tag:`cezar-run-${e.id}`}}function py(){let e=z(),t=cy(x().data?.notifications).enabled,n=(0,Y.useRef)(t);return n.current=t,(0,Y.useEffect)(()=>{let t=e.getQueryCache(),r=new Map,i=new Map,a=new Map,o=new Set,s=new Map,c=0,l=e=>e.length===3&&typeof e[0]==`string`&&e[1]===`runs`&&e[2]===`list`,u=()=>{let e=new Set([...r.values()].flatMap(e=>[...e.keys()]));for(let t of i.keys())e.has(t)||(i.delete(t),a.delete(t),o.delete(t))},d=(e,t,s=!1,l=1/0)=>{let d=r.get(e),{statuses:f}=uy(new Map,t),p=t.filter(e=>{if((a.get(e.id)??0)>l)return!1;let t=d?.get(e.id),n=f.get(e.id),r=l===1/0?t:i.get(e.id);return t!==void 0&&r!==void 0&&(r.status!==n.status||r.wantsAttention!==n.wantsAttention)}),{entering:m,statuses:h}=uy(i,p);for(let[e,t]of f)!d?.has(e)&&!o.has(e)&&(a.get(e)??0)<=l&&(i.set(e,t),a.set(e,++c));for(let[e,t]of h){let n=i.get(e);n?.status===t.status&&n.wantsAttention===t.wantsAttention||(i.set(e,t),a.set(e,++c),o.add(e))}if(r.set(e,f),u(),!s&&m.length!==0&&dy({enabled:n.current,hidden:document.visibilityState===`hidden`,permission:ly()}))for(let e of m)my(e)};for(let e of t.getAll().sort((e,t)=>e.state.dataUpdatedAt-t.state.dataUpdatedAt))l(e.queryKey)&&Array.isArray(e.state.data)&&d(e.queryHash,e.state.data,!0);return t.subscribe(e=>{if(l(e.query.queryKey)){if(e.type===`removed`)r.delete(e.query.queryHash),s.delete(e.query.queryHash),u();else if(e.type===`updated`&&(e.action.type===`fetch`&&s.set(e.query.queryHash,c),e.action.type===`success`&&Array.isArray(e.query.state.data))){let t=e.action.manual?1/0:s.get(e.query.queryHash)??0;d(e.query.queryHash,e.query.state.data,!1,t),e.action.manual||s.delete(e.query.queryHash)}}})},[e]),null}function my(e){let t=globalThis.Notification;if(typeof t!=`function`)return;let n=fy(e);try{new t(n.title,{body:n.body,tag:n.tag})}catch{}}function hy(){return(0,X.jsx)(Uo,{route:`activity`,density:`sparse`,rootProps:{"aria-busy":`true`},header:{title:`Activity`},children:(0,X.jsx)(`p`,{"data-slot":`activity-loading`,role:`status`,className:`text-xs text-muted-foreground`,children:`Loading activity…`})})}function gy(){return(0,X.jsx)(Jo,{route:`github`,density:`sparse`,flushPadding:!0,children:(0,X.jsx)(Yo,{icon:(0,X.jsx)(pi,{className:`motion-safe:animate-spin`}),tone:`neutral`,title:`Loading GitHub…`,subtitle:`Fetching open issues and pull requests.`})})}function _y({skill:e,emphasized:t}){return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{className:c(`shrink-0 font-mono text-xs`,t&&`font-semibold`),children:e.name}),e.description?(0,X.jsx)(`span`,{title:e.description,className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null,e.path?(0,X.jsx)(`span`,{title:e.path,className:`min-w-0 truncate text-xs text-soft-foreground`,children:e.path}):null]})}var vy=80,yy=2e3,by=50,xy=200,Sy=50,Cy=[{id:`add-tests`,label:`Add tests`,text:`Also add or update tests covering this change.`},{id:`explain-change`,label:`Explain the change`,text:`Explain what changed and why before finishing.`},{id:`keep-minimal`,label:`Keep it minimal`,text:`Keep the change as small and targeted as possible — no unrelated refactors.`},{id:`update-docs`,label:`Update docs`,text:`Also update any relevant documentation or comments.`},{id:`check-edge-cases`,label:`Double-check edge cases`,text:`Double-check edge cases and error handling before finishing.`}];function wy(e){return!!e&&typeof e==`object`}function Ty(e){if(e===void 0||!Array.isArray(e))return Cy.map(e=>({...e}));let t=new Set,n=[];for(let r of e){if(!wy(r))continue;let e=typeof r.id==`string`?r.id.trim():``;if(e===`create-automation`)continue;let i=typeof r.label==`string`?r.label.trim():``,a=typeof r.text==`string`?r.text.trim():``;if(!e||!i||!a||t.has(e))continue;t.add(e);let o=Ey(r.skills);if(n.push({id:e,label:i.slice(0,vy),text:a.slice(0,yy),...o.length>0?{skills:o}:{}}),n.length>=by)break}return n}function Ey(e){if(!Array.isArray(e))return[];let t=new Set;for(let n of e){if(typeof n!=`string`)continue;let e=n.trim();if(!(!e||t.has(e))&&(t.add(e.slice(0,xy)),t.size>=Sy))break}return[...t]}function Dy(e,t){if(t.length===0)return[];let n=new Set(t);return e.filter(e=>e.skills?.some(e=>n.has(e)))}function Oy(e,t){return Dy(e,t).map(e=>e.text).join(`
|
|
6
6
|
|
|
7
7
|
`)}function ky(e,t,n,r=``){if(e===``||e===r||e===t){let e=r&&n?`${r}\n\n${n}`:r||n;return{text:e,applied:n?e:``}}return{text:e,applied:t}}function Ay(){return`tpl-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`}function jy(e,t,n){let r=Math.max(0,Math.min(t,e.length)),i=e.slice(0,r),a=e.slice(r),o=``;i.length>0&&(o=i.endsWith(`
|
|
8
8
|
|
|
@@ -17,5 +17,5 @@ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,n,r,t as i}from
|
|
|
17
17
|
`:`
|
|
18
18
|
|
|
19
19
|
`),{text:i+o+n+c+s,caret:i.length+o.length+n.length}}function My({prompt:e,base:t,selectionStart:n,focused:r,remembered:i}){return e===t?e.length:r&&n!=null||n!=null&&n>0?n:i??e.length}var Ny=`(hover: none) and (pointer: coarse)`;function Py(){return typeof globalThis.matchMedia==`function`&&globalThis.matchMedia(Ny).matches}function Fy(e){return e.key!==`Enter`||e.shiftKey||e.altKey||e.repeat||e.isComposing?!1:e.metaKey||e.ctrlKey?!0:!Py()}function Iy(e=typeof navigator>`u`?``:navigator.platform){return/mac|iphone|ipad|ipod/i.test(e)?`⌘↵`:`Ctrl+↵`}var Ly={png:`image/png`,jpg:`image/jpeg`,jpeg:`image/jpeg`,gif:`image/gif`,webp:`image/webp`,svg:`image/svg+xml`,bmp:`image/bmp`,avif:`image/avif`,md:`text/markdown`,markdown:`text/markdown`,txt:`text/plain`,log:`text/plain`,pdf:`application/pdf`};function Ry(e){return Xt(e.type)?e.type:ya(Ly,e.name.split(`.`).pop()?.toLowerCase()??``)??null}async function zy(e){let t=new Uint8Array(await e.arrayBuffer()),n=``;for(let e=0;e<t.length;e+=32768)n+=String.fromCharCode(...t.subarray(e,e+32768));let r=btoa(n),i=Ry(e)??`application/octet-stream`,a=Et(i);return{mediaType:i,data:r,...a?{preview:`data:${i};base64,${r}`}:{},name:e.name||(a?`pasted image`:`pasted.${Lt(i)}`),isImage:a}}function By(e,t){let n=[],r=[],i=t;for(let t of e){let e=t.name||`attachment`;if(Ry(t)===null){r.push(`${e} is not a supported attachment (images, PDF and plain-text files such as TXT or MD)`);continue}if(t.size>5242880){r.push(`${e} is too large (max 5 MB)`);continue}if(i>=4){r.push(`${e} skipped — max 4 attachments per message`);continue}n.push(t),i+=1}return{accepted:n,rejected:r}}var Vy=new Set([`/`,`@`]);function Hy(e,t){for(let n=t-1;n>=0;--n){let r=e[n];if(/\s/.test(r))return null;if(Vy.has(r))return n>0&&!/\s/.test(e[n-1])?null:{trigger:r,start:n,query:e.slice(n+1,t)}}return null}function Uy(e,t,n,r){let i=`${t.trigger}${r} `;return{text:e.slice(0,t.start)+i+e.slice(n),caret:t.start+i.length}}function Wy(){let e=window;return e.SpeechRecognition??e.webkitSpeechRecognition}function Gy(e,t){let n=e,r=``;for(let e=t.resultIndex;e<t.results.length;e+=1){let i=t.results[e],a=i[0]?.transcript??``;i.isFinal?n+=a:r+=a}return{finalText:n,interim:r}}function Ky(e,t){switch(e){case`aborted`:return null;case`network`:case`service-not-allowed`:return{message:`Dictation couldn't reach this browser's speech service. Some Chromium builds, such as Helium, block it. Use your system dictation instead (macOS: press Fn/Globe twice), or open the cockpit in Chrome or Safari.`,retryable:e===`network`};case`not-allowed`:return{message:`Microphone access is blocked. Allow it in this site's browser settings, then try again.`,retryable:!0};case`audio-capture`:return{message:`No microphone was found. Connect one, then try again.`,retryable:!0};case`language-not-supported`:return{message:`This browser can't recognize speech in ${t}. Use your system dictation instead (macOS: press Fn/Globe twice).`,retryable:!1};case`no-speech`:return{message:`No speech was heard. Check the microphone, then try again.`,retryable:!0};default:return{message:`Dictation failed${e?` — ${e}`:``}`,retryable:!0}}}function qy(e){let[t,n]=Y.useState(null),r=Y.useRef(null),i=Y.useRef(``),a=Y.useRef(!1),o=Y.useRef(()=>{}),[s]=Y.useState(()=>Wy()!==void 0),c=Y.useCallback(()=>{let e=r.current;r.current=null,i.current=``,n(null),e&&(e.onresult=null,e.onerror=null,e.onend=null,e.abort())},[]);Y.useEffect(()=>(a.current=!0,()=>{a.current=!1,c()}),[c]);let l=Y.useCallback(()=>o.current(),[]),u=Y.useCallback(()=>{if(!a.current||r.current)return;let t=Wy();if(!t)return;let o;try{o=new t,o.lang=navigator.language||`en-US`,o.continuous=!0,o.interimResults=!0;let a=Date.now();o.onresult=e=>{let t=Gy(i.current,e);i.current=t.finalText,n({transcript:t.finalText+t.interim,startedAt:a})},o.onerror=t=>{console.warn(`[dictation] recognition error`,t.error,t.message);let n=Ky(t.error,o.lang);c(),n&&e(n.message,n.retryable?l:void 0)},o.start(),r.current=o,n({transcript:``,startedAt:a})}catch{e(`Dictation failed — the microphone could not be started`,l),c()}},[e,l,c]);return o.current=u,{supported:s,recording:t,start:u,cancel:Y.useCallback(()=>c(),[c]),finish:Y.useCallback(()=>{let e=r.current,a=(i.current+``).trim()===``?``:i.current,o=t?.transcript??a;return e&&(e.onresult=null,e.onerror=null,e.onend=null,e.stop()),r.current=null,i.current=``,n(null),o.trim()},[t])}}function Jy(e,t){let n=Math.max(0,Math.floor((t-e)/1e3));return`${Math.floor(n/60)}:${String(n%60).padStart(2,`0`)}`}function Yy(e,t){return e.trim()!==``||t>0}function Xy(e,t,n,r){return!e&&(t!==void 0&&n||r)}function Zy(e,t,n){return!e&&!t&&n!==void 0}function Qy(e,t,n,r){return e||t||!n&&r!==void 0}function $y(e,t,n){return!e&&t?t:n}function eb(e,t,n){return e||t&&n}function tb(e,t,n){return e||t&&n}function nb(e,t,n,r,i,a){return e||t||n||i.trim()===``&&a===0&&!r}function rb(e,t){return e&&!t}function ib(e){return e??`default`}function ab(e,t){return e.get(t)??!1}function ob(e){return e instanceof Error?e.message:String(e)}function sb(e,t){return e===``?t:`${t}\n${e}`}function cb(e){return`${e||`Attachment`} could not be read — try attaching it again`}function lb(e){return[...e??[]].filter(e=>e.kind===`file`).map(e=>e.getAsFile()).filter(e=>e!==null)}function ub(e){return[...e??[]]}function db(e,t){return e.trim()===``?t:`${e.replace(/\s*$/,``)} ${t}`}function fb(e,t,n,r,i){return e||t||n&&(r||i)}function pb(e,t,n){return!e||t||n}function mb(e,t,n){return(e+t+n)%n}function hb(e,t){return e??t}function gb(){return typeof CSS<`u`&&CSS.supports(`field-sizing`,`content`)}function _b(e,t){return e!==t}function vb(e){return e||void 0}function yb(e,t){return e&&!t||void 0}function bb(e,t,n){return e?t??``:n}function xb(e,t){return e?`${t}-submission`:void 0}function Sb(e,t,n){return e?`${t} ${n}`:t}function Cb(e,t,n,r){return e||t||n!==null||r!=null}function wb(e,t,n){return e||!!t||n}function Tb(e,t){return!!e||t}function Eb(e,t){return!e&&!t}function Db(e,t){return!!e||!!t}function Ob(e,t){return e===`@`?`No files seen in this session yet — full file search arrives with the Files tab.`:t?`Loading skills…`:`No matching skills.`}function kb(e,t){return c(`shrink-0 truncate`,e&&`font-semibold`,t&&`font-mono text-xs`)}function Ab(e,t,n){return c(e&&`new-task-composer`,t&&`session-composer`,n&&`opacity-80`)}function jb(e){return c(`rounded-xl border border-[var(--composer-border)] bg-card shadow-none transition-[border-color,box-shadow] focus-within:border-ring focus-within:ring-[3px] focus-within:ring-ring/15`,e&&`new-task-editor`)}function Mb(e){return c(`group relative shrink-0 overflow-hidden rounded-md border border-border`,e?`size-12`:`flex h-12 min-w-11 max-w-[200px] items-center gap-1.5 bg-muted/40 px-2.5 text-xs text-muted-foreground`)}function Nb(e,t){return c(`block field-sizing-content min-h-11 w-full overflow-y-auto resize-none bg-transparent px-3 pbs-2.5 pbe-1 text-base leading-normal outline-hidden placeholder:text-muted-foreground disabled:cursor-not-allowed md:min-h-[54px] md:px-4 md:pbs-3 md:text-sm`,e?`max-h-11 md:max-h-[220px]`:`max-h-[220px]`,t&&`md:text-base`)}function Pb(e,t){return e?`Task description`:t}function Fb(e){return e?`hidden px-5 pbs-5 text-xs text-muted-foreground md:block`:`sr-only`}function Ib(e){return c(`ms-auto flex min-w-0 flex-wrap items-center justify-end gap-1 md:flex-nowrap`,e&&`new-task-submission`)}function Lb(e){return c(`min-w-0 flex-wrap items-center gap-1.5 md:flex-nowrap`,e.executionOptions&&`me-auto`,e.mobileCollapsible&&`max-md:[&_button]:min-h-11 max-md:[&_button]:min-w-11`,e.mobileCompact?`hidden md:flex`:`flex`)}function Rb(e,t){return c(e.executionOptions?`h-12 w-full gap-2 px-6`:e.sessionControls?`h-11 w-auto gap-2 px-5`:`size-11`,!e.hasContent&&t&&`w-auto px-3`,`active:opacity-80`)}function zb(e,t){return c(`overflow-y-auto text-xs leading-5 text-muted-foreground`,e&&!t?`h-0`:`px-3 pbe-2 md:px-4`,e?t&&`min-h-6`:`h-24 md:h-20`)}function Bb(e){return c(`h-11 min-w-11 active:opacity-80`,e?`w-auto px-3`:`w-11`)}function Vb(e){return c(`flex min-w-0 flex-wrap items-center gap-1`,e&&`w-full`)}function Hb(e){return c(`transition-transform motion-reduce:transition-none`,!e&&`rotate-180`)}var Ub=`size-11 shrink-0 rounded-[9px] border border-border p-0 text-muted-foreground`;function Wb(e){return c(Ub,e&&`hidden md:inline-flex`)}function Gb(e){return e.disabled||e.busy||e.stopPending||!e.hasContent&&!e.allowEmptySubmit}function Kb(e,t){return!e.sessionControls&&!e.hasContent&&!!t}function qb(e,t){return e.executionOptions||e.sessionControls||!e.hasContent&&!!t}function Jb(e,t){return e.sessionControls||e.hasContent||!t}function Yb(e){return e?`Finishing…`:`Finish`}function Xb({mode:e,onStart:t}){return(0,X.jsx)(G,{type:`button`,variant:`ghost`,size:`icon-sm`,disabled:e.disabled||e.readOnly,"aria-label":`Start dictation`,title:`Dictation`,className:Wb(e.mobileCompact),onClick:t,children:(0,X.jsx)(lr,{"aria-hidden":`true`,className:`size-4`})})}function Zb({mode:e,onFinish:t}){return(0,X.jsxs)(G,{type:`button`,"data-slot":`composer-finish`,"aria-label":e.finishLabel,"aria-busy":e.finishing||void 0,title:e.finishTitle,disabled:e.busy||e.stopPending||e.finishing,className:`h-11 w-auto gap-[7px] px-5 active:opacity-80`,onClick:t,children:[(0,X.jsx)(mr,{"aria-hidden":`true`}),e.finishLabel]})}function Qb({mode:e,onStop:t}){return(0,X.jsxs)(G,{type:`button`,variant:`outline`,size:`icon-sm`,"aria-label":e.stopPending?`Stopping…`:`Stop`,"aria-busy":e.stopPending||void 0,title:e.stopPending?`Waiting for execution to stop`:`Stop execution; keep existing work`,disabled:e.busy||e.stopPending,className:Bb(e.labelledStop),onClick:t,children:[(0,X.jsx)(Dr,{"aria-hidden":`true`,className:`size-3 fill-current`}),e.labelledStop?e.stopPending?`Stopping…`:`Stop`:null]})}function $b({shown:e,compactFeedback:t,hasCompactFeedback:n,textareaId:r,submissionError:i,stopPending:a,busy:o,pendingLabel:s,failureHint:c,idleFeedback:l}){return e?(0,X.jsx)(`div`,{className:zb(t,n),children:(0,X.jsx)(`div`,{id:`${r}-submission`,role:i===null?`status`:`alert`,"aria-atomic":`true`,tabIndex:i===null?void 0:0,className:`break-words`,children:a?`Stopping execution. Your draft is kept.`:o?s:i===null?l??null:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`p`,{className:`font-medium text-foreground`,children:i}),(0,X.jsx)(`p`,{children:c})]})})}):null}function ex({mode:e,emptySubmitLabel:t,emptySubmitVariant:n,optionsId:r,dictationButton:i,footerEnd:a,stopControl:o,secondaryAction:s,finishControl:c,onSubmit:l}){return(0,X.jsxs)(`div`,{"data-slot":`composer-submit-row`,className:Ib(e.executionOptions),children:[Db(e.executionOptions,e.sessionControls)?null:i,a?(0,X.jsx)(`div`,{id:r,"data-slot":`composer-footer-end`,className:Lb(e),children:(0,X.jsx)(`div`,{className:`contents`,inert:vb(e.readOnly),children:a})}):null,(0,X.jsxs)(`div`,{className:`flex min-w-[100px] items-center justify-end gap-1`,"data-slot":`composer-actions`,children:[o??s,c,Eb(e.primaryStop,e.primaryFinish)?(0,X.jsxs)(G,{type:`button`,size:`icon-sm`,variant:e.hasContent?`primary`:n??`primary`,"aria-label":e.submitLabel,"aria-busy":yb(e.busy,e.stopPending),disabled:Gb(e),className:Rb(e,t),onClick:l,children:[Kb(e,t)?(0,X.jsx)(mi,{"aria-hidden":`true`}):null,qb(e,t)?e.submitLabel:null,Jb(e,t)?(0,X.jsx)(xr,{"aria-hidden":`true`}):null]}):null]})]})}function tx({images:e,readOnly:t,onRemove:n}){return e.length===0?null:(0,X.jsx)(`div`,{"data-slot":`composer-thumbs`,className:`flex flex-nowrap items-center gap-2 overflow-x-auto px-4 pbs-3 md:flex-wrap md:overflow-visible`,children:e.map((e,r)=>(0,X.jsxs)(`button`,{type:`button`,"aria-label":`Remove ${e.name}`,title:t?`Attachment submitted`:`Click to remove`,disabled:t,className:Mb(e.isImage),onClick:()=>n(r),children:[e.isImage?(0,X.jsx)(`img`,{src:e.preview,alt:``,className:`size-full object-cover`}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(rr,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,X.jsx)(`span`,{className:`truncate`,children:e.name})]}),(0,X.jsx)(`span`,{className:`absolute inset-0 hidden items-center justify-center bg-background/70 group-hover:flex group-focus-visible:flex`,children:(0,X.jsx)(vr,{"aria-hidden":`true`,className:`size-4`})})]},`${e.name}-${r}`))})}function nx({menuListRef:e,trigger:t,activeValue:n,skillsPending:r,candidates:i,onValueChange:a,onPick:o}){return(0,X.jsx)(Co,{shouldFilter:!1,value:n??``,onValueChange:a,children:(0,X.jsx)(So,{ref:e,"data-slot":`composer-menu`,"data-trigger":t,className:`max-h-[min(16rem,var(--radix-popover-content-available-height))] p-1`,children:i.length===0?(0,X.jsx)(`p`,{className:`px-3 py-4 text-center text-xs text-muted-foreground`,children:Ob(t,r)}):i.map(e=>(0,X.jsxs)(bo,{value:e.value,"data-slot":`composer-menu-item`,"data-emphasized":e.emphasized||void 0,onSelect:()=>o(e),children:[(0,X.jsx)(`span`,{className:kb(e.emphasized,t===`@`),children:e.label}),e.description?(0,X.jsx)(`span`,{title:e.description,className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null]},e.value))})})}function rx({recording:e,insertionDisabled:t,onCancel:n,onInsert:r,onInsertAndSend:i,now:a}){return(0,X.jsxs)(`div`,{"data-slot":`dictation-overlay`,role:`status`,"aria-label":`Dictation in progress`,className:`flex items-center gap-2.5 rounded-b-xl border-bs border-border bg-muted/60 px-3 py-2`,children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`size-2 flex-none animate-pulse rounded-full bg-danger motion-reduce:animate-none`}),(0,X.jsx)(`span`,{"data-slot":`dictation-timer`,className:`text-xs font-medium text-muted-foreground tabular-nums`,children:Jy(e.startedAt,a)}),(0,X.jsx)(`span`,{"data-slot":`dictation-transcript`,"aria-live":`polite`,className:`min-w-0 flex-1 truncate text-sm text-foreground`,children:e.transcript===``?(0,X.jsx)(`span`,{className:`text-muted-foreground`,children:`Listening…`}):e.transcript}),(0,X.jsx)(G,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Cancel dictation`,className:`size-11 text-muted-foreground md:size-8`,onClick:n,children:(0,X.jsx)(vr,{"aria-hidden":`true`})}),(0,X.jsx)(G,{type:`button`,variant:`outline`,size:`icon-sm`,disabled:t,"aria-label":`Insert transcription`,className:`size-11 md:size-8`,onClick:r,children:(0,X.jsx)(mr,{"aria-hidden":`true`})}),(0,X.jsx)(G,{type:`button`,size:`icon-sm`,disabled:t,"aria-label":`Insert transcription and send`,className:`size-11 md:size-8`,onClick:i,children:(0,X.jsx)(xr,{"aria-hidden":`true`})})]})}function ix({mobileOpen:e,controls:t,onToggle:n}){return(0,X.jsx)(G,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`size-11 md:hidden`,"aria-label":e?`Collapse composer`:`Expand composer`,"aria-expanded":e,"aria-controls":t,onClick:n,children:(0,X.jsx)(Tr,{"aria-hidden":`true`,className:Hb(e)})})}function ax(){return(0,X.jsxs)(`p`,{"data-slot":`composer-skill-hint`,className:`flex items-center gap-2 px-5 pbs-3 pbe-2 text-xs text-muted-foreground`,children:[(0,X.jsx)(Sr,{"aria-hidden":`true`,className:`size-[15px] shrink-0`}),`Type / for a skill or workflow`]})}function ox({disabled:e,onFiles:t,inputRef:n}){return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(G,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Attach files`,title:`Attach an image, PDF, TXT or MD file (or paste a screenshot)`,disabled:e,className:Ub,onClick:()=>n.current?.click(),children:(0,X.jsx)(rr,{"aria-hidden":`true`,className:`size-[15px]`})}),(0,X.jsx)(`input`,{ref:n,type:`file`,accept:`image/*,application/pdf,text/plain,text/markdown,.pdf,.txt,.md,.markdown,.log`,multiple:!0,className:`hidden`,"aria-hidden":`true`,tabIndex:-1,onChange:e=>{t([...e.target.files??[]]),e.target.value=``}})]})}function sx({mode:e,executionOptions:t,sessionControls:n,images:r,onRemoveImage:i,textareaId:a,textareaRef:o,text:s,disabled:c,retainDraftUntilSuccess:l,ariaLabel:u,disabledReason:d,placeholder:f,onTextChange:p,onKeyDown:m,onSelect:h,onPaste:g,recording:_,onCancelDictation:v,onInsertTranscript:y,onInsertAndSend:b,stopControl:x,mobileCollapsible:S,mobileOpen:C,optionsId:w,footerEnd:T,onToggleMobile:E,footerStart:D,attachInputRef:O,addFiles:k,dictationButton:A,submissionControls:j,feedback:M,agentOptions:ee}){return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{"data-slot":`composer-editor`,className:jb(t),children:[(0,X.jsx)(tx,{images:r,readOnly:e.readOnly,onRemove:i}),(0,X.jsx)(`label`,{htmlFor:a,className:Fb(t),children:Pb(t,u)}),(0,X.jsx)(`textarea`,{ref:o,id:a,autoComplete:`off`,rows:1,value:s,disabled:c,readOnly:e.readOnly,"aria-busy":e.readOnly||void 0,"aria-describedby":xb(l,a),"aria-label":u,placeholder:bb(c,d,f),className:Nb(e.mobileCompact,t),onChange:e=>p(e.target.value),onKeyDown:m,onSelect:h,onPaste:g}),t?(0,X.jsx)(ax,{}):null,n&&_?(0,X.jsx)(`div`,{"data-slot":`session-controls`,inert:vb(e.readOnly),children:n}):null,_?(0,X.jsx)(cx,{recording:_,mode:e,onCancel:v,onInsert:y,onInsertAndSend:b,stopControl:x}):(0,X.jsx)(lx,{mode:e,sessionControls:n,executionOptions:t,mobileCollapsible:S,mobileOpen:C,optionsId:w,textareaId:a,footerEnd:T,onToggleMobile:E,footerStart:D,attachInputRef:O,addFiles:k,disabled:c,dictationButton:A,submissionControls:j}),t?null:M]}),t?(0,X.jsx)(ux,{mode:e,agentOptions:ee,executionOptions:t,submissionControls:j,feedback:M}):null]})}function cx({recording:e,mode:t,onCancel:n,onInsert:r,onInsertAndSend:i,stopControl:a}){let o=io(1e3);return(0,X.jsxs)(`div`,{children:[(0,X.jsx)(rx,{recording:e,insertionDisabled:t.readOnly,onCancel:n,onInsert:r,onInsertAndSend:i,now:o}),a?(0,X.jsx)(`div`,{className:`flex justify-end px-2 pbe-2`,children:a}):null]})}function lx(e){return(0,X.jsxs)(`div`,{"data-slot":`composer-toolbar`,className:`flex flex-wrap items-center gap-1 gap-y-1 px-1.5 pbs-1 pbe-1.5 md:gap-y-1.5 md:px-2 md:pbs-1.5 md:pbe-2`,children:[e.sessionControls?(0,X.jsx)(`div`,{"data-slot":`session-controls`,inert:vb(e.mode.readOnly),children:e.sessionControls}):null,(0,X.jsxs)(`div`,{"data-slot":`composer-footer-start`,className:Vb(e.executionOptions),children:[(0,X.jsx)(ox,{disabled:e.disabled||e.mode.readOnly,onFiles:e.addFiles,inputRef:e.attachInputRef}),e.mobileCollapsible?(0,X.jsx)(ix,{mobileOpen:e.mobileOpen,controls:Sb(!!e.footerEnd,e.textareaId,e.optionsId),onToggle:e.onToggleMobile}):null,(0,X.jsx)(`div`,{className:`contents`,inert:vb(e.mode.readOnly),children:e.footerStart}),Db(e.executionOptions,e.sessionControls)?(0,X.jsx)(`div`,{children:e.dictationButton}):null]}),e.executionOptions?null:e.submissionControls]})}function ux({mode:e,agentOptions:t,executionOptions:n,submissionControls:r,feedback:i}){return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`div`,{"data-slot":`composer-agent-options`,inert:vb(e.readOnly),children:t}),(0,X.jsx)(`div`,{"data-slot":`composer-execution-panel`,inert:vb(e.readOnly),children:n}),r,(0,X.jsx)(`div`,{"data-slot":`composer-feedback`,children:i})]})}function dx({open:e,onClose:t,rootRef:n,disabled:r,onDrop:i,className:a,children:o,menu:s}){return(0,X.jsxs)(sa,{open:e,onOpenChange:e=>e?void 0:t(),children:[(0,X.jsx)(ia,{asChild:!0,children:(0,X.jsx)(`div`,{ref:n,"data-slot":`composer`,"data-disabled":r||void 0,onDrop:i,onDragOver:e=>e.preventDefault(),className:a,children:o})}),(0,X.jsx)(aa,{side:`top`,align:`start`,sideOffset:8,className:`w-80 max-w-[calc(100vw-2rem)] p-0`,onOpenAutoFocus:e=>e.preventDefault(),onInteractOutside:e=>{n.current?.contains(e.target)&&e.preventDefault()},children:s})]})}var fx=new Map,px={KeyA:`Yes, approved.`,KeyC:`Continue.`},Z={retainDraftUntilSuccess:!1,finishing:!1,stopOnEmpty:!1,stopping:!1,compactFeedback:!1,pendingLabel:`Starting task…`,failureHint:`Could not confirm submission. Check Tasks before you retry. Your draft is kept.`,clearOnSuccess:!0,autoFocus:!1,mobileCollapsible:!1,sendAriaLabel:`Send`,disabled:!1,disabledReason:`Session closed — Continue to reopen.`,allowEmptySubmit:!1,placeholder:`Reply — / for skills, @ for files…`,ariaLabel:`Reply to the agent`,autocompleteSkills:!0,quickReplies:!1};function Q(e,t){return e===void 0?t:e}function mx(e,t,n,r){return t>0||n||!r&&e.trim()!==``}function hx(e){return{...e,retainDraftUntilSuccess:Q(e.retainDraftUntilSuccess,Z.retainDraftUntilSuccess),finishing:Q(e.finishing,Z.finishing),stopOnEmpty:Q(e.stopOnEmpty,Z.stopOnEmpty),stopping:Q(e.stopping,Z.stopping),compactFeedback:Q(e.compactFeedback,Z.compactFeedback),pendingLabel:Q(e.pendingLabel,Z.pendingLabel),failureHint:Q(e.failureHint,Z.failureHint),clearOnSuccess:Q(e.clearOnSuccess,Z.clearOnSuccess),autoFocus:Q(e.autoFocus,Z.autoFocus),mobileCollapsible:Q(e.mobileCollapsible,Z.mobileCollapsible),sendAriaLabel:Q(e.sendAriaLabel,Z.sendAriaLabel),disabled:Q(e.disabled,Z.disabled),disabledReason:Q(e.disabledReason,Z.disabledReason),allowEmptySubmit:Q(e.allowEmptySubmit,Z.allowEmptySubmit),placeholder:Q(e.placeholder,Z.placeholder),ariaLabel:Q(e.ariaLabel,Z.ariaLabel),autocompleteSkills:Q(e.autocompleteSkills,Z.autocompleteSkills),quickReplies:Q(e.quickReplies,Z.quickReplies)}}function gx(e,t,n,r){if(e===null)return[];if(e.trigger===`/`){let r=new Set;return Mo(t,e.query,n).filter(e=>r.has(e.id)?!1:(r.add(e.id),!0)).map(e=>({value:e.id,insert:e.id,label:e.name,description:_x(e,t),emphasized:jo(e)}))}return(r?.()??[]).filter(t=>Fo(t,e.query)).map(e=>({value:e,insert:e,label:e,emphasized:!1}))}function _x(e,t){let n=t.filter(t=>t.id===e.id);return[e.description,...n.map(e=>e.path),n.length>1?`Runner scope picks the copy. Use the task skill picker to choose a specific copy.`:void 0].filter(Boolean).join(` · `)}function vx(e,t){return e.some(e=>e.value===t)?t:e[0]?.value}function yx(e,t,n,r,i,a,o){!e||!t||!n||(r&&a(),i&&o())}function bx(e,t,n,r,i,a,o,s){if(e){a(n);return}B(n,{tone:`danger`}),t&&(o(e=>sb(e,r)),s(e=>[...i,...e].slice(0,4)))}function xx(e,t){let[n,r]=(0,Y.useState)(``),i=e??n,a=(0,Y.useRef)(i);a.current=i;let o=(0,Y.useRef)(t);return o.current=t,{text:i,textRef:a,setText:(0,Y.useCallback)(e=>{let t=typeof e==`function`?e(a.current):e;r(t),o.current?.(t)},[])}}function Sx(e){let{onSubmit:t,retainDraftUntilSuccess:n,onStop:r,onFinish:i,finishing:a,secondaryAction:o,stopOnEmpty:s,stopping:c,emptySubmitLabel:l,emptySubmitVariant:u,compactFeedback:d,idleFeedback:f,pendingLabel:p,failureHint:m,clearOnSuccess:h,onPendingChange:g,value:_,onValueChange:y,autoFocus:b,mobileCollapsible:x,mobileDisclosureKey:S,footerStart:C,footerEnd:w,sessionControls:T,executionOptions:E,agentOptions:D,sendAriaLabel:O,disabled:A,disabledReason:j,allowEmptySubmit:M,placeholder:ee,ariaLabel:te,autocompleteSkills:N,skillRunner:P,skillAccount:ne,quickReplies:re,getMentionCandidates:F,ref:ie,draftPersisted:ae}=hx(e),{text:I,textRef:oe,setText:L}=xx(_,y),[se,ce]=(0,Y.useState)([]),le=(0,Y.useRef)(se);le.current=se;let[de,fe]=(0,Y.useState)(!1),pe=c||de,me=(0,Y.useRef)(pe);me.current=pe;let[he,ge]=(0,Y.useState)(!1),_e=(0,Y.useRef)(!1),ve=(0,Y.useRef)(0),R=(0,Y.useRef)(!0);(0,Y.useEffect)(()=>(R.current=!0,()=>{R.current=!1}),[]);let[ye,be]=(0,Y.useState)(null),xe=()=>tb(me.current,n,_e.current),[Se,Ce]=(0,Y.useState)(null),[we,Te]=(0,Y.useState)(``),[Ee,De]=(0,Y.useState)(!1),Oe=(0,Y.useRef)(null),ke=(0,Y.useId)(),Ae=(0,Y.useId)(),je=(0,Y.useRef)(null),Me=(0,Y.useRef)(new Map),Ne=S===void 0?Me.current:fx,Pe=ib(S),[,Fe]=(0,Y.useReducer)(e=>e+1,0),Ie=ab(Ne,Pe),Le=(0,Y.useRef)(null),Re=(0,Y.useRef)(null),ze=(0,Y.useRef)(null),Be=v(P,ne,N&&Ee),Ve=ue(),He=z(),Ue=(0,Y.useRef)(A);Ue.current=A;let We=qy((e,t)=>B(e,{tone:`danger`,...t?{action:{label:`Try again`,onAction:()=>{!Ue.current&&!xe()&&t()}}}:{}}));(0,Y.useEffect)(()=>{b&&Oe.current?.focus()},[]);let Ge=(0,Y.useCallback)(()=>{let e=Oe.current;if(!e||A||xe()){Ce(null);return}let t=Hy(e.value,hb(e.selectionStart,e.value.length));if(t?.trigger===`/`&&!N||t?.trigger===`@`&&F===void 0)return Ce(null);t?.trigger===`/`&&De(!0),Ce(t)},[N,A,F,n]),Ke=(0,Y.useMemo)(()=>gx(Se,Be.data??[],Ve.data?.skillUsage,F),[F,Be.data,Se,Ve.data?.skillUsage]),qe=vx(Ke,we),Ye=Se!==null;(0,Y.useLayoutEffect)(()=>{!Ye||!qe||[...Re.current?.querySelectorAll(`[data-slot="composer-menu-item"]`)??[]].find(e=>e.getAttribute(`data-value`)===qe)?.scrollIntoView({block:`nearest`})},[qe,Ye]);let Xe=(0,Y.useCallback)(()=>Ce(null),[]),Ze=e=>{let t=Oe.current;if(!t||Se===null||xe())return;let n=hb(t.selectionStart,t.value.length),r=Uy(t.value,Se,n,e.insert);Se.trigger===`/`&&Ve.data!==void 0&&Je({skillUsage:Io(Ve.data.skillUsage,e.insert)}).then(()=>He.invalidateQueries({queryKey:k.uiState})).catch(()=>{}),L(r.text),ze.current=r.caret,Ce(null),t.focus()};(0,Y.useLayoutEffect)(()=>{let e=ze.current,t=Oe.current;e!==null&&t&&(t.setSelectionRange(e,e),ze.current=null)},[I]),(0,Y.useLayoutEffect)(()=>{let e=Oe.current;if(!e||gb())return;let t=()=>{e.style.height=`auto`,e.style.height=`${Math.min(e.scrollHeight,220)}px`};t();let n=e.clientWidth,r=typeof ResizeObserver>`u`?null:new ResizeObserver(()=>{_b(e.clientWidth,n)&&(n=e.clientWidth,t())});r?.observe(e);let i=!1;return document.fonts?.ready.then(()=>{i||t()}),()=>{i=!0,r?.disconnect()}},[I,Ie]);let Qe=(0,Y.useCallback)(e=>{if(A||xe())return;let t=ve.current,r=By(e,le.current.length);for(let e of r.rejected)B(e,{tone:`danger`});for(let e of r.accepted)zy(e).then(e=>{!R.current||n&&_e.current&&!me.current||t!==ve.current||ce(t=>t.length>=4?t:[...t,e])},()=>B(cb(e.name),{tone:`danger`}))},[A,n]),$e=e=>{let t=ub(e.dataTransfer?.files);t.length!==0&&(e.preventDefault(),Qe(t))},et=(0,Y.useCallback)((e,t)=>nb(A,c,_e.current,M,e,t.length),[A,c,M]),tt=(0,Y.useCallback)(async(e,r,i)=>{let a=e.trim();if(!et(e,r)){_e.current=!0,n&&(ve.current+=1),ge(!0),be(null),g?.(!0),Ce(null),i&&!n&&(L(``),ce([]));try{await t(a,r.map(({mediaType:e,data:t})=>({mediaType:e,data:t}))),yx(R.current,n,h,oe.current===e,le.current===r,()=>L(``),()=>ce([]))}catch(t){if(!R.current&&n)return;bx(n,i,ob(t),e,r,be,L,ce)}finally{_e.current=!1,R.current&&(g?.(!1),ge(!1))}}},[et,t,n,h,g,L]),nt=(0,Y.useCallback)(()=>et(oe.current,le.current)?!1:(tt(oe.current,le.current,!0),!0),[et,tt]);(0,Y.useImperativeHandle)(ie,()=>({insertAtCaret:e=>{if(xe())return;let t=Oe.current,n=hb(t?.selectionStart??null,oe.current.length),r=jy(oe.current,n,e);L(r.text),ze.current=r.caret,t?.focus()}}),[L,n]);let rt=async()=>{if(!pb(r,c,_e.current)){_e.current=!0,ge(!0),fe(!0),be(null);try{await r?.()}catch(e){R.current&&be(ob(e))}finally{_e.current=!1,R.current&&(ge(!1),fe(!1))}}},it=e=>{Ye&&at(e)||Fy({key:e.key,shiftKey:e.shiftKey,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,repeat:e.repeat,isComposing:e.nativeEvent.isComposing})&&(e.preventDefault(),nt())},at=e=>{if(e.key===`ArrowDown`||e.key===`ArrowUp`){if(e.preventDefault(),Ke.length===0)return!0;let t=Ke.findIndex(e=>e.value===qe),n=e.key===`ArrowDown`?1:-1,r=Ke[mb(t,n,Ke.length)];return Te(r.value),!0}if(e.key===`Escape`)return e.preventDefault(),Xe(),!0;if((e.key===`Enter`||e.key===`Tab`)&&!e.shiftKey){let t=Ke.find(e=>e.value===qe);if(t)return e.preventDefault(),Ze(t),!0;Xe()}return!1};(0,Y.useEffect)(()=>{if(!re||A)return;let e=e=>{if(!e.altKey||e.metaKey||e.ctrlKey||e.repeat||nd(e.target))return;let t=px[e.code];t!==void 0&&(e.preventDefault(),tt(t,[],!1))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[A,re,tt]);let ot=e=>{if(fb(A,me.current,_e.current,e,n))return;let t=We.finish();if(t===``)return;let r=db(I,t);if(e){n&&L(r),tt(r,se,!0);return}L(r),ze.current=r.length,Oe.current?.focus()},st=Yy(I,se.length),ct=Xy(st,r,s,pe),lt=Zy(st,ct,i),ut={hasContent:st,primaryStop:ct,primaryFinish:lt,labelledStop:Qy(ct,lt,st,l),submitLabel:$y(st,l,O),busy:he,stopPending:pe,finishing:a,finishLabel:Yb(a),finishTitle:`Close the session and mark this task done`,disabled:A,allowEmptySubmit:M,readOnly:eb(pe,n,he),mobileCompact:rb(x,Ie),mobileCollapsible:x,executionOptions:!!E,sessionControls:!!T,showStop:Tb(r,pe)},dt=We.recording;_m(mx(I,se.length,dt!==null,ae===!0));let ft=We.supported?(0,X.jsx)(Xb,{mode:ut,onStart:()=>{xe()||We.start()}}):null,pt=ut.primaryFinish?(0,X.jsx)(Zb,{mode:ut,onFinish:()=>void i?.()}):null,mt=ut.showStop?(0,X.jsx)(Qb,{mode:ut,onStop:()=>void rt()}):null,ht=(0,X.jsx)($b,{shown:wb(n,r,c),compactFeedback:d,hasCompactFeedback:Cb(pe,he,ye,f),textareaId:ke,submissionError:ye,stopPending:pe,busy:he,pendingLabel:p,failureHint:m,idleFeedback:f}),gt=(0,X.jsx)(ex,{mode:ut,emptySubmitLabel:l,emptySubmitVariant:u,optionsId:Ae,dictationButton:ft,footerEnd:w,stopControl:mt,secondaryAction:o,finishControl:pt,onSubmit:nt});return(0,X.jsx)(dx,{open:Ye,onClose:Xe,rootRef:Le,disabled:A,onDrop:$e,className:Ab(E,T,A),menu:(0,X.jsx)(nx,{menuListRef:Re,trigger:Se?.trigger,activeValue:qe,skillsPending:Be.isPending,candidates:Ke,onValueChange:Te,onPick:Ze}),children:(0,X.jsx)(sx,{mode:ut,executionOptions:E,sessionControls:T,images:se,onRemoveImage:e=>{xe()||ce(t=>t.filter((t,n)=>n!==e))},textareaId:ke,textareaRef:Oe,text:I,disabled:A,retainDraftUntilSuccess:n,ariaLabel:te,disabledReason:j,placeholder:ee,onTextChange:e=>{xe()||(L(e),Ge())},onKeyDown:it,onSelect:Ge,onPaste:e=>{let t=lb(e.clipboardData?.items);t.length!==0&&(e.preventDefault(),Qe(t))},recording:dt,onCancelDictation:We.cancel,onInsertTranscript:()=>ot(!1),onInsertAndSend:()=>ot(!0),stopControl:mt,mobileCollapsible:x,mobileOpen:Ie,optionsId:Ae,footerEnd:w,onToggleMobile:()=>{Ne.set(Pe,!Ie),Fe()},footerStart:C,attachInputRef:je,addFiles:Qe,dictationButton:ft,submissionControls:gt,feedback:ht,agentOptions:D})})}var Cx=`inline-flex h-[26px] min-w-0 max-w-full items-center gap-1.5 rounded-full border border-control-border bg-card px-2.5 text-xs font-medium text-muted-foreground transition-colors focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-link-foreground hover:bg-muted hover:text-foreground disabled:pointer-events-none disabled:border-dashed disabled:bg-muted`,wx=(0,X.jsx)(Tr,{"aria-hidden":`true`,className:`size-2.5 shrink-0 text-supporting-foreground`}),Tx=(0,Y.createContext)(null),Ex=e=>Number.parseFloat(e)||0;function Dx({pill:e,box:t,full:n}){let r=getComputedStyle(e),i=[...e.children].filter(e=>{if(e===t)return!1;let n=getComputedStyle(e);return n.display!==`none`&&n.position!==`absolute`});return i.reduce((e,t)=>e+t.getBoundingClientRect().width,0)+Ex(r.columnGap)*i.length+n.getBoundingClientRect().width+Ex(r.paddingLeft)+Ex(r.paddingRight)+Ex(r.borderLeftWidth)+Ex(r.borderRightWidth)}function Ox(e){for(let t=e.parentElement;t;t=t.parentElement){if(t.dataset.slot===`picker-pill-disabled-wrapper`)continue;let e=getComputedStyle(t).display;if(e===`grid`||e===`flex`)return t}return e.parentElement}function kx(e,t){let n=new Map;for(let t of e){let e=Ox(t.pill),r=n.get(e)??new Map,i=Math.round(t.pill.getBoundingClientRect().top);r.set(i,[...r.get(i)??[],t]),n.set(e,r)}for(let[e,r]of n){let n=getComputedStyle(e),i=e.clientWidth-Ex(n.paddingLeft)-Ex(n.paddingRight);for(let e of r.values()){let r=e.map(Dx);if((e.length>1&&e.some(e=>e.pill.dataset.slot===t)?Math.max(...r)*e.length:r.reduce((e,t)=>e+t,0))+Ex(n.columnGap)*(e.length-1)>i+.5)return!1}}return!0}function Ax({children:e,fill:t}){let n=(0,Y.useRef)(new Map),r=(0,Y.useRef)(null),[i,a]=(0,Y.useState)(!0),o=(0,Y.useRef)(t),s=(0,Y.useCallback)(()=>a(kx([...n.current.values()],o.current)),[]),c=(0,Y.useCallback)((e,t)=>{if(n.current.set(e,t),typeof ResizeObserver<`u`){r.current??=new ResizeObserver(s);for(let e of[t.box,t.full,Ox(t.pill)])r.current.observe(e)}return s(),()=>{if(n.current.delete(e),typeof ResizeObserver<`u`)for(let e of[t.box,t.full])r.current?.unobserve(e);s()}},[s]);(0,Y.useLayoutEffect)(()=>{o.current!==t&&(o.current=t,s())},[t,s]),(0,Y.useLayoutEffect)(()=>()=>r.current?.disconnect(),[]);let l=(0,Y.useMemo)(()=>({register:c,showPrefixes:i}),[c,i]);return(0,X.jsx)(Tx.Provider,{value:l,children:e})}function jx({field:e,children:t}){let n=(0,Y.useRef)(null),r=(0,Y.useRef)(null),i=(0,Y.useContext)(Tx),a=i?.register,o=(0,Y.useId)(),[s,l]=(0,Y.useState)(!0);(0,Y.useLayoutEffect)(()=>{let e=n.current,t=r.current;if(a){let n=e.closest(`[data-slot$="pill"]`);return n?a(o,{pill:n,box:e,full:t}):void 0}let i=()=>l(t.getBoundingClientRect().width<=e.getBoundingClientRect().width+.5);if(i(),typeof ResizeObserver>`u`)return;let s=new ResizeObserver(i);return s.observe(e),s.observe(t),()=>s.disconnect()},[e,t,o,a]);let u=i!==null,d=u?i.showPrefixes:s,f=u&&!d;return(0,X.jsxs)(`span`,{ref:n,className:`relative min-w-0 overflow-hidden`,"aria-hidden":`true`,children:[(0,X.jsxs)(`span`,{ref:r,className:c(`invisible w-max whitespace-nowrap`,f?`absolute left-0 top-0`:`block`),children:[e,` · `,t]}),(0,X.jsxs)(`span`,{"data-slot":`picker-label`,className:c(`block truncate`,f?`relative`:`absolute inset-0`),children:[d?(0,X.jsxs)(`span`,{className:`text-muted-foreground`,children:[e,` · `]}):null,t]})]})}function Mx({fieldLabel:e,ariaLabel:t,label:n,options:r,value:i}){return e?`${t} · ${typeof n==`string`?n:r.find(e=>e.value===i)?.label??i}`:t}function Nx({readOnly:e,disabled:t,hint:n,disabledHint:r}){return e?r??n:t?r:n}function Px({fieldLabel:e,fullLabel:t,explanation:n}){return e?[t,n].filter(Boolean).join(` — `):n}function Fx({icon:e,fieldLabel:t,ariaLabel:n,label:r}){return(0,X.jsxs)(X.Fragment,{children:[e,t?(0,X.jsx)(jx,{field:n,children:r}):(0,X.jsx)(`span`,{className:`min-w-0 truncate`,title:typeof r==`string`?r:void 0,children:r})]})}function Ix({slot:e,ariaLabel:t,label:n,value:r,options:i,onPick:a,disabled:o=!1,choicesDisabled:s=!1,readOnly:l=!1,hint:u,disabledHint:d,status:f,searchPlaceholder:p,icon:m,fieldLabel:h=!1,footer:g}){let[_,v]=(0,Y.useState)(!1),[y,b]=(0,Y.useState)(``),x=(0,Y.useRef)(null),S=(0,Y.useRef)(null),C=p?i.filter(e=>e.label.toLowerCase().includes(y.trim().toLowerCase())):i;(0,Y.useEffect)(()=>{if(!_||!p)return;let e=window.setTimeout(()=>x.current?.focus());return()=>window.clearTimeout(e)},[_,p]);let w=e=>{x.current&&document.activeElement===x.current&&e.preventDefault()},T=m?` h-11 gap-2 rounded-lg border-border px-3 text-foreground`:``,E=Mx({fieldLabel:h,ariaLabel:t,label:n,options:i,value:r}),D=Px({fieldLabel:h,fullLabel:E,explanation:Nx({readOnly:l,disabled:o,hint:u,disabledHint:d})}),O=Fx({icon:m,fieldLabel:h,ariaLabel:t,label:n});if(l)return(0,X.jsxs)(`span`,{"data-slot":e,"aria-label":E,title:D,className:c(Cx,T,`cursor-default hover:bg-card hover:text-muted-foreground`),children:[O,h?(0,X.jsx)(`span`,{className:`sr-only`,children:E}):null]});let k=(0,X.jsxs)(`button`,{type:`button`,"data-slot":e,"aria-label":E,disabled:o,title:D,className:c(Cx,T),children:[O,m?(0,X.jsx)(Tr,{"aria-hidden":`true`,className:`size-[13px] shrink-0 text-muted-foreground`}):wx]});return o?(0,X.jsx)(`span`,{"data-slot":`picker-pill-disabled-wrapper`,title:D,className:`inline-flex min-w-0 max-w-full`,children:k}):(0,X.jsxs)(Li,{open:_,onOpenChange:e=>{v(e),e||b(``)},children:[(0,X.jsx)(Pi,{asChild:!0,children:k}),(0,X.jsxs)(Fi,{ref:S,align:`start`,"data-testid":`${e}-menu`,children:[p?(0,X.jsxs)(`div`,{"data-slot":`picker-search`,className:`mbe-1 flex min-h-11 min-w-56 items-center gap-2 border-b border-border px-2`,children:[(0,X.jsx)(fr,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,X.jsx)(`input`,{ref:x,type:`search`,"aria-label":p,placeholder:p,value:y,onChange:e=>b(e.target.value),onKeyDown:e=>{if(e.key===`ArrowDown`||e.key===`ArrowUp`){e.preventDefault(),e.stopPropagation();let t=S.current?.querySelectorAll(`[role="menuitemradio"]:not([data-disabled])`);(e.key===`ArrowDown`?t?.[0]:t?.[t.length-1])?.focus()}else e.key!==`Escape`&&e.stopPropagation()},className:`h-11 w-0 min-w-0 flex-1 bg-transparent text-sm placeholder:text-muted-foreground`})]}):null,(0,X.jsx)(Ii,{value:r,onValueChange:a,children:C.map(e=>(0,X.jsx)(ki,{value:e.value,disabled:s,className:c(`gap-2.5`,p&&`min-h-11`),onPointerMove:w,onPointerLeave:w,onKeyDown:t=>{x.current&&(t.key===`ArrowUp`&&e===C[0]||t.key===`Tab`&&t.shiftKey)&&(t.preventDefault(),t.stopPropagation(),x.current.focus())},children:(0,X.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,X.jsx)(`span`,{className:`text-[13px] font-medium`,children:e.label}),e.desc?(0,X.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e.desc}):null]})},e.value))}),p&&C.length===0?(0,X.jsx)(`p`,{role:`status`,className:`px-2 py-5 text-center text-xs text-muted-foreground`,children:`No matches found.`}):null,f?(0,X.jsx)(K,{disabled:!0,onPointerMove:w,onPointerLeave:w,className:`border-t border-border text-xs text-muted-foreground`,children:f}):null,g]})]})}var Lx=(e,t)=>t===null?e:`${e}:${t}`;function Rx({runners:e,value:t,onPick:n,disabled:r=!1,accounts:i=[],account:a=null,repoAccount:o,icon:s,fieldLabel:c,uninstalled:l=[],signedOut:u=[]}){let d=R().data,f=ee(d).filter(t=>e.includes(t.id)).flatMap(e=>{let t=i.filter(t=>t.provider===e.id),n=e.displayName;return t.length<2?[{value:Lx(e.id,null),label:n,desc:e.pickerDescription}]:t.map(t=>({value:Lx(e.id,t.id),label:`${n} · ${t.label}`,...t.configDir?{desc:t.configDir}:{}}))}),p=r&&(l.length>0||u.length>0),m=a??o?.[t]??`default`,h=f.some(e=>e.value===Lx(t,m))?Lx(t,m):Lx(t,null);return(0,X.jsx)(Ix,{icon:s,fieldLabel:c,slot:`runner-pill`,ariaLabel:`Runner`,label:f.find(e=>e.value===h)?.label??A(d,t),value:h,disabled:r&&!p,choicesDisabled:p,onPick:e=>{let[t,r]=e.split(`:`);n(t,r??null)},options:f,footer:(0,X.jsx)(zx,{uninstalled:l,signedOut:u})})}function zx({uninstalled:e,signedOut:t}){let n=R().data,r=ee(n).flatMap(n=>{let r=n.displayName;return e.includes(n.id)?[{id:n.id,name:r,state:`Not installed`,action:`Install in Settings`}]:t.includes(n.id)?[{id:n.id,name:r,state:`Not connected`,action:`Sign in in Settings`}]:[]});return r.length===0?null:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Mi,{}),r.map(e=>(0,X.jsx)(K,{asChild:!0,className:`gap-2.5 ps-8`,children:(0,X.jsx)(H,{to:Ro(e.id),"data-slot":`runner-install-link`,"data-runner":e.id,children:(0,X.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,X.jsx)(`span`,{className:`text-[13px] font-medium text-muted-foreground`,children:e.name}),(0,X.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[e.state,` · `,(0,X.jsx)(`span`,{className:`font-medium text-accent-text`,children:e.action})]})]})})},e.id))]})}function Bx({templates:e,onInsert:t,triggerClassName:n,disabled:r,iconOnly:i=!1,label:a=`Template`}){let[o,s]=(0,Y.useState)(!1),l=(0,Y.useRef)(null),u=xa();return e.length===0?null:(0,X.jsxs)(sa,{open:o,onOpenChange:s,children:[(0,X.jsx)(ra,{asChild:!0,children:(0,X.jsxs)(`button`,{type:`button`,"data-slot":`prompt-template-trigger`,"aria-label":`Insert a prompt template`,title:`Insert a prompt template`,disabled:r,className:c(`inline-flex h-[26px] items-center gap-1.5 rounded-full border border-border bg-card text-xs font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:pointer-events-none disabled:opacity-50`,i?`w-[26px] justify-center px-0`:`h-11 gap-2 rounded-lg px-3 text-foreground`,n),children:[(0,X.jsx)(dr,{"aria-hidden":`true`,className:i?`size-3 shrink-0 text-accent-icon`:`size-[18px] shrink-0 text-muted-foreground`}),i?null:(0,X.jsxs)(X.Fragment,{children:[a,(0,X.jsx)(Tr,{"aria-hidden":`true`,className:`size-[13px] shrink-0 text-soft-foreground`})]})]})}),(0,X.jsx)(aa,{align:`start`,sideOffset:8,"data-slot":`prompt-template-menu`,className:`w-[336px] max-w-[calc(100vw-2rem)] p-0`,onCloseAutoFocus:e=>e.preventDefault(),children:(0,X.jsxs)(Co,{filter:Do,children:[(0,X.jsx)(ho,{placeholder:`search templates…`,onInput:()=>l.current?.scrollTo(0,0)}),(0,X.jsxs)(So,{ref:l,"data-slot":`prompt-template-list-menu`,className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[(0,X.jsx)(xo,{children:`Nothing matches.`}),(0,X.jsx)(_o,{heading:`Insert a template`,children:e.map(e=>(0,X.jsxs)(bo,{value:`template ${e.label} ${e.id}`,keywords:[e.text,...e.skills??[]],"data-slot":`prompt-template-option`,"data-template":e.id,title:e.text,className:`flex-col items-start gap-0.5`,onSelect:()=>{t(e.text),s(!1)},children:[(0,X.jsxs)(`span`,{className:`flex w-full items-center gap-1.5`,children:[(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[13px] font-medium text-foreground`,children:e.label}),e.skills&&e.skills.length>0?(0,X.jsxs)(`span`,{"data-slot":`prompt-template-assigned`,title:`Applied automatically with: ${e.skills.join(`, `)}`,className:`inline-flex shrink-0 items-center gap-0.5 text-[12px] font-medium text-accent-text`,children:[(0,X.jsx)(Ir,{"aria-hidden":`true`,className:`size-2.5`}),e.skills.length]}):null]}),(0,X.jsx)(`span`,{className:`line-clamp-1 text-xs text-soft-foreground`,children:e.text})]},e.id))}),(0,X.jsx)(go,{}),(0,X.jsx)(_o,{children:(0,X.jsx)(bo,{value:`edit prompt templates settings`,"data-slot":`prompt-template-settings`,className:`text-[12px] text-muted-foreground`,onSelect:()=>{s(!1),u(`/settings/prompt-templates`)},children:`Edit templates…`})})]})]})})]})}var Vx={repo:`Project`,user:`User`,system:`Built in`,other:null};function Hx(e){return[e.scope?Vx[e.scope]:null,e.plugin?`Plugin ${e.plugin}`:null].filter(Boolean).join(` · `)||null}function Ux({skill:e,heading:t=`h2`,actions:n}){let r=Hx(e);return(0,X.jsxs)(`div`,{"data-slot":`skill-detail`,className:`grid min-w-0 gap-3 break-words`,children:[t?(0,X.jsx)(t,{className:`text-xl font-semibold`,children:e.name}):null,e.description?(0,X.jsx)(`p`,{"data-slot":`skill-description`,className:`max-w-[78ch] text-[13.5px] leading-relaxed`,children:e.description}):(0,X.jsx)(`p`,{className:`text-xs text-soft-foreground`,children:`This runner reports no description.`}),(0,X.jsxs)(`dl`,{className:`grid grid-cols-[max-content_minmax(0,1fr)] items-center gap-x-4 gap-y-1.5 text-[12.5px]`,children:[(0,X.jsx)(Wx,{label:`Id`,children:(0,X.jsx)(Gx,{value:e.id,label:`Copy id`})}),r?(0,X.jsx)(Wx,{label:`Source`,children:(0,X.jsx)(`span`,{"data-slot":`skill-source`,children:r})}):null,e.path?(0,X.jsx)(Wx,{label:`File`,children:(0,X.jsx)(Gx,{value:e.path,label:`Copy path`,slot:`skill-path`})}):null]}),n?(0,X.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:n}):null]})}function Wx({label:e,children:t}){return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`dt`,{className:`text-soft-foreground`,children:e}),(0,X.jsx)(`dd`,{className:`flex min-w-0 items-center gap-1`,children:t})]})}function Gx({value:e,label:t,slot:n}){let r=()=>Promise.resolve().then(()=>navigator.clipboard.writeText(e)).then(()=>B(`Copied.`),e=>B(e instanceof Error?e.message:String(e),{tone:`danger`}));return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`code`,{"data-slot":n,title:e,className:`min-w-0 truncate rounded-sm border border-border bg-background px-1.5 py-px font-mono text-xs`,children:e}),(0,X.jsx)(`button`,{type:`button`,"aria-label":t,onClick:()=>void r(),className:`inline-flex size-7 shrink-0 items-center justify-center rounded-sm text-soft-foreground focus-visible:outline-2 pointer-hover:bg-muted pointer-hover:text-foreground`,children:(0,X.jsx)(zr,{"aria-hidden":`true`,className:`size-3.5`})})]})}function Kx({skill:e,onClose:t}){return(0,X.jsx)(va,{open:e!==null,onOpenChange:e=>{e||t()},children:(0,X.jsx)(ga,{"data-slot":`skill-preview`,className:`max-h-[80dvh] overflow-y-auto`,children:e?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(_a,{className:`sr-only`,children:e.name}),(0,X.jsx)(pa,{className:`sr-only`,children:`Runner skill metadata`}),(0,X.jsx)(Ux,{skill:e,heading:`h3`})]}):null})})}function qx(e){try{let t=new URL(e),n=t.pathname===`/`?``:t.pathname.replace(/\/$/,``);return`${t.host}${n}`||e}catch{return e}}function Jx(e){return e?e.webhooks?e.webhooks.filter(e=>e.tasks).map(({id:e,name:t,url:n})=>({id:e,name:t,url:n})):e.webhook?[{id:`task-webhook`,name:`Task webhook`,url:e.webhook.url}]:[]:[]}function Yx(e){let t=e.map(e=>e.name);return t.length<=2?t.join(` and `):t.length===3?`${t[0]}, ${t[1]} and ${t[2]}`:`${t[0]}, ${t[1]} and ${t.length-2} more`}function Xx(e,t){return e===``?{message:`Prefilled from link — review and press Start`,tone:`default`}:{message:t?`Unknown skill "${e}" — prefilled for quick-task; review and press Start`:`Unknown skill "${e}" — no skill selected; review before starting`,tone:`danger`}}function Zx(e,t){return`Use the "${e}" skill on: ${t}`}function Qx(e){let t=e.configuredAutonomous===`source-dependent`?e.source===`skill`:e.configuredAutonomous;return{autonomous:e.planFirst?!1:e.explicitAutonomous??t,worktree:e.hasGit?e.explicitWorktree??e.configuredWorktree:!1}}function $x(e){return e.worktree?`Runs in an isolated worktree — review everything before it lands.`:e.hasGit?`Runs in the repo working tree — your checkout is modified directly.`:`Runs in place — no git repository detected, so there is no worktree to isolate in.`}var eS={text:``,source:null,runner:null,agentProfile:null,model:null,effort:null,planFirst:!1,worktree:null,autonomous:null,archiveWhenDone:!1,autoMergePr:!1,allowWorkers:!0,allowMessaging:!0},tS=`cez-new-task-draft`;function nS(e){return e===null?tS:`${tS}:${e}`}function rS(e){let t=e&&typeof e==`object`?e:{};return{text:typeof t.text==`string`?t.text:``,source:iS(t.source)?t.source:null,runner:typeof t.runner==`string`?t.runner:null,agentProfile:typeof t.agentProfile==`string`?t.agentProfile:null,model:typeof t.model==`string`?t.model:null,effort:typeof t.effort==`string`?t.effort:null,planFirst:t.planFirst===!0,worktree:typeof t.worktree==`boolean`?t.worktree:null,autonomous:typeof t.autonomous==`boolean`?t.autonomous:null,archiveWhenDone:t.archiveWhenDone===!0,autoMergePr:t.autoMergePr===!0,allowWorkers:t.allowWorkers!==!1,allowMessaging:t.allowMessaging!==!1}}function iS(e){return!!e&&typeof e==`object`&&(e.source===`skill`||e.source===`workflow`)&&typeof e.ref==`string`}var aS=new Map,oS=new Map,sS=new Map;function cS(e=null){return oS.get(nS(e))??0}function lS(e=null){let t=nS(e),n=aS.get(t);if(n)return{...n};let r;try{let e=localStorage.getItem(t);r=e?rS(JSON.parse(e)):{...eS}}catch{r={...eS}}return aS.set(t,r),{...r}}function uS(e,t=null){let n=nS(t);oS.set(n,cS(t)+1),aS.set(n,{...e});try{localStorage.setItem(n,JSON.stringify(e)),sS.set(n,!0)}catch{sS.set(n,!1)}}function dS(e=null){return sS.get(nS(e))??!1}function fS(e=null,t){t!==void 0&&cS(e)!==t||uS({...lS(e),text:``,source:null},e)}var pS=`quick-task`;function mS(e,t,n=24){return[t,...(e??[]).filter(e=>!(e.source===t.source&&e.ref===t.ref))].slice(0,n)}function hS(e,t){return C(e,t)?.models.suggested}var gS=[{value:``,label:`auto`,desc:`Harness default`},{value:`low`,label:`low`,desc:`Less reasoning, faster replies`},{value:`medium`,label:`medium`,desc:`Balanced reasoning`},{value:`high`,label:`high`,desc:`More reasoning for hard tasks`},{value:`xhigh`,label:`xhigh`,desc:`Extra-high reasoning`},{value:`max`,label:`max`,desc:`Maximum reasoning`}];function _S(e,t){let n=gS,r=t?.models.find(t=>t.id===e)?.effortLevels;if(r===void 0)return n;let i=[gS[0]],a=new Set;for(let e of r){if(a.has(e))continue;let t=gS.find(t=>t.value===e);t&&(a.add(e),i.push(t))}return i}function vS(e,t){let n=e??``;return t.some(e=>e.value===n)?n:``}function yS(e,t,n){if(!e||hS(n,t)?.some(t=>t.id===e))return!1;let r=(n?.runners??[]).filter(e=>e.id!==t);return r.some(t=>t.models.retired.includes(e))?!0:r.some(t=>t.modelIdScope!==`provider-spanning`&&t.models.suggested.some(t=>t.id!==``&&t.id===e))}function bS(e,t,n,r=[]){let i=n?.runner===e?n.models:[],a=hS(t,e)??hS(t,`claude`)??[],o=[...i.length?a.slice(0,1):a],s=new Set(o.map(e=>e.id));for(let e of i)!e.id||s.has(e.id)||(s.add(e.id),o.push({id:e.id,label:e.label||e.id,desc:e.description}));for(let n of r)!n||s.has(n)||yS(n,e,t)||(s.add(n),o.push({id:n,label:n,desc:`Custom or legacy model`}));return o}function xS(e,t,n,r=!1,i=!1){let a=ae(t,e);if(a!==void 0){if(n?.stale)return`Using cached ${a} model list`;if(r||n?.source===`unavailable`)return`Latest ${a} models unavailable`;if(i&&!n)return`Loading ${a} models…`}}function SS(e,t,n){return xS(e,t,n?.data,n?.isError,n?.isFetching)}function CS(e,t){let n=u(t).filter(t=>e.some(e=>e.name===t&&e.available));return n.length>0?n:[`claude`]}function wS(e,t,n){return e!==null&&t.includes(e)?e:t.includes(n)?n:t[0]??`claude`}function TS(e,t,n=!1){return!n&&e===t?void 0:e}function ES(e,t,n,r,i){let a=bS(t,n,i,[e,r?.[t]]);if(e!==null&&a.some(t=>t.id===e))return e;let o=r?.[t];return o!==void 0&&a.some(e=>e.id===o)?o:``}function DS(e,t,n){return e.source===`skill`?t.some(t=>t.id===e.ref&&(e.path===void 0||t.path===e.path)):n.some(t=>t.name===e.ref)}function OS(e,t,n,r=!1){return e?.source===`skill`&&(r||e.typed)||e&&DS(e,t,n)?e:null}function kS(e){let{task:t,source:n,model:r,modelsLocked:i,effort:a,runner:o,runnerExplicit:s,defaultRunner:c,agentProfile:l,images:u,worktree:d,autonomous:f,archiveWhenDone:p,autoMergePr:m,allowWorkers:h,allowMessaging:g}=e;return{task:t,...n?.source===`skill`?{steps:[{id:`task`,name:n.ref,skill:n.ref,...n.path===void 0?{}:{skillPath:n.path},prompt:`{{task}}`}]}:{workflow:n?.ref??`quick-task`},model:i?void 0:r||void 0,effort:i?void 0:a||void 0,runner:TS(o,c,s),agentProfile:l||void 0,images:u.length>0?[...u]:void 0,worktree:d!==!1&&void 0,autonomous:f===!0||void 0,...AS({archiveWhenDone:p,autoMergePr:m,allowWorkers:h,allowMessaging:g})}}function AS(e){return{...e.archiveWhenDone?{archiveWhenDone:!0}:{},...e.autoMergePr?{autoMergePr:!0}:{},...e.allowWorkers===!1?{allowWorkers:!1}:{},...e.allowMessaging===!1?{allowMessaging:!1}:{}}}function jS(e,t){return t?{...e,notify:!0}:e}function MS(e){return`/tasks/${e.id}`}function NS(e,t,n){return{task:e,steps:[...n.steps],rationale:n.rationale,fallback:n.fallback,images:[...t]}}function PS(e,t){return!Number.isInteger(t)||t<0||t>=e.length?[...e]:e.filter((e,n)=>n!==t)}function FS(e,t,n){let r=[...e];if(!Number.isInteger(t)||t<0||t>=r.length)return r;let i=Math.max(0,Math.min(r.length-1,n));if(i===t)return r;let[a]=r.splice(t,1);return r.splice(i,0,a),r}function IS(e){return e.command??e.prompt??``}function LS(e,t=120){let n=e.split(`
|
|
20
|
-
`)[0]??``;return n.length>t?`${n.slice(0,t-1)}…`:n}function RS(e){let{task:t,steps:n,agentProfile:r,model:i,modelsLocked:a,effort:o,runner:s,runnerExplicit:c,defaultRunner:l,images:u,archiveWhenDone:d,autoMergePr:f,allowWorkers:p,allowMessaging:m}=e;return{task:t,steps:[...n],...r?{agentProfile:r}:{},model:a?void 0:i||void 0,effort:a?void 0:o||void 0,runner:TS(s,l,c),images:u.length>0?[...u]:void 0,...AS({archiveWhenDone:d,autoMergePr:f,allowWorkers:p,allowMessaging:m})}}function zS(e,t,n){return{runner:e,agentProfile:t||null,...e===n?{}:{model:null,effort:null}}}function BS(e,t){let n=lS(e);return{...n,...t.runner===void 0?{}:zS(t.runner,t.account,n.runner),...t.ref===``?{}:{text:t.ref},...t.skill===``?{}:{source:{source:`skill`,ref:t.skill,...t.skillPath===void 0?{}:{path:t.skillPath}}}}}function VS(e,t,n){let[r,i]=(0,Y.useState)(()=>BS(e,t)),a=(0,Y.useRef)(r);(0,Y.useEffect)(()=>{uS(a.current,e)},[e]);let o=(0,Y.useRef)(!1),s=(0,Y.useRef)(!0);(0,Y.useEffect)(()=>(s.current=!0,()=>{s.current=!1}),[]);let c=t=>{if(!s.current||o.current)return;let n={...a.current,...t};a.current=n,uS(n,e),i(n)},l=(0,Y.useRef)(t.runner===void 0);return(0,Y.useEffect)(()=>{!l.current||n===void 0||(l.current=!1,c(zS(n,t.account,a.current.runner)))},[n]),{draft:r,update:c,clearStarted:t=>{if(cS(e)!==t)return;fS(e,t);let n=lS(e);a.current=n,s.current&&i(n)},submissionPending:o,mounted:s}}function HS(e,t,n,r){let i=d(),a=v(n,r),o=a.data,s=t.data?.skillUsage,c=(0,Y.useMemo)(()=>No(o??[],s),[o,s]),l=i.data?.workflows??[],u=i.data!==void 0&&!t.isPending,f=OS(e,c,l,a.unchecked),p=f?.source===`skill`?c.find(e=>e.id===f.ref&&(f.path===void 0||e.path===f.path)):void 0;return{skillList:c,skillUsage:s,workflowList:l,sourcesReady:u,source:f,selectedSkill:p,skillsSettled:!a.isPending,listUnchecked:a.unchecked,unchecked:a.unchecked||f?.source===`skill`&&!p}}function US(e){let{uiState:t,source:n,sourcesReady:r,draftText:i,submissionPending:a,update:o}=e,s=t.data?.promptTemplates,c=(0,Y.useMemo)(()=>Ty(s),[s]),l=Oy(c,n?.source===`skill`?[n.ref]:[]),u=(0,Y.useRef)(i);u.current=i;let d=(0,Y.useRef)(``);return(0,Y.useEffect)(()=>{if(!r||a.current)return;let e=ky(u.current,d.current,l);d.current=e.applied,e.text!==u.current&&o({text:e.text})},[l,r]),c}function WS(e,t){let n=p(),r=R(),i=Qp(),{runners:a,uninstalled:o,signedOut:s}=i,c=t.data?.defaultRunner,l=c??`claude`,d=a.length>0?wS(e.runner,a,l):null,{runner:f,ready:m}=he(d??l),h=n.isSuccess&&a.length>0,g={isPending:n.isPending||r.isPending,isError:n.isError||r.isError},_=i.accountFor(f,e.agentProfile)??i.repoAccount?.[f],v=M(c,u(r.data)),y=v===void 0?null:i.accountFor(v,d===v?e.agentProfile:null),b=be(f,m,_),x=t.data?.modelsLocked===!0,S=t.data?.defaultModels,C=d===null?[]:bS(d,r.data,b.data,[e.model,S?.[d]]),w=d===null?``:ES(x?null:e.model,d,r.data,S,b.data),T=_S(w,b.data);return{providers:g,registered:r,runners:a,uninstalled:o,signedOut:s,defaultRunner:c,planAccount:y,runner:d,displayRunner:f,providersReady:h,catalog:b,modelsLocked:x,models:C,model:w,effortOptions:T,effort:x?``:vS(e.effort,T)}}function GS(e,t){let n=ie(),{accounts:r,repoAccount:i,accountFor:a}=Qp();return{accountChoices:r,repoAccount:i,accountsSettled:!n.isPending,agentProfile:a(e,t)}}function KS(e){let t=(0,Y.useRef)(!1),n=(0,Y.useRef)(void 0);(0,Y.useEffect)(()=>{n.current===void 0&&(n.current=document.activeElement);let r=e&&!t.current;t.current=e,r&&(document.activeElement===document.body||document.activeElement===n.current)&&document.querySelector(`textarea[aria-label="Describe a task for the agent"]`)?.focus()},[e])}function qS(e){let t=e.workspaceConfig.data?.composerDefaults;return Qx({hasGit:e.hasGit,planFirst:e.draft.planFirst,explicitAutonomous:e.draft.autonomous,explicitWorktree:e.draft.worktree,configuredAutonomous:t?.autonomous??t?.inheritedAutonomous??`source-dependent`,configuredWorktree:t?.worktree??t?.inheritedWorktree??!0,source:e.source?.source??`workflow`})}function JS(e){let t=T(),n=t.data?.projects??[],r=e??t.data?.bootProject,i=Jx(n.find(e=>e.id===r)),[a,o]=(0,Y.useState)(!1);return{projectList:n,webhookTargets:i,notifyOn:i.length>0&&a,setNotifyChoice:o}}function YS(e){let[t,n]=(0,Y.useState)(()=>typeof window<`u`&&window.innerWidth<=767);return(0,Y.useLayoutEffect)(()=>{let t=e.current;if(!t)return;let r=()=>n(window.innerWidth<=767||t.getBoundingClientRect().width<550);r();let i=typeof ResizeObserver>`u`?null:new ResizeObserver(r);return i?.observe(t),window.addEventListener(`resize`,r),()=>{i?.disconnect(),window.removeEventListener(`resize`,r)}},[]),t}function XS(e){let t=xa(),[n,r]=(0,Y.useState)(()=>e.deepLink.ref!==``||e.deepLink.skillPath!==void 0);ZS(e.search,t),QS({pending:n,setPending:r,deepLink:e.deepLink,sourcesReady:e.sourcesReady,listUnchecked:e.listUnchecked,skillList:e.skillList,update:e.update})}function ZS(e,t){let n=(0,Y.useRef)(!1);(0,Y.useEffect)(()=>{n.current||(n.current=!0,e.toString()!==``&&t(`/new`,{replace:!0}))},[])}function QS(e){let{pending:t,sourcesReady:n,deepLink:r}=e;(0,Y.useEffect)(()=>{if(!t||!n)return;e.setPending(!1);let i=!e.listUnchecked&&r.skill!==``&&!DS({source:`skill`,ref:r.skill,...r.skillPath===void 0?{}:{path:r.skillPath}},e.skillList,[])?r.skill:``;i!==``&&r.ref!==``&&e.update({text:Zx(r.skill,r.ref),source:null});let{message:a,tone:o}=Xx(i,r.ref!==``);B(a,{tone:o}),document.querySelector(`[data-slot="composer"] button[aria-label="Start task"], [data-slot="composer"] button[aria-label="Plan task"]`)?.focus()},[t,n])}function $S(e){return e.isPending?`Checking agent providers…`:e.isError?`Provider authentication could not be verified.`:`Connect an agent provider before starting a task.`}function eC(e,t,n){Je({lastTask:e?{source:e.source,ref:e.ref}:null,...e?{recentSources:mS(t.data?.recentSources,{source:e.source,ref:e.ref})}:{},...e?.source===`skill`&&t.data!==void 0?{skillUsage:Io(t.data.skillUsage,e.ref)}:{}}).then(()=>n.invalidateQueries({queryKey:k.uiState})).catch(()=>{})}function tC(e){let t=xa(),n=z(),[r,i]=(0,Y.useState)(null),[a,o]=(0,Y.useState)(!1),[s,c]=(0,Y.useState)(!1),{draft:l,draftProjectId:u,engine:d,mounted:f}=e,{providers:p,providersReady:m,runner:h}=d,g=(r,i)=>{e.clearStarted(i),n.invalidateQueries({queryKey:k.runs.all}),f.current&&t(MS(r))};return{plan:r,setPlan:i,planning:a,starting:s,submit:async(t,r)=>{let a=cS(u);if(!m||h===null)throw Error($S(p));if(!e.sourcesReady)throw Error(`Still loading workflows and skills — try again in a second.`);if(l.agentProfile&&!e.accountsSettled)throw Error(`Still loading agent accounts — try again in a second.`);if(l.planFirst){o(!0);try{let e=await Me(t,d.planAccount);f.current&&i(NS(t,r,e))}finally{o(!1)}return}let s=await Gt(jS(kS({task:t,source:e.source,model:d.model,modelsLocked:d.modelsLocked,effort:d.effort,runner:h,runnerExplicit:l.runner!==null,agentProfile:e.agentProfile,defaultRunner:d.defaultRunner,images:r,worktree:e.runMode.worktree,autonomous:e.runMode.autonomous,archiveWhenDone:l.archiveWhenDone,autoMergePr:l.autoMergePr,allowWorkers:l.allowWorkers,allowMessaging:l.allowMessaging}),e.notifyOn));eC(e.source,e.uiState,n),g(s,a)},startPlanned:async()=>{if(r===null||r.steps.length===0||s||!m||h===null||l.agentProfile&&!e.accountsSettled)return;let t=cS(u);c(!0);try{let n=await Gt(jS(RS({task:r.task,steps:r.steps,agentProfile:e.agentProfile,model:d.model,modelsLocked:d.modelsLocked,effort:d.effort,runner:h,runnerExplicit:l.runner!==null,defaultRunner:d.defaultRunner,images:r.images,archiveWhenDone:l.archiveWhenDone,autoMergePr:l.autoMergePr,allowWorkers:l.allowWorkers,allowMessaging:l.allowMessaging}),e.notifyOn));i(null),g(n,t)}catch(e){B(e instanceof Error?e.message:String(e),{tone:`danger`})}finally{c(!1)}}}}function nC({archiveWhenDone:e,autoMergePr:t,onChange:n,disabled:r=!1,disabledReason:i=`Unavailable while saving these settings.`,embedded:a=!1}){let o=(0,Y.useId)(),s=r?i:void 0;return(0,X.jsxs)(`fieldset`,{"data-slot":`completion-controls`,"data-embedded":a||void 0,className:`grid min-w-0 gap-3`,children:[(0,X.jsx)(`legend`,{className:a?`sr-only`:`text-sm font-medium [margin-block-end:0.5rem]`,children:`After Done`}),(0,X.jsxs)(`label`,{htmlFor:`${o}-archive`,className:`completion-control flex min-h-11 min-w-0 items-center justify-between gap-3 rounded-md text-sm`,children:[(0,X.jsxs)(`span`,{className:`min-w-0 break-words`,children:[(0,X.jsx)(`span`,{id:`${o}-archive-label`,children:`Archive when Done`}),a?(0,X.jsx)(`span`,{id:`${o}-archive-help`,className:`completion-control-help`,children:s??`Move to Archived after Done, even without a PR. You can restore it later.`}):null]}),(0,X.jsx)(la,{id:`${o}-archive`,className:`completion-switch`,checked:e,disabled:r,"aria-labelledby":`${o}-archive-label`,"aria-describedby":`${o}-archive-help`,onCheckedChange:e=>n({archiveWhenDone:e})})]}),a?null:(0,X.jsx)(`p`,{id:`${o}-archive-help`,className:`text-xs break-words text-muted-foreground`,children:s??`Move the task to Archived after it reaches Done. You can restore it later.`}),(0,X.jsxs)(`label`,{htmlFor:`${o}-merge`,className:`completion-control flex min-h-11 min-w-0 items-center justify-between gap-3 rounded-md text-sm`,children:[(0,X.jsxs)(`span`,{className:`min-w-0 break-words`,children:[(0,X.jsx)(`span`,{id:`${o}-merge-label`,children:`Auto-merge PR`}),a?(0,X.jsx)(`span`,{id:`${o}-merge-help`,className:`completion-control-help`,children:s??`After Done, mark the PR ready and merge when current-head CI and GitHub rules allow.`}):null]}),(0,X.jsx)(la,{id:`${o}-merge`,className:`completion-switch`,checked:t,disabled:r,"aria-labelledby":`${o}-merge-label`,"aria-describedby":`${o}-merge-help`,onCheckedChange:e=>n({autoMergePr:e})})]}),a?null:(0,X.jsx)(`p`,{id:`${o}-merge-help`,className:`text-xs break-words text-muted-foreground`,children:s??`After Done, mark a draft PR ready and merge when current-head CI and GitHub rules allow it.`}),!a||e&&t?(0,X.jsx)(`p`,{className:`completion-order-note text-xs break-words text-muted-foreground`,children:a?`Merge runs before archive when both are on.`:`When both are on, merge comes before archive. Without a PR, Archive when Done still archives the task.`}):null]})}var rC=[{key:`allowWorkers`,slot:`workers`,label:`Allow Squawk workers`,help:`Agents in this task can start Squawk workers. Each worker is a separate paid agent session. Worker limits cap resources, not spending.`},{key:`allowMessaging`,slot:`messaging`,label:`Allow task messaging`,help:`Agents in this task can message other tasks in this project.`}];function iC({allowWorkers:e,allowMessaging:t,onChange:n,disabled:r=!1,embedded:i=!1}){let a=(0,Y.useId)(),o={allowWorkers:e,allowMessaging:t};return(0,X.jsxs)(`fieldset`,{"data-slot":`task-access-controls`,"data-embedded":i||void 0,className:`grid min-w-0 gap-3`,children:[(0,X.jsx)(`legend`,{className:i?`sr-only`:`text-sm font-medium [margin-block-end:0.5rem]`,children:`Task access`}),rC.map(e=>(0,X.jsxs)(Y.Fragment,{children:[(0,X.jsxs)(`label`,{htmlFor:`${a}-${e.slot}`,"data-slot":`task-access-${e.slot}`,className:`completion-control flex min-h-11 min-w-0 items-center justify-between gap-3 rounded-md text-sm`,children:[(0,X.jsxs)(`span`,{className:`min-w-0 break-words`,children:[(0,X.jsx)(`span`,{id:`${a}-${e.slot}-label`,children:e.label}),i?(0,X.jsx)(`span`,{id:`${a}-${e.slot}-help`,className:`completion-control-help`,children:e.help}):null]}),(0,X.jsx)(la,{id:`${a}-${e.slot}`,className:`completion-switch shrink-0`,checked:o[e.key],disabled:r,"aria-labelledby":`${a}-${e.slot}-label`,"aria-describedby":`${a}-${e.slot}-help`,onCheckedChange:t=>n({[e.key]:t})})]}),i?null:(0,X.jsx)(`p`,{id:`${a}-${e.slot}-help`,className:`text-xs break-words text-muted-foreground`,children:e.help})]},e.key))]})}var aC=[{id:`fix-bug`,label:`Fix a bug`,body:`Investigate and fix the issue, adding a regression test that reproduces it first.`},{id:`add-tests`,label:`Add tests`,body:`Add focused unit tests covering the edge cases and verify the suite passes.`},{id:`review-changes`,label:`Review changes`,body:`Review the recent changes for bugs, edge cases, and missing test coverage.`}];function oC({templates:e,onInsert:t}){let n=e.length>0?e.slice(0,4).map(e=>({id:e.id,label:e.label,body:e.text})):aC,r=e.length>0?`Saved templates`:`Quick start prompts`;return(0,X.jsxs)(`section`,{"data-slot":`new-task-quick-prompts`,"aria-label":r,className:`mt-5 flex flex-col gap-2.5 rounded-xl border border-border bg-card p-4`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-baseline justify-between gap-2`,children:[(0,X.jsx)(`h2`,{className:`text-xs font-semibold text-foreground`,children:r}),(0,X.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Insert a starting prompt into the composer`})]}),(0,X.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:n.map(e=>(0,X.jsx)(`button`,{type:`button`,"data-slot":`new-task-quick-prompt`,onClick:()=>t(e.body),className:`inline-flex min-h-9 max-md:min-h-11 no-hover:min-h-11 items-center rounded-lg border border-border bg-background px-3 py-1.5 text-left text-xs font-medium text-foreground transition-colors hover:bg-muted focus-visible:outline-2 focus-visible:outline-ring`,children:e.label},e.id))})]})}function sC({groupRef:e,compact:t,engine:n,accounts:r,draftEffort:i,update:a}){let o=n.runners.length>1||n.uninstalled.length>0||n.signedOut.length>0||n.runners.some(e=>Zp(r.accountChoices,e))?(0,X.jsx)(cC,{engine:n,accounts:r,update:a},`runner`):null,s=(0,X.jsx)(lC,{engine:n,draftEffort:i,update:a},`model`),c=(0,X.jsx)(uC,{engine:n,update:a},`effort`);return(0,X.jsx)(`div`,{ref:e,"data-slot":`agent-options`,role:`group`,"aria-label":`Agent settings`,className:`new-task-agent-options`,children:(0,X.jsx)(Ax,{children:t?[o,c,s]:[o,s,c]})})}function cC({engine:e,accounts:t,update:n}){return(0,X.jsx)(Rx,{icon:(0,X.jsx)(Sr,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,runners:e.runners,uninstalled:e.uninstalled,signedOut:e.signedOut,value:e.displayRunner,accounts:t.accountChoices,account:t.agentProfile,repoAccount:t.repoAccount,onPick:(t,r)=>n({runner:t,agentProfile:r,...t===e.displayRunner?{}:{model:null}}),disabled:!e.providersReady})}function lC({engine:e,draftEffort:t,update:n}){let{catalog:r,displayRunner:i}=e;return(0,X.jsx)(Ix,{icon:(0,X.jsx)(Vr,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,slot:`model-pill`,ariaLabel:`Model`,label:e.models.find(t=>t.id===e.model)?.label??`auto`,value:e.model,disabled:!e.providersReady,readOnly:e.modelsLocked,disabledHint:e.modelsLocked?`Model selection is locked to native coding-agent settings.`:void 0,onPick:e=>{let i=_S(e,r.data);n({model:e,effort:t===null?null:vS(t,i)})},options:e.models.map(e=>({value:e.id,label:e.label,desc:e.desc})),status:SS(i,e.registered.data,r)})}function uC({engine:e,update:t}){return(0,X.jsx)(Ix,{icon:(0,X.jsx)(wr,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,slot:`effort-pill`,ariaLabel:`Effort`,label:e.effortOptions.find(t=>t.value===e.effort)?.label??`auto`,value:e.effort,disabled:!e.providersReady,readOnly:e.modelsLocked,disabledHint:e.modelsLocked?`Effort selection is locked to native coding-agent settings.`:void 0,onPick:e=>t({effort:e}),options:e.effortOptions.map(e=>({value:e.value,label:e.label,desc:e.desc}))})}function dC({engine:e,draft:t,update:n,repo:r,hasGit:i,runMode:a,webhook:o,completionDisabled:s}){let{displayRunner:c}=e,l=R().data,u=_g(),[d,f]=(0,Y.useState)(),p=d??u;return(0,X.jsxs)(`details`,{"data-slot":`execution-options`,open:p,onToggle:e=>{e.currentTarget.open!==p&&f(e.currentTarget.open)},className:`group rounded-xl border border-border bg-card xl:self-start`,children:[(0,X.jsxs)(`summary`,{className:`flex min-h-[44px] cursor-pointer list-none flex-wrap items-center gap-x-2 gap-y-1 px-3 py-2 text-xs text-muted-foreground pointer-hover:bg-muted/50 active:bg-muted/50 focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-foreground [&::-webkit-details-marker]:hidden`,children:[(0,X.jsx)(_r,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),(0,X.jsx)(`span`,{className:`font-medium text-foreground`,children:`Execution settings`}),(0,X.jsxs)(`span`,{"data-slot":`execution-summary`,hidden:!0,className:`min-w-0 basis-full truncate pl-5 xl:ml-auto xl:basis-auto xl:pl-0`,children:[A(l,c),` · `,e.models.find(t=>t.id===e.model)?.label??`auto`]}),(0,X.jsx)(Tr,{"aria-hidden":`true`,className:`new-task-settings-chevron size-4 shrink-0`})]}),(0,X.jsxs)(`div`,{className:`new-task-settings-body`,children:[(0,X.jsx)(`p`,{className:`new-task-settings-description`,children:`Control this run and what happens after Done.`}),(0,X.jsxs)(`div`,{role:`group`,"aria-label":`Run settings`,className:`new-task-run-settings`,children:[i?(0,X.jsx)(mC,{on:a.worktree,onChange:e=>n({worktree:e})}):null,(0,X.jsx)(_C,{repo:r}),(0,X.jsx)(hC,{on:a.autonomous,disabled:t.planFirst,onChange:e=>n({autonomous:e})}),o.targets.length>0?(0,X.jsx)(gC,{on:o.on,targets:o.targets,onChange:o.onChange}):null]}),(0,X.jsx)(nC,{embedded:!0,archiveWhenDone:t.archiveWhenDone,autoMergePr:t.autoMergePr,onChange:n,disabled:s,disabledReason:`Unavailable while starting the task or preparing its plan.`}),(0,X.jsx)(iC,{embedded:!0,allowWorkers:t.allowWorkers,allowMessaging:t.allowMessaging,onChange:n,disabled:s})]})]})}function fC({showConfigureProviders:e,planFirst:t,planning:n,onModeChange:r}){return(0,X.jsxs)(X.Fragment,{children:[e?(0,X.jsx)(q,{to:`/settings/agent-defaults#providers`,className:`text-xs font-medium text-foreground underline underline-offset-4`,children:`Configure providers`}):null,(0,X.jsx)(SC,{planFirst:t,planning:n,onModeChange:r}),(0,X.jsx)(`kbd`,{"aria-hidden":`true`,className:`hidden rounded-[5px] border border-b-2 border-border bg-card px-[5px] py-px font-mono text-xs font-medium text-muted-foreground md:inline`,children:Iy()})]})}function pC({on:e}){let t=e?`checked`:`unchecked`;return(0,X.jsx)(`span`,{"aria-hidden":`true`,"data-slot":`toggle-track`,"data-state":t,className:c(`flex h-6 w-10 shrink-0 items-center rounded-full border p-0.5`,ca),children:(0,X.jsx)(`span`,{"data-state":t,className:c(`size-[18px] rounded-full`,e&&`ml-auto`,ua)})})}function mC({on:e,disabled:t,disabledReason:n,onChange:r}){return(0,X.jsxs)(`button`,{type:`button`,role:`checkbox`,"aria-checked":e,disabled:t,"aria-label":`Worktree`,"data-slot":`worktree-toggle`,onClick:()=>r(!e),title:t?n:e?`Runs in an isolated worktree — uncheck to run in the repo working tree`:`Runs in the repo working tree — check to isolate in a worktree`,className:`flex items-center justify-between gap-3 px-0 py-3 text-left`,children:[(0,X.jsxs)(`span`,{children:[(0,X.jsx)(`span`,{className:`block text-[13px] font-medium`,children:`Worktree`}),(0,X.jsx)(`span`,{className:`block text-[12px] text-muted-foreground`,children:e?`Changes stay in a separate working copy.`:`Changes are made in the current working directory.`})]}),(0,X.jsx)(pC,{on:e})]})}function hC({on:e,disabled:t,onChange:n}){return(0,X.jsxs)(`button`,{type:`button`,role:`checkbox`,"aria-checked":e,disabled:t,"aria-label":`Autonomous`,"data-slot":`autonomous-toggle`,onClick:()=>n(!e),title:t?`Plan-first runs are interactive — autonomous is unavailable`:e?`Autonomous — the agent runs to completion without pausing for you`:`Runs interactively — check to let the agent finish without pausing for you`,className:`flex items-center justify-between gap-3 px-0 py-3 text-left disabled:opacity-50`,children:[(0,X.jsxs)(`span`,{children:[(0,X.jsx)(`span`,{className:`block text-[13px] font-medium`,children:`Autonomous`}),(0,X.jsx)(`span`,{className:`block text-[12px] text-muted-foreground`,children:`Let the agent proceed without prompts`})]}),(0,X.jsx)(pC,{on:e})]})}function gC({on:e,targets:t,onChange:n}){return(0,X.jsxs)(`button`,{type:`button`,role:`checkbox`,"aria-checked":e,"aria-label":`Notify webhook`,"data-slot":`notify-webhook-toggle`,onClick:()=>n(!e),title:`${e?`Status changes go to`:`Check to send this task's status changes to`} ${Yx(t)} (${t.map(e=>qx(e.url)).join(`, `)})`,className:`flex min-h-11 items-center justify-between gap-3 px-0 py-3 text-left`,children:[(0,X.jsxs)(`span`,{className:`min-w-0`,children:[(0,X.jsx)(`span`,{className:`block text-[13px] font-medium`,children:`Notify webhook`}),(0,X.jsx)(`span`,{"data-slot":`notify-webhook-subtitle`,className:`block truncate text-[12px] text-muted-foreground`,children:`Send status changes`})]}),(0,X.jsx)(pC,{on:e})]})}function _C({repo:e}){return(0,X.jsxs)(`div`,{"data-slot":`base-branch-row`,className:`new-task-base-branch flex items-center justify-between gap-2 text-xs text-muted-foreground`,children:[(0,X.jsx)(`span`,{children:`Base branch`}),e?(0,X.jsx)(vC,{repo:e}):null]})}function vC({repo:e}){let t=z(),n=F({mutationFn:e=>ot({baseBranch:e}),onSuccess:e=>{t.invalidateQueries({queryKey:k.repo}),B(e.baseBranch?`New tasks will branch off "${e.baseBranch}" (PRs target it too).`:`Base branch cleared — new tasks fork from the checked-out branch.`)},onError:e=>B(e.message,{tone:`danger`})});return e.info?(0,X.jsx)(Ix,{searchPlaceholder:`Search branches…`,slot:`base-pill`,ariaLabel:`Base branch`,label:(0,X.jsx)(`span`,{className:`text-xs`,children:e.baseBranch??e.info.branch}),value:e.baseBranch??``,onPick:e=>n.mutate(e===``?null:e),options:[{value:``,label:`follow checked-out branch (${e.info.branch})`,desc:`New task worktrees fork from whatever branch is checked out`},...e.branches.map(e=>({value:e,label:e}))]}):null}var yC=`h-6 rounded-md px-3 text-xs font-medium transition-colors outline-hidden focus-visible:ring-2 focus-visible:ring-ring/50`,bC=`bg-muted text-foreground`,xC=`text-muted-foreground pointer-hover:text-foreground`;function SC({planFirst:e,planning:t,onModeChange:n}){return(0,X.jsxs)(`div`,{"data-slot":`mode-seg`,role:`radiogroup`,"aria-label":`Run mode`,className:`inline-flex items-center gap-0.5 rounded-lg border border-border bg-card p-0.5`,children:[(0,X.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":!e,onClick:()=>n(!1),className:c(yC,e?xC:bC),children:`Run now`}),(0,X.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":e,"aria-busy":t||void 0,"data-slot":`mode-plan`,onClick:()=>n(!0),className:c(yC,e?bC:xC,t&&`animate-pulse`),children:t?`Planning…`:`Plan first`})]})}function CC({plan:e,starting:t,startAvailable:n,startUnavailableReason:r,startUnavailableAction:i,onStepsChange:a,onStart:o,onDiscard:s}){let[l,u]=(0,Y.useState)(null),[d,f]=(0,Y.useState)(null),p=(0,Y.useRef)(null),m=(0,Y.useId)();(0,Y.useEffect)(()=>{p.current?.focus({preventScroll:!0});let e=p.current?.closest(`[data-slot="main"]`);e&&(e.scrollTop=0)},[]);let h=()=>{u(null),f(null)},g=(t,n)=>{t.preventDefault(),l!==null&&l!==n&&a(FS(e.steps,l,n)),h()},_=e.steps.length===0;return(0,X.jsx)(`div`,{"data-slot":`plan-page`,children:(0,X.jsx)(`div`,{"data-slot":`plan-canvas`,children:(0,X.jsxs)(`section`,{ref:p,tabIndex:-1,"aria-labelledby":m,"data-slot":`plan-review`,className:`flex flex-col outline-none`,onKeyDown:e=>{e.key!==`Escape`||e.defaultPrevented||e.target.closest(`[role="dialog"], [role="alertdialog"]`)||(e.preventDefault(),s())},children:[(0,X.jsxs)(`header`,{"data-slot":`dialog-header`,className:`flex flex-col gap-1 px-5 pt-4 pb-3.5 text-left`,children:[(0,X.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,X.jsx)(`h2`,{id:m,"data-slot":`dialog-title`,className:`text-xs font-semibold tracking-[0.08em] text-muted-foreground uppercase`,children:`Proposed chain`}),(0,X.jsx)(`button`,{type:`button`,onClick:s,"aria-label":`Discard the plan`,className:`-mt-1 -mr-1 rounded-md p-1 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`,children:(0,X.jsx)(vr,{"aria-hidden":`true`,className:`size-4`})})]}),(0,X.jsx)(`p`,{"data-slot":`plan-task`,title:e.task,className:`text-[18px] font-medium text-foreground`,children:LS(e.task)}),e.fallback?(0,X.jsx)(`p`,{"data-slot":`plan-fallback`,className:`text-xs text-soft-foreground italic`,children:`planner unavailable — single-step plan`}):e.rationale===``?null:(0,X.jsx)(`p`,{"data-slot":`plan-rationale`,className:`text-xs text-muted-foreground`,children:e.rationale})]}),(0,X.jsx)(`ol`,{"data-slot":`plan-steps`,className:`flex-1 space-y-2 overflow-y-auto px-5 py-4`,children:_?(0,X.jsx)(`li`,{className:`py-6 text-center text-sm text-muted-foreground`,children:`(no steps left — discard and plan again)`}):e.steps.map((t,n)=>(0,X.jsxs)(`li`,{"data-slot":`plan-step`,"data-step-id":t.id,draggable:!0,onDragStart:()=>u(n),onDragOver:e=>{e.preventDefault(),f(n)},onDragLeave:()=>f(e=>e===n?null:e),onDrop:e=>g(e,n),onDragEnd:h,className:c(`flex items-center gap-2.5 rounded-lg border border-border bg-card-2 px-3 py-2.5`,l===n&&`opacity-50`,d===n&&l!==null&&l!==n&&`border-ring`),children:[(0,X.jsx)(ir,{"aria-hidden":`true`,className:`size-3.5 shrink-0 cursor-grab text-soft-foreground`}),(0,X.jsx)(`span`,{className:`w-5 shrink-0 font-mono text-xs text-muted-foreground tabular-nums`,children:String(n+1).padStart(2,`0`)}),(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,X.jsx)(`span`,{className:`text-[13px] font-medium`,children:t.name??t.id}),t.skill?(0,X.jsx)(`span`,{"data-slot":`plan-badge-skill`,title:`skill`,className:`shrink-0 rounded-full bg-accent-strong/15 px-1.5 py-px font-mono text-xs font-medium text-accent-text`,children:t.skill}):null,t.command?(0,X.jsx)(`span`,{"data-slot":`plan-badge-check`,className:`shrink-0 rounded-full bg-muted px-1.5 py-px text-xs font-medium text-muted-foreground`,children:`check`}):null]}),(0,X.jsx)(`p`,{className:`mt-3 whitespace-pre-wrap break-words font-mono text-xs text-muted-foreground`,children:IS(t)})]}),(0,X.jsxs)(`span`,{"data-slot":`plan-step-actions`,className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(G,{type:`button`,variant:`ghost`,size:`icon-sm`,"data-slot":`plan-step-up`,"aria-label":`Move step ${n+1} up`,disabled:n===0,className:`size-7 text-muted-foreground`,onClick:()=>a(FS(e.steps,n,n-1)),children:`Move up`}),(0,X.jsx)(G,{type:`button`,variant:`ghost`,size:`icon-sm`,"data-slot":`plan-step-down`,"aria-label":`Move step ${n+1} down`,disabled:n===e.steps.length-1,className:`size-7 text-muted-foreground`,onClick:()=>a(FS(e.steps,n,n+1)),children:`Move down`}),(0,X.jsx)(G,{type:`button`,variant:`ghost`,size:`icon-sm`,"data-slot":`plan-step-remove`,"aria-label":`Remove step ${n+1}`,className:`size-7 text-muted-foreground hover:text-semantic-red`,onClick:()=>a(PS(e.steps,n)),children:`Remove`})]})]},t.id))}),!n&&r?(0,X.jsxs)(`p`,{id:`plan-start-guidance`,className:`flex flex-wrap items-center gap-1.5 border-t border-border px-5 pt-3 text-xs text-muted-foreground`,children:[(0,X.jsx)(`span`,{children:r}),i]}):null,(0,X.jsxs)(`div`,{"data-slot":`plan-actions`,className:`flex flex-wrap items-center gap-3 px-6 pt-3 pb-6`,children:[(0,X.jsxs)(G,{type:`button`,"data-slot":`plan-start`,disabled:_||t||!n,title:n?void 0:r,"aria-describedby":!n&&r?`plan-start-guidance`:void 0,onClick:o,children:[(0,X.jsx)(mi,{"aria-hidden":`true`,className:`size-3.5`}),t?`Starting…`:`Start`]}),(0,X.jsx)(wC,{steps:e.steps,disabled:_}),(0,X.jsx)(G,{type:`button`,variant:`outline`,onClick:s,children:`Discard`})]}),(0,X.jsx)(`p`,{className:`px-6 pb-6 text-xs text-muted-foreground`,children:`No steps left? Start is disabled. A planner failure shows a single-step fallback.`})]})})})}function wC({steps:e,disabled:t}){let n=z(),[r,i]=(0,Y.useState)(!1),[a,o]=(0,Y.useState)(``),[s,c]=(0,Y.useState)(!1),[l,u]=(0,Y.useState)(!1),d=async t=>{let r=a.trim();if(!(r===``||l)){u(!0);try{let a=await Yt({name:r,steps:e,...t?{overwrite:!0}:{}});B(`Saved — ${a.path.split(`/`).pop()??a.path}`),n.invalidateQueries({queryKey:k.workflows}),c(!1),i(!1),o(``)}catch(e){e instanceof Ge&&e.exists===!0?c(!0):B(e instanceof Error?e.message:String(e),{tone:`danger`})}finally{u(!1)}}};return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(G,{type:`button`,variant:`outline`,"data-slot":`plan-save`,disabled:t,onClick:()=>i(!0),children:`Save as chain`}),(0,X.jsx)(va,{open:r,onOpenChange:e=>i(!!e),children:(0,X.jsxs)(ga,{"data-slot":`plan-save-dialog`,className:`sm:max-w-sm`,showCloseButton:!1,children:[(0,X.jsxs)(ha,{children:[(0,X.jsx)(_a,{children:`Save as chain`}),(0,X.jsx)(pa,{children:`Saves these steps as a reusable workflow — it joins the picker like any other chain.`})]}),(0,X.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),d(!1)},children:[(0,X.jsx)(`label`,{htmlFor:`plan-chain-name`,className:`mb-2 block text-xs text-muted-foreground`,children:`Chain name`}),(0,X.jsx)(Ml,{id:`plan-chain-name`,value:a,onChange:e=>o(e.target.value),"aria-label":`Chain name`,placeholder:`e.g. fix-and-verify-v2`,maxLength:80,autoFocus:!0}),(0,X.jsxs)(fa,{className:`mt-4`,children:[(0,X.jsx)(G,{type:`button`,variant:`outline`,onClick:()=>i(!1),children:`Cancel`}),(0,X.jsx)(G,{type:`submit`,disabled:a.trim()===``||l,children:l?`Saving…`:`Save chain`})]})]})]})}),(0,X.jsx)(n_,{open:s,onOpenChange:e=>e?void 0:c(!1),children:(0,X.jsxs)(a_,{"data-slot":`plan-overwrite-dialog`,children:[(0,X.jsxs)(o_,{children:[(0,X.jsxs)(c_,{children:[`Overwrite “`,a.trim(),`”?`]}),(0,X.jsx)(l_,{children:`A chain with this name already exists. Overwriting replaces its steps with this plan.`})]}),(0,X.jsxs)(s_,{children:[(0,X.jsx)(d_,{children:`Cancel`}),(0,X.jsx)(u_,{onClick:()=>void d(!0),children:`Overwrite chain`})]})]})})]})}var TC={start:{note:`Start immediately with the selected configuration.`,pendingLabel:`Starting task…`,failureHint:void 0,clearOnSuccess:!0,sendAriaLabel:`Start task`},plan:{note:`Review the plan before starting the task.`,pendingLabel:`Planning task…`,failureHint:`Could not create the plan. Your draft is kept. Please retry.`,clearOnSuccess:!1,sendAriaLabel:`Plan task`}};function EC(){let[e]=gn(),t=(0,Y.useRef)(null),n=(0,Y.useRef)(null),r=(0,Y.useRef)(null),{projectId:i}=_n(),a=bt().projectId,o=R().data,[s]=(0,Y.useState)(()=>e.toString()),[c]=(0,Y.useState)(()=>tf(s,o)),l=tf(s,o).runner,u=f(),d=ue(),p=te(),m=_(),{draft:h,update:g,clearStarted:v,submissionPending:y,mounted:b}=VS(a,c,l),x=dS(a),S=WS(h,p),C=GS(S.displayRunner,h.agentProfile),w=HS(h.source,d,S.displayRunner,C.agentProfile),{source:T,sourcesReady:E,skillList:D}=w,O=JS(i),k=US({uiState:d,source:T,sourcesReady:E,draftText:h.text,submissionPending:y,update:g});KS(S.providersReady);let A=u.data===void 0||u.data.info!==null,j=qS({hasGit:A,draft:h,selectedSkill:w.selectedSkill,workspaceConfig:m,source:T}),{plan:M,setPlan:ee,planning:N,starting:P,submit:ne,startPlanned:re}=tC({draft:h,draftProjectId:a,engine:S,agentProfile:C.agentProfile,accountsSettled:C.accountsSettled,sourcesReady:E,source:T,runMode:j,notifyOn:O.notifyOn,uiState:d,mounted:b,clearStarted:v});XS({deepLink:c,search:e,sourcesReady:E&&w.skillsSettled&&!S.providers.isPending&&C.accountsSettled,listUnchecked:w.listUnchecked,skillList:D,update:g});let F=YS(t),{providers:ie,providersReady:ae}=S,I=h.planFirst?TC.plan:TC.start,oe=$S(ie),L=M===null&&h.text.trim()===``,se=ae&&!P&&h.text.trim()===``;return(0,X.jsxs)(Bo,{route:`new`,density:L?`sparse`:`full`,rootProps:{"data-plan-review":M===null?void 0:`true`},className:`relative isolate overflow-x-clip pb-16`,header:DC(M!==null),sparseFooter:OC(L,k,n),children:[(0,X.jsx)(`div`,{"data-slot":`new-task-layout`,"data-persisted-draft":x||void 0,ref:r,style:M===null?void 0:{display:`none`},className:`relative z-[1] w-full`,children:(0,X.jsx)(Sx,{ref:n,onSubmit:ne,retainDraftUntilSuccess:!0,idleFeedback:(0,X.jsxs)(`div`,{"data-slot":`new-task-idle-feedback`,className:`flex flex-col gap-1`,children:[(0,X.jsxs)(`div`,{"data-slot":`new-task-mode-note`,className:`flex items-center justify-between gap-3 text-xs text-muted-foreground`,children:[se?(0,X.jsx)(`span`,{"data-slot":`new-task-start-hint`,children:`Describe a task above to start.`}):(0,X.jsx)(`span`,{children:I.note}),(0,X.jsx)(`kbd`,{className:`hidden font-sans md:inline`,children:Iy()})]}),(0,X.jsx)(`p`,{"data-slot":`run-mode-note`,className:`text-xs text-muted-foreground`,children:$x({worktree:j.worktree,hasGit:A})})]}),pendingLabel:I.pendingLabel,failureHint:I.failureHint,clearOnSuccess:I.clearOnSuccess,onPendingChange:e=>{y.current=e},value:h.text,onValueChange:e=>g({text:e}),draftPersisted:x,autoFocus:!0,placeholder:`Describe a task for the agent — / for skills…`,ariaLabel:`Describe a task for the agent`,sendAriaLabel:I.sendAriaLabel,disabled:!ae||P,disabledReason:oe,autocompleteSkills:!0,skillRunner:S.displayRunner,skillAccount:C.agentProfile,footerStart:(0,X.jsx)(kC,{projects:O.projectList,urlProjectId:i,templates:k,onInsertTemplate:e=>n.current?.insertAtCaret(e),sources:w,onPickSource:e=>g({source:e})}),agentOptions:(0,X.jsx)(sC,{groupRef:t,compact:F,engine:S,accounts:C,draftEffort:h.effort,update:g}),executionOptions:(0,X.jsx)(dC,{engine:S,draft:h,update:g,repo:u.data,hasGit:A,runMode:j,webhook:{targets:O.webhookTargets,on:O.notifyOn,onChange:O.setNotifyChoice},completionDisabled:P||N}),footerEnd:(0,X.jsx)(fC,{showConfigureProviders:!ae&&!ie.isPending,planFirst:h.planFirst,planning:N,onModeChange:e=>g({planFirst:e})})})}),M===null?null:(0,X.jsx)(CC,{plan:M,starting:P,startAvailable:ae,startUnavailableReason:oe,startUnavailableAction:ie.isPending?void 0:(0,X.jsx)(q,{to:`/settings/agent-defaults#providers`,children:`Configure providers`}),onStepsChange:e=>ee(t=>t&&{...t,steps:e}),onStart:()=>void re(),onDiscard:()=>{ee(null),requestAnimationFrame(()=>r.current?.querySelector(`textarea`)?.focus())}})]})}function DC(e){return e?{title:`New task / Plan first`,subtitle:`Review the proposed chain before launching.`,headerSlot:`plan-page-header`,hideSubtitleOnMobile:!0}:{title:`What should the agent work on?`,subtitle:`Describe the outcome, then configure the run.`,subtitleSlot:`page-description`,hideSubtitleOnMobile:!0}}function OC(e,t,n){if(e)return(0,X.jsx)(oC,{templates:t,onInsert:e=>n.current?.insertAtCaret(e)})}function kC({projects:e,urlProjectId:t,templates:n,onInsertTemplate:r,sources:i,onPickSource:a}){let o=xa();return(0,X.jsxs)(X.Fragment,{children:[e.length>1&&t!==void 0?(0,X.jsx)(jC,{projects:e,projectId:t,onPick:e=>o(`/p/${encodeURIComponent(e)}/new`,{replace:!0})}):null,(0,X.jsx)(Bx,{label:`Template`,templates:n,onInsert:r}),(0,X.jsx)(zC,{source:i.source,unchecked:i.unchecked,ready:i.sourcesReady,skillsLoading:!i.skillsSettled,skills:i.skillList,skillUsage:i.skillUsage,workflows:i.workflowList,onPick:a})]})}function AC(e,t){let n=t.trim().toLowerCase();if(n===``)return[...e];let r=e=>{let t=e.name.toLowerCase(),r=e.id.toLowerCase();return t.startsWith(n)||r.startsWith(n)?0:t.includes(n)||r.includes(n)?1:2};return e.map((e,t)=>({project:e,rank:r(e),index:t})).filter(e=>e.rank<2).sort((e,t)=>e.rank-t.rank||e.index-t.index).map(e=>e.project)}function jC({projects:e,projectId:t,onPick:n}){let[r,i]=(0,Y.useState)(!1),[a,o]=(0,Y.useState)(``),{order:s}=bp(),l=e.find(e=>e.id===t),u=AC(wo(e,s),a);return(0,X.jsxs)(sa,{open:r,onOpenChange:e=>{i(e),e||o(``)},children:[(0,X.jsx)(ra,{asChild:!0,children:(0,X.jsxs)(`button`,{type:`button`,"data-slot":`project-pill`,"aria-label":`Project`,title:`Which project this task runs in — its skills, workflows, settings and draft`,className:c(Cx,`border-foreground/60 font-semibold text-foreground`),children:[(0,X.jsx)(Qn,{"aria-hidden":`true`,className:`size-3 shrink-0 text-soft-foreground`}),(0,X.jsx)(`span`,{className:`max-w-40 truncate`,children:l?.name??t}),wx]})}),(0,X.jsx)(aa,{align:`start`,sideOffset:8,className:`w-[300px] max-w-[calc(100vw-2rem)] p-0`,children:(0,X.jsxs)(Co,{shouldFilter:!1,children:[(0,X.jsx)(ho,{placeholder:`search projects…`,value:a,onValueChange:o}),(0,X.jsxs)(So,{"data-slot":`project-menu`,className:`max-h-[min(18rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[u.length===0?(0,X.jsx)(xo,{children:`Nothing matches.`}):null,u.map(e=>(0,X.jsxs)(bo,{value:e.id,keywords:[e.name],"data-slot":`project-option`,"data-project-id":e.id,disabled:e.status===`missing`,onSelect:()=>{n(e.id),i(!1)},children:[(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs font-medium`,children:e.name}),e.status===`missing`?(0,X.jsx)(`span`,{className:`shrink-0 text-xs text-soft-foreground`,children:`folder not found`}):e.branch===void 0?null:(0,X.jsx)(`span`,{className:`shrink-0 font-mono text-xs text-soft-foreground`,children:e.branch}),e.id===t?(0,X.jsx)(mr,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-link-foreground`}):null]},e.id))]}),(0,X.jsx)(`p`,{className:`border-t border-border px-3 py-2 text-xs leading-snug text-soft-foreground`,children:`Skills, workflows, settings and the draft re-resolve against the selected project.`})]})})]})}function MC(e,t,n){return!e&&(t.ranked?t.ranked.length===0:t.mostUsed.length===0&&t.project.length===0&&t.global.length===0)&&n.length===0}function NC(e,t){return Oo(`no skill`,`none plain ${pS} ${e?.description??``}`,t)>0}function PC({source:e,ready:t,offersWorkflows:n,onPick:r,skillLabel:i}){let a=e===null||e.source===`skill`?Ir:Rr;return(0,X.jsxs)(`button`,{type:`button`,"data-slot":`source-pill`,"data-source-kind":e?.source??`none`,"aria-label":`Choose a skill or workflow`,title:e===null?`No skill — the task runs as one plain agent step. Pick a skill or workflow to change that.`:`Runs the ${e.source} "${e.ref}" — pick it again, or press ✕, to run without it`,disabled:!t,onKeyDown:t=>{e===null||t.metaKey||t.ctrlKey||t.altKey||t.key!==`Backspace`&&t.key!==`Delete`||(t.preventDefault(),r(null))},className:c(Cx,e===null?`text-muted-foreground`:`rounded-r-none border-r-0 border-foreground/60 pr-1.5 font-semibold text-foreground`),children:[(0,X.jsx)(a,{"aria-hidden":`true`,className:c(`size-3 shrink-0`,e===null?`text-muted-foreground`:`text-accent-icon`)}),(0,X.jsx)(`span`,{className:`max-w-44 truncate`,children:t?i??e?.ref??(n?`Skill or workflow`:`Skill`):`…`}),wx]})}function FC({source:e,quickTask:t,onPick:n}){return(0,X.jsx)(_o,{children:(0,X.jsxs)(bo,{value:`none no-skill`,keywords:[`none`,`plain`,...Po(pS)],"data-slot":`source-option`,"data-source-kind":`none`,onSelect:()=>n(null),children:[(0,X.jsx)(br,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-soft-foreground`}),(0,X.jsx)(`span`,{className:`shrink-0 text-xs font-medium`,children:`No skill`}),(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:t?.description??`One agent run on your task — no ceremony.`}),e===null?(0,X.jsx)(mr,{"aria-hidden":`true`,className:`ml-auto size-3.5 shrink-0 text-link-foreground`}):null]})})}function IC({ranked:e,mostUsed:t,project:n,skillItem:r}){return(0,X.jsx)(X.Fragment,{children:e?e.length>0?(0,X.jsx)(_o,{children:e.map(e=>r(e,jo(e)))}):null:(0,X.jsxs)(X.Fragment,{children:[t.length>0?(0,X.jsx)(_o,{heading:`Most used`,children:t.map(e=>r(e,jo(e)))}):null,n.length>0?(0,X.jsx)(_o,{heading:`Project skills`,children:n.map(e=>r(e,!0))}):null]})})}function LC({source:e,matchedWorkflows:t,toggle:n}){return t.length>0?(0,X.jsx)(_o,{heading:`Workflows`,children:t.map(t=>{let r=e?.source===`workflow`&&e.ref===t.name;return(0,X.jsxs)(bo,{value:`workflow ${t.name}`,keywords:Po(t.name,t.description),"data-slot":`source-option`,"data-source-kind":`workflow`,"data-source-ref":t.name,onSelect:()=>n({source:`workflow`,ref:t.name}),children:[(0,X.jsx)(`span`,{className:`shrink-0 font-mono text-xs`,children:t.name}),t.description?(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:t.description}):null,r?(0,X.jsx)(mr,{"aria-hidden":`true`,className:`ml-auto size-3.5 shrink-0 text-link-foreground`}):null]},t.name)})}):null}function RC({global:e,skillItem:t}){return e.length>0?(0,X.jsx)(_o,{heading:`Global`,children:e.map(e=>t(e,!1))}):null}function zC({source:e,unchecked:t,ready:n,skillsLoading:r,skills:i,skillUsage:a,workflows:o,onPick:s}){let[l,u]=(0,Y.useState)(!1),[d,f]=(0,Y.useState)(``),[p,m]=(0,Y.useState)(null),h=(0,Y.useRef)(null),{mostUsed:g,project:_,global:v,ranked:y}=Lo(i,d,a),b=o.find(e=>e.name===pS),x=ko(o,d).filter(e=>e.name!==pS),S=o.some(e=>e.name!==pS),C=NC(b,d),w=MC(C,{ranked:y,mostUsed:g,project:_,global:v},x),T=e=>{s(e),u(!1)},E=t=>T(e?.source===t.source&&e.ref===t.ref&&(e.source!==`skill`||t.source!==`skill`||e.path===t.path)?null:t),D=(t,n)=>{let r=e?.source===`skill`&&e.ref===t.id&&e.path===t.path;return(0,X.jsxs)(bo,{value:Ao(t),keywords:Po(t.name,t.description),"data-slot":`source-option`,"data-source-kind":`skill`,"data-source-ref":t.id,onSelect:()=>E({source:`skill`,ref:t.id,...t.path===void 0?{}:{path:t.path}}),children:[(0,X.jsx)(_y,{skill:t,emphasized:n}),(0,X.jsx)(`button`,{type:`button`,"data-slot":`source-skill-view`,"aria-label":`View skill ${t.name}`,title:`View skill`,onClick:e=>{e.preventDefault(),e.stopPropagation(),m(t)},className:`ml-auto shrink-0 rounded-sm p-0.5 text-soft-foreground transition-colors hover:text-foreground`,children:(0,X.jsx)(fi,{"aria-hidden":`true`,className:`size-3.5`})}),r?(0,X.jsx)(mr,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-link-foreground`}):null]},Ao(t))},O=PC({source:e,ready:n,offersWorkflows:S,onPick:s,skillLabel:e?.source===`skill`?i.find(t=>t.id===e.ref&&(e.path===void 0||e.path===t.path))?.name:void 0});return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Kx,{skill:p,onClose:()=>m(null)}),(0,X.jsxs)(sa,{open:l,onOpenChange:e=>{u(e),e||f(``)},children:[(0,X.jsxs)(`span`,{className:`inline-flex items-center`,children:[(0,X.jsx)(ra,{asChild:!0,children:O}),e?.source===`skill`&&t?(0,X.jsx)(`span`,{role:`status`,children:`Unchecked`}):null,e!==null&&n?(0,X.jsx)(`button`,{type:`button`,"data-slot":`source-pill-clear`,"aria-label":`Clear the ${e.source} ${e.ref}`,title:`Run without it`,onClick:()=>s(null),className:c(Cx,`rounded-l-none border-foreground/60 pl-1.5 pr-2 text-soft-foreground hover:text-foreground`),children:(0,X.jsx)(vr,{"aria-hidden":`true`,className:`size-3`})}):null]}),(0,X.jsx)(aa,{align:`start`,sideOffset:8,className:`w-[336px] max-w-[calc(100vw-2rem)] p-0`,children:(0,X.jsxs)(Co,{shouldFilter:!1,children:[(0,X.jsx)(ho,{placeholder:`search skills & workflows…`,value:d,onValueChange:f,onInput:()=>h.current?.scrollTo(0,0)}),(0,X.jsxs)(So,{ref:h,"data-slot":`source-menu`,"aria-busy":r,className:`max-h-[min(18rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[d.trim()&&!i.some(e=>e.id===d.trim())?(0,X.jsx)(_o,{children:(0,X.jsxs)(bo,{value:`typed-skill`,onSelect:()=>T({source:`skill`,ref:d.trim(),typed:!0}),children:[`Use skill id “`,d.trim(),`” (unchecked)`]})}):null,w&&!r?(0,X.jsx)(xo,{children:`Nothing matches.`}):null,C?(0,X.jsx)(FC,{source:e,quickTask:b,onPick:T}):null,r?(0,X.jsx)(`div`,{"data-slot":`source-skills-loading`,role:`status`,className:`px-2 py-1.5 text-xs text-muted-foreground`,children:`Loading skills…`}):null,(0,X.jsx)(IC,{ranked:y,mostUsed:g,project:_,skillItem:D}),(0,X.jsx)(LC,{source:e,matchedWorkflows:x,toggle:E}),(0,X.jsx)(RC,{global:v,skillItem:D})]})]})})]})]})}function BC(){return(0,X.jsx)(Vo,{route:`not-found`,density:`empty`,header:{title:`Page not found`,subtitle:`Nothing lives at this address.`,primaryAction:(0,X.jsx)(Ko,{asChild:!0,variant:`outline`,children:(0,X.jsx)(q,{to:`/`,children:`Back to tasks`})})},emptyState:(0,X.jsx)(qo,{icon:(0,X.jsx)(Ms,{className:`size-4`}),title:`Address not found`,description:`The link may be mistyped, or it points at something that is gone.`})})}function VC(){return(0,X.jsx)(`div`,{className:`px-4 pt-2 md:hidden`,children:(0,X.jsxs)(q,{to:`/git`,"data-slot":`git-back`,className:`inline-flex min-h-11 items-center gap-1.5 text-xs font-medium text-muted-foreground hover:text-foreground`,children:[(0,X.jsx)(Mr,{size:16,"aria-hidden":`true`,className:`size-3.5`}),`Back to Git`]})})}function HC(){let{pathname:e,search:t}=hn();return(0,X.jsxs)(Wo,{route:`repo-git`,density:`sparse`,flushPadding:!0,children:[wa(e)!==`/git`||new URLSearchParams(t).get(`view`)===`repo`?(0,X.jsx)(VC,{}):null,(0,X.jsx)(Yo,{icon:(0,X.jsx)(pi,{className:`motion-safe:animate-spin`}),tone:`neutral`,title:`Loading repository…`,subtitle:`Fetching the repo's git state.`})]})}function UC(){return(0,X.jsxs)(Jo,{route:`skills`,density:`sparse`,rootProps:{"aria-busy":`true`},header:{title:`Skills`,subtitle:`The skills each agent loads in this project, as its runner reports them.`},children:[(0,X.jsx)(`p`,{"data-slot":`skills-loading`,role:`status`,className:`text-xs text-muted-foreground`,children:`Loading skills…`}),(0,X.jsxs)(`div`,{"aria-hidden":`true`,className:`mt-4 flex flex-col gap-[22px] motion-safe:animate-pulse`,children:[(0,X.jsx)(`div`,{className:`h-11 rounded-lg border border-border bg-card`}),(0,X.jsx)(`div`,{className:`h-80 rounded-xl border border-border bg-card`})]})]})}function WC({projectId:e,registry:t}){let n=t.projects.length?t.projects:[{id:t.bootProject,name:t.bootProject}];return(0,X.jsx)(Vo,{route:`unknown-project`,density:`empty`,children:(0,X.jsx)(Yo,{icon:(0,X.jsx)(Vs,{}),tone:`neutral`,title:`“${e}” isn’t registered here`,subtitle:`This Squawk doesn’t serve a project by that id. The link may come from another machine’s workspace — these are the projects registered on this one:`,children:(0,X.jsx)(`ul`,{"data-slot":`registered-projects`,className:`mx-auto flex w-full max-w-xs flex-col gap-1.5 text-left`,children:n.map(e=>(0,X.jsx)(`li`,{children:(0,X.jsxs)(H,{to:`/p/${encodeURIComponent(e.id)}/`,className:`flex items-baseline gap-2 rounded-md border border-border bg-card px-3 py-2 text-sm font-medium text-foreground shadow-xs transition-colors hover:bg-card-2`,children:[e.name||e.id,(0,X.jsxs)(`span`,{className:`font-mono text-xs font-normal text-muted-foreground`,children:[`/p/`,e.id]})]})},e.id))})})})}function GC(){return(0,X.jsxs)(Wo,{route:`workflows`,density:`sparse`,rootProps:{"aria-busy":`true`},header:{title:`Workflows`,subtitle:`Portable skill chains. Steps run from top to bottom.`},children:[(0,X.jsx)(`p`,{"data-slot":`workflows-loading`,role:`status`,className:`text-xs text-muted-foreground`,children:`Loading workflows…`}),(0,X.jsxs)(`div`,{"aria-hidden":`true`,className:`mt-4 flex flex-col gap-[22px] motion-safe:animate-pulse`,children:[(0,X.jsx)(`div`,{className:`h-11 rounded-lg border border-border bg-card`}),(0,X.jsx)(`div`,{className:`h-80 rounded-xl border border-border bg-card`})]})]})}function KC({tab:e}){return(0,X.jsx)(Vo,{route:`task-${e}`,density:`sparse`,flushPadding:!0,children:(0,X.jsx)(Yo,{icon:(0,X.jsx)(pi,{className:`motion-safe:animate-spin`}),tone:`neutral`,title:e===`changes`?`Loading changes…`:`Loading files…`,subtitle:`Fetching the run record.`})})}function qC({tab:e,error:t}){let n=t instanceof Ge&&t.status===404;return(0,X.jsx)(Vo,{route:`task-${e}`,density:`empty`,flushPadding:!0,children:(0,X.jsx)(Yo,{icon:n?(0,X.jsx)(_i,{}):(0,X.jsx)(kr,{size:16}),tone:n?`neutral`:`danger`,title:n?`Task not found`:`Could not load this task`,subtitle:n?`No run has this id. It may have been deleted, or the link is from another machine.`:t.message,actions:(0,X.jsx)(G,{asChild:!0,variant:`outline`,children:(0,X.jsx)(q,{to:`/`,children:`Back to tasks`})})})})}var JC={issue:`issue`,pr:`pull request`};function YC({kind:e,number:t,heading:n=`h1`}){let r=(0,X.jsx)(`div`,{"data-slot":`task-github-loading`,className:`flex min-h-full flex-1 flex-col`,children:(0,X.jsx)(Yo,{icon:(0,X.jsx)(pi,{className:`motion-safe:animate-spin`}),tone:`neutral`,heading:n,title:`Loading ${JC[e]}${t===void 0?``:` #${t}`}…`,subtitle:t===void 0?`Fetching the run record.`:`Asking GitHub.`})});return n===`h2`?r:(0,X.jsx)(Vo,{route:`task-github-item`,density:`sparse`,flushPadding:!0,children:r})}function XC(){return(0,X.jsx)(Vo,{route:`task-thread`,density:`sparse`,flushPadding:!0,children:(0,X.jsx)(Yo,{icon:(0,X.jsx)(pi,{className:`motion-safe:animate-spin`}),tone:`neutral`,title:`Loading task…`,subtitle:`Fetching the run and its session transcript.`})})}async function ZC(e,t,n,r,i){try{return await cs(e,{queryKey:[t,`runs`,`artifact-metadata`,n,r],queryFn:({signal:e})=>Ot(n,r,{signal:e})},i),!0}catch(e){if(e instanceof Ge&&e.status===404)return!1;throw e}}async function QC(e,t,n,r,i,a){if(await ZC(e,t,n,r,i))return n;i.throwIfAborted();let o=await cs(e,{queryKey:[t,`runs`,`relationships`,n],queryFn:({signal:e})=>Ft(n,{signal:e})},i),s=new Set(o.workers.map(e=>e.workerId));a&&s.add(a),s.delete(n);for(let n of s){if(i.aborted)throw i.reason;if(await ZC(e,t,n,r,i))return n}throw new Ge(404,`Report missing or deleted`)}function $C(e,t,n){let r=z(),i=a();return At({queryKey:[i,`runs`,`report-source`,e,t,n],queryFn:({signal:a})=>QC(r,i,e,t,a,n),enabled:!!(e&&t),retry:!1})}var ew=class extends Y.Component{state={failed:!1};static getDerivedStateFromError(){return{failed:!0}}componentDidCatch(e,t){console.error(`Squawk cockpit: the preview pane crashed`,e,t.componentStack)}render(){return this.state.failed?(0,X.jsxs)(`div`,{"data-slot":`preview-pane-error`,role:`alert`,className:`flex h-full flex-col items-center justify-center gap-3 p-6 text-center`,children:[(0,X.jsx)(`p`,{className:`text-sm font-semibold text-foreground`,children:`The preview hit an error`}),(0,X.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`The task is unaffected. Close the preview and open it again.`}),(0,X.jsx)(G,{variant:`outline`,onClick:this.props.onClose,children:`Close preview`})]}):this.props.children}},tw=`cez-preview-tasks`,nw=`cez.preview.pane-width`,rw=e=>Math.min(75,Math.max(30,Math.round(e)));function iw(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function aw(e){if(!iw(e))return;let{port:t,agent:n,url:r}=e;if(typeof t==`number`&&Number.isInteger(t)&&t>=1&&t<=65535)return{port:t};if(n===!0)return{agent:!0};if(typeof r==`string`&&/^https?:\/\//i.test(r))return{url:r}}function ow(e){if(!iw(e))return;let t=aw(e.target),n=typeof e.percent==`number`&&Number.isFinite(e.percent)?e.percent:void 0;return{open:e.open===!0,...t?{target:t}:{},...n===void 0?{}:{percent:n},at:typeof e.at==`number`?e.at:0}}function sw(){try{let e=localStorage.getItem(tw),t=e===null?null:JSON.parse(e);return iw(t)?t:{}}catch{return{}}}function cw(e){let t=ow(sw()[e]);if(!t)return;let{at:n,...r}=t;return r}function lw(e,t,n=Date.now()){let r=sw(),i={open:!1,...ow(r[e]),...t,at:n};for(let e of Object.keys(i))i[e]===void 0&&delete i[e];r[e]=i;let a=Object.keys(r);if(a.length>100){let e=e=>ow(r[e])?.at??0;for(let t of a.sort((t,n)=>e(t)-e(n)).slice(0,a.length-100))delete r[t]}try{localStorage.setItem(tw,JSON.stringify(r))}catch{}}function uw(){try{let e=Number(localStorage.getItem(nw));return e>0?e:void 0}catch{return}}function dw(e){let t=(e===void 0?void 0:cw(e)?.percent)??uw();return t===void 0?58:rw(t)}function fw(e,t){try{localStorage.setItem(nw,String(t))}catch{}e!==void 0&&lw(e,{percent:t})}var pw=`(min-width: 1180px)`,mw=`(max-width: 767px)`;function hw(e,t){let[n,r]=(0,Y.useState)(()=>window.matchMedia?.(e).matches??t);return(0,Y.useEffect)(()=>{let t=window.matchMedia?.(e);if(!t)return;let n=()=>r(t.matches);return n(),t.addEventListener(`change`,n),()=>t.removeEventListener(`change`,n)},[e]),n}var gw=(0,Y.lazy)(()=>V(()=>import(`./preview-pane-connected-B1k-xMeW.js`).then(e=>({default:e.ConnectedPreviewPane})),__vite__mapDeps([66,1,2,7,8,9,10,14,67,68,69,70,62,71,72,44,73,74,75,76,63,18,19,25,26,77,64,13,23,24,48,39,58,11,12]))),_w=2,vw=(0,Y.createContext)(!1);function yw(){return(0,Y.useContext)(vw)}function bw(e){let[t,n]=(0,Y.useState)(void 0);return(0,Y.useEffect)(()=>{let t=e.current?.closest(`[data-slot="main"]`);if(!t)return;let r=()=>n(t.clientHeight||void 0);if(r(),typeof ResizeObserver>`u`)return;let i=new ResizeObserver(r);return i.observe(t),()=>i.disconnect()},[e]),t}function xw({run:e,state:t,children:n,report:r}){let i=hw(pw,!0),a=hw(mw,!1),o=(0,Y.useRef)(null),s=bw(o),{percent:c,setPercent:l}=t,u=!!r||t.open&&e!==void 0,d=u&&!i,f=!r&&t.session,p=d&&!f,m=d&&f,h=e=>{let t=o.current?.getBoundingClientRect();!t||t.width===0||l(rw((t.right-e)/t.width*100))},g=e=>{e.currentTarget.setPointerCapture?.(e.pointerId)},_=e=>{e.currentTarget.hasPointerCapture?.(e.pointerId)&&h(e.clientX)},v=e=>{if(e.key===`ArrowLeft`)l(rw(c+_w));else if(e.key===`ArrowRight`)l(rw(c-_w));else return;e.preventDefault()},y={"--preview-pane":`${c}%`,...s===void 0?{}:{"--preview-h":`${s}px`}};return(0,X.jsxs)(`div`,{ref:o,"data-slot":`task-split`,"data-pane":u?`open`:`closed`,"data-takeover":p?``:void 0,className:`preview-split flex min-h-full w-full min-w-0`,style:y,children:[(0,X.jsx)(`div`,{"data-slot":`task-main`,hidden:p&&a,"data-collapsed":p&&!a?``:void 0,className:`min-w-0 flex-1`,children:(0,X.jsx)(vw.Provider,{value:u,children:n})}),u?(0,X.jsxs)(X.Fragment,{children:[i?(0,X.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize preview`,"aria-valuemin":30,"aria-valuemax":75,"aria-valuenow":c,tabIndex:0,"data-slot":`preview-divider`,className:`preview-divider`,onPointerDown:g,onPointerMove:_,onKeyDown:v}):null,(0,X.jsxs)(`aside`,{"data-slot":`preview-pane`,"data-phone":a?``:void 0,hidden:m,className:`preview-pane`,children:[r,(0,X.jsx)(`div`,{hidden:!!r,className:`h-full`,children:t.open&&e?(0,X.jsx)(ew,{onClose:t.closePane,children:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(`p`,{role:`status`,className:`p-6 text-sm text-muted-foreground`,children:`Opening the preview…`}),children:(0,X.jsx)(gw,{run:e,servers:e.previewServers??[],request:t.request,onSession:p?t.showSession:void 0,onTarget:t.setTarget,onLive:t.setLive,onClose:t.closePane},e.id)})}):null})]})]}):null]})}function Sw(e){if(!e.worktreePath||e.worktreeReclaimedAt)return!0;let t=e.delegation?.role===`worker`?e.delegation.destroy:void 0;return t!==void 0&&!t.remaining.includes(`worktree`)}function Cw(e){let{state:t,server:n}=e,r=co(e.stateAt);switch(t){case`registered`:return n.answeredAtRegistration?{tone:`neutral`,ring:!1,pulse:!1,text:`was running when registered`}:{tone:`neutral`,ring:!0,pulse:!1,text:`registered · not started`};case`adopted`:return{tone:`neutral`,ring:!1,pulse:!1,text:`was running when registered`};case`starting`:return{tone:`pending`,ring:!1,pulse:!0,text:`starting`};case`up`:return{tone:`success`,ring:!1,pulse:!1,text:r?`up · ${r}`:`up`};case`stalled`:return{tone:`pending`,ring:!1,pulse:!1,text:`stalled · port silent 2 min`};case`exited`:return{tone:`danger`,ring:!1,pulse:!1,text:e.exitCode===void 0?`exited`:`exited · code ${e.exitCode}`};case`stopped`:return{tone:`neutral`,ring:!0,pulse:!1,text:e.reason===`idle`?`stopped after 15 min idle`:`stopped`};case`unavailable`:return{tone:`neutral`,ring:!0,pulse:!1,text:`unavailable`}}}function ww(e){return{kind:`preview-server`,id:`preview-server:${e.port}`,server:e,state:`registered`,stateAt:e.registeredAt}}function Tw(e,t){return t?.get(e.port)??ww(e)}function Ew(e){return e.state===`registered`?e.server.answeredAtRegistration:e.state===`up`||e.state===`starting`||e.state===`adopted`}function Dw(e){return e.split(` -- `)[0].trim()}var Ow=(0,Y.createContext)(null);function kw(){return(0,Y.useContext)(Ow)}var Aw=e=>e&&`port`in e?e.port:void 0;function jw(){return typeof window.matchMedia!=`function`||window.matchMedia(`(min-width: 1180px)`).matches}function Mw(e){let t=e===void 0?void 0:cw(e),n=t?.open===!0,r=n?t.target:void 0;return{open:n,target:r,request:n?{...r,restored:!0}:void 0,session:n&&!jw(),percent:dw(e)}}function Nw(e,t=!1){let[n]=(0,Y.useState)(()=>Mw(e)),[r,i]=(0,Y.useState)(n.open),[a,o]=(0,Y.useState)(!1),[s,c]=(0,Y.useState)(n.target),[l,u]=(0,Y.useState)(n.session),[d,f]=(0,Y.useState)(n.request),[p,m]=(0,Y.useState)(n.percent),[h,g]=(0,Y.useState)(e),_=(0,Y.useRef)(r);if(_.current=r,h!==e){let t=Mw(e);g(e),i(t.open),o(!1),c(t.target),u(t.session),f(t.request),m(t.percent)}t&&r&&d?.restored&&(i(!1),c(void 0),f(void 0),u(!1));let v=(0,Y.useCallback)(t=>{e!==void 0&&lw(e,t)},[e]),y=(0,Y.useCallback)(e=>{f({...e});let t=e.port===void 0?e.agent?{agent:!0}:void 0:{port:e.port};u(!1),i(!0),t?(c(t),v({open:!0,target:t})):_.current?v({open:!0}):(c(void 0),v({open:!0,target:void 0}))},[v]),b=(0,Y.useCallback)(()=>{i(!1),o(!1),u(!1),c(void 0),v({open:!1})},[v]),x=(0,Y.useCallback)(e=>{c(e),v({target:e})},[v]),S=(0,Y.useCallback)(t=>{m(t),fw(e,t)},[e]),C=(0,Y.useCallback)(()=>u(!0),[]),w=Aw(s);return(0,Y.useMemo)(()=>({open:r,live:a,port:w,target:s,percent:p,request:d,session:l,openPane:y,closePane:b,showSession:C,setLive:o,setTarget:x,setPercent:S}),[r,a,w,s,p,d,l,y,b,C,x,S])}function Pw(...e){let t=[],n=-1/0,r=!0;for(let i of e){for(let e of i){if(e.seq<=n){r=!1;break}t.push(e),n=e.seq}if(!r)break}if(r)return t;let i=new Map;for(let t of e)for(let e of t)i.set(e.seq,e);return[...i.values()].sort((e,t)=>e.seq-t.seq)}var Fw=(e,t)=>JSON.stringify([e.stepId??null,t]);function Iw(e,t){if(typeof t.delta!=`string`)return;let n=e.item.kind===`tool`?t.field===`output`?`output`:void 0:t.field!==`output`&&(e.item.kind===`message`||e.item.kind===`reasoning`)?`text`:void 0;if(!n)return;let r=e.item[n];e.item={...e.item,[n]:(typeof r==`string`?r:``)+t.delta},e.event={...e.event,seq:t.seq,ts:t.ts}}function Lw(e,t){for(let[n,r]of e)r.event.stepId===t&&e.delete(n)}function Rw(e,t,n){let r=t.item;if(t.type===`item.delta`){let r=e.get(Fw(t,t.itemId));r&&(Iw(r,t),r.touched||=n)}else t.type===`item.completed`&&r&&typeof r==`object`?e.delete(Fw(t,r.id)):(t.type===`item.started`||t.type===`item.updated`)&&r&&typeof r==`object`&&`kind`in r?e.set(Fw(t,r.id),{event:t,item:r,touched:n&&t.type===`item.updated`}):(t.type===`turn.completed`||t.type===`session.started`||t.type===`session.ended`)&&Lw(e,t.stepId)}function zw(e,t){let n=new Set(t.map(({seq:e})=>e)),r=new Map;for(let t of e)Rw(r,t,n.has(t.seq));return[...r.values()].filter(({touched:e})=>e).map(({event:e,item:t})=>({...e,type:`item.updated`,item:t})).sort((e,t)=>e.seq-t.seq)}function Bw(e,t={}){let[n,r]=(0,Y.useState)([]),{cursor:i,afterSeq:o=0,maxEvents:s,compactAt:c,onCompact:l,onReset:u,carryOver:d}=t,f=(0,Y.useRef)(void 0),p=(0,Y.useRef)(d);return p.current=d,(0,Y.useEffect)(()=>{let t=a(),n=e===void 0?void 0:`${t}/${e}`,d=n!==void 0&&f.current===n;if(f.current=n,r(e=>d&&p.current?p.current(e):[]),!e)return;let m=o,h=!1,g=!1,_=0,v=[],y,b,x=()=>{if(y!==void 0&&globalThis.cancelAnimationFrame?.(y),clearTimeout(b),y=void 0,b=void 0,h||v.length===0)return;let e=v;v=[],_+=e.length,r(t=>{let n=Pw(t,e);return!g&&c!==void 0&&_>=c&&(g=!0,queueMicrotask(()=>{h||l?.()})),s===void 0||n.length<=s?n:n.slice(-s)})},S=()=>{b===void 0&&(b=setTimeout(x,50),typeof globalThis.requestAnimationFrame==`function`&&(y=globalThis.requestAnimationFrame(x)))},C=Ht({kind:`run`,projectId:t,runId:e,afterSeq:o,...i?{cursor:i}:{}},{frame:e=>{if(`type`in e){if(e.type===`event`&&e.event.seq>m)m=e.event.seq;else if(e.type!==`snapshot`)return;v.push(e.event),S()}},reset:async(e,t)=>{x();let n=await u?.(e,t);return n&&(m=Math.max(m,n.afterSeq)),n}});return()=>{h=!0,y!==void 0&&globalThis.cancelAnimationFrame?.(y),clearTimeout(b),C()}},[e,i,o,s,c,l,u]),n}var Vw=5,Hw=200,Uw=5e3;function Ww(e,t,n){e.setQueryData(t,e=>{if(!e)return{pages:[n],pageParams:[void 0]};let t=[...e.pages],r=[...e.pageParams],i=-1;for(let e=0;e<t.length;e+=1)(i===-1||t[e].asOfSeq>t[i].asOfSeq)&&(i=e);if(i>=0&&t[i].asOfSeq>n.asOfSeq)return e;for(i>=0&&t[i].newerCursor===void 0?(t[i]=n,r[i]=void 0):(t.push(n),r.push(void 0));t.length>Vw;)t.shift(),r.shift();return{pages:t,pageParams:r}})}function Gw(e,t){return e!==void 0&&(t===void 0||e.asOfSeq>=t.asOfSeq)}function Kw(e,t,n,r){let i=(0,Y.useRef)(void 0),a=r&&t.data!==void 0&&!t.isFetching&&!Gw(t.data,n),o=e===void 0||n===void 0?void 0:`${e}:${n.asOfSeq}`;(0,Y.useEffect)(()=>{!a||o===void 0||i.current===o||(i.current=o,t.refetch())},[a,t,o])}function qw(e,t){return e!==void 0&&e.asOfSeq>t.asOfSeq?e:t}function Jw(e){let t=a(),n=z(),r=[`run-history`,t,e],i=[`run-history-context`,t,e],o=Wt({queryKey:r,enabled:e!==void 0,initialPageParam:void 0,queryFn:({pageParam:t,signal:n})=>Ve(e,t,{signal:n}),getPreviousPageParam:e=>e.olderCursor,getNextPageParam:e=>e.newerCursor,maxPages:Vw,staleTime:1/0,retry:1}),s=At({queryKey:i,enabled:e!==void 0,queryFn:async({signal:t})=>{let r=await at(e,{signal:t});return qw(n.getQueryData(i),r)},retry:1}),c=(0,Y.useCallback)(async r=>{let i=r?{signal:r}:void 0,a=await Ve(e,void 0,i),o=await at(e,i);return r?.throwIfAborted(),Ww(n,[`run-history`,t,e],a),n.setQueryData([`run-history-context`,t,e],e=>qw(e,o)),a},[n,e,t]),l=(0,Y.useCallback)(async(t,n)=>{if(e===void 0)return;let r=await c(n);return{cursor:r.liveCursor,afterSeq:r.asOfSeq}},[c,e]),u=o.isError||s.isError,d=Bw(u?e:void 0,{onReset:l}),f=o.data?.pages??[],p=f.reduce((e,t)=>t.newerCursor===void 0?t:e??t,void 0),m=(0,Y.useRef)(!1),h=(0,Y.useCallback)(()=>{e===void 0||m.current||(m.current=!0,c().catch(()=>{}).finally(()=>{m.current=!1}))},[c,e]),g=e=>e!==void 0&&n.getQueryData([`run-history`,t,e])!==void 0,[_,v]=(0,Y.useState)(()=>({runId:e,pending:g(e)})),y=_.pending;_.runId!==e&&(y=g(e),v({runId:e,pending:y})),(0,Y.useEffect)(()=>{if(!y||e===void 0)return;let t=!1,n=new AbortController;return c(n.signal).catch(()=>{}).finally(()=>{t||v({runId:e,pending:!1})}),()=>{t=!0,n.abort()}},[c,y,e]);let b=(0,Y.useMemo)(()=>Pw(...f.map(e=>e.events)),[f]),x=(0,Y.useRef)({runId:e,current:b,previous:[]});(x.current.current!==b||x.current.runId!==e)&&(x.current={runId:e,current:b,previous:x.current.runId===e?x.current.current:[]});let S=(0,Y.useCallback)(e=>{let{current:t,previous:n}=x.current;return zw(Pw(n,t,e),e)},[]),C=Bw(!u&&p&&!y?e:void 0,{cursor:p?.liveCursor,afterSeq:p?.asOfSeq,maxEvents:Uw,compactAt:Hw,onCompact:h,onReset:l,carryOver:S}),w=(0,Y.useRef)(0);w.current=C.length,(0,Y.useEffect)(()=>()=>{w.current>0&&h()},[h]);let T=(0,Y.useMemo)(()=>u?d:Pw(b,C),[u,d,b,C]);Kw(e,s,p,!u);let E=u||Gw(s.data,p),D=(0,Y.useMemo)(()=>{if(u)return d;let e=s.data?.contextEvents??[],t=s.data?.asOfSeq??0;return Pw(e,T.filter(({seq:e})=>e>t))},[s.data,u,d,T]),O=(0,Y.useCallback)(async()=>{await o.fetchPreviousPage()},[o.fetchPreviousPage]),k=(0,Y.useCallback)(async()=>{u||(await n.resetQueries({queryKey:[`run-history`,t,e],exact:!0}),n.invalidateQueries({queryKey:[`run-history-context`,t,e],exact:!0}))},[u,n,e,t]);return{visibleEvents:T,currentEvents:D,currentComplete:E,isPending:!u&&o.isPending,contextPending:!u&&s.isPending,fallback:u,hasOlder:!u&&!!o.hasPreviousPage,isFetchingOlder:o.isFetchingPreviousPage,olderError:o.isFetchPreviousPageError?o.error instanceof Error?o.error.message:`Could not load earlier items`:void 0,loadOlder:O,jumpToLatest:k,retainedPages:f.length}}function Yw(e){for(let t=e.length-1;t>=0;--t){let n=zt.safeParse(e[t]);if(n.success)return n.data.state===`connected`}return!1}function Xw(e){let{currentEvents:t}=Jw(e);return(0,Y.useMemo)(()=>Yw(t),[t])}var Zw=(0,Y.lazy)(()=>V(()=>import(`./report-reader-CfpyZKZF.js`).then(e=>({default:e.ReportReader})),__vite__mapDeps([78,1,2,6,7,8,9,10,11,12,13,79,14,80,18,19,28,34,35,81,82,83,84,85])));function Qw(){let{id:e}=_n(),t=j(e),n=hn(),r=ke().data?.capabilities?.preview===!0,i=t.data?Sw(t.data):!1,a=Nw(e,i),o=no(e),s=$C(e,o.selection?.artifactId,o.sourceRunId),c=o.selection?(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(`p`,{role:`status`,children:`Loading report…`}),children:(0,X.jsx)(Zw,{runId:s.data??e??``,selection:{artifactId:o.selection.artifactId},fragment:n.hash,onBack:o.close,variant:`pane`,sourceLookup:s},`${e}:${o.selection.artifactId}`)}):void 0,l=r?(0,X.jsx)($w,{id:e,run:t.data,pane:a,removed:i,report:c,children:(0,X.jsx)(pn,{})}):(0,X.jsx)(xw,{run:t.data,state:{...a,open:!1},report:c,children:(0,X.jsx)(pn,{})});return(0,X.jsx)(ao.Provider,{value:o.registry,children:l})}function $w({id:e,run:t,pane:n,removed:r,children:i,report:a}){let o=Xw(e),s=(0,Y.useMemo)(()=>({...n,worktreeRemoved:r,agentLive:o}),[n,r,o]);return(0,X.jsx)(Ow.Provider,{value:s,children:(0,X.jsx)(xw,{run:t,state:n,report:a,children:i})})}var eT=[`task`,`runner`,`workflow`,`branch`,`diff`,`reference`,`usage`,`started`],tT=[`status`,`task`,`workflow`,`branch`,`diff`,`reference`,`tokens`,`cost`,`cpu`,`memory`,`started`],nT=[{id:`status`,label:`Status`,canFold:!1,defaultExpanded:!0,align:`left`,width:`120px`},{id:`task`,label:`Task`,canFold:!1,defaultExpanded:!0,align:`left`,width:`320px`},{id:`runner`,label:`Runner`,canFold:!0,defaultExpanded:!1,align:`left`,width:`132px`,icon:`runner`},{id:`workflow`,label:`Workflow`,canFold:!0,defaultExpanded:!0,align:`left`,width:`112px`,icon:`workflow`},{id:`branch`,label:`Branch`,canFold:!0,defaultExpanded:!1,align:`left`,width:`136px`,icon:`branch`},{id:`diff`,label:`±`,summaryLabel:`Changes`,canFold:!0,defaultExpanded:!0,align:`left`,width:`104px`,icon:`diff`},{id:`reference`,label:`Ref`,summaryLabel:`Reference`,canFold:!0,defaultExpanded:!0,align:`left`,width:`124px`,icon:`reference`},{id:`usage`,label:`Usage`,canFold:!0,defaultExpanded:!0,align:`right`,width:`148px`,icon:`usage`},{id:`tokens`,label:`IN / OUT`,canFold:!0,defaultExpanded:!0,align:`right`,width:`112px`,icon:`tokens`,capability:`tokens`},{id:`cost`,label:`Cost`,canFold:!0,defaultExpanded:!0,align:`right`,width:`64px`,icon:`cost`,capability:`cost`},{id:`cpu`,label:`CPU`,canFold:!0,defaultExpanded:!0,align:`right`,width:`60px`,icon:`cpu`},{id:`memory`,label:`Mem`,canFold:!0,defaultExpanded:!0,align:`right`,width:`80px`,icon:`memory`},{id:`started`,label:`Started`,canFold:!0,defaultExpanded:!0,align:`right`,width:`72px`,icon:`started`}],rT=new Map(nT.map(e=>[e.id,e]));function iT(e){return typeof e!=`object`||!e||Array.isArray(e)?{}:Object.fromEntries(Object.entries(e).filter(e=>typeof e[1]==`boolean`))}function aT(e){let t={};for(let[n,r]of Object.entries(iT(e))){let e=rT.get(n);e?.canFold&&(t[e.id]=r)}return t}function oT(e,t){let n=rT.get(e);return!n||!n.canFold?!0:t[e]??n.defaultExpanded}function sT(e,t){let n=iT(e);return rT.get(t)?.canFold?{...n,[t]:!oT(t,aT(e))}:n}var cT=new Set(tT),lT=new Set(eT);function uT(){return nT.filter(e=>lT.has(e.id))}function dT(e){return nT.filter(t=>cT.has(t.id)&&(t.capability===void 0||e[t.capability]))}function fT(e,t){return t===`flat`?!1:t===`virtual`||e>=100}function pT(e,t){let n=t===null?-1:e.indexOf(t);return n<0?[]:[n-1,n,n+1].filter(t=>t>=0&&t<e.length)}function mT(e,t){let n=e.map(e=>oT(e.id,t)?e.id===`workflow`||e.id===`memory`?120:Number.parseFloat(e.width??`100`):42);return{"--task-columns":e.map((e,t)=>e.id===`task`?`minmax(${n[t]}px, 1fr)`:`${n[t]}px`).join(` `),minInlineSize:Math.max(1240,n.reduce((e,t)=>e+t,0))}}var hT=null,{min:gT,max:_T,abs:vT,floor:yT}=Math,bT=(e,t,n)=>gT(n,_T(t,e)),xT=e=>[...e].sort((e,t)=>e-t),ST=typeof queueMicrotask==`function`?queueMicrotask:e=>{Promise.resolve().then(e)},CT=()=>{let e;return[new Promise(t=>{e=t}),e]},wT=e=>{let t;return()=>(e&&=(t=e(),void 0),t)},TT=(e,t,n)=>{let r=n?`unshift`:`push`;for(let n=0;n<t;n++)e[r](-1);return e},ET=(e,t)=>{let n=e.t[t];return n===-1?e.o:n},DT=(e,t,n)=>{let r=e.t[t]===-1;return e.t[t]=n,e.i=gT(t,e.i),r},OT=(e,t)=>{if(!e.l)return 0;if(e.i>=t)return e.u[t];e.i<0&&(e.u[0]=0,e.i=0);let n=e.i,r=e.u[n];for(;n<t;)r+=ET(e,n),e.u[++n]=r;return e.i=t,r},kT=(e,t,n=0,r=e.l-1)=>{let i=n;for(;n<=r;){let a=yT((n+r)/2);OT(e,a)<=t?(i=a,n=a+1):r=a-1}return bT(i,0,e.l-1)},AT=(e,t,n)=>{let r=t-e.l;return e.i=n?-1:gT(t-1,e.i),e.l=t,r>0?(TT(e.u,r),TT(e.t,r,n),e.o*r):(e.u.splice(r),(n?e.t.splice(0,-r):e.t.splice(r)).reduce((t,n)=>t-(n===-1?e.o:n),0))},jT=typeof window<`u`,MT=e=>e.documentElement,NT=e=>e.ownerDocument,PT=e=>e.defaultView,FT=wT(()=>!!/iP(hone|od|ad)/.test(navigator.userAgent)||navigator.platform===`MacIntel`&&navigator.maxTouchPoints>0),IT=wT(()=>`scrollBehavior`in MT(document).style),LT=e=>_T(e.h(),e.p()),RT=(e,t=40,n=0,r,i=!1)=>{let a=!!n,o=1,s=0,c=0,l=0,u=0,d=0,f=0,p=0,m=0,h=hT,g=[0,a?_T(n-1,0):-1],_=0,v=!1,y=((e,t,n)=>({o:t,t:n?TT(n.slice(0,gT(e,n.length)),_T(0,e-n.length)):TT([],e),l:e,i:-1,u:TT([],e+1)}))(e,r?r[1]:t,r&&r[0]),b=new Set,x=()=>l-c,S=()=>x()+d+u,C=(e,t)=>((e,t,n,r)=>{if(r=gT(r,e.l-1),OT(e,r)<=t){let i=kT(e,n,r);return[kT(e,t,r,i),i]}{let i=kT(e,t,void 0,r);return[i,kT(e,n,i)]}})(y,e,t,g[0]),w=()=>OT(y,y.l),T=(e,t)=>{let n=OT(y,e)-d;return t?w()-n-E(e):n},E=e=>ET(y,e),D=(e,t=-1)=>y.t[e]===t,O=e=>{e&&(FT()&&p!==0||h&&m===1?d+=e:u+=e)};return{v:()=>{b.clear()},m:()=>o,_:()=>(e=>[e.t.slice(),e.o])(y),S:(e=200)=>{if(!v||a)return g;let t,n;if(f)[t,n]=g;else{let r=_T(0,S()),a=r+s;i||(e=_T(0,e),p!==1&&(r-=e),p!==2&&(a+=e)),[t,n]=g=C(_T(0,r),_T(0,a)),h&&(t=gT(t,h[0]),n=_T(n,h[1]))}return[_T(t,0),gT(n,y.l-1)]},$:e=>kT(y,e-c),I:D,k:T,R:E,T:()=>y.l,C:()=>l,M:()=>p!==0,p:()=>s,O:()=>c,h:w,H:()=>(f=u,u=0,[f,m===2]),W:(e,t)=>{let n=[e,t];return b.add(n),()=>{b.delete(n)}},B:(e,t)=>{let n,r,g=0;switch(e){case 1:{if(t===l&&m===0)break;let e=f;f=0;let n=t-l,i=vT(n);e&&i<vT(e)+1||m!==0||(p=n<0?2:1),a&&=!1,l=t,g=4;let o=x();o>=-s&&o<=w()&&(g+=1,r=i>s);break}case 2:g=8,p!==0&&(n=!0,g+=1),p=0,m=0,h=hT;break;case 3:{let e=t.filter(([e,t])=>!D(e,t));if(!e.length)break;O(e.reduce((e,[t,n])=>{let r;if(m===2)r=!0;else if(h&&m===1)r=t<h[0];else{let e=x(),n=T(t),i=E(t);r=p!==1&&m===0?n+i<=e:n<e&&n+i<e+s}return r&&(e+=n-E(t)),e},0));for(let[t,n]of e){let e=E(t),r=DT(y,t,n);i&&(_+=r?n:n-e)}i&&s&&_>s&&(O(((e,t)=>{let n=0,r=[];e.t.forEach((e,i)=>{e!==-1&&(r.push(e),i<t&&n++)}),e.i=-1;let i=xT(r),a=i.length,o=a/2|0,s=a%2==0?(i[o-1]+i[o])/2:i[o],c=e.o;return((e.o=s)-c)*_T(t-n,0)})(y,kT(y,S()))),i=!1),g=3,r=!0;break}case 4:s!==t&&(s||(v=r=!0),s=t,g=3);break;case 5:t[1]?(O(AT(y,t[0],!0)),m=2,g=1):(AT(y,t[0]),g=1);break;case 6:c=t;break;case 7:m=1;break;case 8:h=C(t,t+s),g=1}g&&(o=1+(2147483647&o),n&&d&&(u+=d,d=0),b.forEach(([e,t])=>{g&e&&t(r)}))}}},zT=setTimeout,BT=(e,t)=>t?-e:e,VT=(e,t,n,r,i,a)=>{let o=Date.now,s=0,c=!1,l=!1,u=!1,d=!1,f=(()=>{let t,n=()=>{t!=hT&&clearTimeout(t)},r=()=>{n(),t=zT(()=>{t=hT,(()=>{if(c||l)return c=!1,void f();u=!1,e.B(2)})()},150)};return r.J=n,r})(),p=()=>{s=o(),u&&(d=!0),a&&e.B(6,a()),e.B(1,r()),f()},m=t=>{if(c||!e.M()||t.ctrlKey)return;let r=o()-s;150>r&&50<r&&(n?t.deltaX:t.deltaY)&&(c=!0)},h=()=>{l=!0,u=d=!1},g=()=>{l=!1,FT()&&(u=!0)};return t.addEventListener(`scroll`,p),t.addEventListener(`wheel`,m,{passive:!0}),t.addEventListener(`touchstart`,h,{passive:!0}),t.addEventListener(`touchend`,g,{passive:!0}),{A:()=>{t.removeEventListener(`scroll`,p),t.removeEventListener(`wheel`,m),t.removeEventListener(`touchstart`,h),t.removeEventListener(`touchend`,g),f.J()},L:()=>{let[t,n]=e.H();t&&(i(t,n,d),d=!1,n&&e.p()>e.h()&&e.B(1,r()))}}},HT=(e,t,n)=>{let r;return[async(i,a)=>{if(!await t())return;r&&r();let o=()=>{let[t,n]=CT();return r=()=>{n(!1)},e.p()&&zT(r,150),[t,e.W(2,()=>{n(!0)})]};if(a&&IT())e.B(8,i()),ST(async()=>{for(;;){let t=!0;for(let[n,r]=e.S();n<=r;n++)if(e.I(n)){t=!1;break}if(t)break;let[n,r]=o();try{if(!await n)return}finally{r()}}e.B(7),n(i(),a)});else for(;;){let[t,r]=o();try{if(e.B(7),n(i()),!await t)return}finally{r()}}},()=>{r&&r()}]},UT=(e,t)=>{let n,r,i=CT(),a=!1,o=t?`scrollLeft`:`scrollTop`,s=t?`overflowX`:`overflowY`,[c,l]=HT(e,()=>i[0],(e,r)=>{e=BT(e,a),r?n.scrollTo({[t?`left`:`top`]:e,behavior:`smooth`}):n[o]=e});return{N(c,u){n=u,t&&(a=getComputedStyle(u).direction===`rtl`),r=VT(e,u,t,()=>BT(u[o],a),(t,n,r)=>{if(r){let e=u.style,t=e[s];e[s]=`hidden`,zT(()=>{e[s]=t})}u[o]=BT(e.C()+t,a),n&&l()}),i[1](!0)},v(){r&&r.A(),i[1](!1),i=CT()},P:()=>a,V(e){c(()=>e)},X(t){t+=e.C(),c(()=>t)},Y(t,{align:n,smooth:r,offset:i=0}={}){if(t=bT(t,0,e.T()-1),n===`nearest`){let r=e.k(t),i=e.C();if(r<i)n=`start`;else{if(!(r+e.R(t)>i+e.p()))return;n=`end`}}c(()=>i+e.O()+e.k(t)+(n===`end`?e.R(t)-e.p():n===`center`?(e.R(t)-e.p())/2:0),r)},q:()=>{r&&r.L()}}},WT=e=>{let t;return{j(n){(t||=new(PT(NT(n))).ResizeObserver(e)).observe(n)},D(e){t.unobserve(e)},A(){t&&t.disconnect()}}},GT=(e,t)=>{let n,r=t?`width`:`height`,i=new WeakMap,a=WT(t=>{let a=[];for(let{target:o,contentRect:s}of t)if(o.offsetParent)if(o===n)e.B(4,s[r]);else{let e=i.get(o);e!=hT&&a.push([e,s[r]])}a.length&&e.B(3,a)});return{G(e){a.j(n=e)},U:(e,t)=>(i.set(e,t),a.j(e),()=>{i.delete(e),a.D(e)}),v:a.A}},KT=jT?Y.useLayoutEffect:Y.useEffect,qT=`current`,JT=(e,t)=>{if(Array.isArray(e))for(let n of e)JT(n,t);else e==null||typeof e==`boolean`||t.push(e)},YT=(e,t)=>e.key??`_`+t,XT=e=>{let t=(0,Y.useRef)(null);return t[qT]||(t[qT]=e())},ZT=e=>{let t=(0,Y.useRef)(e);return KT(()=>{t[qT]=e},[e]),t},QT=(0,Y.memo)(({Z:e,ee:t,te:n,oe:r,ne:i,re:a,se:o,ie:s})=>{let c=(0,Y.useRef)(null);KT(()=>t(c[qT],n),[n]);let l=(0,Y.useMemo)(()=>{let e={contain:`layout style`,position:i&&s?void 0:`absolute`,[o?`height`:`width`]:`100%`,[o?`top`:`left`]:0,[o?`left`:`top`]:r,visibility:!i||s?void 0:`hidden`};return o&&(e.display=`inline-flex`),e},[r,i,s,o]);return(0,X.jsx)(a,typeof a==`string`?{ref:c,style:l,children:e}:{ref:c,style:l,index:n,children:e})}),$T=(e,t)=>(0,Y.useMemo)(()=>{if(typeof e==`function`)return[n=>e(t[n],n),t.length];let n=(e=>{let t=[];return JT(e,t),t})(e);return[e=>n[e],n.length]},[e,t]),eE=(0,Y.forwardRef)(({children:e,data:t,bufferSize:n,itemSize:r,shift:i,horizontal:a,keepMounted:o,cache:s,startMargin:c=0,ssrCount:l,as:u=`div`,item:d=`div`,scrollRef:f,onScroll:p,onScrollEnd:m},h)=>{let[g,_]=$T(e,t),v=(0,Y.useRef)(null),y=(0,Y.useRef)(!!l),b=ZT(p),x=ZT(m),[S,C,w,T]=XT(()=>{let e=!!a,t=RT(_,r,l,s,!r);return[t,GT(t,e),UT(t,e),e]});_!==S.T()&&S.B(5,[_,i]),c!==S.O()&&S.B(6,c);let[E,D]=(0,Y.useReducer)(S.m,void 0,S.m),O=S.M(),k=S.h(),A=w.P(),j=[],M=e=>{let t=g(e);return(0,X.jsx)(QT,{ee:C.U,te:e,oe:S.k(e,A),ne:S.I(e),re:d,Z:t,se:T,ie:y[qT]},YT(t,e))};if(KT(()=>{y[qT]=!1,S.W(1,e=>{e?(0,ld.flushSync)(D):D()}),S.W(4,()=>{b[qT]&&b[qT](S.C())}),S.W(8,()=>{x[qT]&&x[qT]()});let e=v[qT],t=t=>{C.G(t),w.N(e,t)};return f?ST(()=>{f[qT]&&t(f[qT])}):t(e.parentElement),()=>{S.v(),C.v(),w.v()}},[]),KT(()=>{w.q()},[E]),(0,Y.useImperativeHandle)(h,()=>({get cache(){return S._()},get scrollOffset(){return S.C()},get scrollSize(){return LT(S)},get viewportSize(){return S.p()},findItemIndex:S.$,getItemOffset:S.k,getItemSize:S.R,scrollToIndex:w.Y,scrollTo:w.V,scrollBy:w.X}),[]),o){let e=new Set(o);for(let[t,r]=S.S(n);t<=r;t++)e.add(t);xT([...e]).forEach(e=>{j.push(M(e))})}else for(let[e,t]=S.S(n);e<=t;e++)j.push(M(e));return(0,X.jsx)(u,{ref:v,style:{contain:`size style`,overflowAnchor:`none`,flex:`none`,position:`relative`,width:T?k:`100%`,height:T?`100%`:k,pointerEvents:O?`none`:void 0},children:j})});function tE(e,t){let[n,r]=(0,Y.useState)(!1),[i,a]=(0,Y.useState)(``),o=(0,Y.useRef)(!1);return{editing:n,draft:i,setDraft:a,begin:()=>{a(e),o.current=!1,r(!0)},commit:()=>{if(o.current)return;o.current=!0,r(!1);let n=i.trim();n.length===0||n===e||t(n)},cancel:()=>{o.current=!0,r(!1)}}}function nE({editor:e,className:t}){return(0,X.jsx)(`input`,{"data-slot":`title-input`,"aria-label":`Task title`,autoFocus:!0,value:e.draft,onChange:t=>e.setDraft(t.target.value),onBlur:e.commit,onKeyDown:t=>{t.key===`Enter`?(t.preventDefault(),e.commit()):t.key===`Escape`&&(t.preventDefault(),e.cancel())},className:c(`w-full min-w-0 rounded-sm border border-border bg-card px-1.5 py-0.5 outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`,t)})}function rE(e){let t=new Map,n=new Set,r;return{begin:e,editingId:()=>r?.id??null,subscribeSelection(e){return n.add(e),()=>{n.delete(e)}},snapshot:e=>r?.id===e?r.editor:null,subscribe(e,n){let r=t.get(e);return r||(r=new Set,t.set(e,r)),r.add(n),()=>{r.delete(n),r.size||t.delete(e)}},publish(e,i){let a=r?.id;if(r=e&&i.editing?{id:e,editor:i}:void 0,a!==r?.id)for(let e of n)e();for(let e of new Set([a,r?.id]))if(e)for(let n of t.get(e)??[])n()}}}var iE=(0,Y.createContext)(null),aE={editing:!1,draft:``,begin(){},setDraft(){},commit(){},cancel(){}};function oE({children:e,runs:t,onRename:n}){let[r,i]=(0,Y.useState)(),[a]=(0,Y.useState)(()=>rE(e=>i({run:e}))),o=t.find(e=>e.id===r?.run.id),s=tE(o?La(o):``,e=>{o&&n(o.id,e)});return(0,Y.useEffect)(()=>{r&&s.begin()},[r]),(0,Y.useEffect)(()=>{r&&!o&&(s.cancel(),i(void 0))},[r,o,s]),(0,Y.useLayoutEffect)(()=>{a.publish(o?.id,s)},[a,o?.id,s]),(0,X.jsx)(iE,{value:a,children:e})}function sE(e){let t=(0,Y.useContext)(iE);if(!t)throw Error(`Task title editor needs its page provider`);return{...(0,Y.useSyncExternalStore)((0,Y.useCallback)(n=>t.subscribe(e.id,n),[t,e.id]),(0,Y.useCallback)(()=>t.snapshot(e.id),[t,e.id]))??aE,begin:()=>t.begin(e)}}var cE=()=>null;function lE(){return uE}function uE(){}function dE(){let e=(0,Y.useContext)(iE);return(0,Y.useSyncExternalStore)(e?.subscribeSelection??lE,e?.editingId??cE)}var fE=(0,Y.createContext)(null);function pE(e,t,n=!1){let[r,i]=(0,Y.useState)(null),a=(0,Y.useRef)(new Map),o=(0,Y.useCallback)((e,t)=>{t?a.current.set(e,t):a.current.delete(e)},[]),s=(0,Y.useCallback)(e=>[...a.current.values()].some(t=>t.includes(e)),[]);return{props:mE(e,t,i,n?s:void 0),value:(0,Y.useMemo)(()=>({focused:r,revision:t,registerList:n?o:void 0}),[r,t,o,n])}}function mE(e,t,n,r){let i=(0,Y.useRef)(r);(0,Y.useLayoutEffect)(()=>{i.current=r});let a=(0,Y.useRef)(null),o=(0,Y.useRef)(null);return(0,Y.useLayoutEffect)(()=>{let e=o.current;if(!e||e.element.isConnected||document.activeElement!==document.body)return;let t=()=>{o.current===e&&(o.current=null,n?.(null))},r=()=>{let n=e.project?`${e.project}/${e.runId}`:e.runId;if(i.current&&!i.current(n)||document.activeElement!==document.body||e.element.isConnected)return t(),!0;let r=[...a.current?.querySelectorAll(`[data-run-id]`)??[]].filter(t=>t.dataset.runId===e.runId&&t.dataset.project===e.project).flatMap(e=>[...e.querySelectorAll(`a,button,input`)]),o=r.find(t=>e.control?t.dataset.taskControl===e.control:t.tagName===e.tag&&t.getAttribute(`aria-label`)===e.label)??r.find(e=>e.tagName===`A`);return o?.focus({preventScroll:!0}),!!o&&document.activeElement===o};if(r()||!a.current)return;let s=()=>{l.disconnect(),document.removeEventListener(`pointerdown`,c,!0),document.removeEventListener(`keydown`,c,!0)},c=()=>{t(),s()},l=new MutationObserver(()=>{r()&&s()});return document.addEventListener(`pointerdown`,c,!0),document.addEventListener(`keydown`,c,!0),l.observe(a.current,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`style`]}),s},[e,t]),{ref:a,onFocusCapture:e=>{let t=e.target,r=t.closest(`[data-run-id]`);o.current=r?{element:t,runId:r.dataset.runId,project:r.dataset.project,control:t.dataset.taskControl??null,label:t.getAttribute(`aria-label`),tag:t.tagName}:null,n?.(r?r.dataset.project?`${r.dataset.project}/${r.dataset.runId}`:r.dataset.runId:null)},onBlurCapture:e=>{let t=e.target,r=e.currentTarget;queueMicrotask(()=>{o.current?.element===t&&t.isConnected&&!r.contains(document.activeElement)&&(o.current=null,n?.(null))})}}}var hE=new WeakMap;function gE({items:e,itemKey:t,children:n,itemSize:r}){let[i]=gn(),a=(0,Y.useRef)(null),o=(0,Y.useRef)(null),[s,c]=(0,Y.useState)({available:null,margin:0}),[l,u]=(0,Y.useState)(null),d=dE(),f=(0,Y.useContext)(fE),p=e.map(t),m=fT(e.length,i.get(`tasks`)),h=s.available===!0&&m,g=(0,Y.useRef)(Symbol(`task-list`)),_=(0,Y.useRef)(()=>{});(0,Y.useLayoutEffect)(()=>{f?.registerList?.(g.current,p);let e=y.current;return e&&hE.set(e,{keys:p,handle:o,measure:()=>_.current()}),()=>{f?.registerList?.(g.current,null),e&&hE.delete(e)}});let v=mE(String(h),void 0,void 0,e=>p.includes(e)),y=v.ref;return(0,Y.useLayoutEffect)(()=>{let e=y.current,t=e?.closest(`[data-slot="main"]`);if(a.current=t??null,!e||!t){c(e=>e.available===!1?e:{available:!1,margin:0});return}let n=null,r=()=>{let r=Math.max(0,e.getBoundingClientRect().top-t.getBoundingClientRect().top+t.scrollTop);r!==n&&(n=r,c(e=>e.available===!0&&e.margin===r?e:{available:!0,margin:r}))};r(),_.current=r;let i=new ResizeObserver(r);for(let n=e;n&&n!==t;n=n.parentElement){i.observe(n);for(let e of n.parentElement?.children??[])i.observe(e)}return i.observe(t),()=>i.disconnect()},[]),(0,X.jsx)(`div`,{ref:y,"data-slot":`task-list-items`,"data-virtualized":h,onFocusCapture:e=>{v.onFocusCapture(e),u(e.target.closest(`[data-task-item]`)?.dataset.taskItem??null)},onBlurCapture:e=>{v.onBlurCapture(e),e.relatedTarget&&!e.currentTarget.contains(e.relatedTarget)&&u(null)},children:h?(0,X.jsx)(vE,{itemSize:r,items:e,keys:p,handle:o,scroll:a,margin:s.margin,focused:f?.focused??l,editing:d,children:n}):(s.available===null&&m?[]:e).map((t,r)=>(0,X.jsx)(`div`,{"data-task-item":p[r],"data-first":r===0,"data-last":r===e.length-1,className:`task-list-flat-item`,children:n(t,r)},p[r]))})}function _E({layout:e,revision:t,visibilityRevision:n=``,children:r,...i}){let a=pE(e,t,!0);return(0,X.jsx)(fE,{value:a.value,children:(0,X.jsx)(bE,{revision:t,visibilityRevision:`${e}:${n}`,children:(0,X.jsx)(`div`,{...i,...a.props,children:r})})})}function vE({items:e,keys:t,handle:n,scroll:r,margin:i,focused:a,editing:o,children:s,itemSize:c}){let[l,u]=(0,Y.useState)(!1),d=yE(r);return(0,Y.useLayoutEffect)(()=>{let e=r.current;if(!e)return;let t=new ResizeObserver(e=>{e.some(e=>e.contentRect.height>0)&&(u(!0),t.disconnect())});return t.observe(e),()=>t.disconnect()},[r]),(0,X.jsx)(eE,{ref:n,...c===void 0?{}:{itemSize:c},scrollRef:r,startMargin:i,keepMounted:[...new Set([...!l&&e.length?[0]:[],...pT(t,a),...pT(t,d),...pT(t,o)])],data:e,children:(n,r)=>(0,X.jsx)(`div`,{"data-task-item":t[r],"data-first":r===0,"data-last":r===e.length-1,children:s(n,r)},t[r])})}function yE(e){let[t,n]=(0,Y.useState)(null),r=(0,Y.useRef)(t);return(0,Y.useLayoutEffect)(()=>{let t=e.current;if(!t)return;let i=e=>{if(e.target!==t)return;let i=t.contains(document.activeElement)?document.activeElement.closest(`[data-task-item]`)?.dataset.taskItem??null:null;i!==r.current&&(r.current=i,(0,ld.flushSync)(()=>n(i)))};return document.addEventListener(`scroll`,i,{capture:!0,passive:!0}),()=>document.removeEventListener(`scroll`,i,{capture:!0})},[e]),t}var bE=class extends Y.Component{root={current:null};owner(){return this.root.current?.closest(`[data-slot="main"]`)??null}getSnapshotBeforeUpdate(e){if(e.revision===this.props.revision&&e.visibilityRevision===this.props.visibilityRevision)return null;let t=this.owner();if(!t||!this.root.current)return null;let n=t.getBoundingClientRect();for(let e of this.root.current.querySelectorAll(`[data-task-item]`)){let r=e.getBoundingClientRect();if(r.bottom>n.top&&r.top<n.bottom)return{key:e.dataset.taskItem,top:r.top,scrollTop:t.scrollTop}}return{key:null,top:0,scrollTop:t.scrollTop}}componentDidUpdate(e,t,n){let r=this.owner();if(!n||!r)return;let i=n.key===null?null:this.currentTop(n.key);i!==null&&Math.abs(i-n.top)>.5&&(r.scrollTop+=i-n.top),queueMicrotask(()=>{r.isConnected&&(0,ld.flushSync)(()=>{for(let e of this.root.current?.querySelectorAll(`[data-slot="task-list-items"]`)??[])hE.get(e)?.measure();r.scrollTop!==n.scrollTop&&r.dispatchEvent(new Event(`scroll`))})})}currentTop(e){for(let t of this.root.current?.querySelectorAll(`[data-task-item]`)??[])if(t.dataset.taskItem===e)return t.getBoundingClientRect().top;for(let t of this.root.current?.querySelectorAll(`[data-slot="task-list-items"]`)??[]){let n=hE.get(t),r=n?.keys.indexOf(e)??-1,i=n?.handle.current;if(r>=0&&i)return t.getBoundingClientRect().top+i.getItemOffset(r)}return null}render(){return(0,X.jsx)(`div`,{ref:this.root,style:{display:`contents`},children:this.props.children})}},xE=[{value:`all`,label:`All`},{value:`direct`,label:`Direct tasks`},{value:`automations`,label:`Automations`}];function SE(e){return e?xE:xE.filter(e=>e.value!==`automations`)}function CE(e,t){return e===`automations`&&!t?`all`:e}function wE(e){return e===`direct`||e===`automations`?e:`all`}function TE(e,t){return t===`all`||qe(e)===(t===`automations`)}function EE(e){return e===`all`?void 0:e===`automations`}function DE(e,t){let n={all:0,direct:0,automations:0};for(let r of e)Wa(r)||r.archived!==(t===`archived`)||(n.all+=1,qe(r)?n.automations+=1:n.direct+=1);return n}function OE(e,t,n,r,i){let a=qa(e).archived,o=a>=200;if(n===`all`)return i??(o?`200+`:a);let s=DE(t,`archived`)[n];return o&&r!==!1?`${s}+`:s}function kE(e){return e.rows.map(e=>e.run)}function AE(e,t){switch(e){case`Needs you`:return`pending`;case`Working`:return`running`;case`Archived`:return`neutral`;case`Finished`:return t.some(e=>Pe(e).bucket===`error`)?`danger`:`success`}}function jE(e,t,n){return Na(e,t,Ya(n))}var ME=(e,t)=>JSON.stringify([e,t]);function NE(e,t,n){let r=new Map,i=e.map(e=>{let{run:t}=e,n=ME(t.projectId,t.id);r.set(n,e);let i=t.delegation;return{...t,id:n,...i&&`parentRunId`in i?{delegation:{...i,parentRunId:ME(t.projectId,i.parentRunId)}}:{}}}),a=new Map;for(let e of n){let t=a.get(e.projectId);t?t.push(e):a.set(e.projectId,[e])}let o=new Map;for(let[e,t]of a)for(let[n,r]of Ya(t))o.set(ME(e,n),r);let s=e=>r.get(e.id);return Na(i,t,o).map(e=>({label:e.label,rows:e.rows.map(e=>({kind:`run`,run:s(e.run),queuePosition:e.queuePosition}))}))}function PE(e){return[e.run]}var FE=/^- \S+ — (?:(?:turn complete|step ".*" complete|step ".*" ended without done|session idle-closed) — |worktree setup (?:done in|failed —|skipped —) )/;function IE(e,t=3){let n=Vt(e,`## Progress log`);if(n<0)return[];let r=[];for(let i of e.slice(Xe(e,n)).split(`
|
|
21
|
-
`)){if(r.length>=t||i.startsWith(`## `))break;let e=i.trim();!e||FE.test(e)||r.push(e.replace(/^[-*] /,``))}return r}function LE({origin:e,counts:t,automations:n,onChange:r,compact:i=!1}){return(0,X.jsx)(`div`,{role:`group`,"aria-label":`Task origin`,"data-slot":`origin-filter`,className:c(`flex flex-wrap items-center`,i?`inline-flex rounded-md border border-border bg-card p-0.5 gap-0.5`:`gap-1.5`),children:SE(n).map(n=>{let a=n.value===e;return(0,X.jsxs)(`button`,{type:`button`,"data-origin":n.value,"aria-pressed":a,onClick:()=>r(n.value),className:c(i?`inline-flex min-h-11 items-center gap-1 rounded-sm px-2.5 text-xs font-medium text-muted-foreground hover:bg-muted hover:text-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-link-foreground md:min-h-0 md:h-8`:`inline-flex min-h-11 items-center gap-1.5 rounded-full border border-border px-3 text-[13px] font-medium text-muted-foreground hover:bg-muted hover:text-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-link-foreground`,a&&(i?`bg-accent-strong/15 text-accent-text`:`border-accent-strong bg-accent-strong/10 text-accent-text`)),children:[n.label,` `,(0,X.jsx)(Zf,{value:t[n.value]})]},n.value)})})}function RE({onExpand:e,onCollapse:t,compact:n=!1}){return(0,X.jsxs)(`div`,{"data-slot":`group-fold-controls`,className:c(`hidden flex-wrap items-center gap-1 md:flex`,!n&&`md:ml-auto md:gap-2`),children:[(0,X.jsx)(G,{type:`button`,variant:`ghost`,size:n?`sm`:`default`,className:n?`h-9 px-2 text-xs text-muted-foreground`:`min-h-11`,"data-action":`expand-groups`,onClick:e,children:`Expand groups`}),(0,X.jsx)(G,{type:`button`,variant:`ghost`,size:n?`sm`:`default`,className:n?`h-9 px-2 text-xs text-muted-foreground`:`min-h-11`,"data-action":`collapse-groups`,onClick:t,children:`Collapse groups`})]})}function zE(e,t){if(t===`danger`)return`contains failed tasks`;switch(e){case`Needs you`:return`needs you`;case`Working`:return`working`;case`Finished`:return`finished`;case`Archived`:return`archived`}}function BE({id:e,label:t,count:n,tone:r,folded:i,collapsed:a,onToggle:o,children:s}){let c=a?Lr:Tr;return(0,X.jsxs)(`section`,{"data-slot":`task-status-group`,"data-bucket":t,"data-folded":i,"data-tone":r,"aria-labelledby":`${e}-heading`,className:`flex flex-col gap-2.5`,children:[(0,X.jsx)(`h2`,{id:`${e}-heading`,className:`text-[13px] font-semibold text-foreground`,children:(0,X.jsxs)(`button`,{type:`button`,"data-slot":`status-group-toggle`,"aria-expanded":!a,"aria-controls":`${e}-rows`,"aria-label":`${t} ${n}${r===`danger`?`, contains failed tasks`:``}`,onClick:o,className:`inline-flex min-h-11 items-center gap-2 rounded-md pr-2 hover:text-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-link-foreground`,children:[(0,X.jsx)(c,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),(0,X.jsx)(J,{tone:r,role:`img`,"aria-label":zE(t,r),title:zE(t,r)}),(0,X.jsx)(`span`,{children:t}),` `,(0,X.jsx)(Zf,{value:n,className:`font-normal text-muted-foreground`})]})}),(0,X.jsx)(`div`,{id:`${e}-rows`,hidden:a,children:a?null:s})]})}function VE({projectId:e,runId:t,status:n,error:r,open:i}){let a=xe(e,t,!0),o=a.data===void 0?[]:IE(a.data);return(0,X.jsxs)(`div`,{"data-slot":`task-preview`,className:`flex flex-col gap-3 rounded-md bg-muted/50 p-4 text-xs`,children:[(0,X.jsx)(`p`,{className:`font-medium text-foreground`,children:n}),r?(0,X.jsx)(`p`,{"data-slot":`task-preview-error`,className:`break-words text-semantic-red`,children:r}):null,a.isPending?(0,X.jsx)(`p`,{role:`status`,className:`text-muted-foreground`,children:`Loading latest progress…`}):a.isError?(0,X.jsx)(`p`,{"data-slot":`task-preview-unavailable`,className:`text-muted-foreground`,children:`Latest progress is unavailable.`}):o.length===0?(0,X.jsx)(`p`,{className:`text-muted-foreground`,children:`No progress recorded yet.`}):(0,X.jsx)(`ul`,{"aria-label":`Latest progress`,className:`flex flex-col gap-1 text-muted-foreground`,children:o.map((e,t)=>(0,X.jsx)(`li`,{className:`break-words`,children:e},t))}),(0,X.jsx)(`div`,{children:i})]})}function HE(e,t){return e===`Finished`?`neutral`:AE(e,t)}var UE=`inline-flex min-h-11 max-md:min-w-11 md:min-h-0 md:h-8 items-center justify-center gap-1.5 border-b-2 border-transparent px-1 text-[13px] text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring`,WE=`border-accent-text font-medium text-foreground`;function GE({view:e,current:t,onSelect:n,count:r,children:i}){let a=e===t;return(0,X.jsxs)(`button`,{type:`button`,"data-slot":`overview-tab`,"data-view":e,"aria-pressed":a,onClick:()=>n(e),className:c(UE,a&&WE),children:[i,r===0?null:(0,X.jsxs)(`span`,{className:`tabular-nums`,children:[` · `,(0,X.jsx)(Zf,{value:r})]})]})}function KE({view:e,onSelect:t,activeCount:n,archivedCount:r,trailing:i}){return(0,X.jsxs)(`div`,{"data-slot":`tasks-view-tabs`,className:`flex flex-wrap items-center gap-x-4 gap-y-1`,children:[(0,X.jsx)(GE,{view:`active`,current:e,onSelect:t,count:n,children:`Active`}),(0,X.jsx)(GE,{view:`archived`,current:e,onSelect:t,count:r,children:`Archived`}),i]})}function qE(){return(0,X.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`—`})}function JE(e,t,n){return`${e} ${e===1?`task`:`tasks`}${t?` loaded`:``}${n?` matching “${n}”`:``}`}function YE({count:e,incomplete:t,needle:n}){return(0,X.jsx)(`span`,{"data-slot":`tasks-result-count`,className:c(`self-center truncate text-xs text-soft-foreground tabular-nums`,n===``&&!t&&`max-md:hidden`),children:JE(e,t,n)})}function XE({branch:e}){return(0,X.jsx)($f,{value:e,variant:`chip`})}function ZE({view:e,unread:t,finished:n,archivePending:r,markReadPending:i=!1,onMarkAllRead:a,onArchiveFinished:o,focusReturnRef:s}){let c=Y.useRef(!1),[l,u]=Y.useState(!1),d=n>0||r;return Y.useEffect(()=>{let e=window.matchMedia?.(gg);if(!e)return;let t=()=>{e.matches&&u(!1)};return t(),e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]),(0,X.jsxs)(X.Fragment,{children:[t>0?(0,X.jsxs)(G,{type:`button`,variant:`outline`,size:`sm`,"data-slot":`mark-all-read`,disabled:i,"aria-busy":i,className:`hidden h-8 md:inline-flex`,onClick:a,children:[(0,X.jsx)(Es,{className:`size-3.5`,"aria-hidden":`true`}),`Mark all read `,(0,X.jsx)(Zf,{value:t,className:`text-muted-foreground`})]}):null,e===`active`&&n>0?(0,X.jsxs)(G,{type:`button`,variant:`outline`,size:`sm`,"data-slot":`archive-finished`,className:`hidden h-8 md:inline-flex`,disabled:r,"aria-busy":r,onClick:o,children:[(0,X.jsx)(Fr,{className:`size-3.5`,"aria-hidden":`true`}),`Archive finished `,(0,X.jsx)(Zf,{value:n,className:`text-muted-foreground`})]}):null,e===`active`&&(d||t>0)?(0,X.jsxs)(Li,{open:l,onOpenChange:u,children:[(0,X.jsx)(Pi,{asChild:!0,children:(0,X.jsx)(G,{type:`button`,variant:`outline`,size:`icon`,className:`min-h-11 min-w-11 md:hidden`,"aria-label":`Task actions`,"aria-busy":r||i,children:(0,X.jsx)(Fs,{"aria-hidden":`true`})})}),(0,X.jsxs)(Fi,{align:`end`,className:`md:hidden`,onCloseAutoFocus:e=>{(c.current||window.matchMedia?.(`(min-width: 48rem)`).matches)&&(e.preventDefault(),c.current=!1,(s?.current??document).querySelector(`[data-slot="overview-tab"][data-view="active"]`)?.focus())},children:[d?(0,X.jsxs)(K,{disabled:r||n===0,onSelect:()=>{c.current=!0,o()},children:[(0,X.jsx)(Fr,{"aria-hidden":`true`}),r?`Archiving…`:`Archive finished (${n})`]}):null,t>0?(0,X.jsxs)(K,{disabled:i,onSelect:a,children:[(0,X.jsx)(Es,{"aria-hidden":`true`}),`Mark all read (${t})`]}):null]})]}):null]})}function QE(e){return e.id===`diff`?`Diff`:e.id===`reference`?`Reference`:e.id===`memory`?`Memory`:e.summaryLabel??e.label}function $E({columns:e,expandedColumns:t,columnsPending:n,onToggleColumn:r,detailedTable:i,onToggleDetailed:a}){return(0,X.jsxs)(sa,{children:[(0,X.jsx)(ra,{asChild:!0,children:(0,X.jsx)(G,{"data-slot":`task-columns-trigger`,variant:`outline`,className:`hidden h-9 md:inline-flex`,children:`Columns`})}),(0,X.jsxs)(aa,{align:`end`,className:`w-72`,children:[(0,X.jsx)(`h2`,{className:`mb-2 text-base font-medium`,children:`Visible columns`}),(0,X.jsx)(`p`,{className:`mb-4 text-xs text-muted-foreground`,children:`Task · Always visible`}),(0,X.jsx)(`div`,{className:`grid grid-cols-2 gap-3`,children:e.filter(e=>e.canFold).map(e=>(0,X.jsxs)(`label`,{className:`flex items-center gap-2 text-xs`,children:[(0,X.jsx)(`input`,{"data-column-toggle":e.id,type:`checkbox`,checked:oT(e.id,t),disabled:n,onChange:()=>r(e.id)}),QE(e)]},e.id))}),(0,X.jsx)(`p`,{className:`mt-4 text-xs text-muted-foreground`,children:`Saved automatically across task lists.`}),a?(0,X.jsx)(G,{variant:`outline`,className:`mt-4`,onClick:a,children:i?`Summary view`:`Resource columns`}):null]})]})}function eD({query:e,onQueryChange:t,searchPlaceholder:n,searchLabel:r,origin:i,originCounts:a,automations:o,onOriginChange:s,columns:c,expandedColumns:l,columnsPending:u,onToggleColumn:d,detailedTable:f,onToggleDetailed:p,groupLabels:m,onSetAllFolds:h,extraControls:g}){return(0,X.jsxs)(`div`,{"data-slot":`tasks-toolbar`,className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 basis-full items-center gap-2 md:contents`,children:[(0,X.jsxs)(`div`,{className:`relative min-w-0 flex-1 md:order-1 md:min-w-48`,children:[(0,X.jsx)(fr,{className:`pointer-events-none absolute top-1/2 left-2.5 size-3.5 -translate-y-1/2 text-soft-foreground`,"aria-hidden":`true`}),(0,X.jsx)(`input`,{type:`text`,value:e,onChange:e=>t(e.target.value),placeholder:n,"aria-label":r,className:`h-11 w-full rounded-md border border-input bg-card pr-3 pl-8 text-base text-foreground outline-none placeholder:text-soft-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 md:h-9 md:text-[13px]`})]}),g?(0,X.jsx)(`div`,{className:`shrink-0 md:order-3`,children:g}):null]}),(0,X.jsx)(`div`,{className:`md:order-2`,children:(0,X.jsx)(LE,{origin:i,counts:a,automations:o,onChange:s,compact:!0})}),(0,X.jsx)(`div`,{className:`hidden md:order-4 md:block`,children:(0,X.jsx)($E,{columns:c,expandedColumns:l,columnsPending:u,onToggleColumn:d,detailedTable:f,onToggleDetailed:p})}),m.length>0?(0,X.jsx)(`div`,{className:`hidden md:order-5 md:block`,children:(0,X.jsx)(RE,{onExpand:()=>h(m,!1),onCollapse:()=>h(m,!0),compact:!0})}):null]})}function tD({projectName:e,status:t,secondaryActions:n}){return{title:`Project tasks`,status:(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:[e?(0,X.jsx)(`span`,{"data-slot":`tasks-project-scope`,className:`hidden text-xs font-medium text-muted-foreground md:inline`,children:e}):null,t]}),secondaryActions:n,primaryAction:(0,X.jsx)(Ko,{asChild:!0,variant:`primary`,"data-slot":`new-task-inline`,children:(0,X.jsxs)(q,{to:`/new`,children:[(0,X.jsx)(nr,{"aria-hidden":`true`}),`New task`]})})}}function nD(e,t,n,r){if(!(!e||t<=0||r!==``))return(0,X.jsx)(Go,{summary:`${t} ${n} ${t===1?`task`:`tasks`} in this project.`,actions:(0,X.jsx)(G,{variant:`outline`,size:`sm`,asChild:!0,className:`max-md:min-h-11`,children:(0,X.jsx)(q,{to:`/new`,children:`Start another task`})})})}function rD(e,t){return e===void 0?`full`:Ho(t)}function iD(e){return{"data-presentation":e?`resources`:`summary`}}var aD=150;function oD(e,t){fe();let n=z(),[r,i]=Y.useState(``),[a,o]=Y.useState(``);Y.useEffect(()=>{let e=setTimeout(()=>o(r),aD);return()=>clearTimeout(e)},[r]);let s=e!==void 0&&qa(e).archived>=200,{data:c,isError:l,isPlaceholderData:u,hasNextPage:d,isFetchingNextPage:f,fetchNextPage:p,refetch:m}=S(a,t===`archived`&&(a!==``||s)),h=c?.pages,g=Y.useMemo(()=>h||l?{runs:(h??[]).flatMap(e=>e.runs),query:u?null:a,hasMore:d,loading:f,onLoadMore:()=>void(h?p():m()),failed:l}:void 0,[h,l,u,a,d,f,p,m]),_=a===``?h:n.getQueryData(k.runs.archived(``))?.pages,v=_===void 0?void 0:_.at(-1)?.nextCursor!=null;return{pages:Y.useMemo(()=>g&&{...g,plainHasMore:v},[g,v]),total:_?.[0]?.total,search:i}}function sD(e,t){return n=>(t===null?n.delete(e):n.set(e,t),n)}function cD(e){return e===void 0?`unknown`:new Intl.NumberFormat().format(e)}function lD(e,t){return`Input tokens: ${cD(e)}; output tokens: ${cD(t)}`}function uD(e,t,n=`compact`){let r=e===void 0?`—`:po(e),i=t===void 0?`—`:po(t);return n===`table`?`${r} / ${i}`:`IN ${r} · OUT ${i}`}function dD({inputTokens:e,outputTokens:t,variant:n=`compact`,omitWhenUnknown:r=!0,className:i,title:a}){return r&&e===void 0&&t===void 0?null:(0,X.jsx)(`span`,{"data-slot":`directional-usage`,"aria-label":lD(e,t),title:a,className:c(`font-mono tabular-nums`,i),children:uD(e,t,n)})}function fD({className:e,dot:t,shape:n=`filled`,pulse:r=!1,children:i,...a}){return(0,X.jsxs)(`span`,{"data-slot":`pill`,className:c(`inline-flex items-center gap-1.5 rounded-full bg-muted px-2.5 py-[3px] text-xs font-medium whitespace-nowrap text-muted-foreground`,e),...a,children:[t?(0,X.jsx)(J,{tone:t,shape:n,pulse:r}):null,i]})}function pD({model:e,showTokens:t,showCost:n,liveUsageSource:r=`stream`,openLink:i,extraActions:a,className:o}){let[s,l]=Y.useState(!1);return(0,X.jsxs)(sa,{open:s,onOpenChange:l,children:[(0,X.jsx)(ra,{asChild:!0,children:(0,X.jsxs)(`button`,{type:`button`,"data-slot":`task-usage-trigger`,"data-task-control":`usage`,"aria-expanded":s,"aria-label":`Usage and telemetry for ${e.title}`,className:c(`inline-flex h-7 max-w-full items-center gap-1 rounded-md border border-border bg-background px-2 font-mono text-xs text-muted-foreground tabular-nums transition-colors hover:border-control-border hover:bg-muted hover:text-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring max-md:min-h-11 max-md:px-2.5`,s&&`border-accent-strong bg-accent-strong/10 text-foreground`,o),children:[(0,X.jsx)(`span`,{className:`min-w-0 truncate`,children:e.usageSummary}),(0,X.jsx)(qr,{className:c(`size-3 shrink-0 opacity-70 transition-transform motion-reduce:transition-none`,s&&`rotate-180`),"aria-hidden":`true`})]})}),s?(0,X.jsx)(aa,{align:`end`,collisionPadding:8,"data-slot":`task-telemetry-popover`,className:`max-h-(--radix-popover-content-available-height) w-80 max-w-[calc(100vw-16px)] overflow-y-auto overscroll-contain p-3.5`,children:(0,X.jsx)(gD,{model:e,showTokens:t,showCost:n,liveUsageSource:r,openLink:i,extraActions:a})}):null]})}function mD({model:e,showTokens:t,showCost:n}){return(0,X.jsx)(hD,{model:e,sample:En(e.runId),showTokens:t,showCost:n})}function hD({model:e,sample:t,showTokens:n,showCost:r}){let{run:i}=e,a=jn(i,t),o=a.cpu.kind===`live`||a.mem.kind===`live`;return(0,X.jsxs)(`div`,{className:`flex flex-col gap-2.5`,children:[(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,X.jsx)(`span`,{className:`text-xs font-semibold tracking-[0.05em] text-accent-text uppercase`,children:`Task telemetry`}),(0,X.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:o?`Live`:`Recorded`})]}),(0,X.jsxs)(`dl`,{className:`grid grid-cols-2 gap-x-3 gap-y-2.5 text-xs`,children:[n?(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:`Tokens IN / OUT`}),(0,X.jsx)(`dd`,{className:`mt-0.5 font-mono text-foreground`,children:(0,X.jsx)(dD,{inputTokens:i.inputTokens,outputTokens:i.outputTokens,omitWhenUnknown:!1})})]}):null,r?(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:`Cost`}),(0,X.jsx)(`dd`,{className:`mt-0.5 font-mono text-foreground tabular-nums`,children:Vn(i.costUsd)||`—`})]}):null,(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:`CPU`}),(0,X.jsx)(`dd`,{"data-usage":`cpu`,"data-usage-kind":a.cpu.kind,title:a.cpu.title,className:`mt-0.5 font-mono text-foreground tabular-nums`,children:a.cpu.text||`—`})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:`Memory`}),(0,X.jsx)(`dd`,{"data-usage":`mem`,"data-usage-kind":a.mem.kind,title:a.mem.title,className:`mt-0.5 font-mono text-foreground tabular-nums`,children:a.mem.text||`—`})]}),e.branch?(0,X.jsxs)(`div`,{className:`col-span-2 border-t border-border pt-2`,children:[(0,X.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:`Branch`}),(0,X.jsx)(`dd`,{className:`mt-1`,children:(0,X.jsx)($f,{value:e.branch,variant:`chip`})})]}):null]})]})}function gD({model:e,showTokens:t,showCost:n,liveUsageSource:r,openLink:i,extraActions:a}){return(0,X.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[r===`stream`?(0,X.jsx)(mD,{model:e,showTokens:t,showCost:n}):(0,X.jsx)(hD,{model:e,sample:e.snapshotUsage,showTokens:t,showCost:n}),(0,X.jsx)(`div`,{className:`border-t border-border pt-2.5`,children:(0,X.jsx)(VE,{projectId:e.projectId,runId:e.runId,status:e.status.label,error:e.run.error,open:(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[i,a]})})})]})}function _D({children:e}){return(0,X.jsx)(G,{asChild:!0,variant:`outline`,size:`sm`,className:`max-md:min-h-11`,children:e})}var vD=new Set(eT);function yD(e,t){return nT.filter(n=>vD.has(n.id)?n.id===`task`?!0:n.id===`reference`&&!t?!1:oT(n.id,e):!1)}function bD(e){return e.map(e=>e.id===`task`?`minmax(0, 1fr)`:e.width??`100px`).join(` `)}function xD(e,t,n){return c(n?`line-clamp-2 min-w-0 whitespace-normal rounded-sm text-[13.5px] leading-[1.35]`:`min-w-0 truncate rounded-sm text-[13px] leading-[18px]`,e?`font-semibold text-foreground`:t?`font-normal text-foreground`:`font-medium text-foreground`,`focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-link-foreground`)}var SD={ask:{label:`Ask`,tone:`text-semantic-amber`},permission:{label:`Permission`,tone:`text-semantic-amber`},review:{label:`Review`,tone:`text-accent-text`},error:{label:`Error`,tone:`text-semantic-red`}};function CD({preview:e}){if(!e)return null;let t=SD[e.kind];return(0,X.jsxs)(`p`,{"data-slot":`task-state-preview`,"data-preview-kind":e.kind,title:e.text,className:`mt-1 flex min-w-0 items-baseline gap-1.5 text-xs leading-[1.35] text-muted-foreground`,children:[(0,X.jsx)(`span`,{className:c(`shrink-0 text-xs font-semibold`,t.tone),children:t.label}),(0,X.jsx)(`span`,{className:`min-w-0 truncate`,children:e.text})]})}function wD({badge:e}){return(0,X.jsxs)(`span`,{"data-slot":`task-automation-badge`,"data-origin":`automation`,title:`Automation ${e.id}`,className:`inline-flex max-w-[180px] shrink-0 items-center gap-1 truncate rounded-full border border-info/30 bg-info/10 px-2 py-px text-xs font-medium text-semantic-info`,children:[(0,X.jsx)(Ur,{className:`size-2.5 shrink-0`,"aria-hidden":`true`}),(0,X.jsx)(`span`,{className:`truncate`,children:e.label})]})}function TD({name:e,href:t}){let n=`inline-flex h-[18px] max-w-[140px] shrink-0 items-center truncate rounded-md border border-border bg-muted px-1.5 font-mono text-xs leading-none font-medium text-foreground`;return t?(0,X.jsx)(H,{to:t,"data-slot":`task-project`,title:e,className:c(n,`hover:border-control-border hover:bg-muted/80`),children:e}):(0,X.jsx)(`span`,{"data-slot":`task-project`,className:n,title:e,children:e})}function ED({scoped:e,to:t,className:n,title:r,children:i,...a}){return e?(0,X.jsx)(q,{to:t,title:r,className:n,...a,children:i}):(0,X.jsx)(H,{to:t,title:r,className:n,...a,children:i})}function DD({run:e,to:t,title:n,unread:r,unreadTone:i,readDone:a,isWorker:o,pinned:s,automationBadge:l,scoped:u=!0,onTogglePin:d,lines:f=1,compact:p=!1}){let m=sE(e);if(m.editing)return(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,"data-slot":`table-title-editor`,children:[(0,X.jsx)(nE,{editor:m,className:`basis-full text-[13px] font-medium`}),(0,X.jsx)(G,{size:`sm`,"aria-label":`Save title`,onMouseDown:e=>e.preventDefault(),onClick:m.commit,children:`Save`}),(0,X.jsx)(G,{size:`sm`,variant:`outline`,"aria-label":`Cancel rename`,onMouseDown:e=>e.preventDefault(),onClick:m.cancel,children:`Cancel`})]});let h=c(f===2?`line-clamp-2 min-w-0 whitespace-normal rounded-sm text-[13px] leading-[18px]`:`min-w-0 truncate rounded-sm text-[13px] leading-[18px]`,r?`font-semibold text-foreground`:a?`font-normal text-foreground`:`font-medium text-foreground`,`focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-link-foreground`);return(0,X.jsxs)(`span`,{className:c(`flex min-w-0 items-center gap-1.5`,p||f===1?`h-[18px]`:`min-h-[18px]`),children:[o?(0,X.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:`Worker`}):null,(0,X.jsx)(ED,{scoped:u,to:t,title:n,"data-task-control":`title`,className:h,children:n}),l?(0,X.jsx)(wD,{badge:l}):null,r?(0,X.jsx)(J,{tone:i,role:`img`,"aria-label":`unread`,title:`Unread — not opened since it finished`,className:`shrink-0`}):null,(0,X.jsx)(`button`,{type:`button`,"data-slot":`row-rename`,"aria-label":`Rename task`,onClick:m.begin,className:`shrink-0 rounded-sm p-0.5 text-soft-foreground opacity-0 transition-opacity group-hover/row:opacity-100 hover:text-foreground focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:(0,X.jsx)(Ys,{className:`size-3`,"aria-hidden":`true`})}),(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`flex-1`}),d?(0,X.jsx)(tg,{pinned:s,onToggle:d,className:`size-[19px] opacity-0 group-hover/row:opacity-100 focus-visible:opacity-100 no-hover:opacity-100 data-[pinned=true]:opacity-100`}):null]})}function OD({model:e,scoped:t,onTogglePin:n,compact:r}){return(0,X.jsx)(DD,{run:e.run,to:e.href,title:e.title,unread:e.unread,unreadTone:e.unreadTone,readDone:e.readDone,isWorker:e.isWorker,pinned:e.pinned,automationBadge:e.automationBadge,scoped:t,onTogglePin:n?t=>n(e,t):void 0,compact:r})}function kD({model:e,scoped:t,showProject:n,onTogglePin:r,clamp:i}){return(0,X.jsxs)(`span`,{className:c(`flex min-w-0 items-center gap-1.5`,i?`items-start`:`min-h-[18px]`),children:[n&&e.projectName?(0,X.jsx)(TD,{name:e.projectName,href:e.projectHref}):null,e.isWorker?(0,X.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:`Worker`}):null,(0,X.jsx)(ED,{scoped:t,to:e.href,title:e.title,"data-task-control":`title`,className:c(xD(e.unread,e.readDone,i),i&&`flex-1`),children:e.title}),!i&&e.automationBadge?(0,X.jsx)(wD,{badge:e.automationBadge}):null,e.unread?(0,X.jsx)(J,{tone:e.unreadTone,role:`img`,"aria-label":`unread`,title:`Unread — not opened since it finished`,className:c(`shrink-0`,i&&`mt-1.5`)}):null,i?null:(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`flex-1`}),r?(0,X.jsx)(tg,{pinned:e.pinned,onToggle:t=>r(e,t),className:i?`-mt-0.5 shrink-0`:`size-[19px] opacity-0 group-hover/row:opacity-100 focus-visible:opacity-100 no-hover:opacity-100 data-[pinned=true]:opacity-100`}):null]})}function AD({model:e,showProject:t,showAutomationOnMeta:n,trailing:r}){let{status:i,scheduled:a,queuePosition:o,runnerModel:s,tags:c}=e;return(0,X.jsxs)(`div`,{"data-slot":`task-meta-line`,className:`mt-1 flex min-w-0 flex-wrap items-center gap-x-1.5 gap-y-1 text-xs text-muted-foreground`,children:[(0,X.jsxs)(fD,{dot:i.tone,shape:i.shape,pulse:i.pulse,title:a?.title??i.label,className:`shrink-0 py-0.5`,children:[i.label,a?(0,X.jsxs)(`span`,{className:`tabular-nums`,children:[` `,a.label]}):null]}),t&&e.projectName?(0,X.jsx)(TD,{name:e.projectName,href:e.projectHref}):null,n&&e.automationBadge?(0,X.jsx)(wD,{badge:e.automationBadge}):null,s?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,X.jsx)(`span`,{"data-slot":`task-runner-model`,className:`min-w-0 truncate`,children:s})]}):null,e.run.status===`queued`&&o!==null?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,X.jsxs)(`span`,{"data-slot":`queue-note`,className:`shrink-0 tabular-nums`,children:[`#`,o,` in queue`]})]}):null,c.map(e=>(0,X.jsx)(`span`,{"data-slot":`task-tag`,className:`rounded bg-muted px-1.5 py-px text-xs text-soft-foreground`,children:e},e)),r]})}function jD({model:e,onSetRead:t,onArchive:n,busy:r}){return!t&&!n?null:(0,X.jsxs)(X.Fragment,{children:[t&&e.canToggleRead?(0,X.jsxs)(G,{type:`button`,variant:`outline`,size:`sm`,"data-action":e.unread?`mark-read`:`mark-unread`,"aria-label":e.unread?`Mark ${e.title} read`:`Mark ${e.title} unread`,disabled:r,onClick:()=>t(e,e.unread),className:`max-md:min-h-11`,children:[e.unread?(0,X.jsx)(fi,{className:`size-3.5`,"aria-hidden":`true`}):(0,X.jsx)(Is,{className:`size-3.5`,"aria-hidden":`true`}),e.unread?`Mark read`:`Mark unread`]}):null,n&&e.canArchive?(0,X.jsxs)(G,{type:`button`,variant:`outline`,size:`sm`,"data-action":e.run.archived?`unarchive-run`:`archive-run`,"aria-label":e.run.archived?`Restore ${e.title} to the active list`:`Archive ${e.title}`,disabled:r,onClick:()=>n(e,!e.run.archived),className:`max-md:min-h-11`,children:[e.run.archived?(0,X.jsx)(ws,{className:`size-3.5`,"aria-hidden":`true`}):(0,X.jsx)(Fr,{className:`size-3.5`,"aria-hidden":`true`}),e.run.archived?`Unarchive`:`Archive`]}):null]})}function MD({model:e,scoped:t}){return e.references.length===0?(0,X.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`—`}):t?(0,X.jsx)(Zh,{run:e.run,reference:e.references[0],compact:!0}):(0,X.jsx)(eg,{references:e.references,maxVisible:1,taskTitle:e.title,projectId:e.projectId,runId:e.runId,repoBase:e.repoBase,compact:!0})}function ND({model:e,scoped:t,showTokens:n,showCost:r,liveUsageSource:i,onSetRead:a,onArchive:o,busy:s,className:c}){return(0,X.jsx)(pD,{model:e,showTokens:n,showCost:r,liveUsageSource:i,className:c,openLink:(0,X.jsx)(_D,{children:(0,X.jsxs)(ED,{scoped:t,to:e.href,"data-task-control":`open`,children:[`Open task`,(0,X.jsxs)(`span`,{className:`sr-only`,children:[`: `,e.title]})]})}),extraActions:(0,X.jsx)(jD,{model:e,onSetRead:a,onArchive:o,busy:s})})}function PD({column:e,hasUsageColumn:t,...n}){let{model:r,now:i,scoped:a,showProject:o,allowRename:s,compact:l,onTogglePin:u}=n;switch(e.id){case`task`:return(0,X.jsxs)(`div`,{role:`cell`,"data-column-id":`task`,className:c(`min-w-0 pr-3`,l?`py-1.5`:`py-2.5`),children:[s?(0,X.jsx)(OD,{model:r,scoped:a,onTogglePin:u,compact:l}):(0,X.jsx)(kD,{model:r,scoped:a,showProject:o,onTogglePin:u,clamp:!1}),(0,X.jsx)(AD,{model:r,showProject:!1,showAutomationOnMeta:!1,trailing:t?null:(0,X.jsx)(ND,{...n,className:`ml-auto h-6 px-1.5 text-xs`})}),(0,X.jsx)(CD,{preview:r.statePreview})]});case`runner`:return(0,X.jsx)(`div`,{role:`cell`,"data-column-id":`runner`,className:`min-w-0 truncate text-xs text-muted-foreground`,title:r.runnerModel,children:r.runnerModel??(0,X.jsx)(`span`,{className:`text-soft-foreground`,children:`—`})});case`workflow`:return(0,X.jsx)(`div`,{role:`cell`,"data-column-id":`workflow`,className:`min-w-0 truncate text-xs text-muted-foreground`,title:r.workflow,children:r.workflow});case`branch`:return(0,X.jsx)(`div`,{role:`cell`,"data-column-id":`branch`,className:`min-w-0 overflow-hidden`,children:r.branch?(0,X.jsx)($f,{value:r.branch,variant:`chip`}):(0,X.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`—`})});case`diff`:return(0,X.jsx)(`div`,{role:`cell`,"data-column-id":`diff`,className:`text-xs`,children:r.diffStat?(0,X.jsx)(Xf,{stat:r.diffStat}):(0,X.jsx)(`span`,{className:`text-soft-foreground`,children:`—`})});case`reference`:return(0,X.jsx)(`div`,{role:`cell`,"data-column-id":`reference`,className:`min-w-0`,children:(0,X.jsx)(MD,{model:r,scoped:a})});case`usage`:return(0,X.jsx)(`div`,{role:`cell`,"data-column-id":`usage`,className:`flex justify-end`,children:(0,X.jsx)(ND,{...n})});case`started`:return(0,X.jsx)(`div`,{role:`cell`,"data-column-id":`started`,className:`text-right text-xs text-muted-foreground`,children:(0,X.jsx)(Qf,{iso:r.startedAt,now:i})});default:return null}}function FD(e){return e instanceof Element&&!!e.closest(`a, button, input, [role="dialog"]`)}function ID(e,t){return e.run===t.run&&e.projectName===t.projectName&&e.projectHref===t.projectHref&&e.runnerModel===t.runnerModel&&e.usageSummary===t.usageSummary&&e.queuePosition===t.queuePosition&&e.automationBadge?.label===t.automationBadge?.label&&e.tags.length===t.tags.length&&e.tags.every((e,n)=>e===t.tags[n])}function LD(e,t){let{model:n,...r}=e,{model:i,...a}=t;return ID(n,i)&&Object.keys(r).every(e=>r[e]===a[e])}var RD=Y.memo(function({rowIndex:e,columns:t,gridTemplate:n,rowSlot:r,...i}){let{model:a,scoped:o}=i,s=xa(),l=xn(),u=e=>o?s(e):l(e),d=t.some(e=>e.id===`usage`);return(0,X.jsx)(`div`,{role:`row`,"aria-rowindex":e,"data-slot":r,"data-task-row":`true`,"data-status":a.run.status,"data-urgent":a.urgent?`true`:void 0,"data-run-id":a.runId,"data-project":a.projectId,style:{gridTemplateColumns:n},onClick:e=>{FD(e.target)||u(a.href)},className:c(`group/row grid cursor-pointer items-center gap-x-3.5 border-b border-border transition-colors hover:bg-muted/70`,a.urgent&&`bg-pending/[0.03]`),children:t.map(e=>(0,X.jsx)(PD,{column:e,hasUsageColumn:d,...i},e.id))})},LD),zD=Y.memo(function({model:e,now:t,scoped:n,showProject:r,showTokens:i,showCost:a,liveUsageSource:o,onTogglePin:s,onSetRead:c,onArchive:l,busy:u,cardSlot:d}){let f=xa(),p=xn(),m=e=>n?f(e):p(e);return(0,X.jsxs)(`article`,{"data-slot":d,"data-task-row":`true`,"data-status":e.run.status,"data-urgent":e.urgent?`true`:void 0,"data-run-id":e.runId,"data-project":e.projectId,onClick:t=>{FD(t.target)||m(e.href)},className:`flex cursor-pointer flex-col gap-1.5 border-b border-border py-2.5`,children:[(0,X.jsx)(`div`,{"data-slot":`mobile-task-title-row`,children:(0,X.jsx)(kD,{model:e,scoped:n,showProject:!1,onTogglePin:s,clamp:!0})}),(0,X.jsx)(AD,{model:e,showProject:r,showAutomationOnMeta:!0}),(0,X.jsx)(CD,{preview:e.statePreview}),(0,X.jsxs)(`div`,{"data-slot":`mobile-task-meta`,className:`mt-0.5 flex min-w-0 flex-wrap items-center gap-x-2.5 gap-y-1 text-xs text-muted-foreground`,children:[(0,X.jsx)(`span`,{"data-slot":`mobile-task-workflow`,className:`min-w-0 truncate`,children:e.workflow}),e.references.length>0?(0,X.jsx)(MD,{model:e,scoped:n}):null,e.queuePosition===null?e.diffStat?(0,X.jsx)(Xf,{stat:e.diffStat}):null:(0,X.jsxs)(`span`,{"data-slot":`queue-note`,className:`tabular-nums`,children:[`#`,e.queuePosition,` in queue`]}),(0,X.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-2`,children:[(0,X.jsx)(pD,{model:e,showTokens:i,showCost:a,liveUsageSource:o,openLink:(0,X.jsx)(_D,{children:(0,X.jsxs)(ED,{scoped:n,to:e.href,"data-task-control":`open`,children:[`Open task`,(0,X.jsxs)(`span`,{className:`sr-only`,children:[`: `,e.title]})]})}),extraActions:(0,X.jsx)(jD,{model:e,onSetRead:c,onArchive:l,busy:u})}),(0,X.jsx)(Qf,{iso:e.startedAt,now:t})]})]})]})},LD);function BD({items:e,density:t,now:n,showHeader:r=!0,showProject:i=!1,showReferences:a=!0,expandedColumns:o=aT(void 0),showTokens:s=!0,showCost:l=!0,scopedLinks:u=!0,liveUsageSource:d=`stream`,allowRename:f=!1,onTogglePin:p,onArchive:m,onSetRead:h,busy:g=!1,tableSlot:_=`tasks-summary`,rowSlot:v=`task-summary-row`,cardSlot:y=`task-card`}){let b=Y.useMemo(()=>yD(o,a),[o,a]),x=Y.useMemo(()=>bD(b),[b]);if(t===`card`)return(0,X.jsx)(hd,{children:(0,X.jsx)(`div`,{"data-slot":`task-cards`,"data-task-table":`true`,"data-density":`card`,className:`flex flex-col rounded-lg border border-card-edge bg-card px-3 shadow-card`,children:(0,X.jsx)(gE,{itemSize:123,items:e,itemKey:e=>e.key,children:e=>(0,X.jsx)(zD,{model:e,now:n,scoped:u,showProject:i,showTokens:s,showCost:l,liveUsageSource:d,onTogglePin:p,onSetRead:h,onArchive:m,busy:g,cardSlot:y},e.key)})})});let S=t===`compact`;return(0,X.jsx)(hd,{children:(0,X.jsx)(`div`,{"data-slot":_,"data-task-table":`true`,"data-density":t,"data-head":r,"data-reference-column":a,className:`overflow-x-auto`,children:(0,X.jsxs)(`div`,{role:`table`,"aria-rowcount":e.length+1,className:`rounded-lg border border-card-edge bg-card px-4 shadow-card`,children:[(0,X.jsx)(`div`,{role:`row`,"aria-rowindex":1,"data-slot":`task-table-head`,style:{gridTemplateColumns:x},className:c(`grid items-center gap-x-3.5`,!r&&`sr-only`),children:b.map(e=>(0,X.jsx)(`div`,{role:`columnheader`,"data-column-id":e.id,className:c(`flex h-8 items-center border-b border-border text-xs font-medium tracking-[0.04em] text-muted-foreground uppercase`,e.align===`right`&&`justify-end text-right`),children:e.summaryLabel??e.label},e.id))}),(0,X.jsx)(gE,{itemSize:S?56:63,items:e,itemKey:e=>e.key,children:(e,t)=>(0,X.jsx)(RD,{model:e,rowIndex:t+2,columns:b,gridTemplate:x,now:n,scoped:u,showProject:i,allowRename:f,showTokens:s,showCost:l,liveUsageSource:d,compact:S,onTogglePin:p,onSetRead:h,onArchive:m,busy:g,rowSlot:v},e.key)})]})})})}var VD=new Set([`done`,`failed`,`cancelled`]);function HD(e,t=240){let n=e.replace(/\s+/g,` `).trim();return n.length<=t?n:`${n.slice(0,t-1).trimEnd()}…`}function UD(e,t){if(e.statePreview)return e.statePreview;if(!e.archived){if(e.hasPendingPermission)return{kind:`permission`,text:`Permission requested`};if(t.rung===`needs-you`)return{kind:`ask`,text:`Waiting for your reply`};if(e.status===`review`)return{kind:`review`,text:`Ready for review`}}if(e.status===`failed`&&!qt(e)&&e.error){let t=HD(e.error);if(t)return{kind:`error`,text:t}}}function WD(e,t){let n=e.runner?A(t,e.runner):void 0,r=e.model?.trim()||void 0;return n&&r?`${n} · ${r}`:n??r}function GD(e,t){let n=[],r=t.showTokens&&(e.inputTokens!==void 0||e.outputTokens!==void 0)?(e.inputTokens??0)+(e.outputTokens??0):0;r>0&&n.push(po(r));let i=t.showCost?Vn(e.costUsd):``;return i&&n.push(i),n}function KD(e,t,n){return e.inputTokens!==void 0||e.outputTokens!==void 0||e.costUsd!==void 0||!!(t||n||e.branch)}function qD(e,t,n){let r=GD(e,n),i=jn(e,t);return r.length<2&&i.cpu.kind===`live`&&i.cpu.text?r.push(i.cpu.text):r.length===0&&i.mem.text&&r.push(i.mem.text),{label:r.length>0?r.join(` · `):`Usage`,hasData:r.length>0||KD(e,i.cpu.text,i.mem.text)}}function JD({run:e,queuePosition:t=null,runners:n,automationName:r,repoBase:i,now:a,showTokens:o=!0,showCost:s=!0}){let c=Pe(e),l=op(e,c),u=Nn(e,a===void 0?void 0:new Date(a)),d=qD(e,e.usage,{showTokens:o,showCost:s}),f=e.automationId;return{key:e.id,runId:e.id,tags:[],run:e,href:`/tasks/${e.id}`,title:La(e),isWorker:Wa(e),unread:Za(e),readDone:ru(e),canToggleRead:Qa(e),unreadTone:au(e),attention:c,status:l,urgent:jt(e),scheduled:u,pinned:!!e.pinned,queuePosition:t,automationBadge:f===void 0?void 0:{id:f,label:r?.(f)??f},runnerModel:WD(e,n),statePreview:UD(e,c),workflow:Gn(e),branch:e.branch,diffStat:e.diffStat,references:Fn(e,i),repoBase:i,startedAt:e.startedAt??e.createdAt,usageSummary:d.label,hasUsageData:d.hasData,snapshotUsage:e.usage,canArchive:e.archived||VD.has(e.status)}}function YD(e){return typeof e==`string`?e:e.pathname??``}function XD({task:e,queuePosition:t=null,runners:n,automationName:r,now:i,showTokens:a=!0,showCost:o=!0}){let s=e.run;return{...JD({run:s,queuePosition:t,runners:n,automationName:r?()=>r(e):void 0,repoBase:e.project?.repoUrl,now:i,showTokens:a,showCost:o}),key:`${s.projectId}/${s.id}`,projectId:s.projectId,projectName:e.projectName,projectHref:YD(ba(s.projectId,`/`)),tags:e.tags,href:YD(ba(s.projectId,`/tasks/${s.id}`)),references:Fn(s,e.project?.repoUrl,s.projectId)}}var ZD=`cez-task-list-folds`,QD=`cez-task-list-folds-changed`;function $D(e,t,n=new Set){let[r,i]=(0,Y.useState)(()=>Tg(ZD));(0,Y.useEffect)(()=>{let e=e=>{e instanceof StorageEvent&&e.key!==null&&e.key!==`cez-task-list-folds`||i(e instanceof CustomEvent?e.detail:Tg(ZD))};return window.addEventListener(`storage`,e),window.addEventListener(QD,e),()=>{window.removeEventListener(`storage`,e),window.removeEventListener(QD,e)}},[]);let a=(0,Y.useCallback)(n=>JSON.stringify([e,t,n]),[e,t]),o=(0,Y.useCallback)(e=>{i(t=>{let n=e(t);return Eg(n,ZD),queueMicrotask(()=>window.dispatchEvent(new CustomEvent(QD,{detail:n}))),n})},[]),s=e=>r[a(e)]===!0;return{isFolded:s,isCollapsed:e=>s(e)&&!n.has(e),toggle:e=>o(t=>({...t,[a(e)]:t[a(e)]!==!0})),setAll:(e,t)=>o(n=>({...n,...Object.fromEntries(e.map(e=>[a(e),t]))})),only:(0,Y.useCallback)((e,t)=>o(n=>({...n,...Object.fromEntries(t.map(t=>[a(t),t!==e]))})),[o,a])}}function eO(e,t,n,r){let i=$D(e,t,n),a=(0,Y.useRef)(r);a.current=r;let[o,s]=Xo(),c=t===`active`?Va(o.get(Ua)):null,{only:l}=i;return(0,Y.useEffect)(()=>{c!==null&&(l(c,Ka),a.current?.(),s(e=>(e.delete(Ua),e)))},[c,l,s]),i}function tO(e){let t=e?.capabilities,n=t?.tokenMetrics!==!1;return{tokens:t?.tokenUsageMetrics??n,cost:t?.costMetrics??n}}function nO(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:{}}function rO(){let e=z(),t=x(),n=Y.useRef(0),r=Y.useRef(0),i=Y.useRef(Promise.resolve()),a=Y.useMemo(()=>aT(t.data?.taskTable?.expandedColumns),[t.data?.taskTable?.expandedColumns]),o=Y.useCallback(t=>{if(!nT.find(e=>e.id===t)?.canFold)return;let a=e.getQueryData(h.uiState);if(a===void 0)return;let o=nO(a?.taskTable),s={...o,expandedColumns:sT(o.expandedColumns,t)};e.setQueryData(h.uiState,{...a,taskTable:s});let c=++n.current;r.current=c;let l=i.current.then(async()=>{let t=await Ct({taskTable:s},{keepalive:!0});c===r.current&&e.setQueryData(h.uiState,t)});i.current=l.catch(t=>{B(t instanceof Error?t.message:String(t),{tone:`danger`}),c===r.current&&e.invalidateQueries({queryKey:h.uiState})})},[e]);return{expandedColumns:a,isExpanded:Y.useCallback(e=>oT(e,a),[a]),toggleColumn:o,isPending:t.isPending}}var iO=()=>void 0;function aO({runs:e,view:t,onViewChange:n,onArchiveFinished:r,archivePending:i=!1,onMarkAllRead:a,onRename:o,onTogglePin:s,now:c=Date.now(),showTokens:l=!0,showCost:u=!0,expandedColumns:d=aT(void 0),onToggleColumn:f=()=>void 0,columnsPending:p=!1,projectName:m,runners:h,error:g,onRetry:_,archivedPages:v,archivedTotal:y,onArchivedSearch:b,origin:x,onOriginChange:S,automations:C,urlQuery:w=``,onQueryChange:T,foldScope:E=`project`,automationName:D=iO}){let[O,k]=oO(w,T);Y.useEffect(()=>{b?.(O.trim())},[b,O]);let[A,j]=sO(x,S,C),[M,ee]=Y.useState(!1),te=_g(),N=Y.useMemo(()=>e??[],[e]),P=Y.useMemo(()=>cO({all:N,view:t,query:O,origin:A,archivedPages:v,archivedTotal:y,automationName:D}),[N,t,O,A,v,y,D]),{groups:ne,needle:re}=P,F=Y.useMemo(()=>dT({tokens:l,cost:u}),[l,u]),ie=Y.useMemo(()=>uT(),[]),ae=eO(E,t,new Set(re?ne.map(e=>e.label):[]),()=>k(``)),I=t===`archived`?void 0:s;return(0,X.jsx)(oE,{runs:v?[...N,...v.runs]:N,onRename:o,children:(0,X.jsx)(Jo,{route:`tasks`,density:rD(e,P.visibleCount),headerSpacing:`compact`,rootProps:iD(M),bodyClassName:`gap-3`,header:tD({projectName:m,status:(0,X.jsx)(KE,{view:t,onSelect:n,activeCount:P.activeCount,archivedCount:P.archivedCount,trailing:e!==void 0&&ne.length>0?(0,X.jsx)(YE,{count:P.visibleCount,incomplete:P.incomplete,needle:re}):null}),secondaryActions:(0,X.jsx)(ZE,{view:t,unread:P.unread,finished:P.finished,archivePending:i,onMarkAllRead:()=>a(EE(A)),onArchiveFinished:()=>r(EE(A))})}),sparseFooter:nD(e!==void 0,P.visibleCount,t,re),children:(0,X.jsxs)(_E,{layout:`${te}:${M}`,revision:ne,visibilityRevision:JSON.stringify([Ja.map(ae.isCollapsed),t,d]),className:`flex min-w-0 flex-1 flex-col gap-3`,children:[(0,X.jsx)(eD,{query:O,onQueryChange:k,searchPlaceholder:`Search tasks or automations…`,searchLabel:`Search tasks`,origin:A,originCounts:P.originTotals,automations:C,onOriginChange:j,columns:M?F:ie,expandedColumns:d,columnsPending:p,onToggleColumn:f,detailedTable:M,onToggleDetailed:()=>ee(e=>!e),groupLabels:ne.map(e=>e.label),onSetAllFolds:ae.setAll}),(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[e===void 0?(0,X.jsx)(uO,{error:g,onRetry:_}):(0,X.jsx)(lO,{view:t,query:O,origin:A,onShowAll:()=>{k(``),j(`all`)},groups:ne,folds:ae,grouped:{desktop:te,detailedTable:M,columns:F,expandedColumns:d,onToggleColumn:f,columnsPending:p,onRename:o,onTogglePin:I,now:c,showTokens:l,showCost:u,runners:h,automationName:D}}),t===`archived`&&v?(0,X.jsx)(dO,{pages:v}):null]})]})})})}function oO(e,t){let[n,r]=Y.useState(e),i=Y.useRef(e),a=Y.useRef(e),o=Y.useRef([]);return Y.useEffect(()=>{if(e===i.current)return;i.current=e;let t=o.current.indexOf(e);o.current=t===-1?[]:o.current.slice(t+1),t===-1&&e!==a.current&&r(e)},[e]),Y.useEffect(()=>{a.current=n.trim(),t?.(n,e=>{o.current.push(e)})},[t,n]),[n,r]}function sO(e,t,n){let[r,i]=Y.useState(`all`);return[CE(e??r,n),t??i]}function cO({all:e,view:t,query:n,origin:r,archivedPages:i,archivedTotal:a,automationName:o}){let s=n.trim(),c=e=>e.automationId===void 0?``:o(e.automationId)??e.automationId,l=i?.query===s,u=new Set(l?i.runs.map(e=>e.id):[]),d=Xa(e,l||s===``?i?.runs??[]:[]).slice(e.length),f=Un(e,n,c),p=new Set(f.map(e=>e.id)),m=Un(e.filter(e=>u.has(e.id)&&!p.has(e.id)),``),h=e=>TE(e,r),g=jE([...f,...m,...Un(d,``)].filter(h),t,e),_=Xa(e,i?.query===``?i.runs:[]),v=qa(e).archived>=200,y=e.filter(h);return{groups:g,needle:s,visibleCount:g.reduce((e,t)=>e+kE(t).length,0),originTotals:DE(_,t),activeCount:DE(e,`active`)[r],archivedCount:OE(e,_,r,i?.plainHasMore,a),incomplete:t===`archived`&&v&&i?.hasMore!==!1,finished:zn(y),unread:iu(y)}}function lO({view:e,query:t,origin:n,onShowAll:r,groups:i,folds:a,grouped:o}){if(i.length===0)return(0,X.jsx)(fO,{view:e,query:t,origin:n,onShowAll:r});let s=i.filter(e=>!a.isCollapsed(e.label)),c=s.some(e=>e.rows.flatMap(PE).some(e=>In(e)!==void 0));return(0,X.jsx)(`div`,{className:`flex flex-col gap-3`,children:i.map(t=>{let n=kE(t);return(0,X.jsx)(BE,{id:`tasks-group-${e}-${t.label.replaceAll(` `,`-`)}`,label:t.label,count:n.length,tone:HE(t.label,n),folded:a.isFolded(t.label),collapsed:a.isCollapsed(t.label),onToggle:()=>a.toggle(t.label),children:(0,X.jsx)(pO,{group:t,showHeader:t===s[0],showReference:c,...o})},t.label)})})}function uO({error:e,onRetry:t}){return e?(0,X.jsxs)(`div`,{role:`alert`,className:`rounded-xl border border-border bg-card p-6`,children:[(0,X.jsx)(`h2`,{className:`text-lg`,children:`Could not load tasks`}),(0,X.jsx)(`p`,{className:`mt-2 text-sm text-muted-foreground`,children:e}),(0,X.jsx)(G,{variant:`outline`,className:`mt-4`,onClick:t,children:`Retry`})]}):(0,X.jsx)(`div`,{role:`status`,"aria-label":`Loading tasks`,className:`rounded-xl border border-border bg-card p-6 text-sm text-muted-foreground`,children:`Loading tasks…`})}function dO({pages:e}){return e.failed?(0,X.jsxs)(`p`,{role:`alert`,"data-slot":`archived-older-error`,className:`mt-3.5 flex items-center justify-center gap-2.5 text-[13px] text-muted-foreground`,children:[`Could not load older archived tasks.`,(0,X.jsx)(G,{variant:`outline`,className:`min-h-11`,onClick:e.onLoadMore,children:`Retry`})]}):e.hasMore?(0,X.jsx)(G,{"data-slot":`archived-older`,variant:`outline`,className:`mt-3.5 min-h-11 self-center`,disabled:e.loading,onClick:e.onLoadMore,children:e.loading?`Loading older archived…`:`Show older archived`}):null}function fO({view:e,query:t,origin:n=`all`,onShowAll:r}){let i=t.trim(),a=i||n!==`all`?`search-miss`:e===`archived`?`archive`:`no-tasks`;return(0,X.jsx)(`div`,{"data-slot":`tasks-empty`,"data-empty-kind":a,className:`flex flex-1 flex-col`,children:a===`search-miss`?(0,X.jsx)(Yo,{heading:`h2`,icon:(0,X.jsx)(_i,{}),tone:`neutral`,title:`No matching tasks`,subtitle:i?`No tasks match “${i}”.`:n===`automations`?`No automation started a task here.`:`No task here was started directly.`,actions:r?(0,X.jsx)(G,{variant:`outline`,className:`min-h-11`,"data-action":`clear-task-filters`,onClick:r,children:`Show all tasks`}):void 0}):a===`archive`?(0,X.jsx)(Yo,{heading:`h2`,icon:(0,X.jsx)(Fr,{}),tone:`neutral`,title:`Nothing archived yet`,subtitle:`Finished tasks you archive land here.`}):(0,X.jsx)(Yo,{heading:`h2`,icon:(0,X.jsx)(Gs,{}),tone:`primary`,backdrop:!0,title:`No tasks yet`,subtitle:`Describe a task to get started.`,actions:(0,X.jsx)(G,{asChild:!0,children:(0,X.jsxs)(q,{to:`/new`,children:[(0,X.jsx)(nr,{"aria-hidden":`true`}),`New task`]})})})})}function pO({showHeader:e,showReference:t,desktop:n,group:r,detailedTable:i,columns:a,expandedColumns:o,onToggleColumn:s,columnsPending:c,onRename:l,onTogglePin:u,now:d,showTokens:f,showCost:p,runners:m,automationName:h}){let g=Y.useMemo(()=>r.rows.flatMap(e=>PE(e).map(t=>({run:t,queuePosition:t.status===`queued`?e.queuePosition:null}))),[r.rows]),_=Y.useMemo(()=>g.map(({run:e,queuePosition:t})=>JD({run:e,queuePosition:t,runners:m,automationName:h,now:d,showTokens:f,showCost:p})),[g,m,h,d,f,p]),v=Y.useCallback((e,t)=>{u?.(e.run,t)},[u]);return n&&i?(0,X.jsx)(`div`,{"data-slot":`tasks-table`,className:`overflow-x-auto rounded-lg border border-card-edge bg-card shadow-card`,children:(0,X.jsx)(hd,{children:(0,X.jsxs)(`div`,{role:`table`,"aria-rowcount":g.length+1,className:`task-resource-grid`,style:mT(a,o),children:[(0,X.jsx)(`div`,{role:`row`,"aria-rowindex":1,className:`task-resource-row`,children:a.map(e=>(0,X.jsx)(hO,{column:e,expanded:oT(e.id,o),onToggle:s,disabled:c},e.id))}),(0,X.jsx)(gE,{itemSize:50,items:g,itemKey:({run:e})=>e.id,children:({run:e,queuePosition:t},n)=>(0,X.jsx)(vO,{rowIndex:n+2,run:e,queuePosition:t,onRename:l,onTogglePin:u,now:d,columns:a,expandedColumns:o,automationName:h})})]})})}):(0,X.jsx)(BD,{items:_,density:n?`table`:`card`,now:d,showHeader:e,showProject:!1,showReferences:t,expandedColumns:o,showTokens:f,showCost:p,scopedLinks:!0,liveUsageSource:`stream`,allowRename:n,onTogglePin:u?v:void 0})}function mO({children:e,right:t=!1,columnId:n,folded:r=!1}){return(0,X.jsx)(`div`,{role:`columnheader`,"data-column-id":n,"data-folded":r||void 0,className:c(`h-[38px] border-b border-border px-2.5 text-left text-xs font-semibold tracking-[0.05em] whitespace-nowrap text-supporting-foreground uppercase first:pl-4 last:pr-4`,t&&`text-right`,r&&`px-0 first:pl-0 last:pr-0`),children:e})}function hO({column:e,expanded:t,onToggle:n,disabled:r}){if(!e.canFold)return(0,X.jsx)(mO,{columnId:e.id,right:e.align===`right`,children:e.label});let i=t?`Fold`:`Expand`;return(0,X.jsx)(mO,{columnId:e.id,right:e.align===`right`,folded:!t,children:(0,X.jsxs)(gd,{children:[(0,X.jsx)(_d,{asChild:!0,children:(0,X.jsx)(`button`,{type:`button`,"aria-label":`${i} ${e.label} column`,"aria-pressed":t,disabled:r,onClick:()=>n(e.id),className:c(`inline-flex h-8 w-full items-center gap-1 rounded-sm px-0.5 text-inherit outline-none hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-wait disabled:opacity-60`,e.align===`right`?`justify-end`:`justify-start`,!t&&`justify-center px-0`),children:t?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{children:e.label}),(0,X.jsx)(Os,{className:`size-3 opacity-55`,"aria-hidden":`true`})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(gO,{icon:e.icon}),(0,X.jsx)(ks,{className:`size-3 opacity-70`,"aria-hidden":`true`})]})})}),(0,X.jsxs)(vd,{side:`top`,children:[e.label,` · `,i,` column`]})]})})}function gO({icon:e}){let t=`size-3.5`;switch(e){case`workflow`:return(0,X.jsx)(Rr,{className:t,"aria-hidden":`true`});case`branch`:return(0,X.jsx)(Jn,{className:t,"aria-hidden":`true`});case`diff`:return(0,X.jsx)(Xn,{className:t,"aria-hidden":`true`});case`reference`:return(0,X.jsx)(Ws,{className:t,"aria-hidden":`true`});case`tokens`:return(0,X.jsx)(js,{className:t,"aria-hidden":`true`});case`cost`:return(0,X.jsx)(Ps,{className:t,"aria-hidden":`true`});case`cpu`:return(0,X.jsx)(Vr,{className:t,"aria-hidden":`true`});case`memory`:return(0,X.jsx)(Ks,{className:t,"aria-hidden":`true`});case`started`:return(0,X.jsx)(As,{className:t,"aria-hidden":`true`});default:return null}}var _O=`h-[88px] border-b border-border px-2.5 whitespace-nowrap first:pl-4 last:pr-4`,vO=Y.memo(function({rowIndex:e,run:t,queuePosition:n,onRename:r,onTogglePin:i,now:a,columns:o,expandedColumns:s,automationName:l}){let u=xa(),d=Pe(t),f=Nn(t),p=`/tasks/${t.id}`,m=Vn(t.costUsd),h=In(t);return(0,X.jsx)(`div`,{role:`row`,"aria-rowindex":e,"data-slot":`task-table-row`,"data-run-id":t.id,onClick:e=>{e.target.closest(`a, button, input`)||u(p)},className:`task-resource-row group/row cursor-pointer hover:bg-muted`,children:o.map(e=>{if(e.id===`memory`)return null;if(e.id===`cpu`){let r=oT(`cpu`,s),i=oT(`memory`,s);return n!==null&&(r||i)?(0,X.jsxs)(`div`,{role:`cell`,"data-slot":`queue-note`,"data-column-id":`cpu-memory`,"aria-colspan":2,style:{gridColumn:`span 2`},className:c(_O,`text-right font-mono text-xs text-supporting-foreground`),children:[`#`,n,` in queue`]},e.id):(0,X.jsx)(wO,{run:t,cpuExpanded:r,memoryExpanded:i},e.id)}return(0,X.jsx)(xO,{column:e,expanded:oT(e.id,s),run:t,attention:d,scheduled:f,reference:h,cost:m,to:p,onRename:r,onTogglePin:i,now:a,automationName:l},e.id)})})});function yO({run:e,to:t,onRename:n,onTogglePin:r,automationName:i}){let a=e.automationId===void 0?void 0:i(e.automationId)??e.automationId;return(0,X.jsxs)(`div`,{role:`cell`,"data-column-id":`task`,className:c(_O,`min-w-[320px] max-w-0 whitespace-normal`),children:[(0,X.jsx)(CO,{lines:2,run:e,to:t,onRename:n,onTogglePin:r}),a?(0,X.jsx)(`div`,{className:`mt-1`,children:(0,X.jsxs)(`span`,{"data-slot":`task-automation-badge`,"data-origin":`automation`,className:`inline-flex max-w-[180px] items-center gap-1 truncate rounded-full border border-info/30 bg-info/10 px-2 py-px text-xs font-medium text-semantic-info`,children:[(0,X.jsx)(Ur,{className:`size-2.5 shrink-0`,"aria-hidden":`true`}),(0,X.jsx)(`span`,{className:`truncate`,children:a})]})}):null]})}function bO({run:e,attention:t,scheduled:n}){let r=op(e,t);return(0,X.jsx)(`div`,{role:`cell`,"data-column-id":`status`,className:c(_O,`overflow-hidden`),children:(0,X.jsx)(fD,{dot:r.tone,shape:r.shape,pulse:r.pulse,title:n?.title??r.label,className:`w-full max-w-full overflow-hidden`,children:(0,X.jsxs)(`span`,{className:`min-w-0 truncate`,children:[r.label,n?(0,X.jsxs)(X.Fragment,{children:[` `,(0,X.jsx)(`span`,{className:`tabular-nums`,children:n.label})]}):null]})})})}function xO({column:e,expanded:t,run:n,attention:r,scheduled:i,reference:a,cost:o,to:s,onRename:l,onTogglePin:u,now:d,automationName:f}){if(!t)return(0,X.jsx)(SO,{column:e.id});switch(e.id){case`status`:return(0,X.jsx)(bO,{run:n,attention:r,scheduled:i});case`task`:return(0,X.jsx)(yO,{run:n,to:s,onRename:l,onTogglePin:u,automationName:f});case`workflow`:return(0,X.jsx)(`div`,{role:`cell`,"data-column-id":e.id,className:c(_O,`max-w-0 truncate text-[13px] text-muted-foreground`),children:Gn(n)});case`branch`:return(0,X.jsx)(`div`,{role:`cell`,"data-column-id":e.id,className:c(_O,`max-w-0 overflow-hidden`),children:n.branch?(0,X.jsx)(XE,{branch:n.branch}):(0,X.jsx)(qE,{})});case`diff`:return(0,X.jsx)(`div`,{role:`cell`,"data-column-id":e.id,className:c(_O,`overflow-hidden`),children:n.diffStat?(0,X.jsx)(Xf,{stat:n.diffStat,compact:!0,className:`block max-w-full`}):(0,X.jsx)(qE,{})});case`reference`:return(0,X.jsx)(`div`,{role:`cell`,"data-column-id":e.id,className:c(_O,`overflow-hidden`),children:a?(0,X.jsx)(Zh,{run:n,reference:a,compact:!0,className:`max-w-full overflow-hidden`}):(0,X.jsx)(qE,{})});case`tokens`:{let t=lD(n.inputTokens,n.outputTokens);return(0,X.jsx)(`div`,{role:`cell`,"data-column-id":e.id,className:c(_O,`text-right text-xs text-muted-foreground`),children:(0,X.jsx)(dD,{inputTokens:n.inputTokens,outputTokens:n.outputTokens,variant:`table`,omitWhenUnknown:!1,title:t,className:`block max-w-full overflow-hidden text-ellipsis`})})}case`cost`:return(0,X.jsx)(`div`,{role:`cell`,"data-column-id":e.id,className:c(_O,`text-right font-mono text-xs text-muted-foreground tabular-nums`),children:o?(0,X.jsx)(EO,{text:o,accessibleText:`$${n.costUsd}`}):(0,X.jsx)(qE,{})});case`started`:return(0,X.jsx)(`div`,{role:`cell`,"data-column-id":e.id,className:c(_O,`text-right text-xs text-supporting-foreground`),children:(0,X.jsx)(Qf,{iso:n.startedAt??n.createdAt,now:d})});default:return null}}function SO({column:e}){return(0,X.jsx)(`div`,{role:`cell`,"aria-hidden":`true`,"data-column-id":e,"data-folded":`true`,className:c(_O,`px-0 first:pl-0 last:pr-0`)})}function CO({run:e,to:t,onTogglePin:n,lines:r=1}){return(0,X.jsx)(DD,{run:e,to:t,title:La(e),unread:Za(e),unreadTone:au(e),readDone:ru(e),isWorker:e.delegation?.role===`worker`,pinned:!!e.pinned,onTogglePin:n?t=>n(e,t):void 0,lines:r})}function wO({run:e,cpuExpanded:t,memoryExpanded:n}){let r=jn(e,En(e.id));return(0,X.jsxs)(X.Fragment,{children:[t?(0,X.jsx)(TO,{column:`cpu`,cell:r.cpu}):(0,X.jsx)(SO,{column:`cpu`}),n?(0,X.jsx)(TO,{column:`memory`,cell:r.mem}):(0,X.jsx)(SO,{column:`memory`})]})}function TO({column:e,cell:t}){let n=t.text&&t.title?`${t.text}; ${t.title}`:t.text;return(0,X.jsx)(`div`,{role:`cell`,"data-usage":e===`memory`?`mem`:e,"data-column-id":e,"data-usage-kind":t.kind,className:c(_O,`overflow-hidden text-right font-mono tabular-nums`,t.kind===`live`&&`bg-accent-strong/5 text-xs font-medium text-foreground`,t.kind===`peak`&&`text-xs text-supporting-foreground`,t.kind===`none`&&`text-xs text-soft-foreground`),children:(0,X.jsx)(EO,{text:t.text||`—`,accessibleText:n||void 0})})}function EO({text:e,accessibleText:t}){return(0,X.jsx)(`span`,{"data-slot":`bounded-metric`,...t?{"aria-label":t,title:t}:{},className:`block max-w-full overflow-hidden text-ellipsis`,children:e})}function DO(){let e=ye(),t=R(),n=tO(ke().data),r=Kf(),{view:i,setView:a,origin:o,setOrigin:s,urlQuery:c,writeQuery:l}=OO(),u=fe(),d=z(),f=oD(e.data,i),p=F({mutationFn:e=>Tt(de(),void 0,e),onSuccess:()=>u.invalidateAfter(`runs`,()=>de()),onError:e=>B(e.message,{tone:`danger`})}),m=F({mutationFn:e=>et(e),onSuccess:()=>d.invalidateQueries({queryKey:k.runs.all}),onError:e=>B(e.message,{tone:`danger`})}),h=F({mutationFn:({id:e,title:t})=>ut(e,{title:t}),onSuccess:()=>d.invalidateQueries({queryKey:k.runs.all}),onError:e=>B(e.message,{tone:`danger`})}),_=y(),v=io(3e4),b=rO(),x=I(),S=De(void 0,{retryOnMount:!1}),C=T({retryOnMount:!1}).data?.projects?.find(e=>e.id===x)?.name,w=[...e.data??[],...f.pages?.runs??[]].some(e=>e.automationId!==void 0),E=g([void 0],r&&w),D=Y.useCallback(e=>E(void 0,e),[E]),O=Y.useMemo(()=>x===void 0?[]:(e.data??[]).flatMap(e=>{let t=In(e);return t?[{projectId:x,kind:t.kind,number:t.number}]:[]}),[e.data,x]),A=Y.useCallback((e,t)=>h.mutate({id:e,title:t}),[h.mutate]),j=Y.useCallback((e,t)=>_.mutate({id:e.id,pinned:t}),[_.mutate]);return(0,X.jsx)(gi,{projectId:x,repoBase:S,requests:O,children:(0,X.jsx)(aO,{runs:e.data,runners:t.data,projectName:C,error:e.error?.message,onRetry:()=>void e.refetch(),view:i,onViewChange:a,origin:o,onOriginChange:s,automations:r,urlQuery:c,onQueryChange:l,foldScope:`project:${x??`default`}`,automationName:D,onArchiveFinished:e=>{p.isPending||p.mutate(e)},archivePending:p.isPending,onMarkAllRead:e=>m.mutate(e),onRename:A,onTogglePin:j,now:v,showTokens:n.tokens,showCost:n.cost,expandedColumns:b.expandedColumns,onToggleColumn:b.toggleColumn,columnsPending:b.isPending,archivedPages:f.pages,archivedTotal:f.total,onArchivedSearch:f.search})})}function OO(){let[e,t]=Xo(),n=e.get(`archived`)===`1`?`archived`:`active`,r=wE(e.get(`origin`)),[i,a]=Y.useState(n),[o,s]=Y.useState(r);Y.useEffect(()=>a(n),[n]),Y.useEffect(()=>s(r),[r]);let c=e.get(`q`)??``,l=Y.useRef(void 0);return Y.useEffect(()=>{let e=l;return()=>clearTimeout(e.current)},[]),{view:i,setView:e=>{a(e),t(sD(`archived`,e===`archived`?`1`:null))},origin:o,setOrigin:e=>{s(e),t(sD(`origin`,e===`all`?null:e))},urlQuery:c,writeQuery:Y.useCallback((e,n)=>{clearTimeout(l.current);let r=e.trim();l.current=setTimeout(()=>t(e=>{let t=e.get(`q`),i=sD(`q`,r===``?null:r)(e);return i.get(`q`)!==t&&n(r),i}),kO)},[t])}}var kO=250;function AO({projects:e,perProjectLimit:t}){return e.length===0?null:(0,X.jsxs)(`p`,{"data-slot":`global-tasks-truncated`,className:`text-xs text-soft-foreground`,children:[`Showing every active task and the newest `,t,` archived tasks per project — older archived tasks in`,` `,e.join(`, `),` are in that project’s own Tasks page.`]})}function jO({registry:e}){return e.length<=1?null:(0,X.jsxs)(`section`,{"data-slot":`other-projects`,className:`rounded-lg border border-border bg-card p-5`,children:[(0,X.jsx)(`h2`,{className:`text-base font-semibold`,children:`Other projects`}),(0,X.jsx)(`div`,{className:`mt-3 flex flex-col divide-y divide-border`,children:e.map(e=>(0,X.jsxs)(`div`,{className:`flex min-h-14 items-center justify-between gap-3`,children:[(0,X.jsx)(`span`,{className:`min-w-0 truncate text-[13px]`,children:e.name}),(0,X.jsxs)(H,{to:ba(e.id,`/`),className:`inline-flex min-h-11 shrink-0 items-center rounded-md px-3 text-xs text-accent-text hover:bg-accent-strong/10`,children:[`View tasks`,(0,X.jsxs)(`span`,{className:`sr-only`,children:[` for `,e.name]})]})]},e.id))})]})}function MO({view:e,filtered:t}){return t?(0,X.jsx)(Yo,{heading:`h2`,icon:(0,X.jsx)(_i,{}),tone:`neutral`,title:`No matching tasks`,subtitle:`No task in any project matches these filters.`}):e===`archived`?(0,X.jsx)(Yo,{heading:`h2`,icon:(0,X.jsx)(Fr,{}),tone:`neutral`,title:`Nothing archived yet`,subtitle:`Finished tasks you archive land here, from every project.`}):(0,X.jsx)(Yo,{heading:`h2`,icon:(0,X.jsx)(Gs,{}),tone:`neutral`,title:`No tasks yet`,subtitle:`Start a task in any project and it shows up here.`})}function NO({groupBy:e,filterDetailsOpen:t,message:n,onRetry:r}){return(0,X.jsx)(Jo,{route:`global-tasks`,density:`empty`,rootProps:{"data-presentation":e===`none`?`summary`:`cards`,"data-filter-details":String(t)},className:`pb-[calc(90px+env(safe-area-inset-bottom))]`,bodyClassName:`gap-[22px]`,children:(0,X.jsx)(Yo,{icon:(0,X.jsx)(Hr,{}),tone:`danger`,title:`Tasks across projects did not load`,subtitle:n,actions:(0,X.jsx)(G,{variant:`outline`,onClick:r,children:`Retry`})})})}function PO({slot:e,label:t,options:n,selected:r,onToggle:i,onClear:a,searchPlaceholder:o,emptyLabel:s=`Nothing to filter by`}){let[l,u]=Y.useState(!1),d=r.length>0,f=r.length===1?n.find(e=>e.value===r[0])?.label??r[0]:`${r.length} selected`;return(0,X.jsxs)(sa,{open:l,onOpenChange:u,children:[(0,X.jsx)(ra,{asChild:!0,children:(0,X.jsxs)(`button`,{type:`button`,"data-slot":`facet-${e}`,"data-active":d?`true`:void 0,"aria-label":`Filter by ${t.toLowerCase()}`,className:c(`inline-flex h-7 items-center gap-1.5 rounded-full border border-border bg-card px-2.5 text-xs font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`,d&&`border-accent-strong/40 bg-accent-strong/10 text-foreground`),children:[(0,X.jsx)(`span`,{className:c(d&&`text-soft-foreground`),children:t}),d?(0,X.jsx)(`span`,{className:`max-w-[140px] truncate font-semibold`,children:f}):null,(0,X.jsx)(qr,{"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,X.jsxs)(aa,{align:`start`,className:`w-64 p-0`,"data-testid":`facet-${e}-menu`,children:[(0,X.jsxs)(Co,{children:[(0,X.jsx)(ho,{placeholder:o??`Search ${t.toLowerCase()}…`}),(0,X.jsxs)(So,{children:[(0,X.jsx)(xo,{children:s}),(0,X.jsx)(_o,{children:n.map(e=>{let t=r.includes(e.value);return(0,X.jsxs)(bo,{value:e.label,onSelect:()=>i(e.value),"data-slot":`facet-option`,"data-value":e.value,"aria-checked":t,role:`option`,children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,className:c(`flex size-4 shrink-0 items-center justify-center rounded-[4px] border`,t?`border-accent-strong bg-accent-strong text-accent-strong-foreground`:`border-input`),children:t?(0,X.jsx)(Kr,{className:`size-3`}):null}),(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.label}),e.count===void 0?null:(0,X.jsx)(`span`,{className:`shrink-0 font-mono text-xs text-soft-foreground tabular-nums`,children:e.count})]},e.value)})})]})]}),d?(0,X.jsx)(`div`,{className:`border-t border-border p-1`,children:(0,X.jsxs)(`button`,{type:`button`,"data-action":`facet-${e}-clear`,onClick:()=>a(),className:`w-full rounded-sm px-2 py-1.5 text-left text-xs font-medium text-muted-foreground hover:bg-muted hover:text-foreground`,children:[`Clear `,t.toLowerCase()]})}):null]})]})}function FO({label:e,count:t,selected:n,onToggle:r,slot:i,tone:a=`neutral`}){return(0,X.jsxs)(`button`,{type:`button`,"data-slot":i,"data-selected":n?`true`:void 0,"aria-pressed":n,onClick:r,className:c(`inline-flex h-7 items-center gap-1.5 rounded-full border px-2.5 text-xs font-medium transition-colors`,a===`tag`?`border-accent-strong/25 bg-accent-strong/10 text-accent-text hover:bg-accent-strong/20`:`border-border bg-card text-muted-foreground hover:bg-muted hover:text-foreground`,n&&`border-accent-strong bg-accent-strong text-accent-strong-foreground hover:bg-accent-strong`),children:[e,t===void 0?null:(0,X.jsx)(`span`,{className:c(`font-mono text-xs tabular-nums`,!n&&`text-soft-foreground`),children:t})]})}function IO({slot:e,label:t,value:n,options:r,onChange:i,size:a=`compact`}){return(0,X.jsx)(`div`,{"data-slot":e,role:`group`,"aria-label":t,className:`inline-flex gap-0.5 rounded-md bg-muted p-[3px]`,children:r.map(e=>{let t=e.value===n;return(0,X.jsx)(`button`,{type:`button`,"data-value":e.value,"aria-pressed":t,disabled:e.disabled,title:e.title,onClick:()=>i(e.value),className:c(`flex h-6 items-center justify-center rounded-[6px] px-2.5 text-[12px] font-medium text-muted-foreground transition-colors hover:text-foreground disabled:pointer-events-none disabled:opacity-50`,a===`touch`&&`h-11 px-4 text-[13px]`,t&&`bg-card font-semibold text-foreground shadow-xs`),children:e.label},e.value)})})}var LO=` untagged`,RO=[{value:`project`,label:`Project`},{value:`tag`,label:`Tag`},{value:`status`,label:`Status`},{value:`workflow`,label:`Workflow`}];function zO(e,t){return e===t?`none`:t}var BO={query:``,tags:[],statuses:[],workflows:[]};function VO(e,t){let{origin:n,...r}=e;return t===`all`?r:{...r,origin:t}}function HO(e,t){return e.includes(t)?e.filter(e=>e!==t):[...e,t]}function UO(e){return(e.projects?.length??0)+e.tags.length+e.statuses.length+e.workflows.length+(e.origin===void 0||e.origin===`all`?0:1)}function WO(e){return e.query.trim()!==``||UO(e)>0}function GO(e){return UO(e.filters)+(e.filters.query.trim()===``?0:1)+(e.groupBy===`none`?0:1)}function KO(e){return GO(e)>0}function qO(e,t){let n=new Map(t.map(e=>[e.id,e]));return e.filter(e=>!Wa(e)).map(e=>{let t=n.get(e.projectId);return{run:e,project:t,projectName:t?.name||e.projectId,tags:t?.tags??[]}})}function JO(e){let t=new Set;for(let n of e)t.add(n.run.workflow);return[...t].sort((e,t)=>e.localeCompare(t))}function YO(e){let t=new Set;for(let n of e)t.add(n.run.status);return[...t].sort((e,t)=>e.localeCompare(t))}function XO(e,t){let n=new Map;for(let r of e)for(let e of t(r))n.set(e,(n.get(e)??0)+1);return n}var ZO=e=>e.tags.length===0?[LO]:e.tags,QO=(e,t)=>e.length===0||t.some(t=>e.includes(t)),$O=(e,t)=>{if(t.length===0)return!0;let n=ZO(e).map(e=>e.toLowerCase());return t.some(e=>n.includes(e.toLowerCase()))};function ek(e,t){return{displayTitle:La(e.run),projectName:e.projectName,tags:e.tags,automation:e.run.automationId===void 0?void 0:t(e)??e.run.automationId,references:()=>Rn(e.run)}}function tk(e,t,n,r=()=>void 0){let i=t.query.trim()!==``;return e.filter(e=>(n===`archived`?!e.run.archived:e.run.archived)||!TE(e.run,t.origin??`all`)||!QO(t.projects??[],[e.run.projectId])||!QO(t.statuses,[e.run.status])||!QO(t.workflows,[e.run.workflow])||!$O(e,t.tags)?!1:!i||Kn(e.run,t.query,{scope:`shown`,extras:ek(e,r)}))}function nk(e,t,n,r,i){return tk(e,r===`origin`?{...t,origin:`all`}:{...t,[r]:[]},n,i)}function rk(e,t){if(t===`none`)return[{key:`all`,label:``,tasks:[...e]}];let n=new Map,r=(e,t,r)=>{let i=n.get(e);i?i.tasks.push(r):n.set(e,{key:e,label:t,tasks:[r]})};for(let n of e)if(t===`project`)r(n.run.projectId,n.projectName,n);else if(t===`status`)r(n.run.status,up(n.run.status),n);else if(t===`workflow`)r(n.run.workflow,n.run.workflow,n);else if(n.tags.length===0)r(LO,`Untagged`,n);else for(let e of n.tags)r(e.toLowerCase(),e,n);return[...n.values()].sort((e,t)=>e.key===` untagged`?1:t.key===` untagged`?-1:t.tasks.length-e.tasks.length||e.label.localeCompare(t.label))}function ik(e,t){let n=new Map(t.map(e=>[e.id,e.name]));return e.map(e=>n.get(e)||e)}var $={query:`q`,project:`project`,tag:`tag`,untagged:`untagged`,status:`status`,workflow:`workflow`,groupBy:`group`,archived:`archived`,origin:`origin`},ak=new Set(RO.map(e=>e.value));function ok(e){let t=new URLSearchParams,n=e.filters.query.trim();n!==``&&t.set($.query,n);for(let n of e.filters.tags)n===` untagged`?t.set($.untagged,`1`):t.append($.tag,n);for(let n of e.filters.projects??[])t.append($.project,n);for(let n of e.filters.statuses)t.append($.status,n);for(let n of e.filters.workflows)t.append($.workflow,n);return e.groupBy!==`none`&&t.set($.groupBy,e.groupBy),e.view===`archived`&&t.set($.archived,`1`),e.filters.origin!==void 0&&e.filters.origin!==`all`&&t.set($.origin,e.filters.origin),t}function sk(e,t){let n=e.getAll($.tag).filter(e=>e!==``);e.get($.untagged)===`1`&&n.push(LO);let r=e.get($.groupBy)??``,i=CE(wE(e.get($.origin)),t);return{filters:{query:e.get($.query)??``,...e.has($.project)?{projects:e.getAll($.project).filter(Boolean)}:{},tags:n,statuses:e.getAll($.status).filter(e=>e!==``),workflows:e.getAll($.workflow).filter(e=>e!==``),...i===`all`?{}:{origin:i}},groupBy:ak.has(r)?r:`none`,view:e.get($.archived)===`1`?`archived`:`active`}}function ck(e){return(e.projects?.length??0)+e.tags.length+e.statuses.length+e.workflows.length}function lk({filters:e,onToggle:t,onClearFacet:n,onClearAll:r,groupBy:i,onGroupByChange:a,projects:o,tasks:s,view:c,automationName:l}){let u=Y.useMemo(()=>Ae(o),[o]),d=Y.useMemo(()=>{let t=(t,n)=>XO(nk(s,e,c,t,l),n);return{projects:t(`projects`,e=>[e.run.projectId]),tags:t(`tags`,ZO),statuses:t(`statuses`,e=>[e.run.status]),workflows:t(`workflows`,e=>[e.run.workflow])}},[s,e,c,l]),f=e=>t=>({...t,count:e.get(t.value)??0});return(0,X.jsxs)(`div`,{id:`global-tasks-filters`,"data-slot":`global-tasks-filters`,className:`flex flex-col gap-2`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,X.jsx)(PO,{slot:`project`,label:`Project`,selected:e.projects??[],onToggle:e=>t(`projects`,e),onClear:()=>n(`projects`),options:[...new Map(s.map(e=>[e.run.projectId,e.projectName])).entries()].map(([e,t])=>({value:e,label:t})).map(f(d.projects)),emptyLabel:`No tasks to filter`}),(0,X.jsx)(PO,{slot:`status`,label:`Status`,selected:e.statuses,onToggle:e=>t(`statuses`,e),onClear:()=>n(`statuses`),options:YO(s).map(e=>({value:e,label:up(e)})).map(f(d.statuses)),emptyLabel:`No tasks to filter`}),(0,X.jsx)(PO,{slot:`workflow`,label:`Workflow`,selected:e.workflows,onToggle:e=>t(`workflows`,e),onClear:()=>n(`workflows`),options:JO(s).map(e=>({value:e,label:e})).map(f(d.workflows)),emptyLabel:`No tasks to filter`}),(0,X.jsxs)(`div`,{"data-slot":`group-controls`,className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(`span`,{className:`mx-1 h-5 w-px bg-border`,"aria-hidden":`true`}),(0,X.jsx)(`span`,{className:`text-xs font-medium text-soft-foreground`,children:`Group by`}),(0,X.jsx)(IO,{slot:`group-by`,label:`Group tasks by`,value:i,options:RO,onChange:e=>a(zO(i,e))})]}),KO({filters:e,groupBy:i})?(0,X.jsxs)(`button`,{type:`button`,"data-action":`clear-filters`,onClick:r,className:`ml-auto inline-flex h-7 items-center gap-1 rounded-full px-2 text-xs font-medium text-muted-foreground hover:bg-muted hover:text-foreground`,children:[(0,X.jsx)(vr,{className:`size-3`,"aria-hidden":`true`}),`Clear`,` (${GO({filters:e,groupBy:i})})`]}):null]}),u.length>0?(0,X.jsxs)(`div`,{"data-slot":`tag-filters`,className:`flex flex-wrap items-center gap-1.5`,children:[(0,X.jsx)(`span`,{className:`text-xs font-medium text-soft-foreground`,children:`Tags`}),u.map(n=>(0,X.jsx)(FO,{slot:`tag-filter`,tone:`tag`,label:n,count:d.tags.get(n)??0,selected:e.tags.some(e=>e.toLowerCase()===n.toLowerCase()),onToggle:()=>t(`tags`,n)},n)),(0,X.jsx)(FO,{slot:`tag-filter`,label:`Untagged`,count:d.tags.get(` untagged`)??0,selected:e.tags.includes(LO),onToggle:()=>t(`tags`,LO)})]}):(0,X.jsxs)(`p`,{"data-slot":`no-tags-hint`,className:`text-xs text-soft-foreground`,children:[`Tag connected repositories in`,` `,(0,X.jsx)(H,{to:`/settings/global/projects`,className:`font-medium text-accent-text hover:underline`,children:Ym(`projects`)}),` `,`to group their tasks together here.`]})]})}var uk=15e3,dk=250,fk=new Set([`done`,`failed`,`cancelled`]);function pk(){return gk({request:({projectId:e,runId:t,archived:n})=>Jt(we(t,{projectId:e}),n),patch:({archived:e})=>t=>({...t,archived:e})})}function mk(){return gk({request:({projectId:e,runId:t,read:n})=>Ke(we(t,{projectId:e}),n),patch:({read:e})=>t=>{if(e)return{...t,seenAt:new Date().toISOString()};let{seenAt:n,...r}=t;return r}})}function hk(){return gk({request:({projectId:e,runId:t,pinned:n})=>nn(we(t,{projectId:e}),n),patch:({pinned:e})=>t=>({...t,pinned:e})})}function gk({request:e,patch:t}){let n=fe();return F({mutationFn:e,onMutate:e=>n.patchIndex(we(e.runId,{projectId:e.projectId}),()=>t(e)),onError:(e,t,n)=>{n?.rollback(),B(e.message,{tone:`danger`})},onSettled:(e,t,{projectId:r,runId:i},a)=>{a?a.settle():n.invalidateAfter(`indexed`,we(i,{projectId:r}))}})}async function _k(e,t){if(e.length===0)return;let n=(await Promise.allSettled(e.map(e=>t(e)))).find(e=>e.status===`rejected`);if(n){let e=n.reason instanceof Error?n.reason.message:String(n.reason);throw Error(e)}}function vk(e,t,n){let r=n.projects&&n.projects.length>0?new Set(n.projects):void 0,i=n.tags.length>0?new Set(n.tags.map(e=>e.toLowerCase())):void 0;return e.filter(e=>!(!TE(e.run,t)||r&&!r.has(e.run.projectId)||i&&!ZO(e).some(e=>i.has(e.toLowerCase()))))}function yk({projectCount:e,bootProject:t,status:n,secondaryActions:r}){return{title:`All tasks`,status:(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:[e>0?(0,X.jsxs)(`span`,{"data-slot":`tasks-project-scope`,className:`hidden text-xs font-medium text-muted-foreground tabular-nums md:inline`,children:[e,` `,e===1?`project`:`projects`]}):null,n]}),secondaryActions:r,primaryAction:(0,X.jsx)(Ko,{asChild:!0,variant:`primary`,"data-slot":`new-task-inline`,children:(0,X.jsxs)(H,{to:ba(t??`default`,`/new`),children:[(0,X.jsx)(nr,{"aria-hidden":`true`}),`New task`]})})}}function bk(e,t,n,r){if(!(!e||t<=0||n))return(0,X.jsx)(Go,{summary:`Showing ${t} ${t===1?`task`:`tasks`} across registered projects.`,actions:(0,X.jsx)(G,{variant:`outline`,size:`sm`,asChild:!0,className:`max-md:min-h-11`,children:(0,X.jsx)(H,{to:ba(r??`default`,`/new`),children:`Start a task`})})})}function xk({tasks:e,origin:t,filters:n}){let r=z(),i=Y.useMemo(()=>vk(e,t,n),[e,t,n]),a=Y.useMemo(()=>i.map(e=>e.run),[i]),o=Y.useMemo(()=>iu(a),[a]),s=Y.useMemo(()=>zn(a),[a]),c=Y.useCallback(()=>{r.invalidateQueries({queryKey:h.runsIndex}),r.invalidateQueries({queryKey:k.runs.all})},[r]),l=F({mutationFn:e=>_k(e,e=>et(EE(t),de({projectId:e}))),onError:e=>B(e.message,{tone:`danger`}),onSettled:c}),u=F({mutationFn:e=>_k(e,e=>Tt(de({projectId:e}),void 0,EE(t))),onError:e=>B(e.message,{tone:`danger`}),onSettled:c}),d=Y.useCallback(()=>{if(l.isPending)return;let e=[...new Set(i.filter(e=>Za(e.run)).map(e=>e.run.projectId))];e.length>0&&l.mutate(e)},[i,l]),f=Y.useCallback(()=>{if(u.isPending)return;let e=[...new Set(i.filter(e=>!e.run.archived&&fk.has(e.run.status)).map(e=>e.run.projectId))];e.length>0&&u.mutate(e)},[i,u]);return{unread:o,finished:s,archivePending:u.isPending,markReadPending:l.isPending,onMarkAllRead:d,onArchiveFinished:f}}function Sk(){let{mutate:e,isPending:t}=pk(),{mutate:n,isPending:r}=mk(),{mutate:i,isPending:a}=hk();return{onArchive:Y.useCallback((t,n)=>{t.projectId&&e({projectId:t.projectId,runId:t.runId,archived:n})},[e]),onSetRead:Y.useCallback((e,t)=>{e.projectId&&n({projectId:e.projectId,runId:e.runId,read:t})},[n]),onTogglePin:Y.useCallback((e,t)=>{e.projectId&&i({projectId:e.projectId,runId:e.runId,pinned:t})},[i]),busy:t||r||a}}function Ck(){let e=_g(),t=T(),n=R(),r=tO(ke().data),i=le(!0,uk),a=rO(),o=Y.useMemo(()=>uT(),[]),[s,l]=Xo(),u=Kf(),{filters:d,groupBy:f,view:p}=Y.useMemo(()=>sk(s,u),[s,u]),m=io(3e4),h=e=>l(t=>{let n=ok(e(sk(t,!0))),r=t.get(`tasks`);return(r===`flat`||r===`virtual`)&&n.set(`tasks`,r),n}),g=e=>h(t=>({...t,filters:e(t.filters)})),_=e=>h(t=>({...t,groupBy:e})),v=e=>h(t=>({...t,view:e})),y=ck(d)+(f===`none`?0:1),[b,x]=Y.useState(y>0),[S,C]=Ek(d.query,e=>g(t=>({...t,query:e}))),w=i.data?.referenceStatuses;Y.useEffect(()=>{w&&Se(w)},[w]);let E=Y.useMemo(()=>t.data?.projects??[],[t.data]),D=Y.useMemo(()=>i.data?.runs??[],[i.data]),O=Y.useMemo(()=>qO(D,E),[D,E]),{nameOf:k,visible:A,originTotals:j,statusGroups:M,folds:ee}=Dk({tasks:O,filters:d,view:p,groupBy:f,index:D,automationsOn:u}),te=Y.useMemo(()=>rk(A,f),[A,f]),N=d.origin??`all`,P=Y.useMemo(()=>{let e=O.map(e=>e.run);return{active:DE(e,`active`)[N],archived:DE(e,`archived`)[N]}},[O,N]),ne=e=>g(t=>VO(t,e)),re=xk({tasks:O,origin:N,filters:d}),F=Sk(),ie=Y.useMemo(()=>A.flatMap(e=>Fn(e.run,e.project?.repoUrl).filter(t=>Mn(t,e.project?.repoUrl)).map(t=>({projectId:e.run.projectId,kind:t.kind,number:t.number}))),[A]),ae=ik(i.data?.truncated??[],E),I=(e,t)=>g(n=>({...n,[e]:HO(n[e]??[],t)})),oe=e=>g(t=>({...t,[e]:[]})),L=i.error??t.error;if(L)return(0,X.jsx)(NO,{groupBy:f,filterDetailsOpen:b,message:L.message,onRetry:()=>{i.refetch(),t.refetch()}});let se=i.data===void 0?`full`:Ho(A.length),ce=(0,X.jsxs)(G,{variant:`outline`,"data-slot":`filters-toggle`,"data-active":b||y>0,className:c(`max-md:min-h-11 md:h-9`,(b||y>0)&&`border-accent-strong bg-accent-strong/10 text-accent-text hover:bg-accent-strong/15 hover:text-accent-text`),"aria-expanded":b,"aria-controls":`global-tasks-filters`,onClick:()=>x(e=>!e),children:[(0,X.jsx)(_r,{"aria-hidden":`true`}),`Filters`,y>0?(0,X.jsx)(Zf,{variant:`accent`,"data-slot":`filters-count`,"aria-hidden":`true`,value:y}):null]});return(0,X.jsx)(Jo,{route:`global-tasks`,density:se,headerSpacing:`compact`,rootProps:{"data-presentation":f===`none`?`summary`:`cards`,"data-filter-details":String(b)},bodyClassName:`gap-3`,header:yk({projectCount:E.length,bootProject:t.data?.bootProject,status:(0,X.jsx)(KE,{view:p,onSelect:v,activeCount:P.active,archivedCount:P.archived,trailing:(0,X.jsxs)(`span`,{"data-slot":`global-tasks-count`,className:`self-center text-xs text-soft-foreground tabular-nums`,children:[A.length,` of `,O.length,ae.length>0?` loaded`:``]})}),secondaryActions:(0,X.jsx)(ZE,{view:p,unread:re.unread,finished:re.finished,archivePending:re.archivePending,markReadPending:re.markReadPending,onMarkAllRead:re.onMarkAllRead,onArchiveFinished:re.onArchiveFinished})}),sparseFooter:bk(i.data!==void 0,A.length,WO(d),t.data?.bootProject),children:(0,X.jsxs)(_E,{layout:`${f}:${e}`,revision:te,visibilityRevision:JSON.stringify([Ja.map(ee.isCollapsed),p,b,a.expandedColumns]),className:`flex min-w-0 flex-1 flex-col gap-3`,children:[(0,X.jsx)(eD,{query:S,onQueryChange:C,searchPlaceholder:`Search every project…`,searchLabel:`Search tasks across projects`,origin:N,originCounts:j,automations:u,onOriginChange:ne,columns:o,expandedColumns:a.expandedColumns,columnsPending:a.isPending,onToggleColumn:a.toggleColumn,groupLabels:M.map(e=>e.label),onSetAllFolds:ee.setAll,extraControls:ce}),(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-3`,children:[(0,X.jsx)(lk,{filters:d,onToggle:I,onClearFacet:oe,onClearAll:()=>{C(``),h(e=>({...e,filters:BO,groupBy:`none`}))},groupBy:f,onGroupByChange:_,projects:E,tasks:O,view:p,automationName:k}),(0,X.jsx)(AO,{projects:ae,perProjectLimit:i.data?.perProjectLimit}),i.data===void 0?(0,X.jsx)(`div`,{role:`status`,className:`rounded-xl border border-border bg-card p-6 text-sm text-muted-foreground`,children:`Loading tasks…`}):(0,X.jsx)(wk,{view:p,filtered:WO(d),visibleCount:A.length,referenceRequests:ie,lists:{desktop:e,groupBy:f,view:p,statusGroups:M,groups:te,folds:ee,expandedColumns:a.expandedColumns,now:m,runners:n.data,showTokens:r.tokens,showCost:r.cost,automationName:k,onTogglePin:p===`archived`?void 0:F.onTogglePin,onArchive:F.onArchive,onSetRead:F.onSetRead,busy:F.busy}}),(0,X.jsx)(jO,{registry:E})]})]})})}function wk({view:e,filtered:t,visibleCount:n,referenceRequests:r,lists:i}){return n===0?(0,X.jsx)(MO,{view:e,filtered:t}):(0,X.jsx)(gi,{requests:r,children:(0,X.jsx)(Tk,{...i})})}function Tk({desktop:e,groupBy:t,view:n,statusGroups:r,groups:i,folds:a,expandedColumns:o,now:s,runners:c,showTokens:l,showCost:u,automationName:d,onTogglePin:f,onArchive:p,onSetRead:m,busy:h}){let g=r.filter(e=>!a.isCollapsed(e.label)),_=t===`none`?g.some(e=>e.rows.flatMap(PE).some(e=>Fn(e.run,e.project?.repoUrl).length>0)):i.some(e=>e.tasks.some(e=>Fn(e.run,e.project?.repoUrl).length>0)),v=e?`table`:`card`,y=e=>e.map(({task:e,queuePosition:t})=>XD({task:e,queuePosition:t,runners:c,automationName:d,now:s,showTokens:l,showCost:u})),b={density:v,now:s,showReferences:_,expandedColumns:o,showTokens:l,showCost:u,scopedLinks:!1,liveUsageSource:`snapshot`,onTogglePin:f,onArchive:p,onSetRead:m,busy:h,tableSlot:`global-tasks-table`,rowSlot:`global-task-row`,cardSlot:`global-task-row`};return(0,X.jsx)(X.Fragment,{children:t===`none`?r.map(e=>{let t=kE(e),r=e.rows.flatMap(e=>PE(e).map(t=>({task:t,queuePosition:t.run.status===`queued`?e.queuePosition:null})));return(0,X.jsx)(BE,{id:`global-group-${n}-${e.label.replaceAll(` `,`-`)}`,label:e.label,count:t.length,tone:HE(e.label,t.map(e=>e.run)),folded:a.isFolded(e.label),collapsed:a.isCollapsed(e.label),onToggle:()=>a.toggle(e.label),children:(0,X.jsx)(BD,{...b,items:y(r),showHeader:e===g[0],showProject:!0})},e.label)}):i.map((e,r)=>{let i=n===`archived`?e.tasks:[...e.tasks].sort((e,t)=>Number(!!t.run.pinned)-Number(!!e.run.pinned));return(0,X.jsxs)(`section`,{"data-slot":`task-group`,"data-group-key":e.key,children:[(0,X.jsxs)(`h2`,{className:`mb-1.5 flex items-center gap-2 text-[12px] font-semibold tracking-[0.04em] text-soft-foreground uppercase`,children:[t===`project`?(0,X.jsx)(H,{to:ba(e.key,`/`),"data-slot":`group-project-link`,className:`hover:text-foreground hover:underline`,children:e.label}):e.label,(0,X.jsx)(Zf,{value:i.length,className:`font-mono text-xs font-medium`})]}),(0,X.jsx)(BD,{...b,items:y(i.map(e=>({task:e,queuePosition:null}))),showHeader:r===0,showProject:t!==`project`})]},e.key)})})}function Ek(e,t){let[n,r]=Y.useState(e),i=Y.useRef(e);return Y.useEffect(()=>{e!==i.current&&r(e),i.current=e},[e]),Y.useEffect(()=>{if(n===i.current)return;let e=setTimeout(()=>{i.current=n,t(n)},dk);return()=>clearTimeout(e)},[n]),[n,r]}function Dk({tasks:e,filters:t,view:n,groupBy:r,index:i,automationsOn:a}){let o=Y.useMemo(()=>[...new Set(e.filter(e=>e.run.automationId!==void 0).map(e=>e.run.projectId))],[e]),s=g(o,a&&o.length>0),c=Y.useCallback(e=>e.run.automationId===void 0?void 0:s(e.run.projectId,e.run.automationId),[s]),l=Y.useMemo(()=>tk(e,t,n,c),[e,t,n,c]),u=DE(nk(e,t,n,`origin`,c).map(e=>e.run),n),d=r===`none`?NE(l,n,i):[];return{nameOf:c,visible:l,originTotals:u,statusGroups:d,folds:$D(`global`,n,new Set(t.query.trim()===``?[]:d.map(e=>e.label)))}}var Ok=(0,Y.lazy)(()=>V(()=>import(`./automations-route-B-f1XBAk.js`).then(e=>({default:e.AutomationsRoute})),__vite__mapDeps([86,1,2,7,8,6,9,10,11,12,87,88,89,23,19,13,68,14,18,90,24,91,64,48,39,38,37,58,92,93,28,40,94,95]))),kk=(0,Y.lazy)(()=>V(()=>import(`./workspace-tools-D1ZIqE9E.js`).then(e=>({default:e.WorkspaceToolsRoute})),__vite__mapDeps([96,1,2,6,7,8,9,10,11,12,97,98,99,16,14,18,19,25,26,27,92,93]))),Ak=(0,Y.lazy)(()=>V(()=>import(`./settings-shell-DoYsgDvs.js`).then(e=>({default:e.SettingsIndexRoute})),__vite__mapDeps([100,1,2,6,7,8,9,10,11,12,13,55,14,18,19,90,23,24,37,38,39,20,58,99,92,93,40,41,65,29,46,47,48,28,42,49,59,60,26,61,17,62,63,64,35,101]))),jk=(0,Y.lazy)(()=>V(()=>import(`./settings-shell-DoYsgDvs.js`).then(e=>({default:e.SettingsSectionRoute})),__vite__mapDeps([100,1,2,6,7,8,9,10,11,12,13,55,14,18,19,90,23,24,37,38,39,20,58,99,92,93,40,41,65,29,46,47,48,28,42,49,59,60,26,61,17,62,63,64,35,101]))),Mk=(0,Y.lazy)(()=>V(()=>import(`./task-thread-DpmaZvjj.js`).then(e=>({default:e.TaskThreadRoute})),__vite__mapDeps([102,1,2,7,8,6,9,10,11,12,97,98,99,13,14,103,68,16,61,104,62,72,105,74,63,18,19,90,23,24,58,106,22,107,28,34,35,108,81,82,83,84,40,109,110,111,76,60,26,17,64,48,39,71,112,47,21,25,77,113,114,75,73,92,93,94,115]))),Nk=(0,Y.lazy)(()=>V(()=>import(`./task-changes-59Qa1bEL.js`).then(e=>({default:e.TaskChangesRoute})),__vite__mapDeps([116,1,2,7,8,6,9,10,11,12,13,111,97,98,99,14,76,60,26,61,17,62,63,18,19,64,23,24,48,39,35,71,105,112,47,21,22,58,25,77,81,82,83,34,84,40,109,113,114,117,80,118,92,93,28,119,120,121,108]))),Pk=(0,Y.lazy)(()=>V(()=>import(`./task-files-DKGtV-H2.js`).then(e=>({default:e.TaskFilesRoute})),__vite__mapDeps([122,1,2,7,8,6,9,10,11,12,13,14,111,97,98,99,76,60,26,61,17,62,63,18,19,64,23,24,48,39,35,71,105,112,47,21,22,58,25,77,81,82,83,34,84,40,109,113,114,79,80,28,85,92,93]))),Fk=(0,Y.lazy)(async()=>{let{TaskReportRoute:e}=await V(async()=>{let{TaskReportRoute:e}=await import(`./report-reader-CfpyZKZF.js`);return{TaskReportRoute:e}},__vite__mapDeps([78,1,2,6,7,8,9,10,11,12,13,79,14,80,18,19,28,34,35,81,82,83,84,85]));return{default:e}}),Ik=(0,Y.lazy)(()=>V(()=>import(`./task-commits-BGtVyWPE.js`).then(e=>({default:e.TaskCommitsRoute})),__vite__mapDeps([123,1,2,6,7,8,9,10,11,12,13,111,97,98,99,14,76,60,26,61,17,62,63,18,19,64,23,24,48,39,35,71,105,112,47,21,22,58,25,77,81,82,83,34,84,40,109,113,114,80,92,93,28,120,118,121,108,124,125]))),Lk=(0,Y.lazy)(()=>V(()=>import(`./task-github-item-KzGyb9nv.js`).then(e=>({default:e.TaskGithubItemRoute})),__vite__mapDeps([126,2,1,7,8,6,9,10,11,12,97,98,99,13,111,14,76,60,26,61,17,62,63,18,19,64,23,24,48,39,35,71,105,112,47,21,22,58,25,77,81,82,83,34,84,40,109,113,114,92,93,28,127,69,104,72,73,51,52,120,118,121,108,124,128]))),Rk=(0,Y.lazy)(()=>V(()=>import(`./repo-git-DfuenTj0.js`).then(e=>({default:e.RepoGitRoute})),__vite__mapDeps([129,1,2,7,8,6,9,10,11,12,97,98,99,13,14,70,130,117,61,80,18,19,63,64,23,24,48,39,118,71,72,112,47,58,25,26,77,92,93,28,119,120,121,108,124,125,131]))),zk=(0,Y.lazy)(()=>V(()=>import(`./github-Cn5ODryx.js`).then(e=>({default:e.GithubRoute})),__vite__mapDeps([132,1,2,7,8,6,9,10,11,12,13,69,14,16,72,73,18,19,91,23,64,24,48,39,38,47,58,99,98,25,26,51,22,21,92,93,28,107,127,61,104,105,52,81,82,83,34,35,84,40,120,118,121,108,124,113,128]))),Bk=(0,Y.lazy)(()=>V(()=>import(`./reports-HWxwI40r.js`).then(e=>({default:e.ReportsRoute})),__vite__mapDeps([133,1,2,7,8,6,9,10,11,12,13,134,14,16,104,18,19,58,77,92,93,107,110,85,84,135]))),Vk=(0,Y.lazy)(()=>V(()=>import(`./workflows-a73JJd3t.js`).then(e=>({default:e.WorkflowsRoute})),__vite__mapDeps([136,1,2,7,8,6,9,10,11,12,13,18,19,64,23,24,48,39,21,22,52,92,93,28,4,40,137]))),Hk=(0,Y.lazy)(()=>V(()=>import(`./activity-route-42fC7Mxs.js`).then(e=>({default:e.ProjectActivityRoute})),__vite__mapDeps([138,1,2,7,8,139,6,9,10,11,12,89,13,14,103,68,16,61,104,62,72,105,74,63,18,19,90,23,24,58,98,99,106,22,107,28,34,35,108,81,82,83,84,40,109,110,67,134,26,71,47,48,39,25,92,93,140]))),Uk=(0,Y.lazy)(()=>V(()=>import(`./global-activity-route-5usGSS4S.js`).then(e=>({default:e.GlobalActivityRoute})),__vite__mapDeps([141,1,2,7,8,6,9,10,11,12,139,89,13,14,103,68,16,61,104,62,72,105,74,63,18,19,90,23,24,58,98,99,106,22,107,28,34,35,108,81,82,83,84,40,109,110,67,134,26,71,47,48,39,25,92,93,140,3]))),Wk=(0,Y.lazy)(()=>V(()=>import(`./skills-BJicAwPH.js`).then(e=>({default:e.SkillsRoute})),__vite__mapDeps([142,1,2,7,8,6,9,10,11,12,13,18,19,58,52,92,93])));function Gk(){let e=hn();return(0,X.jsx)(Ta,{to:{pathname:`/skills`,search:e.search,hash:e.hash},replace:!0})}function Kk({sectionId:e}){let t=hn();return(0,X.jsx)(vn,{to:{pathname:Av(`global`,e),search:t.search,hash:t.hash},replace:!0})}function qk(){return(0,X.jsx)(`div`,{"data-route":`scope-resolving`,className:`flex min-h-full flex-col`,children:(0,X.jsx)(`p`,{className:`px-4 py-6 text-center text-xs text-soft-foreground`,children:`Loading…`})})}function Jk(){let{projectId:e=``}=_n(),t=hn(),n=T(),r=ke();if(e==="default"){let e=n.data?.bootProject??(n.isError?r.data?.bootProject:void 0);if(e!==void 0){let n=t.pathname.replace(/^\/p\/default(?=\/|$)/,``);return(0,X.jsx)(vn,{to:`/p/${encodeURIComponent(e)}${n||`/`}${t.search}${t.hash}`,replace:!0})}if(!n.isError)return(0,X.jsx)(qk,{})}if(n.data){if(!(n.data.bootProject===e||n.data.projects.some(t=>t.id===e)))return(0,X.jsx)(WC,{projectId:e,registry:n.data})}else if(!n.isError)return(0,X.jsx)(qk,{});return(0,X.jsx)(kt,{projectId:n.data?.bootProject===e?null:e,children:(0,X.jsx)(pn,{},e)})}function Yk(){let{projectId:e=``}=_n();return(0,X.jsx)(EC,{},e)}var Xk=/^\/tasks\/([0-9a-f-]{36})(?=\/|$)/i;function Zk(e,t){let n=e.data?.bootProject??t.data?.bootProject;return{resolved:n,settled:(e.data!==void 0||e.isError)&&(t.data!==void 0||t.isError),boot:n??`default`}}function Qk(e,t,n){if(!(e.pathname===`/`&&e.search===``&&e.hash===``))return;if(t.data===void 0&&!t.isError)return(0,X.jsx)(qk,{});let r=hf(af(),t.data,n);if(r!==null)return(0,X.jsx)(vn,{to:r,replace:!0})}function $k(e,t,n,r,i,a){if(!n)return null;let o=i.data?.runs.find(t=>t.id===e)?.projectId;return o===void 0?r?a.data===void 0&&!a.isError?null:a.data?.runs.find(t=>t.id===e)?.projectId??t:t:o}function eA(e,t){let n=t.pathname===`/p`||t.pathname===`/p/`?`/`:t.pathname;return(0,X.jsx)(vn,{to:`/p/${encodeURIComponent(e)}${n}${t.search}${t.hash}`,replace:!0})}function tA(){let e=hn(),t=ke(),n=T(),r=Xk.exec(e.pathname)?.[1]??null,i=le(r!==null),a=i.data!==void 0||i.isError,o=i.data!==void 0&&!i.data.runs.some(e=>e.id===r),s=N(r!==null&&o?r:``),{resolved:c,settled:l,boot:u}=Zk(t,n);if(c===void 0&&!l)return(0,X.jsx)(qk,{});let d=Qk(e,n,c);if(d!==void 0)return d;let f=u;if(r!==null){let e=$k(r,u,a,o,i,s);if(e===null)return(0,X.jsx)(qk,{});f=e}return eA(f,e)}function nA(){return(0,X.jsxs)(U,{path:`/p/:projectId`,element:(0,X.jsx)(Jk,{}),children:[(0,X.jsx)(U,{index:!0,element:(0,X.jsx)(DO,{})}),(0,X.jsx)(U,{path:`new`,element:(0,X.jsx)(Yk,{})}),(0,X.jsx)(U,{path:`activity`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(hy,{}),children:(0,X.jsx)(Hk,{})})}),(0,X.jsxs)(U,{path:`tasks/:id`,element:(0,X.jsx)(Qw,{}),children:[(0,X.jsx)(U,{index:!0,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(XC,{}),children:(0,X.jsx)(Mk,{})})}),(0,X.jsx)(U,{path:`changes`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(KC,{tab:`changes`}),children:(0,X.jsx)(Nk,{})})}),(0,X.jsx)(U,{path:`files`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(KC,{tab:`files`}),children:(0,X.jsx)(Pk,{})})}),(0,X.jsx)(U,{path:`report`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(`div`,{"data-route":`task-report`,children:(0,X.jsx)(`h1`,{className:`p-4 text-sm text-soft-foreground`,children:`Loading report…`})}),children:(0,X.jsx)(Fk,{})})}),(0,X.jsx)(U,{path:`commits`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(KC,{tab:`changes`}),children:(0,X.jsx)(Ik,{})})}),(0,X.jsx)(U,{path:`commits/:sha`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(KC,{tab:`changes`}),children:(0,X.jsx)(Ik,{})})}),(0,X.jsx)(U,{path:`issue/:n`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(YC,{kind:`issue`}),children:(0,X.jsx)(Lk,{kind:`issue`})})}),(0,X.jsx)(U,{path:`pr/:n`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(YC,{kind:`pr`}),children:(0,X.jsx)(Lk,{kind:`pr`})})})]}),(0,X.jsx)(U,{path:`git`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(HC,{}),children:(0,X.jsx)(Rk,{section:`main`,index:!0})})}),(0,X.jsx)(U,{path:`git/commits`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(HC,{}),children:(0,X.jsx)(Rk,{section:`main`})})}),(0,X.jsx)(U,{path:`git/commits/:sha`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(HC,{}),children:(0,X.jsx)(Rk,{section:`main`})})}),(0,X.jsx)(U,{path:`git/not-landed`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(HC,{}),children:(0,X.jsx)(Rk,{section:`not-landed`})})}),(0,X.jsx)(U,{path:`git/cleanup`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(HC,{}),children:(0,X.jsx)(Rk,{section:`cleanup`})})}),(0,X.jsx)(U,{path:`git/branches`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(HC,{}),children:(0,X.jsx)(Rk,{section:`branches`})})}),(0,X.jsx)(U,{path:`git/changes`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(HC,{}),children:(0,X.jsx)(Rk,{section:`changes`})})}),(0,X.jsx)(U,{path:`github`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(gy,{}),children:(0,X.jsx)(zk,{view:`issues`,index:!0})})}),(0,X.jsx)(U,{path:`github/prs`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(gy,{}),children:(0,X.jsx)(zk,{view:`prs`})})}),(0,X.jsx)(U,{path:`github/issues/:n`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(gy,{}),children:(0,X.jsx)(zk,{view:`issues`})})}),(0,X.jsx)(U,{path:`github/prs/:n`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(gy,{}),children:(0,X.jsx)(zk,{view:`prs`})})}),(0,X.jsx)(U,{path:`github/prs/:n/changes`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(gy,{}),children:(0,X.jsx)(zk,{view:`prs`,changes:!0})})}),(0,X.jsx)(U,{path:`automations`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(`p`,{role:`status`,children:`Loading automations…`}),children:(0,X.jsx)(Ok,{})})}),(0,X.jsx)(U,{path:`automations/new`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(`p`,{role:`status`,children:`Loading automations…`}),children:(0,X.jsx)(Ok,{mode:`new`})})}),(0,X.jsx)(U,{path:`automations/:automationId`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(`p`,{role:`status`,children:`Loading automations…`}),children:(0,X.jsx)(Ok,{mode:`edit`})})}),(0,X.jsx)(U,{path:`automations/:automationId/log`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(`p`,{role:`status`,children:`Loading automations…`}),children:(0,X.jsx)(Ok,{mode:`log`})})}),(0,X.jsx)(U,{path:`skills`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(UC,{}),children:(0,X.jsx)(Wk,{})})}),(0,X.jsx)(U,{path:`reports`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(`p`,{role:`status`,children:`Loading reports…`}),children:(0,X.jsx)(Bk,{})})}),(0,X.jsx)(U,{path:`workflows`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(GC,{}),children:(0,X.jsx)(Vk,{})})}),(0,X.jsx)(U,{path:`workflows/:name`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(GC,{}),children:(0,X.jsx)(Vk,{})})}),(0,X.jsx)(U,{path:`settings`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(`p`,{role:`status`,children:`Loading settings…`}),children:(0,X.jsx)(Ak,{})})}),(0,X.jsx)(U,{path:`settings/skills`,element:(0,X.jsx)(Gk,{})}),kv(`project`).map(e=>(0,X.jsx)(U,{path:`settings/${e.id}`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(`p`,{role:`status`,children:`Loading settings…`}),children:(0,X.jsx)(jk,{section:e,scope:`project`})})},e.id)),kv(`global`).map(e=>(0,X.jsx)(U,{path:`settings/${e.id}`,element:(0,X.jsx)(Kk,{sectionId:e.id})},e.id)),(0,X.jsx)(U,{path:`*`,element:(0,X.jsx)(BC,{})})]})}function rA(e){let t=Tn(mn(nA()),e),n=t?.at(-1);return!t||!n||n.route.path===`*`?null:{pattern:`/${t.slice(1).map(e=>e.route.path).filter(e=>e!==void 0).join(`/`)}`.replace(/\/$/,``)||`/`,params:n.params}}function iA(){return(0,X.jsxs)(Cn,{children:[nA(),(0,X.jsx)(U,{path:`/tasks`,element:(0,X.jsx)(Ck,{})}),(0,X.jsx)(U,{path:`/tools`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(`p`,{role:`status`,children:`Loading workspace tools…`}),children:(0,X.jsx)(kk,{})})}),(0,X.jsx)(U,{path:`/activity`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(hy,{}),children:(0,X.jsx)(Uk,{})})}),(0,X.jsx)(U,{path:`/settings/global`,element:(0,X.jsx)(vn,{to:jv,replace:!0})}),(0,X.jsx)(U,{path:`/settings/global/skills`,element:(0,X.jsx)(vn,{to:`/skills`,replace:!0})}),kv(`global`).map(e=>(0,X.jsx)(U,{path:Av(`global`,e.id),element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(`p`,{role:`status`,children:`Loading settings…`}),children:(0,X.jsx)(jk,{section:e,scope:`global`})})},e.id)),(0,X.jsx)(U,{path:`*`,element:(0,X.jsx)(tA,{})})]})}function aA(){let[e]=(0,Y.useState)(bs);return(0,Y.useEffect)(()=>An(e),[e]),(0,X.jsx)(Ss,{children:(0,X.jsx)(Rt,{client:e,children:(0,X.jsxs)(Dn,{children:[(0,X.jsx)(ys,{}),(0,X.jsx)(py,{}),(0,X.jsx)(Uu,{children:(0,X.jsx)(ay,{children:(0,X.jsxs)(wn,{children:[(0,X.jsx)(sy,{}),(0,X.jsx)(xs.Provider,{value:rA,children:(0,X.jsx)(hi,{children:(0,X.jsx)(Wv,{children:(0,X.jsx)(iA,{})})})}),(0,X.jsx)(Kt,{})]})})})]})})})}var oA=document.querySelector(`meta[name="cez-api-base"]`)?.getAttribute(`content`);l(me(oA,void 0,void 0));var sA=document.getElementById(`root`);if(!sA)throw Error(`Squawk: #root container is missing from index.html`);(0,ts.createRoot)(sA).render((0,X.jsx)(Y.StrictMode,{children:(0,X.jsx)(aA,{})}));export{jy as $,$s as $n,Ah as $t,SS as A,$f as An,k_ as At,Ux as B,hd as Bn,S_ as Bt,KC as C,mp as Cn,ov as Ct,iC as D,op as Dn,R_ as Dt,VC as E,lp as En,K_ as Et,wS as F,Gf as Fn,p_ as Ft,Rx as G,Wu as Gn,l_ as Gt,Bx as H,fd as Hn,u_ as Ht,TS as I,Kf as In,w_ as It,Sx as J,Rl as Jn,c_ as Jt,zx as K,hu as Kn,s_ as Kt,Jx as L,nf as Ln,T_ as Lt,bS as M,Yf as Mn,E_ as Mt,vS as N,qf as Nn,D_ as Nt,nC as O,gp as On,F_ as Ot,ES as P,Wf as Pn,m_ as Pt,Oy as Q,lc as Qn,Kh as Qt,qx as R,gd as Rn,g_ as Rt,qC as S,ap as Sn,iv as St,HC as T,up as Tn,sv as Tt,Ix as U,md as Un,d_ as Ut,Kx as V,_d as Vn,n_ as Vt,Ax as W,dd as Wn,a_ as Wt,Iy as X,Ml as Xn,_g as Xt,Fy as Y,Pl as Yn,Gg as Yt,Cy as Z,Al as Zn,qh as Zt,mw as _,Qp as _n,Z_ as _t,nE as a,Ih as an,zs as ar,gy as at,XC as b,tp as bn,J_ as bt,Xw as c,Fh as cn,Fs as cr,ly as ct,Ew as d,Ym as dn,Ds as dr,Av as dt,Rh as en,Zs as er,Ay as et,Dw as f,_m as fn,Ts as fr,kv as ft,pw as g,Xp as gn,W_ as gt,yw as h,Jp as hn,$_ as ht,dD as i,Dh as in,Bs as ir,_y as it,_S as j,Qf as jn,j_ as jt,CS as k,Xf as kn,N_ as kt,Jw as l,vh as ln,Ns as lr,oy as lt,kw as m,Zp as mn,fv as mt,tO as n,Nh as nn,Ws as nr,ky as nt,tE as o,zh as on,Rs as or,hy as ot,Cw as p,am as pn,ws as pr,pv as pt,Cx as q,Zl as qn,o_ as qt,fD as r,Oh as rn,Hs as rr,My as rt,eE as s,kh as sn,Ls as sr,cy as st,IO as t,Ph as tn,Ys as tr,Ty as tt,Tw as u,Th as un,As as ur,jv as ut,hw as v,bp as vn,Q_ as vt,GC as w,vp as wn,q_ as wt,YC as x,fp as xn,G_ as xt,ew as y,ep as yn,U_ as yt,Yx as z,vd as zn,__ as zt};
|
|
20
|
+
`)[0]??``;return n.length>t?`${n.slice(0,t-1)}…`:n}function RS(e){let{task:t,steps:n,agentProfile:r,model:i,modelsLocked:a,effort:o,runner:s,runnerExplicit:c,defaultRunner:l,images:u,archiveWhenDone:d,autoMergePr:f,allowWorkers:p,allowMessaging:m}=e;return{task:t,steps:[...n],...r?{agentProfile:r}:{},model:a?void 0:i||void 0,effort:a?void 0:o||void 0,runner:TS(s,l,c),images:u.length>0?[...u]:void 0,...AS({archiveWhenDone:d,autoMergePr:f,allowWorkers:p,allowMessaging:m})}}function zS(e,t,n){return{runner:e,agentProfile:t||null,...e===n?{}:{model:null,effort:null}}}function BS(e,t){let n=lS(e);return{...n,...t.runner===void 0?{}:zS(t.runner,t.account,n.runner),...t.ref===``?{}:{text:t.ref},...t.skill===``?{}:{source:{source:`skill`,ref:t.skill,...t.skillPath===void 0?{}:{path:t.skillPath}}}}}function VS(e,t,n){let[r,i]=(0,Y.useState)(()=>BS(e,t)),a=(0,Y.useRef)(r);(0,Y.useEffect)(()=>{uS(a.current,e)},[e]);let o=(0,Y.useRef)(!1),s=(0,Y.useRef)(!0);(0,Y.useEffect)(()=>(s.current=!0,()=>{s.current=!1}),[]);let c=t=>{if(!s.current||o.current)return;let n={...a.current,...t};a.current=n,uS(n,e),i(n)},l=(0,Y.useRef)(t.runner===void 0);return(0,Y.useEffect)(()=>{!l.current||n===void 0||(l.current=!1,c(zS(n,t.account,a.current.runner)))},[n]),{draft:r,update:c,clearStarted:t=>{if(cS(e)!==t)return;fS(e,t);let n=lS(e);a.current=n,s.current&&i(n)},submissionPending:o,mounted:s}}function HS(e,t,n,r){let i=d(),a=v(n,r),o=a.data,s=t.data?.skillUsage,c=(0,Y.useMemo)(()=>No(o??[],s),[o,s]),l=i.data?.workflows??[],u=i.data!==void 0&&!t.isPending,f=OS(e,c,l,a.unchecked),p=f?.source===`skill`?c.find(e=>e.id===f.ref&&(f.path===void 0||e.path===f.path)):void 0;return{skillList:c,skillUsage:s,workflowList:l,sourcesReady:u,source:f,selectedSkill:p,skillsSettled:!a.isPending,listUnchecked:a.unchecked,unchecked:a.unchecked||f?.source===`skill`&&!p}}function US(e){let{uiState:t,source:n,sourcesReady:r,draftText:i,submissionPending:a,update:o}=e,s=t.data?.promptTemplates,c=(0,Y.useMemo)(()=>Ty(s),[s]),l=Oy(c,n?.source===`skill`?[n.ref]:[]),u=(0,Y.useRef)(i);u.current=i;let d=(0,Y.useRef)(``);return(0,Y.useEffect)(()=>{if(!r||a.current)return;let e=ky(u.current,d.current,l);d.current=e.applied,e.text!==u.current&&o({text:e.text})},[l,r]),c}function WS(e,t){let n=p(),r=R(),i=Qp(),{runners:a,uninstalled:o,signedOut:s}=i,c=t.data?.defaultRunner,l=c??`claude`,d=a.length>0?wS(e.runner,a,l):null,{runner:f,ready:m}=he(d??l),h=n.isSuccess&&a.length>0,g={isPending:n.isPending||r.isPending,isError:n.isError||r.isError},_=i.accountFor(f,e.agentProfile)??i.repoAccount?.[f],v=M(c,u(r.data)),y=v===void 0?null:i.accountFor(v,d===v?e.agentProfile:null),b=be(f,m,_),x=t.data?.modelsLocked===!0,S=t.data?.defaultModels,C=d===null?[]:bS(d,r.data,b.data,[e.model,S?.[d]]),w=d===null?``:ES(x?null:e.model,d,r.data,S,b.data),T=_S(w,b.data);return{providers:g,registered:r,runners:a,uninstalled:o,signedOut:s,defaultRunner:c,planAccount:y,runner:d,displayRunner:f,providersReady:h,catalog:b,modelsLocked:x,models:C,model:w,effortOptions:T,effort:x?``:vS(e.effort,T)}}function GS(e,t){let n=ie(),{accounts:r,repoAccount:i,accountFor:a}=Qp();return{accountChoices:r,repoAccount:i,accountsSettled:!n.isPending,agentProfile:a(e,t)}}function KS(e){let t=(0,Y.useRef)(!1),n=(0,Y.useRef)(void 0);(0,Y.useEffect)(()=>{n.current===void 0&&(n.current=document.activeElement);let r=e&&!t.current;t.current=e,r&&(document.activeElement===document.body||document.activeElement===n.current)&&document.querySelector(`textarea[aria-label="Describe a task for the agent"]`)?.focus()},[e])}function qS(e){let t=e.workspaceConfig.data?.composerDefaults;return Qx({hasGit:e.hasGit,planFirst:e.draft.planFirst,explicitAutonomous:e.draft.autonomous,explicitWorktree:e.draft.worktree,configuredAutonomous:t?.autonomous??t?.inheritedAutonomous??`source-dependent`,configuredWorktree:t?.worktree??t?.inheritedWorktree??!0,source:e.source?.source??`workflow`})}function JS(e){let t=T(),n=t.data?.projects??[],r=e??t.data?.bootProject,i=Jx(n.find(e=>e.id===r)),[a,o]=(0,Y.useState)(!1);return{projectList:n,webhookTargets:i,notifyOn:i.length>0&&a,setNotifyChoice:o}}function YS(e){let[t,n]=(0,Y.useState)(()=>typeof window<`u`&&window.innerWidth<=767);return(0,Y.useLayoutEffect)(()=>{let t=e.current;if(!t)return;let r=()=>n(window.innerWidth<=767||t.getBoundingClientRect().width<550);r();let i=typeof ResizeObserver>`u`?null:new ResizeObserver(r);return i?.observe(t),window.addEventListener(`resize`,r),()=>{i?.disconnect(),window.removeEventListener(`resize`,r)}},[]),t}function XS(e){let t=xa(),[n,r]=(0,Y.useState)(()=>e.deepLink.ref!==``||e.deepLink.skillPath!==void 0);ZS(e.search,t),QS({pending:n,setPending:r,deepLink:e.deepLink,sourcesReady:e.sourcesReady,listUnchecked:e.listUnchecked,skillList:e.skillList,update:e.update})}function ZS(e,t){let n=(0,Y.useRef)(!1);(0,Y.useEffect)(()=>{n.current||(n.current=!0,e.toString()!==``&&t(`/new`,{replace:!0}))},[])}function QS(e){let{pending:t,sourcesReady:n,deepLink:r}=e;(0,Y.useEffect)(()=>{if(!t||!n)return;e.setPending(!1);let i=!e.listUnchecked&&r.skill!==``&&!DS({source:`skill`,ref:r.skill,...r.skillPath===void 0?{}:{path:r.skillPath}},e.skillList,[])?r.skill:``;i!==``&&r.ref!==``&&e.update({text:Zx(r.skill,r.ref),source:null});let{message:a,tone:o}=Xx(i,r.ref!==``);B(a,{tone:o}),document.querySelector(`[data-slot="composer"] button[aria-label="Start task"], [data-slot="composer"] button[aria-label="Plan task"]`)?.focus()},[t,n])}function $S(e){return e.isPending?`Checking agent providers…`:e.isError?`Provider authentication could not be verified.`:`Connect an agent provider before starting a task.`}function eC(e,t,n){Je({lastTask:e?{source:e.source,ref:e.ref}:null,...e?{recentSources:mS(t.data?.recentSources,{source:e.source,ref:e.ref})}:{},...e?.source===`skill`&&t.data!==void 0?{skillUsage:Io(t.data.skillUsage,e.ref)}:{}}).then(()=>n.invalidateQueries({queryKey:k.uiState})).catch(()=>{})}function tC(e){let t=xa(),n=z(),[r,i]=(0,Y.useState)(null),[a,o]=(0,Y.useState)(!1),[s,c]=(0,Y.useState)(!1),{draft:l,draftProjectId:u,engine:d,mounted:f}=e,{providers:p,providersReady:m,runner:h}=d,g=(r,i)=>{e.clearStarted(i),n.invalidateQueries({queryKey:k.runs.all}),f.current&&t(MS(r))};return{plan:r,setPlan:i,planning:a,starting:s,submit:async(t,r)=>{let a=cS(u);if(!m||h===null)throw Error($S(p));if(!e.sourcesReady)throw Error(`Still loading workflows and skills — try again in a second.`);if(l.agentProfile&&!e.accountsSettled)throw Error(`Still loading agent accounts — try again in a second.`);if(l.planFirst){o(!0);try{let e=await Me(t,d.planAccount);f.current&&i(NS(t,r,e))}finally{o(!1)}return}let s=await Gt(jS(kS({task:t,source:e.source,model:d.model,modelsLocked:d.modelsLocked,effort:d.effort,runner:h,runnerExplicit:l.runner!==null,agentProfile:e.agentProfile,defaultRunner:d.defaultRunner,images:r,worktree:e.runMode.worktree,autonomous:e.runMode.autonomous,archiveWhenDone:l.archiveWhenDone,autoMergePr:l.autoMergePr,allowWorkers:l.allowWorkers,allowMessaging:l.allowMessaging}),e.notifyOn));eC(e.source,e.uiState,n),g(s,a)},startPlanned:async()=>{if(r===null||r.steps.length===0||s||!m||h===null||l.agentProfile&&!e.accountsSettled)return;let t=cS(u);c(!0);try{let n=await Gt(jS(RS({task:r.task,steps:r.steps,agentProfile:e.agentProfile,model:d.model,modelsLocked:d.modelsLocked,effort:d.effort,runner:h,runnerExplicit:l.runner!==null,defaultRunner:d.defaultRunner,images:r.images,archiveWhenDone:l.archiveWhenDone,autoMergePr:l.autoMergePr,allowWorkers:l.allowWorkers,allowMessaging:l.allowMessaging}),e.notifyOn));i(null),g(n,t)}catch(e){B(e instanceof Error?e.message:String(e),{tone:`danger`})}finally{c(!1)}}}}function nC({archiveWhenDone:e,autoMergePr:t,onChange:n,disabled:r=!1,disabledReason:i=`Unavailable while saving these settings.`,embedded:a=!1}){let o=(0,Y.useId)(),s=r?i:void 0;return(0,X.jsxs)(`fieldset`,{"data-slot":`completion-controls`,"data-embedded":a||void 0,className:`grid min-w-0 gap-3`,children:[(0,X.jsx)(`legend`,{className:a?`sr-only`:`text-sm font-medium [margin-block-end:0.5rem]`,children:`After Done`}),(0,X.jsxs)(`label`,{htmlFor:`${o}-archive`,className:`completion-control flex min-h-11 min-w-0 items-center justify-between gap-3 rounded-md text-sm`,children:[(0,X.jsxs)(`span`,{className:`min-w-0 break-words`,children:[(0,X.jsx)(`span`,{id:`${o}-archive-label`,children:`Archive when Done`}),a?(0,X.jsx)(`span`,{id:`${o}-archive-help`,className:`completion-control-help`,children:s??`Move to Archived after Done, even without a PR. You can restore it later.`}):null]}),(0,X.jsx)(la,{id:`${o}-archive`,className:`completion-switch`,checked:e,disabled:r,"aria-labelledby":`${o}-archive-label`,"aria-describedby":`${o}-archive-help`,onCheckedChange:e=>n({archiveWhenDone:e})})]}),a?null:(0,X.jsx)(`p`,{id:`${o}-archive-help`,className:`text-xs break-words text-muted-foreground`,children:s??`Move the task to Archived after it reaches Done. You can restore it later.`}),(0,X.jsxs)(`label`,{htmlFor:`${o}-merge`,className:`completion-control flex min-h-11 min-w-0 items-center justify-between gap-3 rounded-md text-sm`,children:[(0,X.jsxs)(`span`,{className:`min-w-0 break-words`,children:[(0,X.jsx)(`span`,{id:`${o}-merge-label`,children:`Auto-merge PR`}),a?(0,X.jsx)(`span`,{id:`${o}-merge-help`,className:`completion-control-help`,children:s??`After Done, mark the PR ready and merge when current-head CI and GitHub rules allow.`}):null]}),(0,X.jsx)(la,{id:`${o}-merge`,className:`completion-switch`,checked:t,disabled:r,"aria-labelledby":`${o}-merge-label`,"aria-describedby":`${o}-merge-help`,onCheckedChange:e=>n({autoMergePr:e})})]}),a?null:(0,X.jsx)(`p`,{id:`${o}-merge-help`,className:`text-xs break-words text-muted-foreground`,children:s??`After Done, mark a draft PR ready and merge when current-head CI and GitHub rules allow it.`}),!a||e&&t?(0,X.jsx)(`p`,{className:`completion-order-note text-xs break-words text-muted-foreground`,children:a?`Merge runs before archive when both are on.`:`When both are on, merge comes before archive. Without a PR, Archive when Done still archives the task.`}):null]})}var rC=[{key:`allowWorkers`,slot:`workers`,label:`Allow Squawk workers`,help:`Agents in this task can start Squawk workers. Each worker is a separate paid agent session. Worker limits cap resources, not spending.`},{key:`allowMessaging`,slot:`messaging`,label:`Allow task messaging`,help:`Agents in this task can message other tasks in this project.`}];function iC({allowWorkers:e,allowMessaging:t,onChange:n,disabled:r=!1,embedded:i=!1}){let a=(0,Y.useId)(),o={allowWorkers:e,allowMessaging:t};return(0,X.jsxs)(`fieldset`,{"data-slot":`task-access-controls`,"data-embedded":i||void 0,className:`grid min-w-0 gap-3`,children:[(0,X.jsx)(`legend`,{className:i?`sr-only`:`text-sm font-medium [margin-block-end:0.5rem]`,children:`Task access`}),rC.map(e=>(0,X.jsxs)(Y.Fragment,{children:[(0,X.jsxs)(`label`,{htmlFor:`${a}-${e.slot}`,"data-slot":`task-access-${e.slot}`,className:`completion-control flex min-h-11 min-w-0 items-center justify-between gap-3 rounded-md text-sm`,children:[(0,X.jsxs)(`span`,{className:`min-w-0 break-words`,children:[(0,X.jsx)(`span`,{id:`${a}-${e.slot}-label`,children:e.label}),i?(0,X.jsx)(`span`,{id:`${a}-${e.slot}-help`,className:`completion-control-help`,children:e.help}):null]}),(0,X.jsx)(la,{id:`${a}-${e.slot}`,className:`completion-switch shrink-0`,checked:o[e.key],disabled:r,"aria-labelledby":`${a}-${e.slot}-label`,"aria-describedby":`${a}-${e.slot}-help`,onCheckedChange:t=>n({[e.key]:t})})]}),i?null:(0,X.jsx)(`p`,{id:`${a}-${e.slot}-help`,className:`text-xs break-words text-muted-foreground`,children:e.help})]},e.key))]})}var aC=[{id:`fix-bug`,label:`Fix a bug`,body:`Investigate and fix the issue, adding a regression test that reproduces it first.`},{id:`add-tests`,label:`Add tests`,body:`Add focused unit tests covering the edge cases and verify the suite passes.`},{id:`review-changes`,label:`Review changes`,body:`Review the recent changes for bugs, edge cases, and missing test coverage.`}];function oC({templates:e,onInsert:t}){let n=e.length>0?e.slice(0,4).map(e=>({id:e.id,label:e.label,body:e.text})):aC,r=e.length>0?`Saved templates`:`Quick start prompts`;return(0,X.jsxs)(`section`,{"data-slot":`new-task-quick-prompts`,"aria-label":r,className:`mt-5 flex flex-col gap-2.5 rounded-xl border border-border bg-card p-4`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-baseline justify-between gap-2`,children:[(0,X.jsx)(`h2`,{className:`text-xs font-semibold text-foreground`,children:r}),(0,X.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Insert a starting prompt into the composer`})]}),(0,X.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:n.map(e=>(0,X.jsx)(`button`,{type:`button`,"data-slot":`new-task-quick-prompt`,onClick:()=>t(e.body),className:`inline-flex min-h-9 max-md:min-h-11 no-hover:min-h-11 items-center rounded-lg border border-border bg-background px-3 py-1.5 text-left text-xs font-medium text-foreground transition-colors hover:bg-muted focus-visible:outline-2 focus-visible:outline-ring`,children:e.label},e.id))})]})}function sC({groupRef:e,compact:t,engine:n,accounts:r,draftEffort:i,update:a}){let o=n.runners.length>1||n.uninstalled.length>0||n.signedOut.length>0||n.runners.some(e=>Zp(r.accountChoices,e))?(0,X.jsx)(cC,{engine:n,accounts:r,update:a},`runner`):null,s=(0,X.jsx)(lC,{engine:n,draftEffort:i,update:a},`model`),c=(0,X.jsx)(uC,{engine:n,update:a},`effort`);return(0,X.jsx)(`div`,{ref:e,"data-slot":`agent-options`,role:`group`,"aria-label":`Agent settings`,className:`new-task-agent-options`,children:(0,X.jsx)(Ax,{children:t?[o,c,s]:[o,s,c]})})}function cC({engine:e,accounts:t,update:n}){return(0,X.jsx)(Rx,{icon:(0,X.jsx)(Sr,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,runners:e.runners,uninstalled:e.uninstalled,signedOut:e.signedOut,value:e.displayRunner,accounts:t.accountChoices,account:t.agentProfile,repoAccount:t.repoAccount,onPick:(t,r)=>n({runner:t,agentProfile:r,...t===e.displayRunner?{}:{model:null}}),disabled:!e.providersReady})}function lC({engine:e,draftEffort:t,update:n}){let{catalog:r,displayRunner:i}=e;return(0,X.jsx)(Ix,{icon:(0,X.jsx)(Vr,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,slot:`model-pill`,ariaLabel:`Model`,label:e.models.find(t=>t.id===e.model)?.label??`auto`,value:e.model,disabled:!e.providersReady,readOnly:e.modelsLocked,disabledHint:e.modelsLocked?`Model selection is locked to native coding-agent settings.`:void 0,onPick:e=>{let i=_S(e,r.data);n({model:e,effort:t===null?null:vS(t,i)})},options:e.models.map(e=>({value:e.id,label:e.label,desc:e.desc})),status:SS(i,e.registered.data,r)})}function uC({engine:e,update:t}){return(0,X.jsx)(Ix,{icon:(0,X.jsx)(wr,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,slot:`effort-pill`,ariaLabel:`Effort`,label:e.effortOptions.find(t=>t.value===e.effort)?.label??`auto`,value:e.effort,disabled:!e.providersReady,readOnly:e.modelsLocked,disabledHint:e.modelsLocked?`Effort selection is locked to native coding-agent settings.`:void 0,onPick:e=>t({effort:e}),options:e.effortOptions.map(e=>({value:e.value,label:e.label,desc:e.desc}))})}function dC({engine:e,draft:t,update:n,repo:r,hasGit:i,runMode:a,webhook:o,completionDisabled:s}){let{displayRunner:c}=e,l=R().data,u=_g(),[d,f]=(0,Y.useState)(),p=d??u;return(0,X.jsxs)(`details`,{"data-slot":`execution-options`,open:p,onToggle:e=>{e.currentTarget.open!==p&&f(e.currentTarget.open)},className:`group rounded-xl border border-border bg-card xl:self-start`,children:[(0,X.jsxs)(`summary`,{className:`flex min-h-[44px] cursor-pointer list-none flex-wrap items-center gap-x-2 gap-y-1 px-3 py-2 text-xs text-muted-foreground pointer-hover:bg-muted/50 active:bg-muted/50 focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-foreground [&::-webkit-details-marker]:hidden`,children:[(0,X.jsx)(_r,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),(0,X.jsx)(`span`,{className:`font-medium text-foreground`,children:`Execution settings`}),(0,X.jsxs)(`span`,{"data-slot":`execution-summary`,hidden:!0,className:`min-w-0 basis-full truncate pl-5 xl:ml-auto xl:basis-auto xl:pl-0`,children:[A(l,c),` · `,e.models.find(t=>t.id===e.model)?.label??`auto`]}),(0,X.jsx)(Tr,{"aria-hidden":`true`,className:`new-task-settings-chevron size-4 shrink-0`})]}),(0,X.jsxs)(`div`,{className:`new-task-settings-body`,children:[(0,X.jsx)(`p`,{className:`new-task-settings-description`,children:`Control this run and what happens after Done.`}),(0,X.jsxs)(`div`,{role:`group`,"aria-label":`Run settings`,className:`new-task-run-settings`,children:[i?(0,X.jsx)(mC,{on:a.worktree,onChange:e=>n({worktree:e})}):null,(0,X.jsx)(_C,{repo:r}),(0,X.jsx)(hC,{on:a.autonomous,disabled:t.planFirst,onChange:e=>n({autonomous:e})}),o.targets.length>0?(0,X.jsx)(gC,{on:o.on,targets:o.targets,onChange:o.onChange}):null]}),(0,X.jsx)(nC,{embedded:!0,archiveWhenDone:t.archiveWhenDone,autoMergePr:t.autoMergePr,onChange:n,disabled:s,disabledReason:`Unavailable while starting the task or preparing its plan.`}),(0,X.jsx)(iC,{embedded:!0,allowWorkers:t.allowWorkers,allowMessaging:t.allowMessaging,onChange:n,disabled:s})]})]})}function fC({showConfigureProviders:e,planFirst:t,planning:n,onModeChange:r}){return(0,X.jsxs)(X.Fragment,{children:[e?(0,X.jsx)(q,{to:`/settings/agent-defaults#providers`,className:`text-xs font-medium text-foreground underline underline-offset-4`,children:`Configure providers`}):null,(0,X.jsx)(SC,{planFirst:t,planning:n,onModeChange:r}),(0,X.jsx)(`kbd`,{"aria-hidden":`true`,className:`hidden rounded-[5px] border border-b-2 border-border bg-card px-[5px] py-px font-mono text-xs font-medium text-muted-foreground md:inline`,children:Iy()})]})}function pC({on:e}){let t=e?`checked`:`unchecked`;return(0,X.jsx)(`span`,{"aria-hidden":`true`,"data-slot":`toggle-track`,"data-state":t,className:c(`flex h-6 w-10 shrink-0 items-center rounded-full border p-0.5`,ca),children:(0,X.jsx)(`span`,{"data-state":t,className:c(`size-[18px] rounded-full`,e&&`ml-auto`,ua)})})}function mC({on:e,disabled:t,disabledReason:n,onChange:r}){return(0,X.jsxs)(`button`,{type:`button`,role:`checkbox`,"aria-checked":e,disabled:t,"aria-label":`Worktree`,"data-slot":`worktree-toggle`,onClick:()=>r(!e),title:t?n:e?`Runs in an isolated worktree — uncheck to run in the repo working tree`:`Runs in the repo working tree — check to isolate in a worktree`,className:`flex items-center justify-between gap-3 px-0 py-3 text-left`,children:[(0,X.jsxs)(`span`,{children:[(0,X.jsx)(`span`,{className:`block text-[13px] font-medium`,children:`Worktree`}),(0,X.jsx)(`span`,{className:`block text-[12px] text-muted-foreground`,children:e?`Changes stay in a separate working copy.`:`Changes are made in the current working directory.`})]}),(0,X.jsx)(pC,{on:e})]})}function hC({on:e,disabled:t,onChange:n}){return(0,X.jsxs)(`button`,{type:`button`,role:`checkbox`,"aria-checked":e,disabled:t,"aria-label":`Autonomous`,"data-slot":`autonomous-toggle`,onClick:()=>n(!e),title:t?`Plan-first runs are interactive — autonomous is unavailable`:e?`Autonomous — the agent runs to completion without pausing for you`:`Runs interactively — check to let the agent finish without pausing for you`,className:`flex items-center justify-between gap-3 px-0 py-3 text-left disabled:opacity-50`,children:[(0,X.jsxs)(`span`,{children:[(0,X.jsx)(`span`,{className:`block text-[13px] font-medium`,children:`Autonomous`}),(0,X.jsx)(`span`,{className:`block text-[12px] text-muted-foreground`,children:`Let the agent proceed without prompts`})]}),(0,X.jsx)(pC,{on:e})]})}function gC({on:e,targets:t,onChange:n}){return(0,X.jsxs)(`button`,{type:`button`,role:`checkbox`,"aria-checked":e,"aria-label":`Notify webhook`,"data-slot":`notify-webhook-toggle`,onClick:()=>n(!e),title:`${e?`Status changes go to`:`Check to send this task's status changes to`} ${Yx(t)} (${t.map(e=>qx(e.url)).join(`, `)})`,className:`flex min-h-11 items-center justify-between gap-3 px-0 py-3 text-left`,children:[(0,X.jsxs)(`span`,{className:`min-w-0`,children:[(0,X.jsx)(`span`,{className:`block text-[13px] font-medium`,children:`Notify webhook`}),(0,X.jsx)(`span`,{"data-slot":`notify-webhook-subtitle`,className:`block truncate text-[12px] text-muted-foreground`,children:`Send status changes`})]}),(0,X.jsx)(pC,{on:e})]})}function _C({repo:e}){return(0,X.jsxs)(`div`,{"data-slot":`base-branch-row`,className:`new-task-base-branch flex items-center justify-between gap-2 text-xs text-muted-foreground`,children:[(0,X.jsx)(`span`,{children:`Base branch`}),e?(0,X.jsx)(vC,{repo:e}):null]})}function vC({repo:e}){let t=z(),n=F({mutationFn:e=>ot({baseBranch:e}),onSuccess:e=>{t.invalidateQueries({queryKey:k.repo}),B(e.baseBranch?`New tasks will branch off "${e.baseBranch}" (PRs target it too).`:`Base branch cleared — new tasks fork from the checked-out branch.`)},onError:e=>B(e.message,{tone:`danger`})});return e.info?(0,X.jsx)(Ix,{searchPlaceholder:`Search branches…`,slot:`base-pill`,ariaLabel:`Base branch`,label:(0,X.jsx)(`span`,{className:`text-xs`,children:e.baseBranch??e.info.branch}),value:e.baseBranch??``,onPick:e=>n.mutate(e===``?null:e),options:[{value:``,label:`follow checked-out branch (${e.info.branch})`,desc:`New task worktrees fork from whatever branch is checked out`},...e.branches.map(e=>({value:e,label:e}))]}):null}var yC=`h-6 rounded-md px-3 text-xs font-medium transition-colors outline-hidden focus-visible:ring-2 focus-visible:ring-ring/50`,bC=`bg-muted text-foreground`,xC=`text-muted-foreground pointer-hover:text-foreground`;function SC({planFirst:e,planning:t,onModeChange:n}){return(0,X.jsxs)(`div`,{"data-slot":`mode-seg`,role:`radiogroup`,"aria-label":`Run mode`,className:`inline-flex items-center gap-0.5 rounded-lg border border-border bg-card p-0.5`,children:[(0,X.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":!e,onClick:()=>n(!1),className:c(yC,e?xC:bC),children:`Run now`}),(0,X.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":e,"aria-busy":t||void 0,"data-slot":`mode-plan`,onClick:()=>n(!0),className:c(yC,e?bC:xC,t&&`animate-pulse`),children:t?`Planning…`:`Plan first`})]})}function CC({plan:e,starting:t,startAvailable:n,startUnavailableReason:r,startUnavailableAction:i,onStepsChange:a,onStart:o,onDiscard:s}){let[l,u]=(0,Y.useState)(null),[d,f]=(0,Y.useState)(null),p=(0,Y.useRef)(null),m=(0,Y.useId)();(0,Y.useEffect)(()=>{p.current?.focus({preventScroll:!0});let e=p.current?.closest(`[data-slot="main"]`);e&&(e.scrollTop=0)},[]);let h=()=>{u(null),f(null)},g=(t,n)=>{t.preventDefault(),l!==null&&l!==n&&a(FS(e.steps,l,n)),h()},_=e.steps.length===0;return(0,X.jsx)(`div`,{"data-slot":`plan-page`,children:(0,X.jsx)(`div`,{"data-slot":`plan-canvas`,children:(0,X.jsxs)(`section`,{ref:p,tabIndex:-1,"aria-labelledby":m,"data-slot":`plan-review`,className:`flex flex-col outline-none`,onKeyDown:e=>{e.key!==`Escape`||e.defaultPrevented||e.target.closest(`[role="dialog"], [role="alertdialog"]`)||(e.preventDefault(),s())},children:[(0,X.jsxs)(`header`,{"data-slot":`dialog-header`,className:`flex flex-col gap-1 px-5 pt-4 pb-3.5 text-left`,children:[(0,X.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,X.jsx)(`h2`,{id:m,"data-slot":`dialog-title`,className:`text-xs font-semibold tracking-[0.08em] text-muted-foreground uppercase`,children:`Proposed chain`}),(0,X.jsx)(`button`,{type:`button`,onClick:s,"aria-label":`Discard the plan`,className:`-mt-1 -mr-1 rounded-md p-1 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`,children:(0,X.jsx)(vr,{"aria-hidden":`true`,className:`size-4`})})]}),(0,X.jsx)(`p`,{"data-slot":`plan-task`,title:e.task,className:`text-[18px] font-medium text-foreground`,children:LS(e.task)}),e.fallback?(0,X.jsx)(`p`,{"data-slot":`plan-fallback`,className:`text-xs text-soft-foreground italic`,children:`planner unavailable — single-step plan`}):e.rationale===``?null:(0,X.jsx)(`p`,{"data-slot":`plan-rationale`,className:`text-xs text-muted-foreground`,children:e.rationale})]}),(0,X.jsx)(`ol`,{"data-slot":`plan-steps`,className:`flex-1 space-y-2 overflow-y-auto px-5 py-4`,children:_?(0,X.jsx)(`li`,{className:`py-6 text-center text-sm text-muted-foreground`,children:`(no steps left — discard and plan again)`}):e.steps.map((t,n)=>(0,X.jsxs)(`li`,{"data-slot":`plan-step`,"data-step-id":t.id,draggable:!0,onDragStart:()=>u(n),onDragOver:e=>{e.preventDefault(),f(n)},onDragLeave:()=>f(e=>e===n?null:e),onDrop:e=>g(e,n),onDragEnd:h,className:c(`flex items-center gap-2.5 rounded-lg border border-border bg-card-2 px-3 py-2.5`,l===n&&`opacity-50`,d===n&&l!==null&&l!==n&&`border-ring`),children:[(0,X.jsx)(ir,{"aria-hidden":`true`,className:`size-3.5 shrink-0 cursor-grab text-soft-foreground`}),(0,X.jsx)(`span`,{className:`w-5 shrink-0 font-mono text-xs text-muted-foreground tabular-nums`,children:String(n+1).padStart(2,`0`)}),(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,X.jsx)(`span`,{className:`text-[13px] font-medium`,children:t.name??t.id}),t.skill?(0,X.jsx)(`span`,{"data-slot":`plan-badge-skill`,title:`skill`,className:`shrink-0 rounded-full bg-accent-strong/15 px-1.5 py-px font-mono text-xs font-medium text-accent-text`,children:t.skill}):null,t.command?(0,X.jsx)(`span`,{"data-slot":`plan-badge-check`,className:`shrink-0 rounded-full bg-muted px-1.5 py-px text-xs font-medium text-muted-foreground`,children:`check`}):null]}),(0,X.jsx)(`p`,{className:`mt-3 whitespace-pre-wrap break-words font-mono text-xs text-muted-foreground`,children:IS(t)})]}),(0,X.jsxs)(`span`,{"data-slot":`plan-step-actions`,className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(G,{type:`button`,variant:`ghost`,size:`icon-sm`,"data-slot":`plan-step-up`,"aria-label":`Move step ${n+1} up`,disabled:n===0,className:`size-7 text-muted-foreground`,onClick:()=>a(FS(e.steps,n,n-1)),children:`Move up`}),(0,X.jsx)(G,{type:`button`,variant:`ghost`,size:`icon-sm`,"data-slot":`plan-step-down`,"aria-label":`Move step ${n+1} down`,disabled:n===e.steps.length-1,className:`size-7 text-muted-foreground`,onClick:()=>a(FS(e.steps,n,n+1)),children:`Move down`}),(0,X.jsx)(G,{type:`button`,variant:`ghost`,size:`icon-sm`,"data-slot":`plan-step-remove`,"aria-label":`Remove step ${n+1}`,className:`size-7 text-muted-foreground hover:text-semantic-red`,onClick:()=>a(PS(e.steps,n)),children:`Remove`})]})]},t.id))}),!n&&r?(0,X.jsxs)(`p`,{id:`plan-start-guidance`,className:`flex flex-wrap items-center gap-1.5 border-t border-border px-5 pt-3 text-xs text-muted-foreground`,children:[(0,X.jsx)(`span`,{children:r}),i]}):null,(0,X.jsxs)(`div`,{"data-slot":`plan-actions`,className:`flex flex-wrap items-center gap-3 px-6 pt-3 pb-6`,children:[(0,X.jsxs)(G,{type:`button`,"data-slot":`plan-start`,disabled:_||t||!n,title:n?void 0:r,"aria-describedby":!n&&r?`plan-start-guidance`:void 0,onClick:o,children:[(0,X.jsx)(mi,{"aria-hidden":`true`,className:`size-3.5`}),t?`Starting…`:`Start`]}),(0,X.jsx)(wC,{steps:e.steps,disabled:_}),(0,X.jsx)(G,{type:`button`,variant:`outline`,onClick:s,children:`Discard`})]}),(0,X.jsx)(`p`,{className:`px-6 pb-6 text-xs text-muted-foreground`,children:`No steps left? Start is disabled. A planner failure shows a single-step fallback.`})]})})})}function wC({steps:e,disabled:t}){let n=z(),[r,i]=(0,Y.useState)(!1),[a,o]=(0,Y.useState)(``),[s,c]=(0,Y.useState)(!1),[l,u]=(0,Y.useState)(!1),d=async t=>{let r=a.trim();if(!(r===``||l)){u(!0);try{let a=await Yt({name:r,steps:e,...t?{overwrite:!0}:{}});B(`Saved — ${a.path.split(`/`).pop()??a.path}`),n.invalidateQueries({queryKey:k.workflows}),c(!1),i(!1),o(``)}catch(e){e instanceof Ge&&e.exists===!0?c(!0):B(e instanceof Error?e.message:String(e),{tone:`danger`})}finally{u(!1)}}};return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(G,{type:`button`,variant:`outline`,"data-slot":`plan-save`,disabled:t,onClick:()=>i(!0),children:`Save as chain`}),(0,X.jsx)(va,{open:r,onOpenChange:e=>i(!!e),children:(0,X.jsxs)(ga,{"data-slot":`plan-save-dialog`,className:`sm:max-w-sm`,showCloseButton:!1,children:[(0,X.jsxs)(ha,{children:[(0,X.jsx)(_a,{children:`Save as chain`}),(0,X.jsx)(pa,{children:`Saves these steps as a reusable workflow — it joins the picker like any other chain.`})]}),(0,X.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),d(!1)},children:[(0,X.jsx)(`label`,{htmlFor:`plan-chain-name`,className:`mb-2 block text-xs text-muted-foreground`,children:`Chain name`}),(0,X.jsx)(Ml,{id:`plan-chain-name`,value:a,onChange:e=>o(e.target.value),"aria-label":`Chain name`,placeholder:`e.g. fix-and-verify-v2`,maxLength:80,autoFocus:!0}),(0,X.jsxs)(fa,{className:`mt-4`,children:[(0,X.jsx)(G,{type:`button`,variant:`outline`,onClick:()=>i(!1),children:`Cancel`}),(0,X.jsx)(G,{type:`submit`,disabled:a.trim()===``||l,children:l?`Saving…`:`Save chain`})]})]})]})}),(0,X.jsx)(n_,{open:s,onOpenChange:e=>e?void 0:c(!1),children:(0,X.jsxs)(a_,{"data-slot":`plan-overwrite-dialog`,children:[(0,X.jsxs)(o_,{children:[(0,X.jsxs)(c_,{children:[`Overwrite “`,a.trim(),`”?`]}),(0,X.jsx)(l_,{children:`A chain with this name already exists. Overwriting replaces its steps with this plan.`})]}),(0,X.jsxs)(s_,{children:[(0,X.jsx)(d_,{children:`Cancel`}),(0,X.jsx)(u_,{onClick:()=>void d(!0),children:`Overwrite chain`})]})]})})]})}var TC={start:{note:`Start immediately with the selected configuration.`,pendingLabel:`Starting task…`,failureHint:void 0,clearOnSuccess:!0,sendAriaLabel:`Start task`},plan:{note:`Review the plan before starting the task.`,pendingLabel:`Planning task…`,failureHint:`Could not create the plan. Your draft is kept. Please retry.`,clearOnSuccess:!1,sendAriaLabel:`Plan task`}};function EC(){let[e]=gn(),t=(0,Y.useRef)(null),n=(0,Y.useRef)(null),r=(0,Y.useRef)(null),{projectId:i}=_n(),a=bt().projectId,o=R().data,[s]=(0,Y.useState)(()=>e.toString()),[c]=(0,Y.useState)(()=>tf(s,o)),l=tf(s,o).runner,u=f(),d=ue(),p=te(),m=_(),{draft:h,update:g,clearStarted:v,submissionPending:y,mounted:b}=VS(a,c,l),x=dS(a),S=WS(h,p),C=GS(S.displayRunner,h.agentProfile),w=HS(h.source,d,S.displayRunner,C.agentProfile),{source:T,sourcesReady:E,skillList:D}=w,O=JS(i),k=US({uiState:d,source:T,sourcesReady:E,draftText:h.text,submissionPending:y,update:g});KS(S.providersReady);let A=u.data===void 0||u.data.info!==null,j=qS({hasGit:A,draft:h,selectedSkill:w.selectedSkill,workspaceConfig:m,source:T}),{plan:M,setPlan:ee,planning:N,starting:P,submit:ne,startPlanned:re}=tC({draft:h,draftProjectId:a,engine:S,agentProfile:C.agentProfile,accountsSettled:C.accountsSettled,sourcesReady:E,source:T,runMode:j,notifyOn:O.notifyOn,uiState:d,mounted:b,clearStarted:v});XS({deepLink:c,search:e,sourcesReady:E&&w.skillsSettled&&!S.providers.isPending&&C.accountsSettled,listUnchecked:w.listUnchecked,skillList:D,update:g});let F=YS(t),{providers:ie,providersReady:ae}=S,I=h.planFirst?TC.plan:TC.start,oe=$S(ie),L=M===null&&h.text.trim()===``,se=ae&&!P&&h.text.trim()===``;return(0,X.jsxs)(Bo,{route:`new`,density:L?`sparse`:`full`,rootProps:{"data-plan-review":M===null?void 0:`true`},className:`relative isolate overflow-x-clip pb-16`,header:DC(M!==null),sparseFooter:OC(L,k,n),children:[(0,X.jsx)(`div`,{"data-slot":`new-task-layout`,"data-persisted-draft":x||void 0,ref:r,style:M===null?void 0:{display:`none`},className:`relative z-[1] w-full`,children:(0,X.jsx)(Sx,{ref:n,onSubmit:ne,retainDraftUntilSuccess:!0,idleFeedback:(0,X.jsxs)(`div`,{"data-slot":`new-task-idle-feedback`,className:`flex flex-col gap-1`,children:[(0,X.jsxs)(`div`,{"data-slot":`new-task-mode-note`,className:`flex items-center justify-between gap-3 text-xs text-muted-foreground`,children:[se?(0,X.jsx)(`span`,{"data-slot":`new-task-start-hint`,children:`Describe a task above to start.`}):(0,X.jsx)(`span`,{children:I.note}),(0,X.jsx)(`kbd`,{className:`hidden font-sans md:inline`,children:Iy()})]}),(0,X.jsx)(`p`,{"data-slot":`run-mode-note`,className:`text-xs text-muted-foreground`,children:$x({worktree:j.worktree,hasGit:A})})]}),pendingLabel:I.pendingLabel,failureHint:I.failureHint,clearOnSuccess:I.clearOnSuccess,onPendingChange:e=>{y.current=e},value:h.text,onValueChange:e=>g({text:e}),draftPersisted:x,autoFocus:!0,placeholder:`Describe a task for the agent — / for skills…`,ariaLabel:`Describe a task for the agent`,sendAriaLabel:I.sendAriaLabel,disabled:!ae||P,disabledReason:oe,autocompleteSkills:!0,skillRunner:S.displayRunner,skillAccount:C.agentProfile,footerStart:(0,X.jsx)(kC,{projects:O.projectList,urlProjectId:i,templates:k,onInsertTemplate:e=>n.current?.insertAtCaret(e),sources:w,onPickSource:e=>g({source:e})}),agentOptions:(0,X.jsx)(sC,{groupRef:t,compact:F,engine:S,accounts:C,draftEffort:h.effort,update:g}),executionOptions:(0,X.jsx)(dC,{engine:S,draft:h,update:g,repo:u.data,hasGit:A,runMode:j,webhook:{targets:O.webhookTargets,on:O.notifyOn,onChange:O.setNotifyChoice},completionDisabled:P||N}),footerEnd:(0,X.jsx)(fC,{showConfigureProviders:!ae&&!ie.isPending,planFirst:h.planFirst,planning:N,onModeChange:e=>g({planFirst:e})})})}),M===null?null:(0,X.jsx)(CC,{plan:M,starting:P,startAvailable:ae,startUnavailableReason:oe,startUnavailableAction:ie.isPending?void 0:(0,X.jsx)(q,{to:`/settings/agent-defaults#providers`,children:`Configure providers`}),onStepsChange:e=>ee(t=>t&&{...t,steps:e}),onStart:()=>void re(),onDiscard:()=>{ee(null),requestAnimationFrame(()=>r.current?.querySelector(`textarea`)?.focus())}})]})}function DC(e){return e?{title:`New task / Plan first`,subtitle:`Review the proposed chain before launching.`,headerSlot:`plan-page-header`,hideSubtitleOnMobile:!0}:{title:`What should the agent work on?`,subtitle:`Describe the outcome, then configure the run.`,subtitleSlot:`page-description`,hideSubtitleOnMobile:!0}}function OC(e,t,n){if(e)return(0,X.jsx)(oC,{templates:t,onInsert:e=>n.current?.insertAtCaret(e)})}function kC({projects:e,urlProjectId:t,templates:n,onInsertTemplate:r,sources:i,onPickSource:a}){let o=xa();return(0,X.jsxs)(X.Fragment,{children:[e.length>1&&t!==void 0?(0,X.jsx)(jC,{projects:e,projectId:t,onPick:e=>o(`/p/${encodeURIComponent(e)}/new`,{replace:!0})}):null,(0,X.jsx)(Bx,{label:`Template`,templates:n,onInsert:r}),(0,X.jsx)(zC,{source:i.source,unchecked:i.unchecked,ready:i.sourcesReady,skillsLoading:!i.skillsSettled,skills:i.skillList,skillUsage:i.skillUsage,workflows:i.workflowList,onPick:a})]})}function AC(e,t){let n=t.trim().toLowerCase();if(n===``)return[...e];let r=e=>{let t=e.name.toLowerCase(),r=e.id.toLowerCase();return t.startsWith(n)||r.startsWith(n)?0:t.includes(n)||r.includes(n)?1:2};return e.map((e,t)=>({project:e,rank:r(e),index:t})).filter(e=>e.rank<2).sort((e,t)=>e.rank-t.rank||e.index-t.index).map(e=>e.project)}function jC({projects:e,projectId:t,onPick:n}){let[r,i]=(0,Y.useState)(!1),[a,o]=(0,Y.useState)(``),{order:s}=bp(),l=e.find(e=>e.id===t),u=AC(wo(e,s),a);return(0,X.jsxs)(sa,{open:r,onOpenChange:e=>{i(e),e||o(``)},children:[(0,X.jsx)(ra,{asChild:!0,children:(0,X.jsxs)(`button`,{type:`button`,"data-slot":`project-pill`,"aria-label":`Project`,title:`Which project this task runs in — its skills, workflows, settings and draft`,className:c(Cx,`border-foreground/60 font-semibold text-foreground`),children:[(0,X.jsx)(Qn,{"aria-hidden":`true`,className:`size-3 shrink-0 text-soft-foreground`}),(0,X.jsx)(`span`,{className:`max-w-40 truncate`,children:l?.name??t}),wx]})}),(0,X.jsx)(aa,{align:`start`,sideOffset:8,className:`w-[300px] max-w-[calc(100vw-2rem)] p-0`,children:(0,X.jsxs)(Co,{shouldFilter:!1,children:[(0,X.jsx)(ho,{placeholder:`search projects…`,value:a,onValueChange:o}),(0,X.jsxs)(So,{"data-slot":`project-menu`,className:`max-h-[min(18rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[u.length===0?(0,X.jsx)(xo,{children:`Nothing matches.`}):null,u.map(e=>(0,X.jsxs)(bo,{value:e.id,keywords:[e.name],"data-slot":`project-option`,"data-project-id":e.id,disabled:e.status===`missing`,onSelect:()=>{n(e.id),i(!1)},children:[(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs font-medium`,children:e.name}),e.status===`missing`?(0,X.jsx)(`span`,{className:`shrink-0 text-xs text-soft-foreground`,children:`folder not found`}):e.branch===void 0?null:(0,X.jsx)(`span`,{className:`shrink-0 font-mono text-xs text-soft-foreground`,children:e.branch}),e.id===t?(0,X.jsx)(mr,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-link-foreground`}):null]},e.id))]}),(0,X.jsx)(`p`,{className:`border-t border-border px-3 py-2 text-xs leading-snug text-soft-foreground`,children:`Skills, workflows, settings and the draft re-resolve against the selected project.`})]})})]})}function MC(e,t,n){return!e&&(t.ranked?t.ranked.length===0:t.mostUsed.length===0&&t.project.length===0&&t.global.length===0)&&n.length===0}function NC(e,t){return Oo(`no skill`,`none plain ${pS} ${e?.description??``}`,t)>0}function PC({source:e,ready:t,offersWorkflows:n,onPick:r,skillLabel:i}){let a=e===null||e.source===`skill`?Ir:Rr;return(0,X.jsxs)(`button`,{type:`button`,"data-slot":`source-pill`,"data-source-kind":e?.source??`none`,"aria-label":`Choose a skill or workflow`,title:e===null?`No skill — the task runs as one plain agent step. Pick a skill or workflow to change that.`:`Runs the ${e.source} "${e.ref}" — pick it again, or press ✕, to run without it`,disabled:!t,onKeyDown:t=>{e===null||t.metaKey||t.ctrlKey||t.altKey||t.key!==`Backspace`&&t.key!==`Delete`||(t.preventDefault(),r(null))},className:c(Cx,e===null?`text-muted-foreground`:`rounded-r-none border-r-0 border-foreground/60 pr-1.5 font-semibold text-foreground`),children:[(0,X.jsx)(a,{"aria-hidden":`true`,className:c(`size-3 shrink-0`,e===null?`text-muted-foreground`:`text-accent-icon`)}),(0,X.jsx)(`span`,{className:`max-w-44 truncate`,children:t?i??e?.ref??(n?`Skill or workflow`:`Skill`):`…`}),wx]})}function FC({source:e,quickTask:t,onPick:n}){return(0,X.jsx)(_o,{children:(0,X.jsxs)(bo,{value:`none no-skill`,keywords:[`none`,`plain`,...Po(pS)],"data-slot":`source-option`,"data-source-kind":`none`,onSelect:()=>n(null),children:[(0,X.jsx)(br,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-soft-foreground`}),(0,X.jsx)(`span`,{className:`shrink-0 text-xs font-medium`,children:`No skill`}),(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:t?.description??`One agent run on your task — no ceremony.`}),e===null?(0,X.jsx)(mr,{"aria-hidden":`true`,className:`ml-auto size-3.5 shrink-0 text-link-foreground`}):null]})})}function IC({ranked:e,mostUsed:t,project:n,skillItem:r}){return(0,X.jsx)(X.Fragment,{children:e?e.length>0?(0,X.jsx)(_o,{children:e.map(e=>r(e,jo(e)))}):null:(0,X.jsxs)(X.Fragment,{children:[t.length>0?(0,X.jsx)(_o,{heading:`Most used`,children:t.map(e=>r(e,jo(e)))}):null,n.length>0?(0,X.jsx)(_o,{heading:`Project skills`,children:n.map(e=>r(e,!0))}):null]})})}function LC({source:e,matchedWorkflows:t,toggle:n}){return t.length>0?(0,X.jsx)(_o,{heading:`Workflows`,children:t.map(t=>{let r=e?.source===`workflow`&&e.ref===t.name;return(0,X.jsxs)(bo,{value:`workflow ${t.name}`,keywords:Po(t.name,t.description),"data-slot":`source-option`,"data-source-kind":`workflow`,"data-source-ref":t.name,onSelect:()=>n({source:`workflow`,ref:t.name}),children:[(0,X.jsx)(`span`,{className:`shrink-0 font-mono text-xs`,children:t.name}),t.description?(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:t.description}):null,r?(0,X.jsx)(mr,{"aria-hidden":`true`,className:`ml-auto size-3.5 shrink-0 text-link-foreground`}):null]},t.name)})}):null}function RC({global:e,skillItem:t}){return e.length>0?(0,X.jsx)(_o,{heading:`Global`,children:e.map(e=>t(e,!1))}):null}function zC({source:e,unchecked:t,ready:n,skillsLoading:r,skills:i,skillUsage:a,workflows:o,onPick:s}){let[l,u]=(0,Y.useState)(!1),[d,f]=(0,Y.useState)(``),[p,m]=(0,Y.useState)(null),h=(0,Y.useRef)(null),{mostUsed:g,project:_,global:v,ranked:y}=Lo(i,d,a),b=o.find(e=>e.name===pS),x=ko(o,d).filter(e=>e.name!==pS),S=o.some(e=>e.name!==pS),C=NC(b,d),w=MC(C,{ranked:y,mostUsed:g,project:_,global:v},x),T=e=>{s(e),u(!1)},E=t=>T(e?.source===t.source&&e.ref===t.ref&&(e.source!==`skill`||t.source!==`skill`||e.path===t.path)?null:t),D=(t,n)=>{let r=e?.source===`skill`&&e.ref===t.id&&e.path===t.path;return(0,X.jsxs)(bo,{value:Ao(t),keywords:Po(t.name,t.description),"data-slot":`source-option`,"data-source-kind":`skill`,"data-source-ref":t.id,onSelect:()=>E({source:`skill`,ref:t.id,...t.path===void 0?{}:{path:t.path}}),children:[(0,X.jsx)(_y,{skill:t,emphasized:n}),(0,X.jsx)(`button`,{type:`button`,"data-slot":`source-skill-view`,"aria-label":`View skill ${t.name}`,title:`View skill`,onClick:e=>{e.preventDefault(),e.stopPropagation(),m(t)},className:`ml-auto shrink-0 rounded-sm p-0.5 text-soft-foreground transition-colors hover:text-foreground`,children:(0,X.jsx)(fi,{"aria-hidden":`true`,className:`size-3.5`})}),r?(0,X.jsx)(mr,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-link-foreground`}):null]},Ao(t))},O=PC({source:e,ready:n,offersWorkflows:S,onPick:s,skillLabel:e?.source===`skill`?i.find(t=>t.id===e.ref&&(e.path===void 0||e.path===t.path))?.name:void 0});return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Kx,{skill:p,onClose:()=>m(null)}),(0,X.jsxs)(sa,{open:l,onOpenChange:e=>{u(e),e||f(``)},children:[(0,X.jsxs)(`span`,{className:`inline-flex items-center`,children:[(0,X.jsx)(ra,{asChild:!0,children:O}),e?.source===`skill`&&t?(0,X.jsx)(`span`,{role:`status`,children:`Unchecked`}):null,e!==null&&n?(0,X.jsx)(`button`,{type:`button`,"data-slot":`source-pill-clear`,"aria-label":`Clear the ${e.source} ${e.ref}`,title:`Run without it`,onClick:()=>s(null),className:c(Cx,`rounded-l-none border-foreground/60 pl-1.5 pr-2 text-soft-foreground hover:text-foreground`),children:(0,X.jsx)(vr,{"aria-hidden":`true`,className:`size-3`})}):null]}),(0,X.jsx)(aa,{align:`start`,sideOffset:8,className:`w-[336px] max-w-[calc(100vw-2rem)] p-0`,children:(0,X.jsxs)(Co,{shouldFilter:!1,children:[(0,X.jsx)(ho,{placeholder:`search skills & workflows…`,value:d,onValueChange:f,onInput:()=>h.current?.scrollTo(0,0)}),(0,X.jsxs)(So,{ref:h,"data-slot":`source-menu`,"aria-busy":r,className:`max-h-[min(18rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[d.trim()&&!i.some(e=>e.id===d.trim())?(0,X.jsx)(_o,{children:(0,X.jsxs)(bo,{value:`typed-skill`,onSelect:()=>T({source:`skill`,ref:d.trim(),typed:!0}),children:[`Use skill id “`,d.trim(),`” (unchecked)`]})}):null,w&&!r?(0,X.jsx)(xo,{children:`Nothing matches.`}):null,C?(0,X.jsx)(FC,{source:e,quickTask:b,onPick:T}):null,r?(0,X.jsx)(`div`,{"data-slot":`source-skills-loading`,role:`status`,className:`px-2 py-1.5 text-xs text-muted-foreground`,children:`Loading skills…`}):null,(0,X.jsx)(IC,{ranked:y,mostUsed:g,project:_,skillItem:D}),(0,X.jsx)(LC,{source:e,matchedWorkflows:x,toggle:E}),(0,X.jsx)(RC,{global:v,skillItem:D})]})]})})]})]})}function BC(){return(0,X.jsx)(Vo,{route:`not-found`,density:`empty`,header:{title:`Page not found`,subtitle:`Nothing lives at this address.`,primaryAction:(0,X.jsx)(Ko,{asChild:!0,variant:`outline`,children:(0,X.jsx)(q,{to:`/`,children:`Back to tasks`})})},emptyState:(0,X.jsx)(qo,{icon:(0,X.jsx)(Ms,{className:`size-4`}),title:`Address not found`,description:`The link may be mistyped, or it points at something that is gone.`})})}function VC(){return(0,X.jsx)(`div`,{className:`px-4 pt-2 md:hidden`,children:(0,X.jsxs)(q,{to:`/git`,"data-slot":`git-back`,className:`inline-flex min-h-11 items-center gap-1.5 text-xs font-medium text-muted-foreground hover:text-foreground`,children:[(0,X.jsx)(Mr,{size:16,"aria-hidden":`true`,className:`size-3.5`}),`Back to Git`]})})}function HC(){let{pathname:e,search:t}=hn();return(0,X.jsxs)(Wo,{route:`repo-git`,density:`sparse`,flushPadding:!0,children:[wa(e)!==`/git`||new URLSearchParams(t).get(`view`)===`repo`?(0,X.jsx)(VC,{}):null,(0,X.jsx)(Yo,{icon:(0,X.jsx)(pi,{className:`motion-safe:animate-spin`}),tone:`neutral`,title:`Loading repository…`,subtitle:`Fetching the repo's git state.`})]})}function UC(){return(0,X.jsxs)(Jo,{route:`skills`,density:`sparse`,rootProps:{"aria-busy":`true`},header:{title:`Skills`,subtitle:`The skills each agent loads in this project, as its runner reports them.`},children:[(0,X.jsx)(`p`,{"data-slot":`skills-loading`,role:`status`,className:`text-xs text-muted-foreground`,children:`Loading skills…`}),(0,X.jsxs)(`div`,{"aria-hidden":`true`,className:`mt-4 flex flex-col gap-[22px] motion-safe:animate-pulse`,children:[(0,X.jsx)(`div`,{className:`h-11 rounded-lg border border-border bg-card`}),(0,X.jsx)(`div`,{className:`h-80 rounded-xl border border-border bg-card`})]})]})}function WC({projectId:e,registry:t}){let n=t.projects.length?t.projects:[{id:t.bootProject,name:t.bootProject}];return(0,X.jsx)(Vo,{route:`unknown-project`,density:`empty`,children:(0,X.jsx)(Yo,{icon:(0,X.jsx)(Vs,{}),tone:`neutral`,title:`“${e}” isn’t registered here`,subtitle:`This Squawk doesn’t serve a project by that id. The link may come from another machine’s workspace — these are the projects registered on this one:`,children:(0,X.jsx)(`ul`,{"data-slot":`registered-projects`,className:`mx-auto flex w-full max-w-xs flex-col gap-1.5 text-left`,children:n.map(e=>(0,X.jsx)(`li`,{children:(0,X.jsxs)(H,{to:`/p/${encodeURIComponent(e.id)}/`,className:`flex items-baseline gap-2 rounded-md border border-border bg-card px-3 py-2 text-sm font-medium text-foreground shadow-xs transition-colors hover:bg-card-2`,children:[e.name||e.id,(0,X.jsxs)(`span`,{className:`font-mono text-xs font-normal text-muted-foreground`,children:[`/p/`,e.id]})]})},e.id))})})})}function GC(){return(0,X.jsxs)(Wo,{route:`workflows`,density:`sparse`,rootProps:{"aria-busy":`true`},header:{title:`Workflows`,subtitle:`Portable skill chains. Steps run from top to bottom.`},children:[(0,X.jsx)(`p`,{"data-slot":`workflows-loading`,role:`status`,className:`text-xs text-muted-foreground`,children:`Loading workflows…`}),(0,X.jsxs)(`div`,{"aria-hidden":`true`,className:`mt-4 flex flex-col gap-[22px] motion-safe:animate-pulse`,children:[(0,X.jsx)(`div`,{className:`h-11 rounded-lg border border-border bg-card`}),(0,X.jsx)(`div`,{className:`h-80 rounded-xl border border-border bg-card`})]})]})}function KC({tab:e}){return(0,X.jsx)(Vo,{route:`task-${e}`,density:`sparse`,flushPadding:!0,children:(0,X.jsx)(Yo,{icon:(0,X.jsx)(pi,{className:`motion-safe:animate-spin`}),tone:`neutral`,title:e===`changes`?`Loading changes…`:`Loading files…`,subtitle:`Fetching the run record.`})})}function qC({tab:e,error:t}){let n=t instanceof Ge&&t.status===404;return(0,X.jsx)(Vo,{route:`task-${e}`,density:`empty`,flushPadding:!0,children:(0,X.jsx)(Yo,{icon:n?(0,X.jsx)(_i,{}):(0,X.jsx)(kr,{size:16}),tone:n?`neutral`:`danger`,title:n?`Task not found`:`Could not load this task`,subtitle:n?`No run has this id. It may have been deleted, or the link is from another machine.`:t.message,actions:(0,X.jsx)(G,{asChild:!0,variant:`outline`,children:(0,X.jsx)(q,{to:`/`,children:`Back to tasks`})})})})}var JC={issue:`issue`,pr:`pull request`};function YC({kind:e,number:t,heading:n=`h1`}){let r=(0,X.jsx)(`div`,{"data-slot":`task-github-loading`,className:`flex min-h-full flex-1 flex-col`,children:(0,X.jsx)(Yo,{icon:(0,X.jsx)(pi,{className:`motion-safe:animate-spin`}),tone:`neutral`,heading:n,title:`Loading ${JC[e]}${t===void 0?``:` #${t}`}…`,subtitle:t===void 0?`Fetching the run record.`:`Asking GitHub.`})});return n===`h2`?r:(0,X.jsx)(Vo,{route:`task-github-item`,density:`sparse`,flushPadding:!0,children:r})}function XC(){return(0,X.jsx)(Vo,{route:`task-thread`,density:`sparse`,flushPadding:!0,children:(0,X.jsx)(Yo,{icon:(0,X.jsx)(pi,{className:`motion-safe:animate-spin`}),tone:`neutral`,title:`Loading task…`,subtitle:`Fetching the run and its session transcript.`})})}async function ZC(e,t,n,r,i){try{return await cs(e,{queryKey:[t,`runs`,`artifact-metadata`,n,r],queryFn:({signal:e})=>Ot(n,r,{signal:e})},i),!0}catch(e){if(e instanceof Ge&&e.status===404)return!1;throw e}}async function QC(e,t,n,r,i,a){if(await ZC(e,t,n,r,i))return n;i.throwIfAborted();let o=await cs(e,{queryKey:[t,`runs`,`relationships`,n],queryFn:({signal:e})=>Ft(n,{signal:e})},i),s=new Set(o.workers.map(e=>e.workerId));a&&s.add(a),s.delete(n);for(let n of s){if(i.aborted)throw i.reason;if(await ZC(e,t,n,r,i))return n}throw new Ge(404,`Report missing or deleted`)}function $C(e,t,n){let r=z(),i=a();return At({queryKey:[i,`runs`,`report-source`,e,t,n],queryFn:({signal:a})=>QC(r,i,e,t,a,n),enabled:!!(e&&t),retry:!1})}var ew=class extends Y.Component{state={failed:!1};static getDerivedStateFromError(){return{failed:!0}}componentDidCatch(e,t){console.error(`Squawk cockpit: the preview pane crashed`,e,t.componentStack)}render(){return this.state.failed?(0,X.jsxs)(`div`,{"data-slot":`preview-pane-error`,role:`alert`,className:`flex h-full flex-col items-center justify-center gap-3 p-6 text-center`,children:[(0,X.jsx)(`p`,{className:`text-sm font-semibold text-foreground`,children:`The preview hit an error`}),(0,X.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`The task is unaffected. Close the preview and open it again.`}),(0,X.jsx)(G,{variant:`outline`,onClick:this.props.onClose,children:`Close preview`})]}):this.props.children}},tw=`cez-preview-tasks`,nw=`cez.preview.pane-width`,rw=e=>Math.min(75,Math.max(30,Math.round(e)));function iw(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function aw(e){if(!iw(e))return;let{port:t,agent:n,url:r}=e;if(typeof t==`number`&&Number.isInteger(t)&&t>=1&&t<=65535)return{port:t};if(n===!0)return{agent:!0};if(typeof r==`string`&&/^https?:\/\//i.test(r))return{url:r}}function ow(e){if(!iw(e))return;let t=aw(e.target),n=typeof e.percent==`number`&&Number.isFinite(e.percent)?e.percent:void 0;return{open:e.open===!0,...t?{target:t}:{},...n===void 0?{}:{percent:n},at:typeof e.at==`number`?e.at:0}}function sw(){try{let e=localStorage.getItem(tw),t=e===null?null:JSON.parse(e);return iw(t)?t:{}}catch{return{}}}function cw(e){let t=ow(sw()[e]);if(!t)return;let{at:n,...r}=t;return r}function lw(e,t,n=Date.now()){let r=sw(),i={open:!1,...ow(r[e]),...t,at:n};for(let e of Object.keys(i))i[e]===void 0&&delete i[e];r[e]=i;let a=Object.keys(r);if(a.length>100){let e=e=>ow(r[e])?.at??0;for(let t of a.sort((t,n)=>e(t)-e(n)).slice(0,a.length-100))delete r[t]}try{localStorage.setItem(tw,JSON.stringify(r))}catch{}}function uw(){try{let e=Number(localStorage.getItem(nw));return e>0?e:void 0}catch{return}}function dw(e){let t=(e===void 0?void 0:cw(e)?.percent)??uw();return t===void 0?58:rw(t)}function fw(e,t){try{localStorage.setItem(nw,String(t))}catch{}e!==void 0&&lw(e,{percent:t})}var pw=`(min-width: 1180px)`,mw=`(max-width: 767px)`;function hw(e,t){let[n,r]=(0,Y.useState)(()=>window.matchMedia?.(e).matches??t);return(0,Y.useEffect)(()=>{let t=window.matchMedia?.(e);if(!t)return;let n=()=>r(t.matches);return n(),t.addEventListener(`change`,n),()=>t.removeEventListener(`change`,n)},[e]),n}var gw=(0,Y.lazy)(()=>V(()=>import(`./preview-pane-connected-DzajVDzR.js`).then(e=>({default:e.ConnectedPreviewPane})),__vite__mapDeps([66,1,2,7,8,9,10,14,67,68,69,70,62,71,72,44,73,74,75,76,63,18,19,25,26,77,64,13,23,24,48,39,58,11,12]))),_w=2,vw=(0,Y.createContext)(!1);function yw(){return(0,Y.useContext)(vw)}function bw(e){let[t,n]=(0,Y.useState)(void 0);return(0,Y.useEffect)(()=>{let t=e.current?.closest(`[data-slot="main"]`);if(!t)return;let r=()=>n(t.clientHeight||void 0);if(r(),typeof ResizeObserver>`u`)return;let i=new ResizeObserver(r);return i.observe(t),()=>i.disconnect()},[e]),t}function xw({run:e,state:t,children:n,report:r}){let i=hw(pw,!0),a=hw(mw,!1),o=(0,Y.useRef)(null),s=bw(o),{percent:c,setPercent:l}=t,u=!!r||t.open&&e!==void 0,d=u&&!i,f=!r&&t.session,p=d&&!f,m=d&&f,h=e=>{let t=o.current?.getBoundingClientRect();!t||t.width===0||l(rw((t.right-e)/t.width*100))},g=e=>{e.currentTarget.setPointerCapture?.(e.pointerId)},_=e=>{e.currentTarget.hasPointerCapture?.(e.pointerId)&&h(e.clientX)},v=e=>{if(e.key===`ArrowLeft`)l(rw(c+_w));else if(e.key===`ArrowRight`)l(rw(c-_w));else return;e.preventDefault()},y={"--preview-pane":`${c}%`,...s===void 0?{}:{"--preview-h":`${s}px`}};return(0,X.jsxs)(`div`,{ref:o,"data-slot":`task-split`,"data-pane":u?`open`:`closed`,"data-takeover":p?``:void 0,className:`preview-split flex min-h-full w-full min-w-0`,style:y,children:[(0,X.jsx)(`div`,{"data-slot":`task-main`,hidden:p&&a,"data-collapsed":p&&!a?``:void 0,className:`min-w-0 flex-1`,children:(0,X.jsx)(vw.Provider,{value:u,children:n})}),u?(0,X.jsxs)(X.Fragment,{children:[i?(0,X.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize preview`,"aria-valuemin":30,"aria-valuemax":75,"aria-valuenow":c,tabIndex:0,"data-slot":`preview-divider`,className:`preview-divider`,onPointerDown:g,onPointerMove:_,onKeyDown:v}):null,(0,X.jsxs)(`aside`,{"data-slot":`preview-pane`,"data-phone":a?``:void 0,hidden:m,className:`preview-pane`,children:[r,(0,X.jsx)(`div`,{hidden:!!r,className:`h-full`,children:t.open&&e?(0,X.jsx)(ew,{onClose:t.closePane,children:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(`p`,{role:`status`,className:`p-6 text-sm text-muted-foreground`,children:`Opening the preview…`}),children:(0,X.jsx)(gw,{run:e,servers:e.previewServers??[],request:t.request,onSession:p?t.showSession:void 0,onTarget:t.setTarget,onLive:t.setLive,onClose:t.closePane},e.id)})}):null})]})]}):null]})}function Sw(e){if(!e.worktreePath||e.worktreeReclaimedAt)return!0;let t=e.delegation?.role===`worker`?e.delegation.destroy:void 0;return t!==void 0&&!t.remaining.includes(`worktree`)}function Cw(e){let{state:t,server:n}=e,r=co(e.stateAt);switch(t){case`registered`:return n.answeredAtRegistration?{tone:`neutral`,ring:!1,pulse:!1,text:`was running when registered`}:{tone:`neutral`,ring:!0,pulse:!1,text:`registered · not started`};case`adopted`:return{tone:`neutral`,ring:!1,pulse:!1,text:`was running when registered`};case`starting`:return{tone:`pending`,ring:!1,pulse:!0,text:`starting`};case`up`:return{tone:`success`,ring:!1,pulse:!1,text:r?`up · ${r}`:`up`};case`stalled`:return{tone:`pending`,ring:!1,pulse:!1,text:`stalled · port silent 2 min`};case`exited`:return{tone:`danger`,ring:!1,pulse:!1,text:e.exitCode===void 0?`exited`:`exited · code ${e.exitCode}`};case`stopped`:return{tone:`neutral`,ring:!0,pulse:!1,text:e.reason===`idle`?`stopped after 15 min idle`:`stopped`};case`unavailable`:return{tone:`neutral`,ring:!0,pulse:!1,text:`unavailable`}}}function ww(e){return{kind:`preview-server`,id:`preview-server:${e.port}`,server:e,state:`registered`,stateAt:e.registeredAt}}function Tw(e,t){return t?.get(e.port)??ww(e)}function Ew(e){return e.state===`registered`?e.server.answeredAtRegistration:e.state===`up`||e.state===`starting`||e.state===`adopted`}function Dw(e){return e.split(` -- `)[0].trim()}var Ow=(0,Y.createContext)(null);function kw(){return(0,Y.useContext)(Ow)}var Aw=e=>e&&`port`in e?e.port:void 0;function jw(){return typeof window.matchMedia!=`function`||window.matchMedia(`(min-width: 1180px)`).matches}function Mw(e){let t=e===void 0?void 0:cw(e),n=t?.open===!0,r=n?t.target:void 0;return{open:n,target:r,request:n?{...r,restored:!0}:void 0,session:n&&!jw(),percent:dw(e)}}function Nw(e,t=!1){let[n]=(0,Y.useState)(()=>Mw(e)),[r,i]=(0,Y.useState)(n.open),[a,o]=(0,Y.useState)(!1),[s,c]=(0,Y.useState)(n.target),[l,u]=(0,Y.useState)(n.session),[d,f]=(0,Y.useState)(n.request),[p,m]=(0,Y.useState)(n.percent),[h,g]=(0,Y.useState)(e),_=(0,Y.useRef)(r);if(_.current=r,h!==e){let t=Mw(e);g(e),i(t.open),o(!1),c(t.target),u(t.session),f(t.request),m(t.percent)}t&&r&&d?.restored&&(i(!1),c(void 0),f(void 0),u(!1));let v=(0,Y.useCallback)(t=>{e!==void 0&&lw(e,t)},[e]),y=(0,Y.useCallback)(e=>{f({...e});let t=e.port===void 0?e.agent?{agent:!0}:void 0:{port:e.port};u(!1),i(!0),t?(c(t),v({open:!0,target:t})):_.current?v({open:!0}):(c(void 0),v({open:!0,target:void 0}))},[v]),b=(0,Y.useCallback)(()=>{i(!1),o(!1),u(!1),c(void 0),v({open:!1})},[v]),x=(0,Y.useCallback)(e=>{c(e),v({target:e})},[v]),S=(0,Y.useCallback)(t=>{m(t),fw(e,t)},[e]),C=(0,Y.useCallback)(()=>u(!0),[]),w=Aw(s);return(0,Y.useMemo)(()=>({open:r,live:a,port:w,target:s,percent:p,request:d,session:l,openPane:y,closePane:b,showSession:C,setLive:o,setTarget:x,setPercent:S}),[r,a,w,s,p,d,l,y,b,C,x,S])}function Pw(...e){let t=[],n=-1/0,r=!0;for(let i of e){for(let e of i){if(e.seq<=n){r=!1;break}t.push(e),n=e.seq}if(!r)break}if(r)return t;let i=new Map;for(let t of e)for(let e of t)i.set(e.seq,e);return[...i.values()].sort((e,t)=>e.seq-t.seq)}var Fw=(e,t)=>JSON.stringify([e.stepId??null,t]);function Iw(e,t){if(typeof t.delta!=`string`)return;let n=e.item.kind===`tool`?t.field===`output`?`output`:void 0:t.field!==`output`&&(e.item.kind===`message`||e.item.kind===`reasoning`)?`text`:void 0;if(!n)return;let r=e.item[n];e.item={...e.item,[n]:(typeof r==`string`?r:``)+t.delta},e.event={...e.event,seq:t.seq,ts:t.ts}}function Lw(e,t){for(let[n,r]of e)r.event.stepId===t&&e.delete(n)}function Rw(e,t,n){let r=t.item;if(t.type===`item.delta`){let r=e.get(Fw(t,t.itemId));r&&(Iw(r,t),r.touched||=n)}else t.type===`item.completed`&&r&&typeof r==`object`?e.delete(Fw(t,r.id)):(t.type===`item.started`||t.type===`item.updated`)&&r&&typeof r==`object`&&`kind`in r?e.set(Fw(t,r.id),{event:t,item:r,touched:n&&t.type===`item.updated`}):(t.type===`turn.completed`||t.type===`session.started`||t.type===`session.ended`)&&Lw(e,t.stepId)}function zw(e,t){let n=new Set(t.map(({seq:e})=>e)),r=new Map;for(let t of e)Rw(r,t,n.has(t.seq));return[...r.values()].filter(({touched:e})=>e).map(({event:e,item:t})=>({...e,type:`item.updated`,item:t})).sort((e,t)=>e.seq-t.seq)}function Bw(e,t={}){let[n,r]=(0,Y.useState)([]),{cursor:i,afterSeq:o=0,maxEvents:s,compactAt:c,onCompact:l,onReset:u,carryOver:d}=t,f=(0,Y.useRef)(void 0),p=(0,Y.useRef)(d);return p.current=d,(0,Y.useEffect)(()=>{let t=a(),n=e===void 0?void 0:`${t}/${e}`,d=n!==void 0&&f.current===n;if(f.current=n,r(e=>d&&p.current?p.current(e):[]),!e)return;let m=o,h=!1,g=!1,_=0,v=[],y,b,x=()=>{if(y!==void 0&&globalThis.cancelAnimationFrame?.(y),clearTimeout(b),y=void 0,b=void 0,h||v.length===0)return;let e=v;v=[],_+=e.length,r(t=>{let n=Pw(t,e);return!g&&c!==void 0&&_>=c&&(g=!0,queueMicrotask(()=>{h||l?.()})),s===void 0||n.length<=s?n:n.slice(-s)})},S=()=>{b===void 0&&(b=setTimeout(x,50),typeof globalThis.requestAnimationFrame==`function`&&(y=globalThis.requestAnimationFrame(x)))},C=Ht({kind:`run`,projectId:t,runId:e,afterSeq:o,...i?{cursor:i}:{}},{frame:e=>{if(`type`in e){if(e.type===`event`&&e.event.seq>m)m=e.event.seq;else if(e.type!==`snapshot`)return;v.push(e.event),S()}},reset:async(e,t)=>{x();let n=await u?.(e,t);return n&&(m=Math.max(m,n.afterSeq)),n}});return()=>{h=!0,y!==void 0&&globalThis.cancelAnimationFrame?.(y),clearTimeout(b),C()}},[e,i,o,s,c,l,u]),n}var Vw=5,Hw=200,Uw=5e3;function Ww(e,t,n){e.setQueryData(t,e=>{if(!e)return{pages:[n],pageParams:[void 0]};let t=[...e.pages],r=[...e.pageParams],i=-1;for(let e=0;e<t.length;e+=1)(i===-1||t[e].asOfSeq>t[i].asOfSeq)&&(i=e);if(i>=0&&t[i].asOfSeq>n.asOfSeq)return e;for(i>=0&&t[i].newerCursor===void 0?(t[i]=n,r[i]=void 0):(t.push(n),r.push(void 0));t.length>Vw;)t.shift(),r.shift();return{pages:t,pageParams:r}})}function Gw(e,t){return e!==void 0&&(t===void 0||e.asOfSeq>=t.asOfSeq)}function Kw(e,t,n,r){let i=(0,Y.useRef)(void 0),a=r&&t.data!==void 0&&!t.isFetching&&!Gw(t.data,n),o=e===void 0||n===void 0?void 0:`${e}:${n.asOfSeq}`;(0,Y.useEffect)(()=>{!a||o===void 0||i.current===o||(i.current=o,t.refetch())},[a,t,o])}function qw(e,t){return e!==void 0&&e.asOfSeq>t.asOfSeq?e:t}function Jw(e){let t=a(),n=z(),r=[`run-history`,t,e],i=[`run-history-context`,t,e],o=Wt({queryKey:r,enabled:e!==void 0,initialPageParam:void 0,queryFn:({pageParam:t,signal:n})=>Ve(e,t,{signal:n}),getPreviousPageParam:e=>e.olderCursor,getNextPageParam:e=>e.newerCursor,maxPages:Vw,staleTime:1/0,retry:1}),s=At({queryKey:i,enabled:e!==void 0,queryFn:async({signal:t})=>{let r=await at(e,{signal:t});return qw(n.getQueryData(i),r)},retry:1}),c=(0,Y.useCallback)(async r=>{let i=r?{signal:r}:void 0,a=await Ve(e,void 0,i),o=await at(e,i);return r?.throwIfAborted(),Ww(n,[`run-history`,t,e],a),n.setQueryData([`run-history-context`,t,e],e=>qw(e,o)),a},[n,e,t]),l=(0,Y.useCallback)(async(t,n)=>{if(e===void 0)return;let r=await c(n);return{cursor:r.liveCursor,afterSeq:r.asOfSeq}},[c,e]),u=o.isError||s.isError,d=Bw(u?e:void 0,{onReset:l}),f=o.data?.pages??[],p=f.reduce((e,t)=>t.newerCursor===void 0?t:e??t,void 0),m=(0,Y.useRef)(!1),h=(0,Y.useCallback)(()=>{e===void 0||m.current||(m.current=!0,c().catch(()=>{}).finally(()=>{m.current=!1}))},[c,e]),g=e=>e!==void 0&&n.getQueryData([`run-history`,t,e])!==void 0,[_,v]=(0,Y.useState)(()=>({runId:e,pending:g(e)})),y=_.pending;_.runId!==e&&(y=g(e),v({runId:e,pending:y})),(0,Y.useEffect)(()=>{if(!y||e===void 0)return;let t=!1,n=new AbortController;return c(n.signal).catch(()=>{}).finally(()=>{t||v({runId:e,pending:!1})}),()=>{t=!0,n.abort()}},[c,y,e]);let b=(0,Y.useMemo)(()=>Pw(...f.map(e=>e.events)),[f]),x=(0,Y.useRef)({runId:e,current:b,previous:[]});(x.current.current!==b||x.current.runId!==e)&&(x.current={runId:e,current:b,previous:x.current.runId===e?x.current.current:[]});let S=(0,Y.useCallback)(e=>{let{current:t,previous:n}=x.current;return zw(Pw(n,t,e),e)},[]),C=Bw(!u&&p&&!y?e:void 0,{cursor:p?.liveCursor,afterSeq:p?.asOfSeq,maxEvents:Uw,compactAt:Hw,onCompact:h,onReset:l,carryOver:S}),w=(0,Y.useRef)(0);w.current=C.length,(0,Y.useEffect)(()=>()=>{w.current>0&&h()},[h]);let T=(0,Y.useMemo)(()=>u?d:Pw(b,C),[u,d,b,C]);Kw(e,s,p,!u);let E=u||Gw(s.data,p),D=(0,Y.useMemo)(()=>{if(u)return d;let e=s.data?.contextEvents??[],t=s.data?.asOfSeq??0;return Pw(e,T.filter(({seq:e})=>e>t))},[s.data,u,d,T]),O=(0,Y.useCallback)(async()=>{await o.fetchPreviousPage()},[o.fetchPreviousPage]),k=(0,Y.useCallback)(async()=>{u||(await n.resetQueries({queryKey:[`run-history`,t,e],exact:!0}),n.invalidateQueries({queryKey:[`run-history-context`,t,e],exact:!0}))},[u,n,e,t]);return{visibleEvents:T,currentEvents:D,currentComplete:E,isPending:!u&&o.isPending,contextPending:!u&&s.isPending,fallback:u,hasOlder:!u&&!!o.hasPreviousPage,isFetchingOlder:o.isFetchingPreviousPage,olderError:o.isFetchPreviousPageError?o.error instanceof Error?o.error.message:`Could not load earlier items`:void 0,loadOlder:O,jumpToLatest:k,retainedPages:f.length}}function Yw(e){for(let t=e.length-1;t>=0;--t){let n=zt.safeParse(e[t]);if(n.success)return n.data.state===`connected`}return!1}function Xw(e){let{currentEvents:t}=Jw(e);return(0,Y.useMemo)(()=>Yw(t),[t])}var Zw=(0,Y.lazy)(()=>V(()=>import(`./report-reader-Bm0J3ujk.js`).then(e=>({default:e.ReportReader})),__vite__mapDeps([78,1,2,6,7,8,9,10,11,12,13,79,14,80,18,19,28,34,35,81,82,83,84,85])));function Qw(){let{id:e}=_n(),t=j(e),n=hn(),r=ke().data?.capabilities?.preview===!0,i=t.data?Sw(t.data):!1,a=Nw(e,i),o=no(e),s=$C(e,o.selection?.artifactId,o.sourceRunId),c=o.selection?(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(`p`,{role:`status`,children:`Loading report…`}),children:(0,X.jsx)(Zw,{runId:s.data??e??``,selection:{artifactId:o.selection.artifactId},fragment:n.hash,onBack:o.close,variant:`pane`,sourceLookup:s},`${e}:${o.selection.artifactId}`)}):void 0,l=r?(0,X.jsx)($w,{id:e,run:t.data,pane:a,removed:i,report:c,children:(0,X.jsx)(pn,{})}):(0,X.jsx)(xw,{run:t.data,state:{...a,open:!1},report:c,children:(0,X.jsx)(pn,{})});return(0,X.jsx)(ao.Provider,{value:o.registry,children:l})}function $w({id:e,run:t,pane:n,removed:r,children:i,report:a}){let o=Xw(e),s=(0,Y.useMemo)(()=>({...n,worktreeRemoved:r,agentLive:o}),[n,r,o]);return(0,X.jsx)(Ow.Provider,{value:s,children:(0,X.jsx)(xw,{run:t,state:n,report:a,children:i})})}var eT=[`task`,`runner`,`workflow`,`branch`,`diff`,`reference`,`usage`,`started`],tT=[`status`,`task`,`workflow`,`branch`,`diff`,`reference`,`tokens`,`cost`,`cpu`,`memory`,`started`],nT=[{id:`status`,label:`Status`,canFold:!1,defaultExpanded:!0,align:`left`,width:`120px`},{id:`task`,label:`Task`,canFold:!1,defaultExpanded:!0,align:`left`,width:`320px`},{id:`runner`,label:`Runner`,canFold:!0,defaultExpanded:!1,align:`left`,width:`132px`,icon:`runner`},{id:`workflow`,label:`Workflow`,canFold:!0,defaultExpanded:!0,align:`left`,width:`112px`,icon:`workflow`},{id:`branch`,label:`Branch`,canFold:!0,defaultExpanded:!1,align:`left`,width:`136px`,icon:`branch`},{id:`diff`,label:`±`,summaryLabel:`Changes`,canFold:!0,defaultExpanded:!0,align:`left`,width:`104px`,icon:`diff`},{id:`reference`,label:`Ref`,summaryLabel:`Reference`,canFold:!0,defaultExpanded:!0,align:`left`,width:`124px`,icon:`reference`},{id:`usage`,label:`Usage`,canFold:!0,defaultExpanded:!0,align:`right`,width:`148px`,icon:`usage`},{id:`tokens`,label:`IN / OUT`,canFold:!0,defaultExpanded:!0,align:`right`,width:`112px`,icon:`tokens`,capability:`tokens`},{id:`cost`,label:`Cost`,canFold:!0,defaultExpanded:!0,align:`right`,width:`64px`,icon:`cost`,capability:`cost`},{id:`cpu`,label:`CPU`,canFold:!0,defaultExpanded:!0,align:`right`,width:`60px`,icon:`cpu`},{id:`memory`,label:`Mem`,canFold:!0,defaultExpanded:!0,align:`right`,width:`80px`,icon:`memory`},{id:`started`,label:`Started`,canFold:!0,defaultExpanded:!0,align:`right`,width:`72px`,icon:`started`}],rT=new Map(nT.map(e=>[e.id,e]));function iT(e){return typeof e!=`object`||!e||Array.isArray(e)?{}:Object.fromEntries(Object.entries(e).filter(e=>typeof e[1]==`boolean`))}function aT(e){let t={};for(let[n,r]of Object.entries(iT(e))){let e=rT.get(n);e?.canFold&&(t[e.id]=r)}return t}function oT(e,t){let n=rT.get(e);return!n||!n.canFold?!0:t[e]??n.defaultExpanded}function sT(e,t){let n=iT(e);return rT.get(t)?.canFold?{...n,[t]:!oT(t,aT(e))}:n}var cT=new Set(tT),lT=new Set(eT);function uT(){return nT.filter(e=>lT.has(e.id))}function dT(e){return nT.filter(t=>cT.has(t.id)&&(t.capability===void 0||e[t.capability]))}function fT(e,t){return t===`flat`?!1:t===`virtual`||e>=100}function pT(e,t){let n=t===null?-1:e.indexOf(t);return n<0?[]:[n-1,n,n+1].filter(t=>t>=0&&t<e.length)}function mT(e,t){let n=e.map(e=>oT(e.id,t)?e.id===`workflow`||e.id===`memory`?120:Number.parseFloat(e.width??`100`):42);return{"--task-columns":e.map((e,t)=>e.id===`task`?`minmax(${n[t]}px, 1fr)`:`${n[t]}px`).join(` `),minInlineSize:Math.max(1240,n.reduce((e,t)=>e+t,0))}}var hT=null,{min:gT,max:_T,abs:vT,floor:yT}=Math,bT=(e,t,n)=>gT(n,_T(t,e)),xT=e=>[...e].sort((e,t)=>e-t),ST=typeof queueMicrotask==`function`?queueMicrotask:e=>{Promise.resolve().then(e)},CT=()=>{let e;return[new Promise(t=>{e=t}),e]},wT=e=>{let t;return()=>(e&&=(t=e(),void 0),t)},TT=(e,t,n)=>{let r=n?`unshift`:`push`;for(let n=0;n<t;n++)e[r](-1);return e},ET=(e,t)=>{let n=e.t[t];return n===-1?e.o:n},DT=(e,t,n)=>{let r=e.t[t]===-1;return e.t[t]=n,e.i=gT(t,e.i),r},OT=(e,t)=>{if(!e.l)return 0;if(e.i>=t)return e.u[t];e.i<0&&(e.u[0]=0,e.i=0);let n=e.i,r=e.u[n];for(;n<t;)r+=ET(e,n),e.u[++n]=r;return e.i=t,r},kT=(e,t,n=0,r=e.l-1)=>{let i=n;for(;n<=r;){let a=yT((n+r)/2);OT(e,a)<=t?(i=a,n=a+1):r=a-1}return bT(i,0,e.l-1)},AT=(e,t,n)=>{let r=t-e.l;return e.i=n?-1:gT(t-1,e.i),e.l=t,r>0?(TT(e.u,r),TT(e.t,r,n),e.o*r):(e.u.splice(r),(n?e.t.splice(0,-r):e.t.splice(r)).reduce((t,n)=>t-(n===-1?e.o:n),0))},jT=typeof window<`u`,MT=e=>e.documentElement,NT=e=>e.ownerDocument,PT=e=>e.defaultView,FT=wT(()=>!!/iP(hone|od|ad)/.test(navigator.userAgent)||navigator.platform===`MacIntel`&&navigator.maxTouchPoints>0),IT=wT(()=>`scrollBehavior`in MT(document).style),LT=e=>_T(e.h(),e.p()),RT=(e,t=40,n=0,r,i=!1)=>{let a=!!n,o=1,s=0,c=0,l=0,u=0,d=0,f=0,p=0,m=0,h=hT,g=[0,a?_T(n-1,0):-1],_=0,v=!1,y=((e,t,n)=>({o:t,t:n?TT(n.slice(0,gT(e,n.length)),_T(0,e-n.length)):TT([],e),l:e,i:-1,u:TT([],e+1)}))(e,r?r[1]:t,r&&r[0]),b=new Set,x=()=>l-c,S=()=>x()+d+u,C=(e,t)=>((e,t,n,r)=>{if(r=gT(r,e.l-1),OT(e,r)<=t){let i=kT(e,n,r);return[kT(e,t,r,i),i]}{let i=kT(e,t,void 0,r);return[i,kT(e,n,i)]}})(y,e,t,g[0]),w=()=>OT(y,y.l),T=(e,t)=>{let n=OT(y,e)-d;return t?w()-n-E(e):n},E=e=>ET(y,e),D=(e,t=-1)=>y.t[e]===t,O=e=>{e&&(FT()&&p!==0||h&&m===1?d+=e:u+=e)};return{v:()=>{b.clear()},m:()=>o,_:()=>(e=>[e.t.slice(),e.o])(y),S:(e=200)=>{if(!v||a)return g;let t,n;if(f)[t,n]=g;else{let r=_T(0,S()),a=r+s;i||(e=_T(0,e),p!==1&&(r-=e),p!==2&&(a+=e)),[t,n]=g=C(_T(0,r),_T(0,a)),h&&(t=gT(t,h[0]),n=_T(n,h[1]))}return[_T(t,0),gT(n,y.l-1)]},$:e=>kT(y,e-c),I:D,k:T,R:E,T:()=>y.l,C:()=>l,M:()=>p!==0,p:()=>s,O:()=>c,h:w,H:()=>(f=u,u=0,[f,m===2]),W:(e,t)=>{let n=[e,t];return b.add(n),()=>{b.delete(n)}},B:(e,t)=>{let n,r,g=0;switch(e){case 1:{if(t===l&&m===0)break;let e=f;f=0;let n=t-l,i=vT(n);e&&i<vT(e)+1||m!==0||(p=n<0?2:1),a&&=!1,l=t,g=4;let o=x();o>=-s&&o<=w()&&(g+=1,r=i>s);break}case 2:g=8,p!==0&&(n=!0,g+=1),p=0,m=0,h=hT;break;case 3:{let e=t.filter(([e,t])=>!D(e,t));if(!e.length)break;O(e.reduce((e,[t,n])=>{let r;if(m===2)r=!0;else if(h&&m===1)r=t<h[0];else{let e=x(),n=T(t),i=E(t);r=p!==1&&m===0?n+i<=e:n<e&&n+i<e+s}return r&&(e+=n-E(t)),e},0));for(let[t,n]of e){let e=E(t),r=DT(y,t,n);i&&(_+=r?n:n-e)}i&&s&&_>s&&(O(((e,t)=>{let n=0,r=[];e.t.forEach((e,i)=>{e!==-1&&(r.push(e),i<t&&n++)}),e.i=-1;let i=xT(r),a=i.length,o=a/2|0,s=a%2==0?(i[o-1]+i[o])/2:i[o],c=e.o;return((e.o=s)-c)*_T(t-n,0)})(y,kT(y,S()))),i=!1),g=3,r=!0;break}case 4:s!==t&&(s||(v=r=!0),s=t,g=3);break;case 5:t[1]?(O(AT(y,t[0],!0)),m=2,g=1):(AT(y,t[0]),g=1);break;case 6:c=t;break;case 7:m=1;break;case 8:h=C(t,t+s),g=1}g&&(o=1+(2147483647&o),n&&d&&(u+=d,d=0),b.forEach(([e,t])=>{g&e&&t(r)}))}}},zT=setTimeout,BT=(e,t)=>t?-e:e,VT=(e,t,n,r,i,a)=>{let o=Date.now,s=0,c=!1,l=!1,u=!1,d=!1,f=(()=>{let t,n=()=>{t!=hT&&clearTimeout(t)},r=()=>{n(),t=zT(()=>{t=hT,(()=>{if(c||l)return c=!1,void f();u=!1,e.B(2)})()},150)};return r.J=n,r})(),p=()=>{s=o(),u&&(d=!0),a&&e.B(6,a()),e.B(1,r()),f()},m=t=>{if(c||!e.M()||t.ctrlKey)return;let r=o()-s;150>r&&50<r&&(n?t.deltaX:t.deltaY)&&(c=!0)},h=()=>{l=!0,u=d=!1},g=()=>{l=!1,FT()&&(u=!0)};return t.addEventListener(`scroll`,p),t.addEventListener(`wheel`,m,{passive:!0}),t.addEventListener(`touchstart`,h,{passive:!0}),t.addEventListener(`touchend`,g,{passive:!0}),{A:()=>{t.removeEventListener(`scroll`,p),t.removeEventListener(`wheel`,m),t.removeEventListener(`touchstart`,h),t.removeEventListener(`touchend`,g),f.J()},L:()=>{let[t,n]=e.H();t&&(i(t,n,d),d=!1,n&&e.p()>e.h()&&e.B(1,r()))}}},HT=(e,t,n)=>{let r;return[async(i,a)=>{if(!await t())return;r&&r();let o=()=>{let[t,n]=CT();return r=()=>{n(!1)},e.p()&&zT(r,150),[t,e.W(2,()=>{n(!0)})]};if(a&&IT())e.B(8,i()),ST(async()=>{for(;;){let t=!0;for(let[n,r]=e.S();n<=r;n++)if(e.I(n)){t=!1;break}if(t)break;let[n,r]=o();try{if(!await n)return}finally{r()}}e.B(7),n(i(),a)});else for(;;){let[t,r]=o();try{if(e.B(7),n(i()),!await t)return}finally{r()}}},()=>{r&&r()}]},UT=(e,t)=>{let n,r,i=CT(),a=!1,o=t?`scrollLeft`:`scrollTop`,s=t?`overflowX`:`overflowY`,[c,l]=HT(e,()=>i[0],(e,r)=>{e=BT(e,a),r?n.scrollTo({[t?`left`:`top`]:e,behavior:`smooth`}):n[o]=e});return{N(c,u){n=u,t&&(a=getComputedStyle(u).direction===`rtl`),r=VT(e,u,t,()=>BT(u[o],a),(t,n,r)=>{if(r){let e=u.style,t=e[s];e[s]=`hidden`,zT(()=>{e[s]=t})}u[o]=BT(e.C()+t,a),n&&l()}),i[1](!0)},v(){r&&r.A(),i[1](!1),i=CT()},P:()=>a,V(e){c(()=>e)},X(t){t+=e.C(),c(()=>t)},Y(t,{align:n,smooth:r,offset:i=0}={}){if(t=bT(t,0,e.T()-1),n===`nearest`){let r=e.k(t),i=e.C();if(r<i)n=`start`;else{if(!(r+e.R(t)>i+e.p()))return;n=`end`}}c(()=>i+e.O()+e.k(t)+(n===`end`?e.R(t)-e.p():n===`center`?(e.R(t)-e.p())/2:0),r)},q:()=>{r&&r.L()}}},WT=e=>{let t;return{j(n){(t||=new(PT(NT(n))).ResizeObserver(e)).observe(n)},D(e){t.unobserve(e)},A(){t&&t.disconnect()}}},GT=(e,t)=>{let n,r=t?`width`:`height`,i=new WeakMap,a=WT(t=>{let a=[];for(let{target:o,contentRect:s}of t)if(o.offsetParent)if(o===n)e.B(4,s[r]);else{let e=i.get(o);e!=hT&&a.push([e,s[r]])}a.length&&e.B(3,a)});return{G(e){a.j(n=e)},U:(e,t)=>(i.set(e,t),a.j(e),()=>{i.delete(e),a.D(e)}),v:a.A}},KT=jT?Y.useLayoutEffect:Y.useEffect,qT=`current`,JT=(e,t)=>{if(Array.isArray(e))for(let n of e)JT(n,t);else e==null||typeof e==`boolean`||t.push(e)},YT=(e,t)=>e.key??`_`+t,XT=e=>{let t=(0,Y.useRef)(null);return t[qT]||(t[qT]=e())},ZT=e=>{let t=(0,Y.useRef)(e);return KT(()=>{t[qT]=e},[e]),t},QT=(0,Y.memo)(({Z:e,ee:t,te:n,oe:r,ne:i,re:a,se:o,ie:s})=>{let c=(0,Y.useRef)(null);KT(()=>t(c[qT],n),[n]);let l=(0,Y.useMemo)(()=>{let e={contain:`layout style`,position:i&&s?void 0:`absolute`,[o?`height`:`width`]:`100%`,[o?`top`:`left`]:0,[o?`left`:`top`]:r,visibility:!i||s?void 0:`hidden`};return o&&(e.display=`inline-flex`),e},[r,i,s,o]);return(0,X.jsx)(a,typeof a==`string`?{ref:c,style:l,children:e}:{ref:c,style:l,index:n,children:e})}),$T=(e,t)=>(0,Y.useMemo)(()=>{if(typeof e==`function`)return[n=>e(t[n],n),t.length];let n=(e=>{let t=[];return JT(e,t),t})(e);return[e=>n[e],n.length]},[e,t]),eE=(0,Y.forwardRef)(({children:e,data:t,bufferSize:n,itemSize:r,shift:i,horizontal:a,keepMounted:o,cache:s,startMargin:c=0,ssrCount:l,as:u=`div`,item:d=`div`,scrollRef:f,onScroll:p,onScrollEnd:m},h)=>{let[g,_]=$T(e,t),v=(0,Y.useRef)(null),y=(0,Y.useRef)(!!l),b=ZT(p),x=ZT(m),[S,C,w,T]=XT(()=>{let e=!!a,t=RT(_,r,l,s,!r);return[t,GT(t,e),UT(t,e),e]});_!==S.T()&&S.B(5,[_,i]),c!==S.O()&&S.B(6,c);let[E,D]=(0,Y.useReducer)(S.m,void 0,S.m),O=S.M(),k=S.h(),A=w.P(),j=[],M=e=>{let t=g(e);return(0,X.jsx)(QT,{ee:C.U,te:e,oe:S.k(e,A),ne:S.I(e),re:d,Z:t,se:T,ie:y[qT]},YT(t,e))};if(KT(()=>{y[qT]=!1,S.W(1,e=>{e?(0,ld.flushSync)(D):D()}),S.W(4,()=>{b[qT]&&b[qT](S.C())}),S.W(8,()=>{x[qT]&&x[qT]()});let e=v[qT],t=t=>{C.G(t),w.N(e,t)};return f?ST(()=>{f[qT]&&t(f[qT])}):t(e.parentElement),()=>{S.v(),C.v(),w.v()}},[]),KT(()=>{w.q()},[E]),(0,Y.useImperativeHandle)(h,()=>({get cache(){return S._()},get scrollOffset(){return S.C()},get scrollSize(){return LT(S)},get viewportSize(){return S.p()},findItemIndex:S.$,getItemOffset:S.k,getItemSize:S.R,scrollToIndex:w.Y,scrollTo:w.V,scrollBy:w.X}),[]),o){let e=new Set(o);for(let[t,r]=S.S(n);t<=r;t++)e.add(t);xT([...e]).forEach(e=>{j.push(M(e))})}else for(let[e,t]=S.S(n);e<=t;e++)j.push(M(e));return(0,X.jsx)(u,{ref:v,style:{contain:`size style`,overflowAnchor:`none`,flex:`none`,position:`relative`,width:T?k:`100%`,height:T?`100%`:k,pointerEvents:O?`none`:void 0},children:j})});function tE(e,t){let[n,r]=(0,Y.useState)(!1),[i,a]=(0,Y.useState)(``),o=(0,Y.useRef)(!1);return{editing:n,draft:i,setDraft:a,begin:()=>{a(e),o.current=!1,r(!0)},commit:()=>{if(o.current)return;o.current=!0,r(!1);let n=i.trim();n.length===0||n===e||t(n)},cancel:()=>{o.current=!0,r(!1)}}}function nE({editor:e,className:t}){return(0,X.jsx)(`input`,{"data-slot":`title-input`,"aria-label":`Task title`,autoFocus:!0,value:e.draft,onChange:t=>e.setDraft(t.target.value),onBlur:e.commit,onKeyDown:t=>{t.key===`Enter`?(t.preventDefault(),e.commit()):t.key===`Escape`&&(t.preventDefault(),e.cancel())},className:c(`w-full min-w-0 rounded-sm border border-border bg-card px-1.5 py-0.5 outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`,t)})}function rE(e){let t=new Map,n=new Set,r;return{begin:e,editingId:()=>r?.id??null,subscribeSelection(e){return n.add(e),()=>{n.delete(e)}},snapshot:e=>r?.id===e?r.editor:null,subscribe(e,n){let r=t.get(e);return r||(r=new Set,t.set(e,r)),r.add(n),()=>{r.delete(n),r.size||t.delete(e)}},publish(e,i){let a=r?.id;if(r=e&&i.editing?{id:e,editor:i}:void 0,a!==r?.id)for(let e of n)e();for(let e of new Set([a,r?.id]))if(e)for(let n of t.get(e)??[])n()}}}var iE=(0,Y.createContext)(null),aE={editing:!1,draft:``,begin(){},setDraft(){},commit(){},cancel(){}};function oE({children:e,runs:t,onRename:n}){let[r,i]=(0,Y.useState)(),[a]=(0,Y.useState)(()=>rE(e=>i({run:e}))),o=t.find(e=>e.id===r?.run.id),s=tE(o?La(o):``,e=>{o&&n(o.id,e)});return(0,Y.useEffect)(()=>{r&&s.begin()},[r]),(0,Y.useEffect)(()=>{r&&!o&&(s.cancel(),i(void 0))},[r,o,s]),(0,Y.useLayoutEffect)(()=>{a.publish(o?.id,s)},[a,o?.id,s]),(0,X.jsx)(iE,{value:a,children:e})}function sE(e){let t=(0,Y.useContext)(iE);if(!t)throw Error(`Task title editor needs its page provider`);return{...(0,Y.useSyncExternalStore)((0,Y.useCallback)(n=>t.subscribe(e.id,n),[t,e.id]),(0,Y.useCallback)(()=>t.snapshot(e.id),[t,e.id]))??aE,begin:()=>t.begin(e)}}var cE=()=>null;function lE(){return uE}function uE(){}function dE(){let e=(0,Y.useContext)(iE);return(0,Y.useSyncExternalStore)(e?.subscribeSelection??lE,e?.editingId??cE)}var fE=(0,Y.createContext)(null);function pE(e,t,n=!1){let[r,i]=(0,Y.useState)(null),a=(0,Y.useRef)(new Map),o=(0,Y.useCallback)((e,t)=>{t?a.current.set(e,t):a.current.delete(e)},[]),s=(0,Y.useCallback)(e=>[...a.current.values()].some(t=>t.includes(e)),[]);return{props:mE(e,t,i,n?s:void 0),value:(0,Y.useMemo)(()=>({focused:r,revision:t,registerList:n?o:void 0}),[r,t,o,n])}}function mE(e,t,n,r){let i=(0,Y.useRef)(r);(0,Y.useLayoutEffect)(()=>{i.current=r});let a=(0,Y.useRef)(null),o=(0,Y.useRef)(null);return(0,Y.useLayoutEffect)(()=>{let e=o.current;if(!e||e.element.isConnected||document.activeElement!==document.body)return;let t=()=>{o.current===e&&(o.current=null,n?.(null))},r=()=>{let n=e.project?`${e.project}/${e.runId}`:e.runId;if(i.current&&!i.current(n)||document.activeElement!==document.body||e.element.isConnected)return t(),!0;let r=[...a.current?.querySelectorAll(`[data-run-id]`)??[]].filter(t=>t.dataset.runId===e.runId&&t.dataset.project===e.project).flatMap(e=>[...e.querySelectorAll(`a,button,input`)]),o=r.find(t=>e.control?t.dataset.taskControl===e.control:t.tagName===e.tag&&t.getAttribute(`aria-label`)===e.label)??r.find(e=>e.tagName===`A`);return o?.focus({preventScroll:!0}),!!o&&document.activeElement===o};if(r()||!a.current)return;let s=()=>{l.disconnect(),document.removeEventListener(`pointerdown`,c,!0),document.removeEventListener(`keydown`,c,!0)},c=()=>{t(),s()},l=new MutationObserver(()=>{r()&&s()});return document.addEventListener(`pointerdown`,c,!0),document.addEventListener(`keydown`,c,!0),l.observe(a.current,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`style`]}),s},[e,t]),{ref:a,onFocusCapture:e=>{let t=e.target,r=t.closest(`[data-run-id]`);o.current=r?{element:t,runId:r.dataset.runId,project:r.dataset.project,control:t.dataset.taskControl??null,label:t.getAttribute(`aria-label`),tag:t.tagName}:null,n?.(r?r.dataset.project?`${r.dataset.project}/${r.dataset.runId}`:r.dataset.runId:null)},onBlurCapture:e=>{let t=e.target,r=e.currentTarget;queueMicrotask(()=>{o.current?.element===t&&t.isConnected&&!r.contains(document.activeElement)&&(o.current=null,n?.(null))})}}}var hE=new WeakMap;function gE({items:e,itemKey:t,children:n,itemSize:r}){let[i]=gn(),a=(0,Y.useRef)(null),o=(0,Y.useRef)(null),[s,c]=(0,Y.useState)({available:null,margin:0}),[l,u]=(0,Y.useState)(null),d=dE(),f=(0,Y.useContext)(fE),p=e.map(t),m=fT(e.length,i.get(`tasks`)),h=s.available===!0&&m,g=(0,Y.useRef)(Symbol(`task-list`)),_=(0,Y.useRef)(()=>{});(0,Y.useLayoutEffect)(()=>{f?.registerList?.(g.current,p);let e=y.current;return e&&hE.set(e,{keys:p,handle:o,measure:()=>_.current()}),()=>{f?.registerList?.(g.current,null),e&&hE.delete(e)}});let v=mE(String(h),void 0,void 0,e=>p.includes(e)),y=v.ref;return(0,Y.useLayoutEffect)(()=>{let e=y.current,t=e?.closest(`[data-slot="main"]`);if(a.current=t??null,!e||!t){c(e=>e.available===!1?e:{available:!1,margin:0});return}let n=null,r=()=>{let r=Math.max(0,e.getBoundingClientRect().top-t.getBoundingClientRect().top+t.scrollTop);r!==n&&(n=r,c(e=>e.available===!0&&e.margin===r?e:{available:!0,margin:r}))};r(),_.current=r;let i=new ResizeObserver(r);for(let n=e;n&&n!==t;n=n.parentElement){i.observe(n);for(let e of n.parentElement?.children??[])i.observe(e)}return i.observe(t),()=>i.disconnect()},[]),(0,X.jsx)(`div`,{ref:y,"data-slot":`task-list-items`,"data-virtualized":h,onFocusCapture:e=>{v.onFocusCapture(e),u(e.target.closest(`[data-task-item]`)?.dataset.taskItem??null)},onBlurCapture:e=>{v.onBlurCapture(e),e.relatedTarget&&!e.currentTarget.contains(e.relatedTarget)&&u(null)},children:h?(0,X.jsx)(vE,{itemSize:r,items:e,keys:p,handle:o,scroll:a,margin:s.margin,focused:f?.focused??l,editing:d,children:n}):(s.available===null&&m?[]:e).map((t,r)=>(0,X.jsx)(`div`,{"data-task-item":p[r],"data-first":r===0,"data-last":r===e.length-1,className:`task-list-flat-item`,children:n(t,r)},p[r]))})}function _E({layout:e,revision:t,visibilityRevision:n=``,children:r,...i}){let a=pE(e,t,!0);return(0,X.jsx)(fE,{value:a.value,children:(0,X.jsx)(bE,{revision:t,visibilityRevision:`${e}:${n}`,children:(0,X.jsx)(`div`,{...i,...a.props,children:r})})})}function vE({items:e,keys:t,handle:n,scroll:r,margin:i,focused:a,editing:o,children:s,itemSize:c}){let[l,u]=(0,Y.useState)(!1),d=yE(r);return(0,Y.useLayoutEffect)(()=>{let e=r.current;if(!e)return;let t=new ResizeObserver(e=>{e.some(e=>e.contentRect.height>0)&&(u(!0),t.disconnect())});return t.observe(e),()=>t.disconnect()},[r]),(0,X.jsx)(eE,{ref:n,...c===void 0?{}:{itemSize:c},scrollRef:r,startMargin:i,keepMounted:[...new Set([...!l&&e.length?[0]:[],...pT(t,a),...pT(t,d),...pT(t,o)])],data:e,children:(n,r)=>(0,X.jsx)(`div`,{"data-task-item":t[r],"data-first":r===0,"data-last":r===e.length-1,children:s(n,r)},t[r])})}function yE(e){let[t,n]=(0,Y.useState)(null),r=(0,Y.useRef)(t);return(0,Y.useLayoutEffect)(()=>{let t=e.current;if(!t)return;let i=e=>{if(e.target!==t)return;let i=t.contains(document.activeElement)?document.activeElement.closest(`[data-task-item]`)?.dataset.taskItem??null:null;i!==r.current&&(r.current=i,(0,ld.flushSync)(()=>n(i)))};return document.addEventListener(`scroll`,i,{capture:!0,passive:!0}),()=>document.removeEventListener(`scroll`,i,{capture:!0})},[e]),t}var bE=class extends Y.Component{root={current:null};owner(){return this.root.current?.closest(`[data-slot="main"]`)??null}getSnapshotBeforeUpdate(e){if(e.revision===this.props.revision&&e.visibilityRevision===this.props.visibilityRevision)return null;let t=this.owner();if(!t||!this.root.current)return null;let n=t.getBoundingClientRect();for(let e of this.root.current.querySelectorAll(`[data-task-item]`)){let r=e.getBoundingClientRect();if(r.bottom>n.top&&r.top<n.bottom)return{key:e.dataset.taskItem,top:r.top,scrollTop:t.scrollTop}}return{key:null,top:0,scrollTop:t.scrollTop}}componentDidUpdate(e,t,n){let r=this.owner();if(!n||!r)return;let i=n.key===null?null:this.currentTop(n.key);i!==null&&Math.abs(i-n.top)>.5&&(r.scrollTop+=i-n.top),queueMicrotask(()=>{r.isConnected&&(0,ld.flushSync)(()=>{for(let e of this.root.current?.querySelectorAll(`[data-slot="task-list-items"]`)??[])hE.get(e)?.measure();r.scrollTop!==n.scrollTop&&r.dispatchEvent(new Event(`scroll`))})})}currentTop(e){for(let t of this.root.current?.querySelectorAll(`[data-task-item]`)??[])if(t.dataset.taskItem===e)return t.getBoundingClientRect().top;for(let t of this.root.current?.querySelectorAll(`[data-slot="task-list-items"]`)??[]){let n=hE.get(t),r=n?.keys.indexOf(e)??-1,i=n?.handle.current;if(r>=0&&i)return t.getBoundingClientRect().top+i.getItemOffset(r)}return null}render(){return(0,X.jsx)(`div`,{ref:this.root,style:{display:`contents`},children:this.props.children})}},xE=[{value:`all`,label:`All`},{value:`direct`,label:`Direct tasks`},{value:`automations`,label:`Automations`}];function SE(e){return e?xE:xE.filter(e=>e.value!==`automations`)}function CE(e,t){return e===`automations`&&!t?`all`:e}function wE(e){return e===`direct`||e===`automations`?e:`all`}function TE(e,t){return t===`all`||qe(e)===(t===`automations`)}function EE(e){return e===`all`?void 0:e===`automations`}function DE(e,t){let n={all:0,direct:0,automations:0};for(let r of e)Wa(r)||r.archived!==(t===`archived`)||(n.all+=1,qe(r)?n.automations+=1:n.direct+=1);return n}function OE(e,t,n,r,i){let a=qa(e).archived,o=a>=200;if(n===`all`)return i??(o?`200+`:a);let s=DE(t,`archived`)[n];return o&&r!==!1?`${s}+`:s}function kE(e){return e.rows.map(e=>e.run)}function AE(e,t){switch(e){case`Needs you`:return`pending`;case`Working`:return`running`;case`Archived`:return`neutral`;case`Finished`:return t.some(e=>Pe(e).bucket===`error`)?`danger`:`success`}}function jE(e,t,n){return Na(e,t,Ya(n))}var ME=(e,t)=>JSON.stringify([e,t]);function NE(e,t,n){let r=new Map,i=e.map(e=>{let{run:t}=e,n=ME(t.projectId,t.id);r.set(n,e);let i=t.delegation;return{...t,id:n,...i&&`parentRunId`in i?{delegation:{...i,parentRunId:ME(t.projectId,i.parentRunId)}}:{}}}),a=new Map;for(let e of n){let t=a.get(e.projectId);t?t.push(e):a.set(e.projectId,[e])}let o=new Map;for(let[e,t]of a)for(let[n,r]of Ya(t))o.set(ME(e,n),r);let s=e=>r.get(e.id);return Na(i,t,o).map(e=>({label:e.label,rows:e.rows.map(e=>({kind:`run`,run:s(e.run),queuePosition:e.queuePosition}))}))}function PE(e){return[e.run]}var FE=/^- \S+ — (?:(?:turn complete|step ".*" complete|step ".*" ended without done|session idle-closed) — |worktree setup (?:done in|failed —|skipped —) )/;function IE(e,t=3){let n=Vt(e,`## Progress log`);if(n<0)return[];let r=[];for(let i of e.slice(Xe(e,n)).split(`
|
|
21
|
+
`)){if(r.length>=t||i.startsWith(`## `))break;let e=i.trim();!e||FE.test(e)||r.push(e.replace(/^[-*] /,``))}return r}function LE({origin:e,counts:t,automations:n,onChange:r,compact:i=!1}){return(0,X.jsx)(`div`,{role:`group`,"aria-label":`Task origin`,"data-slot":`origin-filter`,className:c(`flex flex-wrap items-center`,i?`inline-flex rounded-md border border-border bg-card p-0.5 gap-0.5`:`gap-1.5`),children:SE(n).map(n=>{let a=n.value===e;return(0,X.jsxs)(`button`,{type:`button`,"data-origin":n.value,"aria-pressed":a,onClick:()=>r(n.value),className:c(i?`inline-flex min-h-11 items-center gap-1 rounded-sm px-2.5 text-xs font-medium text-muted-foreground hover:bg-muted hover:text-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-link-foreground md:min-h-0 md:h-8`:`inline-flex min-h-11 items-center gap-1.5 rounded-full border border-border px-3 text-[13px] font-medium text-muted-foreground hover:bg-muted hover:text-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-link-foreground`,a&&(i?`bg-accent-strong/15 text-accent-text`:`border-accent-strong bg-accent-strong/10 text-accent-text`)),children:[n.label,` `,(0,X.jsx)(Zf,{value:t[n.value]})]},n.value)})})}function RE({onExpand:e,onCollapse:t,compact:n=!1}){return(0,X.jsxs)(`div`,{"data-slot":`group-fold-controls`,className:c(`hidden flex-wrap items-center gap-1 md:flex`,!n&&`md:ml-auto md:gap-2`),children:[(0,X.jsx)(G,{type:`button`,variant:`ghost`,size:n?`sm`:`default`,className:n?`h-9 px-2 text-xs text-muted-foreground`:`min-h-11`,"data-action":`expand-groups`,onClick:e,children:`Expand groups`}),(0,X.jsx)(G,{type:`button`,variant:`ghost`,size:n?`sm`:`default`,className:n?`h-9 px-2 text-xs text-muted-foreground`:`min-h-11`,"data-action":`collapse-groups`,onClick:t,children:`Collapse groups`})]})}function zE(e,t){if(t===`danger`)return`contains failed tasks`;switch(e){case`Needs you`:return`needs you`;case`Working`:return`working`;case`Finished`:return`finished`;case`Archived`:return`archived`}}function BE({id:e,label:t,count:n,tone:r,folded:i,collapsed:a,onToggle:o,children:s}){let c=a?Lr:Tr;return(0,X.jsxs)(`section`,{"data-slot":`task-status-group`,"data-bucket":t,"data-folded":i,"data-tone":r,"aria-labelledby":`${e}-heading`,className:`flex flex-col gap-2.5`,children:[(0,X.jsx)(`h2`,{id:`${e}-heading`,className:`text-[13px] font-semibold text-foreground`,children:(0,X.jsxs)(`button`,{type:`button`,"data-slot":`status-group-toggle`,"aria-expanded":!a,"aria-controls":`${e}-rows`,"aria-label":`${t} ${n}${r===`danger`?`, contains failed tasks`:``}`,onClick:o,className:`inline-flex min-h-11 items-center gap-2 rounded-md pr-2 hover:text-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-link-foreground`,children:[(0,X.jsx)(c,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),(0,X.jsx)(J,{tone:r,role:`img`,"aria-label":zE(t,r),title:zE(t,r)}),(0,X.jsx)(`span`,{children:t}),` `,(0,X.jsx)(Zf,{value:n,className:`font-normal text-muted-foreground`})]})}),(0,X.jsx)(`div`,{id:`${e}-rows`,hidden:a,children:a?null:s})]})}function VE({projectId:e,runId:t,status:n,error:r,open:i}){let a=xe(e,t,!0),o=a.data===void 0?[]:IE(a.data);return(0,X.jsxs)(`div`,{"data-slot":`task-preview`,className:`flex flex-col gap-3 rounded-md bg-muted/50 p-4 text-xs`,children:[(0,X.jsx)(`p`,{className:`font-medium text-foreground`,children:n}),r?(0,X.jsx)(`p`,{"data-slot":`task-preview-error`,className:`break-words text-semantic-red`,children:r}):null,a.isPending?(0,X.jsx)(`p`,{role:`status`,className:`text-muted-foreground`,children:`Loading latest progress…`}):a.isError?(0,X.jsx)(`p`,{"data-slot":`task-preview-unavailable`,className:`text-muted-foreground`,children:`Latest progress is unavailable.`}):o.length===0?(0,X.jsx)(`p`,{className:`text-muted-foreground`,children:`No progress recorded yet.`}):(0,X.jsx)(`ul`,{"aria-label":`Latest progress`,className:`flex flex-col gap-1 text-muted-foreground`,children:o.map((e,t)=>(0,X.jsx)(`li`,{className:`break-words`,children:e},t))}),(0,X.jsx)(`div`,{children:i})]})}function HE(e,t){return e===`Finished`?`neutral`:AE(e,t)}var UE=`inline-flex min-h-11 max-md:min-w-11 md:min-h-0 md:h-8 items-center justify-center gap-1.5 border-b-2 border-transparent px-1 text-[13px] text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring`,WE=`border-accent-text font-medium text-foreground`;function GE({view:e,current:t,onSelect:n,count:r,children:i}){let a=e===t;return(0,X.jsxs)(`button`,{type:`button`,"data-slot":`overview-tab`,"data-view":e,"aria-pressed":a,onClick:()=>n(e),className:c(UE,a&&WE),children:[i,r===0?null:(0,X.jsxs)(`span`,{className:`tabular-nums`,children:[` · `,(0,X.jsx)(Zf,{value:r})]})]})}function KE({view:e,onSelect:t,activeCount:n,archivedCount:r,trailing:i}){return(0,X.jsxs)(`div`,{"data-slot":`tasks-view-tabs`,className:`flex flex-wrap items-center gap-x-4 gap-y-1`,children:[(0,X.jsx)(GE,{view:`active`,current:e,onSelect:t,count:n,children:`Active`}),(0,X.jsx)(GE,{view:`archived`,current:e,onSelect:t,count:r,children:`Archived`}),i]})}function qE(){return(0,X.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`—`})}function JE(e,t,n){return`${e} ${e===1?`task`:`tasks`}${t?` loaded`:``}${n?` matching “${n}”`:``}`}function YE({count:e,incomplete:t,needle:n}){return(0,X.jsx)(`span`,{"data-slot":`tasks-result-count`,className:c(`self-center truncate text-xs text-soft-foreground tabular-nums`,n===``&&!t&&`max-md:hidden`),children:JE(e,t,n)})}function XE({branch:e}){return(0,X.jsx)($f,{value:e,variant:`chip`})}function ZE({view:e,unread:t,finished:n,archivePending:r,markReadPending:i=!1,onMarkAllRead:a,onArchiveFinished:o,focusReturnRef:s}){let c=Y.useRef(!1),[l,u]=Y.useState(!1),d=n>0||r;return Y.useEffect(()=>{let e=window.matchMedia?.(gg);if(!e)return;let t=()=>{e.matches&&u(!1)};return t(),e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]),(0,X.jsxs)(X.Fragment,{children:[t>0?(0,X.jsxs)(G,{type:`button`,variant:`outline`,size:`sm`,"data-slot":`mark-all-read`,disabled:i,"aria-busy":i,className:`hidden h-8 md:inline-flex`,onClick:a,children:[(0,X.jsx)(Es,{className:`size-3.5`,"aria-hidden":`true`}),`Mark all read `,(0,X.jsx)(Zf,{value:t,className:`text-muted-foreground`})]}):null,e===`active`&&n>0?(0,X.jsxs)(G,{type:`button`,variant:`outline`,size:`sm`,"data-slot":`archive-finished`,className:`hidden h-8 md:inline-flex`,disabled:r,"aria-busy":r,onClick:o,children:[(0,X.jsx)(Fr,{className:`size-3.5`,"aria-hidden":`true`}),`Archive finished `,(0,X.jsx)(Zf,{value:n,className:`text-muted-foreground`})]}):null,e===`active`&&(d||t>0)?(0,X.jsxs)(Li,{open:l,onOpenChange:u,children:[(0,X.jsx)(Pi,{asChild:!0,children:(0,X.jsx)(G,{type:`button`,variant:`outline`,size:`icon`,className:`min-h-11 min-w-11 md:hidden`,"aria-label":`Task actions`,"aria-busy":r||i,children:(0,X.jsx)(Fs,{"aria-hidden":`true`})})}),(0,X.jsxs)(Fi,{align:`end`,className:`md:hidden`,onCloseAutoFocus:e=>{(c.current||window.matchMedia?.(`(min-width: 48rem)`).matches)&&(e.preventDefault(),c.current=!1,(s?.current??document).querySelector(`[data-slot="overview-tab"][data-view="active"]`)?.focus())},children:[d?(0,X.jsxs)(K,{disabled:r||n===0,onSelect:()=>{c.current=!0,o()},children:[(0,X.jsx)(Fr,{"aria-hidden":`true`}),r?`Archiving…`:`Archive finished (${n})`]}):null,t>0?(0,X.jsxs)(K,{disabled:i,onSelect:a,children:[(0,X.jsx)(Es,{"aria-hidden":`true`}),`Mark all read (${t})`]}):null]})]}):null]})}function QE(e){return e.id===`diff`?`Diff`:e.id===`reference`?`Reference`:e.id===`memory`?`Memory`:e.summaryLabel??e.label}function $E({columns:e,expandedColumns:t,columnsPending:n,onToggleColumn:r,detailedTable:i,onToggleDetailed:a}){return(0,X.jsxs)(sa,{children:[(0,X.jsx)(ra,{asChild:!0,children:(0,X.jsx)(G,{"data-slot":`task-columns-trigger`,variant:`outline`,className:`hidden h-9 md:inline-flex`,children:`Columns`})}),(0,X.jsxs)(aa,{align:`end`,className:`w-72`,children:[(0,X.jsx)(`h2`,{className:`mb-2 text-base font-medium`,children:`Visible columns`}),(0,X.jsx)(`p`,{className:`mb-4 text-xs text-muted-foreground`,children:`Task · Always visible`}),(0,X.jsx)(`div`,{className:`grid grid-cols-2 gap-3`,children:e.filter(e=>e.canFold).map(e=>(0,X.jsxs)(`label`,{className:`flex items-center gap-2 text-xs`,children:[(0,X.jsx)(`input`,{"data-column-toggle":e.id,type:`checkbox`,checked:oT(e.id,t),disabled:n,onChange:()=>r(e.id)}),QE(e)]},e.id))}),(0,X.jsx)(`p`,{className:`mt-4 text-xs text-muted-foreground`,children:`Saved automatically across task lists.`}),a?(0,X.jsx)(G,{variant:`outline`,className:`mt-4`,onClick:a,children:i?`Summary view`:`Resource columns`}):null]})]})}function eD({query:e,onQueryChange:t,searchPlaceholder:n,searchLabel:r,origin:i,originCounts:a,automations:o,onOriginChange:s,columns:c,expandedColumns:l,columnsPending:u,onToggleColumn:d,detailedTable:f,onToggleDetailed:p,groupLabels:m,onSetAllFolds:h,extraControls:g}){return(0,X.jsxs)(`div`,{"data-slot":`tasks-toolbar`,className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 basis-full items-center gap-2 md:contents`,children:[(0,X.jsxs)(`div`,{className:`relative min-w-0 flex-1 md:order-1 md:min-w-48`,children:[(0,X.jsx)(fr,{className:`pointer-events-none absolute top-1/2 left-2.5 size-3.5 -translate-y-1/2 text-soft-foreground`,"aria-hidden":`true`}),(0,X.jsx)(`input`,{type:`text`,value:e,onChange:e=>t(e.target.value),placeholder:n,"aria-label":r,className:`h-11 w-full rounded-md border border-input bg-card pr-3 pl-8 text-base text-foreground outline-none placeholder:text-soft-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 md:h-9 md:text-[13px]`})]}),g?(0,X.jsx)(`div`,{className:`shrink-0 md:order-3`,children:g}):null]}),(0,X.jsx)(`div`,{className:`md:order-2`,children:(0,X.jsx)(LE,{origin:i,counts:a,automations:o,onChange:s,compact:!0})}),(0,X.jsx)(`div`,{className:`hidden md:order-4 md:block`,children:(0,X.jsx)($E,{columns:c,expandedColumns:l,columnsPending:u,onToggleColumn:d,detailedTable:f,onToggleDetailed:p})}),m.length>0?(0,X.jsx)(`div`,{className:`hidden md:order-5 md:block`,children:(0,X.jsx)(RE,{onExpand:()=>h(m,!1),onCollapse:()=>h(m,!0),compact:!0})}):null]})}function tD({projectName:e,status:t,secondaryActions:n}){return{title:`Project tasks`,status:(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:[e?(0,X.jsx)(`span`,{"data-slot":`tasks-project-scope`,className:`hidden text-xs font-medium text-muted-foreground md:inline`,children:e}):null,t]}),secondaryActions:n,primaryAction:(0,X.jsx)(Ko,{asChild:!0,variant:`primary`,"data-slot":`new-task-inline`,children:(0,X.jsxs)(q,{to:`/new`,children:[(0,X.jsx)(nr,{"aria-hidden":`true`}),`New task`]})})}}function nD(e,t,n,r){if(!(!e||t<=0||r!==``))return(0,X.jsx)(Go,{summary:`${t} ${n} ${t===1?`task`:`tasks`} in this project.`,actions:(0,X.jsx)(G,{variant:`outline`,size:`sm`,asChild:!0,className:`max-md:min-h-11`,children:(0,X.jsx)(q,{to:`/new`,children:`Start another task`})})})}function rD(e,t){return e===void 0?`full`:Ho(t)}function iD(e){return{"data-presentation":e?`resources`:`summary`}}var aD=150;function oD(e,t){fe();let n=z(),[r,i]=Y.useState(``),[a,o]=Y.useState(``);Y.useEffect(()=>{let e=setTimeout(()=>o(r),aD);return()=>clearTimeout(e)},[r]);let s=e!==void 0&&qa(e).archived>=200,{data:c,isError:l,isPlaceholderData:u,hasNextPage:d,isFetchingNextPage:f,fetchNextPage:p,refetch:m}=S(a,t===`archived`&&(a!==``||s)),h=c?.pages,g=Y.useMemo(()=>h||l?{runs:(h??[]).flatMap(e=>e.runs),query:u?null:a,hasMore:d,loading:f,onLoadMore:()=>void(h?p():m()),failed:l}:void 0,[h,l,u,a,d,f,p,m]),_=a===``?h:n.getQueryData(k.runs.archived(``))?.pages,v=_===void 0?void 0:_.at(-1)?.nextCursor!=null;return{pages:Y.useMemo(()=>g&&{...g,plainHasMore:v},[g,v]),total:_?.[0]?.total,search:i}}function sD(e,t){return n=>(t===null?n.delete(e):n.set(e,t),n)}function cD(e){return e===void 0?`unknown`:new Intl.NumberFormat().format(e)}function lD(e,t){return`Input tokens: ${cD(e)}; output tokens: ${cD(t)}`}function uD(e,t,n=`compact`){let r=e===void 0?`—`:po(e),i=t===void 0?`—`:po(t);return n===`table`?`${r} / ${i}`:`IN ${r} · OUT ${i}`}function dD({inputTokens:e,outputTokens:t,variant:n=`compact`,omitWhenUnknown:r=!0,className:i,title:a}){return r&&e===void 0&&t===void 0?null:(0,X.jsx)(`span`,{"data-slot":`directional-usage`,"aria-label":lD(e,t),title:a,className:c(`font-mono tabular-nums`,i),children:uD(e,t,n)})}function fD({className:e,dot:t,shape:n=`filled`,pulse:r=!1,children:i,...a}){return(0,X.jsxs)(`span`,{"data-slot":`pill`,className:c(`inline-flex items-center gap-1.5 rounded-full bg-muted px-2.5 py-[3px] text-xs font-medium whitespace-nowrap text-muted-foreground`,e),...a,children:[t?(0,X.jsx)(J,{tone:t,shape:n,pulse:r}):null,i]})}function pD({model:e,showTokens:t,showCost:n,liveUsageSource:r=`stream`,openLink:i,extraActions:a,className:o}){let[s,l]=Y.useState(!1);return(0,X.jsxs)(sa,{open:s,onOpenChange:l,children:[(0,X.jsx)(ra,{asChild:!0,children:(0,X.jsxs)(`button`,{type:`button`,"data-slot":`task-usage-trigger`,"data-task-control":`usage`,"aria-expanded":s,"aria-label":`Usage and telemetry for ${e.title}`,className:c(`inline-flex h-7 max-w-full items-center gap-1 rounded-md border border-border bg-background px-2 font-mono text-xs text-muted-foreground tabular-nums transition-colors hover:border-control-border hover:bg-muted hover:text-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring max-md:min-h-11 max-md:px-2.5`,s&&`border-accent-strong bg-accent-strong/10 text-foreground`,o),children:[(0,X.jsx)(`span`,{className:`min-w-0 truncate`,children:e.usageSummary}),(0,X.jsx)(qr,{className:c(`size-3 shrink-0 opacity-70 transition-transform motion-reduce:transition-none`,s&&`rotate-180`),"aria-hidden":`true`})]})}),s?(0,X.jsx)(aa,{align:`end`,collisionPadding:8,"data-slot":`task-telemetry-popover`,className:`max-h-(--radix-popover-content-available-height) w-80 max-w-[calc(100vw-16px)] overflow-y-auto overscroll-contain p-3.5`,children:(0,X.jsx)(gD,{model:e,showTokens:t,showCost:n,liveUsageSource:r,openLink:i,extraActions:a})}):null]})}function mD({model:e,showTokens:t,showCost:n}){return(0,X.jsx)(hD,{model:e,sample:En(e.runId),showTokens:t,showCost:n})}function hD({model:e,sample:t,showTokens:n,showCost:r}){let{run:i}=e,a=jn(i,t),o=a.cpu.kind===`live`||a.mem.kind===`live`;return(0,X.jsxs)(`div`,{className:`flex flex-col gap-2.5`,children:[(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,X.jsx)(`span`,{className:`text-xs font-semibold tracking-[0.05em] text-accent-text uppercase`,children:`Task telemetry`}),(0,X.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:o?`Live`:`Recorded`})]}),(0,X.jsxs)(`dl`,{className:`grid grid-cols-2 gap-x-3 gap-y-2.5 text-xs`,children:[n?(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:`Tokens IN / OUT`}),(0,X.jsx)(`dd`,{className:`mt-0.5 font-mono text-foreground`,children:(0,X.jsx)(dD,{inputTokens:i.inputTokens,outputTokens:i.outputTokens,omitWhenUnknown:!1})})]}):null,r?(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:`Cost`}),(0,X.jsx)(`dd`,{className:`mt-0.5 font-mono text-foreground tabular-nums`,children:Vn(i.costUsd)||`—`})]}):null,(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:`CPU`}),(0,X.jsx)(`dd`,{"data-usage":`cpu`,"data-usage-kind":a.cpu.kind,title:a.cpu.title,className:`mt-0.5 font-mono text-foreground tabular-nums`,children:a.cpu.text||`—`})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:`Memory`}),(0,X.jsx)(`dd`,{"data-usage":`mem`,"data-usage-kind":a.mem.kind,title:a.mem.title,className:`mt-0.5 font-mono text-foreground tabular-nums`,children:a.mem.text||`—`})]}),e.branch?(0,X.jsxs)(`div`,{className:`col-span-2 border-t border-border pt-2`,children:[(0,X.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:`Branch`}),(0,X.jsx)(`dd`,{className:`mt-1`,children:(0,X.jsx)($f,{value:e.branch,variant:`chip`})})]}):null]})]})}function gD({model:e,showTokens:t,showCost:n,liveUsageSource:r,openLink:i,extraActions:a}){return(0,X.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[r===`stream`?(0,X.jsx)(mD,{model:e,showTokens:t,showCost:n}):(0,X.jsx)(hD,{model:e,sample:e.snapshotUsage,showTokens:t,showCost:n}),(0,X.jsx)(`div`,{className:`border-t border-border pt-2.5`,children:(0,X.jsx)(VE,{projectId:e.projectId,runId:e.runId,status:e.status.label,error:e.run.error,open:(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[i,a]})})})]})}function _D({children:e}){return(0,X.jsx)(G,{asChild:!0,variant:`outline`,size:`sm`,className:`max-md:min-h-11`,children:e})}var vD=new Set(eT);function yD(e,t){return nT.filter(n=>vD.has(n.id)?n.id===`task`?!0:n.id===`reference`&&!t?!1:oT(n.id,e):!1)}function bD(e){return e.map(e=>e.id===`task`?`minmax(0, 1fr)`:e.width??`100px`).join(` `)}function xD(e,t,n){return c(n?`line-clamp-2 min-w-0 whitespace-normal rounded-sm text-[13.5px] leading-[1.35]`:`min-w-0 truncate rounded-sm text-[13px] leading-[18px]`,e?`font-semibold text-foreground`:t?`font-normal text-foreground`:`font-medium text-foreground`,`focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-link-foreground`)}var SD={ask:{label:`Ask`,tone:`text-semantic-amber`},permission:{label:`Permission`,tone:`text-semantic-amber`},review:{label:`Review`,tone:`text-accent-text`},error:{label:`Error`,tone:`text-semantic-red`}};function CD({preview:e}){if(!e)return null;let t=SD[e.kind];return(0,X.jsxs)(`p`,{"data-slot":`task-state-preview`,"data-preview-kind":e.kind,title:e.text,className:`mt-1 flex min-w-0 items-baseline gap-1.5 text-xs leading-[1.35] text-muted-foreground`,children:[(0,X.jsx)(`span`,{className:c(`shrink-0 text-xs font-semibold`,t.tone),children:t.label}),(0,X.jsx)(`span`,{className:`min-w-0 truncate`,children:e.text})]})}function wD({badge:e}){return(0,X.jsxs)(`span`,{"data-slot":`task-automation-badge`,"data-origin":`automation`,title:`Automation ${e.id}`,className:`inline-flex max-w-[180px] shrink-0 items-center gap-1 truncate rounded-full border border-info/30 bg-info/10 px-2 py-px text-xs font-medium text-semantic-info`,children:[(0,X.jsx)(Ur,{className:`size-2.5 shrink-0`,"aria-hidden":`true`}),(0,X.jsx)(`span`,{className:`truncate`,children:e.label})]})}function TD({name:e,href:t}){let n=`inline-flex h-[18px] max-w-[140px] shrink-0 items-center truncate rounded-md border border-border bg-muted px-1.5 font-mono text-xs leading-none font-medium text-foreground`;return t?(0,X.jsx)(H,{to:t,"data-slot":`task-project`,title:e,className:c(n,`hover:border-control-border hover:bg-muted/80`),children:e}):(0,X.jsx)(`span`,{"data-slot":`task-project`,className:n,title:e,children:e})}function ED({scoped:e,to:t,className:n,title:r,children:i,...a}){return e?(0,X.jsx)(q,{to:t,title:r,className:n,...a,children:i}):(0,X.jsx)(H,{to:t,title:r,className:n,...a,children:i})}function DD({run:e,to:t,title:n,unread:r,unreadTone:i,readDone:a,isWorker:o,pinned:s,automationBadge:l,scoped:u=!0,onTogglePin:d,lines:f=1,compact:p=!1}){let m=sE(e);if(m.editing)return(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,"data-slot":`table-title-editor`,children:[(0,X.jsx)(nE,{editor:m,className:`basis-full text-[13px] font-medium`}),(0,X.jsx)(G,{size:`sm`,"aria-label":`Save title`,onMouseDown:e=>e.preventDefault(),onClick:m.commit,children:`Save`}),(0,X.jsx)(G,{size:`sm`,variant:`outline`,"aria-label":`Cancel rename`,onMouseDown:e=>e.preventDefault(),onClick:m.cancel,children:`Cancel`})]});let h=c(f===2?`line-clamp-2 min-w-0 whitespace-normal rounded-sm text-[13px] leading-[18px]`:`min-w-0 truncate rounded-sm text-[13px] leading-[18px]`,r?`font-semibold text-foreground`:a?`font-normal text-foreground`:`font-medium text-foreground`,`focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-link-foreground`);return(0,X.jsxs)(`span`,{className:c(`flex min-w-0 items-center gap-1.5`,p||f===1?`h-[18px]`:`min-h-[18px]`),children:[o?(0,X.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:`Worker`}):null,(0,X.jsx)(ED,{scoped:u,to:t,title:n,"data-task-control":`title`,className:h,children:n}),l?(0,X.jsx)(wD,{badge:l}):null,r?(0,X.jsx)(J,{tone:i,role:`img`,"aria-label":`unread`,title:`Unread — not opened since it finished`,className:`shrink-0`}):null,(0,X.jsx)(`button`,{type:`button`,"data-slot":`row-rename`,"aria-label":`Rename task`,onClick:m.begin,className:`shrink-0 rounded-sm p-0.5 text-soft-foreground opacity-0 transition-opacity group-hover/row:opacity-100 hover:text-foreground focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:(0,X.jsx)(Ys,{className:`size-3`,"aria-hidden":`true`})}),(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`flex-1`}),d?(0,X.jsx)(tg,{pinned:s,onToggle:d,className:`size-[19px] opacity-0 group-hover/row:opacity-100 focus-visible:opacity-100 no-hover:opacity-100 data-[pinned=true]:opacity-100`}):null]})}function OD({model:e,scoped:t,onTogglePin:n,compact:r}){return(0,X.jsx)(DD,{run:e.run,to:e.href,title:e.title,unread:e.unread,unreadTone:e.unreadTone,readDone:e.readDone,isWorker:e.isWorker,pinned:e.pinned,automationBadge:e.automationBadge,scoped:t,onTogglePin:n?t=>n(e,t):void 0,compact:r})}function kD({model:e,scoped:t,showProject:n,onTogglePin:r,clamp:i}){return(0,X.jsxs)(`span`,{className:c(`flex min-w-0 items-center gap-1.5`,i?`items-start`:`min-h-[18px]`),children:[n&&e.projectName?(0,X.jsx)(TD,{name:e.projectName,href:e.projectHref}):null,e.isWorker?(0,X.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:`Worker`}):null,(0,X.jsx)(ED,{scoped:t,to:e.href,title:e.title,"data-task-control":`title`,className:c(xD(e.unread,e.readDone,i),i&&`flex-1`),children:e.title}),!i&&e.automationBadge?(0,X.jsx)(wD,{badge:e.automationBadge}):null,e.unread?(0,X.jsx)(J,{tone:e.unreadTone,role:`img`,"aria-label":`unread`,title:`Unread — not opened since it finished`,className:c(`shrink-0`,i&&`mt-1.5`)}):null,i?null:(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`flex-1`}),r?(0,X.jsx)(tg,{pinned:e.pinned,onToggle:t=>r(e,t),className:i?`-mt-0.5 shrink-0`:`size-[19px] opacity-0 group-hover/row:opacity-100 focus-visible:opacity-100 no-hover:opacity-100 data-[pinned=true]:opacity-100`}):null]})}function AD({model:e,showProject:t,showAutomationOnMeta:n,trailing:r}){let{status:i,scheduled:a,queuePosition:o,runnerModel:s,tags:c}=e;return(0,X.jsxs)(`div`,{"data-slot":`task-meta-line`,className:`mt-1 flex min-w-0 flex-wrap items-center gap-x-1.5 gap-y-1 text-xs text-muted-foreground`,children:[(0,X.jsxs)(fD,{dot:i.tone,shape:i.shape,pulse:i.pulse,title:a?.title??i.label,className:`shrink-0 py-0.5`,children:[i.label,a?(0,X.jsxs)(`span`,{className:`tabular-nums`,children:[` `,a.label]}):null]}),t&&e.projectName?(0,X.jsx)(TD,{name:e.projectName,href:e.projectHref}):null,n&&e.automationBadge?(0,X.jsx)(wD,{badge:e.automationBadge}):null,s?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,X.jsx)(`span`,{"data-slot":`task-runner-model`,className:`min-w-0 truncate`,children:s})]}):null,e.run.status===`queued`&&o!==null?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,X.jsxs)(`span`,{"data-slot":`queue-note`,className:`shrink-0 tabular-nums`,children:[`#`,o,` in queue`]})]}):null,c.map(e=>(0,X.jsx)(`span`,{"data-slot":`task-tag`,className:`rounded bg-muted px-1.5 py-px text-xs text-soft-foreground`,children:e},e)),r]})}function jD({model:e,onSetRead:t,onArchive:n,busy:r}){return!t&&!n?null:(0,X.jsxs)(X.Fragment,{children:[t&&e.canToggleRead?(0,X.jsxs)(G,{type:`button`,variant:`outline`,size:`sm`,"data-action":e.unread?`mark-read`:`mark-unread`,"aria-label":e.unread?`Mark ${e.title} read`:`Mark ${e.title} unread`,disabled:r,onClick:()=>t(e,e.unread),className:`max-md:min-h-11`,children:[e.unread?(0,X.jsx)(fi,{className:`size-3.5`,"aria-hidden":`true`}):(0,X.jsx)(Is,{className:`size-3.5`,"aria-hidden":`true`}),e.unread?`Mark read`:`Mark unread`]}):null,n&&e.canArchive?(0,X.jsxs)(G,{type:`button`,variant:`outline`,size:`sm`,"data-action":e.run.archived?`unarchive-run`:`archive-run`,"aria-label":e.run.archived?`Restore ${e.title} to the active list`:`Archive ${e.title}`,disabled:r,onClick:()=>n(e,!e.run.archived),className:`max-md:min-h-11`,children:[e.run.archived?(0,X.jsx)(ws,{className:`size-3.5`,"aria-hidden":`true`}):(0,X.jsx)(Fr,{className:`size-3.5`,"aria-hidden":`true`}),e.run.archived?`Unarchive`:`Archive`]}):null]})}function MD({model:e,scoped:t}){return e.references.length===0?(0,X.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`—`}):t?(0,X.jsx)(Zh,{run:e.run,reference:e.references[0],compact:!0}):(0,X.jsx)(eg,{references:e.references,maxVisible:1,taskTitle:e.title,projectId:e.projectId,runId:e.runId,repoBase:e.repoBase,compact:!0})}function ND({model:e,scoped:t,showTokens:n,showCost:r,liveUsageSource:i,onSetRead:a,onArchive:o,busy:s,className:c}){return(0,X.jsx)(pD,{model:e,showTokens:n,showCost:r,liveUsageSource:i,className:c,openLink:(0,X.jsx)(_D,{children:(0,X.jsxs)(ED,{scoped:t,to:e.href,"data-task-control":`open`,children:[`Open task`,(0,X.jsxs)(`span`,{className:`sr-only`,children:[`: `,e.title]})]})}),extraActions:(0,X.jsx)(jD,{model:e,onSetRead:a,onArchive:o,busy:s})})}function PD({column:e,hasUsageColumn:t,...n}){let{model:r,now:i,scoped:a,showProject:o,allowRename:s,compact:l,onTogglePin:u}=n;switch(e.id){case`task`:return(0,X.jsxs)(`div`,{role:`cell`,"data-column-id":`task`,className:c(`min-w-0 pr-3`,l?`py-1.5`:`py-2.5`),children:[s?(0,X.jsx)(OD,{model:r,scoped:a,onTogglePin:u,compact:l}):(0,X.jsx)(kD,{model:r,scoped:a,showProject:o,onTogglePin:u,clamp:!1}),(0,X.jsx)(AD,{model:r,showProject:!1,showAutomationOnMeta:!1,trailing:t?null:(0,X.jsx)(ND,{...n,className:`ml-auto h-6 px-1.5 text-xs`})}),(0,X.jsx)(CD,{preview:r.statePreview})]});case`runner`:return(0,X.jsx)(`div`,{role:`cell`,"data-column-id":`runner`,className:`min-w-0 truncate text-xs text-muted-foreground`,title:r.runnerModel,children:r.runnerModel??(0,X.jsx)(`span`,{className:`text-soft-foreground`,children:`—`})});case`workflow`:return(0,X.jsx)(`div`,{role:`cell`,"data-column-id":`workflow`,className:`min-w-0 truncate text-xs text-muted-foreground`,title:r.workflow,children:r.workflow});case`branch`:return(0,X.jsx)(`div`,{role:`cell`,"data-column-id":`branch`,className:`min-w-0 overflow-hidden`,children:r.branch?(0,X.jsx)($f,{value:r.branch,variant:`chip`}):(0,X.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`—`})});case`diff`:return(0,X.jsx)(`div`,{role:`cell`,"data-column-id":`diff`,className:`text-xs`,children:r.diffStat?(0,X.jsx)(Xf,{stat:r.diffStat}):(0,X.jsx)(`span`,{className:`text-soft-foreground`,children:`—`})});case`reference`:return(0,X.jsx)(`div`,{role:`cell`,"data-column-id":`reference`,className:`min-w-0`,children:(0,X.jsx)(MD,{model:r,scoped:a})});case`usage`:return(0,X.jsx)(`div`,{role:`cell`,"data-column-id":`usage`,className:`flex justify-end`,children:(0,X.jsx)(ND,{...n})});case`started`:return(0,X.jsx)(`div`,{role:`cell`,"data-column-id":`started`,className:`text-right text-xs text-muted-foreground`,children:(0,X.jsx)(Qf,{iso:r.startedAt,now:i})});default:return null}}function FD(e){return e instanceof Element&&!!e.closest(`a, button, input, [role="dialog"]`)}function ID(e,t){return e.run===t.run&&e.projectName===t.projectName&&e.projectHref===t.projectHref&&e.runnerModel===t.runnerModel&&e.usageSummary===t.usageSummary&&e.queuePosition===t.queuePosition&&e.automationBadge?.label===t.automationBadge?.label&&e.tags.length===t.tags.length&&e.tags.every((e,n)=>e===t.tags[n])}function LD(e,t){let{model:n,...r}=e,{model:i,...a}=t;return ID(n,i)&&Object.keys(r).every(e=>r[e]===a[e])}var RD=Y.memo(function({rowIndex:e,columns:t,gridTemplate:n,rowSlot:r,...i}){let{model:a,scoped:o}=i,s=xa(),l=xn(),u=e=>o?s(e):l(e),d=t.some(e=>e.id===`usage`);return(0,X.jsx)(`div`,{role:`row`,"aria-rowindex":e,"data-slot":r,"data-task-row":`true`,"data-status":a.run.status,"data-urgent":a.urgent?`true`:void 0,"data-run-id":a.runId,"data-project":a.projectId,style:{gridTemplateColumns:n},onClick:e=>{FD(e.target)||u(a.href)},className:c(`group/row grid cursor-pointer items-center gap-x-3.5 border-b border-border transition-colors hover:bg-muted/70`,a.urgent&&`bg-pending/[0.03]`),children:t.map(e=>(0,X.jsx)(PD,{column:e,hasUsageColumn:d,...i},e.id))})},LD),zD=Y.memo(function({model:e,now:t,scoped:n,showProject:r,showTokens:i,showCost:a,liveUsageSource:o,onTogglePin:s,onSetRead:c,onArchive:l,busy:u,cardSlot:d}){let f=xa(),p=xn(),m=e=>n?f(e):p(e);return(0,X.jsxs)(`article`,{"data-slot":d,"data-task-row":`true`,"data-status":e.run.status,"data-urgent":e.urgent?`true`:void 0,"data-run-id":e.runId,"data-project":e.projectId,onClick:t=>{FD(t.target)||m(e.href)},className:`flex cursor-pointer flex-col gap-1.5 border-b border-border py-2.5`,children:[(0,X.jsx)(`div`,{"data-slot":`mobile-task-title-row`,children:(0,X.jsx)(kD,{model:e,scoped:n,showProject:!1,onTogglePin:s,clamp:!0})}),(0,X.jsx)(AD,{model:e,showProject:r,showAutomationOnMeta:!0}),(0,X.jsx)(CD,{preview:e.statePreview}),(0,X.jsxs)(`div`,{"data-slot":`mobile-task-meta`,className:`mt-0.5 flex min-w-0 flex-wrap items-center gap-x-2.5 gap-y-1 text-xs text-muted-foreground`,children:[(0,X.jsx)(`span`,{"data-slot":`mobile-task-workflow`,className:`min-w-0 truncate`,children:e.workflow}),e.references.length>0?(0,X.jsx)(MD,{model:e,scoped:n}):null,e.queuePosition===null?e.diffStat?(0,X.jsx)(Xf,{stat:e.diffStat}):null:(0,X.jsxs)(`span`,{"data-slot":`queue-note`,className:`tabular-nums`,children:[`#`,e.queuePosition,` in queue`]}),(0,X.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-2`,children:[(0,X.jsx)(pD,{model:e,showTokens:i,showCost:a,liveUsageSource:o,openLink:(0,X.jsx)(_D,{children:(0,X.jsxs)(ED,{scoped:n,to:e.href,"data-task-control":`open`,children:[`Open task`,(0,X.jsxs)(`span`,{className:`sr-only`,children:[`: `,e.title]})]})}),extraActions:(0,X.jsx)(jD,{model:e,onSetRead:c,onArchive:l,busy:u})}),(0,X.jsx)(Qf,{iso:e.startedAt,now:t})]})]})]})},LD);function BD({items:e,density:t,now:n,showHeader:r=!0,showProject:i=!1,showReferences:a=!0,expandedColumns:o=aT(void 0),showTokens:s=!0,showCost:l=!0,scopedLinks:u=!0,liveUsageSource:d=`stream`,allowRename:f=!1,onTogglePin:p,onArchive:m,onSetRead:h,busy:g=!1,tableSlot:_=`tasks-summary`,rowSlot:v=`task-summary-row`,cardSlot:y=`task-card`}){let b=Y.useMemo(()=>yD(o,a),[o,a]),x=Y.useMemo(()=>bD(b),[b]);if(t===`card`)return(0,X.jsx)(hd,{children:(0,X.jsx)(`div`,{"data-slot":`task-cards`,"data-task-table":`true`,"data-density":`card`,className:`flex flex-col rounded-lg border border-card-edge bg-card px-3 shadow-card`,children:(0,X.jsx)(gE,{itemSize:123,items:e,itemKey:e=>e.key,children:e=>(0,X.jsx)(zD,{model:e,now:n,scoped:u,showProject:i,showTokens:s,showCost:l,liveUsageSource:d,onTogglePin:p,onSetRead:h,onArchive:m,busy:g,cardSlot:y},e.key)})})});let S=t===`compact`;return(0,X.jsx)(hd,{children:(0,X.jsx)(`div`,{"data-slot":_,"data-task-table":`true`,"data-density":t,"data-head":r,"data-reference-column":a,className:`overflow-x-auto`,children:(0,X.jsxs)(`div`,{role:`table`,"aria-rowcount":e.length+1,className:`rounded-lg border border-card-edge bg-card px-4 shadow-card`,children:[(0,X.jsx)(`div`,{role:`row`,"aria-rowindex":1,"data-slot":`task-table-head`,style:{gridTemplateColumns:x},className:c(`grid items-center gap-x-3.5`,!r&&`sr-only`),children:b.map(e=>(0,X.jsx)(`div`,{role:`columnheader`,"data-column-id":e.id,className:c(`flex h-8 items-center border-b border-border text-xs font-medium tracking-[0.04em] text-muted-foreground uppercase`,e.align===`right`&&`justify-end text-right`),children:e.summaryLabel??e.label},e.id))}),(0,X.jsx)(gE,{itemSize:S?56:63,items:e,itemKey:e=>e.key,children:(e,t)=>(0,X.jsx)(RD,{model:e,rowIndex:t+2,columns:b,gridTemplate:x,now:n,scoped:u,showProject:i,allowRename:f,showTokens:s,showCost:l,liveUsageSource:d,compact:S,onTogglePin:p,onSetRead:h,onArchive:m,busy:g,rowSlot:v},e.key)})]})})})}var VD=new Set([`done`,`failed`,`cancelled`]);function HD(e,t=240){let n=e.replace(/\s+/g,` `).trim();return n.length<=t?n:`${n.slice(0,t-1).trimEnd()}…`}function UD(e,t){if(e.statePreview)return e.statePreview;if(!e.archived){if(e.hasPendingPermission)return{kind:`permission`,text:`Permission requested`};if(t.rung===`needs-you`)return{kind:`ask`,text:`Waiting for your reply`};if(e.status===`review`)return{kind:`review`,text:`Ready for review`}}if(e.status===`failed`&&!qt(e)&&e.error){let t=HD(e.error);if(t)return{kind:`error`,text:t}}}function WD(e,t){let n=e.runner?A(t,e.runner):void 0,r=e.model?.trim()||void 0;return n&&r?`${n} · ${r}`:n??r}function GD(e,t){let n=[],r=t.showTokens&&(e.inputTokens!==void 0||e.outputTokens!==void 0)?(e.inputTokens??0)+(e.outputTokens??0):0;r>0&&n.push(po(r));let i=t.showCost?Vn(e.costUsd):``;return i&&n.push(i),n}function KD(e,t,n){return e.inputTokens!==void 0||e.outputTokens!==void 0||e.costUsd!==void 0||!!(t||n||e.branch)}function qD(e,t,n){let r=GD(e,n),i=jn(e,t);return r.length<2&&i.cpu.kind===`live`&&i.cpu.text?r.push(i.cpu.text):r.length===0&&i.mem.text&&r.push(i.mem.text),{label:r.length>0?r.join(` · `):`Usage`,hasData:r.length>0||KD(e,i.cpu.text,i.mem.text)}}function JD({run:e,queuePosition:t=null,runners:n,automationName:r,repoBase:i,now:a,showTokens:o=!0,showCost:s=!0}){let c=Pe(e),l=op(e,c),u=Nn(e,a===void 0?void 0:new Date(a)),d=qD(e,e.usage,{showTokens:o,showCost:s}),f=e.automationId;return{key:e.id,runId:e.id,tags:[],run:e,href:`/tasks/${e.id}`,title:La(e),isWorker:Wa(e),unread:Za(e),readDone:ru(e),canToggleRead:Qa(e),unreadTone:au(e),attention:c,status:l,urgent:jt(e),scheduled:u,pinned:!!e.pinned,queuePosition:t,automationBadge:f===void 0?void 0:{id:f,label:r?.(f)??f},runnerModel:WD(e,n),statePreview:UD(e,c),workflow:Gn(e),branch:e.branch,diffStat:e.diffStat,references:Fn(e,i),repoBase:i,startedAt:e.startedAt??e.createdAt,usageSummary:d.label,hasUsageData:d.hasData,snapshotUsage:e.usage,canArchive:e.archived||VD.has(e.status)}}function YD(e){return typeof e==`string`?e:e.pathname??``}function XD({task:e,queuePosition:t=null,runners:n,automationName:r,now:i,showTokens:a=!0,showCost:o=!0}){let s=e.run;return{...JD({run:s,queuePosition:t,runners:n,automationName:r?()=>r(e):void 0,repoBase:e.project?.repoUrl,now:i,showTokens:a,showCost:o}),key:`${s.projectId}/${s.id}`,projectId:s.projectId,projectName:e.projectName,projectHref:YD(ba(s.projectId,`/`)),tags:e.tags,href:YD(ba(s.projectId,`/tasks/${s.id}`)),references:Fn(s,e.project?.repoUrl,s.projectId)}}var ZD=`cez-task-list-folds`,QD=`cez-task-list-folds-changed`;function $D(e,t,n=new Set){let[r,i]=(0,Y.useState)(()=>Tg(ZD));(0,Y.useEffect)(()=>{let e=e=>{e instanceof StorageEvent&&e.key!==null&&e.key!==`cez-task-list-folds`||i(e instanceof CustomEvent?e.detail:Tg(ZD))};return window.addEventListener(`storage`,e),window.addEventListener(QD,e),()=>{window.removeEventListener(`storage`,e),window.removeEventListener(QD,e)}},[]);let a=(0,Y.useCallback)(n=>JSON.stringify([e,t,n]),[e,t]),o=(0,Y.useCallback)(e=>{i(t=>{let n=e(t);return Eg(n,ZD),queueMicrotask(()=>window.dispatchEvent(new CustomEvent(QD,{detail:n}))),n})},[]),s=e=>r[a(e)]===!0;return{isFolded:s,isCollapsed:e=>s(e)&&!n.has(e),toggle:e=>o(t=>({...t,[a(e)]:t[a(e)]!==!0})),setAll:(e,t)=>o(n=>({...n,...Object.fromEntries(e.map(e=>[a(e),t]))})),only:(0,Y.useCallback)((e,t)=>o(n=>({...n,...Object.fromEntries(t.map(t=>[a(t),t!==e]))})),[o,a])}}function eO(e,t,n,r){let i=$D(e,t,n),a=(0,Y.useRef)(r);a.current=r;let[o,s]=Xo(),c=t===`active`?Va(o.get(Ua)):null,{only:l}=i;return(0,Y.useEffect)(()=>{c!==null&&(l(c,Ka),a.current?.(),s(e=>(e.delete(Ua),e)))},[c,l,s]),i}function tO(e){let t=e?.capabilities,n=t?.tokenMetrics!==!1;return{tokens:t?.tokenUsageMetrics??n,cost:t?.costMetrics??n}}function nO(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:{}}function rO(){let e=z(),t=x(),n=Y.useRef(0),r=Y.useRef(0),i=Y.useRef(Promise.resolve()),a=Y.useMemo(()=>aT(t.data?.taskTable?.expandedColumns),[t.data?.taskTable?.expandedColumns]),o=Y.useCallback(t=>{if(!nT.find(e=>e.id===t)?.canFold)return;let a=e.getQueryData(h.uiState);if(a===void 0)return;let o=nO(a?.taskTable),s={...o,expandedColumns:sT(o.expandedColumns,t)};e.setQueryData(h.uiState,{...a,taskTable:s});let c=++n.current;r.current=c;let l=i.current.then(async()=>{let t=await Ct({taskTable:s},{keepalive:!0});c===r.current&&e.setQueryData(h.uiState,t)});i.current=l.catch(t=>{B(t instanceof Error?t.message:String(t),{tone:`danger`}),c===r.current&&e.invalidateQueries({queryKey:h.uiState})})},[e]);return{expandedColumns:a,isExpanded:Y.useCallback(e=>oT(e,a),[a]),toggleColumn:o,isPending:t.isPending}}var iO=()=>void 0;function aO({runs:e,view:t,onViewChange:n,onArchiveFinished:r,archivePending:i=!1,onMarkAllRead:a,onRename:o,onTogglePin:s,now:c=Date.now(),showTokens:l=!0,showCost:u=!0,expandedColumns:d=aT(void 0),onToggleColumn:f=()=>void 0,columnsPending:p=!1,projectName:m,runners:h,error:g,onRetry:_,archivedPages:v,archivedTotal:y,onArchivedSearch:b,origin:x,onOriginChange:S,automations:C,urlQuery:w=``,onQueryChange:T,foldScope:E=`project`,automationName:D=iO}){let[O,k]=oO(w,T);Y.useEffect(()=>{b?.(O.trim())},[b,O]);let[A,j]=sO(x,S,C),[M,ee]=Y.useState(!1),te=_g(),N=Y.useMemo(()=>e??[],[e]),P=Y.useMemo(()=>cO({all:N,view:t,query:O,origin:A,archivedPages:v,archivedTotal:y,automationName:D}),[N,t,O,A,v,y,D]),{groups:ne,needle:re}=P,F=Y.useMemo(()=>dT({tokens:l,cost:u}),[l,u]),ie=Y.useMemo(()=>uT(),[]),ae=eO(E,t,new Set(re?ne.map(e=>e.label):[]),()=>k(``)),I=t===`archived`?void 0:s;return(0,X.jsx)(oE,{runs:v?[...N,...v.runs]:N,onRename:o,children:(0,X.jsx)(Jo,{route:`tasks`,density:rD(e,P.visibleCount),headerSpacing:`compact`,rootProps:iD(M),bodyClassName:`gap-3`,header:tD({projectName:m,status:(0,X.jsx)(KE,{view:t,onSelect:n,activeCount:P.activeCount,archivedCount:P.archivedCount,trailing:e!==void 0&&ne.length>0?(0,X.jsx)(YE,{count:P.visibleCount,incomplete:P.incomplete,needle:re}):null}),secondaryActions:(0,X.jsx)(ZE,{view:t,unread:P.unread,finished:P.finished,archivePending:i,onMarkAllRead:()=>a(EE(A)),onArchiveFinished:()=>r(EE(A))})}),sparseFooter:nD(e!==void 0,P.visibleCount,t,re),children:(0,X.jsxs)(_E,{layout:`${te}:${M}`,revision:ne,visibilityRevision:JSON.stringify([Ja.map(ae.isCollapsed),t,d]),className:`flex min-w-0 flex-1 flex-col gap-3`,children:[(0,X.jsx)(eD,{query:O,onQueryChange:k,searchPlaceholder:`Search tasks or automations…`,searchLabel:`Search tasks`,origin:A,originCounts:P.originTotals,automations:C,onOriginChange:j,columns:M?F:ie,expandedColumns:d,columnsPending:p,onToggleColumn:f,detailedTable:M,onToggleDetailed:()=>ee(e=>!e),groupLabels:ne.map(e=>e.label),onSetAllFolds:ae.setAll}),(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[e===void 0?(0,X.jsx)(uO,{error:g,onRetry:_}):(0,X.jsx)(lO,{view:t,query:O,origin:A,onShowAll:()=>{k(``),j(`all`)},groups:ne,folds:ae,grouped:{desktop:te,detailedTable:M,columns:F,expandedColumns:d,onToggleColumn:f,columnsPending:p,onRename:o,onTogglePin:I,now:c,showTokens:l,showCost:u,runners:h,automationName:D}}),t===`archived`&&v?(0,X.jsx)(dO,{pages:v}):null]})]})})})}function oO(e,t){let[n,r]=Y.useState(e),i=Y.useRef(e),a=Y.useRef(e),o=Y.useRef([]);return Y.useEffect(()=>{if(e===i.current)return;i.current=e;let t=o.current.indexOf(e);o.current=t===-1?[]:o.current.slice(t+1),t===-1&&e!==a.current&&r(e)},[e]),Y.useEffect(()=>{a.current=n.trim(),t?.(n,e=>{o.current.push(e)})},[t,n]),[n,r]}function sO(e,t,n){let[r,i]=Y.useState(`all`);return[CE(e??r,n),t??i]}function cO({all:e,view:t,query:n,origin:r,archivedPages:i,archivedTotal:a,automationName:o}){let s=n.trim(),c=e=>e.automationId===void 0?``:o(e.automationId)??e.automationId,l=i?.query===s,u=new Set(l?i.runs.map(e=>e.id):[]),d=Xa(e,l||s===``?i?.runs??[]:[]).slice(e.length),f=Un(e,n,c),p=new Set(f.map(e=>e.id)),m=Un(e.filter(e=>u.has(e.id)&&!p.has(e.id)),``),h=e=>TE(e,r),g=jE([...f,...m,...Un(d,``)].filter(h),t,e),_=Xa(e,i?.query===``?i.runs:[]),v=qa(e).archived>=200,y=e.filter(h);return{groups:g,needle:s,visibleCount:g.reduce((e,t)=>e+kE(t).length,0),originTotals:DE(_,t),activeCount:DE(e,`active`)[r],archivedCount:OE(e,_,r,i?.plainHasMore,a),incomplete:t===`archived`&&v&&i?.hasMore!==!1,finished:zn(y),unread:iu(y)}}function lO({view:e,query:t,origin:n,onShowAll:r,groups:i,folds:a,grouped:o}){if(i.length===0)return(0,X.jsx)(fO,{view:e,query:t,origin:n,onShowAll:r});let s=i.filter(e=>!a.isCollapsed(e.label)),c=s.some(e=>e.rows.flatMap(PE).some(e=>In(e)!==void 0));return(0,X.jsx)(`div`,{className:`flex flex-col gap-3`,children:i.map(t=>{let n=kE(t);return(0,X.jsx)(BE,{id:`tasks-group-${e}-${t.label.replaceAll(` `,`-`)}`,label:t.label,count:n.length,tone:HE(t.label,n),folded:a.isFolded(t.label),collapsed:a.isCollapsed(t.label),onToggle:()=>a.toggle(t.label),children:(0,X.jsx)(pO,{group:t,showHeader:t===s[0],showReference:c,...o})},t.label)})})}function uO({error:e,onRetry:t}){return e?(0,X.jsxs)(`div`,{role:`alert`,className:`rounded-xl border border-border bg-card p-6`,children:[(0,X.jsx)(`h2`,{className:`text-lg`,children:`Could not load tasks`}),(0,X.jsx)(`p`,{className:`mt-2 text-sm text-muted-foreground`,children:e}),(0,X.jsx)(G,{variant:`outline`,className:`mt-4`,onClick:t,children:`Retry`})]}):(0,X.jsx)(`div`,{role:`status`,"aria-label":`Loading tasks`,className:`rounded-xl border border-border bg-card p-6 text-sm text-muted-foreground`,children:`Loading tasks…`})}function dO({pages:e}){return e.failed?(0,X.jsxs)(`p`,{role:`alert`,"data-slot":`archived-older-error`,className:`mt-3.5 flex items-center justify-center gap-2.5 text-[13px] text-muted-foreground`,children:[`Could not load older archived tasks.`,(0,X.jsx)(G,{variant:`outline`,className:`min-h-11`,onClick:e.onLoadMore,children:`Retry`})]}):e.hasMore?(0,X.jsx)(G,{"data-slot":`archived-older`,variant:`outline`,className:`mt-3.5 min-h-11 self-center`,disabled:e.loading,onClick:e.onLoadMore,children:e.loading?`Loading older archived…`:`Show older archived`}):null}function fO({view:e,query:t,origin:n=`all`,onShowAll:r}){let i=t.trim(),a=i||n!==`all`?`search-miss`:e===`archived`?`archive`:`no-tasks`;return(0,X.jsx)(`div`,{"data-slot":`tasks-empty`,"data-empty-kind":a,className:`flex flex-1 flex-col`,children:a===`search-miss`?(0,X.jsx)(Yo,{heading:`h2`,icon:(0,X.jsx)(_i,{}),tone:`neutral`,title:`No matching tasks`,subtitle:i?`No tasks match “${i}”.`:n===`automations`?`No automation started a task here.`:`No task here was started directly.`,actions:r?(0,X.jsx)(G,{variant:`outline`,className:`min-h-11`,"data-action":`clear-task-filters`,onClick:r,children:`Show all tasks`}):void 0}):a===`archive`?(0,X.jsx)(Yo,{heading:`h2`,icon:(0,X.jsx)(Fr,{}),tone:`neutral`,title:`Nothing archived yet`,subtitle:`Finished tasks you archive land here.`}):(0,X.jsx)(Yo,{heading:`h2`,icon:(0,X.jsx)(Gs,{}),tone:`primary`,backdrop:!0,title:`No tasks yet`,subtitle:`Describe a task to get started.`,actions:(0,X.jsx)(G,{asChild:!0,children:(0,X.jsxs)(q,{to:`/new`,children:[(0,X.jsx)(nr,{"aria-hidden":`true`}),`New task`]})})})})}function pO({showHeader:e,showReference:t,desktop:n,group:r,detailedTable:i,columns:a,expandedColumns:o,onToggleColumn:s,columnsPending:c,onRename:l,onTogglePin:u,now:d,showTokens:f,showCost:p,runners:m,automationName:h}){let g=Y.useMemo(()=>r.rows.flatMap(e=>PE(e).map(t=>({run:t,queuePosition:t.status===`queued`?e.queuePosition:null}))),[r.rows]),_=Y.useMemo(()=>g.map(({run:e,queuePosition:t})=>JD({run:e,queuePosition:t,runners:m,automationName:h,now:d,showTokens:f,showCost:p})),[g,m,h,d,f,p]),v=Y.useCallback((e,t)=>{u?.(e.run,t)},[u]);return n&&i?(0,X.jsx)(`div`,{"data-slot":`tasks-table`,className:`overflow-x-auto rounded-lg border border-card-edge bg-card shadow-card`,children:(0,X.jsx)(hd,{children:(0,X.jsxs)(`div`,{role:`table`,"aria-rowcount":g.length+1,className:`task-resource-grid`,style:mT(a,o),children:[(0,X.jsx)(`div`,{role:`row`,"aria-rowindex":1,className:`task-resource-row`,children:a.map(e=>(0,X.jsx)(hO,{column:e,expanded:oT(e.id,o),onToggle:s,disabled:c},e.id))}),(0,X.jsx)(gE,{itemSize:50,items:g,itemKey:({run:e})=>e.id,children:({run:e,queuePosition:t},n)=>(0,X.jsx)(vO,{rowIndex:n+2,run:e,queuePosition:t,onRename:l,onTogglePin:u,now:d,columns:a,expandedColumns:o,automationName:h})})]})})}):(0,X.jsx)(BD,{items:_,density:n?`table`:`card`,now:d,showHeader:e,showProject:!1,showReferences:t,expandedColumns:o,showTokens:f,showCost:p,scopedLinks:!0,liveUsageSource:`stream`,allowRename:n,onTogglePin:u?v:void 0})}function mO({children:e,right:t=!1,columnId:n,folded:r=!1}){return(0,X.jsx)(`div`,{role:`columnheader`,"data-column-id":n,"data-folded":r||void 0,className:c(`h-[38px] border-b border-border px-2.5 text-left text-xs font-semibold tracking-[0.05em] whitespace-nowrap text-supporting-foreground uppercase first:pl-4 last:pr-4`,t&&`text-right`,r&&`px-0 first:pl-0 last:pr-0`),children:e})}function hO({column:e,expanded:t,onToggle:n,disabled:r}){if(!e.canFold)return(0,X.jsx)(mO,{columnId:e.id,right:e.align===`right`,children:e.label});let i=t?`Fold`:`Expand`;return(0,X.jsx)(mO,{columnId:e.id,right:e.align===`right`,folded:!t,children:(0,X.jsxs)(gd,{children:[(0,X.jsx)(_d,{asChild:!0,children:(0,X.jsx)(`button`,{type:`button`,"aria-label":`${i} ${e.label} column`,"aria-pressed":t,disabled:r,onClick:()=>n(e.id),className:c(`inline-flex h-8 w-full items-center gap-1 rounded-sm px-0.5 text-inherit outline-none hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-wait disabled:opacity-60`,e.align===`right`?`justify-end`:`justify-start`,!t&&`justify-center px-0`),children:t?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{children:e.label}),(0,X.jsx)(Os,{className:`size-3 opacity-55`,"aria-hidden":`true`})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(gO,{icon:e.icon}),(0,X.jsx)(ks,{className:`size-3 opacity-70`,"aria-hidden":`true`})]})})}),(0,X.jsxs)(vd,{side:`top`,children:[e.label,` · `,i,` column`]})]})})}function gO({icon:e}){let t=`size-3.5`;switch(e){case`workflow`:return(0,X.jsx)(Rr,{className:t,"aria-hidden":`true`});case`branch`:return(0,X.jsx)(Jn,{className:t,"aria-hidden":`true`});case`diff`:return(0,X.jsx)(Xn,{className:t,"aria-hidden":`true`});case`reference`:return(0,X.jsx)(Ws,{className:t,"aria-hidden":`true`});case`tokens`:return(0,X.jsx)(js,{className:t,"aria-hidden":`true`});case`cost`:return(0,X.jsx)(Ps,{className:t,"aria-hidden":`true`});case`cpu`:return(0,X.jsx)(Vr,{className:t,"aria-hidden":`true`});case`memory`:return(0,X.jsx)(Ks,{className:t,"aria-hidden":`true`});case`started`:return(0,X.jsx)(As,{className:t,"aria-hidden":`true`});default:return null}}var _O=`h-[88px] border-b border-border px-2.5 whitespace-nowrap first:pl-4 last:pr-4`,vO=Y.memo(function({rowIndex:e,run:t,queuePosition:n,onRename:r,onTogglePin:i,now:a,columns:o,expandedColumns:s,automationName:l}){let u=xa(),d=Pe(t),f=Nn(t),p=`/tasks/${t.id}`,m=Vn(t.costUsd),h=In(t);return(0,X.jsx)(`div`,{role:`row`,"aria-rowindex":e,"data-slot":`task-table-row`,"data-run-id":t.id,onClick:e=>{e.target.closest(`a, button, input`)||u(p)},className:`task-resource-row group/row cursor-pointer hover:bg-muted`,children:o.map(e=>{if(e.id===`memory`)return null;if(e.id===`cpu`){let r=oT(`cpu`,s),i=oT(`memory`,s);return n!==null&&(r||i)?(0,X.jsxs)(`div`,{role:`cell`,"data-slot":`queue-note`,"data-column-id":`cpu-memory`,"aria-colspan":2,style:{gridColumn:`span 2`},className:c(_O,`text-right font-mono text-xs text-supporting-foreground`),children:[`#`,n,` in queue`]},e.id):(0,X.jsx)(wO,{run:t,cpuExpanded:r,memoryExpanded:i},e.id)}return(0,X.jsx)(xO,{column:e,expanded:oT(e.id,s),run:t,attention:d,scheduled:f,reference:h,cost:m,to:p,onRename:r,onTogglePin:i,now:a,automationName:l},e.id)})})});function yO({run:e,to:t,onRename:n,onTogglePin:r,automationName:i}){let a=e.automationId===void 0?void 0:i(e.automationId)??e.automationId;return(0,X.jsxs)(`div`,{role:`cell`,"data-column-id":`task`,className:c(_O,`min-w-[320px] max-w-0 whitespace-normal`),children:[(0,X.jsx)(CO,{lines:2,run:e,to:t,onRename:n,onTogglePin:r}),a?(0,X.jsx)(`div`,{className:`mt-1`,children:(0,X.jsxs)(`span`,{"data-slot":`task-automation-badge`,"data-origin":`automation`,className:`inline-flex max-w-[180px] items-center gap-1 truncate rounded-full border border-info/30 bg-info/10 px-2 py-px text-xs font-medium text-semantic-info`,children:[(0,X.jsx)(Ur,{className:`size-2.5 shrink-0`,"aria-hidden":`true`}),(0,X.jsx)(`span`,{className:`truncate`,children:a})]})}):null]})}function bO({run:e,attention:t,scheduled:n}){let r=op(e,t);return(0,X.jsx)(`div`,{role:`cell`,"data-column-id":`status`,className:c(_O,`overflow-hidden`),children:(0,X.jsx)(fD,{dot:r.tone,shape:r.shape,pulse:r.pulse,title:n?.title??r.label,className:`w-full max-w-full overflow-hidden`,children:(0,X.jsxs)(`span`,{className:`min-w-0 truncate`,children:[r.label,n?(0,X.jsxs)(X.Fragment,{children:[` `,(0,X.jsx)(`span`,{className:`tabular-nums`,children:n.label})]}):null]})})})}function xO({column:e,expanded:t,run:n,attention:r,scheduled:i,reference:a,cost:o,to:s,onRename:l,onTogglePin:u,now:d,automationName:f}){if(!t)return(0,X.jsx)(SO,{column:e.id});switch(e.id){case`status`:return(0,X.jsx)(bO,{run:n,attention:r,scheduled:i});case`task`:return(0,X.jsx)(yO,{run:n,to:s,onRename:l,onTogglePin:u,automationName:f});case`workflow`:return(0,X.jsx)(`div`,{role:`cell`,"data-column-id":e.id,className:c(_O,`max-w-0 truncate text-[13px] text-muted-foreground`),children:Gn(n)});case`branch`:return(0,X.jsx)(`div`,{role:`cell`,"data-column-id":e.id,className:c(_O,`max-w-0 overflow-hidden`),children:n.branch?(0,X.jsx)(XE,{branch:n.branch}):(0,X.jsx)(qE,{})});case`diff`:return(0,X.jsx)(`div`,{role:`cell`,"data-column-id":e.id,className:c(_O,`overflow-hidden`),children:n.diffStat?(0,X.jsx)(Xf,{stat:n.diffStat,compact:!0,className:`block max-w-full`}):(0,X.jsx)(qE,{})});case`reference`:return(0,X.jsx)(`div`,{role:`cell`,"data-column-id":e.id,className:c(_O,`overflow-hidden`),children:a?(0,X.jsx)(Zh,{run:n,reference:a,compact:!0,className:`max-w-full overflow-hidden`}):(0,X.jsx)(qE,{})});case`tokens`:{let t=lD(n.inputTokens,n.outputTokens);return(0,X.jsx)(`div`,{role:`cell`,"data-column-id":e.id,className:c(_O,`text-right text-xs text-muted-foreground`),children:(0,X.jsx)(dD,{inputTokens:n.inputTokens,outputTokens:n.outputTokens,variant:`table`,omitWhenUnknown:!1,title:t,className:`block max-w-full overflow-hidden text-ellipsis`})})}case`cost`:return(0,X.jsx)(`div`,{role:`cell`,"data-column-id":e.id,className:c(_O,`text-right font-mono text-xs text-muted-foreground tabular-nums`),children:o?(0,X.jsx)(EO,{text:o,accessibleText:`$${n.costUsd}`}):(0,X.jsx)(qE,{})});case`started`:return(0,X.jsx)(`div`,{role:`cell`,"data-column-id":e.id,className:c(_O,`text-right text-xs text-supporting-foreground`),children:(0,X.jsx)(Qf,{iso:n.startedAt??n.createdAt,now:d})});default:return null}}function SO({column:e}){return(0,X.jsx)(`div`,{role:`cell`,"aria-hidden":`true`,"data-column-id":e,"data-folded":`true`,className:c(_O,`px-0 first:pl-0 last:pr-0`)})}function CO({run:e,to:t,onTogglePin:n,lines:r=1}){return(0,X.jsx)(DD,{run:e,to:t,title:La(e),unread:Za(e),unreadTone:au(e),readDone:ru(e),isWorker:e.delegation?.role===`worker`,pinned:!!e.pinned,onTogglePin:n?t=>n(e,t):void 0,lines:r})}function wO({run:e,cpuExpanded:t,memoryExpanded:n}){let r=jn(e,En(e.id));return(0,X.jsxs)(X.Fragment,{children:[t?(0,X.jsx)(TO,{column:`cpu`,cell:r.cpu}):(0,X.jsx)(SO,{column:`cpu`}),n?(0,X.jsx)(TO,{column:`memory`,cell:r.mem}):(0,X.jsx)(SO,{column:`memory`})]})}function TO({column:e,cell:t}){let n=t.text&&t.title?`${t.text}; ${t.title}`:t.text;return(0,X.jsx)(`div`,{role:`cell`,"data-usage":e===`memory`?`mem`:e,"data-column-id":e,"data-usage-kind":t.kind,className:c(_O,`overflow-hidden text-right font-mono tabular-nums`,t.kind===`live`&&`bg-accent-strong/5 text-xs font-medium text-foreground`,t.kind===`peak`&&`text-xs text-supporting-foreground`,t.kind===`none`&&`text-xs text-soft-foreground`),children:(0,X.jsx)(EO,{text:t.text||`—`,accessibleText:n||void 0})})}function EO({text:e,accessibleText:t}){return(0,X.jsx)(`span`,{"data-slot":`bounded-metric`,...t?{"aria-label":t,title:t}:{},className:`block max-w-full overflow-hidden text-ellipsis`,children:e})}function DO(){let e=ye(),t=R(),n=tO(ke().data),r=Kf(),{view:i,setView:a,origin:o,setOrigin:s,urlQuery:c,writeQuery:l}=OO(),u=fe(),d=z(),f=oD(e.data,i),p=F({mutationFn:e=>Tt(de(),void 0,e),onSuccess:()=>u.invalidateAfter(`runs`,()=>de()),onError:e=>B(e.message,{tone:`danger`})}),m=F({mutationFn:e=>et(e),onSuccess:()=>d.invalidateQueries({queryKey:k.runs.all}),onError:e=>B(e.message,{tone:`danger`})}),h=F({mutationFn:({id:e,title:t})=>ut(e,{title:t}),onSuccess:()=>d.invalidateQueries({queryKey:k.runs.all}),onError:e=>B(e.message,{tone:`danger`})}),_=y(),v=io(3e4),b=rO(),x=I(),S=De(void 0,{retryOnMount:!1}),C=T({retryOnMount:!1}).data?.projects?.find(e=>e.id===x)?.name,w=[...e.data??[],...f.pages?.runs??[]].some(e=>e.automationId!==void 0),E=g([void 0],r&&w),D=Y.useCallback(e=>E(void 0,e),[E]),O=Y.useMemo(()=>x===void 0?[]:(e.data??[]).flatMap(e=>{let t=In(e);return t?[{projectId:x,kind:t.kind,number:t.number}]:[]}),[e.data,x]),A=Y.useCallback((e,t)=>h.mutate({id:e,title:t}),[h.mutate]),j=Y.useCallback((e,t)=>_.mutate({id:e.id,pinned:t}),[_.mutate]);return(0,X.jsx)(gi,{projectId:x,repoBase:S,requests:O,children:(0,X.jsx)(aO,{runs:e.data,runners:t.data,projectName:C,error:e.error?.message,onRetry:()=>void e.refetch(),view:i,onViewChange:a,origin:o,onOriginChange:s,automations:r,urlQuery:c,onQueryChange:l,foldScope:`project:${x??`default`}`,automationName:D,onArchiveFinished:e=>{p.isPending||p.mutate(e)},archivePending:p.isPending,onMarkAllRead:e=>m.mutate(e),onRename:A,onTogglePin:j,now:v,showTokens:n.tokens,showCost:n.cost,expandedColumns:b.expandedColumns,onToggleColumn:b.toggleColumn,columnsPending:b.isPending,archivedPages:f.pages,archivedTotal:f.total,onArchivedSearch:f.search})})}function OO(){let[e,t]=Xo(),n=e.get(`archived`)===`1`?`archived`:`active`,r=wE(e.get(`origin`)),[i,a]=Y.useState(n),[o,s]=Y.useState(r);Y.useEffect(()=>a(n),[n]),Y.useEffect(()=>s(r),[r]);let c=e.get(`q`)??``,l=Y.useRef(void 0);return Y.useEffect(()=>{let e=l;return()=>clearTimeout(e.current)},[]),{view:i,setView:e=>{a(e),t(sD(`archived`,e===`archived`?`1`:null))},origin:o,setOrigin:e=>{s(e),t(sD(`origin`,e===`all`?null:e))},urlQuery:c,writeQuery:Y.useCallback((e,n)=>{clearTimeout(l.current);let r=e.trim();l.current=setTimeout(()=>t(e=>{let t=e.get(`q`),i=sD(`q`,r===``?null:r)(e);return i.get(`q`)!==t&&n(r),i}),kO)},[t])}}var kO=250;function AO({projects:e,perProjectLimit:t}){return e.length===0?null:(0,X.jsxs)(`p`,{"data-slot":`global-tasks-truncated`,className:`text-xs text-soft-foreground`,children:[`Showing every active task and the newest `,t,` archived tasks per project — older archived tasks in`,` `,e.join(`, `),` are in that project’s own Tasks page.`]})}function jO({registry:e}){return e.length<=1?null:(0,X.jsxs)(`section`,{"data-slot":`other-projects`,className:`rounded-lg border border-border bg-card p-5`,children:[(0,X.jsx)(`h2`,{className:`text-base font-semibold`,children:`Other projects`}),(0,X.jsx)(`div`,{className:`mt-3 flex flex-col divide-y divide-border`,children:e.map(e=>(0,X.jsxs)(`div`,{className:`flex min-h-14 items-center justify-between gap-3`,children:[(0,X.jsx)(`span`,{className:`min-w-0 truncate text-[13px]`,children:e.name}),(0,X.jsxs)(H,{to:ba(e.id,`/`),className:`inline-flex min-h-11 shrink-0 items-center rounded-md px-3 text-xs text-accent-text hover:bg-accent-strong/10`,children:[`View tasks`,(0,X.jsxs)(`span`,{className:`sr-only`,children:[` for `,e.name]})]})]},e.id))})]})}function MO({view:e,filtered:t}){return t?(0,X.jsx)(Yo,{heading:`h2`,icon:(0,X.jsx)(_i,{}),tone:`neutral`,title:`No matching tasks`,subtitle:`No task in any project matches these filters.`}):e===`archived`?(0,X.jsx)(Yo,{heading:`h2`,icon:(0,X.jsx)(Fr,{}),tone:`neutral`,title:`Nothing archived yet`,subtitle:`Finished tasks you archive land here, from every project.`}):(0,X.jsx)(Yo,{heading:`h2`,icon:(0,X.jsx)(Gs,{}),tone:`neutral`,title:`No tasks yet`,subtitle:`Start a task in any project and it shows up here.`})}function NO({groupBy:e,filterDetailsOpen:t,message:n,onRetry:r}){return(0,X.jsx)(Jo,{route:`global-tasks`,density:`empty`,rootProps:{"data-presentation":e===`none`?`summary`:`cards`,"data-filter-details":String(t)},className:`pb-[calc(90px+env(safe-area-inset-bottom))]`,bodyClassName:`gap-[22px]`,children:(0,X.jsx)(Yo,{icon:(0,X.jsx)(Hr,{}),tone:`danger`,title:`Tasks across projects did not load`,subtitle:n,actions:(0,X.jsx)(G,{variant:`outline`,onClick:r,children:`Retry`})})})}function PO({slot:e,label:t,options:n,selected:r,onToggle:i,onClear:a,searchPlaceholder:o,emptyLabel:s=`Nothing to filter by`}){let[l,u]=Y.useState(!1),d=r.length>0,f=r.length===1?n.find(e=>e.value===r[0])?.label??r[0]:`${r.length} selected`;return(0,X.jsxs)(sa,{open:l,onOpenChange:u,children:[(0,X.jsx)(ra,{asChild:!0,children:(0,X.jsxs)(`button`,{type:`button`,"data-slot":`facet-${e}`,"data-active":d?`true`:void 0,"aria-label":`Filter by ${t.toLowerCase()}`,className:c(`inline-flex h-7 items-center gap-1.5 rounded-full border border-border bg-card px-2.5 text-xs font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`,d&&`border-accent-strong/40 bg-accent-strong/10 text-foreground`),children:[(0,X.jsx)(`span`,{className:c(d&&`text-soft-foreground`),children:t}),d?(0,X.jsx)(`span`,{className:`max-w-[140px] truncate font-semibold`,children:f}):null,(0,X.jsx)(qr,{"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,X.jsxs)(aa,{align:`start`,className:`w-64 p-0`,"data-testid":`facet-${e}-menu`,children:[(0,X.jsxs)(Co,{children:[(0,X.jsx)(ho,{placeholder:o??`Search ${t.toLowerCase()}…`}),(0,X.jsxs)(So,{children:[(0,X.jsx)(xo,{children:s}),(0,X.jsx)(_o,{children:n.map(e=>{let t=r.includes(e.value);return(0,X.jsxs)(bo,{value:e.label,onSelect:()=>i(e.value),"data-slot":`facet-option`,"data-value":e.value,"aria-checked":t,role:`option`,children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,className:c(`flex size-4 shrink-0 items-center justify-center rounded-[4px] border`,t?`border-accent-strong bg-accent-strong text-accent-strong-foreground`:`border-input`),children:t?(0,X.jsx)(Kr,{className:`size-3`}):null}),(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.label}),e.count===void 0?null:(0,X.jsx)(`span`,{className:`shrink-0 font-mono text-xs text-soft-foreground tabular-nums`,children:e.count})]},e.value)})})]})]}),d?(0,X.jsx)(`div`,{className:`border-t border-border p-1`,children:(0,X.jsxs)(`button`,{type:`button`,"data-action":`facet-${e}-clear`,onClick:()=>a(),className:`w-full rounded-sm px-2 py-1.5 text-left text-xs font-medium text-muted-foreground hover:bg-muted hover:text-foreground`,children:[`Clear `,t.toLowerCase()]})}):null]})]})}function FO({label:e,count:t,selected:n,onToggle:r,slot:i,tone:a=`neutral`}){return(0,X.jsxs)(`button`,{type:`button`,"data-slot":i,"data-selected":n?`true`:void 0,"aria-pressed":n,onClick:r,className:c(`inline-flex h-7 items-center gap-1.5 rounded-full border px-2.5 text-xs font-medium transition-colors`,a===`tag`?`border-accent-strong/25 bg-accent-strong/10 text-accent-text hover:bg-accent-strong/20`:`border-border bg-card text-muted-foreground hover:bg-muted hover:text-foreground`,n&&`border-accent-strong bg-accent-strong text-accent-strong-foreground hover:bg-accent-strong`),children:[e,t===void 0?null:(0,X.jsx)(`span`,{className:c(`font-mono text-xs tabular-nums`,!n&&`text-soft-foreground`),children:t})]})}function IO({slot:e,label:t,value:n,options:r,onChange:i,size:a=`compact`}){return(0,X.jsx)(`div`,{"data-slot":e,role:`group`,"aria-label":t,className:`inline-flex gap-0.5 rounded-md bg-muted p-[3px]`,children:r.map(e=>{let t=e.value===n;return(0,X.jsx)(`button`,{type:`button`,"data-value":e.value,"aria-pressed":t,disabled:e.disabled,title:e.title,onClick:()=>i(e.value),className:c(`flex h-6 items-center justify-center rounded-[6px] px-2.5 text-[12px] font-medium text-muted-foreground transition-colors hover:text-foreground disabled:pointer-events-none disabled:opacity-50`,a===`touch`&&`h-11 px-4 text-[13px]`,t&&`bg-card font-semibold text-foreground shadow-xs`),children:e.label},e.value)})})}var LO=` untagged`,RO=[{value:`project`,label:`Project`},{value:`tag`,label:`Tag`},{value:`status`,label:`Status`},{value:`workflow`,label:`Workflow`}];function zO(e,t){return e===t?`none`:t}var BO={query:``,tags:[],statuses:[],workflows:[]};function VO(e,t){let{origin:n,...r}=e;return t===`all`?r:{...r,origin:t}}function HO(e,t){return e.includes(t)?e.filter(e=>e!==t):[...e,t]}function UO(e){return(e.projects?.length??0)+e.tags.length+e.statuses.length+e.workflows.length+(e.origin===void 0||e.origin===`all`?0:1)}function WO(e){return e.query.trim()!==``||UO(e)>0}function GO(e){return UO(e.filters)+(e.filters.query.trim()===``?0:1)+(e.groupBy===`none`?0:1)}function KO(e){return GO(e)>0}function qO(e,t){let n=new Map(t.map(e=>[e.id,e]));return e.filter(e=>!Wa(e)).map(e=>{let t=n.get(e.projectId);return{run:e,project:t,projectName:t?.name||e.projectId,tags:t?.tags??[]}})}function JO(e){let t=new Set;for(let n of e)t.add(n.run.workflow);return[...t].sort((e,t)=>e.localeCompare(t))}function YO(e){let t=new Set;for(let n of e)t.add(n.run.status);return[...t].sort((e,t)=>e.localeCompare(t))}function XO(e,t){let n=new Map;for(let r of e)for(let e of t(r))n.set(e,(n.get(e)??0)+1);return n}var ZO=e=>e.tags.length===0?[LO]:e.tags,QO=(e,t)=>e.length===0||t.some(t=>e.includes(t)),$O=(e,t)=>{if(t.length===0)return!0;let n=ZO(e).map(e=>e.toLowerCase());return t.some(e=>n.includes(e.toLowerCase()))};function ek(e,t){return{displayTitle:La(e.run),projectName:e.projectName,tags:e.tags,automation:e.run.automationId===void 0?void 0:t(e)??e.run.automationId,references:()=>Rn(e.run)}}function tk(e,t,n,r=()=>void 0){let i=t.query.trim()!==``;return e.filter(e=>(n===`archived`?!e.run.archived:e.run.archived)||!TE(e.run,t.origin??`all`)||!QO(t.projects??[],[e.run.projectId])||!QO(t.statuses,[e.run.status])||!QO(t.workflows,[e.run.workflow])||!$O(e,t.tags)?!1:!i||Kn(e.run,t.query,{scope:`shown`,extras:ek(e,r)}))}function nk(e,t,n,r,i){return tk(e,r===`origin`?{...t,origin:`all`}:{...t,[r]:[]},n,i)}function rk(e,t){if(t===`none`)return[{key:`all`,label:``,tasks:[...e]}];let n=new Map,r=(e,t,r)=>{let i=n.get(e);i?i.tasks.push(r):n.set(e,{key:e,label:t,tasks:[r]})};for(let n of e)if(t===`project`)r(n.run.projectId,n.projectName,n);else if(t===`status`)r(n.run.status,up(n.run.status),n);else if(t===`workflow`)r(n.run.workflow,n.run.workflow,n);else if(n.tags.length===0)r(LO,`Untagged`,n);else for(let e of n.tags)r(e.toLowerCase(),e,n);return[...n.values()].sort((e,t)=>e.key===` untagged`?1:t.key===` untagged`?-1:t.tasks.length-e.tasks.length||e.label.localeCompare(t.label))}function ik(e,t){let n=new Map(t.map(e=>[e.id,e.name]));return e.map(e=>n.get(e)||e)}var $={query:`q`,project:`project`,tag:`tag`,untagged:`untagged`,status:`status`,workflow:`workflow`,groupBy:`group`,archived:`archived`,origin:`origin`},ak=new Set(RO.map(e=>e.value));function ok(e){let t=new URLSearchParams,n=e.filters.query.trim();n!==``&&t.set($.query,n);for(let n of e.filters.tags)n===` untagged`?t.set($.untagged,`1`):t.append($.tag,n);for(let n of e.filters.projects??[])t.append($.project,n);for(let n of e.filters.statuses)t.append($.status,n);for(let n of e.filters.workflows)t.append($.workflow,n);return e.groupBy!==`none`&&t.set($.groupBy,e.groupBy),e.view===`archived`&&t.set($.archived,`1`),e.filters.origin!==void 0&&e.filters.origin!==`all`&&t.set($.origin,e.filters.origin),t}function sk(e,t){let n=e.getAll($.tag).filter(e=>e!==``);e.get($.untagged)===`1`&&n.push(LO);let r=e.get($.groupBy)??``,i=CE(wE(e.get($.origin)),t);return{filters:{query:e.get($.query)??``,...e.has($.project)?{projects:e.getAll($.project).filter(Boolean)}:{},tags:n,statuses:e.getAll($.status).filter(e=>e!==``),workflows:e.getAll($.workflow).filter(e=>e!==``),...i===`all`?{}:{origin:i}},groupBy:ak.has(r)?r:`none`,view:e.get($.archived)===`1`?`archived`:`active`}}function ck(e){return(e.projects?.length??0)+e.tags.length+e.statuses.length+e.workflows.length}function lk({filters:e,onToggle:t,onClearFacet:n,onClearAll:r,groupBy:i,onGroupByChange:a,projects:o,tasks:s,view:c,automationName:l}){let u=Y.useMemo(()=>Ae(o),[o]),d=Y.useMemo(()=>{let t=(t,n)=>XO(nk(s,e,c,t,l),n);return{projects:t(`projects`,e=>[e.run.projectId]),tags:t(`tags`,ZO),statuses:t(`statuses`,e=>[e.run.status]),workflows:t(`workflows`,e=>[e.run.workflow])}},[s,e,c,l]),f=e=>t=>({...t,count:e.get(t.value)??0});return(0,X.jsxs)(`div`,{id:`global-tasks-filters`,"data-slot":`global-tasks-filters`,className:`flex flex-col gap-2`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,X.jsx)(PO,{slot:`project`,label:`Project`,selected:e.projects??[],onToggle:e=>t(`projects`,e),onClear:()=>n(`projects`),options:[...new Map(s.map(e=>[e.run.projectId,e.projectName])).entries()].map(([e,t])=>({value:e,label:t})).map(f(d.projects)),emptyLabel:`No tasks to filter`}),(0,X.jsx)(PO,{slot:`status`,label:`Status`,selected:e.statuses,onToggle:e=>t(`statuses`,e),onClear:()=>n(`statuses`),options:YO(s).map(e=>({value:e,label:up(e)})).map(f(d.statuses)),emptyLabel:`No tasks to filter`}),(0,X.jsx)(PO,{slot:`workflow`,label:`Workflow`,selected:e.workflows,onToggle:e=>t(`workflows`,e),onClear:()=>n(`workflows`),options:JO(s).map(e=>({value:e,label:e})).map(f(d.workflows)),emptyLabel:`No tasks to filter`}),(0,X.jsxs)(`div`,{"data-slot":`group-controls`,className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(`span`,{className:`mx-1 h-5 w-px bg-border`,"aria-hidden":`true`}),(0,X.jsx)(`span`,{className:`text-xs font-medium text-soft-foreground`,children:`Group by`}),(0,X.jsx)(IO,{slot:`group-by`,label:`Group tasks by`,value:i,options:RO,onChange:e=>a(zO(i,e))})]}),KO({filters:e,groupBy:i})?(0,X.jsxs)(`button`,{type:`button`,"data-action":`clear-filters`,onClick:r,className:`ml-auto inline-flex h-7 items-center gap-1 rounded-full px-2 text-xs font-medium text-muted-foreground hover:bg-muted hover:text-foreground`,children:[(0,X.jsx)(vr,{className:`size-3`,"aria-hidden":`true`}),`Clear`,` (${GO({filters:e,groupBy:i})})`]}):null]}),u.length>0?(0,X.jsxs)(`div`,{"data-slot":`tag-filters`,className:`flex flex-wrap items-center gap-1.5`,children:[(0,X.jsx)(`span`,{className:`text-xs font-medium text-soft-foreground`,children:`Tags`}),u.map(n=>(0,X.jsx)(FO,{slot:`tag-filter`,tone:`tag`,label:n,count:d.tags.get(n)??0,selected:e.tags.some(e=>e.toLowerCase()===n.toLowerCase()),onToggle:()=>t(`tags`,n)},n)),(0,X.jsx)(FO,{slot:`tag-filter`,label:`Untagged`,count:d.tags.get(` untagged`)??0,selected:e.tags.includes(LO),onToggle:()=>t(`tags`,LO)})]}):(0,X.jsxs)(`p`,{"data-slot":`no-tags-hint`,className:`text-xs text-soft-foreground`,children:[`Tag connected repositories in`,` `,(0,X.jsx)(H,{to:`/settings/global/projects`,className:`font-medium text-accent-text hover:underline`,children:Ym(`projects`)}),` `,`to group their tasks together here.`]})]})}var uk=15e3,dk=250,fk=new Set([`done`,`failed`,`cancelled`]);function pk(){return gk({request:({projectId:e,runId:t,archived:n})=>Jt(we(t,{projectId:e}),n),patch:({archived:e})=>t=>({...t,archived:e})})}function mk(){return gk({request:({projectId:e,runId:t,read:n})=>Ke(we(t,{projectId:e}),n),patch:({read:e})=>t=>{if(e)return{...t,seenAt:new Date().toISOString()};let{seenAt:n,...r}=t;return r}})}function hk(){return gk({request:({projectId:e,runId:t,pinned:n})=>nn(we(t,{projectId:e}),n),patch:({pinned:e})=>t=>({...t,pinned:e})})}function gk({request:e,patch:t}){let n=fe();return F({mutationFn:e,onMutate:e=>n.patchIndex(we(e.runId,{projectId:e.projectId}),()=>t(e)),onError:(e,t,n)=>{n?.rollback(),B(e.message,{tone:`danger`})},onSettled:(e,t,{projectId:r,runId:i},a)=>{a?a.settle():n.invalidateAfter(`indexed`,we(i,{projectId:r}))}})}async function _k(e,t){if(e.length===0)return;let n=(await Promise.allSettled(e.map(e=>t(e)))).find(e=>e.status===`rejected`);if(n){let e=n.reason instanceof Error?n.reason.message:String(n.reason);throw Error(e)}}function vk(e,t,n){let r=n.projects&&n.projects.length>0?new Set(n.projects):void 0,i=n.tags.length>0?new Set(n.tags.map(e=>e.toLowerCase())):void 0;return e.filter(e=>!(!TE(e.run,t)||r&&!r.has(e.run.projectId)||i&&!ZO(e).some(e=>i.has(e.toLowerCase()))))}function yk({projectCount:e,bootProject:t,status:n,secondaryActions:r}){return{title:`All tasks`,status:(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:[e>0?(0,X.jsxs)(`span`,{"data-slot":`tasks-project-scope`,className:`hidden text-xs font-medium text-muted-foreground tabular-nums md:inline`,children:[e,` `,e===1?`project`:`projects`]}):null,n]}),secondaryActions:r,primaryAction:(0,X.jsx)(Ko,{asChild:!0,variant:`primary`,"data-slot":`new-task-inline`,children:(0,X.jsxs)(H,{to:ba(t??`default`,`/new`),children:[(0,X.jsx)(nr,{"aria-hidden":`true`}),`New task`]})})}}function bk(e,t,n,r){if(!(!e||t<=0||n))return(0,X.jsx)(Go,{summary:`Showing ${t} ${t===1?`task`:`tasks`} across registered projects.`,actions:(0,X.jsx)(G,{variant:`outline`,size:`sm`,asChild:!0,className:`max-md:min-h-11`,children:(0,X.jsx)(H,{to:ba(r??`default`,`/new`),children:`Start a task`})})})}function xk({tasks:e,origin:t,filters:n}){let r=z(),i=Y.useMemo(()=>vk(e,t,n),[e,t,n]),a=Y.useMemo(()=>i.map(e=>e.run),[i]),o=Y.useMemo(()=>iu(a),[a]),s=Y.useMemo(()=>zn(a),[a]),c=Y.useCallback(()=>{r.invalidateQueries({queryKey:h.runsIndex}),r.invalidateQueries({queryKey:k.runs.all})},[r]),l=F({mutationFn:e=>_k(e,e=>et(EE(t),de({projectId:e}))),onError:e=>B(e.message,{tone:`danger`}),onSettled:c}),u=F({mutationFn:e=>_k(e,e=>Tt(de({projectId:e}),void 0,EE(t))),onError:e=>B(e.message,{tone:`danger`}),onSettled:c}),d=Y.useCallback(()=>{if(l.isPending)return;let e=[...new Set(i.filter(e=>Za(e.run)).map(e=>e.run.projectId))];e.length>0&&l.mutate(e)},[i,l]),f=Y.useCallback(()=>{if(u.isPending)return;let e=[...new Set(i.filter(e=>!e.run.archived&&fk.has(e.run.status)).map(e=>e.run.projectId))];e.length>0&&u.mutate(e)},[i,u]);return{unread:o,finished:s,archivePending:u.isPending,markReadPending:l.isPending,onMarkAllRead:d,onArchiveFinished:f}}function Sk(){let{mutate:e,isPending:t}=pk(),{mutate:n,isPending:r}=mk(),{mutate:i,isPending:a}=hk();return{onArchive:Y.useCallback((t,n)=>{t.projectId&&e({projectId:t.projectId,runId:t.runId,archived:n})},[e]),onSetRead:Y.useCallback((e,t)=>{e.projectId&&n({projectId:e.projectId,runId:e.runId,read:t})},[n]),onTogglePin:Y.useCallback((e,t)=>{e.projectId&&i({projectId:e.projectId,runId:e.runId,pinned:t})},[i]),busy:t||r||a}}function Ck(){let e=_g(),t=T(),n=R(),r=tO(ke().data),i=le(!0,uk),a=rO(),o=Y.useMemo(()=>uT(),[]),[s,l]=Xo(),u=Kf(),{filters:d,groupBy:f,view:p}=Y.useMemo(()=>sk(s,u),[s,u]),m=io(3e4),h=e=>l(t=>{let n=ok(e(sk(t,!0))),r=t.get(`tasks`);return(r===`flat`||r===`virtual`)&&n.set(`tasks`,r),n}),g=e=>h(t=>({...t,filters:e(t.filters)})),_=e=>h(t=>({...t,groupBy:e})),v=e=>h(t=>({...t,view:e})),y=ck(d)+(f===`none`?0:1),[b,x]=Y.useState(y>0),[S,C]=Ek(d.query,e=>g(t=>({...t,query:e}))),w=i.data?.referenceStatuses;Y.useEffect(()=>{w&&Se(w)},[w]);let E=Y.useMemo(()=>t.data?.projects??[],[t.data]),D=Y.useMemo(()=>i.data?.runs??[],[i.data]),O=Y.useMemo(()=>qO(D,E),[D,E]),{nameOf:k,visible:A,originTotals:j,statusGroups:M,folds:ee}=Dk({tasks:O,filters:d,view:p,groupBy:f,index:D,automationsOn:u}),te=Y.useMemo(()=>rk(A,f),[A,f]),N=d.origin??`all`,P=Y.useMemo(()=>{let e=O.map(e=>e.run);return{active:DE(e,`active`)[N],archived:DE(e,`archived`)[N]}},[O,N]),ne=e=>g(t=>VO(t,e)),re=xk({tasks:O,origin:N,filters:d}),F=Sk(),ie=Y.useMemo(()=>A.flatMap(e=>Fn(e.run,e.project?.repoUrl).filter(t=>Mn(t,e.project?.repoUrl)).map(t=>({projectId:e.run.projectId,kind:t.kind,number:t.number}))),[A]),ae=ik(i.data?.truncated??[],E),I=(e,t)=>g(n=>({...n,[e]:HO(n[e]??[],t)})),oe=e=>g(t=>({...t,[e]:[]})),L=i.error??t.error;if(L)return(0,X.jsx)(NO,{groupBy:f,filterDetailsOpen:b,message:L.message,onRetry:()=>{i.refetch(),t.refetch()}});let se=i.data===void 0?`full`:Ho(A.length),ce=(0,X.jsxs)(G,{variant:`outline`,"data-slot":`filters-toggle`,"data-active":b||y>0,className:c(`max-md:min-h-11 md:h-9`,(b||y>0)&&`border-accent-strong bg-accent-strong/10 text-accent-text hover:bg-accent-strong/15 hover:text-accent-text`),"aria-expanded":b,"aria-controls":`global-tasks-filters`,onClick:()=>x(e=>!e),children:[(0,X.jsx)(_r,{"aria-hidden":`true`}),`Filters`,y>0?(0,X.jsx)(Zf,{variant:`accent`,"data-slot":`filters-count`,"aria-hidden":`true`,value:y}):null]});return(0,X.jsx)(Jo,{route:`global-tasks`,density:se,headerSpacing:`compact`,rootProps:{"data-presentation":f===`none`?`summary`:`cards`,"data-filter-details":String(b)},bodyClassName:`gap-3`,header:yk({projectCount:E.length,bootProject:t.data?.bootProject,status:(0,X.jsx)(KE,{view:p,onSelect:v,activeCount:P.active,archivedCount:P.archived,trailing:(0,X.jsxs)(`span`,{"data-slot":`global-tasks-count`,className:`self-center text-xs text-soft-foreground tabular-nums`,children:[A.length,` of `,O.length,ae.length>0?` loaded`:``]})}),secondaryActions:(0,X.jsx)(ZE,{view:p,unread:re.unread,finished:re.finished,archivePending:re.archivePending,markReadPending:re.markReadPending,onMarkAllRead:re.onMarkAllRead,onArchiveFinished:re.onArchiveFinished})}),sparseFooter:bk(i.data!==void 0,A.length,WO(d),t.data?.bootProject),children:(0,X.jsxs)(_E,{layout:`${f}:${e}`,revision:te,visibilityRevision:JSON.stringify([Ja.map(ee.isCollapsed),p,b,a.expandedColumns]),className:`flex min-w-0 flex-1 flex-col gap-3`,children:[(0,X.jsx)(eD,{query:S,onQueryChange:C,searchPlaceholder:`Search every project…`,searchLabel:`Search tasks across projects`,origin:N,originCounts:j,automations:u,onOriginChange:ne,columns:o,expandedColumns:a.expandedColumns,columnsPending:a.isPending,onToggleColumn:a.toggleColumn,groupLabels:M.map(e=>e.label),onSetAllFolds:ee.setAll,extraControls:ce}),(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-3`,children:[(0,X.jsx)(lk,{filters:d,onToggle:I,onClearFacet:oe,onClearAll:()=>{C(``),h(e=>({...e,filters:BO,groupBy:`none`}))},groupBy:f,onGroupByChange:_,projects:E,tasks:O,view:p,automationName:k}),(0,X.jsx)(AO,{projects:ae,perProjectLimit:i.data?.perProjectLimit}),i.data===void 0?(0,X.jsx)(`div`,{role:`status`,className:`rounded-xl border border-border bg-card p-6 text-sm text-muted-foreground`,children:`Loading tasks…`}):(0,X.jsx)(wk,{view:p,filtered:WO(d),visibleCount:A.length,referenceRequests:ie,lists:{desktop:e,groupBy:f,view:p,statusGroups:M,groups:te,folds:ee,expandedColumns:a.expandedColumns,now:m,runners:n.data,showTokens:r.tokens,showCost:r.cost,automationName:k,onTogglePin:p===`archived`?void 0:F.onTogglePin,onArchive:F.onArchive,onSetRead:F.onSetRead,busy:F.busy}}),(0,X.jsx)(jO,{registry:E})]})]})})}function wk({view:e,filtered:t,visibleCount:n,referenceRequests:r,lists:i}){return n===0?(0,X.jsx)(MO,{view:e,filtered:t}):(0,X.jsx)(gi,{requests:r,children:(0,X.jsx)(Tk,{...i})})}function Tk({desktop:e,groupBy:t,view:n,statusGroups:r,groups:i,folds:a,expandedColumns:o,now:s,runners:c,showTokens:l,showCost:u,automationName:d,onTogglePin:f,onArchive:p,onSetRead:m,busy:h}){let g=r.filter(e=>!a.isCollapsed(e.label)),_=t===`none`?g.some(e=>e.rows.flatMap(PE).some(e=>Fn(e.run,e.project?.repoUrl).length>0)):i.some(e=>e.tasks.some(e=>Fn(e.run,e.project?.repoUrl).length>0)),v=e?`table`:`card`,y=e=>e.map(({task:e,queuePosition:t})=>XD({task:e,queuePosition:t,runners:c,automationName:d,now:s,showTokens:l,showCost:u})),b={density:v,now:s,showReferences:_,expandedColumns:o,showTokens:l,showCost:u,scopedLinks:!1,liveUsageSource:`snapshot`,onTogglePin:f,onArchive:p,onSetRead:m,busy:h,tableSlot:`global-tasks-table`,rowSlot:`global-task-row`,cardSlot:`global-task-row`};return(0,X.jsx)(X.Fragment,{children:t===`none`?r.map(e=>{let t=kE(e),r=e.rows.flatMap(e=>PE(e).map(t=>({task:t,queuePosition:t.run.status===`queued`?e.queuePosition:null})));return(0,X.jsx)(BE,{id:`global-group-${n}-${e.label.replaceAll(` `,`-`)}`,label:e.label,count:t.length,tone:HE(e.label,t.map(e=>e.run)),folded:a.isFolded(e.label),collapsed:a.isCollapsed(e.label),onToggle:()=>a.toggle(e.label),children:(0,X.jsx)(BD,{...b,items:y(r),showHeader:e===g[0],showProject:!0})},e.label)}):i.map((e,r)=>{let i=n===`archived`?e.tasks:[...e.tasks].sort((e,t)=>Number(!!t.run.pinned)-Number(!!e.run.pinned));return(0,X.jsxs)(`section`,{"data-slot":`task-group`,"data-group-key":e.key,children:[(0,X.jsxs)(`h2`,{className:`mb-1.5 flex items-center gap-2 text-[12px] font-semibold tracking-[0.04em] text-soft-foreground uppercase`,children:[t===`project`?(0,X.jsx)(H,{to:ba(e.key,`/`),"data-slot":`group-project-link`,className:`hover:text-foreground hover:underline`,children:e.label}):e.label,(0,X.jsx)(Zf,{value:i.length,className:`font-mono text-xs font-medium`})]}),(0,X.jsx)(BD,{...b,items:y(i.map(e=>({task:e,queuePosition:null}))),showHeader:r===0,showProject:t!==`project`})]},e.key)})})}function Ek(e,t){let[n,r]=Y.useState(e),i=Y.useRef(e);return Y.useEffect(()=>{e!==i.current&&r(e),i.current=e},[e]),Y.useEffect(()=>{if(n===i.current)return;let e=setTimeout(()=>{i.current=n,t(n)},dk);return()=>clearTimeout(e)},[n]),[n,r]}function Dk({tasks:e,filters:t,view:n,groupBy:r,index:i,automationsOn:a}){let o=Y.useMemo(()=>[...new Set(e.filter(e=>e.run.automationId!==void 0).map(e=>e.run.projectId))],[e]),s=g(o,a&&o.length>0),c=Y.useCallback(e=>e.run.automationId===void 0?void 0:s(e.run.projectId,e.run.automationId),[s]),l=Y.useMemo(()=>tk(e,t,n,c),[e,t,n,c]),u=DE(nk(e,t,n,`origin`,c).map(e=>e.run),n),d=r===`none`?NE(l,n,i):[];return{nameOf:c,visible:l,originTotals:u,statusGroups:d,folds:$D(`global`,n,new Set(t.query.trim()===``?[]:d.map(e=>e.label)))}}var Ok=(0,Y.lazy)(()=>V(()=>import(`./automations-route-CygHw9Ni.js`).then(e=>({default:e.AutomationsRoute})),__vite__mapDeps([86,1,2,7,8,6,9,10,11,12,87,88,89,23,19,13,68,14,18,90,24,91,64,48,39,38,37,58,92,93,28,40,94,95]))),kk=(0,Y.lazy)(()=>V(()=>import(`./workspace-tools-CsrBXG_p.js`).then(e=>({default:e.WorkspaceToolsRoute})),__vite__mapDeps([96,1,2,6,7,8,9,10,11,12,97,98,99,16,14,18,19,25,26,27,92,93]))),Ak=(0,Y.lazy)(()=>V(()=>import(`./settings-shell-11SRBczO.js`).then(e=>({default:e.SettingsIndexRoute})),__vite__mapDeps([100,1,2,6,7,8,9,10,11,12,13,55,14,18,19,90,23,24,37,38,39,20,58,99,92,93,40,41,65,29,46,47,48,28,42,49,59,60,26,61,17,62,63,64,35,101]))),jk=(0,Y.lazy)(()=>V(()=>import(`./settings-shell-11SRBczO.js`).then(e=>({default:e.SettingsSectionRoute})),__vite__mapDeps([100,1,2,6,7,8,9,10,11,12,13,55,14,18,19,90,23,24,37,38,39,20,58,99,92,93,40,41,65,29,46,47,48,28,42,49,59,60,26,61,17,62,63,64,35,101]))),Mk=(0,Y.lazy)(()=>V(()=>import(`./task-thread-1BQ5lWbM.js`).then(e=>({default:e.TaskThreadRoute})),__vite__mapDeps([102,1,2,7,8,6,9,10,11,12,97,98,99,13,14,103,68,16,61,104,62,72,105,74,63,18,19,90,23,24,58,106,22,107,28,34,35,108,81,82,83,84,40,109,110,111,76,60,26,17,64,48,39,71,112,47,21,25,77,113,114,75,73,92,93,94,115]))),Nk=(0,Y.lazy)(()=>V(()=>import(`./task-changes-t473lMAF.js`).then(e=>({default:e.TaskChangesRoute})),__vite__mapDeps([116,1,2,7,8,6,9,10,11,12,13,111,97,98,99,14,76,60,26,61,17,62,63,18,19,64,23,24,48,39,35,71,105,112,47,21,22,58,25,77,81,82,83,34,84,40,109,113,114,117,80,118,92,93,28,119,120,121,108]))),Pk=(0,Y.lazy)(()=>V(()=>import(`./task-files-C0zhDxod.js`).then(e=>({default:e.TaskFilesRoute})),__vite__mapDeps([122,1,2,7,8,6,9,10,11,12,13,14,111,97,98,99,76,60,26,61,17,62,63,18,19,64,23,24,48,39,35,71,105,112,47,21,22,58,25,77,81,82,83,34,84,40,109,113,114,79,80,28,85,92,93]))),Fk=(0,Y.lazy)(async()=>{let{TaskReportRoute:e}=await V(async()=>{let{TaskReportRoute:e}=await import(`./report-reader-Bm0J3ujk.js`);return{TaskReportRoute:e}},__vite__mapDeps([78,1,2,6,7,8,9,10,11,12,13,79,14,80,18,19,28,34,35,81,82,83,84,85]));return{default:e}}),Ik=(0,Y.lazy)(()=>V(()=>import(`./task-commits-CuXxfPY6.js`).then(e=>({default:e.TaskCommitsRoute})),__vite__mapDeps([123,1,2,6,7,8,9,10,11,12,13,111,97,98,99,14,76,60,26,61,17,62,63,18,19,64,23,24,48,39,35,71,105,112,47,21,22,58,25,77,81,82,83,34,84,40,109,113,114,80,92,93,28,120,118,121,108,124,125]))),Lk=(0,Y.lazy)(()=>V(()=>import(`./task-github-item-CFU1Rbv0.js`).then(e=>({default:e.TaskGithubItemRoute})),__vite__mapDeps([126,2,1,7,8,6,9,10,11,12,97,98,99,13,111,14,76,60,26,61,17,62,63,18,19,64,23,24,48,39,35,71,105,112,47,21,22,58,25,77,81,82,83,34,84,40,109,113,114,92,93,28,127,69,104,72,73,51,52,120,118,121,108,124,128]))),Rk=(0,Y.lazy)(()=>V(()=>import(`./repo-git-C3YNr0yL.js`).then(e=>({default:e.RepoGitRoute})),__vite__mapDeps([129,1,2,7,8,6,9,10,11,12,97,98,99,13,14,70,130,117,61,80,18,19,63,64,23,24,48,39,118,71,72,112,47,58,25,26,77,92,93,28,119,120,121,108,124,125,131]))),zk=(0,Y.lazy)(()=>V(()=>import(`./github-CxYmUkO9.js`).then(e=>({default:e.GithubRoute})),__vite__mapDeps([132,1,2,7,8,6,9,10,11,12,13,69,14,16,72,73,18,19,91,23,64,24,48,39,38,47,58,99,98,25,26,51,22,21,92,93,28,107,127,61,104,105,52,81,82,83,34,35,84,40,120,118,121,108,124,113,128]))),Bk=(0,Y.lazy)(()=>V(()=>import(`./reports-CNL2zChD.js`).then(e=>({default:e.ReportsRoute})),__vite__mapDeps([133,1,2,7,8,6,9,10,11,12,13,134,14,16,104,18,19,58,77,92,93,107,110,85,84,135]))),Vk=(0,Y.lazy)(()=>V(()=>import(`./workflows-BMlXKiaH.js`).then(e=>({default:e.WorkflowsRoute})),__vite__mapDeps([136,1,2,7,8,6,9,10,11,12,13,18,19,64,23,24,48,39,21,22,52,92,93,28,4,40,137]))),Hk=(0,Y.lazy)(()=>V(()=>import(`./activity-route-D2sff_BA.js`).then(e=>({default:e.ProjectActivityRoute})),__vite__mapDeps([138,1,2,7,8,139,6,9,10,11,12,89,13,14,103,68,16,61,104,62,72,105,74,63,18,19,90,23,24,58,98,99,106,22,107,28,34,35,108,81,82,83,84,40,109,110,67,134,26,71,47,48,39,25,92,93,140]))),Uk=(0,Y.lazy)(()=>V(()=>import(`./global-activity-route-ALFcEqug.js`).then(e=>({default:e.GlobalActivityRoute})),__vite__mapDeps([141,1,2,7,8,6,9,10,11,12,139,89,13,14,103,68,16,61,104,62,72,105,74,63,18,19,90,23,24,58,98,99,106,22,107,28,34,35,108,81,82,83,84,40,109,110,67,134,26,71,47,48,39,25,92,93,140,3]))),Wk=(0,Y.lazy)(()=>V(()=>import(`./skills-B6vquPg1.js`).then(e=>({default:e.SkillsRoute})),__vite__mapDeps([142,1,2,7,8,6,9,10,11,12,13,18,19,58,52,92,93])));function Gk(){let e=hn();return(0,X.jsx)(Ta,{to:{pathname:`/skills`,search:e.search,hash:e.hash},replace:!0})}function Kk({sectionId:e}){let t=hn();return(0,X.jsx)(vn,{to:{pathname:Av(`global`,e),search:t.search,hash:t.hash},replace:!0})}function qk(){return(0,X.jsx)(`div`,{"data-route":`scope-resolving`,className:`flex min-h-full flex-col`,children:(0,X.jsx)(`p`,{className:`px-4 py-6 text-center text-xs text-soft-foreground`,children:`Loading…`})})}function Jk(){let{projectId:e=``}=_n(),t=hn(),n=T(),r=ke();if(e==="default"){let e=n.data?.bootProject??(n.isError?r.data?.bootProject:void 0);if(e!==void 0){let n=t.pathname.replace(/^\/p\/default(?=\/|$)/,``);return(0,X.jsx)(vn,{to:`/p/${encodeURIComponent(e)}${n||`/`}${t.search}${t.hash}`,replace:!0})}if(!n.isError)return(0,X.jsx)(qk,{})}if(n.data){if(!(n.data.bootProject===e||n.data.projects.some(t=>t.id===e)))return(0,X.jsx)(WC,{projectId:e,registry:n.data})}else if(!n.isError)return(0,X.jsx)(qk,{});return(0,X.jsx)(kt,{projectId:n.data?.bootProject===e?null:e,children:(0,X.jsx)(pn,{},e)})}function Yk(){let{projectId:e=``}=_n();return(0,X.jsx)(EC,{},e)}var Xk=/^\/tasks\/([0-9a-f-]{36})(?=\/|$)/i;function Zk(e,t){let n=e.data?.bootProject??t.data?.bootProject;return{resolved:n,settled:(e.data!==void 0||e.isError)&&(t.data!==void 0||t.isError),boot:n??`default`}}function Qk(e,t,n){if(!(e.pathname===`/`&&e.search===``&&e.hash===``))return;if(t.data===void 0&&!t.isError)return(0,X.jsx)(qk,{});let r=hf(af(),t.data,n);if(r!==null)return(0,X.jsx)(vn,{to:r,replace:!0})}function $k(e,t,n,r,i,a){if(!n)return null;let o=i.data?.runs.find(t=>t.id===e)?.projectId;return o===void 0?r?a.data===void 0&&!a.isError?null:a.data?.runs.find(t=>t.id===e)?.projectId??t:t:o}function eA(e,t){let n=t.pathname===`/p`||t.pathname===`/p/`?`/`:t.pathname;return(0,X.jsx)(vn,{to:`/p/${encodeURIComponent(e)}${n}${t.search}${t.hash}`,replace:!0})}function tA(){let e=hn(),t=ke(),n=T(),r=Xk.exec(e.pathname)?.[1]??null,i=le(r!==null),a=i.data!==void 0||i.isError,o=i.data!==void 0&&!i.data.runs.some(e=>e.id===r),s=N(r!==null&&o?r:``),{resolved:c,settled:l,boot:u}=Zk(t,n);if(c===void 0&&!l)return(0,X.jsx)(qk,{});let d=Qk(e,n,c);if(d!==void 0)return d;let f=u;if(r!==null){let e=$k(r,u,a,o,i,s);if(e===null)return(0,X.jsx)(qk,{});f=e}return eA(f,e)}function nA(){return(0,X.jsxs)(U,{path:`/p/:projectId`,element:(0,X.jsx)(Jk,{}),children:[(0,X.jsx)(U,{index:!0,element:(0,X.jsx)(DO,{})}),(0,X.jsx)(U,{path:`new`,element:(0,X.jsx)(Yk,{})}),(0,X.jsx)(U,{path:`activity`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(hy,{}),children:(0,X.jsx)(Hk,{})})}),(0,X.jsxs)(U,{path:`tasks/:id`,element:(0,X.jsx)(Qw,{}),children:[(0,X.jsx)(U,{index:!0,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(XC,{}),children:(0,X.jsx)(Mk,{})})}),(0,X.jsx)(U,{path:`changes`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(KC,{tab:`changes`}),children:(0,X.jsx)(Nk,{})})}),(0,X.jsx)(U,{path:`files`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(KC,{tab:`files`}),children:(0,X.jsx)(Pk,{})})}),(0,X.jsx)(U,{path:`report`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(`div`,{"data-route":`task-report`,children:(0,X.jsx)(`h1`,{className:`p-4 text-sm text-soft-foreground`,children:`Loading report…`})}),children:(0,X.jsx)(Fk,{})})}),(0,X.jsx)(U,{path:`commits`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(KC,{tab:`changes`}),children:(0,X.jsx)(Ik,{})})}),(0,X.jsx)(U,{path:`commits/:sha`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(KC,{tab:`changes`}),children:(0,X.jsx)(Ik,{})})}),(0,X.jsx)(U,{path:`issue/:n`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(YC,{kind:`issue`}),children:(0,X.jsx)(Lk,{kind:`issue`})})}),(0,X.jsx)(U,{path:`pr/:n`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(YC,{kind:`pr`}),children:(0,X.jsx)(Lk,{kind:`pr`})})})]}),(0,X.jsx)(U,{path:`git`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(HC,{}),children:(0,X.jsx)(Rk,{section:`main`,index:!0})})}),(0,X.jsx)(U,{path:`git/commits`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(HC,{}),children:(0,X.jsx)(Rk,{section:`main`})})}),(0,X.jsx)(U,{path:`git/commits/:sha`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(HC,{}),children:(0,X.jsx)(Rk,{section:`main`})})}),(0,X.jsx)(U,{path:`git/not-landed`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(HC,{}),children:(0,X.jsx)(Rk,{section:`not-landed`})})}),(0,X.jsx)(U,{path:`git/cleanup`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(HC,{}),children:(0,X.jsx)(Rk,{section:`cleanup`})})}),(0,X.jsx)(U,{path:`git/branches`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(HC,{}),children:(0,X.jsx)(Rk,{section:`branches`})})}),(0,X.jsx)(U,{path:`git/changes`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(HC,{}),children:(0,X.jsx)(Rk,{section:`changes`})})}),(0,X.jsx)(U,{path:`github`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(gy,{}),children:(0,X.jsx)(zk,{view:`issues`,index:!0})})}),(0,X.jsx)(U,{path:`github/prs`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(gy,{}),children:(0,X.jsx)(zk,{view:`prs`})})}),(0,X.jsx)(U,{path:`github/issues/:n`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(gy,{}),children:(0,X.jsx)(zk,{view:`issues`})})}),(0,X.jsx)(U,{path:`github/prs/:n`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(gy,{}),children:(0,X.jsx)(zk,{view:`prs`})})}),(0,X.jsx)(U,{path:`github/prs/:n/changes`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(gy,{}),children:(0,X.jsx)(zk,{view:`prs`,changes:!0})})}),(0,X.jsx)(U,{path:`automations`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(`p`,{role:`status`,children:`Loading automations…`}),children:(0,X.jsx)(Ok,{})})}),(0,X.jsx)(U,{path:`automations/new`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(`p`,{role:`status`,children:`Loading automations…`}),children:(0,X.jsx)(Ok,{mode:`new`})})}),(0,X.jsx)(U,{path:`automations/:automationId`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(`p`,{role:`status`,children:`Loading automations…`}),children:(0,X.jsx)(Ok,{mode:`edit`})})}),(0,X.jsx)(U,{path:`automations/:automationId/log`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(`p`,{role:`status`,children:`Loading automations…`}),children:(0,X.jsx)(Ok,{mode:`log`})})}),(0,X.jsx)(U,{path:`skills`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(UC,{}),children:(0,X.jsx)(Wk,{})})}),(0,X.jsx)(U,{path:`reports`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(`p`,{role:`status`,children:`Loading reports…`}),children:(0,X.jsx)(Bk,{})})}),(0,X.jsx)(U,{path:`workflows`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(GC,{}),children:(0,X.jsx)(Vk,{})})}),(0,X.jsx)(U,{path:`workflows/:name`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(GC,{}),children:(0,X.jsx)(Vk,{})})}),(0,X.jsx)(U,{path:`settings`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(`p`,{role:`status`,children:`Loading settings…`}),children:(0,X.jsx)(Ak,{})})}),(0,X.jsx)(U,{path:`settings/skills`,element:(0,X.jsx)(Gk,{})}),kv(`project`).map(e=>(0,X.jsx)(U,{path:`settings/${e.id}`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(`p`,{role:`status`,children:`Loading settings…`}),children:(0,X.jsx)(jk,{section:e,scope:`project`})})},e.id)),kv(`global`).map(e=>(0,X.jsx)(U,{path:`settings/${e.id}`,element:(0,X.jsx)(Kk,{sectionId:e.id})},e.id)),(0,X.jsx)(U,{path:`*`,element:(0,X.jsx)(BC,{})})]})}function rA(e){let t=Tn(mn(nA()),e),n=t?.at(-1);return!t||!n||n.route.path===`*`?null:{pattern:`/${t.slice(1).map(e=>e.route.path).filter(e=>e!==void 0).join(`/`)}`.replace(/\/$/,``)||`/`,params:n.params}}function iA(){return(0,X.jsxs)(Cn,{children:[nA(),(0,X.jsx)(U,{path:`/tasks`,element:(0,X.jsx)(Ck,{})}),(0,X.jsx)(U,{path:`/tools`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(`p`,{role:`status`,children:`Loading workspace tools…`}),children:(0,X.jsx)(kk,{})})}),(0,X.jsx)(U,{path:`/activity`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(hy,{}),children:(0,X.jsx)(Uk,{})})}),(0,X.jsx)(U,{path:`/settings/global`,element:(0,X.jsx)(vn,{to:jv,replace:!0})}),(0,X.jsx)(U,{path:`/settings/global/skills`,element:(0,X.jsx)(vn,{to:`/skills`,replace:!0})}),kv(`global`).map(e=>(0,X.jsx)(U,{path:Av(`global`,e.id),element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(`p`,{role:`status`,children:`Loading settings…`}),children:(0,X.jsx)(jk,{section:e,scope:`global`})})},e.id)),(0,X.jsx)(U,{path:`*`,element:(0,X.jsx)(tA,{})})]})}function aA(){let[e]=(0,Y.useState)(bs);return(0,Y.useEffect)(()=>An(e),[e]),(0,X.jsx)(Ss,{children:(0,X.jsx)(Rt,{client:e,children:(0,X.jsxs)(Dn,{children:[(0,X.jsx)(ys,{}),(0,X.jsx)(py,{}),(0,X.jsx)(Uu,{children:(0,X.jsx)(ay,{children:(0,X.jsxs)(wn,{children:[(0,X.jsx)(sy,{}),(0,X.jsx)(xs.Provider,{value:rA,children:(0,X.jsx)(hi,{children:(0,X.jsx)(Wv,{children:(0,X.jsx)(iA,{})})})}),(0,X.jsx)(Kt,{})]})})})]})})})}var oA=document.querySelector(`meta[name="cez-api-base"]`)?.getAttribute(`content`);l(me(oA,void 0,void 0));var sA=document.getElementById(`root`);if(!sA)throw Error(`Squawk: #root container is missing from index.html`);(0,ts.createRoot)(sA).render((0,X.jsx)(Y.StrictMode,{children:(0,X.jsx)(aA,{})}));export{jy as $,$s as $n,Ah as $t,SS as A,$f as An,k_ as At,Ux as B,hd as Bn,S_ as Bt,KC as C,mp as Cn,ov as Ct,iC as D,op as Dn,R_ as Dt,VC as E,lp as En,K_ as Et,wS as F,Gf as Fn,p_ as Ft,Rx as G,Wu as Gn,l_ as Gt,Bx as H,fd as Hn,u_ as Ht,TS as I,Kf as In,w_ as It,Sx as J,Rl as Jn,c_ as Jt,zx as K,hu as Kn,s_ as Kt,Jx as L,nf as Ln,T_ as Lt,bS as M,Yf as Mn,E_ as Mt,vS as N,qf as Nn,D_ as Nt,nC as O,gp as On,F_ as Ot,ES as P,Wf as Pn,m_ as Pt,Oy as Q,lc as Qn,Kh as Qt,qx as R,gd as Rn,g_ as Rt,qC as S,ap as Sn,iv as St,HC as T,up as Tn,sv as Tt,Ix as U,md as Un,d_ as Ut,Kx as V,_d as Vn,n_ as Vt,Ax as W,dd as Wn,a_ as Wt,Iy as X,Ml as Xn,_g as Xt,Fy as Y,Pl as Yn,Gg as Yt,Cy as Z,Al as Zn,qh as Zt,mw as _,Qp as _n,Z_ as _t,nE as a,Ih as an,zs as ar,gy as at,XC as b,tp as bn,J_ as bt,Xw as c,Fh as cn,Fs as cr,ly as ct,Ew as d,Ym as dn,Ds as dr,Av as dt,Rh as en,Zs as er,Ay as et,Dw as f,_m as fn,Ts as fr,kv as ft,pw as g,Xp as gn,W_ as gt,yw as h,Jp as hn,$_ as ht,dD as i,Dh as in,Bs as ir,_y as it,_S as j,Qf as jn,j_ as jt,CS as k,Xf as kn,N_ as kt,Jw as l,vh as ln,Ns as lr,oy as lt,kw as m,Zp as mn,fv as mt,tO as n,Nh as nn,Ws as nr,ky as nt,tE as o,zh as on,Rs as or,hy as ot,Cw as p,am as pn,ws as pr,pv as pt,Cx as q,Zl as qn,o_ as qt,fD as r,Oh as rn,Hs as rr,My as rt,eE as s,kh as sn,Ls as sr,cy as st,IO as t,Ph as tn,Ys as tr,Ty as tt,Tw as u,Th as un,As as ur,jv as ut,hw as v,bp as vn,Q_ as vt,GC as w,vp as wn,q_ as wt,YC as x,fp as xn,G_ as xt,ew as y,ep as yn,U_ as yt,Yx as z,vd as zn,__ as zt};
|