@open-mercato/cezar 0.9.1-pr694.813 → 0.9.1-pr694.821

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/dist/core/codex-ui-mapper.js +27 -0
  2. package/dist/core/codex-ui-mapper.js.map +1 -1
  3. package/dist/server/forge/github.d.ts +1 -0
  4. package/dist/server/forge/github.js +12 -2
  5. package/dist/server/forge/github.js.map +1 -1
  6. package/dist/server/forge/types.d.ts +2 -0
  7. package/dist/server/project-context.d.ts +4 -0
  8. package/dist/server/project-context.js +2 -1
  9. package/dist/server/project-context.js.map +1 -1
  10. package/dist/server/server.d.ts +5 -0
  11. package/dist/server/server.js +31 -9
  12. package/dist/server/server.js.map +1 -1
  13. package/package.json +1 -1
  14. package/web/dist/assets/arrow-left-BWue3Imk.js +1 -0
  15. package/web/dist/assets/bundle-mjs-BT31bpU6.js +1 -0
  16. package/web/dist/assets/{centered-state-D-hkkRHv.js → centered-state-DsblJe6Q.js} +2 -2
  17. package/web/dist/assets/{chunk-BO2N2NFS-DtrdTCWa.js → chunk-BO2N2NFS-DE6qKn3r.js} +8 -8
  18. package/web/dist/assets/circle-check-TKq6_8_Y.js +1 -0
  19. package/web/dist/assets/circle-x-bH39f-Yh.js +1 -0
  20. package/web/dist/assets/commit-list-CAwllMBX.js +1 -0
  21. package/web/dist/assets/compare-variants-JnaeMTz5.js +1 -0
  22. package/web/dist/assets/{core-DePtBHcl.js → core-BCsw8oQw.js} +1 -1
  23. package/web/dist/assets/diff-Drvekr61.js +3 -0
  24. package/web/dist/assets/{diff-view-BBgUutQ0.js → diff-view-Ct3kYFRM.js} +2 -2
  25. package/web/dist/assets/dist-CngV8tyE.js +1 -0
  26. package/web/dist/assets/{ellipsis-vertical-DFAnsUi4.js → ellipsis-vertical-WowqAN6-.js} +1 -1
  27. package/web/dist/assets/{file-vT36R94R.js → file-BWgi5VOt.js} +1 -1
  28. package/web/dist/assets/{git-pull-request-BvjQwr12.js → git-pull-request-D8yt-2Tr.js} +1 -1
  29. package/web/dist/assets/git-toolbar-BLqu97v8.js +1 -0
  30. package/web/dist/assets/github-hrWK-ST8.js +1 -0
  31. package/web/dist/assets/highlighted-body-OFNGDK62-BL-MfFgl.js +1 -0
  32. package/web/dist/assets/image-preview-B3W7bWIq.js +1 -0
  33. package/web/dist/assets/index-B96YnNHc.js +22 -0
  34. package/web/dist/assets/index-DdBHg6_F.css +2 -0
  35. package/web/dist/assets/lib-BQXq3kEf.js +1 -0
  36. package/web/dist/assets/lib-BxQXEXDF.js +1 -0
  37. package/web/dist/assets/mermaid-GHXKKRXX-C4jxqUUb.js +1 -0
  38. package/web/dist/assets/project-router-CnKsyZKI.js +1 -0
  39. package/web/dist/assets/react-runtime-CCIEwYL0.js +9 -0
  40. package/web/dist/assets/{refresh-cw-BgVxWSof.js → refresh-cw-CFp_jUZr.js} +1 -1
  41. package/web/dist/assets/repo-git-DnkvanyM.js +1 -0
  42. package/web/dist/assets/rolldown-runtime-QTnfLwEv.js +1 -0
  43. package/web/dist/assets/{run-diff-DeWQ1xve.js → run-diff-LyXkHJCR.js} +1 -1
  44. package/web/dist/assets/run-header-BtH23tbQ.js +1 -0
  45. package/web/dist/assets/{search-x-CbHLclyX.js → search-x-CaddQd7u.js} +1 -1
  46. package/web/dist/assets/skill-empty-hint-D5QzmqHj.js +1 -0
  47. package/web/dist/assets/skills-CE0HAI_G.js +1 -0
  48. package/web/dist/assets/{square-terminal-DRmz43dF.js → square-terminal-CoE5Kj-S.js} +1 -1
  49. package/web/dist/assets/tab-link-BbQLZUG5.js +1 -0
  50. package/web/dist/assets/task-changes-BYNpnV0E.js +1 -0
  51. package/web/dist/assets/task-commits-DRnMTXtG.js +1 -0
  52. package/web/dist/assets/task-files-DAqPuHp1.js +2 -0
  53. package/web/dist/assets/{task-thread-x1axqNnn.js → task-thread-DMM5s2zt.js} +2 -2
  54. package/web/dist/assets/textarea-Dd8d_Pwi.js +1 -0
  55. package/web/dist/assets/{trash-2-ObVP5T4c.js → trash-2-aYhsIRM2.js} +1 -1
  56. package/web/dist/assets/{triangle-alert-CHtGkjPK.js → triangle-alert-BMsU3ymT.js} +1 -1
  57. package/web/dist/assets/{upload-Dx__Y6Lu.js → upload-DH2pWIfO.js} +1 -1
  58. package/web/dist/assets/use-desktop-BAHxMKrE.js +1 -0
  59. package/web/dist/assets/utils-D27OaPrA.js +1 -0
  60. package/web/dist/assets/{workflows-C3gTBtmF.js → workflows-DCkK4Bsn.js} +2 -2
  61. package/web/dist/assets/zoomable-image-BBB-AoPi.js +1 -0
  62. package/web/dist/index.html +14 -12
  63. package/web/dist/assets/arrow-left-BmHnLe4M.js +0 -1
  64. package/web/dist/assets/bundle-mjs-BegPhL5c.js +0 -1
  65. package/web/dist/assets/circle-check-CH4jMJue.js +0 -1
  66. package/web/dist/assets/commit-list-BXNfseD5.js +0 -1
  67. package/web/dist/assets/compare-variants-CkvpSWZa.js +0 -1
  68. package/web/dist/assets/diff-CITBzanN.js +0 -3
  69. package/web/dist/assets/dist-C553orO_.js +0 -1
  70. package/web/dist/assets/git-toolbar-ChCEnVjR.js +0 -1
  71. package/web/dist/assets/github-B8nK4e73.js +0 -1
  72. package/web/dist/assets/highlighted-body-OFNGDK62-BuFJwunK.js +0 -1
  73. package/web/dist/assets/image-preview-B6kVovYD.js +0 -1
  74. package/web/dist/assets/index-BWzcnzgp.js +0 -30
  75. package/web/dist/assets/index-pJfUoRGK.css +0 -2
  76. package/web/dist/assets/lib-DPEZDBUN.js +0 -1
  77. package/web/dist/assets/lib-uHpeUPzK.js +0 -1
  78. package/web/dist/assets/mermaid-GHXKKRXX-CN2zQue0.js +0 -1
  79. package/web/dist/assets/project-router-C-gp_QmI.js +0 -1
  80. package/web/dist/assets/repo-git-DW8ekpNQ.js +0 -1
  81. package/web/dist/assets/run-header-BaLnTHQf.js +0 -1
  82. package/web/dist/assets/skill-empty-hint-CzXygdIH.js +0 -1
  83. package/web/dist/assets/skills-Bt9YVDdo.js +0 -1
  84. package/web/dist/assets/tab-link-C2tgsylt.js +0 -1
  85. package/web/dist/assets/task-changes-CluQWIkd.js +0 -1
  86. package/web/dist/assets/task-commits-BJRUd8fY.js +0 -1
  87. package/web/dist/assets/task-files-CpWfXD2B.js +0 -2
  88. package/web/dist/assets/textarea-BhdkPlu6.js +0 -1
  89. package/web/dist/assets/use-desktop-BB0Ck5sN.js +0 -1
  90. package/web/dist/assets/utils-B8xGEgP3.js +0 -1
  91. package/web/dist/assets/zoomable-image-Bb6ydBLq.js +0 -1
