@edspencer/paddock 0.71.0 → 0.71.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/packages/server/dist/chat-dto.d.ts +3 -2
- package/packages/server/dist/chat-dto.js +9 -1
- package/packages/server/dist/cli/paddock.js +3 -3
- package/packages/server/dist/cli/service/index.d.ts +10 -1
- package/packages/server/dist/cli/service/index.js +43 -5
- package/packages/server/dist/cli/service/ready.d.ts +61 -0
- package/packages/server/dist/cli/service/ready.js +71 -0
- package/packages/server/dist/discover.d.ts +37 -0
- package/packages/server/dist/discover.js +51 -0
- package/packages/server/dist/herdctl.d.ts +2 -1
- package/packages/server/dist/herdctl.js +11 -6
- package/packages/server/dist/last-activity.d.ts +34 -0
- package/packages/server/dist/last-activity.js +178 -0
- package/packages/server/dist/management-ops.js +5 -1
- package/packages/server/dist/routes/discover.js +10 -3
- package/packages/server/dist/self-mcp-types.d.ts +4 -1
- package/packages/server/dist/transcripts.js +5 -3
- package/packages/server/package.json +1 -1
- package/packages/web/dist/assets/Chip-Db--PJFH.js +2 -0
- package/packages/web/dist/assets/DiscoverPage-BFo4FTzZ.js +2 -0
- package/packages/web/dist/assets/DiscoverView-C4hOB3nr.js +2 -0
- package/packages/web/dist/assets/InstanceConfigPage-U78M95nW.js +2 -0
- package/packages/web/dist/assets/{MarkdownRenderer-BOrDawoY.js → MarkdownRenderer-DdoNl0Ao.js} +2 -2
- package/packages/web/dist/assets/{ProjectMenu-B_8NYWZr.js → ProjectMenu-BxQu14ze.js} +1 -1
- package/packages/web/dist/assets/{ProjectRedirect-xFWTlADS.js → ProjectRedirect-QuGeN-qx.js} +1 -1
- package/packages/web/dist/assets/ProjectView-FUcyJMUf.js +13 -0
- package/packages/web/dist/assets/{ProjectsGrid-BF65wTqN.js → ProjectsGrid-CUFNVTif.js} +1 -1
- package/packages/web/dist/assets/RootHome-SIxo-xX9.js +2 -0
- package/packages/web/dist/assets/{arc-7GXE70CZ.js → arc-C0DRwCCT.js} +1 -1
- package/packages/web/dist/assets/{architectureDiagram-3BPJPVTR-CAEj_lAw.js → architectureDiagram-3BPJPVTR-Wwpf4cvW.js} +1 -1
- package/packages/web/dist/assets/{blockDiagram-GPEHLZMM-wNLONvdQ.js → blockDiagram-GPEHLZMM-DKmCbgWk.js} +1 -1
- package/packages/web/dist/assets/{c4Diagram-AAUBKEIU-Cf7MUqJz.js → c4Diagram-AAUBKEIU-CJ8LiLsj.js} +1 -1
- package/packages/web/dist/assets/channel-DEmtNKeB.js +2 -0
- package/packages/web/dist/assets/{chunk-2J33WTMH-W18BVHtE.js → chunk-2J33WTMH-C3P-O4C3.js} +1 -1
- package/packages/web/dist/assets/{chunk-4BX2VUAB-DDJQi9KC.js → chunk-4BX2VUAB-Cs9u7x61.js} +1 -1
- package/packages/web/dist/assets/{chunk-55IACEB6-L5afa49k.js → chunk-55IACEB6-C1st284U.js} +1 -1
- package/packages/web/dist/assets/{chunk-727SXJPM-Bb0Sw8oK.js → chunk-727SXJPM-BjCAWo7B.js} +1 -1
- package/packages/web/dist/assets/{chunk-AQP2D5EJ-DRrKTv1K.js → chunk-AQP2D5EJ-BP6S9w2Q.js} +1 -1
- package/packages/web/dist/assets/{chunk-FMBD7UC4-CIsdDBaT.js → chunk-FMBD7UC4-C3ySTaPs.js} +1 -1
- package/packages/web/dist/assets/{chunk-ND2GUHAM-DN5ua8KT.js → chunk-ND2GUHAM-eNPD4vzc.js} +1 -1
- package/packages/web/dist/assets/{chunk-QZHKN3VN-DE1WNShj.js → chunk-QZHKN3VN-BbBpgHkO.js} +1 -1
- package/packages/web/dist/assets/classDiagram-4FO5ZUOK-dAGAuccL.js +2 -0
- package/packages/web/dist/assets/classDiagram-v2-Q7XG4LA2-dAGAuccL.js +2 -0
- package/packages/web/dist/assets/{core-DadwNpE4.js → core-ZwDDec0y.js} +1 -1
- package/packages/web/dist/assets/{cose-bilkent-S5V4N54A-2FTPTDA6.js → cose-bilkent-S5V4N54A-DiM4eeF5.js} +1 -1
- package/packages/web/dist/assets/{dagre-BM42HDAG-eJ7MdaEX.js → dagre-BM42HDAG-DKIEUM4M.js} +1 -1
- package/packages/web/dist/assets/{diagram-2AECGRRQ-D8MZTSkB.js → diagram-2AECGRRQ-CqlX7j8t.js} +1 -1
- package/packages/web/dist/assets/{diagram-5GNKFQAL-DVXF3Z-H.js → diagram-5GNKFQAL-Dph5apqo.js} +1 -1
- package/packages/web/dist/assets/{diagram-KO2AKTUF-DoXfbQ0i.js → diagram-KO2AKTUF-TW6LyHGt.js} +1 -1
- package/packages/web/dist/assets/{diagram-LMA3HP47-CRW0fiqv.js → diagram-LMA3HP47-BxxIIv5a.js} +1 -1
- package/packages/web/dist/assets/{diagram-OG6HWLK6-DfhYXDqr.js → diagram-OG6HWLK6-B8M0DeV7.js} +1 -1
- package/packages/web/dist/assets/{erDiagram-TEJ5UH35-HG0QTHgA.js → erDiagram-TEJ5UH35-Bfpy6UQa.js} +1 -1
- package/packages/web/dist/assets/{flowDiagram-I6XJVG4X-ChVekwUy.js → flowDiagram-I6XJVG4X-DstRzxek.js} +1 -1
- package/packages/web/dist/assets/{ganttDiagram-6RSMTGT7-CeA-6Z-T.js → ganttDiagram-6RSMTGT7-Bg0oFbAl.js} +1 -1
- package/packages/web/dist/assets/{gitGraphDiagram-PVQCEYII-ew2oouNN.js → gitGraphDiagram-PVQCEYII-CX4IozE-.js} +1 -1
- package/packages/web/dist/assets/{index-CbqaEg2j.js → index-ASW1Jl0Y.js} +2 -2
- package/packages/web/dist/assets/index-bC5uCujx.css +1 -0
- package/packages/web/dist/assets/{infoDiagram-5YYISTIA-BY9NYdld.js → infoDiagram-5YYISTIA-CG2qCk6u.js} +1 -1
- package/packages/web/dist/assets/{ishikawaDiagram-YF4QCWOH-CgbdrGBm.js → ishikawaDiagram-YF4QCWOH-CPErvl3a.js} +1 -1
- package/packages/web/dist/assets/{journeyDiagram-JHISSGLW-BepLFtbU.js → journeyDiagram-JHISSGLW-Bm6krUsf.js} +1 -1
- package/packages/web/dist/assets/{kanban-definition-UN3LZRKU-JHMJYGJu.js → kanban-definition-UN3LZRKU-B4CC8CAx.js} +1 -1
- package/packages/web/dist/assets/{linear-Ccw8eVgC.js → linear-CJ1DbrOX.js} +1 -1
- package/packages/web/dist/assets/{mermaid.core-lHjASk7x.js → mermaid.core-Dk2kkhf9.js} +4 -4
- package/packages/web/dist/assets/{mindmap-definition-RKZ34NQL-Bi5Iq2M4.js → mindmap-definition-RKZ34NQL-CThvf_YD.js} +1 -1
- package/packages/web/dist/assets/{pieDiagram-4H26LBE5-rZuB_P1J.js → pieDiagram-4H26LBE5-DvkHcng6.js} +1 -1
- package/packages/web/dist/assets/{quadrantDiagram-W4KKPZXB-BuStI37i.js → quadrantDiagram-W4KKPZXB-CqhrTh9q.js} +1 -1
- package/packages/web/dist/assets/{requirementDiagram-4Y6WPE33-BFElQKEX.js → requirementDiagram-4Y6WPE33-CZykiLym.js} +1 -1
- package/packages/web/dist/assets/{sankeyDiagram-5OEKKPKP-tzdQCr91.js → sankeyDiagram-5OEKKPKP-D-TzCKMx.js} +1 -1
- package/packages/web/dist/assets/{sequenceDiagram-3UESZ5HK-j1koqb6Q.js → sequenceDiagram-3UESZ5HK-C5pIItVu.js} +1 -1
- package/packages/web/dist/assets/{stateDiagram-AJRCARHV-B-dUkvgq.js → stateDiagram-AJRCARHV-DE6G2JfB.js} +1 -1
- package/packages/web/dist/assets/stateDiagram-v2-BHNVJYJU-BP6oowh1.js +2 -0
- package/packages/web/dist/assets/{timeline-definition-PNZ67QCA-BWyq6u64.js → timeline-definition-PNZ67QCA-C1VK2OfU.js} +1 -1
- package/packages/web/dist/assets/{vennDiagram-CIIHVFJN-B0CRl3xN.js → vennDiagram-CIIHVFJN-CtOozEwa.js} +1 -1
- package/packages/web/dist/assets/{wardley-L42UT6IY-C45bBEPS.js → wardley-L42UT6IY-DvHGK-lb.js} +1 -1
- package/packages/web/dist/assets/{wardleyDiagram-YWT4CUSO-DT50TWrW.js → wardleyDiagram-YWT4CUSO-DxKwZ3-G.js} +1 -1
- package/packages/web/dist/assets/{xychartDiagram-2RQKCTM6-C8iBuFGD.js → xychartDiagram-2RQKCTM6-HM4j3l6y.js} +1 -1
- package/packages/web/dist/index.html +2 -2
- package/packages/web/dist/sw.js +1 -1
- package/packages/web/dist/assets/Chip-5S5MAayn.js +0 -2
- package/packages/web/dist/assets/DiscoverPage-CEzcRO7X.js +0 -2
- package/packages/web/dist/assets/DiscoverView-CArICIRO.js +0 -2
- package/packages/web/dist/assets/InstanceConfigPage-CKjJsaGZ.js +0 -2
- package/packages/web/dist/assets/ProjectView-polknqZw.js +0 -13
- package/packages/web/dist/assets/RootHome-32k1iDh4.js +0 -2
- package/packages/web/dist/assets/Surfaces-DCm19ZAD.js +0 -2
- package/packages/web/dist/assets/channel-U0NZSTs2.js +0 -2
- package/packages/web/dist/assets/classDiagram-4FO5ZUOK-D1QjNKTc.js +0 -2
- package/packages/web/dist/assets/classDiagram-v2-Q7XG4LA2-D1QjNKTc.js +0 -2
- package/packages/web/dist/assets/index-tvJIh4A9.css +0 -1
- package/packages/web/dist/assets/stateDiagram-v2-BHNVJYJU-b1ksIBrs.js +0 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ProjectsGrid-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ProjectsGrid-CUFNVTif.js","assets/ProjectMenu-BxQu14ze.js","assets/ProjectView-FUcyJMUf.js","assets/queued-CagZVfWU.js","assets/Chip-Db--PJFH.js","assets/lastTab-CU1zsF0j.js","assets/DiscoverView-C4hOB3nr.js","assets/ProjectRedirect-QuGeN-qx.js","assets/InstanceConfigPage-U78M95nW.js","assets/DiscoverPage-BFo4FTzZ.js","assets/RootHome-SIxo-xX9.js"])))=>i.map(i=>d[i]);
|
|
2
2
|
function xd(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const o in r)if(o!=="default"&&!(o in e)){const l=Object.getOwnPropertyDescriptor(r,o);l&&Object.defineProperty(e,o,l.get?l:{enumerable:!0,get:()=>r[o]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))r(o);new MutationObserver(o=>{for(const l of o)if(l.type==="childList")for(const i of l.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&r(i)}).observe(document,{childList:!0,subtree:!0});function n(o){const l={};return o.integrity&&(l.integrity=o.integrity),o.referrerPolicy&&(l.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?l.credentials="include":o.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function r(o){if(o.ep)return;o.ep=!0;const l=n(o);fetch(o.href,l)}})();const Up="modulepreload",Ap=function(e){return"/"+e},Du={},Kt=function(t,n,r){let o=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const i=document.querySelector("meta[property=csp-nonce]"),a=(i==null?void 0:i.nonce)||(i==null?void 0:i.getAttribute("nonce"));o=Promise.allSettled(n.map(s=>{if(s=Ap(s),s in Du)return;Du[s]=!0;const u=s.endsWith(".css"),d=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${s}"]${d}`))return;const c=document.createElement("link");if(c.rel=u?"stylesheet":Up,u||(c.as="script"),c.crossOrigin="",c.href=s,a&&c.setAttribute("nonce",a),document.head.appendChild(c),u)return new Promise((p,w)=>{c.addEventListener("load",p),c.addEventListener("error",()=>w(new Error(`Unable to preload CSS for ${s}`)))})}))}function l(i){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=i,window.dispatchEvent(a),!a.defaultPrevented)throw i}return o.then(i=>{for(const a of i||[])a.status==="rejected"&&l(a.reason);return t().catch(l)})};var A1=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Sd(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var kd={exports:{}},ii={},Ed={exports:{}},ee={};/**
|
|
3
3
|
* @license React
|
|
4
4
|
* react.production.min.js
|
|
@@ -67,5 +67,5 @@ Error generating stack: `+l.message+`
|
|
|
67
67
|
* LICENSE.md file in the root directory of this source tree.
|
|
68
68
|
*
|
|
69
69
|
* @license MIT
|
|
70
|
-
*/function Ur(){return Ur=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Ur.apply(this,arguments)}function Zh(e,t){if(e==null)return{};var n={},r=Object.keys(e),o,l;for(l=0;l<r.length;l++)o=r[l],!(t.indexOf(o)>=0)&&(n[o]=e[o]);return n}function My(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Ly(e,t){return e.button===0&&(!t||t==="_self")&&!My(e)}const Iy=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","unstable_viewTransition"],Dy=["aria-current","caseSensitive","className","end","style","to","unstable_viewTransition","children"],Oy="6";try{window.__reactRouterVersion=Oy}catch{}function $y(e,t){return Vv({basename:void 0,future:Ur({},void 0,{v7_prependBasename:!0}),history:pv({window:void 0}),hydrationData:zy(),routes:e,mapRouteProperties:_y,unstable_dataStrategy:void 0,unstable_patchRoutesOnNavigation:void 0,window:void 0}).initialize()}function zy(){var e;let t=(e=window)==null?void 0:e.__staticRouterHydrationData;return t&&t.errors&&(t=Ur({},t,{errors:Uy(t.errors)})),t}function Uy(e){if(!e)return null;let t=Object.entries(e),n={};for(let[r,o]of t)if(o&&o.__type==="RouteErrorResponse")n[r]=new oi(o.status,o.statusText,o.data,o.internal===!0);else if(o&&o.__type==="Error"){if(o.__subType){let l=window[o.__subType];if(typeof l=="function")try{let i=new l(o.message);i.stack="",n[r]=i}catch{}}if(n[r]==null){let l=new Error(o.message);l.stack="",n[r]=l}}else n[r]=o;return n}const qh=E.createContext({isTransitioning:!1}),Ay=E.createContext(new Map),Fy="startTransition",ld=tm[Fy],by="flushSync",id=hv[by];function By(e){ld?ld(e):e()}function no(e){id?id(e):e()}class Wy{constructor(){this.status="pending",this.promise=new Promise((t,n)=>{this.resolve=r=>{this.status==="pending"&&(this.status="resolved",t(r))},this.reject=r=>{this.status==="pending"&&(this.status="rejected",n(r))}})}}function Vy(e){let{fallbackElement:t,router:n,future:r}=e,[o,l]=E.useState(n.state),[i,a]=E.useState(),[s,u]=E.useState({isTransitioning:!1}),[d,c]=E.useState(),[p,w]=E.useState(),[x,k]=E.useState(),R=E.useRef(new Map),{v7_startTransition:v}=r||{},h=E.useCallback(m=>{v?By(m):m()},[v]),g=E.useCallback((m,O)=>{let{deletedFetchers:L,unstable_flushSync:H,unstable_viewTransitionOpts:oe}=O;L.forEach(de=>R.current.delete(de)),m.fetchers.forEach((de,rt)=>{de.data!==void 0&&R.current.set(rt,de.data)});let ge=n.window==null||n.window.document==null||typeof n.window.document.startViewTransition!="function";if(!oe||ge){H?no(()=>l(m)):h(()=>l(m));return}if(H){no(()=>{p&&(d&&d.resolve(),p.skipTransition()),u({isTransitioning:!0,flushSync:!0,currentLocation:oe.currentLocation,nextLocation:oe.nextLocation})});let de=n.window.document.startViewTransition(()=>{no(()=>l(m))});de.finished.finally(()=>{no(()=>{c(void 0),w(void 0),a(void 0),u({isTransitioning:!1})})}),no(()=>w(de));return}p?(d&&d.resolve(),p.skipTransition(),k({state:m,currentLocation:oe.currentLocation,nextLocation:oe.nextLocation})):(a(m),u({isTransitioning:!0,flushSync:!1,currentLocation:oe.currentLocation,nextLocation:oe.nextLocation}))},[n.window,p,d,R,h]);E.useLayoutEffect(()=>n.subscribe(g),[n,g]),E.useEffect(()=>{s.isTransitioning&&!s.flushSync&&c(new Wy)},[s]),E.useEffect(()=>{if(d&&i&&n.window){let m=i,O=d.promise,L=n.window.document.startViewTransition(async()=>{h(()=>l(m)),await O});L.finished.finally(()=>{c(void 0),w(void 0),a(void 0),u({isTransitioning:!1})}),w(L)}},[h,i,d,n.window]),E.useEffect(()=>{d&&i&&o.location.key===i.location.key&&d.resolve()},[d,p,o.location,i]),E.useEffect(()=>{!s.isTransitioning&&x&&(a(x.state),u({isTransitioning:!0,flushSync:!1,currentLocation:x.currentLocation,nextLocation:x.nextLocation}),k(void 0))},[s.isTransitioning,x]),E.useEffect(()=>{},[]);let C=E.useMemo(()=>({createHref:n.createHref,encodeLocation:n.encodeLocation,go:m=>n.navigate(m),push:(m,O,L)=>n.navigate(m,{state:O,preventScrollReset:L==null?void 0:L.preventScrollReset}),replace:(m,O,L)=>n.navigate(m,{replace:!0,state:O,preventScrollReset:L==null?void 0:L.preventScrollReset})}),[n]),T=n.basename||"/",P=E.useMemo(()=>({router:n,navigator:C,static:!1,basename:T}),[n,C,T]),M=E.useMemo(()=>({v7_relativeSplatPath:n.future.v7_relativeSplatPath}),[n.future.v7_relativeSplatPath]);return E.createElement(E.Fragment,null,E.createElement(Qo.Provider,{value:P},E.createElement(su.Provider,{value:o},E.createElement(Ay.Provider,{value:R.current},E.createElement(qh.Provider,{value:s},E.createElement(Ry,{basename:T,location:o.location,navigationType:o.historyAction,navigator:C,future:M},o.initialized||n.future.v7_partialHydration?E.createElement(Hy,{routes:n.routes,future:n.future,state:o}):t))))),null)}const Hy=E.memo(Qy);function Qy(e){let{routes:t,future:n,state:r}=e;return vy(t,void 0,r,n)}const Ky=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",Gy=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Uo=E.forwardRef(function(t,n){let{onClick:r,relative:o,reloadDocument:l,replace:i,state:a,target:s,to:u,preventScrollReset:d,unstable_viewTransition:c}=t,p=Zh(t,Iy),{basename:w}=E.useContext(rn),x,k=!1;if(typeof u=="string"&&Gy.test(u)&&(x=u,Ky))try{let g=new URL(window.location.href),C=u.startsWith("//")?new URL(g.protocol+u):new URL(u),T=tn(C.pathname,w);C.origin===g.origin&&T!=null?u=T+C.search+C.hash:k=!0}catch{}let R=hy(u,{relative:o}),v=Yy(u,{replace:i,state:a,target:s,preventScrollReset:d,relative:o,unstable_viewTransition:c});function h(g){r&&r(g),g.defaultPrevented||v(g)}return E.createElement("a",Ur({},p,{href:x||R,onClick:k||l?r:h,ref:n,target:s}))}),An=E.forwardRef(function(t,n){let{"aria-current":r="page",caseSensitive:o=!1,className:l="",end:i=!1,style:a,to:s,unstable_viewTransition:u,children:d}=t,c=Zh(t,Dy),p=Pi(s,{relative:c.relative}),w=nr(),x=E.useContext(su),{navigator:k,basename:R}=E.useContext(rn),v=x!=null&&Xy(p)&&u===!0,h=k.encodeLocation?k.encodeLocation(p).pathname:p.pathname,g=w.pathname,C=x&&x.navigation&&x.navigation.location?x.navigation.location.pathname:null;o||(g=g.toLowerCase(),C=C?C.toLowerCase():null,h=h.toLowerCase()),C&&R&&(C=tn(C,R)||C);const T=h!=="/"&&h.endsWith("/")?h.length-1:h.length;let P=g===h||!i&&g.startsWith(h)&&g.charAt(T)==="/",M=C!=null&&(C===h||!i&&C.startsWith(h)&&C.charAt(h.length)==="/"),m={isActive:P,isPending:M,isTransitioning:v},O=P?r:void 0,L;typeof l=="function"?L=l(m):L=[l,P?"active":null,M?"pending":null,v?"transitioning":null].filter(Boolean).join(" ");let H=typeof a=="function"?a(m):a;return E.createElement(Uo,Ur({},c,{"aria-current":O,className:L,ref:n,style:H,to:s,unstable_viewTransition:u}),typeof d=="function"?d(m):d)});var ls;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(ls||(ls={}));var ad;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(ad||(ad={}));function Jy(e){let t=E.useContext(Qo);return t||Z(!1),t}function Yy(e,t){let{target:n,replace:r,state:o,preventScrollReset:l,relative:i,unstable_viewTransition:a}=t===void 0?{}:t,s=ji(),u=nr(),d=Pi(e,{relative:i});return E.useCallback(c=>{if(Ly(c,n)){c.preventDefault();let p=r!==void 0?r:qn(u)===qn(d);s(e,{replace:p,state:o,preventScrollReset:l,relative:i,unstable_viewTransition:a})}},[u,s,d,r,o,n,e,l,i,a])}function Xy(e,t){t===void 0&&(t={});let n=E.useContext(qh);n==null&&Z(!1);let{basename:r}=Jy(ls.useViewTransitionState),o=Pi(e,{relative:t.relative});if(!n.isTransitioning)return!1;let l=tn(n.currentLocation.pathname,r)||n.currentLocation.pathname,i=tn(n.nextLocation.pathname,r)||n.nextLocation.pathname;return ri(o.pathname,i)!=null||ri(o.pathname,l)!=null}const cu="";function du(e){return e===cu}function Q(e){return du(e)?"/api/root":`/api/projects/${encodeURIComponent(e)}`}function Zy(e){return du(e)?"":`/projects/${e}`}function B1(e){return e===""?"/":`${e}/home`}function qy(){return"/projects"}function W1(e,t){const n=e.startsWith(t)?e.slice(t.length):e;return n.startsWith("/files")?"files":n.startsWith("/changes")?"changes":n.startsWith("/history")?"history":n.startsWith("/settings")?"settings":n.startsWith("/triggers")||n.startsWith("/hooks")?"triggers":n.startsWith("/home")?"home":n.startsWith("/chat")?"chat":t===""?"home":"chat"}function V1(e,t){const n=`${t}/files`;if(!e.startsWith(n))return"";const r=e.slice(n.length).replace(/^\//,"");return r?r.split("/").filter(Boolean).map(o=>{try{return decodeURIComponent(o)}catch{return o}}).join("/"):""}function e0(e){return`m-${e}`}function H1(e,t,n){return`${e}/chat/${encodeURIComponent(t)}#${e0(n)}`}function Q1(e){var t;return(t=/^#?m-([0-9a-fA-F][0-9a-fA-F-]{7,})$/.exec(e))==null?void 0:t[1]}function K1(e){if(!e)return"#";const t=e.trim().replace(/\.git$/i,"");if(/^https?:\/\//i.test(t))return t;const n=/^git@([^:]+):(.+)$/.exec(t);if(n)return`https://${n[1]}/${n[2]}`;const r=/^ssh:\/\/git@([^/]+)\/(.+)$/i.exec(t);return r?`https://${r[1]}/${r[2]}`:"#"}const bn="";async function B(e,t){const n=await fetch(`${bn}${e}`,{headers:{"content-type":"application/json",...(t==null?void 0:t.headers)??{}},...t});if(!n.ok){let r=n.statusText;try{const o=await n.json();o.error&&(r=o.error)}catch{}throw new Ao(r,n.status)}return await n.json()}async function t0(e,t){const n=await fetch(`${bn}${e}`,t);if(!n.ok){let r=n.statusText;try{const o=JSON.parse(await n.text());o.error&&(r=o.error)}catch{}throw new Ao(r,n.status)}return n.text()}class Ao extends Error{constructor(t,n){super(t),this.status=n,this.name="ApiError"}}const fu={async me(){return B("/api/me")},async markChatSeen(e,t,n,r){const o=`${Q(e)}/chats/${encodeURIComponent(t)}/seen`;await B(o,{method:"POST",body:JSON.stringify({...n!==void 0?{when:n}:{},...r!=null&&r.keepUnread?{keepUnread:!0}:{}})})},async markChatUnread(e,t,n){const r=`${Q(e)}/chats/${encodeURIComponent(t)}/unread`;await B(r,{method:"POST",body:JSON.stringify({unread:n})})},async projectRuns(e,t){const n=t!==void 0?`?limit=${encodeURIComponent(t)}`:"";return B(`${Q(e)}/runs${n}`)},async markRunsSeen(e,t){await B(`${Q(e)}/runs/seen`,{method:"POST",body:JSON.stringify(t!==void 0?{when:t}:{})})},async getModels(){return B("/api/models")},async getInstanceConfig(){return B("/api/instance-config")},async updateInstanceConfig(e,t){return B("/api/instance-config",{method:"PUT",body:JSON.stringify(t===void 0?{patch:e}:{patch:e,expectedVersion:t})})},async uploadAttachments(e,t,n){const r=new FormData;for(const l of n)r.append("files",l,l.name);const o=await fetch(`${bn}${Q(e)}/chats/${encodeURIComponent(t)}/upload`,{method:"POST",body:r});if(!o.ok){let l=o.statusText;try{const i=await o.json();i.error&&(l=i.error)}catch{}throw new Ao(l,o.status)}return await o.json()},async projectCommands(e){const{commands:t}=await B(`${Q(e)}/commands`);return t},async listProjects(){const{projects:e,root:t}=await B("/api/projects");return{projects:e,root:t??null}},async getProjectDetail(e){return B(`${Q(e)}`)},async attentionChats(e){const t=await B(`${Q(e)}/chats/attention`);return{running:t.running??[],unread:t.unread??[]}},async createProject(e){const{project:t}=await B("/api/projects",{method:"POST",body:JSON.stringify(e)});return t},async updateProject(e,t){const{project:n}=await B(`${Q(e)}`,{method:"PATCH",body:JSON.stringify(t)});return n},async promoteProject(e,t){const{project:n}=await B(`${Q(e)}/promote`,{method:"POST",body:JSON.stringify({repo:t})});return n},async deleteProject(e){await B(`${Q(e)}`,{method:"DELETE"})},async deleteProjectChat(e,t){await B(`${Q(e)}/chats/${encodeURIComponent(t)}`,{method:"DELETE"})},async renameProjectChat(e,t,n){await B(`${Q(e)}/chats/${encodeURIComponent(t)}`,{method:"PATCH",body:JSON.stringify({name:n})})},async archiveProjectChat(e,t,n){await B(`${Q(e)}/chats/${encodeURIComponent(t)}/archive`,{method:"POST",body:JSON.stringify({archived:n})})},async starProjectChat(e,t,n){await B(`${Q(e)}/chats/${encodeURIComponent(t)}/star`,{method:"POST",body:JSON.stringify({starred:n})})},async archiveProjectChats(e,t,n){await B(`${Q(e)}/chats/batch/archive`,{method:"POST",body:JSON.stringify({sessionIds:t,archived:n})})},async markChatsUnread(e,t,n){await B(`${Q(e)}/chats/batch/unread`,{method:"POST",body:JSON.stringify({sessionIds:t,unread:n})})},async deleteProjectChats(e,t){const n=await B(`${Q(e)}/chats/batch/delete`,{method:"POST",body:JSON.stringify({sessionIds:t})});return{removed:n.removed??[],failed:n.failed??[]}},async detachProjectChat(e,t,n){await B(`${Q(e)}/chats/${encodeURIComponent(t)}/detach`,{method:"POST",body:JSON.stringify({detached:n})})},async promoteChat(e,t,n){return B(`${Q(e)}/chats/${encodeURIComponent(t)}/promote`,{method:"POST",body:JSON.stringify(n)})},async forkChat(e,t,n,r){const{sessionId:o}=await B(`${Q(e)}/chats/${encodeURIComponent(t)}/fork`,{method:"POST",body:JSON.stringify({name:n,fromUuid:r})});return o},async revertChat(e,t,n){const{removed:r}=await B(`${Q(e)}/chats/${encodeURIComponent(t)}/revert`,{method:"POST",body:JSON.stringify({uuid:n})});return r},async listProjectDir(e,t=""){const n=t?`?path=${encodeURIComponent(t)}`:"";return B(`${Q(e)}/files${n}`)},async listProjectFiles(e){const{entries:t}=await this.listProjectDir(e);return t.filter(n=>n.kind==="file").map(n=>n.name)},async getProjectFile(e,t){return B(`${Q(e)}/files/${encodeURIComponent(t)}`)},projectFileRawUrl(e,t){return`${bn}${Q(e)}/files/${encodeURIComponent(t)}?raw=1`},chatFileRawUrl(e){return`${bn}/api/chat-files/${encodeURIComponent(e)}`},async pinFile(e,t){const{project:n}=await B(`${Q(e)}/pins`,{method:"PUT",body:JSON.stringify({file:t})});return n},async unpinFile(e,t){const{project:n}=await B(`${Q(e)}/pins/${encodeURIComponent(t)}`,{method:"DELETE"});return n},async listProjectChats(e){const{chats:t}=await B(`${Q(e)}/chats`);return t},async getAdoptableChats(e){return B(`${Q(e)}/adoptable-chats`)},async adoptChats(e,t){return B(`${Q(e)}/adopt-chats`,{method:"POST",body:JSON.stringify(t??{})})},async unadoptChats(e,t){return B(`${Q(e)}/unadopt-chats`,{method:"POST",body:JSON.stringify(t??{})})},async chatUsage(e,t){const n=t?`?scope=${t}`:"",{usage:r}=await B(`${Q(e)}/chats/usage${n}`);return r},async projectChatMessages(e,t){const{messages:n}=await B(`${Q(e)}/chats/${encodeURIComponent(t)}/messages`);return n},async subagentMessages(e,t,n){const r=`${Q(e)}/chats/${encodeURIComponent(t)}`,{messages:o}=await B(`${r}/subagents/${encodeURIComponent(n)}/messages`);return o},async chatContext(e,t){const n=`${Q(e)}/chats/${encodeURIComponent(t)}/context`,{usage:r}=await B(n);return r},async listTriggers(e){return B(`${Q(e)}/triggers`)},async putTrigger(e,t,n){const{trigger:r}=await B(`${Q(e)}/triggers/${encodeURIComponent(t)}`,{method:"PUT",body:JSON.stringify(n)});return r},async deleteTrigger(e,t){await B(`${Q(e)}/triggers/${encodeURIComponent(t)}`,{method:"DELETE"})},async triggerRuntime(e){return B(`${Q(e)}/triggers/runtime`)},async runTrigger(e,t){const{sessionId:n}=await B(`${Q(e)}/triggers/${encodeURIComponent(t)}/run`,{method:"POST",body:"{}"});return n},async gitInfo(){return B("/api/git")},async gitStatus(e){return B(`${Q(e)}/git/status`)},async gitDiff(e,t){const n=t?`?file=${encodeURIComponent(t)}`:"";return t0(`${Q(e)}/git/diff${n}`)},async gitCommit(e,t,n){return B(`${Q(e)}/git/commit`,{method:"POST",body:JSON.stringify(n?{message:t,files:n}:{message:t})})},async gitProjectInfo(e){return B(`${Q(e)}/git/remote`)},async gitPush(e){return B(`${Q(e)}/git/push`,{method:"POST"})},async gitUntrackedFile(e,t){return B(`${Q(e)}/git/file?path=${encodeURIComponent(t)}`)},gitUntrackedFileRawUrl(e,t){return`${bn}${Q(e)}/git/file?path=${encodeURIComponent(t)}&raw=1`},async githubConnect(){return B("/api/git/github/connect",{method:"POST"})},async githubPoll(e){return B("/api/git/github/poll",{method:"POST",body:JSON.stringify({deviceCode:e})})},async githubDisconnect(){await B("/api/git/github/disconnect",{method:"POST"})},async discover(e){const t=new URLSearchParams;e!=null&&e.includeNonGit&&t.set("includeNonGit","1"),e!=null&&e.includeOutsideHome&&t.set("includeOutsideHome","1");const n=t.toString();return B(`/api/discover${n?`?${n}`:""}`)},async discoverSessions(e){return B(`/api/discover/sessions?dir=${encodeURIComponent(e)}`)},async transcriptionStatus(){return B("/api/transcription")},async transcribe(e,t="dictation.webm",n){const r=new FormData;r.append("file",e,t);const o=await fetch(`${bn}/api/transcribe`,{method:"POST",body:r,signal:n});if(!o.ok){let i=o.statusText;try{const a=await o.json();a.error&&(i=a.error)}catch{}throw new Ao(i,o.status)}const{text:l}=await o.json();return l}},ep=E.createContext(null);function n0({children:e}){const[t,n]=E.useState([]),[r,o]=E.useState(null),[l,i]=E.useState(!0),[a,s]=E.useState(null),u=E.useRef(!1),d=E.useCallback(async()=>{u.current||i(!0),s(null);try{const{projects:x,root:k}=await fu.listProjects();u.current=!0,n(x),k&&o(k)}catch(x){s(x instanceof Error?x.message:"Failed to load projects")}finally{i(!1)}},[]),c=E.useCallback(x=>{if(du(x.slug)){o(x);return}n(k=>[x,...k.filter(R=>R.slug!==x.slug)])},[]),p=E.useCallback(x=>{n(k=>k.filter(R=>R.slug!==x))},[]);E.useEffect(()=>{d()},[d]);const w=E.useMemo(()=>({projects:t,rootWorkspace:r,loading:l,error:a,refresh:d,upsert:c,remove:p}),[t,r,l,a,d,c,p]);return f.jsx(ep.Provider,{value:w,children:e})}function tp(){const e=E.useContext(ep);if(!e)throw new Error("useProjects must be used within ProjectsProvider");return e}const r0="paddock:theme";function o0(){return typeof document<"u"&&document.documentElement.classList.contains("dark")}function l0(){const[e,t]=E.useState(o0),n=E.useCallback(()=>{t(r=>{const o=!r;document.documentElement.classList.toggle("dark",o);try{localStorage.setItem(r0,o?"dark":"light")}catch{}return o})},[]);return{dark:e,toggle:n}}const np={name:"Paddock",logo:"🐎",accent:"#c2603c"},i0={enabled:!1,path:"/open-api"};function rp(){const e=globalThis.__PADDOCK_CONFIG__;return{...np,...(e==null?void 0:e.brand)??{}}}function a0(){const e=globalThis.__PADDOCK_CONFIG__;return{...i0,...(e==null?void 0:e.openapi)??{}}}function s0(e){return/^(https?:\/\/|\/)/i.test(e.trim())}const hu=[{slug:"homelab",label:"Homelab",blurb:"Servers, networking, self-hosted services."},{slug:"house",label:"House",blurb:"Physical home systems — water, climate, power, garden."},{slug:"side-projects",label:"Side Projects",blurb:"Apps and ideas of your own."}],sd="",op=new Map(hu.map(e=>[e.slug,e]));function u0(e){if(!e)return"Unsorted";const t=op.get(e);return t?t.label:e.split("-").map(n=>n.charAt(0).toUpperCase()+n.slice(1)).join(" ")}function G1(e){var t;return(t=op.get(e))==null?void 0:t.blurb}function c0(e){const t=new Set(e),n=[];for(const o of hu)t.has(o.slug)&&(n.push(o.slug),t.delete(o.slug));const r=t.delete(sd);return n.push(...[...t].sort()),r&&n.push(sd),n}const lp=25e3,ip=1e4,d0=lp+ip+5e3,f0=500,h0=1e4;class p0{constructor(){this.ws=null,this.outbox=[],this.subs=new Map,this.pingTimer=null,this.pongTimer=null,this.awaitingPong=!1,this.lastPongAt=0,this.reconnectTimer=null,this.reconnectAttempts=0,this.manualClose=!1,this.stateListeners=new Set,this._state="closed",this.activeSessions=new Map,this.activeStartedAt=new Map,this.backgroundTasks=new Map,this.backgroundListeners=new Set,this.stopTaskListeners=new Set,this.activeListeners=new Set,this.activeInfoListeners=new Set,this.knownSessions=new Set;const n=`${window.location.protocol==="https:"?"wss":"ws"}://${window.location.host}`;if(this.url=`${n.replace(/^http/,"ws")}/ws`,typeof window<"u"){const r=()=>this.ensureLive();window.addEventListener("online",r),window.addEventListener("focus",r),typeof document<"u"&&document.addEventListener("visibilitychange",()=>{document.visibilityState==="visible"&&this.ensureLive()})}}get state(){return this._state}onState(t){return this.stateListeners.add(t),t(this._state),()=>this.stateListeners.delete(t)}setState(t){if(this._state!==t){this._state=t;for(const n of this.stateListeners)n(t)}}onActiveSessions(t){return this.activeListeners.add(t),t(new Set(this.activeSessions.keys())),this.connect(),()=>this.activeListeners.delete(t)}onActiveInfos(t){return this.activeInfoListeners.add(t),t(new Map(this.activeSessions)),this.connect(),()=>this.activeInfoListeners.delete(t)}turnStartedAt(t){return this.activeStartedAt.get(t)??null}backgroundWork(t){return this.backgroundTasks.get(t)??[]}onBackgroundWork(t,n){const r=(o,l)=>{o===t&&n(l)};return this.backgroundListeners.add(r),n(this.backgroundWork(t)),this.connect(),()=>this.backgroundListeners.delete(r)}setActive(t,n,r,o){const l=this.activeSessions.has(t);if(n?(this.activeSessions.set(t,r),o!=null&&!this.activeStartedAt.has(t)&&this.activeStartedAt.set(t,o)):(this.activeSessions.delete(t),this.activeStartedAt.delete(t)),this.activeSessions.has(t)!==l){const i=new Set(this.activeSessions.keys());for(const s of this.activeListeners)s(i);const a=new Map(this.activeSessions);for(const s of this.activeInfoListeners)s(a)}}subscribe(t,n,r){const o=Symbol("chat-sub"),l={projectSlug:t,sessionId:n,handlers:r,lastSeq:-1,turnActive:!1};return this.subs.set(o,l),this.connect(),n&&this.attachSession(l,!1),{setSessionId:i=>{const a=this.subs.get(o);a&&(a.sessionId=i,i&&this.attachSession(a,!1))},unsubscribe:()=>{this.subs.delete(o)}}}attachSession(t,n){t.sessionId&&(this.knownSessions.add(t.sessionId),this.transmit(JSON.stringify({type:"chat:subscribe",payload:{projectSlug:t.projectSlug,sessionId:t.sessionId,wantReplay:n,lastSeq:t.lastSeq}})))}send(t,n,r,o){const l={projectSlug:t,sessionId:r,message:n};o!=null&&o.preloadContext&&(l.preloadContext=!0),o!=null&&o.model&&(l.model=o.model),o!=null&&o.attachments&&o.attachments.length>0&&(l.attachments=o.attachments),this.markTurnStart(t,r),this.transmit(JSON.stringify({type:"chat:send",payload:l}))}setQueued(t,n,r,o,l){const i={projectSlug:t,sessionId:n,text:r,qid:o};l&&l.length>0&&(i.attachments=l.map(a=>({id:a.id,filename:a.filename,kind:a.kind}))),this.transmit(JSON.stringify({type:"chat:set_queue",payload:i}))}markTurnStart(t,n){for(const r of this.subs.values())r.projectSlug===t&&r.sessionId===n&&(r.lastSeq=-1,r.turnActive=!0)}sendCommand(t,n,r){this.markTurnStart(t,r),this.transmit(JSON.stringify({type:"chat:command",payload:{projectSlug:t,sessionId:r,command:n}}))}cancel(t){this.transmit(JSON.stringify({type:"chat:cancel",payload:{jobId:t}}))}stopTask(t,n){this.transmit(JSON.stringify({type:"chat:stop_task",payload:{sessionId:t,taskId:n}}))}onStopTaskResult(t,n){const r=(o,l)=>{o===t&&n(l)};return this.stopTaskListeners.add(r),()=>this.stopTaskListeners.delete(r)}continueChat(t,n){this.markTurnStart(t,n),this.transmit(JSON.stringify({type:"chat:continue",payload:{projectSlug:t,sessionId:n}}))}transmit(t){this.isLive()?this.ws.send(t):(this.outbox.push(t),this.ensureLive())}isLive(){var t;return((t=this.ws)==null?void 0:t.readyState)!==WebSocket.OPEN?!1:Date.now()-this.lastPongAt<d0}wantsSocket(){return this.subs.size>0||this.activeListeners.size>0||this.activeInfoListeners.size>0}ensureLive(){var n;if(!this.wantsSocket())return;const t=(n=this.ws)==null?void 0:n.readyState;t===WebSocket.OPEN?this.sendPing():t!==WebSocket.CONNECTING&&(this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.reconnectAttempts=0,this.connect())}flushOutbox(){var n;if(((n=this.ws)==null?void 0:n.readyState)!==WebSocket.OPEN||this.outbox.length===0)return;const t=this.outbox;this.outbox=[];for(const r of t)this.ws.send(r)}connect(){if(this.manualClose=!1,this.ws&&(this.ws.readyState===WebSocket.OPEN||this.ws.readyState===WebSocket.CONNECTING))return;this.setState("connecting");let t;try{t=new WebSocket(this.url)}catch{this.scheduleReconnect();return}this.ws=t,t.onopen=()=>{this.reconnectAttempts=0,this.awaitingPong=!1,this.lastPongAt=Date.now(),this.setState("open"),this.flushOutbox();for(const n of this.subs.values())n.sessionId&&this.attachSession(n,n.turnActive);this.startPing()},t.onclose=()=>{this.stopPing(),this.setState("closed"),this.manualClose||this.scheduleReconnect()},t.onerror=()=>{t.close()},t.onmessage=n=>this.dispatch(n.data)}startPing(){this.stopPing(),this.pingTimer=setInterval(()=>this.sendPing(),lp)}sendPing(){var t;if(!(((t=this.ws)==null?void 0:t.readyState)!==WebSocket.OPEN||this.awaitingPong)){this.awaitingPong=!0;try{this.ws.send(JSON.stringify({type:"ping"}))}catch{this.awaitingPong=!1,this.ws.close();return}this.pongTimer=setTimeout(()=>{var n;this.pongTimer=null,this.awaitingPong&&((n=this.ws)==null||n.close())},ip)}}stopPing(){this.pingTimer&&clearInterval(this.pingTimer),this.pingTimer=null,this.pongTimer&&clearTimeout(this.pongTimer),this.pongTimer=null,this.awaitingPong=!1}scheduleReconnect(){if(this.reconnectTimer)return;const t=Math.min(h0,f0*2**this.reconnectAttempts);this.reconnectAttempts+=1,this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.connect()},t)}route(t,n){const r=[...this.subs.values()].filter(l=>l.projectSlug===t);if(r.length===0)return;if(n){const l=r.find(i=>i.sessionId===n);if(l)return l;if(this.knownSessions.has(n))return}const o=r.find(l=>l.sessionId===null);if(o)return o;if(n===null&&r.length===1)return r[0]}dispatch(t){var u,d,c,p,w,x,k,R,v,h,g,C,T,P,M,m,O,L,H,oe,ge,de,rt,Ye,wt,D,A,K;let n;try{n=JSON.parse(t)}catch{return}if(n.type==="pong"){this.awaitingPong=!1,this.pongTimer&&(clearTimeout(this.pongTimer),this.pongTimer=null),this.lastPongAt=Date.now(),this.flushOutbox();return}if(n.type==="chat:stop_task_result"){const{sessionId:$,taskId:J,outcome:le,message:Y}=n.payload;if($&&J&&le)for(const Ce of this.stopTaskListeners)Ce($,{taskId:J,outcome:le,message:Y});return}const r=n.payload.projectSlug;if(r==null)return;if(n.type==="chat:error"){const $=this.route(r,null);(d=$==null?void 0:(u=$.handlers).onError)==null||d.call(u,n.payload.error);return}if(n.type==="chat:resync"){const $=this.route(r,n.payload.sessionId);(p=$==null?void 0:(c=$.handlers).onResync)==null||p.call(c);return}if(n.type==="chat:background"){const{sessionId:$,tasks:J}=n.payload;if($){const le=Array.isArray(J)?J:[];le.length===0?this.backgroundTasks.delete($):this.backgroundTasks.set($,le);for(const Y of this.backgroundListeners)Y($,le)}return}if(n.type==="chat:active"){this.setActive(n.payload.sessionId,n.payload.running,r,n.payload.startedAt);for(const $ of this.subs.values())$.projectSlug===r&&$.sessionId===n.payload.sessionId&&((x=(w=$.handlers).onActive)==null||x.call(w,{running:n.payload.running,turnRunning:n.payload.turnRunning??n.payload.running,jobId:n.payload.jobId}));return}if(n.type==="chat:queued_flushed"){const{sessionId:$,text:J,attachments:le}=n.payload;if($){Kt(async()=>{const{writeQueued:Y,writeQueuedId:Ce,writeQueuedAttachments:ie}=await import("./queued-CagZVfWU.js");return{writeQueued:Y,writeQueuedId:Ce,writeQueuedAttachments:ie}},[]).then(({writeQueued:Y,writeQueuedId:Ce,writeQueuedAttachments:ie})=>{Y($,r,null),Ce($,r,null),ie($,r,[])});for(const Y of this.subs.values())Y.projectSlug===r&&Y.sessionId===$&&((R=(k=Y.handlers).onQueuedFlushed)==null||R.call(k,{text:J,attachments:le}))}return}if(n.type==="chat:queued_state"){const{sessionId:$,text:J,qid:le,reason:Y,attachments:Ce}=n.payload;if($){const ie=J&&J.length>0?J:null,Ue=Ce??[],zt=ie!==null||Ue.length>0;Kt(async()=>{const{writeQueued:Ut,writeQueuedId:on,writeQueuedAttachments:Wr}=await import("./queued-CagZVfWU.js");return{writeQueued:Ut,writeQueuedId:on,writeQueuedAttachments:Wr}},[]).then(({writeQueued:Ut,writeQueuedId:on,writeQueuedAttachments:Wr})=>{Ut($,r,ie),on($,r,zt?le??null:null),Wr($,r,Ue)});for(const Ut of this.subs.values())Ut.projectSlug===r&&Ut.sessionId===$&&((h=(v=Ut.handlers).onQueuedState)==null||h.call(v,{text:ie,attachments:Ue,qid:le,reason:Y}))}return}if(n.type==="chat:queued_returned"){const{sessionId:$,text:J,attachments:le}=n.payload;if($&&typeof J=="string"){Kt(async()=>{const{writeQueued:Y,writeQueuedId:Ce,writeQueuedAttachments:ie}=await import("./queued-CagZVfWU.js");return{writeQueued:Y,writeQueuedId:Ce,writeQueuedAttachments:ie}},[]).then(({writeQueued:Y,writeQueuedId:Ce,writeQueuedAttachments:ie})=>{Y($,r,null),Ce($,r,null),ie($,r,[])});for(const Y of this.subs.values())Y.projectSlug===r&&Y.sessionId===$&&((C=(g=Y.handlers).onQueuedReturned)==null||C.call(g,{text:J,attachments:le}))}return}if(n.type==="chat:killed_task"){const{sessionId:$,summary:J,timestamp:le}=n.payload;if($)for(const Y of this.subs.values())Y.projectSlug===r&&Y.sessionId===$&&((P=(T=Y.handlers).onKilledTask)==null||P.call(T,{summary:J??"",timestamp:le??""}));return}const{sessionId:o,jobId:l}=n.payload,i=this.route(r,o);if(!i)return;const a={sessionId:o,jobId:l},s=n.payload.seq;switch(typeof s=="number"&&s>i.lastSeq&&(i.lastSeq=s),i.turnActive=n.type!=="chat:complete",n.type){case"chat:response":(m=(M=i.handlers).onResponse)==null||m.call(M,n.payload.chunk,a);break;case"chat:tool_call":(L=(O=i.handlers).onToolCall)==null||L.call(O,{toolName:n.payload.toolName,inputSummary:n.payload.inputSummary,output:n.payload.output,isError:n.payload.isError,durationMs:n.payload.durationMs,toolUseId:n.payload.toolUseId,subagentType:n.payload.subagentType,description:n.payload.description,hasSubagent:n.payload.hasSubagent},a);break;case"chat:tool_start":(oe=(H=i.handlers).onToolStart)==null||oe.call(H,{toolName:n.payload.toolName,inputSummary:n.payload.inputSummary,toolUseId:n.payload.toolUseId,output:"",isError:!1,pending:!0,subagentType:n.payload.subagentType,description:n.payload.description,hasSubagent:n.payload.hasSubagent},a);break;case"chat:message_boundary":(de=(ge=i.handlers).onMessageBoundary)==null||de.call(ge,a);break;case"chat:injected":(Ye=(rt=i.handlers).onInjected)==null||Ye.call(rt,{sender:n.payload.sender,content:n.payload.content,timestamp:n.payload.timestamp},a);break;case"chat:notice":(D=(wt=i.handlers).onNotice)==null||D.call(wt,n.payload.notice,a);break;case"chat:complete":(K=(A=i.handlers).onComplete)==null||K.call(A,{...a,success:n.payload.success,error:n.payload.error,model:n.payload.model,usage:n.payload.usage});break}}}const pu=new p0,Yt=new Map,is="paddock:lastSeen-changed";function mu(e){try{window.dispatchEvent(new CustomEvent(is,{detail:{sessionId:e}}))}catch{}}function m0(e){return Yt.get(e)??0}function g0(e,t){!t||!Number.isFinite(t)||t<=(Yt.get(e)??0)||(Yt.set(e,t),mu(e))}function J1(e,t=Date.now()){const n=Yt.get(e)??0;return t<=n||(Yt.set(e,t),mu(e)),n}function Y1(e,t,n){Yt.get(e)===n&&(t?Yt.set(e,t):Yt.delete(e),mu(e))}const as="paddock:chats-gone";function X1(e){if(e.length!==0){for(const t of e)Yt.delete(t);try{window.dispatchEvent(new CustomEvent(as,{detail:{sessionIds:e}}))}catch{}}}function v0({tag:e,className:t=""}){const n=ji();return f.jsx("button",{type:"button",onClick:r=>{r.preventDefault(),r.stopPropagation(),n(`/tags/${encodeURIComponent(e)}`)},title:`Show projects tagged ${e}`,className:`tag relative z-10 transition-colors hover:bg-surface-selected ${t}`,children:e})}const y0=/^\d{4}-\d{2}-\d{2}$/;function w0(e){if(!e)return"";if(y0.test(e)){const[s,u,d]=e.split("-").map(Number),c=new Date(s,u-1,d);if(Number.isNaN(c.getTime()))return e;const p=new Date,w=new Date(p.getFullYear(),p.getMonth(),p.getDate()),x=Math.round((w.getTime()-c.getTime())/864e5);return x<=0?"today":x===1?"yesterday":x<7?`${x}d ago`:x<35?`${Math.round(x/7)}w ago`:x<365?`${Math.round(x/30)}mo ago`:`${Math.round(x/365)}y ago`}const t=new Date(e).getTime();if(Number.isNaN(t))return e;const n=Math.round((Date.now()-t)/1e3);if(n<45)return"just now";const r=Math.round(n/60);if(r<60)return`${r}m ago`;const o=Math.round(r/60);if(o<24)return`${o}h ago`;const l=Math.round(o/24);if(l<7)return`${l}d ago`;const i=Math.round(l/7);if(i<5)return`${i}w ago`;const a=Math.round(l/30);return a<12?`${a}mo ago`:`${Math.round(l/365)}y ago`}function Z1(e){if(!e)return"";const t=new Date(e).getTime();if(Number.isNaN(t))return e;const n=Math.round((t-Date.now())/1e3);if(n<=30)return"now";const r=Math.round(n/60);if(r<60)return`in ${r}m`;const o=Math.round(r/60);if(o<24)return`in ${o}h`;const l=Math.round(o/24);if(l<7)return`in ${l}d`;const i=Math.round(l/7);if(i<5)return`in ${i}w`;const a=Math.round(l/30);return a<12?`in ${a}mo`:`in ${Math.round(l/365)}y`}function la(e){return!Number.isFinite(e)||e<0?"0":e>=1e6?`${(e/1e6).toFixed(e>=1e7?0:2)}M`:e>=1e3?`${Math.round(e/1e3)}K`:`${Math.round(e)}`}function x0(e){return!Number.isFinite(e)||e<=0?"$0.00":e<.01?"<$0.01":`$${e.toFixed(2)}`}function q1(e){if(!(!e||e.totalTokens==null))return{inputTokens:e.inputTokens??0,outputTokens:e.outputTokens??0,cacheReadTokens:e.cacheReadTokens??0,cacheCreationTokens:e.cacheCreationTokens??0,totalTokens:e.totalTokens,costUsd:e.costUsd??null}}function ew(e){const t=e.inputTokens+e.cacheReadTokens+e.cacheCreationTokens,n=`${la(e.totalTokens)} tokens · ${la(t)} in / ${la(e.outputTokens)} out`;return e.costUsd==null?n:`${n} · ~${x0(e.costUsd)} at API rates`}function tw(e){if(e==null||Number.isNaN(e))return null;if(e<1e3)return`${Math.round(e)}ms`;const t=e/1e3;if(t<10)return`${t.toFixed(1)}s`;if(t<60)return`${Math.round(t)}s`;const n=Math.floor(t/60),r=Math.round(t%60);return r?`${n}m ${r}s`:`${n}m`}const S0="This session is being continued from a previous conversation";function nw(e){return e.trimStart().startsWith(S0)}function rw(e){const t=/^\s*<command-name>([^<]*)<\/command-name>/.exec(e);if(!t)return null;const n=t[1].trim();return n.length>0?n:null}function ow(e){return e.trimStart().startsWith("<local-command-caveat>")}function lw(e){const t=/^\s*<local-command-stdout>([\s\S]*)<\/local-command-stdout>\s*$/.exec(e);if(!t)return null;const n=t[1].trim();return n.length>0?n:null}function iw(e){return/^\s*<local-command-stdout>[\s\S]*<\/local-command-stdout>\s*$/.test(e)}function aw(e){return e.trimStart().startsWith("<task-notification>")}function sw(e){var r;const t=/<summary>([\s\S]*?)<\/summary>/.exec(e),n=(r=t==null?void 0:t[1])==null?void 0:r.trim();return n&&n.length>0?n:"Background agent updated"}function uw(e){var r;const t=/<status>([\s\S]*?)<\/status>/.exec(e),n=(r=t==null?void 0:t[1])==null?void 0:r.trim().toLowerCase();return n&&n.length>0?n:null}function cw(e){return e==="killed"||e==="stopped"}function k0(e){const t=Math.max(0,Math.floor(e/1e3)),n=t%60,r=Math.floor(t/60)%60,o=Math.floor(t/3600),l=String(n).padStart(2,"0");return o>0?`${o}:${String(r).padStart(2,"0")}:${l}`:`${r}:${l}`}function ud(e){if(typeof window>"u"||typeof window.matchMedia!="function")return null;try{return window.matchMedia(e)??null}catch{return null}}function ss(e){const[t,n]=E.useState(()=>{var r;return((r=ud(e))==null?void 0:r.matches)??!1});return E.useEffect(()=>{var l;const r=ud(e);if(!r)return;const o=()=>n(!!r.matches);return o(),typeof r.addEventListener=="function"?(r.addEventListener("change",o),()=>r.removeEventListener("change",o)):((l=r.addListener)==null||l.call(r,o),()=>{var i;return(i=r.removeListener)==null?void 0:i.call(r,o)})},[e]),t}function ap(...e){return e.filter(Boolean).join(" ")}const E0="(min-width: 1280px)",C0="(min-width: 900px)",j0=1;function P0(){const e=ss(E0),t=ss(C0);return e?3:t?2:j0}const ia=6,N0=.75,T0=.9,R0=250,_0=3e4;function M0(e){const[,t]=E.useState(0);E.useEffect(()=>{if(!e)return;const n=setInterval(()=>t(r=>r+1),1e3);return()=>clearInterval(n)},[e])}function L0(){const[e,t]=E.useState(new Map);return E.useEffect(()=>pu.onActiveInfos(n=>t(new Map(n))),[]),e}function I0(e){const[t,n]=E.useState(new Map),r=E.useRef(0);return E.useEffect(()=>{if(!e){r.current++,n(new Map);return}let o=!1;const l=async()=>{const s=++r.current;try{const u=await fu.attentionChats(cu);if(o||s!==r.current)return;n(new Map(u.running.map(d=>[d.sessionId,d])))}catch{}},i=setTimeout(()=>void l(),R0),a=setInterval(()=>{document.visibilityState==="visible"&&l()},_0);return()=>{o=!0,clearTimeout(i),clearInterval(a)}},[e]),t}function D0({fill:e}){const t=e<=0?0:Math.max(1,Math.min(ia,Math.round(e*ia))),n=e<N0?"bg-accent-solid":e<T0?"bg-warn-solid":"bg-danger-solid";return f.jsx("span",{className:"flex items-center gap-px",title:`Context ${Math.round(e*100)}% full`,"aria-hidden":"true",children:Array.from({length:ia},(r,o)=>f.jsx("span",{className:ap("h-2.5 w-[3px] rounded-[1px]",o<t?n:"bg-edge")},o))})}function O0({projectSlug:e,projectName:t,chatName:n,sessionId:r,startedAt:o,fill:l}){const i=o==null?"—:—":k0(Date.now()-o),a=n??"Running turn";return f.jsxs(Uo,{"data-testid":"fleet-channel",to:`${Zy(e)}/chat/${encodeURIComponent(r)}`,title:`${a} — ${t}`,"aria-label":`${a} in ${t}, running${o==null?"":` for ${i}`}`,className:"focus-visible:focus-ring flex h-6 shrink-0 items-center gap-2 rounded-md border border-edge-subtle bg-surface px-2 text-2xs can-hover:hover:border-edge can-hover:hover:bg-surface-hover",children:[f.jsx("span",{className:"h-1.5 w-1.5 shrink-0 rounded-[1px] bg-accent-solid","aria-hidden":"true"}),f.jsx("span",{className:"max-w-[14ch] truncate font-medium text-fg",children:t}),f.jsx("span",{className:"font-mono tabular text-fg-muted",children:i}),l!=null&&f.jsx(D0,{fill:l})]})}function cd({value:e,unit:t,to:n,tone:r,title:o}){return f.jsxs(Uo,{"data-testid":`fleet-${t}`,to:n,title:o,className:"focus-visible:focus-ring flex h-6 shrink-0 items-center gap-1.5 rounded-md px-1.5 can-hover:hover:bg-surface-hover",children:[f.jsx("span",{"aria-hidden":"true",className:ap("h-1.5 w-1.5 shrink-0 rounded-[1px]",r==="live"&&"bg-accent-solid",r==="attention"&&"bg-warn-solid",r==="rest"&&"bg-edge-strong")}),f.jsx("span",{"data-testid":`fleet-${t}-value`,className:"font-mono tabular text-2xs font-semibold text-fg",children:e}),f.jsx("span",{className:"text-3xs font-semibold uppercase tracking-[0.14em] text-fg-subtle",children:t})]})}function $0({unread:e}){const{projects:t,rootWorkspace:n}=tp(),r=L0(),o=E.useMemo(()=>[...r.keys()].sort().join(","),[r]),l=I0(o);M0(r.size>0);const i=P0(),a=E.useMemo(()=>{const w=new Map;for(const x of t)w.set(x.slug,x.name);return n&&w.set(n.slug,n.name),w},[t,n]),s=E.useMemo(()=>[...r.entries()].map(([w,x])=>{const k=l.get(w);return{sessionId:w,projectSlug:x,projectName:a.get(x)??(k==null?void 0:k.projectName)??x,chatName:(k==null?void 0:k.name)??null,startedAt:pu.turnStartedAt(w),fill:(k==null?void 0:k.contextTokens)!=null&&k.contextLimit?Math.min(1,k.contextTokens/k.contextLimit):null}}).sort((w,x)=>(w.startedAt??1/0)-(x.startedAt??1/0)),[r,l,a]),u=s.slice(0,i),d=s.length-u.length,c=E.useMemo(()=>{let w="";for(const x of n?[...t,n]:t)for(const k of x.chatTurns??[])k.lastTurnCompletedAt>w&&(w=k.lastTurnCompletedAt);return w},[t,n]),p=r.size===0?`Fleet idle. ${e} unread.`:`${r.size} running. ${e} unread.`;return f.jsxs("div",{"data-testid":"fleet-readout",className:"flex h-9 shrink-0 items-center gap-2 border-b border-edge-subtle bg-surface-sunken px-2 sm:px-3",children:[f.jsx(cd,{value:r.size,unit:"running",to:"/",tone:r.size>0?"live":"rest",title:r.size>0?"Turns in flight across every project":"Nothing running"}),f.jsx(cd,{value:e,unit:"unread",to:"/",tone:e>0?"attention":"rest",title:"Chats holding a reply you have not read"}),f.jsx("span",{className:"h-4 w-px shrink-0 bg-edge-subtle","aria-hidden":"true"}),f.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-1.5 overflow-hidden",children:[u.map(w=>f.jsx(O0,{projectSlug:w.projectSlug,projectName:w.projectName,chatName:w.chatName,sessionId:w.sessionId,startedAt:w.startedAt,fill:w.fill},w.sessionId)),d>0&&f.jsxs(Uo,{to:"/",className:"focus-visible:focus-ring shrink-0 rounded-md px-1.5 py-1 font-mono tabular text-2xs text-fg-muted can-hover:hover:bg-surface-hover can-hover:hover:text-fg",title:`${d} more running — open Home for the full list`,children:["+",d]}),s.length===0&&(c?f.jsxs("span",{className:"truncate text-2xs text-fg-subtle",children:["Idle · last turn ",w0(c)]}):f.jsx(Uo,{to:"/",className:"focus-visible:focus-ring truncate rounded-md px-1 text-2xs text-accent can-hover:hover:underline",children:"No turns yet — start a chat →"}))]}),f.jsx("span",{role:"status","aria-live":"polite",className:"sr-only",children:p})]})}function q(e){return{width:16,height:16,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",...e}}const z0=e=>f.jsx("svg",{...q(e),children:f.jsx("path",{d:"M12 5v14M5 12h14"})}),dw=e=>f.jsx("svg",{...q(e),children:f.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48"})}),U0=e=>f.jsxs("svg",{...q(e),children:[f.jsx("path",{d:"M3 10.5 12 3l9 7.5"}),f.jsx("path",{d:"M5 9.5V20a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V9.5"})]}),fw=e=>f.jsx("svg",{...q(e),children:f.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})}),A0=e=>f.jsxs("svg",{...q(e),children:[f.jsx("circle",{cx:"11",cy:"11",r:"7"}),f.jsx("path",{d:"m21 21-4.3-4.3"})]}),hw=e=>f.jsxs("svg",{...q(e),children:[f.jsx("path",{d:"M4 5h16"}),f.jsx("path",{d:"M8 5v6h12"}),f.jsx("path",{d:"M8 11v6h12"})]}),pw=e=>f.jsx("svg",{...q(e),children:f.jsx("path",{d:"M4 6h16M4 12h16M4 18h16"})}),F0=e=>f.jsx("svg",{...q(e),children:f.jsx("path",{d:"M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z"})}),mw=e=>f.jsxs("svg",{...q(e),children:[f.jsx("path",{d:"m22 2-7 20-4-9-9-4Z"}),f.jsx("path",{d:"M22 2 11 13"})]}),gw=e=>f.jsx("svg",{...q(e),children:f.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"})}),vw=e=>f.jsxs("svg",{...q(e),children:[f.jsx("rect",{x:"9",y:"2",width:"6",height:"12",rx:"3"}),f.jsx("path",{d:"M5 10a7 7 0 0 0 14 0"}),f.jsx("path",{d:"M12 17v4M8 21h8"})]}),yw=e=>f.jsx("svg",{...q(e),children:f.jsx("path",{d:"m9 18 6-6-6-6"})}),ww=e=>f.jsx("svg",{...q(e),children:f.jsx("path",{d:"M14.7 6.3a4 4 0 0 0-5.4 5.4L3 18l3 3 6.3-6.3a4 4 0 0 0 5.4-5.4l-2.6 2.6-2-2 2.6-2.6Z"})}),b0=e=>f.jsxs("svg",{...q(e),children:[f.jsx("circle",{cx:"12",cy:"12",r:"3"}),f.jsx("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09a1.65 1.65 0 0 0-1-1.51 1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09a1.65 1.65 0 0 0 1.51-1 1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1Z"})]}),xw=e=>f.jsxs("svg",{...q(e),children:[f.jsx("path",{d:"M10.3 3.9 1.8 18a2 2 0 0 0 1.7 3h17a2 2 0 0 0 1.7-3L13.7 3.9a2 2 0 0 0-3.4 0Z"}),f.jsx("path",{d:"M12 9v4M12 17h.01"})]}),Sw=e=>f.jsx("svg",{...q(e),children:f.jsx("path",{d:"M12 3v4M12 17v4M3 12h4M17 12h4M5.6 5.6l2.8 2.8M15.6 15.6l2.8 2.8M5.6 18.4l2.8-2.8M15.6 8.4l2.8-2.8"})}),sp=e=>f.jsx("svg",{...q(e),children:f.jsx("path",{d:"M18 6 6 18M6 6l12 12"})}),kw=e=>f.jsx("svg",{...q(e),children:f.jsx("path",{d:"M13 2 4.5 13.5H11l-1 8.5 8.5-11.5H12z"})}),Ew=e=>f.jsx("svg",{...q(e),children:f.jsx("path",{d:"M6 4.5v15l13-7.5z"})}),B0=e=>f.jsx("svg",{...q(e),children:f.jsx("path",{d:"M3 6h18M3 12h18M3 18h18"})}),Cw=e=>f.jsxs("svg",{...q(e),children:[f.jsx("circle",{cx:"12",cy:"12",r:"9"}),f.jsx("path",{d:"M12 7v5l3 2"})]}),jw=e=>f.jsxs("svg",{...q(e),children:[f.jsx("circle",{cx:"12",cy:"5",r:"1"}),f.jsx("circle",{cx:"12",cy:"12",r:"1"}),f.jsx("circle",{cx:"12",cy:"19",r:"1"})]}),Pw=e=>f.jsx("svg",{...q(e),children:f.jsx("path",{d:"M3 6h18M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2m3 0v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6M10 11v6M14 11v6"})}),Nw=e=>f.jsxs("svg",{...q(e),children:[f.jsx("path",{d:"M12 20h9"}),f.jsx("path",{d:"M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4Z"})]}),Tw=e=>f.jsxs("svg",{...q(e),children:[f.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8Z"}),f.jsx("path",{d:"M14 2v6h6"})]}),Rw=e=>f.jsxs("svg",{...q(e),children:[f.jsx("path",{d:"M12 17v5"}),f.jsx("path",{d:"M9 10.76V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v6.76a2 2 0 0 0 .59 1.42l1.12 1.12A1 1 0 0 1 17 15H7a1 1 0 0 1-.71-1.7l1.12-1.12A2 2 0 0 0 9 10.76Z"})]}),_w=e=>f.jsx("svg",{...q(e),children:f.jsx("path",{d:"M20 6 9 17l-5-5"})}),Mw=({open:e,...t})=>e?f.jsxs("svg",{...q(t),children:[f.jsx("path",{d:"M21.2 8.4c.5.38.8.97.8 1.6v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V10a2 2 0 0 1 .8-1.6l8-6a2 2 0 0 1 2.4 0l8 6Z"}),f.jsx("path",{d:"m22 10-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 10"})]}):f.jsxs("svg",{...q(t),children:[f.jsx("rect",{width:"20",height:"16",x:"2",y:"4",rx:"2"}),f.jsx("path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7"})]}),Lw=e=>f.jsxs("svg",{...q(e),children:[f.jsx("circle",{cx:"6",cy:"6",r:"3"}),f.jsx("circle",{cx:"6",cy:"18",r:"3"}),f.jsx("circle",{cx:"18",cy:"6",r:"3"}),f.jsx("path",{d:"M6 9v6M18 9a9 9 0 0 1-9 9"})]}),Iw=e=>f.jsxs("svg",{...q(e),children:[f.jsx("path",{d:"M9.5 14.5l-1.7 1.7a4 4 0 0 1-5.66-5.66l1.7-1.7"}),f.jsx("path",{d:"M14.5 9.5l1.7-1.7a4 4 0 0 1 5.66 5.66l-1.7 1.7"}),f.jsx("path",{d:"M8 3.5v2M3.5 8h2M16 20.5v-2M20.5 16h-2"})]}),Dw=e=>f.jsxs("svg",{...q(e),children:[f.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),f.jsx("path",{d:"M17 8l-5-5-5 5M12 3v12"})]}),Ow=e=>f.jsx("svg",{...q(e),children:f.jsx("path",{d:"M4 17l6-5-6-5M12 19h8"})}),$w=e=>f.jsx("svg",{...q(e),children:f.jsx("path",{d:"M9 19c-5 1.5-5-2.5-7-3m14 6v-3.9a3.4 3.4 0 0 0-1-2.6c3-.3 6.2-1.5 6.2-6.6a5.2 5.2 0 0 0-1.4-3.6 4.8 4.8 0 0 0-.1-3.6s-1.1-.3-3.7 1.4a12.6 12.6 0 0 0-6.6 0C6.5 1.3 5.4 1.6 5.4 1.6a4.8 4.8 0 0 0-.1 3.6 5.2 5.2 0 0 0-1.4 3.6c0 5.1 3.2 6.3 6.2 6.6a3.4 3.4 0 0 0-1 2.6V22"})}),W0=e=>f.jsxs("svg",{...q(e),children:[f.jsx("circle",{cx:"12",cy:"12",r:"4"}),f.jsx("path",{d:"M12 2v2M12 20v2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M2 12h2M20 12h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4"})]}),V0=e=>f.jsx("svg",{...q(e),children:f.jsx("path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z"})}),H0=e=>f.jsxs("svg",{...q(e),children:[f.jsx("path",{d:"M10 13a5 5 0 0 0 7.5.5l3-3a5 5 0 0 0-7-7l-1.5 1.5"}),f.jsx("path",{d:"M14 11a5 5 0 0 0-7.5-.5l-3 3a5 5 0 0 0 7 7l1.5-1.5"})]}),zw=e=>f.jsx("svg",{...q(e),children:f.jsx("path",{d:"m6 9 6 6 6-6"})}),Uw=e=>f.jsxs("svg",{...q(e),children:[f.jsx("rect",{x:"3",y:"4",width:"18",height:"4",rx:"1"}),f.jsx("path",{d:"M5 8v11a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V8"}),f.jsx("path",{d:"M10 12h4"})]}),Aw=e=>f.jsx("svg",{...q(e),children:f.jsx("path",{d:"M12 2.5l2.9 5.88 6.49.94-4.7 4.58 1.11 6.46L12 17.8l-5.8 3.05 1.11-6.46-4.7-4.58 6.49-.94z"})}),Q0=["idea","active","paused","blocked","done"];function K0({open:e,onClose:t,onCreated:n}){const[r,o]=E.useState(""),[l,i]=E.useState(""),[a,s]=E.useState(""),[u,d]=E.useState(""),[c,p]=E.useState("active"),[w,x]=E.useState(""),[k,R]=E.useState(""),[v,h]=E.useState(!1),[g,C]=E.useState(!1),[T,P]=E.useState(null);if(E.useEffect(()=>{e&&(o(""),i(""),s(""),d(""),p("active"),x(""),R(""),h(!1),P(null))},[e]),E.useEffect(()=>{const m=O=>{O.key==="Escape"&&e&&!g&&t()};return window.addEventListener("keydown",m),()=>window.removeEventListener("keydown",m)},[e,g,t]),!e)return null;const M=async m=>{if(m.preventDefault(),!!r.trim()){C(!0),P(null);try{const O=await fu.createProject({name:r.trim(),status:c,group:u||void 0,summary:l.trim()||void 0,repo:w.trim()||void 0,path:k.trim()||void 0,managed:k.trim()&&!w.trim()?v:void 0,domain:a.split(",").map(L=>L.trim()).filter(Boolean)});n(O)}catch(O){P(O instanceof Ao?O.message:"Failed to create project")}finally{C(!1)}}};return f.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-overlay p-4 backdrop-blur-sm",onClick:()=>!g&&t(),children:f.jsxs("form",{className:"w-full max-w-md animate-scale-in rounded-2xl border border-edge bg-surface-raised p-6 shadow-2xl",onClick:m=>m.stopPropagation(),onSubmit:M,children:[f.jsxs("div",{className:"mb-5 flex items-center justify-between",children:[f.jsx("h2",{className:"text-lg font-semibold",children:"New project"}),f.jsx("button",{type:"button",onClick:t,className:"rounded-lg p-1 text-fg-subtle hover:bg-surface-hover hover:text-fg-muted","aria-label":"Close",children:f.jsx(sp,{width:18,height:18})})]}),f.jsxs("label",{className:"mb-4 block",children:[f.jsx("span",{className:"field-label",children:"Name"}),f.jsx("input",{autoFocus:!0,className:"input",value:r,onChange:m=>o(m.target.value),placeholder:"Garage Water Heater Replacement"})]}),f.jsxs("label",{className:"mb-4 block",children:[f.jsx("span",{className:"field-label",children:"Summary (optional)"}),f.jsx("input",{className:"input",value:l,onChange:m=>i(m.target.value),placeholder:"One line on what this project is about"})]}),f.jsxs("label",{className:"mb-4 block",children:[f.jsx("span",{className:"field-label",children:"Area"}),f.jsxs("select",{className:"input",value:u,onChange:m=>d(m.target.value),children:[f.jsx("option",{value:"",children:"Unsorted"}),hu.map(m=>f.jsx("option",{value:m.slug,children:m.label},m.slug))]})]}),f.jsxs("label",{className:"mb-4 block",children:[f.jsx("span",{className:"field-label",children:"Directory on this machine (optional)"}),f.jsx("input",{className:"input",value:k,onChange:m=>R(m.target.value),placeholder:"/home/ed/Code/foo"}),f.jsx("span",{className:"mt-1 block text-xs text-fg-subtle",children:"Where this project's content lives. An existing checkout is used in place — its real history, branches and remotes — and Paddock writes nothing into it. Absolute path; created for you if it doesn't exist."})]}),f.jsxs("label",{className:"mb-4 block",children:[f.jsx("span",{className:"field-label",children:"Git repository URL (optional)"}),f.jsx("input",{className:"input",value:w,onChange:m=>x(m.target.value),placeholder:"https://github.com/owner/repo.git"}),f.jsx("span",{className:"mt-1 block text-xs text-fg-subtle",children:k.trim()?"Cloned into the directory above if it doesn't exist yet; otherwise the directory is used as-is and this just records which repo it is.":"Paddock clones this repo into the project and works in the checkout. Leave both blank for a notes project."})]}),k.trim()&&!w.trim()&&f.jsxs("label",{className:"mb-4 flex cursor-pointer items-start gap-2",children:[f.jsx("input",{type:"checkbox",className:"mt-0.5",checked:v,onChange:m=>h(m.target.checked)}),f.jsxs("span",{className:"text-xs text-fg-muted",children:[f.jsx("span",{className:"font-medium",children:"These are notes — let Paddock curate them."})," ","Its OVERVIEW.md, CHANGELOG.md and CLAUDE.md are written into that directory. Leave unticked for a code checkout you version yourself, and Paddock will write nothing into it."]})]}),f.jsxs("div",{className:"mb-5 grid grid-cols-2 gap-3",children:[f.jsxs("label",{className:"block",children:[f.jsx("span",{className:"field-label",children:"Domain tags"}),f.jsx("input",{className:"input",value:a,onChange:m=>s(m.target.value),placeholder:"home, plumbing"})]}),f.jsxs("label",{className:"block",children:[f.jsx("span",{className:"field-label",children:"Status"}),f.jsx("select",{className:"input capitalize",value:c,onChange:m=>p(m.target.value),children:Q0.map(m=>f.jsx("option",{value:m,className:"capitalize",children:m},m))})]})]}),T&&f.jsx("p",{className:"mb-4 rounded-lg bg-danger-soft px-3 py-2 text-sm text-danger",children:T}),f.jsxs("div",{className:"flex justify-end gap-2",children:[f.jsx("button",{type:"button",className:"btn-ghost",onClick:t,disabled:g,children:"Cancel"}),f.jsx("button",{type:"submit",className:"btn-primary",disabled:g||!r.trim(),children:g?"Creating…":"Create project"})]})]})})}const gu="paddock:panewidth:",G0={key:"sidenav",def:288,min:200,max:480},Fw={key:"chatlist",def:256,min:220,max:520},J0="(min-width: 1024px)";function Tr(e,t){return Math.min(Math.max(t,e.min),e.max)}function dd(e,t,n){return Tr(n,e+t)}function Y0(e){try{const t=localStorage.getItem(gu+e.key);if(t==null)return null;const n=Number.parseFloat(t);return Number.isFinite(n)?Tr(e,n):null}catch{return null}}function X0(e,t){try{localStorage.setItem(gu+e.key,String(Tr(e,t)))}catch{}}function Z0(e){try{localStorage.removeItem(gu+e.key)}catch{}}function q0(e){const t=ss(J0),[n,r]=E.useState(()=>Y0(e)),o=Tr(e,n??e.def);return{isDesktop:t,width:o,style:t?{width:o}:void 0,preview:l=>r(Tr(e,l)),commit:l=>{const i=Tr(e,l);r(i),X0(e,i)},reset:()=>{r(null),Z0(e)},spec:e}}function e1({spec:e,width:t,onPreview:n,onCommit:r,onReset:o,label:l}){const i=E.useRef(null),a=E.useRef(t);a.current=t;const s=16;return f.jsx("div",{role:"separator","aria-orientation":"vertical","aria-label":l,"aria-valuenow":Math.round(t),"aria-valuemin":e.min,"aria-valuemax":e.max,tabIndex:0,onPointerDown:u=>{i.current={startX:u.clientX,startWidth:t},u.currentTarget.setPointerCapture(u.pointerId)},onPointerMove:u=>{i.current&&n(dd(i.current.startWidth,u.clientX-i.current.startX,e))},onPointerUp:u=>{if(i.current){i.current=null;try{u.currentTarget.releasePointerCapture(u.pointerId)}catch{}r(a.current)}},onDoubleClick:o,onKeyDown:u=>{if(u.key==="ArrowLeft"||u.key==="ArrowRight"){u.preventDefault();const d=dd(t,u.key==="ArrowRight"?s:-s,e);n(d),r(d)}},title:"Drag to resize · double-click to reset",className:"group/resizer absolute inset-y-0 right-0 z-10 hidden w-1.5 -mr-0.5 cursor-ew-resize touch-none lg:block",children:f.jsx("span",{className:"absolute inset-y-0 right-0 w-px bg-edge transition group-hover/resizer:w-0.5 group-hover/resizer:bg-accent-solid group-focus/resizer:w-0.5 group-focus/resizer:bg-accent-solid"})})}function t1(e){const[t,n]=E.useState(new Map),r=E.useRef(new Map),[o,l]=E.useState(0);return E.useEffect(()=>{const i=r.current;for(const a of e)for(const s of a.chatTurns??[]){g0(s.sessionId,s.lastSeen);const u=Date.parse(s.lastTurnCompletedAt);if(!Number.isFinite(u))continue;const d=i.get(s.sessionId);!d||u>d.at?i.set(s.sessionId,{slug:a.slug,at:u,unread:s.unread}):d.unread=s.unread}if(e.length>0){const a=new Set(e.map(s=>s.slug));for(const[s,u]of i)a.has(u.slug)||i.delete(s)}l(a=>a+1)},[e]),E.useEffect(()=>{const i=a=>{var d;const s=((d=a.detail)==null?void 0:d.sessionIds)??[];let u=!1;for(const c of s)u=r.current.delete(c)||u;u&&l(c=>c+1)};return window.addEventListener(as,i),()=>window.removeEventListener(as,i)},[]),E.useEffect(()=>{const i=new Map;return pu.onActiveInfos(a=>{for(const[s,u]of i)a.has(s)||r.current.set(s,{slug:u,at:Date.now()});i.clear();for(const[s,u]of a)i.set(s,u);n(new Map(a)),l(s=>s+1)})},[]),E.useEffect(()=>{const i=()=>l(a=>a+1);return window.addEventListener(is,i),()=>window.removeEventListener(is,i)},[]),E.useMemo(()=>{const i=new Map,a=s=>{let u=i.get(s);return u||(u={unread:0,inflight:0},i.set(s,u)),u};for(const[s,{slug:u,at:d,unread:c}]of r.current)!t.has(s)&&(c||d>m0(s))&&(a(u).unread+=1);for(const s of t.values())a(s).inflight+=1;return i},[t,o])}function n1(){const{projects:e,rootWorkspace:t,loading:n,upsert:r}=tp(),{dark:o,toggle:l}=l0(),[i,a]=E.useState(!1),[s,u]=E.useState(!1),d=ji(),c=nr(),p=rp(),w=a0(),x=q0(G0),k=c.pathname==="/"||c.pathname==="/projects"||c.pathname.startsWith("/chat"),R=c.pathname.startsWith("/projects/")||k;E.useEffect(()=>{a(!1)},[c.pathname]),E.useEffect(()=>{document.title=p.name},[p.name]);const v=E.useMemo(()=>{const P=new Map;for(const M of e){const m=M.group??"",O=P.get(m);O?O.push(M):P.set(m,[M])}return c0(P.keys()).map(M=>[M,P.get(M)??[]])},[e]),h=E.useMemo(()=>t?[...e,t]:e,[e,t]),g=t1(h),C=g.get(cu),T=E.useMemo(()=>{let P=0;for(const M of g.values())P+=M.unread;return P},[g]);return f.jsxs("div",{className:"flex h-[100dvh] flex-col overflow-hidden bg-surface lg:flex-row",children:[!R&&f.jsxs("header",{className:"pt-safe flex items-center gap-2 border-b border-edge px-3 pb-2 lg:hidden",children:[f.jsx("button",{type:"button",onClick:()=>a(!0),"aria-label":"Open menu",className:"btn-subtle -ml-1 px-2 py-2",children:f.jsx(B0,{width:20,height:20})}),f.jsxs(An,{to:"/",className:"flex items-center gap-2",children:[f.jsx(fd,{brand:p,className:"h-7 w-7 text-sm"}),f.jsx("span",{className:"text-md font-semibold tracking-tight",children:p.name})]})]}),i&&f.jsx("div",{className:"fixed inset-0 z-30 bg-overlay backdrop-blur-sm lg:hidden","aria-hidden":"true",onClick:()=>a(!1)}),f.jsxs("aside",{style:x.style,className:`fixed inset-y-0 left-0 z-40 flex w-72 max-w-[85%] shrink-0 flex-col border-r border-edge bg-surface shadow-2xl transition-transform duration-200 ease-out lg:relative lg:z-auto lg:max-w-none lg:translate-x-0 lg:bg-surface-raised/50 lg:shadow-none ${i?"translate-x-0":"-translate-x-full"}`,children:[x.isDesktop&&f.jsx(e1,{spec:x.spec,width:x.width,onPreview:x.preview,onCommit:x.commit,onReset:x.reset,label:"Resize sidebar"}),f.jsxs("div",{className:"flex items-center gap-2 px-5 py-4",children:[f.jsxs(An,{to:"/",className:"group flex items-center gap-2",children:[f.jsx(fd,{brand:p,className:"h-8 w-8 text-base"}),f.jsx("span",{className:"text-lg font-semibold tracking-tight",children:p.name})]}),f.jsx("button",{type:"button",onClick:()=>a(!1),"aria-label":"Close menu",className:"btn-subtle ml-auto px-2 py-2 lg:hidden",children:f.jsx(sp,{width:18,height:18})})]}),f.jsx("div",{className:"px-3 pb-1",children:f.jsxs(An,{to:"/",end:!0,className:({isActive:P})=>`btn-subtle w-full justify-start ${P?"bg-surface-selected":""}`,title:"The root workspace — every project, and the instance's own chats",children:[f.jsx(U0,{width:16,height:16}),"Home",f.jsx(up,{badge:C,className:"ml-auto"})]})}),f.jsxs("div",{className:"mt-5 mb-1 flex items-center justify-between pr-3",children:[f.jsx(An,{to:qy(),className:"section-label hover:text-accent",children:"Projects"}),f.jsx("button",{type:"button",onClick:()=>u(!0),"aria-label":"New Project",title:"New Project",className:"btn-subtle -mr-1 px-1.5 py-1 text-fg-subtle hover:text-accent",children:f.jsx(z0,{width:14,height:14})})]}),f.jsxs("nav",{className:"flex-1 overflow-y-auto px-2 pb-4",children:[n&&f.jsx("div",{className:"space-y-2 px-2 py-2",children:[0,1,2].map(P=>f.jsx("div",{className:"h-10 animate-pulse rounded-lg bg-surface-active"},P))}),!n&&e.length===0&&f.jsx("p",{className:"px-3 py-2 text-sm text-fg-muted",children:"No projects yet."}),!n&&e.length>0&&v.map(([P,M])=>f.jsxs("div",{className:"mb-2",children:[v.length>1&&f.jsx("div",{className:"px-2.5 pb-1 pt-2 text-3xs font-semibold uppercase tracking-wider text-fg-subtle",children:u0(P)}),M.map(m=>f.jsx(o1,{project:m,badge:g.get(m.slug)},m.slug))]},P||"unsorted"))]}),f.jsxs("div",{className:"border-t border-edge px-3 py-3",children:[f.jsxs(An,{to:"/config",className:({isActive:P})=>`btn-subtle w-full justify-start ${P?"bg-surface-selected":""}`,title:"Instance config — paddock.config.yaml (restart required)",children:[f.jsx(b0,{width:15,height:15}),"Config"]}),f.jsxs(An,{to:"/discover",className:({isActive:P})=>`btn-subtle mt-1 w-full justify-start ${P?"bg-surface-selected":""}`,title:"Find directories with existing Claude Code history to import",children:[f.jsx(A0,{width:15,height:15}),"Discover"]}),w.enabled&&f.jsxs("a",{href:w.path,target:"_blank",rel:"noreferrer",className:"btn-subtle mt-1 w-full justify-start",title:"OpenAPI / Swagger reference (opens in a new tab)",children:[f.jsx(H0,{width:15,height:15}),"Swagger API"]}),f.jsxs("button",{type:"button",onClick:l,className:"btn-subtle mt-1 w-full justify-start","aria-label":o?"Switch to light mode":"Switch to dark mode",title:"Toggle light / dark theme",children:[o?f.jsx(W0,{width:15,height:15}):f.jsx(V0,{width:15,height:15}),o?"Light mode":"Dark mode"]}),f.jsxs("p",{className:"mt-2 px-2 text-2xs text-fg-subtle",children:["v","0.71.0"]})]})]}),f.jsxs("div",{className:"flex min-w-0 flex-1 flex-col overflow-hidden",children:[f.jsx($0,{unread:T}),f.jsx("main",{className:"min-h-0 min-w-0 flex-1 overflow-hidden",children:f.jsx(E.Suspense,{fallback:f.jsx(r1,{}),children:f.jsx(Ty,{context:{openNav:()=>a(!0)}})})})]}),f.jsx(K0,{open:s,onClose:()=>u(!1),onCreated:P=>{r(P),u(!1),d(`/projects/${P.slug}/chat`)}})]})}function fd({brand:e,className:t=""}){return f.jsx("span",{className:`flex shrink-0 items-center justify-center overflow-hidden rounded-lg bg-accent-solid text-accent-fg shadow-sm ${t}`,children:s0(e.logo)?f.jsx("img",{src:e.logo,alt:"",className:"h-full w-full object-cover"}):e.logo})}function r1(){return f.jsxs("div",{className:"flex h-full items-center justify-center","aria-busy":"true","aria-live":"polite",children:[f.jsx("span",{className:"h-6 w-6 animate-spin rounded-full border-2 border-edge-strong border-t-accent"}),f.jsx("span",{className:"sr-only",children:"Loading…"})]})}function o1({project:e,badge:t}){return f.jsxs(An,{to:`/projects/${e.slug}`,className:({isActive:n})=>`group mb-0.5 flex flex-col gap-1 rounded-lg px-2.5 py-2 text-sm transition-colors ${n?"bg-surface-selected":"hover:bg-surface-hover"}`,children:[f.jsxs("span",{className:"flex items-center justify-between gap-2",children:[f.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[f.jsx(F0,{width:13,height:13,className:"shrink-0 text-fg-subtle group-hover:text-fg-muted"}),f.jsx("span",{className:"truncate font-medium",children:e.name})]}),f.jsx(up,{badge:t})]}),e.domain.length>0&&f.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden pl-[18px]",children:[e.domain.slice(0,2).map(n=>f.jsx(v0,{tag:n,className:"max-w-[7rem] truncate"},n)),e.domain.length>2&&f.jsxs("span",{className:"shrink-0 text-2xs text-fg-subtle",children:["+",e.domain.length-2]})]})]})}function up({badge:e,className:t=""}){const n=(e==null?void 0:e.unread)??0,r=(e==null?void 0:e.inflight)??0;return n===0&&r===0?null:f.jsxs("span",{className:`flex shrink-0 items-center gap-1.5 ${t}`,children:[r>0&&f.jsxs("span",{className:"flex items-center gap-1 text-2xs tabular text-fg-muted",title:`${r} chat${r===1?"":"s"} in flight`,"aria-label":`${r} chat${r===1?"":"s"} in flight`,children:[f.jsx("span",{"aria-hidden":"true",className:"h-2.5 w-2.5 spin-eco rounded-full border-[1.5px] border-edge-strong border-t-transparent"}),r]}),n>0&&f.jsx("span",{className:"inline-flex min-w-[1.1rem] items-center justify-center rounded-full bg-accent-solid px-1.5 py-0.5 text-2xs font-semibold leading-none tabular text-accent-fg",title:`${n} unread ${n===1?"reply":"replies"}`,"aria-label":`${n} unread ${n===1?"reply":"replies"}`,children:n})]})}const cp="paddock:chunkReloadAt",l1=1e4,hd=/dynamically imported module|module script|importing a module|failed to fetch|unable to preload|load failed|error loading/i;function i1(e){return e?e instanceof Error?e.name==="ChunkLoadError"?!0:hd.test(e.message):hd.test(String(e)):!1}function vu(){try{return typeof sessionStorage<"u"?sessionStorage:void 0}catch{return}}function a1(e=Date.now(),t=vu()){if(!t)return!1;const n=t.getItem(cp);if(!n)return!1;const r=Number(n);return Number.isFinite(r)&&e-r<l1}function s1(e=Date.now(),t=vu()){try{t==null||t.setItem(cp,String(e))}catch{}}function u1(e,t=Date.now(),n=vu()){return i1(e)&&!a1(t,n)?"reload":"show"}function c1(){const e=Xh(),t=u1(e);if(E.useEffect(()=>{t==="reload"&&(s1(),window.location.reload())},[t]),t==="reload")return f.jsxs("div",{className:"flex h-[100dvh] items-center justify-center bg-surface","aria-busy":"true","aria-live":"polite",children:[f.jsx("span",{className:"h-6 w-6 animate-spin rounded-full border-2 border-edge-strong border-t-accent"}),f.jsx("span",{className:"sr-only",children:"Updating…"})]});const n=e instanceof Error?e.message:typeof e=="string"?e:"";return f.jsxs("div",{className:"flex h-[100dvh] flex-col items-center justify-center gap-4 bg-surface px-6 text-center",children:[f.jsxs("div",{children:[f.jsx("h1",{className:"text-lg font-semibold tracking-tight",children:"Something went wrong"}),f.jsx("p",{className:"mt-1 max-w-md text-sm text-fg-muted",children:"The app hit an unexpected error. Reloading usually fixes it."}),n?f.jsx("p",{className:"mt-2 max-w-md break-words font-mono text-2xs text-fg-subtle",children:n}):null]}),f.jsx("button",{className:"btn-primary",onClick:()=>window.location.reload(),children:"Reload"})]})}function d1(){typeof navigator>"u"||!("serviceWorker"in navigator)||window.addEventListener("load",()=>{const e=navigator.serviceWorker,t=!!e.controller;let n=!1;e.addEventListener("controllerchange",()=>{n||!t||(n=!0,window.location.reload())}),e.register("/sw.js").catch(()=>{})})}const yu=e=>e<0?0:e>1?1:e;function wu(e){return e<=.0031308?12.92*e:1.055*Math.pow(e,1/2.4)-.055}function Mt(e){return e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function xu({L:e,a:t,b:n}){const r=(e+.3963377774*t+.2158037573*n)**3,o=(e-.1055613458*t-.0638541728*n)**3,l=(e-.0894841775*t-1.291485548*n)**3;return[4.0767416621*r-3.3077115913*o+.2309699292*l,-1.2684380046*r+2.6097574011*o-.3413193965*l,-.0041960863*r-.7034186147*o+1.707614701*l]}function us(e,t,n){const r=Math.cbrt(.4122214708*e+.5363325363*t+.0514459929*n),o=Math.cbrt(.2119034982*e+.6806995451*t+.1073969566*n),l=Math.cbrt(.0883024619*e+.2817188376*t+.6299787005*n);return{L:.2104542553*r+.793617785*o-.0040720468*l,a:1.9779984951*r-2.428592205*o+.4505937099*l,b:.0259040371*r+.7827717662*o-.808675766*l}}function Fo(e,t,n,r=1){const o=n*Math.PI/180,l=xu({L:e,a:t*Math.cos(o),b:t*Math.sin(o)}),[i,a,s]=l.map(u=>yu(wu(u)));return{r:i,g:a,b:s,a:r}}function pd(e,t,n){const r=n*Math.PI/180;return xu({L:e,a:t*Math.cos(r),b:t*Math.sin(r)}).map(wu).every(o=>o>=-.0015&&o<=1.0015)}function pn({r:e,g:t,b:n}){const r=o=>Math.round(yu(o)*255).toString(16).padStart(2,"0");return`#${r(e)}${r(t)}${r(n)}`}function Ze({r:e,g:t,b:n}){const[r,o,l]=[e,t,n].map(Mt);return .2126*r+.7152*o+.0722*l}function f1(e,t){if(e.a>=1)return e;const n=e.a;return{r:e.r*n+t.r*(1-n),g:e.g*n+t.g*(1-n),b:e.b*n+t.b*(1-n),a:1}}function Qe(e,t){const n=Ze(f1(e,t)),r=Ze(t),[o,l]=n>r?[n,r]:[r,n];return(o+.05)/(l+.05)}const md={white:{r:1,g:1,b:1,a:1},black:{r:0,g:0,b:0,a:1},transparent:{r:0,g:0,b:0,a:0}};function aa(e){const t=[];let n=0,r="";for(const o of e)o==="("?n++:o===")"&&n--,o===","&&n===0?(t.push(r.trim()),r=""):r+=o;return r.trim()&&t.push(r.trim()),t}function ar(e,t){return!e.startsWith(`${t}(`)||!e.endsWith(")")?null:e.slice(t.length+1,-1)}function cn(e){const t=e.endsWith("%")?Number(e.slice(0,-1))/100:Number(e);if(!Number.isFinite(t))throw new Error(`not a number: ${e}`);return t}function Sr(e,t,n=0){if(n>24)throw new Error(`var() cycle resolving ${e}`);const r=e.trim();if(md[r])return md[r];if(r.startsWith("#")){let s=r.slice(1);if(s.length===3&&(s=[...s].map(d=>d+d).join("")),s.length!==6)throw new Error(`bad hex: ${r}`);const u=parseInt(s,16);return{r:(u>>16&255)/255,g:(u>>8&255)/255,b:(u&255)/255,a:1}}const o=ar(r,"var");if(o!==null){const[s,...u]=aa(o),d=t[s]??u.join(",");if(!d)throw new Error(`undefined custom property: ${s}`);return Sr(d,t,n+1)}const l=ar(r,"oklch");if(l!==null){const[s,u]=l.split("/"),d=s.trim().split(/\s+/);if(d.length!==3)throw new Error(`bad oklch(): ${r}`);return Fo(cn(d[0]),cn(d[1]),cn(d[2]),u?cn(u.trim()):1)}const i=ar(r,"rgb")??ar(r,"rgba");if(i!==null){const s=i.trim(),u=ar(s,"var");if(u!==null){const[w]=aa(u),x=t[w];if(!x)throw new Error(`undefined custom property: ${w}`);return Sr(`rgb(${x})`,t,n+1)}const[d,c]=s.split("/"),p=d.trim().split(/[\s,]+/);if(p.length<3)throw new Error(`bad rgb(): ${r}`);return{r:cn(p[0])/255,g:cn(p[1])/255,b:cn(p[2])/255,a:c?cn(c.trim()):1}}const a=ar(r,"color-mix");if(a!==null){const[s,u,d]=aa(a),c=s.trim();if(c!=="in oklab"&&c!=="in srgb")throw new Error(`only \`in oklab\` and \`in srgb\` color-mix are supported, got: ${s}`);const p=gd(u),w=gd(d);let x=p.pct,k=w.pct;x===null&&k===null?(x=.5,k=.5):x===null?x=1-k:k===null&&(k=1-x);const R=x+k,v=x/R,h=Sr(p.color,t,n+1),g=Sr(w.color,t,n+1);return c==="in srgb"?h1(h,g,v):p1(h,g,v)}throw new Error(`unsupported colour value: ${r}`)}function gd(e){const t=/\s+(-?[\d.]+)%$/.exec(e.trim());return t?{color:e.trim().slice(0,t.index).trim(),pct:Number(t[1])/100}:{color:e.trim(),pct:null}}function h1(e,t,n){return{r:e.r*n+t.r*(1-n),g:e.g*n+t.g*(1-n),b:e.b*n+t.b*(1-n),a:e.a*n+t.a*(1-n)}}function p1(e,t,n){const r=us(Mt(e.r),Mt(e.g),Mt(e.b)),o=us(Mt(t.r),Mt(t.g),Mt(t.b)),l={L:r.L*n+o.L*(1-n),a:r.a*n+o.a*(1-n),b:r.b*n+o.b*(1-n)},[i,a,s]=xu(l).map(u=>yu(wu(u)));return{r:i,g:a,b:s,a:e.a*n+t.a*(1-n)}}function Tn({r:e,g:t,b:n}){const{L:r,a:o,b:l}=us(Mt(e),Mt(t),Mt(n)),i=Math.hypot(o,l),a=i<1e-6?0:(Math.atan2(l,o)*180/Math.PI+360)%360;return{L:r,C:i,H:a}}const Lt=4.5,dp=3,jt=.12,fp=["--accent","--accent-600","--accent-700","--accent-solid","--accent-solid-hover","--accent-text"];function pt(e,t){const n=getComputedStyle(e).getPropertyValue(t).trim();if(!n)return null;const r=/^\d+(\.\d+)?( \d+(\.\d+)?){2}$/.test(n)?`rgb(${n})`:n;try{return Sr(r,{})}catch{return null}}function m1(e,t,n){let r=0,o=1;for(let l=0;l<32;l++){const i=(r+o)/2;Ze(Fo(i,t,n))<e?r=i:o=i}return(r+o)/2}function hp(e,t,n){if(pd(e,t,n))return t;let r=0,o=t;for(let l=0;l<24;l++){const i=(r+o)/2;pd(e,i,n)?r=i:o=i}return r}function sa(e,t,n,r,o){const l=Ze(r);let i=t,a=.5;for(let s=0;s<4;s++){const u=m1(l,i,n);let d=o?0:u,c=o?u:1;for(let p=0;p<28;p++){const w=(d+c)/2,x=Qe(Fo(w,i,n),r)>=e;o?x?d=w:c=w:x?c=w:d=w}a=o?d:c,i=hp(a,t,n)}return{L:a,C:i,rgb:Fo(a,i,n)}}const g1=.75;function Rr(e,t,n,r,o,l=e){const i=sa(e,t,n,r,o),a=c=>c.C>=t*g1;if(a(i)||l>=e)return{...i,hit:Qe(i.rgb,r)>=e-.01};let s=l,u=e,d=sa(l,t,n,r,o);for(let c=0;c<16;c++){const p=(s+u)/2,w=sa(p,t,n,r,o);a(w)?(d=w,s=p):u=p}return{...d,hit:Qe(d.rgb,r)>=l-.01}}function ua({r:e,g:t,b:n}){const r=o=>Math.round(Math.max(0,Math.min(1,o))*255);return`${r(e)} ${r(t)} ${r(n)}`}const pp=["--surface","--surface-raised","--surface-sunken","--surface-hover","--surface-active","--surface-selected","--border-subtle","--border","--border-strong","--text","--text-muted","--text-subtle","--scroll-thumb"],vd=["--text","--text-muted","--text-subtle"],v1=["--surface","--surface-raised","--surface-sunken","--surface-hover","--surface-active","--surface-selected"];function mp(e=document.documentElement){for(const t of pp)e.style.removeProperty(t)}function y1(e,t,n=document.documentElement){mp(n);for(const o of pp){const l=pt(n,o);if(!l)continue;const{L:i,C:a}=Tn(l),s=vd.includes(o),u=Math.max(a,t*(s?.5:1));n.style.setProperty(o,pn(Fo(i,hp(i,u,e),e)))}let r=1/0;for(const o of vd){const l=pt(n,o);if(l)for(const i of v1){const a=pt(n,i);a&&(r=Math.min(r,Qe(l,a)))}}return r}function gp(e=document.documentElement){for(const t of fp)e.style.removeProperty(t)}function vp(e,t){const n=fp.map(r=>[r,e.style.getPropertyValue(r)]);gp(e);try{return t()}finally{for(const[r,o]of n)o&&e.style.setProperty(r,o)}}function w1(e=document.documentElement){return vp(e,()=>{const t=pt(e,"--accent");return t?Tn(t).H:0})}const ro={r:1,g:1,b:1,a:1};function yp(e=document.documentElement){return vp(e,()=>x1(e))}function x1(e){const t={accent:pt(e,"--accent")??ro,a600:pt(e,"--accent-600")??ro,a700:pt(e,"--accent-700")??ro},n=pt(e,"--accent-fg")??ro,r=pt(e,"--surface")??ro,o=["--surface","--surface-raised","--surface-sunken"].map(a=>pt(e,a)).filter(a=>a!==null),l=o.length?o:[r],i=l.reduce((a,s)=>Qe(t.a700,a)<Qe(t.a700,s)?a:s);return{fg:n,surface:r,surfaces:l,targets:{accent:Math.max(Qe(t.accent,r),dp+jt),a600:Math.max(Qe(t.a600,n),Lt+jt),a700:Math.max(l.reduce((a,s)=>Math.min(a,Qe(t.a700,s)),1/0),Lt+jt)},chroma:{accent:Tn(t.accent).C,a600:Tn(t.a600).C,a700:Tn(t.a700).C},darker:{accent:Ze(t.accent)<Ze(r),a600:Ze(n)>Ze(t.a600),a700:Ze(t.a700)<Ze(i)},a700Bg:i}}function S1(e,t){const n=Lt+jt;return{accent:Rr(e.targets.accent,e.chroma.accent,t,e.surface,e.darker.accent,dp+jt),a600:Rr(e.targets.a600,e.chroma.a600,t,e.fg,e.darker.a600,n),a700:Rr(e.targets.a700,e.chroma.a700,t,e.a700Bg,e.darker.a700,n)}}function bw(e,t=document.documentElement){const n=yp(t);return e.map(r=>pn(Rr(n.targets.a600,n.chroma.a600,r,n.fg,n.darker.a600,Lt+jt).rgb))}function k1(e,t=document.documentElement,n={}){const r=t.classList.contains("dark")?"dark":"light",o=n.context??yp(t),l=S1(o,e),{a600:i,a700:a,accent:s}=l,u={C:o.chroma.a700};gp(t),t.style.setProperty("--accent",ua(s.rgb)),t.style.setProperty("--accent-600",ua(i.rgb)),t.style.setProperty("--accent-700",ua(a.rgb));const d={};for(const g of["--accent-fg","--accent-solid","--accent-solid-hover","--accent-text","--surface","--surface-raised","--surface-sunken","--accent-soft"])d[g]=pt(t,g);const c=[],p=d["--accent-fg"]??o.fg,w=(g,C,T)=>{const P=d[g];if(!P)return 1/0;let M=Qe(P,p),m=!1;if(M<T+jt){const{C:O}=Tn(P),L=Rr(T+jt,Math.max(O,o.chroma.a600),e,p,Ze(P)<Ze(p),Lt+jt);t.style.setProperty(g,pn(L.rgb)),M=Qe(L.rgb,p),m=!0}return c.push({label:C,fg:"--accent-fg",bg:g,ratio:M,floor:T,repaired:m}),M},x=w("--accent-solid","Primary button",Lt);w("--accent-solid-hover","Primary button, hovered",Math.min(x+.6,12));const k=[];for(const g of["--surface","--surface-raised","--surface-sunken","--accent-soft"]){const C=d[g];C&&k.push({name:g,c:C})}let R=1/0;const v=d["--accent-text"];if(v&&k.length){const g=k.reduce((T,P)=>Qe(v,T.c)<Qe(v,P.c)?T:P,k[0]);R=Qe(v,g.c);let C=!1;if(R<Lt+jt){const{C:T}=Tn(v),P=Rr(Lt+jt,T||u.C,e,g.c,Ze(v)<Ze(g.c));t.style.setProperty("--accent-text",pn(P.rgb)),R=k.reduce((M,m)=>Math.min(M,Qe(P.rgb,m.c)),1/0),C=!0}c.push({label:"Accent text",fg:"--accent-text",bg:g.name,ratio:R,floor:Lt,repaired:C})}const h={};if(!n.live)for(const g of["--accent-solid","--accent-solid-hover","--accent-text"]){const C=pt(t,g);C&&(h[g]=pn(C))}return{hue:e,mode:r,channels:{accent:pn(s.rgb),accent600:pn(i.rgb),accent700:pn(a.rgb)},applied:h,checks:c,ok:c.every(g=>g.ratio>=g.floor-.005)&&x>=Lt}}const E1=[{id:"foundation",label:"Foundation",blurb:"The neutral base. Warm ground, terracotta accent."},{id:"parchment",label:"Parchment",blurb:"Wine chrome, corner brackets, an old-style serif. A 90s RPG menu."},{id:"terminal",label:"Terminal",blurb:"Green phosphor and ANSI in the dark; greenbar and ribbon ink in the light."},{id:"scifi",label:"Sci-Fi",blurb:"Deep-space ground and luminous cyan. Hairlines, telemetry, glow."}],Bw=[{name:"Ember",hue:40},{name:"Amber",hue:75},{name:"Olive",hue:110},{name:"Forest",hue:148},{name:"Teal",hue:190},{name:"Sky",hue:235},{name:"Indigo",hue:268},{name:"Violet",hue:300},{name:"Magenta",hue:330},{name:"Rose",hue:12}],Ww=[{level:0,label:"None"},{level:1,label:"A little"},{level:2,label:"More"}];function C1(e=document.documentElement){const t=rp().accent;if(t&&t.toLowerCase()!==np.accent.toLowerCase())try{return Tn(Sr(t,{})).H}catch{}return w1(e)}const yd={theme:"foundation",hue:null,tint:0},wp="paddock:appearance",wd="paddock:appearance-cache";function j1(){try{const e=localStorage.getItem(wp);if(!e)return yd;const t=JSON.parse(e);return{theme:E1.some(n=>n.id===t.theme)?t.theme:"foundation",hue:typeof t.hue=="number"?(t.hue%360+360)%360:null,tint:t.tint===1||t.tint===2?t.tint:0}}catch{return yd}}function P1(e){try{localStorage.setItem(wp,JSON.stringify(e))}catch{}}function N1(e,t,n){try{const r=JSON.parse(localStorage.getItem(wd)||"{}"),o=`${e}:${t?"dark":"light"}`;n?r[o]={...n.applied,"--accent":n.channels.accent}:delete r[o],localStorage.setItem(wd,JSON.stringify(r))}catch{}}function T1(e,t=document.documentElement){t.setAttribute("data-theme",e.theme);const n=e.hue??C1(t);let r=null;e.tint===0?mp(t):r=y1(n,L1[e.tint],t);const o=k1(n,t);return o&&r!==null&&(o.checks.push({label:"Body text on the tinted ground",fg:"--text-*",bg:"--surface-*",ratio:r,floor:4.5,repaired:!1}),o.ok=o.ok&&r>=4.5),N1(e.theme,t.classList.contains("dark"),o),o}function R1(e,t){P1(e);const n=T1(e,t);return window.dispatchEvent(new CustomEvent(_1,{detail:n})),n}const _1="paddock:appearance";function M1(){const e=()=>R1(j1());e();const t=new MutationObserver(n=>{n.some(r=>r.attributeName==="class")&&e()});return t.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),()=>t.disconnect()}const L1=[0,.008,.018],xp=E.lazy(()=>Kt(()=>import("./ProjectsGrid-BF65wTqN.js"),__vite__mapDeps([0,1])).then(e=>({default:e.ProjectsGrid}))),Ne=E.lazy(()=>Kt(()=>import("./ProjectView-polknqZw.js").then(e=>e.a),__vite__mapDeps([2,1,3,4,5])).then(e=>({default:e.ProjectView}))),I1=E.lazy(()=>Kt(()=>import("./ProjectRedirect-xFWTlADS.js"),__vite__mapDeps([6,5])).then(e=>({default:e.ProjectRedirect}))),D1=E.lazy(()=>Kt(()=>import("./InstanceConfigPage-CKjJsaGZ.js"),__vite__mapDeps([7,4,8])).then(e=>({default:e.InstanceConfigPage}))),O1=E.lazy(()=>Kt(()=>import("./DiscoverPage-CEzcRO7X.js"),__vite__mapDeps([9,10,4,8])).then(e=>({default:e.DiscoverPage}))),$1=E.lazy(()=>Kt(()=>import("./RootHome-32k1iDh4.js"),__vite__mapDeps([11,10,4,8,2,1,3,5])).then(e=>({default:e.RootHome})));M1();const Sp=()=>document.documentElement.setAttribute("data-tab-hidden",document.hidden?"true":"false");document.addEventListener("visibilitychange",Sp);Sp();function z1(){const{tag:e}=gy();return f.jsx(xp,{filterTag:e?decodeURIComponent(e):void 0})}const U1=$y([{path:"/",element:f.jsx(n1,{}),errorElement:f.jsx(c1,{}),children:[{index:!0,element:f.jsx($1,{})},{path:"projects",element:f.jsx(xp,{})},{path:"tags/:tag",element:f.jsx(z1,{})},{path:"projects/:slug",element:f.jsx(I1,{})},{path:"projects/:slug/home",element:f.jsx(Ne,{})},{path:"projects/:slug/chat",element:f.jsx(Ne,{})},{path:"projects/:slug/chat/:sessionId",element:f.jsx(Ne,{})},{path:"projects/:slug/files",element:f.jsx(Ne,{})},{path:"projects/:slug/files/*",element:f.jsx(Ne,{})},{path:"projects/:slug/changes",element:f.jsx(Ne,{})},{path:"projects/:slug/changes/:file",element:f.jsx(Ne,{})},{path:"projects/:slug/history",element:f.jsx(Ne,{})},{path:"projects/:slug/settings",element:f.jsx(Ne,{})},{path:"projects/:slug/triggers",element:f.jsx(Ne,{})},{path:"projects/:slug/hooks",element:f.jsx(Ne,{})},{path:"chat",element:f.jsx(Ne,{root:!0})},{path:"chat/:sessionId",element:f.jsx(Ne,{root:!0})},{path:"files",element:f.jsx(Ne,{root:!0})},{path:"files/*",element:f.jsx(Ne,{root:!0})},{path:"changes",element:f.jsx(Ne,{root:!0})},{path:"changes/:file",element:f.jsx(Ne,{root:!0})},{path:"history",element:f.jsx(Ne,{root:!0})},{path:"triggers",element:f.jsx(Ne,{root:!0})},{path:"settings",element:f.jsx(Ne,{root:!0})},{path:"config",element:f.jsx(D1,{})},{path:"discover",element:f.jsx(O1,{})}]}]);ca.createRoot(document.getElementById("root")).render(f.jsx(Ld.StrictMode,{children:f.jsx(n0,{children:f.jsx(Vy,{router:U1})})}));d1();export{kw as $,_1 as A,Lw as B,fw as C,xw as D,A0 as E,_w as F,Ao as G,F1 as H,b0 as I,F0 as J,Ow as K,Uo as L,B0 as M,K0 as N,zw as O,z0 as P,jw as Q,cu as R,Sw as S,v0 as T,Nw as U,Pw as V,A1 as W,sp as X,vw as Y,gw as Z,Tw as _,ji as a,H0 as a0,mw as a1,nw as a2,rw as a3,iw as a4,lw as a5,ow as a6,aw as a7,uw as a8,sw as a9,Aw as aA,J1 as aB,Y1 as aC,g0 as aD,m0 as aE,nr as aF,W1 as aG,V1 as aH,q0 as aI,B1 as aJ,Zy as aK,H1 as aL,Q1 as aM,X1 as aN,K1 as aO,Fw as aP,k0 as aa,hw as ab,x0 as ac,la as ad,ew as ae,Kt as af,ou as ag,cw as ah,e0 as ai,tw as aj,ww as ak,pu as al,dw as am,Dw as an,$w as ao,Rw as ap,hu as aq,du as ar,Ew as as,Z1 as at,pw as au,e1 as av,q1 as aw,Iw as ax,Uw as ay,Mw as az,fu as b,Cw as c,w0 as d,G1 as e,u0 as f,qy as g,yw as h,gy as i,f as j,b1 as k,ap as l,Sd as m,j1 as n,c0 as o,bw as p,E1 as q,E as r,R1 as s,Bw as t,tp as u,Ww as v,gp as w,k1 as x,yp as y,ss as z};
|
|
70
|
+
*/function Ur(){return Ur=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Ur.apply(this,arguments)}function Zh(e,t){if(e==null)return{};var n={},r=Object.keys(e),o,l;for(l=0;l<r.length;l++)o=r[l],!(t.indexOf(o)>=0)&&(n[o]=e[o]);return n}function My(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Ly(e,t){return e.button===0&&(!t||t==="_self")&&!My(e)}const Iy=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","unstable_viewTransition"],Dy=["aria-current","caseSensitive","className","end","style","to","unstable_viewTransition","children"],Oy="6";try{window.__reactRouterVersion=Oy}catch{}function $y(e,t){return Vv({basename:void 0,future:Ur({},void 0,{v7_prependBasename:!0}),history:pv({window:void 0}),hydrationData:zy(),routes:e,mapRouteProperties:_y,unstable_dataStrategy:void 0,unstable_patchRoutesOnNavigation:void 0,window:void 0}).initialize()}function zy(){var e;let t=(e=window)==null?void 0:e.__staticRouterHydrationData;return t&&t.errors&&(t=Ur({},t,{errors:Uy(t.errors)})),t}function Uy(e){if(!e)return null;let t=Object.entries(e),n={};for(let[r,o]of t)if(o&&o.__type==="RouteErrorResponse")n[r]=new oi(o.status,o.statusText,o.data,o.internal===!0);else if(o&&o.__type==="Error"){if(o.__subType){let l=window[o.__subType];if(typeof l=="function")try{let i=new l(o.message);i.stack="",n[r]=i}catch{}}if(n[r]==null){let l=new Error(o.message);l.stack="",n[r]=l}}else n[r]=o;return n}const qh=E.createContext({isTransitioning:!1}),Ay=E.createContext(new Map),Fy="startTransition",ld=tm[Fy],by="flushSync",id=hv[by];function By(e){ld?ld(e):e()}function no(e){id?id(e):e()}class Wy{constructor(){this.status="pending",this.promise=new Promise((t,n)=>{this.resolve=r=>{this.status==="pending"&&(this.status="resolved",t(r))},this.reject=r=>{this.status==="pending"&&(this.status="rejected",n(r))}})}}function Vy(e){let{fallbackElement:t,router:n,future:r}=e,[o,l]=E.useState(n.state),[i,a]=E.useState(),[s,u]=E.useState({isTransitioning:!1}),[d,c]=E.useState(),[p,w]=E.useState(),[x,k]=E.useState(),R=E.useRef(new Map),{v7_startTransition:v}=r||{},h=E.useCallback(m=>{v?By(m):m()},[v]),g=E.useCallback((m,O)=>{let{deletedFetchers:L,unstable_flushSync:H,unstable_viewTransitionOpts:oe}=O;L.forEach(de=>R.current.delete(de)),m.fetchers.forEach((de,rt)=>{de.data!==void 0&&R.current.set(rt,de.data)});let ge=n.window==null||n.window.document==null||typeof n.window.document.startViewTransition!="function";if(!oe||ge){H?no(()=>l(m)):h(()=>l(m));return}if(H){no(()=>{p&&(d&&d.resolve(),p.skipTransition()),u({isTransitioning:!0,flushSync:!0,currentLocation:oe.currentLocation,nextLocation:oe.nextLocation})});let de=n.window.document.startViewTransition(()=>{no(()=>l(m))});de.finished.finally(()=>{no(()=>{c(void 0),w(void 0),a(void 0),u({isTransitioning:!1})})}),no(()=>w(de));return}p?(d&&d.resolve(),p.skipTransition(),k({state:m,currentLocation:oe.currentLocation,nextLocation:oe.nextLocation})):(a(m),u({isTransitioning:!0,flushSync:!1,currentLocation:oe.currentLocation,nextLocation:oe.nextLocation}))},[n.window,p,d,R,h]);E.useLayoutEffect(()=>n.subscribe(g),[n,g]),E.useEffect(()=>{s.isTransitioning&&!s.flushSync&&c(new Wy)},[s]),E.useEffect(()=>{if(d&&i&&n.window){let m=i,O=d.promise,L=n.window.document.startViewTransition(async()=>{h(()=>l(m)),await O});L.finished.finally(()=>{c(void 0),w(void 0),a(void 0),u({isTransitioning:!1})}),w(L)}},[h,i,d,n.window]),E.useEffect(()=>{d&&i&&o.location.key===i.location.key&&d.resolve()},[d,p,o.location,i]),E.useEffect(()=>{!s.isTransitioning&&x&&(a(x.state),u({isTransitioning:!0,flushSync:!1,currentLocation:x.currentLocation,nextLocation:x.nextLocation}),k(void 0))},[s.isTransitioning,x]),E.useEffect(()=>{},[]);let C=E.useMemo(()=>({createHref:n.createHref,encodeLocation:n.encodeLocation,go:m=>n.navigate(m),push:(m,O,L)=>n.navigate(m,{state:O,preventScrollReset:L==null?void 0:L.preventScrollReset}),replace:(m,O,L)=>n.navigate(m,{replace:!0,state:O,preventScrollReset:L==null?void 0:L.preventScrollReset})}),[n]),T=n.basename||"/",P=E.useMemo(()=>({router:n,navigator:C,static:!1,basename:T}),[n,C,T]),M=E.useMemo(()=>({v7_relativeSplatPath:n.future.v7_relativeSplatPath}),[n.future.v7_relativeSplatPath]);return E.createElement(E.Fragment,null,E.createElement(Qo.Provider,{value:P},E.createElement(su.Provider,{value:o},E.createElement(Ay.Provider,{value:R.current},E.createElement(qh.Provider,{value:s},E.createElement(Ry,{basename:T,location:o.location,navigationType:o.historyAction,navigator:C,future:M},o.initialized||n.future.v7_partialHydration?E.createElement(Hy,{routes:n.routes,future:n.future,state:o}):t))))),null)}const Hy=E.memo(Qy);function Qy(e){let{routes:t,future:n,state:r}=e;return vy(t,void 0,r,n)}const Ky=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",Gy=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Uo=E.forwardRef(function(t,n){let{onClick:r,relative:o,reloadDocument:l,replace:i,state:a,target:s,to:u,preventScrollReset:d,unstable_viewTransition:c}=t,p=Zh(t,Iy),{basename:w}=E.useContext(rn),x,k=!1;if(typeof u=="string"&&Gy.test(u)&&(x=u,Ky))try{let g=new URL(window.location.href),C=u.startsWith("//")?new URL(g.protocol+u):new URL(u),T=tn(C.pathname,w);C.origin===g.origin&&T!=null?u=T+C.search+C.hash:k=!0}catch{}let R=hy(u,{relative:o}),v=Yy(u,{replace:i,state:a,target:s,preventScrollReset:d,relative:o,unstable_viewTransition:c});function h(g){r&&r(g),g.defaultPrevented||v(g)}return E.createElement("a",Ur({},p,{href:x||R,onClick:k||l?r:h,ref:n,target:s}))}),An=E.forwardRef(function(t,n){let{"aria-current":r="page",caseSensitive:o=!1,className:l="",end:i=!1,style:a,to:s,unstable_viewTransition:u,children:d}=t,c=Zh(t,Dy),p=Pi(s,{relative:c.relative}),w=nr(),x=E.useContext(su),{navigator:k,basename:R}=E.useContext(rn),v=x!=null&&Xy(p)&&u===!0,h=k.encodeLocation?k.encodeLocation(p).pathname:p.pathname,g=w.pathname,C=x&&x.navigation&&x.navigation.location?x.navigation.location.pathname:null;o||(g=g.toLowerCase(),C=C?C.toLowerCase():null,h=h.toLowerCase()),C&&R&&(C=tn(C,R)||C);const T=h!=="/"&&h.endsWith("/")?h.length-1:h.length;let P=g===h||!i&&g.startsWith(h)&&g.charAt(T)==="/",M=C!=null&&(C===h||!i&&C.startsWith(h)&&C.charAt(h.length)==="/"),m={isActive:P,isPending:M,isTransitioning:v},O=P?r:void 0,L;typeof l=="function"?L=l(m):L=[l,P?"active":null,M?"pending":null,v?"transitioning":null].filter(Boolean).join(" ");let H=typeof a=="function"?a(m):a;return E.createElement(Uo,Ur({},c,{"aria-current":O,className:L,ref:n,style:H,to:s,unstable_viewTransition:u}),typeof d=="function"?d(m):d)});var ls;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(ls||(ls={}));var ad;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(ad||(ad={}));function Jy(e){let t=E.useContext(Qo);return t||Z(!1),t}function Yy(e,t){let{target:n,replace:r,state:o,preventScrollReset:l,relative:i,unstable_viewTransition:a}=t===void 0?{}:t,s=ji(),u=nr(),d=Pi(e,{relative:i});return E.useCallback(c=>{if(Ly(c,n)){c.preventDefault();let p=r!==void 0?r:qn(u)===qn(d);s(e,{replace:p,state:o,preventScrollReset:l,relative:i,unstable_viewTransition:a})}},[u,s,d,r,o,n,e,l,i,a])}function Xy(e,t){t===void 0&&(t={});let n=E.useContext(qh);n==null&&Z(!1);let{basename:r}=Jy(ls.useViewTransitionState),o=Pi(e,{relative:t.relative});if(!n.isTransitioning)return!1;let l=tn(n.currentLocation.pathname,r)||n.currentLocation.pathname,i=tn(n.nextLocation.pathname,r)||n.nextLocation.pathname;return ri(o.pathname,i)!=null||ri(o.pathname,l)!=null}const cu="";function du(e){return e===cu}function Q(e){return du(e)?"/api/root":`/api/projects/${encodeURIComponent(e)}`}function Zy(e){return du(e)?"":`/projects/${e}`}function B1(e){return e===""?"/":`${e}/home`}function qy(){return"/projects"}function W1(e,t){const n=e.startsWith(t)?e.slice(t.length):e;return n.startsWith("/files")?"files":n.startsWith("/changes")?"changes":n.startsWith("/history")?"history":n.startsWith("/settings")?"settings":n.startsWith("/triggers")||n.startsWith("/hooks")?"triggers":n.startsWith("/home")?"home":n.startsWith("/chat")?"chat":t===""?"home":"chat"}function V1(e,t){const n=`${t}/files`;if(!e.startsWith(n))return"";const r=e.slice(n.length).replace(/^\//,"");return r?r.split("/").filter(Boolean).map(o=>{try{return decodeURIComponent(o)}catch{return o}}).join("/"):""}function e0(e){return`m-${e}`}function H1(e,t,n){return`${e}/chat/${encodeURIComponent(t)}#${e0(n)}`}function Q1(e){var t;return(t=/^#?m-([0-9a-fA-F][0-9a-fA-F-]{7,})$/.exec(e))==null?void 0:t[1]}function K1(e){if(!e)return"#";const t=e.trim().replace(/\.git$/i,"");if(/^https?:\/\//i.test(t))return t;const n=/^git@([^:]+):(.+)$/.exec(t);if(n)return`https://${n[1]}/${n[2]}`;const r=/^ssh:\/\/git@([^/]+)\/(.+)$/i.exec(t);return r?`https://${r[1]}/${r[2]}`:"#"}const bn="";async function B(e,t){const n=await fetch(`${bn}${e}`,{headers:{"content-type":"application/json",...(t==null?void 0:t.headers)??{}},...t});if(!n.ok){let r=n.statusText;try{const o=await n.json();o.error&&(r=o.error)}catch{}throw new Ao(r,n.status)}return await n.json()}async function t0(e,t){const n=await fetch(`${bn}${e}`,t);if(!n.ok){let r=n.statusText;try{const o=JSON.parse(await n.text());o.error&&(r=o.error)}catch{}throw new Ao(r,n.status)}return n.text()}class Ao extends Error{constructor(t,n){super(t),this.status=n,this.name="ApiError"}}const fu={async me(){return B("/api/me")},async markChatSeen(e,t,n,r){const o=`${Q(e)}/chats/${encodeURIComponent(t)}/seen`;await B(o,{method:"POST",body:JSON.stringify({...n!==void 0?{when:n}:{},...r!=null&&r.keepUnread?{keepUnread:!0}:{}})})},async markChatUnread(e,t,n){const r=`${Q(e)}/chats/${encodeURIComponent(t)}/unread`;await B(r,{method:"POST",body:JSON.stringify({unread:n})})},async projectRuns(e,t){const n=t!==void 0?`?limit=${encodeURIComponent(t)}`:"";return B(`${Q(e)}/runs${n}`)},async markRunsSeen(e,t){await B(`${Q(e)}/runs/seen`,{method:"POST",body:JSON.stringify(t!==void 0?{when:t}:{})})},async getModels(){return B("/api/models")},async getInstanceConfig(){return B("/api/instance-config")},async updateInstanceConfig(e,t){return B("/api/instance-config",{method:"PUT",body:JSON.stringify(t===void 0?{patch:e}:{patch:e,expectedVersion:t})})},async uploadAttachments(e,t,n){const r=new FormData;for(const l of n)r.append("files",l,l.name);const o=await fetch(`${bn}${Q(e)}/chats/${encodeURIComponent(t)}/upload`,{method:"POST",body:r});if(!o.ok){let l=o.statusText;try{const i=await o.json();i.error&&(l=i.error)}catch{}throw new Ao(l,o.status)}return await o.json()},async projectCommands(e){const{commands:t}=await B(`${Q(e)}/commands`);return t},async listProjects(){const{projects:e,root:t}=await B("/api/projects");return{projects:e,root:t??null}},async getProjectDetail(e){return B(`${Q(e)}`)},async attentionChats(e){const t=await B(`${Q(e)}/chats/attention`);return{running:t.running??[],unread:t.unread??[]}},async createProject(e){const{project:t}=await B("/api/projects",{method:"POST",body:JSON.stringify(e)});return t},async updateProject(e,t){const{project:n}=await B(`${Q(e)}`,{method:"PATCH",body:JSON.stringify(t)});return n},async promoteProject(e,t){const{project:n}=await B(`${Q(e)}/promote`,{method:"POST",body:JSON.stringify({repo:t})});return n},async deleteProject(e){await B(`${Q(e)}`,{method:"DELETE"})},async deleteProjectChat(e,t){await B(`${Q(e)}/chats/${encodeURIComponent(t)}`,{method:"DELETE"})},async renameProjectChat(e,t,n){await B(`${Q(e)}/chats/${encodeURIComponent(t)}`,{method:"PATCH",body:JSON.stringify({name:n})})},async archiveProjectChat(e,t,n){await B(`${Q(e)}/chats/${encodeURIComponent(t)}/archive`,{method:"POST",body:JSON.stringify({archived:n})})},async starProjectChat(e,t,n){await B(`${Q(e)}/chats/${encodeURIComponent(t)}/star`,{method:"POST",body:JSON.stringify({starred:n})})},async archiveProjectChats(e,t,n){await B(`${Q(e)}/chats/batch/archive`,{method:"POST",body:JSON.stringify({sessionIds:t,archived:n})})},async markChatsUnread(e,t,n){await B(`${Q(e)}/chats/batch/unread`,{method:"POST",body:JSON.stringify({sessionIds:t,unread:n})})},async deleteProjectChats(e,t){const n=await B(`${Q(e)}/chats/batch/delete`,{method:"POST",body:JSON.stringify({sessionIds:t})});return{removed:n.removed??[],failed:n.failed??[]}},async detachProjectChat(e,t,n){await B(`${Q(e)}/chats/${encodeURIComponent(t)}/detach`,{method:"POST",body:JSON.stringify({detached:n})})},async promoteChat(e,t,n){return B(`${Q(e)}/chats/${encodeURIComponent(t)}/promote`,{method:"POST",body:JSON.stringify(n)})},async forkChat(e,t,n,r){const{sessionId:o}=await B(`${Q(e)}/chats/${encodeURIComponent(t)}/fork`,{method:"POST",body:JSON.stringify({name:n,fromUuid:r})});return o},async revertChat(e,t,n){const{removed:r}=await B(`${Q(e)}/chats/${encodeURIComponent(t)}/revert`,{method:"POST",body:JSON.stringify({uuid:n})});return r},async listProjectDir(e,t=""){const n=t?`?path=${encodeURIComponent(t)}`:"";return B(`${Q(e)}/files${n}`)},async listProjectFiles(e){const{entries:t}=await this.listProjectDir(e);return t.filter(n=>n.kind==="file").map(n=>n.name)},async getProjectFile(e,t){return B(`${Q(e)}/files/${encodeURIComponent(t)}`)},projectFileRawUrl(e,t){return`${bn}${Q(e)}/files/${encodeURIComponent(t)}?raw=1`},chatFileRawUrl(e){return`${bn}/api/chat-files/${encodeURIComponent(e)}`},async pinFile(e,t){const{project:n}=await B(`${Q(e)}/pins`,{method:"PUT",body:JSON.stringify({file:t})});return n},async unpinFile(e,t){const{project:n}=await B(`${Q(e)}/pins/${encodeURIComponent(t)}`,{method:"DELETE"});return n},async listProjectChats(e){const{chats:t}=await B(`${Q(e)}/chats`);return t},async getAdoptableChats(e){return B(`${Q(e)}/adoptable-chats`)},async adoptChats(e,t){return B(`${Q(e)}/adopt-chats`,{method:"POST",body:JSON.stringify(t??{})})},async unadoptChats(e,t){return B(`${Q(e)}/unadopt-chats`,{method:"POST",body:JSON.stringify(t??{})})},async chatUsage(e,t){const n=t?`?scope=${t}`:"",{usage:r}=await B(`${Q(e)}/chats/usage${n}`);return r},async projectChatMessages(e,t){const{messages:n}=await B(`${Q(e)}/chats/${encodeURIComponent(t)}/messages`);return n},async subagentMessages(e,t,n){const r=`${Q(e)}/chats/${encodeURIComponent(t)}`,{messages:o}=await B(`${r}/subagents/${encodeURIComponent(n)}/messages`);return o},async chatContext(e,t){const n=`${Q(e)}/chats/${encodeURIComponent(t)}/context`,{usage:r}=await B(n);return r},async listTriggers(e){return B(`${Q(e)}/triggers`)},async putTrigger(e,t,n){const{trigger:r}=await B(`${Q(e)}/triggers/${encodeURIComponent(t)}`,{method:"PUT",body:JSON.stringify(n)});return r},async deleteTrigger(e,t){await B(`${Q(e)}/triggers/${encodeURIComponent(t)}`,{method:"DELETE"})},async triggerRuntime(e){return B(`${Q(e)}/triggers/runtime`)},async runTrigger(e,t){const{sessionId:n}=await B(`${Q(e)}/triggers/${encodeURIComponent(t)}/run`,{method:"POST",body:"{}"});return n},async gitInfo(){return B("/api/git")},async gitStatus(e){return B(`${Q(e)}/git/status`)},async gitDiff(e,t){const n=t?`?file=${encodeURIComponent(t)}`:"";return t0(`${Q(e)}/git/diff${n}`)},async gitCommit(e,t,n){return B(`${Q(e)}/git/commit`,{method:"POST",body:JSON.stringify(n?{message:t,files:n}:{message:t})})},async gitProjectInfo(e){return B(`${Q(e)}/git/remote`)},async gitPush(e){return B(`${Q(e)}/git/push`,{method:"POST"})},async gitUntrackedFile(e,t){return B(`${Q(e)}/git/file?path=${encodeURIComponent(t)}`)},gitUntrackedFileRawUrl(e,t){return`${bn}${Q(e)}/git/file?path=${encodeURIComponent(t)}&raw=1`},async githubConnect(){return B("/api/git/github/connect",{method:"POST"})},async githubPoll(e){return B("/api/git/github/poll",{method:"POST",body:JSON.stringify({deviceCode:e})})},async githubDisconnect(){await B("/api/git/github/disconnect",{method:"POST"})},async discover(e){const t=new URLSearchParams;e!=null&&e.includeNonGit&&t.set("includeNonGit","1"),e!=null&&e.includeOutsideHome&&t.set("includeOutsideHome","1");const n=t.toString();return B(`/api/discover${n?`?${n}`:""}`)},async discoverSessions(e){return B(`/api/discover/sessions?dir=${encodeURIComponent(e)}`)},async transcriptionStatus(){return B("/api/transcription")},async transcribe(e,t="dictation.webm",n){const r=new FormData;r.append("file",e,t);const o=await fetch(`${bn}/api/transcribe`,{method:"POST",body:r,signal:n});if(!o.ok){let i=o.statusText;try{const a=await o.json();a.error&&(i=a.error)}catch{}throw new Ao(i,o.status)}const{text:l}=await o.json();return l}},ep=E.createContext(null);function n0({children:e}){const[t,n]=E.useState([]),[r,o]=E.useState(null),[l,i]=E.useState(!0),[a,s]=E.useState(null),u=E.useRef(!1),d=E.useCallback(async()=>{u.current||i(!0),s(null);try{const{projects:x,root:k}=await fu.listProjects();u.current=!0,n(x),k&&o(k)}catch(x){s(x instanceof Error?x.message:"Failed to load projects")}finally{i(!1)}},[]),c=E.useCallback(x=>{if(du(x.slug)){o(x);return}n(k=>[x,...k.filter(R=>R.slug!==x.slug)])},[]),p=E.useCallback(x=>{n(k=>k.filter(R=>R.slug!==x))},[]);E.useEffect(()=>{d()},[d]);const w=E.useMemo(()=>({projects:t,rootWorkspace:r,loading:l,error:a,refresh:d,upsert:c,remove:p}),[t,r,l,a,d,c,p]);return f.jsx(ep.Provider,{value:w,children:e})}function tp(){const e=E.useContext(ep);if(!e)throw new Error("useProjects must be used within ProjectsProvider");return e}const r0="paddock:theme";function o0(){return typeof document<"u"&&document.documentElement.classList.contains("dark")}function l0(){const[e,t]=E.useState(o0),n=E.useCallback(()=>{t(r=>{const o=!r;document.documentElement.classList.toggle("dark",o);try{localStorage.setItem(r0,o?"dark":"light")}catch{}return o})},[]);return{dark:e,toggle:n}}const np={name:"Paddock",logo:"🐎",accent:"#c2603c"},i0={enabled:!1,path:"/open-api"};function rp(){const e=globalThis.__PADDOCK_CONFIG__;return{...np,...(e==null?void 0:e.brand)??{}}}function a0(){const e=globalThis.__PADDOCK_CONFIG__;return{...i0,...(e==null?void 0:e.openapi)??{}}}function s0(e){return/^(https?:\/\/|\/)/i.test(e.trim())}const hu=[{slug:"homelab",label:"Homelab",blurb:"Servers, networking, self-hosted services."},{slug:"house",label:"House",blurb:"Physical home systems — water, climate, power, garden."},{slug:"side-projects",label:"Side Projects",blurb:"Apps and ideas of your own."}],sd="",op=new Map(hu.map(e=>[e.slug,e]));function u0(e){if(!e)return"Unsorted";const t=op.get(e);return t?t.label:e.split("-").map(n=>n.charAt(0).toUpperCase()+n.slice(1)).join(" ")}function G1(e){var t;return(t=op.get(e))==null?void 0:t.blurb}function c0(e){const t=new Set(e),n=[];for(const o of hu)t.has(o.slug)&&(n.push(o.slug),t.delete(o.slug));const r=t.delete(sd);return n.push(...[...t].sort()),r&&n.push(sd),n}const lp=25e3,ip=1e4,d0=lp+ip+5e3,f0=500,h0=1e4;class p0{constructor(){this.ws=null,this.outbox=[],this.subs=new Map,this.pingTimer=null,this.pongTimer=null,this.awaitingPong=!1,this.lastPongAt=0,this.reconnectTimer=null,this.reconnectAttempts=0,this.manualClose=!1,this.stateListeners=new Set,this._state="closed",this.activeSessions=new Map,this.activeStartedAt=new Map,this.backgroundTasks=new Map,this.backgroundListeners=new Set,this.stopTaskListeners=new Set,this.activeListeners=new Set,this.activeInfoListeners=new Set,this.knownSessions=new Set;const n=`${window.location.protocol==="https:"?"wss":"ws"}://${window.location.host}`;if(this.url=`${n.replace(/^http/,"ws")}/ws`,typeof window<"u"){const r=()=>this.ensureLive();window.addEventListener("online",r),window.addEventListener("focus",r),typeof document<"u"&&document.addEventListener("visibilitychange",()=>{document.visibilityState==="visible"&&this.ensureLive()})}}get state(){return this._state}onState(t){return this.stateListeners.add(t),t(this._state),()=>this.stateListeners.delete(t)}setState(t){if(this._state!==t){this._state=t;for(const n of this.stateListeners)n(t)}}onActiveSessions(t){return this.activeListeners.add(t),t(new Set(this.activeSessions.keys())),this.connect(),()=>this.activeListeners.delete(t)}onActiveInfos(t){return this.activeInfoListeners.add(t),t(new Map(this.activeSessions)),this.connect(),()=>this.activeInfoListeners.delete(t)}turnStartedAt(t){return this.activeStartedAt.get(t)??null}backgroundWork(t){return this.backgroundTasks.get(t)??[]}onBackgroundWork(t,n){const r=(o,l)=>{o===t&&n(l)};return this.backgroundListeners.add(r),n(this.backgroundWork(t)),this.connect(),()=>this.backgroundListeners.delete(r)}setActive(t,n,r,o){const l=this.activeSessions.has(t);if(n?(this.activeSessions.set(t,r),o!=null&&!this.activeStartedAt.has(t)&&this.activeStartedAt.set(t,o)):(this.activeSessions.delete(t),this.activeStartedAt.delete(t)),this.activeSessions.has(t)!==l){const i=new Set(this.activeSessions.keys());for(const s of this.activeListeners)s(i);const a=new Map(this.activeSessions);for(const s of this.activeInfoListeners)s(a)}}subscribe(t,n,r){const o=Symbol("chat-sub"),l={projectSlug:t,sessionId:n,handlers:r,lastSeq:-1,turnActive:!1};return this.subs.set(o,l),this.connect(),n&&this.attachSession(l,!1),{setSessionId:i=>{const a=this.subs.get(o);a&&(a.sessionId=i,i&&this.attachSession(a,!1))},unsubscribe:()=>{this.subs.delete(o)}}}attachSession(t,n){t.sessionId&&(this.knownSessions.add(t.sessionId),this.transmit(JSON.stringify({type:"chat:subscribe",payload:{projectSlug:t.projectSlug,sessionId:t.sessionId,wantReplay:n,lastSeq:t.lastSeq}})))}send(t,n,r,o){const l={projectSlug:t,sessionId:r,message:n};o!=null&&o.preloadContext&&(l.preloadContext=!0),o!=null&&o.model&&(l.model=o.model),o!=null&&o.attachments&&o.attachments.length>0&&(l.attachments=o.attachments),this.markTurnStart(t,r),this.transmit(JSON.stringify({type:"chat:send",payload:l}))}setQueued(t,n,r,o,l){const i={projectSlug:t,sessionId:n,text:r,qid:o};l&&l.length>0&&(i.attachments=l.map(a=>({id:a.id,filename:a.filename,kind:a.kind}))),this.transmit(JSON.stringify({type:"chat:set_queue",payload:i}))}markTurnStart(t,n){for(const r of this.subs.values())r.projectSlug===t&&r.sessionId===n&&(r.lastSeq=-1,r.turnActive=!0)}sendCommand(t,n,r){this.markTurnStart(t,r),this.transmit(JSON.stringify({type:"chat:command",payload:{projectSlug:t,sessionId:r,command:n}}))}cancel(t){this.transmit(JSON.stringify({type:"chat:cancel",payload:{jobId:t}}))}stopTask(t,n){this.transmit(JSON.stringify({type:"chat:stop_task",payload:{sessionId:t,taskId:n}}))}onStopTaskResult(t,n){const r=(o,l)=>{o===t&&n(l)};return this.stopTaskListeners.add(r),()=>this.stopTaskListeners.delete(r)}continueChat(t,n){this.markTurnStart(t,n),this.transmit(JSON.stringify({type:"chat:continue",payload:{projectSlug:t,sessionId:n}}))}transmit(t){this.isLive()?this.ws.send(t):(this.outbox.push(t),this.ensureLive())}isLive(){var t;return((t=this.ws)==null?void 0:t.readyState)!==WebSocket.OPEN?!1:Date.now()-this.lastPongAt<d0}wantsSocket(){return this.subs.size>0||this.activeListeners.size>0||this.activeInfoListeners.size>0}ensureLive(){var n;if(!this.wantsSocket())return;const t=(n=this.ws)==null?void 0:n.readyState;t===WebSocket.OPEN?this.sendPing():t!==WebSocket.CONNECTING&&(this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.reconnectAttempts=0,this.connect())}flushOutbox(){var n;if(((n=this.ws)==null?void 0:n.readyState)!==WebSocket.OPEN||this.outbox.length===0)return;const t=this.outbox;this.outbox=[];for(const r of t)this.ws.send(r)}connect(){if(this.manualClose=!1,this.ws&&(this.ws.readyState===WebSocket.OPEN||this.ws.readyState===WebSocket.CONNECTING))return;this.setState("connecting");let t;try{t=new WebSocket(this.url)}catch{this.scheduleReconnect();return}this.ws=t,t.onopen=()=>{this.reconnectAttempts=0,this.awaitingPong=!1,this.lastPongAt=Date.now(),this.setState("open"),this.flushOutbox();for(const n of this.subs.values())n.sessionId&&this.attachSession(n,n.turnActive);this.startPing()},t.onclose=()=>{this.stopPing(),this.setState("closed"),this.manualClose||this.scheduleReconnect()},t.onerror=()=>{t.close()},t.onmessage=n=>this.dispatch(n.data)}startPing(){this.stopPing(),this.pingTimer=setInterval(()=>this.sendPing(),lp)}sendPing(){var t;if(!(((t=this.ws)==null?void 0:t.readyState)!==WebSocket.OPEN||this.awaitingPong)){this.awaitingPong=!0;try{this.ws.send(JSON.stringify({type:"ping"}))}catch{this.awaitingPong=!1,this.ws.close();return}this.pongTimer=setTimeout(()=>{var n;this.pongTimer=null,this.awaitingPong&&((n=this.ws)==null||n.close())},ip)}}stopPing(){this.pingTimer&&clearInterval(this.pingTimer),this.pingTimer=null,this.pongTimer&&clearTimeout(this.pongTimer),this.pongTimer=null,this.awaitingPong=!1}scheduleReconnect(){if(this.reconnectTimer)return;const t=Math.min(h0,f0*2**this.reconnectAttempts);this.reconnectAttempts+=1,this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.connect()},t)}route(t,n){const r=[...this.subs.values()].filter(l=>l.projectSlug===t);if(r.length===0)return;if(n){const l=r.find(i=>i.sessionId===n);if(l)return l;if(this.knownSessions.has(n))return}const o=r.find(l=>l.sessionId===null);if(o)return o;if(n===null&&r.length===1)return r[0]}dispatch(t){var u,d,c,p,w,x,k,R,v,h,g,C,T,P,M,m,O,L,H,oe,ge,de,rt,Ye,wt,D,A,K;let n;try{n=JSON.parse(t)}catch{return}if(n.type==="pong"){this.awaitingPong=!1,this.pongTimer&&(clearTimeout(this.pongTimer),this.pongTimer=null),this.lastPongAt=Date.now(),this.flushOutbox();return}if(n.type==="chat:stop_task_result"){const{sessionId:$,taskId:J,outcome:le,message:Y}=n.payload;if($&&J&&le)for(const Ce of this.stopTaskListeners)Ce($,{taskId:J,outcome:le,message:Y});return}const r=n.payload.projectSlug;if(r==null)return;if(n.type==="chat:error"){const $=this.route(r,null);(d=$==null?void 0:(u=$.handlers).onError)==null||d.call(u,n.payload.error);return}if(n.type==="chat:resync"){const $=this.route(r,n.payload.sessionId);(p=$==null?void 0:(c=$.handlers).onResync)==null||p.call(c);return}if(n.type==="chat:background"){const{sessionId:$,tasks:J}=n.payload;if($){const le=Array.isArray(J)?J:[];le.length===0?this.backgroundTasks.delete($):this.backgroundTasks.set($,le);for(const Y of this.backgroundListeners)Y($,le)}return}if(n.type==="chat:active"){this.setActive(n.payload.sessionId,n.payload.running,r,n.payload.startedAt);for(const $ of this.subs.values())$.projectSlug===r&&$.sessionId===n.payload.sessionId&&((x=(w=$.handlers).onActive)==null||x.call(w,{running:n.payload.running,turnRunning:n.payload.turnRunning??n.payload.running,jobId:n.payload.jobId}));return}if(n.type==="chat:queued_flushed"){const{sessionId:$,text:J,attachments:le}=n.payload;if($){Kt(async()=>{const{writeQueued:Y,writeQueuedId:Ce,writeQueuedAttachments:ie}=await import("./queued-CagZVfWU.js");return{writeQueued:Y,writeQueuedId:Ce,writeQueuedAttachments:ie}},[]).then(({writeQueued:Y,writeQueuedId:Ce,writeQueuedAttachments:ie})=>{Y($,r,null),Ce($,r,null),ie($,r,[])});for(const Y of this.subs.values())Y.projectSlug===r&&Y.sessionId===$&&((R=(k=Y.handlers).onQueuedFlushed)==null||R.call(k,{text:J,attachments:le}))}return}if(n.type==="chat:queued_state"){const{sessionId:$,text:J,qid:le,reason:Y,attachments:Ce}=n.payload;if($){const ie=J&&J.length>0?J:null,Ue=Ce??[],zt=ie!==null||Ue.length>0;Kt(async()=>{const{writeQueued:Ut,writeQueuedId:on,writeQueuedAttachments:Wr}=await import("./queued-CagZVfWU.js");return{writeQueued:Ut,writeQueuedId:on,writeQueuedAttachments:Wr}},[]).then(({writeQueued:Ut,writeQueuedId:on,writeQueuedAttachments:Wr})=>{Ut($,r,ie),on($,r,zt?le??null:null),Wr($,r,Ue)});for(const Ut of this.subs.values())Ut.projectSlug===r&&Ut.sessionId===$&&((h=(v=Ut.handlers).onQueuedState)==null||h.call(v,{text:ie,attachments:Ue,qid:le,reason:Y}))}return}if(n.type==="chat:queued_returned"){const{sessionId:$,text:J,attachments:le}=n.payload;if($&&typeof J=="string"){Kt(async()=>{const{writeQueued:Y,writeQueuedId:Ce,writeQueuedAttachments:ie}=await import("./queued-CagZVfWU.js");return{writeQueued:Y,writeQueuedId:Ce,writeQueuedAttachments:ie}},[]).then(({writeQueued:Y,writeQueuedId:Ce,writeQueuedAttachments:ie})=>{Y($,r,null),Ce($,r,null),ie($,r,[])});for(const Y of this.subs.values())Y.projectSlug===r&&Y.sessionId===$&&((C=(g=Y.handlers).onQueuedReturned)==null||C.call(g,{text:J,attachments:le}))}return}if(n.type==="chat:killed_task"){const{sessionId:$,summary:J,timestamp:le}=n.payload;if($)for(const Y of this.subs.values())Y.projectSlug===r&&Y.sessionId===$&&((P=(T=Y.handlers).onKilledTask)==null||P.call(T,{summary:J??"",timestamp:le??""}));return}const{sessionId:o,jobId:l}=n.payload,i=this.route(r,o);if(!i)return;const a={sessionId:o,jobId:l},s=n.payload.seq;switch(typeof s=="number"&&s>i.lastSeq&&(i.lastSeq=s),i.turnActive=n.type!=="chat:complete",n.type){case"chat:response":(m=(M=i.handlers).onResponse)==null||m.call(M,n.payload.chunk,a);break;case"chat:tool_call":(L=(O=i.handlers).onToolCall)==null||L.call(O,{toolName:n.payload.toolName,inputSummary:n.payload.inputSummary,output:n.payload.output,isError:n.payload.isError,durationMs:n.payload.durationMs,toolUseId:n.payload.toolUseId,subagentType:n.payload.subagentType,description:n.payload.description,hasSubagent:n.payload.hasSubagent},a);break;case"chat:tool_start":(oe=(H=i.handlers).onToolStart)==null||oe.call(H,{toolName:n.payload.toolName,inputSummary:n.payload.inputSummary,toolUseId:n.payload.toolUseId,output:"",isError:!1,pending:!0,subagentType:n.payload.subagentType,description:n.payload.description,hasSubagent:n.payload.hasSubagent},a);break;case"chat:message_boundary":(de=(ge=i.handlers).onMessageBoundary)==null||de.call(ge,a);break;case"chat:injected":(Ye=(rt=i.handlers).onInjected)==null||Ye.call(rt,{sender:n.payload.sender,content:n.payload.content,timestamp:n.payload.timestamp},a);break;case"chat:notice":(D=(wt=i.handlers).onNotice)==null||D.call(wt,n.payload.notice,a);break;case"chat:complete":(K=(A=i.handlers).onComplete)==null||K.call(A,{...a,success:n.payload.success,error:n.payload.error,model:n.payload.model,usage:n.payload.usage});break}}}const pu=new p0,Yt=new Map,is="paddock:lastSeen-changed";function mu(e){try{window.dispatchEvent(new CustomEvent(is,{detail:{sessionId:e}}))}catch{}}function m0(e){return Yt.get(e)??0}function g0(e,t){!t||!Number.isFinite(t)||t<=(Yt.get(e)??0)||(Yt.set(e,t),mu(e))}function J1(e,t=Date.now()){const n=Yt.get(e)??0;return t<=n||(Yt.set(e,t),mu(e)),n}function Y1(e,t,n){Yt.get(e)===n&&(t?Yt.set(e,t):Yt.delete(e),mu(e))}const as="paddock:chats-gone";function X1(e){if(e.length!==0){for(const t of e)Yt.delete(t);try{window.dispatchEvent(new CustomEvent(as,{detail:{sessionIds:e}}))}catch{}}}function v0({tag:e,className:t=""}){const n=ji();return f.jsx("button",{type:"button",onClick:r=>{r.preventDefault(),r.stopPropagation(),n(`/tags/${encodeURIComponent(e)}`)},title:`Show projects tagged ${e}`,className:`tag relative z-10 transition-colors hover:bg-surface-selected ${t}`,children:e})}const y0=/^\d{4}-\d{2}-\d{2}$/;function w0(e){if(!e)return"";if(y0.test(e)){const[s,u,d]=e.split("-").map(Number),c=new Date(s,u-1,d);if(Number.isNaN(c.getTime()))return e;const p=new Date,w=new Date(p.getFullYear(),p.getMonth(),p.getDate()),x=Math.round((w.getTime()-c.getTime())/864e5);return x<=0?"today":x===1?"yesterday":x<7?`${x}d ago`:x<35?`${Math.round(x/7)}w ago`:x<365?`${Math.round(x/30)}mo ago`:`${Math.round(x/365)}y ago`}const t=new Date(e).getTime();if(Number.isNaN(t))return e;const n=Math.round((Date.now()-t)/1e3);if(n<45)return"just now";const r=Math.round(n/60);if(r<60)return`${r}m ago`;const o=Math.round(r/60);if(o<24)return`${o}h ago`;const l=Math.round(o/24);if(l<7)return`${l}d ago`;const i=Math.round(l/7);if(i<5)return`${i}w ago`;const a=Math.round(l/30);return a<12?`${a}mo ago`:`${Math.round(l/365)}y ago`}function Z1(e){if(!e)return"";const t=new Date(e).getTime();if(Number.isNaN(t))return e;const n=Math.round((t-Date.now())/1e3);if(n<=30)return"now";const r=Math.round(n/60);if(r<60)return`in ${r}m`;const o=Math.round(r/60);if(o<24)return`in ${o}h`;const l=Math.round(o/24);if(l<7)return`in ${l}d`;const i=Math.round(l/7);if(i<5)return`in ${i}w`;const a=Math.round(l/30);return a<12?`in ${a}mo`:`in ${Math.round(l/365)}y`}function la(e){return!Number.isFinite(e)||e<0?"0":e>=1e6?`${(e/1e6).toFixed(e>=1e7?0:2)}M`:e>=1e3?`${Math.round(e/1e3)}K`:`${Math.round(e)}`}function x0(e){return!Number.isFinite(e)||e<=0?"$0.00":e<.01?"<$0.01":`$${e.toFixed(2)}`}function q1(e){if(!(!e||e.totalTokens==null))return{inputTokens:e.inputTokens??0,outputTokens:e.outputTokens??0,cacheReadTokens:e.cacheReadTokens??0,cacheCreationTokens:e.cacheCreationTokens??0,totalTokens:e.totalTokens,costUsd:e.costUsd??null}}function ew(e){const t=e.inputTokens+e.cacheReadTokens+e.cacheCreationTokens,n=`${la(e.totalTokens)} tokens · ${la(t)} in / ${la(e.outputTokens)} out`;return e.costUsd==null?n:`${n} · ~${x0(e.costUsd)} at API rates`}function tw(e){if(e==null||Number.isNaN(e))return null;if(e<1e3)return`${Math.round(e)}ms`;const t=e/1e3;if(t<10)return`${t.toFixed(1)}s`;if(t<60)return`${Math.round(t)}s`;const n=Math.floor(t/60),r=Math.round(t%60);return r?`${n}m ${r}s`:`${n}m`}const S0="This session is being continued from a previous conversation";function nw(e){return e.trimStart().startsWith(S0)}function rw(e){const t=/^\s*<command-name>([^<]*)<\/command-name>/.exec(e);if(!t)return null;const n=t[1].trim();return n.length>0?n:null}function ow(e){return e.trimStart().startsWith("<local-command-caveat>")}function lw(e){const t=/^\s*<local-command-stdout>([\s\S]*)<\/local-command-stdout>\s*$/.exec(e);if(!t)return null;const n=t[1].trim();return n.length>0?n:null}function iw(e){return/^\s*<local-command-stdout>[\s\S]*<\/local-command-stdout>\s*$/.test(e)}function aw(e){return e.trimStart().startsWith("<task-notification>")}function sw(e){var r;const t=/<summary>([\s\S]*?)<\/summary>/.exec(e),n=(r=t==null?void 0:t[1])==null?void 0:r.trim();return n&&n.length>0?n:"Background agent updated"}function uw(e){var r;const t=/<status>([\s\S]*?)<\/status>/.exec(e),n=(r=t==null?void 0:t[1])==null?void 0:r.trim().toLowerCase();return n&&n.length>0?n:null}function cw(e){return e==="killed"||e==="stopped"}function k0(e){const t=Math.max(0,Math.floor(e/1e3)),n=t%60,r=Math.floor(t/60)%60,o=Math.floor(t/3600),l=String(n).padStart(2,"0");return o>0?`${o}:${String(r).padStart(2,"0")}:${l}`:`${r}:${l}`}function ud(e){if(typeof window>"u"||typeof window.matchMedia!="function")return null;try{return window.matchMedia(e)??null}catch{return null}}function ss(e){const[t,n]=E.useState(()=>{var r;return((r=ud(e))==null?void 0:r.matches)??!1});return E.useEffect(()=>{var l;const r=ud(e);if(!r)return;const o=()=>n(!!r.matches);return o(),typeof r.addEventListener=="function"?(r.addEventListener("change",o),()=>r.removeEventListener("change",o)):((l=r.addListener)==null||l.call(r,o),()=>{var i;return(i=r.removeListener)==null?void 0:i.call(r,o)})},[e]),t}function ap(...e){return e.filter(Boolean).join(" ")}const E0="(min-width: 1280px)",C0="(min-width: 900px)",j0=1;function P0(){const e=ss(E0),t=ss(C0);return e?3:t?2:j0}const ia=6,N0=.75,T0=.9,R0=250,_0=3e4;function M0(e){const[,t]=E.useState(0);E.useEffect(()=>{if(!e)return;const n=setInterval(()=>t(r=>r+1),1e3);return()=>clearInterval(n)},[e])}function L0(){const[e,t]=E.useState(new Map);return E.useEffect(()=>pu.onActiveInfos(n=>t(new Map(n))),[]),e}function I0(e){const[t,n]=E.useState(new Map),r=E.useRef(0);return E.useEffect(()=>{if(!e){r.current++,n(new Map);return}let o=!1;const l=async()=>{const s=++r.current;try{const u=await fu.attentionChats(cu);if(o||s!==r.current)return;n(new Map(u.running.map(d=>[d.sessionId,d])))}catch{}},i=setTimeout(()=>void l(),R0),a=setInterval(()=>{document.visibilityState==="visible"&&l()},_0);return()=>{o=!0,clearTimeout(i),clearInterval(a)}},[e]),t}function D0({fill:e}){const t=e<=0?0:Math.max(1,Math.min(ia,Math.round(e*ia))),n=e<N0?"bg-accent-solid":e<T0?"bg-warn-solid":"bg-danger-solid";return f.jsx("span",{className:"flex items-center gap-px",title:`Context ${Math.round(e*100)}% full`,"aria-hidden":"true",children:Array.from({length:ia},(r,o)=>f.jsx("span",{className:ap("h-2.5 w-[3px] rounded-[1px]",o<t?n:"bg-edge")},o))})}function O0({projectSlug:e,projectName:t,chatName:n,sessionId:r,startedAt:o,fill:l}){const i=o==null?"—:—":k0(Date.now()-o),a=n??"Running turn";return f.jsxs(Uo,{"data-testid":"fleet-channel",to:`${Zy(e)}/chat/${encodeURIComponent(r)}`,title:`${a} — ${t}`,"aria-label":`${a} in ${t}, running${o==null?"":` for ${i}`}`,className:"focus-visible:focus-ring flex h-6 shrink-0 items-center gap-2 rounded-md border border-edge-subtle bg-surface px-2 text-2xs can-hover:hover:border-edge can-hover:hover:bg-surface-hover",children:[f.jsx("span",{className:"h-1.5 w-1.5 shrink-0 rounded-[1px] bg-accent-solid","aria-hidden":"true"}),f.jsx("span",{className:"max-w-[14ch] truncate font-medium text-fg",children:t}),f.jsx("span",{className:"font-mono tabular text-fg-muted",children:i}),l!=null&&f.jsx(D0,{fill:l})]})}function cd({value:e,unit:t,to:n,tone:r,title:o}){return f.jsxs(Uo,{"data-testid":`fleet-${t}`,to:n,title:o,className:"focus-visible:focus-ring flex h-6 shrink-0 items-center gap-1.5 rounded-md px-1.5 can-hover:hover:bg-surface-hover",children:[f.jsx("span",{"aria-hidden":"true",className:ap("h-1.5 w-1.5 shrink-0 rounded-[1px]",r==="live"&&"bg-accent-solid",r==="attention"&&"bg-warn-solid",r==="rest"&&"bg-edge-strong")}),f.jsx("span",{"data-testid":`fleet-${t}-value`,className:"font-mono tabular text-2xs font-semibold text-fg",children:e}),f.jsx("span",{className:"text-3xs font-semibold uppercase tracking-[0.14em] text-fg-subtle",children:t})]})}function $0({unread:e}){const{projects:t,rootWorkspace:n}=tp(),r=L0(),o=E.useMemo(()=>[...r.keys()].sort().join(","),[r]),l=I0(o);M0(r.size>0);const i=P0(),a=E.useMemo(()=>{const w=new Map;for(const x of t)w.set(x.slug,x.name);return n&&w.set(n.slug,n.name),w},[t,n]),s=E.useMemo(()=>[...r.entries()].map(([w,x])=>{const k=l.get(w);return{sessionId:w,projectSlug:x,projectName:a.get(x)??(k==null?void 0:k.projectName)??x,chatName:(k==null?void 0:k.name)??null,startedAt:pu.turnStartedAt(w),fill:(k==null?void 0:k.contextTokens)!=null&&k.contextLimit?Math.min(1,k.contextTokens/k.contextLimit):null}}).sort((w,x)=>(w.startedAt??1/0)-(x.startedAt??1/0)),[r,l,a]),u=s.slice(0,i),d=s.length-u.length,c=E.useMemo(()=>{let w="";for(const x of n?[...t,n]:t)for(const k of x.chatTurns??[])k.lastTurnCompletedAt>w&&(w=k.lastTurnCompletedAt);return w},[t,n]),p=r.size===0?`Fleet idle. ${e} unread.`:`${r.size} running. ${e} unread.`;return f.jsxs("div",{"data-testid":"fleet-readout",className:"flex h-9 shrink-0 items-center gap-2 border-b border-edge-subtle bg-surface-sunken px-2 sm:px-3",children:[f.jsx(cd,{value:r.size,unit:"running",to:"/",tone:r.size>0?"live":"rest",title:r.size>0?"Turns in flight across every project":"Nothing running"}),f.jsx(cd,{value:e,unit:"unread",to:"/",tone:e>0?"attention":"rest",title:"Chats holding a reply you have not read"}),f.jsx("span",{className:"h-4 w-px shrink-0 bg-edge-subtle","aria-hidden":"true"}),f.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-1.5 overflow-hidden",children:[u.map(w=>f.jsx(O0,{projectSlug:w.projectSlug,projectName:w.projectName,chatName:w.chatName,sessionId:w.sessionId,startedAt:w.startedAt,fill:w.fill},w.sessionId)),d>0&&f.jsxs(Uo,{to:"/",className:"focus-visible:focus-ring shrink-0 rounded-md px-1.5 py-1 font-mono tabular text-2xs text-fg-muted can-hover:hover:bg-surface-hover can-hover:hover:text-fg",title:`${d} more running — open Home for the full list`,children:["+",d]}),s.length===0&&(c?f.jsxs("span",{className:"truncate text-2xs text-fg-subtle",children:["Idle · last turn ",w0(c)]}):f.jsx(Uo,{to:"/chat",className:"focus-visible:focus-ring truncate rounded-md px-1 text-2xs text-accent can-hover:hover:underline",children:"No turns yet — start a chat →"}))]}),f.jsx("span",{role:"status","aria-live":"polite",className:"sr-only",children:p})]})}function q(e){return{width:16,height:16,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",...e}}const z0=e=>f.jsx("svg",{...q(e),children:f.jsx("path",{d:"M12 5v14M5 12h14"})}),dw=e=>f.jsx("svg",{...q(e),children:f.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48"})}),U0=e=>f.jsxs("svg",{...q(e),children:[f.jsx("path",{d:"M3 10.5 12 3l9 7.5"}),f.jsx("path",{d:"M5 9.5V20a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V9.5"})]}),fw=e=>f.jsx("svg",{...q(e),children:f.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})}),A0=e=>f.jsxs("svg",{...q(e),children:[f.jsx("circle",{cx:"11",cy:"11",r:"7"}),f.jsx("path",{d:"m21 21-4.3-4.3"})]}),hw=e=>f.jsxs("svg",{...q(e),children:[f.jsx("path",{d:"M4 5h16"}),f.jsx("path",{d:"M8 5v6h12"}),f.jsx("path",{d:"M8 11v6h12"})]}),pw=e=>f.jsx("svg",{...q(e),children:f.jsx("path",{d:"M4 6h16M4 12h16M4 18h16"})}),F0=e=>f.jsx("svg",{...q(e),children:f.jsx("path",{d:"M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z"})}),mw=e=>f.jsxs("svg",{...q(e),children:[f.jsx("path",{d:"m22 2-7 20-4-9-9-4Z"}),f.jsx("path",{d:"M22 2 11 13"})]}),gw=e=>f.jsx("svg",{...q(e),children:f.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"})}),vw=e=>f.jsxs("svg",{...q(e),children:[f.jsx("rect",{x:"9",y:"2",width:"6",height:"12",rx:"3"}),f.jsx("path",{d:"M5 10a7 7 0 0 0 14 0"}),f.jsx("path",{d:"M12 17v4M8 21h8"})]}),yw=e=>f.jsx("svg",{...q(e),children:f.jsx("path",{d:"m9 18 6-6-6-6"})}),ww=e=>f.jsx("svg",{...q(e),children:f.jsx("path",{d:"M14.7 6.3a4 4 0 0 0-5.4 5.4L3 18l3 3 6.3-6.3a4 4 0 0 0 5.4-5.4l-2.6 2.6-2-2 2.6-2.6Z"})}),b0=e=>f.jsxs("svg",{...q(e),children:[f.jsx("circle",{cx:"12",cy:"12",r:"3"}),f.jsx("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09a1.65 1.65 0 0 0-1-1.51 1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09a1.65 1.65 0 0 0 1.51-1 1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1Z"})]}),xw=e=>f.jsxs("svg",{...q(e),children:[f.jsx("path",{d:"M10.3 3.9 1.8 18a2 2 0 0 0 1.7 3h17a2 2 0 0 0 1.7-3L13.7 3.9a2 2 0 0 0-3.4 0Z"}),f.jsx("path",{d:"M12 9v4M12 17h.01"})]}),Sw=e=>f.jsx("svg",{...q(e),children:f.jsx("path",{d:"M12 3v4M12 17v4M3 12h4M17 12h4M5.6 5.6l2.8 2.8M15.6 15.6l2.8 2.8M5.6 18.4l2.8-2.8M15.6 8.4l2.8-2.8"})}),sp=e=>f.jsx("svg",{...q(e),children:f.jsx("path",{d:"M18 6 6 18M6 6l12 12"})}),kw=e=>f.jsx("svg",{...q(e),children:f.jsx("path",{d:"M13 2 4.5 13.5H11l-1 8.5 8.5-11.5H12z"})}),Ew=e=>f.jsx("svg",{...q(e),children:f.jsx("path",{d:"M6 4.5v15l13-7.5z"})}),B0=e=>f.jsx("svg",{...q(e),children:f.jsx("path",{d:"M3 6h18M3 12h18M3 18h18"})}),Cw=e=>f.jsxs("svg",{...q(e),children:[f.jsx("circle",{cx:"12",cy:"12",r:"9"}),f.jsx("path",{d:"M12 7v5l3 2"})]}),jw=e=>f.jsxs("svg",{...q(e),children:[f.jsx("circle",{cx:"12",cy:"5",r:"1"}),f.jsx("circle",{cx:"12",cy:"12",r:"1"}),f.jsx("circle",{cx:"12",cy:"19",r:"1"})]}),Pw=e=>f.jsx("svg",{...q(e),children:f.jsx("path",{d:"M3 6h18M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2m3 0v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6M10 11v6M14 11v6"})}),Nw=e=>f.jsxs("svg",{...q(e),children:[f.jsx("path",{d:"M12 20h9"}),f.jsx("path",{d:"M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4Z"})]}),Tw=e=>f.jsxs("svg",{...q(e),children:[f.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8Z"}),f.jsx("path",{d:"M14 2v6h6"})]}),Rw=e=>f.jsxs("svg",{...q(e),children:[f.jsx("path",{d:"M12 17v5"}),f.jsx("path",{d:"M9 10.76V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v6.76a2 2 0 0 0 .59 1.42l1.12 1.12A1 1 0 0 1 17 15H7a1 1 0 0 1-.71-1.7l1.12-1.12A2 2 0 0 0 9 10.76Z"})]}),_w=e=>f.jsx("svg",{...q(e),children:f.jsx("path",{d:"M20 6 9 17l-5-5"})}),Mw=({open:e,...t})=>e?f.jsxs("svg",{...q(t),children:[f.jsx("path",{d:"M21.2 8.4c.5.38.8.97.8 1.6v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V10a2 2 0 0 1 .8-1.6l8-6a2 2 0 0 1 2.4 0l8 6Z"}),f.jsx("path",{d:"m22 10-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 10"})]}):f.jsxs("svg",{...q(t),children:[f.jsx("rect",{width:"20",height:"16",x:"2",y:"4",rx:"2"}),f.jsx("path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7"})]}),Lw=e=>f.jsxs("svg",{...q(e),children:[f.jsx("circle",{cx:"6",cy:"6",r:"3"}),f.jsx("circle",{cx:"6",cy:"18",r:"3"}),f.jsx("circle",{cx:"18",cy:"6",r:"3"}),f.jsx("path",{d:"M6 9v6M18 9a9 9 0 0 1-9 9"})]}),Iw=e=>f.jsxs("svg",{...q(e),children:[f.jsx("path",{d:"M9.5 14.5l-1.7 1.7a4 4 0 0 1-5.66-5.66l1.7-1.7"}),f.jsx("path",{d:"M14.5 9.5l1.7-1.7a4 4 0 0 1 5.66 5.66l-1.7 1.7"}),f.jsx("path",{d:"M8 3.5v2M3.5 8h2M16 20.5v-2M20.5 16h-2"})]}),Dw=e=>f.jsxs("svg",{...q(e),children:[f.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),f.jsx("path",{d:"M17 8l-5-5-5 5M12 3v12"})]}),Ow=e=>f.jsx("svg",{...q(e),children:f.jsx("path",{d:"M4 17l6-5-6-5M12 19h8"})}),$w=e=>f.jsx("svg",{...q(e),children:f.jsx("path",{d:"M9 19c-5 1.5-5-2.5-7-3m14 6v-3.9a3.4 3.4 0 0 0-1-2.6c3-.3 6.2-1.5 6.2-6.6a5.2 5.2 0 0 0-1.4-3.6 4.8 4.8 0 0 0-.1-3.6s-1.1-.3-3.7 1.4a12.6 12.6 0 0 0-6.6 0C6.5 1.3 5.4 1.6 5.4 1.6a4.8 4.8 0 0 0-.1 3.6 5.2 5.2 0 0 0-1.4 3.6c0 5.1 3.2 6.3 6.2 6.6a3.4 3.4 0 0 0-1 2.6V22"})}),W0=e=>f.jsxs("svg",{...q(e),children:[f.jsx("circle",{cx:"12",cy:"12",r:"4"}),f.jsx("path",{d:"M12 2v2M12 20v2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M2 12h2M20 12h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4"})]}),V0=e=>f.jsx("svg",{...q(e),children:f.jsx("path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z"})}),H0=e=>f.jsxs("svg",{...q(e),children:[f.jsx("path",{d:"M10 13a5 5 0 0 0 7.5.5l3-3a5 5 0 0 0-7-7l-1.5 1.5"}),f.jsx("path",{d:"M14 11a5 5 0 0 0-7.5-.5l-3 3a5 5 0 0 0 7 7l1.5-1.5"})]}),zw=e=>f.jsx("svg",{...q(e),children:f.jsx("path",{d:"m6 9 6 6 6-6"})}),Uw=e=>f.jsxs("svg",{...q(e),children:[f.jsx("rect",{x:"3",y:"4",width:"18",height:"4",rx:"1"}),f.jsx("path",{d:"M5 8v11a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V8"}),f.jsx("path",{d:"M10 12h4"})]}),Aw=e=>f.jsx("svg",{...q(e),children:f.jsx("path",{d:"M12 2.5l2.9 5.88 6.49.94-4.7 4.58 1.11 6.46L12 17.8l-5.8 3.05 1.11-6.46-4.7-4.58 6.49-.94z"})}),Q0=["idea","active","paused","blocked","done"];function K0({open:e,onClose:t,onCreated:n}){const[r,o]=E.useState(""),[l,i]=E.useState(""),[a,s]=E.useState(""),[u,d]=E.useState(""),[c,p]=E.useState("active"),[w,x]=E.useState(""),[k,R]=E.useState(""),[v,h]=E.useState(!1),[g,C]=E.useState(!1),[T,P]=E.useState(null);if(E.useEffect(()=>{e&&(o(""),i(""),s(""),d(""),p("active"),x(""),R(""),h(!1),P(null))},[e]),E.useEffect(()=>{const m=O=>{O.key==="Escape"&&e&&!g&&t()};return window.addEventListener("keydown",m),()=>window.removeEventListener("keydown",m)},[e,g,t]),!e)return null;const M=async m=>{if(m.preventDefault(),!!r.trim()){C(!0),P(null);try{const O=await fu.createProject({name:r.trim(),status:c,group:u||void 0,summary:l.trim()||void 0,repo:w.trim()||void 0,path:k.trim()||void 0,managed:k.trim()&&!w.trim()?v:void 0,domain:a.split(",").map(L=>L.trim()).filter(Boolean)});n(O)}catch(O){P(O instanceof Ao?O.message:"Failed to create project")}finally{C(!1)}}};return f.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-overlay p-4 backdrop-blur-sm",onClick:()=>!g&&t(),children:f.jsxs("form",{className:"w-full max-w-md animate-scale-in rounded-2xl border border-edge bg-surface-raised p-6 shadow-2xl",onClick:m=>m.stopPropagation(),onSubmit:M,children:[f.jsxs("div",{className:"mb-5 flex items-center justify-between",children:[f.jsx("h2",{className:"text-lg font-semibold",children:"New project"}),f.jsx("button",{type:"button",onClick:t,className:"rounded-lg p-1 text-fg-subtle hover:bg-surface-hover hover:text-fg-muted","aria-label":"Close",children:f.jsx(sp,{width:18,height:18})})]}),f.jsxs("label",{className:"mb-4 block",children:[f.jsx("span",{className:"field-label",children:"Name"}),f.jsx("input",{autoFocus:!0,className:"input",value:r,onChange:m=>o(m.target.value),placeholder:"Garage Water Heater Replacement"})]}),f.jsxs("label",{className:"mb-4 block",children:[f.jsx("span",{className:"field-label",children:"Summary (optional)"}),f.jsx("input",{className:"input",value:l,onChange:m=>i(m.target.value),placeholder:"One line on what this project is about"})]}),f.jsxs("label",{className:"mb-4 block",children:[f.jsx("span",{className:"field-label",children:"Area"}),f.jsxs("select",{className:"input",value:u,onChange:m=>d(m.target.value),children:[f.jsx("option",{value:"",children:"Unsorted"}),hu.map(m=>f.jsx("option",{value:m.slug,children:m.label},m.slug))]})]}),f.jsxs("label",{className:"mb-4 block",children:[f.jsx("span",{className:"field-label",children:"Directory on this machine (optional)"}),f.jsx("input",{className:"input",value:k,onChange:m=>R(m.target.value),placeholder:"/home/ed/Code/foo"}),f.jsx("span",{className:"mt-1 block text-xs text-fg-subtle",children:"Where this project's content lives. An existing checkout is used in place — its real history, branches and remotes — and Paddock writes nothing into it. Absolute path; created for you if it doesn't exist."})]}),f.jsxs("label",{className:"mb-4 block",children:[f.jsx("span",{className:"field-label",children:"Git repository URL (optional)"}),f.jsx("input",{className:"input",value:w,onChange:m=>x(m.target.value),placeholder:"https://github.com/owner/repo.git"}),f.jsx("span",{className:"mt-1 block text-xs text-fg-subtle",children:k.trim()?"Cloned into the directory above if it doesn't exist yet; otherwise the directory is used as-is and this just records which repo it is.":"Paddock clones this repo into the project and works in the checkout. Leave both blank for a notes project."})]}),k.trim()&&!w.trim()&&f.jsxs("label",{className:"mb-4 flex cursor-pointer items-start gap-2",children:[f.jsx("input",{type:"checkbox",className:"mt-0.5",checked:v,onChange:m=>h(m.target.checked)}),f.jsxs("span",{className:"text-xs text-fg-muted",children:[f.jsx("span",{className:"font-medium",children:"These are notes — let Paddock curate them."})," ","Its OVERVIEW.md, CHANGELOG.md and CLAUDE.md are written into that directory. Leave unticked for a code checkout you version yourself, and Paddock will write nothing into it."]})]}),f.jsxs("div",{className:"mb-5 grid grid-cols-2 gap-3",children:[f.jsxs("label",{className:"block",children:[f.jsx("span",{className:"field-label",children:"Domain tags"}),f.jsx("input",{className:"input",value:a,onChange:m=>s(m.target.value),placeholder:"home, plumbing"})]}),f.jsxs("label",{className:"block",children:[f.jsx("span",{className:"field-label",children:"Status"}),f.jsx("select",{className:"input capitalize",value:c,onChange:m=>p(m.target.value),children:Q0.map(m=>f.jsx("option",{value:m,className:"capitalize",children:m},m))})]})]}),T&&f.jsx("p",{className:"mb-4 rounded-lg bg-danger-soft px-3 py-2 text-sm text-danger",children:T}),f.jsxs("div",{className:"flex justify-end gap-2",children:[f.jsx("button",{type:"button",className:"btn-ghost",onClick:t,disabled:g,children:"Cancel"}),f.jsx("button",{type:"submit",className:"btn-primary",disabled:g||!r.trim(),children:g?"Creating…":"Create project"})]})]})})}const gu="paddock:panewidth:",G0={key:"sidenav",def:288,min:200,max:480},Fw={key:"chatlist",def:256,min:220,max:520},J0="(min-width: 1024px)";function Tr(e,t){return Math.min(Math.max(t,e.min),e.max)}function dd(e,t,n){return Tr(n,e+t)}function Y0(e){try{const t=localStorage.getItem(gu+e.key);if(t==null)return null;const n=Number.parseFloat(t);return Number.isFinite(n)?Tr(e,n):null}catch{return null}}function X0(e,t){try{localStorage.setItem(gu+e.key,String(Tr(e,t)))}catch{}}function Z0(e){try{localStorage.removeItem(gu+e.key)}catch{}}function q0(e){const t=ss(J0),[n,r]=E.useState(()=>Y0(e)),o=Tr(e,n??e.def);return{isDesktop:t,width:o,style:t?{width:o}:void 0,preview:l=>r(Tr(e,l)),commit:l=>{const i=Tr(e,l);r(i),X0(e,i)},reset:()=>{r(null),Z0(e)},spec:e}}function e1({spec:e,width:t,onPreview:n,onCommit:r,onReset:o,label:l}){const i=E.useRef(null),a=E.useRef(t);a.current=t;const s=16;return f.jsx("div",{role:"separator","aria-orientation":"vertical","aria-label":l,"aria-valuenow":Math.round(t),"aria-valuemin":e.min,"aria-valuemax":e.max,tabIndex:0,onPointerDown:u=>{i.current={startX:u.clientX,startWidth:t},u.currentTarget.setPointerCapture(u.pointerId)},onPointerMove:u=>{i.current&&n(dd(i.current.startWidth,u.clientX-i.current.startX,e))},onPointerUp:u=>{if(i.current){i.current=null;try{u.currentTarget.releasePointerCapture(u.pointerId)}catch{}r(a.current)}},onDoubleClick:o,onKeyDown:u=>{if(u.key==="ArrowLeft"||u.key==="ArrowRight"){u.preventDefault();const d=dd(t,u.key==="ArrowRight"?s:-s,e);n(d),r(d)}},title:"Drag to resize · double-click to reset",className:"group/resizer absolute inset-y-0 right-0 z-10 hidden w-1.5 -mr-0.5 cursor-ew-resize touch-none lg:block",children:f.jsx("span",{className:"absolute inset-y-0 right-0 w-px bg-edge transition group-hover/resizer:w-0.5 group-hover/resizer:bg-accent-solid group-focus/resizer:w-0.5 group-focus/resizer:bg-accent-solid"})})}function t1(e){const[t,n]=E.useState(new Map),r=E.useRef(new Map),[o,l]=E.useState(0);return E.useEffect(()=>{const i=r.current;for(const a of e)for(const s of a.chatTurns??[]){g0(s.sessionId,s.lastSeen);const u=Date.parse(s.lastTurnCompletedAt);if(!Number.isFinite(u))continue;const d=i.get(s.sessionId);!d||u>d.at?i.set(s.sessionId,{slug:a.slug,at:u,unread:s.unread}):d.unread=s.unread}if(e.length>0){const a=new Set(e.map(s=>s.slug));for(const[s,u]of i)a.has(u.slug)||i.delete(s)}l(a=>a+1)},[e]),E.useEffect(()=>{const i=a=>{var d;const s=((d=a.detail)==null?void 0:d.sessionIds)??[];let u=!1;for(const c of s)u=r.current.delete(c)||u;u&&l(c=>c+1)};return window.addEventListener(as,i),()=>window.removeEventListener(as,i)},[]),E.useEffect(()=>{const i=new Map;return pu.onActiveInfos(a=>{for(const[s,u]of i)a.has(s)||r.current.set(s,{slug:u,at:Date.now()});i.clear();for(const[s,u]of a)i.set(s,u);n(new Map(a)),l(s=>s+1)})},[]),E.useEffect(()=>{const i=()=>l(a=>a+1);return window.addEventListener(is,i),()=>window.removeEventListener(is,i)},[]),E.useMemo(()=>{const i=new Map,a=s=>{let u=i.get(s);return u||(u={unread:0,inflight:0},i.set(s,u)),u};for(const[s,{slug:u,at:d,unread:c}]of r.current)!t.has(s)&&(c||d>m0(s))&&(a(u).unread+=1);for(const s of t.values())a(s).inflight+=1;return i},[t,o])}function n1(){const{projects:e,rootWorkspace:t,loading:n,upsert:r}=tp(),{dark:o,toggle:l}=l0(),[i,a]=E.useState(!1),[s,u]=E.useState(!1),d=ji(),c=nr(),p=rp(),w=a0(),x=q0(G0),k=c.pathname==="/"||c.pathname==="/projects"||c.pathname.startsWith("/chat"),R=c.pathname.startsWith("/projects/")||k;E.useEffect(()=>{a(!1)},[c.pathname]),E.useEffect(()=>{document.title=p.name},[p.name]);const v=E.useMemo(()=>{const P=new Map;for(const M of e){const m=M.group??"",O=P.get(m);O?O.push(M):P.set(m,[M])}return c0(P.keys()).map(M=>[M,P.get(M)??[]])},[e]),h=E.useMemo(()=>t?[...e,t]:e,[e,t]),g=t1(h),C=g.get(cu),T=E.useMemo(()=>{let P=0;for(const M of g.values())P+=M.unread;return P},[g]);return f.jsxs("div",{className:"flex h-[100dvh] flex-col overflow-hidden bg-surface lg:flex-row",children:[!R&&f.jsxs("header",{className:"pt-safe flex items-center gap-2 border-b border-edge px-3 pb-2 lg:hidden",children:[f.jsx("button",{type:"button",onClick:()=>a(!0),"aria-label":"Open menu",className:"btn-subtle -ml-1 px-2 py-2",children:f.jsx(B0,{width:20,height:20})}),f.jsxs(An,{to:"/",className:"flex items-center gap-2",children:[f.jsx(fd,{brand:p,className:"h-7 w-7 text-sm"}),f.jsx("span",{className:"text-md font-semibold tracking-tight",children:p.name})]})]}),i&&f.jsx("div",{className:"fixed inset-0 z-30 bg-overlay backdrop-blur-sm lg:hidden","aria-hidden":"true",onClick:()=>a(!1)}),f.jsxs("aside",{style:x.style,className:`fixed inset-y-0 left-0 z-40 flex w-72 max-w-[85%] shrink-0 flex-col border-r border-edge bg-surface shadow-2xl transition-transform duration-200 ease-out lg:relative lg:z-auto lg:max-w-none lg:translate-x-0 lg:bg-surface-raised/50 lg:shadow-none ${i?"translate-x-0":"-translate-x-full"}`,children:[x.isDesktop&&f.jsx(e1,{spec:x.spec,width:x.width,onPreview:x.preview,onCommit:x.commit,onReset:x.reset,label:"Resize sidebar"}),f.jsxs("div",{className:"flex items-center gap-2 px-5 py-4",children:[f.jsxs(An,{to:"/",className:"group flex items-center gap-2",children:[f.jsx(fd,{brand:p,className:"h-8 w-8 text-base"}),f.jsx("span",{className:"text-lg font-semibold tracking-tight",children:p.name})]}),f.jsx("button",{type:"button",onClick:()=>a(!1),"aria-label":"Close menu",className:"btn-subtle ml-auto px-2 py-2 lg:hidden",children:f.jsx(sp,{width:18,height:18})})]}),f.jsx("div",{className:"px-3 pb-1",children:f.jsxs(An,{to:"/",end:!0,className:({isActive:P})=>`btn-subtle w-full justify-start ${P?"bg-surface-selected":""}`,title:"The root workspace — every project, and the instance's own chats",children:[f.jsx(U0,{width:16,height:16}),"Home",f.jsx(up,{badge:C,className:"ml-auto"})]})}),f.jsxs("div",{className:"mt-5 mb-1 flex items-center justify-between pr-3",children:[f.jsx(An,{to:qy(),className:"section-label hover:text-accent",children:"Projects"}),f.jsx("button",{type:"button",onClick:()=>u(!0),"aria-label":"New Project",title:"New Project",className:"btn-subtle -mr-1 px-1.5 py-1 text-fg-subtle hover:text-accent",children:f.jsx(z0,{width:14,height:14})})]}),f.jsxs("nav",{className:"flex-1 overflow-y-auto px-2 pb-4",children:[n&&f.jsx("div",{className:"space-y-2 px-2 py-2",children:[0,1,2].map(P=>f.jsx("div",{className:"h-10 animate-pulse rounded-lg bg-surface-active"},P))}),!n&&e.length===0&&f.jsx("p",{className:"px-3 py-2 text-sm text-fg-muted",children:"No projects yet."}),!n&&e.length>0&&v.map(([P,M])=>f.jsxs("div",{className:"mb-2",children:[v.length>1&&f.jsx("div",{className:"px-2.5 pb-1 pt-2 text-3xs font-semibold uppercase tracking-wider text-fg-subtle",children:u0(P)}),M.map(m=>f.jsx(o1,{project:m,badge:g.get(m.slug)},m.slug))]},P||"unsorted"))]}),f.jsxs("div",{className:"border-t border-edge px-3 py-3",children:[f.jsxs(An,{to:"/config",className:({isActive:P})=>`btn-subtle w-full justify-start ${P?"bg-surface-selected":""}`,title:"Instance config — paddock.config.yaml (restart required)",children:[f.jsx(b0,{width:15,height:15}),"Config"]}),f.jsxs(An,{to:"/discover",className:({isActive:P})=>`btn-subtle mt-1 w-full justify-start ${P?"bg-surface-selected":""}`,title:"Find directories with existing Claude Code history to import",children:[f.jsx(A0,{width:15,height:15}),"Discover"]}),w.enabled&&f.jsxs("a",{href:w.path,target:"_blank",rel:"noreferrer",className:"btn-subtle mt-1 w-full justify-start",title:"OpenAPI / Swagger reference (opens in a new tab)",children:[f.jsx(H0,{width:15,height:15}),"Swagger API"]}),f.jsxs("button",{type:"button",onClick:l,className:"btn-subtle mt-1 w-full justify-start","aria-label":o?"Switch to light mode":"Switch to dark mode",title:"Toggle light / dark theme",children:[o?f.jsx(W0,{width:15,height:15}):f.jsx(V0,{width:15,height:15}),o?"Light mode":"Dark mode"]}),f.jsxs("p",{className:"mt-2 px-2 text-2xs text-fg-subtle",children:["v","0.71.1"]})]})]}),f.jsxs("div",{className:"flex min-w-0 flex-1 flex-col overflow-hidden",children:[f.jsx($0,{unread:T}),f.jsx("main",{className:"min-h-0 min-w-0 flex-1 overflow-hidden",children:f.jsx(E.Suspense,{fallback:f.jsx(r1,{}),children:f.jsx(Ty,{context:{openNav:()=>a(!0)}})})})]}),f.jsx(K0,{open:s,onClose:()=>u(!1),onCreated:P=>{r(P),u(!1),d(`/projects/${P.slug}/chat`)}})]})}function fd({brand:e,className:t=""}){return f.jsx("span",{className:`flex shrink-0 items-center justify-center overflow-hidden rounded-lg bg-accent-solid text-accent-fg shadow-sm ${t}`,children:s0(e.logo)?f.jsx("img",{src:e.logo,alt:"",className:"h-full w-full object-cover"}):e.logo})}function r1(){return f.jsxs("div",{className:"flex h-full items-center justify-center","aria-busy":"true","aria-live":"polite",children:[f.jsx("span",{className:"h-6 w-6 animate-spin rounded-full border-2 border-edge-strong border-t-accent"}),f.jsx("span",{className:"sr-only",children:"Loading…"})]})}function o1({project:e,badge:t}){return f.jsxs(An,{to:`/projects/${e.slug}`,className:({isActive:n})=>`group mb-0.5 flex flex-col gap-1 rounded-lg px-2.5 py-2 text-sm transition-colors ${n?"bg-surface-selected":"hover:bg-surface-hover"}`,children:[f.jsxs("span",{className:"flex items-center justify-between gap-2",children:[f.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[f.jsx(F0,{width:13,height:13,className:"shrink-0 text-fg-subtle group-hover:text-fg-muted"}),f.jsx("span",{className:"truncate font-medium",children:e.name})]}),f.jsx(up,{badge:t})]}),e.domain.length>0&&f.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden pl-[18px]",children:[e.domain.slice(0,2).map(n=>f.jsx(v0,{tag:n,className:"max-w-[7rem] truncate"},n)),e.domain.length>2&&f.jsxs("span",{className:"shrink-0 text-2xs text-fg-subtle",children:["+",e.domain.length-2]})]})]})}function up({badge:e,className:t=""}){const n=(e==null?void 0:e.unread)??0,r=(e==null?void 0:e.inflight)??0;return n===0&&r===0?null:f.jsxs("span",{className:`flex shrink-0 items-center gap-1.5 ${t}`,children:[r>0&&f.jsxs("span",{className:"flex items-center gap-1 text-2xs tabular text-fg-muted",title:`${r} chat${r===1?"":"s"} in flight`,"aria-label":`${r} chat${r===1?"":"s"} in flight`,children:[f.jsx("span",{"aria-hidden":"true",className:"h-2.5 w-2.5 spin-eco rounded-full border-[1.5px] border-edge-strong border-t-transparent"}),r]}),n>0&&f.jsx("span",{className:"inline-flex min-w-[1.1rem] items-center justify-center rounded-full bg-accent-solid px-1.5 py-0.5 text-2xs font-semibold leading-none tabular text-accent-fg",title:`${n} unread ${n===1?"reply":"replies"}`,"aria-label":`${n} unread ${n===1?"reply":"replies"}`,children:n})]})}const cp="paddock:chunkReloadAt",l1=1e4,hd=/dynamically imported module|module script|importing a module|failed to fetch|unable to preload|load failed|error loading/i;function i1(e){return e?e instanceof Error?e.name==="ChunkLoadError"?!0:hd.test(e.message):hd.test(String(e)):!1}function vu(){try{return typeof sessionStorage<"u"?sessionStorage:void 0}catch{return}}function a1(e=Date.now(),t=vu()){if(!t)return!1;const n=t.getItem(cp);if(!n)return!1;const r=Number(n);return Number.isFinite(r)&&e-r<l1}function s1(e=Date.now(),t=vu()){try{t==null||t.setItem(cp,String(e))}catch{}}function u1(e,t=Date.now(),n=vu()){return i1(e)&&!a1(t,n)?"reload":"show"}function c1(){const e=Xh(),t=u1(e);if(E.useEffect(()=>{t==="reload"&&(s1(),window.location.reload())},[t]),t==="reload")return f.jsxs("div",{className:"flex h-[100dvh] items-center justify-center bg-surface","aria-busy":"true","aria-live":"polite",children:[f.jsx("span",{className:"h-6 w-6 animate-spin rounded-full border-2 border-edge-strong border-t-accent"}),f.jsx("span",{className:"sr-only",children:"Updating…"})]});const n=e instanceof Error?e.message:typeof e=="string"?e:"";return f.jsxs("div",{className:"flex h-[100dvh] flex-col items-center justify-center gap-4 bg-surface px-6 text-center",children:[f.jsxs("div",{children:[f.jsx("h1",{className:"text-lg font-semibold tracking-tight",children:"Something went wrong"}),f.jsx("p",{className:"mt-1 max-w-md text-sm text-fg-muted",children:"The app hit an unexpected error. Reloading usually fixes it."}),n?f.jsx("p",{className:"mt-2 max-w-md break-words font-mono text-2xs text-fg-subtle",children:n}):null]}),f.jsx("button",{className:"btn-primary",onClick:()=>window.location.reload(),children:"Reload"})]})}function d1(){typeof navigator>"u"||!("serviceWorker"in navigator)||window.addEventListener("load",()=>{const e=navigator.serviceWorker,t=!!e.controller;let n=!1;e.addEventListener("controllerchange",()=>{n||!t||(n=!0,window.location.reload())}),e.register("/sw.js").catch(()=>{})})}const yu=e=>e<0?0:e>1?1:e;function wu(e){return e<=.0031308?12.92*e:1.055*Math.pow(e,1/2.4)-.055}function Mt(e){return e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function xu({L:e,a:t,b:n}){const r=(e+.3963377774*t+.2158037573*n)**3,o=(e-.1055613458*t-.0638541728*n)**3,l=(e-.0894841775*t-1.291485548*n)**3;return[4.0767416621*r-3.3077115913*o+.2309699292*l,-1.2684380046*r+2.6097574011*o-.3413193965*l,-.0041960863*r-.7034186147*o+1.707614701*l]}function us(e,t,n){const r=Math.cbrt(.4122214708*e+.5363325363*t+.0514459929*n),o=Math.cbrt(.2119034982*e+.6806995451*t+.1073969566*n),l=Math.cbrt(.0883024619*e+.2817188376*t+.6299787005*n);return{L:.2104542553*r+.793617785*o-.0040720468*l,a:1.9779984951*r-2.428592205*o+.4505937099*l,b:.0259040371*r+.7827717662*o-.808675766*l}}function Fo(e,t,n,r=1){const o=n*Math.PI/180,l=xu({L:e,a:t*Math.cos(o),b:t*Math.sin(o)}),[i,a,s]=l.map(u=>yu(wu(u)));return{r:i,g:a,b:s,a:r}}function pd(e,t,n){const r=n*Math.PI/180;return xu({L:e,a:t*Math.cos(r),b:t*Math.sin(r)}).map(wu).every(o=>o>=-.0015&&o<=1.0015)}function pn({r:e,g:t,b:n}){const r=o=>Math.round(yu(o)*255).toString(16).padStart(2,"0");return`#${r(e)}${r(t)}${r(n)}`}function Ze({r:e,g:t,b:n}){const[r,o,l]=[e,t,n].map(Mt);return .2126*r+.7152*o+.0722*l}function f1(e,t){if(e.a>=1)return e;const n=e.a;return{r:e.r*n+t.r*(1-n),g:e.g*n+t.g*(1-n),b:e.b*n+t.b*(1-n),a:1}}function Qe(e,t){const n=Ze(f1(e,t)),r=Ze(t),[o,l]=n>r?[n,r]:[r,n];return(o+.05)/(l+.05)}const md={white:{r:1,g:1,b:1,a:1},black:{r:0,g:0,b:0,a:1},transparent:{r:0,g:0,b:0,a:0}};function aa(e){const t=[];let n=0,r="";for(const o of e)o==="("?n++:o===")"&&n--,o===","&&n===0?(t.push(r.trim()),r=""):r+=o;return r.trim()&&t.push(r.trim()),t}function ar(e,t){return!e.startsWith(`${t}(`)||!e.endsWith(")")?null:e.slice(t.length+1,-1)}function cn(e){const t=e.endsWith("%")?Number(e.slice(0,-1))/100:Number(e);if(!Number.isFinite(t))throw new Error(`not a number: ${e}`);return t}function Sr(e,t,n=0){if(n>24)throw new Error(`var() cycle resolving ${e}`);const r=e.trim();if(md[r])return md[r];if(r.startsWith("#")){let s=r.slice(1);if(s.length===3&&(s=[...s].map(d=>d+d).join("")),s.length!==6)throw new Error(`bad hex: ${r}`);const u=parseInt(s,16);return{r:(u>>16&255)/255,g:(u>>8&255)/255,b:(u&255)/255,a:1}}const o=ar(r,"var");if(o!==null){const[s,...u]=aa(o),d=t[s]??u.join(",");if(!d)throw new Error(`undefined custom property: ${s}`);return Sr(d,t,n+1)}const l=ar(r,"oklch");if(l!==null){const[s,u]=l.split("/"),d=s.trim().split(/\s+/);if(d.length!==3)throw new Error(`bad oklch(): ${r}`);return Fo(cn(d[0]),cn(d[1]),cn(d[2]),u?cn(u.trim()):1)}const i=ar(r,"rgb")??ar(r,"rgba");if(i!==null){const s=i.trim(),u=ar(s,"var");if(u!==null){const[w]=aa(u),x=t[w];if(!x)throw new Error(`undefined custom property: ${w}`);return Sr(`rgb(${x})`,t,n+1)}const[d,c]=s.split("/"),p=d.trim().split(/[\s,]+/);if(p.length<3)throw new Error(`bad rgb(): ${r}`);return{r:cn(p[0])/255,g:cn(p[1])/255,b:cn(p[2])/255,a:c?cn(c.trim()):1}}const a=ar(r,"color-mix");if(a!==null){const[s,u,d]=aa(a),c=s.trim();if(c!=="in oklab"&&c!=="in srgb")throw new Error(`only \`in oklab\` and \`in srgb\` color-mix are supported, got: ${s}`);const p=gd(u),w=gd(d);let x=p.pct,k=w.pct;x===null&&k===null?(x=.5,k=.5):x===null?x=1-k:k===null&&(k=1-x);const R=x+k,v=x/R,h=Sr(p.color,t,n+1),g=Sr(w.color,t,n+1);return c==="in srgb"?h1(h,g,v):p1(h,g,v)}throw new Error(`unsupported colour value: ${r}`)}function gd(e){const t=/\s+(-?[\d.]+)%$/.exec(e.trim());return t?{color:e.trim().slice(0,t.index).trim(),pct:Number(t[1])/100}:{color:e.trim(),pct:null}}function h1(e,t,n){return{r:e.r*n+t.r*(1-n),g:e.g*n+t.g*(1-n),b:e.b*n+t.b*(1-n),a:e.a*n+t.a*(1-n)}}function p1(e,t,n){const r=us(Mt(e.r),Mt(e.g),Mt(e.b)),o=us(Mt(t.r),Mt(t.g),Mt(t.b)),l={L:r.L*n+o.L*(1-n),a:r.a*n+o.a*(1-n),b:r.b*n+o.b*(1-n)},[i,a,s]=xu(l).map(u=>yu(wu(u)));return{r:i,g:a,b:s,a:e.a*n+t.a*(1-n)}}function Tn({r:e,g:t,b:n}){const{L:r,a:o,b:l}=us(Mt(e),Mt(t),Mt(n)),i=Math.hypot(o,l),a=i<1e-6?0:(Math.atan2(l,o)*180/Math.PI+360)%360;return{L:r,C:i,H:a}}const Lt=4.5,dp=3,jt=.12,fp=["--accent","--accent-600","--accent-700","--accent-solid","--accent-solid-hover","--accent-text"];function pt(e,t){const n=getComputedStyle(e).getPropertyValue(t).trim();if(!n)return null;const r=/^\d+(\.\d+)?( \d+(\.\d+)?){2}$/.test(n)?`rgb(${n})`:n;try{return Sr(r,{})}catch{return null}}function m1(e,t,n){let r=0,o=1;for(let l=0;l<32;l++){const i=(r+o)/2;Ze(Fo(i,t,n))<e?r=i:o=i}return(r+o)/2}function hp(e,t,n){if(pd(e,t,n))return t;let r=0,o=t;for(let l=0;l<24;l++){const i=(r+o)/2;pd(e,i,n)?r=i:o=i}return r}function sa(e,t,n,r,o){const l=Ze(r);let i=t,a=.5;for(let s=0;s<4;s++){const u=m1(l,i,n);let d=o?0:u,c=o?u:1;for(let p=0;p<28;p++){const w=(d+c)/2,x=Qe(Fo(w,i,n),r)>=e;o?x?d=w:c=w:x?c=w:d=w}a=o?d:c,i=hp(a,t,n)}return{L:a,C:i,rgb:Fo(a,i,n)}}const g1=.75;function Rr(e,t,n,r,o,l=e){const i=sa(e,t,n,r,o),a=c=>c.C>=t*g1;if(a(i)||l>=e)return{...i,hit:Qe(i.rgb,r)>=e-.01};let s=l,u=e,d=sa(l,t,n,r,o);for(let c=0;c<16;c++){const p=(s+u)/2,w=sa(p,t,n,r,o);a(w)?(d=w,s=p):u=p}return{...d,hit:Qe(d.rgb,r)>=l-.01}}function ua({r:e,g:t,b:n}){const r=o=>Math.round(Math.max(0,Math.min(1,o))*255);return`${r(e)} ${r(t)} ${r(n)}`}const pp=["--surface","--surface-raised","--surface-sunken","--surface-hover","--surface-active","--surface-selected","--border-subtle","--border","--border-strong","--text","--text-muted","--text-subtle","--scroll-thumb"],vd=["--text","--text-muted","--text-subtle"],v1=["--surface","--surface-raised","--surface-sunken","--surface-hover","--surface-active","--surface-selected"];function mp(e=document.documentElement){for(const t of pp)e.style.removeProperty(t)}function y1(e,t,n=document.documentElement){mp(n);for(const o of pp){const l=pt(n,o);if(!l)continue;const{L:i,C:a}=Tn(l),s=vd.includes(o),u=Math.max(a,t*(s?.5:1));n.style.setProperty(o,pn(Fo(i,hp(i,u,e),e)))}let r=1/0;for(const o of vd){const l=pt(n,o);if(l)for(const i of v1){const a=pt(n,i);a&&(r=Math.min(r,Qe(l,a)))}}return r}function gp(e=document.documentElement){for(const t of fp)e.style.removeProperty(t)}function vp(e,t){const n=fp.map(r=>[r,e.style.getPropertyValue(r)]);gp(e);try{return t()}finally{for(const[r,o]of n)o&&e.style.setProperty(r,o)}}function w1(e=document.documentElement){return vp(e,()=>{const t=pt(e,"--accent");return t?Tn(t).H:0})}const ro={r:1,g:1,b:1,a:1};function yp(e=document.documentElement){return vp(e,()=>x1(e))}function x1(e){const t={accent:pt(e,"--accent")??ro,a600:pt(e,"--accent-600")??ro,a700:pt(e,"--accent-700")??ro},n=pt(e,"--accent-fg")??ro,r=pt(e,"--surface")??ro,o=["--surface","--surface-raised","--surface-sunken"].map(a=>pt(e,a)).filter(a=>a!==null),l=o.length?o:[r],i=l.reduce((a,s)=>Qe(t.a700,a)<Qe(t.a700,s)?a:s);return{fg:n,surface:r,surfaces:l,targets:{accent:Math.max(Qe(t.accent,r),dp+jt),a600:Math.max(Qe(t.a600,n),Lt+jt),a700:Math.max(l.reduce((a,s)=>Math.min(a,Qe(t.a700,s)),1/0),Lt+jt)},chroma:{accent:Tn(t.accent).C,a600:Tn(t.a600).C,a700:Tn(t.a700).C},darker:{accent:Ze(t.accent)<Ze(r),a600:Ze(n)>Ze(t.a600),a700:Ze(t.a700)<Ze(i)},a700Bg:i}}function S1(e,t){const n=Lt+jt;return{accent:Rr(e.targets.accent,e.chroma.accent,t,e.surface,e.darker.accent,dp+jt),a600:Rr(e.targets.a600,e.chroma.a600,t,e.fg,e.darker.a600,n),a700:Rr(e.targets.a700,e.chroma.a700,t,e.a700Bg,e.darker.a700,n)}}function bw(e,t=document.documentElement){const n=yp(t);return e.map(r=>pn(Rr(n.targets.a600,n.chroma.a600,r,n.fg,n.darker.a600,Lt+jt).rgb))}function k1(e,t=document.documentElement,n={}){const r=t.classList.contains("dark")?"dark":"light",o=n.context??yp(t),l=S1(o,e),{a600:i,a700:a,accent:s}=l,u={C:o.chroma.a700};gp(t),t.style.setProperty("--accent",ua(s.rgb)),t.style.setProperty("--accent-600",ua(i.rgb)),t.style.setProperty("--accent-700",ua(a.rgb));const d={};for(const g of["--accent-fg","--accent-solid","--accent-solid-hover","--accent-text","--surface","--surface-raised","--surface-sunken","--accent-soft"])d[g]=pt(t,g);const c=[],p=d["--accent-fg"]??o.fg,w=(g,C,T)=>{const P=d[g];if(!P)return 1/0;let M=Qe(P,p),m=!1;if(M<T+jt){const{C:O}=Tn(P),L=Rr(T+jt,Math.max(O,o.chroma.a600),e,p,Ze(P)<Ze(p),Lt+jt);t.style.setProperty(g,pn(L.rgb)),M=Qe(L.rgb,p),m=!0}return c.push({label:C,fg:"--accent-fg",bg:g,ratio:M,floor:T,repaired:m}),M},x=w("--accent-solid","Primary button",Lt);w("--accent-solid-hover","Primary button, hovered",Math.min(x+.6,12));const k=[];for(const g of["--surface","--surface-raised","--surface-sunken","--accent-soft"]){const C=d[g];C&&k.push({name:g,c:C})}let R=1/0;const v=d["--accent-text"];if(v&&k.length){const g=k.reduce((T,P)=>Qe(v,T.c)<Qe(v,P.c)?T:P,k[0]);R=Qe(v,g.c);let C=!1;if(R<Lt+jt){const{C:T}=Tn(v),P=Rr(Lt+jt,T||u.C,e,g.c,Ze(v)<Ze(g.c));t.style.setProperty("--accent-text",pn(P.rgb)),R=k.reduce((M,m)=>Math.min(M,Qe(P.rgb,m.c)),1/0),C=!0}c.push({label:"Accent text",fg:"--accent-text",bg:g.name,ratio:R,floor:Lt,repaired:C})}const h={};if(!n.live)for(const g of["--accent-solid","--accent-solid-hover","--accent-text"]){const C=pt(t,g);C&&(h[g]=pn(C))}return{hue:e,mode:r,channels:{accent:pn(s.rgb),accent600:pn(i.rgb),accent700:pn(a.rgb)},applied:h,checks:c,ok:c.every(g=>g.ratio>=g.floor-.005)&&x>=Lt}}const E1=[{id:"foundation",label:"Foundation",blurb:"The neutral base. Warm ground, terracotta accent."},{id:"parchment",label:"Parchment",blurb:"Wine chrome, corner brackets, an old-style serif. A 90s RPG menu."},{id:"terminal",label:"Terminal",blurb:"Green phosphor and ANSI in the dark; greenbar and ribbon ink in the light."},{id:"scifi",label:"Sci-Fi",blurb:"Deep-space ground and luminous cyan. Hairlines, telemetry, glow."}],Bw=[{name:"Ember",hue:40},{name:"Amber",hue:75},{name:"Olive",hue:110},{name:"Forest",hue:148},{name:"Teal",hue:190},{name:"Sky",hue:235},{name:"Indigo",hue:268},{name:"Violet",hue:300},{name:"Magenta",hue:330},{name:"Rose",hue:12}],Ww=[{level:0,label:"None"},{level:1,label:"A little"},{level:2,label:"More"}];function C1(e=document.documentElement){const t=rp().accent;if(t&&t.toLowerCase()!==np.accent.toLowerCase())try{return Tn(Sr(t,{})).H}catch{}return w1(e)}const yd={theme:"foundation",hue:null,tint:0},wp="paddock:appearance",wd="paddock:appearance-cache";function j1(){try{const e=localStorage.getItem(wp);if(!e)return yd;const t=JSON.parse(e);return{theme:E1.some(n=>n.id===t.theme)?t.theme:"foundation",hue:typeof t.hue=="number"?(t.hue%360+360)%360:null,tint:t.tint===1||t.tint===2?t.tint:0}}catch{return yd}}function P1(e){try{localStorage.setItem(wp,JSON.stringify(e))}catch{}}function N1(e,t,n){try{const r=JSON.parse(localStorage.getItem(wd)||"{}"),o=`${e}:${t?"dark":"light"}`;n?r[o]={...n.applied,"--accent":n.channels.accent}:delete r[o],localStorage.setItem(wd,JSON.stringify(r))}catch{}}function T1(e,t=document.documentElement){t.setAttribute("data-theme",e.theme);const n=e.hue??C1(t);let r=null;e.tint===0?mp(t):r=y1(n,L1[e.tint],t);const o=k1(n,t);return o&&r!==null&&(o.checks.push({label:"Body text on the tinted ground",fg:"--text-*",bg:"--surface-*",ratio:r,floor:4.5,repaired:!1}),o.ok=o.ok&&r>=4.5),N1(e.theme,t.classList.contains("dark"),o),o}function R1(e,t){P1(e);const n=T1(e,t);return window.dispatchEvent(new CustomEvent(_1,{detail:n})),n}const _1="paddock:appearance";function M1(){const e=()=>R1(j1());e();const t=new MutationObserver(n=>{n.some(r=>r.attributeName==="class")&&e()});return t.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),()=>t.disconnect()}const L1=[0,.008,.018],xp=E.lazy(()=>Kt(()=>import("./ProjectsGrid-CUFNVTif.js"),__vite__mapDeps([0,1])).then(e=>({default:e.ProjectsGrid}))),Ne=E.lazy(()=>Kt(()=>import("./ProjectView-FUcyJMUf.js").then(e=>e.a),__vite__mapDeps([2,1,3,4,5,6])).then(e=>({default:e.ProjectView}))),I1=E.lazy(()=>Kt(()=>import("./ProjectRedirect-QuGeN-qx.js"),__vite__mapDeps([7,5])).then(e=>({default:e.ProjectRedirect}))),D1=E.lazy(()=>Kt(()=>import("./InstanceConfigPage-U78M95nW.js"),__vite__mapDeps([8,4])).then(e=>({default:e.InstanceConfigPage}))),O1=E.lazy(()=>Kt(()=>import("./DiscoverPage-BFo4FTzZ.js"),__vite__mapDeps([9,6,4])).then(e=>({default:e.DiscoverPage}))),$1=E.lazy(()=>Kt(()=>import("./RootHome-SIxo-xX9.js"),__vite__mapDeps([10,2,1,3,4,5,6])).then(e=>({default:e.RootHome})));M1();const Sp=()=>document.documentElement.setAttribute("data-tab-hidden",document.hidden?"true":"false");document.addEventListener("visibilitychange",Sp);Sp();function z1(){const{tag:e}=gy();return f.jsx(xp,{filterTag:e?decodeURIComponent(e):void 0})}const U1=$y([{path:"/",element:f.jsx(n1,{}),errorElement:f.jsx(c1,{}),children:[{index:!0,element:f.jsx($1,{})},{path:"projects",element:f.jsx(xp,{})},{path:"tags/:tag",element:f.jsx(z1,{})},{path:"projects/:slug",element:f.jsx(I1,{})},{path:"projects/:slug/home",element:f.jsx(Ne,{})},{path:"projects/:slug/chat",element:f.jsx(Ne,{})},{path:"projects/:slug/chat/:sessionId",element:f.jsx(Ne,{})},{path:"projects/:slug/files",element:f.jsx(Ne,{})},{path:"projects/:slug/files/*",element:f.jsx(Ne,{})},{path:"projects/:slug/changes",element:f.jsx(Ne,{})},{path:"projects/:slug/changes/:file",element:f.jsx(Ne,{})},{path:"projects/:slug/history",element:f.jsx(Ne,{})},{path:"projects/:slug/settings",element:f.jsx(Ne,{})},{path:"projects/:slug/triggers",element:f.jsx(Ne,{})},{path:"projects/:slug/hooks",element:f.jsx(Ne,{})},{path:"chat",element:f.jsx(Ne,{root:!0})},{path:"chat/:sessionId",element:f.jsx(Ne,{root:!0})},{path:"files",element:f.jsx(Ne,{root:!0})},{path:"files/*",element:f.jsx(Ne,{root:!0})},{path:"changes",element:f.jsx(Ne,{root:!0})},{path:"changes/:file",element:f.jsx(Ne,{root:!0})},{path:"history",element:f.jsx(Ne,{root:!0})},{path:"triggers",element:f.jsx(Ne,{root:!0})},{path:"settings",element:f.jsx(Ne,{root:!0})},{path:"config",element:f.jsx(D1,{})},{path:"discover",element:f.jsx(O1,{})}]}]);ca.createRoot(document.getElementById("root")).render(f.jsx(Ld.StrictMode,{children:f.jsx(n0,{children:f.jsx(Vy,{router:U1})})}));d1();export{kw as $,_1 as A,Lw as B,fw as C,xw as D,A0 as E,_w as F,Ao as G,F1 as H,b0 as I,F0 as J,Ow as K,Uo as L,B0 as M,K0 as N,zw as O,z0 as P,jw as Q,cu as R,Sw as S,v0 as T,Nw as U,Pw as V,A1 as W,sp as X,vw as Y,gw as Z,Tw as _,ji as a,H0 as a0,mw as a1,nw as a2,rw as a3,iw as a4,lw as a5,ow as a6,aw as a7,uw as a8,sw as a9,Aw as aA,J1 as aB,Y1 as aC,g0 as aD,m0 as aE,nr as aF,W1 as aG,V1 as aH,q0 as aI,B1 as aJ,Zy as aK,H1 as aL,Q1 as aM,X1 as aN,K1 as aO,Fw as aP,k0 as aa,hw as ab,x0 as ac,la as ad,ew as ae,Kt as af,ou as ag,cw as ah,e0 as ai,tw as aj,ww as ak,pu as al,dw as am,Dw as an,$w as ao,Rw as ap,hu as aq,du as ar,Ew as as,Z1 as at,pw as au,e1 as av,q1 as aw,Iw as ax,Uw as ay,Mw as az,fu as b,Cw as c,w0 as d,G1 as e,u0 as f,qy as g,yw as h,gy as i,f as j,b1 as k,Sd as l,j1 as m,bw as n,c0 as o,E1 as p,ap as q,E as r,R1 as s,Bw as t,tp as u,Ww as v,gp as w,k1 as x,yp as y,ss as z};
|
|
71
71
|
|