@edspencer/paddock 0.74.3 → 0.75.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/packages/server/dist/claude-mcp.js +23 -25
- package/packages/server/dist/mcp-servers.d.ts +5 -4
- package/packages/server/dist/mcp-servers.js +38 -40
- package/packages/server/package.json +1 -1
- package/packages/web/dist/assets/{DeleteProjectDialog-q-V59YiP.js → DeleteProjectDialog-BVjEiE8h.js} +1 -1
- package/packages/web/dist/assets/DiscoverPage-Pqr0B6n7.js +2 -0
- package/packages/web/dist/assets/{DiscoverView-CDqEPbLw.js → DiscoverView-BWfSBjLX.js} +1 -1
- package/packages/web/dist/assets/{InstanceConfigPage-CLu6YmDA.js → InstanceConfigPage-ClXUufoD.js} +1 -1
- package/packages/web/dist/assets/{MarkdownRenderer-D-7rJ2MA.js → MarkdownRenderer-A5ROjF2W.js} +1 -1
- package/packages/web/dist/assets/{ProjectRedirect-0rVEh-WX.js → ProjectRedirect-CNQm3371.js} +1 -1
- package/packages/web/dist/assets/ProjectView-BdzJ3aKK.js +13 -0
- package/packages/web/dist/assets/{ProjectsGrid-BjFdqjV3.js → ProjectsGrid-DR1fmWxh.js} +1 -1
- package/packages/web/dist/assets/{RootHome-DTZbSsti.js → RootHome-CTLglUiz.js} +1 -1
- package/packages/web/dist/assets/{Surfaces-ebMLXoSK.js → Surfaces-CF0yyXrm.js} +1 -1
- package/packages/web/dist/assets/{arc-CxgFwaSO.js → arc-DrUfzi6A.js} +1 -1
- package/packages/web/dist/assets/{architectureDiagram-3BPJPVTR-DQRs6fUO.js → architectureDiagram-3BPJPVTR-BYqov1Zc.js} +1 -1
- package/packages/web/dist/assets/{blockDiagram-GPEHLZMM-CKtBGIVx.js → blockDiagram-GPEHLZMM-DmMOVO_f.js} +1 -1
- package/packages/web/dist/assets/{c4Diagram-AAUBKEIU-CiHinbCH.js → c4Diagram-AAUBKEIU-Czfa53Zk.js} +1 -1
- package/packages/web/dist/assets/channel-CEHEe3UY.js +2 -0
- package/packages/web/dist/assets/{chunk-2J33WTMH-DROWEdGz.js → chunk-2J33WTMH-C0V1Q1vH.js} +1 -1
- package/packages/web/dist/assets/{chunk-4BX2VUAB-VWuPhDDm.js → chunk-4BX2VUAB-DnjnNYey.js} +1 -1
- package/packages/web/dist/assets/{chunk-55IACEB6-B3U9YNx_.js → chunk-55IACEB6-BcFZPZvh.js} +1 -1
- package/packages/web/dist/assets/{chunk-727SXJPM-CIX50fRQ.js → chunk-727SXJPM-D3f-Sjzp.js} +1 -1
- package/packages/web/dist/assets/{chunk-AQP2D5EJ-D0FIIi3O.js → chunk-AQP2D5EJ-DQHhDP9y.js} +1 -1
- package/packages/web/dist/assets/{chunk-FMBD7UC4-CPh-a6PK.js → chunk-FMBD7UC4-Dj5WjiyS.js} +1 -1
- package/packages/web/dist/assets/{chunk-ND2GUHAM-Dgvl3GVf.js → chunk-ND2GUHAM-Bl7cQ3SB.js} +1 -1
- package/packages/web/dist/assets/{chunk-QZHKN3VN--6FFIyTd.js → chunk-QZHKN3VN-C7SPUOKr.js} +1 -1
- package/packages/web/dist/assets/classDiagram-4FO5ZUOK-CeAhIB_Q.js +2 -0
- package/packages/web/dist/assets/classDiagram-v2-Q7XG4LA2-CeAhIB_Q.js +2 -0
- package/packages/web/dist/assets/{core-DmcZcbit.js → core-DD3lQR7a.js} +1 -1
- package/packages/web/dist/assets/{cose-bilkent-S5V4N54A-CrkuZMpE.js → cose-bilkent-S5V4N54A-DsUrPBsx.js} +1 -1
- package/packages/web/dist/assets/{dagre-BM42HDAG-DLViqa6a.js → dagre-BM42HDAG--oW-opUg.js} +1 -1
- package/packages/web/dist/assets/{diagram-2AECGRRQ-DDACz4xS.js → diagram-2AECGRRQ-PBABAEds.js} +1 -1
- package/packages/web/dist/assets/{diagram-5GNKFQAL-7M-qCrgM.js → diagram-5GNKFQAL-DHgapxzA.js} +1 -1
- package/packages/web/dist/assets/{diagram-KO2AKTUF-ORCh-W__.js → diagram-KO2AKTUF-BlAviCxX.js} +1 -1
- package/packages/web/dist/assets/{diagram-LMA3HP47-DB-BMVHo.js → diagram-LMA3HP47-CY6_XHw1.js} +1 -1
- package/packages/web/dist/assets/{diagram-OG6HWLK6-DvnaOyG_.js → diagram-OG6HWLK6-6kwM_03D.js} +1 -1
- package/packages/web/dist/assets/{erDiagram-TEJ5UH35-Bv0gzd7A.js → erDiagram-TEJ5UH35-bh-0n04U.js} +1 -1
- package/packages/web/dist/assets/{flowDiagram-I6XJVG4X-ClGD26se.js → flowDiagram-I6XJVG4X-BVkoiXeP.js} +1 -1
- package/packages/web/dist/assets/{ganttDiagram-6RSMTGT7-DVYtc_Dd.js → ganttDiagram-6RSMTGT7-DnfAgVxK.js} +1 -1
- package/packages/web/dist/assets/{gitGraphDiagram-PVQCEYII-Bf6vf5_U.js → gitGraphDiagram-PVQCEYII-BLyvLMXz.js} +1 -1
- package/packages/web/dist/assets/{index-DKbCTgvS.js → index-CQsrBw44.js} +2 -2
- package/packages/web/dist/assets/index-LM9Ga0Wn.css +1 -0
- package/packages/web/dist/assets/{infoDiagram-5YYISTIA-BsUWhgeg.js → infoDiagram-5YYISTIA-D6B9ugJD.js} +1 -1
- package/packages/web/dist/assets/{ishikawaDiagram-YF4QCWOH-CQGtjMds.js → ishikawaDiagram-YF4QCWOH-CZ7CzKek.js} +1 -1
- package/packages/web/dist/assets/{journeyDiagram-JHISSGLW-B58R6W2A.js → journeyDiagram-JHISSGLW-C7XkLc9i.js} +1 -1
- package/packages/web/dist/assets/{kanban-definition-UN3LZRKU-J6QoqrIV.js → kanban-definition-UN3LZRKU-B1IONnOY.js} +1 -1
- package/packages/web/dist/assets/{linear-D82_ZH34.js → linear-Evefwzlv.js} +1 -1
- package/packages/web/dist/assets/{mermaid.core-DAaQ0A8U.js → mermaid.core-DFz_RqY2.js} +4 -4
- package/packages/web/dist/assets/{mindmap-definition-RKZ34NQL-BoF58K9i.js → mindmap-definition-RKZ34NQL-DCHEHB1t.js} +1 -1
- package/packages/web/dist/assets/{pieDiagram-4H26LBE5-DQlDoISX.js → pieDiagram-4H26LBE5-CAgAPCtd.js} +1 -1
- package/packages/web/dist/assets/{quadrantDiagram-W4KKPZXB-wpX7tARX.js → quadrantDiagram-W4KKPZXB-Qx0hVImF.js} +1 -1
- package/packages/web/dist/assets/{requirementDiagram-4Y6WPE33-CsHb872v.js → requirementDiagram-4Y6WPE33-Cag9Mvg9.js} +1 -1
- package/packages/web/dist/assets/{sankeyDiagram-5OEKKPKP-Kd81146T.js → sankeyDiagram-5OEKKPKP-DCdGTeQa.js} +1 -1
- package/packages/web/dist/assets/{sequenceDiagram-3UESZ5HK-BPVBxFck.js → sequenceDiagram-3UESZ5HK-Dwpsy94j.js} +1 -1
- package/packages/web/dist/assets/{stateDiagram-AJRCARHV-B3BWA7Zr.js → stateDiagram-AJRCARHV-aGMHRRAE.js} +1 -1
- package/packages/web/dist/assets/stateDiagram-v2-BHNVJYJU-DhdrFtkn.js +2 -0
- package/packages/web/dist/assets/{timeline-definition-PNZ67QCA-CPV-ctE2.js → timeline-definition-PNZ67QCA-BzPnsQmY.js} +1 -1
- package/packages/web/dist/assets/{vennDiagram-CIIHVFJN-aHIEBP1W.js → vennDiagram-CIIHVFJN-CZ1fY8y7.js} +1 -1
- package/packages/web/dist/assets/{wardley-L42UT6IY-KTdxdz1j.js → wardley-L42UT6IY-C41nLzIr.js} +1 -1
- package/packages/web/dist/assets/{wardleyDiagram-YWT4CUSO-CYVKS1aU.js → wardleyDiagram-YWT4CUSO-CoUrc0lU.js} +1 -1
- package/packages/web/dist/assets/{xychartDiagram-2RQKCTM6-znmQf9g2.js → xychartDiagram-2RQKCTM6-DCOTYBX6.js} +1 -1
- package/packages/web/dist/index.html +2 -2
- package/packages/web/dist/sw.js +1 -1
- package/packages/web/dist/assets/DiscoverPage-Ytc7flhQ.js +0 -2
- package/packages/web/dist/assets/ProjectView-C1ezKZtq.js +0 -13
- package/packages/web/dist/assets/channel-Brnda8TU.js +0 -2
- package/packages/web/dist/assets/classDiagram-4FO5ZUOK-B5WekHqh.js +0 -2
- package/packages/web/dist/assets/classDiagram-v2-Q7XG4LA2-B5WekHqh.js +0 -2
- package/packages/web/dist/assets/index-ClOpntF7.css +0 -1
- package/packages/web/dist/assets/stateDiagram-v2-BHNVJYJU-moMhbA1I.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-DR1fmWxh.js","assets/DeleteProjectDialog-BVjEiE8h.js","assets/lastTab-CU1zsF0j.js","assets/ProjectView-BdzJ3aKK.js","assets/queued-CagZVfWU.js","assets/Surfaces-CF0yyXrm.js","assets/DiscoverView-BWfSBjLX.js","assets/ProjectRedirect-CNQm3371.js","assets/InstanceConfigPage-ClXUufoD.js","assets/DiscoverPage-Pqr0B6n7.js","assets/RootHome-CTLglUiz.js"])))=>i.map(i=>d[i]);
|
|
2
2
|
function Fd(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const s in r)if(s!=="default"&&!(s in e)){const o=Object.getOwnPropertyDescriptor(r,s);o&&Object.defineProperty(e,s,o.get?o:{enumerable:!0,get:()=>r[s]})}}}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 s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const o of s)if(o.type==="childList")for(const i of o.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&r(i)}).observe(document,{childList:!0,subtree:!0});function n(s){const o={};return s.integrity&&(o.integrity=s.integrity),s.referrerPolicy&&(o.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?o.credentials="include":s.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(s){if(s.ep)return;s.ep=!0;const o=n(s);fetch(s.href,o)}})();const pm="modulepreload",mm=function(e){return"/"+e},Ku={},Xt=function(t,n,r){let s=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"));s=Promise.allSettled(n.map(u=>{if(u=mm(u),u in Ku)return;Ku[u]=!0;const c=u.endsWith(".css"),d=c?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${u}"]${d}`))return;const f=document.createElement("link");if(f.rel=c?"stylesheet":pm,c||(f.as="script"),f.crossOrigin="",f.href=u,a&&f.setAttribute("nonce",a),document.head.appendChild(f),c)return new Promise((p,y)=>{f.addEventListener("load",p),f.addEventListener("error",()=>y(new Error(`Unable to preload CSS for ${u}`)))})}))}function o(i){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=i,window.dispatchEvent(a),!a.defaultPrevented)throw i}return s.then(i=>{for(const a of i||[])a.status==="rejected"&&o(a.reason);return t().catch(o)})};var iw=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ud(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Bd={exports:{}},pi={},Wd={exports:{}},ee={};/**
|
|
3
3
|
* @license React
|
|
4
4
|
* react.production.min.js
|
|
@@ -67,5 +67,5 @@ Error generating stack: `+o.message+`
|
|
|
67
67
|
* LICENSE.md file in the root directory of this source tree.
|
|
68
68
|
*
|
|
69
69
|
* @license MIT
|
|
70
|
-
*/function Vr(){return Vr=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},Vr.apply(this,arguments)}function yp(e,t){if(e==null)return{};var n={},r=Object.keys(e),s,o;for(o=0;o<r.length;o++)s=r[o],!(t.indexOf(s)>=0)&&(n[s]=e[s]);return n}function a0(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function l0(e,t){return e.button===0&&(!t||t==="_self")&&!a0(e)}const u0=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","unstable_viewTransition"],c0=["aria-current","caseSensitive","className","end","style","to","unstable_viewTransition","children"],d0="6";try{window.__reactRouterVersion=d0}catch{}function f0(e,t){return wy({basename:void 0,future:Vr({},void 0,{v7_prependBasename:!0}),history:Vv({window:void 0}),hydrationData:h0(),routes:e,mapRouteProperties:i0,unstable_dataStrategy:void 0,unstable_patchRoutesOnNavigation:void 0,window:void 0}).initialize()}function h0(){var e;let t=(e=window)==null?void 0:e.__staticRouterHydrationData;return t&&t.errors&&(t=Vr({},t,{errors:p0(t.errors)})),t}function p0(e){if(!e)return null;let t=Object.entries(e),n={};for(let[r,s]of t)if(s&&s.__type==="RouteErrorResponse")n[r]=new di(s.status,s.statusText,s.data,s.internal===!0);else if(s&&s.__type==="Error"){if(s.__subType){let o=window[s.__subType];if(typeof o=="function")try{let i=new o(s.message);i.stack="",n[r]=i}catch{}}if(n[r]==null){let o=new Error(s.message);o.stack="",n[r]=o}}else n[r]=s;return n}const xp=w.createContext({isTransitioning:!1}),m0=w.createContext(new Map),g0="startTransition",yd=_m[g0],v0="flushSync",xd=Wv[v0];function y0(e){yd?yd(e):e()}function ls(e){xd?xd(e):e()}class x0{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 w0(e){let{fallbackElement:t,router:n,future:r}=e,[s,o]=w.useState(n.state),[i,a]=w.useState(),[u,c]=w.useState({isTransitioning:!1}),[d,f]=w.useState(),[p,y]=w.useState(),[k,S]=w.useState(),C=w.useRef(new Map),{v7_startTransition:g}=r||{},h=w.useCallback(v=>{g?y0(v):v()},[g]),m=w.useCallback((v,D)=>{let{deletedFetchers:L,unstable_flushSync:H,unstable_viewTransitionOpts:se}=D;L.forEach(de=>C.current.delete(de)),v.fetchers.forEach((de,ot)=>{de.data!==void 0&&C.current.set(ot,de.data)});let ge=n.window==null||n.window.document==null||typeof n.window.document.startViewTransition!="function";if(!se||ge){H?ls(()=>o(v)):h(()=>o(v));return}if(H){ls(()=>{p&&(d&&d.resolve(),p.skipTransition()),c({isTransitioning:!0,flushSync:!0,currentLocation:se.currentLocation,nextLocation:se.nextLocation})});let de=n.window.document.startViewTransition(()=>{ls(()=>o(v))});de.finished.finally(()=>{ls(()=>{f(void 0),y(void 0),a(void 0),c({isTransitioning:!1})})}),ls(()=>y(de));return}p?(d&&d.resolve(),p.skipTransition(),S({state:v,currentLocation:se.currentLocation,nextLocation:se.nextLocation})):(a(v),c({isTransitioning:!0,flushSync:!1,currentLocation:se.currentLocation,nextLocation:se.nextLocation}))},[n.window,p,d,C,h]);w.useLayoutEffect(()=>n.subscribe(m),[n,m]),w.useEffect(()=>{u.isTransitioning&&!u.flushSync&&f(new x0)},[u]),w.useEffect(()=>{if(d&&i&&n.window){let v=i,D=d.promise,L=n.window.document.startViewTransition(async()=>{h(()=>o(v)),await D});L.finished.finally(()=>{f(void 0),y(void 0),a(void 0),c({isTransitioning:!1})}),y(L)}},[h,i,d,n.window]),w.useEffect(()=>{d&&i&&s.location.key===i.location.key&&d.resolve()},[d,p,s.location,i]),w.useEffect(()=>{!u.isTransitioning&&k&&(a(k.state),c({isTransitioning:!0,flushSync:!1,currentLocation:k.currentLocation,nextLocation:k.nextLocation}),S(void 0))},[u.isTransitioning,k]),w.useEffect(()=>{},[]);let E=w.useMemo(()=>({createHref:n.createHref,encodeLocation:n.encodeLocation,go:v=>n.navigate(v),push:(v,D,L)=>n.navigate(v,{state:D,preventScrollReset:L==null?void 0:L.preventScrollReset}),replace:(v,D,L)=>n.navigate(v,{replace:!0,state:D,preventScrollReset:L==null?void 0:L.preventScrollReset})}),[n]),R=n.basename||"/",P=w.useMemo(()=>({router:n,navigator:E,static:!1,basename:R}),[n,E,R]),_=w.useMemo(()=>({v7_relativeSplatPath:n.future.v7_relativeSplatPath}),[n.future.v7_relativeSplatPath]);return w.createElement(w.Fragment,null,w.createElement(Xs.Provider,{value:P},w.createElement(Su.Provider,{value:s},w.createElement(m0.Provider,{value:C.current},w.createElement(xp.Provider,{value:u},w.createElement(o0,{basename:R,location:s.location,navigationType:s.historyAction,navigator:E,future:_},s.initialized||n.future.v7_partialHydration?w.createElement(S0,{routes:n.routes,future:n.future,state:s}):t))))),null)}const S0=w.memo(k0);function k0(e){let{routes:t,future:n,state:r}=e;return Ky(t,void 0,r,n)}const j0=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",E0=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Vs=w.forwardRef(function(t,n){let{onClick:r,relative:s,reloadDocument:o,replace:i,state:a,target:u,to:c,preventScrollReset:d,unstable_viewTransition:f}=t,p=yp(t,u0),{basename:y}=w.useContext(ln),k,S=!1;if(typeof c=="string"&&E0.test(c)&&(k=c,j0))try{let m=new URL(window.location.href),E=c.startsWith("//")?new URL(m.protocol+c):new URL(c),R=on(E.pathname,y);E.origin===m.origin&&R!=null?c=R+E.search+E.hash:S=!0}catch{}let C=Wy(c,{relative:s}),g=C0(c,{replace:i,state:a,target:u,preventScrollReset:d,relative:s,unstable_viewTransition:f});function h(m){r&&r(m),m.defaultPrevented||g(m)}return w.createElement("a",Vr({},p,{href:k||C,onClick:S||o?r:h,ref:n,target:u}))}),gn=w.forwardRef(function(t,n){let{"aria-current":r="page",caseSensitive:s=!1,className:o="",end:i=!1,style:a,to:u,unstable_viewTransition:c,children:d}=t,f=yp(t,c0),p=Ii(u,{relative:f.relative}),y=lr(),k=w.useContext(Su),{navigator:S,basename:C}=w.useContext(ln),g=k!=null&&P0(p)&&c===!0,h=S.encodeLocation?S.encodeLocation(p).pathname:p.pathname,m=y.pathname,E=k&&k.navigation&&k.navigation.location?k.navigation.location.pathname:null;s||(m=m.toLowerCase(),E=E?E.toLowerCase():null,h=h.toLowerCase()),E&&C&&(E=on(E,C)||E);const R=h!=="/"&&h.endsWith("/")?h.length-1:h.length;let P=m===h||!i&&m.startsWith(h)&&m.charAt(R)==="/",_=E!=null&&(E===h||!i&&E.startsWith(h)&&E.charAt(h.length)==="/"),v={isActive:P,isPending:_,isTransitioning:g},D=P?r:void 0,L;typeof o=="function"?L=o(v):L=[o,P?"active":null,_?"pending":null,g?"transitioning":null].filter(Boolean).join(" ");let H=typeof a=="function"?a(v):a;return w.createElement(Vs,Vr({},f,{"aria-current":D,className:L,ref:n,style:H,to:u,unstable_viewTransition:c}),typeof d=="function"?d(v):d)});var vl;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(vl||(vl={}));var wd;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(wd||(wd={}));function N0(e){let t=w.useContext(Xs);return t||Z(!1),t}function C0(e,t){let{target:n,replace:r,state:s,preventScrollReset:o,relative:i,unstable_viewTransition:a}=t===void 0?{}:t,u=Zs(),c=lr(),d=Ii(e,{relative:i});return w.useCallback(f=>{if(l0(f,n)){f.preventDefault();let p=r!==void 0?r:sr(c)===sr(d);u(e,{replace:p,state:s,preventScrollReset:o,relative:i,unstable_viewTransition:a})}},[c,u,d,r,s,n,e,o,i,a])}function P0(e,t){t===void 0&&(t={});let n=w.useContext(xp);n==null&&Z(!1);let{basename:r}=N0(vl.useViewTransitionState),s=Ii(e,{relative:t.relative});if(!n.isTransitioning)return!1;let o=on(n.currentLocation.pathname,r)||n.currentLocation.pathname,i=on(n.nextLocation.pathname,r)||n.nextLocation.pathname;return ci(s.pathname,i)!=null||ci(s.pathname,o)!=null}const ju="";function Eu(e){return e===ju}function Q(e){return Eu(e)?"/api/root":`/api/projects/${encodeURIComponent(e)}`}function T0(e){return Eu(e)?"":`/projects/${e}`}function uw(e){return e===""?"/":`${e}/home`}function R0(){return"/projects"}function cw(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 dw(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(s=>{try{return decodeURIComponent(s)}catch{return s}}).join("/"):""}function M0(e){return`m-${e}`}function fw(e,t,n){return`${e}/chat/${encodeURIComponent(t)}#${M0(n)}`}function hw(e){var t;return(t=/^#?m-([0-9a-fA-F][0-9a-fA-F-]{7,})$/.exec(e))==null?void 0:t[1]}const Qn="";async function U(e,t){const n=await fetch(`${Qn}${e}`,{headers:{"content-type":"application/json",...(t==null?void 0:t.headers)??{}},...t});if(!n.ok){let r=n.statusText,s,o;try{o=await n.json();const i=o;i.error&&(r=i.error),typeof i.code=="string"&&(s=i.code)}catch{}throw new On(r,n.status,s,o)}return await n.json()}async function _0(e,t){const n=await fetch(`${Qn}${e}`,t);if(!n.ok){let r=n.statusText;try{const s=JSON.parse(await n.text());s.error&&(r=s.error)}catch{}throw new On(r,n.status)}return n.text()}class On extends Error{constructor(t,n,r,s){super(t),this.status=n,this.code=r,this.body=s,this.name="ApiError"}}const Sd={transcriptRenderLimit:500};let kd=null;const or={async me(){return U("/api/me")},async markChatSeen(e,t,n,r){const s=`${Q(e)}/chats/${encodeURIComponent(t)}/seen`;await U(s,{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 U(r,{method:"POST",body:JSON.stringify({unread:n})})},async projectRuns(e,t){const n=t!==void 0?`?limit=${encodeURIComponent(t)}`:"";return U(`${Q(e)}/runs${n}`)},async markRunsSeen(e,t){await U(`${Q(e)}/runs/seen`,{method:"POST",body:JSON.stringify(t!==void 0?{when:t}:{})})},async getModels(){return U("/api/models")},async getInstanceConfig(){return U("/api/instance-config")},async updateInstanceConfig(e,t){return U("/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 o of n)r.append("files",o,o.name);const s=await fetch(`${Qn}${Q(e)}/chats/${encodeURIComponent(t)}/upload`,{method:"POST",body:r});if(!s.ok){let o=s.statusText;try{const i=await s.json();i.error&&(o=i.error)}catch{}throw new On(o,s.status)}return await s.json()},async projectCommands(e){const{commands:t}=await U(`${Q(e)}/commands`);return t},async listProjects(){const{projects:e,root:t}=await U("/api/projects");return{projects:e,root:t??null}},async getProjectDetail(e){return U(`${Q(e)}`)},async attentionChats(e){const t=await U(`${Q(e)}/chats/attention`);return{running:t.running??[],unread:t.unread??[]}},async createProject(e){const{project:t}=await U("/api/projects",{method:"POST",body:JSON.stringify(e)});return t},async updateProject(e,t){const{project:n}=await U(`${Q(e)}`,{method:"PATCH",body:JSON.stringify(t)});return n},async promoteProject(e,t){const{project:n}=await U(`${Q(e)}/promote`,{method:"POST",body:JSON.stringify({repo:t})});return n},async deleteProject(e){await U(`${Q(e)}`,{method:"DELETE"})},async deleteProjectChat(e,t){await U(`${Q(e)}/chats/${encodeURIComponent(t)}`,{method:"DELETE"})},async renameProjectChat(e,t,n){await U(`${Q(e)}/chats/${encodeURIComponent(t)}`,{method:"PATCH",body:JSON.stringify({name:n})})},async archiveProjectChat(e,t,n){await U(`${Q(e)}/chats/${encodeURIComponent(t)}/archive`,{method:"POST",body:JSON.stringify({archived:n})})},async starProjectChat(e,t,n){await U(`${Q(e)}/chats/${encodeURIComponent(t)}/star`,{method:"POST",body:JSON.stringify({starred:n})})},async archiveProjectChats(e,t,n){await U(`${Q(e)}/chats/batch/archive`,{method:"POST",body:JSON.stringify({sessionIds:t,archived:n})})},async markChatsUnread(e,t,n){await U(`${Q(e)}/chats/batch/unread`,{method:"POST",body:JSON.stringify({sessionIds:t,unread:n})})},async deleteProjectChats(e,t){const n=await U(`${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 U(`${Q(e)}/chats/${encodeURIComponent(t)}/detach`,{method:"POST",body:JSON.stringify({detached:n})})},async promoteChat(e,t,n){return U(`${Q(e)}/chats/${encodeURIComponent(t)}/promote`,{method:"POST",body:JSON.stringify(n)})},async forkChat(e,t,n,r){const{sessionId:s}=await U(`${Q(e)}/chats/${encodeURIComponent(t)}/fork`,{method:"POST",body:JSON.stringify({name:n,fromUuid:r})});return s},async revertChat(e,t,n){const{removed:r}=await U(`${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 U(`${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 U(`${Q(e)}/files/${encodeURIComponent(t)}`)},projectFileRawUrl(e,t){return`${Qn}${Q(e)}/files/${encodeURIComponent(t)}?raw=1`},chatFileRawUrl(e){return`${Qn}/api/chat-files/${encodeURIComponent(e)}`},async pinFile(e,t){const{project:n}=await U(`${Q(e)}/pins`,{method:"PUT",body:JSON.stringify({file:t})});return n},async unpinFile(e,t){const{project:n}=await U(`${Q(e)}/pins/${encodeURIComponent(t)}`,{method:"DELETE"});return n},async listProjectChats(e){const{chats:t}=await U(`${Q(e)}/chats`);return t},async getAdoptableChats(e){return U(`${Q(e)}/adoptable-chats`)},async adoptChats(e,t){return U(`${Q(e)}/adopt-chats`,{method:"POST",body:JSON.stringify(t??{})})},async unadoptChats(e,t){return U(`${Q(e)}/unadopt-chats`,{method:"POST",body:JSON.stringify(t??{})})},async chatUsage(e,t){const n=t?`?scope=${t}`:"",{usage:r}=await U(`${Q(e)}/chats/usage${n}`);return r},uiConfig(){return kd??(kd=or.getModels().then(e=>e.uiDefault??Sd).catch(()=>Sd)),kd},async projectChatMessages(e,t,n=0){const r=n>0?`?limit=${n}`:"",s=await U(`${Q(e)}/chats/${encodeURIComponent(t)}/messages${r}`);return{messages:s.messages,total:s.total??s.messages.length,truncated:s.truncated??!1}},async subagentMessages(e,t,n){const r=`${Q(e)}/chats/${encodeURIComponent(t)}`,{messages:s}=await U(`${r}/subagents/${encodeURIComponent(n)}/messages`);return s},async chatContext(e,t){const n=`${Q(e)}/chats/${encodeURIComponent(t)}/context`,{usage:r}=await U(n);return r},async listTriggers(e){return U(`${Q(e)}/triggers`)},async putTrigger(e,t,n){const{trigger:r}=await U(`${Q(e)}/triggers/${encodeURIComponent(t)}`,{method:"PUT",body:JSON.stringify(n)});return r},async deleteTrigger(e,t){await U(`${Q(e)}/triggers/${encodeURIComponent(t)}`,{method:"DELETE"})},async triggerRuntime(e){return U(`${Q(e)}/triggers/runtime`)},async runTrigger(e,t){const{sessionId:n}=await U(`${Q(e)}/triggers/${encodeURIComponent(t)}/run`,{method:"POST",body:"{}"});return n},async gitInfo(){return U("/api/git")},async gitStatus(e){return U(`${Q(e)}/git/status`)},async gitDiff(e,t){const n=t?`?file=${encodeURIComponent(t)}`:"";return _0(`${Q(e)}/git/diff${n}`)},async gitCommit(e,t,n){return U(`${Q(e)}/git/commit`,{method:"POST",body:JSON.stringify(n?{message:t,files:n}:{message:t})})},async gitProjectInfo(e){return U(`${Q(e)}/git/remote`)},async gitPush(e){return U(`${Q(e)}/git/push`,{method:"POST"})},async gitUntrackedFile(e,t){return U(`${Q(e)}/git/file?path=${encodeURIComponent(t)}`)},gitUntrackedFileRawUrl(e,t){return`${Qn}${Q(e)}/git/file?path=${encodeURIComponent(t)}&raw=1`},async githubConnect(){return U("/api/git/github/connect",{method:"POST"})},async githubPoll(e){return U("/api/git/github/poll",{method:"POST",body:JSON.stringify({deviceCode:e})})},async githubDisconnect(){await U("/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 U(`/api/discover${n?`?${n}`:""}`)},async discoverSessions(e){return U(`/api/discover/sessions?dir=${encodeURIComponent(e)}`)},async transcriptionStatus(){return U("/api/transcription")},async transcribe(e,t="dictation.webm",n){const r=new FormData;r.append("file",e,t);const s=await fetch(`${Qn}/api/transcribe`,{method:"POST",body:r,signal:n});if(!s.ok){let i=s.statusText;try{const a=await s.json();a.error&&(i=a.error)}catch{}throw new On(i,s.status)}const{text:o}=await s.json();return o},async transcriptsMigration(){return U("/api/transcripts/migration")},async transcriptsMigrationChats(e){const t=e===void 0?"":`?slug=${encodeURIComponent(e)}`;return U(`/api/transcripts/migration/chats${t}`)},async runTranscriptsMigration(e){return U("/api/transcripts/migration",{method:"POST",body:JSON.stringify(e)})}},wp=w.createContext(null);function L0({children:e}){const[t,n]=w.useState([]),[r,s]=w.useState(null),[o,i]=w.useState(!0),[a,u]=w.useState(null),c=w.useRef(!1),d=w.useCallback(async()=>{c.current||i(!0),u(null);try{const{projects:k,root:S}=await or.listProjects();c.current=!0,n(k),S&&s(S)}catch(k){u(k instanceof Error?k.message:"Failed to load projects")}finally{i(!1)}},[]),f=w.useCallback(k=>{if(Eu(k.slug)){s(k);return}n(S=>[k,...S.filter(C=>C.slug!==k.slug)])},[]),p=w.useCallback(k=>{n(S=>S.filter(C=>C.slug!==k))},[]);w.useEffect(()=>{d()},[d]);const y=w.useMemo(()=>({projects:t,rootWorkspace:r,loading:o,error:a,refresh:d,upsert:f,remove:p}),[t,r,o,a,d,f,p]);return l.jsx(wp.Provider,{value:y,children:e})}function Sp(){const e=w.useContext(wp);if(!e)throw new Error("useProjects must be used within ProjectsProvider");return e}const b0="paddock:theme";function I0(){return typeof document<"u"&&document.documentElement.classList.contains("dark")}function D0(){const[e,t]=w.useState(I0),n=w.useCallback(()=>{t(r=>{const s=!r;document.documentElement.classList.toggle("dark",s);try{localStorage.setItem(b0,s?"dark":"light")}catch{}return s})},[]);return{dark:e,toggle:n}}const kp={name:"Paddock",logo:"🐎",accent:"#c2603c"},O0={enabled:!1,path:"/open-api"};function jp(){const e=globalThis.__PADDOCK_CONFIG__;return{...kp,...(e==null?void 0:e.brand)??{}}}function $0(){const e=globalThis.__PADDOCK_CONFIG__;return{...O0,...(e==null?void 0:e.openapi)??{}}}function z0(e){return/^(https?:\/\/|\/)/i.test(e.trim())}const Nu=[{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."}],jd="",Ep=new Map(Nu.map(e=>[e.slug,e]));function A0(e){if(!e)return"Unsorted";const t=Ep.get(e);return t?t.label:e.split("-").map(n=>n.charAt(0).toUpperCase()+n.slice(1)).join(" ")}function pw(e){var t;return(t=Ep.get(e))==null?void 0:t.blurb}function F0(e){const t=new Set(e),n=[];for(const s of Nu)t.has(s.slug)&&(n.push(s.slug),t.delete(s.slug));const r=t.delete(jd);return n.push(...[...t].sort()),r&&n.push(jd),n}const Np=25e3,Cp=1e4,U0=Np+Cp+5e3,B0=500,W0=1e4;class V0{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=(s,o)=>{s===t&&n(o)};return this.backgroundListeners.add(r),n(this.backgroundWork(t)),this.connect(),()=>this.backgroundListeners.delete(r)}setActive(t,n,r,s){const o=this.activeSessions.has(t);if(n?(this.activeSessions.set(t,r),s!=null&&!this.activeStartedAt.has(t)&&this.activeStartedAt.set(t,s)):(this.activeSessions.delete(t),this.activeStartedAt.delete(t)),this.activeSessions.has(t)!==o){const i=new Set(this.activeSessions.keys());for(const u of this.activeListeners)u(i);const a=new Map(this.activeSessions);for(const u of this.activeInfoListeners)u(a)}}subscribe(t,n,r){const s=Symbol("chat-sub"),o={projectSlug:t,sessionId:n,handlers:r,lastSeq:-1,turnActive:!1};return this.subs.set(s,o),this.connect(),n&&this.attachSession(o,!1),{setSessionId:i=>{const a=this.subs.get(s);a&&(a.sessionId=i,i&&this.attachSession(a,!1))},unsubscribe:()=>{this.subs.delete(s)}}}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,s){const o={projectSlug:t,sessionId:r,message:n};s!=null&&s.preloadContext&&(o.preloadContext=!0),s!=null&&s.model&&(o.model=s.model),s!=null&&s.attachments&&s.attachments.length>0&&(o.attachments=s.attachments),this.markTurnStart(t,r),this.transmit(JSON.stringify({type:"chat:send",payload:o}))}setQueued(t,n,r,s,o){const i={projectSlug:t,sessionId:n,text:r,qid:s};o&&o.length>0&&(i.attachments=o.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=(s,o)=>{s===t&&n(o)};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<U0}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(),Np)}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())},Cp)}}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(W0,B0*2**this.reconnectAttempts);this.reconnectAttempts+=1,this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.connect()},t)}route(t,n){const r=[...this.subs.values()].filter(o=>o.projectSlug===t);if(r.length===0)return;if(n){const o=r.find(i=>i.sessionId===n);if(o)return o;if(this.knownSessions.has(n))return}const s=r.find(o=>o.sessionId===null);if(s)return s;if(n===null&&r.length===1)return r[0]}dispatch(t){var c,d,f,p,y,k,S,C,g,h,m,E,R,P,_,v,D,L,H,se,ge,de,ot,Xe,St,I,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:O,taskId:Y,outcome:oe,message:J}=n.payload;if(O&&Y&&oe)for(const Ee of this.stopTaskListeners)Ee(O,{taskId:Y,outcome:oe,message:J});return}const r=n.payload.projectSlug;if(r==null)return;if(n.type==="chat:error"){const O=this.route(r,null);(d=O==null?void 0:(c=O.handlers).onError)==null||d.call(c,n.payload.error);return}if(n.type==="chat:resync"){const O=this.route(r,n.payload.sessionId);(p=O==null?void 0:(f=O.handlers).onResync)==null||p.call(f);return}if(n.type==="chat:background"){const{sessionId:O,tasks:Y}=n.payload;if(O){const oe=Array.isArray(Y)?Y:[];oe.length===0?this.backgroundTasks.delete(O):this.backgroundTasks.set(O,oe);for(const J of this.backgroundListeners)J(O,oe)}return}if(n.type==="chat:active"){this.setActive(n.payload.sessionId,n.payload.running,r,n.payload.startedAt);for(const O of this.subs.values())O.projectSlug===r&&O.sessionId===n.payload.sessionId&&((k=(y=O.handlers).onActive)==null||k.call(y,{running:n.payload.running,turnRunning:n.payload.turnRunning??n.payload.running,jobId:n.payload.jobId}));return}if(n.type==="chat:queued_flushed"){const{sessionId:O,text:Y,attachments:oe}=n.payload;if(O){Xt(async()=>{const{writeQueued:J,writeQueuedId:Ee,writeQueuedAttachments:ie}=await import("./queued-CagZVfWU.js");return{writeQueued:J,writeQueuedId:Ee,writeQueuedAttachments:ie}},[]).then(({writeQueued:J,writeQueuedId:Ee,writeQueuedAttachments:ie})=>{J(O,r,null),Ee(O,r,null),ie(O,r,[])});for(const J of this.subs.values())J.projectSlug===r&&J.sessionId===O&&((C=(S=J.handlers).onQueuedFlushed)==null||C.call(S,{text:Y,attachments:oe}))}return}if(n.type==="chat:queued_state"){const{sessionId:O,text:Y,qid:oe,reason:J,attachments:Ee}=n.payload;if(O){const ie=Y&&Y.length>0?Y:null,Ae=Ee??[],Ft=ie!==null||Ae.length>0;Xt(async()=>{const{writeQueued:Ut,writeQueuedId:un,writeQueuedAttachments:Yr}=await import("./queued-CagZVfWU.js");return{writeQueued:Ut,writeQueuedId:un,writeQueuedAttachments:Yr}},[]).then(({writeQueued:Ut,writeQueuedId:un,writeQueuedAttachments:Yr})=>{Ut(O,r,ie),un(O,r,Ft?oe??null:null),Yr(O,r,Ae)});for(const Ut of this.subs.values())Ut.projectSlug===r&&Ut.sessionId===O&&((h=(g=Ut.handlers).onQueuedState)==null||h.call(g,{text:ie,attachments:Ae,qid:oe,reason:J}))}return}if(n.type==="chat:queued_returned"){const{sessionId:O,text:Y,attachments:oe}=n.payload;if(O&&typeof Y=="string"){Xt(async()=>{const{writeQueued:J,writeQueuedId:Ee,writeQueuedAttachments:ie}=await import("./queued-CagZVfWU.js");return{writeQueued:J,writeQueuedId:Ee,writeQueuedAttachments:ie}},[]).then(({writeQueued:J,writeQueuedId:Ee,writeQueuedAttachments:ie})=>{J(O,r,null),Ee(O,r,null),ie(O,r,[])});for(const J of this.subs.values())J.projectSlug===r&&J.sessionId===O&&((E=(m=J.handlers).onQueuedReturned)==null||E.call(m,{text:Y,attachments:oe}))}return}if(n.type==="chat:killed_task"){const{sessionId:O,summary:Y,timestamp:oe}=n.payload;if(O)for(const J of this.subs.values())J.projectSlug===r&&J.sessionId===O&&((P=(R=J.handlers).onKilledTask)==null||P.call(R,{summary:Y??"",timestamp:oe??""}));return}const{sessionId:s,jobId:o}=n.payload,i=this.route(r,s);if(!i)return;const a={sessionId:s,jobId:o},u=n.payload.seq;switch(typeof u=="number"&&u>i.lastSeq&&(i.lastSeq=u),i.turnActive=n.type!=="chat:complete",n.type){case"chat:response":(v=(_=i.handlers).onResponse)==null||v.call(_,n.payload.chunk,a);break;case"chat:tool_call":(L=(D=i.handlers).onToolCall)==null||L.call(D,{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":(se=(H=i.handlers).onToolStart)==null||se.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":(Xe=(ot=i.handlers).onInjected)==null||Xe.call(ot,{sender:n.payload.sender,content:n.payload.content,timestamp:n.payload.timestamp},a);break;case"chat:notice":(I=(St=i.handlers).onNotice)==null||I.call(St,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 Cu=new V0,en=new Map,yl="paddock:lastSeen-changed";function Pu(e){try{window.dispatchEvent(new CustomEvent(yl,{detail:{sessionId:e}}))}catch{}}function H0(e){return en.get(e)??0}function Q0(e,t){!t||!Number.isFinite(t)||t<=(en.get(e)??0)||(en.set(e,t),Pu(e))}function mw(e,t=Date.now()){const n=en.get(e)??0;return t<=n||(en.set(e,t),Pu(e)),n}function gw(e,t,n){en.get(e)===n&&(t?en.set(e,t):en.delete(e),Pu(e))}const xl="paddock:chats-gone";function vw(e){if(e.length!==0){for(const t of e)en.delete(t);try{window.dispatchEvent(new CustomEvent(xl,{detail:{sessionIds:e}}))}catch{}}}function K0({tag:e,className:t=""}){const n=Zs();return l.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 G0=/^\d{4}-\d{2}-\d{2}$/;function wl(e){if(!e)return"";if(G0.test(e)){const[u,c,d]=e.split("-").map(Number),f=new Date(u,c-1,d);if(Number.isNaN(f.getTime()))return e;const p=new Date,y=new Date(p.getFullYear(),p.getMonth(),p.getDate()),k=Math.round((y.getTime()-f.getTime())/864e5);return k<=0?"today":k===1?"yesterday":k<7?`${k}d ago`:k<35?`${Math.round(k/7)}w ago`:k<365?`${Math.round(k/30)}mo ago`:`${Math.round(k/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 s=Math.round(r/60);if(s<24)return`${s}h ago`;const o=Math.round(s/24);if(o<7)return`${o}d ago`;const i=Math.round(o/7);if(i<5)return`${i}w ago`;const a=Math.round(o/30);return a<12?`${a}mo ago`:`${Math.round(o/365)}y ago`}function yw(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 s=Math.round(r/60);if(s<24)return`in ${s}h`;const o=Math.round(s/24);if(o<7)return`in ${o}d`;const i=Math.round(o/7);if(i<5)return`in ${i}w`;const a=Math.round(o/30);return a<12?`in ${a}mo`:`in ${Math.round(o/365)}y`}function ga(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 Y0(e){return!Number.isFinite(e)||e<=0?"$0.00":e<.01?"<$0.01":`$${e.toFixed(2)}`}function xw(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 ww(e){const t=e.inputTokens+e.cacheReadTokens+e.cacheCreationTokens,n=`${ga(e.totalTokens)} tokens · ${ga(t)} in / ${ga(e.outputTokens)} out`;return e.costUsd==null?n:`${n} · ~${Y0(e.costUsd)} at API rates`}function Sw(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 J0="This session is being continued from a previous conversation";function kw(e){return e.trimStart().startsWith(J0)}function jw(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 Ew(e){return e.trimStart().startsWith("<local-command-caveat>")}function Nw(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 Cw(e){return/^\s*<local-command-stdout>[\s\S]*<\/local-command-stdout>\s*$/.test(e)}function Pw(e){return e.trimStart().startsWith("<task-notification>")}function Tw(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 Rw(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 Mw(e){return e==="killed"||e==="stopped"}function X0(e){const t=Math.max(0,Math.floor(e/1e3)),n=t%60,r=Math.floor(t/60)%60,s=Math.floor(t/3600),o=String(n).padStart(2,"0");return s>0?`${s}:${String(r).padStart(2,"0")}:${o}`:`${r}:${o}`}function Ed(e){if(typeof window>"u"||typeof window.matchMedia!="function")return null;try{return window.matchMedia(e)??null}catch{return null}}function Sl(e){const[t,n]=w.useState(()=>{var r;return((r=Ed(e))==null?void 0:r.matches)??!1});return w.useEffect(()=>{var o;const r=Ed(e);if(!r)return;const s=()=>n(!!r.matches);return s(),typeof r.addEventListener=="function"?(r.addEventListener("change",s),()=>r.removeEventListener("change",s)):((o=r.addListener)==null||o.call(r,s),()=>{var i;return(i=r.removeListener)==null?void 0:i.call(r,s)})},[e]),t}const kl="paddock:transcriptsMigration:dismissed";function Z0(){try{return localStorage.getItem(kl)==="1"}catch{return!1}}function Nd(e){try{e?localStorage.setItem(kl,"1"):localStorage.removeItem(kl)}catch{}}let ms=null;function q0(){if(!ms)try{ms=or.transcriptsMigration().catch(()=>null)}catch{ms=Promise.resolve(null)}return ms}function ex(){ms=null}function Pp(){const[e,t]=w.useState(null),[n,r]=w.useState(Z0);w.useEffect(()=>{let o=!0;return q0().then(i=>{!o||!i||(t(i),i&&!i.eligible&&(Nd(!1),r(!1)))}),()=>{o=!1}},[]);const s=w.useCallback(()=>{Nd(!0),r(!0)},[]);return{probe:e,showBanner:(e==null?void 0:e.eligible)===!0&&!n,showInConfig:e!=null&&e.mode==="own"&&(e.eligible||e.reason==="profile-paranoid"),dismiss:s}}function Di(e){return((e==null?void 0:e.projects)??[]).flatMap(t=>t.chats)}function tx(e){return new Set(Di(e).filter(t=>t.defaultSelected).map(t=>t.sessionId))}function nx(e,t){const n=e.chats.length,r=e.chats.reduce((s,o)=>s+(t.has(o.sessionId)?1:0),0);return{selected:r,total:n,all:n>0&&r===n,some:r>0&&r<n}}function rx(e,t,n){const r=new Set(e);for(const s of t.chats)n?r.add(s.sessionId):r.delete(s.sessionId);return r}function sx(e,t){return t?new Set(Di(e).map(n=>n.sessionId)):new Set}function ox(e,t){const n=new Set(e);return n.delete(t)||n.add(t),n}function ix(e,t){const n=Di(e).map(r=>r.sessionId);return{sessionIds:n.filter(r=>t.has(r)),plannedSessionIds:n,expectedVersion:e.configVersion}}function ax(e){const t=(e==null?void 0:e.totals.identical)??0,n=((e==null?void 0:e.projects)??[]).reduce((s,o)=>s+o.projectExtras.length,0),r=(e==null?void 0:e.sweepers.chats)??0;return{identical:t,projectExtras:n,sweeperChats:r,total:t+n+r}}function Tp(e){return e?e.projects.length===0&&e.sweepers.stores===0:!1}function Rp(e){return!e.ok||e.failed.length>0?"partial":e.alreadyMigrated?"already":e.migrated.length===0&&e.preserved.length===0?"nothing":"done"}function lx(e){const t=new Map;for(const n of e){const r=t.get(n.slug);r?r.push(n):t.set(n.slug,[n])}return[...t.entries()].map(([n,r])=>({slug:n,items:r}))}const ux={new:{label:"New",hint:"Not in ~/.claude yet. Moving it in loses nothing."},"fast-forward":{label:"Fast-forward",hint:"One copy is just a longer version of the other. Lossless either way."},diverged:{label:"Diverged",hint:"Both copies have messages the other does not. Ticking keeps Paddock's copy in ~/.claude; the other is kept too, in the preserve folder."},unknown:{label:"Not compared",hint:"Paddock ran out of scan budget before it could compare these two copies, so it has not assumed they are safe to merge."}};function hi(e){return ux[e]??{label:String(e),hint:"This Paddock build does not recognise this state, so it is shown as the server described it."}}function Cd(e){const t=e.indexOf("/.claude/");return t===-1?e:`~${e.slice(t)}`}function cx(e,t){return t==="all"?!0:t==="needs-decision"?!e.defaultSelected:e.state===t}function st(...e){return e.filter(Boolean).join(" ")}const dx={primary:"bg-accent-solid text-accent-fg shadow-xs hover:bg-accent-solid-hover active:scale-[0.98]",ghost:"bg-surface-active text-fg hover:bg-surface-selected",subtle:"text-fg-muted hover:bg-surface-hover hover:text-fg",danger:"bg-danger-solid text-danger-fg shadow-xs hover:brightness-110 active:scale-[0.98]",link:"text-accent underline underline-offset-2 hover:no-underline"},fx={sm:"gap-1.5 px-2 py-1 text-xs rounded-md",md:"gap-2 px-3.5 py-2 text-sm rounded-lg","icon-sm":"h-6 w-6 justify-center rounded-md","icon-md":"h-9 w-9 justify-center rounded-lg"};function jt({variant:e="ghost",size:t="md",icon:n,loading:r=!1,loadingLabel:s,align:o="center",className:i,children:a,disabled:u,type:c="button",...d}){return l.jsxs("button",{type:c,disabled:u||r,"aria-busy":r||void 0,className:st("inline-flex select-none items-center font-medium","motion-fast transition-[color,background-color,border-color,box-shadow,transform]","disabled:cursor-not-allowed disabled:opacity-50",o==="start"?"justify-start text-left":"justify-center",fx[t],dx[e],i),...d,children:[n,r&&s?s:a]})}const Tu=["w-full rounded-lg border border-edge-strong bg-surface-sunken px-3 py-2 text-sm text-fg","outline-none motion-fast transition-[border-color,box-shadow]","focus:border-accent focus:ring-2 focus:ring-accent/25","disabled:cursor-not-allowed disabled:opacity-60","aria-[invalid=true]:border-danger aria-[invalid=true]:focus:ring-danger/25"].join(" ");function _w({className:e,...t}){return l.jsx("input",{className:st(Tu,e),...t})}function Lw({className:e,...t}){return l.jsx("textarea",{className:st(Tu,"resize-y",e),...t})}function bw({className:e,...t}){return l.jsx("select",{className:st(Tu,e),...t})}function Iw({checked:e,onChange:t,label:n,disabled:r,id:s,className:o}){const i=w.useId(),a=s??i;return l.jsxs("label",{htmlFor:a,className:st("relative inline-block shrink-0 cursor-pointer",o),children:[l.jsx("input",{id:a,type:"checkbox","aria-label":n,className:"peer sr-only",checked:e,disabled:r,onChange:u=>t(u.target.checked)}),l.jsx("span",{className:st("block h-[18px] w-8 rounded-full bg-edge-strong","motion-fast transition-colors","after:absolute after:left-0.5 after:top-0.5 after:h-3.5 after:w-3.5 after:rounded-full","after:bg-surface-raised after:shadow-2xs after:transition-transform after:content-['']","peer-checked:bg-accent-solid peer-checked:after:translate-x-3.5","peer-focus-visible:ring-2 peer-focus-visible:ring-accent/50","peer-disabled:opacity-50")})]})}function Mp({label:e,description:t,indeterminate:n=!1,className:r,...s}){const o=w.useRef(null);w.useEffect(()=>{o.current&&(o.current.indeterminate=n)},[n]);const i=l.jsx("input",{ref:o,type:"checkbox",...n?{"aria-checked":"mixed"}:{},className:st("h-4 w-4 shrink-0 cursor-pointer rounded border-edge-strong accent-[var(--accent-solid)]","disabled:cursor-not-allowed disabled:opacity-50",e?"mt-0.5":"",r),...s});return e?l.jsxs("label",{className:"flex cursor-pointer items-start gap-2 text-sm text-fg",children:[i,l.jsxs("span",{className:"min-w-0",children:[e,t&&l.jsx("span",{className:"block text-xs leading-snug text-fg-muted",children:t})]})]}):i}const _p={neutral:"bg-surface-active text-fg-muted",accent:"bg-accent-soft text-accent",success:"bg-success-soft text-success",warn:"bg-warn-soft text-warn",danger:"bg-danger-soft text-danger",info:"bg-info-soft text-info",lineage:"bg-lineage-soft text-lineage"},Lp={neutral:"bg-fg-subtle",accent:"bg-accent-solid",success:"bg-success-solid",warn:"bg-warn-solid",danger:"bg-danger-solid",info:"bg-info-solid",lineage:"bg-lineage-solid"};function hx({tone:e="neutral",shape:t="tag",size:n="md",dot:r=!1,icon:s,title:o,className:i,children:a}){return l.jsxs("span",{title:o,className:st("inline-flex items-center gap-1 font-medium leading-none",t==="pill"?"rounded-full px-2 py-0.5":"rounded-md px-1.5 py-0.5",n==="sm"?"text-3xs":"text-2xs",_p[e],i),children:[r&&l.jsx("span",{className:st("h-1.5 w-1.5 shrink-0 rounded-full",Lp[e])}),s,a]})}function Dw({tone:e="neutral",pulse:t=!1,className:n}){return l.jsx("span",{className:st("inline-block h-2 w-2 shrink-0 rounded-full",Lp[e],t&&"animate-pulse",n)})}function Jt({tone:e="info",icon:t,className:n,children:r}){const s={neutral:"border-edge",accent:"border-accent-edge",success:"border-success-edge",warn:"border-warn-edge",danger:"border-danger-edge",info:"border-info-edge",lineage:"border-lineage-edge"};return l.jsxs("div",{role:e==="danger"?"alert":void 0,className:st("flex items-start gap-2 rounded-lg border px-3 py-2 text-sm",_p[e],s[e],n),children:[t&&l.jsx("span",{className:"mt-0.5 shrink-0",children:t}),l.jsx("div",{className:"min-w-0",children:r})]})}function px(e,t){w.useEffect(()=>{if(!e)return;const n=r=>{r.key==="Escape"&&t()};return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[e,t])}const mx={sm:"max-w-sm",md:"max-w-md",lg:"max-w-2xl"};function gx({open:e,onClose:t,title:n,hideTitle:r=!1,description:s,footer:o,size:i="md",role:a="dialog",dismissOnBackdrop:u=!0,onSubmit:c,className:d,children:f}){const p=w.useRef(null),y=w.useRef(null);if(px(e,t),w.useEffect(()=>{var C,g;return e?(y.current=document.activeElement,(g=((C=p.current)==null?void 0:C.querySelector("[autofocus], input:not([type=hidden]), textarea, select, button, [href], [tabindex]:not([tabindex='-1'])"))??p.current)==null||g.focus(),()=>{const h=y.current;h instanceof HTMLElement&&h.focus()}):void 0},[e]),w.useEffect(()=>{if(!e)return;const S=C=>{if(C.key!=="Tab"||!p.current)return;const g=[...p.current.querySelectorAll("input:not([type=hidden]):not([disabled]), textarea:not([disabled]), select:not([disabled]), button:not([disabled]), [href], [tabindex]:not([tabindex='-1'])")];if(g.length===0)return;const h=g[0],m=g[g.length-1],E=document.activeElement;C.shiftKey&&(E===h||!p.current.contains(E))?(C.preventDefault(),m.focus()):!C.shiftKey&&E===m&&(C.preventDefault(),h.focus())};return document.addEventListener("keydown",S),()=>document.removeEventListener("keydown",S)},[e]),!e)return null;const k=c?"form":"div";return l.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-overlay p-4 backdrop-blur-sm",onClick:()=>u&&t(),children:l.jsxs(k,{ref:p,role:a,"aria-modal":"true","aria-label":n,tabIndex:-1,onClick:S=>S.stopPropagation(),onSubmit:c,className:st("flex max-h-[85vh] w-full flex-col animate-scale-in rounded-2xl border border-edge","bg-surface-raised p-6 shadow-2xl outline-none",mx[i],d),children:[!r&&l.jsx("h2",{className:"text-base font-semibold text-fg",children:n}),s&&l.jsx("p",{className:"mt-1 text-sm text-fg-muted",children:s}),l.jsx("div",{className:"-mx-1 min-h-0 flex-1 overflow-y-auto px-1 py-1",children:f}),o&&l.jsx("div",{className:"mt-4 flex items-center justify-end gap-2",children:o})]})})}function bp({content:e,children:t,delayMs:n=250,className:r=""}){const s=w.useId(),o=w.useRef(null),i=w.useRef(null),a=w.useRef(null),[u,c]=w.useState(null),d=()=>{a.current&&clearTimeout(a.current),a.current=null},f=w.useCallback(()=>{d(),c(null)},[]),p=w.useCallback(()=>{var g;const S=(g=o.current)==null?void 0:g.getBoundingClientRect();if(!S)return;const C=S.top<56;c({x:S.left+S.width/2,y:C?S.bottom+6:S.top-6,below:C})},[]);w.useEffect(()=>d,[]),w.useEffect(()=>{if(!u)return;const S=C=>{C.key==="Escape"&&f()};return window.addEventListener("keydown",S),window.addEventListener("scroll",f,!0),window.addEventListener("resize",f),()=>{window.removeEventListener("keydown",S),window.removeEventListener("scroll",f,!0),window.removeEventListener("resize",f)}},[u,f]),w.useLayoutEffect(()=>{if(!u||!i.current)return;const S=i.current.offsetWidth;if(!S)return;const C=8+S/2,g=window.innerWidth-8-S/2,h=Math.min(Math.max(u.x,C),Math.max(C,g));h!==u.x&&c({...u,x:h})},[u]);const y=w.Children.only(t),k=w.isValidElement(y)?w.cloneElement(y,{"aria-describedby":u?s:void 0}):y;return l.jsxs(l.Fragment,{children:[l.jsx("span",{ref:o,className:`inline-flex ${r}`,onPointerEnter:S=>{S.pointerType!=="touch"&&(d(),a.current=setTimeout(p,n))},onPointerLeave:f,onPointerDown:f,onFocusCapture:p,onBlurCapture:f,children:k}),u&&Mi.createPortal(l.jsx("div",{ref:i,id:s,role:"tooltip",style:{position:"fixed",left:u.x,top:u.y,transform:`translate(-50%, ${u.below?"0":"-100%"})`},className:"pointer-events-none z-[70] max-w-[15rem] animate-fade-in rounded-lg bg-fg px-2 py-1 text-2xs leading-snug text-surface shadow-lg",children:e}),document.body)]})}function Ip({open:e,onClose:t,onCompleted:n}){const[r,s]=w.useState(null),[o,i]=w.useState(new Set),[a,u]=w.useState({kind:"loading"}),[c,d]=w.useState("all"),f=w.useRef(!1),p=w.useCallback(async()=>{u({kind:"loading"});try{const m=await or.transcriptsMigrationChats();s(m),i(tx(m)),u({kind:"plan"})}catch(m){u({kind:"load-failed",message:zp(m)})}},[]);w.useEffect(()=>{e&&(d("all"),p())},[e,p]);const y=w.useMemo(()=>Di(r),[r]),k=w.useMemo(()=>ax(r),[r]),S=w.useMemo(()=>y.reduce((m,E)=>m+(o.has(E.sessionId)?1:0),0),[y,o]),C=w.useMemo(()=>y.filter(Ix).length,[y]),g=w.useCallback(async()=>{if(!(!r||f.current)){f.current=!0,u({kind:"running"});try{const m=await or.runTranscriptsMigration(ix(r,o));ex(),u({kind:"result",result:m}),m.ok&&(n==null||n())}catch(m){u({kind:"refused",error:m})}finally{f.current=!1}}},[r,o,n]),h=a.kind==="running";return l.jsxs(Fx,{open:e,onClose:h?()=>{}:t,dismissOnBackdrop:!h,title:Ox(a),footer:l.jsx(_x,{phase:a,plan:r,rows:y,selectedCount:S,alsoMoving:k.total,onClose:t,onRetry:g,onReload:p,onSubmit:g}),children:[a.kind==="loading"&&l.jsxs("p",{className:"py-8 text-center text-sm text-fg-muted",children:["Comparing this instance's chats with your ",l.jsx(Ce,{children:"~/.claude"}),"…"]}),a.kind==="load-failed"&&l.jsxs(Jt,{tone:"danger",className:"text-sm",children:[l.jsx("p",{className:"font-semibold",children:"Could not read the migration plan."}),l.jsx("p",{className:"mt-1",children:a.message}),l.jsx("p",{className:"mt-1 text-xs",children:"Nothing has been moved."})]}),a.kind==="running"&&l.jsx(Nx,{plan:r,count:S}),a.kind==="refused"&&l.jsx(Cx,{error:a.error,plan:r,rows:y,selected:o}),a.kind==="result"&&l.jsx(Tx,{result:a.result}),a.kind==="plan"&&r&&l.jsx(vx,{plan:r,rows:y,selected:o,setSelected:i,filter:c,setFilter:d,decisionCount:C,alsoMoving:k})]})}function vx({plan:e,rows:t,selected:n,setSelected:r,filter:s,setFilter:o,decisionCount:i,alsoMoving:a}){if(Tp(e))return l.jsxs("div",{className:"py-6 text-sm text-fg-muted",children:[l.jsx("p",{className:"font-semibold text-fg",children:"Nothing to move."}),l.jsxs("p",{className:"mt-1",children:["Every project's ",l.jsx(Ce,{children:".chats/"})," is already empty, so there is nothing to merge into your ",l.jsx(Ce,{children:"~/.claude"}),"."]})]});const u=t.length>0&&t.every(d=>n.has(d.sessionId)),c=t.reduce((d,f)=>d+(n.has(f.sessionId)?1:0),0);return l.jsxs("div",{className:"space-y-3",children:[l.jsxs("p",{className:"text-base text-fg",children:[l.jsxs("strong",{className:"font-semibold",children:[c.toLocaleString()," of ",t.length.toLocaleString()," ",t.length===1?"chat":"chats"]})," ","will move into ",l.jsx(Ce,{children:"~/.claude"}),"."," ",l.jsxs("span",{className:"text-fg-muted",children:["The rest are set aside in ",l.jsx(Ce,{children:".chats-pre-migration/"}),", not deleted."]})]}),l.jsx(yx,{plan:e}),l.jsx(xx,{plan:e,filter:s,setFilter:o,decisionCount:i}),l.jsx("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-2 border-b border-edge pb-2",children:l.jsx(Mp,{checked:u,indeterminate:!u&&n.size>0,onChange:()=>r(sx(e,!u)),label:l.jsx("span",{className:"text-xs",children:"Select all"})})}),l.jsx("ul",{className:"space-y-4",children:e.projects.map(d=>l.jsx(kx,{project:d,selected:n,setSelected:r,filter:s},d.slug))}),a.total>0&&l.jsx(wx,{alsoMoving:a})]})}function yx({plan:e}){const[t,n]=w.useState(!1),r=e.warnings.length+(e.scanBudgetExhausted?1:0);return r===0?null:l.jsxs("div",{className:"rounded-lg border border-warn-edge bg-warn-soft/30",children:[l.jsxs("button",{type:"button",onClick:()=>n(!t),"aria-expanded":t,className:"focus-visible:focus-ring flex w-full items-center gap-1.5 rounded-lg px-3 py-2 text-left text-xs font-semibold text-warn-fg",children:[l.jsx(Dp,{open:t}),r.toLocaleString()," ",r===1?"warning":"warnings",l.jsx("span",{className:"ml-auto font-normal text-fg-muted",children:t?"Hide":"Show"})]}),t&&l.jsxs("div",{className:"space-y-2 px-3 pb-3 pl-8 text-xs text-warn-fg",children:[e.scanBudgetExhausted&&l.jsxs("p",{children:[l.jsxs("strong",{className:"font-semibold",children:[e.totals.unknown.toLocaleString()," ",e.totals.unknown===1?"chat":"chats"," could not be compared."]})," ","Comparing two copies means reading both in full, and this instance has more of them than one pass is allowed to read. Those rows start unticked — Paddock will not assume a chat is safe to merge when it has not looked. Nothing is lost either way."]}),e.warnings.length>0&&l.jsx(Op,{warnings:e.warnings})]})]})}function xx({plan:e,filter:t,setFilter:n,decisionCount:r}){const s=[{state:"new",n:e.totals.new},{state:"fast-forward",n:e.totals.fastForward},{state:"diverged",n:e.totals.diverged},{state:"unknown",n:e.totals.unknown}];return l.jsxs("div",{role:"tablist","aria-label":"Filter chats",className:"flex flex-wrap items-center gap-1",children:[l.jsx(va,{active:t==="all",onClick:()=>n("all"),label:`All ${e.totals.chats.toLocaleString()}`}),r>0&&l.jsx(va,{active:t==="needs-decision",onClick:()=>n("needs-decision"),label:`${r.toLocaleString()} need a decision`}),l.jsx("span",{className:"mx-1 h-4 w-px bg-edge","aria-hidden":"true"}),s.map(({state:o,n:i})=>i===0?null:l.jsx(bp,{content:hi(o).hint,children:l.jsx(va,{active:t===o,onClick:()=>n(o),label:`${i.toLocaleString()} ${hi(o).label.toLowerCase()}`,tone:$p[o]})},o))]})}function va({active:e,onClick:t,label:n,tone:r}){return l.jsx("button",{type:"button",role:"tab","aria-selected":e,onClick:t,className:Oi("focus-visible:focus-ring rounded-full border px-2.5 py-1 text-xs transition",e?"border-accent-edge bg-accent-soft font-semibold text-fg":"border-edge text-fg-muted can-hover:hover:border-edge-strong can-hover:hover:text-fg",!e&&r==="info"&&"text-info-fg",!e&&r==="success"&&"text-success-fg",!e&&r==="warn"&&"text-warn-fg"),children:n})}function wx({alsoMoving:e}){const[t,n]=w.useState(!1),r=[];return e.identical>0&&r.push(`${e.identical.toLocaleString()} ${e.identical===1?"chat that is":"chats that are"} already identical in both places`),e.projectExtras>0&&r.push(`${e.projectExtras.toLocaleString()} project ${e.projectExtras===1?"file":"files"} such as agent memory`),e.sweeperChats>0&&r.push(`${e.sweeperChats.toLocaleString()} internal sweeper transcripts`),l.jsxs("div",{className:"border-t border-edge pt-3",children:[l.jsxs("button",{type:"button",onClick:()=>n(!t),"aria-expanded":t,className:"focus-visible:focus-ring flex w-full items-center gap-1.5 rounded text-left text-xs text-fg-muted can-hover:hover:text-fg",children:[l.jsx(Dp,{open:t}),l.jsxs("span",{children:["Also moving: ",l.jsx("span",{className:"text-fg",children:Sx(e)})]})]}),t&&l.jsxs("p",{className:"mt-1.5 pl-5 text-xs text-fg-muted",children:[Ax(r),". These have no decision attached — Paddock's copy of an identical chat is set aside rather than deleted, and the rest have no counterpart to conflict with."," ",l.jsx(Ce,{children:".chats/"})," has to end up completely empty for the switch to take effect."]})]})}function Sx(e){const t=[],n=e.identical+e.projectExtras;return n>0&&t.push(`+${n.toLocaleString()} ${n===1?"chat":"chats"}`),e.sweeperChats>0&&t.push(`+${e.sweeperChats.toLocaleString()} sweeper`),t.join(", ")}function Dp({open:e}){return l.jsx("svg",{viewBox:"0 0 12 12","aria-hidden":"true",className:Oi("h-3 w-3 shrink-0 transition-transform duration-fast",e&&"rotate-90"),children:l.jsx("path",{d:"M4 2.5 8 6l-4 3.5z",fill:"currentColor"})})}function kx({project:e,selected:t,setSelected:n,filter:r}){const s=e.chats.filter(a=>cx(a,r)),o=w.useMemo(()=>({...e,chats:s}),[e,s]),i=nx(o,t);return s.length===0&&e.projectExtras.length===0?null:l.jsxs("li",{children:[l.jsxs("div",{className:"mb-1.5 flex flex-wrap items-baseline justify-between gap-x-3 gap-y-1 border-t border-edge pt-3",children:[l.jsx(bp,{content:l.jsxs("span",{className:"block max-w-xs break-all font-mono text-2xs",children:["→ ",Cd(e.hostStore),s.some(Dx)&&l.jsxs(l.Fragment,{children:[l.jsx("br",{}),"kept, not deleted → ",Cd(e.preserveDir)]})]}),className:"min-w-0",children:l.jsx("h3",{className:"min-w-0 truncate text-base font-semibold text-fg",children:e.name||"Root workspace"})}),s.length>0&&l.jsx(Mp,{checked:i.all,indeterminate:i.some,onChange:()=>n(rx(t,o,!i.all)),label:l.jsxs("span",{className:"whitespace-nowrap text-2xs text-fg-muted",children:[i.selected," of ",i.total]})})]}),s.length===0?l.jsxs("p",{className:"rounded-lg border border-dashed border-edge px-3 py-2 text-xs text-fg-muted",children:["No chats here need a decision — ",e.projectExtras.length.toLocaleString()," project"," ",e.projectExtras.length===1?"file moves":"files move"," with it anyway."]}):l.jsx("ul",{className:"space-y-1",children:s.map(a=>l.jsx(jx,{chat:a,checked:t.has(a.sessionId),onToggle:()=>n(ox(t,a.sessionId))},a.sessionId))})]})}function jx({chat:e,checked:t,onToggle:n}){const r=e.state==="diverged"||e.state==="unknown";return l.jsx("li",{children:l.jsxs("label",{title:bx(e),className:Oi("flex cursor-pointer items-start gap-2.5 rounded-lg border px-3 py-2 transition","can-hover:hover:bg-surface-hover",r?"border-warn-edge bg-warn-soft/30":"border-edge"),children:[l.jsx("input",{type:"checkbox",className:"mt-1 h-4 w-4 shrink-0 accent-[var(--accent-solid)]",checked:t,onChange:n,"aria-label":`Merge ${e.name??e.sessionId} into ~/.claude`}),l.jsxs("span",{className:"min-w-0 flex-1",children:[l.jsxs("span",{className:"flex flex-wrap items-baseline gap-x-2 gap-y-0.5",children:[l.jsx("span",{className:"min-w-0 truncate text-sm text-fg",children:e.name??l.jsx("span",{className:"font-mono text-xs",children:e.sessionId})}),l.jsx(Lx,{state:e.state})]}),e.preview&&e.preview!==e.name&&l.jsx("span",{className:"mt-0.5 block truncate text-xs text-fg-muted",children:e.preview}),r&&e.host&&l.jsx(Ex,{chat:e,checked:t})]})]})})}function Ex({chat:e,checked:t}){return e.host?l.jsxs("span",{className:"mt-1.5 grid grid-cols-1 gap-1 sm:grid-cols-2",children:[l.jsx(Pd,{title:"Paddock's copy",side:e.own,wins:t,note:t?"moves into ~/.claude":"kept in the preserve folder"}),l.jsx(Pd,{title:"Your ~/.claude copy",side:e.host,wins:!t,note:t?"moved aside, kept":"stays where it is"})]}):null}function Pd({title:e,side:t,wins:n,note:r}){return l.jsxs("span",{className:Oi("block rounded-md border px-2 py-1.5 text-2xs",n?"border-accent-edge bg-accent-soft":"border-edge bg-surface"),children:[l.jsxs("span",{className:"flex items-baseline justify-between gap-2",children:[l.jsx("span",{className:"font-semibold text-fg",children:e}),l.jsx("span",{className:n?"text-accent":"text-fg-muted",children:r})]}),l.jsxs("span",{className:"mt-0.5 block text-fg-muted tabular",children:[t.messageCount!==void 0?`${t.messageCount.toLocaleString()} ${t.messageCount===1?"message":"messages"}`:zx(t.sizeBytes)," · ",t.lastMessageAt?l.jsxs(l.Fragment,{children:["last message ",wl(t.lastMessageAt)]}):l.jsxs(l.Fragment,{children:["file touched ",wl(t.mtime)]})]})]})}function Nx({plan:e,count:t}){var n;return l.jsxs("div",{className:"space-y-3 py-6",children:[l.jsxs("p",{className:"text-sm font-semibold text-fg",children:[l.jsx("span",{className:"mr-2 inline-block h-2 w-2 animate-pulse rounded-full bg-accent-solid"}),"Merging ",t.toLocaleString()," ",t===1?"chat":"chats","…"]}),l.jsxs("ol",{className:"ml-4 list-decimal space-y-1 text-xs text-fg-muted",children:[l.jsx("li",{children:"Stopping any turns that are still running."}),l.jsxs("li",{children:["Moving transcripts into"," ",l.jsx(Ce,{children:((n=e==null?void 0:e.projects[0])==null?void 0:n.hostStore.replace(/\/[^/]*$/,"/…"))??"~/.claude"}),"."]}),l.jsxs("li",{children:["Setting ",l.jsx(Ce,{children:"claude.transcripts: host"}),"."]})]}),l.jsx("p",{className:"text-xs text-fg-subtle",children:"Please leave this open. Nothing is deleted at any point, and if this is interrupted the migration can simply be run again."})]})}function Cx({error:e,plan:t,rows:n,selected:r}){const s=e instanceof On?e.code:void 0,o=$x(e),i=a=>{var u;return((u=n.find(c=>c.sessionId===a))==null?void 0:u.name)??a};return l.jsxs("div",{className:"space-y-3",children:[l.jsxs(Jt,{tone:s==="env_shadowed"?"danger":"warn",className:"text-sm",children:[l.jsx("p",{className:"font-semibold",children:Px[s??""]??"The migration did not run."}),l.jsxs("p",{className:"mt-1 text-fg",children:[l.jsx("strong",{className:"font-semibold",children:"Nothing was moved."})," Every one of these checks runs before the first file is touched, so your chats are exactly where they were."]}),l.jsx("p",{className:"mt-1.5 text-xs",children:zp(e)})]}),s==="turn_running"&&o.length>0&&l.jsxs("div",{className:"text-xs text-fg-muted",children:[l.jsx("p",{className:"font-semibold text-fg",children:"Still running:"}),l.jsx("ul",{className:"mt-1 space-y-0.5",children:o.map(a=>l.jsxs("li",{className:"break-all",children:[l.jsx("span",{className:"text-fg",children:i(a)})," ",l.jsx("span",{className:"font-mono text-2xs text-fg-subtle",children:a})]},a))}),l.jsxs("p",{className:"mt-1.5",children:["A chat mid-turn is still writing to its transcript, so moving it would race the write. Wait for it to finish — or stop it from its own chat screen — then try again. One chat left behind would leave that project's ",l.jsx(Ce,{children:".chats/"})," non-empty, which is why the whole migration refuses rather than skipping it."]})]}),s==="config_conflict"&&l.jsxs("p",{className:"text-xs text-fg-muted",children:["Something else edited ",l.jsx(Ce,{children:(t==null?void 0:t.configPath)??"paddock.config.yaml"})," after this plan was built — another tab, or an editor. Reload the plan so your choices are made against the current file, then submit again."]}),s==="migration_in_progress"&&l.jsx("p",{className:"text-xs text-fg-muted",children:"Another tab or window is running this migration right now. Let it finish — when it does, reload this plan and it will report that there is nothing left to move."}),s==="env_shadowed"&&l.jsxs("p",{className:"text-xs text-fg-muted",children:[l.jsx(Ce,{children:"PADDOCK_CLAUDE_TRANSCRIPTS"})," is set in this server's environment, and an environment variable beats the config file. Writing"," ",l.jsx(Ce,{children:"claude.transcripts: host"})," would have no effect, so the chats would have been moved for nothing. Unset it, restart Paddock, and the offer will come back."]}),l.jsxs("p",{className:"text-2xs text-fg-subtle",children:["Your selection is still here: ",r.size.toLocaleString()," of"," ",n.length.toLocaleString()," ticked."]})]})}const Px={turn_running:"A chat is still mid-turn.",config_conflict:"The config file changed underneath this plan.",migration_in_progress:"A migration is already running.",env_shadowed:"An environment variable is overriding the config file.",invalid:"That request was not valid."};function Tx({result:e}){const t=Rp(e),n=lx(e.preserved),r=e.projects.filter(s=>s.outcome==="skipped-busy");return l.jsxs("div",{className:"space-y-3",children:[t==="partial"?l.jsxs(Jt,{tone:"warn",className:"text-sm",children:[l.jsx("p",{className:"font-semibold",children:"The migration did not finish."}),l.jsxs("p",{className:"mt-1",children:[l.jsx(Ce,{children:"claude.transcripts"})," was ",l.jsx("strong",{className:"font-semibold",children:"not"})," ","changed, so this instance is still using its own store and nothing about how Paddock behaves has changed yet. Files that did move are already in place and will not move twice — ",l.jsx("strong",{className:"font-semibold",children:"running this again is safe"})," and picks up where it stopped."]})]}):t==="already"?l.jsxs(Jt,{tone:"info",className:"text-sm",children:[l.jsx("p",{className:"font-semibold",children:"Already merged."}),l.jsxs("p",{className:"mt-1",children:["Everything was already in your ",l.jsx(Ce,{children:"~/.claude"})," and"," ",l.jsx(Ce,{children:"claude.transcripts"})," was already ",l.jsx(Ce,{children:"host"}),". Nothing needed doing."]})]}):l.jsxs(Jt,{tone:"success",className:"text-sm",children:[l.jsxs("p",{className:"font-semibold",children:["Merged ",e.migrated.length.toLocaleString()," ",e.migrated.length===1?"chat":"chats"," into your ",l.jsx(Ce,{children:"~/.claude"}),"."]}),e.preserved.length>0&&l.jsxs("p",{className:"mt-1",children:[e.preserved.length.toLocaleString()," ",e.preserved.length===1?"copy was":"copies were"," set aside rather than overwritten. Every one is listed below."]})]}),e.restartRequired&&l.jsx(Rx,{ok:t!=="partial",configWritten:e.configWritten}),e.failed.length>0&&l.jsxs("section",{children:[l.jsxs("h3",{className:"text-xs font-semibold text-fg",children:[e.failed.length.toLocaleString()," could not be moved"]}),l.jsx("ul",{className:"mt-1 space-y-1",children:e.failed.map((s,o)=>l.jsxs("li",{className:"rounded-md border border-warn-edge bg-warn-soft/40 px-2 py-1.5 text-2xs",children:[l.jsx("span",{className:"block break-all font-mono text-fg",children:Td(s)}),l.jsxs("span",{className:"block text-fg-muted",children:[s.reason,s.message?` — ${s.message}`:""]}),s.path&&Td(s)!==s.path&&l.jsx("span",{className:"block break-all font-mono text-fg-subtle",children:s.path})]},`${s.slug}:${s.sessionId}:${o}`))})]}),r.length>0&&l.jsxs(Jt,{tone:"warn",className:"text-xs",children:[l.jsxs("p",{className:"font-semibold",children:[r.length," ",r.length===1?"project was":"projects were"," left untouched."]}),l.jsxs("p",{className:"mt-1",children:["A turn started again between the stop and the move, so"," ",r.map(s=>s.slug||"the root workspace").join(", ")," was skipped entirely rather than half-moved. Run the migration again once it is idle."]})]}),e.preserved.length>0&&l.jsxs("section",{"data-testid":"migration-preserved",children:[l.jsxs("h3",{className:"text-xs font-semibold text-fg",children:["Kept, not deleted — ",e.preserved.length.toLocaleString()," ",e.preserved.length===1?"item":"items"]}),l.jsxs("p",{className:"mt-0.5 text-2xs text-fg-muted",children:["Every copy that did not end up in ",l.jsx(Ce,{children:"~/.claude"}),", and exactly where it is now. Nothing here was removed; you can open any of these paths. A chat's sub-agent transcripts, tool results and revert history move with it."]}),n.map(s=>l.jsxs("div",{className:"mt-2",children:[l.jsx("p",{className:"text-2xs font-semibold text-fg-muted",children:s.slug||"root workspace"}),l.jsx("ul",{className:"mt-0.5 space-y-0.5",children:s.items.map((o,i)=>l.jsxs("li",{className:"text-2xs",children:[l.jsx("span",{className:"block break-all font-mono text-fg",children:o.path}),l.jsx("span",{className:"text-fg-subtle",children:Mx(o.reason,o.side)})]},`${o.path}:${i}`))})]},s.slug))]}),e.unplanned.length>0&&l.jsxs("section",{children:[l.jsxs("h3",{className:"text-xs font-semibold text-fg",children:[e.unplanned.length.toLocaleString()," appeared after you opened this"]}),l.jsx("p",{className:"mt-0.5 text-2xs text-fg-muted",children:"These chats were created between the table being built and Submit, so you were never shown them. Each was handled by the same default its classification would have had."}),l.jsx("ul",{className:"mt-1 space-y-0.5",children:e.unplanned.map((s,o)=>l.jsxs("li",{className:"break-all text-2xs",children:[l.jsx("span",{className:"font-mono text-fg",children:s.sessionId})," ",l.jsxs("span",{className:"text-fg-muted",children:["— ",hi(s.state).label.toLowerCase(),", so it was"," ",s.action==="migrated"?"merged":"kept in the preserve folder"]})]},`${s.sessionId}:${o}`))})]}),e.ignoredSessionIds.length>0&&l.jsxs("p",{className:"text-2xs text-fg-muted",children:[e.ignoredSessionIds.length.toLocaleString()," ticked"," ",e.ignoredSessionIds.length===1?"chat was":"chats were"," no longer on disk and were skipped."]}),e.warnings.length>0&&l.jsx(Op,{warnings:e.warnings}),e.sweepers.chats>0&&l.jsxs("p",{className:"text-2xs text-fg-subtle",children:[e.sweepers.chats.toLocaleString()," internal sweeper transcripts across"," ",e.sweepers.stores.toLocaleString()," ",e.sweepers.stores===1?"store":"stores"," moved with their projects."]})]})}function Rx({ok:e,configWritten:t}){return e?t?l.jsxs(Jt,{tone:"accent",className:"text-sm",children:[l.jsx("p",{className:"font-semibold text-fg",children:"Restart the Paddock server now."}),l.jsxs("p",{className:"mt-1",children:["The setting is written, but Paddock reads it once when it starts — so this running server has not picked it up yet."," ",l.jsx("strong",{className:"font-semibold text-fg",children:"Until you restart, your chat list will look empty."})," ","That is expected and nothing is wrong: the running process is still looking in the old location, which the migration just emptied. Everything is on disk — the merged chats are in your ",l.jsx(Ce,{children:"~/.claude"})," and the set-aside copies are in the folders listed here. They all come back the moment Paddock restarts."]})]}):l.jsxs(Jt,{tone:"accent",className:"text-sm",children:[l.jsx("p",{className:"font-semibold text-fg",children:"Restart the Paddock server now."}),l.jsxs("p",{className:"mt-1",children:["Your configuration already asked for ",l.jsx(Ce,{children:"~/.claude"}),", so"," ",l.jsx("strong",{className:"font-semibold text-fg",children:"nothing about it was changed"})," — the chats were simply stranded where Paddock could not reach them, and they are now back in the store it reads. Paddock only wires that up at startup, so this running server has not caught up yet."," ",l.jsx("strong",{className:"font-semibold text-fg",children:"Restart and the chats that were missing will reappear."})," ","The copies set aside along the way are in the folders listed here."]})]}):l.jsxs(Jt,{tone:"accent",className:"text-sm",children:[l.jsx("p",{className:"font-semibold text-fg",children:"Run the migration again, then restart."}),l.jsxs("p",{className:"mt-1",children:["Some chats have already moved out of Paddock's own store, and because the setting was not written this server still looks for them there."," ",l.jsx("strong",{className:"font-semibold text-fg",children:"Until the migration finishes, your chat list will look incomplete."})," ","Nothing is lost — every file is either in your ",l.jsx(Ce,{children:"~/.claude"})," or in the folders listed below. Fix what is reported above, run this again, and restart when it completes."]})]})}function Mx(e,t){switch(e){case"unchecked":return"you left this one unticked, so Paddock's copy was set aside and your ~/.claude copy is untouched";case"unplanned-diverged":return"created after the table was built and had conflicting edits, so it was set aside rather than merged without asking";case"identical":return"already identical in both places, so Paddock's duplicate was set aside";case"already-ahead":return"your ~/.claude copy was the longer one and was kept, so Paddock's shorter copy was set aside";case"superseded":return"your ~/.claude copy was moved here first, then Paddock's copy took its place — this is the original";default:return`set aside from the ${t==="host"?"~/.claude":"Paddock"} side (${e})`}}function _x({phase:e,plan:t,rows:n,selectedCount:r,alsoMoving:s,onClose:o,onRetry:i,onReload:a,onSubmit:u}){if(e.kind==="running")return l.jsx("span",{className:"text-xs text-fg-muted",children:"Working — this usually takes under a second."});if(e.kind==="result")return l.jsx(jt,{variant:"primary",size:"sm",onClick:o,children:"Close"});if(e.kind==="load-failed")return l.jsxs(l.Fragment,{children:[l.jsx(jt,{variant:"ghost",size:"sm",onClick:o,children:"Close"}),l.jsx(jt,{variant:"primary",size:"sm",onClick:a,children:"Try again"})]});if(e.kind==="refused"){const c=e.error instanceof On?e.error.code:void 0,d=c!=="env_shadowed"&&c!=="invalid";return l.jsxs(l.Fragment,{children:[l.jsx(jt,{variant:"ghost",size:"sm",onClick:o,children:"Close"}),c==="config_conflict"?l.jsx(jt,{variant:"primary",size:"sm",onClick:a,children:"Reload the plan"}):d&&l.jsx(jt,{variant:"primary",size:"sm",onClick:i,children:"Try again"})]})}return e.kind==="loading"||!t?l.jsx(jt,{variant:"ghost",size:"sm",onClick:o,children:"Cancel"}):Tp(t)?l.jsx(jt,{variant:"primary",size:"sm",onClick:o,children:"Close"}):l.jsxs(l.Fragment,{children:[l.jsxs("span",{className:"mr-auto text-xs text-fg-muted",children:[r.toLocaleString()," of ",n.length.toLocaleString()," ticked",s>0&&l.jsxs("span",{className:"text-fg-subtle",children:[" · ",s.toLocaleString()," more move anyway"]})]}),l.jsx(jt,{variant:"ghost",size:"sm",onClick:o,children:"Cancel"}),l.jsx(jt,{variant:"primary",size:"sm",onClick:u,children:r===0?"Merge nothing, keep everything":`Merge ${r.toLocaleString()} ${r===1?"chat":"chats"}`})]})}function Op({warnings:e}){return l.jsx("ul",{className:"space-y-1",children:e.map((t,n)=>l.jsxs("li",{children:[l.jsx("span",{children:t.message}),t.paths&&t.paths.length>0&&l.jsxs("details",{className:"mt-0.5",children:[l.jsx("summary",{className:"focus-visible:focus-ring cursor-pointer text-2xs underline underline-offset-2",children:t.paths.length===1?"Show the path":`Show ${t.paths.length} paths`}),l.jsx("ul",{className:"mt-0.5",children:t.paths.map(r=>l.jsx("li",{className:"break-all font-mono text-2xs text-fg-subtle",children:r},r))})]})]},`${t.code}:${n}`))})}const $p={new:"success","fast-forward":"info",diverged:"warn",unknown:"neutral"};function Lx({state:e,n:t}){if(t===0)return null;const n=hi(e);return l.jsx(hx,{tone:$p[e]??"neutral",title:n.hint,children:t===void 0?n.label:`${t.toLocaleString()} ${n.label.toLowerCase()}`})}function bx(e){const t=[];return e.name!==void 0&&t.push(e.sessionId),e.extras.length>0&&t.push(`+${e.extras.length} sidecar ${e.extras.length===1?"file":"files"}`),t.length>0?t.join(" · "):void 0}function Ix(e){return!e.defaultSelected}function Dx(e){return e.state==="diverged"||e.state==="unknown"}function Ce({children:e}){return l.jsx("span",{className:"break-all font-mono",children:e})}function zp(e){return e instanceof Error?e.message:String(e)}function Ox(e){const t="Merge chats into ~/.claude";if(e.kind!=="result")return t;switch(Rp(e.result)){case"partial":return`${t} — unfinished`;case"already":return`${t} — nothing to do`;default:return`${t} — done`}}function Td(e){return e.sessionId&&e.sessionId!=="-"?e.sessionId:e.path??"Project files"}function $x(e){if(!(e instanceof On))return[];const t=e.body;if(typeof t!="object"||t===null)return[];const n=t.sessionIds;return Array.isArray(n)?n.filter(r=>typeof r=="string"):[]}function zx(e){return e<1024?`${e} B`:e<1024*1024?`${Math.round(e/1024)} kB`:`${(e/1024/1024).toFixed(1)} MB`}function Ax(e){return e.length<=1?e[0]??"":`${e.slice(0,-1).join(", ")} and ${e[e.length-1]}`}function Oi(...e){return e.filter(Boolean).join(" ")}function Fx(e){return l.jsx(gx,{...e,size:"lg",className:"sm:max-w-4xl"})}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 Ux=e=>l.jsx("svg",{...q(e),children:l.jsx("path",{d:"M12 5v14M5 12h14"})}),Ow=e=>l.jsx("svg",{...q(e),children:l.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"})}),Bx=e=>l.jsxs("svg",{...q(e),children:[l.jsx("path",{d:"M3 10.5 12 3l9 7.5"}),l.jsx("path",{d:"M5 9.5V20a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V9.5"})]}),$w=e=>l.jsx("svg",{...q(e),children:l.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"})}),Rd=e=>l.jsxs("svg",{...q(e),children:[l.jsx("circle",{cx:"11",cy:"11",r:"7"}),l.jsx("path",{d:"m21 21-4.3-4.3"})]}),zw=e=>l.jsxs("svg",{...q(e),children:[l.jsx("path",{d:"M4 5h16"}),l.jsx("path",{d:"M8 5v6h12"}),l.jsx("path",{d:"M8 11v6h12"})]}),Aw=e=>l.jsx("svg",{...q(e),children:l.jsx("path",{d:"M4 6h16M4 12h16M4 18h16"})}),Wx=e=>l.jsx("svg",{...q(e),children:l.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"})}),Fw=e=>l.jsxs("svg",{...q(e),children:[l.jsx("path",{d:"m22 2-7 20-4-9-9-4Z"}),l.jsx("path",{d:"M22 2 11 13"})]}),Uw=e=>l.jsx("svg",{...q(e),children:l.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"})}),Bw=e=>l.jsxs("svg",{...q(e),children:[l.jsx("rect",{x:"9",y:"2",width:"6",height:"12",rx:"3"}),l.jsx("path",{d:"M5 10a7 7 0 0 0 14 0"}),l.jsx("path",{d:"M12 17v4M8 21h8"})]}),Ww=e=>l.jsx("svg",{...q(e),children:l.jsx("path",{d:"m9 18 6-6-6-6"})}),Vw=e=>l.jsx("svg",{...q(e),children:l.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"})}),Vx=e=>l.jsxs("svg",{...q(e),children:[l.jsx("circle",{cx:"12",cy:"12",r:"3"}),l.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"})]}),Hx=e=>l.jsxs("svg",{...q(e),children:[l.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"}),l.jsx("path",{d:"M12 9v4M12 17h.01"})]}),Hw=e=>l.jsx("svg",{...q(e),children:l.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"})}),$i=e=>l.jsx("svg",{...q(e),children:l.jsx("path",{d:"M18 6 6 18M6 6l12 12"})}),Qw=e=>l.jsx("svg",{...q(e),children:l.jsx("path",{d:"M13 2 4.5 13.5H11l-1 8.5 8.5-11.5H12z"})}),Kw=e=>l.jsx("svg",{...q(e),children:l.jsx("path",{d:"M6 4.5v15l13-7.5z"})}),Qx=e=>l.jsx("svg",{...q(e),children:l.jsx("path",{d:"M3 6h18M3 12h18M3 18h18"})}),Gw=e=>l.jsxs("svg",{...q(e),children:[l.jsx("circle",{cx:"12",cy:"12",r:"9"}),l.jsx("path",{d:"M12 7v5l3 2"})]}),Yw=e=>l.jsxs("svg",{...q(e),children:[l.jsx("circle",{cx:"12",cy:"5",r:"1"}),l.jsx("circle",{cx:"12",cy:"12",r:"1"}),l.jsx("circle",{cx:"12",cy:"19",r:"1"})]}),Jw=e=>l.jsx("svg",{...q(e),children:l.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"})}),Xw=e=>l.jsxs("svg",{...q(e),children:[l.jsx("path",{d:"M12 20h9"}),l.jsx("path",{d:"M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4Z"})]}),Zw=e=>l.jsxs("svg",{...q(e),children:[l.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8Z"}),l.jsx("path",{d:"M14 2v6h6"})]}),qw=e=>l.jsxs("svg",{...q(e),children:[l.jsx("path",{d:"M12 17v5"}),l.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"})]}),Kx=e=>l.jsx("svg",{...q(e),children:l.jsx("path",{d:"M20 6 9 17l-5-5"})}),eS=({open:e,...t})=>e?l.jsxs("svg",{...q(t),children:[l.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"}),l.jsx("path",{d:"m22 10-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 10"})]}):l.jsxs("svg",{...q(t),children:[l.jsx("rect",{width:"20",height:"16",x:"2",y:"4",rx:"2"}),l.jsx("path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7"})]}),tS=e=>l.jsxs("svg",{...q(e),children:[l.jsx("circle",{cx:"6",cy:"6",r:"3"}),l.jsx("circle",{cx:"6",cy:"18",r:"3"}),l.jsx("circle",{cx:"18",cy:"6",r:"3"}),l.jsx("path",{d:"M6 9v6M18 9a9 9 0 0 1-9 9"})]}),nS=e=>l.jsxs("svg",{...q(e),children:[l.jsx("path",{d:"M9.5 14.5l-1.7 1.7a4 4 0 0 1-5.66-5.66l1.7-1.7"}),l.jsx("path",{d:"M14.5 9.5l1.7-1.7a4 4 0 0 1 5.66 5.66l-1.7 1.7"}),l.jsx("path",{d:"M8 3.5v2M3.5 8h2M16 20.5v-2M20.5 16h-2"})]}),rS=e=>l.jsxs("svg",{...q(e),children:[l.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),l.jsx("path",{d:"M17 8l-5-5-5 5M12 3v12"})]}),sS=e=>l.jsx("svg",{...q(e),children:l.jsx("path",{d:"M4 17l6-5-6-5M12 19h8"})}),oS=e=>l.jsx("svg",{...q(e),children:l.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"})}),Gx=e=>l.jsxs("svg",{...q(e),children:[l.jsx("circle",{cx:"12",cy:"12",r:"4"}),l.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"})]}),Yx=e=>l.jsx("svg",{...q(e),children:l.jsx("path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z"})}),Jx=e=>l.jsxs("svg",{...q(e),children:[l.jsx("path",{d:"M10 13a5 5 0 0 0 7.5.5l3-3a5 5 0 0 0-7-7l-1.5 1.5"}),l.jsx("path",{d:"M14 11a5 5 0 0 0-7.5-.5l-3 3a5 5 0 0 0 7 7l1.5-1.5"})]}),iS=e=>l.jsx("svg",{...q(e),children:l.jsx("path",{d:"m6 9 6 6 6-6"})}),aS=e=>l.jsxs("svg",{...q(e),children:[l.jsx("rect",{x:"3",y:"4",width:"18",height:"4",rx:"1"}),l.jsx("path",{d:"M5 8v11a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V8"}),l.jsx("path",{d:"M10 12h4"})]}),lS=e=>l.jsx("svg",{...q(e),children:l.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"})});function Xx({message:e,tone:t="success",onDismiss:n,durationMs:r=6e3,action:s}){if(w.useEffect(()=>{if(e===null||r<=0)return;const i=setTimeout(n,r);return()=>clearTimeout(i)},[e,r,n]),e===null)return null;const o=t==="error";return l.jsx("div",{role:"status","aria-live":"polite",className:"pointer-events-none fixed inset-x-0 bottom-4 z-50 flex justify-center px-4",children:l.jsxs("div",{className:`pointer-events-auto flex max-w-md items-start gap-2 rounded-lg border px-3 py-2 text-sm shadow-lg ${o?"border-danger-edge bg-danger-soft text-danger":"border-edge bg-surface-raised text-fg"}`,children:[o?l.jsx(Hx,{width:16,height:16,className:"mt-0.5 shrink-0"}):l.jsx(Kx,{width:16,height:16,className:"mt-0.5 shrink-0 text-success-solid"}),l.jsx("span",{className:"break-words",children:e}),s&&l.jsx("button",{type:"button",onClick:s.onAct,className:"ml-1 shrink-0 font-medium underline underline-offset-2 transition hover:opacity-80",children:s.label}),l.jsx("button",{type:"button",onClick:n,"aria-label":"Dismiss notification",className:"-mr-1 ml-1 flex h-5 w-5 shrink-0 items-center justify-center rounded transition hover:bg-surface-hover",children:l.jsx($i,{width:12,height:12})})]})})}function Zx(){const{showBanner:e,dismiss:t}=Pp(),n=Zs(),[r,s]=w.useState(!1),[o,i]=w.useState(null),[a,u]=w.useState(!1),c=()=>{t(),i("Hidden on this browser. The migration is still on the Config screen.")};return l.jsxs(l.Fragment,{children:[e&&!a&&l.jsxs("div",{"data-testid":"migration-offer",className:"flex h-6 shrink-0 items-center rounded-md border border-accent-edge bg-accent-soft pr-0.5",children:[l.jsxs("button",{type:"button",onClick:()=>s(!0),title:"Your chats live in Paddock's own store, not in ~/.claude. Merge them in so the Claude Code CLI sees them too.","aria-label":"Merge this instance's chats into your ~/.claude",className:"focus-visible:focus-ring flex h-6 items-center gap-1.5 rounded-md pl-2 pr-1.5 text-2xs can-hover:hover:underline",children:[l.jsx("span",{className:"h-1.5 w-1.5 shrink-0 rounded-[1px] bg-accent-solid","aria-hidden":"true"}),l.jsxs("span",{className:"hidden whitespace-nowrap text-fg-muted sm:inline",children:["Chats are separate from ",l.jsx("span",{className:"font-mono",children:"~/.claude"})]}),l.jsxs("span",{className:"whitespace-nowrap font-semibold text-accent",children:["Merge",l.jsx("span",{className:"sm:hidden",children:" chats"})]})]}),l.jsx("button",{type:"button","data-testid":"migration-offer-dismiss",onClick:c,"aria-label":"Hide the transcript migration offer",title:"Hide this. You can still start the migration from the Config screen.",className:"focus-visible:focus-ring flex h-5 w-5 shrink-0 items-center justify-center rounded text-accent can-hover:hover:bg-accent-solid/15",children:l.jsx($i,{width:11,height:11})})]}),l.jsx(Ip,{open:r,onClose:()=>s(!1),onCompleted:()=>u(!0)}),l.jsx(Xx,{message:o,onDismiss:()=>i(null),durationMs:12e3,action:{label:"Open Config",onAct:()=>{i(null),n("/config")}}})]})}function uS(){const{showInConfig:e}=Pp(),[t,n]=w.useState(!1),[r,s]=w.useState(!1);return e?l.jsxs("div",{className:"px-3 pt-3 sm:px-6","data-testid":"migration-offer-card",children:[!r&&l.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-2 rounded-xl border border-accent-edge bg-accent-soft px-3 py-2.5",children:[l.jsxs("div",{className:"min-w-0 flex-1",children:[l.jsxs("p",{className:"text-sm font-semibold text-fg",children:["Chats are separate from ",l.jsx("span",{className:"font-mono",children:"~/.claude"})]}),l.jsxs("p",{className:"mt-0.5 text-xs text-fg-muted",children:["This instance keeps its transcripts in each project's own store, so the Claude Code CLI does not see them. Merging moves them into your Claude home and switches"," ",l.jsx("span",{className:"font-mono",children:"claude.transcripts"})," to"," ",l.jsx("span",{className:"font-mono",children:"host"}),"."]})]}),l.jsx(jt,{variant:"primary",size:"sm",onClick:()=>n(!0),children:"Merge chats…"})]}),l.jsx(Ip,{open:t,onClose:()=>n(!1),onCompleted:()=>s(!0)})]}):null}const qx="(min-width: 1280px)",e1="(min-width: 900px)",t1=1;function n1(){const e=Sl(qx),t=Sl(e1);return e?3:t?2:t1}const ya=6,r1=.75,s1=.9,o1=250,i1=3e4;function a1(e){const[,t]=w.useState(0);w.useEffect(()=>{if(!e)return;const n=setInterval(()=>t(r=>r+1),1e3);return()=>clearInterval(n)},[e])}function l1(){const[e,t]=w.useState(new Map);return w.useEffect(()=>Cu.onActiveInfos(n=>t(new Map(n))),[]),e}function u1(e){const[t,n]=w.useState(new Map),r=w.useRef(0);return w.useEffect(()=>{if(!e){r.current++,n(new Map);return}let s=!1;const o=async()=>{const u=++r.current;try{const c=await or.attentionChats(ju);if(s||u!==r.current)return;n(new Map(c.running.map(d=>[d.sessionId,d])))}catch{}},i=setTimeout(()=>void o(),o1),a=setInterval(()=>{document.visibilityState==="visible"&&o()},i1);return()=>{s=!0,clearTimeout(i),clearInterval(a)}},[e]),t}function c1({fill:e}){const t=e<=0?0:Math.max(1,Math.min(ya,Math.round(e*ya))),n=e<r1?"bg-accent-solid":e<s1?"bg-warn-solid":"bg-danger-solid";return l.jsx("span",{className:"flex items-center gap-px",title:`Context ${Math.round(e*100)}% full`,"aria-hidden":"true",children:Array.from({length:ya},(r,s)=>l.jsx("span",{className:st("h-2.5 w-[3px] rounded-[1px]",s<t?n:"bg-edge")},s))})}function d1({projectSlug:e,projectName:t,chatName:n,sessionId:r,startedAt:s,fill:o}){const i=s==null?"—:—":X0(Date.now()-s),a=n??"Running turn";return l.jsxs(Vs,{"data-testid":"fleet-channel",to:`${T0(e)}/chat/${encodeURIComponent(r)}`,title:`${a} — ${t}`,"aria-label":`${a} in ${t}, running${s==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:[l.jsx("span",{className:"h-1.5 w-1.5 shrink-0 rounded-[1px] bg-accent-solid","aria-hidden":"true"}),l.jsx("span",{className:"max-w-[14ch] truncate font-medium text-fg",children:t}),l.jsx("span",{className:"font-mono tabular text-fg-muted",children:i}),o!=null&&l.jsx(c1,{fill:o})]})}function Md({value:e,unit:t,to:n,tone:r,title:s}){return l.jsxs(Vs,{"data-testid":`fleet-${t}`,to:n,title:s,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:[l.jsx("span",{"aria-hidden":"true",className:st("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")}),l.jsx("span",{"data-testid":`fleet-${t}-value`,className:"font-mono tabular text-2xs font-semibold text-fg",children:e}),l.jsx("span",{className:"text-3xs font-semibold uppercase tracking-[0.14em] text-fg-subtle",children:t})]})}function f1({unread:e}){const{projects:t,rootWorkspace:n}=Sp(),r=l1(),s=w.useMemo(()=>[...r.keys()].sort().join(","),[r]),o=u1(s);a1(r.size>0);const i=n1(),a=w.useMemo(()=>{const y=new Map;for(const k of t)y.set(k.slug,k.name);return n&&y.set(n.slug,n.name),y},[t,n]),u=w.useMemo(()=>[...r.entries()].map(([y,k])=>{const S=o.get(y);return{sessionId:y,projectSlug:k,projectName:a.get(k)??(S==null?void 0:S.projectName)??k,chatName:(S==null?void 0:S.name)??null,startedAt:Cu.turnStartedAt(y),fill:(S==null?void 0:S.contextTokens)!=null&&S.contextLimit?Math.min(1,S.contextTokens/S.contextLimit):null}}).sort((y,k)=>(y.startedAt??1/0)-(k.startedAt??1/0)),[r,o,a]),c=u.slice(0,i),d=u.length-c.length,f=w.useMemo(()=>{let y="";for(const k of n?[...t,n]:t)for(const S of k.chatTurns??[])S.lastTurnCompletedAt>y&&(y=S.lastTurnCompletedAt);return y},[t,n]),p=r.size===0?`Fleet idle. ${e} unread.`:`${r.size} running. ${e} unread.`;return l.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:[l.jsx(Md,{value:r.size,unit:"running",to:"/",tone:r.size>0?"live":"rest",title:r.size>0?"Turns in flight across every project":"Nothing running"}),l.jsx(Md,{value:e,unit:"unread",to:"/",tone:e>0?"attention":"rest",title:"Chats holding a reply you have not read"}),l.jsx("span",{className:"h-4 w-px shrink-0 bg-edge-subtle","aria-hidden":"true"}),l.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-1.5 overflow-hidden",children:[c.map(y=>l.jsx(d1,{projectSlug:y.projectSlug,projectName:y.projectName,chatName:y.chatName,sessionId:y.sessionId,startedAt:y.startedAt,fill:y.fill},y.sessionId)),d>0&&l.jsxs(Vs,{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]}),u.length===0&&(f?l.jsxs("span",{className:"truncate text-2xs text-fg-subtle",children:["Idle · last turn ",wl(f)]}):l.jsx(Vs,{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 →"}))]}),l.jsx(Zx,{}),l.jsx("span",{role:"status","aria-live":"polite",className:"sr-only",children:p})]})}const h1=["idea","active","paused","blocked","done"];function p1({open:e,onClose:t,onCreated:n}){const[r,s]=w.useState(""),[o,i]=w.useState(""),[a,u]=w.useState(""),[c,d]=w.useState(""),[f,p]=w.useState("active"),[y,k]=w.useState(""),[S,C]=w.useState(""),[g,h]=w.useState(!1),[m,E]=w.useState(!1),[R,P]=w.useState(null);if(w.useEffect(()=>{e&&(s(""),i(""),u(""),d(""),p("active"),k(""),C(""),h(!1),P(null))},[e]),w.useEffect(()=>{const v=D=>{D.key==="Escape"&&e&&!m&&t()};return window.addEventListener("keydown",v),()=>window.removeEventListener("keydown",v)},[e,m,t]),!e)return null;const _=async v=>{if(v.preventDefault(),!!r.trim()){E(!0),P(null);try{const D=await or.createProject({name:r.trim(),status:f,group:c||void 0,summary:o.trim()||void 0,repo:y.trim()||void 0,path:S.trim()||void 0,managed:S.trim()&&!y.trim()?g:void 0,domain:a.split(",").map(L=>L.trim()).filter(Boolean)});n(D)}catch(D){P(D instanceof On?D.message:"Failed to create project")}finally{E(!1)}}};return l.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-overlay p-4 backdrop-blur-sm",onClick:()=>!m&&t(),children:l.jsxs("form",{className:"w-full max-w-md animate-scale-in rounded-2xl border border-edge bg-surface-raised p-6 shadow-2xl",onClick:v=>v.stopPropagation(),onSubmit:_,children:[l.jsxs("div",{className:"mb-5 flex items-center justify-between",children:[l.jsx("h2",{className:"text-lg font-semibold",children:"New project"}),l.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:l.jsx($i,{width:18,height:18})})]}),l.jsxs("label",{className:"mb-4 block",children:[l.jsx("span",{className:"field-label",children:"Name"}),l.jsx("input",{autoFocus:!0,className:"input",value:r,onChange:v=>s(v.target.value),placeholder:"Garage Water Heater Replacement"})]}),l.jsxs("label",{className:"mb-4 block",children:[l.jsx("span",{className:"field-label",children:"Summary (optional)"}),l.jsx("input",{className:"input",value:o,onChange:v=>i(v.target.value),placeholder:"One line on what this project is about"})]}),l.jsxs("label",{className:"mb-4 block",children:[l.jsx("span",{className:"field-label",children:"Area"}),l.jsxs("select",{className:"input",value:c,onChange:v=>d(v.target.value),children:[l.jsx("option",{value:"",children:"Unsorted"}),Nu.map(v=>l.jsx("option",{value:v.slug,children:v.label},v.slug))]})]}),l.jsxs("label",{className:"mb-4 block",children:[l.jsx("span",{className:"field-label",children:"Directory on this machine (optional)"}),l.jsx("input",{className:"input",value:S,onChange:v=>C(v.target.value),placeholder:"/home/ed/Code/foo"}),l.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."})]}),l.jsxs("label",{className:"mb-4 block",children:[l.jsx("span",{className:"field-label",children:"Git repository URL (optional)"}),l.jsx("input",{className:"input",value:y,onChange:v=>k(v.target.value),placeholder:"https://github.com/owner/repo.git"}),l.jsx("span",{className:"mt-1 block text-xs text-fg-subtle",children:S.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."})]}),S.trim()&&!y.trim()&&l.jsxs("label",{className:"mb-4 flex cursor-pointer items-start gap-2",children:[l.jsx("input",{type:"checkbox",className:"mt-0.5",checked:g,onChange:v=>h(v.target.checked)}),l.jsxs("span",{className:"text-xs text-fg-muted",children:[l.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."]})]}),l.jsxs("div",{className:"mb-5 grid grid-cols-2 gap-3",children:[l.jsxs("label",{className:"block",children:[l.jsx("span",{className:"field-label",children:"Domain tags"}),l.jsx("input",{className:"input",value:a,onChange:v=>u(v.target.value),placeholder:"home, plumbing"})]}),l.jsxs("label",{className:"block",children:[l.jsx("span",{className:"field-label",children:"Status"}),l.jsx("select",{className:"input capitalize",value:f,onChange:v=>p(v.target.value),children:h1.map(v=>l.jsx("option",{value:v,className:"capitalize",children:v},v))})]})]}),R&&l.jsx("p",{className:"mb-4 rounded-lg bg-danger-soft px-3 py-2 text-sm text-danger",children:R}),l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsx("button",{type:"button",className:"btn-ghost",onClick:t,disabled:m,children:"Cancel"}),l.jsx("button",{type:"submit",className:"btn-primary",disabled:m||!r.trim(),children:m?"Creating…":"Create project"})]})]})})}const Ru="paddock:panewidth:",m1={key:"sidenav",def:288,min:200,max:480},cS={key:"chatlist",def:256,min:220,max:520},g1="(min-width: 1024px)";function Ir(e,t){return Math.min(Math.max(t,e.min),e.max)}function _d(e,t,n){return Ir(n,e+t)}function v1(e){try{const t=localStorage.getItem(Ru+e.key);if(t==null)return null;const n=Number.parseFloat(t);return Number.isFinite(n)?Ir(e,n):null}catch{return null}}function y1(e,t){try{localStorage.setItem(Ru+e.key,String(Ir(e,t)))}catch{}}function x1(e){try{localStorage.removeItem(Ru+e.key)}catch{}}function w1(e){const t=Sl(g1),[n,r]=w.useState(()=>v1(e)),s=Ir(e,n??e.def);return{isDesktop:t,width:s,style:t?{width:s}:void 0,preview:o=>r(Ir(e,o)),commit:o=>{const i=Ir(e,o);r(i),y1(e,i)},reset:()=>{r(null),x1(e)},spec:e}}function S1({spec:e,width:t,onPreview:n,onCommit:r,onReset:s,label:o}){const i=w.useRef(null),a=w.useRef(t);a.current=t;const u=16;return l.jsx("div",{role:"separator","aria-orientation":"vertical","aria-label":o,"aria-valuenow":Math.round(t),"aria-valuemin":e.min,"aria-valuemax":e.max,tabIndex:0,onPointerDown:c=>{i.current={startX:c.clientX,startWidth:t},c.currentTarget.setPointerCapture(c.pointerId)},onPointerMove:c=>{i.current&&n(_d(i.current.startWidth,c.clientX-i.current.startX,e))},onPointerUp:c=>{if(i.current){i.current=null;try{c.currentTarget.releasePointerCapture(c.pointerId)}catch{}r(a.current)}},onDoubleClick:s,onKeyDown:c=>{if(c.key==="ArrowLeft"||c.key==="ArrowRight"){c.preventDefault();const d=_d(t,c.key==="ArrowRight"?u:-u,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:l.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 k1(e){const[t,n]=w.useState(new Map),r=w.useRef(new Map),[s,o]=w.useState(0);return w.useEffect(()=>{const i=r.current;for(const a of e)for(const u of a.chatTurns??[]){Q0(u.sessionId,u.lastSeen);const c=Date.parse(u.lastTurnCompletedAt);if(!Number.isFinite(c))continue;const d=i.get(u.sessionId);!d||c>d.at?i.set(u.sessionId,{slug:a.slug,at:c,unread:u.unread}):d.unread=u.unread}if(e.length>0){const a=new Set(e.map(u=>u.slug));for(const[u,c]of i)a.has(c.slug)||i.delete(u)}o(a=>a+1)},[e]),w.useEffect(()=>{const i=a=>{var d;const u=((d=a.detail)==null?void 0:d.sessionIds)??[];let c=!1;for(const f of u)c=r.current.delete(f)||c;c&&o(f=>f+1)};return window.addEventListener(xl,i),()=>window.removeEventListener(xl,i)},[]),w.useEffect(()=>{const i=new Map;return Cu.onActiveInfos(a=>{for(const[u,c]of i)a.has(u)||r.current.set(u,{slug:c,at:Date.now()});i.clear();for(const[u,c]of a)i.set(u,c);n(new Map(a)),o(u=>u+1)})},[]),w.useEffect(()=>{const i=()=>o(a=>a+1);return window.addEventListener(yl,i),()=>window.removeEventListener(yl,i)},[]),w.useMemo(()=>{const i=new Map,a=u=>{let c=i.get(u);return c||(c={unread:0,inflight:0},i.set(u,c)),c};for(const[u,{slug:c,at:d,unread:f}]of r.current)!t.has(u)&&(f||d>H0(u))&&(a(c).unread+=1);for(const u of t.values())a(u).inflight+=1;return i},[t,s])}function j1(){const{projects:e,rootWorkspace:t,loading:n,upsert:r}=Sp(),{dark:s,toggle:o}=D0(),[i,a]=w.useState(!1),[u,c]=w.useState(!1),d=Zs(),f=lr(),p=jp(),y=$0(),k=w1(m1),S=f.pathname==="/"||f.pathname==="/projects"||f.pathname.startsWith("/chat"),C=f.pathname.startsWith("/projects/")||S;w.useEffect(()=>{a(!1)},[f.pathname]),w.useEffect(()=>{document.title=p.name},[p.name]);const g=w.useMemo(()=>{const P=new Map;for(const _ of e){const v=_.group??"",D=P.get(v);D?D.push(_):P.set(v,[_])}return F0(P.keys()).map(_=>[_,P.get(_)??[]])},[e]),h=w.useMemo(()=>t?[...e,t]:e,[e,t]),m=k1(h),E=m.get(ju),R=w.useMemo(()=>{let P=0;for(const _ of m.values())P+=_.unread;return P},[m]);return l.jsxs("div",{className:"flex h-[100dvh] flex-col overflow-hidden bg-surface lg:flex-row",children:[!C&&l.jsxs("header",{className:"pt-safe flex items-center gap-2 border-b border-edge px-3 pb-2 lg:hidden",children:[l.jsx("button",{type:"button",onClick:()=>a(!0),"aria-label":"Open menu",className:"btn-subtle -ml-1 px-2 py-2",children:l.jsx(Qx,{width:20,height:20})}),l.jsxs(gn,{to:"/",className:"flex items-center gap-2",children:[l.jsx(Ld,{brand:p,className:"h-7 w-7 text-sm"}),l.jsx("span",{className:"text-md font-semibold tracking-tight",children:p.name})]})]}),i&&l.jsx("div",{className:"fixed inset-0 z-30 bg-overlay backdrop-blur-sm lg:hidden","aria-hidden":"true",onClick:()=>a(!1)}),l.jsxs("aside",{style:k.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:[k.isDesktop&&l.jsx(S1,{spec:k.spec,width:k.width,onPreview:k.preview,onCommit:k.commit,onReset:k.reset,label:"Resize sidebar"}),l.jsxs("div",{className:"flex items-center gap-2 px-5 py-4",children:[l.jsxs(gn,{to:"/",className:"group flex items-center gap-2",children:[l.jsx(Ld,{brand:p,className:"h-8 w-8 text-base"}),l.jsx("span",{className:"text-lg font-semibold tracking-tight",children:p.name})]}),l.jsx("button",{type:"button",onClick:()=>a(!1),"aria-label":"Close menu",className:"btn-subtle ml-auto px-2 py-2 lg:hidden",children:l.jsx($i,{width:18,height:18})})]}),l.jsx("div",{className:"px-3 pb-1",children:l.jsxs(gn,{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:[l.jsx(Bx,{width:16,height:16}),"Home",l.jsx(Ap,{badge:E,className:"ml-auto"})]})}),l.jsxs("div",{className:"mt-5 mb-1 flex items-center justify-between pr-3",children:[l.jsx(gn,{to:R0(),className:"section-label hover:text-accent",children:"Projects"}),l.jsxs("div",{className:"flex items-center gap-0.5",children:[l.jsx(gn,{to:"/discover","aria-label":"Discover projects",title:"Find directories with existing Claude Code history to import",className:({isActive:P})=>`btn-subtle px-1.5 py-1 hover:text-accent ${P?"text-accent":"text-fg-subtle"}`,children:l.jsx(Rd,{width:14,height:14})}),l.jsx("button",{type:"button",onClick:()=>c(!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:l.jsx(Ux,{width:14,height:14})})]})]}),l.jsxs("nav",{className:"flex-1 overflow-y-auto px-2 pb-4",children:[n&&l.jsx("div",{className:"space-y-2 px-2 py-2",children:[0,1,2].map(P=>l.jsx("div",{className:"h-10 animate-pulse rounded-lg bg-surface-active"},P))}),!n&&e.length===0&&l.jsx("p",{className:"px-3 py-2 text-sm text-fg-muted",children:"No projects yet."}),!n&&e.length>0&&g.map(([P,_])=>l.jsxs("div",{className:"mb-2",children:[g.length>1&&l.jsx("div",{className:"px-2.5 pb-1 pt-2 text-3xs font-semibold uppercase tracking-wider text-fg-subtle",children:A0(P)}),_.map(v=>l.jsx(N1,{project:v,badge:m.get(v.slug)},v.slug))]},P||"unsorted"))]}),l.jsxs("div",{className:"border-t border-edge px-3 py-3",children:[l.jsxs(gn,{to:"/config",className:({isActive:P})=>`btn-subtle w-full justify-start ${P?"bg-surface-selected":""}`,title:"Instance config — paddock.config.yaml (restart required)",children:[l.jsx(Vx,{width:15,height:15}),"Config"]}),l.jsxs(gn,{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:[l.jsx(Rd,{width:15,height:15}),"Discover"]}),y.enabled&&l.jsxs("a",{href:y.path,target:"_blank",rel:"noreferrer",className:"btn-subtle mt-1 w-full justify-start",title:"OpenAPI / Swagger reference (opens in a new tab)",children:[l.jsx(Jx,{width:15,height:15}),"Swagger API"]}),l.jsxs("button",{type:"button",onClick:o,className:"btn-subtle mt-1 w-full justify-start","aria-label":s?"Switch to light mode":"Switch to dark mode",title:"Toggle light / dark theme",children:[s?l.jsx(Gx,{width:15,height:15}):l.jsx(Yx,{width:15,height:15}),s?"Light mode":"Dark mode"]}),l.jsxs("p",{className:"mt-2 px-2 text-2xs text-fg-subtle",children:["v","0.74.3"]})]})]}),l.jsxs("div",{className:"flex min-w-0 flex-1 flex-col overflow-hidden",children:[l.jsx(f1,{unread:R}),l.jsx("main",{className:"min-h-0 min-w-0 flex-1 overflow-hidden",children:l.jsx(w.Suspense,{fallback:l.jsx(E1,{}),children:l.jsx(s0,{context:{openNav:()=>a(!0)}})})})]}),l.jsx(p1,{open:u,onClose:()=>c(!1),onCreated:P=>{r(P),c(!1),d(`/projects/${P.slug}/chat`)}})]})}function Ld({brand:e,className:t=""}){return l.jsx("span",{className:`flex shrink-0 items-center justify-center overflow-hidden rounded-lg bg-accent-solid text-accent-fg shadow-sm ${t}`,children:z0(e.logo)?l.jsx("img",{src:e.logo,alt:"",className:"h-full w-full object-cover"}):e.logo})}function E1(){return l.jsxs("div",{className:"flex h-full items-center justify-center","aria-busy":"true","aria-live":"polite",children:[l.jsx("span",{className:"h-6 w-6 animate-spin rounded-full border-2 border-edge-strong border-t-accent"}),l.jsx("span",{className:"sr-only",children:"Loading…"})]})}function N1({project:e,badge:t}){return l.jsxs(gn,{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:[l.jsxs("span",{className:"flex items-center justify-between gap-2",children:[l.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[l.jsx(Wx,{width:13,height:13,className:"shrink-0 text-fg-subtle group-hover:text-fg-muted"}),l.jsx("span",{className:"truncate font-medium",children:e.name})]}),l.jsx(Ap,{badge:t})]}),e.domain.length>0&&l.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden pl-[18px]",children:[e.domain.slice(0,2).map(n=>l.jsx(K0,{tag:n,className:"max-w-[7rem] truncate"},n)),e.domain.length>2&&l.jsxs("span",{className:"shrink-0 text-2xs text-fg-subtle",children:["+",e.domain.length-2]})]})]})}function Ap({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:l.jsxs("span",{className:`flex shrink-0 items-center gap-1.5 ${t}`,children:[r>0&&l.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:[l.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&&l.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 Fp="paddock:chunkReloadAt",C1=1e4,bd=/dynamically imported module|module script|importing a module|failed to fetch|unable to preload|load failed|error loading/i;function P1(e){return e?e instanceof Error?e.name==="ChunkLoadError"?!0:bd.test(e.message):bd.test(String(e)):!1}function Mu(){try{return typeof sessionStorage<"u"?sessionStorage:void 0}catch{return}}function T1(e=Date.now(),t=Mu()){if(!t)return!1;const n=t.getItem(Fp);if(!n)return!1;const r=Number(n);return Number.isFinite(r)&&e-r<C1}function R1(e=Date.now(),t=Mu()){try{t==null||t.setItem(Fp,String(e))}catch{}}function M1(e,t=Date.now(),n=Mu()){return P1(e)&&!T1(t,n)?"reload":"show"}function _1(){const e=vp(),t=M1(e);if(w.useEffect(()=>{t==="reload"&&(R1(),window.location.reload())},[t]),t==="reload")return l.jsxs("div",{className:"flex h-[100dvh] items-center justify-center bg-surface","aria-busy":"true","aria-live":"polite",children:[l.jsx("span",{className:"h-6 w-6 animate-spin rounded-full border-2 border-edge-strong border-t-accent"}),l.jsx("span",{className:"sr-only",children:"Updating…"})]});const n=e instanceof Error?e.message:typeof e=="string"?e:"";return l.jsxs("div",{className:"flex h-[100dvh] flex-col items-center justify-center gap-4 bg-surface px-6 text-center",children:[l.jsxs("div",{children:[l.jsx("h1",{className:"text-lg font-semibold tracking-tight",children:"Something went wrong"}),l.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?l.jsx("p",{className:"mt-2 max-w-md break-words font-mono text-2xs text-fg-subtle",children:n}):null]}),l.jsx("button",{className:"btn-primary",onClick:()=>window.location.reload(),children:"Reload"})]})}function L1(){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 _u=e=>e<0?0:e>1?1:e;function Lu(e){return e<=.0031308?12.92*e:1.055*Math.pow(e,1/2.4)-.055}function It(e){return e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function bu({L:e,a:t,b:n}){const r=(e+.3963377774*t+.2158037573*n)**3,s=(e-.1055613458*t-.0638541728*n)**3,o=(e-.0894841775*t-1.291485548*n)**3;return[4.0767416621*r-3.3077115913*s+.2309699292*o,-1.2684380046*r+2.6097574011*s-.3413193965*o,-.0041960863*r-.7034186147*s+1.707614701*o]}function jl(e,t,n){const r=Math.cbrt(.4122214708*e+.5363325363*t+.0514459929*n),s=Math.cbrt(.2119034982*e+.6806995451*t+.1073969566*n),o=Math.cbrt(.0883024619*e+.2817188376*t+.6299787005*n);return{L:.2104542553*r+.793617785*s-.0040720468*o,a:1.9779984951*r-2.428592205*s+.4505937099*o,b:.0259040371*r+.7827717662*s-.808675766*o}}function Hs(e,t,n,r=1){const s=n*Math.PI/180,o=bu({L:e,a:t*Math.cos(s),b:t*Math.sin(s)}),[i,a,u]=o.map(c=>_u(Lu(c)));return{r:i,g:a,b:u,a:r}}function Id(e,t,n){const r=n*Math.PI/180;return bu({L:e,a:t*Math.cos(r),b:t*Math.sin(r)}).map(Lu).every(s=>s>=-.0015&&s<=1.0015)}function xn({r:e,g:t,b:n}){const r=s=>Math.round(_u(s)*255).toString(16).padStart(2,"0");return`#${r(e)}${r(t)}${r(n)}`}function qe({r:e,g:t,b:n}){const[r,s,o]=[e,t,n].map(It);return .2126*r+.7152*s+.0722*o}function b1(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 Ke(e,t){const n=qe(b1(e,t)),r=qe(t),[s,o]=n>r?[n,r]:[r,n];return(s+.05)/(o+.05)}const Dd={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 xa(e){const t=[];let n=0,r="";for(const s of e)s==="("?n++:s===")"&&n--,s===","&&n===0?(t.push(r.trim()),r=""):r+=s;return r.trim()&&t.push(r.trim()),t}function hr(e,t){return!e.startsWith(`${t}(`)||!e.endsWith(")")?null:e.slice(t.length+1,-1)}function pn(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 Pr(e,t,n=0){if(n>24)throw new Error(`var() cycle resolving ${e}`);const r=e.trim();if(Dd[r])return Dd[r];if(r.startsWith("#")){let u=r.slice(1);if(u.length===3&&(u=[...u].map(d=>d+d).join("")),u.length!==6)throw new Error(`bad hex: ${r}`);const c=parseInt(u,16);return{r:(c>>16&255)/255,g:(c>>8&255)/255,b:(c&255)/255,a:1}}const s=hr(r,"var");if(s!==null){const[u,...c]=xa(s),d=t[u]??c.join(",");if(!d)throw new Error(`undefined custom property: ${u}`);return Pr(d,t,n+1)}const o=hr(r,"oklch");if(o!==null){const[u,c]=o.split("/"),d=u.trim().split(/\s+/);if(d.length!==3)throw new Error(`bad oklch(): ${r}`);return Hs(pn(d[0]),pn(d[1]),pn(d[2]),c?pn(c.trim()):1)}const i=hr(r,"rgb")??hr(r,"rgba");if(i!==null){const u=i.trim(),c=hr(u,"var");if(c!==null){const[y]=xa(c),k=t[y];if(!k)throw new Error(`undefined custom property: ${y}`);return Pr(`rgb(${k})`,t,n+1)}const[d,f]=u.split("/"),p=d.trim().split(/[\s,]+/);if(p.length<3)throw new Error(`bad rgb(): ${r}`);return{r:pn(p[0])/255,g:pn(p[1])/255,b:pn(p[2])/255,a:f?pn(f.trim()):1}}const a=hr(r,"color-mix");if(a!==null){const[u,c,d]=xa(a),f=u.trim();if(f!=="in oklab"&&f!=="in srgb")throw new Error(`only \`in oklab\` and \`in srgb\` color-mix are supported, got: ${u}`);const p=Od(c),y=Od(d);let k=p.pct,S=y.pct;k===null&&S===null?(k=.5,S=.5):k===null?k=1-S:S===null&&(S=1-k);const C=k+S,g=k/C,h=Pr(p.color,t,n+1),m=Pr(y.color,t,n+1);return f==="in srgb"?I1(h,m,g):D1(h,m,g)}throw new Error(`unsupported colour value: ${r}`)}function Od(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 I1(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 D1(e,t,n){const r=jl(It(e.r),It(e.g),It(e.b)),s=jl(It(t.r),It(t.g),It(t.b)),o={L:r.L*n+s.L*(1-n),a:r.a*n+s.a*(1-n),b:r.b*n+s.b*(1-n)},[i,a,u]=bu(o).map(c=>_u(Lu(c)));return{r:i,g:a,b:u,a:e.a*n+t.a*(1-n)}}function bn({r:e,g:t,b:n}){const{L:r,a:s,b:o}=jl(It(e),It(t),It(n)),i=Math.hypot(s,o),a=i<1e-6?0:(Math.atan2(o,s)*180/Math.PI+360)%360;return{L:r,C:i,H:a}}const Dt=4.5,Up=3,Tt=.12,Bp=["--accent","--accent-600","--accent-700","--accent-solid","--accent-solid-hover","--accent-text"];function gt(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 Pr(r,{})}catch{return null}}function O1(e,t,n){let r=0,s=1;for(let o=0;o<32;o++){const i=(r+s)/2;qe(Hs(i,t,n))<e?r=i:s=i}return(r+s)/2}function Wp(e,t,n){if(Id(e,t,n))return t;let r=0,s=t;for(let o=0;o<24;o++){const i=(r+s)/2;Id(e,i,n)?r=i:s=i}return r}function wa(e,t,n,r,s){const o=qe(r);let i=t,a=.5;for(let u=0;u<4;u++){const c=O1(o,i,n);let d=s?0:c,f=s?c:1;for(let p=0;p<28;p++){const y=(d+f)/2,k=Ke(Hs(y,i,n),r)>=e;s?k?d=y:f=y:k?f=y:d=y}a=s?d:f,i=Wp(a,t,n)}return{L:a,C:i,rgb:Hs(a,i,n)}}const $1=.75;function Dr(e,t,n,r,s,o=e){const i=wa(e,t,n,r,s),a=f=>f.C>=t*$1;if(a(i)||o>=e)return{...i,hit:Ke(i.rgb,r)>=e-.01};let u=o,c=e,d=wa(o,t,n,r,s);for(let f=0;f<16;f++){const p=(u+c)/2,y=wa(p,t,n,r,s);a(y)?(d=y,u=p):c=p}return{...d,hit:Ke(d.rgb,r)>=o-.01}}function Sa({r:e,g:t,b:n}){const r=s=>Math.round(Math.max(0,Math.min(1,s))*255);return`${r(e)} ${r(t)} ${r(n)}`}const Vp=["--surface","--surface-raised","--surface-sunken","--surface-hover","--surface-active","--surface-selected","--border-subtle","--border","--border-strong","--text","--text-muted","--text-subtle","--scroll-thumb"],$d=["--text","--text-muted","--text-subtle"],z1=["--surface","--surface-raised","--surface-sunken","--surface-hover","--surface-active","--surface-selected"];function Hp(e=document.documentElement){for(const t of Vp)e.style.removeProperty(t)}function A1(e,t,n=document.documentElement){Hp(n);for(const s of Vp){const o=gt(n,s);if(!o)continue;const{L:i,C:a}=bn(o),u=$d.includes(s),c=Math.max(a,t*(u?.5:1));n.style.setProperty(s,xn(Hs(i,Wp(i,c,e),e)))}let r=1/0;for(const s of $d){const o=gt(n,s);if(o)for(const i of z1){const a=gt(n,i);a&&(r=Math.min(r,Ke(o,a)))}}return r}function Qp(e=document.documentElement){for(const t of Bp)e.style.removeProperty(t)}function Kp(e,t){const n=Bp.map(r=>[r,e.style.getPropertyValue(r)]);Qp(e);try{return t()}finally{for(const[r,s]of n)s&&e.style.setProperty(r,s)}}function F1(e=document.documentElement){return Kp(e,()=>{const t=gt(e,"--accent");return t?bn(t).H:0})}const us={r:1,g:1,b:1,a:1};function Gp(e=document.documentElement){return Kp(e,()=>U1(e))}function U1(e){const t={accent:gt(e,"--accent")??us,a600:gt(e,"--accent-600")??us,a700:gt(e,"--accent-700")??us},n=gt(e,"--accent-fg")??us,r=gt(e,"--surface")??us,s=["--surface","--surface-raised","--surface-sunken"].map(a=>gt(e,a)).filter(a=>a!==null),o=s.length?s:[r],i=o.reduce((a,u)=>Ke(t.a700,a)<Ke(t.a700,u)?a:u);return{fg:n,surface:r,surfaces:o,targets:{accent:Math.max(Ke(t.accent,r),Up+Tt),a600:Math.max(Ke(t.a600,n),Dt+Tt),a700:Math.max(o.reduce((a,u)=>Math.min(a,Ke(t.a700,u)),1/0),Dt+Tt)},chroma:{accent:bn(t.accent).C,a600:bn(t.a600).C,a700:bn(t.a700).C},darker:{accent:qe(t.accent)<qe(r),a600:qe(n)>qe(t.a600),a700:qe(t.a700)<qe(i)},a700Bg:i}}function B1(e,t){const n=Dt+Tt;return{accent:Dr(e.targets.accent,e.chroma.accent,t,e.surface,e.darker.accent,Up+Tt),a600:Dr(e.targets.a600,e.chroma.a600,t,e.fg,e.darker.a600,n),a700:Dr(e.targets.a700,e.chroma.a700,t,e.a700Bg,e.darker.a700,n)}}function dS(e,t=document.documentElement){const n=Gp(t);return e.map(r=>xn(Dr(n.targets.a600,n.chroma.a600,r,n.fg,n.darker.a600,Dt+Tt).rgb))}function W1(e,t=document.documentElement,n={}){const r=t.classList.contains("dark")?"dark":"light",s=n.context??Gp(t),o=B1(s,e),{a600:i,a700:a,accent:u}=o,c={C:s.chroma.a700};Qp(t),t.style.setProperty("--accent",Sa(u.rgb)),t.style.setProperty("--accent-600",Sa(i.rgb)),t.style.setProperty("--accent-700",Sa(a.rgb));const d={};for(const m of["--accent-fg","--accent-solid","--accent-solid-hover","--accent-text","--surface","--surface-raised","--surface-sunken","--accent-soft"])d[m]=gt(t,m);const f=[],p=d["--accent-fg"]??s.fg,y=(m,E,R)=>{const P=d[m];if(!P)return 1/0;let _=Ke(P,p),v=!1;if(_<R+Tt){const{C:D}=bn(P),L=Dr(R+Tt,Math.max(D,s.chroma.a600),e,p,qe(P)<qe(p),Dt+Tt);t.style.setProperty(m,xn(L.rgb)),_=Ke(L.rgb,p),v=!0}return f.push({label:E,fg:"--accent-fg",bg:m,ratio:_,floor:R,repaired:v}),_},k=y("--accent-solid","Primary button",Dt);y("--accent-solid-hover","Primary button, hovered",Math.min(k+.6,12));const S=[];for(const m of["--surface","--surface-raised","--surface-sunken","--accent-soft"]){const E=d[m];E&&S.push({name:m,c:E})}let C=1/0;const g=d["--accent-text"];if(g&&S.length){const m=S.reduce((R,P)=>Ke(g,R.c)<Ke(g,P.c)?R:P,S[0]);C=Ke(g,m.c);let E=!1;if(C<Dt+Tt){const{C:R}=bn(g),P=Dr(Dt+Tt,R||c.C,e,m.c,qe(g)<qe(m.c));t.style.setProperty("--accent-text",xn(P.rgb)),C=S.reduce((_,v)=>Math.min(_,Ke(P.rgb,v.c)),1/0),E=!0}f.push({label:"Accent text",fg:"--accent-text",bg:m.name,ratio:C,floor:Dt,repaired:E})}const h={};if(!n.live)for(const m of["--accent-solid","--accent-solid-hover","--accent-text"]){const E=gt(t,m);E&&(h[m]=xn(E))}return{hue:e,mode:r,channels:{accent:xn(u.rgb),accent600:xn(i.rgb),accent700:xn(a.rgb)},applied:h,checks:f,ok:f.every(m=>m.ratio>=m.floor-.005)&&k>=Dt}}const V1=[{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."}],fS=[{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}],hS=[{level:0,label:"None"},{level:1,label:"A little"},{level:2,label:"More"}];function H1(e=document.documentElement){const t=jp().accent;if(t&&t.toLowerCase()!==kp.accent.toLowerCase())try{return bn(Pr(t,{})).H}catch{}return F1(e)}const zd={theme:"foundation",hue:null,tint:0},Yp="paddock:appearance",Ad="paddock:appearance-cache";function Q1(){try{const e=localStorage.getItem(Yp);if(!e)return zd;const t=JSON.parse(e);return{theme:V1.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 zd}}function K1(e){try{localStorage.setItem(Yp,JSON.stringify(e))}catch{}}function G1(e,t,n){try{const r=JSON.parse(localStorage.getItem(Ad)||"{}"),s=`${e}:${t?"dark":"light"}`;n?r[s]={...n.applied,"--accent":n.channels.accent}:delete r[s],localStorage.setItem(Ad,JSON.stringify(r))}catch{}}function Y1(e,t=document.documentElement){t.setAttribute("data-theme",e.theme);const n=e.hue??H1(t);let r=null;e.tint===0?Hp(t):r=A1(n,q1[e.tint],t);const s=W1(n,t);return s&&r!==null&&(s.checks.push({label:"Body text on the tinted ground",fg:"--text-*",bg:"--surface-*",ratio:r,floor:4.5,repaired:!1}),s.ok=s.ok&&r>=4.5),G1(e.theme,t.classList.contains("dark"),s),s}function J1(e,t){K1(e);const n=Y1(e,t);return window.dispatchEvent(new CustomEvent(X1,{detail:n})),n}const X1="paddock:appearance";function Z1(){const e=()=>J1(Q1());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 q1=[0,.008,.018],Jp=w.lazy(()=>Xt(()=>import("./ProjectsGrid-BjFdqjV3.js"),__vite__mapDeps([0,1,2])).then(e=>({default:e.ProjectsGrid}))),Te=w.lazy(()=>Xt(()=>import("./ProjectView-C1ezKZtq.js").then(e=>e.a),__vite__mapDeps([3,4,1,2,5,6])).then(e=>({default:e.ProjectView}))),ew=w.lazy(()=>Xt(()=>import("./ProjectRedirect-0rVEh-WX.js"),__vite__mapDeps([7,2])).then(e=>({default:e.ProjectRedirect}))),tw=w.lazy(()=>Xt(()=>import("./InstanceConfigPage-CLu6YmDA.js"),__vite__mapDeps([8,5])).then(e=>({default:e.InstanceConfigPage}))),nw=w.lazy(()=>Xt(()=>import("./DiscoverPage-Ytc7flhQ.js"),__vite__mapDeps([9,6,5])).then(e=>({default:e.DiscoverPage}))),rw=w.lazy(()=>Xt(()=>import("./RootHome-DTZbSsti.js"),__vite__mapDeps([10,3,4,1,2,5,6])).then(e=>({default:e.RootHome})));Z1();const Xp=()=>document.documentElement.setAttribute("data-tab-hidden",document.hidden?"true":"false");document.addEventListener("visibilitychange",Xp);Xp();function sw(){const{tag:e}=Qy();return l.jsx(Jp,{filterTag:e?decodeURIComponent(e):void 0})}const ow=f0([{path:"/",element:l.jsx(j1,{}),errorElement:l.jsx(_1,{}),children:[{index:!0,element:l.jsx(rw,{})},{path:"projects",element:l.jsx(Jp,{})},{path:"tags/:tag",element:l.jsx(sw,{})},{path:"projects/:slug",element:l.jsx(ew,{})},{path:"projects/:slug/home",element:l.jsx(Te,{})},{path:"projects/:slug/chat",element:l.jsx(Te,{})},{path:"projects/:slug/chat/:sessionId",element:l.jsx(Te,{})},{path:"projects/:slug/files",element:l.jsx(Te,{})},{path:"projects/:slug/files/*",element:l.jsx(Te,{})},{path:"projects/:slug/changes",element:l.jsx(Te,{})},{path:"projects/:slug/changes/:file",element:l.jsx(Te,{})},{path:"projects/:slug/history",element:l.jsx(Te,{})},{path:"projects/:slug/settings",element:l.jsx(Te,{})},{path:"projects/:slug/triggers",element:l.jsx(Te,{})},{path:"projects/:slug/hooks",element:l.jsx(Te,{})},{path:"chat",element:l.jsx(Te,{root:!0})},{path:"chat/:sessionId",element:l.jsx(Te,{root:!0})},{path:"files",element:l.jsx(Te,{root:!0})},{path:"files/*",element:l.jsx(Te,{root:!0})},{path:"changes",element:l.jsx(Te,{root:!0})},{path:"changes/:file",element:l.jsx(Te,{root:!0})},{path:"history",element:l.jsx(Te,{root:!0})},{path:"triggers",element:l.jsx(Te,{root:!0})},{path:"settings",element:l.jsx(Te,{root:!0})},{path:"config",element:l.jsx(tw,{})},{path:"discover",element:l.jsx(nw,{})}]}]);ka.createRoot(document.getElementById("root")).render(l.jsx(Zd.StrictMode,{children:l.jsx(L0,{children:l.jsx(w0,{router:ow})})}));L1();export{Qx as $,Hx as A,tS as B,$w as C,Qp as D,W1 as E,Gp as F,jt as G,hx as H,Dw as I,Sl as J,Rd as K,Vs as L,Yw as M,lw as N,_w as O,Xw as P,Jt as Q,ju as R,Hw as S,Jw as T,Kx as U,Iw as V,On as W,$i as X,bw as Y,Lw as Z,aw as _,or as a,hw as a$,Vx as a0,uS as a1,Wx as a2,sS as a3,Mp as a4,iS as a5,iw as a6,Bw as a7,Uw as a8,Zw as a9,oS as aA,qw as aB,Eu as aC,Nu as aD,Kw as aE,yw as aF,bp as aG,Aw as aH,S1 as aI,xw as aJ,nS as aK,aS as aL,eS as aM,lS as aN,mw as aO,gw as aP,Q0 as aQ,H0 as aR,vw as aS,Xx as aT,fw as aU,uw as aV,T0 as aW,lr as aX,cw as aY,dw as aZ,w1 as a_,Qw as aa,Jx as ab,Fw as ac,kw as ad,jw as ae,Cw as af,Nw as ag,Ew as ah,Pw as ai,Rw as aj,Tw as ak,X0 as al,gx as am,zw as an,Y0 as ao,ga as ap,ww as aq,Xt as ar,Mi as as,Mw as at,M0 as au,Sw as av,Vw as aw,Cu as ax,Ow as ay,rS as az,Sp as b,cS as b0,st as c,px as d,Zs as e,Ux as f,Ud as g,p1 as h,R0 as i,l as j,K0 as k,Gw as l,wl as m,pw as n,F0 as o,A0 as p,Ww as q,w as r,Q1 as s,J1 as t,Qy as u,X1 as v,dS as w,V1 as x,fS as y,hS as z};
|
|
70
|
+
*/function Vr(){return Vr=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},Vr.apply(this,arguments)}function yp(e,t){if(e==null)return{};var n={},r=Object.keys(e),s,o;for(o=0;o<r.length;o++)s=r[o],!(t.indexOf(s)>=0)&&(n[s]=e[s]);return n}function a0(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function l0(e,t){return e.button===0&&(!t||t==="_self")&&!a0(e)}const u0=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","unstable_viewTransition"],c0=["aria-current","caseSensitive","className","end","style","to","unstable_viewTransition","children"],d0="6";try{window.__reactRouterVersion=d0}catch{}function f0(e,t){return wy({basename:void 0,future:Vr({},void 0,{v7_prependBasename:!0}),history:Vv({window:void 0}),hydrationData:h0(),routes:e,mapRouteProperties:i0,unstable_dataStrategy:void 0,unstable_patchRoutesOnNavigation:void 0,window:void 0}).initialize()}function h0(){var e;let t=(e=window)==null?void 0:e.__staticRouterHydrationData;return t&&t.errors&&(t=Vr({},t,{errors:p0(t.errors)})),t}function p0(e){if(!e)return null;let t=Object.entries(e),n={};for(let[r,s]of t)if(s&&s.__type==="RouteErrorResponse")n[r]=new di(s.status,s.statusText,s.data,s.internal===!0);else if(s&&s.__type==="Error"){if(s.__subType){let o=window[s.__subType];if(typeof o=="function")try{let i=new o(s.message);i.stack="",n[r]=i}catch{}}if(n[r]==null){let o=new Error(s.message);o.stack="",n[r]=o}}else n[r]=s;return n}const xp=w.createContext({isTransitioning:!1}),m0=w.createContext(new Map),g0="startTransition",yd=_m[g0],v0="flushSync",xd=Wv[v0];function y0(e){yd?yd(e):e()}function ls(e){xd?xd(e):e()}class x0{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 w0(e){let{fallbackElement:t,router:n,future:r}=e,[s,o]=w.useState(n.state),[i,a]=w.useState(),[u,c]=w.useState({isTransitioning:!1}),[d,f]=w.useState(),[p,y]=w.useState(),[k,S]=w.useState(),C=w.useRef(new Map),{v7_startTransition:g}=r||{},h=w.useCallback(v=>{g?y0(v):v()},[g]),m=w.useCallback((v,D)=>{let{deletedFetchers:L,unstable_flushSync:H,unstable_viewTransitionOpts:se}=D;L.forEach(de=>C.current.delete(de)),v.fetchers.forEach((de,ot)=>{de.data!==void 0&&C.current.set(ot,de.data)});let ge=n.window==null||n.window.document==null||typeof n.window.document.startViewTransition!="function";if(!se||ge){H?ls(()=>o(v)):h(()=>o(v));return}if(H){ls(()=>{p&&(d&&d.resolve(),p.skipTransition()),c({isTransitioning:!0,flushSync:!0,currentLocation:se.currentLocation,nextLocation:se.nextLocation})});let de=n.window.document.startViewTransition(()=>{ls(()=>o(v))});de.finished.finally(()=>{ls(()=>{f(void 0),y(void 0),a(void 0),c({isTransitioning:!1})})}),ls(()=>y(de));return}p?(d&&d.resolve(),p.skipTransition(),S({state:v,currentLocation:se.currentLocation,nextLocation:se.nextLocation})):(a(v),c({isTransitioning:!0,flushSync:!1,currentLocation:se.currentLocation,nextLocation:se.nextLocation}))},[n.window,p,d,C,h]);w.useLayoutEffect(()=>n.subscribe(m),[n,m]),w.useEffect(()=>{u.isTransitioning&&!u.flushSync&&f(new x0)},[u]),w.useEffect(()=>{if(d&&i&&n.window){let v=i,D=d.promise,L=n.window.document.startViewTransition(async()=>{h(()=>o(v)),await D});L.finished.finally(()=>{f(void 0),y(void 0),a(void 0),c({isTransitioning:!1})}),y(L)}},[h,i,d,n.window]),w.useEffect(()=>{d&&i&&s.location.key===i.location.key&&d.resolve()},[d,p,s.location,i]),w.useEffect(()=>{!u.isTransitioning&&k&&(a(k.state),c({isTransitioning:!0,flushSync:!1,currentLocation:k.currentLocation,nextLocation:k.nextLocation}),S(void 0))},[u.isTransitioning,k]),w.useEffect(()=>{},[]);let E=w.useMemo(()=>({createHref:n.createHref,encodeLocation:n.encodeLocation,go:v=>n.navigate(v),push:(v,D,L)=>n.navigate(v,{state:D,preventScrollReset:L==null?void 0:L.preventScrollReset}),replace:(v,D,L)=>n.navigate(v,{replace:!0,state:D,preventScrollReset:L==null?void 0:L.preventScrollReset})}),[n]),R=n.basename||"/",P=w.useMemo(()=>({router:n,navigator:E,static:!1,basename:R}),[n,E,R]),_=w.useMemo(()=>({v7_relativeSplatPath:n.future.v7_relativeSplatPath}),[n.future.v7_relativeSplatPath]);return w.createElement(w.Fragment,null,w.createElement(Xs.Provider,{value:P},w.createElement(Su.Provider,{value:s},w.createElement(m0.Provider,{value:C.current},w.createElement(xp.Provider,{value:u},w.createElement(o0,{basename:R,location:s.location,navigationType:s.historyAction,navigator:E,future:_},s.initialized||n.future.v7_partialHydration?w.createElement(S0,{routes:n.routes,future:n.future,state:s}):t))))),null)}const S0=w.memo(k0);function k0(e){let{routes:t,future:n,state:r}=e;return Ky(t,void 0,r,n)}const j0=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",E0=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Vs=w.forwardRef(function(t,n){let{onClick:r,relative:s,reloadDocument:o,replace:i,state:a,target:u,to:c,preventScrollReset:d,unstable_viewTransition:f}=t,p=yp(t,u0),{basename:y}=w.useContext(ln),k,S=!1;if(typeof c=="string"&&E0.test(c)&&(k=c,j0))try{let m=new URL(window.location.href),E=c.startsWith("//")?new URL(m.protocol+c):new URL(c),R=on(E.pathname,y);E.origin===m.origin&&R!=null?c=R+E.search+E.hash:S=!0}catch{}let C=Wy(c,{relative:s}),g=C0(c,{replace:i,state:a,target:u,preventScrollReset:d,relative:s,unstable_viewTransition:f});function h(m){r&&r(m),m.defaultPrevented||g(m)}return w.createElement("a",Vr({},p,{href:k||C,onClick:S||o?r:h,ref:n,target:u}))}),gn=w.forwardRef(function(t,n){let{"aria-current":r="page",caseSensitive:s=!1,className:o="",end:i=!1,style:a,to:u,unstable_viewTransition:c,children:d}=t,f=yp(t,c0),p=Ii(u,{relative:f.relative}),y=lr(),k=w.useContext(Su),{navigator:S,basename:C}=w.useContext(ln),g=k!=null&&P0(p)&&c===!0,h=S.encodeLocation?S.encodeLocation(p).pathname:p.pathname,m=y.pathname,E=k&&k.navigation&&k.navigation.location?k.navigation.location.pathname:null;s||(m=m.toLowerCase(),E=E?E.toLowerCase():null,h=h.toLowerCase()),E&&C&&(E=on(E,C)||E);const R=h!=="/"&&h.endsWith("/")?h.length-1:h.length;let P=m===h||!i&&m.startsWith(h)&&m.charAt(R)==="/",_=E!=null&&(E===h||!i&&E.startsWith(h)&&E.charAt(h.length)==="/"),v={isActive:P,isPending:_,isTransitioning:g},D=P?r:void 0,L;typeof o=="function"?L=o(v):L=[o,P?"active":null,_?"pending":null,g?"transitioning":null].filter(Boolean).join(" ");let H=typeof a=="function"?a(v):a;return w.createElement(Vs,Vr({},f,{"aria-current":D,className:L,ref:n,style:H,to:u,unstable_viewTransition:c}),typeof d=="function"?d(v):d)});var vl;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(vl||(vl={}));var wd;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(wd||(wd={}));function N0(e){let t=w.useContext(Xs);return t||Z(!1),t}function C0(e,t){let{target:n,replace:r,state:s,preventScrollReset:o,relative:i,unstable_viewTransition:a}=t===void 0?{}:t,u=Zs(),c=lr(),d=Ii(e,{relative:i});return w.useCallback(f=>{if(l0(f,n)){f.preventDefault();let p=r!==void 0?r:sr(c)===sr(d);u(e,{replace:p,state:s,preventScrollReset:o,relative:i,unstable_viewTransition:a})}},[c,u,d,r,s,n,e,o,i,a])}function P0(e,t){t===void 0&&(t={});let n=w.useContext(xp);n==null&&Z(!1);let{basename:r}=N0(vl.useViewTransitionState),s=Ii(e,{relative:t.relative});if(!n.isTransitioning)return!1;let o=on(n.currentLocation.pathname,r)||n.currentLocation.pathname,i=on(n.nextLocation.pathname,r)||n.nextLocation.pathname;return ci(s.pathname,i)!=null||ci(s.pathname,o)!=null}const ju="";function Eu(e){return e===ju}function Q(e){return Eu(e)?"/api/root":`/api/projects/${encodeURIComponent(e)}`}function T0(e){return Eu(e)?"":`/projects/${e}`}function uw(e){return e===""?"/":`${e}/home`}function R0(){return"/projects"}function cw(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 dw(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(s=>{try{return decodeURIComponent(s)}catch{return s}}).join("/"):""}function M0(e){return`m-${e}`}function fw(e,t,n){return`${e}/chat/${encodeURIComponent(t)}#${M0(n)}`}function hw(e){var t;return(t=/^#?m-([0-9a-fA-F][0-9a-fA-F-]{7,})$/.exec(e))==null?void 0:t[1]}const Qn="";async function U(e,t){const n=await fetch(`${Qn}${e}`,{headers:{"content-type":"application/json",...(t==null?void 0:t.headers)??{}},...t});if(!n.ok){let r=n.statusText,s,o;try{o=await n.json();const i=o;i.error&&(r=i.error),typeof i.code=="string"&&(s=i.code)}catch{}throw new On(r,n.status,s,o)}return await n.json()}async function _0(e,t){const n=await fetch(`${Qn}${e}`,t);if(!n.ok){let r=n.statusText;try{const s=JSON.parse(await n.text());s.error&&(r=s.error)}catch{}throw new On(r,n.status)}return n.text()}class On extends Error{constructor(t,n,r,s){super(t),this.status=n,this.code=r,this.body=s,this.name="ApiError"}}const Sd={transcriptRenderLimit:500};let kd=null;const or={async me(){return U("/api/me")},async markChatSeen(e,t,n,r){const s=`${Q(e)}/chats/${encodeURIComponent(t)}/seen`;await U(s,{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 U(r,{method:"POST",body:JSON.stringify({unread:n})})},async projectRuns(e,t){const n=t!==void 0?`?limit=${encodeURIComponent(t)}`:"";return U(`${Q(e)}/runs${n}`)},async markRunsSeen(e,t){await U(`${Q(e)}/runs/seen`,{method:"POST",body:JSON.stringify(t!==void 0?{when:t}:{})})},async getModels(){return U("/api/models")},async getInstanceConfig(){return U("/api/instance-config")},async updateInstanceConfig(e,t){return U("/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 o of n)r.append("files",o,o.name);const s=await fetch(`${Qn}${Q(e)}/chats/${encodeURIComponent(t)}/upload`,{method:"POST",body:r});if(!s.ok){let o=s.statusText;try{const i=await s.json();i.error&&(o=i.error)}catch{}throw new On(o,s.status)}return await s.json()},async projectCommands(e){const{commands:t}=await U(`${Q(e)}/commands`);return t},async listProjects(){const{projects:e,root:t}=await U("/api/projects");return{projects:e,root:t??null}},async getProjectDetail(e){return U(`${Q(e)}`)},async attentionChats(e){const t=await U(`${Q(e)}/chats/attention`);return{running:t.running??[],unread:t.unread??[]}},async createProject(e){const{project:t}=await U("/api/projects",{method:"POST",body:JSON.stringify(e)});return t},async updateProject(e,t){const{project:n}=await U(`${Q(e)}`,{method:"PATCH",body:JSON.stringify(t)});return n},async promoteProject(e,t){const{project:n}=await U(`${Q(e)}/promote`,{method:"POST",body:JSON.stringify({repo:t})});return n},async deleteProject(e){await U(`${Q(e)}`,{method:"DELETE"})},async deleteProjectChat(e,t){await U(`${Q(e)}/chats/${encodeURIComponent(t)}`,{method:"DELETE"})},async renameProjectChat(e,t,n){await U(`${Q(e)}/chats/${encodeURIComponent(t)}`,{method:"PATCH",body:JSON.stringify({name:n})})},async archiveProjectChat(e,t,n){await U(`${Q(e)}/chats/${encodeURIComponent(t)}/archive`,{method:"POST",body:JSON.stringify({archived:n})})},async starProjectChat(e,t,n){await U(`${Q(e)}/chats/${encodeURIComponent(t)}/star`,{method:"POST",body:JSON.stringify({starred:n})})},async archiveProjectChats(e,t,n){await U(`${Q(e)}/chats/batch/archive`,{method:"POST",body:JSON.stringify({sessionIds:t,archived:n})})},async markChatsUnread(e,t,n){await U(`${Q(e)}/chats/batch/unread`,{method:"POST",body:JSON.stringify({sessionIds:t,unread:n})})},async deleteProjectChats(e,t){const n=await U(`${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 U(`${Q(e)}/chats/${encodeURIComponent(t)}/detach`,{method:"POST",body:JSON.stringify({detached:n})})},async promoteChat(e,t,n){return U(`${Q(e)}/chats/${encodeURIComponent(t)}/promote`,{method:"POST",body:JSON.stringify(n)})},async forkChat(e,t,n,r){const{sessionId:s}=await U(`${Q(e)}/chats/${encodeURIComponent(t)}/fork`,{method:"POST",body:JSON.stringify({name:n,fromUuid:r})});return s},async revertChat(e,t,n){const{removed:r}=await U(`${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 U(`${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 U(`${Q(e)}/files/${encodeURIComponent(t)}`)},projectFileRawUrl(e,t){return`${Qn}${Q(e)}/files/${encodeURIComponent(t)}?raw=1`},chatFileRawUrl(e){return`${Qn}/api/chat-files/${encodeURIComponent(e)}`},async pinFile(e,t){const{project:n}=await U(`${Q(e)}/pins`,{method:"PUT",body:JSON.stringify({file:t})});return n},async unpinFile(e,t){const{project:n}=await U(`${Q(e)}/pins/${encodeURIComponent(t)}`,{method:"DELETE"});return n},async listProjectChats(e){const{chats:t}=await U(`${Q(e)}/chats`);return t},async getAdoptableChats(e){return U(`${Q(e)}/adoptable-chats`)},async adoptChats(e,t){return U(`${Q(e)}/adopt-chats`,{method:"POST",body:JSON.stringify(t??{})})},async unadoptChats(e,t){return U(`${Q(e)}/unadopt-chats`,{method:"POST",body:JSON.stringify(t??{})})},async chatUsage(e,t){const n=t?`?scope=${t}`:"",{usage:r}=await U(`${Q(e)}/chats/usage${n}`);return r},uiConfig(){return kd??(kd=or.getModels().then(e=>e.uiDefault??Sd).catch(()=>Sd)),kd},async projectChatMessages(e,t,n=0){const r=n>0?`?limit=${n}`:"",s=await U(`${Q(e)}/chats/${encodeURIComponent(t)}/messages${r}`);return{messages:s.messages,total:s.total??s.messages.length,truncated:s.truncated??!1}},async subagentMessages(e,t,n){const r=`${Q(e)}/chats/${encodeURIComponent(t)}`,{messages:s}=await U(`${r}/subagents/${encodeURIComponent(n)}/messages`);return s},async chatContext(e,t){const n=`${Q(e)}/chats/${encodeURIComponent(t)}/context`,{usage:r}=await U(n);return r},async listTriggers(e){return U(`${Q(e)}/triggers`)},async putTrigger(e,t,n){const{trigger:r}=await U(`${Q(e)}/triggers/${encodeURIComponent(t)}`,{method:"PUT",body:JSON.stringify(n)});return r},async deleteTrigger(e,t){await U(`${Q(e)}/triggers/${encodeURIComponent(t)}`,{method:"DELETE"})},async triggerRuntime(e){return U(`${Q(e)}/triggers/runtime`)},async runTrigger(e,t){const{sessionId:n}=await U(`${Q(e)}/triggers/${encodeURIComponent(t)}/run`,{method:"POST",body:"{}"});return n},async gitInfo(){return U("/api/git")},async gitStatus(e){return U(`${Q(e)}/git/status`)},async gitDiff(e,t){const n=t?`?file=${encodeURIComponent(t)}`:"";return _0(`${Q(e)}/git/diff${n}`)},async gitCommit(e,t,n){return U(`${Q(e)}/git/commit`,{method:"POST",body:JSON.stringify(n?{message:t,files:n}:{message:t})})},async gitProjectInfo(e){return U(`${Q(e)}/git/remote`)},async gitPush(e){return U(`${Q(e)}/git/push`,{method:"POST"})},async gitUntrackedFile(e,t){return U(`${Q(e)}/git/file?path=${encodeURIComponent(t)}`)},gitUntrackedFileRawUrl(e,t){return`${Qn}${Q(e)}/git/file?path=${encodeURIComponent(t)}&raw=1`},async githubConnect(){return U("/api/git/github/connect",{method:"POST"})},async githubPoll(e){return U("/api/git/github/poll",{method:"POST",body:JSON.stringify({deviceCode:e})})},async githubDisconnect(){await U("/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 U(`/api/discover${n?`?${n}`:""}`)},async discoverSessions(e){return U(`/api/discover/sessions?dir=${encodeURIComponent(e)}`)},async transcriptionStatus(){return U("/api/transcription")},async transcribe(e,t="dictation.webm",n){const r=new FormData;r.append("file",e,t);const s=await fetch(`${Qn}/api/transcribe`,{method:"POST",body:r,signal:n});if(!s.ok){let i=s.statusText;try{const a=await s.json();a.error&&(i=a.error)}catch{}throw new On(i,s.status)}const{text:o}=await s.json();return o},async transcriptsMigration(){return U("/api/transcripts/migration")},async transcriptsMigrationChats(e){const t=e===void 0?"":`?slug=${encodeURIComponent(e)}`;return U(`/api/transcripts/migration/chats${t}`)},async runTranscriptsMigration(e){return U("/api/transcripts/migration",{method:"POST",body:JSON.stringify(e)})}},wp=w.createContext(null);function L0({children:e}){const[t,n]=w.useState([]),[r,s]=w.useState(null),[o,i]=w.useState(!0),[a,u]=w.useState(null),c=w.useRef(!1),d=w.useCallback(async()=>{c.current||i(!0),u(null);try{const{projects:k,root:S}=await or.listProjects();c.current=!0,n(k),S&&s(S)}catch(k){u(k instanceof Error?k.message:"Failed to load projects")}finally{i(!1)}},[]),f=w.useCallback(k=>{if(Eu(k.slug)){s(k);return}n(S=>[k,...S.filter(C=>C.slug!==k.slug)])},[]),p=w.useCallback(k=>{n(S=>S.filter(C=>C.slug!==k))},[]);w.useEffect(()=>{d()},[d]);const y=w.useMemo(()=>({projects:t,rootWorkspace:r,loading:o,error:a,refresh:d,upsert:f,remove:p}),[t,r,o,a,d,f,p]);return l.jsx(wp.Provider,{value:y,children:e})}function Sp(){const e=w.useContext(wp);if(!e)throw new Error("useProjects must be used within ProjectsProvider");return e}const b0="paddock:theme";function I0(){return typeof document<"u"&&document.documentElement.classList.contains("dark")}function D0(){const[e,t]=w.useState(I0),n=w.useCallback(()=>{t(r=>{const s=!r;document.documentElement.classList.toggle("dark",s);try{localStorage.setItem(b0,s?"dark":"light")}catch{}return s})},[]);return{dark:e,toggle:n}}const kp={name:"Paddock",logo:"🐎",accent:"#c2603c"},O0={enabled:!1,path:"/open-api"};function jp(){const e=globalThis.__PADDOCK_CONFIG__;return{...kp,...(e==null?void 0:e.brand)??{}}}function $0(){const e=globalThis.__PADDOCK_CONFIG__;return{...O0,...(e==null?void 0:e.openapi)??{}}}function z0(e){return/^(https?:\/\/|\/)/i.test(e.trim())}const Nu=[{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."}],jd="",Ep=new Map(Nu.map(e=>[e.slug,e]));function A0(e){if(!e)return"Unsorted";const t=Ep.get(e);return t?t.label:e.split("-").map(n=>n.charAt(0).toUpperCase()+n.slice(1)).join(" ")}function pw(e){var t;return(t=Ep.get(e))==null?void 0:t.blurb}function F0(e){const t=new Set(e),n=[];for(const s of Nu)t.has(s.slug)&&(n.push(s.slug),t.delete(s.slug));const r=t.delete(jd);return n.push(...[...t].sort()),r&&n.push(jd),n}const Np=25e3,Cp=1e4,U0=Np+Cp+5e3,B0=500,W0=1e4;class V0{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=(s,o)=>{s===t&&n(o)};return this.backgroundListeners.add(r),n(this.backgroundWork(t)),this.connect(),()=>this.backgroundListeners.delete(r)}setActive(t,n,r,s){const o=this.activeSessions.has(t);if(n?(this.activeSessions.set(t,r),s!=null&&!this.activeStartedAt.has(t)&&this.activeStartedAt.set(t,s)):(this.activeSessions.delete(t),this.activeStartedAt.delete(t)),this.activeSessions.has(t)!==o){const i=new Set(this.activeSessions.keys());for(const u of this.activeListeners)u(i);const a=new Map(this.activeSessions);for(const u of this.activeInfoListeners)u(a)}}subscribe(t,n,r){const s=Symbol("chat-sub"),o={projectSlug:t,sessionId:n,handlers:r,lastSeq:-1,turnActive:!1};return this.subs.set(s,o),this.connect(),n&&this.attachSession(o,!1),{setSessionId:i=>{const a=this.subs.get(s);a&&(a.sessionId=i,i&&this.attachSession(a,!1))},unsubscribe:()=>{this.subs.delete(s)}}}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,s){const o={projectSlug:t,sessionId:r,message:n};s!=null&&s.preloadContext&&(o.preloadContext=!0),s!=null&&s.model&&(o.model=s.model),s!=null&&s.attachments&&s.attachments.length>0&&(o.attachments=s.attachments),this.markTurnStart(t,r),this.transmit(JSON.stringify({type:"chat:send",payload:o}))}setQueued(t,n,r,s,o){const i={projectSlug:t,sessionId:n,text:r,qid:s};o&&o.length>0&&(i.attachments=o.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=(s,o)=>{s===t&&n(o)};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<U0}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(),Np)}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())},Cp)}}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(W0,B0*2**this.reconnectAttempts);this.reconnectAttempts+=1,this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.connect()},t)}route(t,n){const r=[...this.subs.values()].filter(o=>o.projectSlug===t);if(r.length===0)return;if(n){const o=r.find(i=>i.sessionId===n);if(o)return o;if(this.knownSessions.has(n))return}const s=r.find(o=>o.sessionId===null);if(s)return s;if(n===null&&r.length===1)return r[0]}dispatch(t){var c,d,f,p,y,k,S,C,g,h,m,E,R,P,_,v,D,L,H,se,ge,de,ot,Xe,St,I,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:O,taskId:Y,outcome:oe,message:J}=n.payload;if(O&&Y&&oe)for(const Ee of this.stopTaskListeners)Ee(O,{taskId:Y,outcome:oe,message:J});return}const r=n.payload.projectSlug;if(r==null)return;if(n.type==="chat:error"){const O=this.route(r,null);(d=O==null?void 0:(c=O.handlers).onError)==null||d.call(c,n.payload.error);return}if(n.type==="chat:resync"){const O=this.route(r,n.payload.sessionId);(p=O==null?void 0:(f=O.handlers).onResync)==null||p.call(f);return}if(n.type==="chat:background"){const{sessionId:O,tasks:Y}=n.payload;if(O){const oe=Array.isArray(Y)?Y:[];oe.length===0?this.backgroundTasks.delete(O):this.backgroundTasks.set(O,oe);for(const J of this.backgroundListeners)J(O,oe)}return}if(n.type==="chat:active"){this.setActive(n.payload.sessionId,n.payload.running,r,n.payload.startedAt);for(const O of this.subs.values())O.projectSlug===r&&O.sessionId===n.payload.sessionId&&((k=(y=O.handlers).onActive)==null||k.call(y,{running:n.payload.running,turnRunning:n.payload.turnRunning??n.payload.running,jobId:n.payload.jobId}));return}if(n.type==="chat:queued_flushed"){const{sessionId:O,text:Y,attachments:oe}=n.payload;if(O){Xt(async()=>{const{writeQueued:J,writeQueuedId:Ee,writeQueuedAttachments:ie}=await import("./queued-CagZVfWU.js");return{writeQueued:J,writeQueuedId:Ee,writeQueuedAttachments:ie}},[]).then(({writeQueued:J,writeQueuedId:Ee,writeQueuedAttachments:ie})=>{J(O,r,null),Ee(O,r,null),ie(O,r,[])});for(const J of this.subs.values())J.projectSlug===r&&J.sessionId===O&&((C=(S=J.handlers).onQueuedFlushed)==null||C.call(S,{text:Y,attachments:oe}))}return}if(n.type==="chat:queued_state"){const{sessionId:O,text:Y,qid:oe,reason:J,attachments:Ee}=n.payload;if(O){const ie=Y&&Y.length>0?Y:null,Ae=Ee??[],Ft=ie!==null||Ae.length>0;Xt(async()=>{const{writeQueued:Ut,writeQueuedId:un,writeQueuedAttachments:Yr}=await import("./queued-CagZVfWU.js");return{writeQueued:Ut,writeQueuedId:un,writeQueuedAttachments:Yr}},[]).then(({writeQueued:Ut,writeQueuedId:un,writeQueuedAttachments:Yr})=>{Ut(O,r,ie),un(O,r,Ft?oe??null:null),Yr(O,r,Ae)});for(const Ut of this.subs.values())Ut.projectSlug===r&&Ut.sessionId===O&&((h=(g=Ut.handlers).onQueuedState)==null||h.call(g,{text:ie,attachments:Ae,qid:oe,reason:J}))}return}if(n.type==="chat:queued_returned"){const{sessionId:O,text:Y,attachments:oe}=n.payload;if(O&&typeof Y=="string"){Xt(async()=>{const{writeQueued:J,writeQueuedId:Ee,writeQueuedAttachments:ie}=await import("./queued-CagZVfWU.js");return{writeQueued:J,writeQueuedId:Ee,writeQueuedAttachments:ie}},[]).then(({writeQueued:J,writeQueuedId:Ee,writeQueuedAttachments:ie})=>{J(O,r,null),Ee(O,r,null),ie(O,r,[])});for(const J of this.subs.values())J.projectSlug===r&&J.sessionId===O&&((E=(m=J.handlers).onQueuedReturned)==null||E.call(m,{text:Y,attachments:oe}))}return}if(n.type==="chat:killed_task"){const{sessionId:O,summary:Y,timestamp:oe}=n.payload;if(O)for(const J of this.subs.values())J.projectSlug===r&&J.sessionId===O&&((P=(R=J.handlers).onKilledTask)==null||P.call(R,{summary:Y??"",timestamp:oe??""}));return}const{sessionId:s,jobId:o}=n.payload,i=this.route(r,s);if(!i)return;const a={sessionId:s,jobId:o},u=n.payload.seq;switch(typeof u=="number"&&u>i.lastSeq&&(i.lastSeq=u),i.turnActive=n.type!=="chat:complete",n.type){case"chat:response":(v=(_=i.handlers).onResponse)==null||v.call(_,n.payload.chunk,a);break;case"chat:tool_call":(L=(D=i.handlers).onToolCall)==null||L.call(D,{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":(se=(H=i.handlers).onToolStart)==null||se.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":(Xe=(ot=i.handlers).onInjected)==null||Xe.call(ot,{sender:n.payload.sender,content:n.payload.content,timestamp:n.payload.timestamp},a);break;case"chat:notice":(I=(St=i.handlers).onNotice)==null||I.call(St,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 Cu=new V0,en=new Map,yl="paddock:lastSeen-changed";function Pu(e){try{window.dispatchEvent(new CustomEvent(yl,{detail:{sessionId:e}}))}catch{}}function H0(e){return en.get(e)??0}function Q0(e,t){!t||!Number.isFinite(t)||t<=(en.get(e)??0)||(en.set(e,t),Pu(e))}function mw(e,t=Date.now()){const n=en.get(e)??0;return t<=n||(en.set(e,t),Pu(e)),n}function gw(e,t,n){en.get(e)===n&&(t?en.set(e,t):en.delete(e),Pu(e))}const xl="paddock:chats-gone";function vw(e){if(e.length!==0){for(const t of e)en.delete(t);try{window.dispatchEvent(new CustomEvent(xl,{detail:{sessionIds:e}}))}catch{}}}function K0({tag:e,className:t=""}){const n=Zs();return l.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 G0=/^\d{4}-\d{2}-\d{2}$/;function wl(e){if(!e)return"";if(G0.test(e)){const[u,c,d]=e.split("-").map(Number),f=new Date(u,c-1,d);if(Number.isNaN(f.getTime()))return e;const p=new Date,y=new Date(p.getFullYear(),p.getMonth(),p.getDate()),k=Math.round((y.getTime()-f.getTime())/864e5);return k<=0?"today":k===1?"yesterday":k<7?`${k}d ago`:k<35?`${Math.round(k/7)}w ago`:k<365?`${Math.round(k/30)}mo ago`:`${Math.round(k/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 s=Math.round(r/60);if(s<24)return`${s}h ago`;const o=Math.round(s/24);if(o<7)return`${o}d ago`;const i=Math.round(o/7);if(i<5)return`${i}w ago`;const a=Math.round(o/30);return a<12?`${a}mo ago`:`${Math.round(o/365)}y ago`}function yw(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 s=Math.round(r/60);if(s<24)return`in ${s}h`;const o=Math.round(s/24);if(o<7)return`in ${o}d`;const i=Math.round(o/7);if(i<5)return`in ${i}w`;const a=Math.round(o/30);return a<12?`in ${a}mo`:`in ${Math.round(o/365)}y`}function ga(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 Y0(e){return!Number.isFinite(e)||e<=0?"$0.00":e<.01?"<$0.01":`$${e.toFixed(2)}`}function xw(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 ww(e){const t=e.inputTokens+e.cacheReadTokens+e.cacheCreationTokens,n=`${ga(e.totalTokens)} tokens · ${ga(t)} in / ${ga(e.outputTokens)} out`;return e.costUsd==null?n:`${n} · ~${Y0(e.costUsd)} at API rates`}function Sw(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 J0="This session is being continued from a previous conversation";function kw(e){return e.trimStart().startsWith(J0)}function jw(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 Ew(e){return e.trimStart().startsWith("<local-command-caveat>")}function Nw(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 Cw(e){return/^\s*<local-command-stdout>[\s\S]*<\/local-command-stdout>\s*$/.test(e)}function Pw(e){return e.trimStart().startsWith("<task-notification>")}function Tw(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 Rw(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 Mw(e){return e==="killed"||e==="stopped"}function X0(e){const t=Math.max(0,Math.floor(e/1e3)),n=t%60,r=Math.floor(t/60)%60,s=Math.floor(t/3600),o=String(n).padStart(2,"0");return s>0?`${s}:${String(r).padStart(2,"0")}:${o}`:`${r}:${o}`}function Ed(e){if(typeof window>"u"||typeof window.matchMedia!="function")return null;try{return window.matchMedia(e)??null}catch{return null}}function Sl(e){const[t,n]=w.useState(()=>{var r;return((r=Ed(e))==null?void 0:r.matches)??!1});return w.useEffect(()=>{var o;const r=Ed(e);if(!r)return;const s=()=>n(!!r.matches);return s(),typeof r.addEventListener=="function"?(r.addEventListener("change",s),()=>r.removeEventListener("change",s)):((o=r.addListener)==null||o.call(r,s),()=>{var i;return(i=r.removeListener)==null?void 0:i.call(r,s)})},[e]),t}const kl="paddock:transcriptsMigration:dismissed";function Z0(){try{return localStorage.getItem(kl)==="1"}catch{return!1}}function Nd(e){try{e?localStorage.setItem(kl,"1"):localStorage.removeItem(kl)}catch{}}let ms=null;function q0(){if(!ms)try{ms=or.transcriptsMigration().catch(()=>null)}catch{ms=Promise.resolve(null)}return ms}function ex(){ms=null}function Pp(){const[e,t]=w.useState(null),[n,r]=w.useState(Z0);w.useEffect(()=>{let o=!0;return q0().then(i=>{!o||!i||(t(i),i&&!i.eligible&&(Nd(!1),r(!1)))}),()=>{o=!1}},[]);const s=w.useCallback(()=>{Nd(!0),r(!0)},[]);return{probe:e,showBanner:(e==null?void 0:e.eligible)===!0&&!n,showInConfig:e!=null&&e.mode==="own"&&(e.eligible||e.reason==="profile-paranoid"),dismiss:s}}function Di(e){return((e==null?void 0:e.projects)??[]).flatMap(t=>t.chats)}function tx(e){return new Set(Di(e).filter(t=>t.defaultSelected).map(t=>t.sessionId))}function nx(e,t){const n=e.chats.length,r=e.chats.reduce((s,o)=>s+(t.has(o.sessionId)?1:0),0);return{selected:r,total:n,all:n>0&&r===n,some:r>0&&r<n}}function rx(e,t,n){const r=new Set(e);for(const s of t.chats)n?r.add(s.sessionId):r.delete(s.sessionId);return r}function sx(e,t){return t?new Set(Di(e).map(n=>n.sessionId)):new Set}function ox(e,t){const n=new Set(e);return n.delete(t)||n.add(t),n}function ix(e,t){const n=Di(e).map(r=>r.sessionId);return{sessionIds:n.filter(r=>t.has(r)),plannedSessionIds:n,expectedVersion:e.configVersion}}function ax(e){const t=(e==null?void 0:e.totals.identical)??0,n=((e==null?void 0:e.projects)??[]).reduce((s,o)=>s+o.projectExtras.length,0),r=(e==null?void 0:e.sweepers.chats)??0;return{identical:t,projectExtras:n,sweeperChats:r,total:t+n+r}}function Tp(e){return e?e.projects.length===0&&e.sweepers.stores===0:!1}function Rp(e){return!e.ok||e.failed.length>0?"partial":e.alreadyMigrated?"already":e.migrated.length===0&&e.preserved.length===0?"nothing":"done"}function lx(e){const t=new Map;for(const n of e){const r=t.get(n.slug);r?r.push(n):t.set(n.slug,[n])}return[...t.entries()].map(([n,r])=>({slug:n,items:r}))}const ux={new:{label:"New",hint:"Not in ~/.claude yet. Moving it in loses nothing."},"fast-forward":{label:"Fast-forward",hint:"One copy is just a longer version of the other. Lossless either way."},diverged:{label:"Diverged",hint:"Both copies have messages the other does not. Ticking keeps Paddock's copy in ~/.claude; the other is kept too, in the preserve folder."},unknown:{label:"Not compared",hint:"Paddock ran out of scan budget before it could compare these two copies, so it has not assumed they are safe to merge."}};function hi(e){return ux[e]??{label:String(e),hint:"This Paddock build does not recognise this state, so it is shown as the server described it."}}function Cd(e){const t=e.indexOf("/.claude/");return t===-1?e:`~${e.slice(t)}`}function cx(e,t){return t==="all"?!0:t==="needs-decision"?!e.defaultSelected:e.state===t}function st(...e){return e.filter(Boolean).join(" ")}const dx={primary:"bg-accent-solid text-accent-fg shadow-xs hover:bg-accent-solid-hover active:scale-[0.98]",ghost:"bg-surface-active text-fg hover:bg-surface-selected",subtle:"text-fg-muted hover:bg-surface-hover hover:text-fg",danger:"bg-danger-solid text-danger-fg shadow-xs hover:brightness-110 active:scale-[0.98]",link:"text-accent underline underline-offset-2 hover:no-underline"},fx={sm:"gap-1.5 px-2 py-1 text-xs rounded-md",md:"gap-2 px-3.5 py-2 text-sm rounded-lg","icon-sm":"h-6 w-6 justify-center rounded-md","icon-md":"h-9 w-9 justify-center rounded-lg"};function jt({variant:e="ghost",size:t="md",icon:n,loading:r=!1,loadingLabel:s,align:o="center",className:i,children:a,disabled:u,type:c="button",...d}){return l.jsxs("button",{type:c,disabled:u||r,"aria-busy":r||void 0,className:st("inline-flex select-none items-center font-medium","motion-fast transition-[color,background-color,border-color,box-shadow,transform]","disabled:cursor-not-allowed disabled:opacity-50",o==="start"?"justify-start text-left":"justify-center",fx[t],dx[e],i),...d,children:[n,r&&s?s:a]})}const Tu=["w-full rounded-lg border border-edge-strong bg-surface-sunken px-3 py-2 text-sm text-fg","outline-none motion-fast transition-[border-color,box-shadow]","focus:border-accent focus:ring-2 focus:ring-accent/25","disabled:cursor-not-allowed disabled:opacity-60","aria-[invalid=true]:border-danger aria-[invalid=true]:focus:ring-danger/25"].join(" ");function _w({className:e,...t}){return l.jsx("input",{className:st(Tu,e),...t})}function Lw({className:e,...t}){return l.jsx("textarea",{className:st(Tu,"resize-y",e),...t})}function bw({className:e,...t}){return l.jsx("select",{className:st(Tu,e),...t})}function Iw({checked:e,onChange:t,label:n,disabled:r,id:s,className:o}){const i=w.useId(),a=s??i;return l.jsxs("label",{htmlFor:a,className:st("relative inline-block shrink-0 cursor-pointer",o),children:[l.jsx("input",{id:a,type:"checkbox","aria-label":n,className:"peer sr-only",checked:e,disabled:r,onChange:u=>t(u.target.checked)}),l.jsx("span",{className:st("block h-[18px] w-8 rounded-full bg-edge-strong","motion-fast transition-colors","after:absolute after:left-0.5 after:top-0.5 after:h-3.5 after:w-3.5 after:rounded-full","after:bg-surface-raised after:shadow-2xs after:transition-transform after:content-['']","peer-checked:bg-accent-solid peer-checked:after:translate-x-3.5","peer-focus-visible:ring-2 peer-focus-visible:ring-accent/50","peer-disabled:opacity-50")})]})}function Mp({label:e,description:t,indeterminate:n=!1,className:r,...s}){const o=w.useRef(null);w.useEffect(()=>{o.current&&(o.current.indeterminate=n)},[n]);const i=l.jsx("input",{ref:o,type:"checkbox",...n?{"aria-checked":"mixed"}:{},className:st("h-4 w-4 shrink-0 cursor-pointer rounded border-edge-strong accent-[var(--accent-solid)]","disabled:cursor-not-allowed disabled:opacity-50",e?"mt-0.5":"",r),...s});return e?l.jsxs("label",{className:"flex cursor-pointer items-start gap-2 text-sm text-fg",children:[i,l.jsxs("span",{className:"min-w-0",children:[e,t&&l.jsx("span",{className:"block text-xs leading-snug text-fg-muted",children:t})]})]}):i}const _p={neutral:"bg-surface-active text-fg-muted",accent:"bg-accent-soft text-accent",success:"bg-success-soft text-success",warn:"bg-warn-soft text-warn",danger:"bg-danger-soft text-danger",info:"bg-info-soft text-info",lineage:"bg-lineage-soft text-lineage"},Lp={neutral:"bg-fg-subtle",accent:"bg-accent-solid",success:"bg-success-solid",warn:"bg-warn-solid",danger:"bg-danger-solid",info:"bg-info-solid",lineage:"bg-lineage-solid"};function hx({tone:e="neutral",shape:t="tag",size:n="md",dot:r=!1,icon:s,title:o,className:i,children:a}){return l.jsxs("span",{title:o,className:st("inline-flex items-center gap-1 font-medium leading-none",t==="pill"?"rounded-full px-2 py-0.5":"rounded-md px-1.5 py-0.5",n==="sm"?"text-3xs":"text-2xs",_p[e],i),children:[r&&l.jsx("span",{className:st("h-1.5 w-1.5 shrink-0 rounded-full",Lp[e])}),s,a]})}function Dw({tone:e="neutral",pulse:t=!1,className:n}){return l.jsx("span",{className:st("inline-block h-2 w-2 shrink-0 rounded-full",Lp[e],t&&"animate-pulse",n)})}function Jt({tone:e="info",icon:t,className:n,children:r}){const s={neutral:"border-edge",accent:"border-accent-edge",success:"border-success-edge",warn:"border-warn-edge",danger:"border-danger-edge",info:"border-info-edge",lineage:"border-lineage-edge"};return l.jsxs("div",{role:e==="danger"?"alert":void 0,className:st("flex items-start gap-2 rounded-lg border px-3 py-2 text-sm",_p[e],s[e],n),children:[t&&l.jsx("span",{className:"mt-0.5 shrink-0",children:t}),l.jsx("div",{className:"min-w-0",children:r})]})}function px(e,t){w.useEffect(()=>{if(!e)return;const n=r=>{r.key==="Escape"&&t()};return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[e,t])}const mx={sm:"max-w-sm",md:"max-w-md",lg:"max-w-2xl"};function gx({open:e,onClose:t,title:n,hideTitle:r=!1,description:s,footer:o,size:i="md",role:a="dialog",dismissOnBackdrop:u=!0,onSubmit:c,className:d,children:f}){const p=w.useRef(null),y=w.useRef(null);if(px(e,t),w.useEffect(()=>{var C,g;return e?(y.current=document.activeElement,(g=((C=p.current)==null?void 0:C.querySelector("[autofocus], input:not([type=hidden]), textarea, select, button, [href], [tabindex]:not([tabindex='-1'])"))??p.current)==null||g.focus(),()=>{const h=y.current;h instanceof HTMLElement&&h.focus()}):void 0},[e]),w.useEffect(()=>{if(!e)return;const S=C=>{if(C.key!=="Tab"||!p.current)return;const g=[...p.current.querySelectorAll("input:not([type=hidden]):not([disabled]), textarea:not([disabled]), select:not([disabled]), button:not([disabled]), [href], [tabindex]:not([tabindex='-1'])")];if(g.length===0)return;const h=g[0],m=g[g.length-1],E=document.activeElement;C.shiftKey&&(E===h||!p.current.contains(E))?(C.preventDefault(),m.focus()):!C.shiftKey&&E===m&&(C.preventDefault(),h.focus())};return document.addEventListener("keydown",S),()=>document.removeEventListener("keydown",S)},[e]),!e)return null;const k=c?"form":"div";return l.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-overlay p-4 backdrop-blur-sm",onClick:()=>u&&t(),children:l.jsxs(k,{ref:p,role:a,"aria-modal":"true","aria-label":n,tabIndex:-1,onClick:S=>S.stopPropagation(),onSubmit:c,className:st("flex max-h-[85vh] w-full flex-col animate-scale-in rounded-2xl border border-edge","bg-surface-raised p-6 shadow-2xl outline-none",mx[i],d),children:[!r&&l.jsx("h2",{className:"text-base font-semibold text-fg",children:n}),s&&l.jsx("p",{className:"mt-1 text-sm text-fg-muted",children:s}),l.jsx("div",{className:"-mx-1 min-h-0 flex-1 overflow-y-auto px-1 py-1",children:f}),o&&l.jsx("div",{className:"mt-4 flex items-center justify-end gap-2",children:o})]})})}function bp({content:e,children:t,delayMs:n=250,className:r=""}){const s=w.useId(),o=w.useRef(null),i=w.useRef(null),a=w.useRef(null),[u,c]=w.useState(null),d=()=>{a.current&&clearTimeout(a.current),a.current=null},f=w.useCallback(()=>{d(),c(null)},[]),p=w.useCallback(()=>{var g;const S=(g=o.current)==null?void 0:g.getBoundingClientRect();if(!S)return;const C=S.top<56;c({x:S.left+S.width/2,y:C?S.bottom+6:S.top-6,below:C})},[]);w.useEffect(()=>d,[]),w.useEffect(()=>{if(!u)return;const S=C=>{C.key==="Escape"&&f()};return window.addEventListener("keydown",S),window.addEventListener("scroll",f,!0),window.addEventListener("resize",f),()=>{window.removeEventListener("keydown",S),window.removeEventListener("scroll",f,!0),window.removeEventListener("resize",f)}},[u,f]),w.useLayoutEffect(()=>{if(!u||!i.current)return;const S=i.current.offsetWidth;if(!S)return;const C=8+S/2,g=window.innerWidth-8-S/2,h=Math.min(Math.max(u.x,C),Math.max(C,g));h!==u.x&&c({...u,x:h})},[u]);const y=w.Children.only(t),k=w.isValidElement(y)?w.cloneElement(y,{"aria-describedby":u?s:void 0}):y;return l.jsxs(l.Fragment,{children:[l.jsx("span",{ref:o,className:`inline-flex ${r}`,onPointerEnter:S=>{S.pointerType!=="touch"&&(d(),a.current=setTimeout(p,n))},onPointerLeave:f,onPointerDown:f,onFocusCapture:p,onBlurCapture:f,children:k}),u&&Mi.createPortal(l.jsx("div",{ref:i,id:s,role:"tooltip",style:{position:"fixed",left:u.x,top:u.y,transform:`translate(-50%, ${u.below?"0":"-100%"})`},className:"pointer-events-none z-[70] max-w-[15rem] animate-fade-in rounded-lg bg-fg px-2 py-1 text-2xs leading-snug text-surface shadow-lg",children:e}),document.body)]})}function Ip({open:e,onClose:t,onCompleted:n}){const[r,s]=w.useState(null),[o,i]=w.useState(new Set),[a,u]=w.useState({kind:"loading"}),[c,d]=w.useState("all"),f=w.useRef(!1),p=w.useCallback(async()=>{u({kind:"loading"});try{const m=await or.transcriptsMigrationChats();s(m),i(tx(m)),u({kind:"plan"})}catch(m){u({kind:"load-failed",message:zp(m)})}},[]);w.useEffect(()=>{e&&(d("all"),p())},[e,p]);const y=w.useMemo(()=>Di(r),[r]),k=w.useMemo(()=>ax(r),[r]),S=w.useMemo(()=>y.reduce((m,E)=>m+(o.has(E.sessionId)?1:0),0),[y,o]),C=w.useMemo(()=>y.filter(Ix).length,[y]),g=w.useCallback(async()=>{if(!(!r||f.current)){f.current=!0,u({kind:"running"});try{const m=await or.runTranscriptsMigration(ix(r,o));ex(),u({kind:"result",result:m}),m.ok&&(n==null||n())}catch(m){u({kind:"refused",error:m})}finally{f.current=!1}}},[r,o,n]),h=a.kind==="running";return l.jsxs(Fx,{open:e,onClose:h?()=>{}:t,dismissOnBackdrop:!h,title:Ox(a),footer:l.jsx(_x,{phase:a,plan:r,rows:y,selectedCount:S,alsoMoving:k.total,onClose:t,onRetry:g,onReload:p,onSubmit:g}),children:[a.kind==="loading"&&l.jsxs("p",{className:"py-8 text-center text-sm text-fg-muted",children:["Comparing this instance's chats with your ",l.jsx(Ce,{children:"~/.claude"}),"…"]}),a.kind==="load-failed"&&l.jsxs(Jt,{tone:"danger",className:"text-sm",children:[l.jsx("p",{className:"font-semibold",children:"Could not read the migration plan."}),l.jsx("p",{className:"mt-1",children:a.message}),l.jsx("p",{className:"mt-1 text-xs",children:"Nothing has been moved."})]}),a.kind==="running"&&l.jsx(Nx,{plan:r,count:S}),a.kind==="refused"&&l.jsx(Cx,{error:a.error,plan:r,rows:y,selected:o}),a.kind==="result"&&l.jsx(Tx,{result:a.result}),a.kind==="plan"&&r&&l.jsx(vx,{plan:r,rows:y,selected:o,setSelected:i,filter:c,setFilter:d,decisionCount:C,alsoMoving:k})]})}function vx({plan:e,rows:t,selected:n,setSelected:r,filter:s,setFilter:o,decisionCount:i,alsoMoving:a}){if(Tp(e))return l.jsxs("div",{className:"py-6 text-sm text-fg-muted",children:[l.jsx("p",{className:"font-semibold text-fg",children:"Nothing to move."}),l.jsxs("p",{className:"mt-1",children:["Every project's ",l.jsx(Ce,{children:".chats/"})," is already empty, so there is nothing to merge into your ",l.jsx(Ce,{children:"~/.claude"}),"."]})]});const u=t.length>0&&t.every(d=>n.has(d.sessionId)),c=t.reduce((d,f)=>d+(n.has(f.sessionId)?1:0),0);return l.jsxs("div",{className:"space-y-3",children:[l.jsxs("p",{className:"text-base text-fg",children:[l.jsxs("strong",{className:"font-semibold",children:[c.toLocaleString()," of ",t.length.toLocaleString()," ",t.length===1?"chat":"chats"]})," ","will move into ",l.jsx(Ce,{children:"~/.claude"}),"."," ",l.jsxs("span",{className:"text-fg-muted",children:["The rest are set aside in ",l.jsx(Ce,{children:".chats-pre-migration/"}),", not deleted."]})]}),l.jsx(yx,{plan:e}),l.jsx(xx,{plan:e,filter:s,setFilter:o,decisionCount:i}),l.jsx("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-2 border-b border-edge pb-2",children:l.jsx(Mp,{checked:u,indeterminate:!u&&n.size>0,onChange:()=>r(sx(e,!u)),label:l.jsx("span",{className:"text-xs",children:"Select all"})})}),l.jsx("ul",{className:"space-y-4",children:e.projects.map(d=>l.jsx(kx,{project:d,selected:n,setSelected:r,filter:s},d.slug))}),a.total>0&&l.jsx(wx,{alsoMoving:a})]})}function yx({plan:e}){const[t,n]=w.useState(!1),r=e.warnings.length+(e.scanBudgetExhausted?1:0);return r===0?null:l.jsxs("div",{className:"rounded-lg border border-warn-edge bg-warn-soft/30",children:[l.jsxs("button",{type:"button",onClick:()=>n(!t),"aria-expanded":t,className:"focus-visible:focus-ring flex w-full items-center gap-1.5 rounded-lg px-3 py-2 text-left text-xs font-semibold text-warn-fg",children:[l.jsx(Dp,{open:t}),r.toLocaleString()," ",r===1?"warning":"warnings",l.jsx("span",{className:"ml-auto font-normal text-fg-muted",children:t?"Hide":"Show"})]}),t&&l.jsxs("div",{className:"space-y-2 px-3 pb-3 pl-8 text-xs text-warn-fg",children:[e.scanBudgetExhausted&&l.jsxs("p",{children:[l.jsxs("strong",{className:"font-semibold",children:[e.totals.unknown.toLocaleString()," ",e.totals.unknown===1?"chat":"chats"," could not be compared."]})," ","Comparing two copies means reading both in full, and this instance has more of them than one pass is allowed to read. Those rows start unticked — Paddock will not assume a chat is safe to merge when it has not looked. Nothing is lost either way."]}),e.warnings.length>0&&l.jsx(Op,{warnings:e.warnings})]})]})}function xx({plan:e,filter:t,setFilter:n,decisionCount:r}){const s=[{state:"new",n:e.totals.new},{state:"fast-forward",n:e.totals.fastForward},{state:"diverged",n:e.totals.diverged},{state:"unknown",n:e.totals.unknown}];return l.jsxs("div",{role:"tablist","aria-label":"Filter chats",className:"flex flex-wrap items-center gap-1",children:[l.jsx(va,{active:t==="all",onClick:()=>n("all"),label:`All ${e.totals.chats.toLocaleString()}`}),r>0&&l.jsx(va,{active:t==="needs-decision",onClick:()=>n("needs-decision"),label:`${r.toLocaleString()} need a decision`}),l.jsx("span",{className:"mx-1 h-4 w-px bg-edge","aria-hidden":"true"}),s.map(({state:o,n:i})=>i===0?null:l.jsx(bp,{content:hi(o).hint,children:l.jsx(va,{active:t===o,onClick:()=>n(o),label:`${i.toLocaleString()} ${hi(o).label.toLowerCase()}`,tone:$p[o]})},o))]})}function va({active:e,onClick:t,label:n,tone:r}){return l.jsx("button",{type:"button",role:"tab","aria-selected":e,onClick:t,className:Oi("focus-visible:focus-ring rounded-full border px-2.5 py-1 text-xs transition",e?"border-accent-edge bg-accent-soft font-semibold text-fg":"border-edge text-fg-muted can-hover:hover:border-edge-strong can-hover:hover:text-fg",!e&&r==="info"&&"text-info-fg",!e&&r==="success"&&"text-success-fg",!e&&r==="warn"&&"text-warn-fg"),children:n})}function wx({alsoMoving:e}){const[t,n]=w.useState(!1),r=[];return e.identical>0&&r.push(`${e.identical.toLocaleString()} ${e.identical===1?"chat that is":"chats that are"} already identical in both places`),e.projectExtras>0&&r.push(`${e.projectExtras.toLocaleString()} project ${e.projectExtras===1?"file":"files"} such as agent memory`),e.sweeperChats>0&&r.push(`${e.sweeperChats.toLocaleString()} internal sweeper transcripts`),l.jsxs("div",{className:"border-t border-edge pt-3",children:[l.jsxs("button",{type:"button",onClick:()=>n(!t),"aria-expanded":t,className:"focus-visible:focus-ring flex w-full items-center gap-1.5 rounded text-left text-xs text-fg-muted can-hover:hover:text-fg",children:[l.jsx(Dp,{open:t}),l.jsxs("span",{children:["Also moving: ",l.jsx("span",{className:"text-fg",children:Sx(e)})]})]}),t&&l.jsxs("p",{className:"mt-1.5 pl-5 text-xs text-fg-muted",children:[Ax(r),". These have no decision attached — Paddock's copy of an identical chat is set aside rather than deleted, and the rest have no counterpart to conflict with."," ",l.jsx(Ce,{children:".chats/"})," has to end up completely empty for the switch to take effect."]})]})}function Sx(e){const t=[],n=e.identical+e.projectExtras;return n>0&&t.push(`+${n.toLocaleString()} ${n===1?"chat":"chats"}`),e.sweeperChats>0&&t.push(`+${e.sweeperChats.toLocaleString()} sweeper`),t.join(", ")}function Dp({open:e}){return l.jsx("svg",{viewBox:"0 0 12 12","aria-hidden":"true",className:Oi("h-3 w-3 shrink-0 transition-transform duration-fast",e&&"rotate-90"),children:l.jsx("path",{d:"M4 2.5 8 6l-4 3.5z",fill:"currentColor"})})}function kx({project:e,selected:t,setSelected:n,filter:r}){const s=e.chats.filter(a=>cx(a,r)),o=w.useMemo(()=>({...e,chats:s}),[e,s]),i=nx(o,t);return s.length===0&&e.projectExtras.length===0?null:l.jsxs("li",{children:[l.jsxs("div",{className:"mb-1.5 flex flex-wrap items-baseline justify-between gap-x-3 gap-y-1 border-t border-edge pt-3",children:[l.jsx(bp,{content:l.jsxs("span",{className:"block max-w-xs break-all font-mono text-2xs",children:["→ ",Cd(e.hostStore),s.some(Dx)&&l.jsxs(l.Fragment,{children:[l.jsx("br",{}),"kept, not deleted → ",Cd(e.preserveDir)]})]}),className:"min-w-0",children:l.jsx("h3",{className:"min-w-0 truncate text-base font-semibold text-fg",children:e.name||"Root workspace"})}),s.length>0&&l.jsx(Mp,{checked:i.all,indeterminate:i.some,onChange:()=>n(rx(t,o,!i.all)),label:l.jsxs("span",{className:"whitespace-nowrap text-2xs text-fg-muted",children:[i.selected," of ",i.total]})})]}),s.length===0?l.jsxs("p",{className:"rounded-lg border border-dashed border-edge px-3 py-2 text-xs text-fg-muted",children:["No chats here need a decision — ",e.projectExtras.length.toLocaleString()," project"," ",e.projectExtras.length===1?"file moves":"files move"," with it anyway."]}):l.jsx("ul",{className:"space-y-1",children:s.map(a=>l.jsx(jx,{chat:a,checked:t.has(a.sessionId),onToggle:()=>n(ox(t,a.sessionId))},a.sessionId))})]})}function jx({chat:e,checked:t,onToggle:n}){const r=e.state==="diverged"||e.state==="unknown";return l.jsx("li",{children:l.jsxs("label",{title:bx(e),className:Oi("flex cursor-pointer items-start gap-2.5 rounded-lg border px-3 py-2 transition","can-hover:hover:bg-surface-hover",r?"border-warn-edge bg-warn-soft/30":"border-edge"),children:[l.jsx("input",{type:"checkbox",className:"mt-1 h-4 w-4 shrink-0 accent-[var(--accent-solid)]",checked:t,onChange:n,"aria-label":`Merge ${e.name??e.sessionId} into ~/.claude`}),l.jsxs("span",{className:"min-w-0 flex-1",children:[l.jsxs("span",{className:"flex flex-wrap items-baseline gap-x-2 gap-y-0.5",children:[l.jsx("span",{className:"min-w-0 truncate text-sm text-fg",children:e.name??l.jsx("span",{className:"font-mono text-xs",children:e.sessionId})}),l.jsx(Lx,{state:e.state})]}),e.preview&&e.preview!==e.name&&l.jsx("span",{className:"mt-0.5 block truncate text-xs text-fg-muted",children:e.preview}),r&&e.host&&l.jsx(Ex,{chat:e,checked:t})]})]})})}function Ex({chat:e,checked:t}){return e.host?l.jsxs("span",{className:"mt-1.5 grid grid-cols-1 gap-1 sm:grid-cols-2",children:[l.jsx(Pd,{title:"Paddock's copy",side:e.own,wins:t,note:t?"moves into ~/.claude":"kept in the preserve folder"}),l.jsx(Pd,{title:"Your ~/.claude copy",side:e.host,wins:!t,note:t?"moved aside, kept":"stays where it is"})]}):null}function Pd({title:e,side:t,wins:n,note:r}){return l.jsxs("span",{className:Oi("block rounded-md border px-2 py-1.5 text-2xs",n?"border-accent-edge bg-accent-soft":"border-edge bg-surface"),children:[l.jsxs("span",{className:"flex items-baseline justify-between gap-2",children:[l.jsx("span",{className:"font-semibold text-fg",children:e}),l.jsx("span",{className:n?"text-accent":"text-fg-muted",children:r})]}),l.jsxs("span",{className:"mt-0.5 block text-fg-muted tabular",children:[t.messageCount!==void 0?`${t.messageCount.toLocaleString()} ${t.messageCount===1?"message":"messages"}`:zx(t.sizeBytes)," · ",t.lastMessageAt?l.jsxs(l.Fragment,{children:["last message ",wl(t.lastMessageAt)]}):l.jsxs(l.Fragment,{children:["file touched ",wl(t.mtime)]})]})]})}function Nx({plan:e,count:t}){var n;return l.jsxs("div",{className:"space-y-3 py-6",children:[l.jsxs("p",{className:"text-sm font-semibold text-fg",children:[l.jsx("span",{className:"mr-2 inline-block h-2 w-2 animate-pulse rounded-full bg-accent-solid"}),"Merging ",t.toLocaleString()," ",t===1?"chat":"chats","…"]}),l.jsxs("ol",{className:"ml-4 list-decimal space-y-1 text-xs text-fg-muted",children:[l.jsx("li",{children:"Stopping any turns that are still running."}),l.jsxs("li",{children:["Moving transcripts into"," ",l.jsx(Ce,{children:((n=e==null?void 0:e.projects[0])==null?void 0:n.hostStore.replace(/\/[^/]*$/,"/…"))??"~/.claude"}),"."]}),l.jsxs("li",{children:["Setting ",l.jsx(Ce,{children:"claude.transcripts: host"}),"."]})]}),l.jsx("p",{className:"text-xs text-fg-subtle",children:"Please leave this open. Nothing is deleted at any point, and if this is interrupted the migration can simply be run again."})]})}function Cx({error:e,plan:t,rows:n,selected:r}){const s=e instanceof On?e.code:void 0,o=$x(e),i=a=>{var u;return((u=n.find(c=>c.sessionId===a))==null?void 0:u.name)??a};return l.jsxs("div",{className:"space-y-3",children:[l.jsxs(Jt,{tone:s==="env_shadowed"?"danger":"warn",className:"text-sm",children:[l.jsx("p",{className:"font-semibold",children:Px[s??""]??"The migration did not run."}),l.jsxs("p",{className:"mt-1 text-fg",children:[l.jsx("strong",{className:"font-semibold",children:"Nothing was moved."})," Every one of these checks runs before the first file is touched, so your chats are exactly where they were."]}),l.jsx("p",{className:"mt-1.5 text-xs",children:zp(e)})]}),s==="turn_running"&&o.length>0&&l.jsxs("div",{className:"text-xs text-fg-muted",children:[l.jsx("p",{className:"font-semibold text-fg",children:"Still running:"}),l.jsx("ul",{className:"mt-1 space-y-0.5",children:o.map(a=>l.jsxs("li",{className:"break-all",children:[l.jsx("span",{className:"text-fg",children:i(a)})," ",l.jsx("span",{className:"font-mono text-2xs text-fg-subtle",children:a})]},a))}),l.jsxs("p",{className:"mt-1.5",children:["A chat mid-turn is still writing to its transcript, so moving it would race the write. Wait for it to finish — or stop it from its own chat screen — then try again. One chat left behind would leave that project's ",l.jsx(Ce,{children:".chats/"})," non-empty, which is why the whole migration refuses rather than skipping it."]})]}),s==="config_conflict"&&l.jsxs("p",{className:"text-xs text-fg-muted",children:["Something else edited ",l.jsx(Ce,{children:(t==null?void 0:t.configPath)??"paddock.config.yaml"})," after this plan was built — another tab, or an editor. Reload the plan so your choices are made against the current file, then submit again."]}),s==="migration_in_progress"&&l.jsx("p",{className:"text-xs text-fg-muted",children:"Another tab or window is running this migration right now. Let it finish — when it does, reload this plan and it will report that there is nothing left to move."}),s==="env_shadowed"&&l.jsxs("p",{className:"text-xs text-fg-muted",children:[l.jsx(Ce,{children:"PADDOCK_CLAUDE_TRANSCRIPTS"})," is set in this server's environment, and an environment variable beats the config file. Writing"," ",l.jsx(Ce,{children:"claude.transcripts: host"})," would have no effect, so the chats would have been moved for nothing. Unset it, restart Paddock, and the offer will come back."]}),l.jsxs("p",{className:"text-2xs text-fg-subtle",children:["Your selection is still here: ",r.size.toLocaleString()," of"," ",n.length.toLocaleString()," ticked."]})]})}const Px={turn_running:"A chat is still mid-turn.",config_conflict:"The config file changed underneath this plan.",migration_in_progress:"A migration is already running.",env_shadowed:"An environment variable is overriding the config file.",invalid:"That request was not valid."};function Tx({result:e}){const t=Rp(e),n=lx(e.preserved),r=e.projects.filter(s=>s.outcome==="skipped-busy");return l.jsxs("div",{className:"space-y-3",children:[t==="partial"?l.jsxs(Jt,{tone:"warn",className:"text-sm",children:[l.jsx("p",{className:"font-semibold",children:"The migration did not finish."}),l.jsxs("p",{className:"mt-1",children:[l.jsx(Ce,{children:"claude.transcripts"})," was ",l.jsx("strong",{className:"font-semibold",children:"not"})," ","changed, so this instance is still using its own store and nothing about how Paddock behaves has changed yet. Files that did move are already in place and will not move twice — ",l.jsx("strong",{className:"font-semibold",children:"running this again is safe"})," and picks up where it stopped."]})]}):t==="already"?l.jsxs(Jt,{tone:"info",className:"text-sm",children:[l.jsx("p",{className:"font-semibold",children:"Already merged."}),l.jsxs("p",{className:"mt-1",children:["Everything was already in your ",l.jsx(Ce,{children:"~/.claude"})," and"," ",l.jsx(Ce,{children:"claude.transcripts"})," was already ",l.jsx(Ce,{children:"host"}),". Nothing needed doing."]})]}):l.jsxs(Jt,{tone:"success",className:"text-sm",children:[l.jsxs("p",{className:"font-semibold",children:["Merged ",e.migrated.length.toLocaleString()," ",e.migrated.length===1?"chat":"chats"," into your ",l.jsx(Ce,{children:"~/.claude"}),"."]}),e.preserved.length>0&&l.jsxs("p",{className:"mt-1",children:[e.preserved.length.toLocaleString()," ",e.preserved.length===1?"copy was":"copies were"," set aside rather than overwritten. Every one is listed below."]})]}),e.restartRequired&&l.jsx(Rx,{ok:t!=="partial",configWritten:e.configWritten}),e.failed.length>0&&l.jsxs("section",{children:[l.jsxs("h3",{className:"text-xs font-semibold text-fg",children:[e.failed.length.toLocaleString()," could not be moved"]}),l.jsx("ul",{className:"mt-1 space-y-1",children:e.failed.map((s,o)=>l.jsxs("li",{className:"rounded-md border border-warn-edge bg-warn-soft/40 px-2 py-1.5 text-2xs",children:[l.jsx("span",{className:"block break-all font-mono text-fg",children:Td(s)}),l.jsxs("span",{className:"block text-fg-muted",children:[s.reason,s.message?` — ${s.message}`:""]}),s.path&&Td(s)!==s.path&&l.jsx("span",{className:"block break-all font-mono text-fg-subtle",children:s.path})]},`${s.slug}:${s.sessionId}:${o}`))})]}),r.length>0&&l.jsxs(Jt,{tone:"warn",className:"text-xs",children:[l.jsxs("p",{className:"font-semibold",children:[r.length," ",r.length===1?"project was":"projects were"," left untouched."]}),l.jsxs("p",{className:"mt-1",children:["A turn started again between the stop and the move, so"," ",r.map(s=>s.slug||"the root workspace").join(", ")," was skipped entirely rather than half-moved. Run the migration again once it is idle."]})]}),e.preserved.length>0&&l.jsxs("section",{"data-testid":"migration-preserved",children:[l.jsxs("h3",{className:"text-xs font-semibold text-fg",children:["Kept, not deleted — ",e.preserved.length.toLocaleString()," ",e.preserved.length===1?"item":"items"]}),l.jsxs("p",{className:"mt-0.5 text-2xs text-fg-muted",children:["Every copy that did not end up in ",l.jsx(Ce,{children:"~/.claude"}),", and exactly where it is now. Nothing here was removed; you can open any of these paths. A chat's sub-agent transcripts, tool results and revert history move with it."]}),n.map(s=>l.jsxs("div",{className:"mt-2",children:[l.jsx("p",{className:"text-2xs font-semibold text-fg-muted",children:s.slug||"root workspace"}),l.jsx("ul",{className:"mt-0.5 space-y-0.5",children:s.items.map((o,i)=>l.jsxs("li",{className:"text-2xs",children:[l.jsx("span",{className:"block break-all font-mono text-fg",children:o.path}),l.jsx("span",{className:"text-fg-subtle",children:Mx(o.reason,o.side)})]},`${o.path}:${i}`))})]},s.slug))]}),e.unplanned.length>0&&l.jsxs("section",{children:[l.jsxs("h3",{className:"text-xs font-semibold text-fg",children:[e.unplanned.length.toLocaleString()," appeared after you opened this"]}),l.jsx("p",{className:"mt-0.5 text-2xs text-fg-muted",children:"These chats were created between the table being built and Submit, so you were never shown them. Each was handled by the same default its classification would have had."}),l.jsx("ul",{className:"mt-1 space-y-0.5",children:e.unplanned.map((s,o)=>l.jsxs("li",{className:"break-all text-2xs",children:[l.jsx("span",{className:"font-mono text-fg",children:s.sessionId})," ",l.jsxs("span",{className:"text-fg-muted",children:["— ",hi(s.state).label.toLowerCase(),", so it was"," ",s.action==="migrated"?"merged":"kept in the preserve folder"]})]},`${s.sessionId}:${o}`))})]}),e.ignoredSessionIds.length>0&&l.jsxs("p",{className:"text-2xs text-fg-muted",children:[e.ignoredSessionIds.length.toLocaleString()," ticked"," ",e.ignoredSessionIds.length===1?"chat was":"chats were"," no longer on disk and were skipped."]}),e.warnings.length>0&&l.jsx(Op,{warnings:e.warnings}),e.sweepers.chats>0&&l.jsxs("p",{className:"text-2xs text-fg-subtle",children:[e.sweepers.chats.toLocaleString()," internal sweeper transcripts across"," ",e.sweepers.stores.toLocaleString()," ",e.sweepers.stores===1?"store":"stores"," moved with their projects."]})]})}function Rx({ok:e,configWritten:t}){return e?t?l.jsxs(Jt,{tone:"accent",className:"text-sm",children:[l.jsx("p",{className:"font-semibold text-fg",children:"Restart the Paddock server now."}),l.jsxs("p",{className:"mt-1",children:["The setting is written, but Paddock reads it once when it starts — so this running server has not picked it up yet."," ",l.jsx("strong",{className:"font-semibold text-fg",children:"Until you restart, your chat list will look empty."})," ","That is expected and nothing is wrong: the running process is still looking in the old location, which the migration just emptied. Everything is on disk — the merged chats are in your ",l.jsx(Ce,{children:"~/.claude"})," and the set-aside copies are in the folders listed here. They all come back the moment Paddock restarts."]})]}):l.jsxs(Jt,{tone:"accent",className:"text-sm",children:[l.jsx("p",{className:"font-semibold text-fg",children:"Restart the Paddock server now."}),l.jsxs("p",{className:"mt-1",children:["Your configuration already asked for ",l.jsx(Ce,{children:"~/.claude"}),", so"," ",l.jsx("strong",{className:"font-semibold text-fg",children:"nothing about it was changed"})," — the chats were simply stranded where Paddock could not reach them, and they are now back in the store it reads. Paddock only wires that up at startup, so this running server has not caught up yet."," ",l.jsx("strong",{className:"font-semibold text-fg",children:"Restart and the chats that were missing will reappear."})," ","The copies set aside along the way are in the folders listed here."]})]}):l.jsxs(Jt,{tone:"accent",className:"text-sm",children:[l.jsx("p",{className:"font-semibold text-fg",children:"Run the migration again, then restart."}),l.jsxs("p",{className:"mt-1",children:["Some chats have already moved out of Paddock's own store, and because the setting was not written this server still looks for them there."," ",l.jsx("strong",{className:"font-semibold text-fg",children:"Until the migration finishes, your chat list will look incomplete."})," ","Nothing is lost — every file is either in your ",l.jsx(Ce,{children:"~/.claude"})," or in the folders listed below. Fix what is reported above, run this again, and restart when it completes."]})]})}function Mx(e,t){switch(e){case"unchecked":return"you left this one unticked, so Paddock's copy was set aside and your ~/.claude copy is untouched";case"unplanned-diverged":return"created after the table was built and had conflicting edits, so it was set aside rather than merged without asking";case"identical":return"already identical in both places, so Paddock's duplicate was set aside";case"already-ahead":return"your ~/.claude copy was the longer one and was kept, so Paddock's shorter copy was set aside";case"superseded":return"your ~/.claude copy was moved here first, then Paddock's copy took its place — this is the original";default:return`set aside from the ${t==="host"?"~/.claude":"Paddock"} side (${e})`}}function _x({phase:e,plan:t,rows:n,selectedCount:r,alsoMoving:s,onClose:o,onRetry:i,onReload:a,onSubmit:u}){if(e.kind==="running")return l.jsx("span",{className:"text-xs text-fg-muted",children:"Working — this usually takes under a second."});if(e.kind==="result")return l.jsx(jt,{variant:"primary",size:"sm",onClick:o,children:"Close"});if(e.kind==="load-failed")return l.jsxs(l.Fragment,{children:[l.jsx(jt,{variant:"ghost",size:"sm",onClick:o,children:"Close"}),l.jsx(jt,{variant:"primary",size:"sm",onClick:a,children:"Try again"})]});if(e.kind==="refused"){const c=e.error instanceof On?e.error.code:void 0,d=c!=="env_shadowed"&&c!=="invalid";return l.jsxs(l.Fragment,{children:[l.jsx(jt,{variant:"ghost",size:"sm",onClick:o,children:"Close"}),c==="config_conflict"?l.jsx(jt,{variant:"primary",size:"sm",onClick:a,children:"Reload the plan"}):d&&l.jsx(jt,{variant:"primary",size:"sm",onClick:i,children:"Try again"})]})}return e.kind==="loading"||!t?l.jsx(jt,{variant:"ghost",size:"sm",onClick:o,children:"Cancel"}):Tp(t)?l.jsx(jt,{variant:"primary",size:"sm",onClick:o,children:"Close"}):l.jsxs(l.Fragment,{children:[l.jsxs("span",{className:"mr-auto text-xs text-fg-muted",children:[r.toLocaleString()," of ",n.length.toLocaleString()," ticked",s>0&&l.jsxs("span",{className:"text-fg-subtle",children:[" · ",s.toLocaleString()," more move anyway"]})]}),l.jsx(jt,{variant:"ghost",size:"sm",onClick:o,children:"Cancel"}),l.jsx(jt,{variant:"primary",size:"sm",onClick:u,children:r===0?"Merge nothing, keep everything":`Merge ${r.toLocaleString()} ${r===1?"chat":"chats"}`})]})}function Op({warnings:e}){return l.jsx("ul",{className:"space-y-1",children:e.map((t,n)=>l.jsxs("li",{children:[l.jsx("span",{children:t.message}),t.paths&&t.paths.length>0&&l.jsxs("details",{className:"mt-0.5",children:[l.jsx("summary",{className:"focus-visible:focus-ring cursor-pointer text-2xs underline underline-offset-2",children:t.paths.length===1?"Show the path":`Show ${t.paths.length} paths`}),l.jsx("ul",{className:"mt-0.5",children:t.paths.map(r=>l.jsx("li",{className:"break-all font-mono text-2xs text-fg-subtle",children:r},r))})]})]},`${t.code}:${n}`))})}const $p={new:"success","fast-forward":"info",diverged:"warn",unknown:"neutral"};function Lx({state:e,n:t}){if(t===0)return null;const n=hi(e);return l.jsx(hx,{tone:$p[e]??"neutral",title:n.hint,children:t===void 0?n.label:`${t.toLocaleString()} ${n.label.toLowerCase()}`})}function bx(e){const t=[];return e.name!==void 0&&t.push(e.sessionId),e.extras.length>0&&t.push(`+${e.extras.length} sidecar ${e.extras.length===1?"file":"files"}`),t.length>0?t.join(" · "):void 0}function Ix(e){return!e.defaultSelected}function Dx(e){return e.state==="diverged"||e.state==="unknown"}function Ce({children:e}){return l.jsx("span",{className:"break-all font-mono",children:e})}function zp(e){return e instanceof Error?e.message:String(e)}function Ox(e){const t="Merge chats into ~/.claude";if(e.kind!=="result")return t;switch(Rp(e.result)){case"partial":return`${t} — unfinished`;case"already":return`${t} — nothing to do`;default:return`${t} — done`}}function Td(e){return e.sessionId&&e.sessionId!=="-"?e.sessionId:e.path??"Project files"}function $x(e){if(!(e instanceof On))return[];const t=e.body;if(typeof t!="object"||t===null)return[];const n=t.sessionIds;return Array.isArray(n)?n.filter(r=>typeof r=="string"):[]}function zx(e){return e<1024?`${e} B`:e<1024*1024?`${Math.round(e/1024)} kB`:`${(e/1024/1024).toFixed(1)} MB`}function Ax(e){return e.length<=1?e[0]??"":`${e.slice(0,-1).join(", ")} and ${e[e.length-1]}`}function Oi(...e){return e.filter(Boolean).join(" ")}function Fx(e){return l.jsx(gx,{...e,size:"lg",className:"sm:max-w-4xl"})}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 Ux=e=>l.jsx("svg",{...q(e),children:l.jsx("path",{d:"M12 5v14M5 12h14"})}),Ow=e=>l.jsx("svg",{...q(e),children:l.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"})}),Bx=e=>l.jsxs("svg",{...q(e),children:[l.jsx("path",{d:"M3 10.5 12 3l9 7.5"}),l.jsx("path",{d:"M5 9.5V20a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V9.5"})]}),$w=e=>l.jsx("svg",{...q(e),children:l.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"})}),Rd=e=>l.jsxs("svg",{...q(e),children:[l.jsx("circle",{cx:"11",cy:"11",r:"7"}),l.jsx("path",{d:"m21 21-4.3-4.3"})]}),zw=e=>l.jsxs("svg",{...q(e),children:[l.jsx("path",{d:"M4 5h16"}),l.jsx("path",{d:"M8 5v6h12"}),l.jsx("path",{d:"M8 11v6h12"})]}),Aw=e=>l.jsx("svg",{...q(e),children:l.jsx("path",{d:"M4 6h16M4 12h16M4 18h16"})}),Wx=e=>l.jsx("svg",{...q(e),children:l.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"})}),Fw=e=>l.jsxs("svg",{...q(e),children:[l.jsx("path",{d:"m22 2-7 20-4-9-9-4Z"}),l.jsx("path",{d:"M22 2 11 13"})]}),Uw=e=>l.jsx("svg",{...q(e),children:l.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"})}),Bw=e=>l.jsxs("svg",{...q(e),children:[l.jsx("rect",{x:"9",y:"2",width:"6",height:"12",rx:"3"}),l.jsx("path",{d:"M5 10a7 7 0 0 0 14 0"}),l.jsx("path",{d:"M12 17v4M8 21h8"})]}),Ww=e=>l.jsx("svg",{...q(e),children:l.jsx("path",{d:"m9 18 6-6-6-6"})}),Vw=e=>l.jsx("svg",{...q(e),children:l.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"})}),Vx=e=>l.jsxs("svg",{...q(e),children:[l.jsx("circle",{cx:"12",cy:"12",r:"3"}),l.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"})]}),Hx=e=>l.jsxs("svg",{...q(e),children:[l.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"}),l.jsx("path",{d:"M12 9v4M12 17h.01"})]}),Hw=e=>l.jsx("svg",{...q(e),children:l.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"})}),$i=e=>l.jsx("svg",{...q(e),children:l.jsx("path",{d:"M18 6 6 18M6 6l12 12"})}),Qw=e=>l.jsx("svg",{...q(e),children:l.jsx("path",{d:"M13 2 4.5 13.5H11l-1 8.5 8.5-11.5H12z"})}),Kw=e=>l.jsx("svg",{...q(e),children:l.jsx("path",{d:"M6 4.5v15l13-7.5z"})}),Qx=e=>l.jsx("svg",{...q(e),children:l.jsx("path",{d:"M3 6h18M3 12h18M3 18h18"})}),Gw=e=>l.jsxs("svg",{...q(e),children:[l.jsx("circle",{cx:"12",cy:"12",r:"9"}),l.jsx("path",{d:"M12 7v5l3 2"})]}),Yw=e=>l.jsxs("svg",{...q(e),children:[l.jsx("circle",{cx:"12",cy:"5",r:"1"}),l.jsx("circle",{cx:"12",cy:"12",r:"1"}),l.jsx("circle",{cx:"12",cy:"19",r:"1"})]}),Jw=e=>l.jsx("svg",{...q(e),children:l.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"})}),Xw=e=>l.jsxs("svg",{...q(e),children:[l.jsx("path",{d:"M12 20h9"}),l.jsx("path",{d:"M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4Z"})]}),Zw=e=>l.jsxs("svg",{...q(e),children:[l.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8Z"}),l.jsx("path",{d:"M14 2v6h6"})]}),qw=e=>l.jsxs("svg",{...q(e),children:[l.jsx("path",{d:"M12 17v5"}),l.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"})]}),Kx=e=>l.jsx("svg",{...q(e),children:l.jsx("path",{d:"M20 6 9 17l-5-5"})}),eS=({open:e,...t})=>e?l.jsxs("svg",{...q(t),children:[l.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"}),l.jsx("path",{d:"m22 10-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 10"})]}):l.jsxs("svg",{...q(t),children:[l.jsx("rect",{width:"20",height:"16",x:"2",y:"4",rx:"2"}),l.jsx("path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7"})]}),tS=e=>l.jsxs("svg",{...q(e),children:[l.jsx("circle",{cx:"6",cy:"6",r:"3"}),l.jsx("circle",{cx:"6",cy:"18",r:"3"}),l.jsx("circle",{cx:"18",cy:"6",r:"3"}),l.jsx("path",{d:"M6 9v6M18 9a9 9 0 0 1-9 9"})]}),nS=e=>l.jsxs("svg",{...q(e),children:[l.jsx("path",{d:"M9.5 14.5l-1.7 1.7a4 4 0 0 1-5.66-5.66l1.7-1.7"}),l.jsx("path",{d:"M14.5 9.5l1.7-1.7a4 4 0 0 1 5.66 5.66l-1.7 1.7"}),l.jsx("path",{d:"M8 3.5v2M3.5 8h2M16 20.5v-2M20.5 16h-2"})]}),rS=e=>l.jsxs("svg",{...q(e),children:[l.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),l.jsx("path",{d:"M17 8l-5-5-5 5M12 3v12"})]}),sS=e=>l.jsx("svg",{...q(e),children:l.jsx("path",{d:"M4 17l6-5-6-5M12 19h8"})}),oS=e=>l.jsx("svg",{...q(e),children:l.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"})}),Gx=e=>l.jsxs("svg",{...q(e),children:[l.jsx("circle",{cx:"12",cy:"12",r:"4"}),l.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"})]}),Yx=e=>l.jsx("svg",{...q(e),children:l.jsx("path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z"})}),Jx=e=>l.jsxs("svg",{...q(e),children:[l.jsx("path",{d:"M10 13a5 5 0 0 0 7.5.5l3-3a5 5 0 0 0-7-7l-1.5 1.5"}),l.jsx("path",{d:"M14 11a5 5 0 0 0-7.5-.5l-3 3a5 5 0 0 0 7 7l1.5-1.5"})]}),iS=e=>l.jsx("svg",{...q(e),children:l.jsx("path",{d:"m6 9 6 6 6-6"})}),aS=e=>l.jsxs("svg",{...q(e),children:[l.jsx("rect",{x:"3",y:"4",width:"18",height:"4",rx:"1"}),l.jsx("path",{d:"M5 8v11a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V8"}),l.jsx("path",{d:"M10 12h4"})]}),lS=e=>l.jsx("svg",{...q(e),children:l.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"})});function Xx({message:e,tone:t="success",onDismiss:n,durationMs:r=6e3,action:s}){if(w.useEffect(()=>{if(e===null||r<=0)return;const i=setTimeout(n,r);return()=>clearTimeout(i)},[e,r,n]),e===null)return null;const o=t==="error";return l.jsx("div",{role:"status","aria-live":"polite",className:"pointer-events-none fixed inset-x-0 bottom-4 z-50 flex justify-center px-4",children:l.jsxs("div",{className:`pointer-events-auto flex max-w-md items-start gap-2 rounded-lg border px-3 py-2 text-sm shadow-lg ${o?"border-danger-edge bg-danger-soft text-danger":"border-edge bg-surface-raised text-fg"}`,children:[o?l.jsx(Hx,{width:16,height:16,className:"mt-0.5 shrink-0"}):l.jsx(Kx,{width:16,height:16,className:"mt-0.5 shrink-0 text-success-solid"}),l.jsx("span",{className:"break-words",children:e}),s&&l.jsx("button",{type:"button",onClick:s.onAct,className:"ml-1 shrink-0 font-medium underline underline-offset-2 transition hover:opacity-80",children:s.label}),l.jsx("button",{type:"button",onClick:n,"aria-label":"Dismiss notification",className:"-mr-1 ml-1 flex h-5 w-5 shrink-0 items-center justify-center rounded transition hover:bg-surface-hover",children:l.jsx($i,{width:12,height:12})})]})})}function Zx(){const{showBanner:e,dismiss:t}=Pp(),n=Zs(),[r,s]=w.useState(!1),[o,i]=w.useState(null),[a,u]=w.useState(!1),c=()=>{t(),i("Hidden on this browser. The migration is still on the Config screen.")};return l.jsxs(l.Fragment,{children:[e&&!a&&l.jsxs("div",{"data-testid":"migration-offer",className:"flex h-6 shrink-0 items-center rounded-md border border-accent-edge bg-accent-soft pr-0.5",children:[l.jsxs("button",{type:"button",onClick:()=>s(!0),title:"Your chats live in Paddock's own store, not in ~/.claude. Merge them in so the Claude Code CLI sees them too.","aria-label":"Merge this instance's chats into your ~/.claude",className:"focus-visible:focus-ring flex h-6 items-center gap-1.5 rounded-md pl-2 pr-1.5 text-2xs can-hover:hover:underline",children:[l.jsx("span",{className:"h-1.5 w-1.5 shrink-0 rounded-[1px] bg-accent-solid","aria-hidden":"true"}),l.jsxs("span",{className:"hidden whitespace-nowrap text-fg-muted sm:inline",children:["Chats are separate from ",l.jsx("span",{className:"font-mono",children:"~/.claude"})]}),l.jsxs("span",{className:"whitespace-nowrap font-semibold text-accent",children:["Merge",l.jsx("span",{className:"sm:hidden",children:" chats"})]})]}),l.jsx("button",{type:"button","data-testid":"migration-offer-dismiss",onClick:c,"aria-label":"Hide the transcript migration offer",title:"Hide this. You can still start the migration from the Config screen.",className:"focus-visible:focus-ring flex h-5 w-5 shrink-0 items-center justify-center rounded text-accent can-hover:hover:bg-accent-solid/15",children:l.jsx($i,{width:11,height:11})})]}),l.jsx(Ip,{open:r,onClose:()=>s(!1),onCompleted:()=>u(!0)}),l.jsx(Xx,{message:o,onDismiss:()=>i(null),durationMs:12e3,action:{label:"Open Config",onAct:()=>{i(null),n("/config")}}})]})}function uS(){const{showInConfig:e}=Pp(),[t,n]=w.useState(!1),[r,s]=w.useState(!1);return e?l.jsxs("div",{className:"px-3 pt-3 sm:px-6","data-testid":"migration-offer-card",children:[!r&&l.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-2 rounded-xl border border-accent-edge bg-accent-soft px-3 py-2.5",children:[l.jsxs("div",{className:"min-w-0 flex-1",children:[l.jsxs("p",{className:"text-sm font-semibold text-fg",children:["Chats are separate from ",l.jsx("span",{className:"font-mono",children:"~/.claude"})]}),l.jsxs("p",{className:"mt-0.5 text-xs text-fg-muted",children:["This instance keeps its transcripts in each project's own store, so the Claude Code CLI does not see them. Merging moves them into your Claude home and switches"," ",l.jsx("span",{className:"font-mono",children:"claude.transcripts"})," to"," ",l.jsx("span",{className:"font-mono",children:"host"}),"."]})]}),l.jsx(jt,{variant:"primary",size:"sm",onClick:()=>n(!0),children:"Merge chats…"})]}),l.jsx(Ip,{open:t,onClose:()=>n(!1),onCompleted:()=>s(!0)})]}):null}const qx="(min-width: 1280px)",e1="(min-width: 900px)",t1=1;function n1(){const e=Sl(qx),t=Sl(e1);return e?3:t?2:t1}const ya=6,r1=.75,s1=.9,o1=250,i1=3e4;function a1(e){const[,t]=w.useState(0);w.useEffect(()=>{if(!e)return;const n=setInterval(()=>t(r=>r+1),1e3);return()=>clearInterval(n)},[e])}function l1(){const[e,t]=w.useState(new Map);return w.useEffect(()=>Cu.onActiveInfos(n=>t(new Map(n))),[]),e}function u1(e){const[t,n]=w.useState(new Map),r=w.useRef(0);return w.useEffect(()=>{if(!e){r.current++,n(new Map);return}let s=!1;const o=async()=>{const u=++r.current;try{const c=await or.attentionChats(ju);if(s||u!==r.current)return;n(new Map(c.running.map(d=>[d.sessionId,d])))}catch{}},i=setTimeout(()=>void o(),o1),a=setInterval(()=>{document.visibilityState==="visible"&&o()},i1);return()=>{s=!0,clearTimeout(i),clearInterval(a)}},[e]),t}function c1({fill:e}){const t=e<=0?0:Math.max(1,Math.min(ya,Math.round(e*ya))),n=e<r1?"bg-accent-solid":e<s1?"bg-warn-solid":"bg-danger-solid";return l.jsx("span",{className:"flex items-center gap-px",title:`Context ${Math.round(e*100)}% full`,"aria-hidden":"true",children:Array.from({length:ya},(r,s)=>l.jsx("span",{className:st("h-2.5 w-[3px] rounded-[1px]",s<t?n:"bg-edge")},s))})}function d1({projectSlug:e,projectName:t,chatName:n,sessionId:r,startedAt:s,fill:o}){const i=s==null?"—:—":X0(Date.now()-s),a=n??"Running turn";return l.jsxs(Vs,{"data-testid":"fleet-channel",to:`${T0(e)}/chat/${encodeURIComponent(r)}`,title:`${a} — ${t}`,"aria-label":`${a} in ${t}, running${s==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:[l.jsx("span",{className:"h-1.5 w-1.5 shrink-0 rounded-[1px] bg-accent-solid","aria-hidden":"true"}),l.jsx("span",{className:"max-w-[14ch] truncate font-medium text-fg",children:t}),l.jsx("span",{className:"font-mono tabular text-fg-muted",children:i}),o!=null&&l.jsx(c1,{fill:o})]})}function Md({value:e,unit:t,to:n,tone:r,title:s}){return l.jsxs(Vs,{"data-testid":`fleet-${t}`,to:n,title:s,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:[l.jsx("span",{"aria-hidden":"true",className:st("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")}),l.jsx("span",{"data-testid":`fleet-${t}-value`,className:"font-mono tabular text-2xs font-semibold text-fg",children:e}),l.jsx("span",{className:"text-3xs font-semibold uppercase tracking-[0.14em] text-fg-subtle",children:t})]})}function f1({unread:e}){const{projects:t,rootWorkspace:n}=Sp(),r=l1(),s=w.useMemo(()=>[...r.keys()].sort().join(","),[r]),o=u1(s);a1(r.size>0);const i=n1(),a=w.useMemo(()=>{const y=new Map;for(const k of t)y.set(k.slug,k.name);return n&&y.set(n.slug,n.name),y},[t,n]),u=w.useMemo(()=>[...r.entries()].map(([y,k])=>{const S=o.get(y);return{sessionId:y,projectSlug:k,projectName:a.get(k)??(S==null?void 0:S.projectName)??k,chatName:(S==null?void 0:S.name)??null,startedAt:Cu.turnStartedAt(y),fill:(S==null?void 0:S.contextTokens)!=null&&S.contextLimit?Math.min(1,S.contextTokens/S.contextLimit):null}}).sort((y,k)=>(y.startedAt??1/0)-(k.startedAt??1/0)),[r,o,a]),c=u.slice(0,i),d=u.length-c.length,f=w.useMemo(()=>{let y="";for(const k of n?[...t,n]:t)for(const S of k.chatTurns??[])S.lastTurnCompletedAt>y&&(y=S.lastTurnCompletedAt);return y},[t,n]),p=r.size===0?`Fleet idle. ${e} unread.`:`${r.size} running. ${e} unread.`;return l.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:[l.jsx(Md,{value:r.size,unit:"running",to:"/",tone:r.size>0?"live":"rest",title:r.size>0?"Turns in flight across every project":"Nothing running"}),l.jsx(Md,{value:e,unit:"unread",to:"/",tone:e>0?"attention":"rest",title:"Chats holding a reply you have not read"}),l.jsx("span",{className:"h-4 w-px shrink-0 bg-edge-subtle","aria-hidden":"true"}),l.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-1.5 overflow-hidden",children:[c.map(y=>l.jsx(d1,{projectSlug:y.projectSlug,projectName:y.projectName,chatName:y.chatName,sessionId:y.sessionId,startedAt:y.startedAt,fill:y.fill},y.sessionId)),d>0&&l.jsxs(Vs,{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]}),u.length===0&&(f?l.jsxs("span",{className:"truncate text-2xs text-fg-subtle",children:["Idle · last turn ",wl(f)]}):l.jsx(Vs,{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 →"}))]}),l.jsx(Zx,{}),l.jsx("span",{role:"status","aria-live":"polite",className:"sr-only",children:p})]})}const h1=["idea","active","paused","blocked","done"];function p1({open:e,onClose:t,onCreated:n}){const[r,s]=w.useState(""),[o,i]=w.useState(""),[a,u]=w.useState(""),[c,d]=w.useState(""),[f,p]=w.useState("active"),[y,k]=w.useState(""),[S,C]=w.useState(""),[g,h]=w.useState(!1),[m,E]=w.useState(!1),[R,P]=w.useState(null);if(w.useEffect(()=>{e&&(s(""),i(""),u(""),d(""),p("active"),k(""),C(""),h(!1),P(null))},[e]),w.useEffect(()=>{const v=D=>{D.key==="Escape"&&e&&!m&&t()};return window.addEventListener("keydown",v),()=>window.removeEventListener("keydown",v)},[e,m,t]),!e)return null;const _=async v=>{if(v.preventDefault(),!!r.trim()){E(!0),P(null);try{const D=await or.createProject({name:r.trim(),status:f,group:c||void 0,summary:o.trim()||void 0,repo:y.trim()||void 0,path:S.trim()||void 0,managed:S.trim()&&!y.trim()?g:void 0,domain:a.split(",").map(L=>L.trim()).filter(Boolean)});n(D)}catch(D){P(D instanceof On?D.message:"Failed to create project")}finally{E(!1)}}};return l.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-overlay p-4 backdrop-blur-sm",onClick:()=>!m&&t(),children:l.jsxs("form",{className:"w-full max-w-md animate-scale-in rounded-2xl border border-edge bg-surface-raised p-6 shadow-2xl",onClick:v=>v.stopPropagation(),onSubmit:_,children:[l.jsxs("div",{className:"mb-5 flex items-center justify-between",children:[l.jsx("h2",{className:"text-lg font-semibold",children:"New project"}),l.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:l.jsx($i,{width:18,height:18})})]}),l.jsxs("label",{className:"mb-4 block",children:[l.jsx("span",{className:"field-label",children:"Name"}),l.jsx("input",{autoFocus:!0,className:"input",value:r,onChange:v=>s(v.target.value),placeholder:"Garage Water Heater Replacement"})]}),l.jsxs("label",{className:"mb-4 block",children:[l.jsx("span",{className:"field-label",children:"Summary (optional)"}),l.jsx("input",{className:"input",value:o,onChange:v=>i(v.target.value),placeholder:"One line on what this project is about"})]}),l.jsxs("label",{className:"mb-4 block",children:[l.jsx("span",{className:"field-label",children:"Area"}),l.jsxs("select",{className:"input",value:c,onChange:v=>d(v.target.value),children:[l.jsx("option",{value:"",children:"Unsorted"}),Nu.map(v=>l.jsx("option",{value:v.slug,children:v.label},v.slug))]})]}),l.jsxs("label",{className:"mb-4 block",children:[l.jsx("span",{className:"field-label",children:"Directory on this machine (optional)"}),l.jsx("input",{className:"input",value:S,onChange:v=>C(v.target.value),placeholder:"/home/ed/Code/foo"}),l.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."})]}),l.jsxs("label",{className:"mb-4 block",children:[l.jsx("span",{className:"field-label",children:"Git repository URL (optional)"}),l.jsx("input",{className:"input",value:y,onChange:v=>k(v.target.value),placeholder:"https://github.com/owner/repo.git"}),l.jsx("span",{className:"mt-1 block text-xs text-fg-subtle",children:S.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."})]}),S.trim()&&!y.trim()&&l.jsxs("label",{className:"mb-4 flex cursor-pointer items-start gap-2",children:[l.jsx("input",{type:"checkbox",className:"mt-0.5",checked:g,onChange:v=>h(v.target.checked)}),l.jsxs("span",{className:"text-xs text-fg-muted",children:[l.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."]})]}),l.jsxs("div",{className:"mb-5 grid grid-cols-2 gap-3",children:[l.jsxs("label",{className:"block",children:[l.jsx("span",{className:"field-label",children:"Domain tags"}),l.jsx("input",{className:"input",value:a,onChange:v=>u(v.target.value),placeholder:"home, plumbing"})]}),l.jsxs("label",{className:"block",children:[l.jsx("span",{className:"field-label",children:"Status"}),l.jsx("select",{className:"input capitalize",value:f,onChange:v=>p(v.target.value),children:h1.map(v=>l.jsx("option",{value:v,className:"capitalize",children:v},v))})]})]}),R&&l.jsx("p",{className:"mb-4 rounded-lg bg-danger-soft px-3 py-2 text-sm text-danger",children:R}),l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsx("button",{type:"button",className:"btn-ghost",onClick:t,disabled:m,children:"Cancel"}),l.jsx("button",{type:"submit",className:"btn-primary",disabled:m||!r.trim(),children:m?"Creating…":"Create project"})]})]})})}const Ru="paddock:panewidth:",m1={key:"sidenav",def:288,min:200,max:480},cS={key:"chatlist",def:256,min:220,max:520},g1="(min-width: 1024px)";function Ir(e,t){return Math.min(Math.max(t,e.min),e.max)}function _d(e,t,n){return Ir(n,e+t)}function v1(e){try{const t=localStorage.getItem(Ru+e.key);if(t==null)return null;const n=Number.parseFloat(t);return Number.isFinite(n)?Ir(e,n):null}catch{return null}}function y1(e,t){try{localStorage.setItem(Ru+e.key,String(Ir(e,t)))}catch{}}function x1(e){try{localStorage.removeItem(Ru+e.key)}catch{}}function w1(e){const t=Sl(g1),[n,r]=w.useState(()=>v1(e)),s=Ir(e,n??e.def);return{isDesktop:t,width:s,style:t?{width:s}:void 0,preview:o=>r(Ir(e,o)),commit:o=>{const i=Ir(e,o);r(i),y1(e,i)},reset:()=>{r(null),x1(e)},spec:e}}function S1({spec:e,width:t,onPreview:n,onCommit:r,onReset:s,label:o}){const i=w.useRef(null),a=w.useRef(t);a.current=t;const u=16;return l.jsx("div",{role:"separator","aria-orientation":"vertical","aria-label":o,"aria-valuenow":Math.round(t),"aria-valuemin":e.min,"aria-valuemax":e.max,tabIndex:0,onPointerDown:c=>{i.current={startX:c.clientX,startWidth:t},c.currentTarget.setPointerCapture(c.pointerId)},onPointerMove:c=>{i.current&&n(_d(i.current.startWidth,c.clientX-i.current.startX,e))},onPointerUp:c=>{if(i.current){i.current=null;try{c.currentTarget.releasePointerCapture(c.pointerId)}catch{}r(a.current)}},onDoubleClick:s,onKeyDown:c=>{if(c.key==="ArrowLeft"||c.key==="ArrowRight"){c.preventDefault();const d=_d(t,c.key==="ArrowRight"?u:-u,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:l.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 k1(e){const[t,n]=w.useState(new Map),r=w.useRef(new Map),[s,o]=w.useState(0);return w.useEffect(()=>{const i=r.current;for(const a of e)for(const u of a.chatTurns??[]){Q0(u.sessionId,u.lastSeen);const c=Date.parse(u.lastTurnCompletedAt);if(!Number.isFinite(c))continue;const d=i.get(u.sessionId);!d||c>d.at?i.set(u.sessionId,{slug:a.slug,at:c,unread:u.unread}):d.unread=u.unread}if(e.length>0){const a=new Set(e.map(u=>u.slug));for(const[u,c]of i)a.has(c.slug)||i.delete(u)}o(a=>a+1)},[e]),w.useEffect(()=>{const i=a=>{var d;const u=((d=a.detail)==null?void 0:d.sessionIds)??[];let c=!1;for(const f of u)c=r.current.delete(f)||c;c&&o(f=>f+1)};return window.addEventListener(xl,i),()=>window.removeEventListener(xl,i)},[]),w.useEffect(()=>{const i=new Map;return Cu.onActiveInfos(a=>{for(const[u,c]of i)a.has(u)||r.current.set(u,{slug:c,at:Date.now()});i.clear();for(const[u,c]of a)i.set(u,c);n(new Map(a)),o(u=>u+1)})},[]),w.useEffect(()=>{const i=()=>o(a=>a+1);return window.addEventListener(yl,i),()=>window.removeEventListener(yl,i)},[]),w.useMemo(()=>{const i=new Map,a=u=>{let c=i.get(u);return c||(c={unread:0,inflight:0},i.set(u,c)),c};for(const[u,{slug:c,at:d,unread:f}]of r.current)!t.has(u)&&(f||d>H0(u))&&(a(c).unread+=1);for(const u of t.values())a(u).inflight+=1;return i},[t,s])}function j1(){const{projects:e,rootWorkspace:t,loading:n,upsert:r}=Sp(),{dark:s,toggle:o}=D0(),[i,a]=w.useState(!1),[u,c]=w.useState(!1),d=Zs(),f=lr(),p=jp(),y=$0(),k=w1(m1),S=f.pathname==="/"||f.pathname==="/projects"||f.pathname.startsWith("/chat"),C=f.pathname.startsWith("/projects/")||S;w.useEffect(()=>{a(!1)},[f.pathname]),w.useEffect(()=>{document.title=p.name},[p.name]);const g=w.useMemo(()=>{const P=new Map;for(const _ of e){const v=_.group??"",D=P.get(v);D?D.push(_):P.set(v,[_])}return F0(P.keys()).map(_=>[_,P.get(_)??[]])},[e]),h=w.useMemo(()=>t?[...e,t]:e,[e,t]),m=k1(h),E=m.get(ju),R=w.useMemo(()=>{let P=0;for(const _ of m.values())P+=_.unread;return P},[m]);return l.jsxs("div",{className:"flex h-[100dvh] flex-col overflow-hidden bg-surface lg:flex-row",children:[!C&&l.jsxs("header",{className:"pt-safe flex items-center gap-2 border-b border-edge px-3 pb-2 lg:hidden",children:[l.jsx("button",{type:"button",onClick:()=>a(!0),"aria-label":"Open menu",className:"btn-subtle -ml-1 px-2 py-2",children:l.jsx(Qx,{width:20,height:20})}),l.jsxs(gn,{to:"/",className:"flex items-center gap-2",children:[l.jsx(Ld,{brand:p,className:"h-7 w-7 text-sm"}),l.jsx("span",{className:"text-md font-semibold tracking-tight",children:p.name})]})]}),i&&l.jsx("div",{className:"fixed inset-0 z-30 bg-overlay backdrop-blur-sm lg:hidden","aria-hidden":"true",onClick:()=>a(!1)}),l.jsxs("aside",{style:k.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:[k.isDesktop&&l.jsx(S1,{spec:k.spec,width:k.width,onPreview:k.preview,onCommit:k.commit,onReset:k.reset,label:"Resize sidebar"}),l.jsxs("div",{className:"flex items-center gap-2 px-5 py-4",children:[l.jsxs(gn,{to:"/",className:"group flex items-center gap-2",children:[l.jsx(Ld,{brand:p,className:"h-8 w-8 text-base"}),l.jsx("span",{className:"text-lg font-semibold tracking-tight",children:p.name})]}),l.jsx("button",{type:"button",onClick:()=>a(!1),"aria-label":"Close menu",className:"btn-subtle ml-auto px-2 py-2 lg:hidden",children:l.jsx($i,{width:18,height:18})})]}),l.jsx("div",{className:"px-3 pb-1",children:l.jsxs(gn,{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:[l.jsx(Bx,{width:16,height:16}),"Home",l.jsx(Ap,{badge:E,className:"ml-auto"})]})}),l.jsxs("div",{className:"mt-5 mb-1 flex items-center justify-between pr-3",children:[l.jsx(gn,{to:R0(),className:"section-label hover:text-accent",children:"Projects"}),l.jsxs("div",{className:"flex items-center gap-0.5",children:[l.jsx(gn,{to:"/discover","aria-label":"Discover projects",title:"Find directories with existing Claude Code history to import",className:({isActive:P})=>`btn-subtle px-1.5 py-1 hover:text-accent ${P?"text-accent":"text-fg-subtle"}`,children:l.jsx(Rd,{width:14,height:14})}),l.jsx("button",{type:"button",onClick:()=>c(!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:l.jsx(Ux,{width:14,height:14})})]})]}),l.jsxs("nav",{className:"flex-1 overflow-y-auto px-2 pb-4",children:[n&&l.jsx("div",{className:"space-y-2 px-2 py-2",children:[0,1,2].map(P=>l.jsx("div",{className:"h-10 animate-pulse rounded-lg bg-surface-active"},P))}),!n&&e.length===0&&l.jsx("p",{className:"px-3 py-2 text-sm text-fg-muted",children:"No projects yet."}),!n&&e.length>0&&g.map(([P,_])=>l.jsxs("div",{className:"mb-2",children:[g.length>1&&l.jsx("div",{className:"px-2.5 pb-1 pt-2 text-3xs font-semibold uppercase tracking-wider text-fg-subtle",children:A0(P)}),_.map(v=>l.jsx(N1,{project:v,badge:m.get(v.slug)},v.slug))]},P||"unsorted"))]}),l.jsxs("div",{className:"border-t border-edge px-3 py-3",children:[l.jsxs(gn,{to:"/config",className:({isActive:P})=>`btn-subtle w-full justify-start ${P?"bg-surface-selected":""}`,title:"Instance config — paddock.config.yaml (restart required)",children:[l.jsx(Vx,{width:15,height:15}),"Config"]}),l.jsxs(gn,{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:[l.jsx(Rd,{width:15,height:15}),"Discover"]}),y.enabled&&l.jsxs("a",{href:y.path,target:"_blank",rel:"noreferrer",className:"btn-subtle mt-1 w-full justify-start",title:"OpenAPI / Swagger reference (opens in a new tab)",children:[l.jsx(Jx,{width:15,height:15}),"Swagger API"]}),l.jsxs("button",{type:"button",onClick:o,className:"btn-subtle mt-1 w-full justify-start","aria-label":s?"Switch to light mode":"Switch to dark mode",title:"Toggle light / dark theme",children:[s?l.jsx(Gx,{width:15,height:15}):l.jsx(Yx,{width:15,height:15}),s?"Light mode":"Dark mode"]}),l.jsxs("p",{className:"mt-2 px-2 text-2xs text-fg-subtle",children:["v","0.75.0"]})]})]}),l.jsxs("div",{className:"flex min-w-0 flex-1 flex-col overflow-hidden",children:[l.jsx(f1,{unread:R}),l.jsx("main",{className:"min-h-0 min-w-0 flex-1 overflow-hidden",children:l.jsx(w.Suspense,{fallback:l.jsx(E1,{}),children:l.jsx(s0,{context:{openNav:()=>a(!0)}})})})]}),l.jsx(p1,{open:u,onClose:()=>c(!1),onCreated:P=>{r(P),c(!1),d(`/projects/${P.slug}/chat`)}})]})}function Ld({brand:e,className:t=""}){return l.jsx("span",{className:`flex shrink-0 items-center justify-center overflow-hidden rounded-lg bg-accent-solid text-accent-fg shadow-sm ${t}`,children:z0(e.logo)?l.jsx("img",{src:e.logo,alt:"",className:"h-full w-full object-cover"}):e.logo})}function E1(){return l.jsxs("div",{className:"flex h-full items-center justify-center","aria-busy":"true","aria-live":"polite",children:[l.jsx("span",{className:"h-6 w-6 animate-spin rounded-full border-2 border-edge-strong border-t-accent"}),l.jsx("span",{className:"sr-only",children:"Loading…"})]})}function N1({project:e,badge:t}){return l.jsxs(gn,{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:[l.jsxs("span",{className:"flex items-center justify-between gap-2",children:[l.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[l.jsx(Wx,{width:13,height:13,className:"shrink-0 text-fg-subtle group-hover:text-fg-muted"}),l.jsx("span",{className:"truncate font-medium",children:e.name})]}),l.jsx(Ap,{badge:t})]}),e.domain.length>0&&l.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden pl-[18px]",children:[e.domain.slice(0,2).map(n=>l.jsx(K0,{tag:n,className:"max-w-[7rem] truncate"},n)),e.domain.length>2&&l.jsxs("span",{className:"shrink-0 text-2xs text-fg-subtle",children:["+",e.domain.length-2]})]})]})}function Ap({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:l.jsxs("span",{className:`flex shrink-0 items-center gap-1.5 ${t}`,children:[r>0&&l.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:[l.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&&l.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 Fp="paddock:chunkReloadAt",C1=1e4,bd=/dynamically imported module|module script|importing a module|failed to fetch|unable to preload|load failed|error loading/i;function P1(e){return e?e instanceof Error?e.name==="ChunkLoadError"?!0:bd.test(e.message):bd.test(String(e)):!1}function Mu(){try{return typeof sessionStorage<"u"?sessionStorage:void 0}catch{return}}function T1(e=Date.now(),t=Mu()){if(!t)return!1;const n=t.getItem(Fp);if(!n)return!1;const r=Number(n);return Number.isFinite(r)&&e-r<C1}function R1(e=Date.now(),t=Mu()){try{t==null||t.setItem(Fp,String(e))}catch{}}function M1(e,t=Date.now(),n=Mu()){return P1(e)&&!T1(t,n)?"reload":"show"}function _1(){const e=vp(),t=M1(e);if(w.useEffect(()=>{t==="reload"&&(R1(),window.location.reload())},[t]),t==="reload")return l.jsxs("div",{className:"flex h-[100dvh] items-center justify-center bg-surface","aria-busy":"true","aria-live":"polite",children:[l.jsx("span",{className:"h-6 w-6 animate-spin rounded-full border-2 border-edge-strong border-t-accent"}),l.jsx("span",{className:"sr-only",children:"Updating…"})]});const n=e instanceof Error?e.message:typeof e=="string"?e:"";return l.jsxs("div",{className:"flex h-[100dvh] flex-col items-center justify-center gap-4 bg-surface px-6 text-center",children:[l.jsxs("div",{children:[l.jsx("h1",{className:"text-lg font-semibold tracking-tight",children:"Something went wrong"}),l.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?l.jsx("p",{className:"mt-2 max-w-md break-words font-mono text-2xs text-fg-subtle",children:n}):null]}),l.jsx("button",{className:"btn-primary",onClick:()=>window.location.reload(),children:"Reload"})]})}function L1(){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 _u=e=>e<0?0:e>1?1:e;function Lu(e){return e<=.0031308?12.92*e:1.055*Math.pow(e,1/2.4)-.055}function It(e){return e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function bu({L:e,a:t,b:n}){const r=(e+.3963377774*t+.2158037573*n)**3,s=(e-.1055613458*t-.0638541728*n)**3,o=(e-.0894841775*t-1.291485548*n)**3;return[4.0767416621*r-3.3077115913*s+.2309699292*o,-1.2684380046*r+2.6097574011*s-.3413193965*o,-.0041960863*r-.7034186147*s+1.707614701*o]}function jl(e,t,n){const r=Math.cbrt(.4122214708*e+.5363325363*t+.0514459929*n),s=Math.cbrt(.2119034982*e+.6806995451*t+.1073969566*n),o=Math.cbrt(.0883024619*e+.2817188376*t+.6299787005*n);return{L:.2104542553*r+.793617785*s-.0040720468*o,a:1.9779984951*r-2.428592205*s+.4505937099*o,b:.0259040371*r+.7827717662*s-.808675766*o}}function Hs(e,t,n,r=1){const s=n*Math.PI/180,o=bu({L:e,a:t*Math.cos(s),b:t*Math.sin(s)}),[i,a,u]=o.map(c=>_u(Lu(c)));return{r:i,g:a,b:u,a:r}}function Id(e,t,n){const r=n*Math.PI/180;return bu({L:e,a:t*Math.cos(r),b:t*Math.sin(r)}).map(Lu).every(s=>s>=-.0015&&s<=1.0015)}function xn({r:e,g:t,b:n}){const r=s=>Math.round(_u(s)*255).toString(16).padStart(2,"0");return`#${r(e)}${r(t)}${r(n)}`}function qe({r:e,g:t,b:n}){const[r,s,o]=[e,t,n].map(It);return .2126*r+.7152*s+.0722*o}function b1(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 Ke(e,t){const n=qe(b1(e,t)),r=qe(t),[s,o]=n>r?[n,r]:[r,n];return(s+.05)/(o+.05)}const Dd={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 xa(e){const t=[];let n=0,r="";for(const s of e)s==="("?n++:s===")"&&n--,s===","&&n===0?(t.push(r.trim()),r=""):r+=s;return r.trim()&&t.push(r.trim()),t}function hr(e,t){return!e.startsWith(`${t}(`)||!e.endsWith(")")?null:e.slice(t.length+1,-1)}function pn(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 Pr(e,t,n=0){if(n>24)throw new Error(`var() cycle resolving ${e}`);const r=e.trim();if(Dd[r])return Dd[r];if(r.startsWith("#")){let u=r.slice(1);if(u.length===3&&(u=[...u].map(d=>d+d).join("")),u.length!==6)throw new Error(`bad hex: ${r}`);const c=parseInt(u,16);return{r:(c>>16&255)/255,g:(c>>8&255)/255,b:(c&255)/255,a:1}}const s=hr(r,"var");if(s!==null){const[u,...c]=xa(s),d=t[u]??c.join(",");if(!d)throw new Error(`undefined custom property: ${u}`);return Pr(d,t,n+1)}const o=hr(r,"oklch");if(o!==null){const[u,c]=o.split("/"),d=u.trim().split(/\s+/);if(d.length!==3)throw new Error(`bad oklch(): ${r}`);return Hs(pn(d[0]),pn(d[1]),pn(d[2]),c?pn(c.trim()):1)}const i=hr(r,"rgb")??hr(r,"rgba");if(i!==null){const u=i.trim(),c=hr(u,"var");if(c!==null){const[y]=xa(c),k=t[y];if(!k)throw new Error(`undefined custom property: ${y}`);return Pr(`rgb(${k})`,t,n+1)}const[d,f]=u.split("/"),p=d.trim().split(/[\s,]+/);if(p.length<3)throw new Error(`bad rgb(): ${r}`);return{r:pn(p[0])/255,g:pn(p[1])/255,b:pn(p[2])/255,a:f?pn(f.trim()):1}}const a=hr(r,"color-mix");if(a!==null){const[u,c,d]=xa(a),f=u.trim();if(f!=="in oklab"&&f!=="in srgb")throw new Error(`only \`in oklab\` and \`in srgb\` color-mix are supported, got: ${u}`);const p=Od(c),y=Od(d);let k=p.pct,S=y.pct;k===null&&S===null?(k=.5,S=.5):k===null?k=1-S:S===null&&(S=1-k);const C=k+S,g=k/C,h=Pr(p.color,t,n+1),m=Pr(y.color,t,n+1);return f==="in srgb"?I1(h,m,g):D1(h,m,g)}throw new Error(`unsupported colour value: ${r}`)}function Od(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 I1(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 D1(e,t,n){const r=jl(It(e.r),It(e.g),It(e.b)),s=jl(It(t.r),It(t.g),It(t.b)),o={L:r.L*n+s.L*(1-n),a:r.a*n+s.a*(1-n),b:r.b*n+s.b*(1-n)},[i,a,u]=bu(o).map(c=>_u(Lu(c)));return{r:i,g:a,b:u,a:e.a*n+t.a*(1-n)}}function bn({r:e,g:t,b:n}){const{L:r,a:s,b:o}=jl(It(e),It(t),It(n)),i=Math.hypot(s,o),a=i<1e-6?0:(Math.atan2(o,s)*180/Math.PI+360)%360;return{L:r,C:i,H:a}}const Dt=4.5,Up=3,Tt=.12,Bp=["--accent","--accent-600","--accent-700","--accent-solid","--accent-solid-hover","--accent-text"];function gt(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 Pr(r,{})}catch{return null}}function O1(e,t,n){let r=0,s=1;for(let o=0;o<32;o++){const i=(r+s)/2;qe(Hs(i,t,n))<e?r=i:s=i}return(r+s)/2}function Wp(e,t,n){if(Id(e,t,n))return t;let r=0,s=t;for(let o=0;o<24;o++){const i=(r+s)/2;Id(e,i,n)?r=i:s=i}return r}function wa(e,t,n,r,s){const o=qe(r);let i=t,a=.5;for(let u=0;u<4;u++){const c=O1(o,i,n);let d=s?0:c,f=s?c:1;for(let p=0;p<28;p++){const y=(d+f)/2,k=Ke(Hs(y,i,n),r)>=e;s?k?d=y:f=y:k?f=y:d=y}a=s?d:f,i=Wp(a,t,n)}return{L:a,C:i,rgb:Hs(a,i,n)}}const $1=.75;function Dr(e,t,n,r,s,o=e){const i=wa(e,t,n,r,s),a=f=>f.C>=t*$1;if(a(i)||o>=e)return{...i,hit:Ke(i.rgb,r)>=e-.01};let u=o,c=e,d=wa(o,t,n,r,s);for(let f=0;f<16;f++){const p=(u+c)/2,y=wa(p,t,n,r,s);a(y)?(d=y,u=p):c=p}return{...d,hit:Ke(d.rgb,r)>=o-.01}}function Sa({r:e,g:t,b:n}){const r=s=>Math.round(Math.max(0,Math.min(1,s))*255);return`${r(e)} ${r(t)} ${r(n)}`}const Vp=["--surface","--surface-raised","--surface-sunken","--surface-hover","--surface-active","--surface-selected","--border-subtle","--border","--border-strong","--text","--text-muted","--text-subtle","--scroll-thumb"],$d=["--text","--text-muted","--text-subtle"],z1=["--surface","--surface-raised","--surface-sunken","--surface-hover","--surface-active","--surface-selected"];function Hp(e=document.documentElement){for(const t of Vp)e.style.removeProperty(t)}function A1(e,t,n=document.documentElement){Hp(n);for(const s of Vp){const o=gt(n,s);if(!o)continue;const{L:i,C:a}=bn(o),u=$d.includes(s),c=Math.max(a,t*(u?.5:1));n.style.setProperty(s,xn(Hs(i,Wp(i,c,e),e)))}let r=1/0;for(const s of $d){const o=gt(n,s);if(o)for(const i of z1){const a=gt(n,i);a&&(r=Math.min(r,Ke(o,a)))}}return r}function Qp(e=document.documentElement){for(const t of Bp)e.style.removeProperty(t)}function Kp(e,t){const n=Bp.map(r=>[r,e.style.getPropertyValue(r)]);Qp(e);try{return t()}finally{for(const[r,s]of n)s&&e.style.setProperty(r,s)}}function F1(e=document.documentElement){return Kp(e,()=>{const t=gt(e,"--accent");return t?bn(t).H:0})}const us={r:1,g:1,b:1,a:1};function Gp(e=document.documentElement){return Kp(e,()=>U1(e))}function U1(e){const t={accent:gt(e,"--accent")??us,a600:gt(e,"--accent-600")??us,a700:gt(e,"--accent-700")??us},n=gt(e,"--accent-fg")??us,r=gt(e,"--surface")??us,s=["--surface","--surface-raised","--surface-sunken"].map(a=>gt(e,a)).filter(a=>a!==null),o=s.length?s:[r],i=o.reduce((a,u)=>Ke(t.a700,a)<Ke(t.a700,u)?a:u);return{fg:n,surface:r,surfaces:o,targets:{accent:Math.max(Ke(t.accent,r),Up+Tt),a600:Math.max(Ke(t.a600,n),Dt+Tt),a700:Math.max(o.reduce((a,u)=>Math.min(a,Ke(t.a700,u)),1/0),Dt+Tt)},chroma:{accent:bn(t.accent).C,a600:bn(t.a600).C,a700:bn(t.a700).C},darker:{accent:qe(t.accent)<qe(r),a600:qe(n)>qe(t.a600),a700:qe(t.a700)<qe(i)},a700Bg:i}}function B1(e,t){const n=Dt+Tt;return{accent:Dr(e.targets.accent,e.chroma.accent,t,e.surface,e.darker.accent,Up+Tt),a600:Dr(e.targets.a600,e.chroma.a600,t,e.fg,e.darker.a600,n),a700:Dr(e.targets.a700,e.chroma.a700,t,e.a700Bg,e.darker.a700,n)}}function dS(e,t=document.documentElement){const n=Gp(t);return e.map(r=>xn(Dr(n.targets.a600,n.chroma.a600,r,n.fg,n.darker.a600,Dt+Tt).rgb))}function W1(e,t=document.documentElement,n={}){const r=t.classList.contains("dark")?"dark":"light",s=n.context??Gp(t),o=B1(s,e),{a600:i,a700:a,accent:u}=o,c={C:s.chroma.a700};Qp(t),t.style.setProperty("--accent",Sa(u.rgb)),t.style.setProperty("--accent-600",Sa(i.rgb)),t.style.setProperty("--accent-700",Sa(a.rgb));const d={};for(const m of["--accent-fg","--accent-solid","--accent-solid-hover","--accent-text","--surface","--surface-raised","--surface-sunken","--accent-soft"])d[m]=gt(t,m);const f=[],p=d["--accent-fg"]??s.fg,y=(m,E,R)=>{const P=d[m];if(!P)return 1/0;let _=Ke(P,p),v=!1;if(_<R+Tt){const{C:D}=bn(P),L=Dr(R+Tt,Math.max(D,s.chroma.a600),e,p,qe(P)<qe(p),Dt+Tt);t.style.setProperty(m,xn(L.rgb)),_=Ke(L.rgb,p),v=!0}return f.push({label:E,fg:"--accent-fg",bg:m,ratio:_,floor:R,repaired:v}),_},k=y("--accent-solid","Primary button",Dt);y("--accent-solid-hover","Primary button, hovered",Math.min(k+.6,12));const S=[];for(const m of["--surface","--surface-raised","--surface-sunken","--accent-soft"]){const E=d[m];E&&S.push({name:m,c:E})}let C=1/0;const g=d["--accent-text"];if(g&&S.length){const m=S.reduce((R,P)=>Ke(g,R.c)<Ke(g,P.c)?R:P,S[0]);C=Ke(g,m.c);let E=!1;if(C<Dt+Tt){const{C:R}=bn(g),P=Dr(Dt+Tt,R||c.C,e,m.c,qe(g)<qe(m.c));t.style.setProperty("--accent-text",xn(P.rgb)),C=S.reduce((_,v)=>Math.min(_,Ke(P.rgb,v.c)),1/0),E=!0}f.push({label:"Accent text",fg:"--accent-text",bg:m.name,ratio:C,floor:Dt,repaired:E})}const h={};if(!n.live)for(const m of["--accent-solid","--accent-solid-hover","--accent-text"]){const E=gt(t,m);E&&(h[m]=xn(E))}return{hue:e,mode:r,channels:{accent:xn(u.rgb),accent600:xn(i.rgb),accent700:xn(a.rgb)},applied:h,checks:f,ok:f.every(m=>m.ratio>=m.floor-.005)&&k>=Dt}}const V1=[{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."}],fS=[{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}],hS=[{level:0,label:"None"},{level:1,label:"A little"},{level:2,label:"More"}];function H1(e=document.documentElement){const t=jp().accent;if(t&&t.toLowerCase()!==kp.accent.toLowerCase())try{return bn(Pr(t,{})).H}catch{}return F1(e)}const zd={theme:"foundation",hue:null,tint:0},Yp="paddock:appearance",Ad="paddock:appearance-cache";function Q1(){try{const e=localStorage.getItem(Yp);if(!e)return zd;const t=JSON.parse(e);return{theme:V1.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 zd}}function K1(e){try{localStorage.setItem(Yp,JSON.stringify(e))}catch{}}function G1(e,t,n){try{const r=JSON.parse(localStorage.getItem(Ad)||"{}"),s=`${e}:${t?"dark":"light"}`;n?r[s]={...n.applied,"--accent":n.channels.accent}:delete r[s],localStorage.setItem(Ad,JSON.stringify(r))}catch{}}function Y1(e,t=document.documentElement){t.setAttribute("data-theme",e.theme);const n=e.hue??H1(t);let r=null;e.tint===0?Hp(t):r=A1(n,q1[e.tint],t);const s=W1(n,t);return s&&r!==null&&(s.checks.push({label:"Body text on the tinted ground",fg:"--text-*",bg:"--surface-*",ratio:r,floor:4.5,repaired:!1}),s.ok=s.ok&&r>=4.5),G1(e.theme,t.classList.contains("dark"),s),s}function J1(e,t){K1(e);const n=Y1(e,t);return window.dispatchEvent(new CustomEvent(X1,{detail:n})),n}const X1="paddock:appearance";function Z1(){const e=()=>J1(Q1());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 q1=[0,.008,.018],Jp=w.lazy(()=>Xt(()=>import("./ProjectsGrid-DR1fmWxh.js"),__vite__mapDeps([0,1,2])).then(e=>({default:e.ProjectsGrid}))),Te=w.lazy(()=>Xt(()=>import("./ProjectView-BdzJ3aKK.js").then(e=>e.a),__vite__mapDeps([3,4,1,2,5,6])).then(e=>({default:e.ProjectView}))),ew=w.lazy(()=>Xt(()=>import("./ProjectRedirect-CNQm3371.js"),__vite__mapDeps([7,2])).then(e=>({default:e.ProjectRedirect}))),tw=w.lazy(()=>Xt(()=>import("./InstanceConfigPage-ClXUufoD.js"),__vite__mapDeps([8,5])).then(e=>({default:e.InstanceConfigPage}))),nw=w.lazy(()=>Xt(()=>import("./DiscoverPage-Pqr0B6n7.js"),__vite__mapDeps([9,6,5])).then(e=>({default:e.DiscoverPage}))),rw=w.lazy(()=>Xt(()=>import("./RootHome-CTLglUiz.js"),__vite__mapDeps([10,3,4,1,2,5,6])).then(e=>({default:e.RootHome})));Z1();const Xp=()=>document.documentElement.setAttribute("data-tab-hidden",document.hidden?"true":"false");document.addEventListener("visibilitychange",Xp);Xp();function sw(){const{tag:e}=Qy();return l.jsx(Jp,{filterTag:e?decodeURIComponent(e):void 0})}const ow=f0([{path:"/",element:l.jsx(j1,{}),errorElement:l.jsx(_1,{}),children:[{index:!0,element:l.jsx(rw,{})},{path:"projects",element:l.jsx(Jp,{})},{path:"tags/:tag",element:l.jsx(sw,{})},{path:"projects/:slug",element:l.jsx(ew,{})},{path:"projects/:slug/home",element:l.jsx(Te,{})},{path:"projects/:slug/chat",element:l.jsx(Te,{})},{path:"projects/:slug/chat/:sessionId",element:l.jsx(Te,{})},{path:"projects/:slug/files",element:l.jsx(Te,{})},{path:"projects/:slug/files/*",element:l.jsx(Te,{})},{path:"projects/:slug/changes",element:l.jsx(Te,{})},{path:"projects/:slug/changes/:file",element:l.jsx(Te,{})},{path:"projects/:slug/history",element:l.jsx(Te,{})},{path:"projects/:slug/settings",element:l.jsx(Te,{})},{path:"projects/:slug/triggers",element:l.jsx(Te,{})},{path:"projects/:slug/hooks",element:l.jsx(Te,{})},{path:"chat",element:l.jsx(Te,{root:!0})},{path:"chat/:sessionId",element:l.jsx(Te,{root:!0})},{path:"files",element:l.jsx(Te,{root:!0})},{path:"files/*",element:l.jsx(Te,{root:!0})},{path:"changes",element:l.jsx(Te,{root:!0})},{path:"changes/:file",element:l.jsx(Te,{root:!0})},{path:"history",element:l.jsx(Te,{root:!0})},{path:"triggers",element:l.jsx(Te,{root:!0})},{path:"settings",element:l.jsx(Te,{root:!0})},{path:"config",element:l.jsx(tw,{})},{path:"discover",element:l.jsx(nw,{})}]}]);ka.createRoot(document.getElementById("root")).render(l.jsx(Zd.StrictMode,{children:l.jsx(L0,{children:l.jsx(w0,{router:ow})})}));L1();export{Qx as $,Hx as A,tS as B,$w as C,Qp as D,W1 as E,Gp as F,jt as G,hx as H,Dw as I,Sl as J,Rd as K,Vs as L,Yw as M,lw as N,_w as O,Xw as P,Jt as Q,ju as R,Hw as S,Jw as T,Kx as U,Iw as V,On as W,$i as X,bw as Y,Lw as Z,aw as _,or as a,hw as a$,Vx as a0,uS as a1,Wx as a2,sS as a3,Mp as a4,iS as a5,iw as a6,Bw as a7,Uw as a8,Zw as a9,oS as aA,qw as aB,Eu as aC,Nu as aD,Kw as aE,yw as aF,bp as aG,Aw as aH,S1 as aI,xw as aJ,nS as aK,aS as aL,eS as aM,lS as aN,mw as aO,gw as aP,Q0 as aQ,H0 as aR,vw as aS,Xx as aT,fw as aU,uw as aV,T0 as aW,lr as aX,cw as aY,dw as aZ,w1 as a_,Qw as aa,Jx as ab,Fw as ac,kw as ad,jw as ae,Cw as af,Nw as ag,Ew as ah,Pw as ai,Rw as aj,Tw as ak,X0 as al,gx as am,zw as an,Y0 as ao,ga as ap,ww as aq,Xt as ar,Mi as as,Mw as at,M0 as au,Sw as av,Vw as aw,Cu as ax,Ow as ay,rS as az,Sp as b,cS as b0,st as c,px as d,Zs as e,Ux as f,Ud as g,p1 as h,R0 as i,l as j,K0 as k,Gw as l,wl as m,pw as n,F0 as o,A0 as p,Ww as q,w as r,Q1 as s,J1 as t,Qy as u,X1 as v,dS as w,V1 as x,fS as y,hS as z};
|
|
71
71
|
|