@@ -0,0 +1,22 @@
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-DMM5s2zt.js","assets/react-runtime-CCIEwYL0.js","assets/centered-state-DsblJe6Q.js","assets/bundle-mjs-BT31bpU6.js","assets/utils-D27OaPrA.js","assets/run-header-BtH23tbQ.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-BbQLZUG5.js","assets/project-router-CnKsyZKI.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-LyXkHJCR.js","assets/lib-BQXq3kEf.js","assets/zoomable-image-BBB-AoPi.js","assets/compare-variants-JnaeMTz5.js","assets/task-changes-BYNpnV0E.js","assets/git-toolbar-BLqu97v8.js","assets/file-BWgi5VOt.js","assets/use-desktop-BAHxMKrE.js","assets/upload-DH2pWIfO.js","assets/diff-Drvekr61.js","assets/image-preview-B3W7bWIq.js","assets/task-files-DAqPuHp1.js","assets/triangle-alert-BMsU3ymT.js","assets/task-commits-DRnMTXtG.js","assets/arrow-left-BWue3Imk.js","assets/commit-list-CAwllMBX.js","assets/repo-git-DnkvanyM.js","assets/github-hrWK-ST8.js","assets/refresh-cw-CFp_jUZr.js","assets/workflows-DCkK4Bsn.js","assets/skill-empty-hint-D5QzmqHj.js","assets/skills-CE0HAI_G.js"])))=>i.map(i=>d[i]);
2
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,n,r,t as i}from"./react-runtime-CCIEwYL0.js";import{$ as a,$n as o,A as s,An as c,Bn as l,Bt as u,C as d,Cn as f,Ct as p,D as m,Dn as h,E as g,En as _,Et as v,Fn as y,G as b,Gn as x,Gt as S,H as C,Hn as w,I as T,In as E,It as D,J as O,Jn as k,Kn as A,Kt as j,Ln as M,M as ee,Mn as N,N as P,Nn as F,O as I,On as te,Ot as ne,P as re,Pn as L,Pt as ie,Q as R,Qn as ae,Rn as z,Rt as oe,S as se,Sn as ce,St as le,T as ue,Tn as de,Tt as B,U as fe,Un as pe,Vn as V,Wn as me,Wt as he,X as ge,Xn as _e,Y as ve,Yn as ye,Z as be,Zn as xe,Zt as Se,_ as Ce,_n as we,_t as Te,a as H,at as Ee,b as De,bn as Oe,bt as ke,c as Ae,cn as je,d as Me,dn as Ne,er as Pe,et as Fe,f as Ie,fn as Le,g as Re,gt as ze,h as Be,hn as Ve,i as U,in as He,j as Ue,jn as W,jt as We,k as Ge,kn as Ke,l as qe,ln as Je,m as Ye,mn as Xe,mt as Ze,n as Qe,nr as $e,nt as et,o as tt,on as nt,pt as rt,qn as it,r as at,s as ot,t as G,tr as st,u as ct,un as lt,v as ut,vn as dt,vt as ft,w as pt,wn as mt,wt as ht,x as K,xn as gt,xt as _t,y as q,yn as vt,yt}from"./centered-state-DsblJe6Q.js";import{i as J}from"./bundle-mjs-BT31bpU6.js";import{i as bt,n as xt,r as Y,t as X}from"./utils-D27OaPrA.js";import{t as St}from"./search-x-CaddQd7u.js";import{t as Ct}from"./triangle-alert-BMsU3ymT.js";import{n as wt,t as Tt}from"./textarea-Dd8d_Pwi.js";import{a as Et,c as Dt,i as Ot,l as kt,n as At,o as jt,r as Mt,s as Nt,t as Pt}from"./dist-CngV8tyE.js";import{a as Ft,c as It,d as Lt,i as Rt,l as zt,n as Bt,o as Vt,r as Ht,s as Ut,t as Z,u as Wt}from"./project-router-CnKsyZKI.js";import{i as Gt,n as Kt}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 qt=class extends $e{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 w({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=Jt(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=Jt(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=Jt(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=Jt(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){x.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=>ye(t,e))}findAll(e={}){return this.getAll().filter(t=>ye(e,t))}notify(e){x.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return x.batch(()=>Promise.all(e.map(e=>e.continue().catch(xe))))}};function Jt(e){return e.options.scope?.id}var Yt=class extends $e{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??k(r,t),a=this.get(i);return a||(a=new pe({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(){x.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=>_e(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>_e(e,t)):t}notify(e){x.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){x.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){x.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Xt=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new Yt,this.#t=e.mutationCache||new qt,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=st.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=me.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(o(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=A(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return x.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;x.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return x.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=x.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(xe).catch(xe)}invalidateQueries(e,t={}){return x.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=x.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(xe)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(xe)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(o(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(xe).catch(xe)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(xe).catch(xe)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return me.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(it(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{ae(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(it(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{ae(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||=k(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===Pe&&(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()}},Q=e(t(),1),Zt=n();function Qt(e,t){if(e===`ping`)return{project:null,event:{type:`ping`}};let n;try{n=JSON.parse(t)}catch{return null}if(!$t(n))return null;let r=n.project;if(typeof r!=`string`||r===``)return null;switch(e){case`run`:{let{project:e,...t}=n;return en(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 $t(n.usage)?{project:r,event:{type:`usage`,usage:n.usage}}:null;default:return null}}function $t(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function en(e){return $t(e)&&typeof e.id==`string`&&e.id!==``}function tn(e,t){if(!e)return;let n=e.findIndex(e=>e.id===t.id);if(n>=0){let r=[...e];return r[n]=rn(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 nn(e,t){if(!e)return;let n=e.filter(e=>e.id!==t);return n.length===e.length?e:n}function rn(e,t){return e?.usage?{...t,usage:e.usage}:t}var an=Object.freeze({});function on(){let e=an,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 $=i(),sn=`/api/workspace/events`,cn=2,ln=3e3,un=[`run`,`run-deleted`,`todos`,`usage`,`ping`],dn=[`project-added`,`project-removed`,`checkout-progress`,`automation-change`],fn=new Set;function pn(e){return fn.add(e),()=>{fn.delete(e)}}function mn(e){e.invalidateQueries({queryKey:s.runs.all}),e.invalidateQueries({queryKey:s.todos}),e.invalidateQueries({queryKey:s.health}),e.invalidateQueries({queryKey:s.worktrees}),e.invalidateQueries({queryKey:B.providerStatus})}function hn(e){return bt()??e.getQueryData(s.health)?.bootProject}function gn(e,t,n){switch(n.type){case`run`:{e.setQueryData(s.runs.list(),e=>tn(e,n.run));let t=s.runs.detail(n.run.id);e.getQueryData(t)!==void 0&&e.setQueryData(t,e=>rn(e,n.run));let r=s.runs.changes(n.run.id);e.getQueryData(r)!==void 0&&e.invalidateQueries({queryKey:r}),e.invalidateQueries({queryKey:s.worktrees});return}case`run-deleted`:e.setQueryData(s.runs.list(),e=>nn(e,n.id)),e.removeQueries({queryKey:s.runs.detail(n.id)}),e.removeQueries({queryKey:s.runs.diff(n.id)}),e.invalidateQueries({queryKey:s.worktrees});return;case`todos`:e.setQueryData(s.todos,n.items);return;case`usage`:t.set(n.usage);return;case`ping`:return}}function _n(e,t=sn){let n=V();(0,Q.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=B.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()},ln))},f=()=>{i?.close(),i=new r(t,{withCredentials:!0}),i.addEventListener(`open`,()=>{o&&mn(n),o=!0});for(let t of un)i.addEventListener(t,r=>{let i=Qt(t,r.data);i&&(i.project!==null&&i.project!==hn(n)||gn(n,e,i.event))});for(let e of dn)i.addEventListener(e,t=>{let r;try{r=JSON.parse(t.data)}catch{return}e!==`checkout-progress`&&e!==`automation-change`&&n.invalidateQueries({queryKey:B.projects});for(let t of[...fn])t(e,r)});i.addEventListener(`provider-status`,e=>{let t;try{t=JSON.parse(e.data)}catch{return}let r=ce(t);if(!r)return;let i=B.providerStatus,a=gt(n.getQueryData(i),r);if(a!==void 0){n.setQueryData(i,a);return}if(c){l=!0;return}u()}),i.addEventListener(`error`,()=>{i?.readyState===cn&&d()})},p=()=>{document.visibilityState===`visible`&&(mn(n),(!i||i.readyState===cn)&&(clearTimeout(a),a=void 0,f()))},m=()=>{clearTimeout(a),a=void 0,i?.close()},h=e=>{e.persisted&&(mn(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 vn=(0,Q.createContext)(null);function yn({children:e}){let[t]=(0,Q.useState)(on);return _n(t),fe(),(0,$.jsx)(vn.Provider,{value:t,children:e})}function bn(e){let t=(0,Q.useContext)(vn),n=t?t.get:Sn;return(0,Q.useSyncExternalStore)(t?t.subscribe:xn,()=>e?n()[e]:void 0,()=>void 0)}var xn=()=>()=>void 0,Sn=()=>an;function Cn(){return new Xt({defaultOptions:{queries:{refetchInterval:!1,staleTime:5*6e4,gcTime:30*6e4,refetchOnWindowFocus:!1,refetchOnReconnect:!1,retry:(e,t)=>t instanceof v&&t.status>=400&&t.status<500?!1:e<1},mutations:{retry:!1}}})}var wn=Y(`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`}]]),Tn=Y(`arrow-down`,[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]),En=Y(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),Dn=Y(`arrow-up-right`,[[`path`,{d:`M7 7h10v10`,key:`1tivn9`}],[`path`,{d:`M7 17 17 7`,key:`1vkiza`}]]),On=Y(`arrow-up`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]),kn=Y(`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`}]]),An=Y(`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`}]]),jn=Y(`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`}]]),Mn=Y(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),Nn=Y(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),Pn=Y(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),Fn=Y(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]),In=Y(`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`}]]),Ln=Y(`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`}]]),Rn=Y(`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`}]]),zn=Y(`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`}]]),Bn=Y(`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`}]]),Vn=Y(`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`}]]),Hn=Y(`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`}]]),Un=Y(`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`}]]),Wn=Y(`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`}]]),Gn=Y(`gauge`,[[`path`,{d:`m12 14 4-4`,key:`9kzdfg`}],[`path`,{d:`M3.34 19a10 10 0 1 1 17.32 0`,key:`19p75a`}]]),Kn=Y(`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`}]]),qn=Y(`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`}]]),Jn=Y(`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`}]]),Yn=Y(`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`}]]),Xn=Y(`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`}]]),Zn=Y(`menu`,[[`path`,{d:`M4 5h16`,key:`1tepv9`}],[`path`,{d:`M4 12h16`,key:`1lakjw`}],[`path`,{d:`M4 19h16`,key:`1djgab`}]]),Qn=Y(`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`}]]),$n=Y(`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`}]]),er=Y(`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`}]]),tr=Y(`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`}]]),nr=Y(`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`}]]),rr=Y(`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`}]]),ir=Y(`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`}]]),ar=Y(`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`}]]),or=Y(`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`}]]),sr=Y(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),cr=Y(`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`}]]),lr=Y(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),ur=Y(`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`}]]),dr=Y(`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`}]]),fr=Y(`square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),pr=Y(`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`}]]),mr=Y(`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`}]]),hr=Y(`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 gr(e){let t=e+`CollectionProvider`,[n,r]=De(t),[i,a]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=e=>{let{scope:t,children:n}=e,r=Q.useRef(null),a=Q.useRef(new Map).current;return(0,$.jsx)(i,{scope:t,itemMap:a,collectionRef:r,children:n})};o.displayName=t;let s=e+`CollectionSlot`,c=pt(s),l=Q.forwardRef((e,t)=>{let{scope:n,children:r}=e,i=g(t,a(s,n).collectionRef);return(0,$.jsx)(c,{ref:i,children:r})});l.displayName=s;let u=e+`CollectionItemSlot`,d=`data-radix-collection-item`,f=pt(u),p=Q.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=Q.useRef(null),s=g(t,o),c=a(u,n);return Q.useEffect(()=>(c.itemMap.set(o,{ref:o,...i}),()=>void c.itemMap.delete(o))),(0,$.jsx)(f,{[d]:``,ref:s,children:r})});p.displayName=u;function m(t){let n=a(e+`CollectionConsumer`,t);return Q.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 _r=Q.createContext(void 0);function vr(e){let t=Q.useContext(_r);return e||t||`ltr`}var yr=`AlertDialog`,[br,xr]=De(yr,[kt]),Sr=kt(),Cr=e=>{let{__scopeAlertDialog:t,...n}=e,r=Sr(t);return(0,$.jsx)(Pt,{...r,...n,modal:!0})};Cr.displayName=yr;var wr=`AlertDialogTrigger`,Tr=Q.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=Sr(n);return(0,$.jsx)(Dt,{...i,...r,ref:t})});Tr.displayName=wr;var Er=`AlertDialogPortal`,Dr=e=>{let{__scopeAlertDialog:t,...n}=e,r=Sr(t);return(0,$.jsx)(jt,{...r,...n})};Dr.displayName=Er;var Or=`AlertDialogOverlay`,kr=Q.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=Sr(n);return(0,$.jsx)(Et,{...i,...r,ref:t})});kr.displayName=Or;var Ar=`AlertDialogContent`,[jr,Mr]=br(Ar),Nr=Q.forwardRef((e,t)=>{let{__scopeAlertDialog:n,children:r,...i}=e,a=Sr(n),o=g(t,Q.useRef(null)),s=Q.useRef(null);return(0,$.jsx)(jr,{scope:n,cancelRef:s,children:(0,$.jsx)(Mt,{role:`alertdialog`,...a,...i,ref:o,onOpenAutoFocus:q(i.onOpenAutoFocus,e=>{e.preventDefault(),s.current?.focus({preventScroll:!0})}),onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:r})})});Nr.displayName=Ar;var Pr=`AlertDialogTitle`,Fr=Q.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=Sr(n);return(0,$.jsx)(Nt,{...i,...r,ref:t})});Fr.displayName=Pr;var Ir=`AlertDialogDescription`,Lr=Q.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=Sr(n);return(0,$.jsx)(Ot,{...i,...r,ref:t})});Lr.displayName=Ir;var Rr=`AlertDialogAction`,zr=Q.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=Sr(n);return(0,$.jsx)(At,{...i,...r,ref:t})});zr.displayName=Rr;var Br=`AlertDialogCancel`,Vr=Q.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,{cancelRef:i}=Mr(Br,n),a=Sr(n),o=g(t,i);return(0,$.jsx)(At,{...a,...r,ref:o})});Vr.displayName=Br;var Hr=Cr,Ur=Dr,Wr=kr,Gr=Nr,Kr=zr,qr=Vr,Jr=Fr,Yr=Lr;function Xr(e){let t=Q.useRef({value:e,previous:e});return Q.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function Zr(e){let[t,n]=Q.useState(void 0);return ut(()=>{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 Qr=[`top`,`right`,`bottom`,`left`],$r=Math.min,ei=Math.max,ti=Math.round,ni=Math.floor,ri=e=>({x:e,y:e}),ii={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function ai(e,t,n){return ei(e,$r(t,n))}function oi(e,t){return typeof e==`function`?e(t):e}function si(e){return e.split(`-`)[0]}function ci(e){return e.split(`-`)[1]}function li(e){return e===`x`?`y`:`x`}function ui(e){return e===`y`?`height`:`width`}function di(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function fi(e){return li(di(e))}function pi(e,t,n){n===void 0&&(n=!1);let r=ci(e),i=fi(e),a=ui(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=Si(o)),[o,Si(o)]}function mi(e){let t=Si(e);return[hi(e),t,hi(t)]}function hi(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var gi=[`left`,`right`],_i=[`right`,`left`],vi=[`top`,`bottom`],yi=[`bottom`,`top`];function bi(e,t,n){switch(e){case`top`:case`bottom`:return n?t?_i:gi:t?gi:_i;case`left`:case`right`:return t?vi:yi;default:return[]}}function xi(e,t,n,r){let i=ci(e),a=bi(si(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(hi)))),a}function Si(e){let t=si(e);return ii[t]+e.slice(t.length)}function Ci(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function wi(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:Ci(e)}function Ti(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 Ei(e,t,n){let{reference:r,floating:i}=e,a=di(t),o=fi(t),s=ui(o),c=si(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=ci(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function Di(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}=oi(t,e),p=wi(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=Ti(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=Ti(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 Oi=50,ki=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:Di},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=Ei(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<Oi&&(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}=Ei(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},Ai=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}=oi(e,t)||{};if(l==null)return{};let d=wi(u),f={x:n,y:r},p=fi(i),m=ui(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=$r(d[_],T),D=$r(d[v],T),O=C-h[m]-D,k=C/2-h[m]/2+w,A=ai(E,k,O),j=!c.arrow&&ci(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}}}),ji=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}=oi(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=si(r),_=di(o),v=si(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[Si(o)]:mi(o)),x=p!==`none`;!d&&x&&b.push(...xi(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=pi(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`&&_!==di(t))||T.every(e=>di(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=di(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 Mi(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Ni(e){return Qr.some(t=>e[t]>=0)}var Pi=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=oi(e,t);switch(i){case`referenceHidden`:{let e=Mi(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:Ni(e)}}}case`escaped`:{let e=Mi(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:Ni(e)}}}default:return{}}}}},Fi=new Set([`left`,`top`]);async function Ii(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=si(n),s=ci(n),c=di(n)===`y`,l=Fi.has(o)?-1:1,u=a&&c?-1:1,d=oi(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 Li=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 Ii(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}}}}},Ri=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}=oi(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=di(i),p=li(f),m=u[p],h=u[f],g=(e,t)=>ai(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}}}}}},zi=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}=oi(e,t),u={x:n,y:r},d=di(i),f=li(d),p=u[f],m=u[d],h=oi(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=Fi.has(si(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}}}},Bi=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}=oi(e,t),c=await i.detectOverflow(t,s),l=si(n),u=ci(n),d=di(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=$r(p-c[m],g),y=$r(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*ei(c.left,c.right):S=p-2*ei(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 Vi(){return typeof window<`u`}function Hi(e){return Gi(e)?(e.nodeName||``).toLowerCase():`#document`}function Ui(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Wi(e){return((Gi(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function Gi(e){return Vi()?e instanceof Node||e instanceof Ui(e).Node:!1}function Ki(e){return Vi()?e instanceof Element||e instanceof Ui(e).Element:!1}function qi(e){return Vi()?e instanceof HTMLElement||e instanceof Ui(e).HTMLElement:!1}function Ji(e){return!Vi()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof Ui(e).ShadowRoot}function Yi(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=oa(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function Xi(e){return/^(table|td|th)$/.test(Hi(e))}function Zi(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var Qi=/transform|translate|scale|rotate|perspective|filter/,$i=/paint|layout|strict|content/,ea=e=>!!e&&e!==`none`,ta;function na(e){let t=Ki(e)?oa(e):e;return ea(t.transform)||ea(t.translate)||ea(t.scale)||ea(t.rotate)||ea(t.perspective)||!ia()&&(ea(t.backdropFilter)||ea(t.filter))||Qi.test(t.willChange||``)||$i.test(t.contain||``)}function ra(e){let t=ca(e);for(;qi(t)&&!aa(t);){if(na(t))return t;if(Zi(t))return null;t=ca(t)}return null}function ia(){return ta??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),ta}function aa(e){return/^(html|body|#document)$/.test(Hi(e))}function oa(e){return Ui(e).getComputedStyle(e)}function sa(e){return Ki(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function ca(e){if(Hi(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||Ji(e)&&e.host||Wi(e);return Ji(t)?t.host:t}function la(e){let t=ca(e);return aa(t)?(e.ownerDocument||e).body:qi(t)&&Yi(t)?t:la(t)}function ua(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=la(e),i=r===e.ownerDocument?.body,a=Ui(r);if(i){let e=da(a);return t.concat(a,a.visualViewport||[],Yi(r)?r:[],e&&n?ua(e):[])}else return t.concat(r,ua(r,[],n))}function da(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function fa(e){let t=oa(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=qi(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=ti(n)!==a||ti(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function pa(e){return Ki(e)?e:e.contextElement}function ma(e){let t=pa(e);if(!qi(t))return ri(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=fa(t),o=(a?ti(n.width):n.width)/r,s=(a?ti(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var ha=ri(0);function ga(e){let t=Ui(e);return!ia()||!t.visualViewport?ha:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function _a(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===Ui(e)}function va(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=pa(e),o=ri(1);t&&(r?Ki(r)&&(o=ma(r)):o=ma(e));let s=_a(a,n,r)?ga(a):ri(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=Ui(a),t=Ki(r)?Ui(r):r,n=e,i=da(n);for(;i&&t!==n;){let e=ma(i),t=i.getBoundingClientRect(),r=oa(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=Ui(i),i=da(n)}}return Ti({width:u,height:d,x:c,y:l})}function ya(e,t){let n=sa(e).scrollLeft;return t?t.left+n:va(Wi(e)).left+n}function ba(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-ya(e,n),y:n.top+t.scrollTop}}function xa(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=Wi(r),s=t?Zi(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=ri(1),u=ri(0),d=qi(r);if((d||!a)&&((Hi(r)!==`body`||Yi(o))&&(c=sa(r)),d)){let e=va(r);l=ma(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?ba(o,c):ri(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 Sa(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function Ca(e){let t=sa(e),n=e.ownerDocument.body,r=ei(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=ei(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+ya(e),o=-t.scrollTop;return oa(n).direction===`rtl`&&(a+=ei(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var wa=25;function Ta(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=Ui(e),a=Wi(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!ia()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(ya(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<=wa&&(s-=o)}return{width:s,height:c,x:l,y:u}}function Ea(e,t){let n=va(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=ma(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function Da(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=Ta(e,n,t);else if(t===`document`)r=Ca(Wi(e));else if(Ki(t))r=Ea(t,n);else{let n=ga(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return Ti(r)}function Oa(e,t){let n=t.get(e);if(n)return n;let r=ua(e,[],!1).filter(e=>Ki(e)&&Hi(e)!==`body`),i=null,a=oa(e).position===`fixed`,o=a?ca(e):e;for(;Ki(o)&&!aa(o);){let e=oa(o),t=na(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=ca(o)}return t.set(e,r),r}function ka(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?Zi(t)?[]:Oa(t,this._c):[].concat(n),r],o=Da(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=Da(t,a[e],i);s=ei(n.top,s),c=$r(n.right,c),l=$r(n.bottom,l),u=ei(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function Aa(e){let{width:t,height:n}=fa(e);return{width:t,height:n}}function ja(e,t,n){let r=qi(t),i=Wi(t),a=n===`fixed`,o=va(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=ri(0);if((r||!a)&&((Hi(t)!==`body`||Yi(i))&&(s=sa(t)),r)){let e=va(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=ya(i));let l=i&&!r&&!a?ba(i,s):ri(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 Ma(e){return oa(e).position===`static`}function Na(e,t){if(!qi(e)||oa(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return Wi(e)===n&&(n=n.ownerDocument.body),n}function Pa(e,t){let n=Ui(e);if(Zi(e))return n;if(!qi(e)){let t=ca(e);for(;t&&!aa(t);){if(Ki(t)&&!Ma(t))return t;t=ca(t)}return n}let r=Na(e,t);for(;r&&Xi(r)&&Ma(r);)r=Na(r,t);return r&&aa(r)&&Ma(r)&&!na(r)?n:r||ra(e)||n}var Fa=async function(e){let t=this.getOffsetParent||Pa,n=this.getDimensions,r=await n(e.floating);return{reference:ja(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Ia(e){return oa(e).direction===`rtl`}var La={convertOffsetParentRelativeRectToViewportRelativeRect:xa,getDocumentElement:Wi,getClippingRect:ka,getOffsetParent:Pa,getElementRects:Fa,getClientRects:Sa,getDimensions:Aa,getScale:ma,isElement:Ki,isRTL:Ia};function Ra(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function za(e,t,n){let r=null,i,a=Wi(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=ni(d),h=ni(a.clientWidth-(u+f)),g=ni(a.clientHeight-(d+p)),_=ni(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:ei(0,$r(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(!Ra(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=Ui(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function Ba(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=pa(e),u=i||a?[...l?ua(l):[],...t?ua(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?za(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?va(e):null;c&&g();function g(){let t=va(e);h&&!Ra(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 Va=Li,Ha=Ri,Ua=ji,Wa=Bi,Ga=Pi,Ka=Ai,qa=zi,Ja=(e,t,n)=>{let r=new Map,i=n??{},a={...La,...i.platform,_c:r};return ki(e,t,{...i,platform:a})},Ya=e(r(),1),Xa=typeof document<`u`?Q.useLayoutEffect:function(){};function Za(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(!Za(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)&&!Za(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function Qa(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function $a(e,t){let n=Qa(e);return Math.round(t*n)/n}function eo(e){let t=Q.useRef(e);return Xa(()=>{t.current=e}),t}function to(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]=Q.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=Q.useState(r);Za(f,r)||p(r);let[m,h]=Q.useState(null),[g,_]=Q.useState(null),v=Q.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=Q.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=Q.useRef(null),C=Q.useRef(null),w=Q.useRef(u),T=c!=null,E=eo(c),D=eo(i),O=eo(l),k=Q.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};D.current&&(e.platform=D.current),Ja(S.current,C.current,e).then(e=>{let t={...e,isPositioned:O.current!==!1};A.current&&!Za(w.current,t)&&(w.current=t,Ya.flushSync(()=>{d(t)}))})},[f,t,n,D,O]);Xa(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let A=Q.useRef(!1);Xa(()=>(A.current=!0,()=>{A.current=!1}),[]),Xa(()=>{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=Q.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),M=Q.useMemo(()=>({reference:b,floating:x}),[b,x]),ee=Q.useMemo(()=>{let e={position:n,left:0,top:0};if(!M.floating)return e;let t=$a(M.floating,u.x),r=$a(M.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...Qa(M.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,M.floating,u.x,u.y]);return Q.useMemo(()=>({...u,update:k,refs:j,elements:M,floatingStyles:ee}),[u,k,j,M,ee])}var no=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?{}:Ka({element:r.current,padding:i}).fn(n):r?Ka({element:r,padding:i}).fn(n):{}}}},ro=(e,t)=>{let n=Va(e);return{name:n.name,fn:n.fn,options:[e,t]}},io=(e,t)=>{let n=Ha(e);return{name:n.name,fn:n.fn,options:[e,t]}},ao=(e,t)=>({fn:qa(e).fn,options:[e,t]}),oo=(e,t)=>{let n=Ua(e);return{name:n.name,fn:n.fn,options:[e,t]}},so=(e,t)=>{let n=Wa(e);return{name:n.name,fn:n.fn,options:[e,t]}},co=(e,t)=>{let n=Ga(e);return{name:n.name,fn:n.fn,options:[e,t]}},lo=(e,t)=>{let n=no(e);return{name:n.name,fn:n.fn,options:[e,t]}},uo=`Arrow`,fo=Q.forwardRef((e,t)=>{let{children:n,width:r=10,height:i=5,...a}=e;return(0,$.jsx)(K.svg,{...a,ref:t,width:r,height:i,viewBox:`0 0 30 10`,preserveAspectRatio:`none`,children:e.asChild?n:(0,$.jsx)(`polygon`,{points:`0,0 30,0 15,10`})})});fo.displayName=uo;var po=fo,mo=`Popper`,[ho,go]=De(mo),[_o,vo]=ho(mo),yo=e=>{let{__scopePopper:t,children:n}=e,[r,i]=Q.useState(null),[a,o]=Q.useState(void 0);return(0,$.jsx)(_o,{scope:t,anchor:r,onAnchorChange:i,placementState:a,setPlacementState:o,children:n})};yo.displayName=mo;var bo=`PopperAnchor`,xo=Q.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:r,...i}=e,a=vo(bo,n),o=Q.useRef(null),s=a.onAnchorChange,c=g(t,Q.useCallback(e=>{o.current=e,e&&s(e)},[s])),l=Q.useRef(null);Q.useEffect(()=>{if(!r)return;let e=l.current;l.current=r.current,e!==l.current&&s(l.current)});let u=a.placementState&&jo(a.placementState),d=u?.[0],f=u?.[1];return r?null:(0,$.jsx)(K.div,{"data-radix-popper-side":d,"data-radix-popper-align":f,...i,ref:c})});xo.displayName=bo;var So=`PopperContent`,[Co,wo]=ho(So),To=Q.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,...h}=e,_=vo(So,n),[v,y]=Q.useState(null),b=g(t,y),[x,S]=Q.useState(null),C=Zr(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(ko),altBoundary:k},{refs:j,floatingStyles:M,placement:ee,isPositioned:N,middlewareData:P}=to({strategy:`fixed`,placement:E,whileElementsMounted:(...e)=>Ba(...e,{animationFrame:p===`always`}),elements:{reference:_.anchor},middleware:[ro({mainAxis:i+T,alignmentAxis:o}),c&&io({mainAxis:!0,crossAxis:!1,limiter:d===`partial`?ao():void 0,...A}),c&&oo({...A}),so({...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&&lo({element:x,padding:s}),Ao({arrowWidth:w,arrowHeight:T}),f&&co({strategy:`referenceHidden`,...A,boundary:k?A.boundary:void 0})]}),F=_.setPlacementState;ut(()=>(F(ee),()=>{F(void 0)}),[ee,F]);let[I,te]=jo(ee),ne=Ye(m);ut(()=>{N&&ne?.()},[N,ne]);let re=P.arrow?.x,L=P.arrow?.y,ie=P.arrow?.centerOffset!==0,[R,ae]=Q.useState();return ut(()=>{v&&ae(window.getComputedStyle(v).zIndex)},[v]),(0,$.jsx)(`div`,{ref:j.setFloating,"data-radix-popper-content-wrapper":``,style:{...M,transform:N?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,$.jsx)(Co,{scope:n,placedSide:I,placedAlign:te,onArrowChange:S,arrowX:re,arrowY:L,shouldHideArrow:ie,children:(0,$.jsx)(K.div,{"data-side":I,"data-align":te,...h,ref:b,style:{...h.style,animation:N?void 0:`none`}})})})});To.displayName=So;var Eo=`PopperArrow`,Do={top:`bottom`,right:`left`,bottom:`top`,left:`right`},Oo=Q.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=wo(Eo,n),a=Do[i.placedSide];return(0,$.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,$.jsx)(po,{...r,ref:t,style:{...r.style,display:`block`}})})});Oo.displayName=Eo;function ko(e){return e!==null}var Ao=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]=jo(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 jo(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var Mo=yo,No=xo,Po=To,Fo=Oo,Io=!1;function Lo(){let[e,t]=Q.useState(Io);return Q.useEffect(()=>{Io||(Io=!0,t(!0))},[]),e}var Ro=Q.useSyncExternalStore;function zo(){return()=>{}}function Bo(){return Ro(zo,()=>!0,()=>!1)}var Vo=typeof Ro==`function`?Bo:Lo,Ho=`rovingFocusGroup.onEntryFocus`,Uo={bubbles:!1,cancelable:!0},Wo=`RovingFocusGroup`,[Go,Ko,qo]=gr(Wo),[Jo,Yo]=De(Wo,[qo]),[Xo,Zo]=Jo(Wo),Qo=Q.forwardRef((e,t)=>(0,$.jsx)(Go.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,$.jsx)(Go.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,$.jsx)($o,{...e,ref:t})})}));Qo.displayName=Wo;var $o=Q.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=Q.useRef(null),p=g(t,f),m=vr(a),[h,_]=Ce({prop:o,defaultProp:s??null,onChange:c,caller:Wo}),[v,y]=Q.useState(!1),b=Ye(l),x=Ko(n),S=Q.useRef(!1),[C,w]=Q.useState(0);return Q.useEffect(()=>{let e=f.current;if(e)return e.addEventListener(Ho,b),()=>e.removeEventListener(Ho,b)},[b]),(0,$.jsx)(Xo,{scope:n,orientation:r,dir:m,loop:i,currentTabStopId:h,onItemFocus:Q.useCallback(e=>_(e),[_]),onItemShiftTab:Q.useCallback(()=>y(!0),[]),onFocusableItemAdd:Q.useCallback(()=>w(e=>e+1),[]),onFocusableItemRemove:Q.useCallback(()=>w(e=>e-1),[]),children:(0,$.jsx)(K.div,{tabIndex:v||C===0?-1:0,"data-orientation":r,...d,ref:p,style:{outline:`none`,...e.style},onMouseDown:q(e.onMouseDown,()=>{S.current=!0}),onFocus:q(e.onFocus,e=>{let t=!S.current;if(e.target===e.currentTarget&&t&&!v){let t=new CustomEvent(Ho,Uo);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=x().filter(e=>e.focusable);as([e.find(e=>e.active),e.find(e=>e.id===h),...e].filter(Boolean).map(e=>e.ref.current),u)}}S.current=!1}),onBlur:q(e.onBlur,()=>y(!1))})})}),es=`RovingFocusGroupItem`,ts=Q.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...s}=e,c=Be(),l=a||c,u=Zo(es,n),d=u.currentTabStopId===l,f=Ko(n),{onFocusableItemAdd:p,onFocusableItemRemove:m,currentTabStopId:h}=u,g=Vo();return ut(()=>{if(!(!g||!r))return p(),()=>m()},[g,r,p,m]),Q.useEffect(()=>{if(!(g||!r))return p(),()=>m()},[g,r,p,m]),(0,$.jsx)(Go.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:(0,$.jsx)(K.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:t,onMouseDown:q(e.onMouseDown,e=>{r?u.onItemFocus(l):e.preventDefault()}),onFocus:q(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:q(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){u.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=is(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?os(n,r+1):n.slice(r+1)}setTimeout(()=>as(n))}}),children:typeof o==`function`?o({isCurrentTabStop:d,hasTabStop:h!=null}):o})})});ts.displayName=es;var ns={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function rs(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}function is(e,t,n){let r=rs(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return ns[r]}function as(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function os(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var ss=Qo,cs=ts,ls=[`Enter`,` `],us=[`ArrowDown`,`PageUp`,`Home`],ds=[`ArrowUp`,`PageDown`,`End`],fs=[...us,...ds],ps={ltr:[...ls,`ArrowRight`],rtl:[...ls,`ArrowLeft`]},ms={ltr:[`ArrowLeft`],rtl:[`ArrowRight`]},hs=`Menu`,[gs,_s,vs]=gr(hs),[ys,bs]=De(hs,[vs,go,Yo]),xs=go(),Ss=Yo(),[Cs,ws]=ys(hs),[Ts,Es]=ys(hs),Ds=e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=xs(t),[c,l]=Q.useState(null),u=Q.useRef(!1),d=Ye(a),f=vr(i);return Q.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})}},[]),Q.useEffect(()=>{if(!n)return;let e=()=>d(!1);return window.addEventListener(`blur`,e),()=>window.removeEventListener(`blur`,e)},[n,d]),(0,$.jsx)(Mo,{...s,children:(0,$.jsx)(Cs,{scope:t,open:n,onOpenChange:d,content:c,onContentChange:l,children:(0,$.jsx)(Ts,{scope:t,onClose:Q.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:o,children:r})})})};Ds.displayName=hs;var Os=`MenuAnchor`,ks=Q.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=xs(n);return(0,$.jsx)(No,{...i,...r,ref:t})});ks.displayName=Os;var As=`MenuPortal`,[js,Ms]=ys(As,{forceMount:void 0}),Ns=e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=ws(As,t);return(0,$.jsx)(js,{scope:t,forceMount:n,children:(0,$.jsx)(Re,{present:n||a.open,children:(0,$.jsx)(ct,{asChild:!0,container:i,children:r})})})};Ns.displayName=As;var Ps=`MenuContent`,[Fs,Is]=ys(Ps),Ls=Q.forwardRef((e,t)=>{let n=Ms(Ps,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=ws(Ps,e.__scopeMenu),o=Es(Ps,e.__scopeMenu);return(0,$.jsx)(gs.Provider,{scope:e.__scopeMenu,children:(0,$.jsx)(Re,{present:r||a.open,children:(0,$.jsx)(gs.Slot,{scope:e.__scopeMenu,children:o.modal?(0,$.jsx)(Rs,{...i,ref:t}):(0,$.jsx)(zs,{...i,ref:t})})})})}),Rs=Q.forwardRef((e,t)=>{let n=ws(Ps,e.__scopeMenu),r=Q.useRef(null),i=g(t,r);return Q.useEffect(()=>{let e=r.current;if(e)return ot(e)},[]),(0,$.jsx)(Vs,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:q(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),zs=Q.forwardRef((e,t)=>{let n=ws(Ps,e.__scopeMenu);return(0,$.jsx)(Vs,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),Bs=pt(`MenuContent.ScrollLock`),Vs=Q.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,...h}=e,_=ws(Ps,n),v=Es(Ps,n),y=xs(n),b=Ss(n),x=_s(n),[S,C]=Q.useState(null),w=Q.useRef(null),T=g(t,w,_.onContentChange),E=Q.useRef(0),D=Q.useRef(``),O=Q.useRef(0),k=Q.useRef(null),A=Q.useRef(`right`),j=Q.useRef(0),M=m?Ae:Q.Fragment,ee=m?{as:Bs,allowPinchZoom:!0}:void 0,N=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=Tc(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())};Q.useEffect(()=>()=>window.clearTimeout(E.current),[]),qe();let P=Q.useCallback(e=>A.current===k.current?.side&&Dc(e,k.current?.area),[]);return(0,$.jsx)(Fs,{scope:n,searchRef:D,onItemEnter:Q.useCallback(e=>{P(e)&&e.preventDefault()},[P]),onItemLeave:Q.useCallback(e=>{P(e)||(w.current?.focus(),C(null))},[P]),onTriggerLeave:Q.useCallback(e=>{P(e)&&e.preventDefault()},[P]),pointerGraceTimerRef:O,onPointerGraceIntentChange:Q.useCallback(e=>{k.current=e},[]),children:(0,$.jsx)(M,{...ee,children:(0,$.jsx)(Me,{asChild:!0,trapped:i,onMountAutoFocus:q(a,e=>{e.preventDefault(),w.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:(0,$.jsx)(Ie,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,children:(0,$.jsx)(ss,{asChild:!0,...b,dir:v.dir,orientation:`vertical`,loop:r,currentTabStopId:S,onCurrentTabStopIdChange:C,onEntryFocus:q(c,e=>{v.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,$.jsx)(Po,{role:`menu`,"aria-orientation":`vertical`,"data-state":bc(_.open),"data-radix-menu-content":``,dir:v.dir,...y,...h,ref:T,style:{outline:`none`,...h.style},onKeyDown:q(h.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&&N(e.key));let i=w.current;if(e.target!==i||!fs.includes(e.key))return;e.preventDefault();let a=x().filter(e=>!e.disabled).map(e=>e.ref.current);ds.includes(e.key)&&a.reverse(),Cc(a)}),onBlur:q(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(E.current),D.current=``)}),onPointerMove:q(e.onPointerMove,Oc(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}}))})})})})})})});Ls.displayName=Ps;var Hs=`MenuGroup`,Us=Q.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,$.jsx)(K.div,{role:`group`,...r,ref:t})});Us.displayName=Hs;var Ws=`MenuLabel`,Gs=Q.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,$.jsx)(K.div,{...r,ref:t})});Gs.displayName=Ws;var Ks=`MenuItem`,qs=`menu.itemSelect`,Js=Q.forwardRef((e,t)=>{let{disabled:n=!1,onSelect:r,...i}=e,a=Q.useRef(null),o=Es(Ks,e.__scopeMenu),s=Is(Ks,e.__scopeMenu),c=g(t,a),l=Q.useRef(!1),u=()=>{let e=a.current;if(!n&&e){let t=new CustomEvent(qs,{bubbles:!0,cancelable:!0});e.addEventListener(qs,e=>r?.(e),{once:!0}),se(e,t),t.defaultPrevented?l.current=!1:o.onClose()}};return(0,$.jsx)(Ys,{...i,ref:c,disabled:n,onClick:q(e.onClick,u),onPointerDown:t=>{e.onPointerDown?.(t),l.current=!0},onPointerUp:q(e.onPointerUp,e=>{l.current||e.currentTarget?.click()}),onKeyDown:q(e.onKeyDown,e=>{n||e.target!==e.currentTarget||s.searchRef.current!==``&&e.key===` `||ls.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})});Js.displayName=Ks;var Ys=Q.forwardRef((e,t)=>{let{__scopeMenu:n,disabled:r=!1,textValue:i,...a}=e,o=Is(Ks,n),s=Ss(n),c=Q.useRef(null),l=g(t,c),[u,d]=Q.useState(!1),[f,p]=Q.useState(``);return Q.useEffect(()=>{let e=c.current;e&&p((e.textContent??``).trim())},[a.children]),(0,$.jsx)(gs.ItemSlot,{scope:n,disabled:r,textValue:i??f,children:(0,$.jsx)(cs,{asChild:!0,...s,focusable:!r,children:(0,$.jsx)(K.div,{role:`menuitem`,"data-highlighted":u?``:void 0,"aria-disabled":r||void 0,"data-disabled":r?``:void 0,...a,ref:l,onPointerMove:q(e.onPointerMove,Oc(e=>{r?o.onItemLeave(e):(o.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:q(e.onPointerLeave,Oc(e=>o.onItemLeave(e))),onFocus:q(e.onFocus,()=>d(!0)),onBlur:q(e.onBlur,()=>d(!1))})})})}),Xs=`MenuCheckboxItem`,Zs=Q.forwardRef((e,t)=>{let{checked:n=!1,onCheckedChange:r,...i}=e;return(0,$.jsx)(ac,{scope:e.__scopeMenu,checked:n,children:(0,$.jsx)(Js,{role:`menuitemcheckbox`,"aria-checked":xc(n)?`mixed`:n,...i,ref:t,"data-state":Sc(n),onSelect:q(i.onSelect,()=>r?.(xc(n)?!0:!n),{checkForDefaultPrevented:!1})})})});Zs.displayName=Xs;var Qs=`MenuRadioGroup`,[$s,ec]=ys(Qs,{value:void 0,onValueChange:()=>{}}),tc=Q.forwardRef((e,t)=>{let{value:n,onValueChange:r,...i}=e,a=Ye(r);return(0,$.jsx)($s,{scope:e.__scopeMenu,value:n,onValueChange:a,children:(0,$.jsx)(Us,{...i,ref:t})})});tc.displayName=Qs;var nc=`MenuRadioItem`,rc=Q.forwardRef((e,t)=>{let{value:n,...r}=e,i=ec(nc,e.__scopeMenu),a=n===i.value;return(0,$.jsx)(ac,{scope:e.__scopeMenu,checked:a,children:(0,$.jsx)(Js,{role:`menuitemradio`,"aria-checked":a,...r,ref:t,"data-state":Sc(a),onSelect:q(r.onSelect,()=>i.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});rc.displayName=nc;var ic=`MenuItemIndicator`,[ac,oc]=ys(ic,{checked:!1}),sc=Q.forwardRef((e,t)=>{let{__scopeMenu:n,forceMount:r,...i}=e,a=oc(ic,n);return(0,$.jsx)(Re,{present:r||xc(a.checked)||a.checked===!0,children:(0,$.jsx)(K.span,{...i,ref:t,"data-state":Sc(a.checked)})})});sc.displayName=ic;var cc=`MenuSeparator`,lc=Q.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,$.jsx)(K.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})});lc.displayName=cc;var uc=`MenuArrow`,dc=Q.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=xs(n);return(0,$.jsx)(Fo,{...i,...r,ref:t})});dc.displayName=uc;var fc=`MenuSub`,[pc,mc]=ys(fc),hc=e=>{let{__scopeMenu:t,children:n,open:r=!1,onOpenChange:i}=e,a=ws(fc,t),o=xs(t),[s,c]=Q.useState(null),[l,u]=Q.useState(null),d=Ye(i);return Q.useEffect(()=>(a.open===!1&&d(!1),()=>d(!1)),[a.open,d]),(0,$.jsx)(Mo,{...o,children:(0,$.jsx)(Cs,{scope:t,open:r,onOpenChange:d,content:l,onContentChange:u,children:(0,$.jsx)(pc,{scope:t,contentId:Be(),triggerId:Be(),trigger:s,onTriggerChange:c,children:n})})})};hc.displayName=fc;var gc=`MenuSubTrigger`,_c=Q.forwardRef((e,t)=>{let n=ws(gc,e.__scopeMenu),r=Es(gc,e.__scopeMenu),i=mc(gc,e.__scopeMenu),a=Is(gc,e.__scopeMenu),o=Q.useRef(null),{pointerGraceTimerRef:s,onPointerGraceIntentChange:c}=a,l={__scopeMenu:e.__scopeMenu},u=Q.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);Q.useEffect(()=>u,[u]),Q.useEffect(()=>{let e=s.current;return()=>{window.clearTimeout(e),c(null)}},[s,c]);let d=g(t,i.onTriggerChange);return(0,$.jsx)(ks,{asChild:!0,...l,children:(0,$.jsx)(Ys,{id:i.triggerId,"aria-haspopup":`menu`,"aria-expanded":n.open,"aria-controls":n.open?i.contentId:void 0,"data-state":bc(n.open),...e,ref:d,onClick:t=>{e.onClick?.(t),!(e.disabled||t.defaultPrevented)&&(t.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:q(e.onPointerMove,Oc(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:q(e.onPointerLeave,Oc(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:q(e.onKeyDown,t=>{e.disabled||t.target!==t.currentTarget||a.searchRef.current!==``&&t.key===` `||ps[r.dir].includes(t.key)&&(n.onOpenChange(!0),n.content?.focus(),t.preventDefault())})})})});_c.displayName=gc;var vc=`MenuSubContent`,yc=Q.forwardRef((e,t)=>{let n=Ms(Ps,e.__scopeMenu),{forceMount:r=n.forceMount,align:i=`start`,...a}=e,o=ws(Ps,e.__scopeMenu),s=Es(Ps,e.__scopeMenu),c=mc(vc,e.__scopeMenu),l=Q.useRef(null),u=g(t,l);return(0,$.jsx)(gs.Provider,{scope:e.__scopeMenu,children:(0,$.jsx)(Re,{present:r||o.open,children:(0,$.jsx)(gs.Slot,{scope:e.__scopeMenu,children:(0,$.jsx)(Vs,{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:q(e.onFocusOutside,e=>{e.target!==c.trigger&&o.onOpenChange(!1)}),onEscapeKeyDown:q(e.onEscapeKeyDown,e=>{s.onClose(),e.preventDefault()}),onKeyDown:q(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),n=ms[s.dir].includes(e.key);t&&n&&(o.onOpenChange(!1),c.trigger?.focus(),e.preventDefault())})})})})})});yc.displayName=vc;function bc(e){return e?`open`:`closed`}function xc(e){return e===`indeterminate`}function Sc(e){return xc(e)?`indeterminate`:e?`checked`:`unchecked`}function Cc(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function wc(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function Tc(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=wc(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 Ec(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 Dc(e,t){return t?Ec({x:e.clientX,y:e.clientY},t):!1}function Oc(e){return t=>t.pointerType===`mouse`?e(t):void 0}var kc=Ds,Ac=ks,jc=Ns,Mc=Ls,Nc=Us,Pc=Gs,Fc=Js,Ic=Zs,Lc=tc,Rc=rc,zc=sc,Bc=lc,Vc=dc,Hc=_c,Uc=yc,Wc=`DropdownMenu`,[Gc,Kc]=De(Wc,[bs]),qc=bs(),[Jc,Yc]=Gc(Wc),Xc=e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=qc(t),l=Q.useRef(null),[u,d]=Ce({prop:i,defaultProp:a??!1,onChange:o,caller:Wc});return(0,$.jsx)(Jc,{scope:t,triggerId:Be(),triggerRef:l,contentId:Be(),open:u,onOpenChange:d,onOpenToggle:Q.useCallback(()=>d(e=>!e),[d]),modal:s,children:(0,$.jsx)(kc,{...c,open:u,onOpenChange:d,dir:r,modal:s,children:n})})};Xc.displayName=Wc;var Zc=`DropdownMenuTrigger`,Qc=Q.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,a=Yc(Zc,n),o=qc(n),s=g(t,a.triggerRef);return(0,$.jsx)(Ac,{asChild:!0,...o,children:(0,$.jsx)(K.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:q(e.onPointerDown,e=>{!r&&e.button===0&&e.ctrlKey===!1&&(a.onOpenToggle(),a.open||e.preventDefault())}),onKeyDown:q(e.onKeyDown,e=>{r||([`Enter`,` `].includes(e.key)&&a.onOpenToggle(),e.key===`ArrowDown`&&a.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})});Qc.displayName=Zc;var $c=`DropdownMenuPortal`,el=e=>{let{__scopeDropdownMenu:t,...n}=e,r=qc(t);return(0,$.jsx)(jc,{...r,...n})};el.displayName=$c;var tl=`DropdownMenuContent`,nl=Q.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Yc(tl,n),a=qc(n),o=Q.useRef(!1);return(0,$.jsx)(Mc,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:q(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:q(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)`}})});nl.displayName=tl;var rl=`DropdownMenuGroup`,il=Q.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=qc(n);return(0,$.jsx)(Nc,{...i,...r,ref:t})});il.displayName=rl;var al=`DropdownMenuLabel`,ol=Q.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=qc(n);return(0,$.jsx)(Pc,{...i,...r,ref:t})});ol.displayName=al;var sl=`DropdownMenuItem`,cl=Q.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=qc(n);return(0,$.jsx)(Fc,{...i,...r,ref:t})});cl.displayName=sl;var ll=`DropdownMenuCheckboxItem`,ul=Q.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=qc(n);return(0,$.jsx)(Ic,{...i,...r,ref:t})});ul.displayName=ll;var dl=`DropdownMenuRadioGroup`,fl=Q.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=qc(n);return(0,$.jsx)(Lc,{...i,...r,ref:t})});fl.displayName=dl;var pl=`DropdownMenuRadioItem`,ml=Q.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=qc(n);return(0,$.jsx)(Rc,{...i,...r,ref:t})});ml.displayName=pl;var hl=`DropdownMenuItemIndicator`,gl=Q.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=qc(n);return(0,$.jsx)(zc,{...i,...r,ref:t})});gl.displayName=hl;var _l=`DropdownMenuSeparator`,vl=Q.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=qc(n);return(0,$.jsx)(Bc,{...i,...r,ref:t})});vl.displayName=_l;var yl=`DropdownMenuArrow`,bl=Q.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=qc(n);return(0,$.jsx)(Vc,{...i,...r,ref:t})});bl.displayName=yl;var xl=`DropdownMenuSubTrigger`,Sl=Q.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=qc(n);return(0,$.jsx)(Hc,{...i,...r,ref:t})});Sl.displayName=xl;var Cl=`DropdownMenuSubContent`,wl=Q.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=qc(n);return(0,$.jsx)(Uc,{...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)`}})});wl.displayName=Cl;var Tl=Xc,El=Qc,Dl=el,Ol=nl,kl=ol,Al=cl,jl=fl,Ml=ml,Nl=gl,Pl=vl,Fl=`Label`,Il=Q.forwardRef((e,t)=>(0,$.jsx)(K.label,{...e,ref:t,onMouseDown:t=>{t.target.closest(`button, input, select, textarea`)||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));Il.displayName=Fl;var Ll=Il,Rl=`Popover`,[zl,Bl]=De(Rl,[go]),Vl=go(),[Hl,Ul]=zl(Rl),Wl=e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=Vl(t),c=Q.useRef(null),[l,u]=Q.useState(!1),[d,f]=Ce({prop:r,defaultProp:i??!1,onChange:a,caller:Rl});return(0,$.jsx)(Mo,{...s,children:(0,$.jsx)(Hl,{scope:t,contentId:Be(),triggerRef:c,open:d,onOpenChange:f,onOpenToggle:Q.useCallback(()=>f(e=>!e),[f]),hasCustomAnchor:l,onCustomAnchorAdd:Q.useCallback(()=>u(!0),[]),onCustomAnchorRemove:Q.useCallback(()=>u(!1),[]),modal:o,children:n})})};Wl.displayName=Rl;var Gl=`PopoverAnchor`,Kl=Q.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=Ul(Gl,n),a=Vl(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:s}=i;return Q.useEffect(()=>(o(),()=>s()),[o,s]),(0,$.jsx)(No,{...a,...r,ref:t})});Kl.displayName=Gl;var ql=`PopoverTrigger`,Jl=Q.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=Ul(ql,n),a=Vl(n),o=g(t,i.triggerRef),s=(0,$.jsx)(K.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":lu(i.open),...r,ref:o,onClick:q(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?s:(0,$.jsx)(No,{asChild:!0,...a,children:s})});Jl.displayName=ql;var Yl=`PopoverPortal`,[Xl,Zl]=zl(Yl,{forceMount:void 0}),Ql=e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=Ul(Yl,t);return(0,$.jsx)(Xl,{scope:t,forceMount:n,children:(0,$.jsx)(Re,{present:n||a.open,children:(0,$.jsx)(ct,{asChild:!0,container:i,children:r})})})};Ql.displayName=Yl;var $l=`PopoverContent`,eu=Q.forwardRef((e,t)=>{let n=Zl($l,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=Ul($l,e.__scopePopover);return(0,$.jsx)(Re,{present:r||a.open,children:a.modal?(0,$.jsx)(nu,{...i,ref:t}):(0,$.jsx)(ru,{...i,ref:t})})});eu.displayName=$l;var tu=pt(`PopoverContent.RemoveScroll`),nu=Q.forwardRef((e,t)=>{let n=Ul($l,e.__scopePopover),r=Q.useRef(null),i=g(t,r),a=Q.useRef(!1);return Q.useEffect(()=>{let e=r.current;if(e)return ot(e)},[]),(0,$.jsx)(Ae,{as:tu,allowPinchZoom:!0,children:(0,$.jsx)(iu,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:q(e.onCloseAutoFocus,e=>{e.preventDefault(),a.current||n.triggerRef.current?.focus()}),onPointerDownOutside:q(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:q(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),ru=Q.forwardRef((e,t)=>{let n=Ul($l,e.__scopePopover),r=Q.useRef(!1),i=Q.useRef(!1);return(0,$.jsx)(iu,{...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()}})}),iu=Q.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=Ul($l,n),p=Vl(n);return qe(),(0,$.jsx)(Me,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,$.jsx)(Ie,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>f.onOpenChange(!1),deferPointerDownOutside:!0,children:(0,$.jsx)(Po,{"data-state":lu(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)`}})})})}),au=`PopoverClose`,ou=Q.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=Ul(au,n);return(0,$.jsx)(K.button,{type:`button`,...r,ref:t,onClick:q(e.onClick,()=>i.onOpenChange(!1))})});ou.displayName=au;var su=`PopoverArrow`,cu=Q.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=Vl(n);return(0,$.jsx)(Fo,{...i,...r,ref:t})});cu.displayName=su;function lu(e){return e?`open`:`closed`}var uu=Wl,du=Kl,fu=Jl,pu=Ql,mu=eu,hu=`Switch`,[gu,_u]=De(hu),[vu,yu]=gu(hu);function bu(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]=Ce({prop:n,defaultProp:i??!1,onChange:c,caller:hu}),[m,h]=Q.useState(null),[g,_]=Q.useState(null),v={checked:f,setChecked:p,disabled:a,control:m,setControl:h,name:s,form:o,value:u,hasConsumerStoppedPropagationRef:Q.useRef(!1),required:l,defaultChecked:i,isFormControl:!m||!!o||!!m.closest(`form`),bubbleInput:g,setBubbleInput:_};return(0,$.jsx)(vu,{scope:t,...v,children:Ou(d)?d(v):r})}var xu=`SwitchTrigger`,Su=Q.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}=yu(xu,e),h=g(r,u),_=Q.useRef(c);return Q.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,$.jsx)(K.button,{type:`button`,role:`switch`,"aria-checked":c,"aria-required":l,"data-state":ku(c),"data-disabled":s?``:void 0,disabled:s,value:o,...n,ref:h,onClick:q(t,e=>{d(e=>!e),m&&p&&(f.current=e.isPropagationStopped(),f.current||e.stopPropagation())})})});Su.displayName=xu;var Cu=Q.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,$.jsx)(bu,{__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,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Su,{...d,ref:t,__scopeSwitch:n}),e&&(0,$.jsx)(Du,{__scopeSwitch:n})]})})});Cu.displayName=hu;var wu=`SwitchThumb`,Tu=Q.forwardRef((e,t)=>{let{__scopeSwitch:n,...r}=e,i=yu(wu,n);return(0,$.jsx)(K.span,{"data-state":ku(i.checked),"data-disabled":i.disabled?``:void 0,...r,ref:t})});Tu.displayName=wu;var Eu=`SwitchBubbleInput`,Du=Q.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}=yu(Eu,e),m=g(n,p),h=Xr(a),_=Zr(r);Q.useEffect(()=>{let e=f;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set,r=!i.current;if(h!==a&&n){let t=new Event(`click`,{bubbles:r});n.call(e,a),e.dispatchEvent(t)}},[f,h,a,i]);let v=Q.useRef(a);return(0,$.jsx)(K.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%)`}})});Du.displayName=Eu;function Ou(e){return typeof e==`function`}function ku(e){return e?`checked`:`unchecked`}var Au=m(`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 ju({className:e,variant:t=`default`,asChild:n=!1,...r}){return(0,$.jsx)(n?d:`span`,{"data-slot":`badge`,"data-variant":t,className:X(Au({variant:t}),e),...r})}function Mu({...e}){return(0,$.jsx)(Pt,{"data-slot":`dialog`,...e})}function Nu({...e}){return(0,$.jsx)(jt,{"data-slot":`dialog-portal`,...e})}function Pu({...e}){return(0,$.jsx)(At,{"data-slot":`dialog-close`,...e})}function Fu({className:e,...t}){return(0,$.jsx)(Et,{"data-slot":`dialog-overlay`,className:X(`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 Iu({className:e,children:t,showCloseButton:n=!0,...r}){return(0,$.jsxs)(Nu,{"data-slot":`dialog-portal`,children:[(0,$.jsx)(Fu,{}),(0,$.jsxs)(Mt,{"data-slot":`dialog-content`,className:X(`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,$.jsxs)(At,{"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,$.jsx)(wt,{}),(0,$.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function Lu({className:e,...t}){return(0,$.jsx)(`div`,{"data-slot":`dialog-header`,className:X(`flex flex-col gap-2 text-center sm:text-left`,e),...t})}function Ru({className:e,showCloseButton:t=!1,children:n,...r}){return(0,$.jsxs)(`div`,{"data-slot":`dialog-footer`,className:X(`flex flex-col-reverse gap-2 sm:flex-row sm:justify-end`,e),...r,children:[n,t&&(0,$.jsx)(At,{asChild:!0,children:(0,$.jsx)(H,{variant:`outline`,children:`Close`})})]})}function zu({className:e,...t}){return(0,$.jsx)(Nt,{"data-slot":`dialog-title`,className:X(`text-lg leading-none font-semibold`,e),...t})}function Bu({className:e,...t}){return(0,$.jsx)(Ot,{"data-slot":`dialog-description`,className:X(`text-sm text-muted-foreground`,e),...t})}function Vu({open:e,onOpenChange:t}){let[n,r]=(0,Q.useState)(null),[i,o]=(0,Q.useState)(null),s=T(n),c=ve(),l=a(),u=y(),d=new Set((c.data?.projects??[]).map(e=>e.root)),f=e=>{r(e),o(null),l.reset()},p=i?.path??s.data?.path??null,m=s.data?.parent??null;return(0,$.jsx)(Mu,{open:e,onOpenChange:t,children:(0,$.jsxs)(Iu,{"data-slot":`add-project-dialog`,className:`sm:max-w-lg`,children:[(0,$.jsxs)(Lu,{children:[(0,$.jsx)(zu,{children:`Open local folder`}),(0,$.jsx)(Bu,{children:`Pick the folder cezar should run in. Git repos are marked; any folder works.`})]}),(0,$.jsx)(`p`,{"data-slot":`fs-breadcrumb`,className:`truncate font-mono text-[11.5px] text-soft-foreground`,title:s.data?.path??void 0,children:s.data?.path??(s.isError?``:`Loading…`)}),s.isError?(0,$.jsx)(`p`,{"data-slot":`fs-error`,className:`min-w-0 break-words text-[13px] text-danger`,children:s.error instanceof Error?s.error.message:`could not list that folder`}):(0,$.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:[m===null?null:(0,$.jsx)(`li`,{className:`flex`,children:(0,$.jsxs)(`button`,{type:`button`,"data-slot":`fs-up`,onClick:()=>f(m),className:`flex flex-1 items-center gap-2 px-3 py-2 text-left text-[13px] hover:bg-muted`,children:[(0,$.jsx)(Ln,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),`Up one level`]})}),(s.data?.dirs??[]).map(e=>(0,$.jsxs)(`li`,{className:`flex items-stretch`,children:[(0,$.jsxs)(`button`,{type:`button`,"data-slot":`fs-dir`,"aria-pressed":i?.path===e.path,onClick:()=>o(e),onDoubleClick:()=>f(e.path),className:X(`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,$.jsx)(Un,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),(0,$.jsx)(`span`,{className:`truncate`,children:e.name}),e.isRepo?(0,$.jsx)(ju,{variant:`outline`,className:`shrink-0 text-[10px]`,children:`git`}):null,d.has(e.path)?(0,$.jsx)(ju,{variant:`ghost`,className:`shrink-0 text-[10px] text-muted-foreground`,children:`already added`}):null]}),(0,$.jsx)(`button`,{type:`button`,"data-slot":`fs-enter`,"aria-label":`Open ${e.name}`,onClick:()=>f(e.path),className:`flex shrink-0 items-center px-2.5 text-muted-foreground hover:bg-muted hover:text-foreground`,children:(0,$.jsx)(Nn,{className:`size-3.5`,"aria-hidden":`true`})})]},e.path)),s.data&&s.data.dirs.length===0?(0,$.jsx)(`li`,{className:`px-3 py-2 text-[13px] text-muted-foreground`,children:`No subfolders here — “Add project” registers this folder.`}):null]}),s.data?.truncated?(0,$.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,l.isError?(0,$.jsx)(`p`,{"data-slot":`add-project-error`,className:`min-w-0 break-words text-[13px] text-danger`,children:l.error instanceof Error?l.error.message:`could not add that folder`}):null,(0,$.jsxs)(Ru,{className:`min-w-0 sm:items-center sm:justify-between`,children:[(0,$.jsx)(`span`,{"data-slot":`add-project-target`,className:`min-w-0 truncate font-mono text-[11.5px] text-muted-foreground`,title:p??void 0,children:p??``}),(0,$.jsxs)(`span`,{className:`flex shrink-0 gap-2`,children:[(0,$.jsx)(H,{variant:`outline`,onClick:()=>t(!1),children:`Cancel`}),(0,$.jsx)(H,{"data-slot":`add-project-confirm`,disabled:p===null||l.isPending,onClick:()=>{p===null||l.isPending||l.mutate(p,{onSuccess:({project:e})=>{t(!1),u(`/p/${encodeURIComponent(e.id)}/`)}})},children:l.isPending?`Adding…`:`Add project`})]})]})]})})}function Hu({className:e,type:t,...n}){return(0,$.jsx)(`input`,{type:t,"data-slot":`input`,className:X(`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 Uu({className:e,...t}){return(0,$.jsx)(Ll,{"data-slot":`label`,className:X(`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 Wu({open:e,onOpenChange:t}){let[n,r]=(0,Q.useState)(``),[i,a]=(0,Q.useState)(``),[o,s]=(0,Q.useState)(null),c=ve(),l=P(),u=y(),d=(0,Q.useMemo)(()=>`co-${Math.random().toString(36).slice(2)}-${Date.now().toString(36)}`,[]),f=(0,Q.useRef)(d);f.current=d,(0,Q.useEffect)(()=>pn((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,Q.useMemo)(()=>{let e=n.trim().replace(/\/+$/,``).replace(/\.git$/,``).split(`/`).pop()??``;return e.includes(`:`)?e.split(`:`).pop()??``:e},[n]),m=i.trim()===``?p:i.trim(),g=c.data?.projectsDir??``,_=m===``?``:`${g.replace(/\/+$/,``)}/${m}`,v=()=>{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,$.jsx)(Mu,{open:e,onOpenChange:e=>l.isPending?void 0:t(e),children:(0,$.jsxs)(Iu,{"data-slot":`clone-project-dialog`,className:`sm:max-w-lg`,children:[(0,$.jsxs)(Lu,{children:[(0,$.jsx)(zu,{children:`Clone from GitHub`}),(0,$.jsxs)(Bu,{children:[`cezar clones with `,(0,$.jsx)(`code`,{children:`gh`}),` into your checkout root and adds the result as a project.`]})]}),(0,$.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,$.jsx)(Uu,{htmlFor:`clone-url`,children:`Repository`}),(0,$.jsx)(Hu,{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`&&v()}})]}),(0,$.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,$.jsx)(Uu,{htmlFor:`clone-name`,children:`Folder name`}),(0,$.jsx)(Hu,{id:`clone-name`,"data-slot":`clone-name`,placeholder:p===``?`repo`:p,value:i,disabled:l.isPending,onChange:e=>a(e.target.value)}),(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1`,children:[(0,$.jsx)(`p`,{"data-slot":`clone-target`,className:`min-w-0 flex-1 truncate font-mono text-[11.5px] text-soft-foreground`,title:_,children:_}),l.isPending?(0,$.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,$.jsx)(ur,{className:`size-3.5`,"aria-hidden":`true`})}):(0,$.jsx)(H,{asChild:!0,variant:`ghost`,size:`icon-sm`,className:`size-7`,children:(0,$.jsx)(h,{to:`/settings/global/projects`,"data-slot":`clone-root-settings`,"aria-label":`Edit checkout root`,title:`Edit checkout root`,children:(0,$.jsx)(ur,{className:`size-3.5`,"aria-hidden":`true`})})})]})]}),l.isPending?(0,$.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,$.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,$.jsxs)(Ru,{children:[(0,$.jsx)(H,{variant:`outline`,disabled:l.isPending,onClick:()=>t(!1),children:`Cancel`}),(0,$.jsx)(H,{"data-slot":`clone-confirm`,disabled:n.trim()===``||m===``||l.isPending,onClick:v,children:l.isPending?`Cloning…`:`Clone`})]})]})})}function Gu(e){return(0,$.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`currentColor`,"aria-hidden":`true`,...e,children:(0,$.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 Ku=[{to:`/`,label:`Tasks`,icon:Xn,match:[`/`,`/tasks`,`/compare`]},{to:`/inbox`,label:`Inbox`,icon:Jn,match:[`/inbox`],badge:`inbox-count`,inbox:!0},{to:`/git`,label:`Git`,icon:Kn,match:[`/git`]},{to:`/github`,label:`GitHub`,icon:Gu,match:[`/github`],forge:!0},{to:`/automations`,label:`Automations`,icon:hr,match:[`/automations`],forge:!0},{to:`/skills`,label:`Skills`,icon:dr,match:[`/skills`],badge:`skills-update`},{to:`/workflows`,label:`Workflows`,icon:mr,match:[`/workflows`]},{to:`/settings`,label:`Settings`,icon:ur,match:[`/settings`]}];function qu({forge:e=!1,inbox:t=!1}={}){return Ku.filter(n=>(!n.forge||e)&&(!n.inbox||t))}function Ju(e,t){return t===`/`?e===`/`:e===t||e.startsWith(t+`/`)}function Yu(e){let t=null;for(let n of Ku)for(let r of n.match)Ju(e,r)&&(t===null||r.length>t.length)&&(t={to:n.to,length:r.length});return t?.to??null}function Xu(e){let t=Yu(e);return Ku.find(e=>e.to===t)??null}var Zu=m(`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 Qu({className:e,tone:t=`neutral`,pulse:n=!1,...r}){return(0,$.jsx)(`span`,{"data-slot":`status-dot`,"data-tone":t,className:X(Zu({tone:t,pulse:n,className:e})),...r})}var $u=`cez-theme`,ed=`(prefers-color-scheme: light)`,td=`dark`;function nd(e){return e===`light`||e===`dark`||e===`system`?e:td}function rd(e,t){return e===`light`||e===`system`&&t?`light`:`dark`}function id(){try{return nd(localStorage.getItem($u))}catch{return td}}function ad(e){try{localStorage.setItem($u,e)}catch{}}function od(){return typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(ed).matches}function sd(e,t){e.classList.toggle(`light`,t===`light`),e.style.colorScheme=t}var cd=Q.createContext(null);function ld({children:e}){let[t,n]=Q.useState(id),[r,i]=Q.useState(od);Q.useEffect(()=>{let e=window.matchMedia?.(ed);if(!e)return;i(e.matches);let t=e=>i(e.matches);return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]);let a=rd(t,r);Q.useLayoutEffect(()=>{sd(document.documentElement,a)},[a]);let o=Q.useCallback(e=>{n(e),ad(e)},[]),s=Q.useMemo(()=>({theme:t,resolvedTheme:a,setTheme:o}),[t,a,o]);return(0,$.jsx)(cd.Provider,{value:s,children:e})}function ud(){let e=Q.useContext(cd);if(!e)throw Error(`cezar: useTheme() must be called inside <ThemeProvider>`);return e}var dd={light:`dark`,dark:`system`,system:`light`},fd={light:pr,dark:er,system:$n},pd={light:`light`,dark:`dark`,system:`system`};function md({className:e}){let{theme:t,setTheme:n}=ud(),r=dd[t],i=fd[t];return(0,$.jsx)(H,{type:`button`,variant:`ghost`,size:`icon-sm`,className:e,"data-slot":`theme-toggle`,"data-theme-pref":t,title:`Theme: ${pd[t]}`,"aria-label":`Theme: ${pd[t]}. Switch to ${pd[r]}.`,onClick:()=>n(r),children:(0,$.jsx)(i,{"aria-hidden":`true`})})}var hd=1,gd=.9,_d=.8,vd=.17,yd=.1,bd=.999,xd=.9999,Sd=.99,Cd=/[\\\/_+.#"@\[\(\{&]/,wd=/[\\\/_+.#"@\[\(\{&]/g,Td=/[\s-]/,Ed=/[\s-]/g;function Dd(e,t,n,r,i,a,o){if(a===t.length)return i===e.length?hd:Sd;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=Dd(e,t,n,r,l+1,a+1,o),d>u&&(l===i?d*=hd:Cd.test(e.charAt(l-1))?(d*=_d,p=e.slice(i,l-1).match(wd),p&&i>0&&(d*=bd**+p.length)):Td.test(e.charAt(l-1))?(d*=gd,m=e.slice(i,l-1).match(Ed),m&&i>0&&(d*=bd**+m.length)):(d*=vd,i>0&&(d*=bd**+(l-i))),e.charAt(l)!==t.charAt(a)&&(d*=xd)),(d<yd&&n.charAt(l-1)===r.charAt(a+1)||r.charAt(a+1)===r.charAt(a)&&n.charAt(l-1)!==r.charAt(a))&&(f=Dd(e,t,n,r,l+1,a+2,o),f*yd>d&&(d=f*yd)),d>u&&(u=d),l=n.indexOf(c,l+1);return o[s]=u,u}function Od(e){return e.toLowerCase().replace(Ed,` `)}function kd(e,t,n){return e=n&&n.length>0?`${e+` `+n.join(` `)}`:e,Dd(e,t,Od(e),Od(t),0,0,{})}var Ad=`[cmdk-group=""]`,jd=`[cmdk-group-items=""]`,Md=`[cmdk-group-heading=""]`,Nd=`[cmdk-item=""]`,Pd=`${Nd}:not([aria-disabled="true"])`,Fd=`cmdk-item-select`,Id=`data-value`,Ld=(e,t,n)=>kd(e,t,n),Rd=Q.createContext(void 0),zd=()=>Q.useContext(Rd),Bd=Q.createContext(void 0),Vd=()=>Q.useContext(Bd),Hd=Q.createContext(void 0),Ud=Q.forwardRef((e,t)=>{let n=rf(()=>({search:``,value:e.value??e.defaultValue??``,selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}})),r=rf(()=>new Set),i=rf(()=>new Map),a=rf(()=>new Map),o=rf(()=>new Set),s=tf(e),{label:c,children:l,value:u,onValueChange:d,filter:f,shouldFilter:p,loop:m,disablePointerSelection:h=!1,vimBindings:g=!0,..._}=e,v=Be(),y=Be(),b=Be(),x=Q.useRef(null),S=sf();nf(()=>{if(u!==void 0){let e=u.trim();n.current.value=e,C.emit()}},[u]),nf(()=>{S(6,k)},[]);let C=Q.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=Q.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??Ld;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(jd);t?t.appendChild(e.parentElement===t?e:e.closest(`${jd} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${jd} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{let t=x.current?.querySelector(`${Ad}[${Id}="${encodeURIComponent(e[0])}"]`);t?.parentElement.appendChild(t)})}function D(){let e=j().find(e=>e.getAttribute(`aria-disabled`)!==`true`)?.getAttribute(Id);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(Ad)?.querySelector(Md))==null||e.scrollIntoView({block:`nearest`})),t.scrollIntoView({block:`nearest`}))}function A(){return x.current?.querySelector(`${Nd}[aria-selected="true"]`)}function j(){return Array.from(x.current?.querySelectorAll(Pd)||[])}function M(e){let t=j()[e];t&&C.setState(`value`,t.getAttribute(Id))}function ee(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(Id))}function N(e){let t=A()?.closest(Ad),n;for(;t&&!n;)t=e>0?$d(t,Ad):ef(t,Ad),n=t?.querySelector(Pd);n?C.setState(`value`,n.getAttribute(Id)):ee(e)}let P=()=>M(j().length-1),F=e=>{e.preventDefault(),e.metaKey?P():e.altKey?N(1):ee(1)},I=e=>{e.preventDefault(),e.metaKey?M(0):e.altKey?N(-1):ee(-1)};return Q.createElement(K.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&&F(e);break;case`ArrowDown`:F(e);break;case`p`:case`k`:g&&e.ctrlKey&&I(e);break;case`ArrowUp`:I(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(Fd);t.dispatchEvent(e)}}}}},Q.createElement(`label`,{"cmdk-label":``,htmlFor:w.inputId,id:w.labelId,style:uf},c),lf(e,e=>Q.createElement(Bd.Provider,{value:C},Q.createElement(Rd.Provider,{value:w},e))))}),Wd=Q.forwardRef((e,t)=>{let n=Be(),r=Q.useRef(null),i=Q.useContext(Hd),a=zd(),o=tf(e),s=o.current?.forceMount??i?.forceMount;nf(()=>{if(!s)return a.item(n,i?.id)},[s]);let c=of(n,r,[e.value,e.children,r],e.keywords),l=Vd(),u=af(e=>e.value&&e.value===c.current),d=af(e=>s||a.filter()===!1?!0:!e.search||e.filtered.items.get(n)>0);Q.useEffect(()=>{let t=r.current;if(!(!t||e.disabled))return t.addEventListener(Fd,f),()=>t.removeEventListener(Fd,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 Q.createElement(K.div,{ref:ue(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)}),Gd=Q.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:i,...a}=e,o=Be(),s=Q.useRef(null),c=Q.useRef(null),l=Be(),u=zd(),d=af(e=>i||u.filter()===!1?!0:!e.search||e.filtered.groups.has(o));nf(()=>u.group(o),[]),of(o,s,[e.value,e.heading,c]);let f=Q.useMemo(()=>({id:o,forceMount:i}),[i]);return Q.createElement(K.div,{ref:ue(s,t),...a,"cmdk-group":``,role:`presentation`,hidden:!d||void 0},n&&Q.createElement(`div`,{ref:c,"cmdk-group-heading":``,"aria-hidden":!0,id:l},n),lf(e,e=>Q.createElement(`div`,{"cmdk-group-items":``,role:`group`,"aria-labelledby":n?l:void 0},Q.createElement(Hd.Provider,{value:f},e))))}),Kd=Q.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,i=Q.useRef(null),a=af(e=>!e.search);return!n&&!a?null:Q.createElement(K.div,{ref:ue(i,t),...r,"cmdk-separator":``,role:`separator`})}),qd=Q.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,i=e.value!=null,a=Vd(),o=af(e=>e.search),s=af(e=>e.selectedItemId),c=zd();return Q.useEffect(()=>{e.value!=null&&a.setState(`search`,e.value)},[e.value]),Q.createElement(K.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)}})}),Jd=Q.forwardRef((e,t)=>{let{children:n,label:r=`Suggestions`,...i}=e,a=Q.useRef(null),o=Q.useRef(null),s=af(e=>e.selectedItemId),c=zd();return Q.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)}}},[]),Q.createElement(K.div,{ref:ue(a,t),...i,"cmdk-list":``,role:`listbox`,tabIndex:-1,"aria-activedescendant":s,"aria-label":r,id:c.listId},lf(e,e=>Q.createElement(`div`,{ref:ue(o,c.listInnerRef),"cmdk-list-sizer":``},e)))}),Yd=Q.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:a,container:o,...s}=e;return Q.createElement(Pt,{open:n,onOpenChange:r},Q.createElement(jt,{container:o},Q.createElement(Et,{"cmdk-overlay":``,className:i}),Q.createElement(Mt,{"aria-label":e.label,"cmdk-dialog":``,className:a},Q.createElement(Ud,{ref:t,...s}))))}),Xd=Q.forwardRef((e,t)=>af(e=>e.filtered.count===0)?Q.createElement(K.div,{ref:t,...e,"cmdk-empty":``,role:`presentation`}):null),Zd=Q.forwardRef((e,t)=>{let{progress:n,children:r,label:i=`Loading...`,...a}=e;return Q.createElement(K.div,{ref:t,...a,"cmdk-loading":``,role:`progressbar`,"aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},lf(e,e=>Q.createElement(`div`,{"aria-hidden":!0},e)))}),Qd=Object.assign(Ud,{List:Jd,Item:Wd,Input:qd,Group:Gd,Separator:Kd,Dialog:Yd,Empty:Xd,Loading:Zd});function $d(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function ef(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function tf(e){let t=Q.useRef(e);return nf(()=>{t.current=e}),t}var nf=typeof window>`u`?Q.useEffect:Q.useLayoutEffect;function rf(e){let t=Q.useRef();return t.current===void 0&&(t.current=e()),t}function af(e){let t=Vd(),n=()=>e(t.snapshot());return Q.useSyncExternalStore(t.subscribe,n,n)}function of(e,t,n,r=[]){let i=Q.useRef(),a=zd();return nf(()=>{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(Id,s),i.current=s}),i}var sf=()=>{let[e,t]=Q.useState(),n=rf(()=>new Map);return nf(()=>{n.current.forEach(e=>e()),n.current=new Map},[e]),(e,r)=>{n.current.set(e,r),t({})}};function cf(e){let t=e.type;return typeof t==`function`?t(e.props):`render`in t?t.render(e.props):e}function lf({asChild:e,children:t},n){return e&&Q.isValidElement(t)?Q.cloneElement(cf(t),{ref:t.ref},n(t.props.children)):n(t)}var uf={position:`absolute`,width:`1px`,height:`1px`,padding:`0`,margin:`-1px`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,borderWidth:`0`};function df({className:e,...t}){return(0,$.jsx)(Qd,{"data-slot":`command`,className:X(`flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground`,e),...t})}function ff({title:e=`Command Palette`,description:t=`Search for a command to run...`,children:n,className:r,showCloseButton:i=!0,...a}){return(0,$.jsxs)(Mu,{...a,children:[(0,$.jsxs)(Lu,{className:`sr-only`,children:[(0,$.jsx)(zu,{children:e}),(0,$.jsx)(Bu,{children:t})]}),(0,$.jsx)(Iu,{className:X(`overflow-hidden p-0`,r),showCloseButton:i,children:(0,$.jsx)(df,{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 pf({className:e,...t}){return(0,$.jsxs)(`div`,{"data-slot":`command-input-wrapper`,className:`flex h-9 items-center gap-2 border-b px-3`,children:[(0,$.jsx)(lr,{className:`size-4 shrink-0 opacity-50`}),(0,$.jsx)(Qd.Input,{"data-slot":`command-input`,className:X(`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 mf({className:e,...t}){return(0,$.jsx)(Qd.List,{"data-slot":`command-list`,className:X(`max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto`,e),...t})}function hf({...e}){return(0,$.jsx)(Qd.Empty,{"data-slot":`command-empty`,className:`py-6 text-center text-sm`,...e})}function gf({className:e,...t}){return(0,$.jsx)(Qd.Group,{"data-slot":`command-group`,className:X(`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 _f({className:e,...t}){return(0,$.jsx)(Qd.Separator,{"data-slot":`command-separator`,className:X(`-mx-1 h-px bg-border`,e),...t})}function vf({className:e,...t}){return(0,$.jsx)(Qd.Item,{"data-slot":`command-item`,className:X(`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 yf({className:e,...t}){return(0,$.jsx)(`span`,{"data-slot":`command-shortcut`,className:X(`ml-auto text-xs tracking-widest text-muted-foreground`,e),...t})}var bf={permission:0,error:1,waiting:2,running:3,unseen:4,none:5};function xf(e){return!1}function Sf(e){return!1}function Cf(e){return xf(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`}:Sf(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 wf(e){return bf[Cf(e).bucket]<=bf.waiting}function Tf(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 Ef(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 Df=new Set([`ai`,`cezar`,`agents`,`team`]);function Of(e){return Df.has(e.source)}function kf(e){return[...e].sort((e,t)=>Number(!Of(e))-Number(!Of(t)))}var Af=5;function jf(e,t,{mostUsedLimit:n=Af}={}){let r=e.map((e,n)=>({skill:e,index:n,count:Nf(t,e.name)})).filter(e=>e.count>0).sort((e,t)=>t.count-e.count||Number(!Of(e.skill))-Number(!Of(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(Of),global:a.filter(e=>!Of(e))}}function Mf(e,t){let n=jf(e,t);return[...n.mostUsed,...n.project,...n.global]}function Nf(e,t){if(!e||!Object.hasOwn(e,t))return 0;let n=e[t];return typeof n==`number`?n:0}function Pf(e,t){return{...e,[t]:Nf(e,t)+1}}function Ff(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 If(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 Lf=/[\s\-/_.]/;function Rf(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&&Lf.test(a)){let n=e[r+t.length];i=n===void 0||Lf.test(n)?3:2}if(i>n&&(n=i),n===3)break}return n}function zf(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=Rf(i,e);if(t===0)return 0;a+=t}return a/(r.length*3)}function Bf(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&&Lf.test(e)?4:3}return+!!Ff(n,r)}function Vf(e,t){let n=e.split(`-`).filter(Boolean);return t?[...n,t]:n}var Hf=10;function Uf(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=Bf(e,n),a=t?Bf(t,n):0;if(r===0&&a===0)return 0;i+=r>0?r+Hf:a}return i}var Wf=.5;function Gf(e,t,n){return t.trim()===``?[...e]:e.map((e,r)=>{let i=Uf(e.name,e.description,t),a=Nf(n,e.name),o=Math.min(a,Af)*Wf;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 Kf(e,t,n){return Gf(e,t,n)}function qf(e,t){return Gf(e,t)}function Jf(e,t,n){return Gf(Mf(e,n),t,n)}var Yf=[`Needs you`,`Working`,`Recent`,`Archived`],Xf={waiting:0,review:1,running:2,queued:3},Zf=e=>Xf[e.status]??9;function Qf(e,t){return t===`archived`?`Archived`:e.status===`waiting`||e.status===`review`?`Needs you`:e.status===`running`||e.status===`queued`?`Working`:`Recent`}function $f(e){let t=e.titleSummary;return t===void 0||!(e.titleOrigin===`user`||e.titleOrigin===`marker`)&&/[.!?][A-Z]/.test(t)?e.title:t}function ep(e){return e.title.replace(/ \([A-C]\)$/,``)}function tp(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 np(e,t){return e.filter(e=>t===`archived`?e.archived:!e.archived).sort((e,t)=>{let n=Zf(e)-Zf(t);return n===0?t.createdAt.localeCompare(e.createdAt):n})}function rp(e,t){let n=tp(e),r=np(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(Qf(e,t),{kind:`group`,groupId:e.groupId,title:ep(e),members:n});continue}}a(Qf(e,t),{kind:`run`,run:e,queuePosition:n.get(e.id)??null})}return Yf.filter(e=>i.has(e)).map(e=>({label:e,rows:i.get(e)}))}function ip(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 ap(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 op(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 sp(e){return e instanceof HTMLElement&&e.closest(`[cmdk-input]`)!==null}function cp(e,t){return!(typeof e.key!=`string`||e.key.toLowerCase()!==t.toLowerCase()||!e.metaKey&&!e.ctrlKey||e.altKey||e.shiftKey||e.repeat||op(e.target)&&!sp(e.target))}function lp(e,t){let n=Q.useRef(t);Q.useLayoutEffect(()=>{n.current=t}),Q.useEffect(()=>{let t=t=>{cp(t,e)&&(t.preventDefault(),n.current(t))};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e])}function up(e,t){return!(typeof e.key!=`string`||e.key.toLowerCase()!==t.toLowerCase()||e.metaKey||e.ctrlKey||e.altKey||e.shiftKey||e.repeat||op(e.target))}function dp(e,t){let n=Q.useRef(t);Q.useLayoutEffect(()=>{n.current=t}),Q.useEffect(()=>{let t=t=>{up(t,e)&&n.current(t)};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e])}var fp=`cezar:open-command-palette`;function pp(){window.dispatchEvent(new Event(fp))}function mp(e){return[...e].sort((e,t)=>Date.parse(t.createdAt)-Date.parse(e.createdAt))}function hp(){let[e,t]=Q.useState(!1),n=It();lp(`k`,()=>t(e=>!e));let r=Q.useCallback(()=>{t(!1),n(`/new`)},[n]);return lp(`n`,r),dp(`c`,r),Q.useEffect(()=>{let e=()=>t(!0);return window.addEventListener(fp,e),()=>window.removeEventListener(fp,e)},[]),(0,$.jsx)(ff,{open:e,onOpenChange:t,title:`Command palette`,description:`Search tasks, views, actions, and skills`,showCloseButton:!1,children:(0,$.jsx)(gp,{close:()=>t(!1)})})}function gp({close:e}){let t=It(),{theme:n,setTheme:r}=ud(),i=Ze(),a=ze(),o=yt(),s=C(),c=Date.now(),l=Q.useMemo(()=>mp(i.data??[]),[i.data]),u=o.data?.skillUsage,d=Q.useMemo(()=>Mf(a.data??[],u),[a.data,u]),f=n=>{e(),t(n)},p=dd[n];return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(pf,{placeholder:`Search tasks, views, actions, skills…`}),(0,$.jsxs)(mf,{children:[(0,$.jsx)(hf,{children:`Nothing matches.`}),(0,$.jsxs)(gf,{heading:`Views`,children:[qu({forge:s.data?.forge?.available===!0,inbox:s.data?.capabilities.followups===!0}).map(e=>{let t=e.icon;return(0,$.jsxs)(vf,{value:`view ${e.label}`,"data-slot":`palette-view`,"data-nav-to":e.to,onSelect:()=>f(e.to),children:[(0,$.jsx)(t,{"aria-hidden":`true`}),e.label]},e.to)}),(0,$.jsxs)(vf,{value:`view new task`,"data-slot":`palette-view`,"data-nav-to":`/new`,onSelect:()=>f(`/new`),children:[(0,$.jsx)(sr,{"aria-hidden":`true`}),`New task`,(0,$.jsx)(yf,{children:`C`})]})]}),l.length>0?(0,$.jsx)(gf,{heading:`Tasks`,children:l.map(e=>{let t=Cf(e);return(0,$.jsxs)(vf,{value:`task ${$f(e)} ${e.id}`,"data-slot":`palette-task`,"data-run-id":e.id,onSelect:()=>f(`/tasks/${e.id}`),children:[(0,$.jsx)(Qu,{tone:t.tone,pulse:t.pulse,"aria-label":t.label,role:`img`}),(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:$f(e)}),(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-soft-foreground tabular-nums`,children:Tf(e.finishedAt??e.createdAt,c)})]},e.id)})}):null,(0,$.jsxs)(gf,{heading:`Actions`,children:[(0,$.jsxs)(vf,{value:`action toggle theme`,"data-slot":`palette-action`,"data-action":`toggle-theme`,onSelect:()=>{r(p),e()},children:[(0,$.jsx)(er,{"aria-hidden":`true`}),`Toggle theme`,(0,$.jsxs)(yf,{className:`tracking-normal`,children:[n,` → `,p]})]}),(0,$.jsxs)(vf,{value:`action new task`,"data-slot":`palette-action`,"data-action":`new-task`,onSelect:()=>f(`/new`),children:[(0,$.jsx)(sr,{"aria-hidden":`true`}),`New task`]})]}),d.length>0?(0,$.jsx)(gf,{heading:`Skills`,children:d.map(e=>(0,$.jsxs)(vf,{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,$.jsx)(`span`,{className:`shrink-0 font-medium`,children:e.name}),e.description?(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null]},e.path))}):null]})]})}function _p({...e}){return(0,$.jsx)(Tl,{"data-slot":`dropdown-menu`,...e})}function vp({...e}){return(0,$.jsx)(El,{"data-slot":`dropdown-menu-trigger`,...e})}function yp({className:e,sideOffset:t=4,...n}){return(0,$.jsx)(Dl,{children:(0,$.jsx)(Ol,{"data-slot":`dropdown-menu-content`,sideOffset:t,className:X(`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 bp({className:e,inset:t,variant:n=`default`,...r}){return(0,$.jsx)(Al,{"data-slot":`dropdown-menu-item`,"data-inset":t,"data-variant":n,className:X(`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 xp({...e}){return(0,$.jsx)(jl,{"data-slot":`dropdown-menu-radio-group`,...e})}function Sp({className:e,children:t,...n}){return(0,$.jsxs)(Ml,{"data-slot":`dropdown-menu-radio-item`,className:X(`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,$.jsx)(`span`,{className:`pointer-events-none absolute left-2 flex size-3.5 items-center justify-center`,children:(0,$.jsx)(Nl,{children:(0,$.jsx)(Pn,{className:`size-2 fill-current`})})}),t]})}function Cp({className:e,inset:t,...n}){return(0,$.jsx)(kl,{"data-slot":`dropdown-menu-label`,"data-inset":t,className:X(`px-2 py-1.5 text-sm font-medium data-[inset]:pl-8`,e),...n})}function wp({className:e,...t}){return(0,$.jsx)(Pl,{"data-slot":`dropdown-menu-separator`,className:X(`-mx-1 my-1 h-px bg-border`,e),...t})}function Tp({...e}){return(0,$.jsx)(Pt,{"data-slot":`sheet`,...e})}function Ep({...e}){return(0,$.jsx)(Dt,{"data-slot":`sheet-trigger`,...e})}function Dp({...e}){return(0,$.jsx)(At,{"data-slot":`sheet-close`,...e})}function Op({...e}){return(0,$.jsx)(jt,{"data-slot":`sheet-portal`,...e})}function kp({className:e,...t}){return(0,$.jsx)(Et,{"data-slot":`sheet-overlay`,className:X(`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 Ap({className:e,children:t,side:n=`right`,showCloseButton:r=!0,...i}){return(0,$.jsxs)(Op,{children:[(0,$.jsx)(kp,{}),(0,$.jsxs)(Mt,{"data-slot":`sheet-content`,className:X(`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,$.jsxs)(At,{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,$.jsx)(wt,{className:`size-4`}),(0,$.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function jp({className:e,...t}){return(0,$.jsx)(`div`,{"data-slot":`sheet-header`,className:X(`flex flex-col gap-1.5 p-4`,e),...t})}function Mp({className:e,...t}){return(0,$.jsx)(Nt,{"data-slot":`sheet-title`,className:X(`font-semibold text-foreground`,e),...t})}function Np({className:e,...t}){return(0,$.jsx)(Ot,{"data-slot":`sheet-description`,className:X(`text-sm text-muted-foreground`,e),...t})}var Pp=`/assets/open-mercato-toBr6SOa.svg`,Fp=`(min-width: 768px)`,Ip=Q.createContext(void 0);function Lp(){return Q.useContext(Ip)}function Rp({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}=L(),m=Vt(p),h=Yu(m),g=Xu(m),[_,v]=Q.useState(!1),y=Q.useRef(null);Q.useLayoutEffect(()=>{let e=y.current;e&&(e.scrollTop=0)},[p]),Q.useEffect(()=>{v(!1)},[p]),Q.useEffect(()=>{let e=window.matchMedia?.(Fp);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:qu({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,$.jsx)(Tp,{open:_,onOpenChange:v,children:(0,$.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,$.jsx)(zp,{...b}),(0,$.jsx)(Bp,{...b,onNavigate:()=>v(!1)}),(0,$.jsxs)(`div`,{className:`grid min-w-0 flex-1 grid-rows-[auto_auto_1fr_auto] overflow-hidden`,children:[(0,$.jsx)(qp,{title:g?.label??`cezar`}),d?(0,$.jsx)(`div`,{"data-slot":`banner-slot`,className:`row-start-2`,children:d}):null,(0,$.jsx)(`main`,{ref:y,"data-slot":`main`,className:`row-start-3 min-h-0 overflow-y-auto overscroll-contain`,children:e}),(0,$.jsx)(`div`,{"data-slot":`composer`,className:`row-start-4 pb-[env(safe-area-inset-bottom)]`})]})]})})}function zp(e){return(0,$.jsx)(`aside`,{"data-slot":`sidebar`,className:`hidden w-[264px] shrink-0 flex-col border-r border-border bg-sidebar md:flex`,children:(0,$.jsx)(Vp,{...e})})}function Bp({onNavigate:e,...t}){return(0,$.jsxs)(Ap,{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,$.jsx)(Mp,{className:`sr-only`,children:`Navigation`}),(0,$.jsx)(Vp,{...t,onNavigate:e,headerAction:(0,$.jsx)(Dp,{asChild:!0,children:(0,$.jsx)(H,{variant:`ghost`,size:`icon`,"aria-label":`Close menu`,className:`-mr-2 size-11`,children:(0,$.jsx)(wt,{className:`size-[17px]`,"aria-hidden":`true`})})})})]})}function Vp({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,$.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,$.jsxs)(`div`,{className:`flex items-center gap-[9px] px-3.5 pt-3.5 pb-2.5`,children:[(0,$.jsx)(Kp,{}),(0,$.jsx)(`span`,{className:`text-[15px] font-semibold`,children:`cezar`}),n&&!l?(0,$.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,$.jsx)(`div`,{className:X(`shrink-0`,(!n||l)&&`ml-auto`),children:f}):null]}),(0,$.jsxs)(`div`,{className:`flex gap-1.5 px-2.5 pt-1 pb-2`,children:[(0,$.jsx)(H,{asChild:!0,variant:`contrast`,className:`relative min-w-0 flex-1 justify-center`,children:(0,$.jsxs)(Z,{to:`/new`,onClick:d,children:[(0,$.jsx)(sr,{className:`size-[15px]`,"aria-hidden":`true`}),`New task`,(0,$.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,$.jsx)(Up,{})]}),l?(0,$.jsx)(`div`,{"data-slot":`project-groups`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain px-1.5 pb-2`,children:(0,$.jsx)(Ip.Provider,{value:d,children:l})}):(0,$.jsxs)($.Fragment,{children:[(0,$.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,$.jsxs)(Z,{to:t.to,onClick:d,"aria-current":n?`page`:void 0,className:X(`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,$.jsx)(a,{className:`size-4 shrink-0`,"aria-hidden":`true`}),t.label,t.badge===`inbox-count`&&r?(0,$.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,$.jsxs)(`span`,{"data-slot":`nav-update-marker`,className:`ml-auto flex items-center`,children:[(0,$.jsx)(`span`,{className:`size-1.5 rounded-full bg-violet`,"aria-hidden":`true`}),(0,$.jsx)(`span`,{className:`sr-only`,children:`Skills update available`})]}):null]},t.to)})}),(0,$.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,$.jsxs)(`div`,{"data-slot":`sidebar-footer`,className:`flex flex-wrap items-center gap-2 gap-y-1.5 border-t border-border px-3.5 py-2.5`,children:[(0,$.jsx)(`div`,{"data-slot":`tools-menu`,children:c}),a?(0,$.jsx)(Gp,{version:a,latestVersion:o}):null,(0,$.jsx)(Wp,{}),(0,$.jsx)(Hp,{onNavigate:d,className:`ml-auto`}),(0,$.jsx)(md,{})]})]})}function Hp({className:e,onNavigate:t}){return(0,$.jsx)(H,{asChild:!0,variant:`ghost`,size:`icon`,className:X(`size-7`,e),children:(0,$.jsx)(h,{to:`/settings/global`,"data-slot":`global-settings-link`,"aria-label":`Global settings`,title:`Global settings`,onClick:t,children:(0,$.jsx)(ur,{className:`size-4`,"aria-hidden":`true`})})})}function Up(){let[e,t]=Q.useState(!1),[n,r]=Q.useState(!1);return(0,$.jsxs)(_p,{children:[(0,$.jsx)(vp,{asChild:!0,children:(0,$.jsx)(H,{variant:`outline`,size:`icon`,"aria-label":`Add project`,title:`Add project`,className:`size-11 shrink-0 md:size-9`,children:(0,$.jsx)(Vn,{className:`size-4`,"aria-hidden":`true`})})}),(0,$.jsxs)(yp,{align:`start`,className:`w-56`,children:[(0,$.jsx)(Cp,{className:`text-xs text-soft-foreground`,children:`Add project`}),(0,$.jsxs)(bp,{"data-slot":`add-project-local`,onSelect:()=>t(!0),children:[(0,$.jsx)(Un,{"aria-hidden":`true`}),`Open local folder…`]}),(0,$.jsxs)(bp,{"data-slot":`add-project-clone`,onSelect:()=>r(!0),children:[(0,$.jsx)(Gu,{"aria-hidden":`true`}),`Clone from GitHub…`]})]}),e?(0,$.jsx)(Vu,{open:!0,onOpenChange:t}):null,n?(0,$.jsx)(Wu,{open:!0,onOpenChange:r}):null]})}function Wp(){return(0,$.jsxs)(`button`,{type:`button`,"data-slot":`command-palette-hint`,title:`Command palette (⌘K / Ctrl+K)`,"aria-label":`Open the command palette`,onClick:()=>pp(),className:`flex items-center gap-1 rounded-full border border-border px-1.5 py-px font-mono text-[10px] font-medium text-soft-foreground transition-colors hover:bg-muted hover:text-foreground`,children:[(0,$.jsx)(lr,{className:`size-[9px]`,"aria-hidden":`true`}),`⌘K`]})}function Gp({version:e,latestVersion:t}){let n=!!(t&&t!==e);return(0,$.jsxs)(`span`,{"data-slot":`version-chip`,"data-update-available":n?`true`:void 0,title:n?`update available: v${t}`:void 0,className:`flex 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,$.jsx)(Qu,{tone:`pending`,pulse:!0,className:`size-[5px]`}):null,`v`,e]})}function Kp(){return(0,$.jsx)(`img`,{src:Pp,alt:``,"aria-hidden":`true`,"data-slot":`brand-tile`,className:`size-[26px] shrink-0 rounded-sm`})}function qp({title:e}){return(0,$.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,$.jsxs)(`div`,{className:`flex h-[52px] items-center gap-2.5 px-3`,children:[(0,$.jsx)(Ep,{asChild:!0,children:(0,$.jsx)(H,{variant:`ghost`,size:`icon`,"aria-label":`Open menu`,className:`-ml-1.5 size-11`,children:(0,$.jsx)(Zn,{className:`size-[17px]`,"aria-hidden":`true`})})}),(0,$.jsx)(`span`,{className:`truncate text-[14.5px] font-semibold`,children:e}),(0,$.jsx)(`div`,{"data-slot":`mobile-status`,className:`ml-auto flex items-center gap-2`})]})})}var Jp=Q.createContext(null);function Yp({children:e}){let[t,n]=Q.useState(`active`),r=Q.useMemo(()=>[t,n],[t]);return(0,$.jsx)(Jp.Provider,{value:r,children:e})}function Xp(){let e=Q.useContext(Jp);if(!e)throw Error(`useListView must be used inside a <ListViewProvider>`);return e}var Zp=[`claude`,`codex`,`opencode`],Qp={claude:`Claude Code`,codex:`Codex`,opencode:`OpenCode`};function $p(e){if(typeof e!=`object`||!e||Array.isArray(e))return{};let t=e,n={};for(let e of Zp){let r=t[e];typeof r==`string`&&r.length>0&&r.length<=128&&(n[e]=r)}return n}function em(e,t){if(!e)return[];let n=new Map(e.providers.map(e=>[e.provider,e]));return Zp.flatMap(e=>{let r=n.get(e);return r?.status!==`disconnected`||!r.authFailureId||t[e]===r.authFailureId?[]:[{provider:e,label:Qp[e],authFailureId:r.authFailureId}]})}function tm(e,t){return{...e,...Object.fromEntries(t.map(({provider:e,authFailureId:t})=>[e,t]))}}function nm({status:e,pending:t,error:n,dismissals:r,onDismissAuthFailures:i}){if(t||!e)return null;let a;try{a=f(e)}catch{return null}let o=em(a,r);if(o.length>0)return(0,$.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,$.jsx)(Qu,{tone:`danger`}),(0,$.jsxs)(`span`,{children:[`Provider authentication failed during a task:`,` `,o.map(({label:e})=>e).join(`, `),`.`]}),(0,$.jsx)(Z,{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,$.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,$.jsx)(wt,{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,$.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,$.jsx)(Qu,{tone:c?`danger`:`pending`}),(0,$.jsx)(`span`,{children:s?`No agent provider is enabled.`:c?`No connected provider could be verified.`:`No agent provider credentials were found.`}),(0,$.jsx)(Z,{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 rm(e){if(!(typeof e!=`object`||!e||Array.isArray(e)))return e}function im(){let e=ge(),t=p(),n=V(),r=(0,Q.useRef)(Promise.resolve()),i=(0,Q.useRef)(0),a=(0,Q.useRef)(0),o=(0,Q.useRef)(rm(t.data));(0,Q.useEffect)(()=>{a.current===0&&(o.current=rm(t.data))},[t.data]);let s=(0,Q.useCallback)(e=>{let t=B.uiState,s=rm(n.getQueryData(t)),c=tm($p(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 Ne({dismissedProviderAuthFailures:c});o.current=rm(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,$.jsx)(nm,{status:e.data,pending:e.isPending,error:e.isError,dismissals:$p(rm(t.data)?.dismissedProviderAuthFailures),onDismissAuthFailures:s})}function am({stat:e,className:t}){return(0,$.jsxs)(`span`,{"data-slot":`diff-stat`,title:`+${e.adds} −${e.dels} across ${e.files} ${e.files===1?`file`:`files`}`,className:X(`font-mono text-xs font-semibold tabular-nums`,t),children:[(0,$.jsxs)(`span`,{className:`text-success`,children:[`+`,e.adds]}),` `,(0,$.jsxs)(`span`,{className:`text-danger`,children:[`−`,e.dels]})]})}function om({reference:e,taskTitle:t,className:n,compact:r=!1}){let{kind:i,number:a,url:o}=e,s=X(`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||!xt(o)?(0,$.jsx)(`span`,{"data-slot":i===`PR`?`pr-chip`:`issue-chip`,className:s,children:c}):(0,$.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:X(s,`hover:bg-violet/10`),children:[c,(0,$.jsx)(Dn,{className:`size-2.5`,"aria-hidden":`true`})]})}var sm=new Set([`running`,`waiting`]),cm=new Set([`done`,`failed`,`review`,`cancelled`]),lm=new Set([`done`,`failed`,`cancelled`]);function um(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 dm(e){return e?`$${e>=10?e.toFixed(0):e.toFixed(2)}`:``}function fm(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 pm(e,t){let n=t.trim().toLowerCase();return n?e.filter(e=>[$f(e),e.branch??``,e.workflow,fm(e)].some(e=>e.toLowerCase().includes(n))):[...e]}function mm(e){return e.filter(e=>!e.archived&&lm.has(e.status)).length}function hm(e){return e.pullRequestUrl??e.referencedPullRequestUrl}function gm(e){return e.referencedIssueUrl}function _m(e){let t=hm(e),n=t?Number(vm(t)):e.prNumber;if(n&&Number.isInteger(n))return{kind:`PR`,number:n,...t?{url:t}:{}};let r=gm(e),i=e.issueNumber??(r?Number(vm(r)):void 0);if(i&&Number.isInteger(i))return{kind:`Issue`,number:i,...r?{url:r}:{}}}function vm(e){let t=e.split(`/`).pop()??``;return/^\d+$/.test(t)?t:null}function ym(e,t){let n=sm.has(e.status)?t:void 0;if(n)return{cpu:{text:`${n.cpuPct.toFixed(0)}%`,kind:`live`},mem:{text:um(n.rssBytes),kind:`live`}};let r=um(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 bm(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=>cm.has(e.status))?[]:[{groupId:e,title:ep(n),count:t.length}]})}function xm(e){let[t,n]=Q.useState(()=>Date.now());return Q.useEffect(()=>{let t=setInterval(()=>n(Date.now()),e);return()=>clearInterval(t)},[e]),t}function Sm({runs:e,view:t,onViewChange:n,currentRunId:r=null,now:i=Date.now()}){let a=ap(e),o=rp(e,t);return(0,$.jsxs)(`div`,{"data-slot":`quick-list`,children:[(0,$.jsx)(`div`,{className:`sticky top-0 z-10 bg-sidebar pt-2 pb-1`,children:(0,$.jsxs)(`div`,{className:`inline-flex w-full gap-0.5 rounded-md bg-muted p-[3px]`,children:[(0,$.jsxs)(wm,{view:`active`,current:t,onSelect:n,count:a.active,children:[`Active`,a.waiting>0&&t!==`active`?(0,$.jsx)(Qu,{tone:`pending`,pulse:!0,"data-slot":`waiting-dot`,"aria-label":`needs you`}):null]}),(0,$.jsx)(wm,{view:`archived`,current:t,onSelect:n,count:a.archived,children:`Archived`})]})}),o.length===0?(0,$.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,$.jsx)(Cm,{buckets:o,currentRunId:r,now:i})]})}function Cm({buckets:e,currentRunId:t=null,now:n=Date.now(),scope:r=null}){let[i,a]=Q.useState(()=>new Set),o=e=>a(t=>{let n=new Set(t);return n.delete(e)||n.add(e),n});return(0,$.jsx)($.Fragment,{children:e.map(e=>(0,$.jsxs)(`div`,{"data-slot":`quick-list-bucket`,"data-bucket":e.label,children:[(0,$.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,$.jsx)(Tm,{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 wm({view:e,current:t,onSelect:n,count:r,children:i}){let a=e===t;return(0,$.jsxs)(`button`,{type:`button`,"data-slot":`view-tab`,"data-view":e,"aria-pressed":a,onClick:()=>n(e),className:X(`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,$.jsx)(`span`,{className:`font-mono text-[11px] tabular-nums`,children:r}):null]})}function Tm({row:e,currentRunId:t,now:n,scope:r,expanded:i,onToggle:a}){return e.kind===`run`?(0,$.jsx)(Em,{run:e.run,queuePosition:e.queuePosition,currentRunId:t,now:n,scope:r}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`flex items-center rounded-sm hover:bg-muted`,children:[(0,$.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,$.jsx)(Mn,{className:X(`size-3 shrink-0 text-soft-foreground transition-transform`,!i&&`-rotate-90`),"aria-hidden":`true`}),(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[13px] font-medium`,children:e.title}),(0,$.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,$.jsx)(Z,{to:Ft(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,$.jsx)(cr,{className:`size-3.5`,"aria-hidden":`true`})})]}),i?e.members.map(e=>(0,$.jsx)(Em,{run:e,queuePosition:null,currentRunId:t,now:n,scope:r,variant:!0},e.id)):null]})}function Em({run:e,queuePosition:t,currentRunId:n,now:r,scope:i,variant:a=!1}){let o=Cf(e),s=e.id===n,c=hm(e),l=a?``:t===null?Tf(e.finishedAt??e.createdAt,r):`#${t}`;return(0,$.jsxs)(`div`,{"data-slot":`task-row`,"data-run-id":e.id,"data-active":s?`true`:void 0,className:X(`flex items-center rounded-sm hover:bg-muted`,s&&`bg-muted`,a&&`pl-4`),children:[(0,$.jsxs)(Z,{to:Ft(i,`/tasks/${e.id}`),title:$f(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,$.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,$.jsx)(Qu,{tone:o.tone,pulse:o.pulse,"aria-label":o.label,role:`img`}),(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[13px] font-medium`,children:a?Dm(e):$f(e)}),e.diffStat?(0,$.jsx)(am,{stat:e.diffStat,className:`shrink-0 text-[10.5px]`}):null,c||!l?null:(0,$.jsx)(`span`,{className:`shrink-0 text-[11px] text-soft-foreground tabular-nums`,children:l})]}),c&&xt(c)?(0,$.jsx)(om,{reference:{kind:`PR`,...vm(c)?{number:Number(vm(c))}:{},url:c},taskTitle:$f(e),compact:!0,className:`mr-2.5 h-auto shrink-0 gap-[3px] px-1.5 py-px text-[10.5px]`}):null]})}function Dm(e){let t=[e.runner??`claude`];return e.tokensUsed>0&&t.push(Ef(e.tokensUsed)),t.join(` · `)}function Om(){let e=Ze(),[t,n]=Xp(),r=zt(`/tasks/:id/*`),i=zt(`/tasks/:id`),a=xm(3e4);return e.data?(0,$.jsx)(Sm,{runs:e.data,view:t,onViewChange:n,currentRunId:r?.params.id??i?.params.id??null,now:a}):null}var km=10,Am=400;function jm(e,t,n){let r=e?.[t];return r===void 0?t!==n:r}function Mm(e){let t=V(),n=p().data?.sidebar?.collapsed,r=Q.useRef(null),i=Q.useRef(null),a=Q.useCallback(()=>{i.current=null;let e=r.current;e&&(r.current=null,Ne({sidebar:e}).then(e=>t.setQueryData(B.uiState,e)).catch(e=>{U(e instanceof Error?e.message:String(e),{tone:`danger`}),t.invalidateQueries({queryKey:B.uiState})}))},[t]);return Q.useEffect(()=>()=>{i.current!==null&&(clearTimeout(i.current),a())},[a]),{collapsed:n,toggle:Q.useCallback(n=>{let o=t.getQueryData(B.uiState),s=o?.sidebar?.collapsed,c={...o?.sidebar,collapsed:{...s,[n]:!jm(s,n,e)}};t.setQueryData(B.uiState,{...o,sidebar:c}),r.current=c,i.current!==null&&clearTimeout(i.current),i.current=setTimeout(a,Am)},[e,a,t])}}function Nm({projects:e,bootProjectId:t,forgeAvailable:n=!1,inboxAvailable:r=!1,inboxCount:i=null,skillsUpdateAvailable:a=!1}){let{pathname:o}=L(),s=Rt(o)??t,{collapsed:c,toggle:l}=Mm(s),[u]=Xp(),d=Yu(Vt(o)),f=zt(`/tasks/:id/*`),p=zt(`/tasks/:id`),m=f?.params.id??p?.params.id??null,h=xm(3e4);return(0,$.jsx)(`div`,{"data-slot":`project-group-list`,children:Q.useMemo(()=>[...e].sort((e,t)=>t.lastOpenedAt.localeCompare(e.lastOpenedAt)),[e]).map(e=>(0,$.jsx)(Pm,{project:e,boot:e.id===t,active:e.id===s,collapsed:jm(c,e.id,s),onToggle:l,view:u,activeTo:d,currentRunId:m,now:h,forgeAvailable:n,inboxAvailable:r,inboxCount:i,skillsUpdateAvailable:a},e.id))})}function Pm({project:e,boot:t,active:n,collapsed:r,onToggle:i,view:a,activeTo:o,currentRunId:s,now:c,forgeAvailable:l,inboxAvailable:u,inboxCount:d,skillsUpdateAvailable:f}){let p=e.status===`missing`,m=O(e.id,!r&&!p,t),h=Lp(),g=m.data?ap(m.data).waiting:0,_=m.data?ip(rp(m.data,a),km):[];if(p)return(0,$.jsx)(`div`,{"data-slot":`project-group`,"data-project":e.id,"data-status":`missing`,className:`mb-1`,children:(0,$.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,$.jsx)(`span`,{className:`w-3 shrink-0`,"aria-hidden":`true`}),(0,$.jsx)(`span`,{className:`truncate`,children:e.name}),(0,$.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 v=`project-group-${e.id}`;return(0,$.jsxs)(`div`,{"data-slot":`project-group`,"data-project":e.id,"data-status":e.status,"data-collapsed":r?``:void 0,className:`mb-1`,children:[(0,$.jsxs)(`button`,{type:`button`,onClick:()=>i(e.id),"aria-expanded":!r,"aria-controls":v,"data-slot":`project-group-header`,className:X(`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,$.jsx)(Mn,{className:X(`size-3 shrink-0 text-muted-foreground transition-transform`,r&&`-rotate-90`),"aria-hidden":`true`}),(0,$.jsx)(`span`,{className:`truncate`,children:e.name}),g?(0,$.jsx)(`span`,{"data-slot":`project-attention`,title:`${g} task${g===1?``:`s`} need${g===1?`s`:``} you`,className:`shrink-0 rounded-full bg-violet px-1.5 py-px text-[10.5px] font-semibold text-violet-foreground`,children:g}):null,e.branch?(0,$.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,$.jsxs)(`div`,{id:v,"data-slot":`project-group-body`,className:`mt-1 ml-[14px] border-l border-border pl-2`,children:[(0,$.jsx)(`nav`,{"aria-label":`${e.name} navigation`,children:qu({forge:l,inbox:u}).map(t=>{let r=n&&t.to===o,i=t.icon;return(0,$.jsxs)(Z,{to:Ft(e.id,t.to),onClick:h,"aria-current":r?`page`:void 0,className:X(`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,$.jsx)(i,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),t.label,t.badge===`inbox-count`&&n&&d?(0,$.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:d}):null,t.badge===`skills-update`&&n&&f?(0,$.jsxs)(`span`,{"data-slot":`nav-update-marker`,className:`ml-auto flex items-center`,children:[(0,$.jsx)(`span`,{className:`size-1.5 rounded-full bg-violet`,"aria-hidden":`true`}),(0,$.jsx)(`span`,{className:`sr-only`,children:`Skills update available`})]}):null]},t.to)})}),(0,$.jsx)(Cm,{buckets:_,currentRunId:n?s:null,now:c,scope:e.id}),(0,$.jsx)(Z,{to:Ft(e.id,`/`),onClick:h,"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 Fm(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 Im(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 Lm({health:e}){if(!e)return null;let t=e.checks.every(e=>e.available);return(0,$.jsxs)(_p,{children:[(0,$.jsx)(vp,{asChild:!0,children:(0,$.jsxs)(`button`,{type:`button`,"data-slot":`tools-menu-trigger`,title:Fm(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,$.jsx)(Qu,{tone:t?`success`:`pending`}),`Tools`,(0,$.jsx)(Mn,{className:`size-[11px]`,"aria-hidden":`true`})]})}),(0,$.jsxs)(yp,{side:`top`,align:`start`,"data-slot":`tools-menu-content`,className:`w-[240px]`,children:[(0,$.jsx)(Cp,{className:`text-[11px] font-semibold tracking-[.04em] text-soft-foreground uppercase`,children:`Installed tools`}),e.checks.map(e=>e.available?(0,$.jsx)(Rm,{check:e},e.name):(0,$.jsx)(zm,{check:e},e.name)),Im(e)?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(wp,{}),(0,$.jsx)(`p`,{"data-slot":`forge-note`,className:`px-2 py-1.5 text-[11px] leading-snug text-muted-foreground`,children:Im(e)})]}):null,(0,$.jsx)(wp,{}),(0,$.jsx)(bp,{asChild:!0,children:(0,$.jsxs)(Z,{to:`/settings/agents`,"data-slot":`tools-settings`,className:`gap-2 text-[12.5px] text-muted-foreground`,children:[(0,$.jsx)(ur,{className:`size-3.5`,"aria-hidden":`true`}),`Tool settings`]})})]})]})}function Rm({check:e}){return(0,$.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,$.jsx)(Qu,{tone:`success`}),(0,$.jsx)(`span`,{className:`font-mono text-[12.5px] font-medium`,children:e.name}),(0,$.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 zm({check:e}){return(0,$.jsx)(bp,{asChild:!0,children:(0,$.jsxs)(Z,{to:`/settings/agents`,"data-slot":`tool-row`,"data-tool":e.name,"data-available":`false`,className:`flex-col items-stretch gap-1`,children:[(0,$.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(Qu,{tone:`danger`}),(0,$.jsx)(`span`,{className:`font-mono text-[12.5px] font-medium`,children:e.name}),(0,$.jsx)(`span`,{"data-slot":`tool-version`,className:`ml-auto font-mono text-[11.5px] font-medium text-muted-foreground`,children:`not found`})]}),(0,$.jsxs)(`span`,{className:`flex items-end justify-between gap-3 pl-[15px]`,children:[e.hint?(0,$.jsx)(`span`,{"data-slot":`tool-hint`,className:`min-w-0 text-[11px] leading-snug text-muted-foreground`,children:e.hint}):null,(0,$.jsx)(`span`,{"data-slot":`tool-setup`,className:`ml-auto shrink-0 text-[11.5px] font-semibold text-violet`,children:`Set up →`})]})]})})}function Bm(e){return e?.trim()||null}function Vm({projectName:e,pageLabel:t}){let n=Bm(e),r=Bm(t);return n&&r?`${n} — ${r} · cezar`:n?`${n} · cezar`:r?`${r} · cezar`:`cezar`}function Hm(e){let t=Vm(e);(0,Q.useEffect)(()=>{document.title=t},[t])}function Um(){return(0,$.jsx)(`div`,{"data-route":`compare`,className:`flex min-h-full flex-col`,children:(0,$.jsx)(G,{icon:(0,$.jsx)(I,{className:`motion-safe:animate-spin`}),tone:`neutral`,title:`Loading variants…`,subtitle:`Fetching every variant's status, spend and diff summary.`})})}function Wm(){return(0,$.jsx)(`div`,{"data-route":`github`,className:`flex min-h-full flex-col`,children:(0,$.jsx)(G,{icon:(0,$.jsx)(I,{className:`motion-safe:animate-spin`}),tone:`neutral`,title:`Loading GitHub…`,subtitle:`Fetching open issues and pull requests.`})})}function Gm(e,t,n=24){return[t,...(e??[]).filter(e=>!(e.source===t.source&&e.ref===t.ref))].slice(0,n)}var Km=[{id:`claude`,label:`claude`,desc:`Claude Code CLI`},{id:`codex`,label:`codex`,desc:`OpenAI Codex (app-server)`},{id:`opencode`,label:`opencode`,desc:`OpenCode (serve)`}],qm={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 Jm(e,t){return!e||qm[t].some(t=>t.id===e)?!1:Object.entries(qm).some(([n,r])=>n!==t&&r.some(t=>t.id!==``&&t.id===e))}function Ym(e,t,n=[]){let r=[...qm[e]??qm.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)||Jm(t,e)||(i.add(t),r.push({id:t,label:t,desc:`Custom or legacy model`}));return r}function Xm(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 Zm(e){let t=Km.map(e=>e.id).filter(t=>e.some(e=>e.name===t&&e.available));return t.length>0?t:[`claude`]}function Qm(e,t,n){return e!==null&&t.includes(e)?e:t.includes(n)?n:t[0]??`claude`}function $m(e,t,n,r){let i=Ym(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 eh(e,t,n){return e.source===`skill`?t.some(t=>t.name===e.ref):n.some(t=>t.name===e.ref)}function th(e,t,n){for(let r of e)if(r&&eh(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 nh(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 rh(e){let t=`runs`in e?e.runs[0]:e;return t?`/tasks/${t.id}`:`/`}var ih=`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`,ah=(0,$.jsx)(Mn,{"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`});function oh({slot:e,ariaLabel:t,label:n,value:r,options:i,onPick:a,disabled:o=!1,hint:s,disabledHint:c,status:l}){let u=(0,$.jsxs)(`button`,{type:`button`,"data-slot":e,"aria-label":t,disabled:o,title:o?c:s,className:ih,children:[n,ah]});return o?(0,$.jsx)(`span`,{title:c,className:`inline-flex`,children:u}):(0,$.jsxs)(_p,{children:[(0,$.jsx)(vp,{asChild:!0,children:u}),(0,$.jsxs)(yp,{align:`start`,"data-testid":`${e}-menu`,children:[(0,$.jsx)(xp,{value:r,onValueChange:a,children:i.map(e=>(0,$.jsx)(Sp,{value:e.value,className:`gap-2.5`,children:(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,$.jsx)(`span`,{className:`text-[12.5px] font-medium`,children:e.label}),e.desc?(0,$.jsx)(`span`,{className:`text-[11.5px] text-muted-foreground`,children:e.desc}):null]})},e.value))}),l?(0,$.jsx)(bp,{disabled:!0,className:`border-t border-border text-[11.5px] text-muted-foreground`,children:l}):null]})]})}function sh({runners:e,value:t,onPick:n,disabled:r=!1}){return(0,$.jsx)(oh,{slot:`runner-pill`,ariaLabel:`Runner`,label:t,value:t,disabled:r,onPick:e=>n(e),options:Km.filter(t=>e.includes(t.id)).map(e=>({value:e.id,label:e.label,desc:e.desc}))})}function ch(e){let t=C(),n=ge(),r=re(),i=rt(),a=de(n.data),o=t.data?.defaultRunner,s=Qm(e.runner,a,o??a[0]??`claude`);return{runner:s,model:$m(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 lh(e){return{runner:e.defaultRunner!==void 0&&e.runner===e.defaultRunner?void 0:e.runner,model:e.model||void 0}}function uh({pick:e,onChange:t,disabled:n=!1}){let{runner:r,model:i,runners:a,canRun:o}=ch(e),s=re(),c=rt(),l=Ym(r,c.data,[e.model,s.data?.defaultModels?.[r]]),u=n||!o;return(0,$.jsxs)($.Fragment,{children:[a.length>1?(0,$.jsx)(sh,{runners:a,value:r,disabled:u,onPick:e=>t({runner:e,model:null})}):null,(0,$.jsx)(oh,{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:Xm(r,c.data,c.isError)})]})}function dh(e){let t=e.visualViewport;return t?Math.max(0,Math.round(e.innerHeight-t.height-t.offsetTop)):0}function fh(e,t,n,r=250){let i=e.visualViewport;if(!i)return t(0),()=>{};let a,o=()=>{let i=dh(e);t(i),n&&(clearTimeout(a),a=setTimeout(()=>n(i),r))};return t(dh(e)),i.addEventListener(`resize`,o),i.addEventListener(`scroll`,o),()=>{clearTimeout(a),i.removeEventListener(`resize`,o),i.removeEventListener(`scroll`,o),t(0)}}function ph(e){let t=e.visualViewport;return t?{top:Math.max(0,Math.round(t.offsetTop)),bottom:dh(e)}:{top:0,bottom:0}}function mh(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 hh(e,t){let n=e.visualViewport;if(!n)return t({top:0,bottom:0}),()=>{};let r=()=>t(ph(e));return r(),n.addEventListener(`resize`,r),n.addEventListener(`scroll`,r),()=>{n.removeEventListener(`resize`,r),n.removeEventListener(`scroll`,r)}}function gh(){let[e,t]=(0,Q.useState)({top:0,bottom:0});return(0,Q.useEffect)(()=>hh(window,e=>t(t=>t.top===e.top&&t.bottom===e.bottom?t:e)),[]),e}function _h(e){let t=(0,Q.useRef)(e);t.current=e,(0,Q.useEffect)(()=>{let e=document.documentElement;return fh(window,t=>e.style.setProperty(`--kb`,`${t}px`),e=>t.current?.(e))},[])}function vh({...e}){return(0,$.jsx)(uu,{"data-slot":`popover`,...e})}function yh({...e}){return(0,$.jsx)(fu,{"data-slot":`popover-trigger`,...e})}function bh({className:e,align:t=`center`,sideOffset:n=4,collisionPadding:r,...i}){let a=gh();return(0,$.jsx)(pu,{children:(0,$.jsx)(mu,{"data-slot":`popover-content`,align:t,sideOffset:n,collisionPadding:mh(a,r),className:X(`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 xh({...e}){return(0,$.jsx)(du,{"data-slot":`popover-anchor`,...e})}function Sh({templates:e,onInsert:t,triggerClassName:n,disabled:r,iconOnly:i=!1}){let[a,o]=(0,Q.useState)(!1),s=(0,Q.useRef)(null),c=It();return e.length===0?null:(0,$.jsxs)(vh,{open:a,onOpenChange:o,children:[(0,$.jsx)(yh,{asChild:!0,children:(0,$.jsxs)(`button`,{type:`button`,"data-slot":`prompt-template-trigger`,"aria-label":`Insert a prompt template`,title:`Insert a prompt template`,disabled:r,className:X(`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,$.jsx)(tr,{"aria-hidden":`true`,className:`size-3 shrink-0 text-violet`}),i?null:(0,$.jsxs)($.Fragment,{children:[`templates`,(0,$.jsx)(Mn,{"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})]})}),(0,$.jsx)(bh,{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,$.jsxs)(df,{filter:zf,children:[(0,$.jsx)(pf,{placeholder:`search templates…`,onInput:()=>s.current?.scrollTo(0,0)}),(0,$.jsxs)(mf,{ref:s,"data-slot":`prompt-template-list-menu`,className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[(0,$.jsx)(hf,{children:`Nothing matches.`}),(0,$.jsx)(gf,{heading:`Insert a template`,children:e.map(e=>(0,$.jsxs)(vf,{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,$.jsxs)(`span`,{className:`flex w-full items-center gap-1.5`,children:[(0,$.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,$.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,$.jsx)(dr,{"aria-hidden":`true`,className:`size-2.5`}),e.skills.length]}):null]}),(0,$.jsx)(`span`,{className:`line-clamp-1 text-[11px] text-soft-foreground`,children:e.text})]},e.id))}),(0,$.jsx)(_f,{}),(0,$.jsx)(gf,{children:(0,$.jsx)(vf,{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 Ch=80,wh=2e3,Th=50,Eh=200,Dh=50,Oh=[{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 kh(e){return!!e&&typeof e==`object`}function Ah(e){if(e===void 0||!Array.isArray(e))return Oh.map(e=>({...e}));let t=new Set,n=[];for(let r of e){if(!kh(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=jh(r.skills);if(n.push({id:e,label:i.slice(0,Ch),text:a.slice(0,wh),...o.length>0?{skills:o}:{}}),n.length>=Th)break}return n}function jh(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,Eh)),t.size>=Dh))break}return[...t]}function Mh(e,t){if(t.length===0)return[];let n=new Set(t);return e.filter(e=>e.skills?.some(e=>n.has(e)))}function Nh(e,t){return Mh(e,t).map(e=>e.text).join(`
3
+
4
+ `)}function Ph(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 Fh(){return`tpl-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`}function Ih(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(`
5
+
6
+ `)?``:i.endsWith(`
7
+ `)?`
8
+ `:`
9
+
10
+ `);let s=a.replace(/^[ \t]+/,``),c=``;return s.length>0&&(c=s.startsWith(`
11
+
12
+ `)?``:s.startsWith(`
13
+ `)?`
14
+ `:`
15
+
16
+ `),{text:i+o+n+c+s,caret:i.length+o.length+n.length}}var Lh=Cf({status:`waiting`});function Rh(e){return e.filter(e=>!e.startedTaskId)}function zh(e){return e.runnable??!!(e.suggestedSkill||e.suggestedPrompt)}function Bh(){let e=C(),t=e.data?.capabilities.followups===!0,n=e.data!==void 0&&!t,r=ft(!n),i=Ze(),a=r.data===void 0?void 0:Rh(r.data);return(0,$.jsxs)(`div`,{"data-route":`inbox`,className:`flex min-h-full flex-col`,children:[(0,$.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,$.jsx)(`h1`,{className:`text-base font-semibold`,children:`Inbox`}),(0,$.jsx)(`p`,{className:`text-[13px] text-soft-foreground`,children:n?`Disabled for this server; per-task Notes still run.`:`Follow-ups agents suggested when they finished a task.`})]}),(0,$.jsx)(`div`,{className:`flex flex-1 flex-col p-3 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-5 md:pb-5`,children:n?(0,$.jsx)(G,{icon:(0,$.jsx)(Jn,{}),tone:`neutral`,title:`The follow-up inbox is off`,subtitle:`Agents are not asked to leave follow-ups. Set CEZ_FOLLOWUPS=1 and restart cezar to turn the inbox on.`,heading:`h2`}):a===void 0?r.isError?(0,$.jsx)(G,{icon:(0,$.jsx)(Ct,{}),tone:`danger`,title:`Could not load the inbox`,subtitle:r.error.message,heading:`h2`}):null:a.length===0?e.isPending?null:(0,$.jsx)(G,{icon:(0,$.jsx)(Jn,{}),tone:`neutral`,title:`Inbox empty`,subtitle:`Agents drop follow-up suggestions here when they finish a task.`,heading:`h2`}):(0,$.jsx)(`ul`,{"data-slot":`todo-list`,className:`mx-auto flex w-full max-w-3xl flex-col gap-2.5`,children:a.map(e=>(0,$.jsx)(Vh,{todo:e,sourceTaskExists:e.taskId===void 0?null:i.data?.some(t=>t.id===e.taskId)??!1},e.id))})})]})}function Vh({todo:e,sourceTaskExists:t}){let n=It(),r=V(),i=yt(),[a,o]=(0,Q.useState)({runner:null,model:null}),c=ch(a),[l,u]=(0,Q.useState)(!1),[d,f]=(0,Q.useState)(``),p=(0,Q.useRef)(null),m=Ah(i.data?.promptTemplates),h=e=>{let t=p.current?.selectionStart??d.length,n=Ih(d,t,e);f(n.text),requestAnimationFrame(()=>{p.current?.focus(),p.current?.setSelectionRange(n.caret,n.caret)})},g=z({mutationFn:async()=>c.canRun?vt(e.id,{...lh(c),prompt:d.trim()||void 0}):null,onSuccess:e=>{if(e===null)return;let{run:t}=e;r.invalidateQueries({queryKey:s.todos}),r.invalidateQueries({queryKey:s.runs.all}),n(`/tasks/${t.id}`)},onError:e=>U(e.message,{tone:`danger`})}),_=z({mutationFn:()=>Ve(e.id),onSuccess:()=>{r.setQueryData(s.todos,t=>t?.filter(t=>t.id!==e.id)),r.invalidateQueries({queryKey:s.todos})},onError:e=>U(e.message,{tone:`danger`})}),v=g.isPending||_.isPending,y=zh(e);return(0,$.jsxs)(`li`,{"data-slot":`todo-card`,"data-id":e.id,className:`flex flex-col gap-2.5 rounded-lg border border-border bg-card p-4 shadow-xs`,children:[(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,$.jsx)(Qu,{tone:Lh.tone,pulse:Lh.pulse,title:Lh.label,className:`mt-[5px]`}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`p`,{"data-slot":`todo-summary`,className:`text-sm leading-snug font-medium text-foreground`,children:e.summary}),(0,$.jsxs)(`div`,{"data-slot":`todo-meta`,className:`mt-1.5 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-soft-foreground`,children:[e.ts?(0,$.jsxs)(`span`,{children:[Tf(e.ts),` ago`]}):null,e.action?(0,$.jsx)(`span`,{children:e.action}):null,e.taskId===void 0?null:t?(0,$.jsx)(Z,{to:`/tasks/${e.taskId}`,"data-slot":`todo-source`,className:`text-muted-foreground underline decoration-border underline-offset-2 hover:text-foreground`,children:`source task`}):(0,$.jsx)(`span`,{"data-slot":`todo-source-gone`,children:`source task deleted`}),xt(e.prUrl)?(0,$.jsx)(`a`,{href:e.prUrl,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`todo-pr`,className:`text-muted-foreground underline decoration-border underline-offset-2 hover:text-foreground`,children:`PR`}):null,e.suggestedSkill?(0,$.jsxs)(`span`,{"data-slot":`todo-skill`,className:`font-mono`,children:[`skill: `,e.suggestedSkill]}):null]})]}),(0,$.jsx)(`div`,{className:`flex shrink-0 items-center gap-1.5 self-center`,children:y?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(H,{type:`button`,variant:`contrast`,size:`sm`,"data-action":`todo-run`,title:`Start a task from this follow-up`,disabled:v||!c.canRun,onClick:()=>g.mutate(),children:[(0,$.jsx)(or,{"aria-hidden":`true`,className:`size-3`}),`Run`]}),(0,$.jsx)(H,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`todo-dismiss`,title:`Check off (remove)`,disabled:v,onClick:()=>_.mutate(),children:`Dismiss`})]}):(0,$.jsxs)(H,{type:`button`,variant:`contrast`,size:`sm`,"data-action":`todo-acknowledge`,title:`Acknowledge and remove this note`,disabled:v,onClick:()=>_.mutate(),children:[(0,$.jsx)(Ge,{"aria-hidden":`true`,className:`size-3`}),`Acknowledge`]})})]}),y?(0,$.jsxs)(`div`,{"data-slot":`todo-engine`,className:`flex flex-wrap items-center gap-2 pl-5`,children:[(0,$.jsx)(uh,{pick:a,onChange:o,disabled:v||!c.canRun}),!c.providerPending&&!c.canRun?(0,$.jsxs)(`span`,{"data-slot":`todo-provider-gate`,className:`inline-flex flex-wrap items-center gap-1 text-xs text-muted-foreground`,children:[c.providerError?`Provider authentication could not be verified.`:`Connect an agent provider to run this follow-up.`,(0,$.jsx)(Z,{to:`/settings/agents#providers`,className:`font-medium text-foreground underline underline-offset-4`,children:`Configure providers`})]}):null]}):null,y?l?(0,$.jsxs)(`div`,{"data-slot":`todo-instructions`,className:`flex flex-col gap-2 pl-5`,children:[(0,$.jsx)(Tt,{ref:p,"data-slot":`todo-instructions-input`,"aria-label":`Extra instructions for this follow-up`,value:d,onChange:e=>f(e.target.value),placeholder:`Add instructions for the agent… (appended to the suggestion above)`,maxLength:2e4,className:`min-h-16 text-[13px]`}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(Sh,{templates:m,onInsert:h}),(0,$.jsx)(`button`,{type:`button`,"data-slot":`todo-instructions-hide`,onClick:()=>u(!1),className:`text-xs font-medium text-muted-foreground underline decoration-border underline-offset-2 hover:text-foreground`,children:`Hide`})]})]}):(0,$.jsx)(`button`,{type:`button`,"data-slot":`todo-instructions-toggle`,onClick:()=>u(!0),className:`self-start pl-5 text-xs font-medium text-muted-foreground underline decoration-border underline-offset-2 hover:text-foreground`,children:d.trim()?`Edit instructions (added)`:`+ Add instructions`}):null]})}function Hh(e){return!(e.key!==`Enter`||e.shiftKey||e.altKey||e.repeat||e.isComposing)}function Uh(e=typeof navigator>`u`?``:navigator.platform){return/mac|iphone|ipad|ipod/i.test(e)?`⌘↵`:`Ctrl+↵`}async function Wh(e){let t=new Uint8Array(await e.arrayBuffer()),n=``;for(let e=0;e<t.length;e+=32768)n+=String.fromCharCode(...t.subarray(e,e+32768));let r=btoa(n);return{mediaType:e.type,data:r,preview:`data:${e.type};base64,${r}`,name:e.name||`pasted image`}}function Gh(e,t){let n=[],r=[],i=t;for(let t of e)if(t.type.startsWith(`image/`)){if(t.size>5242880){r.push(`${t.name||`image`} is too large (max 5 MB)`);continue}if(i>=4){r.push(`${t.name||`image`} skipped — max 4 images per message`);continue}n.push(t),i+=1}return{accepted:n,rejected:r}}var Kh=new Set([`/`,`@`]);function qh(e,t){for(let n=t-1;n>=0;--n){let r=e[n];if(/\s/.test(r))return null;if(Kh.has(r))return n>0&&!/\s/.test(e[n-1])?null:{trigger:r,start:n,query:e.slice(n+1,t)}}return null}function Jh(e,t,n,r){let i=`${t.trigger}${r} `;return{text:e.slice(0,t.start)+i+e.slice(n),caret:t.start+i.length}}function Yh(){let e=window;return e.SpeechRecognition??e.webkitSpeechRecognition}function Xh(e,t){let n=e,r=``;for(let e=t.resultIndex;e<t.results.length;e+=1){let i=t.results[e],a=i[0]?.transcript??``;i.isFinal?n+=a:r+=a}return{finalText:n,interim:r}}function Zh(e){let[t,n]=Q.useState(null),r=Q.useRef(null),i=Q.useRef(``),[a]=Q.useState(()=>Yh()!==void 0),o=Q.useCallback(()=>{let e=r.current;r.current=null,i.current=``,n(null),e&&(e.onresult=null,e.onerror=null,e.onend=null,e.abort())},[]);return Q.useEffect(()=>o,[o]),{supported:a,recording:t,start:Q.useCallback(()=>{if(r.current)return;let t=Yh();if(!t)return;let a;try{a=new t,a.lang=navigator.language||`en-US`,a.continuous=!0,a.interimResults=!0;let s=Date.now();a.onresult=e=>{let t=Xh(i.current,e);i.current=t.finalText,n({transcript:t.finalText+t.interim,startedAt:s})},a.onerror=t=>{e(`Dictation failed${t.error?` — ${t.error}`:``}`),o()},a.start(),r.current=a,n({transcript:``,startedAt:s})}catch{e(`Dictation failed — the microphone could not be started`),o()}},[e,o]),cancel:Q.useCallback(()=>o(),[o]),finish:Q.useCallback(()=>{let e=r.current,a=(i.current+``).trim()===``?``:i.current,o=t?.transcript??a;return e&&(e.onresult=null,e.onerror=null,e.onend=null,e.stop()),r.current=null,i.current=``,n(null),o.trim()},[t])}}function Qh(e,t){let n=Math.max(0,Math.floor((t-e)/1e3));return`${Math.floor(n/60)}:${String(n%60).padStart(2,`0`)}`}var $h={KeyA:`Yes, approved.`,KeyC:`Continue.`};function eg({onSubmit:e,value:t,onValueChange:n,autoFocus:r=!1,footerStart:i,footerEnd:a,sendAriaLabel:o=`Send`,disabled:c=!1,disabledReason:l=`Session closed — Continue to reopen.`,allowEmptySubmit:u=!1,placeholder:d=`Reply — / for skills, @ for files…`,ariaLabel:f=`Reply to the agent`,autocompleteSkills:p=!0,quickReplies:m=!1,getMentionCandidates:h,ref:g}){let[_,v]=(0,Q.useState)(``),y=t??_,b=(0,Q.useRef)(y);b.current=y;let x=(0,Q.useRef)(n);x.current=n;let S=(0,Q.useCallback)(e=>{let t=typeof e==`function`?e(b.current):e;v(t),x.current?.(t)},[]),[C,w]=(0,Q.useState)([]),T=(0,Q.useRef)(C);T.current=C;let[E,D]=(0,Q.useState)(!1),[O,k]=(0,Q.useState)(null),[A,j]=(0,Q.useState)(``),[M,ee]=(0,Q.useState)(!1),N=(0,Q.useRef)(null),P=(0,Q.useRef)(null),F=(0,Q.useRef)(null),I=ze(p&&M),te=yt(),ne=V(),re=Zh(e=>U(e,{tone:`danger`}));(0,Q.useEffect)(()=>{r&&N.current?.focus()},[]),(0,Q.useImperativeHandle)(g,()=>({insertAtCaret:e=>{let t=N.current,n=Ih(b.current,t?.selectionStart??b.current.length,e);S(n.text),F.current=n.caret,t?.focus()}}),[S]);let L=(0,Q.useCallback)(()=>{let e=N.current;if(!e||c){k(null);return}let t=qh(e.value,e.selectionStart??e.value.length);if(t?.trigger===`/`&&!p||t?.trigger===`@`&&h===void 0)return k(null);t?.trigger===`/`&&ee(!0),k(t)},[p,c,h]),ie=(0,Q.useMemo)(()=>O===null?[]:O.trigger===`/`?Jf(I.data??[],O.query,te.data?.skillUsage).map(e=>({value:`${e.name} ${e.path}`,insert:e.name,label:e.name,description:e.description,emphasized:Of(e)})):(h?.()??[]).filter(e=>Ff(e,O.query)).map(e=>({value:e,insert:e,label:e,emphasized:!1})),[h,I.data,O,te.data?.skillUsage]),R=ie.some(e=>e.value===A)?A:ie[0]?.value,ae=O!==null,z=(0,Q.useCallback)(()=>k(null),[]),oe=e=>{let t=N.current;if(!t||O===null)return;let n=t.selectionStart??t.value.length,r=Jh(t.value,O,n,e.insert);O.trigger===`/`&&te.data!==void 0&&Je({skillUsage:Pf(te.data.skillUsage,e.insert)}).then(()=>ne.invalidateQueries({queryKey:s.uiState})).catch(()=>{}),S(r.text),F.current=r.caret,k(null),t.focus()};(0,Q.useLayoutEffect)(()=>{let e=F.current,t=N.current;e!==null&&t&&(t.setSelectionRange(e,e),F.current=null)},[y]),(0,Q.useLayoutEffect)(()=>{let e=N.current;e&&(e.style.height=`auto`,e.style.height=`${Math.min(e.scrollHeight,220)}px`)},[y]);let se=(0,Q.useCallback)(e=>{if(c)return;let t=Gh(e,T.current.length);for(let e of t.rejected)U(e,{tone:`danger`});for(let e of t.accepted)Wh(e).then(e=>w(t=>t.length>=4?t:[...t,e]))},[c]),ce=e=>{let t=[...e.clipboardData?.items??[]].filter(e=>e.type.startsWith(`image/`)).map(e=>e.getAsFile()).filter(e=>e!==null);t.length!==0&&(e.preventDefault(),se(t))},le=e=>{let t=[...e.dataTransfer?.files??[]];t.length!==0&&(e.preventDefault(),se(t))},ue=(0,Q.useCallback)(async(t,n,r)=>{let i=t.trim();if(!(c||E)&&!(i===``&&n.length===0&&!u)){D(!0);try{await e(i,n.map(({mediaType:e,data:t})=>({mediaType:e,data:t})))}catch(e){U(e instanceof Error?e.message:String(e),{tone:`danger`}),r&&(S(e=>e===``?t:`${t}\n${e}`),w(e=>[...n,...e].slice(0,4)))}finally{D(!1)}}},[u,E,c,e]),de=(0,Q.useCallback)(()=>{if(y.trim()===``&&C.length===0&&!u)return;let e=y,t=C;S(``),w([]),k(null),ue(e,t,!0)},[u,C,ue,y]),B=e=>{if(ae){if(e.key===`ArrowDown`||e.key===`ArrowUp`){if(e.preventDefault(),ie.length===0)return;let t=ie.findIndex(e=>e.value===R),n=e.key===`ArrowDown`?1:-1,r=ie[(t+n+ie.length)%ie.length];j(r.value);return}if(e.key===`Escape`){e.preventDefault(),z();return}if((e.key===`Enter`||e.key===`Tab`)&&!e.shiftKey){let t=ie.find(e=>e.value===R);if(t){e.preventDefault(),oe(t);return}z()}}Hh({key:e.key,shiftKey:e.shiftKey,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,repeat:e.repeat,isComposing:e.nativeEvent.isComposing})&&(e.preventDefault(),de())};(0,Q.useEffect)(()=>{if(!m||c)return;let e=e=>{if(!e.altKey||e.metaKey||e.ctrlKey||e.repeat)return;let t=$h[e.code];t!==void 0&&(e.preventDefault(),ue(t,[],!1))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[c,m,ue]);let fe=e=>{let t=re.finish();if(t===``)return;let n=y.trim()===``?t:`${y.replace(/\s*$/,``)} ${t}`;if(e){S(``),w([]),ue(n,C,!0);return}S(n),F.current=n.length,N.current?.focus()},pe=re.recording;return(0,$.jsxs)(vh,{open:ae,onOpenChange:e=>e?void 0:z(),children:[(0,$.jsx)(xh,{asChild:!0,children:(0,$.jsxs)(`div`,{ref:P,"data-slot":`composer`,"data-disabled":c||void 0,onDrop:le,onDragOver:e=>e.preventDefault(),className:X(`rounded-xl border border-border bg-card shadow-xs transition-[border-color,box-shadow]`,`focus-within:border-ring focus-within:ring-[3px] focus-within:ring-ring/15`,c&&`opacity-80`),children:[C.length>0?(0,$.jsx)(`div`,{"data-slot":`composer-thumbs`,className:`flex flex-wrap gap-2 px-4 pt-3`,children:C.map((e,t)=>(0,$.jsxs)(`button`,{type:`button`,"aria-label":`Remove ${e.name}`,title:`Click to remove`,className:`group relative size-12 overflow-hidden rounded-md border border-border`,onClick:()=>w(e=>e.filter((e,n)=>n!==t)),children:[(0,$.jsx)(`img`,{src:e.preview,alt:``,className:`size-full object-cover`}),(0,$.jsx)(`span`,{className:`absolute inset-0 hidden items-center justify-center bg-background/70 group-hover:flex group-focus-visible:flex`,children:(0,$.jsx)(wt,{"aria-hidden":`true`,className:`size-4`})})]},`${e.name}-${t}`))}):null,(0,$.jsx)(`textarea`,{ref:N,rows:2,value:y,disabled:c,"aria-label":f,placeholder:c?l:d,className:`block max-h-[220px] min-h-[54px] w-full resize-none bg-transparent px-4 pt-3 pb-1 text-base leading-normal outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed md:text-sm`,onChange:e=>{S(e.target.value),L()},onKeyDown:B,onSelect:L,onPaste:ce}),pe?(0,$.jsx)(ng,{transcript:pe.transcript,startedAt:pe.startedAt,onCancel:re.cancel,onInsert:()=>fe(!1),onInsertAndSend:()=>fe(!0)}):(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1 gap-y-1.5 px-2 pt-1.5 pb-2`,children:[(0,$.jsxs)(`div`,{"data-slot":`composer-footer-start`,className:`flex min-w-0 flex-wrap items-center gap-1`,children:[(0,$.jsx)(tg,{disabled:c,onFiles:se}),i]}),(0,$.jsxs)(`div`,{className:`ml-auto flex items-center gap-1`,children:[re.supported?(0,$.jsxs)(H,{type:`button`,variant:`ghost`,size:`sm`,disabled:c,"aria-label":`Start dictation`,title:`Dictation`,className:`h-8 gap-1.5 px-2.5 text-xs font-medium text-muted-foreground`,onClick:re.start,children:[(0,$.jsx)(Qn,{"aria-hidden":`true`,className:`size-3.5`}),`Dictation`]}):null,a?(0,$.jsx)(`div`,{"data-slot":`composer-footer-end`,className:`flex items-center gap-1.5`,children:a}):null,(0,$.jsx)(H,{type:`button`,size:`icon-sm`,"aria-label":o,disabled:c||E||y.trim()===``&&C.length===0&&!u,className:`size-8`,onClick:de,children:(0,$.jsx)(On,{"aria-hidden":`true`})})]})]})]})}),(0,$.jsx)(bh,{side:`top`,align:`start`,sideOffset:8,className:`w-80 max-w-[calc(100vw-2rem)] p-0`,onOpenAutoFocus:e=>e.preventDefault(),onInteractOutside:e=>{P.current?.contains(e.target)&&e.preventDefault()},children:(0,$.jsx)(df,{shouldFilter:!1,value:R??``,onValueChange:j,children:(0,$.jsx)(mf,{"data-slot":`composer-menu`,"data-trigger":O?.trigger,className:`max-h-[min(16rem,var(--radix-popover-content-available-height))] p-1`,children:ie.length===0?(0,$.jsx)(`p`,{className:`px-3 py-4 text-center text-xs text-muted-foreground`,children:O?.trigger===`@`?`No files seen in this session yet — full file search arrives with the Files tab.`:I.isPending?`Loading skills…`:`No matching skills.`}):ie.map(e=>(0,$.jsxs)(vf,{value:e.value,"data-slot":`composer-menu-item`,"data-emphasized":e.emphasized||void 0,onSelect:()=>oe(e),children:[(0,$.jsx)(`span`,{className:X(`shrink-0 truncate`,e.emphasized&&`font-semibold`,O?.trigger===`@`&&`font-mono text-xs`),children:e.label}),e.description?(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null]},e.value))})})})]})}function tg({disabled:e,onFiles:t}){let n=(0,Q.useRef)(null);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(H,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Attach images`,title:`Attach an image (or paste a screenshot)`,disabled:e,className:`size-8 text-muted-foreground`,onClick:()=>n.current?.click(),children:(0,$.jsx)(ir,{"aria-hidden":`true`,className:`size-[15px]`})}),(0,$.jsx)(`input`,{ref:n,type:`file`,accept:`image/*`,multiple:!0,className:`hidden`,"aria-hidden":`true`,tabIndex:-1,onChange:e=>{t([...e.target.files??[]]),e.target.value=``}})]})}function ng({transcript:e,startedAt:t,onCancel:n,onInsert:r,onInsertAndSend:i}){let a=xm(1e3);return(0,$.jsxs)(`div`,{"data-slot":`dictation-overlay`,role:`status`,"aria-label":`Dictation in progress`,className:`flex items-center gap-2.5 rounded-b-xl border-t border-border bg-muted/60 px-3 py-2`,children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,className:`size-2 flex-none animate-pulse rounded-full bg-danger motion-reduce:animate-none`}),(0,$.jsx)(`span`,{"data-slot":`dictation-timer`,className:`text-xs font-medium text-muted-foreground tabular-nums`,children:Qh(t,a)}),(0,$.jsx)(`span`,{"data-slot":`dictation-transcript`,"aria-live":`polite`,className:`min-w-0 flex-1 truncate text-sm text-foreground`,children:e===``?(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:`Listening…`}):e}),(0,$.jsx)(H,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Cancel dictation`,className:`size-8 text-muted-foreground`,onClick:n,children:(0,$.jsx)(wt,{"aria-hidden":`true`})}),(0,$.jsx)(H,{type:`button`,variant:`outline`,size:`icon-sm`,"aria-label":`Insert transcription`,className:`size-8`,onClick:r,children:(0,$.jsx)(Ge,{"aria-hidden":`true`})}),(0,$.jsx)(H,{type:`button`,size:`icon-sm`,"aria-label":`Insert transcription and send`,className:`size-8`,onClick:i,children:(0,$.jsx)(On,{"aria-hidden":`true`})})]})}var rg={name:`cezar-syn`,type:`dark`,fg:`var(--syn-var)`,bg:`transparent`,settings:[{scope:[`keyword`,`storage`,`constant.language`,`variable.language`,`entity.other.attribute-name`,`support.type.property-name`],settings:{foreground:`var(--syn-key)`}},{scope:[`string`,`punctuation.definition.string`],settings:{foreground:`var(--syn-str)`}},{scope:[`entity.name.function`,`support.function`,`entity.name.tag`,`entity.name.type`,`entity.name.class`,`support.class`,`support.type`],settings:{foreground:`var(--syn-fn)`}},{scope:[`comment`,`punctuation.definition.comment`],settings:{foreground:`var(--syn-com)`}},{scope:[`constant.numeric`,`constant.character`,`constant.other`,`support.constant`,`keyword.other.unit`],settings:{foreground:`var(--syn-num)`}},{scope:[`punctuation`,`keyword.operator`,`meta.brace`,`punctuation.separator`,`punctuation.terminator`],settings:{foreground:`var(--syn-punc)`}},{scope:[`variable`,`entity.name.variable`],settings:{foreground:`var(--syn-var)`}}]},ig={typescript:()=>J(()=>import(`./typescript-bsJCZSQ-.js`),[]),tsx:()=>J(()=>import(`./tsx-udAQXfEw.js`),[]),javascript:()=>J(()=>import(`./javascript-BgS3c2Ky.js`),[]),jsx:()=>J(()=>import(`./jsx-Bz0zcwM4.js`),[]),json:()=>J(()=>import(`./json-qhed-kSA.js`),[]),jsonc:()=>J(()=>import(`./jsonc-CYpm1nAK.js`),[]),shellscript:()=>J(()=>import(`./shellscript-CLZ0U2zV.js`),[]),python:()=>J(()=>import(`./python-gzcpVVnB.js`),[]),markdown:()=>J(()=>import(`./markdown-BYOwaDjH.js`),[]),css:()=>J(()=>import(`./css-BsVw1vtW.js`),[]),html:()=>J(()=>import(`./html-BY76lXLH.js`),__vite__mapDeps([0,1,2])),diff:()=>J(()=>import(`./diff-woXpYk--.js`),[]),yaml:()=>J(()=>import(`./yaml-rwi0_p6S.js`),[]),toml:()=>J(()=>import(`./toml-CcmNWLt0.js`),[]),go:()=>J(()=>import(`./go-rLFTqkRN.js`),[]),rust:()=>J(()=>import(`./rust-Cfkwpbl8.js`),[]),sql:()=>J(()=>import(`./sql-BsFa4tDR.js`),[])},ag={ts:`typescript`,js:`javascript`,mjs:`javascript`,cjs:`javascript`,bash:`shellscript`,sh:`shellscript`,shell:`shellscript`,zsh:`shellscript`,console:`shellscript`,py:`python`,md:`markdown`,yml:`yaml`,golang:`go`,rs:`rust`,vue:`html`,xml:`html`},og=new Set([``,`plaintext`,`text`,`txt`,`plain`]);function sg(e){let t=e.trim().toLowerCase();return t in ig?t:ag[t]??null}function cg(e){return og.has(e.trim().toLowerCase())}function lg(){return[...Object.keys(ig),...Object.keys(ag),...og].filter(e=>e!==``)}function ug(e){let t=e.slice(e.lastIndexOf(`/`)+1),n=t.lastIndexOf(`.`);if(n<=0)return null;let r=t.slice(n+1).toLowerCase();return sg({mts:`typescript`,cts:`typescript`,htm:`html`}[r]??r)}var dg=null,fg=null,pg=new Set,mg=new Map;function hg(){return fg??=Promise.all([J(()=>import(`./core-BCsw8oQw.js`),__vite__mapDeps([3,4,5])),J(()=>import(`./engine-javascript-FQvzRocB.js`),[])]).then(async([{createHighlighterCore:e},{createJavaScriptRegexEngine:t}])=>(dg=await e({themes:[rg],langs:[],engine:t({forgiving:!0})}),dg)),fg}function gg(e){let t=sg(e);if(t===null||pg.has(t))return Promise.resolve();let n=mg.get(t);return n||(n=hg().then(async e=>{await e.loadLanguage(await ig[t]()),pg.add(t)}).catch(()=>{mg.delete(t)}),mg.set(t,n)),n}function _g(e){return{tokens:e.split(`
17
+ `).map(e=>[{content:e}]),fg:`var(--syn-var)`,bg:`transparent`}}function vg(e,t,n={}){if(cg(t))return _g(e);let r=sg(t);if(r===null)return _g(e);if(!dg||!pg.has(r))return null;try{let t=dg.codeToTokens(e,{lang:r,theme:rg.name,tokenizeTimeLimit:n.tokenizeTimeLimit});return{tokens:t.tokens.map(e=>e.map(({content:e,color:t})=>({content:e,color:t}))),fg:t.fg??`var(--syn-var)`,bg:`transparent`}}catch{return _g(e)}}async function yg(e,t,n={}){return vg(e,t,n)||(await gg(t),vg(e,t,n)??_g(e))}var bg={name:`shiki`,type:`code-highlighter`,getThemes:()=>[rg,rg],getSupportedLanguages:()=>lg(),supportsLanguage:e=>lg().includes(String(e).toLowerCase()),highlight:({code:e,language:t},n)=>vg(e,String(t))||(yg(e,String(t)).then(e=>n?.(e)),null)};function xg(){let e=t=>{if(!t.children)return;let n=[];for(let r of t.children)if(r.type===`text`&&r.value?.includes(`
18
+ `)){let e=r.value.split(/\r?\n/);e.forEach((t,r)=>{r>0&&!(t===``&&r===e.length-1)&&n.push({type:`break`}),t&&n.push({type:`text`,value:t})})}else e(r),n.push(r);t.children=n};return e}var Sg=[...Object.values(Kt),xg],Cg=[`p`,`strong`,`em`,`del`,`code`,`a`],wg={p:`span`,a:`span`},Tg=(0,Q.memo)(function({children:e,breaks:t=!1,inline:n=!1}){return(0,$.jsx)(Gt,{className:n?`thread-markdown thread-markdown-inline`:`thread-markdown`,plugins:{code:bg},shikiTheme:[rg,rg],remarkPlugins:t?Sg:void 0,allowedElements:n?Cg:void 0,unwrapDisallowed:n||void 0,components:n?wg:void 0,controls:{code:{copy:!0,download:!1},table:!1,mermaid:!1},lineNumbers:!1,children:e})});function Eg({source:e,className:t}){return(0,$.jsx)(`span`,{"data-slot":`skill-source`,"data-source":e,className:X(`shrink-0 rounded-full border border-border px-2 py-px font-mono text-[10.5px]`,Of({source:e})?`font-semibold text-foreground`:`text-soft-foreground`,t),children:e})}function Dg({skill:e,usedBy:t,heading:n=`h2`}){return(0,$.jsxs)(`div`,{"data-slot":`skill-detail`,className:`min-w-0`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2.5`,children:[(0,$.jsx)(n,{className:`min-w-0 font-mono text-lg font-semibold break-all`,children:e.name}),(0,$.jsx)(Eg,{source:e.source})]}),(0,$.jsxs)(`p`,{"data-slot":`skill-path`,className:`mt-1 font-mono text-[10.5px] break-all text-soft-foreground`,children:[e.path,e.team?` · from ${e.team.repo}`:``]}),e.description?(0,$.jsx)(`p`,{"data-slot":`skill-description`,className:`mt-2.5 text-[13px] text-muted-foreground`,children:e.description}):null,t===void 0?null:(0,$.jsxs)(`section`,{"data-slot":`skill-used-by`,className:`mt-5`,children:[(0,$.jsx)(`h3`,{className:`text-[11px] font-semibold tracking-[.04em] text-soft-foreground uppercase`,children:`Used by`}),t.length>0?(0,$.jsx)(`ul`,{className:`mt-1.5 flex flex-col gap-1`,children:t.map(e=>(0,$.jsxs)(`li`,{className:`flex items-center gap-1.5 font-mono text-xs text-muted-foreground`,children:[(0,$.jsx)(En,{"aria-hidden":`true`,className:`size-3 shrink-0 text-soft-foreground`}),e]},e))}):(0,$.jsx)(`p`,{className:`mt-1.5 text-xs text-soft-foreground`,children:`Not referenced by any workflow yet — quick-task picks it up when the task mentions it.`})]}),(0,$.jsxs)(`section`,{className:`mt-5`,children:[(0,$.jsx)(`h3`,{className:`text-[11px] font-semibold tracking-[.04em] text-soft-foreground uppercase`,children:`Content`}),(0,$.jsx)(`div`,{"data-slot":`skill-body`,className:`mt-2 text-sm`,children:(0,$.jsx)(Tg,{children:e.body})})]})]})}function Og({skill:e,onClose:t}){return(0,$.jsx)(Mu,{open:e!==null,onOpenChange:e=>e?void 0:t(),children:(0,$.jsx)(Iu,{"data-slot":`skill-preview`,className:`block max-h-[80dvh] overflow-y-auto sm:max-w-2xl`,children:e?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(zu,{className:`sr-only`,children:e.name}),(0,$.jsx)(Bu,{className:`sr-only`,children:`Read-only skill preview`}),(0,$.jsx)(Dg,{skill:e,heading:`h3`}),(0,$.jsx)(`p`,{className:`mt-5`,children:(0,$.jsx)(Z,{to:`/skills?skill=${encodeURIComponent(e.name)}`,"data-slot":`skill-preview-manage`,onClick:t,className:`text-xs font-semibold text-violet hover:underline`,children:`Open in the Skills catalog`})})]}):null})})}function kg(e,t,n){let r=e.skill===``?{source:`workflow`,ref:`quick-task`}:{source:`skill`,ref:e.skill};return nh({task:e.ref,source:r,model:``,runner:t,defaultRunner:n,variants:1,images:[],todoId:e.todo})}function Ag(e,t){return e.kind===`failed`?{message:`Auto-start failed: ${e.message} — review and press Start`,tone:`danger`}:e.kind===`blocked`?{message:`Auto-start blocked (bad key) — review and press Start`,tone:`danger`}:t===``?{message:`Prefilled from link — review and press Start`,tone:`default`}:{message:`Unknown skill "${t}" — prefilled for quick-task; review and press Start`,tone:`danger`}}function jg(e,t){return`Use the "${e}" skill on: ${t}`}function Mg(e){let t=e.configuredAutonomous===`source-dependent`?e.source===`skill`:e.configuredAutonomous,n=e.interactive!==!0&&void 0;return{autonomous:e.planFirst?!1:e.explicitAutonomous??n??t,worktree:e.hasGit?e.variants>1||e.forceWorktree===!0?!0:e.explicitWorktree??n??e.configuredWorktree:!1}}var Ng={text:``,source:null,runner:null,model:null,variants:1,planFirst:!1,worktree:null,autonomous:null,generateFollowups:null},Pg=`cez-new-task-draft`;function Fg(e){return e===null?Pg:`${Pg}:${e}`}function Ig(e){let t=e&&typeof e==`object`?e:{};return{text:typeof t.text==`string`?t.text:``,source:Lg(t.source)?t.source:null,runner:typeof t.runner==`string`?t.runner:null,model:typeof t.model==`string`?t.model:null,variants:t.variants===2||t.variants===3?t.variants:1,planFirst:t.planFirst===!0,worktree:typeof t.worktree==`boolean`?t.worktree:null,autonomous:typeof t.autonomous==`boolean`?t.autonomous:null,generateFollowups:typeof t.generateFollowups==`boolean`?t.generateFollowups:null}}function Lg(e){return!!e&&typeof e==`object`&&(e.source===`skill`||e.source===`workflow`)&&typeof e.ref==`string`}var Rg=new Map;function zg(e=null){let t=Fg(e),n=Rg.get(t);if(n)return{...n};let r;try{let e=localStorage.getItem(t);r=e?Ig(JSON.parse(e)):{...Ng}}catch{r={...Ng}}return Rg.set(t,r),{...r}}function Bg(e,t=null){let n=Fg(t);Rg.set(n,{...e});try{localStorage.setItem(n,JSON.stringify(e))}catch{}}function Vg(e=null){Bg({...zg(e),text:``},e)}function Hg(e){let t=typeof e==`string`?new URLSearchParams(e):e;return{skill:(t.get(`skill`)??``).trim(),ref:(t.get(`ref`)??t.get(`task`)??``).trim(),auto:t.get(`auto`)===`1`,key:t.get(`key`)??``,todo:(t.get(`todo`)??``).trim()}}function Ug(e,t,n){return{task:e,steps:[...n.steps],rationale:n.rationale,fallback:n.fallback,images:[...t]}}function Wg(e,t){return!Number.isInteger(t)||t<0||t>=e.length?[...e]:e.filter((e,n)=>n!==t)}function Gg(e,t,n){let r=[...e];if(!Number.isInteger(t)||t<0||t>=r.length)return r;let i=Math.max(0,Math.min(r.length-1,n));if(i===t)return r;let[a]=r.splice(t,1);return r.splice(i,0,a),r}function Kg(e){return e.command??e.prompt??``}function qg(e,t=120){let n=e.split(`
19
+ `)[0]??``;return n.length>t?`${n.slice(0,t-1)}…`:n}function Jg(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 Yg({...e}){return(0,$.jsx)(Hr,{"data-slot":`alert-dialog`,...e})}function Xg({...e}){return(0,$.jsx)(Ur,{"data-slot":`alert-dialog-portal`,...e})}function Zg({className:e,...t}){return(0,$.jsx)(Wr,{"data-slot":`alert-dialog-overlay`,className:X(`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 Qg({className:e,...t}){return(0,$.jsxs)(Xg,{children:[(0,$.jsx)(Zg,{}),(0,$.jsx)(Gr,{"data-slot":`alert-dialog-content`,className:X(`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 $g({className:e,...t}){return(0,$.jsx)(`div`,{"data-slot":`alert-dialog-header`,className:X(`flex flex-col gap-2 text-center sm:text-left`,e),...t})}function e_({className:e,...t}){return(0,$.jsx)(`div`,{"data-slot":`alert-dialog-footer`,className:X(`flex flex-col-reverse gap-2 sm:flex-row sm:justify-end`,e),...t})}function t_({className:e,...t}){return(0,$.jsx)(Jr,{"data-slot":`alert-dialog-title`,className:X(`text-lg leading-none font-semibold`,e),...t})}function n_({className:e,...t}){return(0,$.jsx)(Yr,{"data-slot":`alert-dialog-description`,className:X(`text-sm text-muted-foreground`,e),...t})}function r_({className:e,...t}){return(0,$.jsx)(Kr,{"data-slot":`alert-dialog-action`,className:X(tt({variant:`contrast`}),e),...t})}function i_({className:e,...t}){return(0,$.jsx)(qr,{"data-slot":`alert-dialog-cancel`,className:X(tt({variant:`outline`}),e),...t})}function a_({plan:e,starting:t,startAvailable:n,startUnavailableReason:r,startUnavailableAction:i,onStepsChange:a,onStart:o,onDiscard:s}){let[c,l]=(0,Q.useState)(null),[u,d]=(0,Q.useState)(null),f=()=>{l(null),d(null)},p=(t,n)=>{t.preventDefault(),c!==null&&c!==n&&a(Gg(e.steps,c,n)),f()},m=e.steps.length===0;return(0,$.jsx)(Mu,{open:!0,onOpenChange:e=>e?void 0:s(),children:(0,$.jsxs)(Iu,{"data-slot":`plan-review`,showCloseButton:!1,className:X(`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,$.jsxs)(Lu,{className:`gap-1 border-b border-border px-5 pt-4 pb-3.5 text-left sm:text-left`,children:[(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,$.jsx)(zu,{className:`text-[11px] font-semibold tracking-[0.08em] text-muted-foreground uppercase`,children:`Proposed chain`}),(0,$.jsx)(Pu,{"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,$.jsx)(wt,{"aria-hidden":`true`,className:`size-4`})})]}),(0,$.jsx)(Bu,{"data-slot":`plan-task`,title:e.task,className:`truncate text-[13.5px] font-medium text-foreground`,children:qg(e.task)}),e.fallback?(0,$.jsx)(`p`,{"data-slot":`plan-fallback`,className:`text-xs text-soft-foreground italic`,children:`planner unavailable — single-step plan`}):e.rationale===``?null:(0,$.jsx)(`p`,{"data-slot":`plan-rationale`,className:`text-xs text-muted-foreground`,children:e.rationale})]}),(0,$.jsx)(`ol`,{"data-slot":`plan-steps`,className:`flex-1 space-y-2 overflow-y-auto px-5 py-4`,children:m?(0,$.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,$.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:X(`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,$.jsx)(qn,{"aria-hidden":`true`,className:`size-3.5 shrink-0 cursor-grab text-soft-foreground`}),(0,$.jsx)(`span`,{className:`w-5 shrink-0 font-mono text-[11px] text-soft-foreground tabular-nums`,children:String(n+1).padStart(2,`0`)}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,$.jsx)(`span`,{className:`truncate text-[13px] font-semibold`,children:t.name??t.id}),t.skill?(0,$.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,$.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,$.jsx)(`p`,{className:`truncate font-mono text-[11.5px] text-muted-foreground`,children:Kg(t)})]}),(0,$.jsxs)(`span`,{className:`flex shrink-0 items-center`,children:[(0,$.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(Gg(e.steps,n,n-1)),children:(0,$.jsx)(On,{"aria-hidden":`true`,className:`size-3.5`})}),(0,$.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(Gg(e.steps,n,n+1)),children:(0,$.jsx)(Tn,{"aria-hidden":`true`,className:`size-3.5`})}),(0,$.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(Wg(e.steps,n)),children:(0,$.jsx)(wt,{"aria-hidden":`true`,className:`size-3.5`})})]})]},t.id))}),!n&&r?(0,$.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,$.jsx)(`span`,{children:r}),i]}):null,(0,$.jsxs)(`div`,{className:`flex items-center gap-2 px-5 py-3.5 pb-[max(14px,env(safe-area-inset-bottom))]`,children:[(0,$.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,$.jsx)(or,{"aria-hidden":`true`,className:`size-3.5`}),t?`Starting…`:`Start`]}),(0,$.jsx)(o_,{steps:e.steps,disabled:m}),(0,$.jsx)(H,{type:`button`,variant:`ghost`,className:`ml-auto`,onClick:s,children:`Discard`})]})]})})}function o_({steps:e,disabled:t}){let n=V(),[r,i]=(0,Q.useState)(!1),[a,o]=(0,Q.useState)(``),[c,l]=(0,Q.useState)(!1),[d,f]=(0,Q.useState)(!1),p=async t=>{let r=a.trim();if(!(r===``||d)){f(!0);try{let a=await u({name:r,steps:e,...t?{overwrite:!0}:{}});U(`Saved — ${a.path.split(`/`).pop()??a.path}`),n.invalidateQueries({queryKey:s.workflows}),l(!1),i(!1),o(``)}catch(e){e instanceof v&&e.exists===!0?l(!0):U(e instanceof Error?e.message:String(e),{tone:`danger`})}finally{f(!1)}}};return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(H,{type:`button`,variant:`outline`,"data-slot":`plan-save`,disabled:t,onClick:()=>i(!0),children:`Save as chain`}),(0,$.jsx)(Mu,{open:r,onOpenChange:e=>i(!!e),children:(0,$.jsxs)(Iu,{"data-slot":`plan-save-dialog`,className:`sm:max-w-sm`,showCloseButton:!1,children:[(0,$.jsxs)(Lu,{children:[(0,$.jsx)(zu,{children:`Save as chain`}),(0,$.jsx)(Bu,{children:`Saves these steps as a reusable workflow — it joins the picker like any other chain.`})]}),(0,$.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),p(!1)},children:[(0,$.jsx)(Hu,{value:a,onChange:e=>o(e.target.value),"aria-label":`Chain name`,placeholder:`e.g. fix-and-verify-v2`,maxLength:80,autoFocus:!0}),(0,$.jsxs)(Ru,{className:`mt-4`,children:[(0,$.jsx)(H,{type:`button`,variant:`outline`,onClick:()=>i(!1),children:`Cancel`}),(0,$.jsx)(H,{type:`submit`,disabled:a.trim()===``||d,children:d?`Saving…`:`Save`})]})]})]})}),(0,$.jsx)(Yg,{open:c,onOpenChange:e=>e?void 0:l(!1),children:(0,$.jsxs)(Qg,{"data-slot":`plan-overwrite-dialog`,children:[(0,$.jsxs)($g,{children:[(0,$.jsxs)(t_,{children:[`Overwrite “`,a.trim(),`”?`]}),(0,$.jsx)(n_,{children:`A chain with this name already exists. Overwriting replaces its steps with this plan.`})]}),(0,$.jsxs)(e_,{children:[(0,$.jsx)(i_,{children:`Keep the existing chain`}),(0,$.jsx)(r_,{onClick:()=>void p(!0),children:`Overwrite`})]})]})})]})}function s_(){let[e]=M(),t=It(),n=V(),{projectId:r}=E(),i=Lt().projectId,a=ve(),[o]=(0,Q.useState)(()=>Hg(e)),c=C(),l=_t(),u=ze(),d=et(),f=yt(),p=re(),m=le(),[h,g]=(0,Q.useState)(()=>({...zg(i),...o.ref===``?{}:{text:o.ref},...o.skill===``?{}:{source:{source:`skill`,ref:o.skill}}}));(0,Q.useEffect)(()=>{Bg(h,i)},[h,i]);let _=e=>g(t=>({...t,...e})),v=f.data?.recentSources,y=u.data,b=f.data?.skillUsage,x=(0,Q.useMemo)(()=>Mf(y??[],b),[y,b]),S=l.data?.workflows??[],w=a.data?.projects??[],T=u.data!==void 0&&l.data!==void 0&&!f.isPending,D=th([h.source,f.data?.lastTask],x,S),O=D.source===`workflow`?S.find(e=>e.name===D.ref):void 0,k=D.source===`skill`?x.find(e=>e.name===D.ref):void 0,A=(0,Q.useRef)(null),j=(0,Q.useMemo)(()=>Ah(f.data?.promptTemplates),[f.data?.promptTemplates]),ee=Nh(j,D.source===`skill`?[D.ref]:[]),N=(0,Q.useRef)(h.text);N.current=h.text;let P=(0,Q.useRef)(``);(0,Q.useEffect)(()=>{if(!T)return;let e=Ph(N.current,P.current,ee);P.current=e.applied,e.text!==N.current&&_({text:e.text})},[ee,T]);let F=ge(),I=de(F.data),te=c.data?.defaultRunner,ne=te??`claude`,L=I.length>0?Qm(h.runner,I,ne):null,ie=L??ne,R=F.isSuccess&&I.length>0,ae=rt(),z=L===null?[]:Ym(L,ae.data,[h.model,p.data?.defaultModels?.[L]]),se=L===null?``:$m(h.model,L,p.data?.defaultModels,ae.data),ce=(0,Q.useRef)(!1);(0,Q.useEffect)(()=>{let e=R&&!ce.current;ce.current=R,e&&document.activeElement===document.body&&document.querySelector(`textarea[aria-label="Describe a task for the agent"]`)?.focus()},[R]);let ue=c.data===void 0||c.data.repo!==null,B=ue?h.variants:1,fe=D.source===`skill`||D.ref===`quick-task`||O?.steps.length===1,pe=ue,me=!fe||B>1,he=Mg({hasGit:ue,variants:B,forceWorktree:!fe,planFirst:h.planFirst,explicitAutonomous:h.autonomous,explicitWorktree:h.worktree,interactive:k?.interactive,configuredAutonomous:m.data?.composerDefaults?.autonomous??m.data?.composerDefaults?.inheritedAutonomous??`source-dependent`,configuredWorktree:m.data?.composerDefaults?.worktree??m.data?.composerDefaults?.inheritedWorktree??!0,source:D.source}),_e=he.worktree,ye=he.autonomous,be=c.data===void 0||c.data.capabilities.followups,xe=be?h.generateFollowups??f.data?.lastGenerateFollowups??!0:!1,[Ce,we]=(0,Q.useState)(null),[Te,H]=(0,Q.useState)(!1),[Ee,De]=(0,Q.useState)(!1),[Oe,ke]=(0,Q.useState)(()=>o.auto&&o.ref!==``),[Ae,je]=(0,Q.useState)(()=>!o.auto&&o.ref!==``?{kind:`prefill`}:null),Me=(0,Q.useRef)(!1),Ne=(0,Q.useRef)(!1);(0,Q.useEffect)(()=>{Me.current||(Me.current=!0,e.toString()!==``&&t(`/new`,{replace:!0}))},[]),(0,Q.useEffect)(()=>{if(!Ne.current&&!(!o.auto||o.ref===``)&&!F.isPending){if(!R||L===null){Ne.current=!0,je({kind:`prefill`}),ke(!1);return}if(!c.isPending){if(Ne.current=!0,te===void 0){je({kind:`prefill`}),ke(!1);return}(async()=>{let e=``;try{e=(await Se()).key}catch{}if(e!==``&&o.key===e)try{let e=await oe(kg(o,L,te));Vg(i),n.invalidateQueries({queryKey:s.runs.all}),t(rh(e));return}catch(e){je({kind:`failed`,message:e instanceof Error?e.message:String(e)})}else je({kind:`blocked`});ke(!1)})()}}},[te,c.isPending,F.isPending,R,L]),(0,Q.useEffect)(()=>{if(Ae===null||!T)return;je(null);let e=o.skill!==``&&!x.some(e=>e.name===o.skill)?o.skill:``;e!==``&&_({text:jg(o.skill,o.ref),...S.some(e=>e.name===`quick-task`)?{source:{source:`workflow`,ref:`quick-task`}}:{}});let{message:t,tone:n}=Ag(Ae,e);U(t,{tone:n}),document.querySelector(`[data-slot="composer"] button[aria-label="Start task"], [data-slot="composer"] button[aria-label="Plan task"]`)?.focus()},[Ae,T]);let Pe=async(e,r)=>{if(!R||L===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(!T)throw Error(`Still loading workflows and skills — try again in a second.`);if(h.planFirst){H(!0);try{we(Ug(e,r,await nt(e))),_({text:e})}finally{H(!1)}return}let a=await oe(nh({task:e,source:D,model:se,runner:L,defaultRunner:te,variants:B,images:r,worktree:_e,autonomous:ye,generateFollowups:xe,todoId:o.todo}));Je({lastTask:D,recentSources:Gm(v,D),...be?{lastGenerateFollowups:xe}:{},...D.source===`skill`&&f.data!==void 0?{skillUsage:Pf(f.data.skillUsage,D.ref)}:{}}).then(()=>n.invalidateQueries({queryKey:s.uiState})).catch(()=>{}),Vg(i),n.invalidateQueries({queryKey:s.runs.all}),t(rh(a))},Fe=async()=>{if(!(Ce===null||Ce.steps.length===0||Ee||!R||L===null)){De(!0);try{let e=await oe(Jg({task:Ce.task,steps:Ce.steps,model:se,runner:L,defaultRunner:te,variants:B,images:Ce.images,generateFollowups:xe,todoId:o.todo}));be&&Je({lastGenerateFollowups:xe}).then(()=>n.invalidateQueries({queryKey:s.uiState})).catch(()=>{}),Vg(i),we(null),n.invalidateQueries({queryKey:s.runs.all}),t(rh(e))}catch(e){U(e instanceof Error?e.message:String(e),{tone:`danger`})}finally{De(!1)}}};return Oe?(0,$.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,$.jsx)(Qe,{}),(0,$.jsxs)(`div`,{"data-slot":`auto-starting`,role:`status`,className:`text-center`,children:[(0,$.jsx)(`h1`,{className:`animate-pulse text-lg font-semibold tracking-tight`,children:`Starting task…`}),(0,$.jsx)(`p`,{className:`mt-1.5 text-[13.5px] text-muted-foreground`,children:`Launched from a bookmarklet — taking you to the run.`})]})]}):(0,$.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,$.jsx)(Qe,{}),(0,$.jsxs)(`div`,{className:`w-full max-w-[720px]`,children:[(0,$.jsxs)(`header`,{className:`mb-6 text-center max-md:mb-4`,children:[(0,$.jsx)(`h1`,{className:`text-lg font-semibold tracking-tight max-md:text-base`,children:`What should the agent work on?`}),(0,$.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,$.jsx)(eg,{ref:A,onSubmit:Pe,value:h.text,onValueChange:e=>_({text:e}),autoFocus:!0,placeholder:`Describe a task for the agent — / for skills…`,ariaLabel:`Describe a task for the agent`,sendAriaLabel:h.planFirst?`Plan task`:`Start task`,disabled:!R||Ee,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,$.jsxs)($.Fragment,{children:[w.length>1&&r!==void 0?(0,$.jsx)(f_,{projects:w,projectId:r,onPick:e=>t(`/p/${encodeURIComponent(e)}/new`,{replace:!0})}):null,(0,$.jsx)(p_,{source:D,ready:T,skills:x,skillUsage:b,workflows:S,onPick:e=>_({source:e})}),(0,$.jsx)(Sh,{templates:j,iconOnly:!0,onInsert:e=>A.current?.insertAtCaret(e)}),I.length>1?(0,$.jsx)(sh,{runners:I,value:ie,disabled:!R,onPick:e=>_({runner:e,model:null})}):null,(0,$.jsx)(oh,{slot:`model-pill`,ariaLabel:`Model`,label:z.find(e=>e.id===se)?.label??`auto`,value:se,disabled:!R,onPick:e=>_({model:e}),options:z.map(e=>({value:e.id,label:e.label,desc:e.desc})),status:Xm(ie,ae.data,ae.isError)}),(0,$.jsx)(oh,{slot:`variants-pill`,ariaLabel:`Parallel variants`,label:B>1?`×${B} variants`:`×1`,value:String(B),onPick:e=>_({variants:Number(e)}),disabled:!ue,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`}]}),pe?(0,$.jsx)(c_,{on:_e,disabled:me,disabledReason:B>1?`Parallel variants always use isolated worktrees`:`Multi-step workflows require an isolated worktree`,onChange:e=>_({worktree:e})}):null,(0,$.jsx)(l_,{on:ye,disabled:h.planFirst,onChange:e=>_({autonomous:e})}),k?.interactive&&(h.autonomous===null||h.worktree===null)?(0,$.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,be?(0,$.jsx)(u_,{on:xe,onChange:e=>_({generateFollowups:e})}):null,d.data?(0,$.jsx)(m_,{repo:d.data}):null]}),footerEnd:(0,$.jsxs)($.Fragment,{children:[!R&&!F.isPending?(0,$.jsx)(Z,{to:`/settings/agents#providers`,className:`text-xs font-medium text-foreground underline underline-offset-4`,children:`Configure providers`}):null,(0,$.jsx)(h_,{planFirst:h.planFirst,planning:Te,onModeChange:e=>_({planFirst:e})}),(0,$.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:Uh()})]})}),(0,$.jsx)(__,{onPick:e=>_({text:e})})]}),Ce===null?null:(0,$.jsx)(a_,{plan:Ce,starting:Ee,startAvailable:R,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,$.jsx)(Z,{to:`/settings/agents#providers`,children:`Configure providers`}),onStepsChange:e=>we(t=>t&&{...t,steps:e}),onStart:()=>void Fe(),onDiscard:()=>we(null)})]})}function c_({on:e,disabled:t,disabledReason:n,onChange:r}){return(0,$.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:X(ih,e&&`border-primary/60 text-foreground`),children:[e?(0,$.jsx)(Ge,{"aria-hidden":`true`,className:`size-3 shrink-0 text-primary`}):(0,$.jsx)(fr,{"aria-hidden":`true`,className:`size-3 shrink-0 text-soft-foreground`}),`Worktree`]})}function l_({on:e,disabled:t,onChange:n}){return(0,$.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:X(ih,e&&!t&&`border-primary/60 text-foreground`),children:[e?(0,$.jsx)(Ge,{"aria-hidden":`true`,className:`size-3 shrink-0 text-primary`}):(0,$.jsx)(fr,{"aria-hidden":`true`,className:`size-3 shrink-0 text-soft-foreground`}),`Autonomous`]})}function u_({on:e,onChange:t}){return(0,$.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:X(ih,e&&`border-primary/60 text-foreground`),children:[e?(0,$.jsx)(Ge,{"aria-hidden":`true`,className:`size-3 shrink-0 text-primary`}):(0,$.jsx)(fr,{"aria-hidden":`true`,className:`size-3 shrink-0 text-soft-foreground`}),`Follow-ups`]})}function d_(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 f_({projects:e,projectId:t,onPick:n}){let[r,i]=(0,Q.useState)(!1),[a,o]=(0,Q.useState)(``),s=e.find(e=>e.id===t),c=d_(e,a);return(0,$.jsxs)(vh,{open:r,onOpenChange:e=>{i(e),e||o(``)},children:[(0,$.jsx)(yh,{asChild:!0,children:(0,$.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:X(ih,`border-foreground/60 font-semibold text-foreground`),children:[(0,$.jsx)(Vn,{"aria-hidden":`true`,className:`size-3 shrink-0 text-soft-foreground`}),(0,$.jsx)(`span`,{className:`max-w-40 truncate`,children:s?.name??t}),ah]})}),(0,$.jsx)(bh,{align:`start`,sideOffset:8,className:`w-[300px] max-w-[calc(100vw-2rem)] p-0`,children:(0,$.jsxs)(df,{shouldFilter:!1,children:[(0,$.jsx)(pf,{placeholder:`search projects…`,value:a,onValueChange:o}),(0,$.jsxs)(mf,{"data-slot":`project-menu`,className:`max-h-[min(18rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[c.length===0?(0,$.jsx)(hf,{children:`Nothing matches.`}):null,c.map(e=>(0,$.jsxs)(vf,{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,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs font-medium`,children:e.name}),e.status===`missing`?(0,$.jsx)(`span`,{className:`shrink-0 text-[11px] text-soft-foreground`,children:`folder not found`}):e.branch===void 0?null:(0,$.jsx)(`span`,{className:`shrink-0 font-mono text-[11px] text-soft-foreground`,children:e.branch}),e.id===t?(0,$.jsx)(Ge,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-primary`}):null]},e.id))]}),(0,$.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 p_({source:e,ready:t,skills:n,skillUsage:r,workflows:i,onPick:a}){let[o,s]=(0,Q.useState)(!1),[c,l]=(0,Q.useState)(``),[u,d]=(0,Q.useState)(null),f=(0,Q.useRef)(null),{mostUsed:p,project:m,global:h}=jf(Kf(n,c,r),r),g=qf(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,$.jsxs)(vf,{value:`skill ${t.name} ${t.path}`,keywords:Vf(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,$.jsx)(`span`,{className:X(`shrink-0 font-mono text-xs`,n&&`font-semibold`),children:t.name}),t.description?(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:t.description}):null,(0,$.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,$.jsx)(Rn,{"aria-hidden":`true`,className:`size-3.5`})}),r?(0,$.jsx)(Ge,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-primary`}):null]},t.path)};return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Og,{skill:u,onClose:()=>d(null)}),(0,$.jsxs)(vh,{open:o,onOpenChange:e=>{s(e),e||l(``)},children:[(0,$.jsx)(yh,{asChild:!0,children:(0,$.jsxs)(`button`,{type:`button`,"data-slot":`source-pill`,"aria-label":`Choose a skill or workflow`,disabled:!t,className:X(ih,`border-foreground/60 font-mono text-[11.5px] font-semibold text-foreground`),children:[e.source===`skill`?(0,$.jsx)(dr,{"aria-hidden":`true`,className:`size-3 shrink-0 text-violet`}):(0,$.jsx)(mr,{"aria-hidden":`true`,className:`size-3 shrink-0 text-violet`}),(0,$.jsx)(`span`,{className:`max-w-44 truncate`,children:t?e.ref:`…`}),ah]})}),(0,$.jsx)(bh,{align:`start`,sideOffset:8,className:`w-[336px] max-w-[calc(100vw-2rem)] p-0`,children:(0,$.jsxs)(df,{shouldFilter:!1,children:[(0,$.jsx)(pf,{placeholder:`search skills & workflows…`,value:c,onValueChange:l,onInput:()=>f.current?.scrollTo(0,0)}),(0,$.jsxs)(mf,{ref:f,"data-slot":`source-menu`,className:`max-h-[min(18rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[_?(0,$.jsx)(hf,{children:`Nothing matches.`}):null,p.length>0?(0,$.jsx)(gf,{heading:`Most used`,children:p.map(e=>y(e,Of(e)))}):null,m.length>0?(0,$.jsx)(gf,{heading:`Project skills`,children:m.map(e=>y(e,!0))}):null,g.length>0?(0,$.jsx)(gf,{heading:`Workflows`,children:g.map(t=>{let n=e.source===`workflow`&&e.ref===t.name;return(0,$.jsxs)(vf,{value:`workflow ${t.name}`,keywords:Vf(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,$.jsx)(`span`,{className:`shrink-0 font-mono text-xs`,children:t.name}),t.description?(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:t.description}):null,n?(0,$.jsx)(Ge,{"aria-hidden":`true`,className:`ml-auto size-3.5 shrink-0 text-primary`}):null]},t.name)})}):null,h.length>0?(0,$.jsx)(gf,{heading:`Global`,children:h.map(e=>y(e,!1))}):null]})]})})]})]})}function m_({repo:e}){let t=V(),n=z({mutationFn:e=>je({baseBranch:e}),onSuccess:e=>{t.invalidateQueries({queryKey:s.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,$.jsx)(oh,{slot:`base-pill`,ariaLabel:`Base branch`,label:(0,$.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 h_({planFirst:e,planning:t,onModeChange:n}){return(0,$.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,$.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":!e,onClick:()=>n(!1),className:X(`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,$.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":e,"aria-busy":t||void 0,"data-slot":`mode-plan`,onClick:()=>n(!0),className:X(`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 g_=[`Fix a failing or flaky test`,`Summarize recent commits on this branch`,`Update the README for recent changes`];function __({onPick:e}){return(0,$.jsx)(`div`,{className:`mt-7 flex flex-wrap justify-center gap-2 max-md:justify-start`,children:g_.map(t=>(0,$.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,$.jsx)(dr,{"aria-hidden":`true`,className:`size-3 shrink-0 text-soft-foreground`}),t]},t))})}function v_(){return(0,$.jsx)(`div`,{"data-route":`not-found`,className:`flex min-h-full flex-col`,children:(0,$.jsx)(G,{icon:(0,$.jsx)(In,{}),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,$.jsx)(H,{asChild:!0,variant:`outline`,children:(0,$.jsx)(Z,{to:`/`,children:`Back to tasks`})})})})}function y_(){return(0,$.jsx)(`div`,{"data-route":`repo-git`,className:`flex min-h-full flex-col`,children:(0,$.jsx)(G,{icon:(0,$.jsx)(I,{className:`motion-safe:animate-spin`}),tone:`neutral`,title:`Loading repository…`,subtitle:`Fetching the repo's git state.`})})}function b_(){return(0,$.jsxs)(`div`,{"data-route":`skills`,className:`flex min-h-full flex-col`,children:[(0,$.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,$.jsx)(`h1`,{className:`text-base font-semibold`,children:`Skills`}),(0,$.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Markdown playbooks agents can follow.`})]}),(0,$.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 x_({projectId:e,registry:t}){let n=t.projects.length?t.projects:[{id:t.bootProject,name:t.bootProject}];return(0,$.jsx)(`div`,{"data-route":`unknown-project`,className:`flex min-h-full flex-col`,children:(0,$.jsx)(G,{icon:(0,$.jsx)(Hn,{}),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,$.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,$.jsx)(`li`,{children:(0,$.jsxs)(h,{to:`/p/${encodeURIComponent(e.id)}/`,className:`flex items-baseline gap-2 rounded-md border border-border bg-card px-3 py-2 text-sm font-medium text-foreground shadow-xs transition-colors hover:bg-card-2`,children:[e.name||e.id,(0,$.jsxs)(`span`,{className:`font-mono text-[11px] font-normal text-soft-foreground`,children:[`/p/`,e.id]})]})},e.id))})})})}function S_(){return(0,$.jsx)(`div`,{"data-route":`workflows`,className:`flex min-h-full flex-col`,children:(0,$.jsx)(G,{icon:(0,$.jsx)(I,{className:`motion-safe:animate-spin`}),tone:`neutral`,title:`Loading workflows…`,subtitle:`Fetching the saved chains and the skills palette.`})})}function C_({tab:e}){return(0,$.jsx)(`div`,{"data-route":`task-${e}`,className:`flex min-h-full flex-col`,children:(0,$.jsx)(G,{icon:(0,$.jsx)(I,{className:`motion-safe:animate-spin`}),tone:`neutral`,title:e===`changes`?`Loading changes…`:`Loading files…`,subtitle:`Fetching the run record.`})})}function w_({tab:e,error:t}){let n=t instanceof v&&t.status===404;return(0,$.jsx)(`div`,{"data-route":`task-${e}`,className:`flex min-h-full flex-col`,children:(0,$.jsx)(G,{icon:n?(0,$.jsx)(St,{}):(0,$.jsx)(Ct,{}),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,$.jsx)(H,{asChild:!0,variant:`outline`,children:(0,$.jsx)(Z,{to:`/`,children:`Back to tasks`})})})})}function T_(){return(0,$.jsx)(`div`,{"data-route":`task-thread`,className:`flex min-h-full flex-col`,children:(0,$.jsx)(G,{icon:(0,$.jsx)(I,{className:`motion-safe:animate-spin`}),tone:`neutral`,title:`Loading task…`,subtitle:`Fetching the run and its session transcript.`})})}var E_=1500;function D_(e,t){let n=(0,Q.useMemo)(()=>e.split(`
20
+ `).map(e=>[{content:e}]),[e]),r=(0,Q.useMemo)(()=>sg(t),[t]),i=n.length>E_,[a,o]=(0,Q.useState)(null);return(0,Q.useEffect)(()=>{if(r===null||i)return;let t=!1;return yg(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:vg(e,r)?.tokens??n}var O_=`m-0 min-h-full w-full whitespace-pre font-mono text-xs leading-[1.7] px-3 py-2 [tab-size:2]`;function k_({value:e,onChange:t,language:n,readOnly:r,className:i,...a}){let o=D_(e,n),s=(0,Q.useRef)(null),c=(0,Q.useRef)(null),l=()=>{let e=c.current,t=s.current;!e||!t||(t.scrollTop=e.scrollTop,t.scrollLeft=e.scrollLeft)};return(0,Q.useLayoutEffect)(l,[e]),(0,$.jsxs)(`div`,{"data-slot":`code-editor`,className:X(`relative overflow-hidden rounded-md border border-input bg-card`,i),children:[(0,$.jsx)(`pre`,{ref:s,"aria-hidden":`true`,className:X(O_,`pointer-events-none absolute inset-0 overflow-auto text-soft-foreground`),children:o.map((e,t)=>(0,$.jsx)(`span`,{className:`block`,children:e.length===0?`
21
+ `:(0,$.jsxs)($.Fragment,{children:[e.map((e,t)=>(0,$.jsx)(`span`,{style:e.color===void 0?void 0:{color:e.color},children:e.content},t)),`
22
+ `]})},t))}),(0,$.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:X(O_,`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 A_=`An editor-plus-commit: a saved change reaches a run after you commit it to the base branch.`;function j_(e){return t=>t.runners.includes(e)}function M_(e,t,n,r){let i=j_(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 N_=[{id:`claude`,label:`Claude`,groups:[M_(`claude`,`settings`,`Settings`),M_(`claude`,`mcp`,`MCP`,`A dedicated .mcp.json (key: mcpServers), shared via version control.`),M_(`claude`,`memory`,`Memory & instructions`)]},{id:`codex`,label:`Codex`,note:A_,groups:[M_(`codex`,`settings`,`Settings`),M_(`codex`,`mcp`,`MCP`,`Inside config.toml under [mcp_servers.<id>] — the same file as Codex’s settings.`),M_(`codex`,`memory`,`Memory & instructions`)]},{id:`opencode`,label:`OpenCode`,note:A_,groups:[M_(`opencode`,`settings`,`Settings`),M_(`opencode`,`mcp`,`MCP`,`Under the "mcp" key in opencode.json — the same file as OpenCode’s settings.`),M_(`opencode`,`memory`,`Memory & instructions`)]}];function P_(e){let t=N_.find(t=>t.id===e);if(!t)throw Error(`no agent descriptor for ${e}`);return t}function F_(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 I_(){let e=Ue(),t=C(),n=(0,Q.useMemo)(()=>t.data?Zm(t.data.checks):N_.map(e=>e.id),[t.data]);return e.isPending?(0,$.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,$.jsx)(G,{icon:(0,$.jsx)(zn,{}),tone:`danger`,title:`Agent config did not load`,subtitle:e.error.message,heading:`h2`}):(0,$.jsx)(L_,{listing:e.data,installed:n})}function L_({listing:e,installed:t}){let[n,r]=(0,Q.useState)(`claude`),[i,a]=(0,Q.useState)(null),o=P_(n),s=e.files.find(e=>e.id===i)??null,c=e=>{r(e),a(null)};return(0,$.jsxs)(`div`,{"data-slot":`agent-config`,className:`flex flex-col gap-4 p-4 md:p-6`,children:[!e.editable&&(0,$.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,$.jsx)(`div`,{"data-slot":`agent-config-agents`,role:`tablist`,className:`flex flex-wrap gap-1 rounded-md bg-muted/40 p-1`,children:N_.map(e=>(0,$.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:X(`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,$.jsx)(ju,{variant:`outline`,className:`text-[10px] text-soft-foreground`,children:`not installed`})]},e.id))}),o.note&&(0,$.jsx)(`p`,{"data-slot":`agent-config-agent-note`,className:`text-[12px] text-soft-foreground`,children:o.note}),(0,$.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-[minmax(0,20rem)_minmax(0,1fr)]`,children:[(0,$.jsx)(`nav`,{"data-slot":`agent-config-nav`,className:`flex flex-col gap-5`,children:(0,$.jsx)(R_,{agent:o,listing:e,selectedId:i,onSelect:a})}),(0,$.jsx)(`div`,{"data-slot":`agent-config-editor-pane`,children:s?(0,$.jsx)(B_,{file:s},s.id):(0,$.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 R_({agent:e,listing:t,selectedId:n,onSelect:r}){return(0,$.jsx)($.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,$.jsxs)(`section`,{"data-slot":`agent-config-group`,"data-group":i.id,"data-agent":e.id,children:[(0,$.jsx)(`p`,{className:`mb-1 text-[11px] font-medium uppercase tracking-wide text-soft-foreground`,children:i.label}),i.note&&(0,$.jsx)(`p`,{className:`mb-2 text-[12px] text-soft-foreground`,children:i.note}),(0,$.jsx)(`ul`,{className:`flex flex-col gap-1`,children:a.map(e=>(0,$.jsx)(`li`,{children:(0,$.jsxs)(`button`,{type:`button`,"data-slot":`agent-config-file`,"data-selected":e.id===n,onClick:()=>r(e.id),className:X(`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,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-[12px]`,children:e.label}),e.seeded&&(0,$.jsx)(ju,{variant:`outline`,className:`shrink-0 text-[10px]`,children:`seeded`}),!e.exists&&(0,$.jsx)(`span`,{className:`shrink-0 text-[11px] text-soft-foreground`,children:`absent`})]})},e.id))}),o&&t.userMcp&&(0,$.jsx)(z_,{userMcp:t.userMcp})]},i.id)})})}function z_({userMcp:e}){return(0,$.jsxs)(`div`,{"data-slot":`agent-config-user-mcp`,className:`mt-3`,children:[(0,$.jsx)(`h4`,{className:`mb-1 text-[12px] font-semibold`,children:`User & local scopes`}),(0,$.jsxs)(`p`,{className:`mb-2 text-[12px] text-soft-foreground`,children:[`Managed by `,(0,$.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,$.jsx)(`ul`,{className:`flex flex-wrap gap-1`,children:e.servers.map(e=>(0,$.jsx)(`li`,{children:(0,$.jsx)(ju,{variant:`outline`,className:`font-mono text-[11px]`,children:e})},e))}):(0,$.jsx)(`p`,{className:`text-[12px] text-soft-foreground`,children:`No user-scoped MCP servers.`}):(0,$.jsx)(`p`,{className:`text-[12px] text-soft-foreground`,children:`Could not read the file.`})]})}function B_({file:e}){let t=ee(e.id),n=be(e.id),[r,i]=(0,Q.useState)(null),[a,o]=(0,Q.useState)(!1),[s,c]=(0,Q.useState)(null),l=t.data?.version??null;(0,Q.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,$.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`font-mono text-[13px]`,children:e.label}),(0,$.jsx)(ju,{variant:`outline`,className:`text-[10px] uppercase`,children:e.format}),(0,$.jsx)(`a`,{href:e.docsUrl,target:`_blank`,rel:`noreferrer`,className:`text-[12px] text-soft-foreground underline hover:text-foreground`,children:`docs`})]}),(0,$.jsx)(`p`,{"data-slot":`agent-config-precedence`,className:`text-[12px] text-soft-foreground`,children:e.precedence}),(0,$.jsxs)(`p`,{"data-slot":`agent-config-effect`,className:`text-[12px] text-foreground/80`,children:[F_(e),e.hotReload?` ${e.hotReload}`:``]}),t.isPending?(0,$.jsx)(`p`,{className:`text-[13px] text-soft-foreground`,children:`Loading file…`}):t.isError?(0,$.jsx)(`p`,{className:`text-[13px] text-destructive`,children:t.error.message}):(0,$.jsx)(k_,{value:u,language:e.format,readOnly:!f,onChange:i,"aria-label":`${e.label} contents`,className:`h-[26rem]`}),s&&(0,$.jsx)(`p`,{"data-slot":`agent-config-format-error`,className:`text-[12px] text-destructive`,children:s}),a&&(0,$.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,$.jsx)(`span`,{children:`The file changed on disk since you opened it.`}),(0,$.jsx)(H,{size:`sm`,variant:`outline`,onClick:()=>void t.refetch(),children:`Reload from disk`})]}),f&&(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.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 v&&e.status===409?o(!0):e instanceof v&&e.status===400?c(e.message):U(e.message,{tone:`danger`})}})},disabled:!d||n.isPending,children:e.exists?`Save`:`Create`}),(0,$.jsx)(H,{size:`sm`,variant:`ghost`,onClick:()=>i(null),disabled:!d||n.isPending,children:`Revert`}),d&&(0,$.jsx)(`span`,{className:`text-[12px] text-soft-foreground`,children:`Unsaved changes`})]})]})}function V_({className:e,size:t=`default`,...n}){return(0,$.jsx)(Cu,{"data-slot":`switch`,"data-size":t,className:X(`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,$.jsx)(Tu,{"data-slot":`switch-thumb`,className:X(`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 H_=[{id:`claude`,label:`Claude Code`,login:`claude auth login`},{id:`codex`,label:`Codex`,login:`codex login`},{id:`opencode`,label:`OpenCode`,login:`opencode auth login`}],U_=e=>({claude:e,codex:e,opencode:e}),W_={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 G_(e,t,n){return{providers:e.providers.map(e=>e.provider===t?{...e,enabled:n}:e)}}function K_(){let e=ge(),t=R(),n=Ee(),r=V(),[i,a]=(0,Q.useState)(null),o=(0,Q.useRef)(Promise.resolve()),s=(0,Q.useRef)(U_(0)),c=(0,Q.useRef)(U_(0)),l=(0,Q.useRef)(e.data);(0,Q.useEffect)(()=>{i&&mt(e.data,i.provider)?.status===`connected`&&a(null)},[i,e.data]),(0,Q.useEffect)(()=>{if(e.data){if(Object.values(c.current).every(e=>e===0)||!l.current){l.current=e.data;return}l.current={providers:e.data.providers.map(e=>({...e,enabled:c.current[e.provider]>0?mt(l.current,e.provider)?.enabled??e.enabled:e.enabled}))}}},[e.data]);let u=(0,Q.useCallback)((e,t)=>{let n=B.providerStatus,i=r.getQueryData(n);if(!i)return;l.current||=i;let a=G_(i,e,t);c.current[e]+=1,r.setQueryData(n,a);let u=++s.current[e];o.current=o.current.then(async()=>{try{let i=await dt(e,t),a=mt(i,e)?.enabled;if(a===void 0)return;if(l.current=G_(l.current??i,e,a),u===s.current[e]){let t=r.getQueryData(n);r.setQueryData(n,t?G_(t,e,a):i)}}catch(t){if(u===s.current[e]){let i=mt(l.current,e)?.enabled,a=r.getQueryData(n);a&&i!==void 0?r.setQueryData(n,G_(a,e,i)):l.current?r.setQueryData(n,l.current):r.removeQueries({queryKey:n,exact:!0}),U(t instanceof Error?t.message:String(t),{tone:`danger`})}}finally{--c.current[e]}})},[r]),d=z({mutationFn:ie,onSuccess:async e=>{a(null),U(e.opened?`Finish signing in in the terminal, then check again.`:`Provider is already connected.`),await r.invalidateQueries({queryKey:B.providerStatus})},onError:(e,t)=>{if(e instanceof v&&e.command){let n=H_.find(e=>e.id===t)?.label??t;a({provider:t,label:n,message:e.message,command:e.command});return}U(e.message,{tone:`danger`})}}),f=async e=>{try{await navigator.clipboard.writeText(e),U(`Command copied`)}catch{U(`Could not copy the command`,{tone:`danger`})}};return(0,$.jsxs)(`section`,{id:`providers`,"data-slot":`provider-settings`,className:`scroll-mt-20`,children:[(0,$.jsxs)(`div`,{className:`mb-2`,children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:`Providers`}),(0,$.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Connect the coding agents available on this computer.`})]}),e.isError?(0,$.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,$.jsxs)(`div`,{children:[(0,$.jsx)(`p`,{className:`text-[13px] font-medium text-foreground`,children:`Provider status could not be loaded`}),(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.error.message})]}),(0,$.jsx)(H,{type:`button`,variant:`outline`,size:`sm`,disabled:e.isFetching,onClick:()=>void e.refetch(),children:`Retry`})]}):null,(0,$.jsx)(`div`,{className:`flex flex-col gap-2`,children:H_.map(r=>{let a=mt(e.data,r.id),o=a?.status,s=o?W_[o]:e.isPending?{label:`Checking…`,tone:`neutral`}:W_.unknown,c=d.isPending&&d.variables===r.id,l=o===`disconnected`||o===`unknown`,p=a?.authFailureId;return(0,$.jsxs)(Q.Fragment,{children:[(0,$.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,$.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`h3`,{className:`text-[13px] font-semibold text-foreground`,children:r.label}),(0,$.jsxs)(`div`,{className:`mt-1 flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,$.jsx)(Qu,{tone:s.tone,pulse:e.isPending}),(0,$.jsx)(`span`,{children:s.label}),a?.enabled===!1?(0,$.jsx)(`span`,{children:`Disabled`}):null]}),o===`not-installed`?(0,$.jsxs)(`p`,{className:`mt-1.5 text-xs text-soft-foreground`,children:[`Install `,r.label,`, then run `,(0,$.jsx)(`code`,{children:r.login}),`.`]}):o===`unknown`||e.isError&&!o?(0,$.jsx)(`p`,{className:`mt-1.5 text-xs text-soft-foreground`,children:`Verification failed. Check again when the provider is available.`}):a?.hint?(0,$.jsx)(`p`,{className:`mt-1.5 text-xs text-soft-foreground`,children:a.hint}):null]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[o===`not-installed`?null:(0,$.jsx)(V_,{checked:a?.enabled??!0,"aria-label":`Use ${r.label}`,onCheckedChange:e=>u(r.id,e)}),l?(0,$.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,$.jsx)(H,{type:`button`,variant:`outline`,size:`sm`,disabled:d.isPending,onClick:()=>d.mutate(r.id),children:c?`Opening…`:`Connect`}):null,p===void 0?null:(0,$.jsx)(H,{type:`button`,variant:`outline`,size:`sm`,disabled:n.isPending,onClick:()=>n.mutate({provider:r.id,authFailureId:p},{onSuccess:()=>U(`${r.label} can be tried again.`),onError:e=>U(e.message,{tone:`danger`})}),children:`Try again`})]})]}),p===void 0?null:(0,$.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,$.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,$.jsx)(`p`,{className:`text-[13px] text-foreground`,children:i.message}),(0,$.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2`,children:[(0,$.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,$.jsx)(H,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>void f(i.command),children:`Copy command`})]})]}):null]},r.id)})})]})}var q_=2e4;function J_(){let e=re(),t=rt(),n=ge();return e.isPending?(0,$.jsx)(`p`,{"data-slot":`agents-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading agent settings…`}):e.isError?(0,$.jsx)(G,{icon:(0,$.jsx)(jn,{}),tone:`danger`,title:`Agent settings did not load`,subtitle:e.error.message,heading:`h2`}):(0,$.jsx)(Y_,{config:e.data,catalog:t.data,providerStatus:n})}function Y_({config:e,catalog:t,providerStatus:n}){let r=et(),i=V(),a=z({mutationFn:e=>je(e),onSuccess:e=>{i.setQueryData(s.config,e),i.invalidateQueries({queryKey:s.health}),i.invalidateQueries({queryKey:s.repo})},onError:e=>U(e.message,{tone:`danger`})}),[o,c]=(0,Q.useState)(e.systemPrompt??``),l=o.trim(),u=l===(e.systemPrompt??``),d=l.length>q_;return(0,$.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,$.jsx)(K_,{}),(0,$.jsxs)(X_,{title:`Default runner`,hint:`Preselected for new tasks and used by the chain planner. Each task can still pick another runner.`,children:[(0,$.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:Km.map(t=>{let r=t.id===e.defaultRunner,i=mt(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,$.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:X(`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&&mt(n.data,e.defaultRunner)?.enabled===!1?(0,$.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`This provider is disabled. Enable it above or choose another provider.`}):null]}),(0,$.jsx)(X_,{title:`Default models`,hint:`The model preselected in the composer for each runner. Auto lets the runner decide per task.`,children:(0,$.jsx)(`div`,{className:`flex max-w-md flex-col gap-2`,children:Km.map(r=>{let i=mt(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,$.jsxs)(`label`,{className:`flex items-center gap-3`,children:[(0,$.jsx)(`span`,{className:`w-24 shrink-0 font-mono text-xs text-muted-foreground`,children:r.label}),(0,$.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:[Ym(r.id,t,[e.defaultModels[r.id]]).map(e=>(0,$.jsx)(`option`,{value:e.id,children:e.id===``?`auto (default)`:e.label},e.id)),Xm(r.id,t)?(0,$.jsx)(`option`,{disabled:!0,children:Xm(r.id,t)}):null]})]},r.id)})})}),(0,$.jsxs)(X_,{title:`System prompt`,hint:`Extra instructions appended to every run, whichever runner executes it. This is the only place it is edited.`,children:[(0,$.jsx)(Tt,{"aria-label":`System prompt`,"data-slot":`agents-system-prompt`,value:o,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,$.jsxs)(`div`,{className:`flex max-w-xl items-center gap-3`,children:[(0,$.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,$.jsxs)(`p`,{"data-slot":`agents-prompt-limit`,className:`text-[11px] text-danger`,children:[l.length.toLocaleString(),` characters — the limit is`,` `,q_.toLocaleString(),`.`]}):(0,$.jsx)(`p`,{className:`text-[11px] text-soft-foreground`,children:`Leave empty and save to clear. Applied to new runs only.`})]})]}),(0,$.jsx)(X_,{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,$.jsxs)(`label`,{className:`flex w-fit items-center gap-3`,children:[(0,$.jsx)(V_,{"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,$.jsxs)(`span`,{className:`text-[13px] text-muted-foreground`,children:[e.liveTitleUpdates??!0?`On`:`Off`,e.liveTitleUpdates===null&&` (default)`]})]})}),(0,$.jsx)(X_,{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,$.jsxs)(`label`,{className:`flex w-fit items-center gap-3`,children:[(0,$.jsx)(V_,{"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,$.jsxs)(`span`,{className:`text-[13px] text-muted-foreground`,children:[e.reviewGate??!1?`On`:`Off`,e.reviewGate===null&&` (default)`]})]})}),(0,$.jsx)(X_,{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,$.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,$.jsx)(`option`,{value:``,children:`follow checked-out branch (default)`}),r.data.branches.map(e=>(0,$.jsx)(`option`,{value:e,children:e},e))]}):(0,$.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 X_({title:e,hint:t,children:n}){return(0,$.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:e}),(0,$.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:t})]}),n]})}var Z_=`cez-accent`,Q_=`cez-density`,$_=`lime`,ev=`comfortable`;function tv(e){return e===`lime`||e===`violet`?e:$_}function nv(e){return e===`comfortable`||e===`compact`||e===`ultra`?e:ev}function rv(e){let t=e&&typeof e==`object`?e:{};return{accent:tv(t.accent),density:nv(t.density)}}function iv(){try{return{accent:tv(localStorage.getItem(Z_)),density:nv(localStorage.getItem(Q_))}}catch{return{accent:$_,density:ev}}}function av(e){try{localStorage.setItem(Z_,e.accent),localStorage.setItem(Q_,e.density)}catch{}}function ov(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 sv=Q.createContext(null);function cv({children:e}){let t=V(),n=p(),[r,i]=Q.useState(iv),a=n.data;Q.useEffect(()=>{if(a===void 0)return;let e=rv(a.appearance);i(e),av(e)},[a]),Q.useLayoutEffect(()=>{ov(document.documentElement,r)},[r]);let o=Q.useCallback(e=>{i(e),av(e),Ne({appearance:e}).then(e=>t.setQueryData(B.uiState,e)).catch(e=>{U(e instanceof Error?e.message:String(e),{tone:`danger`}),t.invalidateQueries({queryKey:B.uiState})})},[t]),s=Q.useCallback(e=>o({accent:e,density:r.density}),[o,r.density]),c=Q.useCallback(e=>o({accent:r.accent,density:e}),[o,r.accent]),l=Q.useMemo(()=>({accent:r.accent,density:r.density,setAccent:s,setDensity:c}),[r,s,c]);return(0,$.jsx)(sv.Provider,{value:l,children:e})}function lv(){let e=Q.useContext(sv);if(!e)throw Error(`cezar: useAppearance() must be called inside <AppearanceProvider>`);return e}var uv=[{value:`system`,label:`System`,icon:$n},{value:`light`,label:`Light`,icon:pr},{value:`dark`,label:`Dark`,icon:er}],dv=[{value:`lime`,label:`Lime`,swatch:`var(--accent-lime)`},{value:`violet`,label:`Violet`,swatch:`var(--violet)`}],fv=[{value:`comfortable`,label:`Comfortable`},{value:`compact`,label:`Compact`},{value:`ultra`,label:`Compact for real`}];function pv({slot:e,label:t,value:n,options:r,onChange:i}){return(0,$.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,$.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":t,"data-value":e.value,onClick:()=>i(e.value),className:X(`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,$.jsx)(e.icon,{"aria-hidden":`true`,className:`size-3.5`}):null,e.swatch?(0,$.jsx)(`span`,{"aria-hidden":`true`,className:`size-3 rounded-full border border-border`,style:{background:e.swatch}}):null,e.label]},e.value)})})}function mv({title:e,hint:t,children:n}){return(0,$.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:e}),(0,$.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:t})]}),n]})}function hv(){let{theme:e,setTheme:t}=ud(),{accent:n,density:r,setAccent:i,setDensity:a}=lv();return(0,$.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,$.jsx)(mv,{title:`Theme`,hint:`System follows your OS preference. Applies to this browser.`,children:(0,$.jsx)(pv,{slot:`appearance-theme`,label:`Theme`,value:e,options:uv,onChange:t})}),(0,$.jsx)(mv,{title:`Accent`,hint:`The primary action color. Saved with this repo's cockpit state.`,children:(0,$.jsx)(pv,{slot:`appearance-accent`,label:`Accent`,value:n,options:dv,onChange:i})}),(0,$.jsx)(mv,{title:`Density`,hint:`Compact tightens spacing across the cockpit — text stays the same size.`,children:(0,$.jsx)(pv,{slot:`appearance-density`,label:`Density`,value:r,options:fv,onChange:a})})]})}var gv=`http://localhost:4321`;function _v(e,t,n,r=gv,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 vv(){let e=ze();return e.isPending?(0,$.jsx)(`p`,{"data-slot":`bookmarklets-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading bookmarklets…`}):e.isError?(0,$.jsx)(G,{icon:(0,$.jsx)(Ct,{}),tone:`danger`,heading:`h2`,title:`Could not load bookmarklets`,subtitle:e.error.message}):(0,$.jsx)(`div`,{className:`flex min-h-full flex-1 overflow-y-auto px-4 py-5 md:px-7`,children:(0,$.jsx)(yv,{skills:kf(e.data??[])})})}function yv({skills:e}){let t=b(),n=C(),r=ve(),[i,a]=(0,Q.useState)(!1),[o,s]=(0,Q.useState)(``),c=t.data?.key??``,l=window.location.origin,u=Ut()??n.data?.bootProject??null,d=r.data?.projects.find(e=>e.id===u)?.name??Qy(n.data)?.name??null,f=o.trim().toLowerCase(),p=e.filter(e=>e.name.toLowerCase().includes(f));return(0,$.jsxs)(`div`,{"data-slot":`bookmarklet-panel`,className:`mx-auto w-full max-w-2xl`,children:[(0,$.jsx)(`h2`,{className:`text-base font-semibold`,children:`Run from GitHub`}),(0,$.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,$.jsx)(`span`,{className:`font-mono`,children:`npx cezar`}),`.`]}),(0,$.jsxs)(`label`,{className:`mt-4 flex items-center gap-2 text-[13px] font-medium`,children:[(0,$.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,$.jsx)(`span`,{className:`font-normal text-soft-foreground`,children:`— re-drag the buttons after changing this`})]}),(0,$.jsx)(`div`,{"data-slot":`bm-generic`,className:`mt-4`,children:(0,$.jsx)(bv,{label:d?`cezar (${d}): this PR/issue`:`cezar: this PR/issue`,url:_v(``,!1,c,l,u),hint:`prefills the form — nothing starts by itself`})}),(0,$.jsx)(Hu,{"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,$.jsx)(`div`,{"data-slot":`bm-list`,className:`mt-3 flex flex-col gap-2`,children:p.length>0?p.map(e=>(0,$.jsx)(bv,{label:d?`/${e.name} (${d})`:`/${e.name}`,url:_v(e.name,i,c,l,u),hint:e.source},e.path)):(0,$.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 bv({label:e,url:t,hint:n}){let r=(0,Q.useRef)(null);(0,Q.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,$.jsxs)(`div`,{"data-slot":`bm-row`,className:`flex min-w-0 items-center gap-2.5`,children:[(0,$.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,$.jsx)(hr,{"aria-hidden":`true`,className:`size-3 text-primary`}),e]}),(0,$.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,$.jsx)(`span`,{className:`min-w-0 truncate text-[11px] text-soft-foreground`,children:n}):null]})}function xv(e){return{enabled:(e&&typeof e==`object`?e:{}).enabled===!0}}function Sv(){let e=globalThis.Notification;if(typeof e!=`function`)return`unsupported`;let t=e.permission;return t===`granted`||t===`denied`?t:`default`}function Cv(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||wf(i)&&r.push(i)}return{entering:r,statuses:n}}function wv(e){return e.enabled&&e.hidden&&e.permission===`granted`}function Tv(e){let t=Cf(e).label;return{title:e.titleSummary??e.title,body:`Task ${t}`,tag:`cezar-run-${e.id}`}}function Ev(){let e=V(),t=p(),[n,r]=Q.useState(!1),[i,a]=Q.useState(Sv),o=t.data;Q.useEffect(()=>{o!==void 0&&r(xv(o.notifications).enabled)},[o]);let s=Q.useCallback(t=>{r(t),Ne({notifications:{enabled:t}}).then(t=>e.setQueryData(B.uiState,t)).catch(t=>{U(t instanceof Error?t.message:String(t),{tone:`danger`}),e.invalidateQueries({queryKey:B.uiState})})},[e]),c=Q.useCallback(e=>{if(!e){s(!1);return}if(Sv()!=="default"){s(!0);return}s(!0),Notification.requestPermission().then(e=>a(e)).catch(()=>a(Sv()))},[s]),l=i===`unsupported`;return(0,$.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,$.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:(0,$.jsx)(`label`,{htmlFor:`notifications-enabled`,children:`Notify when an agent needs you`})}),(0,$.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,$.jsx)(V_,{id:`notifications-enabled`,"data-slot":`notifications-toggle`,checked:n,disabled:l,onCheckedChange:c})]}),l?(0,$.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,$.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 Dv({title:e,hint:t,children:n}){return(0,$.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:e}),(0,$.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:t})]}),n]})}var Ov=1,kv={ok:`ok`,"not-git":`no git repo`,missing:`folder not found`};function Av(e){let t=new Date(e);return Number.isNaN(t.getTime())?`—`:t.toLocaleDateString(void 0,{month:`short`,day:`numeric`})}function jv(){let e=le(),t=ve();return e.isPending||t.isPending?(0,$.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,$.jsx)(G,{icon:(0,$.jsx)(Wn,{}),tone:`danger`,title:`Project settings did not load`,subtitle:(e.error??t.error)?.message,heading:`h2`}):(0,$.jsx)(Mv,{config:e.data,registry:t.data})}function Mv({config:e,registry:t}){return(0,$.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,$.jsx)(Nv,{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,$.jsx)(Nv,{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,$.jsx)(Pv,{registry:t,workspaceMax:e.resources.maxParallel})]})}function Nv({configKey:e,value:t,title:n,hint:r,placeholder:i,slot:a,savedLabel:o,footer:s,refreshProjects:c=!1}){let l=V(),u=z({mutationFn:t=>lt(e===`browseRoot`?{browseRoot:t}:{projectsDir:t}),onSuccess:t=>{l.setQueryData(B.config,t),e===`browseRoot`?l.invalidateQueries({queryKey:B.fsBrowseRoot}):c&&l.invalidateQueries({queryKey:B.projects})}}),[d,f]=(0,Q.useState)(t),p=d.trim(),m=p===t,h=u.isError?u.error.message:null;return(0,$.jsxs)(Dv,{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,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.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,$.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,$.jsx)(`p`,{className:`text-[11px] text-soft-foreground`,children:s}):(0,$.jsxs)(`p`,{"data-slot":`projects-${a}-root-error`,role:`alert`,className:`text-[11px] text-danger`,children:[h,` — setting unchanged`]})]})}function Pv({registry:e,workspaceMax:t}){let[n,r]=(0,Q.useState)(null),i=Fe();return(0,$.jsxs)(Dv,{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,$.jsx)(`p`,{"data-slot":`projects-empty`,className:`text-[13px] text-soft-foreground`,children:`No projects registered yet.`}):(0,$.jsx)(`div`,{className:`overflow-x-auto rounded-md border border-border`,children:(0,$.jsxs)(`table`,{className:`w-full border-collapse text-sm`,children:[(0,$.jsx)(`caption`,{className:`sr-only`,children:`Projects registered in this workspace`}),(0,$.jsx)(`thead`,{children:(0,$.jsxs)(`tr`,{className:`border-b border-border text-left text-[12px] text-soft-foreground`,children:[(0,$.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Project`}),(0,$.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Status`}),(0,$.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Max parallel`}),(0,$.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Added`}),(0,$.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium text-right`,children:`Actions`})]})}),(0,$.jsx)(`tbody`,{children:e.projects.map(n=>(0,$.jsx)(Fv,{project:n,isBoot:n.id===e.bootProject,workspaceMax:t,disabled:i.isPending,onRemove:()=>r(n)},n.id))})]})}),(0,$.jsx)(Yg,{open:n!==null,onOpenChange:e=>!e&&r(null),children:(0,$.jsxs)(Qg,{children:[(0,$.jsxs)($g,{children:[(0,$.jsxs)(t_,{children:[`Remove `,n?.name,` from the workspace?`]}),(0,$.jsxs)(n_,{children:[`This only unregisters the project — `,(0,$.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,$.jsx)(`span`,{className:`mt-1 block truncate font-mono text-[11px] text-foreground`,title:n?.root,children:n?.root})]})]}),(0,$.jsxs)(e_,{children:[(0,$.jsx)(i_,{children:`Keep it`}),(0,$.jsx)(r_,{"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 Fv({project:e,isBoot:t,workspaceMax:n,disabled:r,onRemove:i}){return(0,$.jsxs)(`tr`,{"data-slot":`project-row`,"data-project":e.id,className:`border-b border-border last:border-0`,children:[(0,$.jsxs)(`th`,{scope:`row`,className:`max-w-[260px] px-3 py-2 text-left font-normal`,children:[(0,$.jsx)(`span`,{className:`block truncate text-foreground`,children:e.name}),(0,$.jsx)(`span`,{className:`block truncate font-mono text-[11px] text-soft-foreground`,title:e.root,children:e.root})]}),(0,$.jsxs)(`td`,{className:`px-3 py-2`,children:[(0,$.jsx)(`span`,{"data-slot":`project-status`,className:e.status===`missing`?`text-[12px] text-danger`:`text-[12px] text-soft-foreground`,children:kv[e.status]}),e.status===`missing`?null:(0,$.jsxs)(`span`,{className:`ml-1 text-[11px] text-soft-foreground`,children:[`· `,e.source]})]}),(0,$.jsx)(`td`,{className:`px-3 py-2`,children:(0,$.jsx)(Iv,{project:e,workspaceMax:n})}),(0,$.jsx)(`td`,{className:`px-3 py-2 tabular-nums text-soft-foreground`,children:Av(e.addedAt)}),(0,$.jsx)(`td`,{className:`px-3 py-2 text-right`,children:(0,$.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 Iv({project:e,workspaceMax:t}){let n=ke(),r=e.maxParallel===void 0?``:String(e.maxParallel);return(0,$.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,$.jsxs)(`option`,{value:``,children:[`Inherit workspace (`,t,`)`]}),Array.from({length:16},(e,t)=>t+Ov).map(e=>(0,$.jsx)(`option`,{value:e,children:e},e))]})}function Lv(){let e=yt();return e.isPending?(0,$.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,$.jsx)(G,{icon:(0,$.jsx)(tr,{}),tone:`danger`,title:`Prompt templates did not load`,subtitle:e.error.message,heading:`h2`}):(0,$.jsx)(Rv,{initial:Ah(e.data.promptTemplates)})}function Rv({initial:e}){let t=V(),n=ze(),r=yt(),[i,a]=(0,Q.useState)(e),[o,c]=(0,Q.useState)(``),[l,u]=(0,Q.useState)(``),d=z({mutationFn:e=>Je({promptTemplates:e}),onSuccess:e=>{t.setQueryData(s.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,$.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,$.jsxs)(Bv,{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,$.jsx)(`div`,{"data-slot":`prompt-template-list`,className:`flex flex-col gap-3`,children:i.length===0?(0,$.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,$.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,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(Hu,{"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,$.jsx)(H,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`prompt-template-remove`,title:`Remove this template`,onClick:()=>g(e.id),children:(0,$.jsx)(wt,{"aria-hidden":`true`,className:`size-3.5`})})]}),(0,$.jsx)(Tt,{"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,$.jsxs)(`div`,{className:`mt-0.5 flex flex-wrap items-center gap-1.5`,children:[(0,$.jsx)(zv,{label:e.label,skills:n.data??[],skillUsage:r.data?.skillUsage,selected:e.skills??[],onToggle:t=>h(e.id,t)}),(e.skills??[]).map(t=>(0,$.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,$.jsx)(wt,{"aria-hidden":`true`,className:`size-3`})]},t))]})]},e.id))}),(0,$.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,$.jsx)(Hu,{"aria-label":`New template label`,"data-slot":`prompt-template-new-label`,placeholder:`Label (e.g. "Add tests")`,value:o,maxLength:80,onChange:e=>c(e.target.value)}),(0,$.jsx)(Tt,{"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,$.jsxs)(H,{type:`button`,variant:`outline`,size:`sm`,"data-action":`prompt-template-add`,disabled:!o.trim()||!l.trim(),onClick:()=>{let e=o.trim(),t=l.trim();!e||!t||(a(n=>[...n,{id:Fh(),label:e,text:t}]),c(``),u(``))},className:`self-start`,children:[(0,$.jsx)(sr,{"aria-hidden":`true`,className:`size-3.5`}),`Add template`]})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,$.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,$.jsx)(H,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`prompt-templates-reset`,disabled:d.isPending,onClick:()=>a(Oh.map(e=>({...e}))),children:`Reset to defaults`}),p?(0,$.jsx)(`p`,{"data-slot":`prompt-templates-invalid`,className:`text-[11px] text-danger`,children:`Every template needs both a label and text.`}):null]})]})})}function zv({label:e,skills:t,skillUsage:n,selected:r,onToggle:i}){let[a,o]=(0,Q.useState)(!1),s=(0,Q.useRef)(null),{mostUsed:c,project:l,global:u}=jf(t,n),d=(e,t)=>{let n=r.includes(e.name);return(0,$.jsxs)(vf,{value:`skill ${e.name} ${e.path}`,keywords:Vf(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,$.jsx)(`span`,{className:X(`shrink-0 font-mono text-xs`,t&&`font-semibold`),children:e.name}),e.description?(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null,n?(0,$.jsx)(Ge,{"aria-hidden":`true`,className:`ml-auto size-3.5 shrink-0 text-primary`}):null]},e.path)};return(0,$.jsxs)(vh,{open:a,onOpenChange:o,children:[(0,$.jsx)(yh,{asChild:!0,children:(0,$.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:X(`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,$.jsx)(dr,{"aria-hidden":`true`,className:`size-3 shrink-0 text-violet`}),t.length===0?`no skills found`:`apply with…`,(0,$.jsx)(Mn,{"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,$.jsx)(bh,{align:`start`,sideOffset:8,className:`w-[336px] max-w-[calc(100vw-2rem)] p-0`,children:(0,$.jsxs)(df,{filter:zf,children:[(0,$.jsx)(pf,{placeholder:`search skills…`,onInput:()=>s.current?.scrollTo(0,0)}),(0,$.jsxs)(mf,{ref:s,"data-slot":`prompt-template-skill-menu`,className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[(0,$.jsx)(hf,{children:`Nothing matches.`}),c.length>0?(0,$.jsx)(gf,{heading:`Most used`,children:c.map(e=>d(e,Of(e)))}):null,l.length>0?(0,$.jsx)(gf,{heading:`Project skills`,children:l.map(e=>d(e,!0))}):null,u.length>0?(0,$.jsx)(gf,{heading:`Global`,children:u.map(e=>d(e,!1))}):null]})]})})]})}function Bv({title:e,hint:t,children:n}){return(0,$.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:e}),(0,$.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:t})]}),n]})}var Vv=1,Hv=1,Uv=60,Wv=256;function Gv(){let e=le();return e.isPending?(0,$.jsx)(`p`,{"data-slot":`resources-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading resource settings…`}):e.isError?(0,$.jsx)(G,{icon:(0,$.jsx)(Gn,{}),tone:`danger`,title:`Resource settings did not load`,subtitle:e.error.message,heading:`h2`}):(0,$.jsx)(Kv,{config:e.data})}function Kv({config:e}){let t=V(),n=z({mutationFn:e=>lt(e),onSuccess:e=>t.setQueryData(B.config,e),onError:e=>U(e.message,{tone:`danger`})}),[r,i]=(0,Q.useState)(e.resources.memoryLimitMb?String(e.resources.memoryLimitMb):``),a=e.resources.monitoringWakeIntervalMinutes??null,[o,s]=(0,Q.useState)(a===null?`park`:`interval`),[c,l]=(0,Q.useState)(String(a??5)),u=Number(c),d=!Number.isInteger(u)||u<Hv||u>Uv,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),g=r.trim()!==``&&(!Number.isInteger(m)||m<Wv),_=(e.resources.memoryLimitMb??0)===(g?-1:m),v=()=>n.mutate({resources:{memoryLimitMb:m===0?null:m}},{onSuccess:()=>U(m===0?`Memory limit cleared`:`Memory limit set to ${m} MiB`)}),y=e.composerDefaults??{autonomous:null,worktree:null,inheritedAutonomous:`source-dependent`,inheritedWorktree:!0},b=(e,t)=>n.mutate({composerDefaults:{[e]:t===`inherit`?null:t===`on`}});return(0,$.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,$.jsxs)(Dv,{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,$.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+Vv).map(e=>(0,$.jsx)(`option`,{value:e,children:e},e))}),(0,$.jsxs)(`p`,{className:`text-[11px] text-soft-foreground`,children:[`Need a different limit for one project?`,` `,(0,$.jsx)(h,{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,$.jsxs)(Dv,{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,$.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,$.jsx)(`option`,{value:t,children:t},t))}),(0,$.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,$.jsxs)(Dv,{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,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.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,$.jsx)(`option`,{value:`park`,children:`Park until resumed`}),(0,$.jsx)(`option`,{value:`interval`,children:`Re-check on an interval`})]}),o===`interval`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`input`,{type:`number`,min:Hv,max:Uv,"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,$.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`minutes`})]}):null,(0,$.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,$.jsx)(`p`,{"data-slot":`resources-monitoring-wake-invalid`,className:`text-[11px] text-danger`,children:`Enter a whole number from 1 to 60 minutes.`}):(0,$.jsx)(`p`,{className:`text-[11px] text-soft-foreground`,children:`Applied consistently to Claude, Codex and OpenCode.`})]}),(0,$.jsxs)(Dv,{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,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`input`,{type:`number`,inputMode:`numeric`,min:Wv,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,$.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`MiB`}),(0,$.jsx)(H,{type:`button`,variant:`outline`,size:`sm`,"data-action":`resources-save-memory`,disabled:_||g||n.isPending,onClick:v,children:`Save`})]}),g?(0,$.jsxs)(`p`,{"data-slot":`resources-memory-invalid`,className:`text-[11px] text-danger`,children:[`Enter a whole number of at least `,Wv,` MiB, or leave empty for no limit.`]}):(0,$.jsx)(`p`,{className:`text-[11px] text-soft-foreground`,children:`Applies to newly started tasks.`})]}),(0,$.jsxs)(Dv,{title:`New task defaults`,hint:`Set stable composer defaults across projects. Explicit choices and run-shape constraints still win.`,children:[(0,$.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,"data-slot":`resources-composer-defaults`,children:[(0,$.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,$.jsx)(`span`,{className:`font-medium`,children:`Autonomous by default`}),(0,$.jsxs)(`select`,{"aria-label":`Autonomous by default`,value:y.autonomous===null?`inherit`:y.autonomous?`on`:`off`,disabled:n.isPending,onChange:e=>b(`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,$.jsx)(`option`,{value:`inherit`,children:`Inherit environment`}),(0,$.jsx)(`option`,{value:`on`,children:`On`}),(0,$.jsx)(`option`,{value:`off`,children:`Off`})]}),(0,$.jsxs)(`span`,{className:`text-[11px] text-soft-foreground`,children:[`Inherited: `,y.inheritedAutonomous===`source-dependent`?`Source-dependent — skills on, workflows off`:y.inheritedAutonomous?`On`:`Off`]})]}),(0,$.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,$.jsx)(`span`,{className:`font-medium`,children:`Use a worktree by default`}),(0,$.jsxs)(`select`,{"aria-label":`Use a worktree by default`,value:y.worktree===null?`inherit`:y.worktree?`on`:`off`,disabled:n.isPending,onChange:e=>b(`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,$.jsx)(`option`,{value:`inherit`,children:`Inherit environment`}),(0,$.jsx)(`option`,{value:`on`,children:`On`}),(0,$.jsx)(`option`,{value:`off`,children:`Off`})]}),(0,$.jsxs)(`span`,{className:`text-[11px] text-soft-foreground`,children:[`Inherited: `,y.inheritedWorktree?`On`:`Off`]})]})]}),(0,$.jsx)(`p`,{className:`text-[11px] text-soft-foreground`,children:`Interactive skills may recommend both off. Multi-step and parallel runs remain isolated.`})]})]})}function qv(){let e=le(),t=ve().data?.bootProject??``,n=Te(t,!!t);return e.isPending?(0,$.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,$.jsx)(G,{icon:(0,$.jsx)(nr,{}),tone:`danger`,title:`Skill settings did not load`,subtitle:e.error.message,heading:`h2`}):(0,$.jsx)(Jv,{config:e.data,update:n.data,updateError:n.error})}function Jv({config:e,update:t,updateError:n}){let r=V(),i=z({mutationFn:e=>lt(e),onSuccess:e=>r.setQueryData(B.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,$.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,$.jsxs)(`section`,{className:`flex flex-col gap-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:(0,$.jsx)(`label`,{htmlFor:`skills-auto-update`,children:`Update Open Mercato skills automatically`})}),(0,$.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,$.jsxs)(`div`,{className:`flex shrink-0 flex-col items-end gap-1`,children:[(0,$.jsx)(V_,{id:`skills-auto-update`,"data-slot":`skills-auto-update`,checked:e.effectiveSkillsAutoUpdate,disabled:i.isPending,onCheckedChange:e=>i.mutate({skillsAutoUpdate:e})}),(0,$.jsxs)(`span`,{className:`text-[11px] text-soft-foreground`,children:[e.effectiveSkillsAutoUpdate?`On`:`Off`,a?` (default)`:``]})]})]}),(0,$.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,$.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,$.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,$.jsx)(`p`,{"data-slot":`skills-installation-status`,role:n||t?.status===`unavailable`?`status`:void 0,className:`text-[13px] text-soft-foreground`,children:o})]})})}function Yv(){let e=ht(),t=V(),[n,r]=(0,Q.useState)(null),i=()=>t.invalidateQueries({queryKey:s.worktrees}),a=z({mutationFn:()=>Le(),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`})}),o=z({mutationFn:e=>Xe(e),onSuccess:()=>{i(),U(`Worktree removed`)},onError:e=>U(e.message,{tone:`danger`})});if(e.isPending)return(0,$.jsx)(`p`,{"data-slot":`worktrees-loading`,className:`text-[13px] text-soft-foreground`,children:`Loading worktrees…`});if(e.isError)return(0,$.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||o.isPending;return(0,$.jsxs)(`div`,{"data-slot":`worktrees-panel`,className:`flex flex-col gap-3`,children:[c.length===0?(0,$.jsx)(`p`,{"data-slot":`worktrees-empty`,className:`text-[13px] text-soft-foreground`,children:`No task worktrees on disk.`}):(0,$.jsx)(`div`,{className:`overflow-x-auto rounded-md border border-border`,children:(0,$.jsxs)(`table`,{className:`w-full border-collapse text-sm`,children:[(0,$.jsx)(`caption`,{className:`sr-only`,children:`Task worktrees currently materialized on disk`}),(0,$.jsx)(`thead`,{children:(0,$.jsxs)(`tr`,{className:`border-b border-border text-left text-[12px] text-soft-foreground`,children:[(0,$.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Task`}),(0,$.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Status`}),(0,$.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Size`}),(0,$.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Age`}),(0,$.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium text-right`,children:`Actions`})]})}),(0,$.jsx)(`tbody`,{children:c.map(e=>(0,$.jsx)(Xv,{worktree:e,disabled:d,onDelete:()=>r({kind:`delete`,runId:e.runId,title:e.title})},e.runId))})]})}),(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,$.jsxs)(`p`,{"data-slot":`worktrees-footer`,className:`text-[12px] text-soft-foreground`,children:[c.length,` worktree`,c.length===1?``:`s`,l===null?` · size unavailable`:` · ${um(l)||`0 kB`} on disk`,` · `,u===0?`keeping all (unlimited)`:`keeping the last ${u}`]}),(0,$.jsx)(H,{type:`button`,variant:`outline`,size:`sm`,"data-action":`worktrees-reclaim-now`,disabled:d,onClick:()=>r({kind:`reclaim`}),children:`Reclaim now`})]}),(0,$.jsx)(Yg,{open:n!==null,onOpenChange:e=>!e&&r(null),children:(0,$.jsxs)(Qg,{children:[(0,$.jsxs)($g,{children:[(0,$.jsx)(t_,{children:n?.kind===`delete`?`Delete this worktree?`:`Reclaim old worktrees?`}),(0,$.jsx)(n_,{children:n?.kind===`delete`?(0,$.jsxs)($.Fragment,{children:[`This removes the worktree directory and its branch — the local-only work is not recoverable afterwards.`,(0,$.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,$.jsxs)(e_,{children:[(0,$.jsx)(i_,{children:`Keep it`}),(0,$.jsx)(r_,{"data-action":`worktrees-confirm`,className:n?.kind===`delete`?`bg-danger text-danger-foreground hover:brightness-[0.96]`:void 0,onClick:()=>{n?.kind===`reclaim`?a.mutate():n?.kind===`delete`&&o.mutate(n.runId),r(null)},children:n?.kind===`delete`?`Delete`:`Reclaim now`})]})]})})]})}function Xv({worktree:e,disabled:t,onDelete:n}){return(0,$.jsxs)(`tr`,{"data-slot":`worktree-row`,"data-run":e.runId,className:`border-b border-border last:border-0`,children:[(0,$.jsxs)(`th`,{scope:`row`,className:`max-w-[220px] px-3 py-2 text-left font-normal`,children:[(0,$.jsx)(`span`,{className:`block truncate text-foreground`,title:e.title,children:e.title}),(0,$.jsx)(`span`,{className:`block truncate font-mono text-[11px] text-soft-foreground`,children:e.branch??e.runId.slice(0,8)})]}),(0,$.jsxs)(`td`,{className:`px-3 py-2`,children:[(0,$.jsx)(`span`,{className:`text-[12px] text-soft-foreground`,children:e.status}),e.reclaimable?(0,$.jsx)(`span`,{"data-slot":`worktree-reclaimable`,className:`ml-1 text-[11px] text-soft-foreground`,children:`(reclaimable)`}):null]}),(0,$.jsx)(`td`,{className:`px-3 py-2 tabular-nums text-soft-foreground`,children:e.sizeBytes===null?`—`:um(e.sizeBytes)||`0 kB`}),(0,$.jsx)(`td`,{className:`px-3 py-2 tabular-nums text-soft-foreground`,children:Tf(e.finishedAt??void 0)||`—`}),(0,$.jsx)(`td`,{className:`px-3 py-2 text-right`,children:(0,$.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 Zv=0,Qv=1e3;function $v(){let e=re();return e.isPending?(0,$.jsx)(`p`,{"data-slot":`worktrees-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading worktree settings…`}):e.isError?(0,$.jsx)(G,{icon:(0,$.jsx)(Bn,{}),tone:`danger`,title:`Worktree settings did not load`,subtitle:e.error.message,heading:`h2`}):(0,$.jsx)(ey,{config:e.data})}function ey({config:e}){let t=V(),n=z({mutationFn:e=>je(e),onSuccess:e=>t.setQueryData(s.config,e),onError:e=>U(e.message,{tone:`danger`})}),[r,i]=(0,Q.useState)(String(e.worktreeRetention)),a=Number(r),o=r.trim()===``||!Number.isInteger(a)||a<Zv||a>Qv,c=e.worktreeRetention===(o?-1:a);return(0,$.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,$.jsxs)(Dv,{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,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`input`,{type:`number`,inputMode:`numeric`,min:Zv,max:Qv,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,$.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`worktrees`}),(0,$.jsx)(H,{type:`button`,variant:`outline`,size:`sm`,"data-action":`resources-save-retention`,disabled:c||o||n.isPending,onClick:()=>n.mutate({worktreeRetention:a},{onSuccess:()=>{t.invalidateQueries({queryKey:s.worktrees}),U(a===0?`Keeping all worktrees (unlimited)`:`Keeping the last ${a} finished worktree${a===1?``:`s`}`)}}),children:`Save`})]}),o?(0,$.jsxs)(`p`,{"data-slot":`resources-retention-invalid`,className:`text-[11px] text-danger`,children:[`Enter a whole number from `,Zv,` to `,Qv,` (0 = unlimited).`]}):(0,$.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,$.jsx)(Dv,{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,$.jsx)(Yv,{})})]})}function ty(e,t){return function(){return(0,$.jsx)(G,{icon:(0,$.jsx)(t,{}),tone:`neutral`,title:e,subtitle:`This section arrives in a later phase of the redesign.`,heading:`h2`})}}var ny=[{id:`agents`,title:`Agents`,description:`Default runner, models and system prompt.`,icon:jn,component:J_,scope:`project`},{id:`agent-config`,title:`Agent config`,description:`Edit the coding agents’ own config files, per scope.`,icon:zn,component:I_,scope:`project`},{id:`worktrees`,title:`Worktrees`,description:`How many finished task worktrees this project keeps on disk.`,icon:Bn,component:$v,scope:`project`},{id:`bookmarklets`,title:`Bookmarklets`,description:`Launch skills from a GitHub PR or issue.`,icon:An,component:vv,scope:`project`},{id:`prompt-templates`,title:`Prompt templates`,description:`Reusable snippets for follow-up instructions.`,icon:tr,component:Lv,scope:`project`},{id:`appearance`,title:`Appearance`,description:`Theme, accent and density.`,icon:rr,component:hv,scope:`global`},{id:`notifications`,title:`Notifications`,description:`Browser notifications when an agent needs you.`,icon:kn,component:Ev,scope:`global`},{id:`resources`,title:`Resources`,description:`Parallel tasks and per-task memory limit, across every project.`,icon:Gn,component:Gv,scope:`global`},{id:`skills`,title:`Skills`,description:`Updates for skills installed on this machine.`,icon:nr,component:qv,scope:`global`},{id:`projects`,title:`Projects`,description:`The workspace registry and where GitHub checkouts land.`,icon:Wn,component:jv,scope:`global`},{id:`keyboard`,title:`Keyboard`,description:`Shortcuts.`,icon:Yn,component:ty(`Keyboard`,Yn),scope:`global`,hidden:!0}];function ry(e,t){return ny.filter(n=>!n.hidden&&n.scope===e&&!(t?.singleProject===!0&&n.id===`projects`))}function iy(e,t){return e===`global`?`/settings/global/${t}`:`/settings/${t}`}function ay(e){return e===`global`?`/settings/global`:`/settings`}function oy(e){return e===`global`?{Link:h,NavLink:te}:{Link:Z,NavLink:Bt}}function sy({scope:e,activeId:t,capabilities:n}){let{NavLink:r}=oy(e);return(0,$.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:[ry(e,n).map(n=>(0,$.jsxs)(r,{to:iy(e,n.id),"data-section":n.id,"aria-current":n.id===t?`page`:void 0,className:X(`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,$.jsx)(n.icon,{"aria-hidden":`true`,className:`size-4 shrink-0`}),n.title]},n.id)),e===`global`?(0,$.jsx)(`p`,{className:`mt-auto px-2.5 pt-3 text-[11px] text-soft-foreground`,children:`Stored in ~/.cezar`}):null]})}function cy({scope:e,activeId:t,capabilities:n}){let{NavLink:r}=oy(e);return(0,$.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:ry(e,n).map(n=>(0,$.jsx)(r,{to:iy(e,n.id),"data-section":n.id,"aria-current":n.id===t?`page`:void 0,className:X(`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 ly({section:e,scope:t,capabilities:n}){let r=e.component;return(0,$.jsxs)(`div`,{"data-route":t===`global`?`settings-global-${e.id}`:`settings-${e.id}`,className:`flex min-h-full flex-col`,children:[(0,$.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,$.jsx)(`h1`,{className:`text-base font-semibold`,children:e.title}),(0,$.jsx)(`p`,{className:`text-[13px] text-soft-foreground`,children:e.description}),t===`global`?(0,$.jsx)(`span`,{"data-slot":`settings-scope-chip`,className:`ml-auto text-[11px] text-soft-foreground`,children:`Global settings`}):null]}),(0,$.jsxs)(`div`,{className:`flex flex-1 flex-col md:flex-row`,children:[(0,$.jsx)(sy,{scope:t,activeId:e.id,capabilities:n}),(0,$.jsx)(cy,{scope:t,activeId:e.id,capabilities:n}),(0,$.jsx)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:(0,$.jsx)(r,{})})]})]})}function uy({scope:e,capabilities:t}){let{Link:n}=oy(e),r=e===`global`;return(0,$.jsxs)(`div`,{"data-route":r?`settings-global`:`settings`,className:`flex min-h-full flex-col`,children:[(0,$.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,$.jsx)(`h1`,{className:`text-base font-semibold`,children:r?`Global settings`:`Settings`}),(0,$.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,$.jsxs)(`div`,{className:`flex flex-1 flex-col md:flex-row`,children:[(0,$.jsx)(sy,{scope:e,activeId:null,capabilities:t}),(0,$.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,$.jsx)(`ul`,{"data-slot":`settings-index`,className:`mx-auto flex w-full max-w-2xl flex-col gap-2.5`,children:ry(e,t).map(t=>(0,$.jsx)(`li`,{children:(0,$.jsxs)(n,{to:iy(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,$.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-md border border-border bg-muted text-muted-foreground`,children:(0,$.jsx)(t.icon,{"aria-hidden":`true`,className:`size-4`})}),(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`span`,{className:`block text-sm font-medium text-foreground`,children:t.title}),(0,$.jsx)(`span`,{className:`block text-xs text-soft-foreground`,children:t.description})]}),(0,$.jsx)(Nn,{"aria-hidden":`true`,className:`size-4 shrink-0 text-soft-foreground`})]})},t.id))}),(0,$.jsx)(`p`,{className:`mx-auto mt-4 w-full max-w-2xl text-[12px] text-soft-foreground`,children:r?(0,$.jsx)($.Fragment,{children:`Agents, worktrees, bookmarklets and prompt templates are per project.`}):(0,$.jsxs)($.Fragment,{children:[`Appearance, notifications, host resources and the project registry live in`,` `,(0,$.jsx)(h,{to:ay(`global`),"data-slot":`settings-global-link`,className:`underline underline-offset-2 hover:text-foreground`,children:`Global settings`}),`.`]})})]})]})]})}function dy(e,t){let[n,r]=(0,Q.useState)(!1),[i,a]=(0,Q.useState)(``),o=(0,Q.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 fy({editor:e,className:t}){return(0,$.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:X(`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 py({className:e,dot:t,pulse:n=!1,children:r,...i}){return(0,$.jsxs)(`span`,{"data-slot":`pill`,className:X(`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,$.jsx)(Qu,{tone:t,pulse:n}):null,r]})}function my({runs:e,view:t,onViewChange:n,onArchiveFinished:r,onRename:i,now:a=Date.now()}){let[o,s]=Q.useState(``),c=e??[],l=ap(c),u=np(pm(c,o),t),d=tp(c),f=bm(pm(c,o),t),p=mm(c);return(0,$.jsxs)(`div`,{"data-route":`tasks`,className:`flex min-h-full flex-col`,children:[(0,$.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,$.jsx)(`h1`,{className:`text-base font-semibold`,children:`Tasks`}),(0,$.jsxs)(`div`,{className:`inline-flex gap-0.5 rounded-md bg-muted p-[3px]`,children:[(0,$.jsx)(gy,{view:`active`,current:t,onSelect:n,count:l.active,children:`Active`}),(0,$.jsx)(gy,{view:`archived`,current:t,onSelect:n,count:l.archived,children:`Archived`})]}),(0,$.jsx)(`div`,{className:`flex-1`}),t===`active`&&p>0?(0,$.jsxs)(H,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`archive-finished`,onClick:r,children:[(0,$.jsx)(wn,{className:`size-3.5`,"aria-hidden":`true`}),`Archive finished`]}):null,(0,$.jsxs)(`div`,{className:`relative w-60`,children:[(0,$.jsx)(lr,{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,$.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,$.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,$.jsx)(hy,{view:t,query:o}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{"data-slot":`tasks-table`,className:`hidden overflow-x-auto rounded-lg border border-border bg-card shadow-xs md:block`,children:(0,$.jsxs)(`table`,{className:`w-full min-w-[1040px] border-collapse`,children:[(0,$.jsx)(`thead`,{children:(0,$.jsxs)(`tr`,{children:[(0,$.jsx)(_y,{children:`Status`}),(0,$.jsx)(_y,{children:`Task`}),(0,$.jsx)(_y,{children:`Workflow`}),(0,$.jsx)(_y,{children:`Branch`}),(0,$.jsx)(_y,{children:`±`}),(0,$.jsx)(_y,{children:`Ref`}),(0,$.jsx)(_y,{right:!0,children:`Tokens`}),(0,$.jsx)(_y,{right:!0,children:`Cost`}),(0,$.jsx)(_y,{right:!0,children:`CPU`}),(0,$.jsx)(_y,{right:!0,children:`Mem`}),(0,$.jsx)(_y,{right:!0,children:`Started`})]})}),(0,$.jsx)(`tbody`,{className:`[&>tr:last-child>td]:border-b-0`,children:u.map(e=>(0,$.jsx)(yy,{run:e,queuePosition:e.status===`queued`?d.get(e.id)??null:null,onRename:i,now:a},e.id))})]})}),(0,$.jsx)(`div`,{"data-slot":`task-cards`,className:`flex flex-col gap-2.5 md:hidden`,children:u.map(e=>(0,$.jsx)(Cy,{run:e,queuePosition:e.status===`queued`?d.get(e.id)??null:null,now:a},e.id))})]}),f.map(e=>(0,$.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,$.jsx)(cr,{className:`size-[15px] shrink-0 text-soft-foreground`,"aria-hidden":`true`}),(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`strong`,{className:`font-semibold text-foreground`,children:e.title}),` — `,e.count,` variants finished`]}),(0,$.jsx)(H,{asChild:!0,variant:`outline`,size:`sm`,className:`md:ml-auto`,children:(0,$.jsx)(Z,{to:`/compare/${e.groupId}`,children:`Compare`})})]},e.groupId))]}),(0,$.jsx)(Z,{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,$.jsx)(sr,{className:`size-[22px]`,"aria-hidden":`true`})})]})}function hy({view:e,query:t}){let n=t.trim(),r=n?`search-miss`:e===`archived`?`archive`:`no-tasks`;return(0,$.jsx)(`div`,{"data-slot":`tasks-empty`,"data-empty-kind":r,className:`flex flex-1 flex-col`,children:r===`search-miss`?(0,$.jsx)(G,{heading:`h2`,icon:(0,$.jsx)(St,{}),tone:`neutral`,title:`No matching tasks`,subtitle:`No tasks match “${n}”.`}):r===`archive`?(0,$.jsx)(G,{heading:`h2`,icon:(0,$.jsx)(wn,{}),tone:`neutral`,title:`Nothing archived yet`,subtitle:`Finished tasks you archive land here.`}):(0,$.jsx)(G,{heading:`h2`,icon:(0,$.jsx)(Xn,{}),tone:`primary`,backdrop:!0,title:`No tasks yet`,subtitle:`Describe a task to get started.`,actions:(0,$.jsx)(H,{asChild:!0,children:(0,$.jsxs)(Z,{to:`/new`,children:[(0,$.jsx)(sr,{"aria-hidden":`true`}),`New task`]})})})})}function gy({view:e,current:t,onSelect:n,count:r,children:i}){let a=e===t;return(0,$.jsxs)(`button`,{type:`button`,"data-slot":`overview-tab`,"data-view":e,"aria-pressed":a,onClick:()=>n(e),className:X(`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,$.jsx)(`span`,{className:`font-mono text-[11px] tabular-nums`,children:r}):null]})}function _y({children:e,right:t=!1}){return(0,$.jsx)(`th`,{className:X(`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 vy=`h-11 border-b border-border px-2.5 whitespace-nowrap first:pl-4 last:pr-4`;function yy({run:e,queuePosition:t,onRename:n,now:r}){let i=It(),a=Cf(e),o=`/tasks/${e.id}`,s=dm(e.costUsd),c=_m(e);return(0,$.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,$.jsx)(`td`,{className:vy,children:(0,$.jsx)(py,{dot:a.tone,pulse:a.pulse,children:a.label})}),(0,$.jsx)(`td`,{className:X(vy,`w-[34%] max-w-0`),children:(0,$.jsx)(by,{run:e,to:o,onRename:n})}),(0,$.jsx)(`td`,{className:X(vy,`text-[12.5px] text-muted-foreground`),children:fm(e)}),(0,$.jsx)(`td`,{className:vy,children:e.branch?(0,$.jsx)(Ey,{branch:e.branch}):(0,$.jsx)(wy,{})}),(0,$.jsx)(`td`,{className:vy,children:e.diffStat?(0,$.jsx)(am,{stat:e.diffStat}):(0,$.jsx)(wy,{})}),(0,$.jsx)(`td`,{className:vy,children:c?(0,$.jsx)(om,{reference:c,taskTitle:$f(e)}):(0,$.jsx)(wy,{})}),(0,$.jsx)(`td`,{className:X(vy,`text-right font-mono text-xs text-muted-foreground tabular-nums`),children:Ef(e.tokensUsed)}),(0,$.jsx)(`td`,{className:X(vy,`text-right font-mono text-xs text-muted-foreground tabular-nums`),children:s||(0,$.jsx)(wy,{})}),t===null?(0,$.jsx)(xy,{run:e}):(0,$.jsxs)(`td`,{"data-slot":`queue-note`,colSpan:2,className:X(vy,`text-right font-mono text-[11.5px] text-soft-foreground`),children:[`#`,t,` in queue`]}),(0,$.jsx)(`td`,{className:X(vy,`text-right text-xs text-soft-foreground tabular-nums`),children:Tf(e.startedAt??e.createdAt,r)})]})}function by({run:e,to:t,onRename:n}){let r=$f(e),i=dy(r,t=>n(e.id,t));return i.editing?(0,$.jsx)(fy,{editor:i,className:`text-[13px] font-medium`}):(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,$.jsx)(Z,{to:t,title:r,className:`min-w-0 truncate text-[13px] font-medium`,children:r}),(0,$.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,$.jsx)(ar,{className:`size-3`,"aria-hidden":`true`})})]})}function xy({run:e}){let t=ym(e,bn(e.id));return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Sy,{column:`cpu`,cell:t.cpu}),(0,$.jsx)(Sy,{column:`mem`,cell:t.mem})]})}function Sy({column:e,cell:t}){return(0,$.jsx)(`td`,{"data-usage":e,"data-usage-kind":t.kind,title:t.title,className:X(vy,`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 Cy({run:e,queuePosition:t,now:n}){let r=It(),i=Cf(e),a=`/tasks/${e.id}`,o=_m(e);return(0,$.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,$.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[(0,$.jsx)(py,{dot:i.tone,pulse:i.pulse,className:`mt-px shrink-0`,children:i.label}),(0,$.jsx)(Z,{to:a,className:`min-w-0 flex-1 text-[13.5px] leading-[1.35] font-medium`,children:$f(e)}),(0,$.jsx)(`span`,{className:`mt-0.5 shrink-0 text-[11.5px] text-soft-foreground tabular-nums`,children:Tf(e.finishedAt??e.createdAt,n)})]}),(0,$.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,$.jsx)(`span`,{children:fm(e)}),t===null?(0,$.jsxs)($.Fragment,{children:[e.branch?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Ty,{}),(0,$.jsx)(`span`,{children:e.branch})]}):null,e.diffStat?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Ty,{}),(0,$.jsx)(am,{stat:e.diffStat,className:`text-[11.5px]`})]}):null,e.tokensUsed>0?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Ty,{}),(0,$.jsx)(`span`,{children:Ef(e.tokensUsed)})]}):null]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Ty,{}),(0,$.jsxs)(`span`,{"data-slot":`queue-note`,children:[`#`,t,` in queue`]})]}),o?(0,$.jsx)(om,{reference:o,taskTitle:$f(e),className:`h-5`}):null]})]})}function wy(){return(0,$.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`—`})}function Ty(){return(0,$.jsx)(`span`,{className:`text-soft-foreground`,"aria-hidden":`true`,children:`·`})}function Ey({branch:e}){return(0,$.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 Dy(){let e=Ze(),[t,n]=Xp(),r=V(),i=z({mutationFn:ne,onSuccess:()=>r.invalidateQueries({queryKey:s.runs.all})}),a=z({mutationFn:({id:e,title:t})=>He(e,{title:t}),onSuccess:()=>r.invalidateQueries({queryKey:s.runs.all}),onError:e=>U(e.message,{tone:`danger`})}),o=xm(3e4);return(0,$.jsx)(my,{runs:e.data,view:t,onViewChange:n,onArchiveFinished:()=>i.mutate(),onRename:(e,t)=>a.mutate({id:e,title:t}),now:o})}function Oy({mode:e=`list`}){let{automationId:t}=E(),n=It(),r=Ut(),[i,a]=(0,Q.useState)(),[o,s]=(0,Q.useState)(``),[c,l]=(0,Q.useState)({}),u=()=>j().then(a).catch(e=>s(String(e)));if((0,Q.useEffect)(()=>{u()},[]),(0,Q.useEffect)(()=>pn((e,t)=>{if(e!==`automation-change`)return;let n=t;typeof n.project==`string`&&(r===null||n.project===r)&&u()}),[r]),e===`new`)return(0,$.jsx)(Ay,{onSaved:()=>{n(`/automations`),u()}});if(e===`edit`){let e=i?.automations.find(e=>e.id===t);return e?(0,$.jsx)(Ay,{automation:e,onSaved:()=>{n(`/automations`),u()}}):(0,$.jsx)(My,{text:`Loading automation…`})}if(e===`log`){let e=i?.automations.find(e=>e.id===t);return t?(0,$.jsx)(ky,{automationId:t,automationName:e?.name}):(0,$.jsx)(My,{text:`Automation not found.`})}let d=async e=>{l(t=>({...t,[e.id]:`Checking…`}));try{let{checkId:t}=await We(e.id,`preview`);for(let n=0;n<60;n+=1){let n=await he(t);if(n.status===`complete`){l(t=>({...t,[e.id]:`${n.matches??0} match${n.matches===1?``:`es`} found; no tasks launched.`})),u();return}if(n.status===`error`)throw Error(n.error??`Preview failed`);await new Promise(e=>setTimeout(e,500))}throw Error(`Preview is still running`)}catch(t){l(n=>({...n,[e.id]:t instanceof Error?t.message:String(t)}))}};return(0,$.jsx)(jy,{title:`Automations`,subtitle:`Checks run while cezar is open. No webhook or public URL required.`,action:(0,$.jsx)(H,{asChild:!0,children:(0,$.jsxs)(Z,{to:`/automations/new`,children:[(0,$.jsx)(sr,{}),`New automation`]})}),children:o?(0,$.jsx)(My,{text:o}):i?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`mb-4 rounded-lg border bg-muted/30 px-4 py-3 text-sm`,children:[(0,$.jsxs)(`span`,{className:`font-medium`,children:[`GitHub `,i.available?`available`:`unavailable`]}),(0,$.jsxs)(`span`,{className:`text-muted-foreground`,children:[` · Scheduler `,i.scheduler.state,i.reason?` · ${i.reason}`:``]})]}),i.automations.length===0?(0,$.jsx)(My,{text:`No automations yet. Create one paused, test its bounded filter, then enable it from a current-time baseline.`}):(0,$.jsx)(`div`,{className:`grid gap-3`,children:i.automations.map(e=>(0,$.jsxs)(`article`,{className:`rounded-xl border bg-card p-4`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{className:`font-semibold`,children:e.name}),(0,$.jsxs)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:[e.events.join(`, `),` · every `,Math.round(e.intervalSeconds/60),` min`]})]}),(0,$.jsx)(`span`,{className:`rounded-full border px-2 py-1 text-xs`,children:e.enabled?`Enabled`:`Paused`})]}),(0,$.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:[(0,$.jsxs)(H,{size:`sm`,variant:`outline`,onClick:()=>void d(e),disabled:c[e.id]===`Checking…`,children:[(0,$.jsx)(or,{}),`Test filter`]}),(0,$.jsx)(H,{size:`sm`,variant:`outline`,onClick:()=>void we(e.id,!e.enabled).then(u),children:e.enabled?`Pause`:`Enable`}),(0,$.jsx)(H,{size:`sm`,variant:`ghost`,asChild:!0,children:(0,$.jsx)(Z,{to:`/automations/${e.id}`,children:`Edit`})}),(0,$.jsx)(H,{size:`sm`,variant:`ghost`,asChild:!0,children:(0,$.jsx)(Z,{to:`/automations/${e.id}/log`,children:`View log`})})]}),c[e.id]&&(0,$.jsx)(`p`,{className:`mt-3 text-sm text-muted-foreground`,role:`status`,children:c[e.id]})]},e.id))})]}):(0,$.jsx)(My,{text:`Loading automations…`})})}function ky({automationId:e,automationName:t}){let[n,r]=(0,Q.useState)(),[i,a]=(0,Q.useState)(``),o=()=>S(e).then(({records:e})=>r(e)).catch(e=>a(String(e)));return(0,Q.useEffect)(()=>{o()},[e]),(0,Q.useEffect)(()=>pn((t,n)=>{t===`automation-change`&&n.automationId===e&&o()}),[e]),(0,$.jsx)(jy,{title:`Execution log`,subtitle:t??`Automation activity`,action:(0,$.jsx)(H,{variant:`outline`,asChild:!0,children:(0,$.jsx)(Z,{to:`/automations`,children:`Back to automations`})}),children:i?(0,$.jsx)(My,{text:i}):n?n.length===0?(0,$.jsx)(My,{text:`No checks have run yet.`}):(0,$.jsx)(`ol`,{className:`grid gap-3`,"aria-label":`Automation execution log`,children:n.map(e=>(0,$.jsxs)(`li`,{className:`rounded-xl border bg-card p-4`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,$.jsx)(`span`,{className:`font-medium capitalize`,children:e.result.replace(`-`,` `)}),(0,$.jsx)(`time`,{className:`text-xs text-muted-foreground`,dateTime:e.ts,children:new Date(e.ts).toLocaleString()})]}),e.reason&&(0,$.jsx)(`p`,{className:`mt-2 text-sm text-muted-foreground`,children:e.reason}),(e.githubUrl||e.runId)&&(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-3 text-sm`,children:[e.githubUrl&&(0,$.jsx)(`a`,{className:`underline underline-offset-4`,href:e.githubUrl,target:`_blank`,rel:`noreferrer`,children:e.githubTitle??`GitHub #${e.githubNumber??``}`}),e.runId&&(0,$.jsx)(Z,{className:`underline underline-offset-4`,to:`/runs/${e.runId}`,children:`Open task`})]})]},e.seq))}):(0,$.jsx)(My,{text:`Loading execution log…`})})}function Ay({automation:e,onSaved:t}){let[n,r]=(0,Q.useState)(e?.name??``),[i,a]=(0,Q.useState)(e?.task.prompt??`Review {{github.url}}`),[o,s]=(0,Q.useState)(!1),[c,l]=(0,Q.useState)(``);return(0,$.jsx)(jy,{title:e?`Edit automation`:`New automation`,subtitle:`Define a bounded GitHub trigger and the ordinary cezar task it launches.`,children:(0,$.jsxs)(`form`,{className:`grid max-w-3xl gap-6`,onSubmit:async r=>{r.preventDefault(),l(``);try{e?await Oe(e.id,{name:n,description:e.description,events:e.events,intervalSeconds:e.intervalSeconds,filters:e.filters,task:{...e.task,prompt:i},enabled:e.enabled,expectedRevision:e.revision}):await D({name:n,events:[`issue.opened`],intervalSeconds:300,filters:{lookbackDays:7,maxRecords:25},task:{prompt:i,workflow:`quick-task`},enable:o}),t()}catch(e){l(String(e))}},children:[(0,$.jsxs)(`fieldset`,{className:`grid gap-4 rounded-xl border p-5`,children:[(0,$.jsx)(`legend`,{className:`px-2 font-semibold`,children:`When GitHub changes`}),(0,$.jsxs)(`div`,{className:`grid gap-2`,children:[(0,$.jsx)(Uu,{htmlFor:`automation-name`,children:`Name`}),(0,$.jsx)(Hu,{id:`automation-name`,value:n,onChange:e=>r(e.target.value),required:!0})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,$.jsx)(Fn,{className:`size-4`}),`New issue · every 5 minutes · last 7 days · maximum 25 records`]})]}),(0,$.jsxs)(`fieldset`,{className:`grid gap-4 rounded-xl border p-5`,children:[(0,$.jsx)(`legend`,{className:`px-2 font-semibold`,children:`What task to run`}),(0,$.jsxs)(`div`,{className:`grid gap-2`,children:[(0,$.jsx)(Uu,{htmlFor:`automation-prompt`,children:`Prompt`}),(0,$.jsx)(Tt,{id:`automation-prompt`,value:i,onChange:e=>a(e.target.value),rows:8,required:!0})]}),(0,$.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Placeholders include `,`{{github.number}}`,`, `,`{{github.title}}`,`, `,`{{github.url}}`,`, and `,`{{github.labels}}`,`. GitHub content is appended as untrusted context.`]})]}),(0,$.jsxs)(`fieldset`,{className:`rounded-xl border p-5`,children:[(0,$.jsx)(`legend`,{className:`px-2 font-semibold`,children:`Review and enable`}),(0,$.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:o,onChange:e=>s(e.target.checked)}),`Save and enable from a current-time baseline (existing matches will not launch)`]})]}),c&&(0,$.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:c}),(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[(0,$.jsx)(H,{type:`submit`,children:`Save automation`}),(0,$.jsx)(H,{type:`button`,variant:`outline`,onClick:t,children:`Cancel`})]})]})})}function jy({title:e,subtitle:t,action:n,children:r}){return(0,$.jsxs)(`main`,{className:`mx-auto w-full max-w-6xl p-4 sm:p-6`,children:[(0,$.jsxs)(`header`,{className:`mb-6 flex flex-wrap items-start justify-between gap-3`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{className:`mb-2 flex items-center gap-2`,children:[(0,$.jsx)(mr,{className:`size-5`}),(0,$.jsx)(`h1`,{className:`text-2xl font-semibold`,children:e})]}),(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t})]}),n]}),r]})}function My({text:e}){return(0,$.jsx)(`div`,{className:`rounded-xl border border-dashed p-8 text-center text-sm text-muted-foreground`,children:e})}var Ny=(0,Q.lazy)(()=>J(()=>import(`./task-thread-DMM5s2zt.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]))),Py=(0,Q.lazy)(()=>J(()=>import(`./compare-variants-JnaeMTz5.js`).then(e=>({default:e.CompareVariantsRoute})),__vite__mapDeps([25,5,7,8,9,10,20,22,17]))),Fy=(0,Q.lazy)(()=>J(()=>import(`./task-changes-BYNpnV0E.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]))),Iy=(0,Q.lazy)(()=>J(()=>import(`./task-files-DAqPuHp1.js`).then(e=>({default:e.TaskFilesRoute})),__vite__mapDeps([33,5,7,8,9,10,11,12,13,14,15,16,17,18,28,34]))),Ly=(0,Q.lazy)(()=>J(()=>import(`./task-commits-DRnMTXtG.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]))),Ry=(0,Q.lazy)(()=>J(()=>import(`./repo-git-DnkvanyM.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]))),zy=(0,Q.lazy)(()=>J(()=>import(`./github-hrWK-ST8.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]))),By=(0,Q.lazy)(()=>J(()=>import(`./github-hrWK-ST8.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]))),Vy=(0,Q.lazy)(()=>J(()=>import(`./workflows-DCkK4Bsn.js`).then(e=>({default:e.WorkflowsRoute})),__vite__mapDeps([41,5,7,8,9,10,14,42,18,34,30,21]))),Hy=(0,Q.lazy)(()=>J(()=>import(`./skills-CE0HAI_G.js`).then(e=>({default:e.SkillsRoute})),__vite__mapDeps([43,5,7,8,9,10,36,12,42,40,34,17])));function Uy(){let e=L();return(0,$.jsx)(Ht,{to:{pathname:`/skills`,search:e.search,hash:e.hash},replace:!0})}function Wy({sectionId:e}){let t=L();return(0,$.jsx)(Ke,{to:{pathname:iy(`global`,e),search:t.search,hash:t.hash},replace:!0})}function Gy(){return(0,$.jsx)(`div`,{"data-route":`scope-resolving`,className:`flex min-h-full flex-col`,children:(0,$.jsx)(`p`,{className:`px-4 py-6 text-center text-xs text-soft-foreground`,children:`Loading…`})})}function Ky(){let{projectId:e=``}=E(),t=L(),n=ve(),r=C();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,$.jsx)(Ke,{to:`/p/${encodeURIComponent(e)}${n||`/`}${t.search}${t.hash}`,replace:!0})}if(!n.isError)return(0,$.jsx)(Gy,{})}if(n.data){if(!(n.data.bootProject===e||n.data.projects.some(t=>t.id===e)))return(0,$.jsx)(x_,{projectId:e,registry:n.data})}else if(!n.isError)return(0,$.jsx)(Gy,{});return(0,$.jsx)(Wt,{projectId:n.data?.bootProject===e?null:e,children:(0,$.jsx)(c,{},e)})}function qy(){let{projectId:e=``}=E();return(0,$.jsx)(s_,{},e)}function Jy(){let e=L(),t=C();if(t.data===void 0)return(0,$.jsx)(Gy,{});let n=t.data.bootProject??`default`,r=e.pathname===`/p`||e.pathname===`/p/`?`/`:e.pathname;return(0,$.jsx)(Ke,{to:`/p/${encodeURIComponent(n)}${r}${e.search}${e.hash}`,replace:!0})}var Yy=[{pattern:`/`,pageLabel:`Tasks`},{pattern:`/new`,pageLabel:`New task`},{pattern:`/compare/:groupId`,pageLabel:`Compare`},{pattern:`/git/*`,pageLabel:`Git`},{pattern:`/github/*`,pageLabel:`GitHub`},{pattern:`/automations/*`,pageLabel:`Automations`},{pattern:`/skills`,pageLabel:`Skills`},{pattern:`/inbox`,pageLabel:`Inbox`},{pattern:`/workflows/*`,pageLabel:`Workflows`},{pattern:`/settings/*`,pageLabel:`Settings`}];function Xy(e){let t=Vt(e),n=F({path:`/tasks/:id/*`,end:!0},t);return n?{pageLabel:null,taskId:n.params.id??null}:{pageLabel:Yy.find(({pattern:e})=>F({path:e,end:!0},t))?.pageLabel??null,taskId:null}}function Zy(){let e=C().data?.capabilities;return(0,$.jsxs)(N,{children:[(0,$.jsxs)(W,{path:`/p/:projectId`,element:(0,$.jsx)(Ky,{}),children:[(0,$.jsx)(W,{index:!0,element:(0,$.jsx)(Dy,{})}),(0,$.jsx)(W,{path:`new`,element:(0,$.jsx)(qy,{})}),(0,$.jsx)(W,{path:`tasks/:id`,element:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(T_,{}),children:(0,$.jsx)(Ny,{})})}),(0,$.jsx)(W,{path:`tasks/:id/changes`,element:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(C_,{tab:`changes`}),children:(0,$.jsx)(Fy,{})})}),(0,$.jsx)(W,{path:`tasks/:id/files`,element:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(C_,{tab:`files`}),children:(0,$.jsx)(Iy,{})})}),(0,$.jsx)(W,{path:`tasks/:id/commits`,element:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(C_,{tab:`changes`}),children:(0,$.jsx)(Ly,{})})}),(0,$.jsx)(W,{path:`tasks/:id/commits/:sha`,element:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(C_,{tab:`changes`}),children:(0,$.jsx)(Ly,{})})}),(0,$.jsx)(W,{path:`compare/:groupId`,element:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(Um,{}),children:(0,$.jsx)(Py,{})})}),(0,$.jsx)(W,{path:`git`,element:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(y_,{}),children:(0,$.jsx)(Ry,{tab:`changes`})})}),(0,$.jsx)(W,{path:`git/commits`,element:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(y_,{}),children:(0,$.jsx)(Ry,{tab:`commits`})})}),(0,$.jsx)(W,{path:`git/commits/:sha`,element:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(y_,{}),children:(0,$.jsx)(Ry,{tab:`commits`})})}),(0,$.jsx)(W,{path:`git/branches`,element:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(y_,{}),children:(0,$.jsx)(Ry,{tab:`branches`})})}),(0,$.jsx)(W,{path:`github`,element:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(Wm,{}),children:(0,$.jsx)(By,{})})}),(0,$.jsx)(W,{path:`github/prs`,element:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(Wm,{}),children:(0,$.jsx)(zy,{view:`prs`})})}),(0,$.jsx)(W,{path:`github/issues/:n`,element:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(Wm,{}),children:(0,$.jsx)(zy,{view:`issues`})})}),(0,$.jsx)(W,{path:`github/prs/:n`,element:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(Wm,{}),children:(0,$.jsx)(zy,{view:`prs`})})}),(0,$.jsx)(W,{path:`github/prs/:n/changes`,element:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(Wm,{}),children:(0,$.jsx)(zy,{view:`prs`,changes:!0})})}),(0,$.jsx)(W,{path:`automations`,element:(0,$.jsx)(Oy,{})}),(0,$.jsx)(W,{path:`automations/new`,element:(0,$.jsx)(Oy,{mode:`new`})}),(0,$.jsx)(W,{path:`automations/:automationId`,element:(0,$.jsx)(Oy,{mode:`edit`})}),(0,$.jsx)(W,{path:`automations/:automationId/log`,element:(0,$.jsx)(Oy,{mode:`log`})}),(0,$.jsx)(W,{path:`skills`,element:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(b_,{}),children:(0,$.jsx)(Hy,{})})}),(0,$.jsx)(W,{path:`inbox`,element:(0,$.jsx)(Bh,{})}),(0,$.jsx)(W,{path:`workflows`,element:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(S_,{}),children:(0,$.jsx)(Vy,{})})}),(0,$.jsx)(W,{path:`workflows/:name`,element:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(S_,{}),children:(0,$.jsx)(Vy,{})})}),(0,$.jsx)(W,{path:`settings`,element:(0,$.jsx)(uy,{scope:`project`,capabilities:e})}),(0,$.jsx)(W,{path:`settings/skills`,element:(0,$.jsx)(Uy,{})}),ry(`project`,e).map(t=>(0,$.jsx)(W,{path:`settings/${t.id}`,element:(0,$.jsx)(ly,{section:t,scope:`project`,capabilities:e})},t.id)),ry(`global`,e).map(e=>(0,$.jsx)(W,{path:`settings/${e.id}`,element:(0,$.jsx)(Wy,{sectionId:e.id})},e.id)),(0,$.jsx)(W,{path:`*`,element:(0,$.jsx)(v_,{})})]}),(0,$.jsx)(W,{path:`/settings/global`,element:(0,$.jsx)(uy,{scope:`global`,capabilities:e})}),ry(`global`,e).map(t=>(0,$.jsx)(W,{path:iy(`global`,t.id),element:(0,$.jsx)(ly,{section:t,scope:`global`,capabilities:e})},t.id)),(0,$.jsx)(W,{path:`*`,element:(0,$.jsx)(Jy,{})})]})}function Qy(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 $y(e){return e?.available===!0&&(e.status===`available`||e.status===`error`)}function eb({children:e}){let{pathname:t}=L(),n=Ut(),r=C(),i=r.data?.capabilities.followups===!0,a=ft(i),o=$y(Te(n??``,n!==null).data),s=ve().data,c=Xy(t),l=s?.bootProject??r.data?.bootProject??null,u=n!==null&&n===l,d=s?.projects.find(e=>e.id===n),f=O(n??``,d!==void 0&&c.taskId!==null,s?.bootProject===n).data,p=t===`/settings/global`||t.startsWith(`/settings/global/`)?null:d?.name??(u?Qy(r.data)?.name??null:null),m=c.taskId?f?.find(e=>e.id===c.taskId):void 0;Hm({projectName:p,pageLabel:m?$f(m):c.pageLabel});let h=s&&s.projects.length>1?s:null;return(0,$.jsxs)(Yp,{children:[(0,$.jsx)(Rp,{repo:Qy(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,$.jsx)(im,{}),singleProject:r.data?.capabilities.singleProject===!0,taskQuickList:(0,$.jsx)(Om,{}),projectGroups:h?(0,$.jsx)(Nm,{projects:h.projects,bootProjectId:h.bootProject,forgeAvailable:r.data?.forge?.available===!0,inboxAvailable:i,inboxCount:a.data?.length??null,skillsUpdateAvailable:o}):void 0,toolsMenu:(0,$.jsx)(Lm,{health:r.data}),children:e}),(0,$.jsx)(hp,{})]})}function tb(){let e=V(),t=xv(p().data?.notifications).enabled,n=(0,Q.useRef)(t);n.current=t;let r=(0,Q.useRef)(new Map);return(0,Q.useEffect)(()=>{let t=it(s.runs.list()),i=e=>{let{entering:t,statuses:i}=Cv(r.current,e);if(r.current=i,t.length!==0&&wv({enabled:n.current,hidden:document.visibilityState===`hidden`,permission:Sv()}))for(let e of t)nb(e)};return i(e.getQueryData(s.runs.list())),e.getQueryCache().subscribe(e=>{e.query.queryHash!==t||e.type!==`updated`||i(e.query.state.data)})},[e]),null}function nb(e){let t=globalThis.Notification;if(typeof t!=`function`)return;let n=Tv(e);try{new t(n.title,{body:n.body,tag:n.tag})}catch{}}function rb(){let[e]=(0,Q.useState)(Cn);return(0,$.jsx)(l,{client:e,children:(0,$.jsxs)(yn,{children:[(0,$.jsx)(tb,{}),(0,$.jsx)(ld,{children:(0,$.jsx)(cv,{children:(0,$.jsxs)(_,{children:[(0,$.jsx)(eb,{children:(0,$.jsx)(Zy,{})}),(0,$.jsx)(at,{})]})})})]})})}var ib=document.getElementById(`root`);if(!ib)throw Error(`cezar: #root container is missing from index.html`);(0,Zt.createRoot)(ib).render((0,$.jsx)(Q.StrictMode,{children:(0,$.jsx)(rb,{})}));export{gm as $,ar as $t,Ah as A,Cf as At,oh as B,Mu as Bt,vg as C,jf as Ct,Uh as D,If as Dt,Hh as E,Vf as Et,yh as F,vf as Ft,$m as G,zu as Gt,ih as H,Bu as Ht,_h as I,mf as It,Wm as J,dr as Jt,Qm as K,hr as Kt,uh as L,Qu as Lt,Sh as M,hf as Mt,vh as N,gf as Nt,Nh as O,Ef as Ot,bh as P,pf as Pt,vm as Q,or as Qt,lh as R,Gu as Rt,yg as S,Mf as St,eg as T,qf as Tt,Xm as U,Ru as Ut,sh as V,Iu as Vt,Ym as W,Lu as Wt,cm as X,cr as Xt,Um as Y,lr as Yt,dm as Z,sr as Zt,t_ as _,$f as _t,T_ as a,Nn as an,Ap as at,Eg as b,Of as bt,S_ as c,Tn as cn,Mp as ct,r_ as d,bp as dt,qn as en,hm as et,i_ as f,Cp as ft,$g as g,tp as gt,e_ as h,ep as ht,yv as i,Pn as in,Tp as it,Ph as j,df as jt,Ih as k,Tf as kt,y_ as l,wn as ln,_p as lt,n_ as m,vp as mt,fy as n,Un as nn,om as nt,w_ as o,Mn as on,Np as ot,Qg as p,wp as pt,rh as q,mr as qt,dy as r,Rn as rn,am as rt,C_ as s,jn as sn,jp as st,py as t,Kn as tn,fm as tt,Yg as u,yp as ut,Dg as v,Pf as vt,ug as w,Kf as wt,Tg as x,kf as xt,Og as y,Jf as yt,ch as z,Hu as zt};