@open-mercato/cezar 0.15.0 → 0.15.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/automations/github-poller.d.ts +8 -1
- package/dist/automations/github-poller.js +78 -13
- package/dist/automations/github-poller.js.map +1 -1
- package/dist/automations/pr-head.js +15 -1
- package/dist/automations/pr-head.js.map +1 -1
- package/dist/automations/prompts.js +2 -2
- package/dist/automations/types.d.ts +10 -0
- package/dist/automations/types.js +12 -1
- package/dist/automations/types.js.map +1 -1
- package/dist/config.d.ts +1 -0
- package/dist/config.js +6 -0
- package/dist/config.js.map +1 -1
- package/dist/contract/automations.d.ts +31 -1
- package/dist/contract/index.d.ts +1 -0
- package/dist/contract/index.js +161 -17
- package/dist/contract/projects.d.ts +46 -0
- package/dist/contract/runs.d.ts +15 -0
- package/dist/contract/skills.d.ts +1 -0
- package/dist/contract/telemetry.d.ts +124 -0
- package/dist/contract/workspace.d.ts +3 -0
- package/dist/core/cursor-agent-runner.d.ts +11 -0
- package/dist/core/cursor-agent-runner.js +48 -4
- package/dist/core/cursor-agent-runner.js.map +1 -1
- package/dist/core/disclaim-spawn.d.ts +10 -0
- package/dist/core/disclaim-spawn.js +105 -8
- package/dist/core/disclaim-spawn.js.map +1 -1
- package/dist/git-diff-base.js +26 -19
- package/dist/git-diff-base.js.map +1 -1
- package/dist/git-remotes.d.ts +43 -0
- package/dist/git-remotes.js +127 -0
- package/dist/git-remotes.js.map +1 -0
- package/dist/git-worktree.d.ts +43 -19
- package/dist/git-worktree.js +138 -54
- package/dist/git-worktree.js.map +1 -1
- package/dist/index.js +46 -6
- package/dist/index.js.map +1 -1
- package/dist/runs/auto-name.d.ts +17 -0
- package/dist/runs/auto-name.js +47 -2
- package/dist/runs/auto-name.js.map +1 -1
- package/dist/runs/event-history.d.ts +10 -2
- package/dist/runs/event-history.js +290 -120
- package/dist/runs/event-history.js.map +1 -1
- package/dist/runs/retention.js +1 -1
- package/dist/runs/retention.js.map +1 -1
- package/dist/runs/store.d.ts +16 -3
- package/dist/runs/store.js +89 -10
- package/dist/runs/store.js.map +1 -1
- package/dist/server/checkout.d.ts +4 -0
- package/dist/server/checkout.js +9 -5
- package/dist/server/checkout.js.map +1 -1
- package/dist/server/create-project.d.ts +77 -0
- package/dist/server/create-project.js +342 -0
- package/dist/server/create-project.js.map +1 -0
- package/dist/server/forge/github.d.ts +2 -0
- package/dist/server/forge/github.js +32 -10
- package/dist/server/forge/github.js.map +1 -1
- package/dist/server/forge/index.d.ts +1 -12
- package/dist/server/forge/index.js +7 -29
- package/dist/server/forge/index.js.map +1 -1
- package/dist/server/forge/types.d.ts +2 -0
- package/dist/server/git-changes.d.ts +15 -0
- package/dist/server/git-changes.js +51 -1
- package/dist/server/git-changes.js.map +1 -1
- package/dist/server/git.d.ts +3 -2
- package/dist/server/git.js +4 -3
- package/dist/server/git.js.map +1 -1
- package/dist/server/project-context.js +1 -1
- package/dist/server/project-context.js.map +1 -1
- package/dist/server/server.d.ts +609 -302
- package/dist/server/server.js +191 -12
- package/dist/server/server.js.map +1 -1
- package/dist/server/star-count.d.ts +27 -11
- package/dist/server/star-count.js +57 -28
- package/dist/server/star-count.js.map +1 -1
- package/dist/telemetry-cli.d.ts +10 -0
- package/dist/telemetry-cli.js +54 -0
- package/dist/telemetry-cli.js.map +1 -0
- package/dist/telemetry-service.json +1 -0
- package/dist/telemetry.d.ts +79 -0
- package/dist/telemetry.js +453 -0
- package/dist/telemetry.js.map +1 -0
- package/dist/workflows/run.d.ts +28 -0
- package/dist/workflows/run.js +111 -16
- package/dist/workflows/run.js.map +1 -1
- package/dist/workspace/config.d.ts +10 -0
- package/dist/workspace/config.js +16 -0
- package/dist/workspace/config.js.map +1 -1
- package/dist/workspace/projects-cli.js +3 -0
- package/dist/workspace/projects-cli.js.map +1 -1
- package/package.json +3 -3
- package/scripts/mock-claude.mjs +32 -17
- package/scripts/stamp-telemetry-service.mjs +20 -0
- package/web/dist/assets/agent-task-pickers-mJzYn0UB.js +1 -0
- package/web/dist/assets/{alert-dialog-CF_-dmQ1.js → alert-dialog-Dd1WPOaz.js} +1 -1
- package/web/dist/assets/arrow-left-fsST4JqT.js +1 -0
- package/web/dist/assets/{automation-format-D1nqk0ID.js → automation-format-BTIFWfjt.js} +1 -1
- package/web/dist/assets/automations-route-DJjhwqug.js +1 -0
- package/web/dist/assets/button-BNnH7COh.js +100 -0
- package/web/dist/assets/{centered-state-T0J7VmBb.js → centered-state-sEYB3bgq.js} +1 -1
- package/web/dist/assets/check-DA37PQLT.js +1 -0
- package/web/dist/assets/chevron-left-zbXV2Qbu.js +1 -0
- package/web/dist/assets/chevron-right-Beu1pd6H.js +1 -0
- package/web/dist/assets/{collapsible-RD4hkew7.js → collapsible-MuXfYnM8.js} +1 -1
- package/web/dist/assets/commit-list-Bps23fvP.js +1 -0
- package/web/dist/assets/compare-variants-CQskdfDW.js +1 -0
- package/web/dist/assets/composer-DKWLJeo9.js +18 -0
- package/web/dist/assets/dashboard-BCNe_6p7.js +44 -0
- package/web/dist/assets/diff-CrLUECGW.js +3 -0
- package/web/dist/assets/{diff-stat-CFoeFye2.js → diff-stat-SpfygteL.js} +1 -1
- package/web/dist/assets/diff-view-DP4Gw3QJ.js +13 -0
- package/web/dist/assets/{download-BFQEsJRY.js → download-CBwSbmy_.js} +1 -1
- package/web/dist/assets/dropdown-menu-CxPGHgWX.js +1 -0
- package/web/dist/assets/ellipsis-BmusVE8U.js +1 -0
- package/web/dist/assets/{file-Df5WtpM_.js → file-DkvcUwxT.js} +1 -1
- package/web/dist/assets/file-preview-DxFusXAO.js +2 -0
- package/web/dist/assets/file-text-DBeC0yKb.js +1 -0
- package/web/dist/assets/file-tree-BTJZXRkM.js +1 -0
- package/web/dist/assets/{git-commit-horizontal-DawNm4qg.js → git-commit-horizontal-BM9_nEW7.js} +1 -1
- package/web/dist/assets/git-toolbar-DXyPCDkQ.js +1 -0
- package/web/dist/assets/github-G5fU4gJd.js +1 -0
- package/web/dist/assets/index-BN3w52uE.js +21 -0
- package/web/dist/assets/index-CAvSSpvF.css +2 -0
- package/web/dist/assets/{markdown-Bmfy_1Ll.js → markdown-BpZ4p95p.js} +1 -1
- package/web/dist/assets/{markdown-B_O1ys3h.js → markdown-C5F95Rt-.js} +1 -1
- package/web/dist/assets/{message-square-BOO9s3qX.js → message-square-BFQln9c4.js} +1 -1
- package/web/dist/assets/{pill-bO5OcHuK.js → pill-BcIQGDbn.js} +1 -1
- package/web/dist/assets/project-router-CWMOKp_H.js +3 -0
- package/web/dist/assets/reference-chip-B7lU_Pyh.js +1 -0
- package/web/dist/assets/reference-overflow-ClRRXWez.js +1 -0
- package/web/dist/assets/{refresh-cw-BaFyjVUz.js → refresh-cw-BBEYC6z2.js} +1 -1
- package/web/dist/assets/repo-git-CgxxZ7cO.js +1 -0
- package/web/dist/assets/{run-diff-GZbNs8fA.js → run-diff-BTB7nBeD.js} +1 -1
- package/web/dist/assets/run-header-BPNBEaOy.js +1 -0
- package/web/dist/assets/{image-preview-4SVDrBvn.js → scroll-within-DRt7mAnQ.js} +1 -1
- package/web/dist/assets/{search-x-bpAfQtVY.js → search-x-6BavY3mg.js} +1 -1
- package/web/dist/assets/sheet-D9PeyyRZ.js +1 -0
- package/web/dist/assets/skills-SIMzpL0l.js +1 -0
- package/web/dist/assets/square-DsFAQaY9.js +1 -0
- package/web/dist/assets/tab-link-DEUSZU49.js +1 -0
- package/web/dist/assets/{tag-DLwUkUsN.js → tag-DvCVnA6I.js} +1 -1
- package/web/dist/assets/task-changes-D-aajoMU.js +1 -0
- package/web/dist/assets/task-commits-BYD1GVkS.js +1 -0
- package/web/dist/assets/task-composer-7bdNNMP_.js +12 -0
- package/web/dist/assets/task-files-BfIOz-eN.js +1 -0
- package/web/dist/assets/task-graph-B5-5_IPh.js +1 -0
- package/web/dist/assets/task-notes-CfkTBgo8.js +1 -0
- package/web/dist/assets/task-thread-eEkjTDxr.js +10 -0
- package/web/dist/assets/{terminal-CwrL1hAi.js → terminal-xRHwWarr.js} +1 -1
- package/web/dist/assets/textarea-rKUFh5lI.js +1 -0
- package/web/dist/assets/thread-loading-DLlbK51g.js +1 -0
- package/web/dist/assets/{token-metrics-C149OWmd.js → token-metrics-BcPjL36-.js} +1 -1
- package/web/dist/assets/tooltip-BVqBAGNb.js +1 -0
- package/web/dist/assets/tracker-2DfMzsIE.js +4 -0
- package/web/dist/assets/triangle-alert-CP3Xp0FU.js +1 -0
- package/web/dist/assets/upload-bwO_2kok.js +1 -0
- package/web/dist/assets/use-automations-PceYR6ss.js +5 -0
- package/web/dist/assets/use-now-BAKdIYLG.js +1 -0
- package/web/dist/assets/use-submit-shortcut-BA4NVpJl.js +1 -0
- package/web/dist/assets/workflow-graph-HopaWPea.js +13 -0
- package/web/dist/assets/x-HaVPcg_B.js +1 -0
- package/web/dist/index.html +28 -31
- package/web/dist/assets/agent-task-pickers-C3ydGatB.js +0 -1
- package/web/dist/assets/arrow-left-BxBdc5DC.js +0 -1
- package/web/dist/assets/automations-route-BsflncpV.js +0 -1
- package/web/dist/assets/button-CjSjKnkd.js +0 -100
- package/web/dist/assets/check-DAAMuI4o.js +0 -1
- package/web/dist/assets/chevron-left-CvcqxpQZ.js +0 -1
- package/web/dist/assets/chevron-right-DKiL3NWw.js +0 -1
- package/web/dist/assets/commit-list-BJac2uO6.js +0 -1
- package/web/dist/assets/compare-variants-CfqICvRy.js +0 -1
- package/web/dist/assets/composer-DZx3cwQW.js +0 -18
- package/web/dist/assets/dashboard-CpCDiZdE.js +0 -44
- package/web/dist/assets/diff-LG2cl0PE.js +0 -3
- package/web/dist/assets/diff-controls-QgdH-r3F.js +0 -1
- package/web/dist/assets/diff-view-BVwSaBb2.js +0 -13
- package/web/dist/assets/dropdown-menu-DkEK7m00.js +0 -1
- package/web/dist/assets/editable-title-CJSWyCcL.js +0 -1
- package/web/dist/assets/ellipsis-vertical-CB0adfr7.js +0 -1
- package/web/dist/assets/external-link-DPKRidDg.js +0 -1
- package/web/dist/assets/eye-CEHQ0c-s.js +0 -1
- package/web/dist/assets/file-preview-kYsqZiLU.js +0 -2
- package/web/dist/assets/file-text-m0tZu8sU.js +0 -1
- package/web/dist/assets/git-merge-B7oVXcKc.js +0 -1
- package/web/dist/assets/git-toolbar-B0K4Q5Zv.js +0 -1
- package/web/dist/assets/github-C4WaHPni.js +0 -1
- package/web/dist/assets/index-CiQrbvAq.js +0 -21
- package/web/dist/assets/index-WWaEax-B.css +0 -2
- package/web/dist/assets/pencil-CCR9uUZ1.js +0 -1
- package/web/dist/assets/reference-chip-Bx_mG9QG.js +0 -1
- package/web/dist/assets/repo-git-Mn3_jrGP.js +0 -1
- package/web/dist/assets/run-header-i1D5Lvfs.js +0 -1
- package/web/dist/assets/sheet-DCdZVHFk.js +0 -1
- package/web/dist/assets/skills-Dea5ynJK.js +0 -1
- package/web/dist/assets/tab-link-BVItTl_Y.js +0 -1
- package/web/dist/assets/task-changes-xNbBM7FO.js +0 -1
- package/web/dist/assets/task-commits-BYozE_X3.js +0 -1
- package/web/dist/assets/task-composer-Brx0sa7_.js +0 -12
- package/web/dist/assets/task-files-MAPO-efK.js +0 -1
- package/web/dist/assets/task-graph-BSLCUr1E.js +0 -1
- package/web/dist/assets/task-thread-CRVmwchQ.js +0 -9
- package/web/dist/assets/textarea-Bb0_Hz53.js +0 -1
- package/web/dist/assets/thread-loading-Bo6IOu3Y.js +0 -1
- package/web/dist/assets/toaster-Hj_czp_o.js +0 -3
- package/web/dist/assets/tooltip--PYfu68E.js +0 -1
- package/web/dist/assets/tracker-DM5WtYD0.js +0 -4
- package/web/dist/assets/trash-2-EdjdGvEo.js +0 -1
- package/web/dist/assets/triangle-alert-DpH3QFz6.js +0 -1
- package/web/dist/assets/use-automations-XKvBTPM-.js +0 -5
- package/web/dist/assets/use-now-CrM50BFB.js +0 -1
- package/web/dist/assets/use-submit-shortcut-BJ10ZshV.js +0 -1
- package/web/dist/assets/workflow-graph-Y2Pr7ubb.js +0 -13
- package/web/dist/assets/x-BkwTUDpG.js +0 -1
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dashboard-BCNe_6p7.js","assets/rolldown-runtime-QTnfLwEv.js","assets/react-runtime-CCIEwYL0.js","assets/project-router-CWMOKp_H.js","assets/button-BNnH7COh.js","assets/bundle-mjs-BT31bpU6.js","assets/use-automations-PceYR6ss.js","assets/sheet-D9PeyyRZ.js","assets/x-HaVPcg_B.js","assets/reference-chip-B7lU_Pyh.js","assets/tooltip-BVqBAGNb.js","assets/triangle-alert-CP3Xp0FU.js","assets/token-metrics-BcPjL36-.js","assets/check-DA37PQLT.js","assets/use-now-BAKdIYLG.js","assets/automation-format-BTIFWfjt.js","assets/chevron-right-Beu1pd6H.js","assets/download-CBwSbmy_.js","assets/task-thread-eEkjTDxr.js","assets/reference-overflow-ClRRXWez.js","assets/textarea-rKUFh5lI.js","assets/dropdown-menu-CxPGHgWX.js","assets/composer-DKWLJeo9.js","assets/use-submit-shortcut-BA4NVpJl.js","assets/square-DsFAQaY9.js","assets/run-header-BPNBEaOy.js","assets/ellipsis-BmusVE8U.js","assets/centered-state-sEYB3bgq.js","assets/git-toolbar-DXyPCDkQ.js","assets/git-commit-horizontal-BM9_nEW7.js","assets/refresh-cw-BBEYC6z2.js","assets/upload-bwO_2kok.js","assets/diff-stat-SpfygteL.js","assets/collapsible-MuXfYnM8.js","assets/alert-dialog-Dd1WPOaz.js","assets/pill-BcIQGDbn.js","assets/tab-link-DEUSZU49.js","assets/file-text-DBeC0yKb.js","assets/thread-loading-DLlbK51g.js","assets/search-x-6BavY3mg.js","assets/markdown-BpZ4p95p.js","assets/chunk-BO2N2NFS-MDrqQfMl.js","assets/lib-BxQXEXDF.js","assets/lib-BQXq3kEf.js","assets/scroll-within-DRt7mAnQ.js","assets/run-diff-BTB7nBeD.js","assets/task-composer-7bdNNMP_.js","assets/file-DkvcUwxT.js","assets/types-BTlmexWF.js","assets/diff-CrLUECGW.js","assets/compare-variants-CQskdfDW.js","assets/task-changes-D-aajoMU.js","assets/markdown-C5F95Rt-.js","assets/message-square-BFQln9c4.js","assets/file-tree-BTJZXRkM.js","assets/task-files-BfIOz-eN.js","assets/file-preview-DxFusXAO.js","assets/task-commits-BYD1GVkS.js","assets/arrow-left-fsST4JqT.js","assets/commit-list-Bps23fvP.js","assets/task-notes-CfkTBgo8.js","assets/repo-git-CgxxZ7cO.js","assets/github-G5fU4gJd.js","assets/chevron-left-zbXV2Qbu.js","assets/tag-DvCVnA6I.js","assets/agent-task-pickers-mJzYn0UB.js","assets/tracker-2DfMzsIE.js","assets/task-graph-B5-5_IPh.js","assets/workflow-graph-HopaWPea.js","assets/terminal-xRHwWarr.js","assets/workflow-graph-DLioOiRN.css","assets/skills-SIMzpL0l.js","assets/automations-route-DJjhwqug.js"])))=>i.map(i=>d[i]);
|
|
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{$ as a,$i as o,$r as s,$t as c,A as l,An as u,At as d,Bi as f,Bt as p,C as m,Ci as h,Cn as g,Cr as _,E as v,En as y,Fr as b,Ft as x,Gi as S,Gt as C,Hi as w,Hn as T,Ht as E,In as D,It as O,J as k,Ji as A,Jr as j,Ki as M,Kn as N,Kt as P,L as F,Li as ee,Lr as te,M as ne,Mn as re,Mt as ie,Nn as ae,Nr as oe,Nt as se,O as ce,On as le,Pt as ue,Qi as de,Qr as fe,Rt as pe,S as me,Si as he,Sn as ge,Sr as _e,T as ve,Ti as ye,Tn as be,Ui as xe,Un as Se,Ur as Ce,Ut as we,V as Te,Vi as Ee,Vt as De,W as Oe,Wi as ke,Wn as Ae,Wt as je,X as Me,Xi as Ne,Xr as Pe,Xt as Fe,Yi as Ie,Yt as Le,Zi as Re,Zn as ze,Zr as Be,Zt as Ve,_a as He,_i as Ue,a as We,aa as I,ai as Ge,an as Ke,at as qe,b as Je,ba as Ye,bi as Xe,bt as Ze,c as Qe,ca as $e,ci as et,cn as tt,ct as nt,da as rt,dn as it,dt as at,ea as ot,en as st,er as ct,et as lt,f as L,fa as ut,fn as dt,ft,g as pt,ga as mt,h as R,ha as ht,hi as gt,i as _t,ia as vt,ii as yt,in as z,it as bt,jn as xt,jt as St,k as Ct,ki as wt,kn as Tt,kr as Et,kt as Dt,l as Ot,la as kt,lt as At,ma as jt,mi as Mt,mn as Nt,mt as Pt,n as Ft,na as B,nn as It,nr as Lt,nt as Rt,o as zt,oa as Bt,oi as Vt,on as Ht,or as Ut,pa as Wt,pi as Gt,pn as Kt,pr as qt,q as Jt,qi as Yt,qn as Xt,r as Zt,ra as Qt,rn as $t,rt as en,s as tn,sa as nn,si as rn,sn as an,st as on,t as V,ti as sn,tn as cn,tt as ln,u as un,ua as dn,un as fn,ut as pn,v as mn,va as hn,vn as gn,w as _n,wn as vn,x as yn,xi as bn,xn,y as Sn,ya as Cn,yi as wn,yt as Tn,zn as En,zt as Dn}from"./project-router-CWMOKp_H.js";import{A as On,B as kn,C as An,D as H,Dt as jn,E as Mn,F as U,H as Nn,J as Pn,Mt as Fn,N as In,Nt as Ln,P as Rn,S as zn,T as W,W as Bn,_ as Vn,b as Hn,g as Un,h as Wn,i as Gn,k as Kn,m as qn,mt as Jn,q as Yn,r as G,t as K,v as Xn,w as Zn,x as Qn,y as $n,yt as er}from"./button-BNnH7COh.js";import{i as tr}from"./bundle-mjs-BT31bpU6.js";import{C as nr,D as rr,E as ir,O as ar,S as or,T as sr,_ as cr,a as lr,b as ur,c as dr,d as fr,f as pr,g as mr,h as hr,i as gr,k as _r,l as vr,m as yr,p as br,s as xr,u as Sr,v as Cr,w as wr,x as Tr,y as Er}from"./use-automations-PceYR6ss.js";import{i as Dr,n as Or,o as kr,r as Ar,s as jr,t as Mr}from"./sheet-D9PeyyRZ.js";import{$ as Nr,B as Pr,C as Fr,D as Ir,J as Lr,O as Rr,Q as zr,S as Br,T as Vr,U as Hr,V as Ur,X as Wr,Y as Gr,Z as Kr,_ as qr,b as Jr,c as Yr,ct as Xr,d as Zr,f as Qr,g as $r,h as ei,it as ti,l as ni,m as ri,n as ii,nt as ai,p as oi,q as si,r as ci,st as li,t as ui,tt as di,v as fi,w as pi,x as mi,y as hi}from"./reference-overflow-ClRRXWez.js";import{S as gi,_ as _i,a as vi,b as yi,c as bi,f as xi,g as Si,h as Ci,i as wi,l as Ti,m as Ei,o as Di,p as Oi,r as ki,t as Ai,v as ji}from"./reference-chip-B7lU_Pyh.js";import{C as Mi,S as Ni,T as Pi,_ as Fi,a as Ii,b as Li,c as Ri,d as zi,f as Bi,h as Vi,i as Hi,l as Ui,m as Wi,n as Gi,o as Ki,p as qi,r as Ji,s as Yi,t as Xi,u as Zi,v as Qi,w as $i,x as ea,y as ta}from"./composer-DKWLJeo9.js";import{i as na,n as ra,r as ia,t as aa}from"./textarea-rKUFh5lI.js";import{t as oa}from"./check-DA37PQLT.js";import{a as sa,c as ca,d as la,i as ua,l as da,n as fa,o as pa,p as ma,r as ha,s as ga,t as _a,u as va}from"./tooltip-BVqBAGNb.js";import{t as ya}from"./chevron-right-Beu1pd6H.js";import{n as ba,t as xa}from"./x-HaVPcg_B.js";import{c as Sa,d as Ca,f as wa,g as Ta,h as Ea,i as Da,l as Oa,m as ka,n as Aa,p as ja,r as Ma,s as Na,t as Pa,u as Fa}from"./dropdown-menu-CxPGHgWX.js";import{t as Ia}from"./triangle-alert-CP3Xp0FU.js";import{n as La,r as Ra,t as q}from"./centered-state-sEYB3bgq.js";import{n as za,t as Ba}from"./thread-loading-DLlbK51g.js";import{n as Va,r as Ha}from"./use-submit-shortcut-BA4NVpJl.js";import{t as Ua}from"./search-x-6BavY3mg.js";import{t as Wa}from"./square-DsFAQaY9.js";import{t as Ga}from"./upload-bwO_2kok.js";import{a as Ka,c as qa,i as Ja,n as Ya,o as Xa,r as Za,s as Qa,t as $a}from"./alert-dialog-Dd1WPOaz.js";import{i as eo,r as to,t as no}from"./token-metrics-BcPjL36-.js";import{a as ro,c as io,i as ao,l as oo,n as so,o as co,r as lo,s as uo,t as fo,u as po}from"./use-now-BAKdIYLG.js";import{t as mo}from"./diff-stat-SpfygteL.js";import{n as ho,r as go,t as _o}from"./pill-BcIQGDbn.js";import{i as vo,n as yo,r as bo,t as xo}from"./markdown-BpZ4p95p.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 So=class extends Ye{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 Bt({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=Co(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=Co(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=Co(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=Co(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){kt.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=>Wt(t,e))}findAll(e={}){return this.getAll().filter(t=>Wt(e,t))}notify(e){kt.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return kt.batch(()=>Promise.all(e.map(e=>e.continue().catch(ht))))}};function Co(e){return e.options.scope?.id}var wo=class extends Ye{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??ut(r,t),a=this.get(i);return a||(a=new nn({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(){kt.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=>jt(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>jt(e,t)):t}notify(e){kt.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){kt.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){kt.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},To=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new wo,this.#t=e.mutationCache||new So,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=Cn.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=$e.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(He(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=dn(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return kt.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;kt.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return kt.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=kt.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(ht).catch(ht)}invalidateQueries(e,t={}){return kt.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=kt.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(ht)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(ht)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(He(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(ht).catch(ht)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(ht).catch(ht)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return $e.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(rt(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{mt(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(rt(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{mt(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||=ut(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===hn&&(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()}},J=e(t(),1),Eo=n();function Do(e){let t=e.container;if(t===void 0)return{hasContainer:!1,cpuLimited:!1,cpuCores:e.cpuCount,...e.cpuPct===void 0?{}:{cpuPct:e.cpuPct},cpuIsEffective:!1,memLimited:!1,memTotalBytes:e.memTotalBytes,...e.memUsedBytes===void 0?{}:{memUsedBytes:e.memUsedBytes},memIsEffective:!1,cgroupUnknown:e.cgroupProbe===`unavailable`};let n=t.cpuQuotaCores!==void 0||t.cpuAffinityCores!==void 0,r=t.cpuQuotaCores===void 0?t.cpuAffinityCores===void 0?void 0:`cpuset`:`quota`,i=n?Math.min(e.cpuCount,e.hostCpuCount??1/0,t.cpuQuotaCores??1/0,t.cpuAffinityCores??1/0):e.cpuCount,a=t.memLimitBytes!==void 0,o=n?t.cpuPct:e.cpuPct,s=a?t.memUsedBytes:e.memUsedBytes;return{hasContainer:!0,source:t.source,cpuLimited:n,...r===void 0?{}:{cpuLimitKind:r},cpuCores:i,...o===void 0?{}:{cpuPct:o},cpuIsEffective:n,memLimited:a,memTotalBytes:a?t.memLimitBytes??e.memTotalBytes:e.memTotalBytes,...s===void 0?{}:{memUsedBytes:s},memIsEffective:a,...e.hostCpuCount===void 0?{}:{hostCpuCount:e.hostCpuCount},cgroupUnknown:e.cgroupProbe===`unavailable`}}function Oo(e){let t=Math.round(e*10)/10;return`${Number.isInteger(t)?t:t.toFixed(1)} CPU`}function ko(e,t){let n=Nt(t);if(e===void 0)return`— / ${n}`;let r=Nt(e),i=n.split(` `)[1];return i!==void 0&&r.endsWith(` ${i}`)?`${r.slice(0,-(i.length+1))}/${n}`:`${r}/${n}`}function Ao(){let[e,t]=(0,J.useState)(()=>typeof window.matchMedia!=`function`||window.matchMedia(`(min-width: 768px)`).matches);return(0,J.useEffect)(()=>{if(typeof window.matchMedia!=`function`)return;let e=window.matchMedia(`(min-width: 768px)`),n=e=>t(e.matches);return e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)},[]),e}var Y=i(),jo=2500,Mo=2e3,No=(e,t)=>new Promise((n,r)=>{if(t?.aborted){r(new DOMException(`Aborted`,`AbortError`));return}let i=()=>{clearTimeout(a),r(new DOMException(`Aborted`,`AbortError`))},a=setTimeout(()=>{t?.removeEventListener(`abort`,i),n()},e);t?.addEventListener(`abort`,i,{once:!0})});async function Po(e){let t=await oe({signal:e});return t.cpuPct===void 0?(await No(jo,e),oe({signal:e})):t}function Fo(){let e=Te().data;if(e!==void 0)return e.capabilities?.localHandoff===!0?`local`:`remote`}var Io=Object.freeze([]),Lo=Object.freeze({history:Io});function Ro(){let e=Lo,t,n=new Set;return{subscribe(e){return n.add(e),()=>n.delete(e)},get:()=>e,push(r,i,a){let o=e,s=t!==void 0&&t!==a;t=a;let c=o.latest?.sampledAt===r.sampledAt;if(c&&o.latest===r&&o.lastFrameAt===i&&!s)return;let l=o.history[o.history.length-1],u=!c&&l!==void 0&&Date.parse(r.sampledAt)-Date.parse(l.sampledAt)>8e3,d=a!==`route`,f=s||u||!d?[]:o.history,p=Do(r).cpuPct,m=f[f.length-1];e={latest:r,lastFrameAt:i,history:d&&p!==void 0&&m?.sampledAt!==r.sampledAt?[...f,{sampledAt:r.sampledAt,receivedAt:i,cpuPct:p}].slice(-30):f,...o.topicUnavailable===!0?{topicUnavailable:!0}:{}};for(let e of n)e()},markTopicUnavailable(){if(e.topicUnavailable!==!0){e={...e,topicUnavailable:!0};for(let e of n)e()}},reset(){t=void 0,e=Lo;for(let e of n)e()}}}var zo=(0,J.createContext)(null);function Bo({children:e}){let[t]=(0,J.useState)(Ro);return(0,Y.jsxs)(zo.Provider,{value:t,children:[e,(0,Y.jsx)(Vo,{})]})}function Vo(){return Yo(),null}var Ho=()=>()=>void 0;function Uo(){let e=(0,J.useContext)(zo);return(0,J.useSyncExternalStore)(e?e.subscribe:Ho,()=>e?.get().latest,()=>void 0)}function Wo(){let e=(0,J.useContext)(zo);return(0,J.useSyncExternalStore)(e?e.subscribe:Ho,()=>e?.get().history??Lo.history,()=>Lo.history)}function Go(){let e=(0,J.useContext)(zo);return(0,J.useSyncExternalStore)(e?e.subscribe:Ho,()=>e?.get().lastFrameAt,()=>void 0)}function Ko(){let e=(0,J.useContext)(zo);return(0,J.useSyncExternalStore)(e?e.subscribe:Ho,()=>e?.get().topicUnavailable===!0,()=>!1)}function qo(){let e=Uo(),t=Go(),[n,r]=(0,J.useState)(()=>Date.now());if((0,J.useEffect)(()=>{let e=setInterval(()=>r(Date.now()),1e3);return()=>clearInterval(e)},[]),e===void 0)return;let i=Date.parse(e.sampledAt);return Number.isNaN(i)?t===void 0?void 0:Math.max(0,Math.round((n-t)/1e3)):Math.max(0,Math.round((n-i)/1e3))}function Jo(e,t){let n=(0,J.useContext)(zo),r=Fo(),i=Ko();(0,J.useEffect)(()=>{if(!(!n||!t||r!==`local`))return Ht(`host`,t=>{let r=Yn.safeParse(t);r.success&&n.push(r.data,Date.now(),e)},()=>n.markTopicUnavailable())},[n,t,r,e]);let a=Qt({queryKey:[...z.hostUsage,`poll`],queryFn:({signal:e})=>oe({signal:e}),enabled:n!==null&&t&&r===`local`&&i,refetchInterval:Mo,staleTime:0,retry:!1}).data;(0,J.useEffect)(()=>{!n||a===void 0||n.push(a,Date.now(),e)},[n,a,e])}function Yo(){Jo(`root`,Ao())}function Xo(e={}){Jo(`card`,e.enabled??!0)}function Zo(){let e=(0,J.useContext)(zo),t=Fo(),n=Qt({queryKey:z.hostUsage,queryFn:({signal:e})=>Po(e),enabled:t===`remote`,staleTime:0,retry:!1}),r=n.data;return(0,J.useEffect)(()=>{!e||r===void 0||e.push(r,Date.now(),`route`)},[e,r]),n}function Qo(){return new To({defaultOptions:{queries:{refetchInterval:!1,staleTime:5*6e4,gcTime:30*6e4,refetchOnWindowFocus:!1,refetchOnReconnect:!1,retry:(e,t)=>t instanceof Ae&&t.status>=400&&t.status<500?!1:e<1},mutations:{retry:!1}}})}var $o=U(`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`}]]),es=U(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),ts=U(`bell`,[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326`,key:`11g9vi`}]]),ns=U(`blocks`,[[`path`,{d:`M10 22V7a1 1 0 0 0-1-1H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-5a1 1 0 0 0-1-1H2`,key:`1ah6g2`}],[`rect`,{x:`14`,y:`2`,width:`8`,height:`8`,rx:`1`,key:`88lufb`}]]),rs=U(`bookmark`,[[`path`,{d:`M17 3a2 2 0 0 1 2 2v15a1 1 0 0 1-1.496.868l-4.512-2.578a2 2 0 0 0-1.984 0l-4.512 2.578A1 1 0 0 1 5 20V5a2 2 0 0 1 2-2z`,key:`oz39mx`}]]),is=U(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),as=U(`chevrons-left`,[[`path`,{d:`m11 17-5-5 5-5`,key:`13zhaf`}],[`path`,{d:`m18 17-5-5 5-5`,key:`h8a8et`}]]),os=U(`chevrons-right`,[[`path`,{d:`m6 17 5-5-5-5`,key:`xnjwq`}],[`path`,{d:`m13 17 5-5-5-5`,key:`17xmmf`}]]),ss=U(`clock-3`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6h4`,key:`135r8i`}]]),cs=U(`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`}]]),ls=U(`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`}]]),us=U(`corner-left-up`,[[`path`,{d:`M14 9 9 4 4 9`,key:`1af5af`}],[`path`,{d:`M20 20h-7a4 4 0 0 1-4-4V4`,key:`1blwi3`}]]),ds=U(`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`}]]),fs=U(`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`}]]),ps=U(`file-diff`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M9 10h6`,key:`9gxzsh`}],[`path`,{d:`M12 13V7`,key:`h0r20n`}],[`path`,{d:`M9 17h6`,key:`r8uit2`}]]),ms=U(`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`}]]),hs=U(`folder-open`,[[`path`,{d:`m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 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.9H18a2 2 0 0 1 2 2v2`,key:`usdka0`}]]),gs=U(`folder-plus`,[[`path`,{d:`M12 10v6`,key:`1bos4e`}],[`path`,{d:`M9 13h6`,key:`1uhe8q`}],[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),_s=U(`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`}]]),vs=U(`folders`,[[`path`,{d:`M20 5a2 2 0 0 1 2 2v7a2 2 0 0 1-2 2H9a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h2.5a1.5 1.5 0 0 1 1.2.6l.6.8a1.5 1.5 0 0 0 1.2.6z`,key:`a4852j`}],[`path`,{d:`M3 8.268a2 2 0 0 0-1 1.738V19a2 2 0 0 0 2 2h11a2 2 0 0 0 1.732-1`,key:`yxbcw3`}]]),ys=U(`gauge`,[[`path`,{d:`m12 14 4-4`,key:`9kzdfg`}],[`path`,{d:`M3.34 19a10 10 0 1 1 17.32 0`,key:`19p75a`}]]),bs=U(`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`}]]),xs=U(`id-card`,[[`path`,{d:`M16 10h2`,key:`8sgtl7`}],[`path`,{d:`M16 14h2`,key:`epxaof`}],[`path`,{d:`M6.17 15a3 3 0 0 1 5.66 0`,key:`n6f512`}],[`circle`,{cx:`9`,cy:`11`,r:`2`,key:`yxgjnd`}],[`rect`,{x:`2`,y:`5`,width:`20`,height:`14`,rx:`2`,key:`qneu4z`}]]),Ss=U(`inbox`,[[`polyline`,{points:`22 12 16 12 14 15 10 15 8 12 2 12`,key:`o97t9d`}],[`path`,{d:`M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`oot6mr`}]]),Cs=U(`key-round`,[[`path`,{d:`M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z`,key:`1s6t7t`}],[`circle`,{cx:`16.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`w0ekpg`}]]),ws=U(`keyboard`,[[`path`,{d:`M10 8h.01`,key:`1r9ogq`}],[`path`,{d:`M12 12h.01`,key:`1mp3jc`}],[`path`,{d:`M14 8h.01`,key:`1primd`}],[`path`,{d:`M16 12h.01`,key:`1l6xoz`}],[`path`,{d:`M18 8h.01`,key:`emo2bl`}],[`path`,{d:`M6 8h.01`,key:`x9i8wu`}],[`path`,{d:`M7 16h10`,key:`wp8him`}],[`path`,{d:`M8 12h.01`,key:`czm47f`}],[`rect`,{width:`20`,height:`16`,x:`2`,y:`4`,rx:`2`,key:`18n3k1`}]]),Ts=U(`layers`,[[`path`,{d:`M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z`,key:`zw3jo`}],[`path`,{d:`M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12`,key:`1wduqc`}],[`path`,{d:`M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17`,key:`kqbvx6`}]]),Es=U(`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`}]]),Ds=U(`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`}]]),Os=U(`lock`,[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`,key:`1w4ew1`}],[`path`,{d:`M7 11V7a5 5 0 0 1 10 0v4`,key:`fwvmzm`}]]),ks=U(`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`}]]),As=U(`menu`,[[`path`,{d:`M4 5h16`,key:`1tepv9`}],[`path`,{d:`M4 12h16`,key:`1lakjw`}],[`path`,{d:`M4 19h16`,key:`1djgab`}]]),js=U(`minus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]),Ms=U(`monitor`,[[`rect`,{width:`20`,height:`14`,x:`2`,y:`3`,rx:`2`,key:`48i651`}],[`line`,{x1:`8`,x2:`16`,y1:`21`,y2:`21`,key:`1svkeh`}],[`line`,{x1:`12`,x2:`12`,y1:`17`,y2:`21`,key:`vw1qmm`}]]),Ns=U(`moon`,[[`path`,{d:`M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401`,key:`kfwtm`}]]),Ps=U(`notebook-pen`,[[`path`,{d:`M13.4 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-7.4`,key:`re6nr2`}],[`path`,{d:`M2 6h4`,key:`aawbzj`}],[`path`,{d:`M2 10h4`,key:`l0bgd4`}],[`path`,{d:`M2 14h4`,key:`1gsvsf`}],[`path`,{d:`M2 18h4`,key:`1bu2t1`}],[`path`,{d:`M21.378 5.626a1 1 0 1 0-3.004-3.004l-5.01 5.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z`,key:`pqwjuv`}]]),Fs=U(`package-check`,[[`path`,{d:`M12 22V12`,key:`d0xqtd`}],[`path`,{d:`m16 17 2 2 4-4`,key:`uh5qu3`}],[`path`,{d:`M21 11.127V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.729l7 4a2 2 0 0 0 2 .001l1.32-.753`,key:`kpkbpo`}],[`path`,{d:`M3.29 7 12 12l8.71-5`,key:`19ckod`}],[`path`,{d:`m7.5 4.27 8.997 5.148`,key:`9yrvtv`}]]),Is=U(`palette`,[[`path`,{d:`M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z`,key:`e79jfc`}],[`circle`,{cx:`13.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`1okk4w`}],[`circle`,{cx:`17.5`,cy:`10.5`,r:`.5`,fill:`currentColor`,key:`f64h9f`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`.5`,fill:`currentColor`,key:`qy21gx`}],[`circle`,{cx:`8.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`fotxhn`}]]),Ls=U(`play`,[[`path`,{d:`M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z`,key:`10ikf1`}]]),Rs=U(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),zs=U(`scale`,[[`path`,{d:`M12 3v18`,key:`108xh3`}],[`path`,{d:`m19 8 3 8a5 5 0 0 1-6 0zV7`,key:`zcdpyk`}],[`path`,{d:`M3 7h1a17 17 0 0 0 8-2 17 17 0 0 0 8 2h1`,key:`1yorad`}],[`path`,{d:`m5 8 3 8a5 5 0 0 1-6 0zV7`,key:`eua70x`}],[`path`,{d:`M7 21h10`,key:`1b0cd5`}]]),Bs=U(`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`}]]),Vs=U(`shield-check`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),Hs=U(`split`,[[`path`,{d:`M16 3h5v5`,key:`1806ms`}],[`path`,{d:`M8 3H3v5`,key:`15dfkv`}],[`path`,{d:`M12 22v-8.3a4 4 0 0 0-1.172-2.872L3 3`,key:`1qrqzj`}],[`path`,{d:`m15 9 6-6`,key:`ko1vev`}]]),Us=U(`star`,[[`path`,{d:`M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z`,key:`r04s7s`}]]),Ws=U(`sun`,[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]),Gs=U(`ticket`,[[`path`,{d:`M2 9a3 3 0 0 1 0 6v2a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-2a3 3 0 0 1 0-6V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z`,key:`qn84l0`}],[`path`,{d:`M13 5v2`,key:`dyzc3o`}],[`path`,{d:`M13 17v2`,key:`1ont0d`}],[`path`,{d:`M13 11v2`,key:`1wjjxi`}]]),Ks=U(`unplug`,[[`path`,{d:`m19 5 3-3`,key:`yk6iyv`}],[`path`,{d:`m2 22 3-3`,key:`19mgm9`}],[`path`,{d:`M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z`,key:`goz73y`}],[`path`,{d:`M7.5 13.5 10 11`,key:`7xgeeb`}],[`path`,{d:`M10.5 16.5 13 14`,key:`10btkg`}],[`path`,{d:`m12 6 6 6 2.3-2.3a2.4 2.4 0 0 0 0-3.4l-2.6-2.6a2.4 2.4 0 0 0-3.4 0Z`,key:`1snsnr`}]]),qs=U(`workflow`,[[`rect`,{width:`8`,height:`8`,x:`3`,y:`3`,rx:`2`,key:`by2w9f`}],[`path`,{d:`M7 11v4a2 2 0 0 0 2 2h4`,key:`xkn7yn`}],[`rect`,{width:`8`,height:`8`,x:`13`,y:`13`,rx:`2`,key:`1cgmvn`}]]),Js={jira:{label:`Jira`,scopeLabel:`Jira projects`},linear:{label:`Linear`,scopeLabel:`Linear teams`}},Ys=jn.options.map(e=>({kind:e,...Js[e]}));function Xs(e){let t=J.useRef({value:e,previous:e});return J.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var Zs=`Label`,Qs=J.forwardRef((e,t)=>(0,Y.jsx)(H.label,{...e,ref:t,onMouseDown:t=>{t.target.closest(`button, input, select, textarea`)||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));Qs.displayName=Zs;var $s=Qs;function ec(e,[t,n]){return Math.min(n,Math.max(t,e))}var tc=e(r(),1),nc=[` `,`Enter`,`ArrowUp`,`ArrowDown`],rc=[` `,`Enter`],ic=`Select`,[ac,oc,sc]=ja(ic),[cc,lc]=Mn(ic,[sc,da]),uc=da(),[dc,fc]=cc(ic),[pc,mc]=cc(ic),hc=`SelectProvider`;function gc(e){let{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:a,value:o,defaultValue:s,onValueChange:c,dir:l,name:u,autoComplete:d,disabled:f,required:p,form:m,internal_do_not_use_render:h}=e,g=uc(t),[_,v]=J.useState(null),[y,b]=J.useState(null),[x,S]=J.useState(!1),C=wa(l),[w,T]=An({prop:r,defaultProp:i??!1,onChange:a,caller:ic}),[E,D]=An({prop:o,defaultProp:s,onChange:c,caller:ic}),O=J.useRef(null),k=J.useRef(E);J.useEffect(()=>{let e=m?_?.ownerDocument.getElementById(m):_?.form;if(e instanceof HTMLFormElement){let t=()=>D(k.current);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[m,_,D]);let A=!_||!!m||!!_.closest(`form`),[j,M]=J.useState(new Set),N=Qn(),P=Array.from(j).map(e=>e.props.value).join(`;`),F=J.useCallback(e=>{M(t=>new Set(t).add(e))},[]),ee=J.useCallback(e=>{M(t=>{let n=new Set(t);return n.delete(e),n})},[]),te={required:p,trigger:_,onTriggerChange:v,valueNode:y,onValueNodeChange:b,valueNodeHasChildren:x,onValueNodeHasChildrenChange:S,contentId:N,value:E,onValueChange:D,open:w,onOpenChange:T,dir:C,triggerPointerDownPosRef:O,disabled:f,name:u,autoComplete:d,form:m,nativeOptions:j,nativeSelectKey:P,isFormControl:A};return(0,Y.jsx)(ca,{...g,children:(0,Y.jsx)(dc,{scope:t,...te,children:(0,Y.jsx)(ac.Provider,{scope:t,children:(0,Y.jsx)(pc,{scope:t,onNativeOptionAdd:F,onNativeOptionRemove:ee,children:gl(h)?h(te):n})})})})}gc.displayName=hc;var _c=e=>{let{__scopeSelect:t,children:n,...r}=e;return(0,Y.jsx)(gc,{__scopeSelect:t,...r,internal_do_not_use_render:({isFormControl:e})=>(0,Y.jsxs)(Y.Fragment,{children:[n,e?(0,Y.jsx)(hl,{__scopeSelect:t}):null]})})};_c.displayName=ic;var vc=`SelectTrigger`,yc=J.forwardRef((e,t)=>{let{__scopeSelect:n,disabled:r=!1,...i}=e,a=uc(n),o=fc(vc,n),s=o.disabled||r,c=In(t,o.onTriggerChange),l=oc(n),u=J.useRef(`touch`),[d,f,p]=vl(e=>{let t=l().filter(e=>!e.disabled),n=yl(t,e,t.find(e=>e.value===o.value));n!==void 0&&o.onValueChange(n.value)}),m=e=>{s||(o.onOpenChange(!0),p()),e&&(o.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return(0,Y.jsx)(sa,{asChild:!0,...a,children:(0,Y.jsx)(H.button,{type:`button`,role:`combobox`,"aria-controls":o.open?o.contentId:void 0,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":`none`,dir:o.dir,"data-state":o.open?`open`:`closed`,disabled:s,"data-disabled":s?``:void 0,"data-placeholder":_l(o.value)?``:void 0,...i,ref:c,onClick:W(i.onClick,e=>{e.currentTarget.focus(),u.current!==`mouse`&&m(e)}),onPointerDown:W(i.onPointerDown,e=>{u.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&e.pointerType===`mouse`&&(m(e),e.preventDefault())}),onKeyDown:W(i.onKeyDown,e=>{let t=d.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&f(e.key),!(t&&e.key===` `)&&nc.includes(e.key)&&(m(),e.preventDefault())})})})});yc.displayName=vc;var bc=`SelectValue`,xc=J.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,children:a,placeholder:o=``,...s}=e,c=fc(bc,n),{onValueNodeHasChildrenChange:l}=c,u=a!==void 0,d=In(t,c.onValueNodeChange);Zn(()=>{l(u)},[l,u]);let f=_l(c.value);return(0,Y.jsx)(H.span,{...s,asChild:!f&&s.asChild,ref:d,style:{pointerEvents:`none`},children:(0,Y.jsx)(J.Fragment,{children:f?o:a},f?`placeholder`:`value`)})});xc.displayName=bc;var Sc=`SelectIcon`,Cc=J.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,...i}=e;return(0,Y.jsx)(H.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})});Cc.displayName=Sc;var wc=`SelectPortal`,[Tc,Ec]=cc(wc,{forceMount:void 0}),Dc=e=>{let{__scopeSelect:t,forceMount:n,...r}=e;return(0,Y.jsx)(Tc,{scope:e.__scopeSelect,forceMount:n,children:(0,Y.jsx)(Vn,{asChild:!0,...r})})};Dc.displayName=wc;var Oc=`SelectContent`,kc=J.forwardRef((e,t)=>{let n=Ec(Oc,e.__scopeSelect),{forceMount:r=n.forceMount,...i}=e,a=fc(Oc,e.__scopeSelect),[o,s]=J.useState();return Zn(()=>{s(new DocumentFragment)},[]),(0,Y.jsx)(zn,{present:r||a.open,children:({present:e})=>e?(0,Y.jsx)(Ic,{...i,ref:t}):(0,Y.jsx)(Ac,{...i,fragment:o})})});kc.displayName=Oc;var Ac=J.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,fragment:i}=e;return i?tc.createPortal((0,Y.jsx)(Mc,{scope:n,children:(0,Y.jsx)(ac.Slot,{scope:n,children:(0,Y.jsx)(`div`,{ref:t,children:r})})}),i):null});Ac.displayName=`SelectContentFragment`;var jc=10,[Mc,Nc]=cc(Oc),Pc=`SelectContentImpl`,Fc=On(`SelectContent.RemoveScroll`),Ic=J.forwardRef((e,t)=>{let{__scopeSelect:n}=e,{position:r=`item-aligned`,onCloseAutoFocus:i,onEscapeKeyDown:a,onPointerDownOutside:o,side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g,..._}=e,v=fc(Oc,n),[y,b]=J.useState(null),[x,S]=J.useState(null),C=In(t,b),[w,T]=J.useState(null),[E,D]=J.useState(null),O=oc(n),[k,A]=J.useState(!1),j=J.useRef(!1);J.useEffect(()=>{if(y)return qn(y)},[y]),Un();let M=J.useCallback(e=>{let[t,...n]=O().map(e=>e.ref.current),[r]=n.slice(-1),i=document.activeElement;for(let n of e)if(n===i||(n?.scrollIntoView({block:`nearest`}),n===t&&x&&(x.scrollTop=0),n===r&&x&&(x.scrollTop=x.scrollHeight),n?.focus(),document.activeElement!==i))return},[O,x]),N=J.useCallback(()=>M([w,y]),[M,w,y]);J.useEffect(()=>{k&&N()},[k,N]);let{onOpenChange:P,triggerPointerDownPosRef:F}=v;J.useEffect(()=>{if(y){let e={x:0,y:0},t=t=>{e={x:Math.abs(Math.round(t.pageX)-(F.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(F.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():n.composedPath().includes(y)||P(!1),document.removeEventListener(`pointermove`,t),F.current=null};return F.current!==null&&(document.addEventListener(`pointermove`,t),document.addEventListener(`pointerup`,n,{capture:!0,once:!0})),()=>{document.removeEventListener(`pointermove`,t),document.removeEventListener(`pointerup`,n,{capture:!0})}}},[y,P,F]),J.useEffect(()=>{let e=()=>P(!1);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[P]);let[ee,te]=vl(e=>{let t=O().filter(e=>!e.disabled),n=yl(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current?.focus())}),ne=J.useCallback((e,t,n)=>{let r=!j.current&&!n;(v.value!==void 0&&v.value===t||r)&&(T(e),r&&(j.current=!0))},[v.value]),re=J.useCallback(()=>y?.focus(),[y]),ie=J.useCallback((e,t,n)=>{let r=!j.current&&!n;(v.value!==void 0&&v.value===t||r)&&D(e)},[v.value]),ae=r===`popper`?Bc:Rc,oe=ae===Bc?{side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g}:{};return(0,Y.jsx)(Mc,{scope:n,content:y,viewport:x,onViewportChange:S,itemRefCallback:ne,selectedItem:w,onItemLeave:re,itemTextRefCallback:ie,focusSelectedItem:N,selectedItemText:E,position:r,isPositioned:k,searchRef:ee,children:(0,Y.jsx)(Wn,{as:Fc,allowPinchZoom:!0,children:(0,Y.jsx)(Xn,{asChild:!0,trapped:v.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:W(i,e=>{v.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,Y.jsx)($n,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>v.onOpenChange(!1),children:(0,Y.jsx)(ae,{role:`listbox`,id:v.contentId,"data-state":v.open?`open`:`closed`,dir:v.dir,onContextMenu:e=>e.preventDefault(),..._,...oe,onPlaced:()=>A(!0),ref:C,style:{display:`flex`,flexDirection:`column`,outline:`none`,..._.style},onKeyDown:W(_.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&te(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=O().filter(e=>!e.disabled).map(e=>e.ref.current);if([`ArrowUp`,`End`].includes(e.key)&&(t=t.slice().reverse()),[`ArrowUp`,`ArrowDown`].includes(e.key)){let n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>M(t)),e.preventDefault()}})})})})})})});Ic.displayName=Pc;var Lc=`SelectItemAlignedPosition`,Rc=J.forwardRef((e,t)=>{let{__scopeSelect:n,onPlaced:r,...i}=e,a=fc(Oc,n),o=Nc(Oc,n),[s,c]=J.useState(null),[l,u]=J.useState(null),d=In(t,u),f=oc(n),p=J.useRef(!1),m=J.useRef(!0),{viewport:h,selectedItem:g,selectedItemText:_,focusSelectedItem:v}=o,y=J.useCallback(()=>{if(a.trigger&&a.valueNode&&s&&l&&h&&g&&_){let e=a.trigger.getBoundingClientRect(),t=l.getBoundingClientRect(),n=a.valueNode.getBoundingClientRect(),i=_.getBoundingClientRect();if(a.dir!==`rtl`){let r=i.left-t.left,a=n.left-r,o=e.left-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-jc,d=ec(a,[jc,Math.max(jc,u-l)]);s.style.minWidth=c+`px`,s.style.left=d+`px`}else{let r=t.right-i.right,a=window.innerWidth-n.right-r,o=window.innerWidth-e.right-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-jc,d=ec(a,[jc,Math.max(jc,u-l)]);s.style.minWidth=c+`px`,s.style.right=d+`px`}let o=f(),c=window.innerHeight-jc*2,u=h.scrollHeight,d=window.getComputedStyle(l),m=parseInt(d.borderTopWidth,10),v=parseInt(d.paddingTop,10),y=parseInt(d.borderBottomWidth,10),b=parseInt(d.paddingBottom,10),x=m+v+u+b+y,S=Math.min(g.offsetHeight*5,x),C=window.getComputedStyle(h),w=parseInt(C.paddingTop,10),T=parseInt(C.paddingBottom,10),E=e.top+e.height/2-jc,D=c-E,O=g.offsetHeight/2,k=g.offsetTop+O,A=m+v+k,j=x-A;if(A<=E){let e=o.length>0&&g===o[o.length-1].ref.current;s.style.bottom=`0px`;let t=l.clientHeight-h.offsetTop-h.offsetHeight,n=A+Math.max(D,O+(e?T:0)+t+y);s.style.height=n+`px`}else{let e=o.length>0&&g===o[0].ref.current;s.style.top=`0px`;let t=Math.max(E,m+h.offsetTop+(e?w:0)+O)+j;s.style.height=t+`px`,h.scrollTop=A-E+h.offsetTop}s.style.margin=`${jc}px 0`,s.style.minHeight=S+`px`,s.style.maxHeight=c+`px`,r?.(),requestAnimationFrame(()=>p.current=!0)}},[f,a.trigger,a.valueNode,s,l,h,g,_,a.dir,r]);Zn(()=>y(),[y]);let[b,x]=J.useState();return Zn(()=>{l&&x(window.getComputedStyle(l).zIndex)},[l]),(0,Y.jsx)(Vc,{scope:n,contentWrapper:s,shouldExpandOnScrollRef:p,onScrollButtonChange:J.useCallback(e=>{e&&m.current===!0&&(y(),v?.(),m.current=!1)},[y,v]),children:(0,Y.jsx)(`div`,{ref:c,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:b},children:(0,Y.jsx)(H.div,{...i,ref:d,style:{boxSizing:`border-box`,maxHeight:`100%`,...i.style}})})})});Rc.displayName=Lc;var zc=`SelectPopperPosition`,Bc=J.forwardRef((e,t)=>{let{__scopeSelect:n,align:r=`start`,collisionPadding:i=jc,...a}=e,o=uc(n);return(0,Y.jsx)(ga,{...o,...a,ref:t,align:r,collisionPadding:i,style:{boxSizing:`border-box`,...a.style,"--radix-select-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-select-content-available-width":`var(--radix-popper-available-width)`,"--radix-select-content-available-height":`var(--radix-popper-available-height)`,"--radix-select-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-select-trigger-height":`var(--radix-popper-anchor-height)`}})});Bc.displayName=zc;var[Vc,Hc]=cc(Oc,{}),Uc=`SelectViewport`,Wc=J.forwardRef((e,t)=>{let{__scopeSelect:n,nonce:r,...i}=e,a=Nc(Uc,n),o=Hc(Uc,n),s=In(t,a.onViewportChange),c=J.useRef(0);return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}`},nonce:r}),(0,Y.jsx)(ac.Slot,{scope:n,children:(0,Y.jsx)(H.div,{"data-radix-select-viewport":``,role:`presentation`,...i,ref:s,style:{position:`relative`,flex:1,overflow:`hidden auto`,...i.style},onScroll:W(i.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=o;if(r?.current&&n){let e=Math.abs(c.current-t.scrollTop);if(e>0){let r=window.innerHeight-jc*2,i=parseFloat(n.style.minHeight),a=parseFloat(n.style.height),o=Math.max(i,a);if(o<r){let i=o+e,a=Math.min(r,i),s=i-a;n.style.height=a+`px`,n.style.bottom===`0px`&&(t.scrollTop=s>0?s:0,n.style.justifyContent=`flex-end`)}}}c.current=t.scrollTop})})})]})});Wc.displayName=Uc;var Gc=`SelectGroup`,[Kc,qc]=cc(Gc),Jc=J.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=Qn();return(0,Y.jsx)(Kc,{scope:n,id:i,children:(0,Y.jsx)(H.div,{role:`group`,"aria-labelledby":i,...r,ref:t})})});Jc.displayName=Gc;var Yc=`SelectLabel`,Xc=J.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=qc(Yc,n);return(0,Y.jsx)(H.div,{id:i.id,...r,ref:t})});Xc.displayName=Yc;var Zc=`SelectItem`,[Qc,$c]=cc(Zc),el=J.forwardRef((e,t)=>{let{__scopeSelect:n,value:r,disabled:i=!1,textValue:a,...o}=e,s=fc(Zc,n),c=Nc(Zc,n),l=s.value===r,[u,d]=J.useState(a??``),[f,p]=J.useState(!1),m=In(t,Hn(e=>c.itemRefCallback?.(e,r,i))),h=Qn(),g=J.useRef(`touch`),_=()=>{i||(s.onValueChange(r),s.onOpenChange(!1))};return(0,Y.jsx)(Qc,{scope:n,value:r,disabled:i,textId:h,isSelected:l,onItemTextChange:J.useCallback(e=>{d(t=>t||(e?.textContent??``).trim())},[]),children:(0,Y.jsx)(ac.ItemSlot,{scope:n,value:r,disabled:i,textValue:u,children:(0,Y.jsx)(H.div,{role:`option`,"aria-labelledby":h,"data-highlighted":f?``:void 0,"aria-selected":l&&f,"data-state":l?`checked`:`unchecked`,"aria-disabled":i||void 0,"data-disabled":i?``:void 0,tabIndex:i?void 0:-1,...o,ref:m,onFocus:W(o.onFocus,()=>p(!0)),onBlur:W(o.onBlur,()=>p(!1)),onClick:W(o.onClick,()=>{g.current!==`mouse`&&_()}),onPointerUp:W(o.onPointerUp,()=>{g.current===`mouse`&&_()}),onPointerDown:W(o.onPointerDown,e=>{g.current=e.pointerType}),onPointerMove:W(o.onPointerMove,e=>{g.current=e.pointerType,i?c.onItemLeave?.():g.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:W(o.onPointerLeave,e=>{e.currentTarget===document.activeElement&&c.onItemLeave?.()}),onKeyDown:W(o.onKeyDown,e=>{i||e.target!==e.currentTarget||c.searchRef?.current!==``&&e.key===` `||(rc.includes(e.key)&&_(),e.key===` `&&e.preventDefault())})})})})});el.displayName=Zc;var tl=`SelectItemText`,nl=J.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,...a}=e,o=fc(tl,n),s=Nc(tl,n),c=$c(tl,n),l=mc(tl,n),[u,d]=J.useState(null),f=Hn(e=>s.itemTextRefCallback?.(e,c.value,c.disabled)),p=In(t,d,c.onItemTextChange,f),m=u?.textContent,h=J.useMemo(()=>(0,Y.jsx)(`option`,{value:c.value,disabled:c.disabled,children:m},c.value),[c.disabled,c.value,m]),{onNativeOptionAdd:g,onNativeOptionRemove:_}=l;return Zn(()=>(g(h),()=>_(h)),[g,_,h]),(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(H.span,{id:c.textId,...a,ref:p}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren&&!_l(o.value)?tc.createPortal(a.children,o.valueNode):null]})});nl.displayName=tl;var rl=`SelectItemIndicator`,il=J.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return $c(rl,n).isSelected?(0,Y.jsx)(H.span,{"aria-hidden":!0,...r,ref:t}):null});il.displayName=rl;var al=`SelectScrollUpButton`,ol=J.forwardRef((e,t)=>{let n=Nc(al,e.__scopeSelect),r=Hc(al,e.__scopeSelect),[i,a]=J.useState(!1),o=In(t,r.onScrollButtonChange);return Zn(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollTop>0;a(e)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,Y.jsx)(ll,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null});ol.displayName=al;var sl=`SelectScrollDownButton`,cl=J.forwardRef((e,t)=>{let n=Nc(sl,e.__scopeSelect),r=Hc(sl,e.__scopeSelect),[i,a]=J.useState(!1),o=In(t,r.onScrollButtonChange);return Zn(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight,n=Math.ceil(t.scrollTop)<e;a(n)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,Y.jsx)(ll,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null});cl.displayName=sl;var ll=J.forwardRef((e,t)=>{let{__scopeSelect:n,onAutoScroll:r,...i}=e,a=Nc(`SelectScrollButton`,n),o=J.useRef(null),s=oc(n),c=J.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return J.useEffect(()=>()=>c(),[c]),Zn(()=>{s().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[s]),(0,Y.jsx)(H.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:W(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:W(i.onPointerMove,()=>{a.onItemLeave?.(),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:W(i.onPointerLeave,()=>{c()})})}),ul=`SelectSeparator`,dl=J.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return(0,Y.jsx)(H.div,{"aria-hidden":!0,...r,ref:t})});dl.displayName=ul;var fl=`SelectArrow`,pl=J.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=uc(n);return Nc(fl,n).position===`popper`?(0,Y.jsx)(pa,{...i,...r,ref:t}):null});pl.displayName=fl;var ml=`SelectBubbleInput`,hl=J.forwardRef(({__scopeSelect:e,...t},n)=>{let r=fc(ml,e),{value:i,onValueChange:a,required:o,disabled:s,name:c,autoComplete:l,form:u}=r,{nativeOptions:d,nativeSelectKey:f}=r,p=J.useRef(null),m=In(n,p),h=i??``,g=Xs(h),_=Array.from(d).some(e=>(e.props.value??``)===``);return J.useEffect(()=>{let e=p.current;if(!e)return;let t=window.HTMLSelectElement.prototype,n=Object.getOwnPropertyDescriptor(t,`value`).set;if(g!==h&&n){let t=new Event(`change`,{bubbles:!0});n.call(e,h),e.dispatchEvent(t)}},[g,h]),(0,Y.jsxs)(H.select,{"aria-hidden":!0,required:o,tabIndex:-1,name:c,autoComplete:l,disabled:s,form:u,onChange:e=>a(e.target.value),...t,style:{...la,...t.style},ref:m,defaultValue:h,children:[_l(i)&&!_?(0,Y.jsx)(`option`,{value:``}):null,Array.from(d)]},f)});hl.displayName=ml;function gl(e){return typeof e==`function`}function _l(e){return e===``||e===void 0}function vl(e){let t=Hn(e),n=J.useRef(``),r=J.useRef(0),i=J.useCallback(e=>{let i=n.current+e;t(i),(function e(t){n.current=t,window.clearTimeout(r.current),t!==``&&(r.current=window.setTimeout(()=>e(``),1e3))})(i)},[t]),a=J.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return J.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}function yl(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=bl(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.textValue.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function bl(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var xl=`Switch`,[Sl,Cl]=Mn(xl),[wl,Tl]=Sl(xl);function El(e){let{__scopeSwitch:t,checked:n,children:r,defaultChecked:i,disabled:a,form:o,name:s,onCheckedChange:c,required:l,value:u=`on`,internal_do_not_use_render:d}=e,[f,p]=An({prop:n,defaultProp:i??!1,onChange:c,caller:xl}),[m,h]=J.useState(null),[g,_]=J.useState(null),v={checked:f,setChecked:p,disabled:a,control:m,setControl:h,name:s,form:o,value:u,hasConsumerStoppedPropagationRef:J.useRef(!1),required:l,defaultChecked:i,isFormControl:!m||!!o||!!m.closest(`form`),bubbleInput:g,setBubbleInput:_};return(0,Y.jsx)(wl,{scope:t,...v,children:Pl(d)?d(v):r})}var Dl=`SwitchTrigger`,Ol=J.forwardRef(({__scopeSwitch:e,onClick:t,...n},r)=>{let{control:i,form:a,value:o,disabled:s,checked:c,required:l,setControl:u,setChecked:d,hasConsumerStoppedPropagationRef:f,isFormControl:p,bubbleInput:m}=Tl(Dl,e),h=In(r,u),g=J.useRef(c);return J.useEffect(()=>{let e=a?i?.ownerDocument.getElementById(a):i?.form;if(e instanceof HTMLFormElement){let t=()=>d(g.current);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[i,a,d]),(0,Y.jsx)(H.button,{type:`button`,role:`switch`,"aria-checked":c,"aria-required":l,"data-state":Fl(c),"data-disabled":s?``:void 0,disabled:s,value:o,...n,ref:h,onClick:W(t,e=>{d(e=>!e),m&&p&&(f.current=e.isPropagationStopped(),f.current||e.stopPropagation())})})});Ol.displayName=Dl;var kl=J.forwardRef((e,t)=>{let{__scopeSwitch:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c,onCheckedChange:l,form:u,...d}=e;return(0,Y.jsx)(El,{__scopeSwitch:n,checked:i,defaultChecked:a,disabled:s,required:o,onCheckedChange:l,name:r,form:u,value:c,internal_do_not_use_render:({isFormControl:e})=>(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Ol,{...d,ref:t,__scopeSwitch:n}),e&&(0,Y.jsx)(Nl,{__scopeSwitch:n})]})})});kl.displayName=xl;var Al=`SwitchThumb`,jl=J.forwardRef((e,t)=>{let{__scopeSwitch:n,...r}=e,i=Tl(Al,n);return(0,Y.jsx)(H.span,{"data-state":Fl(i.checked),"data-disabled":i.disabled?``:void 0,...r,ref:t})});jl.displayName=Al;var Ml=`SwitchBubbleInput`,Nl=J.forwardRef(({__scopeSwitch:e,...t},n)=>{let{control:r,hasConsumerStoppedPropagationRef:i,checked:a,defaultChecked:o,required:s,disabled:c,name:l,value:u,form:d,bubbleInput:f,setBubbleInput:p}=Tl(Ml,e),m=In(n,p),h=Xs(a),g=va(r);J.useEffect(()=>{let e=f;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set,r=!i.current;if(h!==a&&n){let t=new Event(`click`,{bubbles:r});n.call(e,a),e.dispatchEvent(t)}},[f,h,a,i]);let _=J.useRef(a);return(0,Y.jsx)(H.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:o??_.current,required:s,disabled:c,name:l,value:u,form:d,...t,tabIndex:-1,ref:m,style:{...t.style,...g,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})});Nl.displayName=Ml;function Pl(e){return typeof e==`function`}function Fl(e){return e?`checked`:`unchecked`}var Il=`Tabs`,[Ll,Rl]=Mn(Il,[Ca]),zl=Ca(),[Bl,Vl]=Ll(Il),Hl=J.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,onValueChange:i,defaultValue:a,orientation:o=`horizontal`,dir:s,activationMode:c=`automatic`,...l}=e,u=wa(s),[d,f]=An({prop:r,onChange:i,defaultProp:a??``,caller:Il});return(0,Y.jsx)(Bl,{scope:n,baseId:Qn(),value:d,onValueChange:f,orientation:o,dir:u,activationMode:c,children:(0,Y.jsx)(H.div,{dir:u,"data-orientation":o,...l,ref:t})})});Hl.displayName=Il;var Ul=`TabsList`,Wl=J.forwardRef((e,t)=>{let{__scopeTabs:n,loop:r=!0,...i}=e,a=Vl(Ul,n),o=zl(n);return(0,Y.jsx)(Fa,{asChild:!0,...o,orientation:a.orientation,dir:a.dir,loop:r,children:(0,Y.jsx)(H.div,{role:`tablist`,"aria-orientation":a.orientation,...i,ref:t})})});Wl.displayName=Ul;var Gl=`TabsTrigger`,Kl=J.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,disabled:i=!1,...a}=e,o=Vl(Gl,n),s=zl(n),c=Yl(o.baseId,r),l=Xl(o.baseId,r),u=r===o.value;return(0,Y.jsx)(Oa,{asChild:!0,...s,focusable:!i,active:u,children:(0,Y.jsx)(H.button,{type:`button`,role:`tab`,"aria-selected":u,"aria-controls":l,"data-state":u?`active`:`inactive`,"data-disabled":i?``:void 0,disabled:i,id:c,...a,ref:t,onMouseDown:W(e.onMouseDown,e=>{!i&&e.button===0&&e.ctrlKey===!1?o.onValueChange(r):e.preventDefault()}),onKeyDown:W(e.onKeyDown,e=>{i||e.target!==e.currentTarget||[` `,`Enter`].includes(e.key)&&o.onValueChange(r)}),onFocus:W(e.onFocus,()=>{let e=o.activationMode!==`manual`;!u&&!i&&e&&o.onValueChange(r)})})})});Kl.displayName=Gl;var ql=`TabsContent`,Jl=J.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,forceMount:i,children:a,...o}=e,s=Vl(ql,n),c=Yl(s.baseId,r),l=Xl(s.baseId,r),u=r===s.value,d=J.useRef(u);return J.useEffect(()=>{let e=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,Y.jsx)(zn,{present:i||u,children:({present:n})=>(0,Y.jsx)(H.div,{"data-state":u?`active`:`inactive`,"data-orientation":s.orientation,role:`tabpanel`,"aria-labelledby":c,hidden:!n,id:l,tabIndex:0,...o,ref:t,style:{...e.style,animationDuration:d.current?`0s`:void 0},children:n&&a})})});Jl.displayName=ql;function Yl(e,t){return`${e}-trigger-${t}`}function Xl(e,t){return`${e}-content-${t}`}var Zl=Hl,Ql=Wl,$l=Kl,eu=Jl,tu=Rn(`inline-flex w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-full border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 [&>svg]:pointer-events-none [&>svg]:size-3`,{variants:{variant:{default:`bg-primary text-primary-foreground [a&]:hover:bg-primary/90`,secondary:`bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90`,destructive:`bg-destructive text-destructive-foreground focus-visible:ring-destructive/20 [a&]:hover:bg-destructive/90`,outline:`border-border text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground`,ghost:`[a&]:hover:bg-accent [a&]:hover:text-accent-foreground`,link:`text-primary underline-offset-4 [a&]:hover:underline`}},defaultVariants:{variant:`default`}});function X({className:e,variant:t=`default`,asChild:n=!1,...r}){return(0,Y.jsx)(n?Kn:`span`,{"data-slot":`badge`,"data-variant":t,className:G(tu({variant:t}),e),...r})}var nu=`x-apple.systempreferences:com.apple.preference.security?Privacy_FilesAndFolders`,ru=`inline-flex items-center gap-1 rounded-md border border-border px-2 py-1 text-foreground hover:bg-muted`;function iu(e){let t=e.replace(/[\\/]+$/,``),n=Math.max(t.lastIndexOf(`/`),t.lastIndexOf(`\\`));return n<0?null:n===0?t.slice(0,1):t.slice(0,n)}function au({path:e,selected:t,onSelect:n,onEnter:r,decorate:i,emptyHint:a,showHidden:o=!1}){let s=ne(e,o),c=s.data?.parent??null;return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`p`,{"data-slot":`fs-breadcrumb`,className:`truncate font-mono text-[11.5px] text-soft-foreground`,title:s.data?.path??void 0,children:s.data?.path??(s.isError?``:`Loading…`)}),s.isError?(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:[(0,Y.jsx)(`p`,{"data-slot":`fs-error`,className:`min-w-0 break-words text-[13px] text-danger`,children:s.error instanceof Error?s.error.message:`could not list that folder`}),s.error instanceof Ae&&s.error.status===403?(0,Y.jsx)(`p`,{"data-slot":`fs-privacy-hint`,className:`text-[12.5px] text-soft-foreground`,children:`Allow it under Privacy & Security ▸ Files & Folders, then try again.`}):null,(0,Y.jsxs)(`div`,{className:`flex flex-wrap gap-2 text-[12.5px]`,children:[e!==null&&iu(e)!==null?(0,Y.jsxs)(`button`,{type:`button`,"data-slot":`fs-error-back`,onClick:()=>r(iu(e)),className:ru,children:[(0,Y.jsx)(us,{className:`size-3.5`,"aria-hidden":!0}),`Back`]}):null,s.error instanceof Ae&&s.error.status===403?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`a`,{"data-slot":`fs-privacy-settings`,href:nu,target:`_blank`,rel:`noreferrer`,className:ru,children:`Open Privacy Settings`}),(0,Y.jsx)(`button`,{type:`button`,"data-slot":`fs-retry`,onClick:()=>void s.refetch(),className:ru,children:`Try again`})]}):null]})]}):(0,Y.jsxs)(`ul`,{"data-slot":`fs-listing`,className:`max-h-64 divide-y divide-border/60 overflow-y-auto overscroll-contain rounded-md border border-border`,children:[c===null?null:(0,Y.jsx)(`li`,{className:`flex`,children:(0,Y.jsxs)(`button`,{type:`button`,"data-slot":`fs-up`,onClick:()=>r(c),className:`flex flex-1 items-center gap-2 px-3 py-2 text-left text-[13px] hover:bg-muted`,children:[(0,Y.jsx)(us,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),`Up one level`]})}),(s.data?.dirs??[]).map(e=>(0,Y.jsxs)(`li`,{className:`flex items-stretch`,children:[(0,Y.jsxs)(`button`,{type:`button`,"data-slot":`fs-dir`,"aria-pressed":t?.path===e.path,onClick:()=>n(e),onDoubleClick:()=>r(e.path),className:G(`flex min-w-0 flex-1 items-center gap-2 px-3 py-2 text-left text-[13px] hover:bg-muted`,t?.path===e.path&&`bg-muted`),children:[(0,Y.jsx)(Ea,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),(0,Y.jsx)(`span`,{className:`truncate`,children:e.name}),i?.(e)]}),(0,Y.jsx)(`button`,{type:`button`,"data-slot":`fs-enter`,"aria-label":`Open ${e.name}`,onClick:()=>r(e.path),className:`flex shrink-0 items-center px-2.5 text-muted-foreground hover:bg-muted hover:text-foreground`,children:(0,Y.jsx)(ya,{className:`size-3.5`,"aria-hidden":`true`})})]},e.path)),s.data&&s.data.dirs.length===0?(0,Y.jsx)(`li`,{className:`px-3 py-2 text-[13px] text-muted-foreground`,children:a}):null]}),s.data?.truncated?(0,Y.jsx)(`p`,{"data-slot":`fs-truncated`,className:`text-[11.5px] text-muted-foreground`,children:`Too many folders to list — only the first ones are shown.`}):null]})}function ou(e,t,n=!1){let r=ne(e,n);return t?.path??r.data?.path??null}function su({open:e,onOpenChange:t}){let[n,r]=(0,J.useState)(null),[i,a]=(0,J.useState)(null),o=ln(),s=pn(),c=de(),l=new Set((o.data?.projects??[]).filter(e=>!e.unregistered).map(e=>e.root)),u=e=>{r(e),a(null),s.reset()},d=ou(n,i);return(0,Y.jsx)(xi,{open:e,onOpenChange:t,children:(0,Y.jsxs)(Oi,{"data-slot":`add-project-dialog`,className:`sm:max-w-lg`,children:[(0,Y.jsxs)(Si,{children:[(0,Y.jsx)(_i,{children:`Open local folder`}),(0,Y.jsx)(Ei,{children:`Pick the folder cezar should run in. Git repos are marked; any folder works.`})]}),(0,Y.jsx)(au,{path:n,selected:i,onSelect:a,onEnter:u,emptyHint:`No subfolders here — “Add project” registers this folder.`,decorate:e=>(0,Y.jsxs)(Y.Fragment,{children:[e.isRepo?(0,Y.jsx)(X,{variant:`outline`,className:`shrink-0 text-[10px]`,children:`git`}):null,l.has(e.path)?(0,Y.jsx)(X,{variant:`ghost`,className:`shrink-0 text-[10px] text-muted-foreground`,children:`already added`}):null]})}),s.isError?(0,Y.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,Y.jsxs)(Ci,{className:`min-w-0 sm:items-center sm:justify-between`,children:[(0,Y.jsx)(`span`,{"data-slot":`add-project-target`,className:`min-w-0 truncate font-mono text-[11.5px] text-muted-foreground`,title:d??void 0,children:d??``}),(0,Y.jsxs)(`span`,{className:`flex shrink-0 gap-2`,children:[(0,Y.jsx)(K,{variant:`outline`,onClick:()=>t(!1),children:`Cancel`}),(0,Y.jsx)(K,{"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 cu({className:e,type:t,...n}){return(0,Y.jsx)(`input`,{type:t,"data-slot":`input`,className:G(`h-9 w-full min-w-0 rounded-md border border-input bg-card px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none selection:bg-primary selection:text-primary-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 lu({className:e,...t}){return(0,Y.jsx)($s,{"data-slot":`label`,className:G(`flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50`,e),...t})}function uu(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 du({open:e,onOpenChange:t}){let[n,r]=(0,J.useState)(``),[i,a]=(0,J.useState)(``),[o,s]=(0,J.useState)(null),[c,l]=(0,J.useState)(!1),u=(0,J.useRef)(!1),d=ln(),f=_n(),{mutate:p,isPending:m}=f,h=de(),g=uu(f.error),_=(0,J.useMemo)(()=>`co-${Math.random().toString(36).slice(2)}-${Date.now().toString(36)}`,[]),v=(0,J.useRef)(_);v.current=_,(0,J.useEffect)(()=>ar((e,t)=>{if(e!==`checkout-progress`)return;let n=t;n?.checkoutId===v.current&&(n.phase===`cloning`&&n.line?s(n.line):n.phase!==`cloning`&&s(null))}),[]);let y=(0,J.useMemo)(()=>{let e=n.trim().replace(/\/+$/,``).replace(/\.git$/,``).split(`/`).pop()??``;return e.includes(`:`)?e.split(`:`).pop()??``:e},[n]),b=i.trim()===``?y:i.trim(),x=d.data?.projectsDir??``,S=b===``?``:`${x.replace(/\/+$/,``)}/${b}`,C=(0,J.useCallback)(()=>{n.trim()===``||m||(u.current=!1,l(!1),s(null),p({url:n.trim(),checkoutId:_,...i.trim()===``?{}:{name:i.trim()}},{onSuccess:({project:e})=>{t(!1),h(`/p/${encodeURIComponent(e.id)}/`)}}))},[p,m,_,i,h,t,n]);return(0,J.useEffect)(()=>{if(!c)return;let e=()=>{u.current&&(u.current=!1,l(!1),C())},t=()=>{document.visibilityState===`visible`&&e()};return window.addEventListener(`focus`,e),document.addEventListener(`visibilitychange`,t),()=>{window.removeEventListener(`focus`,e),document.removeEventListener(`visibilitychange`,t)}},[c,C]),(0,Y.jsx)(xi,{open:e,onOpenChange:e=>f.isPending?void 0:t(e),children:(0,Y.jsxs)(Oi,{"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,Y.jsxs)(Si,{children:[(0,Y.jsx)(_i,{children:`Clone from GitHub`}),(0,Y.jsxs)(Ei,{children:[`The service clones with `,(0,Y.jsx)(`code`,{children:`gh`}),` into your checkout root and adds the result as a project.`]})]}),(0,Y.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,Y.jsx)(lu,{htmlFor:`clone-url`,children:`Repository`}),(0,Y.jsx)(cu,{id:`clone-url`,"data-slot":`clone-url`,autoFocus:!0,placeholder:`owner/repo or https://github.com/owner/repo`,value:n,disabled:f.isPending,onChange:e=>r(e.target.value),onKeyDown:e=>{e.key===`Enter`&&C()}})]}),(0,Y.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,Y.jsx)(lu,{htmlFor:`clone-name`,children:`Folder name`}),(0,Y.jsx)(cu,{id:`clone-name`,"data-slot":`clone-name`,placeholder:y===``?`repo`:y,value:i,disabled:f.isPending,onChange:e=>a(e.target.value)}),(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1`,children:[(0,Y.jsx)(`p`,{"data-slot":`clone-target`,className:`min-w-0 flex-1 truncate font-mono text-[11.5px] text-soft-foreground`,title:S,children:S}),f.isPending?(0,Y.jsx)(K,{"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,Y.jsx)(Bs,{className:`size-3.5`,"aria-hidden":`true`})}):(0,Y.jsx)(K,{asChild:!0,variant:`ghost`,size:`icon-sm`,className:`size-7`,children:(0,Y.jsx)(ke,{to:`/settings/global/projects`,"data-slot":`clone-root-settings`,"aria-label":`Edit checkout root`,title:`Edit checkout root`,children:(0,Y.jsx)(Bs,{className:`size-3.5`,"aria-hidden":`true`})})})]})]}),f.isPending?(0,Y.jsx)(`p`,{"data-slot":`clone-progress`,className:`truncate font-mono text-[11.5px] text-muted-foreground`,children:o??`Starting the clone…`}):null,f.isError?(0,Y.jsx)(`div`,{"data-slot":`clone-error`,className:`grid min-w-0 gap-1.5 text-[13px] text-danger`,children:g?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`p`,{children:`GitHub requires SAML authorization for this organization.`}),(0,Y.jsxs)(`p`,{children:[(0,Y.jsx)(`a`,{"data-slot":`clone-sso-link`,className:`font-medium underline underline-offset-2`,href:g,target:`_blank`,rel:`noreferrer`,onClick:()=>{u.current=!0,l(!0)},children:`Authorize this GitHub organization`}),c?` — return here after authorizing, or choose Retry clone.`:` — return to this tab to retry, or choose Retry clone.`]}),(0,Y.jsxs)(`details`,{className:`min-w-0`,children:[(0,Y.jsx)(`summary`,{children:`Error details`}),(0,Y.jsx)(`p`,{className:`whitespace-pre-wrap break-all`,children:f.error instanceof Error?f.error.message:null})]})]}):(0,Y.jsx)(`p`,{className:`min-w-0 whitespace-pre-wrap break-all`,children:f.error instanceof Error?f.error.message:`could not clone that repository`})}):null,(0,Y.jsxs)(Ci,{children:[(0,Y.jsx)(K,{variant:`outline`,disabled:f.isPending,onClick:()=>t(!1),children:`Cancel`}),(0,Y.jsx)(K,{"data-slot":`clone-confirm`,disabled:n.trim()===``||b===``||f.isPending,onClick:C,children:f.isPending?`Cloning…`:f.isError?`Retry clone`:`Clone`})]})]})})}function fu({className:e,size:t=`default`,...n}){return(0,Y.jsx)(kl,{"data-slot":`switch`,"data-size":t,className:G(`peer group/switch inline-flex shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-[1.15rem] data-[size=default]:w-8 data-[size=sm]:h-3.5 data-[size=sm]:w-6 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input`,e),...n,children:(0,Y.jsx)(jl,{"data-slot":`switch-thumb`,className:G(`pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0`)})})}var pu=[{slug:`github/codespaces-nextjs`,label:`Next.js`,description:`Minimal Next.js app (GitHub)`},{slug:`vercel/ai-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 mu(e){let t=e.trim().toLowerCase();return t===``||pu.some(e=>e.slug.toLowerCase()===t)?pu:pu.filter(e=>[e.label,e.slug,e.description].some(e=>e.toLowerCase().includes(t)))}function hu({value:e,onChange:t,disabled:n,id:r}){let[i,a]=(0,J.useState)(-1),o=(0,J.useId)(),s=mu(e),c=(0,J.useRef)(null),l=e.trim();(0,J.useEffect)(()=>{i<0||c.current?.querySelector(`[data-index="${i}"]`)?.scrollIntoView?.({block:`nearest`})},[i]),(0,J.useEffect)(()=>{c.current?.querySelector(`[aria-selected="true"]`)?.scrollIntoView?.({block:`nearest`})},[l]);let u=e=>{n||(t(e),a(-1))};return(0,Y.jsxs)(`div`,{className:`grid gap-2 md:flex md:min-h-0 md:flex-1 md:flex-col`,children:[(0,Y.jsx)(cu,{id:r,"data-slot":`create-template`,role:`combobox`,"aria-expanded":s.length>0,"aria-controls":o,"aria-autocomplete":`list`,"aria-activedescendant":i>=0?`${o}-${i}`:void 0,autoComplete:`off`,placeholder:`Search, or paste owner/repo or a URL`,value:e,disabled:n,onBlur:()=>a(-1),onChange:e=>{t(e.target.value),a(-1)},onKeyDown:e=>{if(e.key===`ArrowDown`||e.key===`ArrowUp`){e.preventDefault();let t=e.key===`ArrowDown`?1:-1;a(e=>s.length===0?-1:(e+t+s.length)%s.length)}else if(e.key===`Enter`&&i>=0){e.preventDefault();let t=s[i];t&&u(t.slug)}}}),s.length>0?(0,Y.jsx)(`ul`,{ref:c,id:o,role:`listbox`,"aria-label":`Suggested templates`,"aria-disabled":n||void 0,"data-slot":`create-template-suggestions`,className:G(`max-h-56 overflow-y-auto overscroll-contain rounded-md border border-border p-1`,`md:max-h-none md:min-h-36 md:flex-1`,n?`pointer-events-none opacity-50`:void 0),children:s.map((e,t)=>{let n=e.slug===l;return(0,Y.jsxs)(`li`,{id:`${o}-${t}`,role:`option`,"aria-selected":n,"data-index":t,"data-slot":`create-template-suggestion`,"data-template":e.slug,onMouseDown:e=>e.preventDefault(),onClick:()=>u(e.slug),onMouseEnter:()=>a(t),onMouseLeave:()=>a(-1),className:G(`grid cursor-pointer gap-0.5 rounded-sm border px-2 py-1.5`,n?`border-primary bg-primary/5`:`border-transparent`,t===i&&!n?`bg-accent text-accent-foreground`:void 0),children:[(0,Y.jsxs)(`span`,{className:`flex min-w-0 items-baseline justify-between gap-2`,children:[(0,Y.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1.5 text-sm font-medium`,children:[e.label,n?(0,Y.jsx)(ba,{className:`size-3.5 shrink-0 text-primary`,"aria-hidden":`true`}):null]}),(0,Y.jsx)(`span`,{className:`min-w-0 truncate text-[11px] text-muted-foreground`,children:e.description})]}),(0,Y.jsx)(`span`,{className:`truncate font-mono text-[11px] text-soft-foreground`,children:e.slug})]},e.slug)})}):(0,Y.jsxs)(`p`,{"data-slot":`create-template-no-match`,className:`px-1 text-[12px] text-muted-foreground`,children:[`No suggested template matches — any `,(0,Y.jsx)(`span`,{className:`font-mono`,children:`owner/repo`}),` or GitHub URL works.`]})]})}function gu(e){return e.trimStart().replace(/\s+/g,`-`)}function _u({open:e,onOpenChange:t}){let[n,r]=(0,J.useState)(``),[i,a]=(0,J.useState)(!0),[o,s]=(0,J.useState)(``),[c,l]=(0,J.useState)(``),[u,d]=(0,J.useState)(`empty`),[f,p]=(0,J.useState)(null),m=ln(),h=F(),g=Ct(),_=de(),v=(0,J.useMemo)(()=>`np-${Math.random().toString(36).slice(2)}-${Date.now().toString(36)}`,[]),y=(0,J.useRef)(v);y.current=v,(0,J.useEffect)(()=>ar((e,t)=>{if(e!==`checkout-progress`)return;let n=t;n?.checkoutId===y.current&&(n.phase===`cloning`&&n.line?p(n.line):n.phase!==`cloning`&&p(null))}),[]);let b=h.data,x=b?.available===!0&&Array.isArray(b.owners)&&b.owners.length>0,S=(0,J.useMemo)(()=>b?.available&&Array.isArray(b.owners)?b.owners:[],[b]),C=S.some(e=>e.login===o)?o:S[0]?.login??``,w=i&&x,T=n.trim(),E=er.test(T),D=T===``||E?null:T.length>100?`At most 100 characters.`:`Use letters, digits, “.”, “-” and “_” only.`,O=m.data?.projectsDir??``,k=E?`${O.replace(/\/+$/,``)}/${T}`:``,A=w&&u===`template`,j=A&&c.trim()===``,M=()=>{if(!E||g.isPending||i&&h.isPending||j)return;p(null);let e=c.trim();g.mutate({name:T,checkoutId:v,...w?{github:{owner:C,...A&&e!==``?{template:e}:{}}}:{}},{onSuccess:({project:e})=>{t(!1),_(`/p/${encodeURIComponent(e.id)}/`)}})},N=g.isPending,P=h.isPending||x;return(0,Y.jsx)(xi,{open:e,onOpenChange:e=>N?void 0:t(e),children:(0,Y.jsxs)(Oi,{"data-slot":`create-project-dialog`,className:G(`max-h-[calc(100dvh-2rem)] overflow-y-auto`,P?`md:h-[min(50rem,calc(100dvh-4rem))] md:max-w-3xl md:grid-rows-[auto_minmax(0,1fr)_auto] md:overflow-hidden`:void 0),children:[(0,Y.jsxs)(Si,{children:[(0,Y.jsx)(_i,{children:`New project`}),(0,Y.jsx)(Ei,{children:`cezar creates a new git repository in your checkout root and adds it as a project.`})]}),(0,Y.jsxs)(`div`,{"data-slot":`create-layout`,className:G(`grid gap-6`,P?`md:min-h-0 md:grid-cols-[minmax(0,5fr)_minmax(0,6fr)]`:void 0),children:[P?(0,Y.jsx)(`div`,{"data-slot":`create-owners-column`,className:`min-w-0 md:flex md:min-h-0 md:flex-col md:border-r md:border-border md:pr-6`,children:x?(0,Y.jsx)(vu,{owners:S,value:C,disabled:N||!w,onChange:s}):(0,Y.jsx)(bu,{})}):null,(0,Y.jsxs)(`div`,{"data-slot":`create-form-column`,className:G(`grid min-w-0 content-start gap-4`,P?`md:-m-1 md:flex md:min-h-0 md:flex-col md:overflow-y-auto md:p-1`:void 0),children:[(0,Y.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,Y.jsx)(lu,{htmlFor:`create-name`,children:`Name`}),(0,Y.jsx)(cu,{id:`create-name`,"data-slot":`create-name`,autoFocus:!0,placeholder:`my-project`,value:n,disabled:N,"aria-invalid":D!==null,"aria-describedby":`create-name-hint`,onChange:e=>r(gu(e.target.value)),onKeyDown:e=>{e.key===`Enter`&&M()}}),D?(0,Y.jsx)(`p`,{id:`create-name-hint`,"data-slot":`create-name-error`,className:`text-[12px] text-danger`,children:D}):(0,Y.jsx)(`p`,{id:`create-name-hint`,"data-slot":`create-target`,className:`min-w-0 truncate font-mono text-[11.5px] text-soft-foreground`,title:k,children:k})]}),(0,Y.jsxs)(`div`,{className:`grid gap-3 rounded-md border border-border p-3`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Y.jsxs)(lu,{htmlFor:`create-github`,className:`flex items-center gap-1.5`,children:[(0,Y.jsx)(Os,{className:`size-3.5`,"aria-hidden":`true`}),`Create a private GitHub repository`]}),(0,Y.jsx)(fu,{id:`create-github`,"data-slot":`create-github`,checked:w,disabled:N||!x,onCheckedChange:a})]}),h.isPending?(0,Y.jsx)(`p`,{className:`text-[12px] text-muted-foreground`,children:`Checking GitHub…`}):x?null:(0,Y.jsx)(`p`,{"data-slot":`create-github-unavailable`,className:`text-[12px] text-muted-foreground`,children:b&&!b.available?b.reason:`Could not read your GitHub accounts — the project will be created locally only.`}),w?(0,Y.jsxs)(`p`,{className:`text-[12px] text-muted-foreground`,children:[`Created as `,(0,Y.jsx)(`strong`,{children:`private`}),` under `,(0,Y.jsx)(`strong`,{children:C}),` — you can change its visibility on GitHub.`]}):null]}),(0,Y.jsxs)(`div`,{"data-slot":`create-start`,className:`grid gap-3 rounded-md border border-border p-3 md:flex md:min-h-0 md:flex-1 md:flex-col`,children:[(0,Y.jsx)(`span`,{id:`create-start-label`,className:`text-sm font-medium`,children:`Start with`}),(0,Y.jsxs)(`div`,{role:`radiogroup`,"aria-labelledby":`create-start-label`,className:`grid gap-2 sm:grid-cols-2`,children:[(0,Y.jsx)(yu,{slot:`create-start-empty`,checked:!A,disabled:N,title:`Empty repository`,hint:`One empty commit, no files.`,onSelect:()=>d(`empty`)}),(0,Y.jsx)(yu,{slot:`create-start-template`,checked:A,disabled:N||!w,title:`From a template`,hint:w?`Copy a GitHub template.`:`Needs a GitHub repository.`,onSelect:()=>d(`template`)})]}),A?(0,Y.jsxs)(`div`,{className:`grid gap-1.5 md:flex md:min-h-0 md:flex-1 md:flex-col`,children:[(0,Y.jsx)(lu,{htmlFor:`create-template`,children:`Template`}),(0,Y.jsx)(hu,{id:`create-template`,value:c,disabled:N,onChange:l})]}):null]}),N?(0,Y.jsx)(`p`,{"data-slot":`create-progress`,className:`truncate font-mono text-[11.5px] text-muted-foreground`,children:f??`Starting…`}):null,g.isError?(0,Y.jsx)(`p`,{"data-slot":`create-error`,className:`whitespace-pre-line text-[13px] text-danger`,children:g.error instanceof Error?g.error.message:`could not create the project`}):null]})]}),(0,Y.jsxs)(Ci,{children:[(0,Y.jsx)(K,{variant:`outline`,disabled:N,onClick:()=>t(!1),children:`Cancel`}),(0,Y.jsx)(K,{"data-slot":`create-confirm`,disabled:!E||N||j||i&&h.isPending,onClick:M,children:N?`Creating…`:`Create`})]})]})})}function vu({owners:e,value:t,disabled:n,onChange:r}){let i=(0,J.useRef)([]),a=(t,n)=>{if(e.length===0)return;let a=(t+n+e.length)%e.length,o=e[a]?.login;o!==void 0&&(r(o),i.current[a]?.focus())};return(0,Y.jsxs)(`div`,{className:`grid gap-3 md:flex md:min-h-0 md:flex-1 md:flex-col`,children:[(0,Y.jsx)(`span`,{id:`create-owner-label`,className:`text-[12px] font-semibold tracking-wider text-muted-foreground uppercase`,children:`Select organization`}),(0,Y.jsx)(`div`,{role:`radiogroup`,"aria-labelledby":`create-owner-label`,"data-slot":`create-owner`,className:`-mx-1 grid max-h-64 content-start gap-2 overflow-y-auto px-1 py-0.5 md:max-h-none md:min-h-0 md:flex-1`,children:e.map((e,o)=>{let s=e.login===t;return(0,Y.jsxs)(`button`,{ref:e=>{i.current[o]=e},type:`button`,role:`radio`,"aria-checked":s,tabIndex:s?0:-1,disabled:n,"data-slot":`create-owner-option`,"data-owner":e.login,onClick:()=>r(e.login),onKeyDown:e=>{e.key===`ArrowDown`||e.key===`ArrowRight`?(e.preventDefault(),a(o,1)):(e.key===`ArrowUp`||e.key===`ArrowLeft`)&&(e.preventDefault(),a(o,-1))},className:G(`flex w-full items-center gap-3 rounded-lg border bg-card px-3 py-2.5 text-left outline-none transition-colors`,`focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`,s?`border-primary bg-primary/5`:`border-border hover:bg-muted/50`),children:[(0,Y.jsx)(xu,{owner:e}),(0,Y.jsxs)(`span`,{className:`grid min-w-0 flex-1 gap-0.5`,children:[(0,Y.jsxs)(`span`,{className:`flex items-center gap-1.5 truncate text-sm font-semibold`,children:[e.login,s?(0,Y.jsx)(ba,{className:`size-4 shrink-0 text-primary`,"aria-hidden":`true`}):null]}),e.personal?(0,Y.jsx)(`span`,{className:`text-[12px] text-muted-foreground`,children:`Personal account`}):e.description?(0,Y.jsx)(`span`,{className:`line-clamp-2 text-[12px] text-muted-foreground`,children:e.description}):null]})]},e.login)})})]})}function yu({slot:e,checked:t,disabled:n,title:r,hint:i,onSelect:a}){return(0,Y.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":t,disabled:n,"data-slot":e,onClick:a,className:G(`grid gap-0.5 rounded-md border px-3 py-2 text-left outline-none transition-colors`,`focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50`,t?`border-primary bg-primary/5`:`border-border hover:bg-muted/50`),children:[(0,Y.jsx)(`span`,{className:`text-sm font-medium`,children:r}),(0,Y.jsx)(`span`,{className:`text-[12px] text-muted-foreground`,children:i})]})}function bu(){return(0,Y.jsxs)(`div`,{className:`grid gap-3`,"data-slot":`create-owners-loading`,"aria-hidden":`true`,children:[(0,Y.jsx)(`span`,{className:`text-[12px] font-semibold tracking-wider text-muted-foreground uppercase`,children:`Select organization`}),[0,1].map(e=>(0,Y.jsxs)(`div`,{className:`flex items-center gap-3 rounded-lg border border-border px-3 py-2.5`,children:[(0,Y.jsx)(`span`,{className:`size-9 shrink-0 animate-pulse rounded-full bg-muted`}),(0,Y.jsx)(`span`,{className:`h-3 w-24 animate-pulse rounded bg-muted`})]},e))]})}function xu({owner:e}){let[t,n]=(0,J.useState)(!1),r=e.personal?`rounded-full`:`rounded-md`;return e.avatarUrl&&!t?(0,Y.jsx)(`img`,{src:e.avatarUrl,alt:``,width:36,height:36,loading:`lazy`,onError:()=>n(!0),"data-slot":`create-owner-avatar`,className:G(`size-9 shrink-0 bg-muted`,r)}):(0,Y.jsx)(`span`,{"aria-hidden":`true`,className:G(`flex size-9 shrink-0 items-center justify-center bg-muted text-sm font-semibold text-muted-foreground uppercase`,r),children:e.login.slice(0,1)})}var Su=class extends J.Component{state={failed:!1};static getDerivedStateFromError(){return{failed:!0}}componentDidCatch(e){console.error(`[cezar] ${this.props.label} failed to render`,e),L(`${this.props.label} failed to open: ${e instanceof Error?e.message:String(e)}`,{tone:`danger`}),this.props.onError()}render(){return this.state.failed?null:this.props.children}};function Cu(e){return(0,Y.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`currentColor`,"aria-hidden":`true`,...e,children:(0,Y.jsx)(`path`,{d:`M12 1.9a10.1 10.1 0 0 0-3.2 19.7c.5.1.7-.2.7-.5v-1.8c-2.8.6-3.4-1.2-3.4-1.2-.5-1.2-1.1-1.5-1.1-1.5-.9-.6.1-.6.1-.6 1 .1 1.5 1 1.5 1 .9 1.6 2.4 1.1 3 .9.1-.7.4-1.1.6-1.4-2.2-.3-4.6-1.1-4.6-5 0-1.1.4-2 1-2.7-.1-.3-.4-1.3.1-2.7 0 0 .9-.3 2.8 1a9.6 9.6 0 0 1 5 0c1.9-1.3 2.8-1 2.8-1 .5 1.4.2 2.4.1 2.7.6.7 1 1.6 1 2.7 0 3.9-2.4 4.7-4.6 5 .4.3.7.9.7 1.9v2.8c0 .3.2.6.7.5A10.1 10.1 0 0 0 12 1.9z`})})}var wu=[{to:`/`,label:`Tasks`,icon:Ds,match:[`/`,`/tasks`,`/compare`],badge:`tasks-unread`},{to:`/inbox`,label:`Inbox`,icon:Ss,match:[`/inbox`],badge:`inbox-count`,inbox:!0},{to:`/git`,label:`Git`,icon:ka,match:[`/git`]},{to:`/github`,label:`GitHub`,icon:Cu,match:[`/github`],forge:!0},{to:`/tracker`,label:`Tracker`,icon:Gs,match:[`/tracker`],tracker:!0},{to:`/automations`,label:`Automations`,icon:ai,match:[`/automations`],automations:!0},{to:`/skills`,label:`Skills`,icon:ti,match:[`/skills`],badge:`skills-update`},{to:`/workflows`,label:`Workflows`,icon:qs,match:[`/workflows`]},{to:`/settings`,label:`Settings`,icon:Bs,match:[`/settings`]}];function Tu({forge:e=!1,inbox:t=!1,automations:n=!1,tracker:r}={}){return wu.filter(i=>(!i.forge||e)&&(!i.inbox||t)&&(!i.automations||n)&&(!i.tracker||r!==void 0)).map(e=>e.tracker?{...e,label:r?Js[r].label:e.label}:e)}function Eu(e,t){return t===`/`?e===`/`:e===t||e.startsWith(t+`/`)}function Du(e){let t=null;for(let n of wu)for(let r of n.match)Eu(e,r)&&(t===null||r.length>t.length)&&(t={to:n.to,length:r.length});return t?.to??null}function Ou(e){let t=Du(e);return wu.find(e=>e.to===t)??null}var ku=`cez-theme`,Au=`(prefers-color-scheme: light)`,ju=`dark`;function Mu(e){return e===`light`||e===`dark`||e===`system`?e:ju}function Nu(e,t){return e===`light`||e===`system`&&t?`light`:`dark`}function Pu(){try{return Mu(localStorage.getItem(ku))}catch{return ju}}function Fu(e){try{localStorage.setItem(ku,e)}catch{}}function Iu(){return typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(Au).matches}function Lu(e,t){e.classList.toggle(`light`,t===`light`),e.style.colorScheme=t}var Ru=J.createContext(null);function zu({children:e}){let[t,n]=J.useState(Pu),[r,i]=J.useState(Iu);J.useEffect(()=>{let e=window.matchMedia?.(Au);if(!e)return;i(e.matches);let t=e=>i(e.matches);return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]);let a=Nu(t,r);J.useLayoutEffect(()=>{Lu(document.documentElement,a)},[a]);let o=J.useCallback(e=>{n(e),Fu(e)},[]),s=J.useMemo(()=>({theme:t,resolvedTheme:a,setTheme:o}),[t,a,o]);return(0,Y.jsx)(Ru.Provider,{value:s,children:e})}function Bu(){let e=J.useContext(Ru);if(!e)throw Error(`cezar: useTheme() must be called inside <ThemeProvider>`);return e}var Vu={light:`dark`,dark:`system`,system:`light`},Hu={light:Ws,dark:Ns,system:Ms},Uu={light:`light`,dark:`dark`,system:`system`};function Wu({className:e}){let{theme:t,setTheme:n}=Bu(),r=Vu[t],i=Hu[t];return(0,Y.jsx)(K,{type:`button`,variant:`ghost`,size:`icon-sm`,className:e,"data-slot":`theme-toggle`,"data-theme-pref":t,title:`Theme: ${Uu[t]}`,"aria-label":`Theme: ${Uu[t]}. Switch to ${Uu[r]}.`,onClick:()=>n(r),children:(0,Y.jsx)(i,{"aria-hidden":`true`})})}function Gu(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),t.size>=200))break}return[...t]}function Ku(e){return[...e].sort((e,t)=>t.lastOpenedAt.localeCompare(e.lastOpenedAt))}function qu(e,t){let n=Gu(t);if(n.length===0)return Ku(e);let r=new Map(n.map((e,t)=>[e,t])),i=[],a=[];for(let t of e)r.has(t.id)?i.push(t):a.push(t);return i.sort((e,t)=>r.get(e.id)-r.get(t.id)),[...Ku(a),...i]}function Ju(e,t,n){return t===n||t<0||n<0||t>=e.length||n>=e.length?[...e]:pr([...e],t,n)}function Yu(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:{}}function Xu(){let e=I(),t=It(),n=J.useRef(0),r=J.useRef(Promise.resolve()),i=J.useMemo(()=>Gu(t.data?.sidebar?.projectOrder),[t.data?.sidebar?.projectOrder]),a=J.useCallback(t=>{let i=e.getQueryData(z.uiState);if(i===void 0)return;let{projectOrder:a,...o}=Yu(i.sidebar),c=t===null?o:{...o,projectOrder:t};e.setQueryData(z.uiState,{...i,sidebar:c});let l=++n.current,u=r.current.then(async()=>{let t=await s({sidebar:c},{keepalive:!0});l===n.current&&e.setQueryData(z.uiState,t)});r.current=u.catch(t=>{L(t instanceof Error?t.message:String(t),{tone:`danger`}),l===n.current&&e.invalidateQueries({queryKey:z.uiState})})},[e]),o=J.useCallback(e=>{let t=Gu(e);t.length!==0&&a(t.slice(0,200))},[a]),c=J.useCallback(()=>a(null),[a]);return{order:i,canReorder:t.data!==void 0,setOrder:o,reset:c}}var Zu=`cezar:open-command-palette`;function Qu(){window.dispatchEvent(new Event(Zu))}function $u(e){return[...e].sort((e,t)=>Date.parse(t.createdAt)-Date.parse(e.createdAt))}function ed(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 td(e,t,n){let r=$u(e).map(e=>({projectId:t,id:e.id,title:e.title,titleSummary:e.titleSummary,titleOrigin:e.titleOrigin,status:e.status,activity:e.activity,createdAt:e.createdAt,finishedAt:e.finishedAt,seenAt:e.seenAt,archived:e.archived,autoResumeAt:e.autoResumeAt,awaitingAnswerSince:e.awaitingAnswerSince,workflow:e.workflow,branch:e.branch,startedAt:e.startedAt})),i=new Set(r.map(nd)),a=(n??[]).filter(e=>!i.has(nd(e))).sort((e,t)=>t.createdAt.localeCompare(e.createdAt));return[...r,...a]}var nd=e=>`${e.projectId??``}/${e.id}`;function rd(e){let t=e.filter(e=>Gr(e)).sort((e,t)=>(t.finishedAt??``).localeCompare(e.finishedAt??``)),n=new Set(t.map(nd));return{recentlyFinished:t,otherTasks:e.filter(e=>!n.has(nd(e)))}}function id(e,t,n=[]){let r=qu(e,n);return[...r.filter(e=>e.id!==t),...r.filter(e=>e.id===t)]}function ad(){let[e,t]=J.useState(!1),n=Qe();qi(`k`,()=>t(e=>!e));let r=J.useCallback(()=>{t(!1),n(`/new`)},[n]);return qi(`n`,r),Wi(`c`,r),J.useEffect(()=>{let e=()=>t(!0);return window.addEventListener(Zu,e),()=>window.removeEventListener(Zu,e)},[]),(0,Y.jsx)(lo,{open:e,onOpenChange:t,title:`Command palette`,description:`Search projects, tasks, views, actions, and skills`,showCloseButton:!1,filter:ed,className:`top-[10vh] translate-y-0 sm:max-w-2xl lg:max-w-3xl xl:max-w-4xl`,children:(0,Y.jsx)(sd,{close:()=>t(!1)})})}function od({task:e,projectName:t,showProject:n,now:r,onSelect:i}){let a=D(e),o=xt(e);return(0,Y.jsxs)(uo,{value:`task ${o} ${e.id}`,keywords:t?[t]:void 0,"data-slot":`palette-task`,"data-run-id":e.id,"data-project-id":e.projectId??void 0,onSelect:()=>i(e),children:[(0,Y.jsx)(eo,{tone:a.tone,pulse:a.pulse,"aria-label":a.label,role:`img`}),(0,Y.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:o}),n&&t?(0,Y.jsx)(`span`,{"data-slot":`palette-task-project`,className:`shrink-0 truncate text-xs text-soft-foreground`,children:t}):null,(0,Y.jsx)(`span`,{className:`shrink-0 text-xs text-soft-foreground tabular-nums`,children:to(e.finishedAt??e.createdAt,r)})]})}function sd({close:e}){let t=Qe(),n=de(),[r,i]=J.useState(``),a=r.trim()!==``,o=tn(),{theme:s,setTheme:c}=Bu(),l=ln(),u=Te(),d=l.data,f=d?.bootProject??u.data?.bootProject??null,p=ie(o,f),m=Dn(),h=Le(),g=Date.now(),_=d!==void 0&&d.projects.length>1,v=se(_),{order:y}=Xu(),b=J.useMemo(()=>_?id(d.projects,o,y):[],[_,d,o,y]),x=J.useMemo(()=>new Map((d?.projects??[]).map(e=>[e.id,e.name])),[d]),S=(o==="default"?null:o)??f,C=J.useMemo(()=>td(p.data??[],S,v.data?.runs),[p.data,S,v.data]),w=J.useMemo(()=>rd(C),[C]),T=a?[]:w.recentlyFinished,E=a?C:w.otherTasks,D=_,O=e=>e.projectId===null?null:x.get(e.projectId)??null,k=h.data?.skillUsage,A=J.useMemo(()=>Li(m.data??[],k),[m.data,k]),j=n=>{e(),t(n)},M=t=>{e(),n(t)},N=n=>{e(),t(We(n,`/`))},P=n=>{e(),t(n.projectId===null?`/tasks/${n.id}`:We(n.projectId,`/tasks/${n.id}`))},F=Vu[s];return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(co,{placeholder:`Search projects, tasks, views, actions, skills…`,value:r,onValueChange:i}),(0,Y.jsxs)(io,{className:`max-h-[55vh] min-h-[14rem] sm:max-h-[60vh] lg:max-h-[68vh]`,children:[(0,Y.jsx)(ao,{children:`Nothing matches.`}),(0,Y.jsx)(ro,{children:(0,Y.jsxs)(uo,{value:`new task`,"data-slot":`palette-view`,"data-nav-to":`/new`,onSelect:()=>j(`/new`),children:[(0,Y.jsx)(Rs,{"aria-hidden":`true`}),`New task`,(0,Y.jsx)(po,{children:`C`})]})}),!a&&T.length>0?(0,Y.jsx)(ro,{heading:`Recently finished`,children:T.map(e=>(0,Y.jsx)(od,{task:e,projectName:O(e),showProject:D,now:g,onSelect:P},nd(e)))}):null,(0,Y.jsxs)(ro,{heading:`Views`,children:[_?(0,Y.jsxs)(uo,{value:`view All tasks`,"data-slot":`palette-view`,"data-nav-to":`/tasks`,onSelect:()=>M(`/tasks`),children:[(0,Y.jsx)(Ts,{"aria-hidden":`true`}),`All tasks`]}):null,Tu({forge:u.data?.forge?.available===!0,inbox:u.data?.capabilities.followups===!0,automations:u.data?.capabilities.automations===!0,tracker:d?.projects.find(e=>e.id===(o??d.bootProject))?.tracker}).map(e=>{let t=e.icon;return(0,Y.jsxs)(uo,{value:`view ${e.label}`,"data-slot":`palette-view`,"data-nav-to":e.to,onSelect:()=>j(e.to),children:[(0,Y.jsx)(t,{"aria-hidden":`true`}),e.label]},e.to)})]}),b.length>0?(0,Y.jsx)(ro,{heading:`Projects`,children:b.map(e=>{let t=e.id===o,n=e.status===`missing`;return(0,Y.jsxs)(uo,{value:`project ${e.name} ${e.id}`,keywords:[e.root],"data-slot":`palette-project`,"data-project-id":e.id,disabled:n,onSelect:()=>N(e.id),children:[(0,Y.jsx)(hs,{"aria-hidden":`true`}),(0,Y.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.name}),n?(0,Y.jsx)(`span`,{className:`shrink-0 text-xs text-soft-foreground`,children:`folder not found`}):e.branch===void 0?null:(0,Y.jsx)(`span`,{className:`shrink-0 font-mono text-xs text-soft-foreground`,children:e.branch}),t?(0,Y.jsx)(oa,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-primary`}):null]},e.id)})}):null,E.length>0?(0,Y.jsx)(ro,{heading:`Tasks`,children:E.map(e=>(0,Y.jsx)(od,{task:e,projectName:O(e),showProject:D,now:g,onSelect:P},nd(e)))}):null,(0,Y.jsx)(ro,{heading:`Actions`,children:(0,Y.jsxs)(uo,{value:`action toggle theme`,"data-slot":`palette-action`,"data-action":`toggle-theme`,onSelect:()=>{c(F),e()},children:[(0,Y.jsx)(Ns,{"aria-hidden":`true`}),`Toggle theme`,(0,Y.jsxs)(po,{className:`tracking-normal`,children:[s,` → `,F]})]})}),A.length>0?(0,Y.jsx)(ro,{heading:`Skills`,children:A.map(e=>(0,Y.jsxs)(uo,{value:`skill ${e.name} ${e.path}`,keywords:e.description?[e.description]:void 0,"data-slot":`palette-skill`,"data-skill":e.name,onSelect:()=>j(`/new?skill=${encodeURIComponent(e.name)}`),children:[(0,Y.jsx)(`span`,{className:`shrink-0 font-medium`,children:e.name}),e.description?(0,Y.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null]},e.path))}):null]})]})}var cd=`https://github.com/open-mercato/cezar`,ld=`cez:star-toast-seen`;function ud(e){if(!Number.isFinite(e)||e<0)return`0`;let t=Math.floor(e);if(t<1e3)return String(t);let n=t/1e3,r=Math.floor(n*10)/10;return r<100?`${r.toFixed(1).replace(/\.0$/,``)}k`:`${Math.floor(n)}k`}var dd=`cez:star-ask`,fd=1500;function pd(e=vd()){if(!e)return null;try{let t=e.getItem(dd);if(t!==null){let e=JSON.parse(t);return{asks:Number.isInteger(e.asks)&&e.asks>=0?e.asks:3,...typeof e.lastAskedAt==`string`?{lastAskedAt:e.lastAskedAt}:{},...e.outcome===`starred`||e.outcome===`never`?{outcome:e.outcome}:{}}}let n=e.getItem(ld);return n===null?{asks:0}:{asks:1,lastAskedAt:n}}catch{return null}}function md(e,t=vd()){try{t?.setItem(dd,JSON.stringify(e))}catch{}}function hd(e,t){if(!e||e.outcome||e.asks>=3)return!1;if(!e.lastAskedAt)return!0;let n=Date.parse(e.lastAskedAt);return!Number.isFinite(n)||t-n>=12096e5}function gd(e){return(e??[]).filter(e=>yd.has(e.status)).length}function _d(e){return e.visible&&e.focused&&!e.typing&&!e.dialogOpen&&e.now-e.lastInteractionAt>=0&&e.now-e.lastInteractionAt<=6e4}function vd(){try{return globalThis.localStorage??null}catch{return null}}var yd=new Set([`done`,`review`]);function bd(e,t){let n=new Map,r=!1,i=!1;for(let a of t??[]){n.set(a.id,a.status);let t=e.get(a.id);t===void 0||t===a.status||yd.has(a.status)&&(r=!0,a.pullRequestUrl&&(i=!0))}return{succeeded:r,withPullRequest:i,statuses:n}}var xd=[`354.6,217.3 511.0,307.6 421.0,359.6 354.6,321.2 267.9,371.2 267.9,471.3 444.6,573.3 354.6,625.3 177.9,523.3 177.9,319.3`,`177.9,284.6 354.6,182.6 354.6,78.7 177.9,180.7`,`354.6,372.3 397.0,396.8 397.0,445.8 354.6,470.3 312.1,445.8 312.1,396.8`,`483.7,372.3 526.1,396.8 526.1,445.8 483.7,470.3 441.2,445.8 441.2,396.8`],Sd={x:177.9,y:78.7,width:348.2,height:546.6},Cd={mark:26,name:19,gap:11.4};function wd({height:e=Cd.mark,className:t}){return(0,Y.jsx)(`svg`,{"data-slot":`brand-mark`,"aria-hidden":`true`,focusable:`false`,viewBox:`${Sd.x} ${Sd.y} ${Sd.width} ${Sd.height}`,height:e,width:e*Sd.width/Sd.height,fill:`currentColor`,className:G(`shrink-0`,t),children:xd.map(e=>(0,Y.jsx)(`polygon`,{points:e},e))})}function Td({className:e,name:t=`cezar`,logoUrl:n=null}){return(0,Y.jsxs)(`span`,{"data-slot":`brand-lockup`,className:G(`flex min-w-0 items-center text-foreground`,e),style:{gap:Cd.gap},children:[n?(0,Y.jsx)(`img`,{"data-slot":`brand-logo`,src:n,alt:``,className:`size-[26px] shrink-0 object-contain`}):(0,Y.jsx)(wd,{}),(0,Y.jsx)(`span`,{"data-slot":`brand-name`,className:G(`max-w-full truncate leading-none font-semibold tracking-normal`,t===`cezar`&&`lowercase`),style:{fontFamily:`var(--brand)`,fontSize:Cd.name},children:t})]})}function Ed({...e}){return(0,Y.jsx)(_c,{"data-slot":`select`,...e})}function Dd({...e}){return(0,Y.jsx)(xc,{"data-slot":`select-value`,...e})}function Od({className:e,size:t=`default`,children:n,...r}){return(0,Y.jsxs)(yc,{"data-slot":`select-trigger`,"data-size":t,className:G(`flex w-fit items-center justify-between gap-2 rounded-md border border-input bg-card px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[placeholder]:text-muted-foreground data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 hover:bg-muted [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground`,e),...r,children:[n,(0,Y.jsx)(Cc,{asChild:!0,children:(0,Y.jsx)(ma,{className:`size-4 opacity-50`})})]})}function kd({className:e,children:t,position:n=`item-aligned`,align:r=`center`,...i}){return(0,Y.jsx)(Dc,{children:(0,Y.jsxs)(kc,{"data-slot":`select-content`,className:G(`relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border bg-popover text-popover-foreground shadow-md data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95`,n===`popper`&&`data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1`,e),position:n,align:r,...i,children:[(0,Y.jsx)(jd,{}),(0,Y.jsx)(Wc,{className:G(`p-1`,n===`popper`&&`h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1`),children:t}),(0,Y.jsx)(Md,{})]})})}function Ad({className:e,children:t,...n}){return(0,Y.jsxs)(el,{"data-slot":`select-item`,className:G(`relative flex w-full cursor-pointer items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2`,e),...n,children:[(0,Y.jsx)(`span`,{"data-slot":`select-item-indicator`,className:`absolute right-2 flex size-3.5 items-center justify-center`,children:(0,Y.jsx)(il,{children:(0,Y.jsx)(oa,{className:`size-4`})})}),(0,Y.jsx)(nl,{children:t})]})}function jd({className:e,...t}){return(0,Y.jsx)(ol,{"data-slot":`select-scroll-up-button`,className:G(`flex cursor-pointer items-center justify-center py-1`,e),...t,children:(0,Y.jsx)(is,{className:`size-4`})})}function Md({className:e,...t}){return(0,Y.jsx)(cl,{"data-slot":`select-scroll-down-button`,className:G(`flex cursor-pointer items-center justify-center py-1`,e),...t,children:(0,Y.jsx)(ma,{className:`size-4`})})}function Nd(e){let t=/-pr(\d+)\./.exec(e);return t?Number(t[1]):null}function Pd({data:e,onApply:t,applying:n}){let r=O(),i=At(),[a,o]=(0,J.useState)(`worktrees`),[s,c]=(0,J.useState)(``),[l,u]=(0,J.useState)(null),[d,f]=(0,J.useState)(!1),p=e.job?.status===`running`||e.job?.status===`restarting`,m=e.installed.find(e=>e.active),h=r.data?.checkouts??[],g=r.data?.pulls,_=!r.data||h.length>0,v=_?a:`pulls`,y=s.trim().toLowerCase(),b=(0,J.useMemo)(()=>h.filter(e=>!y||[e.branch,e.task?.title,e.task?.id,e.commit?.subject,e.worktree,e.pr?`#${e.pr}`:``].filter(Boolean).some(e=>e.toLowerCase().includes(y))),[h,y]),x=(0,J.useMemo)(()=>(g?.items??[]).filter(e=>!e.version&&!d?!1:!y||[`#${e.number}`,String(e.number),e.title,e.branch,e.author??``].some(e=>e.toLowerCase().includes(y))),[g,y,d]),S=(g?.items??[]).filter(e=>!e.version).length,C=v===`worktrees`?h.find(e=>e.id===l):void 0,w=v===`pulls`?g?.items.find(e=>e.version&&e.version===l):void 0,T=C?.id??w?.version??null,E=!!C&&(!C.built||C.stale),D=!!T&&T===m?.id&&!E,k=w&&!w.installed?`Install & restart`:E?`${C.built?`Rebuild`:`Build`} & ${C.id===m?.id?`restart`:`switch`}`:`Switch & restart`;return(0,Y.jsxs)(`div`,{"data-slot":`self-update-development`,className:`flex min-w-0 flex-col gap-2`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Y.jsx)(`div`,{role:`tablist`,"aria-label":`Development builds`,className:`flex rounded-md border border-border bg-muted/40 p-0.5`,children:[..._?[{value:`worktrees`,label:`Worktrees`,count:h.length}]:[],{value:`pulls`,label:`Pull requests`,count:(g?.items.length??0)-S}].map(e=>(0,Y.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":v===e.value,onClick:()=>{o(e.value),u(null)},className:G(`rounded-[5px] px-3 py-1 text-[12.5px] font-semibold transition-colors`,v===e.value?`bg-card text-foreground shadow-sm`:`text-muted-foreground hover:text-foreground`),children:[e.label,r.data?(0,Y.jsx)(`span`,{className:`ml-1.5 font-normal text-muted-foreground`,children:e.count}):null]},e.value))}),(0,Y.jsx)(K,{variant:`ghost`,size:`sm`,onClick:()=>i.mutate(),disabled:i.isPending||r.isFetching,children:i.isPending?`Refreshing…`:`Refresh`})]}),(0,Y.jsx)(cu,{"aria-label":`Filter`,value:s,onChange:e=>c(e.target.value),placeholder:v===`worktrees`?`Filter by task, branch, commit or #PR`:`Filter by #number, title, branch or author`,className:`h-8 text-[13px]`}),(0,Y.jsx)(`div`,{className:`max-h-72 min-h-24 overflow-y-auto rounded-md border border-border`,children:r.isPending?(0,Y.jsx)(`p`,{className:`px-3 py-3 text-[12.5px] text-muted-foreground`,children:`Looking for worktrees and pull requests…`}):r.error?(0,Y.jsx)(`p`,{className:`px-3 py-3 text-[12.5px] text-danger`,children:r.error.message}):v===`worktrees`?(0,Y.jsxs)(Y.Fragment,{children:[b.length===0?(0,Y.jsx)(`p`,{className:`px-3 py-3 text-[12.5px] text-muted-foreground`,children:`Nothing matches.`}):null,(0,Y.jsx)(`div`,{role:`listbox`,"aria-label":`Worktrees`,children:b.map(e=>(0,Y.jsx)(Id,{checkout:e,active:e.id===m?.id,selected:l===e.id,onSelect:()=>u(e.id)},e.worktree))})]}):(0,Y.jsxs)(Y.Fragment,{children:[g&&!g.available?(0,Y.jsx)(`p`,{className:`px-3 py-2 text-[12px] text-muted-foreground`,children:g.reason}):null,g?.available&&x.length===0?(0,Y.jsx)(`p`,{className:`px-3 py-3 text-[12.5px] text-muted-foreground`,children:g.items.length===0?`No open pull requests on ${g.repo}.`:y?`Nothing matches.`:`No open pull request has a preview build.`}):null,(0,Y.jsx)(`div`,{role:`listbox`,"aria-label":`Pull requests`,children:x.map(e=>(0,Y.jsx)(Ld,{pull:e,active:!!e.version&&e.version===m?.id,selected:!!e.version&&l===e.version,onSelect:()=>e.version&&u(e.version)},e.number))}),S>0?(0,Y.jsx)(`button`,{type:`button`,onClick:()=>f(e=>!e),className:`w-full border-t border-border px-3 py-2 text-left text-[12px] text-muted-foreground hover:text-foreground`,children:d?`Hide the ${S} without a preview build`:`${S} more without a preview build (forks, CI not green yet) — show`}):null]})}),(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-2`,children:[(0,Y.jsx)(`p`,{className:`min-w-0 truncate text-[11.5px] text-muted-foreground`,title:C?.worktree,children:C?E?`${C.built?`Built before its last commit`:`Not built yet`} — runs npm run build in ${C.worktree} first (about a minute).`:C.worktree:w?`Installs ${w.version} from npm.`:v===`worktrees`?`Linked, not copied: a worktree that is not built, or built before its last commit, is built before the switch.`:`Preview builds CI publishes for green same-repo pull requests.`}),(0,Y.jsx)(K,{size:`sm`,variant:`contrast`,onClick:()=>T&&t(T),disabled:!T||D||!e.canSelfUpdate||n||p,children:k})]})]})}function Fd({selected:e,disabled:t,onSelect:n,title:r,children:i}){return(0,Y.jsx)(`div`,{role:`option`,"aria-selected":e,"aria-disabled":t,tabIndex:t?-1:0,title:r,onClick:()=>!t&&n(),onKeyDown:e=>{!t&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),n())},className:G(`flex min-w-0 flex-col gap-0.5 border-b border-border px-3 py-2 last:border-b-0 outline-none`,t?`cursor-not-allowed opacity-55`:`cursor-pointer hover:bg-muted/50 focus-visible:bg-muted/60`,e&&`bg-primary/10 hover:bg-primary/10`),children:i})}function Id({checkout:e,active:t,selected:n,onSelect:r}){let i=e.task?.title??e.commit?.subject??e.branch;return(0,Y.jsxs)(Fd,{selected:n,disabled:!e.id,onSelect:r,title:e.worktree,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Y.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[13px] font-medium`,children:i}),e.pr?(0,Y.jsxs)(X,{variant:`outline`,children:[`#`,e.pr]}):null,t?(0,Y.jsx)(X,{variant:`secondary`,children:`current`}):null,e.built?e.stale?(0,Y.jsx)(X,{variant:`outline`,children:`needs rebuild`}):null:(0,Y.jsx)(X,{variant:`outline`,children:`not built`})]}),(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 text-[11.5px] text-muted-foreground`,children:[(0,Y.jsx)(`span`,{className:`shrink-0 font-mono`,children:e.branch}),e.task?(0,Y.jsxs)(`span`,{className:`shrink-0`,children:[`· `,e.task.status]}):null,e.commit?(0,Y.jsxs)(`span`,{className:`min-w-0 truncate`,children:[`· `,e.commit.sha,` `,e.task?e.commit.subject:``,` · `,to(e.commit.at),` ago`]}):null,e.builtAt?(0,Y.jsxs)(`span`,{className:`shrink-0`,children:[`· built `,to(e.builtAt),` ago`]}):null]})]})}function Ld({pull:e,active:t,selected:n,onSelect:r}){return(0,Y.jsxs)(Fd,{selected:n,disabled:!e.version,onSelect:r,title:e.url,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Y.jsxs)(`span`,{className:`shrink-0 text-[13px] text-muted-foreground`,children:[`#`,e.number]}),(0,Y.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[13px] font-medium`,children:e.title}),e.draft?(0,Y.jsx)(X,{variant:`outline`,children:`draft`}):null,t?(0,Y.jsx)(X,{variant:`secondary`,children:`current`}):e.version?e.installed?(0,Y.jsx)(X,{variant:`outline`,children:`installed`}):null:(0,Y.jsx)(X,{variant:`outline`,children:`no build`})]}),(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 text-[11.5px] text-muted-foreground`,children:[e.author?(0,Y.jsx)(`span`,{className:`shrink-0`,children:e.author}):null,(0,Y.jsxs)(`span`,{className:`min-w-0 truncate font-mono`,children:[`· `,e.branch]}),(0,Y.jsxs)(`span`,{className:`shrink-0`,children:[`· updated `,to(e.updatedAt),` ago`]}),e.version?(0,Y.jsxs)(`span`,{className:`shrink-0`,children:[`· build `,e.publishedAt?`${to(e.publishedAt)} ago`:e.version]}):null]})]})}function Rd({open:e,onOpenChange:t,autoApply:n,brandName:r=`cezar`}){let i=x(e),a=nt(),o=pe(),s=m(),[c,l]=(0,J.useState)(``),u=i.data,d=(0,J.useRef)(null),f=(0,J.useRef)(!1);return(0,J.useEffect)(()=>{!n||f.current||!u||!u.canSelfUpdate||u.job||(f.current=!0,!(u.activeRuns>0)&&s.mutate(n))},[n,u,s]),(0,Y.jsx)(xi,{open:e,onOpenChange:e=>{!e&&u?.job?.status===`running`||t(e)},children:(0,Y.jsxs)(Oi,{"data-slot":`self-update-dialog`,className:`sm:max-w-xl`,ref:d,onOpenAutoFocus:e=>{e.preventDefault(),d.current?.focus()},children:[(0,Y.jsxs)(Si,{children:[(0,Y.jsxs)(_i,{className:`flex items-center gap-2`,children:[(0,Y.jsxs)(`span`,{children:[r,` `,u?`v${u.version}`:``]}),(0,Y.jsx)(Wd,{data:u})]}),(0,Y.jsxs)(Ei,{className:`sr-only`,children:[`Update `,r,`, pick a release channel or switch versions.`]})]}),u?(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-5`,children:[(0,Y.jsx)(Vd,{data:u,busy:o.isPending,onChange:e=>{l(``),o.mutate(e)}}),(0,Y.jsx)(Hd,{data:u,checking:a.isPending,onCheck:()=>a.mutate(),onApply:e=>s.mutate(e),applying:s.isPending}),u.channel===`development`?(0,Y.jsx)(Pd,{data:u,onApply:e=>s.mutate(e),applying:s.isPending}):(0,Y.jsx)(Ud,{data:u,picked:c,onPick:l,onApply:e=>s.mutate(e),applying:s.isPending}),u.canSelfUpdate?null:(0,Y.jsx)(Gd,{data:u}),u.activeRuns>0&&u.canSelfUpdate?(0,Y.jsxs)(`p`,{className:`rounded-md border border-pending/50 bg-pending/10 px-3 py-2 text-[12.5px] text-foreground`,children:[u.activeRuns,` task`,u.activeRuns===1?` is`:`s are`,` running. A restart interrupts them; `,r,` re-queues or resumes them on the way back up.`]}):null,o.error?(0,Y.jsxs)(`p`,{className:`text-[12.5px] text-danger`,children:[`Could not switch the channel: `,o.error.message,o.variables===`development`?` The running ${r} server predates the Development channel — restart ${r} to load it.`:null]}):null,s.error?(0,Y.jsx)(`p`,{className:`text-[12.5px] text-danger`,children:s.error.message}):null,u.job?(0,Y.jsx)(Kd,{data:u}):null]}):i.error?(0,Y.jsx)(`p`,{className:`text-[13px] text-danger`,children:i.error.message}):null]})})}var zd=[{value:`stable`,label:`Stable`},{value:`nightly`,label:`Nightly`},{value:`development`,label:`Development`}],Bd={stable:`Tagged releases.`,nightly:`A fresh build of main every night.`,development:`A cezar worktree or an open pull request. Never updates on its own.`};function Vd({data:e,busy:t,onChange:n}){return(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(`div`,{className:`text-[13px] font-semibold`,children:`Release channel`}),(0,Y.jsx)(`div`,{className:`text-[12px] text-muted-foreground`,children:Bd[e.channel]})]}),(0,Y.jsx)(`div`,{role:`radiogroup`,"aria-label":`Release channel`,"data-slot":`channel-toggle`,className:`flex shrink-0 rounded-md border border-border bg-muted/40 p-0.5`,children:zd.map(r=>{let i=e.channel===r.value;return(0,Y.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":i,disabled:t,onClick:()=>!i&&n(r.value),className:G(`rounded-[5px] px-3 py-1 text-[12.5px] font-semibold transition-colors`,i?`bg-card text-foreground shadow-sm`:`text-muted-foreground hover:text-foreground`),children:r.label},r.value)})})]})}function Hd({data:e,checking:t,onCheck:n,onApply:r,applying:i}){let a=e.job?.status===`running`||e.job?.status===`restarting`,o=e.installed.find(e=>e.active),s=o?.source===`registry`?Nd(o.version):null,c=o&&(o.source===`link`||o.source===`local`||s!==null)?o:null;if(c||e.channel===`development`){let o=e.channel===`development`?null:e.latest[e.channel],l=o!==null&&e.installed.some(e=>e.source===`registry`&&e.id===o);return(0,Y.jsxs)(`div`,{"data-slot":`self-update-latest`,className:`flex flex-col gap-2 rounded-md border border-border bg-card px-3 py-2.5`,children:[(0,Y.jsx)(`div`,{className:`min-w-0 text-[13px] break-words`,children:c?.source===`link`?(0,Y.jsxs)(Y.Fragment,{children:[`Running worktree `,(0,Y.jsx)(`span`,{className:`font-mono text-[12.5px] font-semibold`,children:c.branch??c.id}),`, not a release.`]}):c?.source===`local`?(0,Y.jsx)(Y.Fragment,{children:`Running a local build, not a release.`}):s===null?(0,Y.jsxs)(Y.Fragment,{children:[`Running `,(0,Y.jsxs)(`span`,{className:`font-semibold`,children:[`v`,e.version]}),`. Pick a worktree or a pull request below.`]}):(0,Y.jsxs)(Y.Fragment,{children:[`Running the preview build of `,(0,Y.jsxs)(`span`,{className:`font-semibold`,children:[`PR #`,s]}),`, not a release.`]})}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-x-3 gap-y-2`,children:[(0,Y.jsx)(`div`,{className:`min-w-0 text-[11.5px] break-words text-muted-foreground`,children:e.channel===`development`?`Switch the channel back to Stable or Nightly to follow releases again.`:e.checkedAt?(0,Y.jsxs)(Y.Fragment,{children:[o?(0,Y.jsxs)(Y.Fragment,{children:[`Newest `,e.channel,`: `,(0,Y.jsxs)(`span`,{className:`font-mono text-foreground`,children:[`v`,o]}),` ·`,` `]}):null,`checked `,new Date(e.checkedAt).toLocaleTimeString()]}):`The npm registry has not answered yet.`}),e.channel===`development`?null:(0,Y.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-2`,children:[(0,Y.jsx)(K,{variant:`ghost`,size:`sm`,onClick:n,disabled:t||a,children:t?`Checking…`:`Check again`}),o?(0,Y.jsx)(K,{size:`sm`,"aria-label":l?`Back to v${o}`:`Install v${o} & restart`,onClick:()=>r(o),disabled:!e.canSelfUpdate||i||a,children:l?`Switch back`:`Install & restart`}):null]})]})]})}let l=e.updateAvailable;return(0,Y.jsxs)(`div`,{"data-slot":`self-update-latest`,className:G(`flex items-center justify-between gap-3 rounded-md border px-3 py-2.5`,l?`border-primary/40 bg-primary/5`:`border-border bg-card`),children:[(0,Y.jsxs)(`div`,{className:`min-w-0 text-[13px]`,children:[e.checkedAt?l?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`span`,{className:`font-semibold`,children:[`v`,l]}),` is available on `,e.channel,`.`]}):(0,Y.jsxs)(Y.Fragment,{children:[`You are on the newest `,e.channel,` version`,e.channel===`nightly`&&e.latest.nightly?` (v${e.latest.nightly})`:``,`.`]}):(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:`The npm registry has not answered yet.`}),e.checkedAt?(0,Y.jsxs)(`div`,{className:`text-[11.5px] text-muted-foreground`,children:[`checked `,new Date(e.checkedAt).toLocaleTimeString()]}):null]}),(0,Y.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[(0,Y.jsx)(K,{variant:`ghost`,size:`sm`,onClick:n,disabled:t||a,children:t?`Checking…`:`Check again`}),l?(0,Y.jsx)(K,{size:`sm`,onClick:()=>r(l),disabled:!e.canSelfUpdate||i||a,children:`Update & restart`}):null]})]})}function Ud({data:e,picked:t,onPick:n,onApply:r,applying:i}){let a=e.job?.status===`running`||e.job?.status===`restarting`,o=(0,J.useMemo)(()=>{let t=e.channel===`stable`?e.installed.filter(e=>e.source===`local`).map(e=>({value:e.id,label:`v${e.version} · local build`,installed:!0,active:e.active})):[],n=e.available.filter(t=>t.channel===e.channel).map(t=>({value:t.version,label:`v${t.version}${t.publishedAt?` · ${t.publishedAt.slice(0,10)}`:``}`,installed:t.installed,active:e.installed.some(e=>e.active&&e.id===t.version)}));return[...t,...n]},[e]),s=o.find(e=>e.value===t);return(0,Y.jsxs)(`div`,{"data-slot":`self-update-picker`,className:`flex min-w-0 flex-col gap-2`,children:[(0,Y.jsxs)(`div`,{className:`text-[13px] font-semibold`,children:[`Pick a version `,(0,Y.jsxs)(`span`,{className:`font-normal text-muted-foreground`,children:[`· `,e.channel]})]}),(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Y.jsxs)(Ed,{value:t,onValueChange:n,disabled:o.length===0||a,children:[(0,Y.jsx)(Od,{size:`sm`,"aria-label":`Version`,className:`w-0 min-w-0 flex-1 text-[13px]`,children:(0,Y.jsx)(Dd,{placeholder:o.length===0?`No versions known`:`Choose a version to install`})}),(0,Y.jsx)(kd,{className:`max-h-72`,children:o.map(e=>(0,Y.jsx)(Ad,{value:e.value,children:(0,Y.jsxs)(`span`,{className:`flex items-center gap-2`,children:[e.label,e.active?(0,Y.jsx)(X,{variant:`secondary`,children:`current`}):e.installed?(0,Y.jsx)(X,{variant:`outline`,children:`installed`}):null]})},e.value))})]}),(0,Y.jsx)(K,{size:`sm`,variant:`contrast`,onClick:()=>s&&r(s.value),disabled:!s||s.active||!e.canSelfUpdate||i||a,children:s?.installed?`Switch & restart`:`Install & restart`})]}),(0,Y.jsx)(`p`,{className:`text-[11.5px] text-muted-foreground`,children:`Any version, older ones included. Installed versions stay on disk, so switching back is instant.`})]})}function Wd({data:e}){let t=e?.installed.find(e=>e.active);if(t?.source===`local`)return(0,Y.jsx)(X,{variant:`outline`,children:`local build`});if(t?.source===`link`)return(0,Y.jsxs)(X,{variant:`outline`,children:[`worktree · `,t.branch??t.id]});let n=t?Nd(t.version):null;return n===null?null:(0,Y.jsxs)(X,{variant:`outline`,children:[`PR #`,n,` build`]})}function Gd({data:e}){let t=e.installKind===`checkout`?`node packages/cezar/dist/index.js install`:e.installKind===`global-npm`?`cezar install`:`npx cezar-cli install`;return(0,Y.jsxs)(`div`,{"data-slot":`self-update-install-hint`,className:`rounded-md border border-border bg-muted/40 px-3 py-2.5 text-[12.5px]`,children:[(0,Y.jsx)(`p`,{children:e.reason}),(0,Y.jsx)(`p`,{className:`mt-1.5 text-muted-foreground`,children:`Run this once, then start cezar with the plain command:`}),(0,Y.jsx)(`pre`,{className:`mt-1.5 overflow-x-auto rounded bg-background px-2 py-1.5 font-mono text-[12px]`,children:t})]})}function Kd({data:e}){let t=e.job,n=I(),r=(0,J.useRef)(null),[i,a]=(0,J.useState)(`waiting`);return(0,J.useEffect)(()=>{r.current?.scrollTo({top:r.current.scrollHeight})},[t.log.length]),(0,J.useEffect)(()=>{if(t.status!==`restarting`)return;let r=!1,i=Date.now(),o=()=>{a(`back`),n.removeQueries({queryKey:z.selfUpdate}),window.setTimeout(()=>window.location.reload(),400)},s=async()=>{if(!r){try{if((await _e()).version!==e.version)return o();let t=await Et().catch(()=>null);if(t&&!t.job)return o()}catch{}if(Date.now()-i>9e4){a(`timeout`);return}window.setTimeout(s,1e3)}};return window.setTimeout(s,1500),()=>{r=!0}},[t.status,e.version,n]),(0,Y.jsxs)(`div`,{"data-slot":`self-update-job`,className:`flex min-w-0 flex-col gap-1.5`,children:[(0,Y.jsx)(`div`,{className:`flex items-center justify-between text-[12.5px]`,children:(0,Y.jsx)(`span`,{className:`font-semibold`,children:t.status===`running`?`Installing ${t.target}…`:t.status===`failed`?`Install of ${t.target} failed`:i===`back`?`Back — reloading`:i===`timeout`?`Restart took too long — reload the page by hand`:`Restarting into ${t.target}…`})}),(0,Y.jsx)(`pre`,{ref:r,className:`max-h-40 min-w-0 overflow-y-auto rounded-md border border-border bg-background px-2 py-1.5 font-mono text-[11px] leading-[1.5] break-all whitespace-pre-wrap text-muted-foreground`,children:t.log.join(`
|
|
3
|
+
`)}),t.error?(0,Y.jsx)(`p`,{className:`text-[12.5px] text-danger`,children:t.error}):null]})}var qd=`cez-sidebar-width`;function Jd(e){let t=typeof e==`number`?e:Number(e);return Number.isFinite(t)?Math.min(420,Math.max(264,Math.round(t))):264}function Yd(){try{let e=localStorage.getItem(qd);return e===null?264:Jd(e)}catch{return 264}}function Xd(e){try{localStorage.setItem(qd,String(Jd(e)))}catch{}}var Zd=`(min-width: 768px)`,Qd=J.createContext(void 0),$d=J.memo(function({children:e,mainRef:t}){return(0,Y.jsx)(`main`,{ref:t,"data-slot":`main`,className:`row-start-3 min-h-0 overflow-y-auto overscroll-contain`,children:e})});function ef(){return J.useContext(Qd)}function tf(e){return Ne({path:`/tasks/:id`,end:!0},zt(e))!==null}var nf=J.memo(function({children:e,repo:t=null,inboxCount:n=null,unreadCount:r=null,skillsUpdateAvailable:i=!1,version:a=null,latestVersion:o=null,starCount:s=null,taskQuickList:c,hostWidget:l,toolsMenu:u,forgeAvailable:d=!0,inboxAvailable:f=!0,automationsAvailable:p=!0,tracker:m,singleProject:h=!1,banner:g,footerBanner:_,projectGroups:v,brandName:y=`cezar`,brandLogoUrl:b=null}){let{pathname:x}=Re(),S=zt(x),C=Du(S),w=Ou(S),T=w?.to===`/tracker`&&m?{...w,label:Js[m].label}:w,[E,D]=J.useState(!1),O=J.useCallback(()=>D(!1),[]),k=J.useRef(null),A=tf(x),[j,M]=J.useState(Yd),N=J.useCallback(e=>{let t=Jd(e);M(t),Xd(t)},[]);J.useLayoutEffect(()=>{if(A)return;let e=k.current;e&&(e.scrollTop=0)},[x,A]),J.useEffect(()=>{D(!1)},[x]),J.useEffect(()=>{let e=window.matchMedia?.(Zd);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={activeTo:C,items:J.useMemo(()=>Tu({forge:d,inbox:f,automations:p,tracker:m}),[d,f,p,m]),repo:t,inboxCount:f?n:null,unreadCount:r,skillsUpdateAvailable:i,version:a,latestVersion:o,starCount:s,taskQuickList:c,hostWidget:l,toolsMenu:u,projectGroups:v,singleProject:h,brandName:y,brandLogoUrl:b},F=af();return(0,Y.jsxs)(`div`,{"data-slot":`app-shell`,"data-desktop":F??void 0,className:`flex h-dvh overflow-hidden bg-background text-foreground pl-[env(safe-area-inset-left)] pr-[env(safe-area-inset-right)]`,children:[F===`macos`?(0,Y.jsx)(`div`,{"data-slot":`desktop-titlebar`,"data-tauri-drag-region":``,className:`fixed inset-x-0 top-0 z-[60] flex h-[28px] select-none items-center pl-[80px]`,children:a&&o&&o!==a?(0,Y.jsx)(rf,{latestVersion:o,brandName:y}):null}):null,(0,Y.jsx)(of,{...P,width:j,onWidthChange:N,desktop:F}),(0,Y.jsxs)(`div`,{className:G(`grid min-w-0 flex-1 grid-rows-[auto_auto_1fr_auto] overflow-hidden`,F===`macos`&&`pt-[28px]`),children:[(0,Y.jsxs)(Mr,{open:E,onOpenChange:D,children:[(0,Y.jsx)(yf,{title:T?.label??y}),(0,Y.jsx)(cf,{...P,onNavigate:O})]}),g?(0,Y.jsx)(`div`,{"data-slot":`banner-slot`,className:`row-start-2`,children:g}):null,(0,Y.jsx)($d,{mainRef:k,children:e}),(0,Y.jsx)(`div`,{"data-slot":`composer`,className:`row-start-4 pb-[env(safe-area-inset-bottom)]`,children:_})]})]})});function rf({latestVersion:e,brandName:t}){let[n,r]=J.useState(!1);return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`button`,{type:`button`,"data-slot":`titlebar-update`,onClick:()=>r(!0),title:`Update ${t} to v${e} and restart`,className:`inline-flex h-[18px] items-center gap-1 rounded-full border border-primary/40 bg-primary/15 px-2 text-[11px] font-semibold text-foreground transition-colors hover:bg-primary/30`,children:[(0,Y.jsx)(eo,{tone:`pending`,pulse:!0,className:`size-[5px] shrink-0`}),`Update `,t,(0,Y.jsxs)(`span`,{className:`font-mono font-medium text-muted-foreground`,children:[`v`,e]})]}),n?(0,Y.jsx)(Rd,{open:n,onOpenChange:r,autoApply:e,brandName:t}):null]})}function af(){let[e]=J.useState(()=>{if(typeof document>`u`)return null;let e=document.documentElement.dataset.cezDesktop;return e===`macos`||e===`windows`||e===`linux`?e:null});return e}var of=J.memo(function({width:e,onWidthChange:t,desktop:n=null,...r}){return(0,Y.jsxs)(`aside`,{"data-slot":`sidebar`,style:{width:e},className:G(`relative hidden shrink-0 flex-col border-r border-border bg-sidebar md:flex`,n===`macos`&&`pt-[28px]`),children:[(0,Y.jsx)(lf,{...r,compactHeader:n===`macos`}),(0,Y.jsx)(sf,{width:e,onWidthChange:t})]})});function sf({width:e,onWidthChange:t}){let n=J.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(Jd(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,Y.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(Jd(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-violet/40 focus-visible:bg-violet/60 focus-visible:outline-none`})}var cf=J.memo(function({onNavigate:e,...t}){return(0,Y.jsxs)(Ar,{side:`left`,"data-slot":`mobile-nav-drawer`,showCloseButton:!1,className:`w-[264px] gap-0 border-border bg-sidebar p-0 sm:max-w-none md:hidden`,"aria-describedby":void 0,children:[(0,Y.jsx)(kr,{className:`sr-only`,children:`Navigation`}),(0,Y.jsx)(lf,{...t,onNavigate:e,headerAction:(0,Y.jsx)(Or,{asChild:!0,children:(0,Y.jsx)(K,{variant:`ghost`,size:`icon`,"aria-label":`Close menu`,className:`-mr-2 size-11`,children:(0,Y.jsx)(xa,{className:`size-[17px]`,"aria-hidden":`true`})})})})]})});function lf({activeTo:e,items:t,repo:n,inboxCount:r,unreadCount:i,skillsUpdateAvailable:a,version:o,latestVersion:s,starCount:c,taskQuickList:l,hostWidget:u,toolsMenu:d,projectGroups:f,singleProject:p,brandName:m,brandLogoUrl:h,onNavigate:g,headerAction:_,compactHeader:v=!1}){return(0,Y.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,Y.jsxs)(`div`,{className:G(`flex items-center gap-[9px] px-3.5 pb-2.5`,v?`pt-1.5`:`pt-3.5`),children:[(0,Y.jsx)(Td,{name:m,logoUrl:h}),n&&!f?(0,Y.jsxs)(`span`,{"data-slot":`repo-chip`,className:`ml-auto truncate font-mono text-[11px] font-medium text-soft-foreground`,children:[n.name,` / `,n.branch]}):null,_?(0,Y.jsx)(`div`,{className:G(`shrink-0`,(!n||f)&&`ml-auto`),children:_}):null]}),(0,Y.jsxs)(`div`,{className:`flex gap-1.5 px-2.5 pt-1 pb-2`,children:[(0,Y.jsx)(K,{asChild:!0,variant:`contrast`,className:`relative min-w-0 flex-1 justify-center`,children:(0,Y.jsxs)(V,{to:`/new`,onClick:g,children:[(0,Y.jsx)(Rs,{className:`size-[15px]`,"aria-hidden":`true`}),`New task`,(0,Y.jsx)(`kbd`,{"aria-hidden":`true`,className:`absolute right-2.5 rounded-[5px] border border-b-2 border-contrast-foreground/25 bg-transparent px-[5px] py-px font-mono text-[10.5px] font-medium text-contrast-foreground/60`,children:`C`})]})}),p?null:(0,Y.jsx)(hf,{})]}),(0,Y.jsx)(`div`,{className:`shrink-0 px-1.5`,children:(0,Y.jsx)(ff,{onNavigate:g})}),f?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`div`,{className:`shrink-0 border-b border-border px-1.5 pt-0.5 pb-2`,children:(0,Y.jsx)(pf,{onNavigate:g})}),(0,Y.jsx)(`div`,{"data-slot":`project-groups`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain px-1.5 pt-1.5 pb-2`,children:(0,Y.jsx)(Qd.Provider,{value:g,children:f})})]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`nav`,{"aria-label":`Main`,className:`px-2.5 py-1.5`,children:t.map(t=>{let n=t.to===e,o=t.icon;return(0,Y.jsxs)(V,{to:t.to,onClick:g,"aria-current":n?`page`:void 0,className:G(`flex h-11 w-full items-center gap-2.5 rounded-md px-2.5 text-[13.5px] font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground md:h-[34px]`,n&&`bg-muted font-semibold text-foreground`),children:[(0,Y.jsx)(o,{className:`size-4 shrink-0`,"aria-hidden":`true`}),t.label,t.badge===`inbox-count`&&r?(0,Y.jsx)(`span`,{"data-slot":`nav-badge`,className:`ml-auto rounded-full bg-violet px-1.5 py-px text-[10.5px] font-semibold text-violet-foreground`,children:r}):null,t.badge===`tasks-unread`&&i?(0,Y.jsx)(`span`,{"data-slot":`nav-unread-badge`,title:`${i} unread finished ${i===1?`task`:`tasks`}`,className:`ml-auto rounded-full bg-violet px-1.5 py-px text-[10.5px] font-semibold text-violet-foreground`,children:i}):null,t.badge===`skills-update`&&a?(0,Y.jsxs)(`span`,{"data-slot":`nav-update-marker`,className:`ml-auto flex items-center`,children:[(0,Y.jsx)(`span`,{className:`size-1.5 rounded-full bg-violet`,"aria-hidden":`true`}),(0,Y.jsx)(`span`,{className:`sr-only`,children:`Skills update available`})]}):null]},t.to)})}),(0,Y.jsx)(`div`,{"data-slot":`task-quick-list`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain px-2.5 pb-2`,children:l})]}),(0,Y.jsxs)(`div`,{"data-slot":`sidebar-footer`,className:`flex flex-col gap-1.5 border-t border-border px-3.5 py-2.5`,children:[u,(0,Y.jsx)(gf,{}),(0,Y.jsxs)(`div`,{"data-slot":`sidebar-footer-controls`,className:`flex items-center gap-2`,children:[(0,Y.jsx)(`div`,{"data-slot":`tools-menu`,className:`shrink-0`,children:d}),o?(0,Y.jsx)(_f,{version:o,latestVersion:s,brandName:m}):null,c===null?null:(0,Y.jsx)(vf,{count:c}),(0,Y.jsx)(mf,{onNavigate:g,className:`ml-auto`}),(0,Y.jsx)(Wu,{})]})]})]})}var uf=`flex h-11 w-full items-center gap-2.5 rounded-md px-2.5 text-[13.5px] font-semibold text-foreground transition-colors hover:bg-muted md:h-9`;function df(e){return G(`size-4 shrink-0`,e?`text-violet`:`text-violet/70`)}function ff({onNavigate:e}){return(0,Y.jsx)(S,{to:`/dashboard`,"data-slot":`dashboard-link`,onClick:e,className:({isActive:e})=>G(uf,e&&`bg-muted`),children:({isActive:e})=>(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(wr,{className:df(e),"aria-hidden":`true`}),`Dashboard`]})})}function pf({onNavigate:e}){let{pathname:t}=Re(),n=t===`/tasks`;return(0,Y.jsxs)(ke,{to:`/tasks`,"data-slot":`all-tasks-link`,onClick:e,"aria-current":n?`page`:void 0,className:G(uf,n&&`bg-muted`),children:[(0,Y.jsx)(Ts,{className:df(n),"aria-hidden":`true`}),`All tasks`]})}function mf({className:e,onNavigate:t}){return(0,Y.jsx)(K,{asChild:!0,variant:`ghost`,size:`icon`,className:G(`size-7`,e),children:(0,Y.jsx)(ke,{to:`/settings/global`,"data-slot":`global-settings-link`,"aria-label":`Global settings`,title:`Global settings`,onClick:t,children:(0,Y.jsx)(Bs,{className:`size-4`,"aria-hidden":`true`})})})}function hf(){let[e,t]=J.useState(!1),[n,r]=J.useState(!1),[i,a]=J.useState(!1);return(0,Y.jsxs)(Pa,{children:[(0,Y.jsx)(Sa,{asChild:!0,children:(0,Y.jsx)(K,{variant:`outline`,size:`icon`,"aria-label":`Add project`,title:`Add project`,className:`size-11 shrink-0 md:size-9`,children:(0,Y.jsx)(hs,{className:`size-4`,"aria-hidden":`true`})})}),(0,Y.jsxs)(Aa,{align:`start`,className:`w-56`,children:[(0,Y.jsx)(Da,{className:`text-xs text-soft-foreground`,children:`Add project`}),(0,Y.jsxs)(Ma,{"data-slot":`add-project-local`,onSelect:()=>{t(!0),Nr(`folder`)},children:[(0,Y.jsx)(Ea,{"aria-hidden":`true`}),`Open local folder…`]}),(0,Y.jsxs)(Ma,{"data-slot":`add-project-clone`,onSelect:()=>{r(!0),Nr(`clone`)},children:[(0,Y.jsx)(Cu,{"aria-hidden":`true`}),`Clone from GitHub…`]}),(0,Y.jsxs)(Ma,{"data-slot":`add-project-create`,onSelect:()=>{a(!0),Nr(`new`)},children:[(0,Y.jsx)(gs,{"aria-hidden":`true`}),`New project…`]})]}),e?(0,Y.jsx)(Su,{label:`Open local folder`,onError:()=>t(!1),children:(0,Y.jsx)(su,{open:!0,onOpenChange:t})}):null,n?(0,Y.jsx)(Su,{label:`Clone from GitHub`,onError:()=>r(!1),children:(0,Y.jsx)(du,{open:!0,onOpenChange:r})}):null,i?(0,Y.jsx)(Su,{label:`New project`,onError:()=>a(!1),children:(0,Y.jsx)(_u,{open:!0,onOpenChange:a})}):null]})}function gf(){return(0,Y.jsxs)(`button`,{type:`button`,"data-slot":`command-palette-hint`,title:`Search — command palette (⌘K / Ctrl+K)`,onClick:()=>Qu(),className:`flex w-full items-center gap-1.5 rounded-md border border-border bg-muted/30 px-2 py-1 text-left text-xs font-medium text-soft-foreground transition-colors hover:bg-muted hover:text-foreground`,children:[(0,Y.jsx)(ji,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),(0,Y.jsx)(`span`,{className:`truncate`,children:`Search…`}),(0,Y.jsx)(`kbd`,{"aria-hidden":`true`,className:`ml-auto shrink-0 rounded-[5px] border border-b-2 border-border bg-card px-[5px] py-px font-mono text-[10.5px] font-medium text-muted-foreground`,children:Bi(`k`)})]})}function _f({version:e,latestVersion:t,brandName:n}){let r=!!(t&&t!==e),[i,a]=J.useState(!1);return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`button`,{type:`button`,"data-slot":`version-chip`,"data-update-available":r?`true`:void 0,title:r?`v${e} — update available: v${t}`:`v${e}`,"aria-label":r?`${n} v${e}, update to v${t} available — open updater`:`${n} v${e} — open updater`,onClick:()=>a(!0),className:`flex min-w-0 cursor-pointer items-center gap-1 rounded-full border border-border px-1.5 py-px font-mono text-[10px] font-medium text-soft-foreground outline-none hover:bg-muted hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50`,children:[r?(0,Y.jsx)(eo,{tone:`pending`,pulse:!0,className:`size-[5px] shrink-0`}):null,(0,Y.jsxs)(`span`,{className:`truncate`,children:[`v`,e]})]}),i?(0,Y.jsx)(Rd,{open:i,onOpenChange:a,brandName:n}):null]})}function vf({count:e}){let t=ud(e);return(0,Y.jsxs)(`a`,{"data-slot":`star-chip`,href:cd,target:`_blank`,rel:`noopener noreferrer`,title:`Star cezar on GitHub — ${e.toLocaleString()} stars`,"aria-label":`Star cezar on GitHub — ${e.toLocaleString()} stars`,className:`flex shrink-0 items-center gap-1 rounded-full border border-border px-1.5 py-px font-mono text-[10px] font-medium text-soft-foreground outline-none hover:bg-muted hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50`,children:[(0,Y.jsx)(`span`,{"aria-hidden":`true`,children:`⭐`}),(0,Y.jsx)(`span`,{children:t})]})}function yf({title:e}){return(0,Y.jsx)(`header`,{"data-slot":`mobile-top-bar`,className:`row-start-1 border-b border-border bg-card pt-[env(safe-area-inset-top)] md:hidden`,children:(0,Y.jsxs)(`div`,{className:`flex h-11 items-center gap-2.5 px-3`,children:[(0,Y.jsx)(jr,{asChild:!0,children:(0,Y.jsx)(K,{variant:`ghost`,size:`icon`,"aria-label":`Open menu`,className:`-ml-1.5 size-11`,children:(0,Y.jsx)(As,{className:`size-[17px]`,"aria-hidden":`true`})})}),(0,Y.jsx)(`span`,{className:`truncate text-[14.5px] font-semibold`,children:e}),(0,Y.jsx)(`div`,{"data-slot":`mobile-status`,className:`ml-auto flex items-center gap-2`})]})})}var bf=J.createContext(null);function xf({children:e}){let[t,n]=J.useState(`active`),r=J.useMemo(()=>[t,n],[t]);return(0,Y.jsx)(bf.Provider,{value:r,children:e})}function Sf(){let e=J.useContext(bf);if(!e)throw Error(`useListView must be used inside a <ListViewProvider>`);return e}var Cf=1e4,wf=e=>Math.min(100,Math.max(0,e)),Tf=e=>e===void 0||e<80?`ok`:e<90?`warn`:`critical`;function Ef(){let e=Ao(),t=Fo();return!e||t!==`local`?null:(0,Y.jsx)(Df,{})}function Df(){let e=Uo(),t=Wo(),n=Go(),[r,i]=(0,J.useState)(!1);(0,J.useEffect)(()=>{if(n===void 0){i(!1);return}let e=n+Cf-Date.now();if(e<=0){i(!0);return}i(!1);let t=setTimeout(()=>i(!0),e);return()=>clearTimeout(t)},[n]);let a=e===void 0?void 0:Do(e),o=a?.cpuPct,s=r?`stale`:a!==void 0&&a.cpuLimited&&o===void 0?`—`:o===void 0?t.length===0?`sampling…`:`—`:`${Math.round(o)}%`,c=a===void 0||a.memUsedBytes===void 0||a.memTotalBytes<=0?void 0:a.memUsedBytes/a.memTotalBytes*100,l=r?`stale`:c===void 0?`—`:`${Math.round(c)}%`,u=a===void 0?`—`:ko(a.memUsedBytes,a.memTotalBytes),d=a?.cpuLimited===!0?`${a.cpuLimitKind===`cpuset`?`cpuset `:``}${Oo(a.cpuCores)}`:void 0,f=`CPU ${s}${d===void 0?``:` of ${d}`}, RAM ${l} (${u})`;return(0,Y.jsxs)(V,{to:`/settings/resources`,"data-slot":`host-usage-widget`,"data-state":r?`stale`:`live`,"data-frames":t.length,"aria-label":`Machine usage: ${f}. Open Settings, Resources.`,title:f,className:G(`grid grid-cols-[auto_minmax(0,1fr)_auto_auto_minmax(0,1fr)_auto] items-center gap-x-1.5 rounded-md border border-border px-2 py-1 text-[11px] leading-[14px] text-soft-foreground transition-colors hover:bg-muted hover:text-foreground`,r?`opacity-70`:null),children:[(0,Y.jsx)(Of,{label:`CPU`,pct:r?void 0:o,valueSlot:`host-usage-widget-cpu`,value:s}),(0,Y.jsx)(Of,{label:`RAM`,pct:r?void 0:c,valueSlot:`host-usage-widget-mem-pct`,value:l,gutter:!0})]})}function Of({label:e,pct:t,valueSlot:n,value:r,gutter:i}){let a=Tf(t);return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`span`,{className:G(`font-medium tracking-wide text-muted-foreground`,i===!0?`ml-1`:null),children:e}),(0,Y.jsx)(`span`,{"data-slot":`host-usage-widget-${e.toLowerCase()}-bar`,"data-level":a,role:`meter`,"aria-label":e,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":t===void 0?void 0:Math.round(wf(t)),className:`h-1.5 overflow-hidden rounded-full bg-muted`,children:(0,Y.jsx)(`span`,{className:G(`block h-full rounded-full transition-[width] duration-500`,a===`critical`?`bg-destructive`:a===`warn`?`bg-pending`:`bg-primary`),style:{width:`${t===void 0?0:wf(t)}%`}})}),(0,Y.jsx)(`span`,{"data-slot":n,className:G(`text-right font-medium tabular-nums`,a===`critical`?`text-destructive`:a===`warn`?`text-pending-strong`:`text-foreground`),children:r})]})}var kf=[`claude`,`codex`,`junie`,`opencode`,`cursor`,`pi`,`copilot`],Af={claude:`Claude Code`,codex:`Codex`,opencode:`OpenCode`,cursor:`Cursor`,pi:`pi`,junie:`Junie`,copilot:`GitHub Copilot CLI`};function jf(e){if(typeof e!=`object`||!e||Array.isArray(e))return{};let t=e,n={};for(let e of kf){let r=t[e];typeof r==`string`&&r.length>0&&r.length<=128&&(n[e]=r)}return n}function Mf(e,t){if(!e)return[];let n=new Map(e.providers.map(e=>[e.provider,e]));return kf.flatMap(e=>{let r=n.get(e);return r?.status!==`disconnected`||!r.authFailureId||t[e]===r.authFailureId?[]:[{provider:e,label:Af[e],authFailureId:r.authFailureId}]})}function Nf(e,t){return{...e,...Object.fromEntries(t.map(({provider:e,authFailureId:t})=>[e,t]))}}function Pf({status:e,pending:t,error:n,dismissals:r,onDismissAuthFailures:i}){if(t||!e)return null;let a;try{a=f(e)}catch{return null}let o=Mf(a,r);if(o.length>0)return(0,Y.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,Y.jsx)(eo,{tone:`danger`}),(0,Y.jsxs)(`span`,{children:[`Provider authentication failed during a task:`,` `,o.map(({label:e})=>e).join(`, `),`.`]}),(0,Y.jsx)(V,{to:`/settings/agents#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,Y.jsx)(`button`,{type:`button`,"aria-label":`Dismiss provider authentication alert`,onClick:()=>i(o),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,Y.jsx)(xa,{className:`size-4`,"aria-hidden":`true`})})]});if(n||a.providers.some(e=>e.enabled&&e.status===`connected`))return null;let s=a.providers.some(e=>e.status===`connected`),c=a.providers.some(e=>e.status===`unknown`);return(0,Y.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,Y.jsx)(eo,{tone:c?`danger`:`pending`}),(0,Y.jsx)(`span`,{children:s?`No agent provider is enabled.`:c?`No connected provider could be verified.`:`No agent provider credentials were found.`}),(0,Y.jsx)(V,{to:`/settings/agents#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 Ff(e){if(!(typeof e!=`object`||!e||Array.isArray(e)))return e}function If(){let e=Rt(),t=It(),n=I(),r=(0,J.useRef)(Promise.resolve()),i=(0,J.useRef)(0),a=(0,J.useRef)(0),o=(0,J.useRef)(Ff(t.data));(0,J.useEffect)(()=>{a.current===0&&(o.current=Ff(t.data))},[t.data]);let c=(0,J.useCallback)(e=>{let t=z.uiState,c=Ff(n.getQueryData(t)),l=Nf(jf(c?.dismissedProviderAuthFailures),e),u={...c,dismissedProviderAuthFailures:l};a.current+=1,n.setQueryData(t,u);let d=++i.current;r.current=r.current.then(async()=>{try{let e=await s({dismissedProviderAuthFailures:l});o.current=Ff(e),d===i.current&&n.setQueryData(t,e)}catch(e){d===i.current&&(o.current===void 0?n.removeQueries({queryKey:t,exact:!0}):n.setQueryData(t,o.current),n.invalidateQueries({queryKey:t}),L(e instanceof Error?e.message:String(e),{tone:`danger`}))}finally{--a.current}})},[n]);return(0,Y.jsx)(Pf,{status:e.data,pending:e.isPending,error:e.isError,dismissals:jf(Ff(t.data)?.dismissedProviderAuthFailures),onDismissAuthFailures:c})}var Lf=`https://github.com/open-mercato/cezar/blob/main/docs/telemetry.md`,Rf=`https://github.com/open-mercato/cezar/blob/main/packages/cezar/src/telemetry.ts`;function zf(e){return e!==void 0&&e.consent===`unknown`&&e.blockedBy===null}var Bf=[`How many tasks you start (agent, model)`,`How many messages you send`,`Which pages you open`,`Errors, with your paths removed`,`Version, OS, app or CLI`,`A random install id`],Vf=[`Prompts, messages, code, diffs`,`File paths`,`Repo, branch or project names`,`Keys or credentials`,`Your IP, in any payload`];function Hf(){let e=I();return(0,J.useCallback)(async t=>{try{let n=await Pe({consent:t});return e.setQueryData(z.telemetryConsent,n),t===`denied`&&wt(),!0}catch(e){return L(e instanceof Error?e.message:String(e),{tone:`danger`}),!1}},[e])}function Uf({busy:e,onAnswer:t,size:n}){let r=n===`lg`?`min-h-11`:`h-9`;return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(K,{variant:`outline`,className:r,disabled:e,"data-slot":`telemetry-deny`,onClick:()=>t(`denied`),children:`Don’t share`}),(0,Y.jsx)(K,{className:r,disabled:e,"data-slot":`telemetry-grant`,onClick:()=>t(`granted`),children:`Share usage data`})]})}function Wf(){let e=E(),t=Hf(),[n,r]=(0,J.useState)(!1),[i,a]=(0,J.useState)(!1);if(!zf(e.data))return null;let o=async e=>{r(!0);let n=await t(e);r(!1),n&&a(!1)};return(0,Y.jsxs)(`div`,{"data-slot":`telemetry-consent-banner`,className:`px-4 pb-3 md:px-5 md:pb-4`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-3 rounded-lg border bg-card px-4 py-3 shadow-lg`,children:[(0,Y.jsx)(Vs,{className:`hidden size-[18px] shrink-0 text-violet sm:block`,"aria-hidden":`true`}),(0,Y.jsxs)(`p`,{className:`min-w-0 flex-1 basis-[280px] text-[13px] leading-relaxed text-muted-foreground`,children:[(0,Y.jsx)(`span`,{className:`font-medium text-foreground`,children:`Help improve cezar?`}),` With your OK we send task counts and crash reports to the maintainers — never prompts, code, paths or repo names. Change it anytime in Settings → Privacy.`,` `,(0,Y.jsx)(`button`,{type:`button`,"data-slot":`telemetry-details`,className:`underline underline-offset-2 hover:text-foreground`,onClick:()=>a(!0),children:`Details`})]}),(0,Y.jsx)(`div`,{className:`flex gap-2`,children:(0,Y.jsx)(Uf,{busy:n,onAnswer:e=>void o(e),size:`sm`})})]}),(0,Y.jsx)(Kf,{open:i,onOpenChange:a,busy:n,onAnswer:e=>void o(e)})]})}function Gf({title:e,tone:t,items:n}){let r=t===`ok`?oa:xa;return(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`span`,{className:`block text-[13px] font-medium text-foreground`,children:e}),(0,Y.jsx)(`ul`,{className:`mt-2 space-y-1.5`,children:n.map(e=>(0,Y.jsxs)(`li`,{className:`flex gap-2 text-[13px] leading-snug text-muted-foreground`,children:[(0,Y.jsx)(r,{className:`mt-0.5 size-3.5 shrink-0 ${t===`ok`?`text-success`:`text-soft-foreground`}`,"aria-hidden":`true`}),e]},e))})]})}function Kf({open:e,onOpenChange:t,busy:n,onAnswer:r}){return(0,Y.jsx)(xi,{open:e,onOpenChange:t,children:(0,Y.jsx)(Oi,{"data-slot":`telemetry-details-dialog`,className:`max-h-[calc(100dvh-2rem)] gap-0 overflow-y-auto p-0 sm:max-w-[480px]`,onOpenAutoFocus:e=>{e.preventDefault(),e.currentTarget.focus()},children:(0,Y.jsxs)(`div`,{className:`space-y-5 p-6`,children:[(0,Y.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Y.jsx)(`span`,{className:`block font-mono text-[11px] font-semibold uppercase tracking-[0.14em] text-muted-foreground`,children:`What is sent`}),(0,Y.jsx)(_i,{className:`text-xl font-semibold tracking-tight`,children:`Usage data, in full`}),(0,Y.jsx)(Ei,{className:`text-sm leading-relaxed text-muted-foreground`,children:`Counts of what you use and reports of what broke, so cezar’s maintainers at Open Mercato can fix bugs without you filing them. Off until you say yes.`})]}),(0,Y.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Y.jsx)(Gf,{title:`Shared`,tone:`ok`,items:Bf}),(0,Y.jsx)(Gf,{title:`Never shared`,tone:`no`,items:Vf})]}),(0,Y.jsxs)(`p`,{className:`text-xs leading-relaxed text-soft-foreground`,children:[`Every label is a closed list the server enforces. Withdraw anytime in Settings → Privacy or with `,(0,Y.jsx)(`code`,{className:`font-mono`,children:`cezar telemetry disable`}),` — the install id is deleted.`,` `,(0,Y.jsx)(`a`,{href:Rf,target:`_blank`,rel:`noopener noreferrer`,className:`underline underline-offset-2 hover:text-foreground`,children:`Read the code`}),` · `,(0,Y.jsx)(`a`,{href:Lf,target:`_blank`,rel:`noopener noreferrer`,className:`underline underline-offset-2 hover:text-foreground`,children:`Privacy notice`})]}),(0,Y.jsx)(`div`,{className:`grid grid-cols-2 gap-2`,children:(0,Y.jsx)(Uf,{busy:n,onAnswer:r,size:`lg`})})]})})})}function qf(){return(0,Y.jsx)(`span`,{"data-slot":`unread-marker`,className:`sr-only`,children:`, unread`})}var Jf=`regular`,Yf=[{value:`regular`,label:`Regular`},{value:`automation`,label:`Automations`},{value:`all`,label:`All`}],Xf=`cez-task-origin`;function Zf(e){return e.automationId??e.automation?.automationId??e.automationTrigger?.automationId??e.automationTracker?.automationId}function Qf(e,t){let n=Zf(e);if(n!==void 0)return n;let r=e.dispatch?.rootRunId;if(r===void 0||r===e.id)return;let i=t(r);return i===void 0?void 0:Zf(i)}function $f(e,t){return t===`all`?!0:t===`automation`?e!==void 0:e===void 0}function ep(e){return e===`regular`||e===`automation`||e===`all`?e:Jf}function tp(){try{return ep(localStorage.getItem(Xf))}catch{return Jf}}var np=new Set,rp;function ip(e){try{localStorage.setItem(Xf,e)}catch{rp=e}for(let e of np)e()}function ap(){return rp??tp()}function op(e){np.add(e);let t=t=>{(t.key===null||t.key===`cez-task-origin`)&&e()};return window.addEventListener(`storage`,t),()=>{np.delete(e),window.removeEventListener(`storage`,t)}}function sp(){return[J.useSyncExternalStore(op,ap,()=>Jf),ip]}var cp={statuses:[],workflows:[],automations:[]};function lp(e){return e.statuses.length+e.workflows.length+e.automations.length}function up(e){let t=new Map(e.map(e=>[e.id,e]));return new Map(e.map(e=>[e.id,Qf(e,e=>t.get(e))]))}var dp=(e,t)=>e.length===0||t!==void 0&&e.includes(t);function fp(e,t,n,r){return e.filter(e=>{let i=r.get(e.id);return!(!$f(i,t)||!dp(n.statuses,e.status)||!dp(n.workflows,vn(e))||t!==`regular`&&!dp(n.automations,i))})}function pp(e,t){return t===`all`?[...e]:fp(e,t,cp,up(e))}function mp(e,t,n,r,i){let a=new Map;for(let o of fp(e,t,{...n,[i]:[]},r)){let e=i===`statuses`?o.status:i===`workflows`?vn(o):r.get(o.id);e!==void 0&&a.set(e,(a.get(e)??0)+1)}return a}function hp(e,t,n){return{regular:fp(e,`regular`,t,n).length,automation:fp(e,`automation`,t,n).length,all:fp(e,`all`,t,n).length}}function gp(e){let t=new Set;for(let n of e)n!==void 0&&t.add(n);return[...t].sort((e,t)=>e.localeCompare(t))}function _p(e){let t=new Map;for(let n of e)t.has(n.id)||t.set(n.id,{run:n,depth:0,children:[],childCount:0,descendantCount:0});let n=e=>{let n=e.dispatch?.parentRunId;if(n===void 0||n===e.id)return null;let r=t.get(n);if(r===void 0)return null;let i=new Set([e.id]),a=r;for(;a!==void 0;){if(i.has(a.run.id))return null;i.add(a.run.id);let e=a.run.dispatch?.parentRunId;a=e===void 0?void 0:t.get(e)}return r},r=[];for(let i of e){let e=t.get(i.id);if(e===void 0||e.run!==i)continue;let a=n(i);a===null?r.push(e):a.children.push(e)}let i=(e,t)=>{e.depth=t,e.childCount=e.children.length;let n=0;for(let r of e.children)n+=1+i(r,t+1);return e.descendantCount=n,n};for(let e of r)i(e,0);return r}function vp(e,t){let n=[],r=e=>{for(let i of e)n.push(i),(i.children.length===0||t===void 0||t(i.run.id))&&r(i.children)};return r(e),n}function yp(e,t){return vp(_p(e),t)}function bp(e){return e<=0?null:`${e} subtask${e===1?``:`s`}`}function xp(e){return e.dispatch?.parentRunId===void 0?null:e.dispatch.kind??`implement`}function Sp({runs:e,view:t,onViewChange:n,currentRunId:r=null,now:i=Date.now(),showTokens:a=!0,showCost:o=!0,onTogglePin:s}){let c=le(e),l=y(e,t),u=t===`archived`?void 0:s;return(0,Y.jsxs)(`div`,{"data-slot":`quick-list`,children:[(0,Y.jsx)(`div`,{className:`sticky top-0 z-10 bg-sidebar pt-2 pb-1`,children:(0,Y.jsxs)(`div`,{className:`inline-flex w-full gap-0.5 rounded-md bg-muted p-[3px]`,children:[(0,Y.jsxs)(Tp,{view:`active`,current:t,onSelect:n,count:c.active,children:[`Active`,c.waiting>0&&t!==`active`?(0,Y.jsx)(eo,{tone:`pending`,pulse:!0,"data-slot":`waiting-dot`,"aria-label":`needs you`}):null]}),(0,Y.jsx)(Tp,{view:`archived`,current:t,onSelect:n,count:c.archived,children:`Archived`})]})}),l.length===0?(0,Y.jsx)(`p`,{className:`px-3 py-3.5 text-xs text-soft-foreground`,children:t===`archived`?`Nothing archived yet.`:`No tasks yet — describe one.`}):(0,Y.jsx)(Cp,{buckets:l,currentRunId:r,now:i,showTokens:a,showCost:o,onTogglePin:u})]})}function Cp({buckets:e,currentRunId:t=null,now:n=Date.now(),scope:r=null,showTokens:i=!0,showCost:a=!0,onTogglePin:o}){let[s,c]=J.useState(()=>new Set),l=e=>c(t=>{let n=new Set(t);return n.delete(e)||n.add(e),n});return(0,Y.jsx)(Y.Fragment,{children:e.map(e=>(0,Y.jsxs)(`div`,{"data-slot":`quick-list-bucket`,"data-bucket":e.label,children:[(0,Y.jsx)(`h2`,{className:`px-3 pt-2.5 pb-1 text-[11px] font-semibold tracking-[0.04em] text-soft-foreground uppercase`,children:e.label}),wp(e.rows).map(e=>(0,Y.jsx)(Ep,{row:e.run.row,depth:e.depth,childCount:e.childCount,currentRunId:t,now:n,scope:r,showTokens:i,showCost:a,expanded:e.run.row.kind===`group`&&s.has(e.run.row.groupId),onToggle:l,onTogglePin:o},e.run.id))]},e.label))})}function wp(e){return yp(e.map(e=>e.kind===`group`?{id:`group:${e.groupId}`,row:e}:{id:e.run.id,dispatch:e.run.dispatch,row:e}))}function Tp({view:e,current:t,onSelect:n,count:r,children:i}){let a=e===t;return(0,Y.jsxs)(`button`,{type:`button`,"data-slot":`view-tab`,"data-view":e,"aria-pressed":a,onClick:()=>n(e),className:G(`flex h-7 flex-1 items-center justify-center gap-1.5 rounded-[7px] text-[12.5px] font-medium text-muted-foreground`,a&&`bg-card font-semibold text-foreground shadow-xs`),children:[i,r>0?(0,Y.jsx)(`span`,{className:`font-mono text-[11px] tabular-nums`,children:r}):null]})}function Ep({row:e,depth:t,childCount:n,currentRunId:r,now:i,scope:a,expanded:o,onToggle:s,showTokens:c,showCost:l,onTogglePin:u}){return e.kind===`run`?(0,Y.jsx)(kp,{run:e.run,depth:t,childCount:n,queuePosition:e.queuePosition,currentRunId:r,now:i,scope:a,showTokens:c,showCost:l,onTogglePin:u}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`div`,{className:`flex items-center rounded-sm hover:bg-muted`,children:[(0,Y.jsxs)(`button`,{type:`button`,"data-slot":`group-tile`,"data-group-id":e.groupId,"aria-expanded":o,onClick:()=>s(e.groupId),className:`flex min-w-0 flex-1 items-center gap-2 px-2.5 py-[7px] text-left`,children:[(0,Y.jsx)(ma,{className:G(`size-3 shrink-0 text-soft-foreground transition-transform`,!o&&`-rotate-90`),"aria-hidden":`true`}),(0,Y.jsx)(`span`,{className:`min-w-[7rem] flex-1 truncate text-[13px] font-medium`,children:e.title}),(0,Y.jsxs)(`span`,{className:`shrink-0 rounded-full bg-muted px-1.5 py-px font-mono text-[10.5px] font-semibold text-muted-foreground`,children:[`×`,e.members.length]})]}),(0,Y.jsx)(V,{to:We(a,`/compare/${e.groupId}`),"data-slot":`group-compare`,title:`Compare the variants`,"aria-label":`Compare the variants of ${e.title}`,className:`mr-1.5 inline-flex size-6 shrink-0 items-center justify-center rounded-sm text-soft-foreground hover:bg-violet/10 hover:text-violet`,children:(0,Y.jsx)(zs,{className:`size-3.5`,"aria-hidden":`true`})})]}),o?e.members.map(e=>(0,Y.jsx)(kp,{run:e,queuePosition:null,currentRunId:r,now:i,scope:a,variant:!0,showTokens:c,showCost:l,onTogglePin:u},e.id)):null]})}var Dp=`w-0 overflow-hidden opacity-0 group-hover/task-row:-ml-1 group-hover/task-row:mr-1 group-hover/task-row:w-5 group-hover/task-row:opacity-100 group-focus-within/task-row:-ml-1 group-focus-within/task-row:mr-1 group-focus-within/task-row:w-5 group-focus-within/task-row:opacity-100 no-hover:-ml-1 no-hover:mr-1 no-hover:size-7 no-hover:opacity-100 data-[pinned=true]:-ml-1 data-[pinned=true]:mr-1 data-[pinned=true]:w-5 data-[pinned=true]:opacity-100`,Op=`group-hover/task-row:hidden group-focus-within/task-row:hidden no-hover:hidden`,kp=J.memo(function({run:e,depth:t=0,childCount:n=0,queuePosition:r,currentRunId:i,now:a,scope:o,variant:s=!1,showTokens:c,showCost:l,onTogglePin:d}){let f=D(e),p=e.id===i,m=xn(e),h=xt(e),g=u(h,m?.number)?ae(h).rest:h,_=Gr(e),v=Lr(e),y=s?``:r===null?to(e.finishedAt??e.createdAt,a):`#${r}`,b=bp(n),x=xp(e);return(0,Y.jsxs)(`div`,{"data-slot":`task-row`,"data-run-id":e.id,"data-active":p?`true`:void 0,"data-depth":t,style:t>0?{paddingLeft:`${10+t*14}px`}:void 0,className:G(`group/task-row flex items-center gap-2 rounded-sm pl-2.5 hover:bg-muted`,p&&`bg-muted`,s&&`pl-[26px]`),children:[(0,Y.jsx)(eo,{tone:f.tone,pulse:f.pulse,"aria-label":f.label,role:`img`}),m?(0,Y.jsx)(Rr,{run:e,reference:m,compact:!0,className:`h-auto shrink-0 gap-[2px] px-1.5 py-px text-[10.5px]`}):null,(0,Y.jsxs)(V,{to:We(o,`/tasks/${e.id}`),title:h,"aria-current":p?`page`:void 0,className:G(`flex min-w-0 flex-1 items-center gap-2 py-[7px]`,d?`pr-0.5`:`pr-2.5`),children:[s?(0,Y.jsx)(`span`,{className:`inline-flex size-[15px] shrink-0 items-center justify-center rounded-full bg-violet/15 font-mono text-[9.5px] font-semibold text-violet`,children:e.variant??`?`}):null,(0,Y.jsx)(`span`,{"data-slot":`task-row-title`,className:G(`min-w-[7rem] flex-1 truncate text-[13px]`,_?`font-semibold text-foreground`:v?`font-medium text-muted-foreground`:`font-medium`),children:s?Ap(e,c,l):g}),x?(0,Y.jsx)(`span`,{"data-slot":`dispatch-kind`,className:G(`shrink-0 rounded-full bg-muted px-1.5 py-px text-[10px] font-medium text-muted-foreground`,d&&(e.pinned?`hidden`:Op)),children:x}):null,e.diffStat?(0,Y.jsx)(mo,{stat:e.diffStat,className:`hidden shrink-0 text-[10.5px] @min-[23rem]/sidebar:inline`}):null,b?(0,Y.jsx)(`span`,{"data-slot":`subtask-count`,title:b,className:`hidden shrink-0 rounded-full bg-muted px-1.5 py-px text-[10px] font-medium text-muted-foreground @min-[19rem]/sidebar:inline`,children:n}):null,y&&(r!==null||!m)?(0,Y.jsx)(`span`,{"data-slot":`task-row-age`,className:G(`shrink-0 text-[11px] text-soft-foreground tabular-nums`,x&&t>0&&r===null&&`hidden @min-[19rem]/sidebar:inline`),children:y}):null,_?(0,Y.jsx)(qf,{}):null]}),d?(0,Y.jsx)(Hr,{pinned:!!e.pinned,onToggle:t=>d(e,t),className:Dp}):null]})});function Ap(e,t,n){let r=[e.runner??`claude`];t&&(e.inputTokens!==void 0||e.outputTokens!==void 0)&&r.push(go(e.inputTokens,e.outputTokens));let i=Kt(e.costUsd);return n&&i&&r.push(i),r.join(` · `)}function jp(){let e=Te(),t=ie(tn(),e.data?.bootProject??null),n=Me(),r=no(e.data),[i,a]=Sf(),[o]=sp(),s=J.useMemo(()=>t.data?pp(t.data,o):void 0,[t.data,o]),c=Ot(`/tasks/:id/*`),l=Ot(`/tasks/:id`),u=fo(3e4),d=J.useCallback((e,t)=>n.mutate({id:e.id,pinned:t},{onError:e=>L(e.message,{tone:`danger`})}),[n.mutate]),f=qe(),p=J.useMemo(()=>f===void 0?[]:(s??[]).flatMap(e=>ge(e).map(e=>({projectId:f,kind:e.kind,number:e.number}))),[s,f]);return s?(0,Y.jsx)(bi,{projectId:f,requests:p,children:(0,Y.jsx)(Sp,{runs:s,view:i,onViewChange:a,currentRunId:c?.params.id??l?.params.id??null,now:u,showTokens:r.tokens,showCost:r.cost,onTogglePin:d})}):null}var Mp=`cez-sidebar-collapsed`;function Np(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 Pp(){try{let e=localStorage.getItem(Mp);return e===null?{}:Np(JSON.parse(e))}catch{return{}}}function Fp(e){try{localStorage.setItem(Mp,JSON.stringify(e))}catch{}}function Ip(e,t,n){let r=e?.[t];return r===void 0?t!==n:r}var Lp=10;function Rp(e){let[t,n]=J.useState(Pp),r=J.useRef(t),i=J.useCallback(e=>{r.current=e,Fp(e),n(e)},[]);return{collapsed:t,toggle:J.useCallback(t=>{i({...r.current,[t]:!Ip(r.current,t,e)})},[e,i]),expand:J.useCallback(e=>{if(!(e in r.current))return;let t={...r.current};delete t[e],i(t)},[i])}}function zp({projects:e,bootProjectId:t,inboxAvailable:n=!1,automationsAvailable:r=!1,inboxCount:i=null,skillsUpdateAvailable:a=!1}){let{pathname:o}=Re(),s=_t(o),c=s??t,{collapsed:l,toggle:u,expand:d}=Rp(c),[f]=Sf(),p=Du(zt(o)),m=Ot(`/tasks/:id/*`),h=Ot(`/tasks/:id`),g=m?.params.id??h?.params.id??null,_=fo(3e4),v=no(Te().data),{order:y,canReorder:b,setOrder:x}=Xu(),S=J.useMemo(()=>{let t=qu(e,y),n=t.filter(e=>e.unregistered);return n.length===0?t:[...n,...t.filter(e=>!e.unregistered)]},[e,y]),C=J.useMemo(()=>S.map(e=>e.id),[S]),w=Tr(ur(Cr,{activationConstraint:{distance:4}}),ur(cr,{coordinateGetter:yr})),T=b&&S.length>1,E=J.useCallback(e=>{let{active:t,over:n}=e;if(n===null||n.id===t.id)return;let r=C.indexOf(String(t.id)),i=C.indexOf(String(n.id));r===-1||i===-1||x(Ju(C,r,i))},[C,x]),D=J.useMemo(()=>{let e=e=>{let t=C.indexOf(String(e));return{name:S[t]?.name??String(e),position:`position ${t+1} of ${C.length}`}};return{onDragStart:({active:t})=>{let{name:n,position:r}=e(t.id);return`Picked up ${n}, ${r}.`},onDragOver:({active:t,over:n})=>n?`${e(t.id).name} moved to ${e(n.id).position}.`:`${e(t.id).name} is not over a drop position.`,onDragEnd:({active:t,over:n})=>n?`${e(t.id).name} dropped at ${e(n.id).position}.`:`${e(t.id).name} dropped. The order is unchanged.`,onDragCancel:({active:t})=>`Reordering cancelled. ${e(t.id).name} returned to ${e(t.id).position}.`}},[S,C]),O=S.map(e=>(0,Y.jsx)(Vp,{project:e,boot:e.id===t,active:e.id===s,collapsed:Ip(l,e.id,c),onToggle:u,onSelect:d,view:f,activeTo:p,currentRunId:g,now:_,inboxAvailable:n,automationsAvailable:r,inboxCount:i,skillsUpdateAvailable:a,showTokens:v.tokens,showCost:v.cost,sortable:T,position:C.indexOf(e.id)+1,total:C.length},e.id));return(0,Y.jsx)(`div`,{"data-slot":`project-group-list`,children:(0,Y.jsx)(mr,{sensors:w,collisionDetection:Er,accessibility:{announcements:D},onDragEnd:E,children:(0,Y.jsx)(fr,{items:C,strategy:br,children:O})})})}function Bp({name:e,position:t,total:n,disabled:r,handleProps:i}){return(0,Y.jsx)(`button`,{type:`button`,"data-slot":`project-group-grip`,disabled:r,"aria-label":`Reorder ${e}, position ${t} of ${n}`,className:G(`flex h-11 w-6 shrink-0 cursor-grab items-center justify-center rounded text-muted-foreground opacity-0 outline-none transition-opacity md:h-[34px] md:w-4`,`touch-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`,r&&`cursor-default group-hover/row:opacity-0 group-focus-within/row:opacity-0 [@media(hover:none)]:opacity-0`),...i,children:(0,Y.jsx)(bs,{"aria-hidden":`true`,className:`size-3.5`})})}function Vp({project:e,boot:t,active:n,collapsed:r,onToggle:i,onSelect:o,view:s,activeTo:c,currentRunId:l,now:u,inboxAvailable:d,automationsAvailable:f,inboxCount:p,skillsUpdateAvailable:m,showTokens:h,showCost:g,sortable:_,position:v,total:b}){let x=e.status===`missing`,S=_&&!x&&!e.unregistered,{attributes:C,listeners:w,setNodeRef:T,transform:E,transition:D,isDragging:O}=hr({id:e.id,disabled:!S}),k={transform:or.Translate.toString(E),transition:D},A=(0,Y.jsx)(Bp,{name:e.name,position:v,total:b,disabled:!S,handleProps:{...C,...w}}),j=a(e.id,!r&&!x,t),M=ef(),N=Me(e.id,t?`default`:e.id),P=J.useCallback((e,t)=>N.mutate({id:e.id,pinned:t},{onError:e=>L(e.message,{tone:`danger`})}),[N.mutate]),[F]=sp(),ee=j.data?le(j.data).waiting:0,te=j.data?be(y(pp(j.data,F),s),Lp):[],ne=te.flatMap(t=>t.rows.flatMap(t=>ge(t.kind===`run`?t.run:t.members[0]).map(t=>({projectId:e.id,kind:t.kind,number:t.number}))));if(x)return(0,Y.jsx)(`div`,{ref:T,style:k,"data-slot":`project-group`,"data-project":e.id,"data-status":`missing`,className:G(`mb-1`,O&&`relative z-10 opacity-40`),children:(0,Y.jsxs)(`div`,{className:`flex items-center`,children:[(0,Y.jsx)(`span`,{"aria-hidden":`true`,className:`w-6 shrink-0 md:w-4`}),(0,Y.jsxs)(`div`,{"data-slot":`project-group-header`,title:`${e.root} is gone — remove it in Global settings → Projects`,className:`flex h-11 min-w-0 flex-1 items-center gap-[7px] rounded-lg px-2 text-[13px] font-semibold opacity-55 md:h-[34px]`,children:[(0,Y.jsx)(`span`,{className:`w-3 shrink-0`,"aria-hidden":`true`}),(0,Y.jsx)(`span`,{className:`truncate`,children:e.name}),(0,Y.jsx)(`span`,{"data-slot":`project-missing`,className:`ml-auto shrink-0 rounded-full bg-danger/15 px-[7px] py-px text-[10px] font-medium text-danger`,children:`folder not found`})]})]})});let re=`project-group-${e.id}`;return(0,Y.jsxs)(`div`,{ref:T,style:k,"data-slot":`project-group`,"data-project":e.id,"data-status":e.status,"data-collapsed":r?``:void 0,"data-dragging":O?``:void 0,"data-active":n?``:void 0,className:G(`mb-1`,O&&`relative z-10 opacity-40`),children:[(0,Y.jsxs)(`div`,{className:`group/row flex items-center`,children:[A,(0,Y.jsxs)(`div`,{"data-slot":`project-group-row`,className:G(`flex min-w-0 flex-1 items-center rounded-lg transition-colors hover:bg-muted`,n&&`bg-muted`),children:[(0,Y.jsx)(`button`,{type:`button`,onClick:()=>i(e.id),"aria-expanded":!r,"aria-controls":re,"aria-label":`${r?`Expand`:`Collapse`} ${e.name}`,"data-slot":`project-group-disclosure`,className:G(`flex h-11 w-[27px] shrink-0 items-center justify-center rounded-lg md:h-[34px]`),children:(0,Y.jsx)(ma,{className:G(`size-3 shrink-0 text-muted-foreground transition-transform`,r&&`-rotate-90`),"aria-hidden":`true`})}),(0,Y.jsxs)(V,{to:We(e.id,`/`),onClick:()=>{o(e.id),M?.()},"aria-current":n?`true`:void 0,"data-slot":`project-group-header`,className:G(`flex h-11 min-w-0 flex-1 items-center gap-[7px] rounded-lg pr-2 text-left text-[13px] font-semibold md:h-[34px]`,n&&`text-foreground`),children:[(0,Y.jsx)(`span`,{className:`truncate`,children:e.name}),e.unregistered?(0,Y.jsx)(`span`,{"data-slot":`project-unregistered`,title:`cezar is serving this folder — it is not in your saved projects. Add it in Global settings → Projects.`,className:`shrink-0 rounded-full bg-muted px-[7px] py-px text-[10px] font-medium text-soft-foreground`,children:`not saved`}):null,ee?(0,Y.jsx)(`span`,{"data-slot":`project-attention`,title:`${ee} task${ee===1?``:`s`} need${ee===1?`s`:``} you`,className:`shrink-0 rounded-full bg-violet px-1.5 py-px text-[10.5px] font-semibold text-violet-foreground`,children:ee}):null,e.branch?(0,Y.jsx)(`span`,{"data-slot":`project-branch`,className:`ml-auto max-w-[92px] truncate font-mono text-[10.5px] font-medium text-soft-foreground`,children:e.branch}):null]})]})]}),r?null:(0,Y.jsxs)(`div`,{id:re,"data-slot":`project-group-body`,className:`mt-1 ml-[14px] border-l border-border pl-2`,children:[(0,Y.jsx)(`nav`,{"aria-label":`${e.name} navigation`,children:Tu({forge:e.forge===`github`,inbox:d,automations:f,tracker:e.tracker}).map(t=>{let r=n&&t.to===c,i=t.icon;return(0,Y.jsxs)(V,{to:We(e.id,t.to),onClick:M,"aria-current":r?`page`:void 0,className:G(`flex h-11 w-full items-center gap-2.5 rounded-md px-2.5 text-[13px] font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground md:h-[30px]`,r&&`bg-muted font-semibold text-foreground`),children:[(0,Y.jsx)(i,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),t.label,t.badge===`inbox-count`&&n&&p?(0,Y.jsx)(`span`,{"data-slot":`nav-badge`,className:`ml-auto rounded-full bg-violet px-1.5 py-px text-[10.5px] font-semibold text-violet-foreground`,children:p}):null,t.badge===`skills-update`&&n&&m?(0,Y.jsxs)(`span`,{"data-slot":`nav-update-marker`,className:`ml-auto flex items-center`,children:[(0,Y.jsx)(`span`,{className:`size-1.5 rounded-full bg-violet`,"aria-hidden":`true`}),(0,Y.jsx)(`span`,{className:`sr-only`,children:`Skills update available`})]}):null]},t.to)})}),(0,Y.jsx)(bi,{projectId:e.id,requests:ne,children:(0,Y.jsx)(Cp,{buckets:te,currentRunId:n?l:null,now:u,scope:e.id,showTokens:h,showCost:g,onTogglePin:s===`archived`?void 0:P})}),(0,Y.jsx)(V,{to:We(e.id,`/`),onClick:M,"data-slot":`project-group-more`,className:`flex h-9 items-center rounded-md px-3 text-[12px] text-muted-foreground transition-colors hover:text-foreground md:h-7`,children:`More…`})]})]})}var Hp={claude:!0,codex:!0,junie:!0,opencode:!0,cursor:!0,pi:!0,copilot:!0},Up=e=>Object.hasOwn(Hp,e.name);function Wp(e){let t=e.checks.filter(Up);if(t.length&&!t.some(e=>e.available))return`no agent CLI found — install one to run tasks`;let n=t.find(t=>t.name===e.defaultRunner);return n&&!n.available?`default runner (${e.defaultRunner}) not found`:null}function Gp(e){let t=`cezar v${e.version}`,n=Wp(e);if(n)return`${t} · ${n}`;let r=e.checks.filter(e=>!e.available).map(e=>e.name);return r.length?`${t} · optional: ${r.join(`, `)} not installed`:t}function Kp(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 qp({health:e}){if(!e)return null;let t=Wp(e);return(0,Y.jsxs)(Pa,{children:[(0,Y.jsx)(Sa,{asChild:!0,children:(0,Y.jsxs)(`button`,{type:`button`,"data-slot":`tools-menu-trigger`,title:Gp(e),className:`flex items-center gap-1.5 rounded-full border border-border px-2 py-0.5 text-[11px] font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`,children:[(0,Y.jsx)(eo,{tone:t?`pending`:`success`}),`Tools`,(0,Y.jsx)(ma,{className:`size-[11px]`,"aria-hidden":`true`})]})}),(0,Y.jsxs)(Aa,{side:`top`,align:`start`,"data-slot":`tools-menu-content`,className:`w-[240px]`,children:[(0,Y.jsx)(Da,{className:`text-[11px] font-semibold tracking-[.04em] text-soft-foreground uppercase`,children:`Installed tools`}),e.checks.map(e=>e.available?(0,Y.jsx)(Jp,{check:e},e.name):(0,Y.jsx)(Yp,{check:e},e.name)),Kp(e)?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Na,{}),(0,Y.jsx)(`p`,{"data-slot":`forge-note`,className:`px-2 py-1.5 text-[11px] leading-snug text-muted-foreground`,children:Kp(e)})]}):null,(0,Y.jsx)(Na,{}),(0,Y.jsx)(Ma,{asChild:!0,children:(0,Y.jsxs)(V,{to:`/settings/agents`,"data-slot":`tools-settings`,className:`gap-2 text-[12.5px] text-muted-foreground`,children:[(0,Y.jsx)(Bs,{className:`size-3.5`,"aria-hidden":`true`}),`Tool settings`]})})]})]})}function Jp({check:e}){return(0,Y.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,Y.jsx)(eo,{tone:`success`}),(0,Y.jsx)(`span`,{className:`font-mono text-[12.5px] font-medium`,children:e.name}),(0,Y.jsx)(`span`,{"data-slot":`tool-version`,className:`ml-auto font-mono text-[11.5px] font-medium text-muted-foreground tabular-nums`,children:e.version??`not found`})]})}function Yp({check:e}){return(0,Y.jsx)(Ma,{asChild:!0,children:(0,Y.jsxs)(V,{to:`/settings/agents`,"data-slot":`tool-row`,"data-tool":e.name,"data-available":`false`,className:`flex-col items-stretch gap-1`,children:[(0,Y.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(eo,{tone:`danger`}),(0,Y.jsx)(`span`,{className:`font-mono text-[12.5px] font-medium`,children:e.name}),(0,Y.jsx)(`span`,{"data-slot":`tool-version`,className:`ml-auto font-mono text-[11.5px] font-medium text-muted-foreground`,children:`not found`})]}),(0,Y.jsxs)(`span`,{className:`flex items-end justify-between gap-3 pl-[15px]`,children:[e.hint?(0,Y.jsx)(`span`,{"data-slot":`tool-hint`,className:`min-w-0 text-[11px] leading-snug text-muted-foreground`,children:e.hint}):null,(0,Y.jsx)(`span`,{"data-slot":`tool-setup`,className:`ml-auto shrink-0 text-[11.5px] font-semibold text-violet`,children:`Set up →`})]})]})})}function Xp(e){return e?.trim()||null}function Zp({projectName:e,pageLabel:t,brandName:n}){let r=Xp(e),i=Xp(t),a=Xp(n??null)??`cezar`;return r&&i?`${r} — ${i} · ${a}`:r?`${r} · ${a}`:i?`${i} · ${a}`:a}function Qp(e){let t=Zp(e);(0,J.useEffect)(()=>{document.title=t},[t]),(0,J.useEffect)(()=>{let t=document.querySelector(`link[rel="icon"]`);t||(t=document.createElement(`link`),t.rel=`icon`,document.head.append(t)),t.href=e.brandLogoUrl??`/icon.svg`,t.type=e.brandLogoUrl?.includes(`.svg?`)?`image/svg+xml`:``},[e.brandLogoUrl])}var $p=`cez-last-location`;function em(){try{let e=localStorage.getItem($p);return e===null?null:JSON.parse(e)}catch{return null}}function tm(e){try{localStorage.setItem($p,JSON.stringify(e))}catch{}}var nm=new Set([`projectId`,`pathname`,`search`,`hash`]);function rm(e){if(typeof e!=`object`||!e||Array.isArray(e))return null;let t=e;if(Object.keys(t).some(e=>!nm.has(e))||typeof t.projectId!=`string`||t.projectId.length<1||t.projectId.length>64||typeof t.pathname!=`string`||t.pathname.length<1||t.pathname.length>2048||!t.pathname.startsWith(`/p/`)||t.search!==void 0&&(typeof t.search!=`string`||t.search.length>4096||!t.search.startsWith(`?`))||t.hash!==void 0&&(typeof t.hash!=`string`||t.hash.length>2048||!t.hash.startsWith(`#`)))return null;try{if(_t(t.pathname)!==t.projectId)return null}catch{return null}return{projectId:t.projectId,pathname:t.pathname,...t.search===void 0?{}:{search:t.search},...t.hash===void 0?{}:{hash:t.hash}}}function im(e,t){let n=t.projects.find(t=>t.id===e);return n!==void 0&&n.status!==`missing`}function am(e,t){if(t===void 0)return null;let n;try{n=_t(e.pathname)}catch{return null}return n===null||!im(n,t)?null:rm({projectId:n,pathname:e.pathname,...e.search===``?{}:{search:e.search},...e.hash===``?{}:{hash:e.hash}})}function om(e,t,n){let r=rm(e);return r===null||!(t===void 0?n!==void 0&&r.projectId===n:im(r.projectId,t))?null:`${r.pathname}${r.search??``}${r.hash??``}`}function sm(e,t){if(e===void 0)return t;let{projects:n}=e;return n.length===0||n.some(e=>e.id===t)?t:qu(n.filter(e=>e.status!==`missing`),[])[0]?.id??t}function cm(e,t){let n=rm(e);return n!==null&&n.projectId===t.projectId&&n.pathname===t.pathname&&(n.search??``)===(t.search??``)&&(n.hash??``)===(t.hash??``)}function lm(){return(0,Y.jsxs)(`div`,{"data-route":`automations`,className:`flex min-h-full flex-col`,children:[(0,Y.jsxs)(`header`,{className:`sticky top-0 z-10 hidden h-14 shrink-0 items-center gap-3 border-b border-border bg-background px-5 md:flex`,children:[(0,Y.jsx)(`h1`,{className:`text-base font-semibold`,children:`Automations`}),(0,Y.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Scheduled and GitHub-triggered runs.`})]}),(0,Y.jsx)(`p`,{"data-slot":`automations-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-6`,children:`Loading automations…`})]})}function um(){return(0,Y.jsx)(`div`,{"data-route":`compare`,className:`flex min-h-full flex-col`,children:(0,Y.jsx)(q,{icon:(0,Y.jsx)(Ra,{className:`motion-safe:animate-spin`}),tone:`neutral`,title:`Loading variants…`,subtitle:`Fetching every variant's status, spend and diff summary.`})})}function dm(){return(0,Y.jsx)(`div`,{"data-route":`github`,className:`flex min-h-full flex-col`,children:(0,Y.jsx)(q,{icon:(0,Y.jsx)(Ra,{className:`motion-safe:animate-spin`}),tone:`neutral`,title:`Loading GitHub…`,subtitle:`Fetching open issues and pull requests.`})})}var fm={workflow:null,skills:[],runner:null,model:null},pm=`cez-followup-selection`,mm=oi.map(e=>e.id);function hm(e){let t=e&&typeof e==`object`?e:{};return{workflow:typeof t.workflow==`string`?t.workflow:null,skills:Array.isArray(t.skills)?t.skills.filter(e=>typeof e==`string`):[],runner:mm.includes(t.runner)?t.runner:null,model:typeof t.model==`string`?t.model:null}}function gm(){try{let e=localStorage.getItem(pm);return e?hm(JSON.parse(e)):{...fm}}catch{return{...fm}}}function _m(e){try{localStorage.setItem(pm,JSON.stringify({...gm(),...e}))}catch{}}var vm=`cez-followup-prompt:`;function ym(e){try{return localStorage.getItem(vm+e)??``}catch{return``}}function bm(e,t){try{t===``?localStorage.removeItem(vm+e):localStorage.setItem(vm+e,t)}catch{}}function xm(e){let t=Rt(),n=ve(),r=w(t.data),i=n.data?.defaultRunner,a=mi(e.runner,r,i??r[0]??`claude`),o=d(a),s=n.data?.modelsLocked===!0,{accounts:c,repoAccount:l}=zi(),u=c.some(t=>t.provider===a&&t.id===e.account)?e.account:null;return{runner:a,runnerExplicit:e.runner!==null,model:Jr(s?null:e.model,a,n.data?.defaultModels,o.data),runners:r,defaultRunner:i,canRun:t.isSuccess&&r.length>0,modelsLocked:s,providerPending:t.isPending,providerError:t.isError,accounts:c,account:u,repoAccount:l}}function Sm(e){let[t,n]=(0,J.useState)(Cm);return(0,J.useEffect)(()=>{e&&_m({runner:t.runner,model:t.model})},[e,t.runner,t.model]),Em(t,n),[t,n]}function Cm(){let e=gm();return{runner:e.runner,model:e.model,account:null}}function wm(){return Sm(!0)}function Tm(){return Sm(!1)}function Em(e,t){let n=Rt(),r=ve(),i=w(n.data),a=mi(e.runner,i,r.data?.defaultRunner??i[0]??`claude`),o=n.isSuccess&&i.length>0,s=o&&e.runner!==null&&!i.includes(e.runner),c=o&&e.model!==null&&qr(e.model,a);(0,J.useEffect)(()=>{!s&&!c||t({...e,runner:s?null:e.runner,model:c?null:e.model})},[s,c,e,t])}function Dm(e){return{runner:Fr(e.runner,e.defaultRunner,e.runnerExplicit),model:e.modelsLocked?void 0:e.model||void 0}}function Om(e){return{...Dm(e),...e.account?{agentProfile:e.account}:{}}}function km({pick:e,onChange:t,disabled:n=!1,accounts:r=!1}){let i=xm(e),{runner:a,model:o,runners:s,canRun:c,modelsLocked:l}=i,u=ve(),f=d(a),p=fi(a,f.data,[e.model,u.data?.defaultModels?.[a]]),m=n||!c,h=r?i.accounts:[];return(0,Y.jsxs)(Y.Fragment,{children:[s.length>1||s.some(e=>Zi(h,e))?(0,Y.jsx)(ni,{runners:s,value:a,accounts:h,account:r?i.account:null,repoAccount:r?i.repoAccount:void 0,disabled:m,onPick:(n,i)=>t(r?{runner:n,account:i,model:n===a?e.model:null}:{runner:n,account:null,model:null})}):null,(0,Y.jsx)(Yr,{slot:`model-pill`,ariaLabel:`Model`,label:p.find(e=>e.id===o).label,value:o,disabled:m,readOnly:l===!0,disabledHint:l?`Model selection is locked to native coding-agent settings.`:void 0,onPick:n=>t({...e,model:n}),options:p.map(e=>({value:e.id,label:e.label,desc:e.desc})),status:$r(a,f.data,f.isError)})]})}function Am({templates:e,onInsert:t,triggerClassName:n,disabled:r,iconOnly:i=!1}){let[a,o]=(0,J.useState)(!1),s=(0,J.useRef)(null),c=Qe();return e.length===0?null:(0,Y.jsxs)(ki,{open:a,onOpenChange:o,children:[(0,Y.jsx)(Di,{asChild:!0,children:(0,Y.jsxs)(`button`,{type:`button`,"data-slot":`prompt-template-trigger`,"aria-label":`Insert a prompt template`,title:`Insert a prompt template`,disabled:r,className:G(`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`:`px-2.5`,n),children:[(0,Y.jsx)(Ps,{"aria-hidden":`true`,className:`size-3 shrink-0 text-violet`}),i?null:(0,Y.jsxs)(Y.Fragment,{children:[`templates`,(0,Y.jsx)(ma,{"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})]})}),(0,Y.jsx)(vi,{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,Y.jsxs)(so,{filter:Qi,children:[(0,Y.jsx)(co,{placeholder:`search templates…`,onInput:()=>s.current?.scrollTo(0,0)}),(0,Y.jsxs)(io,{ref:s,"data-slot":`prompt-template-list-menu`,className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[(0,Y.jsx)(ao,{children:`Nothing matches.`}),(0,Y.jsx)(ro,{heading:`Insert a template`,children:e.map(e=>(0,Y.jsxs)(uo,{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),o(!1)},children:[(0,Y.jsxs)(`span`,{className:`flex w-full items-center gap-1.5`,children:[(0,Y.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[12.5px] font-medium text-foreground`,children:e.label}),e.skills&&e.skills.length>0?(0,Y.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-[10px] font-medium text-violet`,children:[(0,Y.jsx)(ti,{"aria-hidden":`true`,className:`size-2.5`}),e.skills.length]}):null]}),(0,Y.jsx)(`span`,{className:`line-clamp-1 text-[11px] text-soft-foreground`,children:e.text})]},e.id))}),(0,Y.jsx)(oo,{}),(0,Y.jsx)(ro,{children:(0,Y.jsx)(uo,{value:`edit prompt templates settings`,"data-slot":`prompt-template-settings`,className:`text-[12px] text-muted-foreground`,onSelect:()=>{o(!1),c(`/settings/instructions#prompt-templates`)},children:`Edit templates…`})})]})]})})]})}var jm=D({status:`waiting`});function Mm(e){return e.filter(e=>!e.startedTaskId)}function Nm(e){return e.runnable??!!(e.suggestedSkill||e.suggestedPrompt)}function Pm(){let e=Te(),t=e.data?.capabilities.followups===!0,n=e.data!==void 0&&!t,r=we(!n),i=St(),a=r.data===void 0?void 0:Mm(r.data);return(0,Y.jsxs)(`div`,{"data-route":`inbox`,className:`flex min-h-full flex-col`,children:[(0,Y.jsxs)(`header`,{className:`sticky top-0 z-10 hidden h-14 shrink-0 items-center gap-3 border-b border-border bg-background px-5 md:flex`,children:[(0,Y.jsx)(`h1`,{className:`text-base font-semibold`,children:`Inbox`}),(0,Y.jsx)(`p`,{className:`text-[13px] text-soft-foreground`,children:n?`Disabled for this server; per-task Notes still run.`:`Follow-ups agents suggested when they finished a task.`})]}),(0,Y.jsx)(`div`,{className:`flex flex-1 flex-col p-3 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-5 md:pb-5`,children:n?(0,Y.jsx)(q,{icon:(0,Y.jsx)(Ss,{}),tone:`neutral`,title:`The follow-up inbox is off`,subtitle:`Agents are not asked to leave follow-ups. Set CEZ_FOLLOWUPS=1 and restart the service to turn the inbox on.`,heading:`h2`}):a===void 0?r.isError?(0,Y.jsx)(q,{icon:(0,Y.jsx)(Ia,{}),tone:`danger`,title:`Could not load the inbox`,subtitle:r.error.message,heading:`h2`}):null:a.length===0?e.isPending?null:(0,Y.jsx)(q,{icon:(0,Y.jsx)(Ss,{}),tone:`neutral`,title:`Inbox empty`,subtitle:`Agents drop follow-up suggestions here when they finish a task.`,heading:`h2`}):(0,Y.jsx)(`ul`,{"data-slot":`todo-list`,className:`mx-auto flex w-full max-w-3xl flex-col gap-2.5`,children:a.map(e=>(0,Y.jsx)(Fm,{todo:e,sourceTaskExists:e.taskId===void 0?null:i.data?.some(t=>t.id===e.taskId)??!1},e.id))})})]})}function Fm({todo:e,sourceTaskExists:t}){let n=Qe(),r=I(),i=Le(),[a,o]=Tm(),s=xm(a),[c,l]=(0,J.useState)(!1),[u,d]=(0,J.useState)(``),f=(0,J.useRef)(null),p=Te(),m=Ii(Ri(i.data?.promptTemplates),p.data?.capabilities),h=e=>{let t=f.current?.selectionStart??u.length,n=Ki(u,t,e);d(n.text),requestAnimationFrame(()=>{f.current?.focus(),f.current?.setSelectionRange(n.caret,n.caret)})},g=B({mutationFn:async()=>s.canRun?he(e.id,{...Dm(s),prompt:u.trim()||void 0}):null,onSuccess:e=>{if(e===null)return;di(`inbox`);let{run:t}=e;r.invalidateQueries({queryKey:R.todos}),r.invalidateQueries({queryKey:R.runs.all}),n(`/tasks/${t.id}`)},onError:e=>L(e.message,{tone:`danger`})}),_=B({mutationFn:()=>Vt(e.id),onSuccess:()=>{r.setQueryData(R.todos,t=>t?.filter(t=>t.id!==e.id)),r.invalidateQueries({queryKey:R.todos})},onError:e=>L(e.message,{tone:`danger`})}),v=g.isPending||_.isPending,y=Nm(e);return(0,Y.jsxs)(`li`,{"data-slot":`todo-card`,"data-id":e.id,className:`flex flex-col gap-2.5 rounded-lg border border-border bg-card p-4 shadow-xs`,children:[(0,Y.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,Y.jsx)(eo,{tone:jm.tone,pulse:jm.pulse,title:jm.label,className:`mt-[5px]`}),(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Y.jsx)(`p`,{"data-slot":`todo-summary`,className:`text-sm leading-snug font-medium text-foreground`,children:e.summary}),(0,Y.jsxs)(`div`,{"data-slot":`todo-meta`,className:`mt-1.5 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-soft-foreground`,children:[e.ts?(0,Y.jsxs)(`span`,{children:[to(e.ts),` ago`]}):null,e.action?(0,Y.jsx)(`span`,{children:e.action}):null,e.taskId===void 0?null:t?(0,Y.jsx)(V,{to:`/tasks/${e.taskId}`,"data-slot":`todo-source`,className:`text-muted-foreground underline decoration-border underline-offset-2 hover:text-foreground`,children:`source task`}):(0,Y.jsx)(`span`,{"data-slot":`todo-source-gone`,children:`source task deleted`}),Gn(e.prUrl)?(0,Y.jsx)(`a`,{href:e.prUrl,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`todo-pr`,className:`text-muted-foreground underline decoration-border underline-offset-2 hover:text-foreground`,children:`PR`}):null,e.suggestedSkill?(0,Y.jsxs)(`span`,{"data-slot":`todo-skill`,className:`font-mono`,children:[`skill: `,e.suggestedSkill]}):null]})]}),(0,Y.jsx)(`div`,{className:`flex shrink-0 items-center gap-1.5 self-center`,children:y?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(K,{type:`button`,variant:`contrast`,size:`sm`,"data-action":`todo-run`,title:`Start a task from this follow-up`,disabled:v||!s.canRun,onClick:()=>g.mutate(),children:[(0,Y.jsx)(Ls,{"aria-hidden":`true`,className:`size-3`}),`Run`]}),(0,Y.jsx)(K,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`todo-dismiss`,title:`Check off (remove)`,disabled:v,onClick:()=>_.mutate(),children:`Dismiss`})]}):(0,Y.jsxs)(K,{type:`button`,variant:`contrast`,size:`sm`,"data-action":`todo-acknowledge`,title:`Acknowledge and remove this note`,disabled:v,onClick:()=>_.mutate(),children:[(0,Y.jsx)(oa,{"aria-hidden":`true`,className:`size-3`}),`Acknowledge`]})})]}),y?(0,Y.jsxs)(`div`,{"data-slot":`todo-engine`,className:`flex flex-wrap items-center gap-2 pl-5`,children:[(0,Y.jsx)(km,{pick:a,onChange:o,disabled:v||!s.canRun}),!s.providerPending&&!s.canRun?(0,Y.jsxs)(`span`,{"data-slot":`todo-provider-gate`,className:`inline-flex flex-wrap items-center gap-1 text-xs text-muted-foreground`,children:[s.providerError?`Provider authentication could not be verified.`:`Connect an agent provider to run this follow-up.`,(0,Y.jsx)(V,{to:`/settings/agents#providers`,className:`font-medium text-foreground underline underline-offset-4`,children:`Configure providers`})]}):null]}):null,y?c?(0,Y.jsxs)(`div`,{"data-slot":`todo-instructions`,className:`flex flex-col gap-2 pl-5`,children:[(0,Y.jsx)(aa,{ref:f,"data-slot":`todo-instructions-input`,"aria-label":`Extra instructions for this follow-up`,value:u,onChange:e=>d(e.target.value),placeholder:`Add instructions for the agent… (appended to the suggestion above)`,maxLength:2e4,className:`min-h-16 text-[13px]`}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(Am,{templates:m,onInsert:h}),(0,Y.jsx)(`button`,{type:`button`,"data-slot":`todo-instructions-hide`,onClick:()=>l(!1),className:`text-xs font-medium text-muted-foreground underline decoration-border underline-offset-2 hover:text-foreground`,children:`Hide`})]})]}):(0,Y.jsx)(`button`,{type:`button`,"data-slot":`todo-instructions-toggle`,onClick:()=>l(!0),className:`self-start pl-5 text-xs font-medium text-muted-foreground underline decoration-border underline-offset-2 hover:text-foreground`,children:u.trim()?`Edit instructions (added)`:`+ Add instructions`}):null]})}function Im({onLongPress:e,onClick:t,delayMs:n=450,moveTolerance:r=8}){let i=(0,J.useRef)({onLongPress:e,onClick:t});i.current={onLongPress:e,onClick:t};let a=(0,J.useRef)(null),o=(0,J.useRef)({x:0,y:0}),s=(0,J.useRef)(!1),c=(0,J.useCallback)(()=>{a.current!==null&&(clearTimeout(a.current),a.current=null)},[]);return(0,J.useEffect)(()=>c,[c]),{onPointerDown:(0,J.useCallback)(e=>{s.current=!1,c(),e.button===0&&(o.current={x:e.clientX??0,y:e.clientY??0},a.current=setTimeout(()=>{a.current=null,s.current=!0,i.current.onLongPress()},n))},[c,n]),onPointerMove:(0,J.useCallback)(e=>{if(a.current===null)return;let t=(e.clientX??0)-o.current.x,n=(e.clientY??0)-o.current.y;Math.hypot(t,n)>r&&c()},[c,r]),onPointerUp:c,onPointerCancel:c,onContextMenu:(0,J.useCallback)(e=>{e.preventDefault(),c(),!s.current&&(s.current=!0,i.current.onLongPress())},[c]),onClick:(0,J.useCallback)(e=>{if(s.current){s.current=!1,e.preventDefault();return}i.current.onClick?.()},[]),onKeyDown:(0,J.useCallback)(e=>{(e.key===`ArrowDown`||e.key===`Enter`&&e.shiftKey)&&(e.preventDefault(),i.current.onLongPress())},[])}}function Lm({available:e,value:t,onChange:n,onSettingsOpenChange:r,runners:i,parentRunner:a,parentModels:o}){let[s,c]=(0,J.useState)(!1),l=Ao(),u=(0,J.useRef)({});t!==null&&(u.current=t);let f=(t??u.current).runner??a,p=d(f,e&&f!==a),m=f===a?o:fi(f,p.data),h=e=>{c(e),r?.(e)},g=t!==null,_=Im({onLongPress:()=>h(!0),onClick:()=>n(g?null:u.current)});if(!e)return null;let v=(0,Y.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":g,"aria-label":`Dispatch`,"data-slot":`dispatch-toggle`,"data-state":g?`on`:`off`,..._,className:G(l?`inline-flex h-full w-[26px] items-center justify-center transition-colors hover:bg-muted`:G(Qr,`w-[26px] justify-center px-0`),g&&(l?`hover:bg-primary/15`:`border-primary/60 bg-primary/10 text-primary hover:bg-primary/15 hover:text-primary`)),children:(0,Y.jsx)(Hs,{"aria-hidden":`true`,className:G(`size-3 shrink-0`,g?`text-primary`:`text-soft-foreground`)})}),y=(0,Y.jsx)(Wm,{value:t,remembered:u.current,onChange:n,runners:i,models:m}),b=(0,Y.jsxs)(fa,{side:`top`,sideOffset:6,className:`max-w-[260px]`,children:[(0,Y.jsx)(`div`,{className:`font-medium`,children:g?`Dispatch — on`:`Dispatch — off`}),(0,Y.jsx)(`div`,{className:`text-contrast-foreground/80`,children:g?`Splits this task into subtasks it runs as separate tasks`:`Let this task split into subtasks`}),l?(0,Y.jsx)(`div`,{className:`mt-0.5 text-contrast-foreground/60`,children:`▾ limits and subtask defaults`}):null]}),x=l?(0,Y.jsxs)(`span`,{"data-slot":`dispatch-control`,"data-state":g?`on`:`off`,className:G(`inline-flex h-[26px] items-stretch overflow-hidden rounded-full border border-border bg-card text-muted-foreground transition-colors`,g&&`border-primary/60 bg-primary/10 text-primary`),children:[(0,Y.jsx)(ha,{delayDuration:300,children:(0,Y.jsxs)(_a,{children:[(0,Y.jsx)(ua,{asChild:!0,children:v}),b]})}),(0,Y.jsx)(`button`,{type:`button`,"aria-label":`Dispatch settings`,"aria-haspopup":`dialog`,"aria-expanded":s,"data-slot":`dispatch-settings-trigger`,onClick:()=>h(!s),className:G(`inline-flex w-[18px] items-center justify-center border-l border-border transition-colors hover:bg-muted`,g&&`border-primary/40 hover:bg-primary/15`),children:(0,Y.jsx)(ma,{"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})})]}):(0,Y.jsx)(ha,{delayDuration:300,children:(0,Y.jsxs)(_a,{children:[(0,Y.jsx)(ua,{asChild:!0,children:v}),b]})});return l?(0,Y.jsxs)(ki,{open:s,onOpenChange:h,children:[(0,Y.jsx)(wi,{asChild:!0,children:x}),(0,Y.jsx)(vi,{align:`start`,sideOffset:8,"data-slot":`dispatch-settings`,className:`w-[340px] max-w-[calc(100vw-2rem)] p-3.5`,children:y})]}):(0,Y.jsxs)(Y.Fragment,{children:[x,(0,Y.jsx)(Mr,{open:s,onOpenChange:h,children:(0,Y.jsxs)(Ar,{side:`bottom`,"data-slot":`dispatch-settings`,className:`rounded-t-xl p-4 pt-16 pb-[max(1rem,env(safe-area-inset-bottom))]`,children:[(0,Y.jsx)(kr,{className:`sr-only`,children:`Dispatch`}),(0,Y.jsx)(Dr,{className:`sr-only`,children:`Split this task into subtasks run as separate tasks`}),y]})})]})}function Rm({label:e,htmlFor:t,children:n}){return(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Y.jsx)(`label`,{htmlFor:t,className:`shrink-0 text-xs text-foreground`,children:e}),n]})}var zm=`h-7 max-w-[180px] rounded-md border border-input bg-card px-2 text-xs shadow-xs outline-none transition-[color,box-shadow] hover:bg-muted focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50`,Bm=[2,3,4,5,8,10,15,20,30,50],Vm=.5,Hm=1e4;function Um(e){let t={};return e.maxSubtasks!==void 0&&(t.maxSubtasks=e.maxSubtasks),e.inFlight!==void 0&&(t.inFlight=e.inFlight),e.runner!==void 0&&(t.runner=e.runner),e.model!==void 0&&(t.model=e.model),e.budgetUsd!==void 0&&(t.budgetUsd=e.budgetUsd),t}function Wm({value:e,remembered:t,onChange:n,runners:r,models:i}){let a=(0,J.useId)(),o=e!==null,s=e??t,c=e=>n(Um({...s,...e})),l=i.filter(e=>e.id!==``),u=oi.filter(e=>r.includes(e.id)),d=s.maxSubtasks!==void 0&&!Bm.some(e=>e===s.maxSubtasks)?[...Bm,s.maxSubtasks].sort((e,t)=>e-t):[...Bm];return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,Y.jsxs)(`header`,{className:`flex items-start gap-2.5`,children:[(0,Y.jsx)(`span`,{"aria-hidden":`true`,className:`flex size-7 shrink-0 items-center justify-center rounded-full bg-primary/10 text-primary`,children:(0,Y.jsx)(Hs,{className:`size-3.5`})}),(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Y.jsx)(`div`,{className:`text-[13px] font-semibold leading-tight text-foreground`,children:`Dispatch`}),(0,Y.jsx)(`p`,{className:`mt-0.5 text-xs leading-snug text-muted-foreground`,children:`Split this task into subtasks run as separate tasks`})]}),(0,Y.jsx)(fu,{"aria-label":`Dispatch`,"data-slot":`dispatch-settings-switch`,checked:o,onCheckedChange:e=>n(e?t:null)})]}),(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2 border-t border-border pt-3`,children:[(0,Y.jsx)(Rm,{label:`Max subtasks`,htmlFor:`${a}-max`,children:(0,Y.jsxs)(`select`,{id:`${a}-max`,"data-slot":`dispatch-max-subtasks`,className:zm,value:s.maxSubtasks??``,onChange:e=>c({maxSubtasks:e.target.value===``?void 0:Number(e.target.value)}),children:[(0,Y.jsx)(`option`,{value:``,children:`unlimited`}),d.map(e=>(0,Y.jsx)(`option`,{value:e,children:e},e))]})}),(0,Y.jsx)(Rm,{label:`In flight at once`,htmlFor:`${a}-flight`,children:(0,Y.jsx)(`select`,{id:`${a}-flight`,"data-slot":`dispatch-in-flight`,className:zm,value:s.inFlight??4,onChange:e=>{let t=Number(e.target.value);c({inFlight:t===4?void 0:t})},children:Array.from({length:4},(e,t)=>t+1).map(e=>(0,Y.jsx)(`option`,{value:e,children:e},e))})}),(0,Y.jsx)(Rm,{label:`Subtask runner`,htmlFor:`${a}-runner`,children:(0,Y.jsxs)(`select`,{id:`${a}-runner`,"data-slot":`dispatch-runner`,className:zm,value:s.runner??``,onChange:e=>c({runner:e.target.value===``?void 0:e.target.value,model:void 0}),children:[(0,Y.jsx)(`option`,{value:``,children:`same as parent`}),u.map(e=>(0,Y.jsx)(`option`,{value:e.id,children:e.label},e.id))]})}),(0,Y.jsx)(Rm,{label:`Subtask model`,htmlFor:`${a}-model`,children:(0,Y.jsxs)(`select`,{id:`${a}-model`,"data-slot":`dispatch-model`,className:zm,value:s.model??``,onChange:e=>c({model:e.target.value===``?void 0:e.target.value}),children:[(0,Y.jsx)(`option`,{value:``,children:`same as parent`}),l.map(e=>(0,Y.jsx)(`option`,{value:e.id,children:e.label},e.id)),s.model!==void 0&&!l.some(e=>e.id===s.model)?(0,Y.jsx)(`option`,{value:s.model,children:s.model}):null]})}),(0,Y.jsx)(Rm,{label:`Budget per subtask`,htmlFor:`${a}-budget`,children:(0,Y.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,Y.jsx)(cu,{id:`${a}-budget`,"data-slot":`dispatch-budget`,type:`number`,inputMode:`decimal`,placeholder:`none`,step:.5,min:Vm,max:Hm,className:`h-7 w-24 px-2 text-xs md:text-xs`,value:s.budgetUsd??``,onChange:e=>{let t=e.target.value,n=Number(t);c({budgetUsd:t===``||!Number.isFinite(n)||n<=0?void 0:Math.min(Hm,Math.max(Vm,n))})}}),(0,Y.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`USD`})]})})]}),(0,Y.jsxs)(`p`,{className:`text-xs leading-snug text-muted-foreground`,children:[`The engine keeps its own brakes: `,4,` in flight and budgets carved out of this task's. These only tell the agent what you want.`]})]})}var Gm=38,Km=280,qm=900,Jm=600,Ym=5500,Xm=1400,Z=e=>({text:e,tone:`key`}),Zm=e=>({text:e,tone:`str`}),Qm=e=>({text:e,tone:`fn`}),$m=e=>({text:e,tone:`com`}),eh=e=>({text:e,tone:`num`}),Q=e=>({text:e}),th=[[[$m(`// task accepted — isolating a worktree`)],[Z(`const`),Q(` tree = `),Z(`await`),Q(` git.`),Qm(`worktree`),Q(`(task.branch)`)],[Z(`const`),Q(` agent = `),Qm(`spawn`),Q(`(runner, { tree, skills })`)],[Z(`for await`),Q(` (`),Z(`const`),Q(` event `),Z(`of`),Q(` agent.`),Qm(`stream`),Q(`()) {`)],[Q(` cockpit.`),Qm(`render`),Q(`(event)`)],[Q(`}`)]],[[Q(`$ cezar run `),Zm(`--worktree --autonomous`)],[Zm(`✓`),Q(` worktree ready · base `),Zm(`main`)],[Zm(`✓`),Q(` agent started`)],[$m(`… editing src/routes/new-task.tsx`)],[Zm(`✓`),Q(` tests green · `),eh(`+42 −7`)],[Zm(`✓`),Q(` pull request opened`)]],[[$m(`# flaky: replay before touching code`)],[Z(`def`),Q(` `),Qm(`stabilize`),Q(`(test):`)],[Q(` `),Z(`for`),Q(` attempt `),Z(`in`),Q(` `),Qm(`range`),Q(`(`),eh(`3`),Q(`):`)],[Q(` `),Z(`if`),Q(` `),Qm(`run`),Q(`(test).ok:`)],[Q(` `),Z(`return`),Q(` `),Zm(`'green'`)],[Q(` `),Z(`return`),Q(` `),Qm(`quarantine`),Q(`(test)`)]],[[$m(`// apply the reviewed plan, step by step`)],[Z(`let`),Q(` diff = worktree.`),Qm(`diff`),Q(`()?;`)],[Z(`match`),Q(` `),Qm(`review`),Q(`(diff) {`)],[Q(` Ok(pr) => gh::`),Qm(`open`),Q(`(pr),`)],[Q(` Err(e) => `),Qm(`retry`),Q(`(e, backoff),`)],[Q(`}`)]],[[$m(`// merge when every check is green`)],[Z(`func`),Q(` `),Qm(`merge`),Q(`(pr *PullRequest) `),Z(`error`),Q(` {`)],[Q(` `),Z(`if`),Q(` err := ci.`),Qm(`Wait`),Q(`(pr); err != `),Z(`nil`),Q(` {`)],[Q(` `),Z(`return`),Q(` err`)],[Q(` }`)],[Q(` `),Z(`return`),Q(` gh.`),Qm(`Merge`),Q(`(pr)`)],[Q(`}`)]],[[$m(`-- which branches ship the most?`)],[Z(`select`),Q(` branch, `),Qm(`count`),Q(`(*) `),Z(`as`),Q(` runs`)],[Z(`from`),Q(` tasks`)],[Z(`where`),Q(` status = `),Zm(`'green'`)],[Z(`group by`),Q(` branch`)],[Z(`order by`),Q(` runs `),Z(`desc`),Q(`;`)]],[[$m(`/* the composer glow, one token deep */`)],[Q(`.composer`),Z(`:focus-within`),Q(` {`)],[Q(` border-color: `),Qm(`var`),Q(`(--primary);`)],[Q(` box-shadow: `),eh(`0 0 0 3px`),Q(` `),Qm(`var`),Q(`(--ring);`)],[Q(` transition: box-shadow `),eh(`120ms`),Q(` ease;`)],[Q(`}`)]]],nh=[[`left-[3%] top-[12%]`,`left-[5%] top-[36%]`,`left-[8%] top-[58%]`],[`right-[3%] top-[14%]`,`right-[6%] top-[40%]`,`right-[4%] top-[62%]`],[`left-[28%] top-[66%]`,`left-[45%] top-[72%]`,`right-[26%] top-[70%]`]],rh={key:`var(--syn-key)`,str:`var(--syn-str)`,fn:`var(--syn-fn)`,com:`var(--syn-com)`,num:`var(--syn-num)`},ih=e=>e.reduce((e,t)=>e+t.text.length,0),ah=e=>e.reduce((e,t)=>e+ih(t)*Gm+Km,0);function oh(e){let t=[...e];for(let e=t.length-1;e>0;e--){let n=Math.floor(Math.random()*(e+1)),r=t[e];t[e]=t[n],t[n]=r}return t}function sh(){let e=oh(th).slice(0,nh.length),t=oh(nh.map(e=>e[Math.floor(Math.random()*e.length)]??``)),n=Jm;return{blocks:e.map((e,r)=>{let i=n;return n+=ah(e)+qm,{lines:e,slot:t[r]??``,startMs:i}}),cycleMs:n-qm+Ym+Xm}}function ch({block:e,cycleMs:t}){let n=e.startMs;return(0,Y.jsx)(`div`,{className:G(`ghost-code-block absolute font-mono text-[11.5px] leading-[1.9] text-soft-foreground`,e.slot),style:{"--cycle":`${t}ms`},children:e.lines.map((e,t)=>{let r=ih(e),i=n;return n+=r*Gm+Km,(0,Y.jsx)(`div`,{className:`ghost-code-line`,style:{"--n":r,"--t":`${r*Gm}ms`,"--d":`${i}ms`},children:e.map((e,t)=>(0,Y.jsx)(`span`,{style:e.tone?{color:rh[e.tone]}:void 0,children:e.text},t))},t)})})}var lh=`(prefers-reduced-motion: reduce)`;function uh(){let[e,t]=(0,J.useState)(()=>typeof window.matchMedia==`function`&&!window.matchMedia(lh).matches);return(0,J.useEffect)(()=>{if(typeof window.matchMedia!=`function`)return;let e=window.matchMedia(lh),n=e=>t(!e.matches);return e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)},[]),e}function dh(){let[e,t]=(0,J.useState)(0),n=uh(),r=(0,J.useMemo)(()=>sh(),[e]);return(0,J.useEffect)(()=>{if(!n)return;let e=window.setTimeout(()=>t(e=>e+1),r.cycleMs);return()=>window.clearTimeout(e)},[e,n,r.cycleMs]),(0,Y.jsx)(`div`,{"data-slot":`ghost-code-backdrop`,"aria-hidden":`true`,className:`pointer-events-none absolute inset-0 -z-10 overflow-hidden max-xl:hidden [mask-image:linear-gradient(to_bottom,black_30%,transparent_96%)]`,children:(0,Y.jsx)(`div`,{className:`contents`,children:r.blocks.map((e,t)=>(0,Y.jsx)(ch,{block:e,cycleMs:r.cycleMs},t))},e)})}function fh({label:e,url:t,hint:n,showIcon:r=!0,copySlot:i=`bm-copy`}){let a=(0,J.useRef)(null);(0,J.useEffect)(()=>{a.current?.setAttribute(`href`,t)},[t]);let o=async()=>{try{await navigator.clipboard.writeText(t),L(`Bookmarklet URL copied.`)}catch{L(`Copy failed — drag the button instead.`,{tone:`danger`})}};return(0,Y.jsxs)(`div`,{"data-slot":`bm-row`,className:`flex min-w-0 items-center gap-2.5`,children:[(0,Y.jsxs)(`a`,{ref:a,draggable:!0,"data-slot":`bm-link`,title:`Drag me to your bookmarks bar`,onClick:e=>{e.preventDefault(),L(`Drag me to your bookmarks bar`)},className:`inline-flex shrink-0 items-center gap-1.5 rounded-md border border-border bg-card px-2.5 py-1 font-mono text-xs font-medium text-foreground shadow-xs transition-colors hover:bg-muted`,children:[r?(0,Y.jsx)(ai,{"aria-hidden":`true`,className:`size-3 text-primary`}):null,e]}),(0,Y.jsx)(`button`,{type:`button`,"data-slot":i,title:`Copy the bookmarklet URL`,onClick:()=>void o(),className:`shrink-0 text-xs font-medium text-muted-foreground transition-colors hover:text-foreground`,children:`Copy`}),n?(0,Y.jsx)(`span`,{className:`min-w-0 truncate text-[11px] text-soft-foreground`,children:n}):null]})}var ph=`http://localhost:4321`;function mh(e,t,n,r=ph,i=null){let a=e=>encodeURIComponent(e).replaceAll(`'`,`%27`),o=`(()=>{const m=location.href.match(/^https:\\/\\/github\\.com\\/([^\\/]+)\\/([^\\/]+)\\/(pull|issues)\\/\\d+/);if(!m){alert('Open a GitHub PR or issue first');return;}const q='${`${e?`skill=${a(e)}&`:``}auto=${t?`1`:`0`}&key=${a(n)}&ref=`}'+encodeURIComponent(location.href);open('${r.replaceAll(`'`,`%27`)}${i===null||i===``?`/new`:`/p/${a(i)}/new`}?'+q,'_blank');})();`;return`javascript:${encodeURIComponent(o)}`}var hh={ai:`From this project’s .ai/skills; always enabled while present.`,cezar:`From this project’s .ai/cezar/skills; always enabled while present.`,agents:`From .agents/skills or an agent-specific folder; always enabled while present.`,global:`User-wide from ~/.agents/skills or ~/.claude/skills, shared across projects.`,team:`Shared from a team repository configured for this project; importable skills can be enabled or disabled here.`,builtin:`Built into Cezar rather than installed from a skill repository.`};function gh({source:e,className:t,teamRepo:n}){let r=Fi({source:e}),i=e===`team`&&n?`Shared from ${n}, a team skills repository configured for this project.`:hh[e];return(0,Y.jsx)(ha,{delayDuration:300,children:(0,Y.jsxs)(_a,{children:[(0,Y.jsx)(ua,{asChild:!0,children:(0,Y.jsx)(`span`,{"data-slot":`skill-source`,"data-source":e,"aria-label":i,className:G(`shrink-0 rounded-full border border-border px-2 py-px font-mono text-[10.5px]`,r?`font-semibold text-foreground`:`text-soft-foreground`,t),children:e})}),(0,Y.jsx)(fa,{side:`top`,sideOffset:6,className:`max-w-[260px]`,children:i})]})})}function _h({skill:e,usedBy:t,heading:n=`h2`,enabled:r=!0,activation:i}){return(0,Y.jsxs)(`div`,{"data-slot":`skill-detail`,className:`mx-auto w-full min-w-0 max-w-[var(--measure)]`,children:[(0,Y.jsxs)(`section`,{"data-slot":`skill-properties`,className:`rounded-lg border border-border bg-muted/20 p-4`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-start justify-between gap-4`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2.5`,children:[(0,Y.jsx)(n,{className:`min-w-0 font-mono text-lg font-semibold break-all`,children:e.name}),(0,Y.jsx)(gh,{source:e.source,teamRepo:e.team?.repo})]}),(0,Y.jsxs)(`p`,{"data-slot":`skill-path`,className:`mt-1 font-mono text-[10.5px] break-all text-soft-foreground`,children:[e.path,e.team?` · from ${e.team.repo}`:``]}),e.description?(0,Y.jsx)(`p`,{"data-slot":`skill-description`,className:`mt-2.5 text-[13px] text-muted-foreground`,children:e.description}):null]}),i?(0,Y.jsx)(fu,{"data-slot":`skill-activation-detail`,"aria-label":i.ariaLabel,checked:i.checked,disabled:i.disabled,onCheckedChange:i.onCheckedChange,size:`sm`,className:`mt-1.5 shrink-0`}):null]}),r?(0,Y.jsx)(vh,{skill:e}):null,t===void 0?null:(0,Y.jsxs)(`section`,{"data-slot":`skill-used-by`,className:`mt-4 border-t border-border pt-4`,children:[(0,Y.jsx)(`h3`,{className:`text-[11px] font-semibold tracking-[.04em] text-soft-foreground uppercase`,children:`Used by`}),t.length>0?(0,Y.jsx)(`ul`,{className:`mt-1.5 flex flex-col gap-1`,children:t.map(e=>(0,Y.jsxs)(`li`,{className:`flex items-center gap-1.5 font-mono text-xs text-muted-foreground`,children:[(0,Y.jsx)(es,{"aria-hidden":`true`,className:`size-3 shrink-0 text-soft-foreground`}),e]},e))}):(0,Y.jsx)(`p`,{className:`mt-1.5 text-xs text-soft-foreground`,children:`Not referenced by any workflow yet — quick-task picks it up when the task mentions it.`})]})]}),(0,Y.jsxs)(`section`,{"data-slot":`skill-content`,className:`mt-6 min-w-0 border-t border-border pt-5`,children:[(0,Y.jsx)(`h3`,{className:`text-[11px] font-semibold tracking-[.04em] text-soft-foreground uppercase`,children:`Content`}),(0,Y.jsx)(`div`,{"data-slot":`skill-body`,className:`mt-3 text-sm`,children:(0,Y.jsx)(xo,{children:e.body})})]})]})}function vh({skill:e}){let t=Oe(),n=Te(),r=ln(),[i,a]=(0,J.useState)(!1),o=t.data?.key??``,s=window.location.origin,c=tn()??n.data?.bootProject??null,l=r.data?.projects.find(e=>e.id===c)?.name??ax(n.data)?.name??null,u=mh(e.name,i,o,s,c);return(0,Y.jsxs)(`section`,{"data-slot":`skill-run-from-github`,className:`mt-5 border-t border-border pt-4`,children:[(0,Y.jsx)(`h3`,{className:`text-[11px] font-semibold tracking-[.04em] text-soft-foreground uppercase`,children:`Run from GitHub`}),(0,Y.jsx)(`p`,{className:`mt-1.5 text-xs text-muted-foreground`,children:`Drag the button to your bookmarks bar, then click it on a GitHub PR or issue.`}),(0,Y.jsxs)(`div`,{className:`mt-3 flex items-center gap-2 text-xs font-medium`,children:[(0,Y.jsx)(fu,{"data-slot":`bookmarklet-auto`,size:`sm`,"aria-label":`Start automatically`,checked:i,onCheckedChange:a}),(0,Y.jsx)(`span`,{children:`Start automatically`})]}),(0,Y.jsx)(`div`,{className:`mt-3`,children:(0,Y.jsx)(fh,{label:l?`/${e.name} (${l})`:`/${e.name}`,url:u,showIcon:!1,copySlot:`skill-bookmarklet-copy`})}),(0,Y.jsx)(`p`,{className:`mt-2 text-xs text-soft-foreground`,children:`To update an existing bookmarklet after changing this option, drag the button to your bookmarks bar again.`}),(0,Y.jsx)(V,{to:`/settings/bookmarklets`,"data-slot":`skill-bookmarklets-settings`,className:`mt-2 inline-block text-xs font-medium text-violet hover:underline`,children:`Manage saved bookmarklets`})]})}function yh({skill:e,onClose:t}){return(0,Y.jsx)(xi,{open:e!==null,onOpenChange:e=>e?void 0:t(),children:(0,Y.jsx)(Oi,{"data-slot":`skill-preview`,className:`block max-h-[80dvh] overflow-y-auto sm:max-w-2xl`,children:e?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(_i,{className:`sr-only`,children:e.name}),(0,Y.jsx)(Ei,{className:`sr-only`,children:`Skill preview with GitHub launcher`}),(0,Y.jsx)(_h,{skill:e,heading:`h3`}),(0,Y.jsx)(`p`,{className:`mt-5`,children:(0,Y.jsx)(V,{to:`/skills?skill=${encodeURIComponent(e.name)}`,"data-slot":`skill-preview-manage`,onClick:t,className:`text-xs font-semibold text-violet hover:underline`,children:`Open in the Skills catalog`})})]}):null})})}function bh({source:e,ready:t,skills:n,skillUsage:r,workflows:i,onPick:a}){let[o,s]=(0,J.useState)(!1),[c,l]=(0,J.useState)(``),[u,d]=(0,J.useState)(null),f=(0,J.useRef)(null),{mostUsed:p,project:m,global:h}=ea(Mi(n,c,r),r),g=i.find(e=>e.name===Vr),_=$i(i,c).filter(e=>e.name!==Vr),v=Ni(`no skill`,`none plain ${Vr} ${g?.description??``}`,c)>0,y=!v&&p.length===0&&m.length===0&&h.length===0&&_.length===0,b=e=>{a(e),s(!1)},x=t=>b(e?.source===t.source&&e.ref===t.ref?null:t),S=(t,n)=>{let r=e?.source===`skill`&&e.ref===t.name;return(0,Y.jsxs)(uo,{value:`skill ${t.name} ${t.path}`,keywords:Pi(t.name,t.description),"data-slot":`source-option`,"data-source-kind":`skill`,"data-source-ref":t.name,onSelect:()=>x({source:`skill`,ref:t.name}),children:[(0,Y.jsx)(`span`,{className:G(`shrink-0 font-mono text-xs`,n&&`font-semibold`),children:t.name}),t.description?(0,Y.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:t.description}):null,(0,Y.jsx)(`button`,{type:`button`,"data-slot":`source-skill-view`,"aria-label":`View skill ${t.name}`,title:`View skill`,onClick:e=>{e.preventDefault(),e.stopPropagation(),d(t)},className:`ml-auto shrink-0 rounded-sm p-0.5 text-soft-foreground transition-colors hover:text-foreground`,children:(0,Y.jsx)(Ta,{"aria-hidden":`true`,className:`size-3.5`})}),r?(0,Y.jsx)(oa,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-primary`}):null]},t.path)},C=e===null?Rs:e.source===`skill`?ti:qs,w=(0,Y.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(),a(null))},className:G(Qr,`font-mono text-[11.5px]`,e===null?`border-dashed text-soft-foreground`:`rounded-r-none border-r-0 border-foreground/60 pr-1.5 font-semibold text-foreground`),children:[(0,Y.jsx)(C,{"aria-hidden":`true`,className:G(`size-3 shrink-0`,e===null?`text-soft-foreground`:`text-violet`)}),(0,Y.jsx)(`span`,{className:`max-w-44 truncate`,children:t?e?.ref??`Skill`:`…`}),Zr]});return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(yh,{skill:u,onClose:()=>d(null)}),(0,Y.jsxs)(ki,{open:o,onOpenChange:e=>{s(e),e||l(``)},children:[(0,Y.jsxs)(`span`,{className:`inline-flex items-center`,children:[(0,Y.jsx)(Di,{asChild:!0,children:w}),e!==null&&t?(0,Y.jsx)(`button`,{type:`button`,"data-slot":`source-pill-clear`,"aria-label":`Clear the ${e.source} ${e.ref}`,title:`Run without it`,onClick:()=>a(null),className:G(Qr,`rounded-l-none border-foreground/60 pl-1.5 pr-2 text-soft-foreground hover:text-foreground`),children:(0,Y.jsx)(xa,{"aria-hidden":`true`,className:`size-3`})}):null]}),(0,Y.jsx)(vi,{align:`start`,sideOffset:8,className:`w-[336px] max-w-[calc(100vw-2rem)] p-0`,children:(0,Y.jsxs)(so,{shouldFilter:!1,children:[(0,Y.jsx)(co,{placeholder:`search skills & workflows…`,value:c,onValueChange:l,onInput:()=>f.current?.scrollTo(0,0)}),(0,Y.jsxs)(io,{ref:f,"data-slot":`source-menu`,className:`max-h-[min(18rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[y?(0,Y.jsx)(ao,{children:`Nothing matches.`}):null,v?(0,Y.jsx)(ro,{children:(0,Y.jsxs)(uo,{value:`none no-skill`,keywords:[`none`,`plain`,...Pi(Vr)],"data-slot":`source-option`,"data-source-kind":`none`,onSelect:()=>b(null),children:[(0,Y.jsx)(yi,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-soft-foreground`}),(0,Y.jsx)(`span`,{className:`shrink-0 text-xs font-medium`,children:`No skill`}),(0,Y.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:g?.description??`One agent run on your task — no ceremony.`}),e===null?(0,Y.jsx)(oa,{"aria-hidden":`true`,className:`ml-auto size-3.5 shrink-0 text-primary`}):null]})}):null,p.length>0?(0,Y.jsx)(ro,{heading:`Most used`,children:p.map(e=>S(e,Fi(e)))}):null,m.length>0?(0,Y.jsx)(ro,{heading:`Project skills`,children:m.map(e=>S(e,!0))}):null,_.length>0?(0,Y.jsx)(ro,{heading:`Workflows`,children:_.map(t=>{let n=e?.source===`workflow`&&e.ref===t.name;return(0,Y.jsxs)(uo,{value:`workflow ${t.name}`,keywords:Pi(t.name,t.description),"data-slot":`source-option`,"data-source-kind":`workflow`,"data-source-ref":t.name,onSelect:()=>x({source:`workflow`,ref:t.name}),children:[(0,Y.jsx)(`span`,{className:`shrink-0 font-mono text-xs`,children:t.name}),t.description?(0,Y.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:t.description}):null,n?(0,Y.jsx)(oa,{"aria-hidden":`true`,className:`ml-auto size-3.5 shrink-0 text-primary`}):null]},t.name)})}):null,h.length>0?(0,Y.jsx)(ro,{heading:`Global`,children:h.map(e=>S(e,!1))}):null]})]})})]})]})}function xh(e,t,n){let r=e.skill===``?{source:`workflow`,ref:`quick-task`}:{source:`skill`,ref:e.skill};return ei({task:e.ref,source:r,model:``,runner:t,defaultRunner:n,variants:1,images:[],todoId:e.todo})}function Sh(e,t){return e.kind===`failed`?{message:`Auto-start failed: ${e.message} — review and press Start`,tone:`danger`}:e.kind===`blocked`?{message:`Auto-start blocked (bad key) — review and press Start`,tone:`danger`}:t===``?{message:`Prefilled from link — review and press Start`,tone:`default`}:{message:`Unknown skill "${t}" — prefilled for quick-task; review and press Start`,tone:`danger`}}function Ch(e,t){return`Use the "${e}" skill on: ${t}`}function wh(e){let t=e.dispatch===!0,n=e.configuredAutonomous===`source-dependent`?e.source===`skill`:e.configuredAutonomous,r=e.interactive!==!0&&void 0;return{autonomous:e.explicitAutonomous??(t?!0:void 0)??r??n,worktree:e.hasGit?e.variants>1||t?!0:e.explicitWorktree??r??e.configuredWorktree:!1}}function Th(e){return e.dispatch===!0?e.autonomous===!0?`Runs on its own and fans work out to subtasks — it will not pause for you.`:`Fans work out to subtasks in isolated worktrees.`: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 Eh={text:``,source:null,runner:null,agentProfile:null,model:null,variants:1,worktree:null,autonomous:null,generateFollowups:null,dispatch:null},Dh=`cez-new-task-draft`;function Oh(e){return e===null?Dh:`${Dh}:${e}`}function kh(e){let t=e&&typeof e==`object`?e:{};return{text:typeof t.text==`string`?t.text:``,source:jh(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,variants:t.variants===2||t.variants===3?t.variants:1,worktree:typeof t.worktree==`boolean`?t.worktree:null,autonomous:typeof t.autonomous==`boolean`?t.autonomous:null,generateFollowups:typeof t.generateFollowups==`boolean`?t.generateFollowups:null,dispatch:Ah(t.dispatch)}}function Ah(e){if(!e||typeof e!=`object`||Array.isArray(e))return null;let t=e,n={},r=(e,t)=>typeof e==`number`&&Number.isInteger(e)&&e>=1&&e<=t?e:void 0,i=r(t.maxSubtasks,50);i!==void 0&&(n.maxSubtasks=i);let a=r(t.inFlight,4);return a!==void 0&&(n.inFlight=a),typeof t.runner==`string`&&oi.some(e=>e.id===t.runner)&&(n.runner=t.runner),typeof t.model==`string`&&t.model!==``&&t.model.length<=120&&(n.model=t.model),typeof t.budgetUsd==`number`&&Number.isFinite(t.budgetUsd)&&t.budgetUsd>0&&t.budgetUsd<=1e4&&(n.budgetUsd=t.budgetUsd),n}function jh(e){return!!e&&typeof e==`object`&&(e.source===`skill`||e.source===`workflow`)&&typeof e.ref==`string`}var Mh=new Map;function Nh(e=null){let t=Oh(e),n=Mh.get(t);if(n)return{...n};let r;try{let e=localStorage.getItem(t);r=e?kh(JSON.parse(e)):{...Eh}}catch{r={...Eh}}return Mh.set(t,r),{...r}}function Ph(e,t=null){let n=Oh(t);Mh.set(n,{...e});try{localStorage.setItem(n,JSON.stringify(e))}catch{}}function Fh(e=null){Ph({...Nh(e),text:``,source:null},e)}var Ih=new Map;function Lh(e=null){return[...Ih.get(Oh(e))??[]]}function Rh(e,t=null){let n=Oh(t);e.length===0?Ih.delete(n):Ih.set(n,[...e])}function zh(e,t){if(e===t)return{moved:!1,reason:`same-project`};let n=Nh(e),r=Lh(e);if(n.text===``&&r.length===0)return{moved:!1,reason:`nothing-to-move`};let i=Nh(t);return i.text!==``||Lh(t).length>0?{moved:!1,reason:`destination-busy`}:(Ph({...i,text:n.text},t),Ph({...n,text:``},e),Rh(r,t),Rh([],e),{moved:!0})}function Bh(e){let t=typeof e==`string`?new URLSearchParams(e):e;return{skill:(t.get(`skill`)??``).trim(),ref:(t.get(`ref`)??t.get(`task`)??``).trim(),auto:t.get(`auto`)===`1`,key:t.get(`key`)??``,todo:(t.get(`todo`)??``).trim()}}function Vh(){let[e]=ot(),t=Qe(),n=I(),{projectId:r}=o(),i=Se().projectId,a=ln(),[s]=(0,J.useState)(()=>Bh(e)),l=Te(),u=c(),f=Dn(),p=Pt(),m=Le(),h=ve(),g=st(),[v,y]=(0,J.useState)(()=>({...Nh(i),...s.ref===``?{}:{text:s.ref},...s.skill===``?{}:{source:{source:`skill`,ref:s.skill}}}));(0,J.useEffect)(()=>{Ph(v,i)},[v,i]);let b=e=>y(t=>({...t,...e})),[x,S]=(0,J.useState)(()=>Lh(i));(0,J.useEffect)(()=>{Rh(x,i)},[x,i]);let C=m.data?.recentSources,T=f.data,E=m.data?.skillUsage,D=(0,J.useMemo)(()=>Li(T??[],E),[T,E]),O=u.data?.workflows??[],k=a.data?.projects??[],A=e=>a.data?.bootProject===e?null:e,j=f.data!==void 0&&u.data!==void 0&&!m.isPending,M=Br(v.source,D,O),N=M?.source===`skill`?D.find(e=>e.name===M.ref):void 0,P=(0,J.useRef)(null),F=(0,J.useMemo)(()=>Ii(Ri(m.data?.promptTemplates),l.data?.capabilities),[m.data?.promptTemplates,l.data?.capabilities]),ee=Hi(F,M?.source===`skill`?[M.ref]:[]),te=(0,J.useRef)(v.text);te.current=v.text;let ne=(0,J.useRef)(``);(0,J.useEffect)(()=>{if(!j)return;let e=Ui(te.current,ne.current,ee);ne.current=e.applied,e.text!==te.current&&b({text:e.text})},[ee,j]);let re=Rt(),ie=w(re.data),ae=h.data?.defaultRunner,oe=ae??`claude`,se=ie.length>0?mi(v.runner,ie,oe):null,ce=se??oe,le=re.isSuccess&&ie.length>0,ue=d(ce),de=h.data?.modelsLocked===!0,fe=se===null?[]:fi(se,ue.data,[v.model,h.data?.defaultModels?.[se]]),pe=se===null?``:Jr(de?null:v.model,se,h.data?.defaultModels,ue.data),{accounts:me,repoAccount:he}=zi(),ge=me.some(e=>e.provider===ce&&e.id===v.agentProfile)?v.agentProfile:null,_e=(0,J.useRef)(!1);(0,J.useEffect)(()=>{let e=le&&!_e.current;_e.current=le,e&&document.activeElement===document.body&&document.querySelector(`textarea[aria-label="Describe a task for the agent"]`)?.focus()},[le]);let ye=p.data===void 0||p.data.info!==null,be=ye?v.variants:1,xe=ye,Ce=l.data?.capabilities.dispatch===!0&&ye,we=Ce?v.dispatch:null,Ee=we!==null,[De,Oe]=(0,J.useState)(!1),[ke,Ae]=(0,J.useState)(!1),je=(0,J.useRef)(null),Me=e=>{b({dispatch:e}),je.current!==null&&clearTimeout(je.current),je.current=null,Oe(e!==null),e!==null&&(je.current=setTimeout(()=>Oe(!1),6e3))};(0,J.useEffect)(()=>()=>{je.current!==null&&clearTimeout(je.current)},[]);let Ne=be>1||Ee,Pe=wh({hasGit:ye,variants:be,explicitAutonomous:v.autonomous,explicitWorktree:v.worktree,interactive:N?.interactive,configuredAutonomous:g.data?.composerDefaults?.autonomous??g.data?.composerDefaults?.inheritedAutonomous??`source-dependent`,configuredWorktree:g.data?.composerDefaults?.worktree??g.data?.composerDefaults?.inheritedWorktree??!0,source:M?.source??`workflow`,dispatch:Ee}),Fe=Pe.worktree,Ie=Pe.autonomous,Re=l.data===void 0||l.data.capabilities.followups,ze=Re?v.generateFollowups??m.data?.lastGenerateFollowups??!0:!1,[Ve,He]=(0,J.useState)(()=>s.auto&&s.ref!==``),[Ue,We]=(0,J.useState)(()=>!s.auto&&s.ref!==``?{kind:`prefill`}:null),Ge=(0,J.useRef)(!1),Ke=(0,J.useRef)(!1);return(0,J.useEffect)(()=>{Ge.current||(Ge.current=!0,e.toString()!==``&&t(`/new`,{replace:!0}))},[]),(0,J.useEffect)(()=>{if(!Ke.current&&!(!s.auto||s.ref===``)&&!re.isPending){if(!le||se===null){Ke.current=!0,We({kind:`prefill`}),He(!1);return}if(!h.isPending){if(Ke.current=!0,ae===void 0){We({kind:`prefill`}),He(!1);return}if(se!==ae){We({kind:`prefill`}),He(!1);return}(async()=>{let e=``;try{e=(await _()).key}catch{}if(e!==``&&s.key===e)try{let e=await Ut(xh(s,se,ae));di(`bookmarklet`),Fh(i),n.invalidateQueries({queryKey:R.runs.all}),t(pi(e));return}catch(e){We({kind:`failed`,message:e instanceof Error?e.message:String(e)})}else We({kind:`blocked`});He(!1)})()}}},[h.isPending,ae,re.isPending,le,se]),(0,J.useEffect)(()=>{if(Ue===null||!j)return;We(null);let e=s.skill!==``&&!D.some(e=>e.name===s.skill)?s.skill:``;e!==``&&b({text:Ch(s.skill,s.ref),source:null});let{message:t,tone:n}=Sh(Ue,e);L(t,{tone:n}),document.querySelector(`[data-slot="composer"] button[aria-label="Start task"]`)?.focus()},[Ue,j]),Ve?(0,Y.jsxs)(`div`,{"data-route":`new`,className:`relative isolate flex min-h-full flex-col items-center justify-center overflow-x-clip px-6`,children:[(0,Y.jsx)(La,{}),(0,Y.jsxs)(`div`,{"data-slot":`auto-starting`,role:`status`,className:`text-center`,children:[(0,Y.jsx)(`h1`,{className:`animate-pulse text-lg font-semibold tracking-tight`,children:`Starting task…`}),(0,Y.jsx)(`p`,{className:`mt-1.5 text-[13.5px] text-muted-foreground`,children:`Launched from a bookmarklet — taking you to the run.`})]})]}):(0,Y.jsxs)(`div`,{"data-route":`new`,className:`relative isolate flex min-h-full flex-col items-center overflow-x-clip px-6 pt-[clamp(32px,7vh,84px)] pb-16 max-md:px-3.5 max-md:pt-7`,children:[(0,Y.jsx)(La,{}),(0,Y.jsx)(dh,{}),(0,Y.jsxs)(`div`,{className:`w-full max-w-[720px]`,children:[(0,Y.jsxs)(`header`,{className:`mb-6 text-center max-md:mb-4`,children:[(0,Y.jsx)(`h1`,{className:`text-lg font-semibold tracking-tight max-md:text-base`,children:`What should the agent work on?`}),(0,Y.jsx)(`p`,{"data-slot":`run-mode-note`,className:`mt-1.5 text-[13.5px] text-muted-foreground max-md:text-xs`,children:Th({worktree:Fe,hasGit:ye,dispatch:Ee,autonomous:Ie})})]}),(0,Y.jsx)(Xi,{ref:P,onSubmit:async(e,r)=>{if(!le||se===null)throw Error(re.isPending?`Checking agent providers…`:re.isError?`Provider authentication could not be verified.`:`Connect an agent provider before starting a task.`);if(!j)throw Error(`Still loading workflows and skills — try again in a second.`);let a=await Ut(ei({task:e,source:M,model:pe,modelsLocked:de,runner:se,runnerExplicit:v.runner!==null,agentProfile:ge,defaultRunner:ae,variants:be,images:r,worktree:Fe,autonomous:Ie,generateFollowups:ze,todoId:s.todo,dispatch:we}));di(`new_task`),Be({lastTask:M,...M?{recentSources:hi(C,M)}:{},...Re?{lastGenerateFollowups:ze}:{},...M?.source===`skill`&&m.data!==void 0?{skillUsage:Vi(m.data.skillUsage,M.ref)}:{}}).then(()=>n.invalidateQueries({queryKey:R.uiState})).catch(()=>{}),Fh(i),n.invalidateQueries({queryKey:R.runs.all}),t(pi(a))},value:v.text,onValueChange:e=>b({text:e}),images:x,onImagesChange:S,autoFocus:!0,placeholder:`Describe a task for the agent — / for skills…`,ariaLabel:`Describe a task for the agent`,sendAriaLabel:`Start task`,disabled:!le,disabledReason:re.isPending?`Checking agent providers…`:re.isError?`Provider authentication could not be verified.`:`Connect an agent provider before starting a task.`,autocompleteSkills:!0,footerStart:(0,Y.jsxs)(Y.Fragment,{children:[k.length>1&&r!==void 0?(0,Y.jsx)(qh,{projects:k,projectId:r,onPick:e=>{let n=zh(i,A(e));!n.moved&&n.reason===`destination-busy`&&L(`Kept your draft in ${k.find(e=>e.id===(i??a.data?.bootProject))?.name??r}; ${k.find(t=>t.id===e)?.name??e} already has an unsent draft.`,{tone:`danger`}),t(`/p/${encodeURIComponent(e)}/new`,{replace:!0})}}):null,(0,Y.jsx)(bh,{source:M,ready:j,skills:D,skillUsage:E,workflows:O,onPick:e=>b({source:e})}),ie.length>1||ie.some(e=>Zi(me,e))?(0,Y.jsx)(ni,{runners:ie,value:ce,accounts:me,account:ge,repoAccount:he,onPick:(e,t)=>b({runner:e,agentProfile:t,...e===ce?{}:{model:null}}),disabled:!le}):null,(0,Y.jsx)(Yr,{slot:`model-pill`,ariaLabel:`Model`,label:fe.find(e=>e.id===pe)?.label??`auto`,value:pe,disabled:!le,readOnly:de,disabledHint:de?`Model selection is locked to native coding-agent settings.`:void 0,onPick:e=>b({model:e}),options:fe.map(e=>({value:e.id,label:e.label,desc:e.desc})),status:$r(ce,ue.data,ue.isError)}),(0,Y.jsx)(Yr,{slot:`variants-pill`,ariaLabel:`Parallel variants`,label:be>1?`×${be} variants`:`×1`,value:String(be),onPick:e=>b({variants:Number(e)}),disabled:!ye,hint:`How many times to run this task in parallel — each variant gets its own worktree, and you pick the diff you keep. ×1 runs it once.`,disabledHint:`Parallel variants need a git repository — each variant runs in its own worktree.`,options:[{value:`1`,label:`×1`,desc:`One run`},{value:`2`,label:`×2 variants`,desc:`Two competing runs — pick the diff you keep`},{value:`3`,label:`×3 variants`,desc:`Three competing runs — pick the diff you keep`}]}),(0,Y.jsx)(Hh,{}),xe?(0,Y.jsx)(Uh,{on:Fe,disabled:Ne,disabledReason:Ee?`Dispatch forks this task's commits — subtasks need a worktree`:`Parallel variants always use isolated worktrees`,onChange:e=>b({worktree:e})}):null,(0,Y.jsx)(Wh,{on:Ie,onChange:e=>b({autonomous:e})}),Re?(0,Y.jsx)(Gh,{on:ze,onChange:e=>b({generateFollowups:e})}):null,F.length>0||Ce?(0,Y.jsx)(Hh,{}):null,(0,Y.jsx)(Am,{templates:F,iconOnly:!0,onInsert:e=>P.current?.insertAtCaret(e)}),(0,Y.jsx)(Lm,{available:Ce,value:we,onChange:Me,onSettingsOpenChange:Ae,runners:ie,parentRunner:ce,parentModels:fe}),p.data?.info?(0,Y.jsx)(Hh,{}):null,p.data?(0,Y.jsx)(Jh,{repo:p.data}):null,N?.interactive&&(v.autonomous===null||v.worktree===null)?(0,Y.jsx)(`p`,{className:`basis-full text-xs text-muted-foreground`,"data-slot":`interactive-skill-hint`,children:`This skill recommends an interactive run in the current checkout. You can change either setting.`}):null]}),footerEnd:(0,Y.jsxs)(Y.Fragment,{children:[!le&&!re.isPending?(0,Y.jsx)(V,{to:`/settings/agents#providers`,className:`text-xs font-medium text-foreground underline underline-offset-4`,children:`Configure providers`}):null,(0,Y.jsx)(`kbd`,{"aria-hidden":`true`,className:`rounded-[5px] border border-b-2 border-border bg-card px-[5px] py-px font-mono text-[10.5px] font-medium text-muted-foreground`,children:Va()})]})}),Ee&&(ke||De)?(0,Y.jsxs)(`p`,{"data-slot":`dispatch-hint`,className:`mt-2 rounded-md border border-primary/25 bg-primary/[0.07] px-3 py-1.5 text-xs text-muted-foreground`,children:[(0,Y.jsx)(`strong`,{className:`font-semibold text-foreground`,children:`Dispatch is on.`}),` Splits this task into subtasks it runs as separate tasks. Worktree stays on. Long-press the icon for limits.`]}):null,(0,Y.jsx)(Xh,{onPick:e=>b({text:e})})]})]})}function Hh(){return(0,Y.jsx)(`span`,{"aria-hidden":`true`,className:`mx-0.5 h-3.5 w-px shrink-0 bg-border max-md:hidden`})}function Uh({on:e,disabled:t,disabledReason:n,onChange:r}){return(0,Y.jsxs)(`button`,{type:`button`,role:`checkbox`,"aria-checked":e,disabled:t,"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:G(Qr,e&&`border-primary/60 text-foreground`),children:[e?(0,Y.jsx)(oa,{"aria-hidden":`true`,className:`size-3 shrink-0 text-primary`}):(0,Y.jsx)(Wa,{"aria-hidden":`true`,className:`size-3 shrink-0 text-soft-foreground`}),`Worktree`]})}function Wh({on:e,disabled:t,onChange:n}){return(0,Y.jsxs)(`button`,{type:`button`,role:`checkbox`,"aria-checked":e,disabled:t,"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:G(Qr,e&&!t&&`border-primary/60 text-foreground`),children:[e?(0,Y.jsx)(oa,{"aria-hidden":`true`,className:`size-3 shrink-0 text-primary`}):(0,Y.jsx)(Wa,{"aria-hidden":`true`,className:`size-3 shrink-0 text-soft-foreground`}),`Autonomous`]})}function Gh({on:e,onChange:t}){return(0,Y.jsxs)(`button`,{type:`button`,role:`checkbox`,"aria-checked":e,"data-slot":`generate-followups-toggle`,onClick:()=>t(!e),title:e?`Agents can add newly discovered follow-up work to the task inbox`:`Follow-up generation is off; agents still maintain the handoff journal`,className:G(Qr,e&&`border-primary/60 text-foreground`),children:[e?(0,Y.jsx)(oa,{"aria-hidden":`true`,className:`size-3 shrink-0 text-primary`}):(0,Y.jsx)(Wa,{"aria-hidden":`true`,className:`size-3 shrink-0 text-soft-foreground`}),`Follow-ups`]})}function Kh(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 qh({projects:e,projectId:t,onPick:n}){let[r,i]=(0,J.useState)(!1),[a,o]=(0,J.useState)(``),s=e.find(e=>e.id===t),c=Kh(e,a);return(0,Y.jsxs)(ki,{open:r,onOpenChange:e=>{i(e),e||o(``)},children:[(0,Y.jsx)(Di,{asChild:!0,children:(0,Y.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:G(Qr,`border-foreground/60 font-semibold text-foreground`),children:[(0,Y.jsx)(hs,{"aria-hidden":`true`,className:`size-3 shrink-0 text-soft-foreground`}),(0,Y.jsx)(`span`,{className:`max-w-40 truncate`,children:s?.name??t}),Zr]})}),(0,Y.jsx)(vi,{align:`start`,sideOffset:8,className:`w-[300px] max-w-[calc(100vw-2rem)] p-0`,children:(0,Y.jsxs)(so,{shouldFilter:!1,children:[(0,Y.jsx)(co,{placeholder:`search projects…`,value:a,onValueChange:o}),(0,Y.jsxs)(io,{"data-slot":`project-menu`,className:`max-h-[min(18rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[c.length===0?(0,Y.jsx)(ao,{children:`Nothing matches.`}):null,c.map(e=>(0,Y.jsxs)(uo,{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,Y.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs font-medium`,children:e.name}),e.status===`missing`?(0,Y.jsx)(`span`,{className:`shrink-0 text-[11px] text-soft-foreground`,children:`folder not found`}):e.branch===void 0?null:(0,Y.jsx)(`span`,{className:`shrink-0 font-mono text-[11px] text-soft-foreground`,children:e.branch}),e.id===t?(0,Y.jsx)(oa,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-primary`}):null]},e.id))]}),(0,Y.jsx)(`p`,{className:`border-t border-border px-3 py-2 text-[11px] leading-snug text-soft-foreground`,children:`Skills, workflows, settings and the draft re-resolve against the selected project.`})]})})]})}function Jh({repo:e}){let t=I(),n=B({mutationFn:e=>j({baseBranch:e}),onSuccess:e=>{t.invalidateQueries({queryKey:R.repo}),L(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=>L(e.message,{tone:`danger`})});return e.info?(0,Y.jsx)(Yr,{slot:`base-pill`,ariaLabel:`Base branch`,label:(0,Y.jsxs)(`span`,{className:`font-mono text-[11.5px]`,children:[`base: `,e.baseBranch??e.info.branch]}),value:e.baseBranch??``,onPick:e=>n.mutate(e===``?null:e),searchPlaceholder:`Search branches…`,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 Yh=[`Fix a failing or flaky test`,`Summarize recent commits on this branch`,`Update the README for recent changes`];function Xh({onPick:e}){return(0,Y.jsx)(`div`,{className:`mt-7 flex flex-wrap justify-center gap-2 max-md:justify-start`,children:Yh.map(t=>(0,Y.jsxs)(`button`,{type:`button`,"data-slot":`suggested-chip`,onClick:()=>e(t),className:`inline-flex h-[30px] items-center gap-1.5 rounded-full border border-border px-3 text-[12.5px] font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`,children:[(0,Y.jsx)(ti,{"aria-hidden":`true`,className:`size-3 shrink-0 text-soft-foreground`}),t]},t))})}function Zh(){return(0,Y.jsx)(`div`,{"data-route":`not-found`,className:`flex min-h-full flex-col`,children:(0,Y.jsx)(q,{icon:(0,Y.jsx)(ls,{}),tone:`neutral`,title:`Page not found`,subtitle:`Nothing lives at this address. The link may be mistyped, or it points at something that is gone.`,actions:(0,Y.jsx)(K,{asChild:!0,variant:`outline`,children:(0,Y.jsx)(V,{to:`/`,children:`Back to tasks`})})})})}function Qh(){return(0,Y.jsx)(`div`,{"data-route":`repo-git`,className:`flex min-h-full flex-col`,children:(0,Y.jsx)(q,{icon:(0,Y.jsx)(Ra,{className:`motion-safe:animate-spin`}),tone:`neutral`,title:`Loading repository…`,subtitle:`Fetching the repo's git state.`})})}function $h(){return(0,Y.jsxs)(`div`,{"data-route":`skills`,className:`flex min-h-full flex-col`,children:[(0,Y.jsxs)(`header`,{className:`sticky top-0 z-10 hidden h-14 shrink-0 items-center gap-3 border-b border-border bg-background px-5 md:flex`,children:[(0,Y.jsx)(`h1`,{className:`text-base font-semibold`,children:`Skills`}),(0,Y.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Markdown playbooks agents can follow.`})]}),(0,Y.jsx)(`p`,{"data-slot":`skills-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-6`,children:`Loading skills…`})]})}function eg({projectId:e,registry:t}){let n=t.projects.length?t.projects:[{id:t.bootProject,name:t.bootProject}];return(0,Y.jsx)(`div`,{"data-route":`unknown-project`,className:`flex min-h-full flex-col`,children:(0,Y.jsx)(q,{icon:(0,Y.jsx)(_s,{}),tone:`neutral`,title:`“${e}” isn’t registered here`,subtitle:`This workspace doesn’t serve a project by that id. The link may come from another machine’s workspace — these are the projects this one can open:`,children:(0,Y.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,Y.jsx)(`li`,{children:(0,Y.jsxs)(ke,{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,Y.jsxs)(`span`,{className:`font-mono text-[11px] font-normal text-soft-foreground`,children:[`/p/`,e.id]})]})},e.id))})})})}function tg(){return(0,Y.jsx)(`div`,{"data-route":`workflows`,className:`flex min-h-full flex-col`,children:(0,Y.jsx)(q,{icon:(0,Y.jsx)(Ra,{className:`motion-safe:animate-spin`}),tone:`neutral`,title:`Loading workflows…`,subtitle:`Fetching the saved workflows and the node catalog.`})})}var ng={changes:`Loading changes…`,commits:`Loading changes…`,files:`Loading files…`,graph:`Loading the graph…`,notes:`Loading notes…`};function rg({tab:e}){return(0,Y.jsx)(`div`,{"data-route":`task-${e}`,className:`flex min-h-full flex-col`,children:(0,Y.jsx)(q,{icon:(0,Y.jsx)(Ra,{className:`motion-safe:animate-spin`}),tone:`neutral`,title:ng[e],subtitle:`Fetching the run record.`})})}function ig({tab:e,error:t}){let n=t instanceof Ae&&t.status===404;return(0,Y.jsx)(`div`,{"data-route":`task-${e}`,className:`flex min-h-full flex-col`,children:(0,Y.jsx)(q,{icon:n?(0,Y.jsx)(Ua,{}):(0,Y.jsx)(Ia,{}),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,Y.jsx)(K,{asChild:!0,variant:`outline`,children:(0,Y.jsx)(V,{to:`/`,children:`Back to tasks`})})})})}function ag({className:e,orientation:t=`horizontal`,...n}){return(0,Y.jsx)(Zl,{"data-slot":`tabs`,"data-orientation":t,orientation:t,className:G(`group/tabs flex gap-2 data-[orientation=horizontal]:flex-col`,e),...n})}var og=Rn(`group/tabs-list inline-flex w-fit items-center justify-center rounded-md p-[3px] text-muted-foreground group-data-[orientation=horizontal]/tabs:h-9 group-data-[orientation=vertical]/tabs:h-fit group-data-[orientation=vertical]/tabs:flex-col data-[variant=line]:rounded-none`,{variants:{variant:{default:`bg-muted`,line:`gap-1 bg-transparent`}},defaultVariants:{variant:`default`}});function sg({className:e,variant:t=`default`,...n}){return(0,Y.jsx)(Ql,{"data-slot":`tabs-list`,"data-variant":t,className:G(og({variant:t}),e),...n})}function cg({className:e,...t}){return(0,Y.jsx)($l,{"data-slot":`tabs-trigger`,className:G(`relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-sm border border-transparent px-3 py-1 text-[12.5px] font-medium whitespace-nowrap text-muted-foreground transition-all group-data-[orientation=vertical]/tabs:w-full group-data-[orientation=vertical]/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 group-data-[variant=default]/tabs-list:data-[state=active]:shadow-xs group-data-[variant=line]/tabs-list:data-[state=active]:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,`group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-[state=active]:bg-transparent`,`data-[state=active]:bg-card data-[state=active]:font-semibold data-[state=active]:text-foreground`,`after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-[orientation=horizontal]/tabs:after:inset-x-0 group-data-[orientation=horizontal]/tabs:after:bottom-[-5px] group-data-[orientation=horizontal]/tabs:after:h-0.5 group-data-[orientation=vertical]/tabs:after:inset-y-0 group-data-[orientation=vertical]/tabs:after:-right-1 group-data-[orientation=vertical]/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-[state=active]:after:opacity-100`,e),...t})}function lg({className:e,...t}){return(0,Y.jsx)(eu,{"data-slot":`tabs-content`,className:G(`flex-1 outline-none`,e),...t})}function ug(e){return oi.flatMap(t=>{let n=e.filter(e=>e.provider===t.id);return n.length<2?[{runner:t,account:null,label:t.label,desc:t.desc,missing:!1}]:n.map(e=>({runner:t,account:e.isDefault?null:e.id,label:`${t.label} · ${e.label}`,desc:e.exists?e.configDir:`${e.configDir} — folder not created yet`,missing:!e.exists}))})}var dg=e=>e.length>oi.length;function fg({rows:e,runner:t,accountFor:n,providerStatus:r,disabled:i=!1,accountDisabled:a=!1,onPick:o}){let s=dg(e);return(0,Y.jsx)(`div`,{role:`radiogroup`,"aria-label":`Default runner`,"data-slot":`agents-runner`,className:G(`gap-0.5 rounded-md border border-border bg-card p-0.5`,s?`flex max-w-md flex-col`:`inline-flex w-fit`),children:e.map(c=>{let l=Ee(r.data,c.runner.id),u=!r.isPending&&!r.isError&&l?.enabled===!0&&l.status===`connected`,d=r.isPending?`Checking provider authentication…`:r.isError?`Provider authentication could not be verified.`:l?.enabled===!1?`This provider is disabled. Enable it above or choose another provider.`:u?void 0:`Connect this provider before selecting it.`,f=e.filter(e=>e.runner.id===c.runner.id).length>1,p=c.runner.id===t&&c.account===n(c.runner.id);return(0,Y.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":p,"data-value":c.runner.id,"data-account":c.account??``,title:d??c.desc,disabled:i||!u||f&&a,onClick:()=>o(c.runner.id,c.account,f),className:G(`rounded-sm px-3 py-1.5 text-left font-mono text-[13px] font-medium transition-colors disabled:opacity-50`,p?`bg-muted text-foreground`:`text-muted-foreground hover:text-foreground`),children:[c.label,s?(0,Y.jsx)(`span`,{"data-slot":c.missing?`agents-account-missing`:`agents-account-dir`,"data-runner":c.runner.id,className:`ml-2 font-sans text-[11.5px] text-soft-foreground`,children:c.desc}):null]},`${c.runner.id}:${c.account??``}`)})})}function pg({open:e,onOpenChange:t,providers:n,initialProvider:r}){let[i,a]=(0,J.useState)(null),[o,s]=(0,J.useState)(null),[c,l]=(0,J.useState)(r??n[0]??`claude`),[u,d]=(0,J.useState)(``),[f,p]=(0,J.useState)(``),[m,h]=(0,J.useState)(!1),g=ce(),_=f.trim();return(0,Y.jsx)(xi,{open:e,onOpenChange:t,children:(0,Y.jsxs)(Oi,{"data-slot":`add-account-dialog`,className:`sm:max-w-lg`,children:[(0,Y.jsxs)(Si,{children:[(0,Y.jsx)(_i,{children:`Add agent account`}),(0,Y.jsx)(Ei,{children:`The config folder this account uses. It does not have to exist yet — Connect signs in and the CLI creates it.`})]}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Y.jsxs)(`label`,{className:`flex items-center gap-2 text-[13px]`,children:[(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:`Agent`}),(0,Y.jsx)(`select`,{"aria-label":`Agent`,"data-slot":`add-account-provider`,value:c,onChange:e=>l(e.target.value),className:`rounded-md border border-input bg-card px-2 py-1 text-[13px] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50`,children:n.map(e=>(0,Y.jsx)(`option`,{value:e,children:e},e))})]}),(0,Y.jsxs)(`label`,{className:`flex min-w-0 flex-1 items-center gap-2 text-[13px]`,children:[(0,Y.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:`Name`}),(0,Y.jsx)(`input`,{type:`text`,"aria-label":`Account name`,"data-slot":`add-account-label`,value:u,placeholder:`Work`,onChange:e=>d(e.target.value),className:`min-w-0 flex-1 rounded-md border border-input bg-card px-2 py-1 text-[13px] outline-none focus-visible:border-ring`})]})]}),(0,Y.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,Y.jsxs)(`label`,{className:`flex min-w-0 items-center gap-2 text-[13px]`,children:[(0,Y.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:`Folder`}),(0,Y.jsx)(`input`,{type:`text`,spellCheck:!1,autoComplete:`off`,"aria-label":`Config folder`,"data-slot":`add-account-dir`,value:f,placeholder:c===`codex`?`~/.codex-second`:`~/.claude-second`,onChange:e=>{p(e.target.value),s(null),g.reset()},className:`min-w-0 flex-1 rounded-md border border-input bg-card px-2 py-1 font-mono text-[12.5px] outline-none focus-visible:border-ring`}),(0,Y.jsx)(K,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`add-account-browse`,"aria-expanded":m,onClick:()=>h(e=>!e),children:m?`Hide folders`:`Browse…`})]}),(0,Y.jsxs)(`p`,{className:`text-[11.5px] text-soft-foreground`,children:[`A `,(0,Y.jsx)(`code`,{children:`~`}),` is kept as written and expanded when the agent runs.`]})]}),m?(0,Y.jsx)(au,{path:i,selected:o,onSelect:e=>{s(e),p(e.path),g.reset()},onEnter:e=>{a(e),s(null),g.reset()},showHidden:!0,emptyHint:`No subfolders here — pick this folder by typing its path above.`}):null,g.isError?(0,Y.jsx)(`p`,{"data-slot":`add-account-error`,className:`min-w-0 break-words text-[13px] text-danger`,children:g.error instanceof Error?g.error.message:`could not add that folder`}):null,(0,Y.jsxs)(Ci,{className:`min-w-0 sm:items-center sm:justify-end`,children:[(0,Y.jsx)(K,{variant:`outline`,onClick:()=>t(!1),children:`Cancel`}),(0,Y.jsx)(K,{"data-slot":`add-account-confirm`,disabled:_===``||g.isPending,onClick:()=>{_===``||g.isPending||g.mutate({provider:c,configDir:_,...u.trim()?{label:u.trim()}:{}},{onSuccess:()=>{t(!1),d(``),p(``),s(null),h(!1),L(`Account added — use Connect to sign in`)}})},children:g.isPending?`Adding…`:`Add account`})]})]})})}var mg={claude:`Claude Code`,codex:`Codex`,junie:`Junie`,opencode:`OpenCode`,cursor:`Cursor`,pi:`pi`,copilot:`GitHub Copilot CLI`},hg={claude:`curl -fsSL https://claude.ai/install.sh | bash`,codex:`npm i -g @openai/codex`,junie:`https://www.jetbrains.com/junie/`,opencode:`https://opencode.ai`,cursor:`curl https://cursor.com/install -fsS | bash`,pi:`https://github.com/badlogic/pi-mono`,copilot:`npm i -g @github/copilot`},gg={connected:{label:`Connected`,tone:`success`},disconnected:{label:`Not connected`,tone:`pending`},"not-installed":{label:`Not installed`,tone:`neutral`},unknown:{label:`Could not verify`,tone:`danger`}};function _g(){let e=me();return e.isPending?(0,Y.jsx)(`p`,{"data-slot":`accounts-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading agent accounts…`}):e.isError?(0,Y.jsx)(q,{icon:(0,Y.jsx)(xs,{}),tone:`danger`,title:`Agent accounts did not load`,subtitle:e.error.message,heading:`h2`}):(0,Y.jsx)(vg,{data:e.data})}function vg({data:e}){let t=Te(),[n,r]=(0,J.useState)(null),[i,a]=(0,J.useState)(null),o=at(),s=ee;return e.editable?(0,Y.jsxs)(`div`,{"data-slot":`accounts-section`,className:`mx-auto flex w-full max-w-2xl flex-col gap-5 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:`Agent accounts`}),(0,Y.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`One agent per tab: whether it is installed, and which logins you have. Add a second config folder to keep a work account beside a personal one; each project picks which it uses in its own Agents settings.`})]}),(0,Y.jsx)(bg,{profiles:e}),(0,Y.jsxs)(ag,{defaultValue:`claude`,children:[(0,Y.jsx)(sg,{variant:`line`,"data-slot":`accounts-tabs`,children:s.map(e=>(0,Y.jsx)(cg,{value:e,"data-provider":e,children:mg[e]},e))}),s.map(n=>(0,Y.jsx)(lg,{value:n,className:`pt-4`,children:(0,Y.jsx)(yg,{provider:n,check:t.data?.checks?.find(e=>e.name===n),accounts:e.profiles.filter(e=>e.provider===n),canCarryAccounts:e.profileCapableProviders.includes(n),onAdd:()=>r(n),onRemove:a})},n))]}),n===null?null:(0,Y.jsx)(pg,{open:!0,onOpenChange:e=>!e&&r(null),providers:e.profileCapableProviders,initialProvider:n},n),(0,Y.jsx)($a,{open:i!==null,onOpenChange:e=>!e&&a(null),children:(0,Y.jsxs)(Ja,{"data-slot":`accounts-remove-confirm`,children:[(0,Y.jsxs)(Qa,{children:[(0,Y.jsxs)(qa,{children:[`Remove “`,i?.label,`”?`]}),(0,Y.jsxs)(Ka,{children:[`This only forgets the account. Nothing in `,i?.configDir,` is deleted — not your login, not your sessions. Projects using it fall back to the default account, and tasks that ran under it can no longer be resumed from here.`]})]}),(0,Y.jsxs)(Xa,{children:[(0,Y.jsx)(Za,{children:`Cancel`}),(0,Y.jsx)(Ya,{"data-action":`accounts-remove-confirm`,disabled:o.isPending,onClick:()=>{let e=i;e&&o.mutate(e.id,{onSuccess:()=>{a(null),L(`Removed ${e.label}`)},onError:e=>L(e.message,{tone:`danger`})})},children:`Remove`})]})]})})]}):(0,Y.jsxs)(`div`,{"data-slot":`accounts-section`,className:`mx-auto flex w-full max-w-2xl flex-col gap-4 p-4 md:p-6`,children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:`Agent accounts`}),(0,Y.jsx)(`p`,{"data-slot":`accounts-hosted`,className:`text-[13px] text-soft-foreground`,children:`Agent accounts are managed from the machine that owns the checkout — this cockpit runs in hosted mode.`})]})}function yg({provider:e,check:t,accounts:n,canCarryAccounts:r,onAdd:i,onRemove:a}){let o=t?.available===!0;return(0,Y.jsxs)(`div`,{"data-slot":`accounts-provider`,"data-provider":e,className:`flex flex-col gap-4`,children:[(0,Y.jsxs)(`dl`,{className:`divide-y divide-border/60 overflow-hidden rounded-md border border-border bg-card text-[13px]`,children:[(0,Y.jsx)(xg,{label:`Installed`,children:t===void 0?(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:`Checking…`}):o?(0,Y.jsx)(`span`,{"data-slot":`agent-installed`,children:`Yes`}):(0,Y.jsxs)(`span`,{"data-slot":`agent-installed`,className:`text-muted-foreground`,children:[`No — `,(0,Y.jsx)(`code`,{className:`text-[12px]`,children:hg[e]})]})}),o&&t?.version?(0,Y.jsx)(xg,{label:`Version`,children:(0,Y.jsx)(`span`,{"data-slot":`agent-version`,className:`font-mono text-[12.5px]`,children:t.version})}):null,(0,Y.jsx)(xg,{label:`Accounts`,children:(0,Y.jsx)(`span`,{children:n.length===1?`the discovered one`:`${n.length} (1 discovered, ${n.length-1} added)`})})]}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Y.jsx)(`h3`,{className:`text-[13px] font-semibold text-foreground`,children:`Logins`}),r?(0,Y.jsx)(K,{type:`button`,variant:`outline`,size:`sm`,"data-action":`accounts-add`,"data-provider":e,onClick:i,children:`Add account`}):null]}),(0,Y.jsx)(`ul`,{className:`divide-y divide-border/60 rounded-md border border-border bg-card`,children:n.map(e=>(0,Y.jsx)(Sg,{account:e,onRemove:()=>a(e)},e.id))}),r?null:(0,Y.jsxs)(`p`,{"data-slot":`accounts-single-only`,className:`text-[11.5px] text-soft-foreground`,children:[mg[e],` can only hold one account here: it keeps its credentials outside its config folder, so a second folder would change settings without changing the login — which would say “work account” while billing the other one.`]})]})}function bg({profiles:e}){let t=I(),n=st(),r=Rt(),i=Dt(),a=ue(),o=B({mutationFn:e=>fe(e),onSuccess:e=>t.setQueryData(z.config,e),onError:e=>L(e.message,{tone:`danger`})});if(n.data===void 0)return null;let s=ug(e.profiles),c=n.data.agentDefaults.runner??`claude`,l=n.data.agentDefaults.models??{};return(0,Y.jsxs)(`section`,{"data-slot":`accounts-defaults`,className:`flex flex-col gap-3 rounded-lg border border-border bg-card/40 p-3.5`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h3`,{className:`text-[13px] font-semibold text-foreground`,children:`Defaults for new projects`}),(0,Y.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`What a project runs when it has not chosen for itself — set once instead of per repository. A project that has chosen keeps its own.`})]}),(0,Y.jsx)(fg,{rows:s,runner:c,accountFor:t=>e.defaults[t]??null,providerStatus:r,disabled:o.isPending,accountDisabled:a.isPending,onPick:(e,t,n)=>{e!==c&&o.mutate({agentDefaults:{runner:e}}),n&&a.mutate({projectId:null,provider:e,profileId:t},{onError:e=>L(e.message,{tone:`danger`})})}}),(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Y.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Default model per agent`}),oi.map(e=>(0,Y.jsxs)(`label`,{className:`flex items-center gap-3`,children:[(0,Y.jsx)(`span`,{className:`w-24 shrink-0 font-mono text-xs text-muted-foreground`,children:e.label}),(0,Y.jsxs)(`select`,{"aria-label":`Default model for ${e.label}`,"data-slot":`accounts-default-model`,"data-runner":e.id,value:l[e.id]??``,disabled:o.isPending,onChange:t=>o.mutate({agentDefaults:{models:{[e.id]:t.target.value||null}}}),className:`block w-full max-w-xs rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`,children:[fi(e.id,i[e.id].data,[l[e.id]]).map(e=>(0,Y.jsx)(`option`,{value:e.id,children:e.id===``?`auto (default)`:e.label},e.id)),$r(e.id,i[e.id].data,i[e.id].isError)?(0,Y.jsx)(`option`,{disabled:!0,children:$r(e.id,i[e.id].data,i[e.id].isError)}):null]})]},e.id))]})]})}function xg({label:e,children:t}){return(0,Y.jsxs)(`div`,{className:`flex items-baseline gap-3 px-3.5 py-2.5`,children:[(0,Y.jsx)(`dt`,{className:`w-28 shrink-0 text-muted-foreground`,children:e}),(0,Y.jsx)(`dd`,{className:`min-w-0 flex-1`,children:t})]})}function Sg({account:e,onRemove:t}){let[n,r]=(0,J.useState)(!1),i=Jn(e),a=v(),o=bt(),s=Sn(i,e.status===void 0),c=e.status??s.data?.status,l=c?gg[c.status]:void 0;return(0,Y.jsxs)(`li`,{"data-slot":`account-row`,"data-account":e.id,className:`flex flex-col gap-2 px-3.5 py-3`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(`span`,{className:`text-[13px] font-medium text-foreground`,children:e.label}),e.isDefault?(0,Y.jsx)(X,{variant:`ghost`,className:`shrink-0 text-[10px] text-muted-foreground`,children:`discovered`}):null]}),(0,Y.jsx)(`p`,{"data-slot":`account-path`,className:`mt-0.5 truncate font-mono text-[11.5px] text-soft-foreground`,title:e.path,children:e.configDir}),(0,Y.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-2 text-xs text-muted-foreground`,children:[(0,Y.jsx)(eo,{tone:l?.tone??`neutral`,pulse:l===void 0}),(0,Y.jsx)(`span`,{"data-slot":`account-status`,children:l?.label??`Checking…`}),e.exists?e.looksValid?null:(0,Y.jsxs)(`span`,{"data-slot":`account-unrecognised`,children:[`— this folder does not look like `,mg[e.provider],` config yet`]}):(0,Y.jsx)(`span`,{"data-slot":`account-missing`,children:`— folder not created yet; Connect will make it`})]})]}),(0,Y.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[c?.status===`connected`?null:(0,Y.jsx)(K,{type:`button`,size:`sm`,"data-action":`account-connect`,disabled:a.isPending,onClick:()=>a.mutate({provider:e.provider,...e.isDefault?{}:{profileId:e.id}},{onSuccess:e=>L(e.opened?`Finish signing in in the terminal, then Check again.`:`This account is already connected.`),onError:e=>L(e instanceof Ae&&e.command?`${e.message} — run: ${e.command}`:e.message,{tone:`danger`})}),children:`Connect`}),(0,Y.jsx)(K,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`account-recheck`,disabled:o.isPending,title:`Re-probe this account's login now, instead of waiting for the cached answer`,onClick:()=>o.mutate(i,{onError:e=>L(e.message,{tone:`danger`})}),children:`Check again`}),(0,Y.jsx)(K,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`account-details-toggle`,"aria-expanded":n,onClick:()=>r(e=>!e),children:n?`Hide details`:`Show details`})]})]}),n?(0,Y.jsx)(Cg,{account:e,routeId:i,onRemove:t}):null]})}function Cg({account:e,routeId:t,onRemove:n}){let r=mn(t,!0),i=Jt(),a=k(),[o,s]=(0,J.useState)(!1),[c,l]=(0,J.useState)(e.label),u=Fe(),d=a.data?.targets??[],f=d.filter(e=>Ur(e.id)===void 0&&e.id!==`terminal`&&e.id!==`finder`).map(e=>({target:e})),p=d.filter(e=>Ur(e.id)===void 0).map(e=>({target:e})),m=(e,n,r)=>i.mutate({routeId:t,file:e,...r?{target:r}:{}},{onError:e=>L(e.message,{tone:`danger`}),onSuccess:()=>L(`Opened ${n}`)});return(0,Y.jsxs)(`div`,{"data-slot":`account-details`,className:`rounded-md border border-border/60 bg-muted/30 p-3`,children:[r.isPending?(0,Y.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Reading account details…`}):r.isError?(0,Y.jsx)(`p`,{"data-slot":`account-details-error`,className:`text-xs text-danger`,children:r.error.message}):r.data.available?(0,Y.jsx)(`dl`,{"data-slot":`account-identity`,className:`grid grid-cols-[7rem_minmax(0,1fr)] gap-x-3 gap-y-1 text-xs`,children:r.data.fields.map(e=>(0,Y.jsxs)(J.Fragment,{children:[(0,Y.jsx)(`dt`,{className:`text-muted-foreground`,children:e.label}),(0,Y.jsx)(`dd`,{className:`min-w-0 truncate text-foreground`,title:e.value,children:e.value})]},e.label))}):(0,Y.jsx)(`p`,{"data-slot":`account-identity-unavailable`,className:`text-xs text-muted-foreground`,children:r.data.reason??`No account details to show.`}),(0,Y.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-1.5 border-t border-border/60 pt-2.5`,children:[(0,Y.jsx)(`span`,{className:`mr-1 text-xs text-muted-foreground`,children:`Config files`}),e.files.map(e=>(0,Y.jsx)(Pr,{slot:`account-open-file`,label:e.label,triggerVariant:`outline`,disabled:i.isPending,title:e.exists?e.path:`${e.path} — not created yet`,choices:f,onPick:t=>m(e.id,e.label,t),leading:(0,Y.jsxs)(Ma,{"data-target":`system`,onSelect:()=>m(e.id,e.label),children:[(0,Y.jsx)(ia,{"aria-hidden":`true`}),`System default`]})},e.id)),(0,Y.jsx)(Pr,{slot:`account-open-folder`,label:`Folder`,disabled:i.isPending,title:e.path,choices:p,onPick:e=>m(`folder`,`folder`,e),leading:(0,Y.jsxs)(Ma,{"data-target":`system`,onSelect:()=>m(`folder`,`folder`),children:[(0,Y.jsx)(ia,{"aria-hidden":`true`}),`System default`]})})]}),e.isDefault?null:(0,Y.jsxs)(`div`,{"data-slot":`account-manage`,className:`mt-3 flex flex-wrap items-center gap-2 border-t border-border/60 pt-2.5`,children:[(0,Y.jsx)(`span`,{className:`mr-1 text-xs text-muted-foreground`,children:`Account`}),o?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`input`,{type:`text`,autoFocus:!0,"aria-label":`Name for ${e.label}`,"data-slot":`account-rename-input`,value:c,onChange:e=>l(e.target.value),className:`w-48 rounded-md border border-input bg-card px-2 py-1 text-xs outline-none focus-visible:border-ring`}),(0,Y.jsx)(K,{type:`button`,size:`sm`,"data-action":`account-rename-save`,disabled:u.isPending||c.trim()===``||c.trim()===e.label,onClick:()=>u.mutate({id:e.id,label:c.trim()},{onSuccess:()=>s(!1),onError:e=>L(e.message,{tone:`danger`})}),children:`Save`}),(0,Y.jsx)(K,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>{l(e.label),s(!1)},children:`Cancel`})]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(K,{type:`button`,variant:`outline`,size:`sm`,"data-action":`account-rename`,onClick:()=>s(!0),children:`Rename`}),(0,Y.jsx)(K,{type:`button`,variant:`outline`,size:`sm`,"data-action":`account-remove`,onClick:n,children:`Remove`}),(0,Y.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Renaming changes what cezar calls this account, not its folder.`})]})]})]})}var wg=1500;function Tg(e,t){let n=(0,J.useMemo)(()=>e.split(`
|
|
4
|
+
`).map(e=>[{content:e}]),[e]),r=(0,J.useMemo)(()=>yo(t),[t]),i=n.length>wg,[a,o]=(0,J.useState)(null);return(0,J.useEffect)(()=>{if(r===null||i)return;let t=!1;return bo(e,r).then(n=>{t||o({key:e,tokens:n.tokens})}),()=>{t=!0}},[e,r,i]),r===null||i?n:a?.key===e?a.tokens:vo(e,r)?.tokens??n}var Eg=`m-0 min-h-full w-full whitespace-pre font-mono text-xs leading-[1.7] px-3 py-2 [tab-size:2]`;function Dg({value:e,onChange:t,language:n,readOnly:r,className:i,...a}){let o=Tg(e,n),s=(0,J.useRef)(null),c=(0,J.useRef)(null),l=()=>{let e=c.current,t=s.current;!e||!t||(t.scrollTop=e.scrollTop,t.scrollLeft=e.scrollLeft)};return(0,J.useLayoutEffect)(l,[e]),(0,Y.jsxs)(`div`,{"data-slot":`code-editor`,className:G(`relative overflow-hidden rounded-md border border-input bg-card`,i),children:[(0,Y.jsx)(`pre`,{ref:s,"aria-hidden":`true`,className:G(Eg,`pointer-events-none absolute inset-0 overflow-auto text-soft-foreground`),children:o.map((e,t)=>(0,Y.jsx)(`span`,{className:`block`,children:e.length===0?`
|
|
5
|
+
`:(0,Y.jsxs)(Y.Fragment,{children:[e.map((e,t)=>(0,Y.jsx)(`span`,{style:e.color===void 0?void 0:{color:e.color},children:e.content},t)),`
|
|
6
|
+
`]})},t))}),(0,Y.jsx)(`textarea`,{ref:c,"data-slot":`code-editor-input`,value:e,readOnly:r,onChange:e=>t?.(e.target.value),onScroll:l,spellCheck:!1,autoCorrect:`off`,autoCapitalize:`off`,autoComplete:`off`,wrap:`off`,className:G(Eg,`relative block resize-none overflow-auto bg-transparent text-transparent caret-foreground outline-none`,`selection:bg-primary/30 focus-visible:ring-0`,r&&`cursor-default`),...a})]})}var Og=`An editor-plus-commit: a saved change reaches a run after you commit it to the base branch.`;function kg(e){return t=>t.runners.includes(e)}function Ag(e,t,n,r){let i=kg(e);return{id:t,label:n,note:r,files:t===`mcp`?e=>i(e)&&(e.holdsMcp===!0||e.kind===`mcp`):e=>i(e)&&e.kind===t}}var jg=[{id:`claude`,label:`Claude`,groups:[Ag(`claude`,`settings`,`Settings`),Ag(`claude`,`mcp`,`MCP`,`A dedicated .mcp.json (key: mcpServers), shared via version control.`),Ag(`claude`,`memory`,`Memory & instructions`)]},{id:`codex`,label:`Codex`,note:Og,groups:[Ag(`codex`,`settings`,`Settings`),Ag(`codex`,`mcp`,`MCP`,`Inside config.toml under [mcp_servers.<id>] — the same file as Codex’s settings.`),Ag(`codex`,`memory`,`Memory & instructions`)]},{id:`copilot`,label:`GitHub Copilot`,note:Og,groups:[Ag(`copilot`,`settings`,`Settings`),Ag(`copilot`,`mcp`,`MCP`,`A dedicated ~/.copilot/mcp-config.json. Per-run --additional-mcp-config augments it rather than replacing it.`),Ag(`copilot`,`memory`,`Memory & instructions`)]},{id:`opencode`,label:`OpenCode`,note:Og,groups:[Ag(`opencode`,`settings`,`Settings`),Ag(`opencode`,`mcp`,`MCP`,`Under the "mcp" key in opencode.json — the same file as OpenCode’s settings.`),Ag(`opencode`,`memory`,`Memory & instructions`)]},{id:`cursor`,label:`Cursor`,note:"Cursor Agent CLI (`agent`). Auth via `agent login` or CURSOR_API_KEY. No separate memory file — instructions live in rules/MCP elsewhere.",groups:[Ag(`cursor`,`settings`,`Settings`),Ag(`cursor`,`mcp`,`MCP`,`User ~/.cursor/mcp.json and project .cursor/mcp.json.`)]}];function Mg(e){let t=jg.find(t=>t.id===e);if(!t)throw Error(`no agent descriptor for ${e}`);return t}var Ng=`{
|
|
7
|
+
"mcpServers": {
|
|
8
|
+
"example-stdio": {
|
|
9
|
+
"command": "/absolute/path/to/your-mcp-server",
|
|
10
|
+
"args": [],
|
|
11
|
+
"env": { "API_TOKEN": "your-personal-token" }
|
|
12
|
+
},
|
|
13
|
+
"example-http": {
|
|
14
|
+
"type": "http",
|
|
15
|
+
"url": "https://mcp.example.com/mcp",
|
|
16
|
+
"headers": { "Authorization": "Bearer your-personal-token" }
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
`;function Pg(e){return e.private?`Private to this project — added to every run at launch, takes effect on the next session. Never committed.`:e.seeded?`Copied into each run’s worktree — takes effect on your next run.`:e.tracked===`tracked`?`Runs read the committed copy — this edit applies after you commit it.`:e.tracked===`outside-repo`?`Applies to every session on this machine.`:`Personal, git-ignored.`}function Fg(){let e=Je(),t=Te(),n=(0,J.useMemo)(()=>t.data?ri(t.data.checks):jg.map(e=>e.id),[t.data]);return e.isPending?(0,Y.jsx)(`p`,{"data-slot":`agent-config-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading agent config…`}):e.isError?(0,Y.jsx)(q,{icon:(0,Y.jsx)(fs,{}),tone:`danger`,title:`Agent config did not load`,subtitle:e.error.message,heading:`h2`}):(0,Y.jsx)(Ig,{listing:e.data,installed:n})}function Ig({listing:e,installed:t}){let[n,r]=(0,J.useState)(`claude`),[i,a]=(0,J.useState)(null),o=Mg(n),s=e.files.find(e=>e.id===i)??null,c=e=>{r(e),a(null)};return(0,Y.jsxs)(`div`,{"data-slot":`agent-config`,className:`flex flex-col gap-4 p-4 md:p-6`,children:[!e.editable&&(0,Y.jsx)(`div`,{"data-slot":`agent-config-readonly`,className:`rounded-md border border-border bg-muted/40 px-3 py-2 text-[13px] text-soft-foreground`,children:`Read-only: agent config is edited from the machine that owns the checkout (this cockpit runs in hosted mode). You can still see every file and which one wins.`}),(0,Y.jsx)(`div`,{"data-slot":`agent-config-agents`,role:`tablist`,className:`flex flex-wrap gap-1 rounded-md bg-muted/40 p-1`,children:jg.map(e=>(0,Y.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":e.id===o.id,"data-slot":`agent-config-agent`,"data-agent":e.id,"data-selected":e.id===o.id,onClick:()=>c(e.id),className:G(`flex items-center gap-2 rounded-md px-3 py-1.5 text-[13px] transition-colors`,e.id===o.id?`bg-background font-semibold shadow-sm`:`hover:bg-muted/60`),children:[e.label,!t.includes(e.id)&&(0,Y.jsx)(X,{variant:`outline`,className:`text-[10px] text-soft-foreground`,children:`not installed`})]},e.id))}),o.note&&(0,Y.jsx)(`p`,{"data-slot":`agent-config-agent-note`,className:`text-[12px] text-soft-foreground`,children:o.note}),(0,Y.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-[minmax(0,20rem)_minmax(0,1fr)]`,children:[(0,Y.jsx)(`nav`,{"data-slot":`agent-config-nav`,className:`flex flex-col gap-5`,children:(0,Y.jsx)(Lg,{agent:o,listing:e,selectedId:i,onSelect:a})}),(0,Y.jsx)(`div`,{"data-slot":`agent-config-editor-pane`,children:s?(0,Y.jsx)(zg,{file:s},s.id):(0,Y.jsx)(`div`,{className:`flex h-full min-h-40 items-center justify-center rounded-md border border-dashed border-border text-[13px] text-soft-foreground`,children:`Select a config file to view or edit it.`})})]})]})}function Lg({agent:e,listing:t,selectedId:n,onSelect:r}){return(0,Y.jsx)(Y.Fragment,{children:e.groups.map(i=>{let a=t.files.filter(i.files),o=e.id===`claude`&&i.id===`mcp`;return a.length===0&&!(o&&t.userMcp)?null:(0,Y.jsxs)(`section`,{"data-slot":`agent-config-group`,"data-group":i.id,"data-agent":e.id,children:[(0,Y.jsx)(`p`,{className:`mb-1 text-[11px] font-medium uppercase tracking-wide text-soft-foreground`,children:i.label}),i.note&&(0,Y.jsx)(`p`,{className:`mb-2 text-[12px] text-soft-foreground`,children:i.note}),(0,Y.jsx)(`ul`,{className:`flex flex-col gap-1`,children:a.map(e=>(0,Y.jsx)(`li`,{children:(0,Y.jsxs)(`button`,{type:`button`,"data-slot":`agent-config-file`,"data-selected":e.id===n,onClick:()=>r(e.id),className:G(`flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-[13px] transition-colors`,e.id===n?`bg-primary/15 text-foreground`:`hover:bg-muted/60`),children:[(0,Y.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-[12px]`,children:e.label}),e.seeded&&(0,Y.jsx)(X,{variant:`outline`,className:`shrink-0 text-[10px]`,children:`seeded`}),e.private&&(0,Y.jsx)(X,{variant:`outline`,className:`shrink-0 text-[10px]`,children:`private`}),!e.exists&&(0,Y.jsx)(`span`,{className:`shrink-0 text-[11px] text-soft-foreground`,children:`absent`})]})},e.id))}),o&&t.userMcp&&(0,Y.jsx)(Rg,{userMcp:t.userMcp})]},i.id)})})}function Rg({userMcp:e}){return(0,Y.jsxs)(`div`,{"data-slot":`agent-config-user-mcp`,className:`mt-3`,children:[(0,Y.jsx)(`h4`,{className:`mb-1 text-[12px] font-semibold`,children:`User & local scopes`}),(0,Y.jsxs)(`p`,{className:`mb-2 text-[12px] text-soft-foreground`,children:[`Managed by `,(0,Y.jsx)(`code`,{className:`font-mono`,children:`claude mcp add`}),` in `,e.path,` — cezar does not edit Claude’s state file.`]}),e.readable?e.servers.length>0?(0,Y.jsx)(`ul`,{className:`flex flex-wrap gap-1`,children:e.servers.map(e=>(0,Y.jsx)(`li`,{children:(0,Y.jsx)(X,{variant:`outline`,className:`font-mono text-[11px]`,children:e})},e))}):(0,Y.jsx)(`p`,{className:`text-[12px] text-soft-foreground`,children:`No user-scoped MCP servers.`}):(0,Y.jsx)(`p`,{className:`text-[12px] text-soft-foreground`,children:`Could not read the file.`})]})}function zg({file:e}){let t=yn(e.id),n=en(e.id),[r,i]=(0,J.useState)(null),[a,o]=(0,J.useState)(!1),[s,c]=(0,J.useState)(null),l=t.data?.version??null;(0,J.useEffect)(()=>{t.data&&(i(e.private&&!t.data.exists?Ng:t.data.content),o(!1),c(null))},[t.data?.version,t.data]);let u=r??t.data?.content??``,d=t.data?u!==t.data.content:!1,f=e.writable;return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Y.jsx)(`span`,{className:`font-mono text-[13px]`,children:e.label}),(0,Y.jsx)(X,{variant:`outline`,className:`text-[10px] uppercase`,children:e.format}),(0,Y.jsx)(`a`,{href:e.docsUrl,target:`_blank`,rel:`noreferrer`,className:`text-[12px] text-soft-foreground underline hover:text-foreground`,children:`docs`})]}),(0,Y.jsx)(`p`,{"data-slot":`agent-config-precedence`,className:`text-[12px] text-soft-foreground`,children:e.precedence}),(0,Y.jsxs)(`p`,{"data-slot":`agent-config-effect`,className:`text-[12px] text-foreground/80`,children:[Pg(e),e.hotReload?` ${e.hotReload}`:``]}),t.isPending?(0,Y.jsx)(`p`,{className:`text-[13px] text-soft-foreground`,children:`Loading file…`}):t.isError?(0,Y.jsx)(`p`,{className:`text-[13px] text-destructive`,children:t.error.message}):(0,Y.jsx)(Dg,{value:u,language:e.format,readOnly:!f,onChange:i,"aria-label":`${e.label} contents`,className:`h-[26rem]`}),s&&(0,Y.jsx)(`p`,{"data-slot":`agent-config-format-error`,className:`text-[12px] text-destructive`,children:s}),a&&(0,Y.jsxs)(`div`,{"data-slot":`agent-config-conflict`,className:`flex items-center justify-between gap-2 rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-[12px]`,children:[(0,Y.jsx)(`span`,{children:`The file changed on disk since you opened it.`}),(0,Y.jsx)(K,{size:`sm`,variant:`outline`,onClick:()=>void t.refetch(),children:`Reload from disk`})]}),f&&(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(K,{size:`sm`,onClick:()=>{c(null),o(!1),n.mutate({content:u,version:l},{onSuccess:()=>{i(null),L(`${e.exists?`Saved`:`Created`} ${e.label}`)},onError:e=>{e instanceof Ae&&e.status===409?o(!0):e instanceof Ae&&e.status===400?c(e.message):L(e.message,{tone:`danger`})}})},disabled:!d||n.isPending,children:e.exists?`Save`:`Create`}),(0,Y.jsx)(K,{size:`sm`,variant:`ghost`,onClick:()=>i(null),disabled:!d||n.isPending,children:`Revert`}),d&&(0,Y.jsx)(`span`,{className:`text-[12px] text-soft-foreground`,children:`Unsaved changes`})]})]})}var Bg=[{id:`claude`,label:`Claude Code`,login:`claude auth login`},{id:`codex`,label:`Codex`,login:`codex login`},{id:`junie`,label:`Junie`,login:`junie login`},{id:`opencode`,label:`OpenCode`,login:`opencode auth login`},{id:`cursor`,label:`Cursor`,login:`agent login`},{id:`pi`,label:`pi`,login:`pi /login`},{id:`copilot`,label:`GitHub Copilot CLI`,login:`copilot login`}],Vg=e=>({claude:e,codex:e,junie:e,opencode:e,cursor:e,pi:e,copilot:e}),Hg={connected:{label:`Credentials found`,tone:`success`},disconnected:{label:`Not connected`,tone:`pending`},"not-installed":{label:`Not installed`,tone:`neutral`},unknown:{label:`Could not verify`,tone:`danger`}};function Ug(e,t,n){return{providers:e.providers.map(e=>e.provider===t?{...e,enabled:n}:e)}}function Wg(){let e=Rt(),t=on(),n=Tn(),r=I(),[i,a]=(0,J.useState)(null),o=(0,J.useRef)(Promise.resolve()),s=(0,J.useRef)(Vg(0)),c=(0,J.useRef)(Vg(0)),l=(0,J.useRef)(e.data);(0,J.useEffect)(()=>{i&&Ee(e.data,i.provider)?.status===`connected`&&a(null)},[i,e.data]),(0,J.useEffect)(()=>{if(e.data){if(Object.values(c.current).every(e=>e===0)||!l.current){l.current=e.data;return}l.current={providers:e.data.providers.map(e=>({...e,enabled:c.current[e.provider]>0?Ee(l.current,e.provider)?.enabled??e.enabled:e.enabled}))}}},[e.data]);let u=(0,J.useCallback)((e,t)=>{let n=z.providerStatus,i=r.getQueryData(n);if(!i)return;l.current||=i;let a=Ug(i,e,t);c.current[e]+=1,r.setQueryData(n,a);let u=++s.current[e];o.current=o.current.then(async()=>{try{let i=await Xe(e,t),a=Ee(i,e)?.enabled;if(a===void 0)return;if(l.current=Ug(l.current??i,e,a),u===s.current[e]){let t=r.getQueryData(n);r.setQueryData(n,t?Ug(t,e,a):i)}}catch(t){if(u===s.current[e]){let i=Ee(l.current,e)?.enabled,a=r.getQueryData(n);a&&i!==void 0?r.setQueryData(n,Ug(a,e,i)):l.current?r.setQueryData(n,l.current):r.removeQueries({queryKey:n,exact:!0}),L(t instanceof Error?t.message:String(t),{tone:`danger`})}}finally{--c.current[e]}})},[r]),d=B({mutationFn:e=>Lt(e),onSuccess:async e=>{a(null),L(e.opened?`Finish signing in in the terminal, then check again.`:`Provider is already connected.`),await r.invalidateQueries({queryKey:z.providerStatus})},onError:(e,t)=>{if(e instanceof Ae&&e.command){let n=Bg.find(e=>e.id===t)?.label??t;a({provider:t,label:n,message:e.message,command:e.command});return}L(e.message,{tone:`danger`})}}),f=async e=>{try{await navigator.clipboard.writeText(e),L(`Command copied`)}catch{L(`Could not copy the command`,{tone:`danger`})}};return(0,Y.jsxs)(`section`,{id:`providers`,"data-slot":`provider-settings`,className:`scroll-mt-20`,children:[(0,Y.jsxs)(`div`,{className:`mb-2`,children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:`Providers`}),(0,Y.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Connect the coding agents available on this computer.`})]}),e.isError?(0,Y.jsxs)(`div`,{role:`alert`,className:`mb-3 flex flex-wrap items-center justify-between gap-2 rounded-md border border-danger/30 bg-danger/5 px-3 py-2.5`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`text-[13px] font-medium text-foreground`,children:`Provider status could not be loaded`}),(0,Y.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.error.message})]}),(0,Y.jsx)(K,{type:`button`,variant:`outline`,size:`sm`,disabled:e.isFetching,onClick:()=>void e.refetch(),children:`Retry`})]}):null,(0,Y.jsx)(`div`,{className:`flex flex-col gap-2`,children:Bg.map(r=>{let a=Ee(e.data,r.id),o=a?.status,s=o?Hg[o]:e.isPending?{label:`Checking…`,tone:`neutral`}:Hg.unknown,c=d.isPending&&d.variables===r.id,l=o===`disconnected`||o===`unknown`,p=a?.authFailureId;return(0,Y.jsxs)(J.Fragment,{children:[(0,Y.jsxs)(`div`,{"data-slot":`provider-card`,"data-provider":r.id,className:`rounded-md border border-border bg-card px-3.5 py-3`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(`h3`,{className:`text-[13px] font-semibold text-foreground`,children:r.label}),(0,Y.jsxs)(`div`,{className:`mt-1 flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,Y.jsx)(eo,{tone:s.tone,pulse:e.isPending}),(0,Y.jsx)(`span`,{children:s.label}),a?.enabled===!1?(0,Y.jsx)(`span`,{children:`Disabled`}):null]}),o===`not-installed`?(0,Y.jsxs)(`p`,{className:`mt-1.5 text-xs text-soft-foreground`,children:[`Install `,r.label,`, then run `,(0,Y.jsx)(`code`,{children:r.login}),`.`]}):o===`unknown`||e.isError&&!o?(0,Y.jsx)(`p`,{className:`mt-1.5 text-xs text-soft-foreground`,children:a?.hint??`Verification failed. Check again when the provider is available.`}):a?.hint?(0,Y.jsx)(`p`,{className:`mt-1.5 text-xs text-soft-foreground`,children:a.hint}):null]}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[o===`not-installed`?null:(0,Y.jsx)(fu,{checked:a?.enabled??!0,"aria-label":`Use ${r.label}`,onCheckedChange:e=>u(r.id,e)}),l?(0,Y.jsx)(K,{type:`button`,variant:`ghost`,size:`sm`,disabled:t.isPending,onClick:()=>t.mutate(void 0,{onError:e=>L(e.message,{tone:`danger`})}),children:`Check again`}):null,o===`disconnected`?(0,Y.jsx)(K,{type:`button`,variant:`outline`,size:`sm`,disabled:d.isPending,onClick:()=>d.mutate(r.id),children:c?`Opening…`:`Connect`}):null,p===void 0?null:(0,Y.jsx)(K,{type:`button`,variant:`outline`,size:`sm`,disabled:n.isPending,onClick:()=>n.mutate({provider:r.id,authFailureId:p},{onSuccess:()=>L(`${r.label} can be tried again.`),onError:e=>L(e.message,{tone:`danger`})}),children:`Try again`})]})]}),p===void 0?null:(0,Y.jsx)(`p`,{className:`mt-2 text-xs text-soft-foreground`,children:`Use this after completing the provider sign-in flow. cezar cannot validate the credential without a task/model request; it will verify it on the next task.`})]}),i?.provider===r.id&&o!==`connected`?(0,Y.jsxs)(`div`,{role:`region`,"aria-label":`${i.label} manual sign-in`,className:`rounded-md border border-pending/40 bg-pending/5 px-3.5 py-3`,children:[(0,Y.jsx)(`p`,{className:`text-[13px] text-foreground`,children:i.message}),(0,Y.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2`,children:[(0,Y.jsx)(`code`,{className:`min-w-0 flex-1 overflow-x-auto rounded-sm bg-muted px-2 py-1.5 text-xs`,children:i.command}),(0,Y.jsx)(K,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>void f(i.command),children:`Copy command`})]})]}):null]},r.id)})})]})}function Gg(){let e=I();return B({mutationFn:e=>j(e),onSuccess:t=>{e.setQueryData(R.config,t),e.invalidateQueries({queryKey:R.health}),e.invalidateQueries({queryKey:R.repo})},onError:e=>L(e.message,{tone:`danger`})})}function Kg(){let e=ve(),t=Dt(),n=Rt();return e.isPending?(0,Y.jsx)(`p`,{"data-slot":`agents-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading agent settings…`}):e.isError?(0,Y.jsx)(q,{icon:(0,Y.jsx)(na,{}),tone:`danger`,title:`Agent settings did not load`,subtitle:e.error.message,heading:`h2`}):(0,Y.jsx)(qg,{config:e.data,catalogs:t,providerStatus:n})}function qg({config:e,catalogs:t,providerStatus:n}){let r=Gg();return(0,Y.jsxs)(`div`,{"data-slot":`agents-section`,className:`mx-auto flex w-full max-w-2xl flex-col gap-7 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:[(0,Y.jsx)(Wg,{}),(0,Y.jsx)(Jg,{defaultRunner:e.defaultRunner,providerStatus:n,saving:r.isPending,onPick:e=>r.mutate({defaultRunner:e})}),(0,Y.jsx)(Yg,{title:`Default models`,hint:e.modelsLocked?`Models are locked to the defaults configured in the native coding-agent settings.`:`The model preselected in the composer for each runner. Auto lets the runner decide per task.`,children:(0,Y.jsx)(`div`,{className:`flex max-w-md flex-col gap-2`,children:oi.map(i=>{let a=Ee(n.data,i.id),o=!n.isPending&&!n.isError&&a?.enabled===!0&&a.status===`connected`,s=n.isPending?`Checking provider authentication…`:n.isError?`Provider authentication could not be verified.`:a?.enabled===!1?`This provider is disabled. Enable it above or choose another provider.`:o?void 0:`Connect this provider before selecting it.`,c=t[i.id],l=$r(i.id,c.data,c.isError),u=fi(i.id,c.data,[e.defaultModels[i.id]]),d=e.defaultModels[i.id]??``,f=u.find(e=>e.id===d)?.label??d??`auto (default)`;return(0,Y.jsxs)(`label`,{className:`flex items-center gap-3`,children:[(0,Y.jsx)(`span`,{className:`w-24 shrink-0 font-mono text-xs text-muted-foreground`,children:i.label}),e.modelsLocked?(0,Y.jsx)(`output`,{"aria-label":`Default model for ${i.label}`,"data-slot":`agents-model`,"data-runner":i.id,title:`Model selection is locked to native coding-agent settings.`,className:`block w-full rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs`,children:f}):(0,Y.jsxs)(`select`,{"aria-label":`Default model for ${i.label}`,"data-slot":`agents-model`,"data-runner":i.id,value:d,title:s??i.desc,disabled:r.isPending||!o,onChange:e=>r.mutate({defaultModels:{[i.id]:e.target.value||null},defaultModelsAuto:{[i.id]:e.target.value===``}}),className:`block w-full rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`,children:[u.map(e=>(0,Y.jsx)(`option`,{value:e.id,children:e.id===``?`auto (default)`:e.label},e.id)),l?(0,Y.jsx)(`option`,{disabled:!0,children:l}):null]})]},i.id)})})})]})}function Jg({defaultRunner:e,providerStatus:t,saving:n,onPick:r}){let i=me(),a=ln(),o=Se(),s=Pt(),c=ue(),l=o.projectId??`default`,u=s.data?.info?.root,d=u?i.data?.selections[u]:void 0,f=i.data?.defaults,p=ug(i.data?.profiles??[]),m=dg(p);return(0,Y.jsxs)(Yg,{title:m?`Default agent`:`Default runner`,hint:m?`Preselected for new tasks in THIS repo, and used by the chain planner. Each task can still pick another agent or account. The account is stored on this machine only — it is never committed, so a teammate keeps their own.`:`Preselected for new tasks in THIS repo, and used by the chain planner. Each task can still pick another runner.`,children:[(0,Y.jsx)(fg,{rows:p,runner:e,accountFor:e=>d?.[e]??f?.[e]??null,providerStatus:t,disabled:n,accountDisabled:c.isPending||a.data===void 0,onPick:(t,n,i)=>{t!==e&&r(t),i&&c.mutate({projectId:l,provider:t,profileId:n},{onError:e=>L(e.message,{tone:`danger`})})}}),!t.isPending&&!t.isError&&Ee(t.data,e)?.enabled===!1?(0,Y.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`This provider is disabled. Enable it above or choose another provider.`}):null,m?(0,Y.jsx)(`p`,{className:`max-w-md text-[13px] text-muted-foreground`,children:`Tasks already started under another account can’t be resumed here — their sessions live in that account’s folder.`}):null]})}function Yg({title:e,hint:t,children:n}){return(0,Y.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:e}),(0,Y.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:t})]}),n]})}var Xg=`cez-accent`,Zg=`cez-density`,Qg=`cez-width`,$g=`lime`,e_=`comfortable`,t_=`narrow`;function n_(e){return e===`lime`||e===`violet`?e:$g}function r_(e){return e===`comfortable`||e===`compact`||e===`ultra`?e:e_}function i_(e){return e===`narrow`||e===`wide`?e:t_}function a_(e){let t=e&&typeof e==`object`?e:{};return{accent:n_(t.accent),density:r_(t.density),width:i_(t.width)}}function o_(){try{return{accent:n_(localStorage.getItem(Xg)),density:r_(localStorage.getItem(Zg)),width:i_(localStorage.getItem(Qg))}}catch{return{accent:$g,density:e_,width:t_}}}function s_(e){try{localStorage.setItem(Xg,e.accent),localStorage.setItem(Zg,e.density),localStorage.setItem(Qg,e.width)}catch{}}function c_(e,t){t.accent===`lime`?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 l_=J.createContext(null);function u_({children:e}){let t=I(),n=It(),[r,i]=J.useState(o_),a=n.data;J.useEffect(()=>{if(a===void 0)return;let e=a_(a.appearance);i(e),s_(e)},[a]),J.useLayoutEffect(()=>{c_(document.documentElement,r)},[r]);let o=J.useCallback(e=>{i(e),s_(e),s({appearance:e}).then(e=>t.setQueryData(z.uiState,e)).catch(e=>{L(e instanceof Error?e.message:String(e),{tone:`danger`}),t.invalidateQueries({queryKey:z.uiState})})},[t]),c=J.useCallback(e=>o({...r,accent:e}),[o,r]),l=J.useCallback(e=>o({...r,density:e}),[o,r]),u=J.useCallback(e=>o({...r,width:e}),[o,r]),d=J.useMemo(()=>({accent:r.accent,density:r.density,width:r.width,setAccent:c,setDensity:l,setWidth:u}),[r,c,l,u]);return(0,Y.jsx)(l_.Provider,{value:d,children:e})}function d_(){let e=J.useContext(l_);if(!e)throw Error(`cezar: useAppearance() must be called inside <AppearanceProvider>`);return e}var f_=[{value:`system`,label:`System`,icon:Ms},{value:`light`,label:`Light`,icon:Ws},{value:`dark`,label:`Dark`,icon:Ns}],p_=[{value:`lime`,label:`Lime`,swatch:`var(--accent-lime)`},{value:`violet`,label:`Violet`,swatch:`var(--violet)`}],m_=[{value:`comfortable`,label:`Comfortable`},{value:`compact`,label:`Compact`},{value:`ultra`,label:`Compact for real`}],h_=[{value:`narrow`,label:`Narrow`},{value:`wide`,label:`Wide`}];function g_({slot:e,label:t,value:n,options:r,onChange:i}){return(0,Y.jsx)(`div`,{role:`radiogroup`,"aria-label":t,"data-slot":e,className:`inline-flex w-fit gap-0.5 rounded-md border border-border bg-card p-0.5`,children:r.map(e=>{let t=e.value===n;return(0,Y.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":t,"data-value":e.value,onClick:()=>i(e.value),className:G(`flex items-center gap-2 rounded-sm px-3 py-1.5 text-[13px] font-medium transition-colors`,t?`bg-muted text-foreground`:`text-muted-foreground hover:text-foreground`),children:[e.icon?(0,Y.jsx)(e.icon,{"aria-hidden":`true`,className:`size-3.5`}):null,e.swatch?(0,Y.jsx)(`span`,{"aria-hidden":`true`,className:`size-3 rounded-full border border-border`,style:{background:e.swatch}}):null,e.label]},e.value)})})}function __({title:e,hint:t,children:n}){return(0,Y.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:e}),(0,Y.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:t})]}),n]})}function v_(){let e=ln(),{order:t,canReorder:n,reset:r}=Xu();return!((e.data?.projects.length??0)>1)||t.length===0?null:(0,Y.jsx)(__,{title:`Project order`,hint:`The sidebar is in the order you dragged it into. Reset puts it back to most-recently-opened first. Shared with every browser signed in to this cezar.`,children:(0,Y.jsx)(K,{type:`button`,variant:`outline`,size:`sm`,"data-slot":`appearance-project-order-reset`,disabled:!n,onClick:r,className:`w-fit`,children:`Reset order`})})}function y_(){let e=st(),t=I(),n=(0,J.useRef)(null),[r,i]=(0,J.useState)(null);(0,J.useEffect)(()=>()=>{r&&URL.revokeObjectURL(r.url)},[r]);let a=B({mutationFn:e=>fe(e),onSuccess:e=>t.setQueryData(z.config,e),onError:e=>L(e.message,{tone:`danger`})}),o=B({mutationFn:async e=>e?ye(e):qt(),onSuccess:e=>{let n=t.getQueryData(z.config);n&&t.setQueryData(z.config,{...n,branding:{...n.branding,logoUrl:e}}),i(null)},onError:e=>L(e.message,{tone:`danger`})}),s=e.data?.branding,[c,l]=(0,J.useState)(s?.name??`cezar`),[u,d]=(0,J.useState)(s?.name??`cezar`);return(0,J.useEffect)(()=>{s&&c===u&&(l(s.name),d(s.name))},[s?.name]),(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(__,{title:`Instance name`,hint:`Shown in the sidebar and browser tab across this workspace.`,children:(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Y.jsx)(`input`,{"data-slot":`branding-name`,"aria-label":`Instance name`,maxLength:80,value:c,onChange:e=>l(e.currentTarget.value),onBlur:()=>{let e=c.trim();if(!e){l(s?.name??`cezar`);return}e!==s?.name&&a.mutate({branding:{name:e}}),d(e)},className:`h-9 w-64 rounded-md border border-border bg-background px-3 text-sm`}),(0,Y.jsx)(K,{type:`button`,variant:`outline`,size:`sm`,disabled:!s||s.name===`cezar`||a.isPending,onClick:()=>a.mutate({branding:{name:null}}),children:`Reset name`})]})}),(0,Y.jsx)(__,{title:`Logo`,hint:`PNG, JPEG, WebP, GIF, AVIF, or safe SVG up to 2 MB. Stored on this machine and shared by its browsers.`,children:(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 rounded-lg border border-border bg-card p-3`,children:[r?(0,Y.jsx)(`img`,{src:r.url,alt:`Logo preview`,className:`size-10 rounded-md border border-border bg-background object-contain p-1`}):s?.logoUrl?(0,Y.jsx)(`img`,{src:s.logoUrl,alt:`Current instance logo`,className:`size-10 rounded-md border border-border bg-background object-contain p-1`}):(0,Y.jsx)(`span`,{"aria-hidden":`true`,className:`size-10 rounded-md border border-dashed border-border bg-background`}),(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Y.jsx)(`p`,{className:`truncate text-sm font-medium text-foreground`,children:r?.file.name??(s?.logoUrl?`Current logo`:`No logo selected`)}),(0,Y.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Choose an image to preview it before saving.`})]}),(0,Y.jsx)(`input`,{ref:n,"data-slot":`branding-logo`,"aria-label":`Upload logo`,type:`file`,accept:`image/png,image/jpeg,image/webp,image/gif,image/avif,image/svg+xml`,disabled:o.isPending,hidden:!0,onChange:e=>{let t=e.currentTarget.files?.[0];t&&i({file:t,url:URL.createObjectURL(t)}),e.currentTarget.value=``}}),(0,Y.jsxs)(K,{type:`button`,variant:`outline`,size:`sm`,disabled:!s||o.isPending,onClick:()=>n.current?.click(),children:[(0,Y.jsx)(Ga,{"aria-hidden":`true`,className:`size-3.5`}),`Choose logo`]}),r?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(K,{type:`button`,size:`sm`,disabled:o.isPending,onClick:()=>o.mutate(r.file),children:`Save logo`}),(0,Y.jsx)(K,{type:`button`,variant:`outline`,size:`sm`,disabled:o.isPending,onClick:()=>i(null),children:`Cancel`})]}):s?.logoUrl?(0,Y.jsx)(K,{type:`button`,variant:`outline`,size:`sm`,disabled:o.isPending,onClick:()=>o.mutate(null),children:`Remove logo`}):null]})})]})}function b_(){let{theme:e,setTheme:t}=Bu(),{accent:n,density:r,width:i,setAccent:a,setDensity:o,setWidth:s}=d_();return(0,Y.jsxs)(`div`,{"data-slot":`appearance-section`,className:`mx-auto flex w-full max-w-2xl flex-col gap-7 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:[(0,Y.jsx)(y_,{}),(0,Y.jsx)(__,{title:`Theme`,hint:`System follows your OS preference. Applies to this browser.`,children:(0,Y.jsx)(g_,{slot:`appearance-theme`,label:`Theme`,value:e,options:f_,onChange:t})}),(0,Y.jsx)(__,{title:`Accent`,hint:`The primary action color. Saved with this repo's cockpit state.`,children:(0,Y.jsx)(g_,{slot:`appearance-accent`,label:`Accent`,value:n,options:p_,onChange:a})}),(0,Y.jsx)(__,{title:`Density`,hint:`Compact tightens spacing across the cockpit — text stays the same size.`,children:(0,Y.jsx)(g_,{slot:`appearance-density`,label:`Density`,value:r,options:m_,onChange:o})}),(0,Y.jsx)(__,{title:`Reading width`,hint:`Wide gives task sessions, commits, and skill content more room. Narrow keeps a comfortable reading column. The Changes tab is always full-width.`,children:(0,Y.jsx)(g_,{slot:`appearance-width`,label:`Reading width`,value:i,options:h_,onChange:s})}),(0,Y.jsx)(v_,{})]})}function x_({embedded:e=!1}={}){let t=Le();return t.isPending?(0,Y.jsx)(`p`,{"data-slot":`prompt-templates-loading`,className:e?`text-[13px] text-soft-foreground`:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading prompt templates…`}):t.isError?(0,Y.jsx)(q,{icon:(0,Y.jsx)(Ps,{}),tone:`danger`,title:`Prompt templates did not load`,subtitle:t.error.message,heading:`h2`}):(0,Y.jsx)(S_,{initial:Ri(t.data.promptTemplates),embedded:e})}function S_({initial:e,embedded:t}){let n=I(),r=Dn(),i=Le(),[a,o]=(0,J.useState)(e),[s,c]=(0,J.useState)(``),[l,u]=(0,J.useState)(``),d=B({mutationFn:e=>Be({promptTemplates:e}),onSuccess:e=>{n.setQueryData(R.uiState,e),L(`Prompt templates saved`)},onError:e=>L(e.message,{tone:`danger`})}),f=JSON.stringify(a)!==JSON.stringify(e),p=a.some(e=>e.label.trim()===``||e.text.trim()===``),m=(e,t)=>o(n=>n.map(n=>n.id===e?{...n,...t}:n)),h=(e,t)=>o(n=>n.map(n=>{if(n.id!==e)return n;let r=n.skills??[],i=r.includes(t)?r.filter(e=>e!==t):[...r,t],{skills:a,...o}=n;return i.length>0?{...o,skills:i}:o})),g=e=>o(t=>t.filter(t=>t.id!==e));return(0,Y.jsx)(`div`,{"data-slot":`prompt-templates-section`,className:t?`flex w-full flex-col gap-7`:`mx-auto flex w-full max-w-2xl flex-col gap-7 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:(0,Y.jsxs)(w_,{title:`Prompt templates`,hint:`Reusable snippets you can insert into a prompt — the new-task composer, the GitHub hand-over, and the Inbox's “Add instructions” box all offer this list. Assign a template to a skill and it fills the prompt in for you when you pick that skill, as long as you have not typed anything yet.`,children:[(0,Y.jsx)(`div`,{"data-slot":`prompt-template-list`,className:`flex flex-col gap-3`,children:a.length===0?(0,Y.jsx)(`p`,{"data-slot":`prompt-templates-empty`,className:`text-[13px] text-soft-foreground`,children:`No templates. Add one below, or reset to the built-ins.`}):a.map(e=>(0,Y.jsxs)(`div`,{"data-slot":`prompt-template-row`,"data-template":e.id,className:`flex flex-col gap-1.5 rounded-md border border-border bg-card p-3`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(cu,{"aria-label":`Label for ${e.label||`this template`}`,"data-slot":`prompt-template-label-input`,value:e.label,maxLength:80,onChange:t=>m(e.id,{label:t.target.value}),className:`flex-1`}),(0,Y.jsx)(K,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`prompt-template-remove`,title:`Remove this template`,onClick:()=>g(e.id),children:(0,Y.jsx)(xa,{"aria-hidden":`true`,className:`size-3.5`})})]}),(0,Y.jsx)(aa,{"aria-label":`Text for ${e.label||`this template`}`,"data-slot":`prompt-template-text-input`,value:e.text,maxLength:Ji,onChange:t=>m(e.id,{text:t.target.value}),className:`min-h-14 text-[13px]`}),(0,Y.jsxs)(`div`,{className:`mt-0.5 flex flex-wrap items-center gap-1.5`,children:[(0,Y.jsx)(C_,{label:e.label,skills:r.data??[],skillUsage:i.data?.skillUsage,selected:e.skills??[],onToggle:t=>h(e.id,t)}),(e.skills??[]).map(t=>(0,Y.jsxs)(`button`,{type:`button`,"data-slot":`prompt-template-skill-chip`,"data-skill":t,title:`Stop applying “${e.label}” automatically with ${t}`,onClick:()=>h(e.id,t),className:`inline-flex items-center gap-1 rounded-full border border-border bg-muted px-2 py-px font-mono text-[11px] font-medium text-foreground transition-colors hover:bg-danger/10 hover:text-danger`,children:[t,(0,Y.jsx)(xa,{"aria-hidden":`true`,className:`size-3`})]},t))]})]},e.id))}),(0,Y.jsxs)(`div`,{"data-slot":`prompt-template-new`,className:`flex flex-col gap-1.5 rounded-md border border-dashed border-border p-3`,children:[(0,Y.jsx)(cu,{"aria-label":`New template label`,"data-slot":`prompt-template-new-label`,placeholder:`Label (e.g. "Add tests")`,value:s,maxLength:80,onChange:e=>c(e.target.value)}),(0,Y.jsx)(aa,{"aria-label":`New template text`,"data-slot":`prompt-template-new-text`,placeholder:`The instructions to insert…`,value:l,maxLength:Ji,onChange:e=>u(e.target.value),className:`min-h-14 text-[13px]`}),(0,Y.jsxs)(K,{type:`button`,variant:`outline`,size:`sm`,"data-action":`prompt-template-add`,disabled:!s.trim()||!l.trim(),onClick:()=>{let e=s.trim(),t=l.trim();!e||!t||(o(n=>[...n,{id:Yi(),label:e,text:t}]),c(``),u(``))},className:`self-start`,children:[(0,Y.jsx)(Rs,{"aria-hidden":`true`,className:`size-3.5`}),`Add template`]})]}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Y.jsx)(K,{type:`button`,variant:`contrast`,size:`sm`,"data-action":`prompt-templates-save`,disabled:!f||p||d.isPending,onClick:()=>d.mutate(a),children:`Save`}),(0,Y.jsx)(K,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`prompt-templates-reset`,disabled:d.isPending,onClick:()=>o(Gi.map(e=>({...e}))),children:`Reset to defaults`}),p?(0,Y.jsx)(`p`,{"data-slot":`prompt-templates-invalid`,className:`text-[11px] text-danger`,children:`Every template needs both a label and text.`}):null]})]})})}function C_({label:e,skills:t,skillUsage:n,selected:r,onToggle:i}){let[a,o]=(0,J.useState)(!1),[s,c]=(0,J.useState)(``),l=(0,J.useRef)(null),{mostUsed:u,project:d,global:f}=ea(Mi(t,s,n),n),p=(e,t)=>{let n=r.includes(e.name);return(0,Y.jsxs)(uo,{value:`skill ${e.name} ${e.path}`,keywords:Pi(e.name,e.description),"data-slot":`prompt-template-skill-option`,"data-skill":e.name,"data-selected":n?`true`:void 0,onSelect:()=>i(e.name),children:[(0,Y.jsx)(`span`,{className:G(`shrink-0 font-mono text-xs`,t&&`font-semibold`),children:e.name}),e.description?(0,Y.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null,n?(0,Y.jsx)(oa,{"aria-hidden":`true`,className:`ml-auto size-3.5 shrink-0 text-primary`}):null]},e.path)};return(0,Y.jsxs)(ki,{open:a,onOpenChange:e=>{o(e),e||c(``)},children:[(0,Y.jsx)(Di,{asChild:!0,children:(0,Y.jsxs)(`button`,{type:`button`,"data-slot":`prompt-template-skills-trigger`,"aria-label":`Apply ${e||`this template`} automatically with a skill`,title:`Pick the skills this template applies itself to`,disabled:t.length===0,className:G(`inline-flex h-[26px] 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 disabled:pointer-events-none disabled:opacity-50`,r.length>0&&`border-foreground/60 font-semibold text-foreground`),children:[(0,Y.jsx)(ti,{"aria-hidden":`true`,className:`size-3 shrink-0 text-violet`}),t.length===0?`no skills found`:`apply with…`,(0,Y.jsx)(ma,{"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,Y.jsx)(vi,{align:`start`,sideOffset:8,className:`w-[336px] max-w-[calc(100vw-2rem)] p-0`,children:(0,Y.jsxs)(so,{shouldFilter:!1,children:[(0,Y.jsx)(co,{placeholder:`search skills…`,value:s,onValueChange:c,onInput:()=>l.current?.scrollTo(0,0)}),(0,Y.jsxs)(io,{ref:l,"data-slot":`prompt-template-skill-menu`,className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[u.length===0&&d.length===0&&f.length===0?(0,Y.jsx)(ao,{children:`Nothing matches.`}):null,u.length>0?(0,Y.jsx)(ro,{heading:`Most used`,children:u.map(e=>p(e,Fi(e)))}):null,d.length>0?(0,Y.jsx)(ro,{heading:`Project skills`,children:d.map(e=>p(e,!0))}):null,f.length>0?(0,Y.jsx)(ro,{heading:`Global`,children:f.map(e=>p(e,!1))}):null]})]})})]})}function w_({title:e,hint:t,children:n}){return(0,Y.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:e}),(0,Y.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:t})]}),n]})}function $({title:e,hint:t,children:n}){return(0,Y.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:e}),(0,Y.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:t})]}),n]})}var T_=2e4,E_=4e3;function D_(){let e=ve();return e.isPending?(0,Y.jsx)(`p`,{"data-slot":`instructions-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading instructions…`}):e.isError?(0,Y.jsx)(q,{icon:(0,Y.jsx)(za,{}),tone:`danger`,title:`Instructions did not load`,subtitle:e.error.message,heading:`h2`}):(0,Y.jsx)(O_,{config:e.data})}function O_({config:e}){let t=Gg(),[n,r]=(0,J.useState)(e.systemPrompt??``),i=n.trim(),a=i===(e.systemPrompt??``),o=i.length>T_,s=()=>t.mutate({systemPrompt:i===``?null:i},{onSuccess:()=>L(i===``?`System prompt cleared`:`System prompt saved`)}),[c,l]=(0,J.useState)(e.branchNaming??``),u=c.trim(),d=u===(e.branchNaming??``),f=u.length>E_;return(0,Y.jsxs)(`div`,{"data-slot":`instructions-section`,className:`mx-auto flex w-full max-w-2xl flex-col gap-7 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:[(0,Y.jsxs)($,{title:`System prompt`,hint:`Read by every agent step of every new task, whichever runner executes it. This is the only place it is edited.`,children:[(0,Y.jsx)(aa,{"aria-label":`System prompt`,"data-slot":`instructions-system-prompt`,value:n,onChange:e=>r(e.target.value),placeholder:`Extra rules for every agent run — conventions, tone, review requirements…`,className:`min-h-32 max-w-xl`}),(0,Y.jsxs)(`div`,{className:`flex max-w-xl items-center gap-3`,children:[(0,Y.jsx)(K,{type:`button`,variant:`outline`,size:`sm`,"data-action":`instructions-save-prompt`,disabled:a||o||t.isPending,onClick:s,children:`Save`}),o?(0,Y.jsxs)(`p`,{"data-slot":`instructions-prompt-limit`,className:`text-[11px] text-danger`,children:[i.length.toLocaleString(),` characters — the limit is `,T_.toLocaleString(),`.`]}):(0,Y.jsx)(`p`,{className:`text-[11px] text-soft-foreground`,children:`Leave empty and save to clear. Applied to new runs only.`})]})]}),(0,Y.jsxs)($,{title:`Branch naming`,hint:`How new task branches are named. Generated from the first prompt.`,children:[(0,Y.jsx)(aa,{"aria-label":`Branch naming`,"data-slot":`instructions-branch-naming`,value:c,onChange:e=>l(e.target.value),placeholder:`Describe your branch naming convention…`,className:`min-h-24 max-w-xl`}),(0,Y.jsxs)(`div`,{className:`flex max-w-xl items-center gap-3`,children:[(0,Y.jsx)(K,{type:`button`,variant:`outline`,size:`sm`,"data-action":`instructions-save-branch-naming`,disabled:d||f||t.isPending,onClick:()=>t.mutate({branchNaming:u===``?null:u},{onSuccess:()=>L(u===``?`Branch naming cleared`:`Branch naming saved`)}),children:`Save`}),f?(0,Y.jsxs)(`p`,{"data-slot":`instructions-branch-naming-limit`,className:`text-[11px] text-danger`,children:[u.length.toLocaleString(),` characters — the limit is`,` `,E_.toLocaleString(),`.`]}):(0,Y.jsx)(`p`,{className:`text-[11px] text-soft-foreground`,children:`Leave empty for the default names. A new task waits for its name before it forks.`})]})]}),(0,Y.jsx)(`div`,{id:`prompt-templates`,className:`scroll-mt-20`,children:(0,Y.jsx)(x_,{embedded:!0})})]})}function k_(){let e=Dn();return e.isPending?(0,Y.jsx)(`p`,{"data-slot":`bookmarklets-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading bookmarklets…`}):e.isError?(0,Y.jsx)(q,{icon:(0,Y.jsx)(Ia,{}),tone:`danger`,heading:`h2`,title:`Could not load bookmarklets`,subtitle:e.error.message}):(0,Y.jsx)(`div`,{className:`flex min-h-full flex-1 overflow-y-auto px-4 py-5 md:px-7`,children:(0,Y.jsx)(A_,{skills:ta(e.data??[])})})}function A_({skills:e}){let t=Oe(),n=Te(),r=ln(),[i,a]=(0,J.useState)(!1),[o,s]=(0,J.useState)(``),c=t.data?.key??``,l=window.location.origin,u=tn()??n.data?.bootProject??null,d=r.data?.projects.find(e=>e.id===u)?.name??ax(n.data)?.name??null,f=o.trim().toLowerCase(),p=e.filter(e=>e.name.toLowerCase().includes(f));return(0,Y.jsxs)(`div`,{"data-slot":`bookmarklet-panel`,className:`mx-auto w-full max-w-2xl`,children:[(0,Y.jsx)(`h2`,{className:`text-base font-semibold`,children:`Run from GitHub`}),(0,Y.jsxs)(`p`,{className:`mt-2 text-[13px] leading-relaxed text-muted-foreground`,children:[`Drag a button below to your browser's bookmarks bar. On any GitHub PR or issue, click it to open this cockpit directly. The cockpit must be running: `,(0,Y.jsx)(`span`,{className:`font-mono`,children:`npx cezar`}),`.`]}),(0,Y.jsxs)(`label`,{className:`mt-4 flex items-center gap-2 text-[13px] font-medium`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,"data-slot":`bm-auto`,checked:i,onChange:e=>a(e.target.checked),className:`size-3.5`}),`One-click launch (auto-submit)`,` `,(0,Y.jsx)(`span`,{className:`font-normal text-soft-foreground`,children:`— re-drag the buttons after changing this`})]}),(0,Y.jsx)(`div`,{"data-slot":`bm-generic`,className:`mt-4`,children:(0,Y.jsx)(fh,{label:d?`cezar (${d}): this PR/issue`:`cezar: this PR/issue`,url:mh(``,!1,c,l,u),hint:`prefills the form — nothing starts by itself`})}),(0,Y.jsx)(cu,{"data-slot":`bm-filter`,placeholder:`Filter skills…`,"aria-label":`Filter bookmarklet skills`,value:o,onChange:e=>s(e.target.value),className:`mt-5 h-8 text-[13px]`}),(0,Y.jsx)(`div`,{"data-slot":`bm-list`,className:`mt-3 flex flex-col gap-2`,children:p.length>0?p.map(e=>(0,Y.jsx)(fh,{label:d?`/${e.name} (${d})`:`/${e.name}`,url:mh(e.name,i,c,l,u),hint:e.source},e.path)):(0,Y.jsx)(`p`,{className:`text-xs text-soft-foreground`,children:e.length>0?`(no skills match)`:`(no skills yet — the generic launcher above still works)`})})]})}function j_(e){return{enabled:(e&&typeof e==`object`?e:{}).enabled===!0}}function M_(){let e=globalThis.Notification;if(typeof e!=`function`)return`unsupported`;let t=e.permission;return t===`granted`||t===`denied`?t:`default`}function N_(e,t){let n=new Map,r=[];for(let i of t??[]){n.set(i.id,i.status);let t=e.get(i.id);t===void 0||t===i.status||En(i)&&r.push(i)}return{entering:r,statuses:n}}function P_(e){return e.enabled&&e.hidden&&e.permission===`granted`}function F_(e){let t=D(e).label;return{title:e.titleSummary??e.title,body:`Task ${t}`,tag:`cezar-run-${e.id}`}}function I_(){let e=I(),t=It(),[n,r]=J.useState(!1),[i,a]=J.useState(M_),o=t.data;J.useEffect(()=>{o!==void 0&&r(j_(o.notifications).enabled)},[o]);let c=J.useCallback(t=>{r(t),s({notifications:{enabled:t}}).then(t=>e.setQueryData(z.uiState,t)).catch(t=>{L(t instanceof Error?t.message:String(t),{tone:`danger`}),e.invalidateQueries({queryKey:z.uiState})})},[e]),l=J.useCallback(e=>{if(!e){c(!1);return}if(M_()!=="default"){c(!0);return}c(!0),Notification.requestPermission().then(e=>a(e)).catch(()=>a(M_()))},[c]),u=i===`unsupported`;return(0,Y.jsx)(`div`,{"data-slot":`notifications-section`,className:`mx-auto flex w-full max-w-2xl flex-col gap-7 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:(0,Y.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,Y.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:(0,Y.jsx)(`label`,{htmlFor:`notifications-enabled`,children:`Notify when an agent needs you`})}),(0,Y.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`A browser notification when a task starts waiting, asks for review, or fails — only while this tab is in the background. Off by default.`})]}),(0,Y.jsx)(fu,{id:`notifications-enabled`,"data-slot":`notifications-toggle`,checked:n,disabled:u,onCheckedChange:l})]}),u?(0,Y.jsx)(`p`,{"data-slot":`notifications-unsupported`,className:`text-[13px] text-muted-foreground`,children:`This browser does not support notifications, so the toggle is unavailable here.`}):null,!u&&n&&i===`denied`?(0,Y.jsx)(`p`,{"data-slot":`notifications-denied`,className:`text-[13px] text-danger`,children:`This browser is blocking notifications for the cockpit. The preference is saved, but nothing will be delivered here until you allow notifications in the browser's site settings.`}):null]})})}function L_(){let e=E(),t=Hf(),[n,r]=J.useState(!1),i=e.data,a=i?.blockedBy??null;return(0,Y.jsx)(`div`,{"data-slot":`privacy-section`,className:`mx-auto flex w-full max-w-2xl flex-col gap-7 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:(0,Y.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,Y.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:(0,Y.jsx)(`label`,{htmlFor:`telemetry-enabled`,children:`Share usage data`})}),(0,Y.jsxs)(`p`,{className:`text-[13px] text-muted-foreground`,children:[`Task counts and crash reports, sent to cezar’s maintainers at Open Mercato`,i?(0,Y.jsxs)(Y.Fragment,{children:[` (`,(0,Y.jsx)(`span`,{className:`font-mono text-[12px]`,children:i.endpoint}),`)`]}):null,`. Never prompts, code, diffs, paths or repository names. Off unless you turn it on; turning it off deletes this machine’s install id.`]})]}),(0,Y.jsx)(fu,{id:`telemetry-enabled`,"data-slot":`telemetry-toggle`,checked:i?.consent===`granted`,disabled:!i||n,onCheckedChange:e=>{r(!0),t(e?`granted`:`denied`).finally(()=>r(!1))}})]}),a===`env`?(0,Y.jsxs)(`p`,{"data-slot":`telemetry-blocked`,className:`text-[13px] text-muted-foreground`,children:[(0,Y.jsx)(`code`,{className:`font-mono text-[12px]`,children:`CEZ_TELEMETRY=0`}),` or`,` `,(0,Y.jsx)(`code`,{className:`font-mono text-[12px]`,children:`DO_NOT_TRACK=1`}),` is set for this server, so nothing is sent whatever this switch says.`]}):a===`automation`?(0,Y.jsxs)(`p`,{"data-slot":`telemetry-blocked`,className:`text-[13px] text-muted-foreground`,children:[`This server runs under CI, a test runner or `,(0,Y.jsx)(`code`,{className:`font-mono text-[12px]`,children:`CEZ_DRY_RUN=1`}),`, so nothing is sent from it.`]}):null,(0,Y.jsxs)(`a`,{href:Lf,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex w-fit items-center gap-1 text-[13px] text-muted-foreground underline-offset-4 hover:text-foreground hover:underline`,children:[`Exactly what is collected`,(0,Y.jsx)(gi,{className:`size-3.5`,"aria-hidden":`true`})]})]})})}var R_=400,z_=Symbol(`none`),B_=e=>e===null?``:String(e);function V_({value:e,min:t,max:n,onCommit:r,allowEmpty:i=!1,emptyStepFrom:a,placeholder:o,disabled:s,"aria-label":c,"data-slot":l,className:u}){let d=(0,J.useId)(),[f,p]=(0,J.useState)(()=>B_(e)),m=(0,J.useRef)(f),h=(0,J.useRef)(null),g=(0,J.useRef)(z_),_=(0,J.useRef)({value:e,onCommit:r});_.current={value:e,onCommit:r};let v=e=>{m.current=e,p(e)};(0,J.useEffect)(()=>{g.current=z_,h.current===null&&v(B_(e))},[e]);let y=(0,J.useRef)(()=>{});(0,J.useEffect)(()=>()=>{h.current!==null&&y.current()},[]);let b=e=>{let r=e.trim();if(r===``)return i?null:`invalid`;if(!/^-?\d+$/.test(r))return`invalid`;let a=Number(r);return a<t||a>n?`invalid`:a},x=b(f),S=x===`invalid`,C=()=>{h.current!==null&&(clearTimeout(h.current),h.current=null);let{value:e,onCommit:t}=_.current,n=b(m.current);if(n===`invalid`||n===e||g.current!==z_&&n===g.current)return;let r=t(n);r instanceof Promise&&(g.current=n,r.catch(()=>{g.current===n&&(g.current=z_),v(B_(_.current.value))}))};y.current=C;let w=e=>{let r=b(m.current),i=r===null?a??t:r===`invalid`?(_.current.value??a??t)+e:r+e;v(String(Math.min(n,Math.max(t,i)))),h.current!==null&&clearTimeout(h.current),h.current=setTimeout(C,R_)},T=t=>{t.key===`ArrowUp`||t.key===`ArrowDown`?(t.preventDefault(),w(t.key===`ArrowUp`?1:-1)):t.key===`Enter`?(t.preventDefault(),C()):t.key===`Escape`&&(h.current!==null&&clearTimeout(h.current),h.current=null,v(B_(e)))},E=typeof x==`number`?x:null,D=`flex h-1/2 w-6 items-center justify-center text-soft-foreground hover:bg-muted hover:text-foreground disabled:pointer-events-none disabled:opacity-40`;return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Y.jsxs)(`div`,{className:G(`flex w-28 items-stretch overflow-hidden rounded-md border border-input bg-card shadow-xs focus-within:border-ring focus-within:ring-[3px] focus-within:ring-ring/50`,S&&`border-danger`,s&&`opacity-50`,u),children:[(0,Y.jsx)(`input`,{type:`text`,inputMode:`numeric`,role:`spinbutton`,"aria-label":c,"aria-valuemin":t,"aria-valuemax":n,"aria-valuenow":E??void 0,"aria-invalid":S||void 0,"aria-describedby":S?d:void 0,"data-slot":l,value:f,placeholder:o,disabled:s,onChange:e=>v(e.target.value),onBlur:C,onKeyDown:T,className:`min-w-0 flex-1 bg-transparent px-3 py-1.5 text-sm outline-none placeholder:text-soft-foreground`}),(0,Y.jsxs)(`div`,{className:`flex flex-col border-l border-input`,children:[(0,Y.jsx)(`button`,{type:`button`,tabIndex:-1,"aria-label":`Increase ${c}`,"data-action":`stepper-increment`,disabled:s||E!==null&&E>=n,onMouseDown:e=>e.preventDefault(),onClick:()=>w(1),className:D,children:(0,Y.jsx)(is,{className:`size-3.5`})}),(0,Y.jsx)(`button`,{type:`button`,tabIndex:-1,"aria-label":`Decrease ${c}`,"data-action":`stepper-decrement`,disabled:s||E!==null&&E<=t,onMouseDown:e=>e.preventDefault(),onClick:()=>w(-1),className:G(D,`border-t border-input`),children:(0,Y.jsx)(ma,{className:`size-3.5`})})]})]}),S?(0,Y.jsxs)(`p`,{id:d,"data-slot":`stepper-invalid`,className:`text-[11px] text-danger`,children:[`Enter a whole number from `,t,` to `,n,i?`, or leave it empty`:``,`.`]}):null]})}function H_(){let e=ft();return{isPending:e.isPending,confirm:(t,n)=>e.mutate(t.id,{onSuccess:()=>{L(`${t.name} removed from the workspace — its files are untouched`),n?.()},onError:e=>L(e.message,{tone:`danger`})})}}function U_({project:e,onOpenChange:t,onConfirm:n}){return(0,Y.jsx)($a,{open:e!==null,onOpenChange:t,children:(0,Y.jsxs)(Ja,{children:[(0,Y.jsxs)(Qa,{children:[(0,Y.jsxs)(qa,{children:[`Remove `,e?.name,` from the workspace?`]}),(0,Y.jsxs)(Ka,{children:[`This only unregisters the project — `,(0,Y.jsx)(`strong`,{children:`nothing on disk is deleted`}),`. The folder, its git history and its task history all stay exactly where they are, and adding it back later finds everything intact.`,(0,Y.jsx)(`span`,{className:`mt-1 block truncate font-mono text-[11px] text-foreground`,title:e?.root,children:e?.root})]})]}),(0,Y.jsxs)(Xa,{children:[(0,Y.jsx)(Za,{children:`Keep it`}),(0,Y.jsx)(Ya,{"data-action":`projects-confirm-remove`,className:`bg-danger text-danger-foreground hover:brightness-[0.96]`,onClick:n,children:`Remove from list`})]})]})})}var W_=1,G_=16,K_={ok:`ok`,"not-git":`no git repo`,missing:`folder not found`};function q_(e){let t=new Date(e);return Number.isNaN(t.getTime())?`—`:t.toLocaleDateString(void 0,{month:`short`,day:`numeric`})}function J_(){let e=st(),t=ln();return e.isPending||t.isPending?(0,Y.jsx)(`p`,{"data-slot":`projects-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading projects…`}):e.isError||t.isError?(0,Y.jsx)(q,{icon:(0,Y.jsx)(vs,{}),tone:`danger`,title:`Project settings did not load`,subtitle:(e.error??t.error)?.message,heading:`h2`}):(0,Y.jsx)(Y_,{config:e.data,registry:t.data})}function Y_({config:e,registry:t}){return(0,Y.jsxs)(`div`,{"data-slot":`projects-section`,className:`mx-auto flex w-full max-w-4xl flex-col gap-7 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:[(0,Y.jsx)(X_,{configKey:`browseRoot`,value:e.browseRoot,title:`Default browse folder`,hint:`Where “Open local folder…” starts. The picker cannot navigate above this folder.`,placeholder:`~/`,slot:`browse`,savedLabel:`Browse folder`,footer:`Only affects folder browsing; GitHub checkouts use the separate checkout folder.`}),(0,Y.jsx)(X_,{configKey:`projectsDir`,value:e.projectsDir,title:`Default checkout folder`,hint:`Where “Clone from GitHub” and “New project” put new projects: <folder>/<project name>.`,placeholder:`~/cezar/projects`,slot:`checkout`,savedLabel:`Checkout folder`,footer:`Only affects new checkouts; projects already registered keep their location.`,refreshProjects:!0}),(0,Y.jsx)(Z_,{registry:t,workspaceMax:e.resources.maxParallel})]})}function X_({configKey:e,value:t,title:n,hint:r,placeholder:i,slot:a,savedLabel:o,footer:s,refreshProjects:c=!1}){let l=I(),u=B({mutationFn:t=>fe(e===`browseRoot`?{browseRoot:t}:{projectsDir:t}),onSuccess:t=>{l.setQueryData(z.config,t),e===`browseRoot`?l.invalidateQueries({queryKey:z.fsBrowseRoot}):c&&l.invalidateQueries({queryKey:z.projects})}}),[d,f]=(0,J.useState)(t),p=d.trim(),m=p===t,h=u.isError?u.error.message:null;return(0,Y.jsxs)($,{title:n,hint:`${r} ${e===`browseRoot`?`Choose an existing folder; it is verified writable before saving.`:`The folder is created recursively if needed, then verified writable before saving.`}`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(`input`,{type:`text`,spellCheck:!1,"aria-label":n,"aria-invalid":h!==null,"data-slot":`projects-${a}-root`,value:d,disabled:u.isPending,placeholder:i,onChange:e=>{f(e.target.value),u.isError&&u.reset()},className:`block w-full max-w-sm rounded-md border border-input bg-card px-3 py-1.5 font-mono text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 aria-invalid:border-danger disabled:opacity-50`}),(0,Y.jsx)(K,{type:`button`,variant:`outline`,size:`sm`,"data-action":`projects-save-${a}-root`,disabled:m||p===``||u.isPending,onClick:()=>u.mutate(p,{onSuccess:()=>L(`${o} set to ${p}`)}),children:`Save`})]}),h===null?(0,Y.jsx)(`p`,{className:`text-[11px] text-soft-foreground`,children:s}):(0,Y.jsxs)(`p`,{"data-slot":`projects-${a}-root-error`,role:`alert`,className:`text-[11px] text-danger`,children:[h,` — setting unchanged`]})]})}function Z_({registry:e,workspaceMax:t}){let[n,r]=(0,J.useState)(null),i=H_(),a=(0,J.useMemo)(()=>an(e.projects),[e.projects]);return(0,Y.jsxs)($,{title:`Registered projects`,hint:`The folders you have added. While this list is empty the folder cezar is serving is listed as “not registered” with an Add button; once you have projects, starting cezar somewhere new neither registers nor lists that folder — use “Add project” when you want to keep it. “Tags” group connected repositories — give the API, the web app and the design system a shared “storefront” tag and the global Tasks page can show all three as one piece of work. “Max parallel” caps how many of that project's tasks run at once (leave it empty to inherit the workspace limit); the workspace limit (${t}) still applies as an overall ceiling, so a per-project value above it has no extra effect until the workspace limit is raised. Removing a project only unregisters it — no files on disk are deleted.`,children:[e.projects.length===0?(0,Y.jsx)(`p`,{"data-slot":`projects-empty`,className:`text-[13px] text-soft-foreground`,children:`No projects registered yet.`}):(0,Y.jsx)(`div`,{className:`overflow-x-auto rounded-md border border-border`,children:(0,Y.jsxs)(`table`,{className:`w-full border-collapse text-sm`,children:[(0,Y.jsx)(`caption`,{className:`sr-only`,children:`Projects in this workspace`}),(0,Y.jsxs)(`colgroup`,{children:[(0,Y.jsx)(`col`,{}),(0,Y.jsx)(`col`,{style:{width:`104px`}}),(0,Y.jsx)(`col`,{style:{width:`260px`}}),(0,Y.jsx)(`col`,{style:{width:`150px`}}),(0,Y.jsx)(`col`,{style:{width:`72px`}}),(0,Y.jsx)(`col`,{style:{width:`92px`}})]}),(0,Y.jsx)(`thead`,{children:(0,Y.jsxs)(`tr`,{className:`border-b border-border text-left text-[12px] text-soft-foreground`,children:[(0,Y.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Project`}),(0,Y.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Status`}),(0,Y.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Tags`}),(0,Y.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Max parallel`}),(0,Y.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Added`}),(0,Y.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium text-right`,children:`Actions`})]})}),(0,Y.jsx)(`tbody`,{children:e.projects.map(n=>(0,Y.jsx)(Q_,{project:n,isBoot:n.id===e.bootProject,workspaceMax:t,vocabulary:a,disabled:i.isPending,onRemove:()=>r(n)},n.id))})]})}),(0,Y.jsx)(U_,{project:n,onOpenChange:e=>!e&&r(null),onConfirm:()=>{if(!n)return;let e=n;r(null),i.confirm(e)}})]})}function Q_({project:e,isBoot:t,workspaceMax:n,vocabulary:r,disabled:i,onRemove:a}){return(0,Y.jsxs)(`tr`,{"data-slot":`project-row`,"data-project":e.id,className:`border-b border-border last:border-0`,children:[(0,Y.jsxs)(`th`,{scope:`row`,className:`max-w-0 px-3 py-2 text-left font-normal`,children:[(0,Y.jsx)(`span`,{className:`block truncate text-foreground`,children:e.name}),(0,Y.jsx)(`span`,{className:`block truncate font-mono text-[11px] text-soft-foreground`,title:e.root,children:e.root})]}),(0,Y.jsxs)(`td`,{className:`px-3 py-2`,children:[(0,Y.jsx)(`span`,{"data-slot":`project-status`,className:e.status===`missing`?`text-[12px] text-danger`:`text-[12px] text-soft-foreground`,children:K_[e.status]}),e.unregistered?(0,Y.jsx)(`span`,{"data-slot":`project-unregistered`,className:`ml-1 text-[11px] text-soft-foreground`,children:`· not registered`}):e.status===`missing`?null:(0,Y.jsxs)(`span`,{className:`ml-1 text-[11px] text-soft-foreground`,children:[`· `,e.source]})]}),(0,Y.jsx)(`td`,{className:`px-3 py-2`,children:e.unregistered?(0,Y.jsx)(`span`,{className:`text-[12px] text-soft-foreground`,children:`—`}):(0,Y.jsx)(ev,{project:e,vocabulary:r})}),(0,Y.jsx)(`td`,{className:`px-3 py-2`,children:e.unregistered?(0,Y.jsx)(`span`,{className:`text-[12px] text-soft-foreground`,children:`—`}):(0,Y.jsx)(tv,{project:e,workspaceMax:n})}),(0,Y.jsx)(`td`,{className:`px-3 py-2 tabular-nums text-soft-foreground`,children:e.unregistered?`—`:q_(e.addedAt)}),(0,Y.jsx)(`td`,{className:`px-3 py-2 text-right`,children:e.unregistered?(0,Y.jsx)($_,{root:e.root,name:e.name,disabled:i}):(0,Y.jsx)(K,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`project-remove`,"aria-label":`Remove ${e.name} from the workspace — unregisters it, no files are deleted`,title:t?"cezar is serving this project — stop it and use `cezar projects remove`":void 0,disabled:i||t,onClick:a,children:`Remove`})})]})}function $_({root:e,name:t,disabled:n=!1}){let r=pn();return(0,Y.jsx)(K,{type:`button`,variant:`outline`,size:`sm`,"data-action":`project-add-boot`,"aria-label":`Add ${t} to your projects`,title:`cezar is serving this folder — save it to your projects`,disabled:n||r.isPending,onClick:()=>r.mutate(e,{onSuccess:()=>L(`${t} added to your projects`),onError:e=>L(e.message,{tone:`danger`})}),children:`Add project`})}function ev({project:e,vocabulary:t}){let n=Ve(),[r,i]=(0,J.useState)(``),[a,o]=(0,J.useState)(!1),[s,c]=(0,J.useState)(-1),l=(0,J.useRef)(null),u=e.tags??[],d=tt(t,u,r),f=a&&d.length>0,p=(t,r)=>{n.mutate({id:e.id,tags:t},{onSuccess:()=>L(r),onError:e=>L(e.message,{tone:`danger`})})},m=t=>{let n=t.trim().slice(0,32);if(c(-1),n){if(u.some(e=>e.toLowerCase()===n.toLowerCase())){i(``);return}if(u.length>=20){L(`${e.name} already has the maximum of 20 tags`,{tone:`danger`});return}i(``),p([...u,n],`${e.name} tagged \u201c${n}\u201d`)}},h=t=>{p(u.filter(e=>e!==t),`\u201c${t}\u201d removed from ${e.name}`)},g=`project-tag-suggestions-${e.id}`;return(0,Y.jsxs)(`div`,{"data-slot":`project-tags`,className:`flex flex-wrap items-center gap-1`,children:[u.map(t=>(0,Y.jsxs)(`span`,{"data-slot":`project-tag`,className:`inline-flex max-w-full items-center gap-1 rounded-full bg-violet/15 py-px pr-1 pl-2 text-[11px] font-medium whitespace-nowrap text-violet`,children:[t,(0,Y.jsx)(`button`,{type:`button`,"data-action":`project-tag-remove`,"aria-label":`Remove tag ${t} from ${e.name}`,disabled:n.isPending,onClick:()=>h(t),className:`rounded-full p-0.5 hover:bg-violet/25 disabled:opacity-50`,children:(0,Y.jsx)(xa,{className:`size-3`,"aria-hidden":`true`})})]},t)),(0,Y.jsxs)(ki,{open:f,onOpenChange:o,children:[(0,Y.jsx)(wi,{asChild:!0,children:(0,Y.jsx)(`input`,{ref:l,type:`text`,"data-slot":`project-tag-input`,"aria-label":`Add a tag to ${e.name}`,role:`combobox`,"aria-expanded":f,"aria-controls":f?g:void 0,"aria-autocomplete":`list`,"aria-activedescendant":f&&s>=0?`${g}-${s}`:void 0,placeholder:u.length===0?`Add tag…`:`+`,value:r,maxLength:32,disabled:n.isPending,onFocus:()=>o(!0),onBlur:()=>o(!1),onChange:e=>{if(o(!0),c(-1),e.target.value.includes(`,`)){i(e.target.value.replace(/,/g,``));return}i(e.target.value)},onKeyDown:e=>{if(e.key===`ArrowDown`||e.key===`ArrowUp`){if(d.length===0)return;e.preventDefault(),o(!0);let t=e.key===`ArrowDown`?1:-1,n=s+t;c(n>=d.length?-1:n<-1?d.length-1:n);return}if(e.key===`Escape`&&f){e.preventDefault(),o(!1),c(-1);return}if(e.key===`Enter`||e.key===`,`){e.preventDefault(),m(s>=0?d[s]??r:r);return}if(e.key===`Tab`){o(!1);return}if(e.key===`Backspace`&&r===``&&u.length>0){e.preventDefault();let t=u[u.length-1];t!==void 0&&h(t)}},className:`h-6 w-16 min-w-0 flex-1 rounded-md border border-input bg-card px-1.5 text-[12px] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`})}),(0,Y.jsxs)(vi,{align:`start`,sideOffset:4,id:g,role:`listbox`,"data-slot":`project-tag-suggestions`,className:`w-56 p-1`,onOpenAutoFocus:e=>e.preventDefault(),onCloseAutoFocus:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:[(0,Y.jsx)(`p`,{className:`px-2 pt-1 pb-1.5 text-[10.5px] text-soft-foreground`,children:`Tags used in this workspace`}),d.map((e,t)=>(0,Y.jsx)(`button`,{type:`button`,id:`${g}-${t}`,role:`option`,"aria-selected":t===s,"data-slot":`project-tag-suggestion`,onMouseDown:e=>e.preventDefault(),onClick:()=>{m(e),l.current?.focus()},onMouseEnter:()=>c(t),className:G(`flex w-full items-center rounded-sm px-2 py-1 text-left text-[12px] font-medium text-violet`,t===s&&`bg-muted`),children:e},e))]})]})]})}function tv({project:e,workspaceMax:t}){let n=Ve();return(0,Y.jsx)(V_,{"aria-label":`Max parallel tasks for ${e.name}`,"data-slot":`project-max-parallel`,value:e.maxParallel??null,min:W_,max:G_,allowEmpty:!0,emptyStepFrom:Math.min(G_,Math.max(W_,t)),placeholder:`Inherit (${t})`,className:`w-40`,onCommit:r=>n.mutateAsync({id:e.id,maxParallel:r},{onSuccess:()=>L(r===null?`${e.name} inherits the workspace limit (${t})`:`${e.name} runs at most ${r} task${r===1?``:`s`} at a time`),onError:e=>L(e.message,{tone:`danger`})})})}var nv=30,rv=100,iv=32,av=60,ov=85,sv=e=>Math.min(100,Math.max(0,e));function cv(){Xo({enabled:!Ao()});let e=Fo(),t=Ko(),{isError:n}=Zo(),r=Uo(),i=Wo(),a=qo(),o=r===void 0?void 0:Do(r),s=o?.cpuPct,c=e===`local`,l=o?.memTotalBytes??0,u=o?.memUsedBytes!==void 0&&l>0?sv(o.memUsedBytes/l*100):0,d=s===void 0?void 0:s>ov?`bg-danger`:s>=av?`bg-pending`:`bg-primary`,f=s===void 0?void 0:sv(s),p=i.length>=2?i.map((e,t)=>{let n=t/(nv-1)*rv,r=iv-sv(e.cpuPct)/100*iv;return`${n.toFixed(1)},${r.toFixed(1)}`}).join(` `):void 0,m=o===void 0||!o.cpuLimited?s===void 0?`sampling…`:`${Math.round(s)}%`:s===void 0?`—`:`${Math.round(s)}%`,h=o===void 0||!o.cpuLimited?void 0:`${o.cpuLimitKind===`cpuset`?`cpuset `:``}${Oo(o.cpuCores)}`,g=o===void 0?void 0:`${o.memUsedBytes===void 0?`—`:Nt(o.memUsedBytes)} / ${Nt(o.memTotalBytes)}`;return(0,Y.jsxs)(`section`,{"data-slot":`machine-card`,"aria-labelledby":`machine-card-title`,className:`rounded-xl border border-border bg-card/60 p-4`,children:[(0,Y.jsxs)(`header`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Y.jsx)(eo,{tone:c?`success`:`neutral`,pulse:c}),(0,Y.jsx)(`h2`,{id:`machine-card-title`,className:`text-sm font-semibold`,children:`Machine`}),(0,Y.jsx)(`span`,{"data-slot":`machine-card-mode`,className:`text-[11px] text-soft-foreground`,children:c?`live`:`last known`}),(0,Y.jsx)(`span`,{"data-slot":`machine-card-freshness`,className:`ml-auto shrink-0 text-[11px] tabular-nums text-soft-foreground`,children:a===void 0?`waiting…`:`updated ${a} s ago`})]}),o?.hasContainer===!0?(0,Y.jsxs)(`p`,{"data-slot":`machine-card-limits`,className:`mt-2 text-[11.5px] text-soft-foreground`,children:[`cgroup limits detected · `,o.source]}):null,t?(0,Y.jsx)(`p`,{"data-slot":`machine-card-transport`,className:`mt-2 text-[11.5px] text-soft-foreground`,children:`The server refused this origin's host topic, so live values are polled from the authenticated route instead.`}):null,n&&r===void 0?(0,Y.jsx)(`p`,{"data-slot":`machine-card-error`,className:`mt-3 text-[12.5px] text-soft-foreground`,children:`Host totals are unavailable right now.`}):null,(0,Y.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,Y.jsxs)(`div`,{"data-slot":`machine-card-cpu`,className:`grid grid-cols-[86px_1fr] items-start gap-3`,children:[(0,Y.jsxs)(`span`,{className:`pt-0.5 text-[12.5px] text-soft-foreground`,children:[`CPU`,o?.cpuIsEffective===!0?` (effective)`:``]}),(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Y.jsx)(`span`,{"data-slot":`machine-card-cpu-value`,className:`w-32 shrink-0 text-[13px] tabular-nums`,children:h===void 0?m:`${h} · ${m}`}),(0,Y.jsx)(`div`,{className:`h-2 min-w-0 flex-1 overflow-hidden rounded-full bg-muted`,children:d===void 0||f===void 0?null:(0,Y.jsx)(`div`,{"data-slot":`machine-card-cpu-bar`,className:G(`h-full rounded-full`,d),style:{width:`${f}%`}})})]}),p===void 0?null:(0,Y.jsx)(`svg`,{"data-slot":`machine-card-cpu-sparkline`,className:`mt-1.5 h-8 w-full text-primary`,viewBox:`0 0 ${rv} ${iv}`,preserveAspectRatio:`none`,role:`img`,"aria-label":`CPU over the last up to ${i.length*2} seconds`,children:(0,Y.jsx)(`polyline`,{points:p,fill:`none`,stroke:`currentColor`,strokeWidth:1.5,vectorEffect:`non-scaling-stroke`})})]})]}),o===void 0?null:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`div`,{"data-slot":`machine-card-memory`,className:`grid grid-cols-[86px_1fr] items-center gap-3`,children:[(0,Y.jsxs)(`span`,{className:`text-[12.5px] text-soft-foreground`,children:[`Memory`,o.memIsEffective?` (effective)`:``]}),(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,Y.jsx)(`span`,{"data-slot":`machine-card-memory-value`,className:`w-32 shrink-0 text-[13px] tabular-nums`,children:g}),(0,Y.jsx)(`div`,{className:`h-2 min-w-0 flex-1 overflow-hidden rounded-full bg-muted`,children:(0,Y.jsx)(`div`,{className:`h-full rounded-full bg-primary`,style:{width:`${u}%`}})})]})]}),typeof r?.swapTotalBytes==`number`&&typeof r?.swapUsedBytes==`number`?(0,Y.jsxs)(`div`,{"data-slot":`machine-card-swap`,className:`grid grid-cols-[86px_1fr] items-center gap-3`,children:[(0,Y.jsx)(`span`,{className:`text-[12.5px] text-soft-foreground`,children:`Swap`}),(0,Y.jsxs)(`span`,{className:`text-[13px] tabular-nums`,children:[Nt(r.swapUsedBytes),` / `,Nt(r.swapTotalBytes)]})]}):null,r?.loadAvg===void 0?null:(0,Y.jsxs)(`div`,{"data-slot":`machine-card-load`,className:`grid grid-cols-[86px_1fr] items-center gap-3`,children:[(0,Y.jsx)(`span`,{className:`text-[12.5px] text-soft-foreground`,children:`Load average`}),(0,Y.jsxs)(`span`,{className:`flex items-center gap-2 text-[13px] tabular-nums`,children:[r.loadAvg.one.toFixed(2),` · `,r.loadAvg.five.toFixed(2),` ·`,` `,r.loadAvg.fifteen.toFixed(2),(0,Y.jsx)(`span`,{"data-slot":`machine-card-load-cores`,className:`rounded-md border border-border px-1.5 py-0.5 text-[11px] text-soft-foreground`,children:o.hasContainer&&o.hostCpuCount!==void 0?`host ${o.hostCpuCount} cores`:`${r.cpuCount} cores`})]})]}),o.hasContainer&&o.hostCpuCount!==void 0?(0,Y.jsxs)(`p`,{"data-slot":`machine-card-host-context`,className:`text-[11.5px] tabular-nums text-soft-foreground`,children:[`host `,Oo(o.hostCpuCount),` · `,Nt(r?.memTotalBytes??0),` RAM`]}):null]})]}),(0,Y.jsx)(`p`,{"data-slot":`machine-card-caveat`,className:`mt-3 border-t border-border pt-2 text-[11px] text-soft-foreground`,children:o?.hasContainer===!0?`Effective values come from this process’s own cgroup; host totals are labelled.`:o?.cgroupUnknown===!0?`No cgroup information available for this process - host totals only.`:`Host totals - no cgroup limit tighter than the host detected for this process.`})]})}var lv=1,uv=16,dv=16,fv=1440,pv=1,mv=60,hv=256;function gv(){let e=st();return e.isPending?(0,Y.jsx)(`p`,{"data-slot":`resources-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading resource settings…`}):e.isError?(0,Y.jsx)(q,{icon:(0,Y.jsx)(ys,{}),tone:`danger`,title:`Resource settings did not load`,subtitle:e.error.message,heading:`h2`}):(0,Y.jsx)(_v,{config:e.data})}function _v({config:e}){let t=I(),n=B({mutationFn:e=>fe(e),onSuccess:e=>t.setQueryData(z.config,e),onError:e=>L(e.message,{tone:`danger`})}),[r,i]=(0,J.useState)(e.resources.memoryLimitMb?String(e.resources.memoryLimitMb):``),a=e.resources.monitoringWakeIntervalMinutes??null,[o,s]=(0,J.useState)(a===null?`park`:`interval`),[c,l]=(0,J.useState)(String(a??5)),u=Number(c),d=!Number.isInteger(u)||u<pv||u>mv,f=o===`park`?a===null:!d&&a===u,p=()=>n.mutate({resources:{monitoringWakeIntervalMinutes:o===`park`?null:u}},{onSuccess:()=>L(o===`park`?`Monitoring will stay parked`:`Monitoring will re-check every ${u} minutes`)}),m=e.resources.autoResumeOnUsageLimit??!0,h=e=>n.mutate({resources:{autoResumeOnUsageLimit:e}},{onSuccess:()=>L(e?`Tasks stopped by a usage limit will resume themselves`:`Tasks stopped by a usage limit will stay failed`)}),g=r.trim()===``?0:Number(r),_=r.trim()!==``&&(!Number.isInteger(g)||g<hv),v=(e.resources.memoryLimitMb??0)===(_?-1:g),y=()=>n.mutate({resources:{memoryLimitMb:g===0?null:g}},{onSuccess:()=>L(g===0?`Memory limit cleared`:`Memory limit set to ${g} MiB`)}),b=e.composerDefaults??{autonomous:null,worktree:null,inheritedAutonomous:`source-dependent`,inheritedWorktree:!0},x=(e,t)=>n.mutate({composerDefaults:{[e]:t===`inherit`?null:t===`on`}});return(0,Y.jsxs)(`div`,{"data-slot":`resources-section`,className:`mx-auto flex w-full max-w-2xl flex-col gap-7 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:[(0,Y.jsx)(cv,{}),(0,Y.jsxs)($,{title:`Max parallel tasks`,hint:`How many tasks run at once across every project. The rest wait in the queue. A non-git directory always runs one at a time.`,children:[(0,Y.jsx)(V_,{"aria-label":`Max parallel tasks`,"data-slot":`resources-max-parallel`,value:e.resources.maxParallel,min:lv,max:uv,onCommit:e=>n.mutateAsync({resources:{maxParallel:e??lv}})}),(0,Y.jsxs)(`p`,{className:`text-[11px] text-soft-foreground`,children:[`Need a different limit for one project?`,` `,(0,Y.jsx)(ke,{to:`/settings/global/projects`,"data-slot":`resources-project-limits-link`,className:`font-medium text-foreground underline decoration-border underline-offset-2 hover:decoration-foreground`,children:`Configure per-project limits`}),`.`]})]}),(0,Y.jsxs)($,{title:`Waiting-session idle timeout`,hint:`How long a plain waiting session may stay open without activity before its live backend session ends. Continue resumes it; set 0 to keep it open indefinitely.`,children:[(0,Y.jsx)(V_,{"aria-label":`Waiting-session idle timeout`,"data-slot":`resources-idle-timeout`,value:e.resources.idleTimeoutMinutes??0,min:0,max:fv,onCommit:e=>n.mutateAsync({resources:{idleTimeoutMinutes:e??0}})}),(0,Y.jsx)(`p`,{className:`text-[11px] text-soft-foreground`,children:`Minutes; 0 keeps plain waiting sessions alive. Monitoring sessions are already exempt.`})]}),(0,Y.jsxs)($,{title:`Extra monitoring sessions`,hint:`How many agent sessions may wait on CI, sub-agents, or monitored commands without using an active task slot. Extra sessions stay alive but pause the queue.`,children:[(0,Y.jsx)(V_,{"aria-label":`Extra monitoring sessions`,"data-slot":`resources-max-monitoring`,value:e.resources.maxMonitoringSessions??2,min:0,max:dv,onCommit:e=>n.mutateAsync({resources:{maxMonitoringSessions:e??0}})}),(0,Y.jsxs)(`p`,{className:`text-[11px] text-soft-foreground`,children:[`Capacity: `,e.resources.maxParallel,` active + `,e.resources.maxMonitoringSessions??2,` monitoring. Set 0 to make monitoring share active slots.`]})]}),(0,Y.jsxs)($,{title:`Monitoring wake-up`,hint:`Park uses no model turns. Re-check sends the same agent a follow-up on this cadence until work completes or the 40-wakeup safety cap is reached.`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Y.jsxs)(`select`,{"aria-label":`Monitoring wake-up`,"data-slot":`resources-monitoring-wake-mode`,value:o,disabled:n.isPending,onChange:e=>s(e.target.value),className:`rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`,children:[(0,Y.jsx)(`option`,{value:`park`,children:`Park until resumed`}),(0,Y.jsx)(`option`,{value:`interval`,children:`Re-check on an interval`})]}),o===`interval`?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`input`,{type:`number`,min:pv,max:mv,"aria-label":`Wake interval in minutes`,"data-slot":`resources-monitoring-wake-interval`,value:c,disabled:n.isPending,onChange:e=>l(e.target.value),className:`block w-24 rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`}),(0,Y.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`minutes`})]}):null,(0,Y.jsx)(K,{type:`button`,variant:`outline`,size:`sm`,"data-action":`resources-save-monitoring-wake`,disabled:f||o===`interval`&&d||n.isPending,onClick:p,children:`Save`})]}),o===`interval`&&d?(0,Y.jsx)(`p`,{"data-slot":`resources-monitoring-wake-invalid`,className:`text-[11px] text-danger`,children:`Enter a whole number from 1 to 60 minutes.`}):(0,Y.jsx)(`p`,{className:`text-[11px] text-soft-foreground`,children:`Applied consistently to Claude, Codex and OpenCode.`})]}),(0,Y.jsxs)($,{title:`Auto-resume after a usage limit`,hint:`When an agent stops because its provider usage limit is reached, cezar waits for the reset the provider named and continues the task 30 seconds later — up to 12 times in a row without you. Off leaves the task failed with its Continue button.`,children:[(0,Y.jsxs)(`select`,{"aria-label":`Auto-resume after a usage limit`,"data-slot":`resources-auto-resume`,value:m?`on`:`off`,disabled:n.isPending,onChange:e=>h(e.target.value===`on`),className:`block w-28 rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`,children:[(0,Y.jsx)(`option`,{value:`on`,children:`On`}),(0,Y.jsx)(`option`,{value:`off`,children:`Off`})]}),(0,Y.jsx)(`p`,{className:`text-[11px] text-soft-foreground`,children:`Applies to Claude, Codex and OpenCode — whenever the provider says when the limit lifts.`})]}),(0,Y.jsxs)($,{title:`Per-task memory limit`,hint:`When a task's whole process tree crosses this, the engine pauses it with a warning and starts the next queued task. Leave empty for no limit.`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(`input`,{type:`number`,inputMode:`numeric`,min:hv,step:256,"aria-label":`Per-task memory limit in MiB`,"data-slot":`resources-memory-limit`,value:r,disabled:n.isPending,placeholder:`no limit`,onChange:e=>i(e.target.value),className:`block w-32 rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`}),(0,Y.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`MiB`}),(0,Y.jsx)(K,{type:`button`,variant:`outline`,size:`sm`,"data-action":`resources-save-memory`,disabled:v||_||n.isPending,onClick:y,children:`Save`})]}),_?(0,Y.jsxs)(`p`,{"data-slot":`resources-memory-invalid`,className:`text-[11px] text-danger`,children:[`Enter a whole number of at least `,hv,` MiB, or leave empty for no limit.`]}):(0,Y.jsx)(`p`,{className:`text-[11px] text-soft-foreground`,children:`Applies to newly started tasks.`})]}),(0,Y.jsxs)($,{title:`New task defaults`,hint:`Set stable composer defaults across projects. Explicit choices and run-shape constraints still win.`,children:[(0,Y.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,"data-slot":`resources-composer-defaults`,children:[(0,Y.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,Y.jsx)(`span`,{className:`font-medium`,children:`Autonomous by default`}),(0,Y.jsxs)(`select`,{"aria-label":`Autonomous by default`,value:b.autonomous===null?`inherit`:b.autonomous?`on`:`off`,disabled:n.isPending,onChange:e=>x(`autonomous`,e.target.value),className:`rounded-md border border-input bg-card px-3 py-1.5 shadow-xs outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`,children:[(0,Y.jsx)(`option`,{value:`inherit`,children:`Inherit environment`}),(0,Y.jsx)(`option`,{value:`on`,children:`On`}),(0,Y.jsx)(`option`,{value:`off`,children:`Off`})]}),(0,Y.jsxs)(`span`,{className:`text-[11px] text-soft-foreground`,children:[`Inherited: `,b.inheritedAutonomous===`source-dependent`?`Source-dependent — skills on, workflows off`:b.inheritedAutonomous?`On`:`Off`]})]}),(0,Y.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,Y.jsx)(`span`,{className:`font-medium`,children:`Use a worktree by default`}),(0,Y.jsxs)(`select`,{"aria-label":`Use a worktree by default`,value:b.worktree===null?`inherit`:b.worktree?`on`:`off`,disabled:n.isPending,onChange:e=>x(`worktree`,e.target.value),className:`rounded-md border border-input bg-card px-3 py-1.5 shadow-xs outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`,children:[(0,Y.jsx)(`option`,{value:`inherit`,children:`Inherit environment`}),(0,Y.jsx)(`option`,{value:`on`,children:`On`}),(0,Y.jsx)(`option`,{value:`off`,children:`Off`})]}),(0,Y.jsxs)(`span`,{className:`text-[11px] text-soft-foreground`,children:[`Inherited: `,b.inheritedWorktree?`On`:`Off`]})]})]}),(0,Y.jsx)(`p`,{className:`text-[11px] text-soft-foreground`,children:`Interactive skills may recommend both off. Multi-step and parallel runs remain isolated.`})]})]})}function vv(){let e=st();return e.isPending?(0,Y.jsx)(`p`,{"data-slot":`skills-settings-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading skill settings…`}):e.isError?(0,Y.jsx)(q,{icon:(0,Y.jsx)(Fs,{}),tone:`danger`,title:`Skill settings did not load`,subtitle:e.error.message,heading:`h2`}):(0,Y.jsx)(yv,{config:e.data})}function yv({config:e}){let t=I(),n=B({mutationFn:e=>fe(e),onSuccess:e=>t.setQueryData(z.config,e),onError:e=>L(e.message,{tone:`danger`})}),r=e.skillsAutoUpdate===null;return(0,Y.jsx)(`div`,{"data-slot":`skills-settings-section`,className:`mx-auto flex w-full max-w-2xl flex-col gap-4 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:(0,Y.jsxs)(`section`,{className:`flex flex-col gap-3`,children:[(0,Y.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:(0,Y.jsx)(`label`,{htmlFor:`skills-auto-update`,children:`Update Open Mercato skills automatically`})}),(0,Y.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Checks installed Open Mercato skills in the background and applies available updates. Other skills and untracked folders are never changed.`})]}),(0,Y.jsxs)(`div`,{className:`flex shrink-0 flex-col items-end gap-1`,children:[(0,Y.jsx)(fu,{id:`skills-auto-update`,"data-slot":`skills-auto-update`,checked:e.effectiveSkillsAutoUpdate,disabled:n.isPending,onCheckedChange:e=>n.mutate({skillsAutoUpdate:e})}),(0,Y.jsxs)(`span`,{className:`text-[11px] text-soft-foreground`,children:[e.effectiveSkillsAutoUpdate?`On`:`Off`,r?` (default)`:``]})]})]}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 rounded-md border border-border bg-muted/30 px-3 py-2 text-xs text-muted-foreground`,children:[(0,Y.jsx)(`span`,{children:r?`No override is saved. CEZ_SKILLS_AUTO_UPDATE supplies the inherited default when set; otherwise it is on.`:`An explicit workspace override is saved.`}),(0,Y.jsx)(K,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`skills-use-default`,disabled:r||n.isPending,onClick:()=>n.mutate({skillsAutoUpdate:null}),children:`Use default`})]})]})})}function bv(){let e=ve();return e.isPending?(0,Y.jsx)(`p`,{"data-slot":`tasks-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading task settings…`}):e.isError?(0,Y.jsx)(q,{icon:(0,Y.jsx)(Ds,{}),tone:`danger`,title:`Task settings did not load`,subtitle:e.error.message,heading:`h2`}):(0,Y.jsx)(xv,{config:e.data})}function xv({config:e}){let t=Pt(),n=Gg();return(0,Y.jsxs)(`div`,{"data-slot":`tasks-section`,className:`mx-auto flex w-full max-w-2xl flex-col gap-7 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:[(0,Y.jsx)($,{title:`Base branch`,hint:`New task worktrees branch from this and draft PRs target it. Also settable from the Git view.`,children:t.data?.info?(0,Y.jsxs)(`select`,{"aria-label":`Base branch`,"data-slot":`tasks-base-branch`,value:e.baseBranch??``,disabled:n.isPending,onChange:e=>n.mutate({baseBranch:e.target.value||null}),className:`block w-full max-w-md rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`,children:[(0,Y.jsx)(`option`,{value:``,children:`follow checked-out branch (default)`}),t.data.branches.map(e=>(0,Y.jsx)(`option`,{value:e,children:e},e))]}):(0,Y.jsx)(`p`,{"data-slot":`tasks-base-branch-unavailable`,className:`text-[13px] text-soft-foreground`,children:t.isPending?`Loading branches…`:`Not a git repository — tasks run in place, no branching.`})}),(0,Y.jsx)($,{title:`Review changes before finishing`,hint:`When on, a task with changes pauses so you can Accept, Send back, or open a Draft PR. Autonomous tasks always skip this and finish on their own. Default: off — tasks finish without asking.`,children:(0,Y.jsxs)(`label`,{className:`flex w-fit items-center gap-3`,children:[(0,Y.jsx)(fu,{"aria-label":`Review changes before finishing`,"data-slot":`tasks-review-gate`,checked:e.reviewGate??!1,disabled:n.isPending,onCheckedChange:e=>n.mutate({reviewGate:e},{onSuccess:()=>L(e?`Review gate on`:`Review gate off`)})}),(0,Y.jsxs)(`span`,{className:`text-[13px] text-muted-foreground`,children:[e.reviewGate??!1?`On`:`Off`,e.reviewGate===null&&` (default)`]})]})}),(0,Y.jsx)($,{title:`Live title updates`,hint:`Refresh a task's short title through the namer model as the run progresses. A manual rename always wins and stops updates for that task.`,children:(0,Y.jsxs)(`label`,{className:`flex w-fit items-center gap-3`,children:[(0,Y.jsx)(fu,{"aria-label":`Live title updates`,"data-slot":`tasks-live-title-updates`,checked:e.liveTitleUpdates??!0,disabled:n.isPending,onCheckedChange:e=>n.mutate({liveTitleUpdates:e},{onSuccess:()=>L(e?`Live title updates on`:`Live title updates off`)})}),(0,Y.jsxs)(`span`,{className:`text-[13px] text-muted-foreground`,children:[e.liveTitleUpdates??!0?`On`:`Off`,e.liveTitleUpdates===null&&` (default)`]})]})})]})}function Sv(){let e=$t(),t=I(),[n,r]=(0,J.useState)(null),i=()=>t.invalidateQueries({queryKey:R.worktrees}),a=B({mutationFn:()=>sn(),onSuccess:e=>{i(),L(e.reclaimed.length===0?`Nothing to reclaim — all worktrees are within the limit`:`Reclaimed ${e.reclaimed.length} worktree${e.reclaimed.length===1?``:`s`} (branch kept)`)},onError:e=>L(e.message,{tone:`danger`})}),o=B({mutationFn:e=>Ge(e),onSuccess:()=>{i(),L(`Worktree removed`)},onError:e=>L(e.message,{tone:`danger`})});if(e.isPending)return(0,Y.jsx)(`p`,{"data-slot":`worktrees-loading`,className:`text-[13px] text-soft-foreground`,children:`Loading worktrees…`});if(e.isError)return(0,Y.jsxs)(`p`,{"data-slot":`worktrees-error`,className:`text-[13px] text-danger`,children:[`Worktrees did not load: `,e.error.message]});let{worktrees:s,totalBytes:c,keep:l}=e.data,u=a.isPending||o.isPending;return(0,Y.jsxs)(`div`,{"data-slot":`worktrees-panel`,className:`flex flex-col gap-3`,children:[s.length===0?(0,Y.jsx)(`p`,{"data-slot":`worktrees-empty`,className:`text-[13px] text-soft-foreground`,children:`No task worktrees on disk.`}):(0,Y.jsx)(`div`,{className:`overflow-x-auto rounded-md border border-border`,children:(0,Y.jsxs)(`table`,{className:`w-full border-collapse text-sm`,children:[(0,Y.jsx)(`caption`,{className:`sr-only`,children:`Task worktrees currently materialized on disk`}),(0,Y.jsx)(`thead`,{children:(0,Y.jsxs)(`tr`,{className:`border-b border-border text-left text-[12px] text-soft-foreground`,children:[(0,Y.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Task`}),(0,Y.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Status`}),(0,Y.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Size`}),(0,Y.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Age`}),(0,Y.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium text-right`,children:`Actions`})]})}),(0,Y.jsx)(`tbody`,{children:s.map(e=>(0,Y.jsx)(Cv,{worktree:e,disabled:u,onDelete:()=>r({kind:`delete`,runId:e.runId,title:e.title})},e.runId))})]})}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Y.jsxs)(`p`,{"data-slot":`worktrees-footer`,className:`text-[12px] text-soft-foreground`,children:[s.length,` worktree`,s.length===1?``:`s`,c===null?` · size unavailable`:` · ${Nt(c)||`0 kB`} on disk`,` · `,l===0?`keeping all (unlimited)`:`keeping the last ${l}`]}),(0,Y.jsx)(K,{type:`button`,variant:`outline`,size:`sm`,"data-action":`worktrees-reclaim-now`,disabled:u,onClick:()=>r({kind:`reclaim`}),children:`Reclaim now`})]}),(0,Y.jsx)($a,{open:n!==null,onOpenChange:e=>!e&&r(null),children:(0,Y.jsxs)(Ja,{children:[(0,Y.jsxs)(Qa,{children:[(0,Y.jsx)(qa,{children:n?.kind===`delete`?`Delete this worktree?`:`Reclaim old worktrees?`}),(0,Y.jsx)(Ka,{children:n?.kind===`delete`?(0,Y.jsxs)(Y.Fragment,{children:[`This removes the worktree directory and its branch — the local-only work is not recoverable afterwards.`,(0,Y.jsx)(`span`,{className:`mt-1 block truncate font-medium text-foreground`,title:n.title,children:n.title})]}):`Finished worktrees beyond the keep-limit are reclaimed now (directory only). Their branches are kept, so the work stays recoverable.`})]}),(0,Y.jsxs)(Xa,{children:[(0,Y.jsx)(Za,{children:`Keep it`}),(0,Y.jsx)(Ya,{"data-action":`worktrees-confirm`,className:n?.kind===`delete`?`bg-danger text-danger-foreground hover:brightness-[0.96]`:void 0,onClick:()=>{n?.kind===`reclaim`?a.mutate():n?.kind===`delete`&&o.mutate(n.runId),r(null)},children:n?.kind===`delete`?`Delete`:`Reclaim now`})]})]})})]})}function Cv({worktree:e,disabled:t,onDelete:n}){return(0,Y.jsxs)(`tr`,{"data-slot":`worktree-row`,"data-run":e.runId,className:`border-b border-border last:border-0`,children:[(0,Y.jsxs)(`th`,{scope:`row`,className:`max-w-[220px] px-3 py-2 text-left font-normal`,children:[(0,Y.jsx)(`span`,{className:`block truncate text-foreground`,title:e.title,children:e.title}),(0,Y.jsx)(`span`,{className:`block truncate font-mono text-[11px] text-soft-foreground`,children:e.branch??e.runId.slice(0,8)})]}),(0,Y.jsxs)(`td`,{className:`px-3 py-2`,children:[(0,Y.jsx)(`span`,{className:`text-[12px] text-soft-foreground`,children:e.status}),e.reclaimable?(0,Y.jsx)(`span`,{"data-slot":`worktree-reclaimable`,className:`ml-1 text-[11px] text-soft-foreground`,children:`(reclaimable)`}):null]}),(0,Y.jsx)(`td`,{className:`px-3 py-2 tabular-nums text-soft-foreground`,children:e.sizeBytes===null?`—`:Nt(e.sizeBytes)||`0 kB`}),(0,Y.jsx)(`td`,{className:`px-3 py-2 tabular-nums text-soft-foreground`,children:to(e.finishedAt??void 0)||`—`}),(0,Y.jsx)(`td`,{className:`px-3 py-2 text-right`,children:(0,Y.jsx)(K,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`worktree-delete`,"aria-label":`Delete the worktree for ${e.title}`,disabled:t,onClick:n,children:`Delete`})})]})}var wv=0,Tv=1e3;function Ev(){let e=ve();return e.isPending?(0,Y.jsx)(`p`,{"data-slot":`worktrees-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading worktree settings…`}):e.isError?(0,Y.jsx)(q,{icon:(0,Y.jsx)(ms,{}),tone:`danger`,title:`Worktree settings did not load`,subtitle:e.error.message,heading:`h2`}):(0,Y.jsx)(Dv,{config:e.data})}function Dv({config:e}){let t=I(),n=B({mutationFn:e=>j(e),onSuccess:e=>t.setQueryData(R.config,e),onError:e=>L(e.message,{tone:`danger`})}),[r,i]=(0,J.useState)(String(e.worktreeRetention)),a=Number(r),o=r.trim()===``||!Number.isInteger(a)||a<wv||a>Tv,s=e.worktreeRetention===(o?-1:a);return(0,Y.jsxs)(`div`,{"data-slot":`worktrees-section`,className:`mx-auto flex w-full max-w-2xl flex-col gap-7 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:[(0,Y.jsxs)($,{title:`Keep last N worktrees`,hint:`Older finished worktrees are reclaimed to free disk; their branch is kept so the work stays recoverable. 0 = unlimited. In-review and running tasks are never reclaimed, so the count on disk can exceed this.`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(`input`,{type:`number`,inputMode:`numeric`,min:wv,max:Tv,step:1,"aria-label":`Keep last N finished worktrees`,"data-slot":`resources-worktree-retention`,value:r,disabled:n.isPending,onChange:e=>i(e.target.value),className:`block w-32 rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`}),(0,Y.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`worktrees`}),(0,Y.jsx)(K,{type:`button`,variant:`outline`,size:`sm`,"data-action":`resources-save-retention`,disabled:s||o||n.isPending,onClick:()=>n.mutate({worktreeRetention:a},{onSuccess:()=>{t.invalidateQueries({queryKey:R.worktrees}),L(a===0?`Keeping all worktrees (unlimited)`:`Keeping the last ${a} finished worktree${a===1?``:`s`}`)}}),children:`Save`})]}),o?(0,Y.jsxs)(`p`,{"data-slot":`resources-retention-invalid`,className:`text-[11px] text-danger`,children:[`Enter a whole number from `,wv,` to `,Tv,` (0 = unlimited).`]}):(0,Y.jsx)(`p`,{className:`text-[11px] text-soft-foreground`,children:a===0?`Keeping every finished worktree.`:`Keeping the last ${a} finished worktree${a===1?``:`s`} on disk.`})]}),(0,Y.jsx)($,{title:`Worktrees`,hint:`Task worktrees currently on disk. Delete one to reclaim its space now, or reclaim everything past the keep-limit at once. Branches are always kept, so the work stays recoverable.`,children:(0,Y.jsx)(Sv,{})})]})}function Ov(){let e=P(),t=je(),n=I(),[r,i]=(0,J.useState)(`jira`),[a,o]=(0,J.useState)(null),[s,c]=(0,J.useState)(``),[l,u]=(0,J.useState)(``),[d,f]=(0,J.useState)(``),p=()=>{f(``),u(``),c(``),o(null)};(0,J.useEffect)(()=>{p(),h(!1),y(null)},[kn()]);let[m,h]=(0,J.useState)(!1),[g,_]=(0,J.useState)(``),[v,y]=(0,J.useState)(null),b=C(r,g,m),x=b.data?.pages??[],S=x.find(e=>e.available)?.available?x.find(e=>e.available).source:void 0,w=(0,J.useMemo)(()=>x.flatMap(e=>e.available?e.candidates:[]),[x]);(0,J.useEffect)(()=>{h(!1),y(null),p()},[e.data?.connection?.id]);let T=x.find(e=>!e.available),E=async e=>{await n.invalidateQueries({queryKey:R.tracker.allFor(e)}),await n.invalidateQueries({queryKey:z.projects})},D=B({mutationFn:async()=>{if(!v||!S)throw Error(`Choose a tracker project first.`);let t=kn(),n=R.tracker.associationFor(t);return{...await Mt({kind:r,sourceId:S.id,externalId:v.id,...e.data?.connection?{connectionId:e.data.connection.id}:{}}),projectId:t,associationKey:n}},onSuccess:async e=>{await Promise.all([n.cancelQueries({queryKey:R.tracker.allFor(e.projectId)}),n.cancelQueries({queryKey:z.projects})]),n.setQueryData(e.associationKey,{association:e.association}),h(!1),y(null),await E(e.projectId),L(`${e.association.externalName} connected`)},onError:e=>L(e.message,{tone:`danger`})}),O=B({mutationFn:async()=>{let e=kn(),t=R.tracker.associationFor(e);return{...await ct(),projectId:e,associationKey:t}},onSuccess:async e=>{await Promise.all([n.cancelQueries({queryKey:R.tracker.allFor(e.projectId)}),n.cancelQueries({queryKey:z.projects})]),n.setQueryData(e.associationKey,{association:null}),await E(e.projectId),L(`Tracker disconnected`)},onError:e=>L(e.message,{tone:`danger`})}),k=B({onMutate:()=>kn(),mutationFn:async()=>{let e=kn();if(!a)throw Error(`Choose a provider.`);return{...await gt(a===`jira`?{kind:`jira`,origin:s.trim(),email:l.trim(),token:d}:{kind:`linear`,key:d}),projectId:e}},onSuccess:async e=>{kn()===e.projectId&&(p(),h(!1),y(null)),await n.cancelQueries({queryKey:R.tracker.allFor(e.projectId)}),n.setQueryData([`tracker`,e.projectId,`connection`],{connection:e.connection,demo:e.demo}),await E(e.projectId),L(`Credentials saved for this project. Browse and connect a scope.`)},onError:(e,t,n)=>{kn()===n&&f(``),L(e.message,{tone:`danger`})}}),A=B({mutationFn:async()=>{let e=kn();return await rn(),e},onSuccess:async e=>{kn()===e&&(p(),h(!1),y(null)),await n.cancelQueries({queryKey:R.tracker.allFor(e)}),n.setQueryData([`tracker`,e,`connection`],{connection:null,demo:!1}),await E(e),L(`Project credentials removed`)},onError:e=>L(e.message,{tone:`danger`})}),j=k.isPending||A.isPending,M=t.data?.association,N=e.data?.connection,F=!!M&&(e.data?.demo===!0||!!N&&N.kind===M.kind&&N.id===M.connectionId);return t.isPending?(0,Y.jsx)(`p`,{className:`p-6 text-sm text-muted-foreground`,children:`Loading tracker settings…`}):t.isError?(0,Y.jsx)(`p`,{className:`p-6 text-sm text-danger`,children:t.error.message}):(0,Y.jsxs)(`div`,{className:`mx-auto flex w-full max-w-2xl flex-col gap-6 p-4 md:p-6`,"data-slot":`tracker-settings`,children:[(0,Y.jsxs)(`section`,{className:`rounded-lg border border-border bg-card p-4`,children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold`,children:`Issue tracker`}),(0,Y.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Connect a project or team from your issue tracker. Credentials belong only to this project and are stored locally outside the repository. Server-wide environment keys are not used.`}),F&&t.data.association?(0,Y.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center justify-between gap-3 rounded-md border border-border p-3`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`font-medium`,children:t.data.association.externalName}),(0,Y.jsxs)(`a`,{className:`inline-flex items-center gap-1 text-xs text-violet hover:underline`,href:t.data.association.source.webUrl,target:`_blank`,rel:`noreferrer`,children:[Js[t.data.association.kind].label,` `,(0,Y.jsx)(ia,{className:`size-3`})]})]}),(0,Y.jsxs)(K,{variant:`outline`,onClick:()=>O.mutate(),disabled:O.isPending,children:[(0,Y.jsx)(Ks,{className:`size-3.5`}),` Disconnect`]})]}):(0,Y.jsx)(`p`,{className:`mt-4 text-sm font-medium`,children:e.isPending?`Loading connection…`:e.isError?`Connection status unavailable.`:`No tracker connected.`})]}),M&&N&&!e.isError&&!e.data?.demo&&!F?(0,Y.jsx)(`p`,{className:`text-sm text-warning`,children:`This scope needs reconnection with this project's credentials. Configure a connection, then browse and select its scope again.`}):null,e.data?.error?(0,Y.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:e.data.error}):null,(0,Y.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`For local credential cleanup, run `,(0,Y.jsx)(`code`,{children:`cez tracker-connections list`}),`, then `,(0,Y.jsx)(`code`,{children:`cez tracker-connections remove <id>`}),`. Local deletion does not revoke the vendor token.`]}),e.isError?(0,Y.jsxs)(`p`,{className:`text-sm text-danger`,children:[`Could not load project connection. `,(0,Y.jsx)(`button`,{onClick:()=>void e.refetch(),children:`Retry`})]}):null,(0,Y.jsxs)(`section`,{className:`rounded-lg border border-border bg-card p-4`,children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold`,children:`Connect a provider`}),(0,Y.jsx)(`div`,{className:`mt-3 grid gap-3 sm:grid-cols-2`,children:Ys.map(t=>{let n=!e.isError&&(e.data?.demo===!0||e.data?.connection?.kind===t.kind);return(0,Y.jsxs)(`div`,{className:`rounded-md border border-border p-3`,children:[(0,Y.jsx)(`p`,{className:`font-medium`,children:t.label}),e.data?.demo?null:(0,Y.jsxs)(K,{variant:`outline`,disabled:j||e.isPending||e.isError,onClick:()=>{p(),o(t.kind),h(!1),y(null)},children:[e.data?.connection?.kind===t.kind?`Replace`:`Configure`,` `,t.label,` credentials`]}),(0,Y.jsxs)(K,{className:`mt-3`,variant:`outline`,disabled:!n||j,onClick:()=>{i(t.kind),h(!0),_(``),y(null)},children:[(0,Y.jsx)(Es,{className:`size-3.5`}),` Browse `,t.label]}),n?null:(0,Y.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:`Configure credentials for this project to browse.`})]},t.kind)})})]}),e.data?.connection?(0,Y.jsx)(K,{variant:`outline`,disabled:j,onClick:()=>A.mutate(),children:`Remove project credentials`}):null,a?(0,Y.jsxs)(`form`,{className:`rounded-lg border border-border bg-card p-4`,onSubmit:e=>{e.preventDefault(),k.mutate()},autoComplete:`off`,children:[(0,Y.jsxs)(`h2`,{className:`font-medium`,children:[Js[a].label,` credentials for this project`]}),(0,Y.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:`Saved in a private .env file for this project, without encryption. Use read-only access limited to this project's data. Saving replaces this project's connection and requires selecting its scope again.`}),a===`jira`?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`label`,{className:`mt-3 block text-sm`,children:[`Jira site URL`,(0,Y.jsx)(`input`,{"aria-label":`Jira site URL`,type:`url`,required:!0,value:s,onChange:e=>c(e.target.value),placeholder:`https://your-site.atlassian.net`,className:`mt-1 block w-full rounded border bg-background p-2`})]}),(0,Y.jsxs)(`label`,{className:`mt-3 block text-sm`,children:[`Account email`,(0,Y.jsx)(`input`,{"aria-label":`Account email`,type:`email`,required:!0,value:l,onChange:e=>u(e.target.value),className:`mt-1 block w-full rounded border bg-background p-2`})]})]}):null,(0,Y.jsxs)(`label`,{className:`mt-3 block text-sm`,children:[`API token`,(0,Y.jsx)(`input`,{"aria-label":`API token`,type:`password`,autoComplete:`new-password`,required:!0,maxLength:8192,value:d,onChange:e=>f(e.target.value),className:`mt-1 block w-full rounded border bg-background p-2`})]}),(0,Y.jsxs)(`div`,{className:`mt-3 flex gap-2`,children:[(0,Y.jsx)(K,{type:`submit`,disabled:j,children:`Save project credentials`}),(0,Y.jsx)(K,{type:`button`,variant:`outline`,disabled:j,onClick:p,children:`Cancel`})]})]}):null,m?(0,Y.jsxs)(`section`,{className:`rounded-lg border border-violet/40 bg-card p-4`,"aria-label":`${Js[r].label} picker`,children:[(0,Y.jsxs)(`label`,{className:`text-xs font-medium`,htmlFor:`tracker-candidate-search`,children:[`Search `,Js[r].scopeLabel]}),(0,Y.jsx)(`input`,{id:`tracker-candidate-search`,className:`mt-2 h-9 w-full rounded-md border border-border bg-background px-3 text-sm`,value:g,onChange:e=>{_(e.target.value),y(null)},placeholder:`Search by name…`}),(0,Y.jsxs)(`div`,{className:`mt-3 max-h-64 space-y-1 overflow-auto`,children:[b.isPending?(0,Y.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Loading…`}):null,b.isError?(0,Y.jsx)(kv,{reason:b.error.message,generation:b.errorUpdatedAt,retry:()=>void b.refetch()}):null,T&&!T.available?(0,Y.jsx)(kv,{reason:T.reason,generation:b.dataUpdatedAt,retryAfterSeconds:T.code===`rate_limited`?T.retryAfterSeconds:void 0,retry:()=>void b.refetch()}):null,w.map(e=>(0,Y.jsx)(`button`,{type:`button`,className:`block w-full rounded-md border px-3 py-2 text-left text-sm ${v?.id===e.id?`border-violet bg-violet/10`:`border-border`}`,onClick:()=>y(e),children:e.name},e.id)),!b.isPending&&!b.isError&&!T&&w.length===0?(0,Y.jsx)(`p`,{className:`py-3 text-sm text-muted-foreground`,children:`No projects or teams match.`}):null,b.hasNextPage?(0,Y.jsx)(K,{variant:`ghost`,onClick:()=>void b.fetchNextPage(),disabled:b.isFetchingNextPage,children:`Load more`}):null]}),(0,Y.jsxs)(`div`,{className:`mt-4 flex gap-2`,children:[(0,Y.jsx)(K,{variant:`contrast`,disabled:!v||D.isPending||j,onClick:()=>D.mutate(),children:`Connect`}),(0,Y.jsx)(K,{variant:`ghost`,onClick:()=>h(!1),children:`Cancel`})]})]}):null]})}function kv({reason:e,retry:t,retryAfterSeconds:n=0,generation:r}){let[i,a]=(0,J.useState)(n);return(0,J.useEffect)(()=>a(n),[e,n,r]),(0,J.useEffect)(()=>{if(i<=0)return;let e=window.setInterval(()=>a(e=>Math.max(0,e-1)),1e3);return()=>window.clearInterval(e)},[i>0]),(0,Y.jsxs)(`div`,{className:`rounded-md border border-danger/30 bg-danger/5 p-3 text-sm`,children:[(0,Y.jsx)(`p`,{className:`text-danger`,children:e}),(0,Y.jsx)(K,{className:`mt-2`,variant:`outline`,disabled:i>0,onClick:t,children:i>0?`Retry in ${i}s`:`Retry`})]})}var Av={checks:`Check steps (workflow commands)`,cezar:`cezar itself (its own features — not the agents)`};function jv(e){return e===`keychain`?`Encrypted with a data key kept in your OS keychain.`:`Encrypted with a data key in ~/.cezar/secrets/.key (0600) — no OS keychain is available on this machine, so this is a private file, not a vault.`}function Mv({scope:e,list:t,save:n,remove:r,invalidate:i}){let a=I(),[o,s]=(0,J.useState)(``),[c,l]=(0,J.useState)(``),[u,d]=(0,J.useState)([`checks`]),[f,p]=(0,J.useState)(null),m=o===``?null:Ln(o),h=B({mutationFn:async()=>{let e=kn();return await n(o,{value:c,audiences:u}),{projectId:e,saved:o}},onSuccess:async({projectId:e,saved:t})=>{kn()===e&&(s(``),l(``),p(null)),await i(a,e),L(`${t} saved`)},onError:e=>p(e.message)}),g=B({mutationFn:async e=>{let t=kn();return await r(e),{projectId:t,removed:e}},onSuccess:async({projectId:e,removed:t})=>{await i(a,e),L(`${t} removed`)},onError:e=>L(e.message,{tone:`danger`})}),_=()=>{let e=Ln(o);if(e){p(e);return}if(u.length===0){p(`pick at least one audience`);return}p(null),h.mutate()},v=e=>d(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]),y=e===`project`?`Project secrets`:`Workspace secrets`,b=e===`project`?`Values for this project only — an e2e runner’s model key, a staging login. They reach the audiences you pick and never an agent session.`:`Values shared by every project on this machine — a key cezar’s own features use, a token every project’s checks need. A project secret of the same name wins. They never reach an agent session.`,x=t.data?.secrets??[];return(0,Y.jsxs)(`div`,{className:`mx-auto flex w-full max-w-2xl flex-col gap-6 p-4 md:p-6`,"data-slot":`secrets-settings`,"data-scope":e,children:[(0,Y.jsxs)(`section`,{className:`rounded-lg border border-border bg-card p-4`,children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold`,children:y}),(0,Y.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:b}),t.isPending?(0,Y.jsx)(`p`,{className:`mt-4 text-sm text-muted-foreground`,children:`Loading…`}):null,t.isError?(0,Y.jsx)(`p`,{role:`alert`,className:`mt-4 text-sm text-danger`,children:t.error?.message}):null,t.data&&x.length===0?(0,Y.jsx)(`p`,{className:`mt-4 text-sm text-muted-foreground`,children:`No secrets stored.`}):null,t.data&&x.length>0?(0,Y.jsx)(`ul`,{className:`mt-4 divide-y divide-border rounded-md border border-border`,"aria-label":`Stored ${e} secrets`,children:x.map(e=>(0,Y.jsxs)(`li`,{className:`flex items-center justify-between gap-3 px-3 py-2`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(`code`,{className:`text-sm`,children:e.name}),(0,Y.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.audiences.map(e=>Av[e].split(` (`)[0]).join(` · `)})]}),(0,Y.jsxs)(K,{variant:`outline`,"aria-label":`Delete ${e.name}`,disabled:g.isPending,onClick:()=>g.mutate(e.name),children:[(0,Y.jsx)(ra,{className:`size-3.5`}),` Delete`]})]},e.name))}):null,t.data?(0,Y.jsx)(`p`,{className:`mt-3 text-xs text-muted-foreground`,"data-slot":`key-backend`,children:jv(t.data.keyBackend)}):null]}),(0,Y.jsxs)(`form`,{className:`rounded-lg border border-border bg-card p-4`,autoComplete:`off`,onSubmit:e=>{e.preventDefault(),_()},children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold`,children:`Add or replace a secret`}),(0,Y.jsxs)(`label`,{className:`mt-3 block text-sm`,children:[`Name`,(0,Y.jsx)(`input`,{"aria-label":`Name`,value:o,onChange:e=>{s(e.target.value.toUpperCase()),p(null)},autoComplete:`off`,spellCheck:!1,placeholder:`AI_GATEWAY_API_KEY`,"aria-invalid":m?!0:void 0,className:`mt-1 block w-full rounded border border-border bg-background p-2 font-mono`})]}),m?(0,Y.jsx)(`p`,{className:`mt-1 text-xs text-danger`,children:m}):null,(0,Y.jsxs)(`label`,{className:`mt-3 block text-sm`,children:[`Value`,(0,Y.jsx)(`input`,{"aria-label":`Value`,type:`password`,autoComplete:`off`,required:!0,value:c,onChange:e=>l(e.target.value),className:`mt-1 block w-full rounded border border-border bg-background p-2`})]}),(0,Y.jsxs)(`fieldset`,{className:`mt-3`,children:[(0,Y.jsx)(`legend`,{className:`text-sm`,children:`Who may read it`}),Fn.map(e=>(0,Y.jsxs)(`label`,{className:`mt-1 flex items-center gap-2 text-sm`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,"aria-label":Av[e],checked:u.includes(e),onChange:()=>v(e)}),Av[e]]},e)),(0,Y.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:`Agents are never an audience: a secret cannot be handed to a Claude Code, Codex or OpenCode session.`})]}),f&&f!==m?(0,Y.jsx)(`p`,{role:`alert`,className:`mt-2 text-sm text-danger`,children:f}):null,(0,Y.jsx)(`div`,{className:`mt-3`,children:(0,Y.jsx)(K,{type:`submit`,disabled:h.isPending||o===``||c===``||u.length===0||!!m,children:`Save secret`})})]})]})}function Nv(){return(0,Y.jsx)(Mv,{scope:`project`,list:lt(),save:Gt,remove:yt,invalidate:(e,t)=>e.invalidateQueries({queryKey:R.secrets.allFor(t??``)})})}function Pv(){return(0,Y.jsx)(Mv,{scope:`workspace`,list:cn(),save:Ue,remove:et,invalidate:e=>e.invalidateQueries({queryKey:z.secrets})})}var Fv=`/assets/tester-army-tUUSV6JM.png`,Iv=`https://github.com/tester-army/e2e`,Lv={AI_GATEWAY_API_KEY:`Vercel AI Gateway`,OPENAI_API_KEY:`OpenAI`,ANTHROPIC_API_KEY:`Anthropic`,OPENROUTER_API_KEY:`OpenRouter`},Rv=new Set([`queued`,`running`,`waiting`]);function zv(e,t,n,r){if(Rv.has(e))return`Setting up — cezar is installing and configuring e2e in its own worktree.`;let i=r?`its draft PR is ready — merge it to finish.`:`merge ${n?`branch ${n}`:`the setup task’s branch`} to finish.`;return e===`review`?`Ready for review — ${i}`:e===`done`?t?`Setup finished.`:`Setup finished — ${i}`:e===`failed`?`The last setup failed — open the task to see why, then try again.`:`The last setup was cancelled.`}function Bv({ok:e,children:t}){return(0,Y.jsxs)(`li`,{className:`flex items-center gap-2 text-sm`,"data-ok":e,children:[e?(0,Y.jsx)(oa,{className:`size-4 text-success`,"aria-hidden":!0}):(0,Y.jsx)(js,{className:`size-4 text-muted-foreground`,"aria-hidden":!0}),(0,Y.jsx)(`span`,{className:e?void 0:`text-muted-foreground`,children:t})]})}function Vv(){let e=I(),t=de(),n=l(),r=Ze(n.data?.setup?.runId),[i,a]=(0,J.useState)(void 0),[o,s]=(0,J.useState)(``),[c,u]=(0,J.useState)(null),d=r.data?.status??n.data?.setup?.status,f=r.data?.pullRequestUrl&&/^https?:\/\//.test(r.data.pullRequestUrl)?r.data.pullRequestUrl:void 0,p=d!==void 0&&Rv.has(d),m=n.data?.credentials??[],h=i??m[0]??`AI_GATEWAY_API_KEY`,g=!!(n.data?.configFile&&n.data.workflow),_=B({mutationFn:async()=>({projectId:kn(),runId:(await bn(o?{credential:{name:h,value:o}}:{})).runId}),onSuccess:async({projectId:n,runId:r})=>{s(``),u(null),await Promise.all([e.invalidateQueries({queryKey:R.e2e.allFor(n??``)}),e.invalidateQueries({queryKey:R.secrets.allFor(n??``)})]),L(`e2e setup started`),kn()===n&&t(We(n,`/tasks/${r}`))},onError:e=>u(e.message)});return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-4`,"data-slot":`e2e-settings`,children:[(0,Y.jsxs)(`section`,{className:`rounded-lg border border-border bg-card p-4`,children:[(0,Y.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,Y.jsx)(`img`,{src:Fv,alt:``,width:40,height:40,className:`size-10 shrink-0 rounded-md`}),(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold`,children:`TesterArmy e2e`}),(0,Y.jsx)(`span`,{"data-slot":`e2e-badge`,"data-state":p?`setting-up`:g?`installed`:`none`,className:g&&!p?`rounded-full bg-success/10 px-2 py-0.5 text-xs font-medium text-success`:`rounded-full bg-muted px-2 py-0.5 text-xs font-medium text-muted-foreground`,children:p?`Setting up`:g?`Installed`:`Not set up`})]}),(0,Y.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Agentic browser end-to-end testing`})]}),(0,Y.jsxs)(`a`,{href:Iv,target:`_blank`,rel:`noreferrer`,className:`inline-flex shrink-0 items-center gap-1 text-xs text-muted-foreground underline-offset-2 hover:text-foreground hover:underline`,children:[`tester-army/e2e `,(0,Y.jsx)(ia,{className:`size-3`,"aria-hidden":!0})]})]}),(0,Y.jsxs)(`p`,{className:`mt-3 text-sm text-muted-foreground`,children:[`cezar installs it for this project, points it at your dev server, writes a smoke test and an`,` `,(0,Y.jsx)(`code`,{children:`implement-and-e2e`}),` workflow, proves it all passes in a real browser and opens a draft PR for you to merge.`]}),n.isPending?(0,Y.jsx)(`p`,{className:`mt-4 text-sm text-muted-foreground`,children:`Loading…`}):null,n.isError?(0,Y.jsx)(`p`,{role:`alert`,className:`mt-4 text-sm text-danger`,children:n.error.message}):null,n.data?(0,Y.jsxs)(`ul`,{className:`mt-4 flex flex-col gap-1.5`,"aria-label":`e2e status`,children:[(0,Y.jsx)(Bv,{ok:!!n.data.configFile,children:n.data.configFile?(0,Y.jsxs)(Y.Fragment,{children:[`Configured (`,(0,Y.jsx)(`code`,{children:n.data.configFile}),`)`]}):`Not configured in this checkout`}),(0,Y.jsxs)(Bv,{ok:n.data.workflow,children:[(0,Y.jsx)(`code`,{children:`implement-and-e2e`}),` workflow `,n.data.workflow?`available`:`not added yet`]}),(0,Y.jsx)(Bv,{ok:m.length>0,children:m.length>0?(0,Y.jsxs)(Y.Fragment,{children:[`Model key: `,(0,Y.jsx)(`code`,{children:m.join(`, `)})]}):`No model key — smoke tests run without one; agent steps need one`})]}):null,n.data?.setup&&d?(0,Y.jsxs)(`p`,{className:`mt-3 text-sm`,"data-slot":`e2e-setup-run`,"data-status":d,children:[zv(d,!!n.data.configFile,r.data?.branch,f),` `,f&&!n.data.configFile?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`a`,{className:`underline`,href:f,target:`_blank`,rel:`noreferrer`,children:`Open the draft PR`}),` · `]}):null,(0,Y.jsx)(ke,{className:`underline`,to:We(kn(),`/tasks/${n.data.setup.runId}`),children:`Open the setup task`})]}):null]}),(0,Y.jsxs)(`form`,{className:`rounded-lg border border-border bg-card p-4`,autoComplete:`off`,onSubmit:e=>{e.preventDefault(),_.mutate()},children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold`,children:g?`Set up again`:`Set up e2e`}),(0,Y.jsxs)(`label`,{className:`mt-3 block text-sm`,children:[`Model provider`,(0,Y.jsx)(`select`,{"aria-label":`Model provider`,value:h,onChange:e=>a(e.target.value),className:`mt-1 block w-full rounded border border-border bg-background p-2 outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50`,children:Bn.map(e=>(0,Y.jsxs)(`option`,{value:e,children:[Lv[e],` (`,e,`)`,m.includes(e)?` — stored`:``]},e))})]}),(0,Y.jsxs)(`label`,{className:`mt-3 block text-sm`,children:[`API key `,(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:`(optional)`}),(0,Y.jsx)(`input`,{"aria-label":`API key`,type:`password`,autoComplete:`off`,value:o,onChange:e=>s(e.target.value),placeholder:m.includes(h)?`stored — leave empty to keep it`:``,className:`mt-1 block w-full rounded border border-border bg-background p-2`})]}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:`Stored encrypted as a project secret for check steps only — never handed to an agent session.`}),c?(0,Y.jsx)(`p`,{role:`alert`,className:`mt-2 text-sm text-danger`,children:c}):null,(0,Y.jsx)(`div`,{className:`mt-3`,children:(0,Y.jsx)(K,{type:`submit`,disabled:_.isPending||p||!n.data,children:p?`Setup in progress…`:g?`Set up again`:`Set up e2e`})})]})]})}function Hv(){return(0,Y.jsxs)(`div`,{className:`mx-auto flex w-full max-w-2xl flex-col gap-4 p-4 md:p-6`,"data-slot":`integrations-settings`,children:[(0,Y.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Tools cezar can set up in this project for you — each one as a task you review and merge.`}),(0,Y.jsxs)(ag,{defaultValue:`test-frameworks`,children:[(0,Y.jsx)(sg,{variant:`line`,"data-slot":`integrations-tabs`,children:(0,Y.jsx)(cg,{value:`test-frameworks`,children:`Test frameworks`})}),(0,Y.jsx)(lg,{value:`test-frameworks`,className:`pt-4`,children:(0,Y.jsx)(Vv,{})})]})]})}function Uv(e,t){return function(){return(0,Y.jsx)(q,{icon:(0,Y.jsx)(t,{}),tone:`neutral`,title:e,subtitle:`This section arrives in a later phase of the redesign.`,heading:`h2`})}}var Wv=[{id:`tracker`,title:`Issue tracker`,description:`Connect this project to Jira or Linear.`,icon:Gs,component:Ov,scope:`project`},{id:`secrets`,title:`Secrets`,description:`Encrypted values for this project’s check steps and cezar — never for agents.`,icon:Cs,component:Nv,scope:`project`},{id:`integrations`,title:`External integrations`,description:`Third-party tools cezar installs and wires into this project — test frameworks first.`,icon:ns,component:Hv,scope:`project`},{id:`agents`,title:`Agents`,description:`Providers, default runner and models.`,icon:na,component:Kg,scope:`project`},{id:`instructions`,title:`Instructions`,description:`What you write for the models: system prompt, branch naming, prompt templates.`,icon:za,component:D_,scope:`project`},{id:`tasks`,title:`Tasks`,description:`Base branch, review before finishing, live titles.`,icon:Ds,component:bv,scope:`project`},{id:`agent-config`,title:`Agent config`,description:`Edit the coding agents’ own config files, per scope.`,icon:fs,component:Fg,scope:`project`},{id:`worktrees`,title:`Worktrees`,description:`How many finished task worktrees this project keeps on disk.`,icon:ms,component:Ev,scope:`project`},{id:`bookmarklets`,title:`Bookmarklets`,description:`Launch skills from a GitHub PR or issue.`,icon:rs,component:k_,scope:`project`},{id:`appearance`,title:`Appearance`,description:`Theme, accent and density.`,icon:Is,component:b_,scope:`global`},{id:`notifications`,title:`Notifications`,description:`Browser notifications when an agent needs you.`,icon:ts,component:I_,scope:`global`},{id:`resources`,title:`Resources`,description:`Parallel tasks and per-task memory limit, across every project.`,icon:ys,component:gv,scope:`global`},{id:`skills`,title:`Skills`,description:`Updates for skills installed on this machine.`,icon:Fs,component:vv,scope:`global`},{id:`workspace-secrets`,title:`Secrets`,description:`Encrypted values shared by every project on this machine — never for agents.`,icon:Cs,component:Pv,scope:`global`},{id:`accounts`,title:`Agent accounts`,description:`Second logins, and the agent and models a project uses when it has chosen none.`,icon:xs,component:_g,scope:`global`},{id:`projects`,title:`Projects`,description:`The workspace registry and where GitHub checkouts land.`,icon:vs,component:J_,scope:`global`},{id:`privacy`,title:`Privacy`,description:`Whether cezar shares usage data with its maintainers. Off unless you turn it on.`,icon:Vs,component:L_,scope:`global`},{id:`keyboard`,title:`Keyboard`,description:`Shortcuts.`,icon:ws,component:Uv(`Keyboard`,ws),scope:`global`,hidden:!0}];function Gv(e,t){return Wv.filter(n=>!n.hidden&&n.scope===e&&!(t?.singleProject===!0&&n.id===`projects`))}function Kv(){let e=tn(),t=ln().data;return e===null?null:t?.projects.find(t=>t.id===e)?.root??null}function qv(e){navigator.clipboard.writeText(e).then(()=>L(`Project folder copied`)).catch(()=>L(e))}function Jv(){let e=Kv();return e===null?null:(0,Y.jsx)($,{title:`Project folder`,hint:`Where this project lives on disk. Every task worktree, git command and agent run resolves against it.`,children:(0,Y.jsxs)(`div`,{"data-slot":`project-location`,"data-variant":`field`,className:`flex items-start gap-3 rounded-md border border-border bg-card p-3`,children:[(0,Y.jsx)(`span`,{"data-slot":`project-location-path`,className:`min-w-0 flex-1 font-mono text-xs break-all text-foreground`,children:e}),(0,Y.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,Y.jsx)(`button`,{type:`button`,"data-action":`project-location-copy`,title:`Copy the project folder path`,onClick:()=>qv(e),className:`text-xs font-medium text-muted-foreground transition-colors hover:text-foreground`,children:`Copy`}),(0,Y.jsx)(Xv,{root:e})]})]})})}function Yv(){let e=Kv();return e===null?null:(0,Y.jsxs)(`div`,{"data-slot":`project-location`,"data-variant":`nav`,className:`mt-auto px-2.5 pt-3`,children:[(0,Y.jsx)(`p`,{className:`text-[11px] text-soft-foreground`,children:`Project folder`}),(0,Y.jsx)(`button`,{type:`button`,"data-action":`project-location-copy`,title:`${e} — click to copy`,onClick:()=>qv(e),className:`block w-full truncate text-left font-mono text-[11px] text-muted-foreground transition-colors hover:text-foreground`,children:e})]})}function Xv({root:e}){let t=k(),n=B({mutationFn:e=>te(e),onError:e=>L(e.message,{tone:`danger`})}),r=(t.data?.targets??[]).filter(e=>Ur(e.id)===void 0).map(e=>({target:e}));return r.length===0?null:(0,Y.jsx)(Pr,{slot:`project-location-open`,label:`Open with`,triggerVariant:`outline`,title:e,disabled:n.isPending,choices:r,onPick:e=>n.mutate(e,{onSuccess:()=>L(`Opening the project folder in ${r.find(t=>t.target.id===e)?.target.label??e}`)})})}function Zv(e){let t=new Date(e);return Number.isNaN(t.getTime())?`—`:t.toLocaleDateString(void 0,{year:`numeric`,month:`short`,day:`numeric`})}function Qv({capabilities:e}){let t=tn(),n=ln(),r=st();if(n.isPending)return(0,Y.jsx)(`p`,{"data-slot":`project-general-loading`,className:`text-[13px] text-soft-foreground`,children:`Loading project…`});if(n.isError)return(0,Y.jsxs)(`p`,{"data-slot":`project-general-error`,className:`text-[13px] text-danger`,children:[`Could not read the project registry — `,n.error.message]});let i=n.data,a=i?.projects.find(e=>e.id===t);if(!i||!a)return null;let o=e?.singleProject!==!0&&a.unregistered!==!0;return(0,Y.jsxs)(`div`,{"data-slot":`project-general`,className:`mx-auto flex w-full max-w-2xl flex-col gap-7`,children:[(0,Y.jsx)(Jv,{}),(0,Y.jsx)($v,{project:a,canRemove:o}),a.unregistered?(0,Y.jsx)($,{title:`Add to your projects`,hint:`cezar is serving this folder because you started it here — starting cezar somewhere new never adds it to your project list for you. Adding it keeps it in the sidebar between runs and gives it a registry entry to hold settings like the task cap. Nothing on disk changes either way.`,children:(0,Y.jsx)($_,{root:a.root,name:a.name})}):null,o?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)($,{title:`Max parallel tasks`,hint:r.data?`How many of this project's tasks may run at once — leave it empty to inherit the workspace limit. The workspace limit (${r.data.resources.maxParallel}) still applies as an overall ceiling, so a higher value here has no extra effect until that one is raised.`:`How many of this project's tasks may run at once — leave it empty to inherit the workspace limit. The workspace limit still applies as an overall ceiling.`,children:r.data?(0,Y.jsx)(tv,{project:a,workspaceMax:r.data.resources.maxParallel}):(0,Y.jsx)(`p`,{className:`text-[13px] text-soft-foreground`,children:`Loading the workspace limit…`})}),(0,Y.jsx)(ey,{project:a,bootProject:i.bootProject})]}):null]})}function $v({project:e,canRemove:t}){return(0,Y.jsx)($,{title:`Project`,hint:`The registry entry for this checkout — re-probed every time the project list is read.`,children:(0,Y.jsxs)(`dl`,{"data-slot":`project-facts`,className:`grid grid-cols-[8rem_minmax(0,1fr)] gap-x-3 gap-y-1.5 rounded-md border border-border bg-card p-3 text-[13px]`,children:[(0,Y.jsx)(`dt`,{className:`text-muted-foreground`,children:`Name`}),(0,Y.jsx)(`dd`,{className:`min-w-0 truncate text-foreground`,children:e.name}),(0,Y.jsx)(`dt`,{className:`text-muted-foreground`,children:`Status`}),(0,Y.jsxs)(`dd`,{"data-slot":`project-general-status`,className:e.status===`missing`?`text-danger`:`text-foreground`,children:[K_[e.status],e.status===`missing`?t?` — remove it below, or restore the folder`:` — restore the folder at the path above`:null]}),e.branch===void 0?null:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`dt`,{className:`text-muted-foreground`,children:`Branch`}),(0,Y.jsx)(`dd`,{className:`min-w-0 truncate font-mono text-xs text-foreground`,children:e.branch})]}),e.unregistered?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`dt`,{className:`text-muted-foreground`,children:`In your projects`}),(0,Y.jsx)(`dd`,{"data-slot":`project-general-unregistered`,className:`text-foreground`,children:`No — served because cezar was started here`})]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`dt`,{className:`text-muted-foreground`,children:`Added`}),(0,Y.jsxs)(`dd`,{className:`text-foreground`,children:[Zv(e.addedAt),(0,Y.jsx)(`span`,{className:`text-soft-foreground`,children:e.source===`checkout`?` · cloned from GitHub`:` · opened locally`})]}),(0,Y.jsx)(`dt`,{className:`text-muted-foreground`,children:`Last opened`}),(0,Y.jsx)(`dd`,{className:`text-foreground`,children:Zv(e.lastOpenedAt)})]})]})})}function ey({project:e,bootProject:t}){let[n,r]=(0,J.useState)(null),i=H_(),a=de(),o=e.id===t;return(0,Y.jsxs)($,{title:`Remove from workspace`,hint:`Unregisters this project so it leaves the sidebar and the project list. Nothing on disk is deleted — the folder, its git history and its task history all stay, and adding it back later finds everything intact.`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Y.jsxs)(K,{type:`button`,variant:`outline`,size:`sm`,"data-action":`project-general-remove`,"aria-label":`Remove ${e.name} from the workspace — unregisters it, no files are deleted`,title:o?"cezar is serving this project — stop it and use `cezar projects remove`":void 0,disabled:o||i.isPending,onClick:()=>r(e),className:`text-danger`,children:[`Remove `,e.name]}),o?(0,Y.jsx)(`span`,{"data-slot":`project-general-remove-boot`,className:`text-[11px] text-soft-foreground`,children:"cezar is serving this project — stop cezar and run `cezar projects remove` to drop it."}):null]}),(0,Y.jsx)(U_,{project:n,onOpenChange:e=>!e&&r(null),onConfirm:()=>{r(null),i.confirm(e,()=>void a(`/p/${encodeURIComponent(t)}`))}})]})}function ty(e,t){return e===`global`?`/settings/global/${t}`:`/settings/${t}`}function ny(e){return e===`global`?`/settings/global`:`/settings`}function ry(e){return e===`global`?{Link:ke,NavLink:S}:{Link:V,NavLink:Ft}}function iy({scope:e,activeId:t,capabilities:n}){let{NavLink:r}=ry(e);return(0,Y.jsxs)(`nav`,{"aria-label":`Settings sections`,"data-slot":`settings-nav`,"data-scope":e,className:`hidden w-52 shrink-0 flex-col gap-1 border-r border-border p-3 md:flex`,children:[(0,Y.jsxs)(r,{to:ny(e),end:!0,"data-slot":`settings-nav-index`,"aria-current":t===null?`page`:void 0,className:G(`flex items-center gap-2.5 rounded-md px-2.5 py-2 text-[13px] font-medium transition-colors`,t===null?`bg-muted text-foreground`:`text-muted-foreground hover:bg-muted/60 hover:text-foreground`),children:[(0,Y.jsx)(nr,{"aria-hidden":`true`,className:`size-4 shrink-0`}),`General`]}),Gv(e,n).map(n=>(0,Y.jsxs)(r,{to:ty(e,n.id),"data-section":n.id,"aria-current":n.id===t?`page`:void 0,className:G(`flex items-center gap-2.5 rounded-md px-2.5 py-2 text-[13px] font-medium transition-colors`,n.id===t?`bg-muted text-foreground`:`text-muted-foreground hover:bg-muted/60 hover:text-foreground`),children:[(0,Y.jsx)(n.icon,{"aria-hidden":`true`,className:`size-4 shrink-0`}),n.title]},n.id)),e===`global`?(0,Y.jsx)(`p`,{className:`mt-auto px-2.5 pt-3 text-[11px] text-soft-foreground`,children:`Stored in ~/.cezar`}):(0,Y.jsx)(Yv,{})]})}function ay({scope:e,activeId:t,capabilities:n}){let{NavLink:r}=ry(e);return(0,Y.jsxs)(`nav`,{"aria-label":`Settings sections`,"data-slot":`settings-nav-mobile`,className:`flex shrink-0 gap-1.5 overflow-x-auto border-b border-border px-3 py-2.5 md:hidden`,children:[(0,Y.jsx)(r,{to:ny(e),end:!0,"data-slot":`settings-nav-index`,className:`rounded-full border border-border bg-card px-3 py-1.5 text-[13px] font-medium whitespace-nowrap text-muted-foreground transition-colors`,children:`General`}),Gv(e,n).map(n=>(0,Y.jsx)(r,{to:ty(e,n.id),"data-section":n.id,"aria-current":n.id===t?`page`:void 0,className:G(`rounded-full border px-3 py-1.5 text-[13px] font-medium whitespace-nowrap transition-colors`,n.id===t?`border-transparent bg-contrast text-contrast-foreground`:`border-border bg-card text-muted-foreground`),children:n.title},n.id))]})}function oy({section:e,scope:t,capabilities:n}){let r=e.component;return(0,Y.jsxs)(`div`,{"data-route":t===`global`?`settings-global-${e.id}`:`settings-${e.id}`,className:`flex min-h-full flex-col`,children:[(0,Y.jsxs)(`header`,{className:`sticky top-0 z-10 hidden h-14 shrink-0 items-center gap-3 border-b border-border bg-background px-5 md:flex`,children:[(0,Y.jsx)(`h1`,{className:`text-base font-semibold`,children:e.title}),(0,Y.jsx)(`p`,{className:`text-[13px] text-soft-foreground`,children:e.description}),t===`global`?(0,Y.jsx)(`span`,{"data-slot":`settings-scope-chip`,className:`ml-auto text-[11px] text-soft-foreground`,children:`Global settings`}):null]}),(0,Y.jsxs)(`div`,{className:`flex flex-1 flex-col md:flex-row`,children:[(0,Y.jsx)(iy,{scope:t,activeId:e.id,capabilities:n}),(0,Y.jsx)(ay,{scope:t,activeId:e.id,capabilities:n}),(0,Y.jsx)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:(0,Y.jsx)(r,{})})]})]})}function sy({scope:e,capabilities:t}){let{Link:n}=ry(e),r=e===`global`;return(0,Y.jsxs)(`div`,{"data-route":r?`settings-global`:`settings`,className:`flex min-h-full flex-col`,children:[(0,Y.jsxs)(`header`,{className:`sticky top-0 z-10 hidden h-14 shrink-0 items-center gap-3 border-b border-border bg-background px-5 md:flex`,children:[(0,Y.jsx)(`h1`,{className:`text-base font-semibold`,children:r?`Global settings`:`Settings`}),(0,Y.jsx)(`p`,{className:`text-[13px] text-soft-foreground`,children:r?`Preferences for you and this machine, shared by every project.`:`Configure this project and its agents.`})]}),(0,Y.jsxs)(`div`,{className:`flex flex-1 flex-col md:flex-row`,children:[(0,Y.jsx)(iy,{scope:e,activeId:null,capabilities:t}),(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col p-3 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-5 md:pb-5`,children:[r?null:(0,Y.jsx)(Qv,{capabilities:t}),(0,Y.jsx)(`ul`,{"data-slot":`settings-index`,className:G(`mx-auto flex w-full max-w-2xl flex-col gap-2.5`,r?null:`mt-7 md:hidden`),children:Gv(e,t).map(t=>(0,Y.jsx)(`li`,{children:(0,Y.jsxs)(n,{to:ty(e,t.id),"data-section":t.id,className:`flex items-center gap-3.5 rounded-lg border border-border bg-card p-4 shadow-xs transition-colors hover:bg-card-2`,children:[(0,Y.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-md border border-border bg-muted text-muted-foreground`,children:(0,Y.jsx)(t.icon,{"aria-hidden":`true`,className:`size-4`})}),(0,Y.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Y.jsx)(`span`,{className:`block text-sm font-medium text-foreground`,children:t.title}),(0,Y.jsx)(`span`,{className:`block text-xs text-soft-foreground`,children:t.description})]}),(0,Y.jsx)(ya,{"aria-hidden":`true`,className:`size-4 shrink-0 text-soft-foreground`})]})},t.id))}),(0,Y.jsx)(`p`,{className:`mx-auto mt-4 w-full max-w-2xl text-[12px] text-soft-foreground`,children:r?(0,Y.jsx)(Y.Fragment,{children:`Agents, worktrees, bookmarklets and prompt templates are per project.`}):(0,Y.jsxs)(Y.Fragment,{children:[`Appearance, notifications, host resources and the project registry live in`,` `,(0,Y.jsx)(ke,{to:ny(`global`),"data-slot":`settings-global-link`,className:`underline underline-offset-2 hover:text-foreground`,children:`Global settings`}),`.`]})})]})]})]})}function cy({label:e,expanded:t,onToggle:n,className:r}){return(0,Y.jsxs)(`button`,{type:`button`,"data-slot":`subtask-toggle`,"aria-expanded":t,"aria-label":`${t?`Collapse`:`Expand`} ${e}`,onClick:n,className:G(`inline-flex shrink-0 items-center gap-0.5 rounded-full bg-muted py-px pr-1.5 pl-1 text-[10.5px] font-medium text-muted-foreground hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,r),children:[(0,Y.jsx)(ya,{className:G(`size-3 transition-transform`,t&&`rotate-90`),"aria-hidden":`true`}),e]})}function ly({className:e,...t}){return(0,Y.jsx)(`div`,{"data-slot":`skeleton`,className:G(`animate-pulse rounded-md bg-accent`,e),...t})}var uy=[{id:`status`,label:`Status`,canFold:!1,defaultExpanded:!0,align:`left`,width:`116px`},{id:`task`,label:`Task`,canFold:!1,defaultExpanded:!0,align:`left`},{id:`workflow`,label:`Workflow`,canFold:!0,defaultExpanded:!0,align:`left`,width:`124px`,icon:`workflow`},{id:`branch`,label:`Branch`,canFold:!0,defaultExpanded:!1,align:`left`,width:`128px`,icon:`branch`},{id:`diff`,label:`±`,canFold:!0,defaultExpanded:!0,align:`left`,width:`78px`,icon:`diff`},{id:`reference`,label:`Ref`,canFold:!0,defaultExpanded:!0,align:`left`,width:`76px`,icon:`reference`},{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:`76px`,icon:`cost`,capability:`cost`},{id:`cpu`,label:`CPU`,canFold:!0,defaultExpanded:!0,align:`right`,width:`68px`,icon:`cpu`},{id:`memory`,label:`Mem`,canFold:!0,defaultExpanded:!0,align:`right`,width:`88px`,icon:`memory`},{id:`started`,label:`Started`,canFold:!0,defaultExpanded:!0,align:`right`,width:`82px`,icon:`started`}],dy=new Map(uy.map(e=>[e.id,e]));function fy(e){return typeof e!=`object`||!e||Array.isArray(e)?{}:Object.fromEntries(Object.entries(e).filter(e=>typeof e[1]==`boolean`))}function py(e){let t={};for(let[n,r]of Object.entries(fy(e))){let e=dy.get(n);e?.canFold&&(t[e.id]=r)}return t}function my(e,t){let n=dy.get(e);return!n||!n.canFold?!0:t[e]??n.defaultExpanded}function hy(e,t){let n=fy(e);return dy.get(t)?.canFold?{...n,[t]:!my(t,py(e))}:n}function gy(e){return uy.filter(t=>t.capability===void 0||e[t.capability])}function _y(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:{}}function vy(){let e=I(),t=It(),n=J.useRef(0),r=J.useRef(0),i=J.useRef(Promise.resolve()),a=J.useMemo(()=>py(t.data?.taskTable?.expandedColumns),[t.data?.taskTable?.expandedColumns]),o=J.useCallback(t=>{if(!uy.find(e=>e.id===t)?.canFold)return;let a=e.getQueryData(z.uiState);if(a===void 0)return;let o=_y(a?.taskTable),c={...o,expandedColumns:hy(o.expandedColumns,t)};e.setQueryData(z.uiState,{...a,taskTable:c});let l=++n.current;r.current=l;let u=i.current.then(async()=>{let t=await s({taskTable:c},{keepalive:!0});l===r.current&&e.setQueryData(z.uiState,t)});i.current=u.catch(t=>{L(t instanceof Error?t.message:String(t),{tone:`danger`}),l===r.current&&e.invalidateQueries({queryKey:z.uiState})})},[e]);return{expandedColumns:a,isExpanded:J.useCallback(e=>my(e,a),[a]),toggleColumn:o,isPending:t.isPending}}function yy({runs:e,view:t,onViewChange:n,onArchiveFinished:r,onMarkAllRead:i,onRename:a,onTogglePin:o,now:s=Date.now(),showTokens:c=!0,showCost:l=!0,expandedColumns:u=py(void 0),onToggleColumn:d=()=>void 0,columnsPending:f=!1,origin:p=`all`,onOriginChange:m=()=>void 0,automationNames:h,gitRepo:g=!0}){let[_,v]=J.useState(``),[y,b]=J.useState(new Set),x=e=>b(t=>{let n=new Set(t);return n.delete(e)||n.add(e),n}),[S,C]=J.useState(cp),w=J.useMemo(()=>e??[],[e]),T=J.useMemo(()=>up(w),[w]),E=fp(w,p,S,T),D=le(E),O=re(it(E,_),t),k=_.trim()!==``,A=yp(O,e=>k||y.has(e)),j=Tt(w),M=fn(it(E,_),t),N=dt(w),P=gy({tokens:c,cost:l}),F=Wr(w),ee=t===`archived`?void 0:o;return(0,Y.jsxs)(`div`,{"data-route":`tasks`,className:`flex min-h-full flex-col`,children:[(0,Y.jsxs)(`header`,{className:`sticky top-0 z-10 hidden h-14 shrink-0 items-center gap-3 border-b border-border bg-background px-5 md:flex`,children:[(0,Y.jsx)(`h1`,{className:`text-base font-semibold`,children:`Tasks`}),(0,Y.jsxs)(`div`,{className:`inline-flex gap-0.5 rounded-md bg-muted p-[3px]`,children:[(0,Y.jsx)(Sy,{view:`active`,current:t,onSelect:n,count:D.active,children:`Active`}),(0,Y.jsx)(Sy,{view:`archived`,current:t,onSelect:n,count:D.archived,children:`Archived`})]}),(0,Y.jsx)(`div`,{className:`flex-1`}),F>0?(0,Y.jsxs)(K,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`mark-all-read`,onClick:i,children:[(0,Y.jsx)(ir,{className:`size-3.5`,"aria-hidden":`true`}),`Mark all read`]}):null,t===`active`&&N>0?(0,Y.jsxs)(K,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`archive-finished`,onClick:r,children:[(0,Y.jsx)(Xr,{className:`size-3.5`,"aria-hidden":`true`}),`Archive finished`]}):null,(0,Y.jsxs)(`div`,{className:`relative w-60`,children:[(0,Y.jsx)(ji,{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,Y.jsx)(`input`,{type:`text`,value:_,onChange:e=>v(e.target.value),placeholder:`Search tasks…`,"aria-label":`Search tasks`,className:`h-9 w-full rounded-md border border-input bg-card pr-3 pl-8 text-[13px] text-foreground outline-none placeholder:text-soft-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50`})]})]}),(0,Y.jsxs)(`div`,{className:`flex flex-1 flex-col p-3 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-5 md:pb-5`,children:[w.length>0?(0,Y.jsx)(xy,{runs:w,view:t,origin:p,onOriginChange:m,filters:S,onFiltersChange:C,automations:T,automationNames:h}):null,e===void 0?null:O.length===0?(0,Y.jsx)(by,{view:t,query:_,filtered:lp(S)>0,onClearFilters:()=>C(cp),origin:p,hiddenByOrigin:p!==`all`&&fp(re(w,t),`all`,S,T).length>0,onShowAll:()=>m(`all`)}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`div`,{"data-slot":`tasks-table`,className:`hidden overflow-x-auto rounded-lg border border-border bg-card shadow-xs md:block`,children:(0,Y.jsx)(ha,{children:(0,Y.jsxs)(`table`,{className:`w-full border-collapse`,children:[(0,Y.jsx)(`colgroup`,{children:P.map(e=>{let t=my(e.id,u);return(0,Y.jsx)(`col`,{"data-column-id":e.id,"data-expanded":t,style:{width:t?e.width:`42px`}},e.id)})}),(0,Y.jsx)(`thead`,{children:(0,Y.jsx)(`tr`,{children:P.map(e=>(0,Y.jsx)(wy,{column:e,expanded:my(e.id,u),onToggle:d,disabled:f},e.id))})}),(0,Y.jsx)(`tbody`,{className:`[&>tr:last-child>td]:border-b-0`,children:A.map(e=>(0,Y.jsx)(Dy,{gitRepo:g,run:e.run,depth:e.depth,childCount:e.childCount,subtasksExpanded:k||y.has(e.run.id),onToggleSubtasks:x,queuePosition:e.run.status===`queued`?j.get(e.run.id)??null:null,onRename:a,onTogglePin:ee,now:s,columns:P,expandedColumns:u},e.run.id))})]})})}),(0,Y.jsx)(`div`,{"data-slot":`task-cards`,className:`flex flex-col gap-2.5 md:hidden`,children:A.map(e=>(0,Y.jsx)(Ny,{run:e.run,depth:e.depth,childCount:e.childCount,subtasksExpanded:k||y.has(e.run.id),onToggleSubtasks:x,queuePosition:e.run.status===`queued`?j.get(e.run.id)??null:null,now:s,showTokens:c,showCost:l,onTogglePin:ee,gitRepo:g},e.run.id))})]}),M.map(e=>(0,Y.jsxs)(`div`,{"data-slot":`compare-strip`,"data-group-id":e.groupId,className:`mt-3.5 flex flex-wrap items-center gap-2.5 rounded-lg border border-border bg-card px-3.5 py-2.5 text-[12.5px] text-muted-foreground shadow-xs`,children:[(0,Y.jsx)(zs,{className:`size-[15px] shrink-0 text-soft-foreground`,"aria-hidden":`true`}),(0,Y.jsxs)(`span`,{children:[(0,Y.jsx)(`strong`,{className:`font-semibold text-foreground`,children:e.title}),` — `,e.count,` variants finished`]}),(0,Y.jsx)(K,{asChild:!0,variant:`outline`,size:`sm`,className:`md:ml-auto`,children:(0,Y.jsx)(V,{to:`/compare/${e.groupId}`,children:`Compare`})})]},e.groupId))]}),(0,Y.jsx)(V,{to:`/new`,"data-slot":`new-task-fab`,"aria-label":`New task`,className:`fixed right-4 bottom-[calc(16px+env(safe-area-inset-bottom))] z-20 inline-flex size-14 items-center justify-center rounded-full bg-primary text-primary-foreground shadow-modal md:hidden`,children:(0,Y.jsx)(Rs,{className:`size-[22px]`,"aria-hidden":`true`})})]})}function by({view:e,query:t,filtered:n=!1,onClearFilters:r=()=>void 0,origin:i=`all`,hiddenByOrigin:a=!1,onShowAll:o=()=>void 0}){let s=t.trim(),c=s?`search-miss`:n?`filtered`:a?`origin-hidden`:e===`archived`?`archive`:`no-tasks`;return(0,Y.jsx)(`div`,{"data-slot":`tasks-empty`,"data-empty-kind":c,className:`flex flex-1 flex-col`,children:c===`filtered`?(0,Y.jsx)(q,{heading:`h2`,icon:(0,Y.jsx)(Ua,{}),tone:`neutral`,title:`No tasks match these filters`,actions:(0,Y.jsx)(K,{type:`button`,variant:`outline`,onClick:r,children:`Clear filters`})}):c===`origin-hidden`?(0,Y.jsx)(q,{heading:`h2`,icon:(0,Y.jsx)(qs,{}),tone:`neutral`,title:i===`regular`?`No regular tasks here`:`No automation tasks here`,subtitle:i===`regular`?`Tasks started by automations are hidden.`:`Only tasks started by automations are shown.`,actions:(0,Y.jsx)(K,{type:`button`,variant:`outline`,onClick:o,children:`Show all tasks`})}):c===`search-miss`?(0,Y.jsx)(q,{heading:`h2`,icon:(0,Y.jsx)(Ua,{}),tone:`neutral`,title:`No matching tasks`,subtitle:`No tasks match “${s}”.`}):c===`archive`?(0,Y.jsx)(q,{heading:`h2`,icon:(0,Y.jsx)(Xr,{}),tone:`neutral`,title:`Nothing archived yet`,subtitle:`Finished tasks you archive land here.`}):(0,Y.jsx)(q,{heading:`h2`,icon:(0,Y.jsx)(Ds,{}),tone:`primary`,backdrop:!0,title:`No tasks yet`,subtitle:`Describe a task to get started.`,actions:(0,Y.jsx)(K,{asChild:!0,children:(0,Y.jsxs)(V,{to:`/new`,children:[(0,Y.jsx)(Rs,{"aria-hidden":`true`}),`New task`]})})})})}function xy({runs:e,view:t,origin:n,onOriginChange:r,filters:i,onFiltersChange:a,automations:o,automationNames:s}){let c=J.useMemo(()=>e.filter(e=>t===`archived`?e.archived:!e.archived),[e,t]),l=hp(c,i,o),u=e=>mp(c,n,i,o,e),d=u(`statuses`),f=u(`workflows`),p=u(`automations`),m=gp(c.map(e=>o.get(e.id))),h=(e,t)=>a(n=>({...n,[e]:n[e].includes(t)?n[e].filter(e=>e!==t):[...n[e],t]})),g=e=>a(t=>({...t,[e]:[]})),_=lp(i);return(0,Y.jsxs)(`div`,{"data-slot":`tasks-filters`,className:`mb-3 flex flex-wrap items-center gap-1.5`,children:[(0,Y.jsx)(Sr,{slot:`task-origin`,label:`Show tasks started by`,value:n,options:Yf.map(e=>({...e,count:l[e.value]})),onChange:r}),(0,Y.jsx)(`span`,{className:`mx-1 h-5 w-px bg-border`,"aria-hidden":`true`}),(0,Y.jsx)(xr,{slot:`status`,label:`Status`,selected:i.statuses,onToggle:e=>h(`statuses`,e),onClear:()=>g(`statuses`),options:gp(c.map(e=>e.status)).map(e=>({value:e,label:e,count:d.get(e)??0})),emptyLabel:`No tasks to filter`}),(0,Y.jsx)(xr,{slot:`workflow`,label:`Workflow`,selected:i.workflows,onToggle:e=>h(`workflows`,e),onClear:()=>g(`workflows`),options:gp(c.map(e=>vn(e))).map(e=>({value:e,label:e,count:f.get(e)??0})),emptyLabel:`No tasks to filter`}),n!==`regular`&&m.length>0?(0,Y.jsx)(xr,{slot:`automation`,label:`Automation`,selected:i.automations,onToggle:e=>h(`automations`,e),onClear:()=>g(`automations`),options:m.map(e=>({value:e,label:s?.get(e)??e,count:p.get(e)??0})),emptyLabel:`No automation tasks`}):null,_>0?(0,Y.jsxs)(`button`,{type:`button`,"data-action":`clear-filters`,onClick:()=>a(()=>cp),className:`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,Y.jsx)(xa,{className:`size-3`,"aria-hidden":`true`}),`Clear (`,_,`)`]}):null]})}function Sy({view:e,current:t,onSelect:n,count:r,children:i}){let a=e===t;return(0,Y.jsxs)(`button`,{type:`button`,"data-slot":`overview-tab`,"data-view":e,"aria-pressed":a,onClick:()=>n(e),className:G(`flex h-7 items-center justify-center gap-1.5 rounded-[7px] px-3 text-[12.5px] font-medium text-muted-foreground`,a&&`bg-card font-semibold text-foreground shadow-xs`),children:[i,r>0?(0,Y.jsx)(`span`,{className:`font-mono text-[11px] tabular-nums`,children:r}):null]})}function Cy({children:e,right:t=!1,columnId:n,folded:r=!1}){return(0,Y.jsx)(`th`,{scope:`col`,"data-column-id":n,"data-folded":r||void 0,className:G(`h-[38px] border-b border-border px-2.5 text-left text-[11px] font-semibold tracking-[0.05em] whitespace-nowrap text-soft-foreground uppercase first:pl-4 last:pr-4`,t&&`text-right`,r&&`px-0 first:pl-0 last:pr-0`),children:e})}function wy({column:e,expanded:t,onToggle:n,disabled:r}){if(!e.canFold)return(0,Y.jsx)(Cy,{columnId:e.id,right:e.align===`right`,children:e.label});let i=t?`Fold`:`Expand`;return(0,Y.jsx)(Cy,{columnId:e.id,right:e.align===`right`,folded:!t,children:(0,Y.jsxs)(_a,{children:[(0,Y.jsx)(ua,{asChild:!0,children:(0,Y.jsx)(`button`,{type:`button`,"aria-label":`${i} ${e.label} column`,"aria-pressed":t,disabled:r,onClick:()=>n(e.id),className:G(`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,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`span`,{children:e.label}),(0,Y.jsx)(as,{className:`size-3 opacity-55`,"aria-hidden":`true`})]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Ty,{icon:e.icon}),(0,Y.jsx)(os,{className:`size-3 opacity-70`,"aria-hidden":`true`})]})})}),(0,Y.jsxs)(fa,{side:`top`,children:[e.label,` · `,i,` column`]})]})})}function Ty({icon:e}){let t=`size-3.5`;switch(e){case`workflow`:return(0,Y.jsx)(qs,{className:t,"aria-hidden":`true`});case`branch`:return(0,Y.jsx)(ka,{className:t,"aria-hidden":`true`});case`diff`:return(0,Y.jsx)(ps,{className:t,"aria-hidden":`true`});case`reference`:return(0,Y.jsx)(Es,{className:t,"aria-hidden":`true`});case`tokens`:return(0,Y.jsx)(cs,{className:t,"aria-hidden":`true`});case`cost`:return(0,Y.jsx)(sr,{className:t,"aria-hidden":`true`});case`cpu`:return(0,Y.jsx)(li,{className:t,"aria-hidden":`true`});case`memory`:return(0,Y.jsx)(ks,{className:t,"aria-hidden":`true`});case`started`:return(0,Y.jsx)(ss,{className:t,"aria-hidden":`true`});default:return null}}var Ey=`h-11 border-b border-border px-2.5 whitespace-nowrap first:pl-4 last:pr-4`;function Dy({gitRepo:e,run:t,depth:n,childCount:r,subtasksExpanded:i,onToggleSubtasks:a,queuePosition:o,onRename:s,onTogglePin:c,now:l,columns:u,expandedColumns:d}){let f=Qe(),p=D(t),m=gn(t),h=`/tasks/${t.id}`,g=Kt(t.costUsd),_=xn(t);return(0,Y.jsx)(`tr`,{"data-slot":`task-table-row`,"data-run-id":t.id,"data-depth":n,onClick:e=>{e.target.closest(`a, button, input`)||f(h)},className:`group/row cursor-pointer hover:bg-muted`,children:u.map(u=>{if(u.id===`memory`)return null;if(u.id===`cpu`){let e=my(`cpu`,d),n=my(`memory`,d);return o!==null&&(e||n)?(0,Y.jsxs)(`td`,{"data-slot":`queue-note`,"data-column-id":`cpu-memory`,colSpan:2,className:G(Ey,`text-right font-mono text-[11.5px] text-soft-foreground`),children:[`#`,o,` in queue`]},u.id):(0,Y.jsx)(jy,{run:t,cpuExpanded:e,memoryExpanded:n},u.id)}return(0,Y.jsx)(Oy,{gitRepo:e,column:u,expanded:my(u.id,d),run:t,depth:n,childCount:r,subtasksExpanded:i,onToggleSubtasks:a,attention:p,scheduled:m,reference:_,cost:g,to:h,onRename:s,onTogglePin:c,now:l},u.id)})})}function Oy({gitRepo:e,column:t,expanded:n,run:r,depth:i,childCount:a,subtasksExpanded:o,onToggleSubtasks:s,attention:c,scheduled:l,reference:u,cost:d,to:f,onRename:p,onTogglePin:m,now:h}){if(!n)return(0,Y.jsx)(ky,{column:t.id});switch(t.id){case`status`:return(0,Y.jsx)(`td`,{"data-column-id":t.id,className:Ey,children:(0,Y.jsxs)(_o,{dot:c.tone,pulse:c.pulse,title:l?.title,children:[c.label,l?(0,Y.jsx)(`span`,{className:`tabular-nums`,children:l.label}):null]})});case`task`:return(0,Y.jsx)(`td`,{"data-column-id":t.id,className:G(Ey,`min-w-[220px] max-w-0`),children:(0,Y.jsx)(Ay,{run:r,depth:i,childCount:a,subtasksExpanded:o,onToggleSubtasks:s,to:f,onRename:p,onTogglePin:m})});case`workflow`:return(0,Y.jsx)(`td`,{"data-column-id":t.id,className:G(Ey,`text-[12.5px] text-muted-foreground`),children:vn(r)});case`branch`:return(0,Y.jsx)(`td`,{"data-column-id":t.id,className:Ey,children:r.branch?(0,Y.jsx)(Iy,{branch:r.branch}):Ly(r,e)?(0,Y.jsx)(Ry,{}):(0,Y.jsx)(Py,{})});case`diff`:return(0,Y.jsx)(`td`,{"data-column-id":t.id,className:Ey,children:r.diffStat?(0,Y.jsx)(mo,{stat:r.diffStat}):(0,Y.jsx)(Py,{})});case`reference`:return(0,Y.jsx)(`td`,{"data-column-id":t.id,className:Ey,children:u?(0,Y.jsx)(Rr,{run:r,reference:u}):(0,Y.jsx)(Py,{})});case`tokens`:return(0,Y.jsx)(`td`,{"data-column-id":t.id,className:G(Ey,`text-right text-xs text-muted-foreground`),children:(0,Y.jsx)(ho,{inputTokens:r.inputTokens,outputTokens:r.outputTokens,variant:`table`,omitWhenUnknown:!1})});case`cost`:return(0,Y.jsx)(`td`,{"data-column-id":t.id,className:G(Ey,`text-right font-mono text-xs text-muted-foreground tabular-nums`),children:d||(0,Y.jsx)(Py,{})});case`started`:return(0,Y.jsx)(`td`,{"data-column-id":t.id,className:G(Ey,`text-right text-xs text-soft-foreground tabular-nums`),children:to(r.startedAt??r.createdAt,h)});case`cpu`:case`memory`:return null}}function ky({column:e}){return(0,Y.jsx)(`td`,{role:`presentation`,"aria-hidden":`true`,"data-column-id":e,"data-folded":`true`,className:G(Ey,`px-0 first:pl-0 last:pr-0`)})}function Ay({run:e,depth:t,childCount:n,subtasksExpanded:r,onToggleSubtasks:i,to:a,onRename:o,onTogglePin:s}){let c=xt(e),l=ci(c,t=>o(e.id,t)),u=Gr(e),d=Lr(e),f=bp(n),p=t>0?{paddingLeft:`${t*14}px`}:void 0;return l.editing?(0,Y.jsx)(`span`,{className:`flex min-w-0 items-center`,style:p,children:(0,Y.jsx)(ii,{editor:l,className:`text-[13px] font-medium`})}):(0,Y.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,style:p,children:[t>0?(0,Y.jsx)(`span`,{"aria-hidden":`true`,"data-slot":`subtask-tick`,className:`shrink-0 font-mono text-[11px] leading-none text-soft-foreground`,children:`└`}):null,(0,Y.jsxs)(V,{to:a,title:c,className:G(`min-w-0 truncate text-[13px]`,u?`font-semibold text-foreground`:d?`font-medium text-muted-foreground`:`font-medium`),children:[c,u?(0,Y.jsx)(qf,{}):null]}),xp(e)?(0,Y.jsx)(`span`,{"data-slot":`dispatch-kind`,className:`shrink-0 rounded-full bg-muted px-1.5 py-px text-[10.5px] font-medium text-muted-foreground`,children:xp(e)}):null,f?(0,Y.jsx)(cy,{label:f,expanded:r,onToggle:()=>i(e.id)}):null,(0,Y.jsx)(`button`,{type:`button`,"data-slot":`row-rename`,"aria-label":`Rename task`,onClick:l.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,Y.jsx)(Ha,{className:`size-3`,"aria-hidden":`true`})}),s?(0,Y.jsx)(Hr,{pinned:!!e.pinned,onToggle:t=>s(e,t),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 jy({run:e,cpuExpanded:t,memoryExpanded:n}){let r=g(e,_r(e.id));return(0,Y.jsxs)(Y.Fragment,{children:[t?(0,Y.jsx)(My,{column:`cpu`,cell:r.cpu}):(0,Y.jsx)(ky,{column:`cpu`}),n?(0,Y.jsx)(My,{column:`memory`,cell:r.mem}):(0,Y.jsx)(ky,{column:`memory`})]})}function My({column:e,cell:t}){return(0,Y.jsx)(`td`,{"data-usage":e===`memory`?`mem`:e,"data-column-id":e,"data-usage-kind":t.kind,title:t.title,className:G(Ey,`text-right font-mono tabular-nums`,t.kind===`live`&&`bg-violet/5 text-xs font-medium text-foreground`,t.kind===`peak`&&`text-[11.5px] text-soft-foreground`,t.kind===`none`&&`text-xs text-soft-foreground`),children:t.text||`—`})}function Ny({run:e,depth:t,childCount:n,subtasksExpanded:r,onToggleSubtasks:i,queuePosition:a,now:o,showTokens:s,showCost:c,onTogglePin:l,gitRepo:u}){let d=Qe(),f=D(e),p=gn(e),m=`/tasks/${e.id}`,h=xn(e),g=Gr(e),_=Lr(e),v=Kt(e.costUsd),y=bp(n),b=e.inputTokens!==void 0||e.outputTokens!==void 0;return(0,Y.jsxs)(`div`,{"data-slot":`task-card`,"data-run-id":e.id,"data-depth":t,style:t>0?{marginLeft:`${t*14}px`}:void 0,onClick:e=>{e.target.closest(`a, button`)||d(m)},className:`cursor-pointer rounded-lg border border-border bg-card px-3.5 py-3 shadow-xs`,children:[(0,Y.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[(0,Y.jsxs)(_o,{dot:f.tone,pulse:f.pulse,className:`mt-px shrink-0`,title:p?.title,children:[f.label,p?(0,Y.jsx)(`span`,{className:`tabular-nums`,children:p.label}):null]}),(0,Y.jsxs)(V,{to:m,className:G(`min-w-0 flex-1 text-[13.5px] leading-[1.35]`,g?`font-semibold text-foreground`:_?`font-medium text-muted-foreground`:`font-medium`),children:[xt(e),g?(0,Y.jsx)(qf,{}):null]}),xp(e)?(0,Y.jsx)(`span`,{"data-slot":`dispatch-kind`,className:`mt-px shrink-0 rounded-full bg-muted px-1.5 py-px text-[10.5px] font-medium text-muted-foreground`,children:xp(e)}):null,y?(0,Y.jsx)(cy,{label:y,expanded:r,onToggle:()=>i(e.id),className:`mt-px`}):null,(0,Y.jsx)(`span`,{className:`mt-0.5 shrink-0 text-[11.5px] text-soft-foreground tabular-nums`,children:to(e.finishedAt??e.createdAt,o)}),l?(0,Y.jsx)(Hr,{pinned:!!e.pinned,onToggle:t=>l(e,t),className:`-mr-1 mt-px`}):null]}),(0,Y.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-1.5 font-mono text-[11.5px] font-medium text-muted-foreground tabular-nums`,children:[(0,Y.jsx)(`span`,{children:vn(e)}),a===null?(0,Y.jsxs)(Y.Fragment,{children:[e.branch?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Fy,{}),(0,Y.jsx)(`span`,{children:e.branch})]}):Ly(e,u)?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Fy,{}),(0,Y.jsx)(Ry,{})]}):null,e.diffStat?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Fy,{}),(0,Y.jsx)(mo,{stat:e.diffStat,className:`text-[11.5px]`})]}):null,s&&b?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Fy,{}),(0,Y.jsx)(ho,{inputTokens:e.inputTokens,outputTokens:e.outputTokens})]}):null,c&&v?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Fy,{}),(0,Y.jsx)(`span`,{children:v})]}):null]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Fy,{}),(0,Y.jsxs)(`span`,{"data-slot":`queue-note`,children:[`#`,a,` in queue`]})]}),h?(0,Y.jsx)(Rr,{run:e,reference:h,className:`h-5`}):null]})]})}function Py(){return(0,Y.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`—`})}function Fy(){return(0,Y.jsx)(`span`,{className:`text-soft-foreground`,"aria-hidden":`true`,children:`·`})}function Iy({branch:e}){return(0,Y.jsx)(`span`,{className:`rounded-[6px] bg-muted px-1.5 py-0.5 font-mono text-[11.5px] font-medium text-muted-foreground`,children:e})}function Ly(e,t){return t&&e.status===`running`&&!e.branch&&e.worktree!==!1}function Ry(){return(0,Y.jsx)(ly,{"data-slot":`branch-skeleton`,role:`status`,"aria-label":`naming branch`,className:`inline-block h-4 w-24 align-middle`})}function zy(){let e=St(),t=no(Te().data),n=Pt(),r=!n.data||n.data.info!==null,[i,a]=Sf(),o=I(),s=B({mutationFn:N,onSuccess:()=>o.invalidateQueries({queryKey:R.runs.all})}),c=B({mutationFn:b,onSuccess:()=>o.invalidateQueries({queryKey:R.runs.all}),onError:e=>L(e.message,{tone:`danger`})}),l=B({mutationFn:({id:e,title:t})=>Ce(e,{title:t}),onSuccess:e=>{Ke(o,e),o.invalidateQueries({queryKey:R.runs.all})},onError:e=>L(e.message,{tone:`danger`})}),u=Me(),d=fo(3e4),f=vy(),[p,m]=sp(),h=gr(),g=J.useMemo(()=>(e.data??[]).some(e=>e.automation??e.automationTrigger??e.automationTracker),[e.data]),_=lr(h.known&&!h.off&&g&&p!==`regular`),v=J.useMemo(()=>new Map((_.data?.automations??[]).map(e=>[e.id,e.name])),[_.data]),y=qe();return(0,Y.jsx)(bi,{projectId:y,requests:J.useMemo(()=>y===void 0?[]:(e.data??[]).flatMap(e=>ge(e).map(e=>({projectId:y,kind:e.kind,number:e.number}))),[e.data,y]),children:(0,Y.jsx)(yy,{runs:e.data,view:i,onViewChange:a,onArchiveFinished:()=>s.mutate(),onMarkAllRead:()=>c.mutate(),onRename:(e,t)=>l.mutate({id:e,title:t}),onTogglePin:(e,t)=>u.mutate({id:e.id,pinned:t},{onError:e=>L(e.message,{tone:`danger`})}),now:d,showTokens:t.tokens,showCost:t.cost,expandedColumns:f.expandedColumns,onToggleColumn:f.toggleColumn,columnsPending:f.isPending,origin:p,onOriginChange:m,gitRepo:r,automationNames:v})})}var By=` untagged`,Vy=[{value:`project`,label:`Project`},{value:`tag`,label:`Tag`},{value:`status`,label:`Status`},{value:`workflow`,label:`Workflow`}];function Hy(e,t){return e===t?`none`:t}var Uy={query:``,tags:[],statuses:[],workflows:[]};function Wy(e,t){return e.includes(t)?e.filter(e=>e!==t):[...e,t]}function Gy(e){return e.tags.length+e.statuses.length+e.workflows.length}function Ky(e){return e.query.trim()!==``||Gy(e)>0}function qy(e){return Gy(e.filters)+(e.filters.query.trim()===``?0:1)+(e.groupBy===`none`?0:1)}function Jy(e){return qy(e)>0}function Yy(e,t){let n=new Map(t.map(e=>[e.id,e]));return e.map(e=>{let t=n.get(e.projectId);return{run:e,project:t,projectName:t?.name||e.projectId,tags:t?.tags??[]}})}var Xy=e=>`${e.projectId}/${e.id}`;function Zy(e){let t=new Map(e.map(e=>[Xy(e.run),e.run]));return new Map(e.map(e=>[Xy(e.run),Qf(e.run,n=>t.get(`${e.run.projectId}/${n}`))]))}function Qy(e,t,n){return e.filter(e=>$f(n.get(Xy(e.run)),t))}function $y(e){let t=new Set;for(let n of e)t.add(n.run.workflow);return[...t].sort((e,t)=>e.localeCompare(t))}function eb(e){let t=new Set;for(let n of e)t.add(n.run.status);return[...t].sort((e,t)=>e.localeCompare(t))}function tb(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 nb=e=>e.tags.length===0?[By]:e.tags,rb=(e,t)=>e.length===0||t.some(t=>e.includes(t)),ib=(e,t)=>{if(t.length===0)return!0;let n=nb(e).map(e=>e.toLowerCase());return t.some(e=>n.includes(e.toLowerCase()))};function ab(e){return[xt(e.run),e.projectName,e.run.workflow,e.run.branch??``,...e.tags].join(`
|
|
21
|
+
`).toLowerCase()}function ob(e,t,n){let r=t.query.trim().toLowerCase().split(/\s+/).filter(Boolean);return e.filter(e=>{if((n===`archived`?!e.run.archived:e.run.archived)||!rb(t.statuses,[e.run.status])||!rb(t.workflows,[e.run.workflow])||!ib(e,t.tags))return!1;if(r.length===0)return!0;let i=ab(e);return r.every(e=>i.includes(e))})}function sb(e,t,n,r){return ob(e,{...t,[r]:[]},n)}function cb(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,n.run.status,n);else if(t===`workflow`)r(n.run.workflow,n.run.workflow,n);else if(n.tags.length===0)r(By,`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 lb(e,t){let n=new Map(t.map(e=>[e.id,e.name]));return e.map(e=>n.get(e)||e)}var ub={query:`q`,tag:`tag`,untagged:`untagged`,status:`status`,workflow:`workflow`,groupBy:`group`,archived:`archived`},db=new Set(Vy.map(e=>e.value));function fb(e){let t=new URLSearchParams,n=e.filters.query.trim();n!==``&&t.set(ub.query,n);for(let n of e.filters.tags)n===` untagged`?t.set(ub.untagged,`1`):t.append(ub.tag,n);for(let n of e.filters.statuses)t.append(ub.status,n);for(let n of e.filters.workflows)t.append(ub.workflow,n);return e.groupBy!==`none`&&t.set(ub.groupBy,e.groupBy),e.view===`archived`&&t.set(ub.archived,`1`),t}function pb(e){let t=e.getAll(ub.tag).filter(e=>e!==``);e.get(ub.untagged)===`1`&&t.push(By);let n=e.get(ub.groupBy)??``;return{filters:{query:e.get(ub.query)??``,tags:t,statuses:e.getAll(ub.status).filter(e=>e!==``),workflows:e.getAll(ub.workflow).filter(e=>e!==``)},groupBy:db.has(n)?n:`none`,view:e.get(ub.archived)===`1`?`archived`:`active`}}var mb=15e3,hb=250,gb=1,_b=new Set([`done`,`failed`,`cancelled`]);function vb(){return bb({request:({task:e,archived:t})=>Xt(e.run.projectId,e.run.id,t),patch:({archived:e})=>t=>({...t,archived:e})})}function yb(){return bb({request:({task:e,read:t})=>wn(e.run.projectId,e.run.id,t),patch:({read:e})=>t=>{if(e)return{...t,seenAt:new Date().toISOString()};let{seenAt:n,...r}=t;return r}})}function bb({request:e,patch:t}){let n=I();return B({mutationFn:e,onMutate:async e=>{await n.cancelQueries({queryKey:z.runsIndex});let r=n.getQueryData(z.runsIndex),i=t(e),{task:a}=e;return n.setQueryData(z.runsIndex,e=>e===void 0?e:{...e,runs:e.runs.map(e=>e.projectId===a.run.projectId&&e.id===a.run.id?i(e):e)}),{previous:r}},onError:(e,t,r)=>{r?.previous&&n.setQueryData(z.runsIndex,r.previous),L(e.message,{tone:`danger`})},onSettled:(e,t,{task:r})=>{n.invalidateQueries({queryKey:z.runsIndex}),n.invalidateQueries({queryKey:R.runs.all}),n.invalidateQueries({queryKey:[r.run.projectId,`runs`,`list`]})}})}function xb(){let e=ln(),t=no(Te().data),n=se(!0,mb),[r,i]=ot(),{filters:a,groupBy:o,view:s}=J.useMemo(()=>pb(r),[r]),[c,l]=Sf();J.useEffect(()=>{c!==s&&l(s)},[s,c,l]);let u=fo(3e4),d=e=>i(t=>fb(e(pb(t))),{replace:!0}),f=e=>d(t=>({...t,filters:e(t.filters)})),p=e=>d(t=>({...t,groupBy:e})),m=e=>d(t=>({...t,view:e})),[h,g]=J.useState(a.query),[_,v]=J.useState(new Set),y=e=>v(t=>{let n=new Set(t);return n.delete(e)||n.add(e),n}),b=a.query.trim()!==``,x=e=>b||_.has(e),S=J.useRef(a.query);J.useEffect(()=>{a.query!==S.current&&g(a.query),S.current=a.query},[a.query]),J.useEffect(()=>{if(h===S.current)return;let e=setTimeout(()=>{S.current=h,f(e=>({...e,query:h}))},hb);return()=>clearTimeout(e)},[h]);let C=n.data?.referenceStatuses;J.useEffect(()=>{C&&pt(C)},[C]);let w=J.useMemo(()=>e.data?.projects??[],[e.data]),T=J.useMemo(()=>Yy(n.data?.runs??[],w),[n.data,w]),[E,D]=sp(),O=J.useMemo(()=>Zy(T),[T]),k=J.useMemo(()=>Qy(T,E,O),[T,E,O]),A=J.useMemo(()=>{let e=e=>ob(Qy(T,e,O),a,s).length;return{regular:e(`regular`),automation:e(`automation`),all:e(`all`)}},[T,O,a,s]),j=J.useMemo(()=>ob(k,a,s),[k,a,s]),M=J.useMemo(()=>cb(j,o),[j,o]),N=J.useMemo(()=>j.flatMap(e=>ge(e.run,e.project?.repoUrl).map(t=>({projectId:e.run.projectId,kind:t.kind,number:t.number}))),[j]),P=lb(n.data?.truncated??[],w),F=(e,t)=>f(n=>({...n,[e]:Wy(n[e],t)})),ee=e=>f(t=>({...t,[e]:[]})),te=vb(),ne=yb();if(n.isError||e.isError)return(0,Y.jsx)(`div`,{"data-route":`global-tasks`,className:`flex min-h-full flex-col`,children:(0,Y.jsx)(q,{icon:(0,Y.jsx)(Ts,{}),tone:`danger`,title:`Tasks across projects did not load`,subtitle:(n.error??e.error)?.message})});let re=(0,Y.jsxs)(`div`,{className:`relative w-full md:w-60`,children:[(0,Y.jsx)(ji,{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,Y.jsx)(`input`,{type:`text`,value:h,onChange:e=>g(e.target.value),placeholder:`Search every project…`,"aria-label":`Search tasks across projects`,className:`h-9 w-full rounded-md border border-input bg-card pr-3 pl-8 text-[13px] text-foreground outline-none placeholder:text-soft-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50`})]});return(0,Y.jsxs)(`div`,{"data-route":`global-tasks`,className:`flex min-h-full flex-col`,children:[(0,Y.jsxs)(`header`,{className:`sticky top-0 z-10 hidden h-14 shrink-0 items-center gap-3 border-b border-border bg-background px-5 md:flex`,children:[(0,Y.jsx)(`h1`,{className:`text-base font-semibold`,children:`All tasks`}),(0,Y.jsxs)(`div`,{className:`inline-flex gap-0.5 rounded-md bg-muted p-[3px]`,children:[(0,Y.jsx)(Sb,{view:`active`,current:s,onSelect:m,children:`Active`}),(0,Y.jsx)(Sb,{view:`archived`,current:s,onSelect:m,children:`Archived`})]}),(0,Y.jsx)(`div`,{className:`flex-1`}),(0,Y.jsxs)(`span`,{"data-slot":`global-tasks-count`,className:`text-[12.5px] text-soft-foreground tabular-nums`,children:[j.length,` of `,T.length]}),re]}),(0,Y.jsxs)(`div`,{className:`flex flex-1 flex-col gap-3 p-3 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-5 md:pb-5`,children:[(0,Y.jsx)(`div`,{className:`md:hidden`,children:re}),(0,Y.jsx)(Cb,{filters:a,onToggle:F,onClearFacet:ee,onClearAll:()=>{g(``),d(e=>({...e,filters:Uy,groupBy:`none`}))},groupBy:o,onGroupByChange:p,projects:w,tasks:k,view:s,origin:E,onOriginChange:D,originCounts:A}),P.length>0?(0,Y.jsxs)(`p`,{"data-slot":`global-tasks-truncated`,className:`text-[11.5px] text-soft-foreground`,children:[`Showing the newest `,n.data?.perProjectLimit,` tasks per project — older ones in`,` `,P.join(`, `),` are only in that project’s own Tasks page.`]}):null,n.data===void 0?null:j.length===0?(0,Y.jsx)(Fb,{view:s,filtered:Ky(a),origin:E,hiddenByOrigin:E!==`all`&&A.all>0,onShowAll:()=>D(`all`)}):(0,Y.jsx)(bi,{requests:N,children:M.map(e=>(0,Y.jsxs)(`section`,{"data-slot":`task-group`,"data-group-key":e.key,children:[o===`none`?null:(0,Y.jsxs)(`h2`,{className:`mb-1.5 flex items-center gap-2 text-[12px] font-semibold tracking-[0.04em] text-soft-foreground uppercase`,children:[o===`project`?(0,Y.jsx)(ke,{to:We(e.key,`/`),"data-slot":`group-project-link`,className:`hover:text-foreground hover:underline`,children:e.label}):e.label,(0,Y.jsx)(`span`,{className:`font-mono text-[11px] font-medium tabular-nums`,children:e.tasks.length})]}),(0,Y.jsx)(Tb,{tasks:e.tasks,now:u,isSubtasksExpanded:x,onToggleSubtasks:y,showProject:o!==`project`,onArchive:(e,t)=>te.mutate({task:e,archived:t}),onSetRead:(e,t)=>ne.mutate({task:e,read:t}),busy:te.isPending||ne.isPending,showCost:t.cost})]},e.key))})]})]})}function Sb({view:e,current:t,onSelect:n,children:r}){let i=e===t;return(0,Y.jsx)(`button`,{type:`button`,"data-slot":`overview-tab`,"data-view":e,"aria-pressed":i,onClick:()=>n(e),className:G(`flex h-7 items-center justify-center rounded-[7px] px-3 text-[12.5px] font-medium text-muted-foreground`,i&&`bg-card font-semibold text-foreground shadow-xs`),children:r})}function Cb({filters:e,onToggle:t,onClearFacet:n,onClearAll:r,groupBy:i,onGroupByChange:a,projects:o,tasks:s,view:c,origin:l,onOriginChange:u,originCounts:d}){let f=J.useMemo(()=>an(o),[o]),p=J.useMemo(()=>{let t=(t,n)=>tb(sb(s,e,c,t),n);return{tags:t(`tags`,nb),statuses:t(`statuses`,e=>[e.run.status]),workflows:t(`workflows`,e=>[e.run.workflow])}},[s,e,c]),m=e=>t=>({...t,count:e.get(t.value)??0});return(0,Y.jsxs)(`div`,{"data-slot":`global-tasks-filters`,className:`flex flex-col gap-2 rounded-lg border border-border bg-card p-2.5 shadow-xs`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,Y.jsx)(Sr,{slot:`task-origin`,label:`Show tasks started by`,value:l,options:Yf.map(e=>({...e,count:d[e.value]})),onChange:u}),(0,Y.jsx)(`span`,{className:`mx-1 h-5 w-px bg-border`,"aria-hidden":`true`}),(0,Y.jsx)(xr,{slot:`status`,label:`Status`,selected:e.statuses,onToggle:e=>t(`statuses`,e),onClear:()=>n(`statuses`),options:eb(s).map(e=>({value:e,label:e})).map(m(p.statuses)),emptyLabel:`No tasks to filter`}),(0,Y.jsx)(xr,{slot:`workflow`,label:`Workflow`,selected:e.workflows,onToggle:e=>t(`workflows`,e),onClear:()=>n(`workflows`),options:$y(s).map(e=>({value:e,label:e})).map(m(p.workflows)),emptyLabel:`No tasks to filter`}),(0,Y.jsx)(`span`,{className:`mx-1 h-5 w-px bg-border`,"aria-hidden":`true`}),(0,Y.jsx)(`span`,{className:`text-[11px] font-medium text-soft-foreground`,children:`Group by`}),(0,Y.jsx)(dr,{slot:`group-by`,label:`Group tasks by`,value:i,options:Vy,onChange:e=>a(Hy(i,e))}),Jy({filters:e,groupBy:i})?(0,Y.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,Y.jsx)(xa,{className:`size-3`,"aria-hidden":`true`}),`Clear`,` (${qy({filters:e,groupBy:i})})`]}):null]}),f.length>0?(0,Y.jsxs)(`div`,{"data-slot":`tag-filters`,className:`flex flex-wrap items-center gap-1.5`,children:[(0,Y.jsx)(`span`,{className:`text-[11px] font-medium text-soft-foreground`,children:`Tags`}),f.map(n=>(0,Y.jsx)(vr,{slot:`tag-filter`,tone:`tag`,label:n,count:p.tags.get(n)??0,selected:e.tags.some(e=>e.toLowerCase()===n.toLowerCase()),onToggle:()=>t(`tags`,n)},n)),(0,Y.jsx)(vr,{slot:`tag-filter`,label:`Untagged`,count:p.tags.get(` untagged`)??0,selected:e.tags.includes(By),onToggle:()=>t(`tags`,By)})]}):(0,Y.jsxs)(`p`,{"data-slot":`no-tags-hint`,className:`text-[11px] text-soft-foreground`,children:[`Tag connected repositories in`,` `,(0,Y.jsx)(ke,{to:`/settings/global/projects`,className:`font-medium text-violet hover:underline`,children:`Settings → Projects`}),` `,`to group their tasks together here.`]})]})}var wb=e=>e.dispatch;function Tb({tasks:e,now:t,isSubtasksExpanded:n,onToggleSubtasks:r,showProject:i,onArchive:a,onSetRead:o,busy:s,showCost:c}){return(0,Y.jsx)(`div`,{"data-slot":`global-tasks-table`,className:`overflow-x-auto rounded-lg border border-border bg-card shadow-xs`,children:(0,Y.jsx)(ha,{children:(0,Y.jsxs)(`table`,{className:`w-full border-collapse`,children:[(0,Y.jsx)(`thead`,{children:(0,Y.jsxs)(`tr`,{children:[(0,Y.jsx)(Eb,{className:`w-[104px]`,children:`Status`}),(0,Y.jsx)(Eb,{children:`Task`}),i?(0,Y.jsx)(Eb,{className:`w-[124px]`,children:`Project`}):null,(0,Y.jsx)(Eb,{className:`hidden w-[120px] xl:table-cell`,children:`Tags`}),(0,Y.jsx)(Eb,{className:`w-[84px]`,children:`Ref`}),(0,Y.jsx)(Eb,{className:`hidden w-[108px] xl:table-cell`,children:`Workflow`}),c?(0,Y.jsx)(Eb,{className:`hidden w-[64px] text-right lg:table-cell`,children:`Cost`}):null,(0,Y.jsx)(Eb,{className:`hidden w-[56px] text-right xl:table-cell`,children:`CPU`}),(0,Y.jsx)(Eb,{className:`hidden w-[84px] text-right xl:table-cell`,children:`Mem`}),(0,Y.jsx)(Eb,{className:`w-[56px] text-right`,children:`Age`}),(0,Y.jsx)(Eb,{className:`w-[64px] text-right`,children:(0,Y.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]})}),(0,Y.jsx)(`tbody`,{className:`[&>tr:last-child>td]:border-b-0`,children:yp(e.map(e=>({id:e.run.id,dispatch:wb(e.run),task:e})),n).map(e=>(0,Y.jsx)(Ob,{task:e.run.task,depth:e.depth,childCount:e.childCount,subtasksExpanded:n(e.run.id),onToggleSubtasks:r,now:t,showProject:i,onArchive:a,onSetRead:o,busy:s,showCost:c},`${e.run.task.run.projectId}/${e.run.task.run.id}`))})]})})})}function Eb({children:e,className:t}){return(0,Y.jsx)(`th`,{scope:`col`,className:G(`h-[38px] border-b border-border px-2.5 text-left text-[11px] font-semibold tracking-[0.05em] whitespace-nowrap text-soft-foreground uppercase first:pl-4 last:pr-4`,t),children:e})}var Db=`h-11 border-b border-border px-2.5 whitespace-nowrap first:pl-4 last:pr-4`;function Ob({task:e,depth:t,childCount:n,subtasksExpanded:r,onToggleSubtasks:i,now:a,showProject:o,onArchive:s,onSetRead:c,busy:l,showCost:u}){let{run:d}=e,f=D(d),p=We(d.projectId,`/tasks/${d.id}`),m=Gr(d),h=Lr(d),_=ge(d,e.project?.repoUrl),v=bp(n),y=g(d,d.usage);return(0,Y.jsxs)(`tr`,{"data-slot":`global-task-row`,"data-run-id":d.id,"data-project":d.projectId,"data-depth":t,className:`hover:bg-muted`,children:[(0,Y.jsx)(`td`,{className:Db,children:(0,Y.jsx)(_o,{dot:f.tone,pulse:f.pulse,children:f.label})}),(0,Y.jsx)(`td`,{className:G(Db,`min-w-[320px] max-w-0`),children:(0,Y.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,style:t>0?{paddingLeft:`${t*14}px`}:void 0,children:[t>0?(0,Y.jsx)(`span`,{"aria-hidden":`true`,"data-slot":`subtask-tick`,className:`shrink-0 font-mono text-[11px] leading-none text-soft-foreground`,children:`└`}):null,(0,Y.jsxs)(ke,{to:p,title:xt(d),className:G(`min-w-0 truncate text-[13px]`,m?`font-semibold text-foreground`:h?`font-medium text-muted-foreground`:`font-medium`),children:[xt(d),m?(0,Y.jsx)(qf,{}):null]}),xp(d)?(0,Y.jsx)(`span`,{"data-slot":`dispatch-kind`,className:`shrink-0 rounded-full bg-muted px-1.5 py-px text-[10.5px] font-medium text-muted-foreground`,children:xp(d)}):null,v?(0,Y.jsx)(cy,{label:v,expanded:r,onToggle:()=>i(d.id)}):null]})}),o?(0,Y.jsx)(`td`,{className:G(Db,`text-[12.5px] text-muted-foreground`),children:(0,Y.jsx)(ke,{to:We(d.projectId,`/`),className:`truncate hover:text-foreground`,children:e.projectName})}):null,(0,Y.jsx)(`td`,{className:G(Db,`hidden xl:table-cell`),children:e.tags.length>0?(0,Y.jsx)(`span`,{className:`flex flex-wrap items-center gap-1`,children:e.tags.map(e=>(0,Y.jsx)(Mb,{tag:e},e))}):(0,Y.jsx)(Pb,{})}),(0,Y.jsx)(`td`,{className:Db,children:_.length>0?(0,Y.jsx)(jb,{references:_,run:d}):(0,Y.jsx)(Pb,{})}),(0,Y.jsx)(`td`,{className:G(Db,`hidden text-[12.5px] text-muted-foreground xl:table-cell`),children:d.workflow}),u?(0,Y.jsx)(`td`,{className:G(Db,`hidden text-right font-mono text-xs text-muted-foreground tabular-nums lg:table-cell`),children:Kt(d.costUsd)||(0,Y.jsx)(Pb,{})}):null,(0,Y.jsx)(Nb,{column:`cpu`,cell:y.cpu}),(0,Y.jsx)(Nb,{column:`memory`,cell:y.mem}),(0,Y.jsx)(`td`,{className:G(Db,`text-right text-xs text-soft-foreground tabular-nums`),children:to(d.startedAt??d.createdAt,a)}),(0,Y.jsx)(`td`,{className:G(Db,`text-right`),children:(0,Y.jsxs)(`span`,{className:`inline-flex items-center gap-0.5`,children:[(0,Y.jsx)(kb,{task:e,busy:l,onSetRead:c}),(0,Y.jsx)(Ab,{task:e,busy:l,onArchive:s})]})})]})}function kb({task:e,busy:t,onSetRead:n}){if(!si(e.run))return null;let r=Gr(e.run),i=xt(e.run),a=r?`Mark ${i} read`:`Mark ${i} unread`,o=r?Ta:ds;return(0,Y.jsxs)(_a,{children:[(0,Y.jsx)(ua,{asChild:!0,children:(0,Y.jsx)(`button`,{type:`button`,"data-action":r?`mark-read`:`mark-unread`,"aria-label":a,disabled:t,onClick:()=>n(e,r),className:G(`inline-flex size-7 items-center justify-center rounded-md transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none disabled:cursor-wait disabled:opacity-50`,r?`text-violet`:`text-soft-foreground`),children:(0,Y.jsx)(o,{className:`size-3.5`,"aria-hidden":`true`})})}),(0,Y.jsx)(fa,{side:`left`,children:r?`Mark read`:`Mark unread`})]})}function Ab({task:e,busy:t,onArchive:n}){let r=e.run.archived;if(!r&&!_b.has(e.run.status))return null;let i=r?`Restore ${xt(e.run)} to the active list`:`Archive ${xt(e.run)}`;return(0,Y.jsxs)(_a,{children:[(0,Y.jsx)(ua,{asChild:!0,children:(0,Y.jsx)(`button`,{type:`button`,"data-action":r?`unarchive-run`:`archive-run`,"aria-label":i,disabled:t,onClick:()=>n(e,!r),className:`inline-flex size-7 items-center justify-center rounded-md text-soft-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none disabled:cursor-wait disabled:opacity-50`,children:(0,Y.jsx)(r?$o:Xr,{className:`size-3.5`,"aria-hidden":`true`})})}),(0,Y.jsx)(fa,{side:`left`,children:r?`Restore`:`Archive`})]})}function jb({references:e,run:t}){let n=e.slice(0,gb),r=e.length-n.length,i=xt(t);return(0,Y.jsxs)(`span`,{className:`flex flex-nowrap items-center gap-1`,children:[n.map(e=>(0,Y.jsx)(Ai,{reference:e,taskTitle:i,projectId:t.projectId,conflictAction:(0,Y.jsx)(Ir,{projectId:t.projectId,runId:t.id,prNumber:e.number}),className:`shrink-0`},`${e.kind}#${e.number}`)),r>0?(0,Y.jsx)(ui,{references:e,taskTitle:i,hidden:r,projectId:t.projectId}):null]})}function Mb({tag:e,className:t}){return(0,Y.jsx)(`span`,{"data-slot":`project-tag`,className:G(`inline-flex max-w-full items-center truncate rounded-full bg-muted px-1.5 py-px text-[10.5px] font-medium text-muted-foreground`,t),children:e})}function Nb({column:e,cell:t}){return(0,Y.jsx)(`td`,{"data-usage":e===`memory`?`mem`:e,"data-usage-kind":t.kind,title:t.title,className:G(Db,`hidden text-right font-mono tabular-nums xl:table-cell`,t.kind===`live`&&`bg-violet/5 text-xs font-medium text-foreground`,t.kind===`peak`&&`text-[11.5px] text-soft-foreground`,t.kind===`none`&&`text-xs text-soft-foreground`),children:t.text||`—`})}function Pb(){return(0,Y.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`—`})}function Fb({view:e,filtered:t,origin:n=`all`,hiddenByOrigin:r=!1,onShowAll:i=()=>void 0}){return r?(0,Y.jsx)(`div`,{"data-slot":`global-tasks-empty`,"data-empty-kind":`origin-hidden`,children:(0,Y.jsx)(q,{heading:`h2`,icon:(0,Y.jsx)(Ts,{}),tone:`neutral`,title:n===`regular`?`No regular tasks here`:`No automation tasks here`,subtitle:n===`regular`?`Tasks started by automations are hidden.`:`Only tasks started by automations are shown.`,actions:(0,Y.jsx)(K,{type:`button`,variant:`outline`,onClick:i,children:`Show all tasks`})})}):t?(0,Y.jsx)(q,{heading:`h2`,icon:(0,Y.jsx)(Ua,{}),tone:`neutral`,title:`No matching tasks`,subtitle:`No task in any project matches these filters.`}):e===`archived`?(0,Y.jsx)(q,{heading:`h2`,icon:(0,Y.jsx)(Xr,{}),tone:`neutral`,title:`Nothing archived yet`,subtitle:`Finished tasks you archive land here, from every project.`}):(0,Y.jsx)(q,{heading:`h2`,icon:(0,Y.jsx)(Ds,{}),tone:`neutral`,title:`No tasks yet`,subtitle:`Start a task in any project and it shows up here.`})}var Ib=zr(`dashboard`,()=>tr(()=>import(`./dashboard-BCNe_6p7.js`).then(e=>({default:e.DashboardRoute})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17]))),Lb=zr(`task-thread`,()=>tr(()=>import(`./task-thread-eEkjTDxr.js`).then(e=>({default:e.TaskThreadRoute})),__vite__mapDeps([18,1,2,3,4,5,7,8,19,9,10,11,12,20,21,22,13,23,24,14,16,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49]))),Rb=zr(`compare`,()=>tr(()=>import(`./compare-variants-CQskdfDW.js`).then(e=>({default:e.CompareVariantsRoute})),__vite__mapDeps([50,1,2,3,4,5,13,16,27,39,33,34,12,35,40,41,42,45]))),zb=zr(`task-changes`,()=>tr(()=>import(`./task-changes-D-aajoMU.js`).then(e=>({default:e.TaskChangesRoute})),__vite__mapDeps([51,1,2,3,4,5,19,9,10,8,11,12,20,21,25,13,26,27,23,28,29,30,31,32,33,34,35,36,52,53,49,44,54,16,47,46,22,24,14,48]))),Bb=zr(`task-files`,()=>tr(()=>import(`./task-files-BfIOz-eN.js`).then(e=>({default:e.TaskFilesRoute})),__vite__mapDeps([55,1,2,3,4,5,16,25,19,9,10,8,11,12,20,21,13,26,27,23,28,29,30,31,32,33,34,35,36,56,40,41,42,47]))),Vb=zr(`task-commits`,()=>tr(()=>import(`./task-commits-BYD1GVkS.js`).then(e=>({default:e.TaskCommitsRoute})),__vite__mapDeps([57,1,2,3,4,5,19,9,10,8,11,12,20,21,58,25,13,26,27,23,28,29,30,31,32,33,34,35,36,39,49,44,59,43]))),Hb=(0,J.lazy)(()=>tr(()=>import(`./task-notes-CfkTBgo8.js`).then(e=>({default:e.TaskNotesRoute})),__vite__mapDeps([60,2,1,3,4,5,25,19,9,10,8,11,12,20,21,13,26,27,23,28,29,30,31,32,33,34,35,36,40,41,42]))),Ub=zr(`repo-git`,()=>tr(()=>import(`./repo-git-CgxxZ7cO.js`).then(e=>({default:e.RepoGitRoute})),__vite__mapDeps([61,1,2,3,4,5,58,13,16,21,10,56,11,27,40,34,41,42,47,29,39,28,30,31,32,52,53,49,44,36,54,59,43]))),Wb=zr(`github`,()=>tr(()=>import(`./github-G5fU4gJd.js`).then(e=>({default:e.GithubRoute})),__vite__mapDeps([62,1,2,3,4,5,6,7,8,9,10,11,12,13,14,19,20,21,58,22,23,24,63,16,27,53,30,64,40,34,41,42,43,65,49,32,44,36]))),Gb=zr(`tracker`,()=>tr(()=>import(`./tracker-2DfMzsIE.js`).then(e=>({default:e.TrackerRoute})),__vite__mapDeps([66,1,2,3,4,5,19,9,10,8,11,12,20,21,58,13,27,23,30,64,14,40,34,41,42,65,22,24]))),Kb=zr(`task-graph`,()=>tr(()=>import(`./task-graph-B5-5_IPh.js`).then(e=>({default:e.TaskGraphRoute})),__vite__mapDeps([67,1,2,3,4,5,20,25,19,9,10,8,11,12,21,13,26,27,23,28,29,30,31,32,33,34,35,36,68,17,69,53,24,64,70]))),qb=zr(`workflow-graph`,()=>tr(()=>import(`./workflow-graph-HopaWPea.js`).then(e=>({default:e.WorkflowGraphRoute})),__vite__mapDeps([68,1,2,3,4,5,20,8,17,29,69,11,27,53,24,64,31,34,70]))),Jb=zr(`skills`,()=>tr(()=>import(`./skills-SIMzpL0l.js`).then(e=>({default:e.SkillsRoute})),__vite__mapDeps([71,1,2,3,4,5,19,9,10,8,11,12,20,21,58,22,13,23,24,14,27,30]))),Yb=zr(`automations`,()=>tr(()=>import(`./automations-route-DJjhwqug.js`).then(e=>({default:e.AutomationsRoute})),__vite__mapDeps([72,1,2,3,4,5,6,7,8,9,10,11,12,13,14,19,20,21,58,22,23,24,15,63,16,26,37,69,27,33,34,35])));function Xb(){let e=Re();return new URLSearchParams(e.search).get(`skill`)===`__bm`?(0,Y.jsx)(Zt,{to:{pathname:`/settings/bookmarklets`,hash:e.hash},replace:!0}):(0,Y.jsx)(Zt,{to:{pathname:`/skills`,search:e.search,hash:e.hash},replace:!0})}function Zb({sectionId:e}){let t=Re();return(0,Y.jsx)(M,{to:{pathname:ty(`global`,e),search:t.search,hash:t.hash},replace:!0})}function Qb(){return(0,Y.jsx)(`div`,{"data-route":`scope-resolving`,className:`flex min-h-full flex-col`,children:(0,Y.jsx)(`p`,{className:`px-4 py-6 text-center text-xs text-soft-foreground`,children:`Loading…`})})}function $b(){let{projectId:e=``}=o(),t=Re(),n=ln(),r=Te();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,Y.jsx)(M,{to:`/p/${encodeURIComponent(e)}${n||`/`}${t.search}${t.hash}`,replace:!0})}if(!n.isError)return(0,Y.jsx)(Qb,{})}if(n.data){if(!(n.data.bootProject===e||n.data.projects.some(t=>t.id===e)))return(0,Y.jsx)(eg,{projectId:e,registry:n.data})}else if(!n.isError)return(0,Y.jsx)(Qb,{});return(0,Y.jsx)(T,{projectId:n.data?.bootProject===e?null:e,children:(0,Y.jsx)(Yt,{},e)})}function ex(){let{projectId:e=``}=o();return(0,Y.jsx)(Vh,{},e)}function tx(){let e=Re(),t=Te(),n=ln(),r=t.data?.bootProject??n.data?.bootProject,i=(t.data!==void 0||t.isError)&&(n.data!==void 0||n.isError);if(r===void 0&&!i)return(0,Y.jsx)(Qb,{});let a=r??`default`;if(e.pathname===`/`&&e.search===``&&e.hash===``){if(n.data===void 0&&!n.isError)return(0,Y.jsx)(Qb,{});let e=om(em(),n.data,r);if(e!==null)return(0,Y.jsx)(M,{to:e,replace:!0});let t=sm(n.data,a);if(t!==a)return(0,Y.jsx)(M,{to:`/p/${encodeURIComponent(t)}/`,replace:!0})}let o=e.pathname===`/p`||e.pathname===`/p/`?`/`:e.pathname;return(0,Y.jsx)(M,{to:`/p/${encodeURIComponent(a)}${o}${e.search}${e.hash}`,replace:!0})}var nx=[{pattern:`/`,pageLabel:`Tasks`},{pattern:`/tasks`,pageLabel:`All tasks`},{pattern:`/dashboard`,pageLabel:`Dashboard`},{pattern:`/new`,pageLabel:`New task`},{pattern:`/compare/:groupId`,pageLabel:`Compare`},{pattern:`/git/*`,pageLabel:`Git`},{pattern:`/github/*`,pageLabel:`GitHub`},{pattern:`/tracker/*`,pageLabel:`Tracker`},{pattern:`/automations/*`,pageLabel:`Automations`},{pattern:`/skills`,pageLabel:`Skills`},{pattern:`/inbox`,pageLabel:`Inbox`},{pattern:`/workflows/*`,pageLabel:`Workflows`},{pattern:`/settings/*`,pageLabel:`Settings`}];function rx(e){let t=zt(e),n=Ne({path:`/tasks/:id/*`,end:!0},t);return n?{pageLabel:null,taskId:n.params.id??null}:{pageLabel:nx.find(({pattern:e})=>Ne({path:e,end:!0},t))?.pageLabel??null,taskId:null}}var ix=(0,J.memo)(function(){let e=Te().data?.capabilities;return(0,Y.jsxs)(Ie,{children:[(0,Y.jsxs)(A,{path:`/p/:projectId`,element:(0,Y.jsx)($b,{}),children:[(0,Y.jsx)(A,{index:!0,element:(0,Y.jsx)(zy,{})}),(0,Y.jsx)(A,{path:`new`,element:(0,Y.jsx)(ex,{})}),(0,Y.jsx)(A,{path:`tasks/:id`,element:(0,Y.jsx)(J.Suspense,{fallback:(0,Y.jsx)(Ba,{}),children:(0,Y.jsx)(Lb,{})})}),(0,Y.jsx)(A,{path:`tasks/:id/changes`,element:(0,Y.jsx)(J.Suspense,{fallback:(0,Y.jsx)(rg,{tab:`changes`}),children:(0,Y.jsx)(zb,{})})}),(0,Y.jsx)(A,{path:`tasks/:id/files`,element:(0,Y.jsx)(J.Suspense,{fallback:(0,Y.jsx)(rg,{tab:`files`}),children:(0,Y.jsx)(Bb,{})})}),(0,Y.jsx)(A,{path:`tasks/:id/graph`,element:(0,Y.jsx)(J.Suspense,{fallback:(0,Y.jsx)(rg,{tab:`changes`}),children:(0,Y.jsx)(Kb,{})})}),(0,Y.jsx)(A,{path:`tasks/:id/commits`,element:(0,Y.jsx)(J.Suspense,{fallback:(0,Y.jsx)(rg,{tab:`changes`}),children:(0,Y.jsx)(Vb,{})})}),(0,Y.jsx)(A,{path:`tasks/:id/notes`,element:(0,Y.jsx)(J.Suspense,{fallback:(0,Y.jsx)(rg,{tab:`notes`}),children:(0,Y.jsx)(Hb,{})})}),(0,Y.jsx)(A,{path:`tasks/:id/commits/:sha`,element:(0,Y.jsx)(J.Suspense,{fallback:(0,Y.jsx)(rg,{tab:`changes`}),children:(0,Y.jsx)(Vb,{})})}),(0,Y.jsx)(A,{path:`compare/:groupId`,element:(0,Y.jsx)(J.Suspense,{fallback:(0,Y.jsx)(um,{}),children:(0,Y.jsx)(Rb,{})})}),(0,Y.jsx)(A,{path:`git`,element:(0,Y.jsx)(J.Suspense,{fallback:(0,Y.jsx)(Qh,{}),children:(0,Y.jsx)(Ub,{tab:`changes`})})}),(0,Y.jsx)(A,{path:`git/commits`,element:(0,Y.jsx)(J.Suspense,{fallback:(0,Y.jsx)(Qh,{}),children:(0,Y.jsx)(Ub,{tab:`commits`})})}),(0,Y.jsx)(A,{path:`git/commits/:sha`,element:(0,Y.jsx)(J.Suspense,{fallback:(0,Y.jsx)(Qh,{}),children:(0,Y.jsx)(Ub,{tab:`commits`})})}),(0,Y.jsx)(A,{path:`git/branches`,element:(0,Y.jsx)(J.Suspense,{fallback:(0,Y.jsx)(Qh,{}),children:(0,Y.jsx)(Ub,{tab:`branches`})})}),(0,Y.jsx)(A,{path:`git/files`,element:(0,Y.jsx)(J.Suspense,{fallback:(0,Y.jsx)(Qh,{}),children:(0,Y.jsx)(Ub,{tab:`files`})})}),(0,Y.jsx)(A,{path:`git/files/*`,element:(0,Y.jsx)(J.Suspense,{fallback:(0,Y.jsx)(Qh,{}),children:(0,Y.jsx)(Ub,{tab:`files`})})}),(0,Y.jsx)(A,{path:`github`,element:(0,Y.jsx)(J.Suspense,{fallback:(0,Y.jsx)(dm,{}),children:(0,Y.jsx)(Wb,{view:`issues`,index:!0})})}),(0,Y.jsx)(A,{path:`tracker`,element:(0,Y.jsx)(J.Suspense,{fallback:(0,Y.jsx)(Qb,{}),children:(0,Y.jsx)(Gb,{})})}),(0,Y.jsx)(A,{path:`tracker/:id`,element:(0,Y.jsx)(J.Suspense,{fallback:(0,Y.jsx)(Qb,{}),children:(0,Y.jsx)(Gb,{})})}),(0,Y.jsx)(A,{path:`github/prs`,element:(0,Y.jsx)(J.Suspense,{fallback:(0,Y.jsx)(dm,{}),children:(0,Y.jsx)(Wb,{view:`prs`})})}),(0,Y.jsx)(A,{path:`github/issues/:n`,element:(0,Y.jsx)(J.Suspense,{fallback:(0,Y.jsx)(dm,{}),children:(0,Y.jsx)(Wb,{view:`issues`})})}),(0,Y.jsx)(A,{path:`github/prs/:n`,element:(0,Y.jsx)(J.Suspense,{fallback:(0,Y.jsx)(dm,{}),children:(0,Y.jsx)(Wb,{view:`prs`})})}),(0,Y.jsx)(A,{path:`github/prs/:n/changes`,element:(0,Y.jsx)(J.Suspense,{fallback:(0,Y.jsx)(dm,{}),children:(0,Y.jsx)(Wb,{view:`prs`,changes:!0})})}),(0,Y.jsx)(A,{path:`automations`,element:(0,Y.jsx)(J.Suspense,{fallback:(0,Y.jsx)(lm,{}),children:(0,Y.jsx)(Yb,{})})}),(0,Y.jsx)(A,{path:`automations/new`,element:(0,Y.jsx)(J.Suspense,{fallback:(0,Y.jsx)(lm,{}),children:(0,Y.jsx)(Yb,{mode:`new`})})}),(0,Y.jsx)(A,{path:`automations/:automationId`,element:(0,Y.jsx)(J.Suspense,{fallback:(0,Y.jsx)(lm,{}),children:(0,Y.jsx)(Yb,{mode:`edit`})})}),(0,Y.jsx)(A,{path:`automations/:automationId/log`,element:(0,Y.jsx)(J.Suspense,{fallback:(0,Y.jsx)(lm,{}),children:(0,Y.jsx)(Yb,{mode:`log`})})}),(0,Y.jsx)(A,{path:`skills`,element:(0,Y.jsx)(J.Suspense,{fallback:(0,Y.jsx)($h,{}),children:(0,Y.jsx)(Jb,{})})}),(0,Y.jsx)(A,{path:`inbox`,element:(0,Y.jsx)(Pm,{})}),(0,Y.jsx)(A,{path:`workflows`,element:(0,Y.jsx)(J.Suspense,{fallback:(0,Y.jsx)(tg,{}),children:(0,Y.jsx)(qb,{})})}),(0,Y.jsx)(A,{path:`workflows/:name`,element:(0,Y.jsx)(J.Suspense,{fallback:(0,Y.jsx)(tg,{}),children:(0,Y.jsx)(qb,{})})}),(0,Y.jsx)(A,{path:`workflows-new/*`,element:(0,Y.jsx)(Zt,{to:`/workflows`,replace:!0})}),(0,Y.jsx)(A,{path:`settings`,element:(0,Y.jsx)(sy,{scope:`project`,capabilities:e})}),(0,Y.jsx)(A,{path:`settings/skills`,element:(0,Y.jsx)(Xb,{})}),(0,Y.jsx)(A,{path:`settings/prompt-templates`,element:(0,Y.jsx)(Zt,{to:{pathname:`/settings/instructions`,hash:`#prompt-templates`},replace:!0})}),Gv(`project`,e).map(t=>(0,Y.jsx)(A,{path:`settings/${t.id}`,element:(0,Y.jsx)(oy,{section:t,scope:`project`,capabilities:e})},t.id)),Gv(`global`,e).map(e=>(0,Y.jsx)(A,{path:`settings/${e.id}`,element:(0,Y.jsx)(Zb,{sectionId:e.id})},e.id)),(0,Y.jsx)(A,{path:`*`,element:(0,Y.jsx)(Zh,{})})]}),(0,Y.jsx)(A,{path:`/tasks`,element:(0,Y.jsx)(xb,{})}),(0,Y.jsx)(A,{path:`/dashboard`,element:(0,Y.jsx)(J.Suspense,{fallback:(0,Y.jsx)(`div`,{role:`status`,className:`p-6 text-sm text-muted-foreground`,children:`Loading dashboard…`}),children:(0,Y.jsx)(Ib,{})})}),(0,Y.jsx)(A,{path:`/settings/global`,element:(0,Y.jsx)(sy,{scope:`global`,capabilities:e})}),Gv(`global`,e).map(t=>(0,Y.jsx)(A,{path:ty(`global`,t.id),element:(0,Y.jsx)(oy,{section:t,scope:`global`,capabilities:e})},t.id)),(0,Y.jsx)(A,{path:`*`,element:(0,Y.jsx)(tx,{})})]})});function ax(e){let t=e?.repo;if(!t)return null;let n=t.root.replace(/[\\/]+$/,``).split(/[\\/]/).pop();return n?{name:n,branch:t.branch}:null}function ox(e){return e?.available===!0&&(e.status===`available`||e.status===`error`)}var sx=(0,J.memo)(function({children:e}){let{pathname:t}=Re(),n=tn(),r=Te(),i=st(),o=i.data?.branding,s=o!==void 0&&(o.name!==`cezar`||o.logoUrl!==null),c=De(!s&&i.data!==void 0),l=r.data?.capabilities.followups===!0,u=r.data?.capabilities.automations===!0,d=we(l),f=ox(p(n??``,n!==null).data),m=ln().data,h=rx(t),g=m?.bootProject??r.data?.bootProject??null,_=ie(n,g,(0,J.useMemo)(()=>Wr,[])),v=n!==null&&n===g,y=m?.projects.find(e=>e.id===n),b=m?.projects.find(e=>e.id===g),x=n===null?b?.tracker:y?.tracker,S=h.taskId,C=a(n??``,y!==void 0&&S!==null,m?.bootProject===n,(0,J.useMemo)(()=>e=>{let t=S?e.find(e=>e.id===S):void 0;return t?xt(t):void 0},[S])).data;Qp({projectName:t===`/settings/global`||t.startsWith(`/settings/global/`)?null:y?.name??(v?ax(r.data)?.name??null:null),pageLabel:C??h.pageLabel,brandName:i.data?.branding.name,brandLogoUrl:i.data?.branding.logoUrl});let w=m&&m.projects.length>1?m:null,T=(0,J.useMemo)(()=>ax(r.data),[r.data?.repo?.root,r.data?.repo?.branch]),E=(0,J.useMemo)(()=>(0,Y.jsx)(If,{}),[]),D=(0,J.useMemo)(()=>(0,Y.jsx)(Wf,{}),[]),O=(0,J.useMemo)(()=>(0,Y.jsx)(jp,{}),[]),k=(0,J.useMemo)(()=>(0,Y.jsx)(Ef,{}),[]),A=(0,J.useMemo)(()=>w?(0,Y.jsx)(zp,{projects:w.projects,bootProjectId:w.bootProject,inboxAvailable:l,automationsAvailable:u,inboxCount:d.data?.length??null,skillsUpdateAvailable:f}):void 0,[w,l,u,d.data?.length,f]),j=(0,J.useMemo)(()=>(0,Y.jsx)(qp,{health:r.data}),[r.data]);return(0,Y.jsxs)(xf,{children:[(0,Y.jsx)(nf,{repo:T,brandName:i.data?.branding.name??`cezar`,brandLogoUrl:i.data?.branding.logoUrl??null,version:r.data?.version??null,latestVersion:r.data?.latestVersion??null,starCount:!s&&c.data?.available?c.data.count??null:null,inboxCount:d.data?.length??null,unreadCount:_.data??null,skillsUpdateAvailable:f,forgeAvailable:r.data?.forge?.available===!0,inboxAvailable:l,automationsAvailable:u,tracker:x,banner:E,footerBanner:D,singleProject:r.data?.capabilities.singleProject===!0,taskQuickList:O,hostWidget:k,projectGroups:A,toolsMenu:j,children:e}),(0,Y.jsx)(ad,{})]})});function cx(){let e=Re(),t=ln();return(0,J.useEffect)(()=>{let n=am(e,t.data);n!==null&&(cm(em(),n)||tm(n))},[e.hash,e.pathname,e.search,t.data]),null}function lx(){let e=I(),t=j_(It().data?.notifications).enabled,n=(0,J.useRef)(t);n.current=t;let r=(0,J.useRef)(new Map);return(0,J.useEffect)(()=>{let t=rt(R.runs.list()),i=e=>{let{entering:t,statuses:i}=N_(r.current,e);if(r.current=i,t.length!==0&&P_({enabled:n.current,hidden:document.visibilityState===`hidden`,permission:M_()}))for(let e of t)ux(e)};return i(e.getQueryData(R.runs.list())),e.getQueryCache().subscribe(e=>{e.query.queryHash!==t||e.type!==`updated`||i(e.query.state.data)})},[e]),null}function ux(e){let t=globalThis.Notification;if(typeof t!=`function`)return;let n=F_(e);try{new t(n.title,{body:n.body,tag:n.tag})}catch{}}function dx(e,t=!0){return Qt({queryKey:[...z.dashboard,`insights`,e],enabled:t,staleTime:5e3,refetchInterval:t?15e3:!1,refetchIntervalInBackground:!1,retry:!1,queryFn:async({signal:t})=>Pn.parse(await h(await ze.api.v1.workspace.dashboard.insights.$get({query:{period:e,tzOffsetMinutes:String(new Date().getTimezoneOffset())}},{init:{signal:t}}),`/workspace/dashboard/insights`))})}var fx=[`pointerdown`,`pointermove`,`keydown`,`wheel`,`touchstart`];function px(){let e=document.activeElement;return e?e.isContentEditable||e.tagName===`TEXTAREA`||e.tagName===`INPUT`&&e.type!==`checkbox`:!1}var mx=()=>document.querySelector(`[role="dialog"],[role="alertdialog"]`)!==null;function hx(){let e=I(),t=st(),n=t.data?.branding,r=n!==void 0&&(n.name!==`cezar`||n.logoUrl!==null),i=De(t.data!==void 0&&!r),a=!r&&i.data?.available===!0,o=!r&&i.data?.available?i.data.count??null:null,[s,c]=(0,J.useState)(!1),l=(0,J.useRef)(a);l.current=a;let u=(0,J.useRef)(new Map),d=(0,J.useRef)(null),f=(0,J.useRef)(0);return(0,J.useEffect)(()=>{let t=rt(R.runs.list()),n,r=()=>_d({now:Date.now(),visible:document.visibilityState===`visible`,focused:document.hasFocus(),lastInteractionAt:f.current,typing:px(),dialogOpen:mx()}),i=()=>{let e=d.current;if(!(e===null||n)){if(Date.now()-e>18e5){d.current=null;return}r()&&(n=setTimeout(()=>{n=void 0;let e=pd();if(!(d.current===null||!r()||!l.current)){if(!hd(e,Date.now())){d.current=null;return}d.current=null,md({...e,asks:e.asks+1,lastAskedAt:new Date().toISOString()}),c(!0)}},fd))}},a=e=>{let{succeeded:t,statuses:n}=bd(u.current,e);u.current=n,!(!t||!l.current)&&(gd(e)<3||hd(pd(),Date.now())&&(d.current=Date.now(),i()))},o=()=>{f.current=Date.now(),i()};for(let e of fx)window.addEventListener(e,o,{passive:!0});document.addEventListener(`visibilitychange`,i),window.addEventListener(`focus`,i),a(e.getQueryData(R.runs.list()));let s=e.getQueryCache().subscribe(e=>{e.query.queryHash!==t||e.type!==`updated`||a(e.query.state.data)});return()=>{s(),clearTimeout(n);for(let e of fx)window.removeEventListener(e,o);document.removeEventListener(`visibilitychange`,i),window.removeEventListener(`focus`,i)}},[e]),r?null:(0,Y.jsx)(_x,{open:s,onOpenChange:c,count:o})}function gx(e){let t=pd();t&&md({...t,outcome:e})}function _x({open:e,onOpenChange:t,count:n}){let r=dx(`30d`,e).data?.delivered,i=r&&r.completedTasks>0?[{label:`Tasks done`,n:r.completedTasks,value:r.completedTasks.toLocaleString(`en-US`)},{label:`PRs opened`,n:r.prsOpened,value:r.prsOpened.toLocaleString(`en-US`)},{label:`Lines written`,n:r.additions,value:`+${r.additions.toLocaleString(`en-US`)}`}].filter(e=>e.n>0):null;return(0,Y.jsx)(xi,{open:e,onOpenChange:t,children:(0,Y.jsxs)(Oi,{"data-slot":`star-ask`,className:`gap-0 overflow-hidden p-0 sm:max-w-[440px]`,children:[(0,Y.jsxs)(`div`,{className:`relative flex h-36 items-center justify-center overflow-hidden border-b bg-card-2`,children:[(0,Y.jsx)(`div`,{"aria-hidden":`true`,className:`absolute inset-0 bg-[radial-gradient(circle_at_22%_35%,color-mix(in_oklab,var(--accent-lime)_32%,transparent),transparent_55%),radial-gradient(circle_at_80%_70%,color-mix(in_oklab,var(--violet)_38%,transparent),transparent_55%)]`}),(0,Y.jsxs)(`div`,{"aria-hidden":`true`,className:`relative flex items-center gap-4`,children:[(0,Y.jsx)(wd,{height:52,className:`text-foreground`}),(0,Y.jsx)(`span`,{className:`flex size-12 items-center justify-center rounded-full border bg-card shadow-md`,children:(0,Y.jsx)(Us,{className:`size-6 fill-current text-pending-strong`})})]}),n!==null&&(0,Y.jsxs)(`span`,{className:`absolute bottom-3 left-1/2 -translate-x-1/2 rounded-full border bg-card/80 px-2.5 py-0.5 font-mono text-[11px] text-muted-foreground backdrop-blur`,children:[`⭐ `,ud(n),` stars on GitHub`]})]}),(0,Y.jsxs)(`div`,{className:`space-y-4 p-6`,children:[(0,Y.jsxs)(`div`,{className:`space-y-2`,children:[(0,Y.jsx)(`span`,{className:`section-mark block font-mono text-[11px] font-semibold uppercase tracking-[0.14em] text-muted-foreground`,children:`Open source · MIT`}),(0,Y.jsx)(_i,{className:`text-xl font-semibold tracking-tight`,children:`Is cezar pulling its weight?`}),(0,Y.jsx)(Ei,{className:`text-sm leading-relaxed text-muted-foreground`,children:`cezar is free, open source and runs on your machine, with no account to create. A GitHub star is how other developers find it, and how we know what to keep building.`})]}),i&&(0,Y.jsxs)(`div`,{className:`rounded-lg border bg-card-2 p-3`,children:[(0,Y.jsx)(`span`,{className:`block font-mono text-[10.5px] uppercase tracking-[0.12em] text-soft-foreground`,children:`Your last 30 days with cezar`}),(0,Y.jsx)(`dl`,{className:`mt-2 grid gap-2`,style:{gridTemplateColumns:`repeat(${i.length}, minmax(0, 1fr))`},children:i.map(e=>(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-col-reverse`,children:[(0,Y.jsx)(`dt`,{className:`text-xs text-soft-foreground`,children:e.label}),(0,Y.jsx)(`dd`,{className:`truncate text-lg font-semibold tabular-nums`,children:e.value})]},e.label))})]}),(0,Y.jsx)(K,{asChild:!0,className:`h-11 w-full text-sm font-semibold`,children:(0,Y.jsxs)(`a`,{href:cd,target:`_blank`,rel:`noopener noreferrer`,onClick:()=>{gx(`starred`),t(!1)},children:[(0,Y.jsx)(Us,{className:`size-4 fill-current`,"aria-hidden":`true`}),`Star cezar on GitHub`,(0,Y.jsx)(gi,{className:`size-4`,"aria-hidden":`true`})]})}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Y.jsx)(K,{variant:`ghost`,className:`min-h-11`,onClick:()=>t(!1),children:`Maybe later`}),(0,Y.jsx)(K,{variant:`ghost`,className:`min-h-11 text-soft-foreground`,onClick:()=>{gx(`never`),t(!1)},children:`Don’t ask again`})]})]})]})})}function vx(){let[e]=(0,J.useState)(Qo);return(0,Y.jsx)(vt,{client:e,children:(0,Y.jsx)(rr,{children:(0,Y.jsxs)(Bo,{children:[(0,Y.jsx)(lx,{}),(0,Y.jsx)(hx,{}),(0,Y.jsx)(zu,{children:(0,Y.jsx)(u_,{children:(0,Y.jsxs)(xe,{children:[(0,Y.jsx)(cx,{}),(0,Y.jsx)(Kr,{}),(0,Y.jsx)(Ti,{children:(0,Y.jsx)(sx,{children:(0,Y.jsx)(ix,{})})}),(0,Y.jsx)(un,{})]})})})]})})})}function yx(){return(document.querySelector(`meta[name="cez-api-base"]`)?.getAttribute(`content`))?.trim()||``}Nn(yx());var bx=document.getElementById(`root`);if(!bx)throw Error(`cezar: #root container is missing from index.html`);(0,Eo.createRoot)(bx).render((0,Y.jsx)(J.StrictMode,{children:(0,Y.jsx)(vx,{})}));export{lu as A,ps as B,Ed as C,Dd as D,Od as E,Hs as F,Ao as H,Bs as I,zs as L,Js as M,qs as N,Cu as O,Gs as P,Rs as R,um as S,Ad as T,ss as V,ym as _,rg as a,_m as b,bh as c,gh as d,Am as f,xm as g,wm as h,ig as i,cu as j,fu as k,_h as l,Om as m,ly as n,tg as o,km as p,ty as r,Qh as s,dx as t,yh as u,gm as v,kd as w,dm as x,bm as y,Ls as z};
|