@open-mercato/cezar 0.9.1-pr709.853 → 0.9.1-pr709.856
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/web/dist/assets/{compare-variants-CbiCg_gM.js → compare-variants-SQ-ZYaDx.js} +1 -1
- package/web/dist/assets/{diff-CANo6FGh.js → diff-C2juD22q.js} +2 -2
- package/web/dist/assets/{diff-view-Bp3wVnEU.js → diff-view-B8J0_nFo.js} +1 -1
- package/web/dist/assets/{git-toolbar-CntWCsG_.js → git-toolbar-1COtUQ2N.js} +1 -1
- package/web/dist/assets/{github-72b-Q1Br.js → github-B8BsP33C.js} +1 -1
- package/web/dist/assets/{index-Dngu3-hi.js → index-C29jjp6D.js} +2 -2
- package/web/dist/assets/{repo-git-Cc9uAVzh.js → repo-git-CYfdegZH.js} +1 -1
- package/web/dist/assets/{run-diff-B4U4s0Xi.js → run-diff-BAZmmGo_.js} +1 -1
- package/web/dist/assets/{run-header-BVnuXZE2.js → run-header-LXnF_Jvz.js} +1 -1
- package/web/dist/assets/{skills-BDD1dfEE.js → skills-C0pJsokM.js} +1 -1
- package/web/dist/assets/{task-changes-1Dlu76oI.js → task-changes-DigJxA1i.js} +1 -1
- package/web/dist/assets/{task-commits-BbdH8rWJ.js → task-commits-DrMd0mHA.js} +1 -1
- package/web/dist/assets/{task-files-DZ3YIg_X.js → task-files-C_TaL6Ym.js} +1 -1
- package/web/dist/assets/task-thread-CNKDBZ3f.js +9 -0
- package/web/dist/assets/{use-desktop-DGeHtQ89.js → use-desktop-DRXFO3YV.js} +1 -1
- package/web/dist/assets/{workflows-DDKekv0c.js → workflows-CxEa4Qpj.js} +1 -1
- package/web/dist/index.html +1 -1
- package/web/dist/assets/task-thread-7gsMtehO.js +0 -9
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/html-BY76lXLH.js","assets/css-BsVw1vtW.js","assets/javascript-BgS3c2Ky.js","assets/core-BCsw8oQw.js","assets/lib-BxQXEXDF.js","assets/rolldown-runtime-QTnfLwEv.js","assets/task-thread-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/html-BY76lXLH.js","assets/css-BsVw1vtW.js","assets/javascript-BgS3c2Ky.js","assets/core-BCsw8oQw.js","assets/lib-BxQXEXDF.js","assets/rolldown-runtime-QTnfLwEv.js","assets/task-thread-CNKDBZ3f.js","assets/react-runtime-CCIEwYL0.js","assets/centered-state-Cq29cbPx.js","assets/bundle-mjs-BT31bpU6.js","assets/utils-D27OaPrA.js","assets/run-header-LXnF_Jvz.js","assets/circle-check-TKq6_8_Y.js","assets/circle-x-bH39f-Yh.js","assets/trash-2-aYhsIRM2.js","assets/ellipsis-vertical-WowqAN6-.js","assets/tab-link-DU-62KyI.js","assets/project-router-DoUYF6nR.js","assets/square-terminal-CoE5Kj-S.js","assets/git-pull-request-D8yt-2Tr.js","assets/search-x-CaddQd7u.js","assets/textarea-Dd8d_Pwi.js","assets/run-diff-BAZmmGo_.js","assets/lib-BQXq3kEf.js","assets/zoomable-image-BBB-AoPi.js","assets/compare-variants-SQ-ZYaDx.js","assets/task-changes-DigJxA1i.js","assets/git-toolbar-1COtUQ2N.js","assets/file-BWgi5VOt.js","assets/use-desktop-DRXFO3YV.js","assets/upload-DH2pWIfO.js","assets/diff-C2juD22q.js","assets/image-preview-B3W7bWIq.js","assets/task-files-C_TaL6Ym.js","assets/triangle-alert-BMsU3ymT.js","assets/task-commits-DrMd0mHA.js","assets/arrow-left-BWue3Imk.js","assets/commit-list-B-hhWl6r.js","assets/repo-git-CYfdegZH.js","assets/github-B8BsP33C.js","assets/refresh-cw-CFp_jUZr.js","assets/workflows-CxEa4Qpj.js","assets/skill-empty-hint-D5QzmqHj.js","assets/skills-C0pJsokM.js"])))=>i.map(i=>d[i]);
|
|
2
2
|
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,n,r,t as i}from"./react-runtime-CCIEwYL0.js";import{$ as a,A as o,An as s,Bn as c,C as l,Cn as u,Ct as d,D as f,Dn as p,Dt as m,E as h,En as g,Et as _,Fn as v,Gn as y,Hn as b,In as x,Jn as S,K as C,Kn as w,L as T,Ln as E,Lt as D,M as O,Mn as k,N as A,O as j,On as M,P as N,Pn as ee,Pt as P,Q as te,Rn as ne,S as F,Sn as re,St as ie,T as I,Tn as L,Tt as R,U as z,Un as ae,Vn as B,W as oe,Wn as se,X as ce,Xn as le,Y as ue,Yn as de,Z as fe,_ as V,_n as pe,_t as me,a as H,an as he,b as ge,bn as _e,bt as ve,c as ye,cn as be,d as xe,dn as Se,en as Ce,et as we,f as Te,g as Ee,gn as De,h as Oe,hn as ke,ht as Ae,i as U,in as je,j as Me,jn as Ne,k as Pe,kn as Fe,kt as Ie,l as Le,m as Re,mn as ze,mt as Be,n as Ve,nn as He,o as Ue,on as We,ot as Ge,pn as Ke,qn as qe,qt as Je,r as Ye,rt as Xe,s as Ze,sn as Qe,t as W,tt as $e,u as et,un as tt,v as nt,vn as rt,vt as it,w as at,wn as ot,wt as st,x as G,xn as ct,xt as lt,y as K,yn as ut,yt as dt,zn as ft,zt as pt}from"./centered-state-Cq29cbPx.js";import{i as q}from"./bundle-mjs-BT31bpU6.js";import{i as mt,n as ht,r as J,t as Y}from"./utils-D27OaPrA.js";import{t as gt}from"./search-x-CaddQd7u.js";import{t as _t}from"./triangle-alert-BMsU3ymT.js";import{n as vt,t as yt}from"./textarea-Dd8d_Pwi.js";import{a as bt,c as xt,i as St,l as Ct,n as wt,o as Tt,r as Et,s as Dt,t as Ot}from"./dist-BGP2OpHS.js";import{a as kt,c as At,d as jt,i as Mt,l as Nt,n as Pt,o as Ft,r as It,s as Lt,t as X,u as Rt}from"./project-router-DoUYF6nR.js";import{i as zt,n as Bt}from"./chunk-BO2N2NFS-DE6qKn3r.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 Vt=class extends le{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 x({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=Ht(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=Ht(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=Ht(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=Ht(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){ft.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=>ae(t,e))}findAll(e={}){return this.getAll().filter(t=>ae(e,t))}notify(e){ft.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return ft.batch(()=>Promise.all(e.map(e=>e.continue().catch(y))))}};function Ht(e){return e.options.scope?.id}var Ut=class extends le{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??b(r,t),a=this.get(i);return a||(a=new E({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(){ft.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=>se(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>se(e,t)):t}notify(e){ft.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){ft.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){ft.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Wt=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new Ut,this.#t=e.mutationCache||new Vt,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=de.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=ne.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(qe(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=c(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return ft.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;ft.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return ft.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=ft.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(y).catch(y)}invalidateQueries(e,t={}){return ft.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=ft.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(y)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(y)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(qe(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(y).catch(y)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(y).catch(y)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return ne.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(B(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{w(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(B(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{w(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||=b(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===S&&(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()}},Z=e(t(),1),Gt=n();function Kt(e,t){if(e===`ping`)return{project:null,event:{type:`ping`}};let n;try{n=JSON.parse(t)}catch{return null}if(!qt(n))return null;let r=n.project;if(typeof r!=`string`||r===``)return null;switch(e){case`run`:{let{project:e,...t}=n;return Jt(t)?{project:r,event:{type:`run`,run:t}}:null}case`run-deleted`:{let e=n.id;return typeof e==`string`&&e?{project:r,event:{type:`run-deleted`,id:e}}:null}case`todos`:return Array.isArray(n.items)?{project:r,event:{type:`todos`,items:n.items}}:null;case`usage`:return qt(n.usage)?{project:r,event:{type:`usage`,usage:n.usage}}:null;default:return null}}function qt(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Jt(e){return qt(e)&&typeof e.id==`string`&&e.id!==``}function Yt(e,t){if(!e)return;let n=e.findIndex(e=>e.id===t.id);if(n>=0){let r=[...e];return r[n]=Zt(e[n],t),r}let r=t.createdAt??``,i=e.findIndex(e=>(e.createdAt??``).localeCompare(r)<0),a=[...e];return a.splice(i<0?e.length:i,0,t),a}function Xt(e,t){if(!e)return;let n=e.filter(e=>e.id!==t);return n.length===e.length?e:n}function Zt(e,t){return e?.usage?{...t,usage:e.usage}:t}var Qt=Object.freeze({});function $t(){let e=Qt,t=new Set;return{subscribe(e){return t.add(e),()=>t.delete(e)},get:()=>e,set(n){e=n;for(let e of t)e()}}}var Q=i(),en=`/api/workspace/events`,tn=2,nn=3e3,rn=[`run`,`run-deleted`,`todos`,`usage`,`ping`],an=[`project-added`,`project-removed`,`checkout-progress`],on=new Set;function sn(e){return on.add(e),()=>{on.delete(e)}}function cn(e){e.invalidateQueries({queryKey:o.runs.all}),e.invalidateQueries({queryKey:o.todos}),e.invalidateQueries({queryKey:o.health}),e.invalidateQueries({queryKey:o.worktrees}),e.invalidateQueries({queryKey:_.providerStatus})}function ln(e){return mt()??e.getQueryData(o.health)?.bootProject}function un(e,t,n){switch(n.type){case`run`:{e.setQueryData(o.runs.list(),e=>Yt(e,n.run));let t=o.runs.detail(n.run.id);e.getQueryData(t)!==void 0&&e.setQueryData(t,e=>Zt(e,n.run));let r=o.runs.changes(n.run.id);e.getQueryData(r)!==void 0&&e.invalidateQueries({queryKey:r}),e.invalidateQueries({queryKey:o.worktrees});return}case`run-deleted`:e.setQueryData(o.runs.list(),e=>Xt(e,n.id)),e.removeQueries({queryKey:o.runs.detail(n.id)}),e.removeQueries({queryKey:o.runs.diff(n.id)}),e.invalidateQueries({queryKey:o.worktrees});return;case`todos`:e.setQueryData(o.todos,n.items);return;case`usage`:t.set(n.usage);return;case`ping`:return}}function dn(e,t=en){let n=v();(0,Z.useEffect)(()=>{let r=globalThis.EventSource;if(typeof r!=`function`)return;let i=null,a,o=!1,s=!1,c=!1,l=!1,u=()=>{c=!0,l=!1;let e=_.providerStatus;n.cancelQueries({queryKey:e,exact:!0}).then(()=>n.invalidateQueries({queryKey:e,exact:!0,refetchType:`active`})).finally(()=>{if(s||!l){c=!1;return}u()})},d=()=>{s||a!==void 0||(a=setTimeout(()=>{a=void 0,s||f()},nn))},f=()=>{i?.close(),i=new r(t,{withCredentials:!0}),i.addEventListener(`open`,()=>{o&&cn(n),o=!0});for(let t of rn)i.addEventListener(t,r=>{let i=Kt(t,r.data);i&&(i.project!==null&&i.project!==ln(n)||un(n,e,i.event))});for(let e of an)i.addEventListener(e,t=>{let r;try{r=JSON.parse(t.data)}catch{return}e!==`checkout-progress`&&n.invalidateQueries({queryKey:_.projects});for(let t of[...on])t(e,r)});i.addEventListener(`provider-status`,e=>{let t;try{t=JSON.parse(e.data)}catch{return}let r=De(t);if(!r)return;let i=_.providerStatus,a=ke(n.getQueryData(i),r);if(a!==void 0){n.setQueryData(i,a);return}if(c){l=!0;return}u()}),i.addEventListener(`error`,()=>{i?.readyState===tn&&d()})},p=()=>{document.visibilityState===`visible`&&(cn(n),(!i||i.readyState===tn)&&(clearTimeout(a),a=void 0,f()))},m=()=>{clearTimeout(a),a=void 0,i?.close()},h=e=>{e.persisted&&(cn(n),f())};return document.addEventListener(`visibilitychange`,p),window.addEventListener(`pagehide`,m),window.addEventListener(`pageshow`,h),f(),()=>{s=!0,clearTimeout(a),document.removeEventListener(`visibilitychange`,p),window.removeEventListener(`pagehide`,m),window.removeEventListener(`pageshow`,h),i?.close(),i=null}},[n,e,t])}var fn=(0,Z.createContext)(null);function pn({children:e}){let[t]=(0,Z.useState)($t);return dn(t),oe(),(0,Q.jsx)(fn.Provider,{value:t,children:e})}function mn(e){let t=(0,Z.useContext)(fn),n=t?t.get:gn;return(0,Z.useSyncExternalStore)(t?t.subscribe:hn,()=>e?n()[e]:void 0,()=>void 0)}var hn=()=>()=>void 0,gn=()=>Qt;function _n(){return new Wt({defaultOptions:{queries:{refetchInterval:!1,staleTime:5*6e4,gcTime:30*6e4,refetchOnWindowFocus:!1,refetchOnReconnect:!1,retry:(e,t)=>t instanceof m&&t.status>=400&&t.status<500?!1:e<1},mutations:{retry:!1}}})}var vn=J(`archive`,[[`rect`,{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`,key:`1wp1u1`}],[`path`,{d:`M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8`,key:`1s80jp`}],[`path`,{d:`M10 12h4`,key:`a56b0p`}]]),yn=J(`arrow-down`,[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]),bn=J(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),xn=J(`arrow-up-right`,[[`path`,{d:`M7 7h10v10`,key:`1tivn9`}],[`path`,{d:`M7 17 17 7`,key:`1vkiza`}]]),Sn=J(`arrow-up`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]),Cn=J(`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`}]]),wn=J(`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`}]]),Tn=J(`bot`,[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]),En=J(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),Dn=J(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),On=J(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),kn=J(`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`}]]),An=J(`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`}]]),jn=J(`eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),Mn=J(`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`}]]),Nn=J(`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`}]]),Pn=J(`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`}]]),Fn=J(`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`}]]),In=J(`folder`,[[`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`}]]),Ln=J(`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`}]]),Rn=J(`gauge`,[[`path`,{d:`m12 14 4-4`,key:`9kzdfg`}],[`path`,{d:`M3.34 19a10 10 0 1 1 17.32 0`,key:`19p75a`}]]),zn=J(`git-branch`,[[`path`,{d:`M15 6a9 9 0 0 0-9 9V3`,key:`1cii5b`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}]]),Bn=J(`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`}]]),Vn=J(`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`}]]),Hn=J(`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`}]]),Un=J(`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`}]]),Wn=J(`menu`,[[`path`,{d:`M4 5h16`,key:`1tepv9`}],[`path`,{d:`M4 12h16`,key:`1lakjw`}],[`path`,{d:`M4 19h16`,key:`1djgab`}]]),Gn=J(`mic`,[[`path`,{d:`M12 19v3`,key:`npa21l`}],[`path`,{d:`M19 10v2a7 7 0 0 1-14 0v-2`,key:`1vc78b`}],[`rect`,{x:`9`,y:`2`,width:`6`,height:`13`,rx:`3`,key:`s6n7sd`}]]),Kn=J(`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`}]]),qn=J(`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`}]]),Jn=J(`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`}]]),Yn=J(`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`}]]),Xn=J(`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`}]]),Zn=J(`paperclip`,[[`path`,{d:`m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551`,key:`1miecu`}]]),Qn=J(`pencil`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]),$n=J(`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`}]]),er=J(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),tr=J(`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`}]]),nr=J(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),rr=J(`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`}]]),ir=J(`sparkles`,[[`path`,{d:`M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z`,key:`1s2grr`}],[`path`,{d:`M20 2v4`,key:`1rf3ol`}],[`path`,{d:`M22 4h-4`,key:`gwowj6`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]]),ar=J(`square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),or=J(`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`}]]),sr=J(`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`}]]),cr=J(`zap`,[[`path`,{d:`M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z`,key:`1xq2db`}]]);function lr(e){let t=e+`CollectionProvider`,[n,r]=ge(t),[i,a]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=e=>{let{scope:t,children:n}=e,r=Z.useRef(null),a=Z.useRef(new Map).current;return(0,Q.jsx)(i,{scope:t,itemMap:a,collectionRef:r,children:n})};o.displayName=t;let s=e+`CollectionSlot`,c=at(s),l=Z.forwardRef((e,t)=>{let{scope:n,children:r}=e,i=h(t,a(s,n).collectionRef);return(0,Q.jsx)(c,{ref:i,children:r})});l.displayName=s;let u=e+`CollectionItemSlot`,d=`data-radix-collection-item`,f=at(u),p=Z.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=Z.useRef(null),s=h(t,o),c=a(u,n);return Z.useEffect(()=>(c.itemMap.set(o,{ref:o,...i}),()=>void c.itemMap.delete(o))),(0,Q.jsx)(f,{[d]:``,ref:s,children:r})});p.displayName=u;function m(t){let n=a(e+`CollectionConsumer`,t);return Z.useCallback(()=>{let e=n.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${d}]`));return Array.from(n.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[n.collectionRef,n.itemMap])}return[{Provider:o,Slot:l,ItemSlot:p},m,r]}var ur=Z.createContext(void 0);function dr(e){let t=Z.useContext(ur);return e||t||`ltr`}var fr=`AlertDialog`,[pr,mr]=ge(fr,[Ct]),hr=Ct(),gr=e=>{let{__scopeAlertDialog:t,...n}=e,r=hr(t);return(0,Q.jsx)(Ot,{...r,...n,modal:!0})};gr.displayName=fr;var _r=`AlertDialogTrigger`,vr=Z.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=hr(n);return(0,Q.jsx)(xt,{...i,...r,ref:t})});vr.displayName=_r;var yr=`AlertDialogPortal`,br=e=>{let{__scopeAlertDialog:t,...n}=e,r=hr(t);return(0,Q.jsx)(Tt,{...r,...n})};br.displayName=yr;var xr=`AlertDialogOverlay`,Sr=Z.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=hr(n);return(0,Q.jsx)(bt,{...i,...r,ref:t})});Sr.displayName=xr;var Cr=`AlertDialogContent`,[wr,Tr]=pr(Cr),Er=Z.forwardRef((e,t)=>{let{__scopeAlertDialog:n,children:r,...i}=e,a=hr(n),o=h(t,Z.useRef(null)),s=Z.useRef(null);return(0,Q.jsx)(wr,{scope:n,cancelRef:s,children:(0,Q.jsx)(Et,{role:`alertdialog`,...a,...i,ref:o,onOpenAutoFocus:K(i.onOpenAutoFocus,e=>{e.preventDefault(),s.current?.focus({preventScroll:!0})}),onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:r})})});Er.displayName=Cr;var Dr=`AlertDialogTitle`,Or=Z.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=hr(n);return(0,Q.jsx)(Dt,{...i,...r,ref:t})});Or.displayName=Dr;var kr=`AlertDialogDescription`,Ar=Z.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=hr(n);return(0,Q.jsx)(St,{...i,...r,ref:t})});Ar.displayName=kr;var jr=`AlertDialogAction`,Mr=Z.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=hr(n);return(0,Q.jsx)(wt,{...i,...r,ref:t})});Mr.displayName=jr;var Nr=`AlertDialogCancel`,Pr=Z.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,{cancelRef:i}=Tr(Nr,n),a=hr(n),o=h(t,i);return(0,Q.jsx)(wt,{...a,...r,ref:o})});Pr.displayName=Nr;var Fr=gr,Ir=br,Lr=Sr,Rr=Er,zr=Mr,Br=Pr,Vr=Or,Hr=Ar;function Ur(e){let t=Z.useRef({value:e,previous:e});return Z.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function Wr(e){let[t,n]=Z.useState(void 0);return nt(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let r=t[0],i,a;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}else n(void 0)},[e]),t}var Gr=[`top`,`right`,`bottom`,`left`],Kr=Math.min,qr=Math.max,Jr=Math.round,Yr=Math.floor,Xr=e=>({x:e,y:e}),Zr={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function Qr(e,t,n){return qr(e,Kr(t,n))}function $r(e,t){return typeof e==`function`?e(t):e}function ei(e){return e.split(`-`)[0]}function ti(e){return e.split(`-`)[1]}function ni(e){return e===`x`?`y`:`x`}function ri(e){return e===`y`?`height`:`width`}function ii(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function ai(e){return ni(ii(e))}function oi(e,t,n){n===void 0&&(n=!1);let r=ti(e),i=ai(e),a=ri(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=hi(o)),[o,hi(o)]}function si(e){let t=hi(e);return[ci(e),t,ci(t)]}function ci(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var li=[`left`,`right`],ui=[`right`,`left`],di=[`top`,`bottom`],fi=[`bottom`,`top`];function pi(e,t,n){switch(e){case`top`:case`bottom`:return n?t?ui:li:t?li:ui;case`left`:case`right`:return t?di:fi;default:return[]}}function mi(e,t,n,r){let i=ti(e),a=pi(ei(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(ci)))),a}function hi(e){let t=ei(e);return Zr[t]+e.slice(t.length)}function gi(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function _i(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:gi(e)}function vi(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function yi(e,t,n){let{reference:r,floating:i}=e,a=ii(t),o=ai(t),s=ri(o),c=ei(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}let m=ti(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function bi(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=$r(t,e),p=_i(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=vi(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=vi(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var xi=50,Si=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:bi},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=yi(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<xi&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=yi(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},Ci=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=$r(e,t)||{};if(l==null)return{};let d=_i(u),f={x:n,y:r},p=ai(i),m=ri(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=Kr(d[_],T),D=Kr(d[v],T),O=C-h[m]-D,k=C/2-h[m]/2+w,A=Qr(E,k,O),j=!c.arrow&&ti(i)!=null&&k!==A&&a.reference[m]/2-(k<E?E:D)-h[m]/2<0,M=j?k<E?k-E:k-O:0;return{[p]:f[p]+M,data:{[p]:A,centerOffset:k-A-M,...j&&{alignmentOffset:M}},reset:j}}}),wi=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=$r(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=ei(r),_=ii(o),v=ei(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[hi(o)]:si(o)),x=p!==`none`;!d&&x&&b.push(...mi(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=oi(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(!(u===`alignment`&&_!==ii(t))||T.every(e=>ii(e.placement)!==_||e.overflows[0]>0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=ii(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function Ti(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Ei(e){return Gr.some(t=>e[t]>=0)}var Di=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=$r(e,t);switch(i){case`referenceHidden`:{let e=Ti(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:Ei(e)}}}case`escaped`:{let e=Ti(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:Ei(e)}}}default:return{}}}}},Oi=new Set([`left`,`top`]);async function ki(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=ei(n),s=ti(n),c=ii(n)===`y`,l=Oi.has(o)?-1:1,u=a&&c?-1:1,d=$r(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var Ai=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await ki(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},ji=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=$r(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=ii(i),p=ni(f),m=u[p],h=u[f],g=(e,t)=>Qr(t+d[e===`y`?`top`:`left`],t,t-d[e===`y`?`bottom`:`right`]);o&&(m=g(p,m)),s&&(h=g(f,h));let _=c.fn({...t,[p]:m,[f]:h});return{..._,data:{x:_.x-n,y:_.y-r,enabled:{[p]:o,[f]:s}}}}}},Mi=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=$r(e,t),u={x:n,y:r},d=ii(i),f=ni(d),p=u[f],m=u[d],h=$r(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:h.mainAxis??0,crossAxis:h.crossAxis??0};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=Oi.has(ei(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},Ni=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){let{placement:n,rects:r,platform:i,elements:a}=t,{apply:o=()=>{},...s}=$r(e,t),c=await i.detectOverflow(t,s),l=ei(n),u=ti(n),d=ii(n)===`y`,{width:f,height:p}=r.floating,m,h;l===`top`||l===`bottom`?(m=l,h=u===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?`start`:`end`)?`left`:`right`):(h=l,m=u===`end`?`top`:`bottom`);let g=p-c.top-c.bottom,_=f-c.left-c.right,v=Kr(p-c[m],g),y=Kr(f-c[h],_),b=t.middlewareData.shift,x=!b,S=v,C=y;b!=null&&b.enabled.x&&(C=_),b!=null&&b.enabled.y&&(S=g),x&&!u&&(d?C=f-2*qr(c.left,c.right):S=p-2*qr(c.top,c.bottom)),await o({...t,availableWidth:C,availableHeight:S});let w=await i.getDimensions(a.floating);return f!==w.width||p!==w.height?{reset:{rects:!0}}:{}}}};function Pi(){return typeof window<`u`}function Fi(e){return Ri(e)?(e.nodeName||``).toLowerCase():`#document`}function Ii(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Li(e){return((Ri(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function Ri(e){return Pi()?e instanceof Node||e instanceof Ii(e).Node:!1}function zi(e){return Pi()?e instanceof Element||e instanceof Ii(e).Element:!1}function Bi(e){return Pi()?e instanceof HTMLElement||e instanceof Ii(e).HTMLElement:!1}function Vi(e){return!Pi()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof Ii(e).ShadowRoot}function Hi(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=$i(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function Ui(e){return/^(table|td|th)$/.test(Fi(e))}function Wi(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var Gi=/transform|translate|scale|rotate|perspective|filter/,Ki=/paint|layout|strict|content/,qi=e=>!!e&&e!==`none`,Ji;function Yi(e){let t=zi(e)?$i(e):e;return qi(t.transform)||qi(t.translate)||qi(t.scale)||qi(t.rotate)||qi(t.perspective)||!Zi()&&(qi(t.backdropFilter)||qi(t.filter))||Gi.test(t.willChange||``)||Ki.test(t.contain||``)}function Xi(e){let t=ta(e);for(;Bi(t)&&!Qi(t);){if(Yi(t))return t;if(Wi(t))return null;t=ta(t)}return null}function Zi(){return Ji??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),Ji}function Qi(e){return/^(html|body|#document)$/.test(Fi(e))}function $i(e){return Ii(e).getComputedStyle(e)}function ea(e){return zi(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function ta(e){if(Fi(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||Vi(e)&&e.host||Li(e);return Vi(t)?t.host:t}function na(e){let t=ta(e);return Qi(t)?(e.ownerDocument||e).body:Bi(t)&&Hi(t)?t:na(t)}function ra(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=na(e),i=r===e.ownerDocument?.body,a=Ii(r);if(i){let e=ia(a);return t.concat(a,a.visualViewport||[],Hi(r)?r:[],e&&n?ra(e):[])}else return t.concat(r,ra(r,[],n))}function ia(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function aa(e){let t=$i(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=Bi(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=Jr(n)!==a||Jr(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function oa(e){return zi(e)?e:e.contextElement}function sa(e){let t=oa(e);if(!Bi(t))return Xr(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=aa(t),o=(a?Jr(n.width):n.width)/r,s=(a?Jr(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var ca=Xr(0);function la(e){let t=Ii(e);return!Zi()||!t.visualViewport?ca:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function ua(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===Ii(e)}function da(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=oa(e),o=Xr(1);t&&(r?zi(r)&&(o=sa(r)):o=sa(e));let s=ua(a,n,r)?la(a):Xr(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a&&r){let e=Ii(a),t=zi(r)?Ii(r):r,n=e,i=ia(n);for(;i&&t!==n;){let e=sa(i),t=i.getBoundingClientRect(),r=$i(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=Ii(i),i=ia(n)}}return vi({width:u,height:d,x:c,y:l})}function fa(e,t){let n=ea(e).scrollLeft;return t?t.left+n:da(Li(e)).left+n}function pa(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-fa(e,n),y:n.top+t.scrollTop}}function ma(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=Li(r),s=t?Wi(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=Xr(1),u=Xr(0),d=Bi(r);if((d||!a)&&((Fi(r)!==`body`||Hi(o))&&(c=ea(r)),d)){let e=da(r);l=sa(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?pa(o,c):Xr(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function ha(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function ga(e){let t=ea(e),n=e.ownerDocument.body,r=qr(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=qr(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+fa(e),o=-t.scrollTop;return $i(n).direction===`rtl`&&(a+=qr(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var _a=25;function va(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=Ii(e),a=Li(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!Zi()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(fa(a)<=0){let e=a.ownerDocument,t=e.body,n=getComputedStyle(t),r=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,i=Math.abs(a.clientWidth-t.clientWidth-r),o=getComputedStyle(a).scrollbarGutter===`stable both-edges`?i/2:i;o<=_a&&(s-=o)}return{width:s,height:c,x:l,y:u}}function ya(e,t){let n=da(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=sa(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function ba(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=va(e,n,t);else if(t===`document`)r=ga(Li(e));else if(zi(t))r=ya(t,n);else{let n=la(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return vi(r)}function xa(e,t){let n=t.get(e);if(n)return n;let r=ra(e,[],!1).filter(e=>zi(e)&&Fi(e)!==`body`),i=null,a=$i(e).position===`fixed`,o=a?ta(e):e;for(;zi(o)&&!Qi(o);){let e=$i(o),t=Yi(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=ta(o)}return t.set(e,r),r}function Sa(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?Wi(t)?[]:xa(t,this._c):[].concat(n),r],o=ba(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=ba(t,a[e],i);s=qr(n.top,s),c=Kr(n.right,c),l=Kr(n.bottom,l),u=qr(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function Ca(e){let{width:t,height:n}=aa(e);return{width:t,height:n}}function wa(e,t,n){let r=Bi(t),i=Li(t),a=n===`fixed`,o=da(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=Xr(0);if((r||!a)&&((Fi(t)!==`body`||Hi(i))&&(s=ea(t)),r)){let e=da(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=fa(i));let l=i&&!r&&!a?pa(i,s):Xr(0);return{x:o.left+s.scrollLeft-c.x-l.x,y:o.top+s.scrollTop-c.y-l.y,width:o.width,height:o.height}}function Ta(e){return $i(e).position===`static`}function Ea(e,t){if(!Bi(e)||$i(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return Li(e)===n&&(n=n.ownerDocument.body),n}function Da(e,t){let n=Ii(e);if(Wi(e))return n;if(!Bi(e)){let t=ta(e);for(;t&&!Qi(t);){if(zi(t)&&!Ta(t))return t;t=ta(t)}return n}let r=Ea(e,t);for(;r&&Ui(r)&&Ta(r);)r=Ea(r,t);return r&&Qi(r)&&Ta(r)&&!Yi(r)?n:r||Xi(e)||n}var Oa=async function(e){let t=this.getOffsetParent||Da,n=this.getDimensions,r=await n(e.floating);return{reference:wa(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function ka(e){return $i(e).direction===`rtl`}var Aa={convertOffsetParentRelativeRectToViewportRelativeRect:ma,getDocumentElement:Li,getClippingRect:Sa,getOffsetParent:Da,getElementRects:Oa,getClientRects:ha,getDimensions:Ca,getScale:sa,isElement:zi,isRTL:ka};function ja(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Ma(e,t,n){let r=null,i,a=Li(e);function o(){var e;clearTimeout(i),(e=r)==null||e.disconnect(),r=null}function s(n,c){n===void 0&&(n=!1),c===void 0&&(c=1),o();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(n||t(),!f||!p)return;let m=Yr(d),h=Yr(a.clientWidth-(u+f)),g=Yr(a.clientHeight-(d+p)),_=Yr(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:qr(0,Kr(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(!ja(l,e.getBoundingClientRect()))return s();if(n!==c){if(!y)return s();n?s(!1,n):i=setTimeout(()=>{s(!1,1e-7)},1e3)}y=!1}try{r=new IntersectionObserver(b,{...v,root:a.ownerDocument})}catch{r=new IntersectionObserver(b,v)}r.observe(e)}let c=Ii(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function Na(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=oa(e),u=i||a?[...l?ra(l):[],...t?ra(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?Ma(l,n,a):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?da(e):null;c&&g();function g(){let t=da(e);h&&!ja(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var Pa=Ai,Fa=ji,Ia=wi,La=Ni,Ra=Di,za=Ci,Ba=Mi,Va=(e,t,n)=>{let r=new Map,i=n??{},a={...Aa,...i.platform,_c:r};return Si(e,t,{...i,platform:a})},Ha=e(r(),1),Ua=typeof document<`u`?Z.useLayoutEffect:function(){};function Wa(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Wa(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!Wa(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function Ga(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Ka(e,t){let n=Ga(e);return Math.round(t*n)/n}function qa(e){let t=Z.useRef(e);return Ua(()=>{t.current=e}),t}function Ja(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=Z.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=Z.useState(r);Wa(f,r)||p(r);let[m,h]=Z.useState(null),[g,_]=Z.useState(null),v=Z.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=Z.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=Z.useRef(null),C=Z.useRef(null),w=Z.useRef(u),T=c!=null,E=qa(c),D=qa(i),O=qa(l),k=Z.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};D.current&&(e.platform=D.current),Va(S.current,C.current,e).then(e=>{let t={...e,isPositioned:O.current!==!1};A.current&&!Wa(w.current,t)&&(w.current=t,Ha.flushSync(()=>{d(t)}))})},[f,t,n,D,O]);Ua(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let A=Z.useRef(!1);Ua(()=>(A.current=!0,()=>{A.current=!1}),[]),Ua(()=>{if(b&&(S.current=b),x&&(C.current=x),b&&x){if(E.current)return E.current(b,x,k);k()}},[b,x,k,E,T]);let j=Z.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),M=Z.useMemo(()=>({reference:b,floating:x}),[b,x]),N=Z.useMemo(()=>{let e={position:n,left:0,top:0};if(!M.floating)return e;let t=Ka(M.floating,u.x),r=Ka(M.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...Ga(M.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,M.floating,u.x,u.y]);return Z.useMemo(()=>({...u,update:k,refs:j,elements:M,floatingStyles:N}),[u,k,j,M,N])}var Ya=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:za({element:r.current,padding:i}).fn(n):r?za({element:r,padding:i}).fn(n):{}}}},Xa=(e,t)=>{let n=Pa(e);return{name:n.name,fn:n.fn,options:[e,t]}},Za=(e,t)=>{let n=Fa(e);return{name:n.name,fn:n.fn,options:[e,t]}},Qa=(e,t)=>({fn:Ba(e).fn,options:[e,t]}),$a=(e,t)=>{let n=Ia(e);return{name:n.name,fn:n.fn,options:[e,t]}},eo=(e,t)=>{let n=La(e);return{name:n.name,fn:n.fn,options:[e,t]}},to=(e,t)=>{let n=Ra(e);return{name:n.name,fn:n.fn,options:[e,t]}},no=(e,t)=>{let n=Ya(e);return{name:n.name,fn:n.fn,options:[e,t]}},ro=`Arrow`,io=Z.forwardRef((e,t)=>{let{children:n,width:r=10,height:i=5,...a}=e;return(0,Q.jsx)(G.svg,{...a,ref:t,width:r,height:i,viewBox:`0 0 30 10`,preserveAspectRatio:`none`,children:e.asChild?n:(0,Q.jsx)(`polygon`,{points:`0,0 30,0 15,10`})})});io.displayName=ro;var ao=io,oo=`Popper`,[so,co]=ge(oo),[lo,uo]=so(oo),fo=e=>{let{__scopePopper:t,children:n}=e,[r,i]=Z.useState(null),[a,o]=Z.useState(void 0);return(0,Q.jsx)(lo,{scope:t,anchor:r,onAnchorChange:i,placementState:a,setPlacementState:o,children:n})};fo.displayName=oo;var po=`PopperAnchor`,mo=Z.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:r,...i}=e,a=uo(po,n),o=Z.useRef(null),s=a.onAnchorChange,c=h(t,Z.useCallback(e=>{o.current=e,e&&s(e)},[s])),l=Z.useRef(null);Z.useEffect(()=>{if(!r)return;let e=l.current;l.current=r.current,e!==l.current&&s(l.current)});let u=a.placementState&&wo(a.placementState),d=u?.[0],f=u?.[1];return r?null:(0,Q.jsx)(G.div,{"data-radix-popper-side":d,"data-radix-popper-align":f,...i,ref:c})});mo.displayName=po;var ho=`PopperContent`,[go,_o]=so(ho),vo=Z.forwardRef((e,t)=>{let{__scopePopper:n,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,arrowPadding:s=0,avoidCollisions:c=!0,collisionBoundary:l=[],collisionPadding:u=0,sticky:d=`partial`,hideWhenDetached:f=!1,updatePositionStrategy:p=`optimized`,onPlaced:m,...g}=e,_=uo(ho,n),[v,y]=Z.useState(null),b=h(t,y),[x,S]=Z.useState(null),C=Wr(x),w=C?.width??0,T=C?.height??0,E=r+(a===`center`?``:`-`+a),D=typeof u==`number`?u:{top:0,right:0,bottom:0,left:0,...u},O=Array.isArray(l)?l:[l],k=O.length>0,A={padding:D,boundary:O.filter(So),altBoundary:k},{refs:j,floatingStyles:M,placement:N,isPositioned:ee,middlewareData:P}=Ja({strategy:`fixed`,placement:E,whileElementsMounted:(...e)=>Na(...e,{animationFrame:p===`always`}),elements:{reference:_.anchor},middleware:[Xa({mainAxis:i+T,alignmentAxis:o}),c&&Za({mainAxis:!0,crossAxis:!1,limiter:d===`partial`?Qa():void 0,...A}),c&&$a({...A}),eo({...A,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)}}),x&&no({element:x,padding:s}),Co({arrowWidth:w,arrowHeight:T}),f&&to({strategy:`referenceHidden`,...A,boundary:k?A.boundary:void 0})]}),te=_.setPlacementState;nt(()=>(te(N),()=>{te(void 0)}),[N,te]);let[ne,F]=wo(N),re=Re(m);nt(()=>{ee&&re?.()},[ee,re]);let ie=P.arrow?.x,I=P.arrow?.y,L=P.arrow?.centerOffset!==0,[R,z]=Z.useState();return nt(()=>{v&&z(window.getComputedStyle(v).zIndex)},[v]),(0,Q.jsx)(`div`,{ref:j.setFloating,"data-radix-popper-content-wrapper":``,style:{...M,transform:ee?M.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:R,"--radix-popper-transform-origin":[P.transformOrigin?.x,P.transformOrigin?.y].join(` `),...P.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,Q.jsx)(go,{scope:n,placedSide:ne,placedAlign:F,onArrowChange:S,arrowX:ie,arrowY:I,shouldHideArrow:L,children:(0,Q.jsx)(G.div,{"data-side":ne,"data-align":F,...g,ref:b,style:{...g.style,animation:ee?void 0:`none`}})})})});vo.displayName=ho;var yo=`PopperArrow`,bo={top:`bottom`,right:`left`,bottom:`top`,left:`right`},xo=Z.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=_o(yo,n),a=bo[i.placedSide];return(0,Q.jsx)(`span`,{ref:i.onArrowChange,style:{position:`absolute`,left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:``,right:`0 0`,bottom:`center 0`,left:`100% 0`}[i.placedSide],transform:{top:`translateY(100%)`,right:`translateY(50%) rotate(90deg) translateX(-50%)`,bottom:`rotate(180deg)`,left:`translateY(50%) rotate(-90deg) translateX(50%)`}[i.placedSide],visibility:i.shouldHideArrow?`hidden`:void 0},children:(0,Q.jsx)(ao,{...r,ref:t,style:{...r.style,display:`block`}})})});xo.displayName=yo;function So(e){return e!==null}var Co=e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=wo(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}});function wo(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var To=fo,Eo=mo,Do=vo,Oo=xo,ko=!1;function Ao(){let[e,t]=Z.useState(ko);return Z.useEffect(()=>{ko||(ko=!0,t(!0))},[]),e}var jo=Z.useSyncExternalStore;function Mo(){return()=>{}}function No(){return jo(Mo,()=>!0,()=>!1)}var Po=typeof jo==`function`?No:Ao,Fo=`rovingFocusGroup.onEntryFocus`,Io={bubbles:!1,cancelable:!0},Lo=`RovingFocusGroup`,[Ro,zo,Bo]=lr(Lo),[Vo,Ho]=ge(Lo,[Bo]),[Uo,Wo]=Vo(Lo),Go=Z.forwardRef((e,t)=>(0,Q.jsx)(Ro.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,Q.jsx)(Ro.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,Q.jsx)(Ko,{...e,ref:t})})}));Go.displayName=Lo;var Ko=Z.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:a,currentTabStopId:o,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:c,onEntryFocus:l,preventScrollOnEntryFocus:u=!1,...d}=e,f=Z.useRef(null),p=h(t,f),m=dr(a),[g,_]=V({prop:o,defaultProp:s??null,onChange:c,caller:Lo}),[v,y]=Z.useState(!1),b=Re(l),x=zo(n),S=Z.useRef(!1),[C,w]=Z.useState(0);return Z.useEffect(()=>{let e=f.current;if(e)return e.addEventListener(Fo,b),()=>e.removeEventListener(Fo,b)},[b]),(0,Q.jsx)(Uo,{scope:n,orientation:r,dir:m,loop:i,currentTabStopId:g,onItemFocus:Z.useCallback(e=>_(e),[_]),onItemShiftTab:Z.useCallback(()=>y(!0),[]),onFocusableItemAdd:Z.useCallback(()=>w(e=>e+1),[]),onFocusableItemRemove:Z.useCallback(()=>w(e=>e-1),[]),children:(0,Q.jsx)(G.div,{tabIndex:v||C===0?-1:0,"data-orientation":r,...d,ref:p,style:{outline:`none`,...e.style},onMouseDown:K(e.onMouseDown,()=>{S.current=!0}),onFocus:K(e.onFocus,e=>{let t=!S.current;if(e.target===e.currentTarget&&t&&!v){let t=new CustomEvent(Fo,Io);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=x().filter(e=>e.focusable);Qo([e.find(e=>e.active),e.find(e=>e.id===g),...e].filter(Boolean).map(e=>e.ref.current),u)}}S.current=!1}),onBlur:K(e.onBlur,()=>y(!1))})})}),qo=`RovingFocusGroupItem`,Jo=Z.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...s}=e,c=Oe(),l=a||c,u=Wo(qo,n),d=u.currentTabStopId===l,f=zo(n),{onFocusableItemAdd:p,onFocusableItemRemove:m,currentTabStopId:h}=u,g=Po();return nt(()=>{if(!(!g||!r))return p(),()=>m()},[g,r,p,m]),Z.useEffect(()=>{if(!(g||!r))return p(),()=>m()},[g,r,p,m]),(0,Q.jsx)(Ro.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:(0,Q.jsx)(G.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:t,onMouseDown:K(e.onMouseDown,e=>{r?u.onItemFocus(l):e.preventDefault()}),onFocus:K(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:K(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){u.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=Zo(e,u.orientation,u.dir);if(t!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=f().filter(e=>e.focusable).map(e=>e.ref.current);if(t===`last`)n.reverse();else if(t===`prev`||t===`next`){t===`prev`&&n.reverse();let r=n.indexOf(e.currentTarget);n=u.loop?$o(n,r+1):n.slice(r+1)}setTimeout(()=>Qo(n))}}),children:typeof o==`function`?o({isCurrentTabStop:d,hasTabStop:h!=null}):o})})});Jo.displayName=qo;var Yo={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function Xo(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}function Zo(e,t,n){let r=Xo(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return Yo[r]}function Qo(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function $o(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var es=Go,ts=Jo,ns=[`Enter`,` `],rs=[`ArrowDown`,`PageUp`,`Home`],is=[`ArrowUp`,`PageDown`,`End`],as=[...rs,...is],os={ltr:[...ns,`ArrowRight`],rtl:[...ns,`ArrowLeft`]},ss={ltr:[`ArrowLeft`],rtl:[`ArrowRight`]},cs=`Menu`,[ls,us,ds]=lr(cs),[fs,ps]=ge(cs,[ds,co,Ho]),ms=co(),hs=Ho(),[gs,_s]=fs(cs),[vs,ys]=fs(cs),bs=e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=ms(t),[c,l]=Z.useState(null),u=Z.useRef(!1),d=Re(a),f=dr(i);return Z.useEffect(()=>{let e=()=>{u.current=!0,document.addEventListener(`pointerdown`,t,{capture:!0,once:!0}),document.addEventListener(`pointermove`,t,{capture:!0,once:!0})},t=()=>u.current=!1;return document.addEventListener(`keydown`,e,{capture:!0}),()=>{document.removeEventListener(`keydown`,e,{capture:!0}),document.removeEventListener(`pointerdown`,t,{capture:!0}),document.removeEventListener(`pointermove`,t,{capture:!0})}},[]),Z.useEffect(()=>{if(!n)return;let e=()=>d(!1);return window.addEventListener(`blur`,e),()=>window.removeEventListener(`blur`,e)},[n,d]),(0,Q.jsx)(To,{...s,children:(0,Q.jsx)(gs,{scope:t,open:n,onOpenChange:d,content:c,onContentChange:l,children:(0,Q.jsx)(vs,{scope:t,onClose:Z.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:o,children:r})})})};bs.displayName=cs;var xs=`MenuAnchor`,Ss=Z.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=ms(n);return(0,Q.jsx)(Eo,{...i,...r,ref:t})});Ss.displayName=xs;var Cs=`MenuPortal`,[ws,Ts]=fs(Cs,{forceMount:void 0}),Es=e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=_s(Cs,t);return(0,Q.jsx)(ws,{scope:t,forceMount:n,children:(0,Q.jsx)(Ee,{present:n||a.open,children:(0,Q.jsx)(et,{asChild:!0,container:i,children:r})})})};Es.displayName=Cs;var Ds=`MenuContent`,[Os,ks]=fs(Ds),As=Z.forwardRef((e,t)=>{let n=Ts(Ds,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=_s(Ds,e.__scopeMenu),o=ys(Ds,e.__scopeMenu);return(0,Q.jsx)(ls.Provider,{scope:e.__scopeMenu,children:(0,Q.jsx)(Ee,{present:r||a.open,children:(0,Q.jsx)(ls.Slot,{scope:e.__scopeMenu,children:o.modal?(0,Q.jsx)(js,{...i,ref:t}):(0,Q.jsx)(Ms,{...i,ref:t})})})})}),js=Z.forwardRef((e,t)=>{let n=_s(Ds,e.__scopeMenu),r=Z.useRef(null),i=h(t,r);return Z.useEffect(()=>{let e=r.current;if(e)return Ze(e)},[]),(0,Q.jsx)(Ps,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:K(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),Ms=Z.forwardRef((e,t)=>{let n=_s(Ds,e.__scopeMenu);return(0,Q.jsx)(Ps,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),Ns=at(`MenuContent.ScrollLock`),Ps=Z.forwardRef((e,t)=>{let{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:a,onCloseAutoFocus:o,disableOutsidePointerEvents:s,onEntryFocus:c,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,disableOutsideScroll:m,...g}=e,_=_s(Ds,n),v=ys(Ds,n),y=ms(n),b=hs(n),x=us(n),[S,C]=Z.useState(null),w=Z.useRef(null),T=h(t,w,_.onContentChange),E=Z.useRef(0),D=Z.useRef(``),O=Z.useRef(0),k=Z.useRef(null),A=Z.useRef(`right`),j=Z.useRef(0),M=m?ye:Z.Fragment,N=m?{as:Ns,allowPinchZoom:!0}:void 0,ee=e=>{let t=D.current+e,n=x().filter(e=>!e.disabled),r=document.activeElement,i=n.find(e=>e.ref.current===r)?.textValue,a=vc(n.map(e=>e.textValue),t,i),o=n.find(e=>e.textValue===a)?.ref.current;(function e(t){D.current=t,window.clearTimeout(E.current),t!==``&&(E.current=window.setTimeout(()=>e(``),1e3))})(t),o&&setTimeout(()=>o.focus())};Z.useEffect(()=>()=>window.clearTimeout(E.current),[]),Le();let P=Z.useCallback(e=>A.current===k.current?.side&&bc(e,k.current?.area),[]);return(0,Q.jsx)(Os,{scope:n,searchRef:D,onItemEnter:Z.useCallback(e=>{P(e)&&e.preventDefault()},[P]),onItemLeave:Z.useCallback(e=>{P(e)||(w.current?.focus(),C(null))},[P]),onTriggerLeave:Z.useCallback(e=>{P(e)&&e.preventDefault()},[P]),pointerGraceTimerRef:O,onPointerGraceIntentChange:Z.useCallback(e=>{k.current=e},[]),children:(0,Q.jsx)(M,{...N,children:(0,Q.jsx)(xe,{asChild:!0,trapped:i,onMountAutoFocus:K(a,e=>{e.preventDefault(),w.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:(0,Q.jsx)(Te,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,children:(0,Q.jsx)(es,{asChild:!0,...b,dir:v.dir,orientation:`vertical`,loop:r,currentTabStopId:S,onCurrentTabStopIdChange:C,onEntryFocus:K(c,e=>{v.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,Q.jsx)(Do,{role:`menu`,"aria-orientation":`vertical`,"data-state":pc(_.open),"data-radix-menu-content":``,dir:v.dir,...y,...g,ref:T,style:{outline:`none`,...g.style},onKeyDown:K(g.onKeyDown,e=>{let t=e.target.closest(`[data-radix-menu-content]`)===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=e.key.length===1;t&&(e.key===`Tab`&&e.preventDefault(),!n&&r&&ee(e.key));let i=w.current;if(e.target!==i||!as.includes(e.key))return;e.preventDefault();let a=x().filter(e=>!e.disabled).map(e=>e.ref.current);is.includes(e.key)&&a.reverse(),gc(a)}),onBlur:K(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(E.current),D.current=``)}),onPointerMove:K(e.onPointerMove,xc(e=>{let t=e.target,n=j.current!==e.clientX;if(e.currentTarget.contains(t)&&n){let t=e.clientX>j.current?`right`:`left`;A.current=t,j.current=e.clientX}}))})})})})})})});As.displayName=Ds;var Fs=`MenuGroup`,Is=Z.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,Q.jsx)(G.div,{role:`group`,...r,ref:t})});Is.displayName=Fs;var Ls=`MenuLabel`,Rs=Z.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,Q.jsx)(G.div,{...r,ref:t})});Rs.displayName=Ls;var zs=`MenuItem`,Bs=`menu.itemSelect`,Vs=Z.forwardRef((e,t)=>{let{disabled:n=!1,onSelect:r,...i}=e,a=Z.useRef(null),o=ys(zs,e.__scopeMenu),s=ks(zs,e.__scopeMenu),c=h(t,a),l=Z.useRef(!1),u=()=>{let e=a.current;if(!n&&e){let t=new CustomEvent(Bs,{bubbles:!0,cancelable:!0});e.addEventListener(Bs,e=>r?.(e),{once:!0}),F(e,t),t.defaultPrevented?l.current=!1:o.onClose()}};return(0,Q.jsx)(Hs,{...i,ref:c,disabled:n,onClick:K(e.onClick,u),onPointerDown:t=>{e.onPointerDown?.(t),l.current=!0},onPointerUp:K(e.onPointerUp,e=>{l.current||e.currentTarget?.click()}),onKeyDown:K(e.onKeyDown,e=>{n||e.target!==e.currentTarget||s.searchRef.current!==``&&e.key===` `||ns.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})});Vs.displayName=zs;var Hs=Z.forwardRef((e,t)=>{let{__scopeMenu:n,disabled:r=!1,textValue:i,...a}=e,o=ks(zs,n),s=hs(n),c=Z.useRef(null),l=h(t,c),[u,d]=Z.useState(!1),[f,p]=Z.useState(``);return Z.useEffect(()=>{let e=c.current;e&&p((e.textContent??``).trim())},[a.children]),(0,Q.jsx)(ls.ItemSlot,{scope:n,disabled:r,textValue:i??f,children:(0,Q.jsx)(ts,{asChild:!0,...s,focusable:!r,children:(0,Q.jsx)(G.div,{role:`menuitem`,"data-highlighted":u?``:void 0,"aria-disabled":r||void 0,"data-disabled":r?``:void 0,...a,ref:l,onPointerMove:K(e.onPointerMove,xc(e=>{r?o.onItemLeave(e):(o.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:K(e.onPointerLeave,xc(e=>o.onItemLeave(e))),onFocus:K(e.onFocus,()=>d(!0)),onBlur:K(e.onBlur,()=>d(!1))})})})}),Us=`MenuCheckboxItem`,Ws=Z.forwardRef((e,t)=>{let{checked:n=!1,onCheckedChange:r,...i}=e;return(0,Q.jsx)(Qs,{scope:e.__scopeMenu,checked:n,children:(0,Q.jsx)(Vs,{role:`menuitemcheckbox`,"aria-checked":mc(n)?`mixed`:n,...i,ref:t,"data-state":hc(n),onSelect:K(i.onSelect,()=>r?.(mc(n)?!0:!n),{checkForDefaultPrevented:!1})})})});Ws.displayName=Us;var Gs=`MenuRadioGroup`,[Ks,qs]=fs(Gs,{value:void 0,onValueChange:()=>{}}),Js=Z.forwardRef((e,t)=>{let{value:n,onValueChange:r,...i}=e,a=Re(r);return(0,Q.jsx)(Ks,{scope:e.__scopeMenu,value:n,onValueChange:a,children:(0,Q.jsx)(Is,{...i,ref:t})})});Js.displayName=Gs;var Ys=`MenuRadioItem`,Xs=Z.forwardRef((e,t)=>{let{value:n,...r}=e,i=qs(Ys,e.__scopeMenu),a=n===i.value;return(0,Q.jsx)(Qs,{scope:e.__scopeMenu,checked:a,children:(0,Q.jsx)(Vs,{role:`menuitemradio`,"aria-checked":a,...r,ref:t,"data-state":hc(a),onSelect:K(r.onSelect,()=>i.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});Xs.displayName=Ys;var Zs=`MenuItemIndicator`,[Qs,$s]=fs(Zs,{checked:!1}),ec=Z.forwardRef((e,t)=>{let{__scopeMenu:n,forceMount:r,...i}=e,a=$s(Zs,n);return(0,Q.jsx)(Ee,{present:r||mc(a.checked)||a.checked===!0,children:(0,Q.jsx)(G.span,{...i,ref:t,"data-state":hc(a.checked)})})});ec.displayName=Zs;var tc=`MenuSeparator`,nc=Z.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,Q.jsx)(G.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})});nc.displayName=tc;var rc=`MenuArrow`,ic=Z.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=ms(n);return(0,Q.jsx)(Oo,{...i,...r,ref:t})});ic.displayName=rc;var ac=`MenuSub`,[oc,sc]=fs(ac),cc=e=>{let{__scopeMenu:t,children:n,open:r=!1,onOpenChange:i}=e,a=_s(ac,t),o=ms(t),[s,c]=Z.useState(null),[l,u]=Z.useState(null),d=Re(i);return Z.useEffect(()=>(a.open===!1&&d(!1),()=>d(!1)),[a.open,d]),(0,Q.jsx)(To,{...o,children:(0,Q.jsx)(gs,{scope:t,open:r,onOpenChange:d,content:l,onContentChange:u,children:(0,Q.jsx)(oc,{scope:t,contentId:Oe(),triggerId:Oe(),trigger:s,onTriggerChange:c,children:n})})})};cc.displayName=ac;var lc=`MenuSubTrigger`,uc=Z.forwardRef((e,t)=>{let n=_s(lc,e.__scopeMenu),r=ys(lc,e.__scopeMenu),i=sc(lc,e.__scopeMenu),a=ks(lc,e.__scopeMenu),o=Z.useRef(null),{pointerGraceTimerRef:s,onPointerGraceIntentChange:c}=a,l={__scopeMenu:e.__scopeMenu},u=Z.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);Z.useEffect(()=>u,[u]),Z.useEffect(()=>{let e=s.current;return()=>{window.clearTimeout(e),c(null)}},[s,c]);let d=h(t,i.onTriggerChange);return(0,Q.jsx)(Ss,{asChild:!0,...l,children:(0,Q.jsx)(Hs,{id:i.triggerId,"aria-haspopup":`menu`,"aria-expanded":n.open,"aria-controls":n.open?i.contentId:void 0,"data-state":pc(n.open),...e,ref:d,onClick:t=>{e.onClick?.(t),!(e.disabled||t.defaultPrevented)&&(t.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:K(e.onPointerMove,xc(t=>{a.onItemEnter(t),!t.defaultPrevented&&!e.disabled&&!n.open&&!o.current&&(a.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{n.onOpenChange(!0),u()},100))})),onPointerLeave:K(e.onPointerLeave,xc(e=>{u();let t=n.content?.getBoundingClientRect();if(t){let r=n.content?.dataset.side,i=r===`right`,o=i?-5:5,c=t[i?`left`:`right`],l=t[i?`right`:`left`];a.onPointerGraceIntentChange({area:[{x:e.clientX+o,y:e.clientY},{x:c,y:t.top},{x:l,y:t.top},{x:l,y:t.bottom},{x:c,y:t.bottom}],side:r}),window.clearTimeout(s.current),s.current=window.setTimeout(()=>a.onPointerGraceIntentChange(null),300)}else{if(a.onTriggerLeave(e),e.defaultPrevented)return;a.onPointerGraceIntentChange(null)}})),onKeyDown:K(e.onKeyDown,t=>{e.disabled||t.target!==t.currentTarget||a.searchRef.current!==``&&t.key===` `||os[r.dir].includes(t.key)&&(n.onOpenChange(!0),n.content?.focus(),t.preventDefault())})})})});uc.displayName=lc;var dc=`MenuSubContent`,fc=Z.forwardRef((e,t)=>{let n=Ts(Ds,e.__scopeMenu),{forceMount:r=n.forceMount,align:i=`start`,...a}=e,o=_s(Ds,e.__scopeMenu),s=ys(Ds,e.__scopeMenu),c=sc(dc,e.__scopeMenu),l=Z.useRef(null),u=h(t,l);return(0,Q.jsx)(ls.Provider,{scope:e.__scopeMenu,children:(0,Q.jsx)(Ee,{present:r||o.open,children:(0,Q.jsx)(ls.Slot,{scope:e.__scopeMenu,children:(0,Q.jsx)(Ps,{id:c.contentId,"aria-labelledby":c.triggerId,...a,ref:u,align:i,side:s.dir===`rtl`?`left`:`right`,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{s.isUsingKeyboardRef.current&&l.current?.focus(),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:K(e.onFocusOutside,e=>{e.target!==c.trigger&&o.onOpenChange(!1)}),onEscapeKeyDown:K(e.onEscapeKeyDown,e=>{s.onClose(),e.preventDefault()}),onKeyDown:K(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),n=ss[s.dir].includes(e.key);t&&n&&(o.onOpenChange(!1),c.trigger?.focus(),e.preventDefault())})})})})})});fc.displayName=dc;function pc(e){return e?`open`:`closed`}function mc(e){return e===`indeterminate`}function hc(e){return mc(e)?`indeterminate`:e?`checked`:`unchecked`}function gc(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function _c(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function vc(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=_c(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function yc(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function bc(e,t){return t?yc({x:e.clientX,y:e.clientY},t):!1}function xc(e){return t=>t.pointerType===`mouse`?e(t):void 0}var Sc=bs,Cc=Ss,wc=Es,Tc=As,Ec=Is,Dc=Rs,Oc=Vs,kc=Ws,Ac=Js,jc=Xs,Mc=ec,Nc=nc,Pc=ic,Fc=uc,Ic=fc,Lc=`DropdownMenu`,[Rc,zc]=ge(Lc,[ps]),$=ps(),[Bc,Vc]=Rc(Lc),Hc=e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=$(t),l=Z.useRef(null),[u,d]=V({prop:i,defaultProp:a??!1,onChange:o,caller:Lc});return(0,Q.jsx)(Bc,{scope:t,triggerId:Oe(),triggerRef:l,contentId:Oe(),open:u,onOpenChange:d,onOpenToggle:Z.useCallback(()=>d(e=>!e),[d]),modal:s,children:(0,Q.jsx)(Sc,{...c,open:u,onOpenChange:d,dir:r,modal:s,children:n})})};Hc.displayName=Lc;var Uc=`DropdownMenuTrigger`,Wc=Z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,a=Vc(Uc,n),o=$(n),s=h(t,a.triggerRef);return(0,Q.jsx)(Cc,{asChild:!0,...o,children:(0,Q.jsx)(G.button,{type:`button`,id:a.triggerId,"aria-haspopup":`menu`,"aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,disabled:r,...i,ref:s,onPointerDown:K(e.onPointerDown,e=>{!r&&e.button===0&&e.ctrlKey===!1&&(a.onOpenToggle(),a.open||e.preventDefault())}),onKeyDown:K(e.onKeyDown,e=>{r||([`Enter`,` `].includes(e.key)&&a.onOpenToggle(),e.key===`ArrowDown`&&a.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})});Wc.displayName=Uc;var Gc=`DropdownMenuPortal`,Kc=e=>{let{__scopeDropdownMenu:t,...n}=e,r=$(t);return(0,Q.jsx)(wc,{...r,...n})};Kc.displayName=Gc;var qc=`DropdownMenuContent`,Jc=Z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Vc(qc,n),a=$(n),o=Z.useRef(!1);return(0,Q.jsx)(Tc,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:K(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:K(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;(!i.modal||r)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});Jc.displayName=qc;var Yc=`DropdownMenuGroup`,Xc=Z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,Q.jsx)(Ec,{...i,...r,ref:t})});Xc.displayName=Yc;var Zc=`DropdownMenuLabel`,Qc=Z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,Q.jsx)(Dc,{...i,...r,ref:t})});Qc.displayName=Zc;var $c=`DropdownMenuItem`,el=Z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,Q.jsx)(Oc,{...i,...r,ref:t})});el.displayName=$c;var tl=`DropdownMenuCheckboxItem`,nl=Z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,Q.jsx)(kc,{...i,...r,ref:t})});nl.displayName=tl;var rl=`DropdownMenuRadioGroup`,il=Z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,Q.jsx)(Ac,{...i,...r,ref:t})});il.displayName=rl;var al=`DropdownMenuRadioItem`,ol=Z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,Q.jsx)(jc,{...i,...r,ref:t})});ol.displayName=al;var sl=`DropdownMenuItemIndicator`,cl=Z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,Q.jsx)(Mc,{...i,...r,ref:t})});cl.displayName=sl;var ll=`DropdownMenuSeparator`,ul=Z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,Q.jsx)(Nc,{...i,...r,ref:t})});ul.displayName=ll;var dl=`DropdownMenuArrow`,fl=Z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,Q.jsx)(Pc,{...i,...r,ref:t})});fl.displayName=dl;var pl=`DropdownMenuSubTrigger`,ml=Z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,Q.jsx)(Fc,{...i,...r,ref:t})});ml.displayName=pl;var hl=`DropdownMenuSubContent`,gl=Z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,Q.jsx)(Ic,{...i,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});gl.displayName=hl;var _l=Hc,vl=Wc,yl=Kc,bl=Jc,xl=Qc,Sl=el,Cl=il,wl=ol,Tl=cl,El=ul,Dl=`Label`,Ol=Z.forwardRef((e,t)=>(0,Q.jsx)(G.label,{...e,ref:t,onMouseDown:t=>{t.target.closest(`button, input, select, textarea`)||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));Ol.displayName=Dl;var kl=Ol,Al=`Popover`,[jl,Ml]=ge(Al,[co]),Nl=co(),[Pl,Fl]=jl(Al),Il=e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=Nl(t),c=Z.useRef(null),[l,u]=Z.useState(!1),[d,f]=V({prop:r,defaultProp:i??!1,onChange:a,caller:Al});return(0,Q.jsx)(To,{...s,children:(0,Q.jsx)(Pl,{scope:t,contentId:Oe(),triggerRef:c,open:d,onOpenChange:f,onOpenToggle:Z.useCallback(()=>f(e=>!e),[f]),hasCustomAnchor:l,onCustomAnchorAdd:Z.useCallback(()=>u(!0),[]),onCustomAnchorRemove:Z.useCallback(()=>u(!1),[]),modal:o,children:n})})};Il.displayName=Al;var Ll=`PopoverAnchor`,Rl=Z.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=Fl(Ll,n),a=Nl(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:s}=i;return Z.useEffect(()=>(o(),()=>s()),[o,s]),(0,Q.jsx)(Eo,{...a,...r,ref:t})});Rl.displayName=Ll;var zl=`PopoverTrigger`,Bl=Z.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=Fl(zl,n),a=Nl(n),o=h(t,i.triggerRef),s=(0,Q.jsx)(G.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":tu(i.open),...r,ref:o,onClick:K(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?s:(0,Q.jsx)(Eo,{asChild:!0,...a,children:s})});Bl.displayName=zl;var Vl=`PopoverPortal`,[Hl,Ul]=jl(Vl,{forceMount:void 0}),Wl=e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=Fl(Vl,t);return(0,Q.jsx)(Hl,{scope:t,forceMount:n,children:(0,Q.jsx)(Ee,{present:n||a.open,children:(0,Q.jsx)(et,{asChild:!0,container:i,children:r})})})};Wl.displayName=Vl;var Gl=`PopoverContent`,Kl=Z.forwardRef((e,t)=>{let n=Ul(Gl,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=Fl(Gl,e.__scopePopover);return(0,Q.jsx)(Ee,{present:r||a.open,children:a.modal?(0,Q.jsx)(Jl,{...i,ref:t}):(0,Q.jsx)(Yl,{...i,ref:t})})});Kl.displayName=Gl;var ql=at(`PopoverContent.RemoveScroll`),Jl=Z.forwardRef((e,t)=>{let n=Fl(Gl,e.__scopePopover),r=Z.useRef(null),i=h(t,r),a=Z.useRef(!1);return Z.useEffect(()=>{let e=r.current;if(e)return Ze(e)},[]),(0,Q.jsx)(ye,{as:ql,allowPinchZoom:!0,children:(0,Q.jsx)(Xl,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:K(e.onCloseAutoFocus,e=>{e.preventDefault(),a.current||n.triggerRef.current?.focus()}),onPointerDownOutside:K(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;a.current=r},{checkForDefaultPrevented:!1}),onFocusOutside:K(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),Yl=Z.forwardRef((e,t)=>{let n=Fl(Gl,e.__scopePopover),r=Z.useRef(!1),i=Z.useRef(!1);return(0,Q.jsx)(Xl,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),Xl=Z.forwardRef((e,t)=>{let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:u,...d}=e,f=Fl(Gl,n),p=Nl(n);return Le(),(0,Q.jsx)(xe,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,Q.jsx)(Te,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>f.onOpenChange(!1),deferPointerDownOutside:!0,children:(0,Q.jsx)(Do,{"data-state":tu(f.open),role:`dialog`,id:f.contentId,...p,...d,ref:t,style:{...d.style,"--radix-popover-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-popover-content-available-width":`var(--radix-popper-available-width)`,"--radix-popover-content-available-height":`var(--radix-popper-available-height)`,"--radix-popover-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-popover-trigger-height":`var(--radix-popper-anchor-height)`}})})})}),Zl=`PopoverClose`,Ql=Z.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=Fl(Zl,n);return(0,Q.jsx)(G.button,{type:`button`,...r,ref:t,onClick:K(e.onClick,()=>i.onOpenChange(!1))})});Ql.displayName=Zl;var $l=`PopoverArrow`,eu=Z.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=Nl(n);return(0,Q.jsx)(Oo,{...i,...r,ref:t})});eu.displayName=$l;function tu(e){return e?`open`:`closed`}var nu=Il,ru=Rl,iu=Bl,au=Wl,ou=Kl,su=`Switch`,[cu,lu]=ge(su),[uu,du]=cu(su);function fu(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]=V({prop:n,defaultProp:i??!1,onChange:c,caller:su}),[m,h]=Z.useState(null),[g,_]=Z.useState(null),v={checked:f,setChecked:p,disabled:a,control:m,setControl:h,name:s,form:o,value:u,hasConsumerStoppedPropagationRef:Z.useRef(!1),required:l,defaultChecked:i,isFormControl:!m||!!o||!!m.closest(`form`),bubbleInput:g,setBubbleInput:_};return(0,Q.jsx)(uu,{scope:t,...v,children:bu(d)?d(v):r})}var pu=`SwitchTrigger`,mu=Z.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}=du(pu,e),g=h(r,u),_=Z.useRef(c);return Z.useEffect(()=>{let e=a?i?.ownerDocument.getElementById(a):i?.form;if(e instanceof HTMLFormElement){let t=()=>d(_.current);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[i,a,d]),(0,Q.jsx)(G.button,{type:`button`,role:`switch`,"aria-checked":c,"aria-required":l,"data-state":xu(c),"data-disabled":s?``:void 0,disabled:s,value:o,...n,ref:g,onClick:K(t,e=>{d(e=>!e),m&&p&&(f.current=e.isPropagationStopped(),f.current||e.stopPropagation())})})});mu.displayName=pu;var hu=Z.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,Q.jsx)(fu,{__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,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(mu,{...d,ref:t,__scopeSwitch:n}),e&&(0,Q.jsx)(yu,{__scopeSwitch:n})]})})});hu.displayName=su;var gu=`SwitchThumb`,_u=Z.forwardRef((e,t)=>{let{__scopeSwitch:n,...r}=e,i=du(gu,n);return(0,Q.jsx)(G.span,{"data-state":xu(i.checked),"data-disabled":i.disabled?``:void 0,...r,ref:t})});_u.displayName=gu;var vu=`SwitchBubbleInput`,yu=Z.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}=du(vu,e),m=h(n,p),g=Ur(a),_=Wr(r);Z.useEffect(()=>{let e=f;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set,r=!i.current;if(g!==a&&n){let t=new Event(`click`,{bubbles:r});n.call(e,a),e.dispatchEvent(t)}},[f,g,a,i]);let v=Z.useRef(a);return(0,Q.jsx)(G.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:o??v.current,required:s,disabled:c,name:l,value:u,form:d,...t,tabIndex:-1,ref:m,style:{...t.style,..._,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})});yu.displayName=vu;function bu(e){return typeof e==`function`}function xu(e){return e?`checked`:`unchecked`}var Su=f(`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 Cu({className:e,variant:t=`default`,asChild:n=!1,...r}){return(0,Q.jsx)(n?l:`span`,{"data-slot":`badge`,"data-variant":t,className:Y(Su({variant:t}),e),...r})}function wu({...e}){return(0,Q.jsx)(Ot,{"data-slot":`dialog`,...e})}function Tu({...e}){return(0,Q.jsx)(Tt,{"data-slot":`dialog-portal`,...e})}function Eu({...e}){return(0,Q.jsx)(wt,{"data-slot":`dialog-close`,...e})}function Du({className:e,...t}){return(0,Q.jsx)(bt,{"data-slot":`dialog-overlay`,className:Y(`fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0`,e),...t})}function Ou({className:e,children:t,showCloseButton:n=!0,...r}){return(0,Q.jsxs)(Tu,{"data-slot":`dialog-portal`,children:[(0,Q.jsx)(Du,{}),(0,Q.jsxs)(Et,{"data-slot":`dialog-content`,className:Y(`fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border bg-card p-6 shadow-modal duration-200 outline-none 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 sm:max-w-lg`,e),...r,children:[t,n&&(0,Q.jsxs)(wt,{"data-slot":`dialog-close`,className:`absolute top-4 right-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,children:[(0,Q.jsx)(vt,{}),(0,Q.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function ku({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`dialog-header`,className:Y(`flex flex-col gap-2 text-center sm:text-left`,e),...t})}function Au({className:e,showCloseButton:t=!1,children:n,...r}){return(0,Q.jsxs)(`div`,{"data-slot":`dialog-footer`,className:Y(`flex flex-col-reverse gap-2 sm:flex-row sm:justify-end`,e),...r,children:[n,t&&(0,Q.jsx)(wt,{asChild:!0,children:(0,Q.jsx)(H,{variant:`outline`,children:`Close`})})]})}function ju({className:e,...t}){return(0,Q.jsx)(Dt,{"data-slot":`dialog-title`,className:Y(`text-lg leading-none font-semibold`,e),...t})}function Mu({className:e,...t}){return(0,Q.jsx)(St,{"data-slot":`dialog-description`,className:Y(`text-sm text-muted-foreground`,e),...t})}function Nu({open:e,onOpenChange:t}){let[n,r]=(0,Z.useState)(null),[i,a]=(0,Z.useState)(null),o=T(n),s=ce(),c=we(),l=Fe(),u=new Set((s.data?.projects??[]).map(e=>e.root)),d=e=>{r(e),a(null),c.reset()},f=i?.path??o.data?.path??null,p=o.data?.parent??null;return(0,Q.jsx)(wu,{open:e,onOpenChange:t,children:(0,Q.jsxs)(Ou,{"data-slot":`add-project-dialog`,className:`sm:max-w-lg`,children:[(0,Q.jsxs)(ku,{children:[(0,Q.jsx)(ju,{children:`Open local folder`}),(0,Q.jsx)(Mu,{children:`Pick the folder cezar should run in. Git repos are marked; any folder works.`})]}),(0,Q.jsx)(`p`,{"data-slot":`fs-breadcrumb`,className:`truncate font-mono text-[11.5px] text-soft-foreground`,title:o.data?.path??void 0,children:o.data?.path??(o.isError?``:`Loading…`)}),o.isError?(0,Q.jsx)(`p`,{"data-slot":`fs-error`,className:`min-w-0 break-words text-[13px] text-danger`,children:o.error instanceof Error?o.error.message:`could not list that folder`}):(0,Q.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:[p===null?null:(0,Q.jsx)(`li`,{className:`flex`,children:(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`fs-up`,onClick:()=>d(p),className:`flex flex-1 items-center gap-2 px-3 py-2 text-left text-[13px] hover:bg-muted`,children:[(0,Q.jsx)(An,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),`Up one level`]})}),(o.data?.dirs??[]).map(e=>(0,Q.jsxs)(`li`,{className:`flex items-stretch`,children:[(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`fs-dir`,"aria-pressed":i?.path===e.path,onClick:()=>a(e),onDoubleClick:()=>d(e.path),className:Y(`flex min-w-0 flex-1 items-center gap-2 px-3 py-2 text-left text-[13px] hover:bg-muted`,i?.path===e.path&&`bg-muted`),children:[(0,Q.jsx)(In,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),(0,Q.jsx)(`span`,{className:`truncate`,children:e.name}),e.isRepo?(0,Q.jsx)(Cu,{variant:`outline`,className:`shrink-0 text-[10px]`,children:`git`}):null,u.has(e.path)?(0,Q.jsx)(Cu,{variant:`ghost`,className:`shrink-0 text-[10px] text-muted-foreground`,children:`already added`}):null]}),(0,Q.jsx)(`button`,{type:`button`,"data-slot":`fs-enter`,"aria-label":`Open ${e.name}`,onClick:()=>d(e.path),className:`flex shrink-0 items-center px-2.5 text-muted-foreground hover:bg-muted hover:text-foreground`,children:(0,Q.jsx)(Dn,{className:`size-3.5`,"aria-hidden":`true`})})]},e.path)),o.data&&o.data.dirs.length===0?(0,Q.jsx)(`li`,{className:`px-3 py-2 text-[13px] text-muted-foreground`,children:`No subfolders here — “Add project” registers this folder.`}):null]}),o.data?.truncated?(0,Q.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,c.isError?(0,Q.jsx)(`p`,{"data-slot":`add-project-error`,className:`min-w-0 break-words text-[13px] text-danger`,children:c.error instanceof Error?c.error.message:`could not add that folder`}):null,(0,Q.jsxs)(Au,{className:`min-w-0 sm:items-center sm:justify-between`,children:[(0,Q.jsx)(`span`,{"data-slot":`add-project-target`,className:`min-w-0 truncate font-mono text-[11.5px] text-muted-foreground`,title:f??void 0,children:f??``}),(0,Q.jsxs)(`span`,{className:`flex shrink-0 gap-2`,children:[(0,Q.jsx)(H,{variant:`outline`,onClick:()=>t(!1),children:`Cancel`}),(0,Q.jsx)(H,{"data-slot":`add-project-confirm`,disabled:f===null||c.isPending,onClick:()=>{f===null||c.isPending||c.mutate(f,{onSuccess:({project:e})=>{t(!1),l(`/p/${encodeURIComponent(e.id)}/`)}})},children:c.isPending?`Adding…`:`Add project`})]})]})]})})}function Pu({className:e,type:t,...n}){return(0,Q.jsx)(`input`,{type:t,"data-slot":`input`,className:Y(`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 Fu({className:e,...t}){return(0,Q.jsx)(kl,{"data-slot":`label`,className:Y(`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 Iu({open:e,onOpenChange:t}){let[n,r]=(0,Z.useState)(``),[i,a]=(0,Z.useState)(``),[o,s]=(0,Z.useState)(null),c=ce(),l=A(),u=Fe(),d=(0,Z.useMemo)(()=>`co-${Math.random().toString(36).slice(2)}-${Date.now().toString(36)}`,[]),f=(0,Z.useRef)(d);f.current=d,(0,Z.useEffect)(()=>sn((e,t)=>{if(e!==`checkout-progress`)return;let n=t;n?.checkoutId===f.current&&(n.phase===`cloning`&&n.line?s(n.line):n.phase!==`cloning`&&s(null))}),[]);let p=(0,Z.useMemo)(()=>{let e=n.trim().replace(/\/+$/,``).replace(/\.git$/,``).split(`/`).pop()??``;return e.includes(`:`)?e.split(`:`).pop()??``:e},[n]),m=i.trim()===``?p:i.trim(),h=c.data?.projectsDir??``,g=m===``?``:`${h.replace(/\/+$/,``)}/${m}`,_=()=>{n.trim()===``||l.isPending||(s(null),l.mutate({url:n.trim(),checkoutId:d,...i.trim()===``?{}:{name:i.trim()}},{onSuccess:({project:e})=>{t(!1),u(`/p/${encodeURIComponent(e.id)}/`)}}))};return(0,Q.jsx)(wu,{open:e,onOpenChange:e=>l.isPending?void 0:t(e),children:(0,Q.jsxs)(Ou,{"data-slot":`clone-project-dialog`,className:`sm:max-w-lg`,children:[(0,Q.jsxs)(ku,{children:[(0,Q.jsx)(ju,{children:`Clone from GitHub`}),(0,Q.jsxs)(Mu,{children:[`cezar clones with `,(0,Q.jsx)(`code`,{children:`gh`}),` into your checkout root and adds the result as a project.`]})]}),(0,Q.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,Q.jsx)(Fu,{htmlFor:`clone-url`,children:`Repository`}),(0,Q.jsx)(Pu,{id:`clone-url`,"data-slot":`clone-url`,autoFocus:!0,placeholder:`owner/repo or https://github.com/owner/repo`,value:n,disabled:l.isPending,onChange:e=>r(e.target.value),onKeyDown:e=>{e.key===`Enter`&&_()}})]}),(0,Q.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,Q.jsx)(Fu,{htmlFor:`clone-name`,children:`Folder name`}),(0,Q.jsx)(Pu,{id:`clone-name`,"data-slot":`clone-name`,placeholder:p===``?`repo`:p,value:i,disabled:l.isPending,onChange:e=>a(e.target.value)}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1`,children:[(0,Q.jsx)(`p`,{"data-slot":`clone-target`,className:`min-w-0 flex-1 truncate font-mono text-[11.5px] text-soft-foreground`,title:g,children:g}),l.isPending?(0,Q.jsx)(H,{"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,Q.jsx)(rr,{className:`size-3.5`,"aria-hidden":`true`})}):(0,Q.jsx)(H,{asChild:!0,variant:`ghost`,size:`icon-sm`,className:`size-7`,children:(0,Q.jsx)(ct,{to:`/settings/global/projects`,"data-slot":`clone-root-settings`,"aria-label":`Edit checkout root`,title:`Edit checkout root`,children:(0,Q.jsx)(rr,{className:`size-3.5`,"aria-hidden":`true`})})})]})]}),l.isPending?(0,Q.jsx)(`p`,{"data-slot":`clone-progress`,className:`truncate font-mono text-[11.5px] text-muted-foreground`,children:o??`Starting the clone…`}):null,l.isError?(0,Q.jsx)(`p`,{"data-slot":`clone-error`,className:`text-[13px] text-danger`,children:l.error instanceof Error?l.error.message:`could not clone that repository`}):null,(0,Q.jsxs)(Au,{children:[(0,Q.jsx)(H,{variant:`outline`,disabled:l.isPending,onClick:()=>t(!1),children:`Cancel`}),(0,Q.jsx)(H,{"data-slot":`clone-confirm`,disabled:n.trim()===``||m===``||l.isPending,onClick:_,children:l.isPending?`Cloning…`:`Clone`})]})]})})}function Lu(e){return(0,Q.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`currentColor`,"aria-hidden":`true`,...e,children:(0,Q.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 Ru=[{to:`/`,label:`Tasks`,icon:Un,match:[`/`,`/tasks`,`/compare`]},{to:`/inbox`,label:`Inbox`,icon:Vn,match:[`/inbox`],badge:`inbox-count`,inbox:!0},{to:`/git`,label:`Git`,icon:zn,match:[`/git`]},{to:`/github`,label:`GitHub`,icon:Lu,match:[`/github`],forge:!0},{to:`/skills`,label:`Skills`,icon:ir,match:[`/skills`],badge:`skills-update`},{to:`/workflows`,label:`Workflows`,icon:sr,match:[`/workflows`]},{to:`/settings`,label:`Settings`,icon:rr,match:[`/settings`]}];function zu({forge:e=!1,inbox:t=!1}={}){return Ru.filter(n=>(!n.forge||e)&&(!n.inbox||t))}function Bu(e,t){return t===`/`?e===`/`:e===t||e.startsWith(t+`/`)}function Vu(e){let t=null;for(let n of Ru)for(let r of n.match)Bu(e,r)&&(t===null||r.length>t.length)&&(t={to:n.to,length:r.length});return t?.to??null}function Hu(e){let t=Vu(e);return Ru.find(e=>e.to===t)??null}var Uu=f(`inline-block size-[7px] shrink-0 rounded-full`,{variants:{tone:{success:`bg-success`,pending:`bg-pending`,danger:`bg-danger`,violet:`bg-violet`,neutral:`bg-soft-foreground`},pulse:{true:`animate-pulse`,false:``}},defaultVariants:{tone:`neutral`,pulse:!1}});function Wu({className:e,tone:t=`neutral`,pulse:n=!1,...r}){return(0,Q.jsx)(`span`,{"data-slot":`status-dot`,"data-tone":t,className:Y(Uu({tone:t,pulse:n,className:e})),...r})}var Gu=`cez-theme`,Ku=`(prefers-color-scheme: light)`,qu=`dark`;function Ju(e){return e===`light`||e===`dark`||e===`system`?e:qu}function Yu(e,t){return e===`light`||e===`system`&&t?`light`:`dark`}function Xu(){try{return Ju(localStorage.getItem(Gu))}catch{return qu}}function Zu(e){try{localStorage.setItem(Gu,e)}catch{}}function Qu(){return typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(Ku).matches}function $u(e,t){e.classList.toggle(`light`,t===`light`),e.style.colorScheme=t}var ed=Z.createContext(null);function td({children:e}){let[t,n]=Z.useState(Xu),[r,i]=Z.useState(Qu);Z.useEffect(()=>{let e=window.matchMedia?.(Ku);if(!e)return;i(e.matches);let t=e=>i(e.matches);return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]);let a=Yu(t,r);Z.useLayoutEffect(()=>{$u(document.documentElement,a)},[a]);let o=Z.useCallback(e=>{n(e),Zu(e)},[]),s=Z.useMemo(()=>({theme:t,resolvedTheme:a,setTheme:o}),[t,a,o]);return(0,Q.jsx)(ed.Provider,{value:s,children:e})}function nd(){let e=Z.useContext(ed);if(!e)throw Error(`cezar: useTheme() must be called inside <ThemeProvider>`);return e}var rd={light:`dark`,dark:`system`,system:`light`},id={light:or,dark:qn,system:Kn},ad={light:`light`,dark:`dark`,system:`system`};function od({className:e}){let{theme:t,setTheme:n}=nd(),r=rd[t],i=id[t];return(0,Q.jsx)(H,{type:`button`,variant:`ghost`,size:`icon-sm`,className:e,"data-slot":`theme-toggle`,"data-theme-pref":t,title:`Theme: ${ad[t]}`,"aria-label":`Theme: ${ad[t]}. Switch to ${ad[r]}.`,onClick:()=>n(r),children:(0,Q.jsx)(i,{"aria-hidden":`true`})})}var sd=1,cd=.9,ld=.8,ud=.17,dd=.1,fd=.999,pd=.9999,md=.99,hd=/[\\\/_+.#"@\[\(\{&]/,gd=/[\\\/_+.#"@\[\(\{&]/g,_d=/[\s-]/,vd=/[\s-]/g;function yd(e,t,n,r,i,a,o){if(a===t.length)return i===e.length?sd:md;var s=`${i},${a}`;if(o[s]!==void 0)return o[s];for(var c=r.charAt(a),l=n.indexOf(c,i),u=0,d,f,p,m;l>=0;)d=yd(e,t,n,r,l+1,a+1,o),d>u&&(l===i?d*=sd:hd.test(e.charAt(l-1))?(d*=ld,p=e.slice(i,l-1).match(gd),p&&i>0&&(d*=fd**+p.length)):_d.test(e.charAt(l-1))?(d*=cd,m=e.slice(i,l-1).match(vd),m&&i>0&&(d*=fd**+m.length)):(d*=ud,i>0&&(d*=fd**+(l-i))),e.charAt(l)!==t.charAt(a)&&(d*=pd)),(d<dd&&n.charAt(l-1)===r.charAt(a+1)||r.charAt(a+1)===r.charAt(a)&&n.charAt(l-1)!==r.charAt(a))&&(f=yd(e,t,n,r,l+1,a+2,o),f*dd>d&&(d=f*dd)),d>u&&(u=d),l=n.indexOf(c,l+1);return o[s]=u,u}function bd(e){return e.toLowerCase().replace(vd,` `)}function xd(e,t,n){return e=n&&n.length>0?`${e+` `+n.join(` `)}`:e,yd(e,t,bd(e),bd(t),0,0,{})}var Sd=`[cmdk-group=""]`,Cd=`[cmdk-group-items=""]`,wd=`[cmdk-group-heading=""]`,Td=`[cmdk-item=""]`,Ed=`${Td}:not([aria-disabled="true"])`,Dd=`cmdk-item-select`,Od=`data-value`,kd=(e,t,n)=>xd(e,t,n),Ad=Z.createContext(void 0),jd=()=>Z.useContext(Ad),Md=Z.createContext(void 0),Nd=()=>Z.useContext(Md),Pd=Z.createContext(void 0),Fd=Z.forwardRef((e,t)=>{let n=Yd(()=>({search:``,value:e.value??e.defaultValue??``,selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}})),r=Yd(()=>new Set),i=Yd(()=>new Map),a=Yd(()=>new Map),o=Yd(()=>new Set),s=qd(e),{label:c,children:l,value:u,onValueChange:d,filter:f,shouldFilter:p,loop:m,disablePointerSelection:h=!1,vimBindings:g=!0,..._}=e,v=Oe(),y=Oe(),b=Oe(),x=Z.useRef(null),S=Qd();Jd(()=>{if(u!==void 0){let e=u.trim();n.current.value=e,C.emit()}},[u]),Jd(()=>{S(6,k)},[]);let C=Z.useMemo(()=>({subscribe:e=>(o.current.add(e),()=>o.current.delete(e)),snapshot:()=>n.current,setState:(e,t,r)=>{var i,a,o;if(!Object.is(n.current[e],t)){if(n.current[e]=t,e===`search`)O(),E(),S(1,D);else if(e===`value`){if(document.activeElement.hasAttribute(`cmdk-input`)||document.activeElement.hasAttribute(`cmdk-root`)){let e=document.getElementById(b);e?e.focus():(i=document.getElementById(v))==null||i.focus()}if(S(7,()=>{n.current.selectedItemId=A()?.id,C.emit()}),r||S(5,k),s.current?.value!==void 0){let e=t??``;(o=(a=s.current).onValueChange)==null||o.call(a,e);return}}C.emit()}},emit:()=>{o.current.forEach(e=>e())}}),[]),w=Z.useMemo(()=>({value:(e,t,r)=>{t!==a.current.get(e)?.value&&(a.current.set(e,{value:t,keywords:r}),n.current.filtered.items.set(e,T(t,r)),S(2,()=>{E(),C.emit()}))},item:(e,t)=>(r.current.add(e),t&&(i.current.has(t)?i.current.get(t).add(e):i.current.set(t,new Set([e]))),S(3,()=>{O(),E(),n.current.value||D(),C.emit()}),()=>{a.current.delete(e),r.current.delete(e),n.current.filtered.items.delete(e);let t=A();S(4,()=>{O(),t?.getAttribute(`id`)===e&&D(),C.emit()})}),group:e=>(i.current.has(e)||i.current.set(e,new Set),()=>{a.current.delete(e),i.current.delete(e)}),filter:()=>s.current.shouldFilter,label:c||e[`aria-label`],getDisablePointerSelection:()=>s.current.disablePointerSelection,listId:v,inputId:b,labelId:y,listInnerRef:x}),[]);function T(e,t){let r=s.current?.filter??kd;return e?r(e,n.current.search,t):0}function E(){if(!n.current.search||s.current.shouldFilter===!1)return;let e=n.current.filtered.items,t=[];n.current.filtered.groups.forEach(n=>{let r=i.current.get(n),a=0;r.forEach(t=>{let n=e.get(t);a=Math.max(n,a)}),t.push([n,a])});let r=x.current;j().sort((t,n)=>{let r=t.getAttribute(`id`),i=n.getAttribute(`id`);return(e.get(i)??0)-(e.get(r)??0)}).forEach(e=>{let t=e.closest(Cd);t?t.appendChild(e.parentElement===t?e:e.closest(`${Cd} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${Cd} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{let t=x.current?.querySelector(`${Sd}[${Od}="${encodeURIComponent(e[0])}"]`);t?.parentElement.appendChild(t)})}function D(){let e=j().find(e=>e.getAttribute(`aria-disabled`)!==`true`)?.getAttribute(Od);C.setState(`value`,e||void 0)}function O(){if(!n.current.search||s.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let e=0;for(let t of r.current){let r=T(a.current.get(t)?.value??``,a.current.get(t)?.keywords??[]);n.current.filtered.items.set(t,r),r>0&&e++}for(let[e,t]of i.current)for(let r of t)if(n.current.filtered.items.get(r)>0){n.current.filtered.groups.add(e);break}n.current.filtered.count=e}function k(){var e;let t=A();t&&(t.parentElement?.firstChild===t&&((e=t.closest(Sd)?.querySelector(wd))==null||e.scrollIntoView({block:`nearest`})),t.scrollIntoView({block:`nearest`}))}function A(){return x.current?.querySelector(`${Td}[aria-selected="true"]`)}function j(){return Array.from(x.current?.querySelectorAll(Ed)||[])}function M(e){let t=j()[e];t&&C.setState(`value`,t.getAttribute(Od))}function N(e){var t;let n=A(),r=j(),i=r.findIndex(e=>e===n),a=r[i+e];(t=s.current)!=null&&t.loop&&(a=i+e<0?r[r.length-1]:i+e===r.length?r[0]:r[i+e]),a&&C.setState(`value`,a.getAttribute(Od))}function ee(e){let t=A()?.closest(Sd),n;for(;t&&!n;)t=e>0?Gd(t,Sd):Kd(t,Sd),n=t?.querySelector(Ed);n?C.setState(`value`,n.getAttribute(Od)):N(e)}let P=()=>M(j().length-1),te=e=>{e.preventDefault(),e.metaKey?P():e.altKey?ee(1):N(1)},ne=e=>{e.preventDefault(),e.metaKey?M(0):e.altKey?ee(-1):N(-1)};return Z.createElement(G.div,{ref:t,tabIndex:-1,..._,"cmdk-root":``,onKeyDown:e=>{var t;(t=_.onKeyDown)==null||t.call(_,e);let n=e.nativeEvent.isComposing||e.keyCode===229;if(!(e.defaultPrevented||n))switch(e.key){case`n`:case`j`:g&&e.ctrlKey&&te(e);break;case`ArrowDown`:te(e);break;case`p`:case`k`:g&&e.ctrlKey&&ne(e);break;case`ArrowUp`:ne(e);break;case`Home`:e.preventDefault(),M(0);break;case`End`:e.preventDefault(),P();break;case`Enter`:{e.preventDefault();let t=A();if(t){let e=new Event(Dd);t.dispatchEvent(e)}}}}},Z.createElement(`label`,{"cmdk-label":``,htmlFor:w.inputId,id:w.labelId,style:tf},c),ef(e,e=>Z.createElement(Md.Provider,{value:C},Z.createElement(Ad.Provider,{value:w},e))))}),Id=Z.forwardRef((e,t)=>{let n=Oe(),r=Z.useRef(null),i=Z.useContext(Pd),a=jd(),o=qd(e),s=o.current?.forceMount??i?.forceMount;Jd(()=>{if(!s)return a.item(n,i?.id)},[s]);let c=Zd(n,r,[e.value,e.children,r],e.keywords),l=Nd(),u=Xd(e=>e.value&&e.value===c.current),d=Xd(e=>s||a.filter()===!1?!0:!e.search||e.filtered.items.get(n)>0);Z.useEffect(()=>{let t=r.current;if(!(!t||e.disabled))return t.addEventListener(Dd,f),()=>t.removeEventListener(Dd,f)},[d,e.onSelect,e.disabled]);function f(){var e,t;p(),(t=(e=o.current).onSelect)==null||t.call(e,c.current)}function p(){l.setState(`value`,c.current,!0)}if(!d)return null;let{disabled:m,value:h,onSelect:g,forceMount:_,keywords:v,...y}=e;return Z.createElement(G.div,{ref:I(r,t),...y,id:n,"cmdk-item":``,role:`option`,"aria-disabled":!!m,"aria-selected":!!u,"data-disabled":!!m,"data-selected":!!u,onPointerMove:m||a.getDisablePointerSelection()?void 0:p,onClick:m?void 0:f},e.children)}),Ld=Z.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:i,...a}=e,o=Oe(),s=Z.useRef(null),c=Z.useRef(null),l=Oe(),u=jd(),d=Xd(e=>i||u.filter()===!1?!0:!e.search||e.filtered.groups.has(o));Jd(()=>u.group(o),[]),Zd(o,s,[e.value,e.heading,c]);let f=Z.useMemo(()=>({id:o,forceMount:i}),[i]);return Z.createElement(G.div,{ref:I(s,t),...a,"cmdk-group":``,role:`presentation`,hidden:!d||void 0},n&&Z.createElement(`div`,{ref:c,"cmdk-group-heading":``,"aria-hidden":!0,id:l},n),ef(e,e=>Z.createElement(`div`,{"cmdk-group-items":``,role:`group`,"aria-labelledby":n?l:void 0},Z.createElement(Pd.Provider,{value:f},e))))}),Rd=Z.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,i=Z.useRef(null),a=Xd(e=>!e.search);return!n&&!a?null:Z.createElement(G.div,{ref:I(i,t),...r,"cmdk-separator":``,role:`separator`})}),zd=Z.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,i=e.value!=null,a=Nd(),o=Xd(e=>e.search),s=Xd(e=>e.selectedItemId),c=jd();return Z.useEffect(()=>{e.value!=null&&a.setState(`search`,e.value)},[e.value]),Z.createElement(G.input,{ref:t,...r,"cmdk-input":``,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,"aria-autocomplete":`list`,role:`combobox`,"aria-expanded":!0,"aria-controls":c.listId,"aria-labelledby":c.labelId,"aria-activedescendant":s,id:c.inputId,type:`text`,value:i?e.value:o,onChange:e=>{i||a.setState(`search`,e.target.value),n?.(e.target.value)}})}),Bd=Z.forwardRef((e,t)=>{let{children:n,label:r=`Suggestions`,...i}=e,a=Z.useRef(null),o=Z.useRef(null),s=Xd(e=>e.selectedItemId),c=jd();return Z.useEffect(()=>{if(o.current&&a.current){let e=o.current,t=a.current,n,r=new ResizeObserver(()=>{n=requestAnimationFrame(()=>{let n=e.offsetHeight;t.style.setProperty(`--cmdk-list-height`,n.toFixed(1)+`px`)})});return r.observe(e),()=>{cancelAnimationFrame(n),r.unobserve(e)}}},[]),Z.createElement(G.div,{ref:I(a,t),...i,"cmdk-list":``,role:`listbox`,tabIndex:-1,"aria-activedescendant":s,"aria-label":r,id:c.listId},ef(e,e=>Z.createElement(`div`,{ref:I(o,c.listInnerRef),"cmdk-list-sizer":``},e)))}),Vd=Z.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:a,container:o,...s}=e;return Z.createElement(Ot,{open:n,onOpenChange:r},Z.createElement(Tt,{container:o},Z.createElement(bt,{"cmdk-overlay":``,className:i}),Z.createElement(Et,{"aria-label":e.label,"cmdk-dialog":``,className:a},Z.createElement(Fd,{ref:t,...s}))))}),Hd=Z.forwardRef((e,t)=>Xd(e=>e.filtered.count===0)?Z.createElement(G.div,{ref:t,...e,"cmdk-empty":``,role:`presentation`}):null),Ud=Z.forwardRef((e,t)=>{let{progress:n,children:r,label:i=`Loading...`,...a}=e;return Z.createElement(G.div,{ref:t,...a,"cmdk-loading":``,role:`progressbar`,"aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},ef(e,e=>Z.createElement(`div`,{"aria-hidden":!0},e)))}),Wd=Object.assign(Fd,{List:Bd,Item:Id,Input:zd,Group:Ld,Separator:Rd,Dialog:Vd,Empty:Hd,Loading:Ud});function Gd(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function Kd(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function qd(e){let t=Z.useRef(e);return Jd(()=>{t.current=e}),t}var Jd=typeof window>`u`?Z.useEffect:Z.useLayoutEffect;function Yd(e){let t=Z.useRef();return t.current===void 0&&(t.current=e()),t}function Xd(e){let t=Nd(),n=()=>e(t.snapshot());return Z.useSyncExternalStore(t.subscribe,n,n)}function Zd(e,t,n,r=[]){let i=Z.useRef(),a=jd();return Jd(()=>{var o;let s=(()=>{for(let e of n){if(typeof e==`string`)return e.trim();if(typeof e==`object`&&`current`in e)return e.current?e.current.textContent?.trim():i.current}})(),c=r.map(e=>e.trim());a.value(e,s,c),(o=t.current)==null||o.setAttribute(Od,s),i.current=s}),i}var Qd=()=>{let[e,t]=Z.useState(),n=Yd(()=>new Map);return Jd(()=>{n.current.forEach(e=>e()),n.current=new Map},[e]),(e,r)=>{n.current.set(e,r),t({})}};function $d(e){let t=e.type;return typeof t==`function`?t(e.props):`render`in t?t.render(e.props):e}function ef({asChild:e,children:t},n){return e&&Z.isValidElement(t)?Z.cloneElement($d(t),{ref:t.ref},n(t.props.children)):n(t)}var tf={position:`absolute`,width:`1px`,height:`1px`,padding:`0`,margin:`-1px`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,borderWidth:`0`};function nf({className:e,...t}){return(0,Q.jsx)(Wd,{"data-slot":`command`,className:Y(`flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground`,e),...t})}function rf({title:e=`Command Palette`,description:t=`Search for a command to run...`,children:n,className:r,showCloseButton:i=!0,...a}){return(0,Q.jsxs)(wu,{...a,children:[(0,Q.jsxs)(ku,{className:`sr-only`,children:[(0,Q.jsx)(ju,{children:e}),(0,Q.jsx)(Mu,{children:t})]}),(0,Q.jsx)(Ou,{className:Y(`overflow-hidden p-0`,r),showCloseButton:i,children:(0,Q.jsx)(nf,{className:`**:data-[slot=command-input-wrapper]:h-12 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5`,children:n})})]})}function af({className:e,...t}){return(0,Q.jsxs)(`div`,{"data-slot":`command-input-wrapper`,className:`flex h-9 items-center gap-2 border-b px-3`,children:[(0,Q.jsx)(nr,{className:`size-4 shrink-0 opacity-50`}),(0,Q.jsx)(Wd.Input,{"data-slot":`command-input`,className:Y(`flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50`,e),...t})]})}function of({className:e,...t}){return(0,Q.jsx)(Wd.List,{"data-slot":`command-list`,className:Y(`max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto`,e),...t})}function sf({...e}){return(0,Q.jsx)(Wd.Empty,{"data-slot":`command-empty`,className:`py-6 text-center text-sm`,...e})}function cf({className:e,...t}){return(0,Q.jsx)(Wd.Group,{"data-slot":`command-group`,className:Y(`overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground`,e),...t})}function lf({className:e,...t}){return(0,Q.jsx)(Wd.Separator,{"data-slot":`command-separator`,className:Y(`-mx-1 h-px bg-border`,e),...t})}function uf({className:e,...t}){return(0,Q.jsx)(Wd.Item,{"data-slot":`command-item`,className:Y(`relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground`,e),...t})}function df({className:e,...t}){return(0,Q.jsx)(`span`,{"data-slot":`command-shortcut`,className:Y(`ml-auto text-xs tracking-widest text-muted-foreground`,e),...t})}var ff={permission:0,error:1,waiting:2,running:3,unseen:4,none:5};function pf(e){return!1}function mf(e){return!1}function hf(e){return pf(e)?{bucket:`permission`,tone:`violet`,pulse:!0,label:`needs permission`}:e.status===`failed`?{bucket:`error`,tone:`danger`,pulse:!1,label:`failed`}:e.status===`waiting`?{bucket:`waiting`,tone:`pending`,pulse:!0,label:`needs you`}:e.status===`review`?{bucket:`waiting`,tone:`violet`,pulse:!0,label:`needs review`}:e.status===`running`&&e.activity===`monitoring`?{bucket:`running`,tone:`violet`,pulse:!0,label:`monitoring`}:e.status===`running`?{bucket:`running`,tone:`violet`,pulse:!0,label:`running`}:mf(e)?{bucket:`unseen`,tone:`violet`,pulse:!1,label:`unseen`}:e.status===`queued`?{bucket:`none`,tone:`neutral`,pulse:!1,label:`queued`}:e.status===`done`?{bucket:`none`,tone:`success`,pulse:!1,label:`done`}:{bucket:`none`,tone:`neutral`,pulse:!1,label:`cancelled`}}function gf(e){return ff[hf(e).bucket]<=ff.waiting}function _f(e,t=Date.now()){if(!e)return``;let n=new Date(e).getTime();if(Number.isNaN(n))return``;let r=Math.max(0,(t-n)/1e3);return r<60?`${Math.floor(r)}s`:r<3600?`${Math.floor(r/60)}m`:r<86400?`${Math.floor(r/3600)}h`:`${Math.floor(r/86400)}d`}function vf(e){return!Number.isFinite(e)||e<=0?`0`:e>=1e6?`${(Math.floor(e/1e5)/10).toFixed(1)}M`:e>=1e3?`${(Math.floor(e/100)/10).toFixed(1)}k`:String(Math.floor(e))}var yf=new Set([`ai`,`cezar`,`agents`,`team`]);function bf(e){return yf.has(e.source)}function xf(e){return[...e].sort((e,t)=>Number(!bf(e))-Number(!bf(t)))}var Sf=5;function Cf(e,t,{mostUsedLimit:n=Sf}={}){let r=e.map((e,n)=>({skill:e,index:n,count:Tf(t,e.name)})).filter(e=>e.count>0).sort((e,t)=>t.count-e.count||Number(!bf(e.skill))-Number(!bf(t.skill))||e.index-t.index).slice(0,n).map(e=>e.skill),i=new Set(r),a=e.filter(e=>!i.has(e));return{mostUsed:r,project:a.filter(bf),global:a.filter(e=>!bf(e))}}function wf(e,t){let n=Cf(e,t);return[...n.mostUsed,...n.project,...n.global]}function Tf(e,t){if(!e||!Object.hasOwn(e,t))return 0;let n=e[t];return typeof n==`number`?n:0}function Ef(e,t){return{...e,[t]:Tf(e,t)+1}}function Df(e,t){if(t===``)return!0;let n=e.toLowerCase(),r=t.toLowerCase(),i=0;for(let e of r){if(i=n.indexOf(e,i),i===-1)return!1;i+=1}return!0}function Of(e,t){let n=[];for(let r of e)for(let e of r.steps??[])e.skill===t&&n.push(`${r.name} › ${e.name??e.id}`);return n}var kf=/[\s\-/_.]/;function Af(e,t){let n=0;for(let r=e.indexOf(t);r!==-1;r=e.indexOf(t,r+1)){let i=1,a=e[r-1];if(r===0||a!==void 0&&kf.test(a)){let n=e[r+t.length];i=n===void 0||kf.test(n)?3:2}if(i>n&&(n=i),n===3)break}return n}function jf(e,t,n){let r=t.toLowerCase().split(/\s+/).filter(Boolean);if(r.length===0)return 1;let i=[e,...n??[]].join(` `).toLowerCase(),a=0;for(let e of r){let t=Af(i,e);if(t===0)return 0;a+=t}return a/(r.length*3)}function Mf(e,t){if(t===``)return 1;let n=e.toLowerCase(),r=t.toLowerCase();if(n===r)return 6;if(n.startsWith(r))return 5;let i=n.indexOf(r);if(i>0){let e=n[i-1];return e!==void 0&&kf.test(e)?4:3}return+!!Df(n,r)}function Nf(e,t){let n=e.split(`-`).filter(Boolean);return t?[...n,t]:n}var Pf=10;function Ff(e,t,n){let r=n.toLowerCase().split(/\s+/).filter(Boolean);if(r.length===0)return 1;let i=0;for(let n of r){let r=Mf(e,n),a=t?Mf(t,n):0;if(r===0&&a===0)return 0;i+=r>0?r+Pf:a}return i}var If=.5;function Lf(e,t,n){return t.trim()===``?[...e]:e.map((e,r)=>{let i=Ff(e.name,e.description,t),a=Tf(n,e.name),o=Math.min(a,Sf)*If;return{item:e,index:r,count:a,score:i>0?i+o:0}}).filter(e=>e.score>0).sort((e,t)=>t.score-e.score||t.count-e.count||e.index-t.index).map(e=>e.item)}function Rf(e,t,n){return Lf(e,t,n)}function zf(e,t){return Lf(e,t)}function Bf(e,t,n){return Lf(wf(e,n),t,n)}var Vf=[`Needs you`,`Working`,`Recent`,`Archived`],Hf={waiting:0,review:1,running:2,queued:3},Uf=e=>Hf[e.status]??9;function Wf(e,t){return t===`archived`?`Archived`:e.status===`waiting`||e.status===`review`?`Needs you`:e.status===`running`||e.status===`queued`?`Working`:`Recent`}function Gf(e){let t=e.titleSummary;return t===void 0||!(e.titleOrigin===`user`||e.titleOrigin===`marker`)&&/[.!?][A-Z]/.test(t)?e.title:t}function Kf(e){return e.title.replace(/ \([A-C]\)$/,``)}function qf(e){let t=e.filter(e=>!e.archived&&e.status===`queued`).sort((e,t)=>e.createdAt.localeCompare(t.createdAt));return new Map(t.map((e,t)=>[e.id,t+1]))}function Jf(e,t){return e.filter(e=>t===`archived`?e.archived:!e.archived).sort((e,t)=>{let n=Uf(e)-Uf(t);return n===0?t.createdAt.localeCompare(e.createdAt):n})}function Yf(e,t){let n=qf(e),r=Jf(e,t),i=new Map,a=(e,t)=>{let n=i.get(e);n?n.push(t):i.set(e,[t])},o=new Set;for(let e of r){if(e.groupId){if(o.has(e.groupId))continue;o.add(e.groupId);let n=r.filter(t=>t.groupId===e.groupId).sort((e,t)=>(e.variant??``).localeCompare(t.variant??``));if(n.length>1){a(Wf(e,t),{kind:`group`,groupId:e.groupId,title:Kf(e),members:n});continue}}a(Wf(e,t),{kind:`run`,run:e,queuePosition:n.get(e.id)??null})}return Vf.filter(e=>i.has(e)).map(e=>({label:e,rows:i.get(e)}))}function Xf(e,t){let n=[],r=t;for(let t of e){if(r<=0)break;let e=t.rows.slice(0,r);r-=e.length,n.push({label:t.label,rows:e})}return n}function Zf(e){let t=0,n=0,r=0;for(let i of e){if(i.archived){n+=1;continue}t+=1,(i.status===`waiting`||i.status===`review`)&&(r+=1)}return{active:t,archived:n,waiting:r}}function Qf(e){if(!(e instanceof HTMLElement))return!1;let t=e.tagName;return t===`INPUT`||t===`TEXTAREA`||t===`SELECT`||e.isContentEditable?!0:e.closest(`[contenteditable=""], [contenteditable="true"]`)!==null}function $f(e){return e instanceof HTMLElement&&e.closest(`[cmdk-input]`)!==null}function ep(e,t){return!(typeof e.key!=`string`||e.key.toLowerCase()!==t.toLowerCase()||!e.metaKey&&!e.ctrlKey||e.altKey||e.shiftKey||e.repeat||Qf(e.target)&&!$f(e.target))}function tp(e,t){let n=Z.useRef(t);Z.useLayoutEffect(()=>{n.current=t}),Z.useEffect(()=>{let t=t=>{ep(t,e)&&(t.preventDefault(),n.current(t))};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e])}function np(e,t){return!(typeof e.key!=`string`||e.key.toLowerCase()!==t.toLowerCase()||e.metaKey||e.ctrlKey||e.altKey||e.shiftKey||e.repeat||Qf(e.target))}function rp(e,t=typeof navigator>`u`?``:navigator.platform){let n=e.toUpperCase();return/mac|iphone|ipad|ipod/i.test(t)?`⌘${n}`:`Ctrl+${n}`}function ip(e,t){let n=Z.useRef(t);Z.useLayoutEffect(()=>{n.current=t}),Z.useEffect(()=>{let t=t=>{np(t,e)&&n.current(t)};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e])}var ap=`cezar:open-command-palette`;function op(){window.dispatchEvent(new Event(ap))}function sp(e){return[...e].sort((e,t)=>Date.parse(t.createdAt)-Date.parse(e.createdAt))}function cp(){let[e,t]=Z.useState(!1),n=At();tp(`k`,()=>t(e=>!e));let r=Z.useCallback(()=>{t(!1),n(`/new`)},[n]);return tp(`n`,r),ip(`c`,r),Z.useEffect(()=>{let e=()=>t(!0);return window.addEventListener(ap,e),()=>window.removeEventListener(ap,e)},[]),(0,Q.jsx)(rf,{open:e,onOpenChange:t,title:`Command palette`,description:`Search tasks, views, actions, and skills`,showCloseButton:!1,children:(0,Q.jsx)(lp,{close:()=>t(!1)})})}function lp({close:e}){let t=At(),{theme:n,setTheme:r}=nd(),i=Ae(),a=me(),o=ve(),s=z(),c=Date.now(),l=Z.useMemo(()=>sp(i.data??[]),[i.data]),u=o.data?.skillUsage,d=Z.useMemo(()=>wf(a.data??[],u),[a.data,u]),f=n=>{e(),t(n)},p=rd[n];return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(af,{placeholder:`Search tasks, views, actions, skills…`}),(0,Q.jsxs)(of,{children:[(0,Q.jsx)(sf,{children:`Nothing matches.`}),(0,Q.jsxs)(cf,{heading:`Views`,children:[zu({forge:s.data?.forge?.available===!0,inbox:s.data?.capabilities.followups===!0}).map(e=>{let t=e.icon;return(0,Q.jsxs)(uf,{value:`view ${e.label}`,"data-slot":`palette-view`,"data-nav-to":e.to,onSelect:()=>f(e.to),children:[(0,Q.jsx)(t,{"aria-hidden":`true`}),e.label]},e.to)}),(0,Q.jsxs)(uf,{value:`view new task`,"data-slot":`palette-view`,"data-nav-to":`/new`,onSelect:()=>f(`/new`),children:[(0,Q.jsx)(er,{"aria-hidden":`true`}),`New task`,(0,Q.jsx)(df,{children:`C`})]})]}),l.length>0?(0,Q.jsx)(cf,{heading:`Tasks`,children:l.map(e=>{let t=hf(e);return(0,Q.jsxs)(uf,{value:`task ${Gf(e)} ${e.id}`,"data-slot":`palette-task`,"data-run-id":e.id,onSelect:()=>f(`/tasks/${e.id}`),children:[(0,Q.jsx)(Wu,{tone:t.tone,pulse:t.pulse,"aria-label":t.label,role:`img`}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:Gf(e)}),(0,Q.jsx)(`span`,{className:`shrink-0 text-xs text-soft-foreground tabular-nums`,children:_f(e.finishedAt??e.createdAt,c)})]},e.id)})}):null,(0,Q.jsxs)(cf,{heading:`Actions`,children:[(0,Q.jsxs)(uf,{value:`action toggle theme`,"data-slot":`palette-action`,"data-action":`toggle-theme`,onSelect:()=>{r(p),e()},children:[(0,Q.jsx)(qn,{"aria-hidden":`true`}),`Toggle theme`,(0,Q.jsxs)(df,{className:`tracking-normal`,children:[n,` → `,p]})]}),(0,Q.jsxs)(uf,{value:`action new task`,"data-slot":`palette-action`,"data-action":`new-task`,onSelect:()=>f(`/new`),children:[(0,Q.jsx)(er,{"aria-hidden":`true`}),`New task`]})]}),d.length>0?(0,Q.jsx)(cf,{heading:`Skills`,children:d.map(e=>(0,Q.jsxs)(uf,{value:`skill ${e.name} ${e.path}`,keywords:e.description?[e.description]:void 0,"data-slot":`palette-skill`,"data-skill":e.name,onSelect:()=>f(`/new?skill=${encodeURIComponent(e.name)}`),children:[(0,Q.jsx)(`span`,{className:`shrink-0 font-medium`,children:e.name}),e.description?(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null]},e.path))}):null]})]})}function up({...e}){return(0,Q.jsx)(_l,{"data-slot":`dropdown-menu`,...e})}function dp({...e}){return(0,Q.jsx)(vl,{"data-slot":`dropdown-menu-trigger`,...e})}function fp({className:e,sideOffset:t=4,...n}){return(0,Q.jsx)(yl,{children:(0,Q.jsx)(bl,{"data-slot":`dropdown-menu-content`,sideOffset:t,className:Y(`z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border bg-popover p-1 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`,e),...n})})}function pp({className:e,inset:t,variant:n=`default`,...r}){return(0,Q.jsx)(Sl,{"data-slot":`dropdown-menu-item`,"data-inset":t,"data-variant":n,className:Y(`relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground data-[variant=destructive]:*:[svg]:text-destructive!`,e),...r})}function mp({...e}){return(0,Q.jsx)(Cl,{"data-slot":`dropdown-menu-radio-group`,...e})}function hp({className:e,children:t,...n}){return(0,Q.jsxs)(wl,{"data-slot":`dropdown-menu-radio-item`,className:Y(`relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 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`,e),...n,children:[(0,Q.jsx)(`span`,{className:`pointer-events-none absolute left-2 flex size-3.5 items-center justify-center`,children:(0,Q.jsx)(Tl,{children:(0,Q.jsx)(On,{className:`size-2 fill-current`})})}),t]})}function gp({className:e,inset:t,...n}){return(0,Q.jsx)(xl,{"data-slot":`dropdown-menu-label`,"data-inset":t,className:Y(`px-2 py-1.5 text-sm font-medium data-[inset]:pl-8`,e),...n})}function _p({className:e,...t}){return(0,Q.jsx)(El,{"data-slot":`dropdown-menu-separator`,className:Y(`-mx-1 my-1 h-px bg-border`,e),...t})}function vp({...e}){return(0,Q.jsx)(Ot,{"data-slot":`sheet`,...e})}function yp({...e}){return(0,Q.jsx)(xt,{"data-slot":`sheet-trigger`,...e})}function bp({...e}){return(0,Q.jsx)(wt,{"data-slot":`sheet-close`,...e})}function xp({...e}){return(0,Q.jsx)(Tt,{"data-slot":`sheet-portal`,...e})}function Sp({className:e,...t}){return(0,Q.jsx)(bt,{"data-slot":`sheet-overlay`,className:Y(`fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0`,e),...t})}function Cp({className:e,children:t,side:n=`right`,showCloseButton:r=!0,...i}){return(0,Q.jsxs)(xp,{children:[(0,Q.jsx)(Sp,{}),(0,Q.jsxs)(Et,{"data-slot":`sheet-content`,className:Y(`fixed z-50 flex flex-col gap-4 bg-background shadow-modal transition ease-in-out data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:animate-in data-[state=open]:duration-500`,n===`right`&&`inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm`,n===`left`&&`inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm`,n===`top`&&`inset-x-0 top-0 h-auto border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top`,n===`bottom`&&`inset-x-0 bottom-0 h-auto border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom`,e),...i,children:[t,r&&(0,Q.jsxs)(wt,{className:`absolute top-4 right-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none data-[state=open]:bg-secondary`,children:[(0,Q.jsx)(vt,{className:`size-4`}),(0,Q.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function wp({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`sheet-header`,className:Y(`flex flex-col gap-1.5 p-4`,e),...t})}function Tp({className:e,...t}){return(0,Q.jsx)(Dt,{"data-slot":`sheet-title`,className:Y(`font-semibold text-foreground`,e),...t})}function Ep({className:e,...t}){return(0,Q.jsx)(St,{"data-slot":`sheet-description`,className:Y(`text-sm text-muted-foreground`,e),...t})}var Dp=`/open-mercato.svg`,Op=`(min-width: 768px)`,kp=Z.createContext(void 0);function Ap(){return Z.useContext(kp)}function jp({children:e,repo:t=null,inboxCount:n=null,skillsUpdateAvailable:r=!1,version:i=null,latestVersion:a=null,taskQuickList:o,toolsMenu:s,forgeAvailable:c=!0,inboxAvailable:l=!0,singleProject:u=!1,banner:d,projectGroups:f}){let{pathname:p}=M(),m=Ft(p),h=Vu(m),g=Hu(m),[_,v]=Z.useState(!1),y=Z.useRef(null);Z.useLayoutEffect(()=>{let e=y.current;e&&(e.scrollTop=0)},[p]),Z.useEffect(()=>{v(!1)},[p]),Z.useEffect(()=>{let e=window.matchMedia?.(Op);if(!e)return;e.matches&&v(!1);let t=e=>{e.matches&&v(!1)};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]);let b={activeTo:h,items:zu({forge:c,inbox:l}),repo:t,inboxCount:l?n:null,skillsUpdateAvailable:r,version:i,latestVersion:a,taskQuickList:o,toolsMenu:s,projectGroups:f,singleProject:u};return(0,Q.jsx)(vp,{open:_,onOpenChange:v,children:(0,Q.jsxs)(`div`,{"data-slot":`app-shell`,className:`flex h-dvh overflow-hidden bg-background text-foreground pl-[env(safe-area-inset-left)] pr-[env(safe-area-inset-right)]`,children:[(0,Q.jsx)(Mp,{...b}),(0,Q.jsx)(Np,{...b,onNavigate:()=>v(!1)}),(0,Q.jsxs)(`div`,{className:`grid min-w-0 flex-1 grid-rows-[auto_auto_1fr_auto] overflow-hidden`,children:[(0,Q.jsx)(Bp,{title:g?.label??`cezar`}),d?(0,Q.jsx)(`div`,{"data-slot":`banner-slot`,className:`row-start-2`,children:d}):null,(0,Q.jsx)(`main`,{ref:y,"data-slot":`main`,className:`row-start-3 min-h-0 overflow-y-auto overscroll-contain`,children:e}),(0,Q.jsx)(`div`,{"data-slot":`composer`,className:`row-start-4 pb-[env(safe-area-inset-bottom)]`})]})]})})}function Mp(e){return(0,Q.jsx)(`aside`,{"data-slot":`sidebar`,className:`hidden w-[264px] shrink-0 flex-col border-r border-border bg-sidebar md:flex`,children:(0,Q.jsx)(Pp,{...e})})}function Np({onNavigate:e,...t}){return(0,Q.jsxs)(Cp,{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,Q.jsx)(Tp,{className:`sr-only`,children:`Navigation`}),(0,Q.jsx)(Pp,{...t,onNavigate:e,headerAction:(0,Q.jsx)(bp,{asChild:!0,children:(0,Q.jsx)(H,{variant:`ghost`,size:`icon`,"aria-label":`Close menu`,className:`-mr-2 size-11`,children:(0,Q.jsx)(vt,{className:`size-[17px]`,"aria-hidden":`true`})})})})]})}function Pp({activeTo:e,items:t,repo:n,inboxCount:r,skillsUpdateAvailable:i,version:a,latestVersion:o,taskQuickList:s,toolsMenu:c,projectGroups:l,singleProject:u,onNavigate:d,headerAction:f}){return(0,Q.jsxs)(`div`,{"data-slot":`sidebar-content`,className:`flex min-h-0 flex-1 flex-col pt-[env(safe-area-inset-top)] pb-[env(safe-area-inset-bottom)]`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-[9px] px-3.5 pt-3.5 pb-2.5`,children:[(0,Q.jsx)(zp,{}),(0,Q.jsx)(`span`,{className:`text-[15px] font-semibold`,children:`cezar`}),n&&!l?(0,Q.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,f?(0,Q.jsx)(`div`,{className:Y(`shrink-0`,(!n||l)&&`ml-auto`),children:f}):null]}),(0,Q.jsxs)(`div`,{className:`flex gap-1.5 px-2.5 pt-1 pb-2`,children:[(0,Q.jsx)(H,{asChild:!0,variant:`contrast`,className:`relative min-w-0 flex-1 justify-center`,children:(0,Q.jsxs)(X,{to:`/new`,onClick:d,children:[(0,Q.jsx)(er,{className:`size-[15px]`,"aria-hidden":`true`}),`New task`,(0,Q.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`})]})}),u?null:(0,Q.jsx)(Ip,{})]}),l?(0,Q.jsx)(`div`,{"data-slot":`project-groups`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain px-1.5 pb-2`,children:(0,Q.jsx)(kp.Provider,{value:d,children:l})}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`nav`,{"aria-label":`Main`,className:`px-2.5 py-1.5`,children:t.map(t=>{let n=t.to===e,a=t.icon;return(0,Q.jsxs)(X,{to:t.to,onClick:d,"aria-current":n?`page`:void 0,className:Y(`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,Q.jsx)(a,{className:`size-4 shrink-0`,"aria-hidden":`true`}),t.label,t.badge===`inbox-count`&&r?(0,Q.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===`skills-update`&&i?(0,Q.jsxs)(`span`,{"data-slot":`nav-update-marker`,className:`ml-auto flex items-center`,children:[(0,Q.jsx)(`span`,{className:`size-1.5 rounded-full bg-violet`,"aria-hidden":`true`}),(0,Q.jsx)(`span`,{className:`sr-only`,children:`Skills update available`})]}):null]},t.to)})}),(0,Q.jsx)(`div`,{"data-slot":`task-quick-list`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain px-2.5 pb-2`,children:s})]}),(0,Q.jsxs)(`div`,{"data-slot":`sidebar-footer`,className:`flex flex-col gap-1.5 border-t border-border px-3.5 py-2.5`,children:[(0,Q.jsx)(Lp,{}),(0,Q.jsxs)(`div`,{"data-slot":`sidebar-footer-controls`,className:`flex items-center gap-2`,children:[(0,Q.jsx)(`div`,{"data-slot":`tools-menu`,className:`shrink-0`,children:c}),a?(0,Q.jsx)(Rp,{version:a,latestVersion:o}):null,(0,Q.jsx)(Fp,{onNavigate:d,className:`ml-auto`}),(0,Q.jsx)(od,{})]})]})]})}function Fp({className:e,onNavigate:t}){return(0,Q.jsx)(H,{asChild:!0,variant:`ghost`,size:`icon`,className:Y(`size-7`,e),children:(0,Q.jsx)(ct,{to:`/settings/global`,"data-slot":`global-settings-link`,"aria-label":`Global settings`,title:`Global settings`,onClick:t,children:(0,Q.jsx)(rr,{className:`size-4`,"aria-hidden":`true`})})})}function Ip(){let[e,t]=Z.useState(!1),[n,r]=Z.useState(!1);return(0,Q.jsxs)(up,{children:[(0,Q.jsx)(dp,{asChild:!0,children:(0,Q.jsx)(H,{variant:`outline`,size:`icon`,"aria-label":`Add project`,title:`Add project`,className:`size-11 shrink-0 md:size-9`,children:(0,Q.jsx)(Pn,{className:`size-4`,"aria-hidden":`true`})})}),(0,Q.jsxs)(fp,{align:`start`,className:`w-56`,children:[(0,Q.jsx)(gp,{className:`text-xs text-soft-foreground`,children:`Add project`}),(0,Q.jsxs)(pp,{"data-slot":`add-project-local`,onSelect:()=>t(!0),children:[(0,Q.jsx)(In,{"aria-hidden":`true`}),`Open local folder…`]}),(0,Q.jsxs)(pp,{"data-slot":`add-project-clone`,onSelect:()=>r(!0),children:[(0,Q.jsx)(Lu,{"aria-hidden":`true`}),`Clone from GitHub…`]})]}),e?(0,Q.jsx)(Nu,{open:!0,onOpenChange:t}):null,n?(0,Q.jsx)(Iu,{open:!0,onOpenChange:r}):null]})}function Lp(){return(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`command-palette-hint`,title:`Search — command palette (⌘K / Ctrl+K)`,onClick:()=>op(),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,Q.jsx)(nr,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),(0,Q.jsx)(`span`,{className:`truncate`,children:`Search…`}),(0,Q.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:rp(`k`)})]})}function Rp({version:e,latestVersion:t}){let n=!!(t&&t!==e);return(0,Q.jsxs)(`span`,{"data-slot":`version-chip`,"data-update-available":n?`true`:void 0,title:n?`update available: v${t}`:void 0,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`,children:[n?(0,Q.jsx)(Wu,{tone:`pending`,pulse:!0,className:`size-[5px]`}):null,`v`,e]})}function zp(){return(0,Q.jsx)(`img`,{src:Dp,alt:``,"aria-hidden":`true`,"data-slot":`brand-tile`,className:`size-[26px] shrink-0 rounded-sm`})}function Bp({title:e}){return(0,Q.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,Q.jsxs)(`div`,{className:`flex h-[52px] items-center gap-2.5 px-3`,children:[(0,Q.jsx)(yp,{asChild:!0,children:(0,Q.jsx)(H,{variant:`ghost`,size:`icon`,"aria-label":`Open menu`,className:`-ml-1.5 size-11`,children:(0,Q.jsx)(Wn,{className:`size-[17px]`,"aria-hidden":`true`})})}),(0,Q.jsx)(`span`,{className:`truncate text-[14.5px] font-semibold`,children:e}),(0,Q.jsx)(`div`,{"data-slot":`mobile-status`,className:`ml-auto flex items-center gap-2`})]})})}var Vp=Z.createContext(null);function Hp({children:e}){let[t,n]=Z.useState(`active`),r=Z.useMemo(()=>[t,n],[t]);return(0,Q.jsx)(Vp.Provider,{value:r,children:e})}function Up(){let e=Z.useContext(Vp);if(!e)throw Error(`useListView must be used inside a <ListViewProvider>`);return e}var Wp=[`claude`,`codex`,`opencode`],Gp={claude:`Claude Code`,codex:`Codex`,opencode:`OpenCode`};function Kp(e){if(typeof e!=`object`||!e||Array.isArray(e))return{};let t=e,n={};for(let e of Wp){let r=t[e];typeof r==`string`&&r.length>0&&r.length<=128&&(n[e]=r)}return n}function qp(e,t){if(!e)return[];let n=new Map(e.providers.map(e=>[e.provider,e]));return Wp.flatMap(e=>{let r=n.get(e);return r?.status!==`disconnected`||!r.authFailureId||t[e]===r.authFailureId?[]:[{provider:e,label:Gp[e],authFailureId:r.authFailureId}]})}function Jp(e,t){return{...e,...Object.fromEntries(t.map(({provider:e,authFailureId:t})=>[e,t]))}}function Yp({status:e,pending:t,error:n,dismissals:r,onDismissAuthFailures:i}){if(t||!e)return null;let a;try{a=pe(e)}catch{return null}let o=qp(a,r);if(o.length>0)return(0,Q.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,Q.jsx)(Wu,{tone:`danger`}),(0,Q.jsxs)(`span`,{children:[`Provider authentication failed during a task:`,` `,o.map(({label:e})=>e).join(`, `),`.`]}),(0,Q.jsx)(X,{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,Q.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,Q.jsx)(vt,{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,Q.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,Q.jsx)(Wu,{tone:c?`danger`:`pending`}),(0,Q.jsx)(`span`,{children:s?`No agent provider is enabled.`:c?`No connected provider could be verified.`:`No agent provider credentials were found.`}),(0,Q.jsx)(X,{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 Xp(e){if(!(typeof e!=`object`||!e||Array.isArray(e)))return e}function Zp(){let e=fe(),t=st(),n=v(),r=(0,Z.useRef)(Promise.resolve()),i=(0,Z.useRef)(0),a=(0,Z.useRef)(0),o=(0,Z.useRef)(Xp(t.data));(0,Z.useEffect)(()=>{a.current===0&&(o.current=Xp(t.data))},[t.data]);let s=(0,Z.useCallback)(e=>{let t=_.uiState,s=Xp(n.getQueryData(t)),c=Jp(Kp(s?.dismissedProviderAuthFailures),e),l={...s,dismissedProviderAuthFailures:c};a.current+=1,n.setQueryData(t,l);let u=++i.current;r.current=r.current.then(async()=>{try{let e=await Qe({dismissedProviderAuthFailures:c});o.current=Xp(e),u===i.current&&n.setQueryData(t,e)}catch(e){u===i.current&&(o.current===void 0?n.removeQueries({queryKey:t,exact:!0}):n.setQueryData(t,o.current),n.invalidateQueries({queryKey:t}),U(e instanceof Error?e.message:String(e),{tone:`danger`}))}finally{--a.current}})},[n]);return(0,Q.jsx)(Yp,{status:e.data,pending:e.isPending,error:e.isError,dismissals:Kp(Xp(t.data)?.dismissedProviderAuthFailures),onDismissAuthFailures:s})}function Qp({stat:e,className:t}){return(0,Q.jsxs)(`span`,{"data-slot":`diff-stat`,title:`+${e.adds} −${e.dels} across ${e.files} ${e.files===1?`file`:`files`}`,className:Y(`font-mono text-xs font-semibold tabular-nums`,t),children:[(0,Q.jsxs)(`span`,{className:`text-success`,children:[`+`,e.adds]}),` `,(0,Q.jsxs)(`span`,{className:`text-danger`,children:[`−`,e.dels]})]})}function $p({reference:e,taskTitle:t,className:n,compact:r=!1}){let{kind:i,number:a,url:o}=e,s=Y(`inline-flex h-[22px] items-center gap-1 rounded-full border border-violet/35 px-2 font-mono text-[11px] font-semibold text-violet`,n),c=r&&i===`PR`?`PR`:a?`${i===`Issue`?`Issue `:``}#${a}`:i;return!o||!ht(o)?(0,Q.jsx)(`span`,{"data-slot":i===`PR`?`pr-chip`:`issue-chip`,className:s,children:c}):(0,Q.jsxs)(`a`,{"data-slot":i===`PR`?`pr-chip`:`issue-chip`,href:o,target:`_blank`,rel:`noopener noreferrer`,title:o,"aria-label":`Open the ${i===`PR`?`pull request`:`issue`} for ${t}`,className:Y(s,`hover:bg-violet/10`),children:[c,(0,Q.jsx)(xn,{className:`size-2.5`,"aria-hidden":`true`})]})}var em=new Set([`running`,`waiting`]),tm=new Set([`done`,`failed`,`review`,`cancelled`]),nm=new Set([`done`,`failed`,`cancelled`]);function rm(e){return e?e>=1024**3?`${(e/1024**3).toFixed(1)} GB`:e>=1024**2?`${Math.round(e/1024**2)} MB`:`${Math.round(e/1024)} kB`:``}function im(e){return e?`$${e>=10?e.toFixed(0):e.toFixed(2)}`:``}function am(e){if(e.workflow===`(planned)`||e.workflow===`(inbox)`){let t=e.steps.find(e=>e.kind===`agent`);if(t?.name)return t.name}return e.workflow}function om(e,t){let n=t.trim().toLowerCase();return n?e.filter(e=>[Gf(e),e.branch??``,e.workflow,am(e)].some(e=>e.toLowerCase().includes(n))):[...e]}function sm(e){return e.filter(e=>!e.archived&&nm.has(e.status)).length}function cm(e){return e.pullRequestUrl??e.referencedPullRequestUrl}function lm(e){return e.referencedIssueUrl}function um(e){let t=cm(e),n=t?Number(dm(t)):e.prNumber;if(n&&Number.isInteger(n))return{kind:`PR`,number:n,...t?{url:t}:{}};let r=lm(e),i=e.issueNumber??(r?Number(dm(r)):void 0);if(i&&Number.isInteger(i))return{kind:`Issue`,number:i,...r?{url:r}:{}}}function dm(e){let t=e.split(`/`).pop()??``;return/^\d+$/.test(t)?t:null}function fm(e,t){let n=em.has(e.status)?t:void 0;if(n)return{cpu:{text:`${n.cpuPct.toFixed(0)}%`,kind:`live`},mem:{text:rm(n.rssBytes),kind:`live`}};let r=rm(e.peakRssBytes);return{cpu:{text:``,kind:`none`},mem:r?{text:`peak ${r}`,kind:`peak`,title:`peak — run finished${e.peakProcCount?` · ${e.peakProcCount} procs`:``}`}:{text:``,kind:`none`}}}function pm(e,t){let n=e.filter(e=>t===`archived`?e.archived:!e.archived),r=new Map;for(let e of n){if(!e.groupId)continue;let t=r.get(e.groupId);t?t.push(e):r.set(e.groupId,[e])}return[...r.entries()].flatMap(([e,t])=>{let n=t[0];return!n||t.length<2||!t.every(e=>tm.has(e.status))?[]:[{groupId:e,title:Kf(n),count:t.length}]})}function mm(e){let[t,n]=Z.useState(()=>Date.now());return Z.useEffect(()=>{let t=setInterval(()=>n(Date.now()),e);return()=>clearInterval(t)},[e]),t}function hm({runs:e,view:t,onViewChange:n,currentRunId:r=null,now:i=Date.now()}){let a=Zf(e),o=Yf(e,t);return(0,Q.jsxs)(`div`,{"data-slot":`quick-list`,children:[(0,Q.jsx)(`div`,{className:`sticky top-0 z-10 bg-sidebar pt-2 pb-1`,children:(0,Q.jsxs)(`div`,{className:`inline-flex w-full gap-0.5 rounded-md bg-muted p-[3px]`,children:[(0,Q.jsxs)(_m,{view:`active`,current:t,onSelect:n,count:a.active,children:[`Active`,a.waiting>0&&t!==`active`?(0,Q.jsx)(Wu,{tone:`pending`,pulse:!0,"data-slot":`waiting-dot`,"aria-label":`needs you`}):null]}),(0,Q.jsx)(_m,{view:`archived`,current:t,onSelect:n,count:a.archived,children:`Archived`})]})}),o.length===0?(0,Q.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,Q.jsx)(gm,{buckets:o,currentRunId:r,now:i})]})}function gm({buckets:e,currentRunId:t=null,now:n=Date.now(),scope:r=null}){let[i,a]=Z.useState(()=>new Set),o=e=>a(t=>{let n=new Set(t);return n.delete(e)||n.add(e),n});return(0,Q.jsx)(Q.Fragment,{children:e.map(e=>(0,Q.jsxs)(`div`,{"data-slot":`quick-list-bucket`,"data-bucket":e.label,children:[(0,Q.jsx)(`h2`,{className:`px-3 pt-2.5 pb-1 text-[11px] font-semibold tracking-[0.04em] text-soft-foreground uppercase`,children:e.label}),e.rows.map(e=>(0,Q.jsx)(vm,{row:e,currentRunId:t,now:n,scope:r,expanded:e.kind===`group`&&i.has(e.groupId),onToggle:o},e.kind===`group`?e.groupId:e.run.id))]},e.label))})}function _m({view:e,current:t,onSelect:n,count:r,children:i}){let a=e===t;return(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`view-tab`,"data-view":e,"aria-pressed":a,onClick:()=>n(e),className:Y(`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,Q.jsx)(`span`,{className:`font-mono text-[11px] tabular-nums`,children:r}):null]})}function vm({row:e,currentRunId:t,now:n,scope:r,expanded:i,onToggle:a}){return e.kind===`run`?(0,Q.jsx)(ym,{run:e.run,queuePosition:e.queuePosition,currentRunId:t,now:n,scope:r}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`flex items-center rounded-sm hover:bg-muted`,children:[(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`group-tile`,"data-group-id":e.groupId,"aria-expanded":i,onClick:()=>a(e.groupId),className:`flex min-w-0 flex-1 items-center gap-2 px-2.5 py-[7px] text-left`,children:[(0,Q.jsx)(En,{className:Y(`size-3 shrink-0 text-soft-foreground transition-transform`,!i&&`-rotate-90`),"aria-hidden":`true`}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[13px] font-medium`,children:e.title}),(0,Q.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,Q.jsx)(X,{to:kt(r,`/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,Q.jsx)(tr,{className:`size-3.5`,"aria-hidden":`true`})})]}),i?e.members.map(e=>(0,Q.jsx)(ym,{run:e,queuePosition:null,currentRunId:t,now:n,scope:r,variant:!0},e.id)):null]})}function ym({run:e,queuePosition:t,currentRunId:n,now:r,scope:i,variant:a=!1}){let o=hf(e),s=e.id===n,c=cm(e),l=a?``:t===null?_f(e.finishedAt??e.createdAt,r):`#${t}`;return(0,Q.jsxs)(`div`,{"data-slot":`task-row`,"data-run-id":e.id,"data-active":s?`true`:void 0,className:Y(`flex items-center rounded-sm hover:bg-muted`,s&&`bg-muted`,a&&`pl-4`),children:[(0,Q.jsxs)(X,{to:kt(i,`/tasks/${e.id}`),title:Gf(e),"aria-current":s?`page`:void 0,className:`flex min-w-0 flex-1 items-center gap-2 px-2.5 py-[7px]`,children:[a?(0,Q.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,Q.jsx)(Wu,{tone:o.tone,pulse:o.pulse,"aria-label":o.label,role:`img`}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[13px] font-medium`,children:a?bm(e):Gf(e)}),e.diffStat?(0,Q.jsx)(Qp,{stat:e.diffStat,className:`shrink-0 text-[10.5px]`}):null,c||!l?null:(0,Q.jsx)(`span`,{className:`shrink-0 text-[11px] text-soft-foreground tabular-nums`,children:l})]}),c&&ht(c)?(0,Q.jsx)($p,{reference:{kind:`PR`,...dm(c)?{number:Number(dm(c))}:{},url:c},taskTitle:Gf(e),compact:!0,className:`mr-2.5 h-auto shrink-0 gap-[3px] px-1.5 py-px text-[10.5px]`}):null]})}function bm(e){let t=[e.runner??`claude`];return e.tokensUsed>0&&t.push(vf(e.tokensUsed)),t.join(` · `)}function xm(){let e=Ae(),[t,n]=Up(),r=Nt(`/tasks/:id/*`),i=Nt(`/tasks/:id`),a=mm(3e4);return e.data?(0,Q.jsx)(hm,{runs:e.data,view:t,onViewChange:n,currentRunId:r?.params.id??i?.params.id??null,now:a}):null}var Sm=10,Cm=400;function wm(e,t,n){let r=e?.[t];return r===void 0?t!==n:r}function Tm(e){let t=v(),n=st().data?.sidebar?.collapsed,r=Z.useRef(null),i=Z.useRef(null),a=Z.useCallback(()=>{i.current=null;let e=r.current;e&&(r.current=null,Qe({sidebar:e}).then(e=>t.setQueryData(_.uiState,e)).catch(e=>{U(e instanceof Error?e.message:String(e),{tone:`danger`}),t.invalidateQueries({queryKey:_.uiState})}))},[t]);return Z.useEffect(()=>()=>{i.current!==null&&(clearTimeout(i.current),a())},[a]),{collapsed:n,toggle:Z.useCallback(n=>{let o=t.getQueryData(_.uiState),s=o?.sidebar?.collapsed,c={...o?.sidebar,collapsed:{...s,[n]:!wm(s,n,e)}};t.setQueryData(_.uiState,{...o,sidebar:c}),r.current=c,i.current!==null&&clearTimeout(i.current),i.current=setTimeout(a,Cm)},[e,a,t])}}function Em({projects:e,bootProjectId:t,inboxAvailable:n=!1,inboxCount:r=null,skillsUpdateAvailable:i=!1}){let{pathname:a}=M(),o=Mt(a)??t,{collapsed:s,toggle:c}=Tm(o),[l]=Up(),u=Vu(Ft(a)),d=Nt(`/tasks/:id/*`),f=Nt(`/tasks/:id`),p=d?.params.id??f?.params.id??null,m=mm(3e4);return(0,Q.jsx)(`div`,{"data-slot":`project-group-list`,children:Z.useMemo(()=>[...e].sort((e,t)=>t.lastOpenedAt.localeCompare(e.lastOpenedAt)),[e]).map(e=>(0,Q.jsx)(Dm,{project:e,boot:e.id===t,active:e.id===o,collapsed:wm(s,e.id,o),onToggle:c,view:l,activeTo:u,currentRunId:p,now:m,inboxAvailable:n,inboxCount:r,skillsUpdateAvailable:i},e.id))})}function Dm({project:e,boot:t,active:n,collapsed:r,onToggle:i,view:a,activeTo:o,currentRunId:s,now:c,inboxAvailable:l,inboxCount:u,skillsUpdateAvailable:d}){let f=e.status===`missing`,p=ue(e.id,!r&&!f,t),m=Ap(),h=p.data?Zf(p.data).waiting:0,g=p.data?Xf(Yf(p.data,a),Sm):[];if(f)return(0,Q.jsx)(`div`,{"data-slot":`project-group`,"data-project":e.id,"data-status":`missing`,className:`mb-1`,children:(0,Q.jsxs)(`div`,{"data-slot":`project-group-header`,title:`${e.root} is gone — remove it in Global settings → Projects`,className:`flex h-11 w-full items-center gap-[7px] rounded-lg px-2 text-[13px] font-semibold opacity-55 md:h-[34px]`,children:[(0,Q.jsx)(`span`,{className:`w-3 shrink-0`,"aria-hidden":`true`}),(0,Q.jsx)(`span`,{className:`truncate`,children:e.name}),(0,Q.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 _=`project-group-${e.id}`;return(0,Q.jsxs)(`div`,{"data-slot":`project-group`,"data-project":e.id,"data-status":e.status,"data-collapsed":r?``:void 0,className:`mb-1`,children:[(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>i(e.id),"aria-expanded":!r,"aria-controls":_,"data-slot":`project-group-header`,className:Y(`flex h-11 w-full items-center gap-[7px] rounded-lg px-2 text-left text-[13px] font-semibold transition-colors hover:bg-muted md:h-[34px]`,n&&`bg-muted`),children:[(0,Q.jsx)(En,{className:Y(`size-3 shrink-0 text-muted-foreground transition-transform`,r&&`-rotate-90`),"aria-hidden":`true`}),(0,Q.jsx)(`span`,{className:`truncate`,children:e.name}),h?(0,Q.jsx)(`span`,{"data-slot":`project-attention`,title:`${h} task${h===1?``:`s`} need${h===1?`s`:``} you`,className:`shrink-0 rounded-full bg-violet px-1.5 py-px text-[10.5px] font-semibold text-violet-foreground`,children:h}):null,e.branch?(0,Q.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,Q.jsxs)(`div`,{id:_,"data-slot":`project-group-body`,className:`mt-1 ml-[14px] border-l border-border pl-2`,children:[(0,Q.jsx)(`nav`,{"aria-label":`${e.name} navigation`,children:zu({forge:e.forge===`github`,inbox:l}).map(t=>{let r=n&&t.to===o,i=t.icon;return(0,Q.jsxs)(X,{to:kt(e.id,t.to),onClick:m,"aria-current":r?`page`:void 0,className:Y(`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,Q.jsx)(i,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),t.label,t.badge===`inbox-count`&&n&&u?(0,Q.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:u}):null,t.badge===`skills-update`&&n&&d?(0,Q.jsxs)(`span`,{"data-slot":`nav-update-marker`,className:`ml-auto flex items-center`,children:[(0,Q.jsx)(`span`,{className:`size-1.5 rounded-full bg-violet`,"aria-hidden":`true`}),(0,Q.jsx)(`span`,{className:`sr-only`,children:`Skills update available`})]}):null]},t.to)})}),(0,Q.jsx)(gm,{buckets:g,currentRunId:n?s:null,now:c,scope:e.id}),(0,Q.jsx)(X,{to:kt(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…`})]})]})}function Om(e){let t=e.checks.filter(e=>!e.available).map(e=>e.name),n=`cezar v${e.version}`;return t.length?`${n} · needs attention: ${t.join(`, `)}`:n}function km(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 Am({health:e}){if(!e)return null;let t=e.checks.every(e=>e.available);return(0,Q.jsxs)(up,{children:[(0,Q.jsx)(dp,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`tools-menu-trigger`,title:Om(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,Q.jsx)(Wu,{tone:t?`success`:`pending`}),`Tools`,(0,Q.jsx)(En,{className:`size-[11px]`,"aria-hidden":`true`})]})}),(0,Q.jsxs)(fp,{side:`top`,align:`start`,"data-slot":`tools-menu-content`,className:`w-[240px]`,children:[(0,Q.jsx)(gp,{className:`text-[11px] font-semibold tracking-[.04em] text-soft-foreground uppercase`,children:`Installed tools`}),e.checks.map(e=>e.available?(0,Q.jsx)(jm,{check:e},e.name):(0,Q.jsx)(Mm,{check:e},e.name)),km(e)?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(_p,{}),(0,Q.jsx)(`p`,{"data-slot":`forge-note`,className:`px-2 py-1.5 text-[11px] leading-snug text-muted-foreground`,children:km(e)})]}):null,(0,Q.jsx)(_p,{}),(0,Q.jsx)(pp,{asChild:!0,children:(0,Q.jsxs)(X,{to:`/settings/agents`,"data-slot":`tools-settings`,className:`gap-2 text-[12.5px] text-muted-foreground`,children:[(0,Q.jsx)(rr,{className:`size-3.5`,"aria-hidden":`true`}),`Tool settings`]})})]})]})}function jm({check:e}){return(0,Q.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,Q.jsx)(Wu,{tone:`success`}),(0,Q.jsx)(`span`,{className:`font-mono text-[12.5px] font-medium`,children:e.name}),(0,Q.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 Mm({check:e}){return(0,Q.jsx)(pp,{asChild:!0,children:(0,Q.jsxs)(X,{to:`/settings/agents`,"data-slot":`tool-row`,"data-tool":e.name,"data-available":`false`,className:`flex-col items-stretch gap-1`,children:[(0,Q.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(Wu,{tone:`danger`}),(0,Q.jsx)(`span`,{className:`font-mono text-[12.5px] font-medium`,children:e.name}),(0,Q.jsx)(`span`,{"data-slot":`tool-version`,className:`ml-auto font-mono text-[11.5px] font-medium text-muted-foreground`,children:`not found`})]}),(0,Q.jsxs)(`span`,{className:`flex items-end justify-between gap-3 pl-[15px]`,children:[e.hint?(0,Q.jsx)(`span`,{"data-slot":`tool-hint`,className:`min-w-0 text-[11px] leading-snug text-muted-foreground`,children:e.hint}):null,(0,Q.jsx)(`span`,{"data-slot":`tool-setup`,className:`ml-auto shrink-0 text-[11.5px] font-semibold text-violet`,children:`Set up →`})]})]})})}function Nm(e){return e?.trim()||null}function Pm({projectName:e,pageLabel:t}){let n=Nm(e),r=Nm(t);return n&&r?`${n} — ${r} · cezar`:n?`${n} · cezar`:r?`${r} · cezar`:`cezar`}function Fm(e){let t=Pm(e);(0,Z.useEffect)(()=>{document.title=t},[t])}function Im(){return(0,Q.jsx)(`div`,{"data-route":`compare`,className:`flex min-h-full flex-col`,children:(0,Q.jsx)(W,{icon:(0,Q.jsx)(j,{className:`motion-safe:animate-spin`}),tone:`neutral`,title:`Loading variants…`,subtitle:`Fetching every variant's status, spend and diff summary.`})})}function Lm(){return(0,Q.jsx)(`div`,{"data-route":`github`,className:`flex min-h-full flex-col`,children:(0,Q.jsx)(W,{icon:(0,Q.jsx)(j,{className:`motion-safe:animate-spin`}),tone:`neutral`,title:`Loading GitHub…`,subtitle:`Fetching open issues and pull requests.`})})}function Rm(e,t,n=24){return[t,...(e??[]).filter(e=>!(e.source===t.source&&e.ref===t.ref))].slice(0,n)}var zm=[{id:`claude`,label:`claude`,desc:`Claude Code CLI`},{id:`codex`,label:`codex`,desc:`OpenAI Codex (app-server)`},{id:`opencode`,label:`opencode`,desc:`OpenCode (serve)`}],Bm={claude:[{id:``,label:`auto`,desc:`Pick the best model per step`},{id:`opus`,label:`opus`,desc:`Deep reasoning for hard tasks`},{id:`sonnet`,label:`sonnet`,desc:`Fast and cheap`},{id:`haiku`,label:`haiku`,desc:`Fastest — simple, scoped tasks`},{id:`claude-fable-5`,label:`Fable 5`,desc:`Most capable — the Claude 5 family`},{id:`claude-opus-4-8`,label:`Opus 4.8`,desc:`Pinned version`},{id:`claude-sonnet-5`,label:`Sonnet 5`,desc:`Pinned version`},{id:`claude-haiku-4-5`,label:`Haiku 4.5`,desc:`Pinned version`}],codex:[{id:``,label:`auto`,desc:`Use your Codex default model`}],opencode:[{id:``,label:`auto`,desc:`Use your OpenCode default model`},{id:`anthropic/claude-opus-4-8`,label:`claude-opus-4.8`,desc:`via Anthropic`},{id:`anthropic/claude-sonnet-5`,label:`claude-sonnet-5`,desc:`via Anthropic`},{id:`openai/gpt-5.1`,label:`gpt-5.1`,desc:`via OpenAI`},{id:`openai/gpt-5.1-codex`,label:`gpt-5.1-codex`,desc:`via OpenAI`}]};function Vm(e,t){return!e||Bm[t].some(t=>t.id===e)?!1:Object.entries(Bm).some(([n,r])=>n!==t&&r.some(t=>t.id!==``&&t.id===e))}function Hm(e,t,n=[]){let r=[...Bm[e]??Bm.claude];if(e!==`codex`)return r;let i=new Set(r.map(e=>e.id));for(let e of t?.models??[])!e.id||i.has(e.id)||(i.add(e.id),r.push({id:e.id,label:e.label||e.id,desc:e.description}));for(let t of n)!t||i.has(t)||Vm(t,e)||(i.add(t),r.push({id:t,label:t,desc:`Custom or legacy model`}));return r}function Um(e,t,n=!1){if(e===`codex`){if(t?.stale)return`Using cached Codex model list`;if(n||t?.source===`unavailable`)return`Latest Codex models unavailable`}}function Wm(e){let t=zm.map(e=>e.id).filter(t=>e.some(e=>e.name===t&&e.available));return t.length>0?t:[`claude`]}function Gm(e,t,n){return e!==null&&t.includes(e)?e:t.includes(n)?n:t[0]??`claude`}function Km(e,t,n,r){let i=Hm(t,r,[e,n?.[t]]);if(e!==null&&i.some(t=>t.id===e))return e;let a=n?.[t];return a!==void 0&&i.some(e=>e.id===a)?a:``}function qm(e,t,n){return e.source===`skill`?t.some(t=>t.name===e.ref):n.some(t=>t.name===e.ref)}function Jm(e,t,n){for(let r of e)if(r&&qm(r,t,n))return r;if(n.some(e=>e.name===`quick-task`))return{source:`workflow`,ref:`quick-task`};let r=t[0];return r?{source:`skill`,ref:r.name}:{source:`workflow`,ref:n[0]?.name??`quick-task`}}function Ym(e){let{task:t,source:n,model:r,runner:i,defaultRunner:a,variants:o,images:s,worktree:c,autonomous:l,generateFollowups:u,todoId:d}=e;return{task:t,...n.source===`skill`?{steps:[{id:`task`,name:n.ref,skill:n.ref,prompt:`{{task}}`}]}:{workflow:n.ref},model:r||void 0,runner:i===a?void 0:i,variants:o>1?o:void 0,images:s.length>0?[...s]:void 0,worktree:c===!1&&o<=1?!1:void 0,autonomous:l===!0||void 0,generateFollowups:u!==!1&&void 0,todoId:d||void 0}}function Xm(e){let t=`runs`in e?e.runs[0]:e;return t?`/tasks/${t.id}`:`/`}var Zm=`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-55`,Qm=(0,Q.jsx)(En,{"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`});function $m({slot:e,ariaLabel:t,label:n,value:r,options:i,onPick:a,disabled:o=!1,hint:s,disabledHint:c,status:l}){let u=(0,Q.jsxs)(`button`,{type:`button`,"data-slot":e,"aria-label":t,disabled:o,title:o?c:s,className:Zm,children:[n,Qm]});return o?(0,Q.jsx)(`span`,{title:c,className:`inline-flex`,children:u}):(0,Q.jsxs)(up,{children:[(0,Q.jsx)(dp,{asChild:!0,children:u}),(0,Q.jsxs)(fp,{align:`start`,"data-testid":`${e}-menu`,children:[(0,Q.jsx)(mp,{value:r,onValueChange:a,children:i.map(e=>(0,Q.jsx)(hp,{value:e.value,className:`gap-2.5`,children:(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,Q.jsx)(`span`,{className:`text-[12.5px] font-medium`,children:e.label}),e.desc?(0,Q.jsx)(`span`,{className:`text-[11.5px] text-muted-foreground`,children:e.desc}):null]})},e.value))}),l?(0,Q.jsx)(pp,{disabled:!0,className:`border-t border-border text-[11.5px] text-muted-foreground`,children:l}):null]})]})}function eh({runners:e,value:t,onPick:n,disabled:r=!1}){return(0,Q.jsx)($m,{slot:`runner-pill`,ariaLabel:`Runner`,label:t,value:t,disabled:r,onPick:e=>n(e),options:zm.filter(t=>e.includes(t.id)).map(e=>({value:e.id,label:e.label,desc:e.desc}))})}function th(e){let t=z(),n=fe(),r=N(),i=Be(),a=ut(n.data),o=t.data?.defaultRunner,s=Gm(e.runner,a,o??a[0]??`claude`);return{runner:s,model:Km(e.model,s,r.data?.defaultModels,i.data),runners:a,defaultRunner:o,canRun:n.isSuccess&&a.length>0,providerPending:n.isPending,providerError:n.isError}}function nh(e){return{runner:e.defaultRunner!==void 0&&e.runner===e.defaultRunner?void 0:e.runner,model:e.model||void 0}}function rh({pick:e,onChange:t,disabled:n=!1}){let{runner:r,model:i,runners:a,canRun:o}=th(e),s=N(),c=Be(),l=Hm(r,c.data,[e.model,s.data?.defaultModels?.[r]]),u=n||!o;return(0,Q.jsxs)(Q.Fragment,{children:[a.length>1?(0,Q.jsx)(eh,{runners:a,value:r,disabled:u,onPick:e=>t({runner:e,model:null})}):null,(0,Q.jsx)($m,{slot:`model-pill`,ariaLabel:`Model`,label:l.find(e=>e.id===i).label,value:i,disabled:u,onPick:n=>t({...e,model:n}),options:l.map(e=>({value:e.id,label:e.label,desc:e.desc})),status:Um(r,c.data,c.isError)})]})}function ih(e){let t=e.visualViewport;return t?Math.max(0,Math.round(e.innerHeight-t.height-t.offsetTop)):0}function ah(e,t,n,r=250){let i=e.visualViewport;if(!i)return t(0),()=>{};let a,o=()=>{let i=ih(e);t(i),n&&(clearTimeout(a),a=setTimeout(()=>n(i),r))};return t(ih(e)),i.addEventListener(`resize`,o),i.addEventListener(`scroll`,o),()=>{clearTimeout(a),i.removeEventListener(`resize`,o),i.removeEventListener(`scroll`,o),t(0)}}function oh(e){let t=e.visualViewport;return t?{top:Math.max(0,Math.round(t.offsetTop)),bottom:ih(e)}:{top:0,bottom:0}}function sh(e,t=0){let n=typeof t==`number`?{top:t,right:t,bottom:t,left:t}:t;return{top:(n.top??0)+e.top,right:n.right??0,bottom:(n.bottom??0)+e.bottom,left:n.left??0}}function ch(e,t){let n=e.visualViewport;if(!n)return t({top:0,bottom:0}),()=>{};let r=()=>t(oh(e));return r(),n.addEventListener(`resize`,r),n.addEventListener(`scroll`,r),()=>{n.removeEventListener(`resize`,r),n.removeEventListener(`scroll`,r)}}function lh(){let[e,t]=(0,Z.useState)({top:0,bottom:0});return(0,Z.useEffect)(()=>ch(window,e=>t(t=>t.top===e.top&&t.bottom===e.bottom?t:e)),[]),e}function uh(e){let t=(0,Z.useRef)(e);t.current=e,(0,Z.useEffect)(()=>{let e=document.documentElement;return ah(window,t=>e.style.setProperty(`--kb`,`${t}px`),e=>t.current?.(e))},[])}function dh({...e}){return(0,Q.jsx)(nu,{"data-slot":`popover`,...e})}function fh({...e}){return(0,Q.jsx)(iu,{"data-slot":`popover-trigger`,...e})}function ph({className:e,align:t=`center`,sideOffset:n=4,collisionPadding:r,...i}){let a=lh();return(0,Q.jsx)(au,{children:(0,Q.jsx)(ou,{"data-slot":`popover-content`,align:t,sideOffset:n,collisionPadding:sh(a,r),className:Y(`z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-hidden 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`,e),...i})})}function mh({...e}){return(0,Q.jsx)(ru,{"data-slot":`popover-anchor`,...e})}function hh({templates:e,onInsert:t,triggerClassName:n,disabled:r,iconOnly:i=!1}){let[a,o]=(0,Z.useState)(!1),s=(0,Z.useRef)(null),c=At();return e.length===0?null:(0,Q.jsxs)(dh,{open:a,onOpenChange:o,children:[(0,Q.jsx)(fh,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`prompt-template-trigger`,"aria-label":`Insert a prompt template`,title:`Insert a prompt template`,disabled:r,className:Y(`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,Q.jsx)(Jn,{"aria-hidden":`true`,className:`size-3 shrink-0 text-violet`}),i?null:(0,Q.jsxs)(Q.Fragment,{children:[`templates`,(0,Q.jsx)(En,{"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})]})}),(0,Q.jsx)(ph,{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,Q.jsxs)(nf,{filter:jf,children:[(0,Q.jsx)(af,{placeholder:`search templates…`,onInput:()=>s.current?.scrollTo(0,0)}),(0,Q.jsxs)(of,{ref:s,"data-slot":`prompt-template-list-menu`,className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[(0,Q.jsx)(sf,{children:`Nothing matches.`}),(0,Q.jsx)(cf,{heading:`Insert a template`,children:e.map(e=>(0,Q.jsxs)(uf,{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,Q.jsxs)(`span`,{className:`flex w-full items-center gap-1.5`,children:[(0,Q.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,Q.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,Q.jsx)(ir,{"aria-hidden":`true`,className:`size-2.5`}),e.skills.length]}):null]}),(0,Q.jsx)(`span`,{className:`line-clamp-1 text-[11px] text-soft-foreground`,children:e.text})]},e.id))}),(0,Q.jsx)(lf,{}),(0,Q.jsx)(cf,{children:(0,Q.jsx)(uf,{value:`edit prompt templates settings`,"data-slot":`prompt-template-settings`,className:`text-[12px] text-muted-foreground`,onSelect:()=>{o(!1),c(`/settings/prompt-templates`)},children:`Edit templates…`})})]})]})})]})}var gh=80,_h=2e3,vh=50,yh=200,bh=50,xh=[{id:`add-tests`,label:`Add tests`,text:`Also add or update tests covering this change.`},{id:`explain-change`,label:`Explain the change`,text:`Explain what changed and why before finishing.`},{id:`keep-minimal`,label:`Keep it minimal`,text:`Keep the change as small and targeted as possible — no unrelated refactors.`},{id:`update-docs`,label:`Update docs`,text:`Also update any relevant documentation or comments.`},{id:`check-edge-cases`,label:`Double-check edge cases`,text:`Double-check edge cases and error handling before finishing.`}];function Sh(e){return!!e&&typeof e==`object`}function Ch(e){if(e===void 0||!Array.isArray(e))return xh.map(e=>({...e}));let t=new Set,n=[];for(let r of e){if(!Sh(r))continue;let e=typeof r.id==`string`?r.id.trim():``,i=typeof r.label==`string`?r.label.trim():``,a=typeof r.text==`string`?r.text.trim():``;if(!e||!i||!a||t.has(e))continue;t.add(e);let o=wh(r.skills);if(n.push({id:e,label:i.slice(0,gh),text:a.slice(0,_h),...o.length>0?{skills:o}:{}}),n.length>=vh)break}return n}function wh(e){if(!Array.isArray(e))return[];let t=new Set;for(let n of e){if(typeof n!=`string`)continue;let e=n.trim();if(!(!e||t.has(e))&&(t.add(e.slice(0,yh)),t.size>=bh))break}return[...t]}function Th(e,t){if(t.length===0)return[];let n=new Set(t);return e.filter(e=>e.skills?.some(e=>n.has(e)))}function Eh(e,t){return Th(e,t).map(e=>e.text).join(`
|
|
3
3
|
|
|
4
4
|
`)}function Dh(e,t,n,r=``){if(e===``||e===r||e===t){let e=r&&n?`${r}\n\n${n}`:r||n;return{text:e,applied:n?e:``}}return{text:e,applied:t}}function Oh(){return`tpl-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`}function kh(e,t,n){let r=Math.max(0,Math.min(t,e.length)),i=e.slice(0,r),a=e.slice(r),o=``;i.length>0&&(o=i.endsWith(`
|
|
@@ -19,4 +19,4 @@ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,n,r,t as i}from
|
|
|
19
19
|
`)[0]??``;return n.length>t?`${n.slice(0,t-1)}…`:n}function Vg(e){let{task:t,steps:n,model:r,runner:i,defaultRunner:a,variants:o,images:s,generateFollowups:c,todoId:l}=e;return{task:t,steps:[...n],model:r||void 0,runner:i===a?void 0:i,variants:o>1?o:void 0,images:s.length>0?[...s]:void 0,generateFollowups:c!==!1&&void 0,todoId:l||void 0}}function Hg({...e}){return(0,Q.jsx)(Fr,{"data-slot":`alert-dialog`,...e})}function Ug({...e}){return(0,Q.jsx)(Ir,{"data-slot":`alert-dialog-portal`,...e})}function Wg({className:e,...t}){return(0,Q.jsx)(Lr,{"data-slot":`alert-dialog-overlay`,className:Y(`fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0`,e),...t})}function Gg({className:e,...t}){return(0,Q.jsxs)(Ug,{children:[(0,Q.jsx)(Wg,{}),(0,Q.jsx)(Rr,{"data-slot":`alert-dialog-content`,className:Y(`fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border bg-card p-6 shadow-modal duration-200 outline-none 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 sm:max-w-md`,e),...t})]})}function Kg({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`alert-dialog-header`,className:Y(`flex flex-col gap-2 text-center sm:text-left`,e),...t})}function qg({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`alert-dialog-footer`,className:Y(`flex flex-col-reverse gap-2 sm:flex-row sm:justify-end`,e),...t})}function Jg({className:e,...t}){return(0,Q.jsx)(Vr,{"data-slot":`alert-dialog-title`,className:Y(`text-lg leading-none font-semibold`,e),...t})}function Yg({className:e,...t}){return(0,Q.jsx)(Hr,{"data-slot":`alert-dialog-description`,className:Y(`text-sm text-muted-foreground`,e),...t})}function Xg({className:e,...t}){return(0,Q.jsx)(zr,{"data-slot":`alert-dialog-action`,className:Y(Ue({variant:`contrast`}),e),...t})}function Zg({className:e,...t}){return(0,Q.jsx)(Br,{"data-slot":`alert-dialog-cancel`,className:Y(Ue({variant:`outline`}),e),...t})}function Qg({plan:e,starting:t,startAvailable:n,startUnavailableReason:r,startUnavailableAction:i,onStepsChange:a,onStart:o,onDiscard:s}){let[c,l]=(0,Z.useState)(null),[u,d]=(0,Z.useState)(null),f=()=>{l(null),d(null)},p=(t,n)=>{t.preventDefault(),c!==null&&c!==n&&a(Rg(e.steps,c,n)),f()},m=e.steps.length===0;return(0,Q.jsx)(wu,{open:!0,onOpenChange:e=>e?void 0:s(),children:(0,Q.jsxs)(Ou,{"data-slot":`plan-review`,showCloseButton:!1,className:Y(`top-0 left-0 flex h-dvh w-full max-w-full translate-x-0 translate-y-0 flex-col gap-0 rounded-none p-0`,`sm:top-1/2 sm:left-1/2 sm:h-auto sm:max-h-[85dvh] sm:max-w-[680px] sm:-translate-x-1/2 sm:-translate-y-1/2 sm:rounded-xl`),children:[(0,Q.jsxs)(ku,{className:`gap-1 border-b border-border px-5 pt-4 pb-3.5 text-left sm:text-left`,children:[(0,Q.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,Q.jsx)(ju,{className:`text-[11px] font-semibold tracking-[0.08em] text-muted-foreground uppercase`,children:`Proposed chain`}),(0,Q.jsx)(Eu,{"aria-label":`Discard the plan`,className:`-mt-1 -mr-1 rounded-md p-1 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`,children:(0,Q.jsx)(vt,{"aria-hidden":`true`,className:`size-4`})})]}),(0,Q.jsx)(Mu,{"data-slot":`plan-task`,title:e.task,className:`truncate text-[13.5px] font-medium text-foreground`,children:Bg(e.task)}),e.fallback?(0,Q.jsx)(`p`,{"data-slot":`plan-fallback`,className:`text-xs text-soft-foreground italic`,children:`planner unavailable — single-step plan`}):e.rationale===``?null:(0,Q.jsx)(`p`,{"data-slot":`plan-rationale`,className:`text-xs text-muted-foreground`,children:e.rationale})]}),(0,Q.jsx)(`ol`,{"data-slot":`plan-steps`,className:`flex-1 space-y-2 overflow-y-auto px-5 py-4`,children:m?(0,Q.jsx)(`li`,{className:`py-6 text-center text-sm text-muted-foreground`,children:`(no steps left — discard and plan again)`}):e.steps.map((t,n)=>(0,Q.jsxs)(`li`,{"data-slot":`plan-step`,"data-step-id":t.id,draggable:!0,onDragStart:()=>l(n),onDragOver:e=>{e.preventDefault(),d(n)},onDragLeave:()=>d(e=>e===n?null:e),onDrop:e=>p(e,n),onDragEnd:f,className:Y(`flex items-center gap-2.5 rounded-lg border border-border bg-card-2 px-3 py-2.5`,c===n&&`opacity-50`,u===n&&c!==null&&c!==n&&`border-ring`),children:[(0,Q.jsx)(Bn,{"aria-hidden":`true`,className:`size-3.5 shrink-0 cursor-grab text-soft-foreground`}),(0,Q.jsx)(`span`,{className:`w-5 shrink-0 font-mono text-[11px] text-soft-foreground tabular-nums`,children:String(n+1).padStart(2,`0`)}),(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,Q.jsx)(`span`,{className:`truncate text-[13px] font-semibold`,children:t.name??t.id}),t.skill?(0,Q.jsx)(`span`,{"data-slot":`plan-badge-skill`,title:`skill`,className:`shrink-0 rounded-full bg-violet/15 px-1.5 py-px font-mono text-[10.5px] font-medium text-violet`,children:t.skill}):null,t.command?(0,Q.jsx)(`span`,{"data-slot":`plan-badge-check`,className:`shrink-0 rounded-full bg-muted px-1.5 py-px text-[10.5px] font-medium text-muted-foreground`,children:`check`}):null]}),(0,Q.jsx)(`p`,{className:`truncate font-mono text-[11.5px] text-muted-foreground`,children:zg(t)})]}),(0,Q.jsxs)(`span`,{className:`flex shrink-0 items-center`,children:[(0,Q.jsx)(H,{type:`button`,variant:`ghost`,size:`icon-sm`,"data-slot":`plan-step-up`,"aria-label":`Move step ${n+1} up`,disabled:n===0,className:`size-7 text-muted-foreground`,onClick:()=>a(Rg(e.steps,n,n-1)),children:(0,Q.jsx)(Sn,{"aria-hidden":`true`,className:`size-3.5`})}),(0,Q.jsx)(H,{type:`button`,variant:`ghost`,size:`icon-sm`,"data-slot":`plan-step-down`,"aria-label":`Move step ${n+1} down`,disabled:n===e.steps.length-1,className:`size-7 text-muted-foreground`,onClick:()=>a(Rg(e.steps,n,n+1)),children:(0,Q.jsx)(yn,{"aria-hidden":`true`,className:`size-3.5`})}),(0,Q.jsx)(H,{type:`button`,variant:`ghost`,size:`icon-sm`,"data-slot":`plan-step-remove`,"aria-label":`Remove step ${n+1}`,className:`size-7 text-muted-foreground hover:text-danger`,onClick:()=>a(Lg(e.steps,n)),children:(0,Q.jsx)(vt,{"aria-hidden":`true`,className:`size-3.5`})})]})]},t.id))}),!n&&r?(0,Q.jsxs)(`p`,{id:`plan-start-guidance`,className:`flex flex-wrap items-center gap-1.5 border-t border-border px-5 pt-3 text-xs text-muted-foreground`,children:[(0,Q.jsx)(`span`,{children:r}),i]}):null,(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 px-5 py-3.5 pb-[max(14px,env(safe-area-inset-bottom))]`,children:[(0,Q.jsxs)(H,{type:`button`,"data-slot":`plan-start`,disabled:m||t||!n,title:n?void 0:r,"aria-describedby":!n&&r?`plan-start-guidance`:void 0,onClick:o,children:[(0,Q.jsx)($n,{"aria-hidden":`true`,className:`size-3.5`}),t?`Starting…`:`Start`]}),(0,Q.jsx)($g,{steps:e.steps,disabled:m}),(0,Q.jsx)(H,{type:`button`,variant:`ghost`,className:`ml-auto`,onClick:s,children:`Discard`})]})]})})}function $g({steps:e,disabled:t}){let n=v(),[r,i]=(0,Z.useState)(!1),[a,s]=(0,Z.useState)(``),[c,l]=(0,Z.useState)(!1),[u,d]=(0,Z.useState)(!1),f=async t=>{let r=a.trim();if(!(r===``||u)){d(!0);try{let a=await pt({name:r,steps:e,...t?{overwrite:!0}:{}});U(`Saved — ${a.path.split(`/`).pop()??a.path}`),n.invalidateQueries({queryKey:o.workflows}),l(!1),i(!1),s(``)}catch(e){e instanceof m&&e.exists===!0?l(!0):U(e instanceof Error?e.message:String(e),{tone:`danger`})}finally{d(!1)}}};return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(H,{type:`button`,variant:`outline`,"data-slot":`plan-save`,disabled:t,onClick:()=>i(!0),children:`Save as chain`}),(0,Q.jsx)(wu,{open:r,onOpenChange:e=>i(!!e),children:(0,Q.jsxs)(Ou,{"data-slot":`plan-save-dialog`,className:`sm:max-w-sm`,showCloseButton:!1,children:[(0,Q.jsxs)(ku,{children:[(0,Q.jsx)(ju,{children:`Save as chain`}),(0,Q.jsx)(Mu,{children:`Saves these steps as a reusable workflow — it joins the picker like any other chain.`})]}),(0,Q.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),f(!1)},children:[(0,Q.jsx)(Pu,{value:a,onChange:e=>s(e.target.value),"aria-label":`Chain name`,placeholder:`e.g. fix-and-verify-v2`,maxLength:80,autoFocus:!0}),(0,Q.jsxs)(Au,{className:`mt-4`,children:[(0,Q.jsx)(H,{type:`button`,variant:`outline`,onClick:()=>i(!1),children:`Cancel`}),(0,Q.jsx)(H,{type:`submit`,disabled:a.trim()===``||u,children:u?`Saving…`:`Save`})]})]})]})}),(0,Q.jsx)(Hg,{open:c,onOpenChange:e=>e?void 0:l(!1),children:(0,Q.jsxs)(Gg,{"data-slot":`plan-overwrite-dialog`,children:[(0,Q.jsxs)(Kg,{children:[(0,Q.jsxs)(Jg,{children:[`Overwrite “`,a.trim(),`”?`]}),(0,Q.jsx)(Yg,{children:`A chain with this name already exists. Overwriting replaces its steps with this plan.`})]}),(0,Q.jsxs)(qg,{children:[(0,Q.jsx)(Zg,{children:`Keep the existing chain`}),(0,Q.jsx)(Xg,{onClick:()=>void f(!0),children:`Overwrite`})]})]})})]})}function e_(){let[e]=Ne(),t=At(),n=v(),{projectId:r}=s(),i=jt().projectId,a=ce(),[c]=(0,Z.useState)(()=>Fg(e)),l=z(),u=ie(),f=me(),p=Xe(),m=ve(),h=N(),g=d(),[_,y]=(0,Z.useState)(()=>({...Mg(i),...c.ref===``?{}:{text:c.ref},...c.skill===``?{}:{source:{source:`skill`,ref:c.skill}}}));(0,Z.useEffect)(()=>{Ng(_,i)},[_,i]);let b=e=>y(t=>({...t,...e})),x=m.data?.recentSources,S=f.data,C=m.data?.skillUsage,w=(0,Z.useMemo)(()=>wf(S??[],C),[S,C]),T=u.data?.workflows??[],E=a.data?.projects??[],O=f.data!==void 0&&u.data!==void 0&&!m.isPending,k=Jm([_.source,m.data?.lastTask],w,T),A=k.source===`workflow`?T.find(e=>e.name===k.ref):void 0,j=k.source===`skill`?w.find(e=>e.name===k.ref):void 0,M=(0,Z.useRef)(null),ee=(0,Z.useMemo)(()=>Ch(m.data?.promptTemplates),[m.data?.promptTemplates]),P=Eh(ee,k.source===`skill`?[k.ref]:[]),te=(0,Z.useRef)(_.text);te.current=_.text;let ne=(0,Z.useRef)(``);(0,Z.useEffect)(()=>{if(!O)return;let e=Dh(te.current,ne.current,P);ne.current=e.applied,e.text!==te.current&&b({text:e.text})},[P,O]);let F=fe(),re=ut(F.data),I=l.data?.defaultRunner,L=I??`claude`,R=re.length>0?Gm(_.runner,re,L):null,ae=R??L,B=F.isSuccess&&re.length>0,oe=Be(),se=R===null?[]:Hm(R,oe.data,[_.model,h.data?.defaultModels?.[R]]),le=R===null?``:Km(_.model,R,h.data?.defaultModels,oe.data),ue=(0,Z.useRef)(!1);(0,Z.useEffect)(()=>{let e=B&&!ue.current;ue.current=B,e&&document.activeElement===document.body&&document.querySelector(`textarea[aria-label="Describe a task for the agent"]`)?.focus()},[B]);let de=l.data===void 0||l.data.repo!==null,V=de?_.variants:1,pe=k.source===`skill`||k.ref===`quick-task`||A?.steps.length===1,H=de,ge=!pe||V>1,_e=Tg({hasGit:de,variants:V,forceWorktree:!pe,planFirst:_.planFirst,explicitAutonomous:_.autonomous,explicitWorktree:_.worktree,interactive:j?.interactive,configuredAutonomous:g.data?.composerDefaults?.autonomous??g.data?.composerDefaults?.inheritedAutonomous??`source-dependent`,configuredWorktree:g.data?.composerDefaults?.worktree??g.data?.composerDefaults?.inheritedWorktree??!0,source:k.source}),ye=_e.worktree,be=_e.autonomous,xe=l.data===void 0||l.data.capabilities.followups,Se=xe?_.generateFollowups??m.data?.lastGenerateFollowups??!0:!1,[Ce,we]=(0,Z.useState)(null),[Te,Ee]=(0,Z.useState)(!1),[De,Oe]=(0,Z.useState)(!1),[ke,Ae]=(0,Z.useState)(()=>c.auto&&c.ref!==``),[je,Me]=(0,Z.useState)(()=>!c.auto&&c.ref!==``?{kind:`prefill`}:null),Pe=(0,Z.useRef)(!1),Fe=(0,Z.useRef)(!1);(0,Z.useEffect)(()=>{Pe.current||(Pe.current=!0,e.toString()!==``&&t(`/new`,{replace:!0}))},[]),(0,Z.useEffect)(()=>{if(!Fe.current&&!(!c.auto||c.ref===``)&&!F.isPending){if(!B||R===null){Fe.current=!0,Me({kind:`prefill`}),Ae(!1);return}if(!l.isPending){if(Fe.current=!0,I===void 0){Me({kind:`prefill`}),Ae(!1);return}(async()=>{let e=``;try{e=(await Je()).key}catch{}if(e!==``&&c.key===e)try{let e=await D(Sg(c,R,I));Pg(i),n.invalidateQueries({queryKey:o.runs.all}),t(Xm(e));return}catch(e){Me({kind:`failed`,message:e instanceof Error?e.message:String(e)})}else Me({kind:`blocked`});Ae(!1)})()}}},[I,l.isPending,F.isPending,B,R]),(0,Z.useEffect)(()=>{if(je===null||!O)return;Me(null);let e=c.skill!==``&&!w.some(e=>e.name===c.skill)?c.skill:``;e!==``&&b({text:wg(c.skill,c.ref),...T.some(e=>e.name===`quick-task`)?{source:{source:`workflow`,ref:`quick-task`}}:{}});let{message:t,tone:n}=Cg(je,e);U(t,{tone:n}),document.querySelector(`[data-slot="composer"] button[aria-label="Start task"], [data-slot="composer"] button[aria-label="Plan task"]`)?.focus()},[je,O]);let Ie=async(e,r)=>{if(!B||R===null)throw Error(F.isPending?`Checking agent providers…`:F.isError?`Provider authentication could not be verified.`:`Connect an agent provider before starting a task.`);if(!O)throw Error(`Still loading workflows and skills — try again in a second.`);if(_.planFirst){Ee(!0);try{we(Ig(e,r,await He(e))),b({text:e})}finally{Ee(!1)}return}let a=await D(Ym({task:e,source:k,model:le,runner:R,defaultRunner:I,variants:V,images:r,worktree:ye,autonomous:be,generateFollowups:Se,todoId:c.todo}));he({lastTask:k,recentSources:Rm(x,k),...xe?{lastGenerateFollowups:Se}:{},...k.source===`skill`&&m.data!==void 0?{skillUsage:Ef(m.data.skillUsage,k.ref)}:{}}).then(()=>n.invalidateQueries({queryKey:o.uiState})).catch(()=>{}),Pg(i),n.invalidateQueries({queryKey:o.runs.all}),t(Xm(a))},Le=async()=>{if(!(Ce===null||Ce.steps.length===0||De||!B||R===null)){Oe(!0);try{let e=await D(Vg({task:Ce.task,steps:Ce.steps,model:le,runner:R,defaultRunner:I,variants:V,images:Ce.images,generateFollowups:Se,todoId:c.todo}));xe&&he({lastGenerateFollowups:Se}).then(()=>n.invalidateQueries({queryKey:o.uiState})).catch(()=>{}),Pg(i),we(null),n.invalidateQueries({queryKey:o.runs.all}),t(Xm(e))}catch(e){U(e instanceof Error?e.message:String(e),{tone:`danger`})}finally{Oe(!1)}}};return ke?(0,Q.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,Q.jsx)(Ve,{}),(0,Q.jsxs)(`div`,{"data-slot":`auto-starting`,role:`status`,className:`text-center`,children:[(0,Q.jsx)(`h1`,{className:`animate-pulse text-lg font-semibold tracking-tight`,children:`Starting task…`}),(0,Q.jsx)(`p`,{className:`mt-1.5 text-[13.5px] text-muted-foreground`,children:`Launched from a bookmarklet — taking you to the run.`})]})]}):(0,Q.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,Q.jsx)(Ve,{}),(0,Q.jsxs)(`div`,{className:`w-full max-w-[720px]`,children:[(0,Q.jsxs)(`header`,{className:`mb-6 text-center max-md:mb-4`,children:[(0,Q.jsx)(`h1`,{className:`text-lg font-semibold tracking-tight max-md:text-base`,children:`What should the agent work on?`}),(0,Q.jsx)(`p`,{className:`mt-1.5 text-[13.5px] text-muted-foreground max-md:text-xs`,children:`Runs in an isolated worktree — review everything before it lands.`})]}),(0,Q.jsx)(qh,{ref:M,onSubmit:Ie,value:_.text,onValueChange:e=>b({text:e}),autoFocus:!0,placeholder:`Describe a task for the agent — / for skills…`,ariaLabel:`Describe a task for the agent`,sendAriaLabel:_.planFirst?`Plan task`:`Start task`,disabled:!B||De,disabledReason:F.isPending?`Checking agent providers…`:F.isError?`Provider authentication could not be verified.`:`Connect an agent provider before starting a task.`,autocompleteSkills:!0,footerStart:(0,Q.jsxs)(Q.Fragment,{children:[E.length>1&&r!==void 0?(0,Q.jsx)(a_,{projects:E,projectId:r,onPick:e=>t(`/p/${encodeURIComponent(e)}/new`,{replace:!0})}):null,(0,Q.jsx)(o_,{source:k,ready:O,skills:w,skillUsage:C,workflows:T,onPick:e=>b({source:e})}),(0,Q.jsx)(hh,{templates:ee,iconOnly:!0,onInsert:e=>M.current?.insertAtCaret(e)}),re.length>1?(0,Q.jsx)(eh,{runners:re,value:ae,disabled:!B,onPick:e=>b({runner:e,model:null})}):null,(0,Q.jsx)($m,{slot:`model-pill`,ariaLabel:`Model`,label:se.find(e=>e.id===le)?.label??`auto`,value:le,disabled:!B,onPick:e=>b({model:e}),options:se.map(e=>({value:e.id,label:e.label,desc:e.desc})),status:Um(ae,oe.data,oe.isError)}),(0,Q.jsx)($m,{slot:`variants-pill`,ariaLabel:`Parallel variants`,label:V>1?`×${V} variants`:`×1`,value:String(V),onPick:e=>b({variants:Number(e)}),disabled:!de,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`}]}),H?(0,Q.jsx)(t_,{on:ye,disabled:ge,disabledReason:V>1?`Parallel variants always use isolated worktrees`:`Multi-step workflows require an isolated worktree`,onChange:e=>b({worktree:e})}):null,(0,Q.jsx)(n_,{on:be,disabled:_.planFirst,onChange:e=>b({autonomous:e})}),j?.interactive&&(_.autonomous===null||_.worktree===null)?(0,Q.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,xe?(0,Q.jsx)(r_,{on:Se,onChange:e=>b({generateFollowups:e})}):null,p.data?(0,Q.jsx)(s_,{repo:p.data}):null]}),footerEnd:(0,Q.jsxs)(Q.Fragment,{children:[!B&&!F.isPending?(0,Q.jsx)(X,{to:`/settings/agents#providers`,className:`text-xs font-medium text-foreground underline underline-offset-4`,children:`Configure providers`}):null,(0,Q.jsx)(c_,{planFirst:_.planFirst,planning:Te,onModeChange:e=>b({planFirst:e})}),(0,Q.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:Ih()})]})}),(0,Q.jsx)(u_,{onPick:e=>b({text:e})})]}),Ce===null?null:(0,Q.jsx)(Qg,{plan:Ce,starting:De,startAvailable:B,startUnavailableReason:F.isPending?`Checking agent providers…`:F.isError?`Provider authentication could not be verified.`:`Connect an agent provider before starting a task.`,startUnavailableAction:F.isPending?void 0:(0,Q.jsx)(X,{to:`/settings/agents#providers`,children:`Configure providers`}),onStepsChange:e=>we(t=>t&&{...t,steps:e}),onStart:()=>void Le(),onDiscard:()=>we(null)})]})}function t_({on:e,disabled:t,disabledReason:n,onChange:r}){return(0,Q.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:Y(Zm,e&&`border-primary/60 text-foreground`),children:[e?(0,Q.jsx)(Pe,{"aria-hidden":`true`,className:`size-3 shrink-0 text-primary`}):(0,Q.jsx)(ar,{"aria-hidden":`true`,className:`size-3 shrink-0 text-soft-foreground`}),`Worktree`]})}function n_({on:e,disabled:t,onChange:n}){return(0,Q.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:Y(Zm,e&&!t&&`border-primary/60 text-foreground`),children:[e?(0,Q.jsx)(Pe,{"aria-hidden":`true`,className:`size-3 shrink-0 text-primary`}):(0,Q.jsx)(ar,{"aria-hidden":`true`,className:`size-3 shrink-0 text-soft-foreground`}),`Autonomous`]})}function r_({on:e,onChange:t}){return(0,Q.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:Y(Zm,e&&`border-primary/60 text-foreground`),children:[e?(0,Q.jsx)(Pe,{"aria-hidden":`true`,className:`size-3 shrink-0 text-primary`}):(0,Q.jsx)(ar,{"aria-hidden":`true`,className:`size-3 shrink-0 text-soft-foreground`}),`Follow-ups`]})}function i_(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 a_({projects:e,projectId:t,onPick:n}){let[r,i]=(0,Z.useState)(!1),[a,o]=(0,Z.useState)(``),s=e.find(e=>e.id===t),c=i_(e,a);return(0,Q.jsxs)(dh,{open:r,onOpenChange:e=>{i(e),e||o(``)},children:[(0,Q.jsx)(fh,{asChild:!0,children:(0,Q.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:Y(Zm,`border-foreground/60 font-semibold text-foreground`),children:[(0,Q.jsx)(Pn,{"aria-hidden":`true`,className:`size-3 shrink-0 text-soft-foreground`}),(0,Q.jsx)(`span`,{className:`max-w-40 truncate`,children:s?.name??t}),Qm]})}),(0,Q.jsx)(ph,{align:`start`,sideOffset:8,className:`w-[300px] max-w-[calc(100vw-2rem)] p-0`,children:(0,Q.jsxs)(nf,{shouldFilter:!1,children:[(0,Q.jsx)(af,{placeholder:`search projects…`,value:a,onValueChange:o}),(0,Q.jsxs)(of,{"data-slot":`project-menu`,className:`max-h-[min(18rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[c.length===0?(0,Q.jsx)(sf,{children:`Nothing matches.`}):null,c.map(e=>(0,Q.jsxs)(uf,{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,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs font-medium`,children:e.name}),e.status===`missing`?(0,Q.jsx)(`span`,{className:`shrink-0 text-[11px] text-soft-foreground`,children:`folder not found`}):e.branch===void 0?null:(0,Q.jsx)(`span`,{className:`shrink-0 font-mono text-[11px] text-soft-foreground`,children:e.branch}),e.id===t?(0,Q.jsx)(Pe,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-primary`}):null]},e.id))]}),(0,Q.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 o_({source:e,ready:t,skills:n,skillUsage:r,workflows:i,onPick:a}){let[o,s]=(0,Z.useState)(!1),[c,l]=(0,Z.useState)(``),[u,d]=(0,Z.useState)(null),f=(0,Z.useRef)(null),{mostUsed:p,project:m,global:h}=Cf(Rf(n,c,r),r),g=zf(i,c),_=p.length===0&&m.length===0&&h.length===0&&g.length===0,v=e=>{a(e),s(!1)},y=(t,n)=>{let r=e.source===`skill`&&e.ref===t.name;return(0,Q.jsxs)(uf,{value:`skill ${t.name} ${t.path}`,keywords:Nf(t.name,t.description),"data-slot":`source-option`,"data-source-kind":`skill`,"data-source-ref":t.name,onSelect:()=>v({source:`skill`,ref:t.name}),children:[(0,Q.jsx)(`span`,{className:Y(`shrink-0 font-mono text-xs`,n&&`font-semibold`),children:t.name}),t.description?(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:t.description}):null,(0,Q.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,Q.jsx)(jn,{"aria-hidden":`true`,className:`size-3.5`})}),r?(0,Q.jsx)(Pe,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-primary`}):null]},t.path)};return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(xg,{skill:u,onClose:()=>d(null)}),(0,Q.jsxs)(dh,{open:o,onOpenChange:e=>{s(e),e||l(``)},children:[(0,Q.jsx)(fh,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`source-pill`,"aria-label":`Choose a skill or workflow`,disabled:!t,className:Y(Zm,`border-foreground/60 font-mono text-[11.5px] font-semibold text-foreground`),children:[e.source===`skill`?(0,Q.jsx)(ir,{"aria-hidden":`true`,className:`size-3 shrink-0 text-violet`}):(0,Q.jsx)(sr,{"aria-hidden":`true`,className:`size-3 shrink-0 text-violet`}),(0,Q.jsx)(`span`,{className:`max-w-44 truncate`,children:t?e.ref:`…`}),Qm]})}),(0,Q.jsx)(ph,{align:`start`,sideOffset:8,className:`w-[336px] max-w-[calc(100vw-2rem)] p-0`,children:(0,Q.jsxs)(nf,{shouldFilter:!1,children:[(0,Q.jsx)(af,{placeholder:`search skills & workflows…`,value:c,onValueChange:l,onInput:()=>f.current?.scrollTo(0,0)}),(0,Q.jsxs)(of,{ref:f,"data-slot":`source-menu`,className:`max-h-[min(18rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[_?(0,Q.jsx)(sf,{children:`Nothing matches.`}):null,p.length>0?(0,Q.jsx)(cf,{heading:`Most used`,children:p.map(e=>y(e,bf(e)))}):null,m.length>0?(0,Q.jsx)(cf,{heading:`Project skills`,children:m.map(e=>y(e,!0))}):null,g.length>0?(0,Q.jsx)(cf,{heading:`Workflows`,children:g.map(t=>{let n=e.source===`workflow`&&e.ref===t.name;return(0,Q.jsxs)(uf,{value:`workflow ${t.name}`,keywords:Nf(t.name,t.description),"data-slot":`source-option`,"data-source-kind":`workflow`,"data-source-ref":t.name,onSelect:()=>v({source:`workflow`,ref:t.name}),children:[(0,Q.jsx)(`span`,{className:`shrink-0 font-mono text-xs`,children:t.name}),t.description?(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:t.description}):null,n?(0,Q.jsx)(Pe,{"aria-hidden":`true`,className:`ml-auto size-3.5 shrink-0 text-primary`}):null]},t.name)})}):null,h.length>0?(0,Q.jsx)(cf,{heading:`Global`,children:h.map(e=>y(e,!1))}):null]})]})})]})]})}function s_({repo:e}){let t=v(),n=k({mutationFn:e=>je({baseBranch:e}),onSuccess:e=>{t.invalidateQueries({queryKey:o.repo}),U(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=>U(e.message,{tone:`danger`})});return e.info?(0,Q.jsx)($m,{slot:`base-pill`,ariaLabel:`Base branch`,label:(0,Q.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),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}function c_({planFirst:e,planning:t,onModeChange:n}){return(0,Q.jsxs)(`div`,{"data-slot":`mode-seg`,role:`radiogroup`,"aria-label":`Run mode`,className:`inline-flex items-center gap-0.5 rounded-lg bg-muted p-[3px]`,children:[(0,Q.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":!e,onClick:()=>n(!1),className:Y(`h-6 rounded-md px-2 text-xs transition-colors`,e?`font-medium text-muted-foreground hover:text-foreground`:`bg-card font-semibold text-foreground shadow-xs`),children:`Start`}),(0,Q.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":e,"aria-busy":t||void 0,"data-slot":`mode-plan`,onClick:()=>n(!0),className:Y(`h-6 rounded-md px-2 text-xs transition-colors`,e?`bg-contrast font-semibold text-contrast-foreground ring-2 ring-ring/55`:`font-medium text-muted-foreground hover:text-foreground`,t&&`animate-pulse`),children:t?`Planning…`:`Plan first`})]})}var l_=[`Fix a failing or flaky test`,`Summarize recent commits on this branch`,`Update the README for recent changes`];function u_({onPick:e}){return(0,Q.jsx)(`div`,{className:`mt-7 flex flex-wrap justify-center gap-2 max-md:justify-start`,children:l_.map(t=>(0,Q.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,Q.jsx)(ir,{"aria-hidden":`true`,className:`size-3 shrink-0 text-soft-foreground`}),t]},t))})}function d_(){return(0,Q.jsx)(`div`,{"data-route":`not-found`,className:`flex min-h-full flex-col`,children:(0,Q.jsx)(W,{icon:(0,Q.jsx)(kn,{}),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,Q.jsx)(H,{asChild:!0,variant:`outline`,children:(0,Q.jsx)(X,{to:`/`,children:`Back to tasks`})})})})}function f_(){return(0,Q.jsx)(`div`,{"data-route":`repo-git`,className:`flex min-h-full flex-col`,children:(0,Q.jsx)(W,{icon:(0,Q.jsx)(j,{className:`motion-safe:animate-spin`}),tone:`neutral`,title:`Loading repository…`,subtitle:`Fetching the repo's git state.`})})}function p_(){return(0,Q.jsxs)(`div`,{"data-route":`skills`,className:`flex min-h-full flex-col`,children:[(0,Q.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,Q.jsx)(`h1`,{className:`text-base font-semibold`,children:`Skills`}),(0,Q.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Markdown playbooks agents can follow.`})]}),(0,Q.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 m_({projectId:e,registry:t}){let n=t.projects.length?t.projects:[{id:t.bootProject,name:t.bootProject}];return(0,Q.jsx)(`div`,{"data-route":`unknown-project`,className:`flex min-h-full flex-col`,children:(0,Q.jsx)(W,{icon:(0,Q.jsx)(Fn,{}),tone:`neutral`,title:`“${e}” isn’t registered here`,subtitle:`This cezar doesn’t serve a project by that id. The link may come from another machine’s workspace — these are the projects registered on this one:`,children:(0,Q.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,Q.jsx)(`li`,{children:(0,Q.jsxs)(ct,{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,Q.jsxs)(`span`,{className:`font-mono text-[11px] font-normal text-soft-foreground`,children:[`/p/`,e.id]})]})},e.id))})})})}function h_(){return(0,Q.jsx)(`div`,{"data-route":`workflows`,className:`flex min-h-full flex-col`,children:(0,Q.jsx)(W,{icon:(0,Q.jsx)(j,{className:`motion-safe:animate-spin`}),tone:`neutral`,title:`Loading workflows…`,subtitle:`Fetching the saved chains and the skills palette.`})})}function g_({tab:e}){return(0,Q.jsx)(`div`,{"data-route":`task-${e}`,className:`flex min-h-full flex-col`,children:(0,Q.jsx)(W,{icon:(0,Q.jsx)(j,{className:`motion-safe:animate-spin`}),tone:`neutral`,title:e===`changes`?`Loading changes…`:`Loading files…`,subtitle:`Fetching the run record.`})})}function __({tab:e,error:t}){let n=t instanceof m&&t.status===404;return(0,Q.jsx)(`div`,{"data-route":`task-${e}`,className:`flex min-h-full flex-col`,children:(0,Q.jsx)(W,{icon:n?(0,Q.jsx)(gt,{}):(0,Q.jsx)(_t,{}),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,Q.jsx)(H,{asChild:!0,variant:`outline`,children:(0,Q.jsx)(X,{to:`/`,children:`Back to tasks`})})})})}function v_(){return(0,Q.jsx)(`div`,{"data-route":`task-thread`,className:`flex min-h-full flex-col`,children:(0,Q.jsx)(W,{icon:(0,Q.jsx)(j,{className:`motion-safe:animate-spin`}),tone:`neutral`,title:`Loading task…`,subtitle:`Fetching the run and its session transcript.`})})}var y_=1500;function b_(e,t){let n=(0,Z.useMemo)(()=>e.split(`
|
|
20
20
|
`).map(e=>[{content:e}]),[e]),r=(0,Z.useMemo)(()=>eg(t),[t]),i=n.length>y_,[a,o]=(0,Z.useState)(null);return(0,Z.useEffect)(()=>{if(r===null||i)return;let t=!1;return fg(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:dg(e,r)?.tokens??n}var x_=`m-0 min-h-full w-full whitespace-pre font-mono text-xs leading-[1.7] px-3 py-2 [tab-size:2]`;function S_({value:e,onChange:t,language:n,readOnly:r,className:i,...a}){let o=b_(e,n),s=(0,Z.useRef)(null),c=(0,Z.useRef)(null),l=()=>{let e=c.current,t=s.current;!e||!t||(t.scrollTop=e.scrollTop,t.scrollLeft=e.scrollLeft)};return(0,Z.useLayoutEffect)(l,[e]),(0,Q.jsxs)(`div`,{"data-slot":`code-editor`,className:Y(`relative overflow-hidden rounded-md border border-input bg-card`,i),children:[(0,Q.jsx)(`pre`,{ref:s,"aria-hidden":`true`,className:Y(x_,`pointer-events-none absolute inset-0 overflow-auto text-soft-foreground`),children:o.map((e,t)=>(0,Q.jsx)(`span`,{className:`block`,children:e.length===0?`
|
|
21
21
|
`:(0,Q.jsxs)(Q.Fragment,{children:[e.map((e,t)=>(0,Q.jsx)(`span`,{style:e.color===void 0?void 0:{color:e.color},children:e.content},t)),`
|
|
22
|
-
`]})},t))}),(0,Q.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:Y(x_,`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 C_=`An editor-plus-commit: a saved change reaches a run after you commit it to the base branch.`;function w_(e){return t=>t.runners.includes(e)}function T_(e,t,n,r){let i=w_(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 E_=[{id:`claude`,label:`Claude`,groups:[T_(`claude`,`settings`,`Settings`),T_(`claude`,`mcp`,`MCP`,`A dedicated .mcp.json (key: mcpServers), shared via version control.`),T_(`claude`,`memory`,`Memory & instructions`)]},{id:`codex`,label:`Codex`,note:C_,groups:[T_(`codex`,`settings`,`Settings`),T_(`codex`,`mcp`,`MCP`,`Inside config.toml under [mcp_servers.<id>] — the same file as Codex’s settings.`),T_(`codex`,`memory`,`Memory & instructions`)]},{id:`opencode`,label:`OpenCode`,note:C_,groups:[T_(`opencode`,`settings`,`Settings`),T_(`opencode`,`mcp`,`MCP`,`Under the "mcp" key in opencode.json — the same file as OpenCode’s settings.`),T_(`opencode`,`memory`,`Memory & instructions`)]}];function D_(e){let t=E_.find(t=>t.id===e);if(!t)throw Error(`no agent descriptor for ${e}`);return t}function O_(e){return 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 k_(){let e=Me(),t=z(),n=(0,Z.useMemo)(()=>t.data?Wm(t.data.checks):E_.map(e=>e.id),[t.data]);return e.isPending?(0,Q.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,Q.jsx)(W,{icon:(0,Q.jsx)(Mn,{}),tone:`danger`,title:`Agent config did not load`,subtitle:e.error.message,heading:`h2`}):(0,Q.jsx)(A_,{listing:e.data,installed:n})}function A_({listing:e,installed:t}){let[n,r]=(0,Z.useState)(`claude`),[i,a]=(0,Z.useState)(null),o=D_(n),s=e.files.find(e=>e.id===i)??null,c=e=>{r(e),a(null)};return(0,Q.jsxs)(`div`,{"data-slot":`agent-config`,className:`flex flex-col gap-4 p-4 md:p-6`,children:[!e.editable&&(0,Q.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,Q.jsx)(`div`,{"data-slot":`agent-config-agents`,role:`tablist`,className:`flex flex-wrap gap-1 rounded-md bg-muted/40 p-1`,children:E_.map(e=>(0,Q.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:Y(`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,Q.jsx)(Cu,{variant:`outline`,className:`text-[10px] text-soft-foreground`,children:`not installed`})]},e.id))}),o.note&&(0,Q.jsx)(`p`,{"data-slot":`agent-config-agent-note`,className:`text-[12px] text-soft-foreground`,children:o.note}),(0,Q.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-[minmax(0,20rem)_minmax(0,1fr)]`,children:[(0,Q.jsx)(`nav`,{"data-slot":`agent-config-nav`,className:`flex flex-col gap-5`,children:(0,Q.jsx)(j_,{agent:o,listing:e,selectedId:i,onSelect:a})}),(0,Q.jsx)(`div`,{"data-slot":`agent-config-editor-pane`,children:s?(0,Q.jsx)(N_,{file:s},s.id):(0,Q.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 j_({agent:e,listing:t,selectedId:n,onSelect:r}){return(0,Q.jsx)(Q.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,Q.jsxs)(`section`,{"data-slot":`agent-config-group`,"data-group":i.id,"data-agent":e.id,children:[(0,Q.jsx)(`p`,{className:`mb-1 text-[11px] font-medium uppercase tracking-wide text-soft-foreground`,children:i.label}),i.note&&(0,Q.jsx)(`p`,{className:`mb-2 text-[12px] text-soft-foreground`,children:i.note}),(0,Q.jsx)(`ul`,{className:`flex flex-col gap-1`,children:a.map(e=>(0,Q.jsx)(`li`,{children:(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`agent-config-file`,"data-selected":e.id===n,onClick:()=>r(e.id),className:Y(`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,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-[12px]`,children:e.label}),e.seeded&&(0,Q.jsx)(Cu,{variant:`outline`,className:`shrink-0 text-[10px]`,children:`seeded`}),!e.exists&&(0,Q.jsx)(`span`,{className:`shrink-0 text-[11px] text-soft-foreground`,children:`absent`})]})},e.id))}),o&&t.userMcp&&(0,Q.jsx)(M_,{userMcp:t.userMcp})]},i.id)})})}function M_({userMcp:e}){return(0,Q.jsxs)(`div`,{"data-slot":`agent-config-user-mcp`,className:`mt-3`,children:[(0,Q.jsx)(`h4`,{className:`mb-1 text-[12px] font-semibold`,children:`User & local scopes`}),(0,Q.jsxs)(`p`,{className:`mb-2 text-[12px] text-soft-foreground`,children:[`Managed by `,(0,Q.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,Q.jsx)(`ul`,{className:`flex flex-wrap gap-1`,children:e.servers.map(e=>(0,Q.jsx)(`li`,{children:(0,Q.jsx)(Cu,{variant:`outline`,className:`font-mono text-[11px]`,children:e})},e))}):(0,Q.jsx)(`p`,{className:`text-[12px] text-soft-foreground`,children:`No user-scoped MCP servers.`}):(0,Q.jsx)(`p`,{className:`text-[12px] text-soft-foreground`,children:`Could not read the file.`})]})}function N_({file:e}){let t=O(e.id),n=te(e.id),[r,i]=(0,Z.useState)(null),[a,o]=(0,Z.useState)(!1),[s,c]=(0,Z.useState)(null),l=t.data?.version??null;(0,Z.useEffect)(()=>{t.data&&(i(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,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(`span`,{className:`font-mono text-[13px]`,children:e.label}),(0,Q.jsx)(Cu,{variant:`outline`,className:`text-[10px] uppercase`,children:e.format}),(0,Q.jsx)(`a`,{href:e.docsUrl,target:`_blank`,rel:`noreferrer`,className:`text-[12px] text-soft-foreground underline hover:text-foreground`,children:`docs`})]}),(0,Q.jsx)(`p`,{"data-slot":`agent-config-precedence`,className:`text-[12px] text-soft-foreground`,children:e.precedence}),(0,Q.jsxs)(`p`,{"data-slot":`agent-config-effect`,className:`text-[12px] text-foreground/80`,children:[O_(e),e.hotReload?` ${e.hotReload}`:``]}),t.isPending?(0,Q.jsx)(`p`,{className:`text-[13px] text-soft-foreground`,children:`Loading file…`}):t.isError?(0,Q.jsx)(`p`,{className:`text-[13px] text-destructive`,children:t.error.message}):(0,Q.jsx)(S_,{value:u,language:e.format,readOnly:!f,onChange:i,"aria-label":`${e.label} contents`,className:`h-[26rem]`}),s&&(0,Q.jsx)(`p`,{"data-slot":`agent-config-format-error`,className:`text-[12px] text-destructive`,children:s}),a&&(0,Q.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,Q.jsx)(`span`,{children:`The file changed on disk since you opened it.`}),(0,Q.jsx)(H,{size:`sm`,variant:`outline`,onClick:()=>void t.refetch(),children:`Reload from disk`})]}),f&&(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(H,{size:`sm`,onClick:()=>{c(null),o(!1),n.mutate({content:u,version:l},{onSuccess:()=>{i(null),U(`${e.exists?`Saved`:`Created`} ${e.label}`)},onError:e=>{e instanceof m&&e.status===409?o(!0):e instanceof m&&e.status===400?c(e.message):U(e.message,{tone:`danger`})}})},disabled:!d||n.isPending,children:e.exists?`Save`:`Create`}),(0,Q.jsx)(H,{size:`sm`,variant:`ghost`,onClick:()=>i(null),disabled:!d||n.isPending,children:`Revert`}),d&&(0,Q.jsx)(`span`,{className:`text-[12px] text-soft-foreground`,children:`Unsaved changes`})]})]})}function P_({className:e,size:t=`default`,...n}){return(0,Q.jsx)(hu,{"data-slot":`switch`,"data-size":t,className:Y(`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,Q.jsx)(_u,{"data-slot":`switch-thumb`,className:Y(`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 F_=[{id:`claude`,label:`Claude Code`,login:`claude auth login`},{id:`codex`,label:`Codex`,login:`codex login`},{id:`opencode`,label:`OpenCode`,login:`opencode auth login`}],I_=e=>({claude:e,codex:e,opencode:e}),L_={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 R_(e,t,n){return{providers:e.providers.map(e=>e.provider===t?{...e,enabled:n}:e)}}function z_(){let e=fe(),t=a(),n=Ge(),r=v(),[i,o]=(0,Z.useState)(null),s=(0,Z.useRef)(Promise.resolve()),c=(0,Z.useRef)(I_(0)),l=(0,Z.useRef)(I_(0)),u=(0,Z.useRef)(e.data);(0,Z.useEffect)(()=>{i&&rt(e.data,i.provider)?.status===`connected`&&o(null)},[i,e.data]),(0,Z.useEffect)(()=>{if(e.data){if(Object.values(l.current).every(e=>e===0)||!u.current){u.current=e.data;return}u.current={providers:e.data.providers.map(e=>({...e,enabled:l.current[e.provider]>0?rt(u.current,e.provider)?.enabled??e.enabled:e.enabled}))}}},[e.data]);let d=(0,Z.useCallback)((e,t)=>{let n=_.providerStatus,i=r.getQueryData(n);if(!i)return;u.current||=i;let a=R_(i,e,t);l.current[e]+=1,r.setQueryData(n,a);let o=++c.current[e];s.current=s.current.then(async()=>{try{let i=await Ke(e,t),a=rt(i,e)?.enabled;if(a===void 0)return;if(u.current=R_(u.current??i,e,a),o===c.current[e]){let t=r.getQueryData(n);r.setQueryData(n,t?R_(t,e,a):i)}}catch(t){if(o===c.current[e]){let i=rt(u.current,e)?.enabled,a=r.getQueryData(n);a&&i!==void 0?r.setQueryData(n,R_(a,e,i)):u.current?r.setQueryData(n,u.current):r.removeQueries({queryKey:n,exact:!0}),U(t instanceof Error?t.message:String(t),{tone:`danger`})}}finally{--l.current[e]}})},[r]),f=k({mutationFn:P,onSuccess:async e=>{o(null),U(e.opened?`Finish signing in in the terminal, then check again.`:`Provider is already connected.`),await r.invalidateQueries({queryKey:_.providerStatus})},onError:(e,t)=>{if(e instanceof m&&e.command){let n=F_.find(e=>e.id===t)?.label??t;o({provider:t,label:n,message:e.message,command:e.command});return}U(e.message,{tone:`danger`})}}),p=async e=>{try{await navigator.clipboard.writeText(e),U(`Command copied`)}catch{U(`Could not copy the command`,{tone:`danger`})}};return(0,Q.jsxs)(`section`,{id:`providers`,"data-slot":`provider-settings`,className:`scroll-mt-20`,children:[(0,Q.jsxs)(`div`,{className:`mb-2`,children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:`Providers`}),(0,Q.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Connect the coding agents available on this computer.`})]}),e.isError?(0,Q.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,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`text-[13px] font-medium text-foreground`,children:`Provider status could not be loaded`}),(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.error.message})]}),(0,Q.jsx)(H,{type:`button`,variant:`outline`,size:`sm`,disabled:e.isFetching,onClick:()=>void e.refetch(),children:`Retry`})]}):null,(0,Q.jsx)(`div`,{className:`flex flex-col gap-2`,children:F_.map(r=>{let a=rt(e.data,r.id),o=a?.status,s=o?L_[o]:e.isPending?{label:`Checking…`,tone:`neutral`}:L_.unknown,c=f.isPending&&f.variables===r.id,l=o===`disconnected`||o===`unknown`,u=a?.authFailureId;return(0,Q.jsxs)(Z.Fragment,{children:[(0,Q.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,Q.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsx)(`h3`,{className:`text-[13px] font-semibold text-foreground`,children:r.label}),(0,Q.jsxs)(`div`,{className:`mt-1 flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,Q.jsx)(Wu,{tone:s.tone,pulse:e.isPending}),(0,Q.jsx)(`span`,{children:s.label}),a?.enabled===!1?(0,Q.jsx)(`span`,{children:`Disabled`}):null]}),o===`not-installed`?(0,Q.jsxs)(`p`,{className:`mt-1.5 text-xs text-soft-foreground`,children:[`Install `,r.label,`, then run `,(0,Q.jsx)(`code`,{children:r.login}),`.`]}):o===`unknown`||e.isError&&!o?(0,Q.jsx)(`p`,{className:`mt-1.5 text-xs text-soft-foreground`,children:`Verification failed. Check again when the provider is available.`}):a?.hint?(0,Q.jsx)(`p`,{className:`mt-1.5 text-xs text-soft-foreground`,children:a.hint}):null]}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[o===`not-installed`?null:(0,Q.jsx)(P_,{checked:a?.enabled??!0,"aria-label":`Use ${r.label}`,onCheckedChange:e=>d(r.id,e)}),l?(0,Q.jsx)(H,{type:`button`,variant:`ghost`,size:`sm`,disabled:t.isPending,onClick:()=>t.mutate(void 0,{onError:e=>U(e.message,{tone:`danger`})}),children:`Check again`}):null,o===`disconnected`?(0,Q.jsx)(H,{type:`button`,variant:`outline`,size:`sm`,disabled:f.isPending,onClick:()=>f.mutate(r.id),children:c?`Opening…`:`Connect`}):null,u===void 0?null:(0,Q.jsx)(H,{type:`button`,variant:`outline`,size:`sm`,disabled:n.isPending,onClick:()=>n.mutate({provider:r.id,authFailureId:u},{onSuccess:()=>U(`${r.label} can be tried again.`),onError:e=>U(e.message,{tone:`danger`})}),children:`Try again`})]})]}),u===void 0?null:(0,Q.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,Q.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,Q.jsx)(`p`,{className:`text-[13px] text-foreground`,children:i.message}),(0,Q.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2`,children:[(0,Q.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,Q.jsx)(H,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>void p(i.command),children:`Copy command`})]})]}):null]},r.id)})})]})}var B_=2e4;function V_(){let e=N(),t=Be(),n=fe();return e.isPending?(0,Q.jsx)(`p`,{"data-slot":`agents-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading agent settings…`}):e.isError?(0,Q.jsx)(W,{icon:(0,Q.jsx)(Tn,{}),tone:`danger`,title:`Agent settings did not load`,subtitle:e.error.message,heading:`h2`}):(0,Q.jsx)(H_,{config:e.data,catalog:t.data,providerStatus:n})}function H_({config:e,catalog:t,providerStatus:n}){let r=Xe(),i=v(),a=k({mutationFn:e=>je(e),onSuccess:e=>{i.setQueryData(o.config,e),i.invalidateQueries({queryKey:o.health}),i.invalidateQueries({queryKey:o.repo})},onError:e=>U(e.message,{tone:`danger`})}),[s,c]=(0,Z.useState)(e.systemPrompt??``),l=s.trim(),u=l===(e.systemPrompt??``),d=l.length>B_;return(0,Q.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,Q.jsx)(z_,{}),(0,Q.jsxs)(U_,{title:`Default runner`,hint:`Preselected for new tasks and used by the chain planner. Each task can still pick another runner.`,children:[(0,Q.jsx)(`div`,{role:`radiogroup`,"aria-label":`Default runner`,"data-slot":`agents-runner`,className:`inline-flex w-fit gap-0.5 rounded-md border border-border bg-card p-0.5`,children:zm.map(t=>{let r=t.id===e.defaultRunner,i=rt(n.data,t.id),o=!n.isPending&&!n.isError&&i?.enabled===!0&&i.status===`connected`,s=n.isPending?`Checking provider authentication…`:n.isError?`Provider authentication could not be verified.`:i?.enabled===!1?`This provider is disabled. Enable it above or choose another provider.`:o?void 0:`Connect this provider before selecting it.`;return(0,Q.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":r,"data-value":t.id,title:s??t.desc,disabled:a.isPending||!o,onClick:()=>a.mutate({defaultRunner:t.id}),className:Y(`rounded-sm px-3 py-1.5 font-mono text-[13px] font-medium transition-colors disabled:opacity-50`,r?`bg-muted text-foreground`:`text-muted-foreground hover:text-foreground`),children:t.label},t.id)})}),!n.isPending&&!n.isError&&rt(n.data,e.defaultRunner)?.enabled===!1?(0,Q.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`This provider is disabled. Enable it above or choose another provider.`}):null]}),(0,Q.jsx)(U_,{title:`Default models`,hint:`The model preselected in the composer for each runner. Auto lets the runner decide per task.`,children:(0,Q.jsx)(`div`,{className:`flex max-w-md flex-col gap-2`,children:zm.map(r=>{let i=rt(n.data,r.id),o=!n.isPending&&!n.isError&&i?.enabled===!0&&i.status===`connected`,s=n.isPending?`Checking provider authentication…`:n.isError?`Provider authentication could not be verified.`:i?.enabled===!1?`This provider is disabled. Enable it above or choose another provider.`:o?void 0:`Connect this provider before selecting it.`;return(0,Q.jsxs)(`label`,{className:`flex items-center gap-3`,children:[(0,Q.jsx)(`span`,{className:`w-24 shrink-0 font-mono text-xs text-muted-foreground`,children:r.label}),(0,Q.jsxs)(`select`,{"aria-label":`Default model for ${r.label}`,"data-slot":`agents-model`,"data-runner":r.id,value:e.defaultModels[r.id]??``,title:s??r.desc,disabled:a.isPending||!o,onChange:e=>a.mutate({defaultModels:{[r.id]:e.target.value||null}}),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:[Hm(r.id,t,[e.defaultModels[r.id]]).map(e=>(0,Q.jsx)(`option`,{value:e.id,children:e.id===``?`auto (default)`:e.label},e.id)),Um(r.id,t)?(0,Q.jsx)(`option`,{disabled:!0,children:Um(r.id,t)}):null]})]},r.id)})})}),(0,Q.jsxs)(U_,{title:`System prompt`,hint:`Extra instructions appended to every run, whichever runner executes it. This is the only place it is edited.`,children:[(0,Q.jsx)(yt,{"aria-label":`System prompt`,"data-slot":`agents-system-prompt`,value:s,onChange:e=>c(e.target.value),placeholder:`Extra rules for every agent run — conventions, tone, review requirements…`,className:`min-h-32 max-w-xl`}),(0,Q.jsxs)(`div`,{className:`flex max-w-xl items-center gap-3`,children:[(0,Q.jsx)(H,{type:`button`,variant:`outline`,size:`sm`,"data-action":`agents-save-prompt`,disabled:u||d||a.isPending,onClick:()=>a.mutate({systemPrompt:l===``?null:l},{onSuccess:()=>U(l===``?`System prompt cleared`:`System prompt saved`)}),children:`Save`}),d?(0,Q.jsxs)(`p`,{"data-slot":`agents-prompt-limit`,className:`text-[11px] text-danger`,children:[l.length.toLocaleString(),` characters — the limit is`,` `,B_.toLocaleString(),`.`]}):(0,Q.jsx)(`p`,{className:`text-[11px] text-soft-foreground`,children:`Leave empty and save to clear. Applied to new runs only.`})]})]}),(0,Q.jsx)(U_,{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,Q.jsxs)(`label`,{className:`flex w-fit items-center gap-3`,children:[(0,Q.jsx)(P_,{"aria-label":`Live title updates`,"data-slot":`agents-live-title-updates`,checked:e.liveTitleUpdates??!0,disabled:a.isPending,onCheckedChange:e=>a.mutate({liveTitleUpdates:e},{onSuccess:()=>U(e?`Live title updates on`:`Live title updates off`)})}),(0,Q.jsxs)(`span`,{className:`text-[13px] text-muted-foreground`,children:[e.liveTitleUpdates??!0?`On`:`Off`,e.liveTitleUpdates===null&&` (default)`]})]})}),(0,Q.jsx)(U_,{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,Q.jsxs)(`label`,{className:`flex w-fit items-center gap-3`,children:[(0,Q.jsx)(P_,{"aria-label":`Review changes before finishing`,"data-slot":`agents-review-gate`,checked:e.reviewGate??!1,disabled:a.isPending,onCheckedChange:e=>a.mutate({reviewGate:e},{onSuccess:()=>U(e?`Review gate on`:`Review gate off`)})}),(0,Q.jsxs)(`span`,{className:`text-[13px] text-muted-foreground`,children:[e.reviewGate??!1?`On`:`Off`,e.reviewGate===null&&` (default)`]})]})}),(0,Q.jsx)(U_,{title:`Base branch`,hint:`New task worktrees branch from this and draft PRs target it. Also settable from the Git view.`,children:r.data?.info?(0,Q.jsxs)(`select`,{"aria-label":`Base branch`,"data-slot":`agents-base-branch`,value:e.baseBranch??``,disabled:a.isPending,onChange:e=>a.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,Q.jsx)(`option`,{value:``,children:`follow checked-out branch (default)`}),r.data.branches.map(e=>(0,Q.jsx)(`option`,{value:e,children:e},e))]}):(0,Q.jsx)(`p`,{"data-slot":`agents-base-branch-unavailable`,className:`text-[13px] text-soft-foreground`,children:r.isPending?`Loading branches…`:`Not a git repository — tasks run in place, no branching.`})})]})}function U_({title:e,hint:t,children:n}){return(0,Q.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:e}),(0,Q.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:t})]}),n]})}var W_=`cez-accent`,G_=`cez-density`,K_=`lime`,q_=`comfortable`;function J_(e){return e===`lime`||e===`violet`?e:K_}function Y_(e){return e===`comfortable`||e===`compact`||e===`ultra`?e:q_}function X_(e){let t=e&&typeof e==`object`?e:{};return{accent:J_(t.accent),density:Y_(t.density)}}function Z_(){try{return{accent:J_(localStorage.getItem(W_)),density:Y_(localStorage.getItem(G_))}}catch{return{accent:K_,density:q_}}}function Q_(e){try{localStorage.setItem(W_,e.accent),localStorage.setItem(G_,e.density)}catch{}}function $_(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}var ev=Z.createContext(null);function tv({children:e}){let t=v(),n=st(),[r,i]=Z.useState(Z_),a=n.data;Z.useEffect(()=>{if(a===void 0)return;let e=X_(a.appearance);i(e),Q_(e)},[a]),Z.useLayoutEffect(()=>{$_(document.documentElement,r)},[r]);let o=Z.useCallback(e=>{i(e),Q_(e),Qe({appearance:e}).then(e=>t.setQueryData(_.uiState,e)).catch(e=>{U(e instanceof Error?e.message:String(e),{tone:`danger`}),t.invalidateQueries({queryKey:_.uiState})})},[t]),s=Z.useCallback(e=>o({accent:e,density:r.density}),[o,r.density]),c=Z.useCallback(e=>o({accent:r.accent,density:e}),[o,r.accent]),l=Z.useMemo(()=>({accent:r.accent,density:r.density,setAccent:s,setDensity:c}),[r,s,c]);return(0,Q.jsx)(ev.Provider,{value:l,children:e})}function nv(){let e=Z.useContext(ev);if(!e)throw Error(`cezar: useAppearance() must be called inside <AppearanceProvider>`);return e}var rv=[{value:`system`,label:`System`,icon:Kn},{value:`light`,label:`Light`,icon:or},{value:`dark`,label:`Dark`,icon:qn}],iv=[{value:`lime`,label:`Lime`,swatch:`var(--accent-lime)`},{value:`violet`,label:`Violet`,swatch:`var(--violet)`}],av=[{value:`comfortable`,label:`Comfortable`},{value:`compact`,label:`Compact`},{value:`ultra`,label:`Compact for real`}];function ov({slot:e,label:t,value:n,options:r,onChange:i}){return(0,Q.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,Q.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":t,"data-value":e.value,onClick:()=>i(e.value),className:Y(`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,Q.jsx)(e.icon,{"aria-hidden":`true`,className:`size-3.5`}):null,e.swatch?(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`size-3 rounded-full border border-border`,style:{background:e.swatch}}):null,e.label]},e.value)})})}function sv({title:e,hint:t,children:n}){return(0,Q.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:e}),(0,Q.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:t})]}),n]})}function cv(){let{theme:e,setTheme:t}=nd(),{accent:n,density:r,setAccent:i,setDensity:a}=nv();return(0,Q.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,Q.jsx)(sv,{title:`Theme`,hint:`System follows your OS preference. Applies to this browser.`,children:(0,Q.jsx)(ov,{slot:`appearance-theme`,label:`Theme`,value:e,options:rv,onChange:t})}),(0,Q.jsx)(sv,{title:`Accent`,hint:`The primary action color. Saved with this repo's cockpit state.`,children:(0,Q.jsx)(ov,{slot:`appearance-accent`,label:`Accent`,value:n,options:iv,onChange:i})}),(0,Q.jsx)(sv,{title:`Density`,hint:`Compact tightens spacing across the cockpit — text stays the same size.`,children:(0,Q.jsx)(ov,{slot:`appearance-density`,label:`Density`,value:r,options:av,onChange:a})})]})}var lv=`http://localhost:4321`;function uv(e,t,n,r=lv,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)}`}function dv(){let e=me();return e.isPending?(0,Q.jsx)(`p`,{"data-slot":`bookmarklets-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading bookmarklets…`}):e.isError?(0,Q.jsx)(W,{icon:(0,Q.jsx)(_t,{}),tone:`danger`,heading:`h2`,title:`Could not load bookmarklets`,subtitle:e.error.message}):(0,Q.jsx)(`div`,{className:`flex min-h-full flex-1 overflow-y-auto px-4 py-5 md:px-7`,children:(0,Q.jsx)(fv,{skills:xf(e.data??[])})})}function fv({skills:e}){let t=C(),n=z(),r=ce(),[i,a]=(0,Z.useState)(!1),[o,s]=(0,Z.useState)(``),c=t.data?.key??``,l=window.location.origin,u=Lt()??n.data?.bootProject??null,d=r.data?.projects.find(e=>e.id===u)?.name??By(n.data)?.name??null,f=o.trim().toLowerCase(),p=e.filter(e=>e.name.toLowerCase().includes(f));return(0,Q.jsxs)(`div`,{"data-slot":`bookmarklet-panel`,className:`mx-auto w-full max-w-2xl`,children:[(0,Q.jsx)(`h2`,{className:`text-base font-semibold`,children:`Run from GitHub`}),(0,Q.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,Q.jsx)(`span`,{className:`font-mono`,children:`npx cezar`}),`.`]}),(0,Q.jsxs)(`label`,{className:`mt-4 flex items-center gap-2 text-[13px] font-medium`,children:[(0,Q.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,Q.jsx)(`span`,{className:`font-normal text-soft-foreground`,children:`— re-drag the buttons after changing this`})]}),(0,Q.jsx)(`div`,{"data-slot":`bm-generic`,className:`mt-4`,children:(0,Q.jsx)(pv,{label:d?`cezar (${d}): this PR/issue`:`cezar: this PR/issue`,url:uv(``,!1,c,l,u),hint:`prefills the form — nothing starts by itself`})}),(0,Q.jsx)(Pu,{"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,Q.jsx)(`div`,{"data-slot":`bm-list`,className:`mt-3 flex flex-col gap-2`,children:p.length>0?p.map(e=>(0,Q.jsx)(pv,{label:d?`/${e.name} (${d})`:`/${e.name}`,url:uv(e.name,i,c,l,u),hint:e.source},e.path)):(0,Q.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 pv({label:e,url:t,hint:n}){let r=(0,Z.useRef)(null);(0,Z.useEffect)(()=>{r.current?.setAttribute(`href`,t)},[t]);let i=async()=>{try{await navigator.clipboard.writeText(t),U(`Bookmarklet URL copied.`)}catch{U(`Copy failed — drag the button instead.`,{tone:`danger`})}};return(0,Q.jsxs)(`div`,{"data-slot":`bm-row`,className:`flex min-w-0 items-center gap-2.5`,children:[(0,Q.jsxs)(`a`,{ref:r,draggable:!0,"data-slot":`bm-link`,title:`Drag me to your bookmarks bar`,onClick:e=>{e.preventDefault(),U(`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:[(0,Q.jsx)(cr,{"aria-hidden":`true`,className:`size-3 text-primary`}),e]}),(0,Q.jsx)(`button`,{type:`button`,"data-slot":`bm-copy`,title:`Copy the bookmarklet URL`,onClick:()=>void i(),className:`shrink-0 text-xs font-medium text-muted-foreground transition-colors hover:text-foreground`,children:`Copy`}),n?(0,Q.jsx)(`span`,{className:`min-w-0 truncate text-[11px] text-soft-foreground`,children:n}):null]})}function mv(e){return{enabled:(e&&typeof e==`object`?e:{}).enabled===!0}}function hv(){let e=globalThis.Notification;if(typeof e!=`function`)return`unsupported`;let t=e.permission;return t===`granted`||t===`denied`?t:`default`}function gv(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||gf(i)&&r.push(i)}return{entering:r,statuses:n}}function _v(e){return e.enabled&&e.hidden&&e.permission===`granted`}function vv(e){let t=hf(e).label;return{title:e.titleSummary??e.title,body:`Task ${t}`,tag:`cezar-run-${e.id}`}}function yv(){let e=v(),t=st(),[n,r]=Z.useState(!1),[i,a]=Z.useState(hv),o=t.data;Z.useEffect(()=>{o!==void 0&&r(mv(o.notifications).enabled)},[o]);let s=Z.useCallback(t=>{r(t),Qe({notifications:{enabled:t}}).then(t=>e.setQueryData(_.uiState,t)).catch(t=>{U(t instanceof Error?t.message:String(t),{tone:`danger`}),e.invalidateQueries({queryKey:_.uiState})})},[e]),c=Z.useCallback(e=>{if(!e){s(!1);return}if(hv()!=="default"){s(!0);return}s(!0),Notification.requestPermission().then(e=>a(e)).catch(()=>a(hv()))},[s]),l=i===`unsupported`;return(0,Q.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,Q.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,Q.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:(0,Q.jsx)(`label`,{htmlFor:`notifications-enabled`,children:`Notify when an agent needs you`})}),(0,Q.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,Q.jsx)(P_,{id:`notifications-enabled`,"data-slot":`notifications-toggle`,checked:n,disabled:l,onCheckedChange:c})]}),l?(0,Q.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,!l&&n&&i===`denied`?(0,Q.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 bv({title:e,hint:t,children:n}){return(0,Q.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:e}),(0,Q.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:t})]}),n]})}var xv=1,Sv={ok:`ok`,"not-git":`no git repo`,missing:`folder not found`};function Cv(e){let t=new Date(e);return Number.isNaN(t.getTime())?`—`:t.toLocaleDateString(void 0,{month:`short`,day:`numeric`})}function wv(){let e=d(),t=ce();return e.isPending||t.isPending?(0,Q.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,Q.jsx)(W,{icon:(0,Q.jsx)(Ln,{}),tone:`danger`,title:`Project settings did not load`,subtitle:(e.error??t.error)?.message,heading:`h2`}):(0,Q.jsx)(Tv,{config:e.data,registry:t.data})}function Tv({config:e,registry:t}){return(0,Q.jsxs)(`div`,{"data-slot":`projects-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,Q.jsx)(Ev,{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,Q.jsx)(Ev,{configKey:`projectsDir`,value:e.projectsDir,title:`Default checkout folder`,hint:`Where “Clone from GitHub” puts 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,Q.jsx)(Dv,{registry:t,workspaceMax:e.resources.maxParallel})]})}function Ev({configKey:e,value:t,title:n,hint:r,placeholder:i,slot:a,savedLabel:o,footer:s,refreshProjects:c=!1}){let l=v(),u=k({mutationFn:t=>We(e===`browseRoot`?{browseRoot:t}:{projectsDir:t}),onSuccess:t=>{l.setQueryData(_.config,t),e===`browseRoot`?l.invalidateQueries({queryKey:_.fsBrowseRoot}):c&&l.invalidateQueries({queryKey:_.projects})}}),[d,f]=(0,Z.useState)(t),p=d.trim(),m=p===t,h=u.isError?u.error.message:null;return(0,Q.jsxs)(bv,{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,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.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,Q.jsx)(H,{type:`button`,variant:`outline`,size:`sm`,"data-action":`projects-save-${a}-root`,disabled:m||p===``||u.isPending,onClick:()=>u.mutate(p,{onSuccess:()=>U(`${o} set to ${p}`)}),children:`Save`})]}),h===null?(0,Q.jsx)(`p`,{className:`text-[11px] text-soft-foreground`,children:s}):(0,Q.jsxs)(`p`,{"data-slot":`projects-${a}-root-error`,role:`alert`,className:`text-[11px] text-danger`,children:[h,` — setting unchanged`]})]})}function Dv({registry:e,workspaceMax:t}){let[n,r]=(0,Z.useState)(null),i=$e();return(0,Q.jsxs)(bv,{title:`Registered projects`,hint:`Every folder cezar has run in, plus the ones added from the GUI. “Max parallel” caps how many of that project's tasks run at once; 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,Q.jsx)(`p`,{"data-slot":`projects-empty`,className:`text-[13px] text-soft-foreground`,children:`No projects registered yet.`}):(0,Q.jsx)(`div`,{className:`overflow-x-auto rounded-md border border-border`,children:(0,Q.jsxs)(`table`,{className:`w-full border-collapse text-sm`,children:[(0,Q.jsx)(`caption`,{className:`sr-only`,children:`Projects registered in this workspace`}),(0,Q.jsx)(`thead`,{children:(0,Q.jsxs)(`tr`,{className:`border-b border-border text-left text-[12px] text-soft-foreground`,children:[(0,Q.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Project`}),(0,Q.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Status`}),(0,Q.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Max parallel`}),(0,Q.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Added`}),(0,Q.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium text-right`,children:`Actions`})]})}),(0,Q.jsx)(`tbody`,{children:e.projects.map(n=>(0,Q.jsx)(Ov,{project:n,isBoot:n.id===e.bootProject,workspaceMax:t,disabled:i.isPending,onRemove:()=>r(n)},n.id))})]})}),(0,Q.jsx)(Hg,{open:n!==null,onOpenChange:e=>!e&&r(null),children:(0,Q.jsxs)(Gg,{children:[(0,Q.jsxs)(Kg,{children:[(0,Q.jsxs)(Jg,{children:[`Remove `,n?.name,` from the workspace?`]}),(0,Q.jsxs)(Yg,{children:[`This only unregisters the project — `,(0,Q.jsx)(`strong`,{children:`nothing on disk is deleted`}),`. The folder, its git history and its task history all stay exactly where they are, and opening it again re-registers it with everything intact.`,(0,Q.jsx)(`span`,{className:`mt-1 block truncate font-mono text-[11px] text-foreground`,title:n?.root,children:n?.root})]})]}),(0,Q.jsxs)(qg,{children:[(0,Q.jsx)(Zg,{children:`Keep it`}),(0,Q.jsx)(Xg,{"data-action":`projects-confirm-remove`,className:`bg-danger text-danger-foreground hover:brightness-[0.96]`,onClick:()=>{if(!n)return;let{id:e,name:t}=n;r(null),i.mutate(e,{onSuccess:()=>U(`${t} removed from the workspace — its files are untouched`),onError:e=>U(e.message,{tone:`danger`})})},children:`Remove from list`})]})]})})]})}function Ov({project:e,isBoot:t,workspaceMax:n,disabled:r,onRemove:i}){return(0,Q.jsxs)(`tr`,{"data-slot":`project-row`,"data-project":e.id,className:`border-b border-border last:border-0`,children:[(0,Q.jsxs)(`th`,{scope:`row`,className:`max-w-[260px] px-3 py-2 text-left font-normal`,children:[(0,Q.jsx)(`span`,{className:`block truncate text-foreground`,children:e.name}),(0,Q.jsx)(`span`,{className:`block truncate font-mono text-[11px] text-soft-foreground`,title:e.root,children:e.root})]}),(0,Q.jsxs)(`td`,{className:`px-3 py-2`,children:[(0,Q.jsx)(`span`,{"data-slot":`project-status`,className:e.status===`missing`?`text-[12px] text-danger`:`text-[12px] text-soft-foreground`,children:Sv[e.status]}),e.status===`missing`?null:(0,Q.jsxs)(`span`,{className:`ml-1 text-[11px] text-soft-foreground`,children:[`· `,e.source]})]}),(0,Q.jsx)(`td`,{className:`px-3 py-2`,children:(0,Q.jsx)(kv,{project:e,workspaceMax:n})}),(0,Q.jsx)(`td`,{className:`px-3 py-2 tabular-nums text-soft-foreground`,children:Cv(e.addedAt)}),(0,Q.jsx)(`td`,{className:`px-3 py-2 text-right`,children:(0,Q.jsx)(H,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`project-remove`,"aria-label":`Unregister ${e.name} (no files are deleted)`,title:t?`cezar is serving this project — it re-registers itself at every start`:void 0,disabled:r||t,onClick:i,children:`Remove`})})]})}function kv({project:e,workspaceMax:t}){let n=lt(),r=e.maxParallel===void 0?``:String(e.maxParallel);return(0,Q.jsxs)(`select`,{"aria-label":`Max parallel tasks for ${e.name}`,"data-slot":`project-max-parallel`,value:r,disabled:n.isPending,onChange:r=>{let i=r.target.value,a=i===``?null:Number(i);n.mutate({id:e.id,maxParallel:a},{onSuccess:()=>U(a===null?`${e.name} inherits the workspace limit (${t})`:`${e.name} runs at most ${a} task${a===1?``:`s`} at a time`),onError:e=>U(e.message,{tone:`danger`})})},className:`block w-44 rounded-md border border-input bg-card px-2 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,Q.jsxs)(`option`,{value:``,children:[`Inherit workspace (`,t,`)`]}),Array.from({length:16},(e,t)=>t+xv).map(e=>(0,Q.jsx)(`option`,{value:e,children:e},e))]})}function Av(){let e=ve();return e.isPending?(0,Q.jsx)(`p`,{"data-slot":`prompt-templates-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading prompt templates…`}):e.isError?(0,Q.jsx)(W,{icon:(0,Q.jsx)(Jn,{}),tone:`danger`,title:`Prompt templates did not load`,subtitle:e.error.message,heading:`h2`}):(0,Q.jsx)(jv,{initial:Ch(e.data.promptTemplates)})}function jv({initial:e}){let t=v(),n=me(),r=ve(),[i,a]=(0,Z.useState)(e),[s,c]=(0,Z.useState)(``),[l,u]=(0,Z.useState)(``),d=k({mutationFn:e=>he({promptTemplates:e}),onSuccess:e=>{t.setQueryData(o.uiState,e),U(`Prompt templates saved`)},onError:e=>U(e.message,{tone:`danger`})}),f=JSON.stringify(i)!==JSON.stringify(e),p=i.some(e=>e.label.trim()===``||e.text.trim()===``),m=(e,t)=>a(n=>n.map(n=>n.id===e?{...n,...t}:n)),h=(e,t)=>a(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=>a(t=>t.filter(t=>t.id!==e));return(0,Q.jsx)(`div`,{"data-slot":`prompt-templates-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,Q.jsxs)(Nv,{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,Q.jsx)(`div`,{"data-slot":`prompt-template-list`,className:`flex flex-col gap-3`,children:i.length===0?(0,Q.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.`}):i.map(e=>(0,Q.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,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(Pu,{"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,Q.jsx)(H,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`prompt-template-remove`,title:`Remove this template`,onClick:()=>g(e.id),children:(0,Q.jsx)(vt,{"aria-hidden":`true`,className:`size-3.5`})})]}),(0,Q.jsx)(yt,{"aria-label":`Text for ${e.label||`this template`}`,"data-slot":`prompt-template-text-input`,value:e.text,maxLength:2e3,onChange:t=>m(e.id,{text:t.target.value}),className:`min-h-14 text-[13px]`}),(0,Q.jsxs)(`div`,{className:`mt-0.5 flex flex-wrap items-center gap-1.5`,children:[(0,Q.jsx)(Mv,{label:e.label,skills:n.data??[],skillUsage:r.data?.skillUsage,selected:e.skills??[],onToggle:t=>h(e.id,t)}),(e.skills??[]).map(t=>(0,Q.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,Q.jsx)(vt,{"aria-hidden":`true`,className:`size-3`})]},t))]})]},e.id))}),(0,Q.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,Q.jsx)(Pu,{"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,Q.jsx)(yt,{"aria-label":`New template text`,"data-slot":`prompt-template-new-text`,placeholder:`The instructions to insert…`,value:l,maxLength:2e3,onChange:e=>u(e.target.value),className:`min-h-14 text-[13px]`}),(0,Q.jsxs)(H,{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||(a(n=>[...n,{id:Oh(),label:e,text:t}]),c(``),u(``))},className:`self-start`,children:[(0,Q.jsx)(er,{"aria-hidden":`true`,className:`size-3.5`}),`Add template`]})]}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Q.jsx)(H,{type:`button`,variant:`contrast`,size:`sm`,"data-action":`prompt-templates-save`,disabled:!f||p||d.isPending,onClick:()=>d.mutate(i),children:`Save`}),(0,Q.jsx)(H,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`prompt-templates-reset`,disabled:d.isPending,onClick:()=>a(xh.map(e=>({...e}))),children:`Reset to defaults`}),p?(0,Q.jsx)(`p`,{"data-slot":`prompt-templates-invalid`,className:`text-[11px] text-danger`,children:`Every template needs both a label and text.`}):null]})]})})}function Mv({label:e,skills:t,skillUsage:n,selected:r,onToggle:i}){let[a,o]=(0,Z.useState)(!1),s=(0,Z.useRef)(null),{mostUsed:c,project:l,global:u}=Cf(t,n),d=(e,t)=>{let n=r.includes(e.name);return(0,Q.jsxs)(uf,{value:`skill ${e.name} ${e.path}`,keywords:Nf(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,Q.jsx)(`span`,{className:Y(`shrink-0 font-mono text-xs`,t&&`font-semibold`),children:e.name}),e.description?(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null,n?(0,Q.jsx)(Pe,{"aria-hidden":`true`,className:`ml-auto size-3.5 shrink-0 text-primary`}):null]},e.path)};return(0,Q.jsxs)(dh,{open:a,onOpenChange:o,children:[(0,Q.jsx)(fh,{asChild:!0,children:(0,Q.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:Y(`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,Q.jsx)(ir,{"aria-hidden":`true`,className:`size-3 shrink-0 text-violet`}),t.length===0?`no skills found`:`apply with…`,(0,Q.jsx)(En,{"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,Q.jsx)(ph,{align:`start`,sideOffset:8,className:`w-[336px] max-w-[calc(100vw-2rem)] p-0`,children:(0,Q.jsxs)(nf,{filter:jf,children:[(0,Q.jsx)(af,{placeholder:`search skills…`,onInput:()=>s.current?.scrollTo(0,0)}),(0,Q.jsxs)(of,{ref:s,"data-slot":`prompt-template-skill-menu`,className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[(0,Q.jsx)(sf,{children:`Nothing matches.`}),c.length>0?(0,Q.jsx)(cf,{heading:`Most used`,children:c.map(e=>d(e,bf(e)))}):null,l.length>0?(0,Q.jsx)(cf,{heading:`Project skills`,children:l.map(e=>d(e,!0))}):null,u.length>0?(0,Q.jsx)(cf,{heading:`Global`,children:u.map(e=>d(e,!1))}):null]})]})})]})}function Nv({title:e,hint:t,children:n}){return(0,Q.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:e}),(0,Q.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:t})]}),n]})}var Pv=1,Fv=1,Iv=60,Lv=256;function Rv(){let e=d();return e.isPending?(0,Q.jsx)(`p`,{"data-slot":`resources-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading resource settings…`}):e.isError?(0,Q.jsx)(W,{icon:(0,Q.jsx)(Rn,{}),tone:`danger`,title:`Resource settings did not load`,subtitle:e.error.message,heading:`h2`}):(0,Q.jsx)(zv,{config:e.data})}function zv({config:e}){let t=v(),n=k({mutationFn:e=>We(e),onSuccess:e=>t.setQueryData(_.config,e),onError:e=>U(e.message,{tone:`danger`})}),[r,i]=(0,Z.useState)(e.resources.memoryLimitMb?String(e.resources.memoryLimitMb):``),a=e.resources.monitoringWakeIntervalMinutes??null,[o,s]=(0,Z.useState)(a===null?`park`:`interval`),[c,l]=(0,Z.useState)(String(a??5)),u=Number(c),d=!Number.isInteger(u)||u<Fv||u>Iv,f=o===`park`?a===null:!d&&a===u,p=()=>n.mutate({resources:{monitoringWakeIntervalMinutes:o===`park`?null:u}},{onSuccess:()=>U(o===`park`?`Monitoring will stay parked`:`Monitoring will re-check every ${u} minutes`)}),m=r.trim()===``?0:Number(r),h=r.trim()!==``&&(!Number.isInteger(m)||m<Lv),g=(e.resources.memoryLimitMb??0)===(h?-1:m),y=()=>n.mutate({resources:{memoryLimitMb:m===0?null:m}},{onSuccess:()=>U(m===0?`Memory limit cleared`:`Memory limit set to ${m} 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,Q.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,Q.jsxs)(bv,{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,Q.jsx)(`select`,{"aria-label":`Max parallel tasks`,"data-slot":`resources-max-parallel`,value:e.resources.maxParallel,disabled:n.isPending,onChange:e=>n.mutate({resources:{maxParallel:Number(e.target.value)}}),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:Array.from({length:16},(e,t)=>t+Pv).map(e=>(0,Q.jsx)(`option`,{value:e,children:e},e))}),(0,Q.jsxs)(`p`,{className:`text-[11px] text-soft-foreground`,children:[`Need a different limit for one project?`,` `,(0,Q.jsx)(ct,{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,Q.jsxs)(bv,{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,Q.jsx)(`select`,{"aria-label":`Extra monitoring sessions`,"data-slot":`resources-max-monitoring`,value:e.resources.maxMonitoringSessions??2,disabled:n.isPending,onChange:e=>n.mutate({resources:{maxMonitoringSessions:Number(e.target.value)}}),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:Array.from({length:17},(e,t)=>(0,Q.jsx)(`option`,{value:t,children:t},t))}),(0,Q.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,Q.jsxs)(bv,{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,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Q.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,Q.jsx)(`option`,{value:`park`,children:`Park until resumed`}),(0,Q.jsx)(`option`,{value:`interval`,children:`Re-check on an interval`})]}),o===`interval`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`input`,{type:`number`,min:Fv,max:Iv,"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,Q.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`minutes`})]}):null,(0,Q.jsx)(H,{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,Q.jsx)(`p`,{"data-slot":`resources-monitoring-wake-invalid`,className:`text-[11px] text-danger`,children:`Enter a whole number from 1 to 60 minutes.`}):(0,Q.jsx)(`p`,{className:`text-[11px] text-soft-foreground`,children:`Applied consistently to Claude, Codex and OpenCode.`})]}),(0,Q.jsxs)(bv,{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,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`input`,{type:`number`,inputMode:`numeric`,min:Lv,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,Q.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`MiB`}),(0,Q.jsx)(H,{type:`button`,variant:`outline`,size:`sm`,"data-action":`resources-save-memory`,disabled:g||h||n.isPending,onClick:y,children:`Save`})]}),h?(0,Q.jsxs)(`p`,{"data-slot":`resources-memory-invalid`,className:`text-[11px] text-danger`,children:[`Enter a whole number of at least `,Lv,` MiB, or leave empty for no limit.`]}):(0,Q.jsx)(`p`,{className:`text-[11px] text-soft-foreground`,children:`Applies to newly started tasks.`})]}),(0,Q.jsxs)(bv,{title:`New task defaults`,hint:`Set stable composer defaults across projects. Explicit choices and run-shape constraints still win.`,children:[(0,Q.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,"data-slot":`resources-composer-defaults`,children:[(0,Q.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,Q.jsx)(`span`,{className:`font-medium`,children:`Autonomous by default`}),(0,Q.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,Q.jsx)(`option`,{value:`inherit`,children:`Inherit environment`}),(0,Q.jsx)(`option`,{value:`on`,children:`On`}),(0,Q.jsx)(`option`,{value:`off`,children:`Off`})]}),(0,Q.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,Q.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,Q.jsx)(`span`,{className:`font-medium`,children:`Use a worktree by default`}),(0,Q.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,Q.jsx)(`option`,{value:`inherit`,children:`Inherit environment`}),(0,Q.jsx)(`option`,{value:`on`,children:`On`}),(0,Q.jsx)(`option`,{value:`off`,children:`Off`})]}),(0,Q.jsxs)(`span`,{className:`text-[11px] text-soft-foreground`,children:[`Inherited: `,b.inheritedWorktree?`On`:`Off`]})]})]}),(0,Q.jsx)(`p`,{className:`text-[11px] text-soft-foreground`,children:`Interactive skills may recommend both off. Multi-step and parallel runs remain isolated.`})]})]})}function Bv(){let e=d(),t=ce().data?.bootProject??``,n=it(t,!!t);return e.isPending?(0,Q.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,Q.jsx)(W,{icon:(0,Q.jsx)(Yn,{}),tone:`danger`,title:`Skill settings did not load`,subtitle:e.error.message,heading:`h2`}):(0,Q.jsx)(Vv,{config:e.data,update:n.data,updateError:n.error})}function Vv({config:e,update:t,updateError:n}){let r=v(),i=k({mutationFn:e=>We(e),onSuccess:e=>r.setQueryData(_.config,e),onError:e=>U(e.message,{tone:`danger`})}),a=e.skillsAutoUpdate===null,o=(()=>{if(n)return`Installation status is unavailable right now.`;if(!t)return`Checking tracked Open Mercato installations…`;if(t.status===`unavailable`)return t.scopes.find(e=>e.reason)?.reason??`Automatic skill updates are unavailable.`;if(t.scopes.every(e=>e.skills.length===0))return`No tracked Open Mercato installation found.`;let e=new Set(t.scopes.flatMap(e=>e.skills)).size;return`${e} tracked Open Mercato skill${e===1?``:`s`} found.`})();return(0,Q.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,Q.jsxs)(`section`,{className:`flex flex-col gap-3`,children:[(0,Q.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:(0,Q.jsx)(`label`,{htmlFor:`skills-auto-update`,children:`Update Open Mercato skills automatically`})}),(0,Q.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,Q.jsxs)(`div`,{className:`flex shrink-0 flex-col items-end gap-1`,children:[(0,Q.jsx)(P_,{id:`skills-auto-update`,"data-slot":`skills-auto-update`,checked:e.effectiveSkillsAutoUpdate,disabled:i.isPending,onCheckedChange:e=>i.mutate({skillsAutoUpdate:e})}),(0,Q.jsxs)(`span`,{className:`text-[11px] text-soft-foreground`,children:[e.effectiveSkillsAutoUpdate?`On`:`Off`,a?` (default)`:``]})]})]}),(0,Q.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,Q.jsx)(`span`,{children:a?`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,Q.jsx)(H,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`skills-use-default`,disabled:a||i.isPending,onClick:()=>i.mutate({skillsAutoUpdate:null}),children:`Use default`})]}),(0,Q.jsx)(`p`,{"data-slot":`skills-installation-status`,role:n||t?.status===`unavailable`?`status`:void 0,className:`text-[13px] text-soft-foreground`,children:o})]})})}function Hv(){let e=R(),t=v(),[n,r]=(0,Z.useState)(null),i=()=>t.invalidateQueries({queryKey:o.worktrees}),a=k({mutationFn:()=>be(),onSuccess:e=>{i(),U(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=>U(e.message,{tone:`danger`})}),s=k({mutationFn:e=>tt(e),onSuccess:()=>{i(),U(`Worktree removed`)},onError:e=>U(e.message,{tone:`danger`})});if(e.isPending)return(0,Q.jsx)(`p`,{"data-slot":`worktrees-loading`,className:`text-[13px] text-soft-foreground`,children:`Loading worktrees…`});if(e.isError)return(0,Q.jsxs)(`p`,{"data-slot":`worktrees-error`,className:`text-[13px] text-danger`,children:[`Worktrees did not load: `,e.error.message]});let{worktrees:c,totalBytes:l,keep:u}=e.data,d=a.isPending||s.isPending;return(0,Q.jsxs)(`div`,{"data-slot":`worktrees-panel`,className:`flex flex-col gap-3`,children:[c.length===0?(0,Q.jsx)(`p`,{"data-slot":`worktrees-empty`,className:`text-[13px] text-soft-foreground`,children:`No task worktrees on disk.`}):(0,Q.jsx)(`div`,{className:`overflow-x-auto rounded-md border border-border`,children:(0,Q.jsxs)(`table`,{className:`w-full border-collapse text-sm`,children:[(0,Q.jsx)(`caption`,{className:`sr-only`,children:`Task worktrees currently materialized on disk`}),(0,Q.jsx)(`thead`,{children:(0,Q.jsxs)(`tr`,{className:`border-b border-border text-left text-[12px] text-soft-foreground`,children:[(0,Q.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Task`}),(0,Q.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Status`}),(0,Q.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Size`}),(0,Q.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Age`}),(0,Q.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium text-right`,children:`Actions`})]})}),(0,Q.jsx)(`tbody`,{children:c.map(e=>(0,Q.jsx)(Uv,{worktree:e,disabled:d,onDelete:()=>r({kind:`delete`,runId:e.runId,title:e.title})},e.runId))})]})}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Q.jsxs)(`p`,{"data-slot":`worktrees-footer`,className:`text-[12px] text-soft-foreground`,children:[c.length,` worktree`,c.length===1?``:`s`,l===null?` · size unavailable`:` · ${rm(l)||`0 kB`} on disk`,` · `,u===0?`keeping all (unlimited)`:`keeping the last ${u}`]}),(0,Q.jsx)(H,{type:`button`,variant:`outline`,size:`sm`,"data-action":`worktrees-reclaim-now`,disabled:d,onClick:()=>r({kind:`reclaim`}),children:`Reclaim now`})]}),(0,Q.jsx)(Hg,{open:n!==null,onOpenChange:e=>!e&&r(null),children:(0,Q.jsxs)(Gg,{children:[(0,Q.jsxs)(Kg,{children:[(0,Q.jsx)(Jg,{children:n?.kind===`delete`?`Delete this worktree?`:`Reclaim old worktrees?`}),(0,Q.jsx)(Yg,{children:n?.kind===`delete`?(0,Q.jsxs)(Q.Fragment,{children:[`This removes the worktree directory and its branch — the local-only work is not recoverable afterwards.`,(0,Q.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,Q.jsxs)(qg,{children:[(0,Q.jsx)(Zg,{children:`Keep it`}),(0,Q.jsx)(Xg,{"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`&&s.mutate(n.runId),r(null)},children:n?.kind===`delete`?`Delete`:`Reclaim now`})]})]})})]})}function Uv({worktree:e,disabled:t,onDelete:n}){return(0,Q.jsxs)(`tr`,{"data-slot":`worktree-row`,"data-run":e.runId,className:`border-b border-border last:border-0`,children:[(0,Q.jsxs)(`th`,{scope:`row`,className:`max-w-[220px] px-3 py-2 text-left font-normal`,children:[(0,Q.jsx)(`span`,{className:`block truncate text-foreground`,title:e.title,children:e.title}),(0,Q.jsx)(`span`,{className:`block truncate font-mono text-[11px] text-soft-foreground`,children:e.branch??e.runId.slice(0,8)})]}),(0,Q.jsxs)(`td`,{className:`px-3 py-2`,children:[(0,Q.jsx)(`span`,{className:`text-[12px] text-soft-foreground`,children:e.status}),e.reclaimable?(0,Q.jsx)(`span`,{"data-slot":`worktree-reclaimable`,className:`ml-1 text-[11px] text-soft-foreground`,children:`(reclaimable)`}):null]}),(0,Q.jsx)(`td`,{className:`px-3 py-2 tabular-nums text-soft-foreground`,children:e.sizeBytes===null?`—`:rm(e.sizeBytes)||`0 kB`}),(0,Q.jsx)(`td`,{className:`px-3 py-2 tabular-nums text-soft-foreground`,children:_f(e.finishedAt??void 0)||`—`}),(0,Q.jsx)(`td`,{className:`px-3 py-2 text-right`,children:(0,Q.jsx)(H,{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,Gv=1e3;function Kv(){let e=N();return e.isPending?(0,Q.jsx)(`p`,{"data-slot":`worktrees-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading worktree settings…`}):e.isError?(0,Q.jsx)(W,{icon:(0,Q.jsx)(Nn,{}),tone:`danger`,title:`Worktree settings did not load`,subtitle:e.error.message,heading:`h2`}):(0,Q.jsx)(qv,{config:e.data})}function qv({config:e}){let t=v(),n=k({mutationFn:e=>je(e),onSuccess:e=>t.setQueryData(o.config,e),onError:e=>U(e.message,{tone:`danger`})}),[r,i]=(0,Z.useState)(String(e.worktreeRetention)),a=Number(r),s=r.trim()===``||!Number.isInteger(a)||a<Wv||a>Gv,c=e.worktreeRetention===(s?-1:a);return(0,Q.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,Q.jsxs)(bv,{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,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`input`,{type:`number`,inputMode:`numeric`,min:Wv,max:Gv,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,Q.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`worktrees`}),(0,Q.jsx)(H,{type:`button`,variant:`outline`,size:`sm`,"data-action":`resources-save-retention`,disabled:c||s||n.isPending,onClick:()=>n.mutate({worktreeRetention:a},{onSuccess:()=>{t.invalidateQueries({queryKey:o.worktrees}),U(a===0?`Keeping all worktrees (unlimited)`:`Keeping the last ${a} finished worktree${a===1?``:`s`}`)}}),children:`Save`})]}),s?(0,Q.jsxs)(`p`,{"data-slot":`resources-retention-invalid`,className:`text-[11px] text-danger`,children:[`Enter a whole number from `,Wv,` to `,Gv,` (0 = unlimited).`]}):(0,Q.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,Q.jsx)(bv,{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,Q.jsx)(Hv,{})})]})}function Jv(e,t){return function(){return(0,Q.jsx)(W,{icon:(0,Q.jsx)(t,{}),tone:`neutral`,title:e,subtitle:`This section arrives in a later phase of the redesign.`,heading:`h2`})}}var Yv=[{id:`agents`,title:`Agents`,description:`Default runner, models and system prompt.`,icon:Tn,component:V_,scope:`project`},{id:`agent-config`,title:`Agent config`,description:`Edit the coding agents’ own config files, per scope.`,icon:Mn,component:k_,scope:`project`},{id:`worktrees`,title:`Worktrees`,description:`How many finished task worktrees this project keeps on disk.`,icon:Nn,component:Kv,scope:`project`},{id:`bookmarklets`,title:`Bookmarklets`,description:`Launch skills from a GitHub PR or issue.`,icon:wn,component:dv,scope:`project`},{id:`prompt-templates`,title:`Prompt templates`,description:`Reusable snippets for follow-up instructions.`,icon:Jn,component:Av,scope:`project`},{id:`appearance`,title:`Appearance`,description:`Theme, accent and density.`,icon:Xn,component:cv,scope:`global`},{id:`notifications`,title:`Notifications`,description:`Browser notifications when an agent needs you.`,icon:Cn,component:yv,scope:`global`},{id:`resources`,title:`Resources`,description:`Parallel tasks and per-task memory limit, across every project.`,icon:Rn,component:Rv,scope:`global`},{id:`skills`,title:`Skills`,description:`Updates for skills installed on this machine.`,icon:Yn,component:Bv,scope:`global`},{id:`projects`,title:`Projects`,description:`The workspace registry and where GitHub checkouts land.`,icon:Ln,component:wv,scope:`global`},{id:`keyboard`,title:`Keyboard`,description:`Shortcuts.`,icon:Hn,component:Jv(`Keyboard`,Hn),scope:`global`,hidden:!0}];function Xv(e,t){return Yv.filter(n=>!n.hidden&&n.scope===e&&!(t?.singleProject===!0&&n.id===`projects`))}function Zv(e,t){return e===`global`?`/settings/global/${t}`:`/settings/${t}`}function Qv(e){return e===`global`?`/settings/global`:`/settings`}function $v(e){return e===`global`?{Link:ct,NavLink:re}:{Link:X,NavLink:Pt}}function ey({scope:e,activeId:t,capabilities:n}){let{NavLink:r}=$v(e);return(0,Q.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:[Xv(e,n).map(n=>(0,Q.jsxs)(r,{to:Zv(e,n.id),"data-section":n.id,"aria-current":n.id===t?`page`:void 0,className:Y(`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,Q.jsx)(n.icon,{"aria-hidden":`true`,className:`size-4 shrink-0`}),n.title]},n.id)),e===`global`?(0,Q.jsx)(`p`,{className:`mt-auto px-2.5 pt-3 text-[11px] text-soft-foreground`,children:`Stored in ~/.cezar`}):null]})}function ty({scope:e,activeId:t,capabilities:n}){let{NavLink:r}=$v(e);return(0,Q.jsx)(`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:Xv(e,n).map(n=>(0,Q.jsx)(r,{to:Zv(e,n.id),"data-section":n.id,"aria-current":n.id===t?`page`:void 0,className:Y(`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 ny({section:e,scope:t,capabilities:n}){let r=e.component;return(0,Q.jsxs)(`div`,{"data-route":t===`global`?`settings-global-${e.id}`:`settings-${e.id}`,className:`flex min-h-full flex-col`,children:[(0,Q.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,Q.jsx)(`h1`,{className:`text-base font-semibold`,children:e.title}),(0,Q.jsx)(`p`,{className:`text-[13px] text-soft-foreground`,children:e.description}),t===`global`?(0,Q.jsx)(`span`,{"data-slot":`settings-scope-chip`,className:`ml-auto text-[11px] text-soft-foreground`,children:`Global settings`}):null]}),(0,Q.jsxs)(`div`,{className:`flex flex-1 flex-col md:flex-row`,children:[(0,Q.jsx)(ey,{scope:t,activeId:e.id,capabilities:n}),(0,Q.jsx)(ty,{scope:t,activeId:e.id,capabilities:n}),(0,Q.jsx)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:(0,Q.jsx)(r,{})})]})]})}function ry({scope:e,capabilities:t}){let{Link:n}=$v(e),r=e===`global`;return(0,Q.jsxs)(`div`,{"data-route":r?`settings-global`:`settings`,className:`flex min-h-full flex-col`,children:[(0,Q.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,Q.jsx)(`h1`,{className:`text-base font-semibold`,children:r?`Global settings`:`Settings`}),(0,Q.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,Q.jsxs)(`div`,{className:`flex flex-1 flex-col md:flex-row`,children:[(0,Q.jsx)(ey,{scope:e,activeId:null,capabilities:t}),(0,Q.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:[(0,Q.jsx)(`ul`,{"data-slot":`settings-index`,className:`mx-auto flex w-full max-w-2xl flex-col gap-2.5`,children:Xv(e,t).map(t=>(0,Q.jsx)(`li`,{children:(0,Q.jsxs)(n,{to:Zv(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,Q.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-md border border-border bg-muted text-muted-foreground`,children:(0,Q.jsx)(t.icon,{"aria-hidden":`true`,className:`size-4`})}),(0,Q.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`span`,{className:`block text-sm font-medium text-foreground`,children:t.title}),(0,Q.jsx)(`span`,{className:`block text-xs text-soft-foreground`,children:t.description})]}),(0,Q.jsx)(Dn,{"aria-hidden":`true`,className:`size-4 shrink-0 text-soft-foreground`})]})},t.id))}),(0,Q.jsx)(`p`,{className:`mx-auto mt-4 w-full max-w-2xl text-[12px] text-soft-foreground`,children:r?(0,Q.jsx)(Q.Fragment,{children:`Agents, worktrees, bookmarklets and prompt templates are per project.`}):(0,Q.jsxs)(Q.Fragment,{children:[`Appearance, notifications, host resources and the project registry live in`,` `,(0,Q.jsx)(ct,{to:Qv(`global`),"data-slot":`settings-global-link`,className:`underline underline-offset-2 hover:text-foreground`,children:`Global settings`}),`.`]})})]})]})]})}function iy(e,t){let[n,r]=(0,Z.useState)(!1),[i,a]=(0,Z.useState)(``),o=(0,Z.useRef)(!1);return{editing:n,draft:i,setDraft:a,begin:()=>{a(e),o.current=!1,r(!0)},commit:()=>{if(o.current)return;o.current=!0,r(!1);let n=i.trim();n.length===0||n===e||t(n)},cancel:()=>{o.current=!0,r(!1)}}}function ay({editor:e,className:t}){return(0,Q.jsx)(`input`,{"data-slot":`title-input`,"aria-label":`Task title`,autoFocus:!0,value:e.draft,onChange:t=>e.setDraft(t.target.value),onBlur:e.commit,onKeyDown:t=>{t.key===`Enter`?(t.preventDefault(),e.commit()):t.key===`Escape`&&(t.preventDefault(),e.cancel())},className:Y(`w-full min-w-0 rounded-sm border border-border bg-card px-1.5 py-0.5 outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`,t)})}function oy({className:e,dot:t,pulse:n=!1,children:r,...i}){return(0,Q.jsxs)(`span`,{"data-slot":`pill`,className:Y(`inline-flex items-center gap-1.5 rounded-full bg-muted px-2.5 py-[3px] text-xs font-medium whitespace-nowrap text-muted-foreground`,e),...i,children:[t?(0,Q.jsx)(Wu,{tone:t,pulse:n}):null,r]})}function sy({runs:e,view:t,onViewChange:n,onArchiveFinished:r,onRename:i,now:a=Date.now()}){let[o,s]=Z.useState(``),c=e??[],l=Zf(c),u=Jf(om(c,o),t),d=qf(c),f=pm(om(c,o),t),p=sm(c);return(0,Q.jsxs)(`div`,{"data-route":`tasks`,className:`flex min-h-full flex-col`,children:[(0,Q.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,Q.jsx)(`h1`,{className:`text-base font-semibold`,children:`Tasks`}),(0,Q.jsxs)(`div`,{className:`inline-flex gap-0.5 rounded-md bg-muted p-[3px]`,children:[(0,Q.jsx)(ly,{view:`active`,current:t,onSelect:n,count:l.active,children:`Active`}),(0,Q.jsx)(ly,{view:`archived`,current:t,onSelect:n,count:l.archived,children:`Archived`})]}),(0,Q.jsx)(`div`,{className:`flex-1`}),t===`active`&&p>0?(0,Q.jsxs)(H,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`archive-finished`,onClick:r,children:[(0,Q.jsx)(vn,{className:`size-3.5`,"aria-hidden":`true`}),`Archive finished`]}):null,(0,Q.jsxs)(`div`,{className:`relative w-60`,children:[(0,Q.jsx)(nr,{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,Q.jsx)(`input`,{type:`text`,value:o,onChange:e=>s(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,Q.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:[e===void 0?null:u.length===0?(0,Q.jsx)(cy,{view:t,query:o}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{"data-slot":`tasks-table`,className:`hidden overflow-x-auto rounded-lg border border-border bg-card shadow-xs md:block`,children:(0,Q.jsxs)(`table`,{className:`w-full min-w-[1040px] border-collapse`,children:[(0,Q.jsx)(`thead`,{children:(0,Q.jsxs)(`tr`,{children:[(0,Q.jsx)(uy,{children:`Status`}),(0,Q.jsx)(uy,{children:`Task`}),(0,Q.jsx)(uy,{children:`Workflow`}),(0,Q.jsx)(uy,{children:`Branch`}),(0,Q.jsx)(uy,{children:`±`}),(0,Q.jsx)(uy,{children:`Ref`}),(0,Q.jsx)(uy,{right:!0,children:`Tokens`}),(0,Q.jsx)(uy,{right:!0,children:`Cost`}),(0,Q.jsx)(uy,{right:!0,children:`CPU`}),(0,Q.jsx)(uy,{right:!0,children:`Mem`}),(0,Q.jsx)(uy,{right:!0,children:`Started`})]})}),(0,Q.jsx)(`tbody`,{className:`[&>tr:last-child>td]:border-b-0`,children:u.map(e=>(0,Q.jsx)(fy,{run:e,queuePosition:e.status===`queued`?d.get(e.id)??null:null,onRename:i,now:a},e.id))})]})}),(0,Q.jsx)(`div`,{"data-slot":`task-cards`,className:`flex flex-col gap-2.5 md:hidden`,children:u.map(e=>(0,Q.jsx)(gy,{run:e,queuePosition:e.status===`queued`?d.get(e.id)??null:null,now:a},e.id))})]}),f.map(e=>(0,Q.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,Q.jsx)(tr,{className:`size-[15px] shrink-0 text-soft-foreground`,"aria-hidden":`true`}),(0,Q.jsxs)(`span`,{children:[(0,Q.jsx)(`strong`,{className:`font-semibold text-foreground`,children:e.title}),` — `,e.count,` variants finished`]}),(0,Q.jsx)(H,{asChild:!0,variant:`outline`,size:`sm`,className:`md:ml-auto`,children:(0,Q.jsx)(X,{to:`/compare/${e.groupId}`,children:`Compare`})})]},e.groupId))]}),(0,Q.jsx)(X,{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,Q.jsx)(er,{className:`size-[22px]`,"aria-hidden":`true`})})]})}function cy({view:e,query:t}){let n=t.trim(),r=n?`search-miss`:e===`archived`?`archive`:`no-tasks`;return(0,Q.jsx)(`div`,{"data-slot":`tasks-empty`,"data-empty-kind":r,className:`flex flex-1 flex-col`,children:r===`search-miss`?(0,Q.jsx)(W,{heading:`h2`,icon:(0,Q.jsx)(gt,{}),tone:`neutral`,title:`No matching tasks`,subtitle:`No tasks match “${n}”.`}):r===`archive`?(0,Q.jsx)(W,{heading:`h2`,icon:(0,Q.jsx)(vn,{}),tone:`neutral`,title:`Nothing archived yet`,subtitle:`Finished tasks you archive land here.`}):(0,Q.jsx)(W,{heading:`h2`,icon:(0,Q.jsx)(Un,{}),tone:`primary`,backdrop:!0,title:`No tasks yet`,subtitle:`Describe a task to get started.`,actions:(0,Q.jsx)(H,{asChild:!0,children:(0,Q.jsxs)(X,{to:`/new`,children:[(0,Q.jsx)(er,{"aria-hidden":`true`}),`New task`]})})})})}function ly({view:e,current:t,onSelect:n,count:r,children:i}){let a=e===t;return(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`overview-tab`,"data-view":e,"aria-pressed":a,onClick:()=>n(e),className:Y(`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,Q.jsx)(`span`,{className:`font-mono text-[11px] tabular-nums`,children:r}):null]})}function uy({children:e,right:t=!1}){return(0,Q.jsx)(`th`,{className:Y(`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`),children:e})}var dy=`h-11 border-b border-border px-2.5 whitespace-nowrap first:pl-4 last:pr-4`;function fy({run:e,queuePosition:t,onRename:n,now:r}){let i=At(),a=hf(e),o=`/tasks/${e.id}`,s=im(e.costUsd),c=um(e);return(0,Q.jsxs)(`tr`,{"data-slot":`task-table-row`,"data-run-id":e.id,onClick:e=>{e.target.closest(`a, button, input`)||i(o)},className:`group/row cursor-pointer hover:bg-muted`,children:[(0,Q.jsx)(`td`,{className:dy,children:(0,Q.jsx)(oy,{dot:a.tone,pulse:a.pulse,children:a.label})}),(0,Q.jsx)(`td`,{className:Y(dy,`w-[34%] max-w-0`),children:(0,Q.jsx)(py,{run:e,to:o,onRename:n})}),(0,Q.jsx)(`td`,{className:Y(dy,`text-[12.5px] text-muted-foreground`),children:am(e)}),(0,Q.jsx)(`td`,{className:dy,children:e.branch?(0,Q.jsx)(yy,{branch:e.branch}):(0,Q.jsx)(_y,{})}),(0,Q.jsx)(`td`,{className:dy,children:e.diffStat?(0,Q.jsx)(Qp,{stat:e.diffStat}):(0,Q.jsx)(_y,{})}),(0,Q.jsx)(`td`,{className:dy,children:c?(0,Q.jsx)($p,{reference:c,taskTitle:Gf(e)}):(0,Q.jsx)(_y,{})}),(0,Q.jsx)(`td`,{className:Y(dy,`text-right font-mono text-xs text-muted-foreground tabular-nums`),children:vf(e.tokensUsed)}),(0,Q.jsx)(`td`,{className:Y(dy,`text-right font-mono text-xs text-muted-foreground tabular-nums`),children:s||(0,Q.jsx)(_y,{})}),t===null?(0,Q.jsx)(my,{run:e}):(0,Q.jsxs)(`td`,{"data-slot":`queue-note`,colSpan:2,className:Y(dy,`text-right font-mono text-[11.5px] text-soft-foreground`),children:[`#`,t,` in queue`]}),(0,Q.jsx)(`td`,{className:Y(dy,`text-right text-xs text-soft-foreground tabular-nums`),children:_f(e.startedAt??e.createdAt,r)})]})}function py({run:e,to:t,onRename:n}){let r=Gf(e),i=iy(r,t=>n(e.id,t));return i.editing?(0,Q.jsx)(ay,{editor:i,className:`text-[13px] font-medium`}):(0,Q.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,Q.jsx)(X,{to:t,title:r,className:`min-w-0 truncate text-[13px] font-medium`,children:r}),(0,Q.jsx)(`button`,{type:`button`,"data-slot":`row-rename`,"aria-label":`Rename task`,onClick:i.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,Q.jsx)(Qn,{className:`size-3`,"aria-hidden":`true`})})]})}function my({run:e}){let t=fm(e,mn(e.id));return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(hy,{column:`cpu`,cell:t.cpu}),(0,Q.jsx)(hy,{column:`mem`,cell:t.mem})]})}function hy({column:e,cell:t}){return(0,Q.jsx)(`td`,{"data-usage":e,"data-usage-kind":t.kind,title:t.title,className:Y(dy,`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 gy({run:e,queuePosition:t,now:n}){let r=At(),i=hf(e),a=`/tasks/${e.id}`,o=um(e);return(0,Q.jsxs)(`div`,{"data-slot":`task-card`,"data-run-id":e.id,onClick:e=>{e.target.closest(`a`)||r(a)},className:`cursor-pointer rounded-lg border border-border bg-card px-3.5 py-3 shadow-xs`,children:[(0,Q.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[(0,Q.jsx)(oy,{dot:i.tone,pulse:i.pulse,className:`mt-px shrink-0`,children:i.label}),(0,Q.jsx)(X,{to:a,className:`min-w-0 flex-1 text-[13.5px] leading-[1.35] font-medium`,children:Gf(e)}),(0,Q.jsx)(`span`,{className:`mt-0.5 shrink-0 text-[11.5px] text-soft-foreground tabular-nums`,children:_f(e.finishedAt??e.createdAt,n)})]}),(0,Q.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,Q.jsx)(`span`,{children:am(e)}),t===null?(0,Q.jsxs)(Q.Fragment,{children:[e.branch?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(vy,{}),(0,Q.jsx)(`span`,{children:e.branch})]}):null,e.diffStat?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(vy,{}),(0,Q.jsx)(Qp,{stat:e.diffStat,className:`text-[11.5px]`})]}):null,e.tokensUsed>0?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(vy,{}),(0,Q.jsx)(`span`,{children:vf(e.tokensUsed)})]}):null]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(vy,{}),(0,Q.jsxs)(`span`,{"data-slot":`queue-note`,children:[`#`,t,` in queue`]})]}),o?(0,Q.jsx)($p,{reference:o,taskTitle:Gf(e),className:`h-5`}):null]})]})}function _y(){return(0,Q.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`—`})}function vy(){return(0,Q.jsx)(`span`,{className:`text-soft-foreground`,"aria-hidden":`true`,children:`·`})}function yy({branch:e}){return(0,Q.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 by(){let e=Ae(),[t,n]=Up(),r=v(),i=k({mutationFn:Ie,onSuccess:()=>r.invalidateQueries({queryKey:o.runs.all})}),a=k({mutationFn:({id:e,title:t})=>Ce(e,{title:t}),onSuccess:()=>r.invalidateQueries({queryKey:o.runs.all}),onError:e=>U(e.message,{tone:`danger`})}),s=mm(3e4);return(0,Q.jsx)(sy,{runs:e.data,view:t,onViewChange:n,onArchiveFinished:()=>i.mutate(),onRename:(e,t)=>a.mutate({id:e,title:t}),now:s})}var xy=(0,Z.lazy)(()=>q(()=>import(`./task-thread-7gsMtehO.js`).then(e=>({default:e.TaskThreadRoute})),__vite__mapDeps([6,5,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24]))),Sy=(0,Z.lazy)(()=>q(()=>import(`./compare-variants-CbiCg_gM.js`).then(e=>({default:e.CompareVariantsRoute})),__vite__mapDeps([25,5,7,8,9,10,20,22,17]))),Cy=(0,Z.lazy)(()=>q(()=>import(`./task-changes-1Dlu76oI.js`).then(e=>({default:e.TaskChangesRoute})),__vite__mapDeps([26,5,7,8,9,10,11,12,13,14,15,16,17,18,27,28,29,19,30,21,31,32,24]))),wy=(0,Z.lazy)(()=>q(()=>import(`./task-files-DZ3YIg_X.js`).then(e=>({default:e.TaskFilesRoute})),__vite__mapDeps([33,5,7,8,9,10,11,12,13,14,15,16,17,18,28,34]))),Ty=(0,Z.lazy)(()=>q(()=>import(`./task-commits-BbdH8rWJ.js`).then(e=>({default:e.TaskCommitsRoute})),__vite__mapDeps([35,5,7,8,9,10,11,12,13,14,15,16,17,18,36,29,20,34,31,32,24,37,23]))),Ey=(0,Z.lazy)(()=>q(()=>import(`./repo-git-Cc9uAVzh.js`).then(e=>({default:e.RepoGitRoute})),__vite__mapDeps([38,5,7,8,9,10,36,16,17,27,15,28,29,19,18,30,20,34,31,32,24,37,23]))),Dy=(0,Z.lazy)(()=>q(()=>import(`./github-72b-Q1Br.js`).then(e=>({default:e.GithubRoute})),__vite__mapDeps([39,5,7,8,9,10,36,12,13,16,17,19,40,34,21,31,32,24]))),Oy=(0,Z.lazy)(()=>q(()=>import(`./github-72b-Q1Br.js`).then(e=>({default:e.GithubIndexRoute})),__vite__mapDeps([39,5,7,8,9,10,36,12,13,16,17,19,40,34,21,31,32,24]))),ky=(0,Z.lazy)(()=>q(()=>import(`./workflows-DDKekv0c.js`).then(e=>({default:e.WorkflowsRoute})),__vite__mapDeps([41,5,7,8,9,10,14,42,18,34,30,21]))),Ay=(0,Z.lazy)(()=>q(()=>import(`./skills-BDD1dfEE.js`).then(e=>({default:e.SkillsRoute})),__vite__mapDeps([43,5,7,8,9,10,36,12,42,40,34,17])));function jy(){let e=M();return(0,Q.jsx)(It,{to:{pathname:`/skills`,search:e.search,hash:e.hash},replace:!0})}function My({sectionId:e}){let t=M();return(0,Q.jsx)(u,{to:{pathname:Zv(`global`,e),search:t.search,hash:t.hash},replace:!0})}function Ny(){return(0,Q.jsx)(`div`,{"data-route":`scope-resolving`,className:`flex min-h-full flex-col`,children:(0,Q.jsx)(`p`,{className:`px-4 py-6 text-center text-xs text-soft-foreground`,children:`Loading…`})})}function Py(){let{projectId:e=``}=s(),t=M(),n=ce(),r=z();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,Q.jsx)(u,{to:`/p/${encodeURIComponent(e)}${n||`/`}${t.search}${t.hash}`,replace:!0})}if(!n.isError)return(0,Q.jsx)(Ny,{})}if(n.data){if(!(n.data.bootProject===e||n.data.projects.some(t=>t.id===e)))return(0,Q.jsx)(m_,{projectId:e,registry:n.data})}else if(!n.isError)return(0,Q.jsx)(Ny,{});return(0,Q.jsx)(Rt,{projectId:n.data?.bootProject===e?null:e,children:(0,Q.jsx)(ot,{},e)})}function Fy(){let{projectId:e=``}=s();return(0,Q.jsx)(e_,{},e)}function Iy(){let e=M(),t=z();if(t.data===void 0)return(0,Q.jsx)(Ny,{});let n=t.data.bootProject??`default`,r=e.pathname===`/p`||e.pathname===`/p/`?`/`:e.pathname;return(0,Q.jsx)(u,{to:`/p/${encodeURIComponent(n)}${r}${e.search}${e.hash}`,replace:!0})}var Ly=[{pattern:`/`,pageLabel:`Tasks`},{pattern:`/new`,pageLabel:`New task`},{pattern:`/compare/:groupId`,pageLabel:`Compare`},{pattern:`/git/*`,pageLabel:`Git`},{pattern:`/github/*`,pageLabel:`GitHub`},{pattern:`/skills`,pageLabel:`Skills`},{pattern:`/inbox`,pageLabel:`Inbox`},{pattern:`/workflows/*`,pageLabel:`Workflows`},{pattern:`/settings/*`,pageLabel:`Settings`}];function Ry(e){let t=Ft(e),n=p({path:`/tasks/:id/*`,end:!0},t);return n?{pageLabel:null,taskId:n.params.id??null}:{pageLabel:Ly.find(({pattern:e})=>p({path:e,end:!0},t))?.pageLabel??null,taskId:null}}function zy(){let e=z().data?.capabilities;return(0,Q.jsxs)(g,{children:[(0,Q.jsxs)(L,{path:`/p/:projectId`,element:(0,Q.jsx)(Py,{}),children:[(0,Q.jsx)(L,{index:!0,element:(0,Q.jsx)(by,{})}),(0,Q.jsx)(L,{path:`new`,element:(0,Q.jsx)(Fy,{})}),(0,Q.jsx)(L,{path:`tasks/:id`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(v_,{}),children:(0,Q.jsx)(xy,{})})}),(0,Q.jsx)(L,{path:`tasks/:id/changes`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(g_,{tab:`changes`}),children:(0,Q.jsx)(Cy,{})})}),(0,Q.jsx)(L,{path:`tasks/:id/files`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(g_,{tab:`files`}),children:(0,Q.jsx)(wy,{})})}),(0,Q.jsx)(L,{path:`tasks/:id/commits`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(g_,{tab:`changes`}),children:(0,Q.jsx)(Ty,{})})}),(0,Q.jsx)(L,{path:`tasks/:id/commits/:sha`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(g_,{tab:`changes`}),children:(0,Q.jsx)(Ty,{})})}),(0,Q.jsx)(L,{path:`compare/:groupId`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(Im,{}),children:(0,Q.jsx)(Sy,{})})}),(0,Q.jsx)(L,{path:`git`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(f_,{}),children:(0,Q.jsx)(Ey,{tab:`changes`})})}),(0,Q.jsx)(L,{path:`git/commits`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(f_,{}),children:(0,Q.jsx)(Ey,{tab:`commits`})})}),(0,Q.jsx)(L,{path:`git/commits/:sha`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(f_,{}),children:(0,Q.jsx)(Ey,{tab:`commits`})})}),(0,Q.jsx)(L,{path:`git/branches`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(f_,{}),children:(0,Q.jsx)(Ey,{tab:`branches`})})}),(0,Q.jsx)(L,{path:`github`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(Lm,{}),children:(0,Q.jsx)(Oy,{})})}),(0,Q.jsx)(L,{path:`github/prs`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(Lm,{}),children:(0,Q.jsx)(Dy,{view:`prs`})})}),(0,Q.jsx)(L,{path:`github/issues/:n`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(Lm,{}),children:(0,Q.jsx)(Dy,{view:`issues`})})}),(0,Q.jsx)(L,{path:`github/prs/:n`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(Lm,{}),children:(0,Q.jsx)(Dy,{view:`prs`})})}),(0,Q.jsx)(L,{path:`github/prs/:n/changes`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(Lm,{}),children:(0,Q.jsx)(Dy,{view:`prs`,changes:!0})})}),(0,Q.jsx)(L,{path:`skills`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(p_,{}),children:(0,Q.jsx)(Ay,{})})}),(0,Q.jsx)(L,{path:`inbox`,element:(0,Q.jsx)(Nh,{})}),(0,Q.jsx)(L,{path:`workflows`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(h_,{}),children:(0,Q.jsx)(ky,{})})}),(0,Q.jsx)(L,{path:`workflows/:name`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(h_,{}),children:(0,Q.jsx)(ky,{})})}),(0,Q.jsx)(L,{path:`settings`,element:(0,Q.jsx)(ry,{scope:`project`,capabilities:e})}),(0,Q.jsx)(L,{path:`settings/skills`,element:(0,Q.jsx)(jy,{})}),Xv(`project`,e).map(t=>(0,Q.jsx)(L,{path:`settings/${t.id}`,element:(0,Q.jsx)(ny,{section:t,scope:`project`,capabilities:e})},t.id)),Xv(`global`,e).map(e=>(0,Q.jsx)(L,{path:`settings/${e.id}`,element:(0,Q.jsx)(My,{sectionId:e.id})},e.id)),(0,Q.jsx)(L,{path:`*`,element:(0,Q.jsx)(d_,{})})]}),(0,Q.jsx)(L,{path:`/settings/global`,element:(0,Q.jsx)(ry,{scope:`global`,capabilities:e})}),Xv(`global`,e).map(t=>(0,Q.jsx)(L,{path:Zv(`global`,t.id),element:(0,Q.jsx)(ny,{section:t,scope:`global`,capabilities:e})},t.id)),(0,Q.jsx)(L,{path:`*`,element:(0,Q.jsx)(Iy,{})})]})}function By(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 Vy(e){return e?.available===!0&&(e.status===`available`||e.status===`error`)}function Hy({children:e}){let{pathname:t}=M(),n=Lt(),r=z(),i=r.data?.capabilities.followups===!0,a=dt(i),o=Vy(it(n??``,n!==null).data),s=ce().data,c=Ry(t),l=s?.bootProject??r.data?.bootProject??null,u=n!==null&&n===l,d=s?.projects.find(e=>e.id===n),f=ue(n??``,d!==void 0&&c.taskId!==null,s?.bootProject===n).data,p=t===`/settings/global`||t.startsWith(`/settings/global/`)?null:d?.name??(u?By(r.data)?.name??null:null),m=c.taskId?f?.find(e=>e.id===c.taskId):void 0;Fm({projectName:p,pageLabel:m?Gf(m):c.pageLabel});let h=s&&s.projects.length>1?s:null;return(0,Q.jsxs)(Hp,{children:[(0,Q.jsx)(jp,{repo:By(r.data),version:r.data?.version??null,latestVersion:r.data?.latestVersion??null,inboxCount:a.data?.length??null,skillsUpdateAvailable:o,forgeAvailable:r.data?.forge?.available===!0,inboxAvailable:i,banner:(0,Q.jsx)(Zp,{}),singleProject:r.data?.capabilities.singleProject===!0,taskQuickList:(0,Q.jsx)(xm,{}),projectGroups:h?(0,Q.jsx)(Em,{projects:h.projects,bootProjectId:h.bootProject,inboxAvailable:i,inboxCount:a.data?.length??null,skillsUpdateAvailable:o}):void 0,toolsMenu:(0,Q.jsx)(Am,{health:r.data}),children:e}),(0,Q.jsx)(cp,{})]})}function Uy(){let e=v(),t=mv(st().data?.notifications).enabled,n=(0,Z.useRef)(t);n.current=t;let r=(0,Z.useRef)(new Map);return(0,Z.useEffect)(()=>{let t=B(o.runs.list()),i=e=>{let{entering:t,statuses:i}=gv(r.current,e);if(r.current=i,t.length!==0&&_v({enabled:n.current,hidden:document.visibilityState===`hidden`,permission:hv()}))for(let e of t)Wy(e)};return i(e.getQueryData(o.runs.list())),e.getQueryCache().subscribe(e=>{e.query.queryHash!==t||e.type!==`updated`||i(e.query.state.data)})},[e]),null}function Wy(e){let t=globalThis.Notification;if(typeof t!=`function`)return;let n=vv(e);try{new t(n.title,{body:n.body,tag:n.tag})}catch{}}function Gy(){let[e]=(0,Z.useState)(_n);return(0,Q.jsx)(ee,{client:e,children:(0,Q.jsxs)(pn,{children:[(0,Q.jsx)(Uy,{}),(0,Q.jsx)(td,{children:(0,Q.jsx)(tv,{children:(0,Q.jsxs)(_e,{children:[(0,Q.jsx)(Hy,{children:(0,Q.jsx)(zy,{})}),(0,Q.jsx)(Ye,{})]})})})]})})}var Ky=document.getElementById(`root`);if(!Ky)throw Error(`cezar: #root container is missing from index.html`);(0,Gt.createRoot)(Ky).render((0,Q.jsx)(Z.StrictMode,{children:(0,Q.jsx)(Gy,{})}));export{lm as $,Qn as $t,Ch as A,hf as At,$m as B,wu as Bt,dg as C,Cf as Ct,Ih as D,Of as Dt,Fh as E,Nf as Et,fh as F,uf as Ft,Km as G,ju as Gt,Zm as H,Mu as Ht,uh as I,of as It,Lm as J,ir as Jt,Gm as K,cr as Kt,rh as L,Wu as Lt,hh as M,sf as Mt,dh as N,cf as Nt,Eh as O,vf as Ot,ph as P,af as Pt,dm as Q,$n as Qt,nh as R,Lu as Rt,fg as S,wf as St,qh as T,zf as Tt,Um as U,Au as Ut,eh as V,Ou as Vt,Hm as W,ku as Wt,tm as X,tr as Xt,Im as Y,nr as Yt,im as Z,er as Zt,Jg as _,Gf as _t,v_ as a,Dn as an,Cp as at,yg as b,bf as bt,h_ as c,yn as cn,Tp as ct,Xg as d,pp as dt,Bn as en,cm as et,Zg as f,gp as ft,Kg as g,qf as gt,qg as h,Kf as ht,fv as i,On as in,vp as it,Dh as j,nf as jt,kh as k,_f as kt,f_ as l,vn as ln,up as lt,Yg as m,dp as mt,ay as n,In as nn,$p as nt,__ as o,En as on,Ep as ot,Gg as p,_p as pt,Xm as q,sr as qt,iy as r,jn as rn,Qp as rt,g_ as s,Tn as sn,wp as st,oy as t,zn as tn,am as tt,Hg as u,fp as ut,bg as v,Ef as vt,rg as w,Rf as wt,vg as x,xf as xt,xg as y,Bf as yt,th as z,Pu as zt};
|
|
22
|
+
`]})},t))}),(0,Q.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:Y(x_,`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 C_=`An editor-plus-commit: a saved change reaches a run after you commit it to the base branch.`;function w_(e){return t=>t.runners.includes(e)}function T_(e,t,n,r){let i=w_(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 E_=[{id:`claude`,label:`Claude`,groups:[T_(`claude`,`settings`,`Settings`),T_(`claude`,`mcp`,`MCP`,`A dedicated .mcp.json (key: mcpServers), shared via version control.`),T_(`claude`,`memory`,`Memory & instructions`)]},{id:`codex`,label:`Codex`,note:C_,groups:[T_(`codex`,`settings`,`Settings`),T_(`codex`,`mcp`,`MCP`,`Inside config.toml under [mcp_servers.<id>] — the same file as Codex’s settings.`),T_(`codex`,`memory`,`Memory & instructions`)]},{id:`opencode`,label:`OpenCode`,note:C_,groups:[T_(`opencode`,`settings`,`Settings`),T_(`opencode`,`mcp`,`MCP`,`Under the "mcp" key in opencode.json — the same file as OpenCode’s settings.`),T_(`opencode`,`memory`,`Memory & instructions`)]}];function D_(e){let t=E_.find(t=>t.id===e);if(!t)throw Error(`no agent descriptor for ${e}`);return t}function O_(e){return 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 k_(){let e=Me(),t=z(),n=(0,Z.useMemo)(()=>t.data?Wm(t.data.checks):E_.map(e=>e.id),[t.data]);return e.isPending?(0,Q.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,Q.jsx)(W,{icon:(0,Q.jsx)(Mn,{}),tone:`danger`,title:`Agent config did not load`,subtitle:e.error.message,heading:`h2`}):(0,Q.jsx)(A_,{listing:e.data,installed:n})}function A_({listing:e,installed:t}){let[n,r]=(0,Z.useState)(`claude`),[i,a]=(0,Z.useState)(null),o=D_(n),s=e.files.find(e=>e.id===i)??null,c=e=>{r(e),a(null)};return(0,Q.jsxs)(`div`,{"data-slot":`agent-config`,className:`flex flex-col gap-4 p-4 md:p-6`,children:[!e.editable&&(0,Q.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,Q.jsx)(`div`,{"data-slot":`agent-config-agents`,role:`tablist`,className:`flex flex-wrap gap-1 rounded-md bg-muted/40 p-1`,children:E_.map(e=>(0,Q.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:Y(`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,Q.jsx)(Cu,{variant:`outline`,className:`text-[10px] text-soft-foreground`,children:`not installed`})]},e.id))}),o.note&&(0,Q.jsx)(`p`,{"data-slot":`agent-config-agent-note`,className:`text-[12px] text-soft-foreground`,children:o.note}),(0,Q.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-[minmax(0,20rem)_minmax(0,1fr)]`,children:[(0,Q.jsx)(`nav`,{"data-slot":`agent-config-nav`,className:`flex flex-col gap-5`,children:(0,Q.jsx)(j_,{agent:o,listing:e,selectedId:i,onSelect:a})}),(0,Q.jsx)(`div`,{"data-slot":`agent-config-editor-pane`,children:s?(0,Q.jsx)(N_,{file:s},s.id):(0,Q.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 j_({agent:e,listing:t,selectedId:n,onSelect:r}){return(0,Q.jsx)(Q.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,Q.jsxs)(`section`,{"data-slot":`agent-config-group`,"data-group":i.id,"data-agent":e.id,children:[(0,Q.jsx)(`p`,{className:`mb-1 text-[11px] font-medium uppercase tracking-wide text-soft-foreground`,children:i.label}),i.note&&(0,Q.jsx)(`p`,{className:`mb-2 text-[12px] text-soft-foreground`,children:i.note}),(0,Q.jsx)(`ul`,{className:`flex flex-col gap-1`,children:a.map(e=>(0,Q.jsx)(`li`,{children:(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`agent-config-file`,"data-selected":e.id===n,onClick:()=>r(e.id),className:Y(`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,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-[12px]`,children:e.label}),e.seeded&&(0,Q.jsx)(Cu,{variant:`outline`,className:`shrink-0 text-[10px]`,children:`seeded`}),!e.exists&&(0,Q.jsx)(`span`,{className:`shrink-0 text-[11px] text-soft-foreground`,children:`absent`})]})},e.id))}),o&&t.userMcp&&(0,Q.jsx)(M_,{userMcp:t.userMcp})]},i.id)})})}function M_({userMcp:e}){return(0,Q.jsxs)(`div`,{"data-slot":`agent-config-user-mcp`,className:`mt-3`,children:[(0,Q.jsx)(`h4`,{className:`mb-1 text-[12px] font-semibold`,children:`User & local scopes`}),(0,Q.jsxs)(`p`,{className:`mb-2 text-[12px] text-soft-foreground`,children:[`Managed by `,(0,Q.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,Q.jsx)(`ul`,{className:`flex flex-wrap gap-1`,children:e.servers.map(e=>(0,Q.jsx)(`li`,{children:(0,Q.jsx)(Cu,{variant:`outline`,className:`font-mono text-[11px]`,children:e})},e))}):(0,Q.jsx)(`p`,{className:`text-[12px] text-soft-foreground`,children:`No user-scoped MCP servers.`}):(0,Q.jsx)(`p`,{className:`text-[12px] text-soft-foreground`,children:`Could not read the file.`})]})}function N_({file:e}){let t=O(e.id),n=te(e.id),[r,i]=(0,Z.useState)(null),[a,o]=(0,Z.useState)(!1),[s,c]=(0,Z.useState)(null),l=t.data?.version??null;(0,Z.useEffect)(()=>{t.data&&(i(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,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(`span`,{className:`font-mono text-[13px]`,children:e.label}),(0,Q.jsx)(Cu,{variant:`outline`,className:`text-[10px] uppercase`,children:e.format}),(0,Q.jsx)(`a`,{href:e.docsUrl,target:`_blank`,rel:`noreferrer`,className:`text-[12px] text-soft-foreground underline hover:text-foreground`,children:`docs`})]}),(0,Q.jsx)(`p`,{"data-slot":`agent-config-precedence`,className:`text-[12px] text-soft-foreground`,children:e.precedence}),(0,Q.jsxs)(`p`,{"data-slot":`agent-config-effect`,className:`text-[12px] text-foreground/80`,children:[O_(e),e.hotReload?` ${e.hotReload}`:``]}),t.isPending?(0,Q.jsx)(`p`,{className:`text-[13px] text-soft-foreground`,children:`Loading file…`}):t.isError?(0,Q.jsx)(`p`,{className:`text-[13px] text-destructive`,children:t.error.message}):(0,Q.jsx)(S_,{value:u,language:e.format,readOnly:!f,onChange:i,"aria-label":`${e.label} contents`,className:`h-[26rem]`}),s&&(0,Q.jsx)(`p`,{"data-slot":`agent-config-format-error`,className:`text-[12px] text-destructive`,children:s}),a&&(0,Q.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,Q.jsx)(`span`,{children:`The file changed on disk since you opened it.`}),(0,Q.jsx)(H,{size:`sm`,variant:`outline`,onClick:()=>void t.refetch(),children:`Reload from disk`})]}),f&&(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(H,{size:`sm`,onClick:()=>{c(null),o(!1),n.mutate({content:u,version:l},{onSuccess:()=>{i(null),U(`${e.exists?`Saved`:`Created`} ${e.label}`)},onError:e=>{e instanceof m&&e.status===409?o(!0):e instanceof m&&e.status===400?c(e.message):U(e.message,{tone:`danger`})}})},disabled:!d||n.isPending,children:e.exists?`Save`:`Create`}),(0,Q.jsx)(H,{size:`sm`,variant:`ghost`,onClick:()=>i(null),disabled:!d||n.isPending,children:`Revert`}),d&&(0,Q.jsx)(`span`,{className:`text-[12px] text-soft-foreground`,children:`Unsaved changes`})]})]})}function P_({className:e,size:t=`default`,...n}){return(0,Q.jsx)(hu,{"data-slot":`switch`,"data-size":t,className:Y(`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,Q.jsx)(_u,{"data-slot":`switch-thumb`,className:Y(`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 F_=[{id:`claude`,label:`Claude Code`,login:`claude auth login`},{id:`codex`,label:`Codex`,login:`codex login`},{id:`opencode`,label:`OpenCode`,login:`opencode auth login`}],I_=e=>({claude:e,codex:e,opencode:e}),L_={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 R_(e,t,n){return{providers:e.providers.map(e=>e.provider===t?{...e,enabled:n}:e)}}function z_(){let e=fe(),t=a(),n=Ge(),r=v(),[i,o]=(0,Z.useState)(null),s=(0,Z.useRef)(Promise.resolve()),c=(0,Z.useRef)(I_(0)),l=(0,Z.useRef)(I_(0)),u=(0,Z.useRef)(e.data);(0,Z.useEffect)(()=>{i&&rt(e.data,i.provider)?.status===`connected`&&o(null)},[i,e.data]),(0,Z.useEffect)(()=>{if(e.data){if(Object.values(l.current).every(e=>e===0)||!u.current){u.current=e.data;return}u.current={providers:e.data.providers.map(e=>({...e,enabled:l.current[e.provider]>0?rt(u.current,e.provider)?.enabled??e.enabled:e.enabled}))}}},[e.data]);let d=(0,Z.useCallback)((e,t)=>{let n=_.providerStatus,i=r.getQueryData(n);if(!i)return;u.current||=i;let a=R_(i,e,t);l.current[e]+=1,r.setQueryData(n,a);let o=++c.current[e];s.current=s.current.then(async()=>{try{let i=await Ke(e,t),a=rt(i,e)?.enabled;if(a===void 0)return;if(u.current=R_(u.current??i,e,a),o===c.current[e]){let t=r.getQueryData(n);r.setQueryData(n,t?R_(t,e,a):i)}}catch(t){if(o===c.current[e]){let i=rt(u.current,e)?.enabled,a=r.getQueryData(n);a&&i!==void 0?r.setQueryData(n,R_(a,e,i)):u.current?r.setQueryData(n,u.current):r.removeQueries({queryKey:n,exact:!0}),U(t instanceof Error?t.message:String(t),{tone:`danger`})}}finally{--l.current[e]}})},[r]),f=k({mutationFn:P,onSuccess:async e=>{o(null),U(e.opened?`Finish signing in in the terminal, then check again.`:`Provider is already connected.`),await r.invalidateQueries({queryKey:_.providerStatus})},onError:(e,t)=>{if(e instanceof m&&e.command){let n=F_.find(e=>e.id===t)?.label??t;o({provider:t,label:n,message:e.message,command:e.command});return}U(e.message,{tone:`danger`})}}),p=async e=>{try{await navigator.clipboard.writeText(e),U(`Command copied`)}catch{U(`Could not copy the command`,{tone:`danger`})}};return(0,Q.jsxs)(`section`,{id:`providers`,"data-slot":`provider-settings`,className:`scroll-mt-20`,children:[(0,Q.jsxs)(`div`,{className:`mb-2`,children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:`Providers`}),(0,Q.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Connect the coding agents available on this computer.`})]}),e.isError?(0,Q.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,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`text-[13px] font-medium text-foreground`,children:`Provider status could not be loaded`}),(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.error.message})]}),(0,Q.jsx)(H,{type:`button`,variant:`outline`,size:`sm`,disabled:e.isFetching,onClick:()=>void e.refetch(),children:`Retry`})]}):null,(0,Q.jsx)(`div`,{className:`flex flex-col gap-2`,children:F_.map(r=>{let a=rt(e.data,r.id),o=a?.status,s=o?L_[o]:e.isPending?{label:`Checking…`,tone:`neutral`}:L_.unknown,c=f.isPending&&f.variables===r.id,l=o===`disconnected`||o===`unknown`,u=a?.authFailureId;return(0,Q.jsxs)(Z.Fragment,{children:[(0,Q.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,Q.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsx)(`h3`,{className:`text-[13px] font-semibold text-foreground`,children:r.label}),(0,Q.jsxs)(`div`,{className:`mt-1 flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,Q.jsx)(Wu,{tone:s.tone,pulse:e.isPending}),(0,Q.jsx)(`span`,{children:s.label}),a?.enabled===!1?(0,Q.jsx)(`span`,{children:`Disabled`}):null]}),o===`not-installed`?(0,Q.jsxs)(`p`,{className:`mt-1.5 text-xs text-soft-foreground`,children:[`Install `,r.label,`, then run `,(0,Q.jsx)(`code`,{children:r.login}),`.`]}):o===`unknown`||e.isError&&!o?(0,Q.jsx)(`p`,{className:`mt-1.5 text-xs text-soft-foreground`,children:`Verification failed. Check again when the provider is available.`}):a?.hint?(0,Q.jsx)(`p`,{className:`mt-1.5 text-xs text-soft-foreground`,children:a.hint}):null]}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[o===`not-installed`?null:(0,Q.jsx)(P_,{checked:a?.enabled??!0,"aria-label":`Use ${r.label}`,onCheckedChange:e=>d(r.id,e)}),l?(0,Q.jsx)(H,{type:`button`,variant:`ghost`,size:`sm`,disabled:t.isPending,onClick:()=>t.mutate(void 0,{onError:e=>U(e.message,{tone:`danger`})}),children:`Check again`}):null,o===`disconnected`?(0,Q.jsx)(H,{type:`button`,variant:`outline`,size:`sm`,disabled:f.isPending,onClick:()=>f.mutate(r.id),children:c?`Opening…`:`Connect`}):null,u===void 0?null:(0,Q.jsx)(H,{type:`button`,variant:`outline`,size:`sm`,disabled:n.isPending,onClick:()=>n.mutate({provider:r.id,authFailureId:u},{onSuccess:()=>U(`${r.label} can be tried again.`),onError:e=>U(e.message,{tone:`danger`})}),children:`Try again`})]})]}),u===void 0?null:(0,Q.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,Q.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,Q.jsx)(`p`,{className:`text-[13px] text-foreground`,children:i.message}),(0,Q.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2`,children:[(0,Q.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,Q.jsx)(H,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>void p(i.command),children:`Copy command`})]})]}):null]},r.id)})})]})}var B_=2e4;function V_(){let e=N(),t=Be(),n=fe();return e.isPending?(0,Q.jsx)(`p`,{"data-slot":`agents-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading agent settings…`}):e.isError?(0,Q.jsx)(W,{icon:(0,Q.jsx)(Tn,{}),tone:`danger`,title:`Agent settings did not load`,subtitle:e.error.message,heading:`h2`}):(0,Q.jsx)(H_,{config:e.data,catalog:t.data,providerStatus:n})}function H_({config:e,catalog:t,providerStatus:n}){let r=Xe(),i=v(),a=k({mutationFn:e=>je(e),onSuccess:e=>{i.setQueryData(o.config,e),i.invalidateQueries({queryKey:o.health}),i.invalidateQueries({queryKey:o.repo})},onError:e=>U(e.message,{tone:`danger`})}),[s,c]=(0,Z.useState)(e.systemPrompt??``),l=s.trim(),u=l===(e.systemPrompt??``),d=l.length>B_;return(0,Q.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,Q.jsx)(z_,{}),(0,Q.jsxs)(U_,{title:`Default runner`,hint:`Preselected for new tasks and used by the chain planner. Each task can still pick another runner.`,children:[(0,Q.jsx)(`div`,{role:`radiogroup`,"aria-label":`Default runner`,"data-slot":`agents-runner`,className:`inline-flex w-fit gap-0.5 rounded-md border border-border bg-card p-0.5`,children:zm.map(t=>{let r=t.id===e.defaultRunner,i=rt(n.data,t.id),o=!n.isPending&&!n.isError&&i?.enabled===!0&&i.status===`connected`,s=n.isPending?`Checking provider authentication…`:n.isError?`Provider authentication could not be verified.`:i?.enabled===!1?`This provider is disabled. Enable it above or choose another provider.`:o?void 0:`Connect this provider before selecting it.`;return(0,Q.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":r,"data-value":t.id,title:s??t.desc,disabled:a.isPending||!o,onClick:()=>a.mutate({defaultRunner:t.id}),className:Y(`rounded-sm px-3 py-1.5 font-mono text-[13px] font-medium transition-colors disabled:opacity-50`,r?`bg-muted text-foreground`:`text-muted-foreground hover:text-foreground`),children:t.label},t.id)})}),!n.isPending&&!n.isError&&rt(n.data,e.defaultRunner)?.enabled===!1?(0,Q.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`This provider is disabled. Enable it above or choose another provider.`}):null]}),(0,Q.jsx)(U_,{title:`Default models`,hint:`The model preselected in the composer for each runner. Auto lets the runner decide per task.`,children:(0,Q.jsx)(`div`,{className:`flex max-w-md flex-col gap-2`,children:zm.map(r=>{let i=rt(n.data,r.id),o=!n.isPending&&!n.isError&&i?.enabled===!0&&i.status===`connected`,s=n.isPending?`Checking provider authentication…`:n.isError?`Provider authentication could not be verified.`:i?.enabled===!1?`This provider is disabled. Enable it above or choose another provider.`:o?void 0:`Connect this provider before selecting it.`;return(0,Q.jsxs)(`label`,{className:`flex items-center gap-3`,children:[(0,Q.jsx)(`span`,{className:`w-24 shrink-0 font-mono text-xs text-muted-foreground`,children:r.label}),(0,Q.jsxs)(`select`,{"aria-label":`Default model for ${r.label}`,"data-slot":`agents-model`,"data-runner":r.id,value:e.defaultModels[r.id]??``,title:s??r.desc,disabled:a.isPending||!o,onChange:e=>a.mutate({defaultModels:{[r.id]:e.target.value||null}}),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:[Hm(r.id,t,[e.defaultModels[r.id]]).map(e=>(0,Q.jsx)(`option`,{value:e.id,children:e.id===``?`auto (default)`:e.label},e.id)),Um(r.id,t)?(0,Q.jsx)(`option`,{disabled:!0,children:Um(r.id,t)}):null]})]},r.id)})})}),(0,Q.jsxs)(U_,{title:`System prompt`,hint:`Extra instructions appended to every run, whichever runner executes it. This is the only place it is edited.`,children:[(0,Q.jsx)(yt,{"aria-label":`System prompt`,"data-slot":`agents-system-prompt`,value:s,onChange:e=>c(e.target.value),placeholder:`Extra rules for every agent run — conventions, tone, review requirements…`,className:`min-h-32 max-w-xl`}),(0,Q.jsxs)(`div`,{className:`flex max-w-xl items-center gap-3`,children:[(0,Q.jsx)(H,{type:`button`,variant:`outline`,size:`sm`,"data-action":`agents-save-prompt`,disabled:u||d||a.isPending,onClick:()=>a.mutate({systemPrompt:l===``?null:l},{onSuccess:()=>U(l===``?`System prompt cleared`:`System prompt saved`)}),children:`Save`}),d?(0,Q.jsxs)(`p`,{"data-slot":`agents-prompt-limit`,className:`text-[11px] text-danger`,children:[l.length.toLocaleString(),` characters — the limit is`,` `,B_.toLocaleString(),`.`]}):(0,Q.jsx)(`p`,{className:`text-[11px] text-soft-foreground`,children:`Leave empty and save to clear. Applied to new runs only.`})]})]}),(0,Q.jsx)(U_,{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,Q.jsxs)(`label`,{className:`flex w-fit items-center gap-3`,children:[(0,Q.jsx)(P_,{"aria-label":`Live title updates`,"data-slot":`agents-live-title-updates`,checked:e.liveTitleUpdates??!0,disabled:a.isPending,onCheckedChange:e=>a.mutate({liveTitleUpdates:e},{onSuccess:()=>U(e?`Live title updates on`:`Live title updates off`)})}),(0,Q.jsxs)(`span`,{className:`text-[13px] text-muted-foreground`,children:[e.liveTitleUpdates??!0?`On`:`Off`,e.liveTitleUpdates===null&&` (default)`]})]})}),(0,Q.jsx)(U_,{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,Q.jsxs)(`label`,{className:`flex w-fit items-center gap-3`,children:[(0,Q.jsx)(P_,{"aria-label":`Review changes before finishing`,"data-slot":`agents-review-gate`,checked:e.reviewGate??!1,disabled:a.isPending,onCheckedChange:e=>a.mutate({reviewGate:e},{onSuccess:()=>U(e?`Review gate on`:`Review gate off`)})}),(0,Q.jsxs)(`span`,{className:`text-[13px] text-muted-foreground`,children:[e.reviewGate??!1?`On`:`Off`,e.reviewGate===null&&` (default)`]})]})}),(0,Q.jsx)(U_,{title:`Base branch`,hint:`New task worktrees branch from this and draft PRs target it. Also settable from the Git view.`,children:r.data?.info?(0,Q.jsxs)(`select`,{"aria-label":`Base branch`,"data-slot":`agents-base-branch`,value:e.baseBranch??``,disabled:a.isPending,onChange:e=>a.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,Q.jsx)(`option`,{value:``,children:`follow checked-out branch (default)`}),r.data.branches.map(e=>(0,Q.jsx)(`option`,{value:e,children:e},e))]}):(0,Q.jsx)(`p`,{"data-slot":`agents-base-branch-unavailable`,className:`text-[13px] text-soft-foreground`,children:r.isPending?`Loading branches…`:`Not a git repository — tasks run in place, no branching.`})})]})}function U_({title:e,hint:t,children:n}){return(0,Q.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:e}),(0,Q.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:t})]}),n]})}var W_=`cez-accent`,G_=`cez-density`,K_=`lime`,q_=`comfortable`;function J_(e){return e===`lime`||e===`violet`?e:K_}function Y_(e){return e===`comfortable`||e===`compact`||e===`ultra`?e:q_}function X_(e){let t=e&&typeof e==`object`?e:{};return{accent:J_(t.accent),density:Y_(t.density)}}function Z_(){try{return{accent:J_(localStorage.getItem(W_)),density:Y_(localStorage.getItem(G_))}}catch{return{accent:K_,density:q_}}}function Q_(e){try{localStorage.setItem(W_,e.accent),localStorage.setItem(G_,e.density)}catch{}}function $_(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}var ev=Z.createContext(null);function tv({children:e}){let t=v(),n=st(),[r,i]=Z.useState(Z_),a=n.data;Z.useEffect(()=>{if(a===void 0)return;let e=X_(a.appearance);i(e),Q_(e)},[a]),Z.useLayoutEffect(()=>{$_(document.documentElement,r)},[r]);let o=Z.useCallback(e=>{i(e),Q_(e),Qe({appearance:e}).then(e=>t.setQueryData(_.uiState,e)).catch(e=>{U(e instanceof Error?e.message:String(e),{tone:`danger`}),t.invalidateQueries({queryKey:_.uiState})})},[t]),s=Z.useCallback(e=>o({accent:e,density:r.density}),[o,r.density]),c=Z.useCallback(e=>o({accent:r.accent,density:e}),[o,r.accent]),l=Z.useMemo(()=>({accent:r.accent,density:r.density,setAccent:s,setDensity:c}),[r,s,c]);return(0,Q.jsx)(ev.Provider,{value:l,children:e})}function nv(){let e=Z.useContext(ev);if(!e)throw Error(`cezar: useAppearance() must be called inside <AppearanceProvider>`);return e}var rv=[{value:`system`,label:`System`,icon:Kn},{value:`light`,label:`Light`,icon:or},{value:`dark`,label:`Dark`,icon:qn}],iv=[{value:`lime`,label:`Lime`,swatch:`var(--accent-lime)`},{value:`violet`,label:`Violet`,swatch:`var(--violet)`}],av=[{value:`comfortable`,label:`Comfortable`},{value:`compact`,label:`Compact`},{value:`ultra`,label:`Compact for real`}];function ov({slot:e,label:t,value:n,options:r,onChange:i}){return(0,Q.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,Q.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":t,"data-value":e.value,onClick:()=>i(e.value),className:Y(`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,Q.jsx)(e.icon,{"aria-hidden":`true`,className:`size-3.5`}):null,e.swatch?(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`size-3 rounded-full border border-border`,style:{background:e.swatch}}):null,e.label]},e.value)})})}function sv({title:e,hint:t,children:n}){return(0,Q.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:e}),(0,Q.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:t})]}),n]})}function cv(){let{theme:e,setTheme:t}=nd(),{accent:n,density:r,setAccent:i,setDensity:a}=nv();return(0,Q.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,Q.jsx)(sv,{title:`Theme`,hint:`System follows your OS preference. Applies to this browser.`,children:(0,Q.jsx)(ov,{slot:`appearance-theme`,label:`Theme`,value:e,options:rv,onChange:t})}),(0,Q.jsx)(sv,{title:`Accent`,hint:`The primary action color. Saved with this repo's cockpit state.`,children:(0,Q.jsx)(ov,{slot:`appearance-accent`,label:`Accent`,value:n,options:iv,onChange:i})}),(0,Q.jsx)(sv,{title:`Density`,hint:`Compact tightens spacing across the cockpit — text stays the same size.`,children:(0,Q.jsx)(ov,{slot:`appearance-density`,label:`Density`,value:r,options:av,onChange:a})})]})}var lv=`http://localhost:4321`;function uv(e,t,n,r=lv,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)}`}function dv(){let e=me();return e.isPending?(0,Q.jsx)(`p`,{"data-slot":`bookmarklets-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading bookmarklets…`}):e.isError?(0,Q.jsx)(W,{icon:(0,Q.jsx)(_t,{}),tone:`danger`,heading:`h2`,title:`Could not load bookmarklets`,subtitle:e.error.message}):(0,Q.jsx)(`div`,{className:`flex min-h-full flex-1 overflow-y-auto px-4 py-5 md:px-7`,children:(0,Q.jsx)(fv,{skills:xf(e.data??[])})})}function fv({skills:e}){let t=C(),n=z(),r=ce(),[i,a]=(0,Z.useState)(!1),[o,s]=(0,Z.useState)(``),c=t.data?.key??``,l=window.location.origin,u=Lt()??n.data?.bootProject??null,d=r.data?.projects.find(e=>e.id===u)?.name??By(n.data)?.name??null,f=o.trim().toLowerCase(),p=e.filter(e=>e.name.toLowerCase().includes(f));return(0,Q.jsxs)(`div`,{"data-slot":`bookmarklet-panel`,className:`mx-auto w-full max-w-2xl`,children:[(0,Q.jsx)(`h2`,{className:`text-base font-semibold`,children:`Run from GitHub`}),(0,Q.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,Q.jsx)(`span`,{className:`font-mono`,children:`npx cezar`}),`.`]}),(0,Q.jsxs)(`label`,{className:`mt-4 flex items-center gap-2 text-[13px] font-medium`,children:[(0,Q.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,Q.jsx)(`span`,{className:`font-normal text-soft-foreground`,children:`— re-drag the buttons after changing this`})]}),(0,Q.jsx)(`div`,{"data-slot":`bm-generic`,className:`mt-4`,children:(0,Q.jsx)(pv,{label:d?`cezar (${d}): this PR/issue`:`cezar: this PR/issue`,url:uv(``,!1,c,l,u),hint:`prefills the form — nothing starts by itself`})}),(0,Q.jsx)(Pu,{"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,Q.jsx)(`div`,{"data-slot":`bm-list`,className:`mt-3 flex flex-col gap-2`,children:p.length>0?p.map(e=>(0,Q.jsx)(pv,{label:d?`/${e.name} (${d})`:`/${e.name}`,url:uv(e.name,i,c,l,u),hint:e.source},e.path)):(0,Q.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 pv({label:e,url:t,hint:n}){let r=(0,Z.useRef)(null);(0,Z.useEffect)(()=>{r.current?.setAttribute(`href`,t)},[t]);let i=async()=>{try{await navigator.clipboard.writeText(t),U(`Bookmarklet URL copied.`)}catch{U(`Copy failed — drag the button instead.`,{tone:`danger`})}};return(0,Q.jsxs)(`div`,{"data-slot":`bm-row`,className:`flex min-w-0 items-center gap-2.5`,children:[(0,Q.jsxs)(`a`,{ref:r,draggable:!0,"data-slot":`bm-link`,title:`Drag me to your bookmarks bar`,onClick:e=>{e.preventDefault(),U(`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:[(0,Q.jsx)(cr,{"aria-hidden":`true`,className:`size-3 text-primary`}),e]}),(0,Q.jsx)(`button`,{type:`button`,"data-slot":`bm-copy`,title:`Copy the bookmarklet URL`,onClick:()=>void i(),className:`shrink-0 text-xs font-medium text-muted-foreground transition-colors hover:text-foreground`,children:`Copy`}),n?(0,Q.jsx)(`span`,{className:`min-w-0 truncate text-[11px] text-soft-foreground`,children:n}):null]})}function mv(e){return{enabled:(e&&typeof e==`object`?e:{}).enabled===!0}}function hv(){let e=globalThis.Notification;if(typeof e!=`function`)return`unsupported`;let t=e.permission;return t===`granted`||t===`denied`?t:`default`}function gv(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||gf(i)&&r.push(i)}return{entering:r,statuses:n}}function _v(e){return e.enabled&&e.hidden&&e.permission===`granted`}function vv(e){let t=hf(e).label;return{title:e.titleSummary??e.title,body:`Task ${t}`,tag:`cezar-run-${e.id}`}}function yv(){let e=v(),t=st(),[n,r]=Z.useState(!1),[i,a]=Z.useState(hv),o=t.data;Z.useEffect(()=>{o!==void 0&&r(mv(o.notifications).enabled)},[o]);let s=Z.useCallback(t=>{r(t),Qe({notifications:{enabled:t}}).then(t=>e.setQueryData(_.uiState,t)).catch(t=>{U(t instanceof Error?t.message:String(t),{tone:`danger`}),e.invalidateQueries({queryKey:_.uiState})})},[e]),c=Z.useCallback(e=>{if(!e){s(!1);return}if(hv()!=="default"){s(!0);return}s(!0),Notification.requestPermission().then(e=>a(e)).catch(()=>a(hv()))},[s]),l=i===`unsupported`;return(0,Q.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,Q.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,Q.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:(0,Q.jsx)(`label`,{htmlFor:`notifications-enabled`,children:`Notify when an agent needs you`})}),(0,Q.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,Q.jsx)(P_,{id:`notifications-enabled`,"data-slot":`notifications-toggle`,checked:n,disabled:l,onCheckedChange:c})]}),l?(0,Q.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,!l&&n&&i===`denied`?(0,Q.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 bv({title:e,hint:t,children:n}){return(0,Q.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:e}),(0,Q.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:t})]}),n]})}var xv=1,Sv={ok:`ok`,"not-git":`no git repo`,missing:`folder not found`};function Cv(e){let t=new Date(e);return Number.isNaN(t.getTime())?`—`:t.toLocaleDateString(void 0,{month:`short`,day:`numeric`})}function wv(){let e=d(),t=ce();return e.isPending||t.isPending?(0,Q.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,Q.jsx)(W,{icon:(0,Q.jsx)(Ln,{}),tone:`danger`,title:`Project settings did not load`,subtitle:(e.error??t.error)?.message,heading:`h2`}):(0,Q.jsx)(Tv,{config:e.data,registry:t.data})}function Tv({config:e,registry:t}){return(0,Q.jsxs)(`div`,{"data-slot":`projects-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,Q.jsx)(Ev,{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,Q.jsx)(Ev,{configKey:`projectsDir`,value:e.projectsDir,title:`Default checkout folder`,hint:`Where “Clone from GitHub” puts 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,Q.jsx)(Dv,{registry:t,workspaceMax:e.resources.maxParallel})]})}function Ev({configKey:e,value:t,title:n,hint:r,placeholder:i,slot:a,savedLabel:o,footer:s,refreshProjects:c=!1}){let l=v(),u=k({mutationFn:t=>We(e===`browseRoot`?{browseRoot:t}:{projectsDir:t}),onSuccess:t=>{l.setQueryData(_.config,t),e===`browseRoot`?l.invalidateQueries({queryKey:_.fsBrowseRoot}):c&&l.invalidateQueries({queryKey:_.projects})}}),[d,f]=(0,Z.useState)(t),p=d.trim(),m=p===t,h=u.isError?u.error.message:null;return(0,Q.jsxs)(bv,{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,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.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,Q.jsx)(H,{type:`button`,variant:`outline`,size:`sm`,"data-action":`projects-save-${a}-root`,disabled:m||p===``||u.isPending,onClick:()=>u.mutate(p,{onSuccess:()=>U(`${o} set to ${p}`)}),children:`Save`})]}),h===null?(0,Q.jsx)(`p`,{className:`text-[11px] text-soft-foreground`,children:s}):(0,Q.jsxs)(`p`,{"data-slot":`projects-${a}-root-error`,role:`alert`,className:`text-[11px] text-danger`,children:[h,` — setting unchanged`]})]})}function Dv({registry:e,workspaceMax:t}){let[n,r]=(0,Z.useState)(null),i=$e();return(0,Q.jsxs)(bv,{title:`Registered projects`,hint:`Every folder cezar has run in, plus the ones added from the GUI. “Max parallel” caps how many of that project's tasks run at once; 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,Q.jsx)(`p`,{"data-slot":`projects-empty`,className:`text-[13px] text-soft-foreground`,children:`No projects registered yet.`}):(0,Q.jsx)(`div`,{className:`overflow-x-auto rounded-md border border-border`,children:(0,Q.jsxs)(`table`,{className:`w-full border-collapse text-sm`,children:[(0,Q.jsx)(`caption`,{className:`sr-only`,children:`Projects registered in this workspace`}),(0,Q.jsx)(`thead`,{children:(0,Q.jsxs)(`tr`,{className:`border-b border-border text-left text-[12px] text-soft-foreground`,children:[(0,Q.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Project`}),(0,Q.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Status`}),(0,Q.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Max parallel`}),(0,Q.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Added`}),(0,Q.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium text-right`,children:`Actions`})]})}),(0,Q.jsx)(`tbody`,{children:e.projects.map(n=>(0,Q.jsx)(Ov,{project:n,isBoot:n.id===e.bootProject,workspaceMax:t,disabled:i.isPending,onRemove:()=>r(n)},n.id))})]})}),(0,Q.jsx)(Hg,{open:n!==null,onOpenChange:e=>!e&&r(null),children:(0,Q.jsxs)(Gg,{children:[(0,Q.jsxs)(Kg,{children:[(0,Q.jsxs)(Jg,{children:[`Remove `,n?.name,` from the workspace?`]}),(0,Q.jsxs)(Yg,{children:[`This only unregisters the project — `,(0,Q.jsx)(`strong`,{children:`nothing on disk is deleted`}),`. The folder, its git history and its task history all stay exactly where they are, and opening it again re-registers it with everything intact.`,(0,Q.jsx)(`span`,{className:`mt-1 block truncate font-mono text-[11px] text-foreground`,title:n?.root,children:n?.root})]})]}),(0,Q.jsxs)(qg,{children:[(0,Q.jsx)(Zg,{children:`Keep it`}),(0,Q.jsx)(Xg,{"data-action":`projects-confirm-remove`,className:`bg-danger text-danger-foreground hover:brightness-[0.96]`,onClick:()=>{if(!n)return;let{id:e,name:t}=n;r(null),i.mutate(e,{onSuccess:()=>U(`${t} removed from the workspace — its files are untouched`),onError:e=>U(e.message,{tone:`danger`})})},children:`Remove from list`})]})]})})]})}function Ov({project:e,isBoot:t,workspaceMax:n,disabled:r,onRemove:i}){return(0,Q.jsxs)(`tr`,{"data-slot":`project-row`,"data-project":e.id,className:`border-b border-border last:border-0`,children:[(0,Q.jsxs)(`th`,{scope:`row`,className:`max-w-[260px] px-3 py-2 text-left font-normal`,children:[(0,Q.jsx)(`span`,{className:`block truncate text-foreground`,children:e.name}),(0,Q.jsx)(`span`,{className:`block truncate font-mono text-[11px] text-soft-foreground`,title:e.root,children:e.root})]}),(0,Q.jsxs)(`td`,{className:`px-3 py-2`,children:[(0,Q.jsx)(`span`,{"data-slot":`project-status`,className:e.status===`missing`?`text-[12px] text-danger`:`text-[12px] text-soft-foreground`,children:Sv[e.status]}),e.status===`missing`?null:(0,Q.jsxs)(`span`,{className:`ml-1 text-[11px] text-soft-foreground`,children:[`· `,e.source]})]}),(0,Q.jsx)(`td`,{className:`px-3 py-2`,children:(0,Q.jsx)(kv,{project:e,workspaceMax:n})}),(0,Q.jsx)(`td`,{className:`px-3 py-2 tabular-nums text-soft-foreground`,children:Cv(e.addedAt)}),(0,Q.jsx)(`td`,{className:`px-3 py-2 text-right`,children:(0,Q.jsx)(H,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`project-remove`,"aria-label":`Unregister ${e.name} (no files are deleted)`,title:t?`cezar is serving this project — it re-registers itself at every start`:void 0,disabled:r||t,onClick:i,children:`Remove`})})]})}function kv({project:e,workspaceMax:t}){let n=lt(),r=e.maxParallel===void 0?``:String(e.maxParallel);return(0,Q.jsxs)(`select`,{"aria-label":`Max parallel tasks for ${e.name}`,"data-slot":`project-max-parallel`,value:r,disabled:n.isPending,onChange:r=>{let i=r.target.value,a=i===``?null:Number(i);n.mutate({id:e.id,maxParallel:a},{onSuccess:()=>U(a===null?`${e.name} inherits the workspace limit (${t})`:`${e.name} runs at most ${a} task${a===1?``:`s`} at a time`),onError:e=>U(e.message,{tone:`danger`})})},className:`block w-44 rounded-md border border-input bg-card px-2 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,Q.jsxs)(`option`,{value:``,children:[`Inherit workspace (`,t,`)`]}),Array.from({length:16},(e,t)=>t+xv).map(e=>(0,Q.jsx)(`option`,{value:e,children:e},e))]})}function Av(){let e=ve();return e.isPending?(0,Q.jsx)(`p`,{"data-slot":`prompt-templates-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading prompt templates…`}):e.isError?(0,Q.jsx)(W,{icon:(0,Q.jsx)(Jn,{}),tone:`danger`,title:`Prompt templates did not load`,subtitle:e.error.message,heading:`h2`}):(0,Q.jsx)(jv,{initial:Ch(e.data.promptTemplates)})}function jv({initial:e}){let t=v(),n=me(),r=ve(),[i,a]=(0,Z.useState)(e),[s,c]=(0,Z.useState)(``),[l,u]=(0,Z.useState)(``),d=k({mutationFn:e=>he({promptTemplates:e}),onSuccess:e=>{t.setQueryData(o.uiState,e),U(`Prompt templates saved`)},onError:e=>U(e.message,{tone:`danger`})}),f=JSON.stringify(i)!==JSON.stringify(e),p=i.some(e=>e.label.trim()===``||e.text.trim()===``),m=(e,t)=>a(n=>n.map(n=>n.id===e?{...n,...t}:n)),h=(e,t)=>a(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=>a(t=>t.filter(t=>t.id!==e));return(0,Q.jsx)(`div`,{"data-slot":`prompt-templates-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,Q.jsxs)(Nv,{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,Q.jsx)(`div`,{"data-slot":`prompt-template-list`,className:`flex flex-col gap-3`,children:i.length===0?(0,Q.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.`}):i.map(e=>(0,Q.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,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(Pu,{"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,Q.jsx)(H,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`prompt-template-remove`,title:`Remove this template`,onClick:()=>g(e.id),children:(0,Q.jsx)(vt,{"aria-hidden":`true`,className:`size-3.5`})})]}),(0,Q.jsx)(yt,{"aria-label":`Text for ${e.label||`this template`}`,"data-slot":`prompt-template-text-input`,value:e.text,maxLength:2e3,onChange:t=>m(e.id,{text:t.target.value}),className:`min-h-14 text-[13px]`}),(0,Q.jsxs)(`div`,{className:`mt-0.5 flex flex-wrap items-center gap-1.5`,children:[(0,Q.jsx)(Mv,{label:e.label,skills:n.data??[],skillUsage:r.data?.skillUsage,selected:e.skills??[],onToggle:t=>h(e.id,t)}),(e.skills??[]).map(t=>(0,Q.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,Q.jsx)(vt,{"aria-hidden":`true`,className:`size-3`})]},t))]})]},e.id))}),(0,Q.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,Q.jsx)(Pu,{"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,Q.jsx)(yt,{"aria-label":`New template text`,"data-slot":`prompt-template-new-text`,placeholder:`The instructions to insert…`,value:l,maxLength:2e3,onChange:e=>u(e.target.value),className:`min-h-14 text-[13px]`}),(0,Q.jsxs)(H,{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||(a(n=>[...n,{id:Oh(),label:e,text:t}]),c(``),u(``))},className:`self-start`,children:[(0,Q.jsx)(er,{"aria-hidden":`true`,className:`size-3.5`}),`Add template`]})]}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Q.jsx)(H,{type:`button`,variant:`contrast`,size:`sm`,"data-action":`prompt-templates-save`,disabled:!f||p||d.isPending,onClick:()=>d.mutate(i),children:`Save`}),(0,Q.jsx)(H,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`prompt-templates-reset`,disabled:d.isPending,onClick:()=>a(xh.map(e=>({...e}))),children:`Reset to defaults`}),p?(0,Q.jsx)(`p`,{"data-slot":`prompt-templates-invalid`,className:`text-[11px] text-danger`,children:`Every template needs both a label and text.`}):null]})]})})}function Mv({label:e,skills:t,skillUsage:n,selected:r,onToggle:i}){let[a,o]=(0,Z.useState)(!1),s=(0,Z.useRef)(null),{mostUsed:c,project:l,global:u}=Cf(t,n),d=(e,t)=>{let n=r.includes(e.name);return(0,Q.jsxs)(uf,{value:`skill ${e.name} ${e.path}`,keywords:Nf(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,Q.jsx)(`span`,{className:Y(`shrink-0 font-mono text-xs`,t&&`font-semibold`),children:e.name}),e.description?(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null,n?(0,Q.jsx)(Pe,{"aria-hidden":`true`,className:`ml-auto size-3.5 shrink-0 text-primary`}):null]},e.path)};return(0,Q.jsxs)(dh,{open:a,onOpenChange:o,children:[(0,Q.jsx)(fh,{asChild:!0,children:(0,Q.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:Y(`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,Q.jsx)(ir,{"aria-hidden":`true`,className:`size-3 shrink-0 text-violet`}),t.length===0?`no skills found`:`apply with…`,(0,Q.jsx)(En,{"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,Q.jsx)(ph,{align:`start`,sideOffset:8,className:`w-[336px] max-w-[calc(100vw-2rem)] p-0`,children:(0,Q.jsxs)(nf,{filter:jf,children:[(0,Q.jsx)(af,{placeholder:`search skills…`,onInput:()=>s.current?.scrollTo(0,0)}),(0,Q.jsxs)(of,{ref:s,"data-slot":`prompt-template-skill-menu`,className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[(0,Q.jsx)(sf,{children:`Nothing matches.`}),c.length>0?(0,Q.jsx)(cf,{heading:`Most used`,children:c.map(e=>d(e,bf(e)))}):null,l.length>0?(0,Q.jsx)(cf,{heading:`Project skills`,children:l.map(e=>d(e,!0))}):null,u.length>0?(0,Q.jsx)(cf,{heading:`Global`,children:u.map(e=>d(e,!1))}):null]})]})})]})}function Nv({title:e,hint:t,children:n}){return(0,Q.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:e}),(0,Q.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:t})]}),n]})}var Pv=1,Fv=1,Iv=60,Lv=256;function Rv(){let e=d();return e.isPending?(0,Q.jsx)(`p`,{"data-slot":`resources-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading resource settings…`}):e.isError?(0,Q.jsx)(W,{icon:(0,Q.jsx)(Rn,{}),tone:`danger`,title:`Resource settings did not load`,subtitle:e.error.message,heading:`h2`}):(0,Q.jsx)(zv,{config:e.data})}function zv({config:e}){let t=v(),n=k({mutationFn:e=>We(e),onSuccess:e=>t.setQueryData(_.config,e),onError:e=>U(e.message,{tone:`danger`})}),[r,i]=(0,Z.useState)(e.resources.memoryLimitMb?String(e.resources.memoryLimitMb):``),a=e.resources.monitoringWakeIntervalMinutes??null,[o,s]=(0,Z.useState)(a===null?`park`:`interval`),[c,l]=(0,Z.useState)(String(a??5)),u=Number(c),d=!Number.isInteger(u)||u<Fv||u>Iv,f=o===`park`?a===null:!d&&a===u,p=()=>n.mutate({resources:{monitoringWakeIntervalMinutes:o===`park`?null:u}},{onSuccess:()=>U(o===`park`?`Monitoring will stay parked`:`Monitoring will re-check every ${u} minutes`)}),m=r.trim()===``?0:Number(r),h=r.trim()!==``&&(!Number.isInteger(m)||m<Lv),g=(e.resources.memoryLimitMb??0)===(h?-1:m),y=()=>n.mutate({resources:{memoryLimitMb:m===0?null:m}},{onSuccess:()=>U(m===0?`Memory limit cleared`:`Memory limit set to ${m} 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,Q.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,Q.jsxs)(bv,{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,Q.jsx)(`select`,{"aria-label":`Max parallel tasks`,"data-slot":`resources-max-parallel`,value:e.resources.maxParallel,disabled:n.isPending,onChange:e=>n.mutate({resources:{maxParallel:Number(e.target.value)}}),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:Array.from({length:16},(e,t)=>t+Pv).map(e=>(0,Q.jsx)(`option`,{value:e,children:e},e))}),(0,Q.jsxs)(`p`,{className:`text-[11px] text-soft-foreground`,children:[`Need a different limit for one project?`,` `,(0,Q.jsx)(ct,{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,Q.jsxs)(bv,{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,Q.jsx)(`select`,{"aria-label":`Extra monitoring sessions`,"data-slot":`resources-max-monitoring`,value:e.resources.maxMonitoringSessions??2,disabled:n.isPending,onChange:e=>n.mutate({resources:{maxMonitoringSessions:Number(e.target.value)}}),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:Array.from({length:17},(e,t)=>(0,Q.jsx)(`option`,{value:t,children:t},t))}),(0,Q.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,Q.jsxs)(bv,{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,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Q.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,Q.jsx)(`option`,{value:`park`,children:`Park until resumed`}),(0,Q.jsx)(`option`,{value:`interval`,children:`Re-check on an interval`})]}),o===`interval`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`input`,{type:`number`,min:Fv,max:Iv,"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,Q.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`minutes`})]}):null,(0,Q.jsx)(H,{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,Q.jsx)(`p`,{"data-slot":`resources-monitoring-wake-invalid`,className:`text-[11px] text-danger`,children:`Enter a whole number from 1 to 60 minutes.`}):(0,Q.jsx)(`p`,{className:`text-[11px] text-soft-foreground`,children:`Applied consistently to Claude, Codex and OpenCode.`})]}),(0,Q.jsxs)(bv,{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,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`input`,{type:`number`,inputMode:`numeric`,min:Lv,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,Q.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`MiB`}),(0,Q.jsx)(H,{type:`button`,variant:`outline`,size:`sm`,"data-action":`resources-save-memory`,disabled:g||h||n.isPending,onClick:y,children:`Save`})]}),h?(0,Q.jsxs)(`p`,{"data-slot":`resources-memory-invalid`,className:`text-[11px] text-danger`,children:[`Enter a whole number of at least `,Lv,` MiB, or leave empty for no limit.`]}):(0,Q.jsx)(`p`,{className:`text-[11px] text-soft-foreground`,children:`Applies to newly started tasks.`})]}),(0,Q.jsxs)(bv,{title:`New task defaults`,hint:`Set stable composer defaults across projects. Explicit choices and run-shape constraints still win.`,children:[(0,Q.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,"data-slot":`resources-composer-defaults`,children:[(0,Q.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,Q.jsx)(`span`,{className:`font-medium`,children:`Autonomous by default`}),(0,Q.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,Q.jsx)(`option`,{value:`inherit`,children:`Inherit environment`}),(0,Q.jsx)(`option`,{value:`on`,children:`On`}),(0,Q.jsx)(`option`,{value:`off`,children:`Off`})]}),(0,Q.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,Q.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,Q.jsx)(`span`,{className:`font-medium`,children:`Use a worktree by default`}),(0,Q.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,Q.jsx)(`option`,{value:`inherit`,children:`Inherit environment`}),(0,Q.jsx)(`option`,{value:`on`,children:`On`}),(0,Q.jsx)(`option`,{value:`off`,children:`Off`})]}),(0,Q.jsxs)(`span`,{className:`text-[11px] text-soft-foreground`,children:[`Inherited: `,b.inheritedWorktree?`On`:`Off`]})]})]}),(0,Q.jsx)(`p`,{className:`text-[11px] text-soft-foreground`,children:`Interactive skills may recommend both off. Multi-step and parallel runs remain isolated.`})]})]})}function Bv(){let e=d(),t=ce().data?.bootProject??``,n=it(t,!!t);return e.isPending?(0,Q.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,Q.jsx)(W,{icon:(0,Q.jsx)(Yn,{}),tone:`danger`,title:`Skill settings did not load`,subtitle:e.error.message,heading:`h2`}):(0,Q.jsx)(Vv,{config:e.data,update:n.data,updateError:n.error})}function Vv({config:e,update:t,updateError:n}){let r=v(),i=k({mutationFn:e=>We(e),onSuccess:e=>r.setQueryData(_.config,e),onError:e=>U(e.message,{tone:`danger`})}),a=e.skillsAutoUpdate===null,o=(()=>{if(n)return`Installation status is unavailable right now.`;if(!t)return`Checking tracked Open Mercato installations…`;if(t.status===`unavailable`)return t.scopes.find(e=>e.reason)?.reason??`Automatic skill updates are unavailable.`;if(t.scopes.every(e=>e.skills.length===0))return`No tracked Open Mercato installation found.`;let e=new Set(t.scopes.flatMap(e=>e.skills)).size;return`${e} tracked Open Mercato skill${e===1?``:`s`} found.`})();return(0,Q.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,Q.jsxs)(`section`,{className:`flex flex-col gap-3`,children:[(0,Q.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:(0,Q.jsx)(`label`,{htmlFor:`skills-auto-update`,children:`Update Open Mercato skills automatically`})}),(0,Q.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,Q.jsxs)(`div`,{className:`flex shrink-0 flex-col items-end gap-1`,children:[(0,Q.jsx)(P_,{id:`skills-auto-update`,"data-slot":`skills-auto-update`,checked:e.effectiveSkillsAutoUpdate,disabled:i.isPending,onCheckedChange:e=>i.mutate({skillsAutoUpdate:e})}),(0,Q.jsxs)(`span`,{className:`text-[11px] text-soft-foreground`,children:[e.effectiveSkillsAutoUpdate?`On`:`Off`,a?` (default)`:``]})]})]}),(0,Q.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,Q.jsx)(`span`,{children:a?`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,Q.jsx)(H,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`skills-use-default`,disabled:a||i.isPending,onClick:()=>i.mutate({skillsAutoUpdate:null}),children:`Use default`})]}),(0,Q.jsx)(`p`,{"data-slot":`skills-installation-status`,role:n||t?.status===`unavailable`?`status`:void 0,className:`text-[13px] text-soft-foreground`,children:o})]})})}function Hv(){let e=R(),t=v(),[n,r]=(0,Z.useState)(null),i=()=>t.invalidateQueries({queryKey:o.worktrees}),a=k({mutationFn:()=>be(),onSuccess:e=>{i(),U(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=>U(e.message,{tone:`danger`})}),s=k({mutationFn:e=>tt(e),onSuccess:()=>{i(),U(`Worktree removed`)},onError:e=>U(e.message,{tone:`danger`})});if(e.isPending)return(0,Q.jsx)(`p`,{"data-slot":`worktrees-loading`,className:`text-[13px] text-soft-foreground`,children:`Loading worktrees…`});if(e.isError)return(0,Q.jsxs)(`p`,{"data-slot":`worktrees-error`,className:`text-[13px] text-danger`,children:[`Worktrees did not load: `,e.error.message]});let{worktrees:c,totalBytes:l,keep:u}=e.data,d=a.isPending||s.isPending;return(0,Q.jsxs)(`div`,{"data-slot":`worktrees-panel`,className:`flex flex-col gap-3`,children:[c.length===0?(0,Q.jsx)(`p`,{"data-slot":`worktrees-empty`,className:`text-[13px] text-soft-foreground`,children:`No task worktrees on disk.`}):(0,Q.jsx)(`div`,{className:`overflow-x-auto rounded-md border border-border`,children:(0,Q.jsxs)(`table`,{className:`w-full border-collapse text-sm`,children:[(0,Q.jsx)(`caption`,{className:`sr-only`,children:`Task worktrees currently materialized on disk`}),(0,Q.jsx)(`thead`,{children:(0,Q.jsxs)(`tr`,{className:`border-b border-border text-left text-[12px] text-soft-foreground`,children:[(0,Q.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Task`}),(0,Q.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Status`}),(0,Q.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Size`}),(0,Q.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Age`}),(0,Q.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium text-right`,children:`Actions`})]})}),(0,Q.jsx)(`tbody`,{children:c.map(e=>(0,Q.jsx)(Uv,{worktree:e,disabled:d,onDelete:()=>r({kind:`delete`,runId:e.runId,title:e.title})},e.runId))})]})}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Q.jsxs)(`p`,{"data-slot":`worktrees-footer`,className:`text-[12px] text-soft-foreground`,children:[c.length,` worktree`,c.length===1?``:`s`,l===null?` · size unavailable`:` · ${rm(l)||`0 kB`} on disk`,` · `,u===0?`keeping all (unlimited)`:`keeping the last ${u}`]}),(0,Q.jsx)(H,{type:`button`,variant:`outline`,size:`sm`,"data-action":`worktrees-reclaim-now`,disabled:d,onClick:()=>r({kind:`reclaim`}),children:`Reclaim now`})]}),(0,Q.jsx)(Hg,{open:n!==null,onOpenChange:e=>!e&&r(null),children:(0,Q.jsxs)(Gg,{children:[(0,Q.jsxs)(Kg,{children:[(0,Q.jsx)(Jg,{children:n?.kind===`delete`?`Delete this worktree?`:`Reclaim old worktrees?`}),(0,Q.jsx)(Yg,{children:n?.kind===`delete`?(0,Q.jsxs)(Q.Fragment,{children:[`This removes the worktree directory and its branch — the local-only work is not recoverable afterwards.`,(0,Q.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,Q.jsxs)(qg,{children:[(0,Q.jsx)(Zg,{children:`Keep it`}),(0,Q.jsx)(Xg,{"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`&&s.mutate(n.runId),r(null)},children:n?.kind===`delete`?`Delete`:`Reclaim now`})]})]})})]})}function Uv({worktree:e,disabled:t,onDelete:n}){return(0,Q.jsxs)(`tr`,{"data-slot":`worktree-row`,"data-run":e.runId,className:`border-b border-border last:border-0`,children:[(0,Q.jsxs)(`th`,{scope:`row`,className:`max-w-[220px] px-3 py-2 text-left font-normal`,children:[(0,Q.jsx)(`span`,{className:`block truncate text-foreground`,title:e.title,children:e.title}),(0,Q.jsx)(`span`,{className:`block truncate font-mono text-[11px] text-soft-foreground`,children:e.branch??e.runId.slice(0,8)})]}),(0,Q.jsxs)(`td`,{className:`px-3 py-2`,children:[(0,Q.jsx)(`span`,{className:`text-[12px] text-soft-foreground`,children:e.status}),e.reclaimable?(0,Q.jsx)(`span`,{"data-slot":`worktree-reclaimable`,className:`ml-1 text-[11px] text-soft-foreground`,children:`(reclaimable)`}):null]}),(0,Q.jsx)(`td`,{className:`px-3 py-2 tabular-nums text-soft-foreground`,children:e.sizeBytes===null?`—`:rm(e.sizeBytes)||`0 kB`}),(0,Q.jsx)(`td`,{className:`px-3 py-2 tabular-nums text-soft-foreground`,children:_f(e.finishedAt??void 0)||`—`}),(0,Q.jsx)(`td`,{className:`px-3 py-2 text-right`,children:(0,Q.jsx)(H,{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,Gv=1e3;function Kv(){let e=N();return e.isPending?(0,Q.jsx)(`p`,{"data-slot":`worktrees-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading worktree settings…`}):e.isError?(0,Q.jsx)(W,{icon:(0,Q.jsx)(Nn,{}),tone:`danger`,title:`Worktree settings did not load`,subtitle:e.error.message,heading:`h2`}):(0,Q.jsx)(qv,{config:e.data})}function qv({config:e}){let t=v(),n=k({mutationFn:e=>je(e),onSuccess:e=>t.setQueryData(o.config,e),onError:e=>U(e.message,{tone:`danger`})}),[r,i]=(0,Z.useState)(String(e.worktreeRetention)),a=Number(r),s=r.trim()===``||!Number.isInteger(a)||a<Wv||a>Gv,c=e.worktreeRetention===(s?-1:a);return(0,Q.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,Q.jsxs)(bv,{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,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`input`,{type:`number`,inputMode:`numeric`,min:Wv,max:Gv,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,Q.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`worktrees`}),(0,Q.jsx)(H,{type:`button`,variant:`outline`,size:`sm`,"data-action":`resources-save-retention`,disabled:c||s||n.isPending,onClick:()=>n.mutate({worktreeRetention:a},{onSuccess:()=>{t.invalidateQueries({queryKey:o.worktrees}),U(a===0?`Keeping all worktrees (unlimited)`:`Keeping the last ${a} finished worktree${a===1?``:`s`}`)}}),children:`Save`})]}),s?(0,Q.jsxs)(`p`,{"data-slot":`resources-retention-invalid`,className:`text-[11px] text-danger`,children:[`Enter a whole number from `,Wv,` to `,Gv,` (0 = unlimited).`]}):(0,Q.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,Q.jsx)(bv,{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,Q.jsx)(Hv,{})})]})}function Jv(e,t){return function(){return(0,Q.jsx)(W,{icon:(0,Q.jsx)(t,{}),tone:`neutral`,title:e,subtitle:`This section arrives in a later phase of the redesign.`,heading:`h2`})}}var Yv=[{id:`agents`,title:`Agents`,description:`Default runner, models and system prompt.`,icon:Tn,component:V_,scope:`project`},{id:`agent-config`,title:`Agent config`,description:`Edit the coding agents’ own config files, per scope.`,icon:Mn,component:k_,scope:`project`},{id:`worktrees`,title:`Worktrees`,description:`How many finished task worktrees this project keeps on disk.`,icon:Nn,component:Kv,scope:`project`},{id:`bookmarklets`,title:`Bookmarklets`,description:`Launch skills from a GitHub PR or issue.`,icon:wn,component:dv,scope:`project`},{id:`prompt-templates`,title:`Prompt templates`,description:`Reusable snippets for follow-up instructions.`,icon:Jn,component:Av,scope:`project`},{id:`appearance`,title:`Appearance`,description:`Theme, accent and density.`,icon:Xn,component:cv,scope:`global`},{id:`notifications`,title:`Notifications`,description:`Browser notifications when an agent needs you.`,icon:Cn,component:yv,scope:`global`},{id:`resources`,title:`Resources`,description:`Parallel tasks and per-task memory limit, across every project.`,icon:Rn,component:Rv,scope:`global`},{id:`skills`,title:`Skills`,description:`Updates for skills installed on this machine.`,icon:Yn,component:Bv,scope:`global`},{id:`projects`,title:`Projects`,description:`The workspace registry and where GitHub checkouts land.`,icon:Ln,component:wv,scope:`global`},{id:`keyboard`,title:`Keyboard`,description:`Shortcuts.`,icon:Hn,component:Jv(`Keyboard`,Hn),scope:`global`,hidden:!0}];function Xv(e,t){return Yv.filter(n=>!n.hidden&&n.scope===e&&!(t?.singleProject===!0&&n.id===`projects`))}function Zv(e,t){return e===`global`?`/settings/global/${t}`:`/settings/${t}`}function Qv(e){return e===`global`?`/settings/global`:`/settings`}function $v(e){return e===`global`?{Link:ct,NavLink:re}:{Link:X,NavLink:Pt}}function ey({scope:e,activeId:t,capabilities:n}){let{NavLink:r}=$v(e);return(0,Q.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:[Xv(e,n).map(n=>(0,Q.jsxs)(r,{to:Zv(e,n.id),"data-section":n.id,"aria-current":n.id===t?`page`:void 0,className:Y(`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,Q.jsx)(n.icon,{"aria-hidden":`true`,className:`size-4 shrink-0`}),n.title]},n.id)),e===`global`?(0,Q.jsx)(`p`,{className:`mt-auto px-2.5 pt-3 text-[11px] text-soft-foreground`,children:`Stored in ~/.cezar`}):null]})}function ty({scope:e,activeId:t,capabilities:n}){let{NavLink:r}=$v(e);return(0,Q.jsx)(`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:Xv(e,n).map(n=>(0,Q.jsx)(r,{to:Zv(e,n.id),"data-section":n.id,"aria-current":n.id===t?`page`:void 0,className:Y(`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 ny({section:e,scope:t,capabilities:n}){let r=e.component;return(0,Q.jsxs)(`div`,{"data-route":t===`global`?`settings-global-${e.id}`:`settings-${e.id}`,className:`flex min-h-full flex-col`,children:[(0,Q.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,Q.jsx)(`h1`,{className:`text-base font-semibold`,children:e.title}),(0,Q.jsx)(`p`,{className:`text-[13px] text-soft-foreground`,children:e.description}),t===`global`?(0,Q.jsx)(`span`,{"data-slot":`settings-scope-chip`,className:`ml-auto text-[11px] text-soft-foreground`,children:`Global settings`}):null]}),(0,Q.jsxs)(`div`,{className:`flex flex-1 flex-col md:flex-row`,children:[(0,Q.jsx)(ey,{scope:t,activeId:e.id,capabilities:n}),(0,Q.jsx)(ty,{scope:t,activeId:e.id,capabilities:n}),(0,Q.jsx)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:(0,Q.jsx)(r,{})})]})]})}function ry({scope:e,capabilities:t}){let{Link:n}=$v(e),r=e===`global`;return(0,Q.jsxs)(`div`,{"data-route":r?`settings-global`:`settings`,className:`flex min-h-full flex-col`,children:[(0,Q.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,Q.jsx)(`h1`,{className:`text-base font-semibold`,children:r?`Global settings`:`Settings`}),(0,Q.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,Q.jsxs)(`div`,{className:`flex flex-1 flex-col md:flex-row`,children:[(0,Q.jsx)(ey,{scope:e,activeId:null,capabilities:t}),(0,Q.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:[(0,Q.jsx)(`ul`,{"data-slot":`settings-index`,className:`mx-auto flex w-full max-w-2xl flex-col gap-2.5`,children:Xv(e,t).map(t=>(0,Q.jsx)(`li`,{children:(0,Q.jsxs)(n,{to:Zv(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,Q.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-md border border-border bg-muted text-muted-foreground`,children:(0,Q.jsx)(t.icon,{"aria-hidden":`true`,className:`size-4`})}),(0,Q.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`span`,{className:`block text-sm font-medium text-foreground`,children:t.title}),(0,Q.jsx)(`span`,{className:`block text-xs text-soft-foreground`,children:t.description})]}),(0,Q.jsx)(Dn,{"aria-hidden":`true`,className:`size-4 shrink-0 text-soft-foreground`})]})},t.id))}),(0,Q.jsx)(`p`,{className:`mx-auto mt-4 w-full max-w-2xl text-[12px] text-soft-foreground`,children:r?(0,Q.jsx)(Q.Fragment,{children:`Agents, worktrees, bookmarklets and prompt templates are per project.`}):(0,Q.jsxs)(Q.Fragment,{children:[`Appearance, notifications, host resources and the project registry live in`,` `,(0,Q.jsx)(ct,{to:Qv(`global`),"data-slot":`settings-global-link`,className:`underline underline-offset-2 hover:text-foreground`,children:`Global settings`}),`.`]})})]})]})]})}function iy(e,t){let[n,r]=(0,Z.useState)(!1),[i,a]=(0,Z.useState)(``),o=(0,Z.useRef)(!1);return{editing:n,draft:i,setDraft:a,begin:()=>{a(e),o.current=!1,r(!0)},commit:()=>{if(o.current)return;o.current=!0,r(!1);let n=i.trim();n.length===0||n===e||t(n)},cancel:()=>{o.current=!0,r(!1)}}}function ay({editor:e,className:t}){return(0,Q.jsx)(`input`,{"data-slot":`title-input`,"aria-label":`Task title`,autoFocus:!0,value:e.draft,onChange:t=>e.setDraft(t.target.value),onBlur:e.commit,onKeyDown:t=>{t.key===`Enter`?(t.preventDefault(),e.commit()):t.key===`Escape`&&(t.preventDefault(),e.cancel())},className:Y(`w-full min-w-0 rounded-sm border border-border bg-card px-1.5 py-0.5 outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`,t)})}function oy({className:e,dot:t,pulse:n=!1,children:r,...i}){return(0,Q.jsxs)(`span`,{"data-slot":`pill`,className:Y(`inline-flex items-center gap-1.5 rounded-full bg-muted px-2.5 py-[3px] text-xs font-medium whitespace-nowrap text-muted-foreground`,e),...i,children:[t?(0,Q.jsx)(Wu,{tone:t,pulse:n}):null,r]})}function sy({runs:e,view:t,onViewChange:n,onArchiveFinished:r,onRename:i,now:a=Date.now()}){let[o,s]=Z.useState(``),c=e??[],l=Zf(c),u=Jf(om(c,o),t),d=qf(c),f=pm(om(c,o),t),p=sm(c);return(0,Q.jsxs)(`div`,{"data-route":`tasks`,className:`flex min-h-full flex-col`,children:[(0,Q.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,Q.jsx)(`h1`,{className:`text-base font-semibold`,children:`Tasks`}),(0,Q.jsxs)(`div`,{className:`inline-flex gap-0.5 rounded-md bg-muted p-[3px]`,children:[(0,Q.jsx)(ly,{view:`active`,current:t,onSelect:n,count:l.active,children:`Active`}),(0,Q.jsx)(ly,{view:`archived`,current:t,onSelect:n,count:l.archived,children:`Archived`})]}),(0,Q.jsx)(`div`,{className:`flex-1`}),t===`active`&&p>0?(0,Q.jsxs)(H,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`archive-finished`,onClick:r,children:[(0,Q.jsx)(vn,{className:`size-3.5`,"aria-hidden":`true`}),`Archive finished`]}):null,(0,Q.jsxs)(`div`,{className:`relative w-60`,children:[(0,Q.jsx)(nr,{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,Q.jsx)(`input`,{type:`text`,value:o,onChange:e=>s(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,Q.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:[e===void 0?null:u.length===0?(0,Q.jsx)(cy,{view:t,query:o}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{"data-slot":`tasks-table`,className:`hidden overflow-x-auto rounded-lg border border-border bg-card shadow-xs md:block`,children:(0,Q.jsxs)(`table`,{className:`w-full min-w-[1040px] border-collapse`,children:[(0,Q.jsx)(`thead`,{children:(0,Q.jsxs)(`tr`,{children:[(0,Q.jsx)(uy,{children:`Status`}),(0,Q.jsx)(uy,{children:`Task`}),(0,Q.jsx)(uy,{children:`Workflow`}),(0,Q.jsx)(uy,{children:`Branch`}),(0,Q.jsx)(uy,{children:`±`}),(0,Q.jsx)(uy,{children:`Ref`}),(0,Q.jsx)(uy,{right:!0,children:`Tokens`}),(0,Q.jsx)(uy,{right:!0,children:`Cost`}),(0,Q.jsx)(uy,{right:!0,children:`CPU`}),(0,Q.jsx)(uy,{right:!0,children:`Mem`}),(0,Q.jsx)(uy,{right:!0,children:`Started`})]})}),(0,Q.jsx)(`tbody`,{className:`[&>tr:last-child>td]:border-b-0`,children:u.map(e=>(0,Q.jsx)(fy,{run:e,queuePosition:e.status===`queued`?d.get(e.id)??null:null,onRename:i,now:a},e.id))})]})}),(0,Q.jsx)(`div`,{"data-slot":`task-cards`,className:`flex flex-col gap-2.5 md:hidden`,children:u.map(e=>(0,Q.jsx)(gy,{run:e,queuePosition:e.status===`queued`?d.get(e.id)??null:null,now:a},e.id))})]}),f.map(e=>(0,Q.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,Q.jsx)(tr,{className:`size-[15px] shrink-0 text-soft-foreground`,"aria-hidden":`true`}),(0,Q.jsxs)(`span`,{children:[(0,Q.jsx)(`strong`,{className:`font-semibold text-foreground`,children:e.title}),` — `,e.count,` variants finished`]}),(0,Q.jsx)(H,{asChild:!0,variant:`outline`,size:`sm`,className:`md:ml-auto`,children:(0,Q.jsx)(X,{to:`/compare/${e.groupId}`,children:`Compare`})})]},e.groupId))]}),(0,Q.jsx)(X,{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,Q.jsx)(er,{className:`size-[22px]`,"aria-hidden":`true`})})]})}function cy({view:e,query:t}){let n=t.trim(),r=n?`search-miss`:e===`archived`?`archive`:`no-tasks`;return(0,Q.jsx)(`div`,{"data-slot":`tasks-empty`,"data-empty-kind":r,className:`flex flex-1 flex-col`,children:r===`search-miss`?(0,Q.jsx)(W,{heading:`h2`,icon:(0,Q.jsx)(gt,{}),tone:`neutral`,title:`No matching tasks`,subtitle:`No tasks match “${n}”.`}):r===`archive`?(0,Q.jsx)(W,{heading:`h2`,icon:(0,Q.jsx)(vn,{}),tone:`neutral`,title:`Nothing archived yet`,subtitle:`Finished tasks you archive land here.`}):(0,Q.jsx)(W,{heading:`h2`,icon:(0,Q.jsx)(Un,{}),tone:`primary`,backdrop:!0,title:`No tasks yet`,subtitle:`Describe a task to get started.`,actions:(0,Q.jsx)(H,{asChild:!0,children:(0,Q.jsxs)(X,{to:`/new`,children:[(0,Q.jsx)(er,{"aria-hidden":`true`}),`New task`]})})})})}function ly({view:e,current:t,onSelect:n,count:r,children:i}){let a=e===t;return(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`overview-tab`,"data-view":e,"aria-pressed":a,onClick:()=>n(e),className:Y(`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,Q.jsx)(`span`,{className:`font-mono text-[11px] tabular-nums`,children:r}):null]})}function uy({children:e,right:t=!1}){return(0,Q.jsx)(`th`,{className:Y(`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`),children:e})}var dy=`h-11 border-b border-border px-2.5 whitespace-nowrap first:pl-4 last:pr-4`;function fy({run:e,queuePosition:t,onRename:n,now:r}){let i=At(),a=hf(e),o=`/tasks/${e.id}`,s=im(e.costUsd),c=um(e);return(0,Q.jsxs)(`tr`,{"data-slot":`task-table-row`,"data-run-id":e.id,onClick:e=>{e.target.closest(`a, button, input`)||i(o)},className:`group/row cursor-pointer hover:bg-muted`,children:[(0,Q.jsx)(`td`,{className:dy,children:(0,Q.jsx)(oy,{dot:a.tone,pulse:a.pulse,children:a.label})}),(0,Q.jsx)(`td`,{className:Y(dy,`w-[34%] max-w-0`),children:(0,Q.jsx)(py,{run:e,to:o,onRename:n})}),(0,Q.jsx)(`td`,{className:Y(dy,`text-[12.5px] text-muted-foreground`),children:am(e)}),(0,Q.jsx)(`td`,{className:dy,children:e.branch?(0,Q.jsx)(yy,{branch:e.branch}):(0,Q.jsx)(_y,{})}),(0,Q.jsx)(`td`,{className:dy,children:e.diffStat?(0,Q.jsx)(Qp,{stat:e.diffStat}):(0,Q.jsx)(_y,{})}),(0,Q.jsx)(`td`,{className:dy,children:c?(0,Q.jsx)($p,{reference:c,taskTitle:Gf(e)}):(0,Q.jsx)(_y,{})}),(0,Q.jsx)(`td`,{className:Y(dy,`text-right font-mono text-xs text-muted-foreground tabular-nums`),children:vf(e.tokensUsed)}),(0,Q.jsx)(`td`,{className:Y(dy,`text-right font-mono text-xs text-muted-foreground tabular-nums`),children:s||(0,Q.jsx)(_y,{})}),t===null?(0,Q.jsx)(my,{run:e}):(0,Q.jsxs)(`td`,{"data-slot":`queue-note`,colSpan:2,className:Y(dy,`text-right font-mono text-[11.5px] text-soft-foreground`),children:[`#`,t,` in queue`]}),(0,Q.jsx)(`td`,{className:Y(dy,`text-right text-xs text-soft-foreground tabular-nums`),children:_f(e.startedAt??e.createdAt,r)})]})}function py({run:e,to:t,onRename:n}){let r=Gf(e),i=iy(r,t=>n(e.id,t));return i.editing?(0,Q.jsx)(ay,{editor:i,className:`text-[13px] font-medium`}):(0,Q.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,Q.jsx)(X,{to:t,title:r,className:`min-w-0 truncate text-[13px] font-medium`,children:r}),(0,Q.jsx)(`button`,{type:`button`,"data-slot":`row-rename`,"aria-label":`Rename task`,onClick:i.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,Q.jsx)(Qn,{className:`size-3`,"aria-hidden":`true`})})]})}function my({run:e}){let t=fm(e,mn(e.id));return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(hy,{column:`cpu`,cell:t.cpu}),(0,Q.jsx)(hy,{column:`mem`,cell:t.mem})]})}function hy({column:e,cell:t}){return(0,Q.jsx)(`td`,{"data-usage":e,"data-usage-kind":t.kind,title:t.title,className:Y(dy,`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 gy({run:e,queuePosition:t,now:n}){let r=At(),i=hf(e),a=`/tasks/${e.id}`,o=um(e);return(0,Q.jsxs)(`div`,{"data-slot":`task-card`,"data-run-id":e.id,onClick:e=>{e.target.closest(`a`)||r(a)},className:`cursor-pointer rounded-lg border border-border bg-card px-3.5 py-3 shadow-xs`,children:[(0,Q.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[(0,Q.jsx)(oy,{dot:i.tone,pulse:i.pulse,className:`mt-px shrink-0`,children:i.label}),(0,Q.jsx)(X,{to:a,className:`min-w-0 flex-1 text-[13.5px] leading-[1.35] font-medium`,children:Gf(e)}),(0,Q.jsx)(`span`,{className:`mt-0.5 shrink-0 text-[11.5px] text-soft-foreground tabular-nums`,children:_f(e.finishedAt??e.createdAt,n)})]}),(0,Q.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,Q.jsx)(`span`,{children:am(e)}),t===null?(0,Q.jsxs)(Q.Fragment,{children:[e.branch?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(vy,{}),(0,Q.jsx)(`span`,{children:e.branch})]}):null,e.diffStat?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(vy,{}),(0,Q.jsx)(Qp,{stat:e.diffStat,className:`text-[11.5px]`})]}):null,e.tokensUsed>0?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(vy,{}),(0,Q.jsx)(`span`,{children:vf(e.tokensUsed)})]}):null]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(vy,{}),(0,Q.jsxs)(`span`,{"data-slot":`queue-note`,children:[`#`,t,` in queue`]})]}),o?(0,Q.jsx)($p,{reference:o,taskTitle:Gf(e),className:`h-5`}):null]})]})}function _y(){return(0,Q.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`—`})}function vy(){return(0,Q.jsx)(`span`,{className:`text-soft-foreground`,"aria-hidden":`true`,children:`·`})}function yy({branch:e}){return(0,Q.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 by(){let e=Ae(),[t,n]=Up(),r=v(),i=k({mutationFn:Ie,onSuccess:()=>r.invalidateQueries({queryKey:o.runs.all})}),a=k({mutationFn:({id:e,title:t})=>Ce(e,{title:t}),onSuccess:()=>r.invalidateQueries({queryKey:o.runs.all}),onError:e=>U(e.message,{tone:`danger`})}),s=mm(3e4);return(0,Q.jsx)(sy,{runs:e.data,view:t,onViewChange:n,onArchiveFinished:()=>i.mutate(),onRename:(e,t)=>a.mutate({id:e,title:t}),now:s})}var xy=(0,Z.lazy)(()=>q(()=>import(`./task-thread-CNKDBZ3f.js`).then(e=>({default:e.TaskThreadRoute})),__vite__mapDeps([6,5,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24]))),Sy=(0,Z.lazy)(()=>q(()=>import(`./compare-variants-SQ-ZYaDx.js`).then(e=>({default:e.CompareVariantsRoute})),__vite__mapDeps([25,5,7,8,9,10,20,22,17]))),Cy=(0,Z.lazy)(()=>q(()=>import(`./task-changes-DigJxA1i.js`).then(e=>({default:e.TaskChangesRoute})),__vite__mapDeps([26,5,7,8,9,10,11,12,13,14,15,16,17,18,27,28,29,19,30,21,31,32,24]))),wy=(0,Z.lazy)(()=>q(()=>import(`./task-files-C_TaL6Ym.js`).then(e=>({default:e.TaskFilesRoute})),__vite__mapDeps([33,5,7,8,9,10,11,12,13,14,15,16,17,18,28,34]))),Ty=(0,Z.lazy)(()=>q(()=>import(`./task-commits-DrMd0mHA.js`).then(e=>({default:e.TaskCommitsRoute})),__vite__mapDeps([35,5,7,8,9,10,11,12,13,14,15,16,17,18,36,29,20,34,31,32,24,37,23]))),Ey=(0,Z.lazy)(()=>q(()=>import(`./repo-git-CYfdegZH.js`).then(e=>({default:e.RepoGitRoute})),__vite__mapDeps([38,5,7,8,9,10,36,16,17,27,15,28,29,19,18,30,20,34,31,32,24,37,23]))),Dy=(0,Z.lazy)(()=>q(()=>import(`./github-B8BsP33C.js`).then(e=>({default:e.GithubRoute})),__vite__mapDeps([39,5,7,8,9,10,36,12,13,16,17,19,40,34,21,31,32,24]))),Oy=(0,Z.lazy)(()=>q(()=>import(`./github-B8BsP33C.js`).then(e=>({default:e.GithubIndexRoute})),__vite__mapDeps([39,5,7,8,9,10,36,12,13,16,17,19,40,34,21,31,32,24]))),ky=(0,Z.lazy)(()=>q(()=>import(`./workflows-CxEa4Qpj.js`).then(e=>({default:e.WorkflowsRoute})),__vite__mapDeps([41,5,7,8,9,10,14,42,18,34,30,21]))),Ay=(0,Z.lazy)(()=>q(()=>import(`./skills-C0pJsokM.js`).then(e=>({default:e.SkillsRoute})),__vite__mapDeps([43,5,7,8,9,10,36,12,42,40,34,17])));function jy(){let e=M();return(0,Q.jsx)(It,{to:{pathname:`/skills`,search:e.search,hash:e.hash},replace:!0})}function My({sectionId:e}){let t=M();return(0,Q.jsx)(u,{to:{pathname:Zv(`global`,e),search:t.search,hash:t.hash},replace:!0})}function Ny(){return(0,Q.jsx)(`div`,{"data-route":`scope-resolving`,className:`flex min-h-full flex-col`,children:(0,Q.jsx)(`p`,{className:`px-4 py-6 text-center text-xs text-soft-foreground`,children:`Loading…`})})}function Py(){let{projectId:e=``}=s(),t=M(),n=ce(),r=z();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,Q.jsx)(u,{to:`/p/${encodeURIComponent(e)}${n||`/`}${t.search}${t.hash}`,replace:!0})}if(!n.isError)return(0,Q.jsx)(Ny,{})}if(n.data){if(!(n.data.bootProject===e||n.data.projects.some(t=>t.id===e)))return(0,Q.jsx)(m_,{projectId:e,registry:n.data})}else if(!n.isError)return(0,Q.jsx)(Ny,{});return(0,Q.jsx)(Rt,{projectId:n.data?.bootProject===e?null:e,children:(0,Q.jsx)(ot,{},e)})}function Fy(){let{projectId:e=``}=s();return(0,Q.jsx)(e_,{},e)}function Iy(){let e=M(),t=z();if(t.data===void 0)return(0,Q.jsx)(Ny,{});let n=t.data.bootProject??`default`,r=e.pathname===`/p`||e.pathname===`/p/`?`/`:e.pathname;return(0,Q.jsx)(u,{to:`/p/${encodeURIComponent(n)}${r}${e.search}${e.hash}`,replace:!0})}var Ly=[{pattern:`/`,pageLabel:`Tasks`},{pattern:`/new`,pageLabel:`New task`},{pattern:`/compare/:groupId`,pageLabel:`Compare`},{pattern:`/git/*`,pageLabel:`Git`},{pattern:`/github/*`,pageLabel:`GitHub`},{pattern:`/skills`,pageLabel:`Skills`},{pattern:`/inbox`,pageLabel:`Inbox`},{pattern:`/workflows/*`,pageLabel:`Workflows`},{pattern:`/settings/*`,pageLabel:`Settings`}];function Ry(e){let t=Ft(e),n=p({path:`/tasks/:id/*`,end:!0},t);return n?{pageLabel:null,taskId:n.params.id??null}:{pageLabel:Ly.find(({pattern:e})=>p({path:e,end:!0},t))?.pageLabel??null,taskId:null}}function zy(){let e=z().data?.capabilities;return(0,Q.jsxs)(g,{children:[(0,Q.jsxs)(L,{path:`/p/:projectId`,element:(0,Q.jsx)(Py,{}),children:[(0,Q.jsx)(L,{index:!0,element:(0,Q.jsx)(by,{})}),(0,Q.jsx)(L,{path:`new`,element:(0,Q.jsx)(Fy,{})}),(0,Q.jsx)(L,{path:`tasks/:id`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(v_,{}),children:(0,Q.jsx)(xy,{})})}),(0,Q.jsx)(L,{path:`tasks/:id/changes`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(g_,{tab:`changes`}),children:(0,Q.jsx)(Cy,{})})}),(0,Q.jsx)(L,{path:`tasks/:id/files`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(g_,{tab:`files`}),children:(0,Q.jsx)(wy,{})})}),(0,Q.jsx)(L,{path:`tasks/:id/commits`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(g_,{tab:`changes`}),children:(0,Q.jsx)(Ty,{})})}),(0,Q.jsx)(L,{path:`tasks/:id/commits/:sha`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(g_,{tab:`changes`}),children:(0,Q.jsx)(Ty,{})})}),(0,Q.jsx)(L,{path:`compare/:groupId`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(Im,{}),children:(0,Q.jsx)(Sy,{})})}),(0,Q.jsx)(L,{path:`git`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(f_,{}),children:(0,Q.jsx)(Ey,{tab:`changes`})})}),(0,Q.jsx)(L,{path:`git/commits`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(f_,{}),children:(0,Q.jsx)(Ey,{tab:`commits`})})}),(0,Q.jsx)(L,{path:`git/commits/:sha`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(f_,{}),children:(0,Q.jsx)(Ey,{tab:`commits`})})}),(0,Q.jsx)(L,{path:`git/branches`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(f_,{}),children:(0,Q.jsx)(Ey,{tab:`branches`})})}),(0,Q.jsx)(L,{path:`github`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(Lm,{}),children:(0,Q.jsx)(Oy,{})})}),(0,Q.jsx)(L,{path:`github/prs`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(Lm,{}),children:(0,Q.jsx)(Dy,{view:`prs`})})}),(0,Q.jsx)(L,{path:`github/issues/:n`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(Lm,{}),children:(0,Q.jsx)(Dy,{view:`issues`})})}),(0,Q.jsx)(L,{path:`github/prs/:n`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(Lm,{}),children:(0,Q.jsx)(Dy,{view:`prs`})})}),(0,Q.jsx)(L,{path:`github/prs/:n/changes`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(Lm,{}),children:(0,Q.jsx)(Dy,{view:`prs`,changes:!0})})}),(0,Q.jsx)(L,{path:`skills`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(p_,{}),children:(0,Q.jsx)(Ay,{})})}),(0,Q.jsx)(L,{path:`inbox`,element:(0,Q.jsx)(Nh,{})}),(0,Q.jsx)(L,{path:`workflows`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(h_,{}),children:(0,Q.jsx)(ky,{})})}),(0,Q.jsx)(L,{path:`workflows/:name`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(h_,{}),children:(0,Q.jsx)(ky,{})})}),(0,Q.jsx)(L,{path:`settings`,element:(0,Q.jsx)(ry,{scope:`project`,capabilities:e})}),(0,Q.jsx)(L,{path:`settings/skills`,element:(0,Q.jsx)(jy,{})}),Xv(`project`,e).map(t=>(0,Q.jsx)(L,{path:`settings/${t.id}`,element:(0,Q.jsx)(ny,{section:t,scope:`project`,capabilities:e})},t.id)),Xv(`global`,e).map(e=>(0,Q.jsx)(L,{path:`settings/${e.id}`,element:(0,Q.jsx)(My,{sectionId:e.id})},e.id)),(0,Q.jsx)(L,{path:`*`,element:(0,Q.jsx)(d_,{})})]}),(0,Q.jsx)(L,{path:`/settings/global`,element:(0,Q.jsx)(ry,{scope:`global`,capabilities:e})}),Xv(`global`,e).map(t=>(0,Q.jsx)(L,{path:Zv(`global`,t.id),element:(0,Q.jsx)(ny,{section:t,scope:`global`,capabilities:e})},t.id)),(0,Q.jsx)(L,{path:`*`,element:(0,Q.jsx)(Iy,{})})]})}function By(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 Vy(e){return e?.available===!0&&(e.status===`available`||e.status===`error`)}function Hy({children:e}){let{pathname:t}=M(),n=Lt(),r=z(),i=r.data?.capabilities.followups===!0,a=dt(i),o=Vy(it(n??``,n!==null).data),s=ce().data,c=Ry(t),l=s?.bootProject??r.data?.bootProject??null,u=n!==null&&n===l,d=s?.projects.find(e=>e.id===n),f=ue(n??``,d!==void 0&&c.taskId!==null,s?.bootProject===n).data,p=t===`/settings/global`||t.startsWith(`/settings/global/`)?null:d?.name??(u?By(r.data)?.name??null:null),m=c.taskId?f?.find(e=>e.id===c.taskId):void 0;Fm({projectName:p,pageLabel:m?Gf(m):c.pageLabel});let h=s&&s.projects.length>1?s:null;return(0,Q.jsxs)(Hp,{children:[(0,Q.jsx)(jp,{repo:By(r.data),version:r.data?.version??null,latestVersion:r.data?.latestVersion??null,inboxCount:a.data?.length??null,skillsUpdateAvailable:o,forgeAvailable:r.data?.forge?.available===!0,inboxAvailable:i,banner:(0,Q.jsx)(Zp,{}),singleProject:r.data?.capabilities.singleProject===!0,taskQuickList:(0,Q.jsx)(xm,{}),projectGroups:h?(0,Q.jsx)(Em,{projects:h.projects,bootProjectId:h.bootProject,inboxAvailable:i,inboxCount:a.data?.length??null,skillsUpdateAvailable:o}):void 0,toolsMenu:(0,Q.jsx)(Am,{health:r.data}),children:e}),(0,Q.jsx)(cp,{})]})}function Uy(){let e=v(),t=mv(st().data?.notifications).enabled,n=(0,Z.useRef)(t);n.current=t;let r=(0,Z.useRef)(new Map);return(0,Z.useEffect)(()=>{let t=B(o.runs.list()),i=e=>{let{entering:t,statuses:i}=gv(r.current,e);if(r.current=i,t.length!==0&&_v({enabled:n.current,hidden:document.visibilityState===`hidden`,permission:hv()}))for(let e of t)Wy(e)};return i(e.getQueryData(o.runs.list())),e.getQueryCache().subscribe(e=>{e.query.queryHash!==t||e.type!==`updated`||i(e.query.state.data)})},[e]),null}function Wy(e){let t=globalThis.Notification;if(typeof t!=`function`)return;let n=vv(e);try{new t(n.title,{body:n.body,tag:n.tag})}catch{}}function Gy(){let[e]=(0,Z.useState)(_n);return(0,Q.jsx)(ee,{client:e,children:(0,Q.jsxs)(pn,{children:[(0,Q.jsx)(Uy,{}),(0,Q.jsx)(td,{children:(0,Q.jsx)(tv,{children:(0,Q.jsxs)(_e,{children:[(0,Q.jsx)(Hy,{children:(0,Q.jsx)(zy,{})}),(0,Q.jsx)(Ye,{})]})})})]})})}var Ky=document.getElementById(`root`);if(!Ky)throw Error(`cezar: #root container is missing from index.html`);(0,Gt.createRoot)(Ky).render((0,Q.jsx)(Z.StrictMode,{children:(0,Q.jsx)(Gy,{})}));export{lm as $,Qn as $t,Ch as A,hf as At,$m as B,wu as Bt,dg as C,Cf as Ct,Ih as D,Of as Dt,Fh as E,Nf as Et,fh as F,uf as Ft,Km as G,ju as Gt,Zm as H,Mu as Ht,uh as I,of as It,Lm as J,ir as Jt,Gm as K,cr as Kt,rh as L,Wu as Lt,hh as M,sf as Mt,dh as N,cf as Nt,Eh as O,vf as Ot,ph as P,af as Pt,dm as Q,$n as Qt,nh as R,Lu as Rt,fg as S,wf as St,qh as T,zf as Tt,Um as U,Au as Ut,eh as V,Ou as Vt,Hm as W,ku as Wt,tm as X,tr as Xt,Im as Y,nr as Yt,im as Z,er as Zt,Jg as _,Gf as _t,v_ as a,Dn as an,Cp as at,yg as b,bf as bt,h_ as c,yn as cn,Tp as ct,Xg as d,pp as dt,Bn as en,cm as et,Zg as f,gp as ft,Kg as g,qf as gt,qg as h,Kf as ht,fv as i,On as in,vp as it,Dh as j,nf as jt,kh as k,_f as kt,f_ as l,vn as ln,up as lt,Yg as m,dp as mt,ay as n,In as nn,$p as nt,__ as o,En as on,Ep as ot,Gg as p,_p as pt,Xm as q,sr as qt,iy as r,jn as rn,Qp as rt,g_ as s,Tn as sn,wp as st,oy as t,zn as tn,am as tt,Hg as u,fp as ut,bg as v,Ef as vt,rg as w,Rf as wt,vg as x,xf as xt,xg as y,Bf as yt,th as z,Pu as zt};
|