@edspencer/paddock 0.69.0 → 0.70.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 +1 -1
- package/packages/server/dist/agent-errors.js +7 -1
- package/packages/server/dist/cli/paddock.js +12 -7
- package/packages/server/dist/config.d.ts +7 -5
- package/packages/server/dist/config.js +0 -1
- package/packages/server/dist/instance-config.js +1 -2
- package/packages/server/dist/recovery-config.d.ts +0 -6
- package/packages/server/dist/recovery-config.js +0 -4
- package/packages/server/package.json +1 -1
- package/packages/web/dist/assets/{Chip-B8UU8Zpr.js → Chip-C8a-t439.js} +1 -1
- package/packages/web/dist/assets/DiscoverPage-C1khyCvD.js +2 -0
- package/packages/web/dist/assets/{DiscoverView-CKN93BnT.js → DiscoverView-DS_Z9xKH.js} +1 -1
- package/packages/web/dist/assets/{InstanceConfigPage-COc2rsu6.js → InstanceConfigPage-B1ei1FDo.js} +1 -1
- package/packages/web/dist/assets/{MarkdownRenderer-BlUYSdHR.js → MarkdownRenderer-DCj_ZwVG.js} +1 -1
- package/packages/web/dist/assets/{ProjectMenu-Davm1-P7.js → ProjectMenu-B7dGZSFB.js} +1 -1
- package/packages/web/dist/assets/{ProjectRedirect-COrC7Yvg.js → ProjectRedirect-bstvMvM9.js} +1 -1
- package/packages/web/dist/assets/{ProjectView-WIODXM93.js → ProjectView-iuiUIoIl.js} +11 -11
- package/packages/web/dist/assets/{ProjectsGrid-CfDehr5s.js → ProjectsGrid-DKvySDUQ.js} +1 -1
- package/packages/web/dist/assets/{RootHome-DniHfYAw.js → RootHome-CD_37qb-.js} +1 -1
- package/packages/web/dist/assets/{Surfaces-GzOkJJHQ.js → Surfaces-1dBayrsj.js} +1 -1
- package/packages/web/dist/assets/{arc-_I2xwzbW.js → arc-BJPb3ViJ.js} +1 -1
- package/packages/web/dist/assets/{architectureDiagram-3BPJPVTR-GW4T_vCB.js → architectureDiagram-3BPJPVTR-PkLOC5wV.js} +1 -1
- package/packages/web/dist/assets/{blockDiagram-GPEHLZMM-rpMzVG3O.js → blockDiagram-GPEHLZMM-IPduhNH-.js} +1 -1
- package/packages/web/dist/assets/{c4Diagram-AAUBKEIU-CwxpNlW3.js → c4Diagram-AAUBKEIU-dKTYV1Vq.js} +1 -1
- package/packages/web/dist/assets/channel-BhrgMiqg.js +2 -0
- package/packages/web/dist/assets/{chunk-2J33WTMH-BG9SyFJ-.js → chunk-2J33WTMH-B5C6geyg.js} +1 -1
- package/packages/web/dist/assets/{chunk-4BX2VUAB-DJlbnTd4.js → chunk-4BX2VUAB-1BRhFRhF.js} +1 -1
- package/packages/web/dist/assets/{chunk-55IACEB6-C-VMlU4m.js → chunk-55IACEB6-DNv-sTiI.js} +1 -1
- package/packages/web/dist/assets/{chunk-727SXJPM-Wigu1170.js → chunk-727SXJPM-CWezuVkx.js} +1 -1
- package/packages/web/dist/assets/{chunk-AQP2D5EJ-C5CFWtjs.js → chunk-AQP2D5EJ-Bt4yEQnu.js} +1 -1
- package/packages/web/dist/assets/{chunk-FMBD7UC4-hQaZU9Hi.js → chunk-FMBD7UC4-lb_8q4JY.js} +1 -1
- package/packages/web/dist/assets/{chunk-ND2GUHAM-AMO00QGi.js → chunk-ND2GUHAM-DOwgGlQ_.js} +1 -1
- package/packages/web/dist/assets/{chunk-QZHKN3VN-T3F7CT-B.js → chunk-QZHKN3VN-BanKpY4q.js} +1 -1
- package/packages/web/dist/assets/classDiagram-4FO5ZUOK-Ho1IMdjg.js +2 -0
- package/packages/web/dist/assets/classDiagram-v2-Q7XG4LA2-Ho1IMdjg.js +2 -0
- package/packages/web/dist/assets/{core-D1JA8p71.js → core-CAsyoNAa.js} +1 -1
- package/packages/web/dist/assets/{cose-bilkent-S5V4N54A-C_fPZY7X.js → cose-bilkent-S5V4N54A-sVaVkwMI.js} +1 -1
- package/packages/web/dist/assets/{dagre-BM42HDAG-nLjMp3c7.js → dagre-BM42HDAG-C9pKHSMo.js} +1 -1
- package/packages/web/dist/assets/{diagram-2AECGRRQ-qYzVcYYg.js → diagram-2AECGRRQ-CHdrmCfX.js} +1 -1
- package/packages/web/dist/assets/{diagram-5GNKFQAL-DVFKMWv0.js → diagram-5GNKFQAL-4UTa2Dfa.js} +1 -1
- package/packages/web/dist/assets/{diagram-KO2AKTUF-B8T7qnCR.js → diagram-KO2AKTUF-NidpfVwW.js} +1 -1
- package/packages/web/dist/assets/{diagram-LMA3HP47-9-_-MiG8.js → diagram-LMA3HP47-ictQj03T.js} +1 -1
- package/packages/web/dist/assets/{diagram-OG6HWLK6-D4eE55Vg.js → diagram-OG6HWLK6-B7dTLMHC.js} +1 -1
- package/packages/web/dist/assets/{erDiagram-TEJ5UH35-adlALhlq.js → erDiagram-TEJ5UH35-C2QYYzJ8.js} +1 -1
- package/packages/web/dist/assets/{flowDiagram-I6XJVG4X-jhJEXK0D.js → flowDiagram-I6XJVG4X-D2rcjSZ9.js} +1 -1
- package/packages/web/dist/assets/{ganttDiagram-6RSMTGT7-CHGNR8Fk.js → ganttDiagram-6RSMTGT7-BQcXTYzg.js} +1 -1
- package/packages/web/dist/assets/{gitGraphDiagram-PVQCEYII-tBQ_60zD.js → gitGraphDiagram-PVQCEYII-DwB2Vqxa.js} +1 -1
- package/packages/web/dist/assets/index-BNzTD4hA.css +1 -0
- package/packages/web/dist/assets/{index-Djl4krRr.js → index-BeuEs7dL.js} +2 -2
- package/packages/web/dist/assets/{infoDiagram-5YYISTIA-D_LJZit4.js → infoDiagram-5YYISTIA-BoK4Mawg.js} +1 -1
- package/packages/web/dist/assets/{ishikawaDiagram-YF4QCWOH-CLsVMtFo.js → ishikawaDiagram-YF4QCWOH-DPP9svhg.js} +1 -1
- package/packages/web/dist/assets/{journeyDiagram-JHISSGLW-DKLfsczG.js → journeyDiagram-JHISSGLW-TrggodYk.js} +1 -1
- package/packages/web/dist/assets/{kanban-definition-UN3LZRKU-CG1dRRin.js → kanban-definition-UN3LZRKU-Bh69hRSR.js} +1 -1
- package/packages/web/dist/assets/{linear-Bc0TsEWL.js → linear-C1iYMpBz.js} +1 -1
- package/packages/web/dist/assets/{mermaid.core-7NBz7_-Q.js → mermaid.core-BZDABcuq.js} +4 -4
- package/packages/web/dist/assets/{mindmap-definition-RKZ34NQL-DD-2NsoA.js → mindmap-definition-RKZ34NQL-DTJON3dS.js} +1 -1
- package/packages/web/dist/assets/{pieDiagram-4H26LBE5-BTYpRP3j.js → pieDiagram-4H26LBE5-BxtFV74I.js} +1 -1
- package/packages/web/dist/assets/{quadrantDiagram-W4KKPZXB-DScmlT0o.js → quadrantDiagram-W4KKPZXB-D2Ar8kmO.js} +1 -1
- package/packages/web/dist/assets/{requirementDiagram-4Y6WPE33-BzLuYCY3.js → requirementDiagram-4Y6WPE33-DiLSfeSQ.js} +1 -1
- package/packages/web/dist/assets/{sankeyDiagram-5OEKKPKP-CH9nUHfL.js → sankeyDiagram-5OEKKPKP-D_CRQc7j.js} +1 -1
- package/packages/web/dist/assets/{sequenceDiagram-3UESZ5HK-vQjaE3Ay.js → sequenceDiagram-3UESZ5HK-DjtfcRNV.js} +1 -1
- package/packages/web/dist/assets/{stateDiagram-AJRCARHV-C76FMvr4.js → stateDiagram-AJRCARHV-CzEtmYLV.js} +1 -1
- package/packages/web/dist/assets/stateDiagram-v2-BHNVJYJU-pM8fIOir.js +2 -0
- package/packages/web/dist/assets/{timeline-definition-PNZ67QCA-zjhYOHh7.js → timeline-definition-PNZ67QCA-DXKspEG3.js} +1 -1
- package/packages/web/dist/assets/{vennDiagram-CIIHVFJN-BpyreyjG.js → vennDiagram-CIIHVFJN-B_tXRMHH.js} +1 -1
- package/packages/web/dist/assets/{wardley-L42UT6IY-CugQjZZ8.js → wardley-L42UT6IY-DNaNoaJm.js} +1 -1
- package/packages/web/dist/assets/{wardleyDiagram-YWT4CUSO-CTpxg9iQ.js → wardleyDiagram-YWT4CUSO-BuVDpC8s.js} +1 -1
- package/packages/web/dist/assets/{xychartDiagram-2RQKCTM6-COJLOF01.js → xychartDiagram-2RQKCTM6-Cqtew2PA.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-vz1s8GYQ.js +0 -2
- package/packages/web/dist/assets/channel-nPAjQX8p.js +0 -2
- package/packages/web/dist/assets/classDiagram-4FO5ZUOK-DuI-4XNG.js +0 -2
- package/packages/web/dist/assets/classDiagram-v2-Q7XG4LA2-DuI-4XNG.js +0 -2
- package/packages/web/dist/assets/index-CJT1g4_p.css +0 -1
- package/packages/web/dist/assets/stateDiagram-v2-BHNVJYJU-CWy9AQvb.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-DKvySDUQ.js","assets/ProjectMenu-B7dGZSFB.js","assets/ProjectView-iuiUIoIl.js","assets/queued-CagZVfWU.js","assets/Surfaces-1dBayrsj.js","assets/lastTab-CU1zsF0j.js","assets/ProjectRedirect-bstvMvM9.js","assets/InstanceConfigPage-B1ei1FDo.js","assets/Chip-C8a-t439.js","assets/DiscoverPage-C1khyCvD.js","assets/DiscoverView-DS_Z9xKH.js","assets/RootHome-CD_37qb-.js"])))=>i.map(i=>d[i]);
|
|
2
2
|
function xd(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const o in r)if(o!=="default"&&!(o in e)){const l=Object.getOwnPropertyDescriptor(r,o);l&&Object.defineProperty(e,o,l.get?l:{enumerable:!0,get:()=>r[o]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))r(o);new MutationObserver(o=>{for(const l of o)if(l.type==="childList")for(const i of l.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&r(i)}).observe(document,{childList:!0,subtree:!0});function n(o){const l={};return o.integrity&&(l.integrity=o.integrity),o.referrerPolicy&&(l.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?l.credentials="include":o.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function r(o){if(o.ep)return;o.ep=!0;const l=n(o);fetch(o.href,l)}})();const Up="modulepreload",Ap=function(e){return"/"+e},Du={},Kt=function(t,n,r){let o=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const i=document.querySelector("meta[property=csp-nonce]"),a=(i==null?void 0:i.nonce)||(i==null?void 0:i.getAttribute("nonce"));o=Promise.allSettled(n.map(s=>{if(s=Ap(s),s in Du)return;Du[s]=!0;const u=s.endsWith(".css"),d=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${s}"]${d}`))return;const c=document.createElement("link");if(c.rel=u?"stylesheet":Up,u||(c.as="script"),c.crossOrigin="",c.href=s,a&&c.setAttribute("nonce",a),document.head.appendChild(c),u)return new Promise((p,w)=>{c.addEventListener("load",p),c.addEventListener("error",()=>w(new Error(`Unable to preload CSS for ${s}`)))})}))}function l(i){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=i,window.dispatchEvent(a),!a.defaultPrevented)throw i}return o.then(i=>{for(const a of i||[])a.status==="rejected"&&l(a.reason);return t().catch(l)})};var U1=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Sd(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var kd={exports:{}},ii={},Ed={exports:{}},ee={};/**
|
|
3
3
|
* @license React
|
|
4
4
|
* react.production.min.js
|
|
@@ -67,5 +67,5 @@ Error generating stack: `+l.message+`
|
|
|
67
67
|
* LICENSE.md file in the root directory of this source tree.
|
|
68
68
|
*
|
|
69
69
|
* @license MIT
|
|
70
|
-
*/function Ur(){return Ur=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Ur.apply(this,arguments)}function Zh(e,t){if(e==null)return{};var n={},r=Object.keys(e),o,l;for(l=0;l<r.length;l++)o=r[l],!(t.indexOf(o)>=0)&&(n[o]=e[o]);return n}function My(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Ly(e,t){return e.button===0&&(!t||t==="_self")&&!My(e)}const Iy=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","unstable_viewTransition"],Dy=["aria-current","caseSensitive","className","end","style","to","unstable_viewTransition","children"],Oy="6";try{window.__reactRouterVersion=Oy}catch{}function zy(e,t){return Vv({basename:void 0,future:Ur({},void 0,{v7_prependBasename:!0}),history:pv({window:void 0}),hydrationData:$y(),routes:e,mapRouteProperties:Ry,unstable_dataStrategy:void 0,unstable_patchRoutesOnNavigation:void 0,window:void 0}).initialize()}function $y(){var e;let t=(e=window)==null?void 0:e.__staticRouterHydrationData;return t&&t.errors&&(t=Ur({},t,{errors:Uy(t.errors)})),t}function Uy(e){if(!e)return null;let t=Object.entries(e),n={};for(let[r,o]of t)if(o&&o.__type==="RouteErrorResponse")n[r]=new oi(o.status,o.statusText,o.data,o.internal===!0);else if(o&&o.__type==="Error"){if(o.__subType){let l=window[o.__subType];if(typeof l=="function")try{let i=new l(o.message);i.stack="",n[r]=i}catch{}}if(n[r]==null){let l=new Error(o.message);l.stack="",n[r]=l}}else n[r]=o;return n}const qh=E.createContext({isTransitioning:!1}),Ay=E.createContext(new Map),Fy="startTransition",ld=tm[Fy],by="flushSync",id=hv[by];function By(e){ld?ld(e):e()}function no(e){id?id(e):e()}class Wy{constructor(){this.status="pending",this.promise=new Promise((t,n)=>{this.resolve=r=>{this.status==="pending"&&(this.status="resolved",t(r))},this.reject=r=>{this.status==="pending"&&(this.status="rejected",n(r))}})}}function Vy(e){let{fallbackElement:t,router:n,future:r}=e,[o,l]=E.useState(n.state),[i,a]=E.useState(),[s,u]=E.useState({isTransitioning:!1}),[d,c]=E.useState(),[p,w]=E.useState(),[x,k]=E.useState(),_=E.useRef(new Map),{v7_startTransition:v}=r||{},h=E.useCallback(m=>{v?By(m):m()},[v]),g=E.useCallback((m,O)=>{let{deletedFetchers:L,unstable_flushSync:H,unstable_viewTransitionOpts:oe}=O;L.forEach(de=>_.current.delete(de)),m.fetchers.forEach((de,rt)=>{de.data!==void 0&&_.current.set(rt,de.data)});let ge=n.window==null||n.window.document==null||typeof n.window.document.startViewTransition!="function";if(!oe||ge){H?no(()=>l(m)):h(()=>l(m));return}if(H){no(()=>{p&&(d&&d.resolve(),p.skipTransition()),u({isTransitioning:!0,flushSync:!0,currentLocation:oe.currentLocation,nextLocation:oe.nextLocation})});let de=n.window.document.startViewTransition(()=>{no(()=>l(m))});de.finished.finally(()=>{no(()=>{c(void 0),w(void 0),a(void 0),u({isTransitioning:!1})})}),no(()=>w(de));return}p?(d&&d.resolve(),p.skipTransition(),k({state:m,currentLocation:oe.currentLocation,nextLocation:oe.nextLocation})):(a(m),u({isTransitioning:!0,flushSync:!1,currentLocation:oe.currentLocation,nextLocation:oe.nextLocation}))},[n.window,p,d,_,h]);E.useLayoutEffect(()=>n.subscribe(g),[n,g]),E.useEffect(()=>{s.isTransitioning&&!s.flushSync&&c(new Wy)},[s]),E.useEffect(()=>{if(d&&i&&n.window){let m=i,O=d.promise,L=n.window.document.startViewTransition(async()=>{h(()=>l(m)),await O});L.finished.finally(()=>{c(void 0),w(void 0),a(void 0),u({isTransitioning:!1})}),w(L)}},[h,i,d,n.window]),E.useEffect(()=>{d&&i&&o.location.key===i.location.key&&d.resolve()},[d,p,o.location,i]),E.useEffect(()=>{!s.isTransitioning&&x&&(a(x.state),u({isTransitioning:!0,flushSync:!1,currentLocation:x.currentLocation,nextLocation:x.nextLocation}),k(void 0))},[s.isTransitioning,x]),E.useEffect(()=>{},[]);let C=E.useMemo(()=>({createHref:n.createHref,encodeLocation:n.encodeLocation,go:m=>n.navigate(m),push:(m,O,L)=>n.navigate(m,{state:O,preventScrollReset:L==null?void 0:L.preventScrollReset}),replace:(m,O,L)=>n.navigate(m,{replace:!0,state:O,preventScrollReset:L==null?void 0:L.preventScrollReset})}),[n]),T=n.basename||"/",P=E.useMemo(()=>({router:n,navigator:C,static:!1,basename:T}),[n,C,T]),M=E.useMemo(()=>({v7_relativeSplatPath:n.future.v7_relativeSplatPath}),[n.future.v7_relativeSplatPath]);return E.createElement(E.Fragment,null,E.createElement(Qo.Provider,{value:P},E.createElement(su.Provider,{value:o},E.createElement(Ay.Provider,{value:_.current},E.createElement(qh.Provider,{value:s},E.createElement(_y,{basename:T,location:o.location,navigationType:o.historyAction,navigator:C,future:M},o.initialized||n.future.v7_partialHydration?E.createElement(Hy,{routes:n.routes,future:n.future,state:o}):t))))),null)}const Hy=E.memo(Qy);function Qy(e){let{routes:t,future:n,state:r}=e;return vy(t,void 0,r,n)}const Ky=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",Gy=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Uo=E.forwardRef(function(t,n){let{onClick:r,relative:o,reloadDocument:l,replace:i,state:a,target:s,to:u,preventScrollReset:d,unstable_viewTransition:c}=t,p=Zh(t,Iy),{basename:w}=E.useContext(rn),x,k=!1;if(typeof u=="string"&&Gy.test(u)&&(x=u,Ky))try{let g=new URL(window.location.href),C=u.startsWith("//")?new URL(g.protocol+u):new URL(u),T=tn(C.pathname,w);C.origin===g.origin&&T!=null?u=T+C.search+C.hash:k=!0}catch{}let _=hy(u,{relative:o}),v=Yy(u,{replace:i,state:a,target:s,preventScrollReset:d,relative:o,unstable_viewTransition:c});function h(g){r&&r(g),g.defaultPrevented||v(g)}return E.createElement("a",Ur({},p,{href:x||_,onClick:k||l?r:h,ref:n,target:s}))}),An=E.forwardRef(function(t,n){let{"aria-current":r="page",caseSensitive:o=!1,className:l="",end:i=!1,style:a,to:s,unstable_viewTransition:u,children:d}=t,c=Zh(t,Dy),p=Pi(s,{relative:c.relative}),w=tr(),x=E.useContext(su),{navigator:k,basename:_}=E.useContext(rn),v=x!=null&&Xy(p)&&u===!0,h=k.encodeLocation?k.encodeLocation(p).pathname:p.pathname,g=w.pathname,C=x&&x.navigation&&x.navigation.location?x.navigation.location.pathname:null;o||(g=g.toLowerCase(),C=C?C.toLowerCase():null,h=h.toLowerCase()),C&&_&&(C=tn(C,_)||C);const T=h!=="/"&&h.endsWith("/")?h.length-1:h.length;let P=g===h||!i&&g.startsWith(h)&&g.charAt(T)==="/",M=C!=null&&(C===h||!i&&C.startsWith(h)&&C.charAt(h.length)==="/"),m={isActive:P,isPending:M,isTransitioning:v},O=P?r:void 0,L;typeof l=="function"?L=l(m):L=[l,P?"active":null,M?"pending":null,v?"transitioning":null].filter(Boolean).join(" ");let H=typeof a=="function"?a(m):a;return E.createElement(Uo,Ur({},c,{"aria-current":O,className:L,ref:n,style:H,to:s,unstable_viewTransition:u}),typeof d=="function"?d(m):d)});var ls;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(ls||(ls={}));var ad;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(ad||(ad={}));function Jy(e){let t=E.useContext(Qo);return t||Y(!1),t}function Yy(e,t){let{target:n,replace:r,state:o,preventScrollReset:l,relative:i,unstable_viewTransition:a}=t===void 0?{}:t,s=ji(),u=tr(),d=Pi(e,{relative:i});return E.useCallback(c=>{if(Ly(c,n)){c.preventDefault();let p=r!==void 0?r:Zn(u)===Zn(d);s(e,{replace:p,state:o,preventScrollReset:l,relative:i,unstable_viewTransition:a})}},[u,s,d,r,o,n,e,l,i,a])}function Xy(e,t){t===void 0&&(t={});let n=E.useContext(qh);n==null&&Y(!1);let{basename:r}=Jy(ls.useViewTransitionState),o=Pi(e,{relative:t.relative});if(!n.isTransitioning)return!1;let l=tn(n.currentLocation.pathname,r)||n.currentLocation.pathname,i=tn(n.nextLocation.pathname,r)||n.nextLocation.pathname;return ri(o.pathname,i)!=null||ri(o.pathname,l)!=null}const cu="";function du(e){return e===cu}function G(e){return du(e)?"/api/root":`/api/projects/${encodeURIComponent(e)}`}function Zy(e){return du(e)?"":`/projects/${e}`}function b1(e){return e===""?"/":`${e}/home`}function qy(){return"/projects"}function B1(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 W1(e,t){const n=`${t}/files`;if(!e.startsWith(n))return"";const r=e.slice(n.length).replace(/^\//,"");return r?r.split("/").filter(Boolean).map(o=>{try{return decodeURIComponent(o)}catch{return o}}).join("/"):""}function V1(e){if(!e)return"#";const t=e.trim().replace(/\.git$/i,"");if(/^https?:\/\//i.test(t))return t;const n=/^git@([^:]+):(.+)$/.exec(t);if(n)return`https://${n[1]}/${n[2]}`;const r=/^ssh:\/\/git@([^/]+)\/(.+)$/i.exec(t);return r?`https://${r[1]}/${r[2]}`:"#"}const xr="";async function W(e,t){const n=await fetch(`${xr}${e}`,{headers:{"content-type":"application/json",...(t==null?void 0:t.headers)??{}},...t});if(!n.ok){let r=n.statusText;try{const o=await n.json();o.error&&(r=o.error)}catch{}throw new Ao(r,n.status)}return await n.json()}async function e0(e,t){const n=await fetch(`${xr}${e}`,t);if(!n.ok){let r=n.statusText;try{const o=JSON.parse(await n.text());o.error&&(r=o.error)}catch{}throw new Ao(r,n.status)}return n.text()}class Ao extends Error{constructor(t,n){super(t),this.status=n,this.name="ApiError"}}const fu={async me(){return W("/api/me")},async markChatSeen(e,t,n,r){const o=`${G(e)}/chats/${encodeURIComponent(t)}/seen`;await W(o,{method:"POST",body:JSON.stringify({...n!==void 0?{when:n}:{},...r!=null&&r.keepUnread?{keepUnread:!0}:{}})})},async markChatUnread(e,t,n){const r=`${G(e)}/chats/${encodeURIComponent(t)}/unread`;await W(r,{method:"POST",body:JSON.stringify({unread:n})})},async projectRuns(e,t){const n=t!==void 0?`?limit=${encodeURIComponent(t)}`:"";return W(`${G(e)}/runs${n}`)},async markRunsSeen(e,t){await W(`${G(e)}/runs/seen`,{method:"POST",body:JSON.stringify(t!==void 0?{when:t}:{})})},async getModels(){return W("/api/models")},async getInstanceConfig(){return W("/api/instance-config")},async updateInstanceConfig(e,t){return W("/api/instance-config",{method:"PUT",body:JSON.stringify(t===void 0?{patch:e}:{patch:e,expectedVersion:t})})},async uploadAttachments(e,t,n){const r=new FormData;for(const l of n)r.append("files",l,l.name);const o=await fetch(`${xr}${G(e)}/chats/${encodeURIComponent(t)}/upload`,{method:"POST",body:r});if(!o.ok){let l=o.statusText;try{const i=await o.json();i.error&&(l=i.error)}catch{}throw new Ao(l,o.status)}return await o.json()},async projectCommands(e){const{commands:t}=await W(`${G(e)}/commands`);return t},async listProjects(){const{projects:e,root:t}=await W("/api/projects");return{projects:e,root:t??null}},async getProjectDetail(e){return W(`${G(e)}`)},async attentionChats(e){const t=await W(`${G(e)}/chats/attention`);return{running:t.running??[],unread:t.unread??[]}},async createProject(e){const{project:t}=await W("/api/projects",{method:"POST",body:JSON.stringify(e)});return t},async updateProject(e,t){const{project:n}=await W(`${G(e)}`,{method:"PATCH",body:JSON.stringify(t)});return n},async promoteProject(e,t){const{project:n}=await W(`${G(e)}/promote`,{method:"POST",body:JSON.stringify({repo:t})});return n},async deleteProject(e){await W(`${G(e)}`,{method:"DELETE"})},async deleteProjectChat(e,t){await W(`${G(e)}/chats/${encodeURIComponent(t)}`,{method:"DELETE"})},async renameProjectChat(e,t,n){await W(`${G(e)}/chats/${encodeURIComponent(t)}`,{method:"PATCH",body:JSON.stringify({name:n})})},async archiveProjectChat(e,t,n){await W(`${G(e)}/chats/${encodeURIComponent(t)}/archive`,{method:"POST",body:JSON.stringify({archived:n})})},async starProjectChat(e,t,n){await W(`${G(e)}/chats/${encodeURIComponent(t)}/star`,{method:"POST",body:JSON.stringify({starred:n})})},async archiveProjectChats(e,t,n){await W(`${G(e)}/chats/batch/archive`,{method:"POST",body:JSON.stringify({sessionIds:t,archived:n})})},async markChatsUnread(e,t,n){await W(`${G(e)}/chats/batch/unread`,{method:"POST",body:JSON.stringify({sessionIds:t,unread:n})})},async deleteProjectChats(e,t){const n=await W(`${G(e)}/chats/batch/delete`,{method:"POST",body:JSON.stringify({sessionIds:t})});return{removed:n.removed??[],failed:n.failed??[]}},async detachProjectChat(e,t,n){await W(`${G(e)}/chats/${encodeURIComponent(t)}/detach`,{method:"POST",body:JSON.stringify({detached:n})})},async promoteChat(e,t,n){return W(`${G(e)}/chats/${encodeURIComponent(t)}/promote`,{method:"POST",body:JSON.stringify(n)})},async forkChat(e,t,n,r){const{sessionId:o}=await W(`${G(e)}/chats/${encodeURIComponent(t)}/fork`,{method:"POST",body:JSON.stringify({name:n,fromUuid:r})});return o},async revertChat(e,t,n){const{removed:r}=await W(`${G(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 W(`${G(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 W(`${G(e)}/files/${encodeURIComponent(t)}`)},projectFileRawUrl(e,t){return`${xr}${G(e)}/files/${encodeURIComponent(t)}?raw=1`},chatFileRawUrl(e){return`${xr}/api/chat-files/${encodeURIComponent(e)}`},async pinFile(e,t){const{project:n}=await W(`${G(e)}/pins`,{method:"PUT",body:JSON.stringify({file:t})});return n},async unpinFile(e,t){const{project:n}=await W(`${G(e)}/pins/${encodeURIComponent(t)}`,{method:"DELETE"});return n},async listProjectChats(e){const{chats:t}=await W(`${G(e)}/chats`);return t},async getAdoptableChats(e){return W(`${G(e)}/adoptable-chats`)},async adoptChats(e,t){return W(`${G(e)}/adopt-chats`,{method:"POST",body:JSON.stringify(t??{})})},async unadoptChats(e,t){return W(`${G(e)}/unadopt-chats`,{method:"POST",body:JSON.stringify(t??{})})},async chatUsage(e,t){const n=t?`?scope=${t}`:"",{usage:r}=await W(`${G(e)}/chats/usage${n}`);return r},async projectChatMessages(e,t){const{messages:n}=await W(`${G(e)}/chats/${encodeURIComponent(t)}/messages`);return n},async subagentMessages(e,t,n){const r=`${G(e)}/chats/${encodeURIComponent(t)}`,{messages:o}=await W(`${r}/subagents/${encodeURIComponent(n)}/messages`);return o},async chatContext(e,t){const n=`${G(e)}/chats/${encodeURIComponent(t)}/context`,{usage:r}=await W(n);return r},async listTriggers(e){return W(`${G(e)}/triggers`)},async putTrigger(e,t,n){const{trigger:r}=await W(`${G(e)}/triggers/${encodeURIComponent(t)}`,{method:"PUT",body:JSON.stringify(n)});return r},async deleteTrigger(e,t){await W(`${G(e)}/triggers/${encodeURIComponent(t)}`,{method:"DELETE"})},async triggerRuntime(e){return W(`${G(e)}/triggers/runtime`)},async runTrigger(e,t){const{sessionId:n}=await W(`${G(e)}/triggers/${encodeURIComponent(t)}/run`,{method:"POST",body:"{}"});return n},async gitInfo(){return W("/api/git")},async gitStatus(e){return W(`${G(e)}/git/status`)},async gitDiff(e,t){const n=t?`?file=${encodeURIComponent(t)}`:"";return e0(`${G(e)}/git/diff${n}`)},async gitCommit(e,t,n){return W(`${G(e)}/git/commit`,{method:"POST",body:JSON.stringify(n?{message:t,files:n}:{message:t})})},async gitPush(){return W("/api/git/push",{method:"POST"})},async githubConnect(){return W("/api/git/github/connect",{method:"POST"})},async githubPoll(e){return W("/api/git/github/poll",{method:"POST",body:JSON.stringify({deviceCode:e})})},async githubDisconnect(){await W("/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 W(`/api/discover${n?`?${n}`:""}`)},async discoverSessions(e){return W(`/api/discover/sessions?dir=${encodeURIComponent(e)}`)},async transcriptionStatus(){return W("/api/transcription")},async transcribe(e,t="dictation.webm",n){const r=new FormData;r.append("file",e,t);const o=await fetch(`${xr}/api/transcribe`,{method:"POST",body:r,signal:n});if(!o.ok){let i=o.statusText;try{const a=await o.json();a.error&&(i=a.error)}catch{}throw new Ao(i,o.status)}const{text:l}=await o.json();return l}},ep=E.createContext(null);function t0({children:e}){const[t,n]=E.useState([]),[r,o]=E.useState(null),[l,i]=E.useState(!0),[a,s]=E.useState(null),u=E.useRef(!1),d=E.useCallback(async()=>{u.current||i(!0),s(null);try{const{projects:x,root:k}=await fu.listProjects();u.current=!0,n(x),k&&o(k)}catch(x){s(x instanceof Error?x.message:"Failed to load projects")}finally{i(!1)}},[]),c=E.useCallback(x=>{if(du(x.slug)){o(x);return}n(k=>[x,...k.filter(_=>_.slug!==x.slug)])},[]),p=E.useCallback(x=>{n(k=>k.filter(_=>_.slug!==x))},[]);E.useEffect(()=>{d()},[d]);const w=E.useMemo(()=>({projects:t,rootWorkspace:r,loading:l,error:a,refresh:d,upsert:c,remove:p}),[t,r,l,a,d,c,p]);return f.jsx(ep.Provider,{value:w,children:e})}function tp(){const e=E.useContext(ep);if(!e)throw new Error("useProjects must be used within ProjectsProvider");return e}const n0="paddock:theme";function r0(){return typeof document<"u"&&document.documentElement.classList.contains("dark")}function o0(){const[e,t]=E.useState(r0),n=E.useCallback(()=>{t(r=>{const o=!r;document.documentElement.classList.toggle("dark",o);try{localStorage.setItem(n0,o?"dark":"light")}catch{}return o})},[]);return{dark:e,toggle:n}}const np={name:"Paddock",logo:"🐎",accent:"#c2603c"},l0={enabled:!1,path:"/open-api"};function rp(){const e=globalThis.__PADDOCK_CONFIG__;return{...np,...(e==null?void 0:e.brand)??{}}}function i0(){const e=globalThis.__PADDOCK_CONFIG__;return{...l0,...(e==null?void 0:e.openapi)??{}}}function a0(e){return/^(https?:\/\/|\/)/i.test(e.trim())}const hu=[{slug:"homelab",label:"Homelab",blurb:"Servers, networking, self-hosted services."},{slug:"house",label:"House",blurb:"Physical home systems — water, climate, power, garden."},{slug:"side-projects",label:"Side Projects",blurb:"Apps and ideas of your own."}],sd="",op=new Map(hu.map(e=>[e.slug,e]));function s0(e){if(!e)return"Unsorted";const t=op.get(e);return t?t.label:e.split("-").map(n=>n.charAt(0).toUpperCase()+n.slice(1)).join(" ")}function H1(e){var t;return(t=op.get(e))==null?void 0:t.blurb}function u0(e){const t=new Set(e),n=[];for(const o of hu)t.has(o.slug)&&(n.push(o.slug),t.delete(o.slug));const r=t.delete(sd);return n.push(...[...t].sort()),r&&n.push(sd),n}const lp=25e3,ip=1e4,c0=lp+ip+5e3,d0=500,f0=1e4;class h0{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.activeListeners=new Set,this.activeInfoListeners=new Set,this.knownSessions=new Set;const n=`${window.location.protocol==="https:"?"wss":"ws"}://${window.location.host}`;if(this.url=`${n.replace(/^http/,"ws")}/ws`,typeof window<"u"){const r=()=>this.ensureLive();window.addEventListener("online",r),window.addEventListener("focus",r),typeof document<"u"&&document.addEventListener("visibilitychange",()=>{document.visibilityState==="visible"&&this.ensureLive()})}}get state(){return this._state}onState(t){return this.stateListeners.add(t),t(this._state),()=>this.stateListeners.delete(t)}setState(t){if(this._state!==t){this._state=t;for(const n of this.stateListeners)n(t)}}onActiveSessions(t){return this.activeListeners.add(t),t(new Set(this.activeSessions.keys())),this.connect(),()=>this.activeListeners.delete(t)}onActiveInfos(t){return this.activeInfoListeners.add(t),t(new Map(this.activeSessions)),this.connect(),()=>this.activeInfoListeners.delete(t)}turnStartedAt(t){return this.activeStartedAt.get(t)??null}backgroundWork(t){return this.backgroundTasks.get(t)??[]}onBackgroundWork(t,n){const r=(o,l)=>{o===t&&n(l)};return this.backgroundListeners.add(r),n(this.backgroundWork(t)),this.connect(),()=>this.backgroundListeners.delete(r)}setActive(t,n,r,o){const l=this.activeSessions.has(t);if(n?(this.activeSessions.set(t,r),o!=null&&!this.activeStartedAt.has(t)&&this.activeStartedAt.set(t,o)):(this.activeSessions.delete(t),this.activeStartedAt.delete(t)),this.activeSessions.has(t)!==l){const i=new Set(this.activeSessions.keys());for(const s of this.activeListeners)s(i);const a=new Map(this.activeSessions);for(const s of this.activeInfoListeners)s(a)}}subscribe(t,n,r){const o=Symbol("chat-sub"),l={projectSlug:t,sessionId:n,handlers:r,lastSeq:-1,turnActive:!1};return this.subs.set(o,l),this.connect(),n&&this.attachSession(l,!1),{setSessionId:i=>{const a=this.subs.get(o);a&&(a.sessionId=i,i&&this.attachSession(a,!1))},unsubscribe:()=>{this.subs.delete(o)}}}attachSession(t,n){t.sessionId&&(this.knownSessions.add(t.sessionId),this.transmit(JSON.stringify({type:"chat:subscribe",payload:{projectSlug:t.projectSlug,sessionId:t.sessionId,wantReplay:n,lastSeq:t.lastSeq}})))}send(t,n,r,o){const l={projectSlug:t,sessionId:r,message:n};o!=null&&o.preloadContext&&(l.preloadContext=!0),o!=null&&o.model&&(l.model=o.model),o!=null&&o.attachments&&o.attachments.length>0&&(l.attachments=o.attachments),this.markTurnStart(t,r),this.transmit(JSON.stringify({type:"chat:send",payload:l}))}setQueued(t,n,r,o,l){const i={projectSlug:t,sessionId:n,text:r,qid:o};l&&l.length>0&&(i.attachments=l.map(a=>({id:a.id,filename:a.filename,kind:a.kind}))),this.transmit(JSON.stringify({type:"chat:set_queue",payload:i}))}markTurnStart(t,n){for(const r of this.subs.values())r.projectSlug===t&&r.sessionId===n&&(r.lastSeq=-1,r.turnActive=!0)}sendCommand(t,n,r){this.markTurnStart(t,r),this.transmit(JSON.stringify({type:"chat:command",payload:{projectSlug:t,sessionId:r,command:n}}))}cancel(t){this.transmit(JSON.stringify({type:"chat:cancel",payload:{jobId:t}}))}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<c0}wantsSocket(){return this.subs.size>0||this.activeListeners.size>0||this.activeInfoListeners.size>0}ensureLive(){var n;if(!this.wantsSocket())return;const t=(n=this.ws)==null?void 0:n.readyState;t===WebSocket.OPEN?this.sendPing():t!==WebSocket.CONNECTING&&(this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.reconnectAttempts=0,this.connect())}flushOutbox(){var n;if(((n=this.ws)==null?void 0:n.readyState)!==WebSocket.OPEN||this.outbox.length===0)return;const t=this.outbox;this.outbox=[];for(const r of t)this.ws.send(r)}connect(){if(this.manualClose=!1,this.ws&&(this.ws.readyState===WebSocket.OPEN||this.ws.readyState===WebSocket.CONNECTING))return;this.setState("connecting");let t;try{t=new WebSocket(this.url)}catch{this.scheduleReconnect();return}this.ws=t,t.onopen=()=>{this.reconnectAttempts=0,this.awaitingPong=!1,this.lastPongAt=Date.now(),this.setState("open"),this.flushOutbox();for(const n of this.subs.values())n.sessionId&&this.attachSession(n,n.turnActive);this.startPing()},t.onclose=()=>{this.stopPing(),this.setState("closed"),this.manualClose||this.scheduleReconnect()},t.onerror=()=>{t.close()},t.onmessage=n=>this.dispatch(n.data)}startPing(){this.stopPing(),this.pingTimer=setInterval(()=>this.sendPing(),lp)}sendPing(){var t;if(!(((t=this.ws)==null?void 0:t.readyState)!==WebSocket.OPEN||this.awaitingPong)){this.awaitingPong=!0;try{this.ws.send(JSON.stringify({type:"ping"}))}catch{this.awaitingPong=!1,this.ws.close();return}this.pongTimer=setTimeout(()=>{var n;this.pongTimer=null,this.awaitingPong&&((n=this.ws)==null||n.close())},ip)}}stopPing(){this.pingTimer&&clearInterval(this.pingTimer),this.pingTimer=null,this.pongTimer&&clearTimeout(this.pongTimer),this.pongTimer=null,this.awaitingPong=!1}scheduleReconnect(){if(this.reconnectTimer)return;const t=Math.min(f0,d0*2**this.reconnectAttempts);this.reconnectAttempts+=1,this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.connect()},t)}route(t,n){const r=[...this.subs.values()].filter(l=>l.projectSlug===t);if(r.length===0)return;if(n){const l=r.find(i=>i.sessionId===n);if(l)return l;if(this.knownSessions.has(n))return}const o=r.find(l=>l.sessionId===null);if(o)return o;if(n===null&&r.length===1)return r[0]}dispatch(t){var u,d,c,p,w,x,k,_,v,h,g,C,T,P,M,m,O,L,H,oe,ge,de,rt,Ye,wt,D,U,Q;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}const r=n.payload.projectSlug;if(r==null)return;if(n.type==="chat:error"){const A=this.route(r,null);(d=A==null?void 0:(u=A.handlers).onError)==null||d.call(u,n.payload.error);return}if(n.type==="chat:resync"){const A=this.route(r,n.payload.sessionId);(p=A==null?void 0:(c=A.handlers).onResync)==null||p.call(c);return}if(n.type==="chat:background"){const{sessionId:A,tasks:Z}=n.payload;if(A){const ue=Array.isArray(Z)?Z:[];ue.length===0?this.backgroundTasks.delete(A):this.backgroundTasks.set(A,ue);for(const q of this.backgroundListeners)q(A,ue)}return}if(n.type==="chat:active"){this.setActive(n.payload.sessionId,n.payload.running,r,n.payload.startedAt);for(const A of this.subs.values())A.projectSlug===r&&A.sessionId===n.payload.sessionId&&((x=(w=A.handlers).onActive)==null||x.call(w,{running:n.payload.running,turnRunning:n.payload.turnRunning??n.payload.running,jobId:n.payload.jobId}));return}if(n.type==="chat:queued_flushed"){const{sessionId:A,text:Z,attachments:ue}=n.payload;if(A){Kt(async()=>{const{writeQueued:q,writeQueuedId:_e,writeQueuedAttachments:le}=await import("./queued-CagZVfWU.js");return{writeQueued:q,writeQueuedId:_e,writeQueuedAttachments:le}},[]).then(({writeQueued:q,writeQueuedId:_e,writeQueuedAttachments:le})=>{q(A,r,null),_e(A,r,null),le(A,r,[])});for(const q of this.subs.values())q.projectSlug===r&&q.sessionId===A&&((_=(k=q.handlers).onQueuedFlushed)==null||_.call(k,{text:Z,attachments:ue}))}return}if(n.type==="chat:queued_state"){const{sessionId:A,text:Z,qid:ue,reason:q,attachments:_e}=n.payload;if(A){const le=Z&&Z.length>0?Z:null,Ue=_e??[],$t=le!==null||Ue.length>0;Kt(async()=>{const{writeQueued:Ut,writeQueuedId:on,writeQueuedAttachments:Wr}=await import("./queued-CagZVfWU.js");return{writeQueued:Ut,writeQueuedId:on,writeQueuedAttachments:Wr}},[]).then(({writeQueued:Ut,writeQueuedId:on,writeQueuedAttachments:Wr})=>{Ut(A,r,le),on(A,r,$t?ue??null:null),Wr(A,r,Ue)});for(const Ut of this.subs.values())Ut.projectSlug===r&&Ut.sessionId===A&&((h=(v=Ut.handlers).onQueuedState)==null||h.call(v,{text:le,attachments:Ue,qid:ue,reason:q}))}return}if(n.type==="chat:queued_returned"){const{sessionId:A,text:Z,attachments:ue}=n.payload;if(A&&typeof Z=="string"){Kt(async()=>{const{writeQueued:q,writeQueuedId:_e,writeQueuedAttachments:le}=await import("./queued-CagZVfWU.js");return{writeQueued:q,writeQueuedId:_e,writeQueuedAttachments:le}},[]).then(({writeQueued:q,writeQueuedId:_e,writeQueuedAttachments:le})=>{q(A,r,null),_e(A,r,null),le(A,r,[])});for(const q of this.subs.values())q.projectSlug===r&&q.sessionId===A&&((C=(g=q.handlers).onQueuedReturned)==null||C.call(g,{text:Z,attachments:ue}))}return}if(n.type==="chat:killed_task"){const{sessionId:A,summary:Z,timestamp:ue}=n.payload;if(A)for(const q of this.subs.values())q.projectSlug===r&&q.sessionId===A&&((P=(T=q.handlers).onKilledTask)==null||P.call(T,{summary:Z??"",timestamp:ue??""}));return}const{sessionId:o,jobId:l}=n.payload,i=this.route(r,o);if(!i)return;const a={sessionId:o,jobId:l},s=n.payload.seq;switch(typeof s=="number"&&s>i.lastSeq&&(i.lastSeq=s),i.turnActive=n.type!=="chat:complete",n.type){case"chat:response":(m=(M=i.handlers).onResponse)==null||m.call(M,n.payload.chunk,a);break;case"chat:tool_call":(L=(O=i.handlers).onToolCall)==null||L.call(O,{toolName:n.payload.toolName,inputSummary:n.payload.inputSummary,output:n.payload.output,isError:n.payload.isError,durationMs:n.payload.durationMs,toolUseId:n.payload.toolUseId,subagentType:n.payload.subagentType,description:n.payload.description,hasSubagent:n.payload.hasSubagent},a);break;case"chat:tool_start":(oe=(H=i.handlers).onToolStart)==null||oe.call(H,{toolName:n.payload.toolName,inputSummary:n.payload.inputSummary,toolUseId:n.payload.toolUseId,output:"",isError:!1,pending:!0,subagentType:n.payload.subagentType,description:n.payload.description,hasSubagent:n.payload.hasSubagent},a);break;case"chat:message_boundary":(de=(ge=i.handlers).onMessageBoundary)==null||de.call(ge,a);break;case"chat:injected":(Ye=(rt=i.handlers).onInjected)==null||Ye.call(rt,{sender:n.payload.sender,content:n.payload.content,timestamp:n.payload.timestamp},a);break;case"chat:notice":(D=(wt=i.handlers).onNotice)==null||D.call(wt,n.payload.notice,a);break;case"chat:complete":(Q=(U=i.handlers).onComplete)==null||Q.call(U,{...a,success:n.payload.success,error:n.payload.error,model:n.payload.model,usage:n.payload.usage});break}}}const pu=new h0,Yt=new Map,is="paddock:lastSeen-changed";function mu(e){try{window.dispatchEvent(new CustomEvent(is,{detail:{sessionId:e}}))}catch{}}function p0(e){return Yt.get(e)??0}function m0(e,t){!t||!Number.isFinite(t)||t<=(Yt.get(e)??0)||(Yt.set(e,t),mu(e))}function Q1(e,t=Date.now()){const n=Yt.get(e)??0;return t<=n||(Yt.set(e,t),mu(e)),n}function K1(e,t,n){Yt.get(e)===n&&(t?Yt.set(e,t):Yt.delete(e),mu(e))}const as="paddock:chats-gone";function G1(e){if(e.length!==0){for(const t of e)Yt.delete(t);try{window.dispatchEvent(new CustomEvent(as,{detail:{sessionIds:e}}))}catch{}}}function g0({tag:e,className:t=""}){const n=ji();return f.jsx("button",{type:"button",onClick:r=>{r.preventDefault(),r.stopPropagation(),n(`/tags/${encodeURIComponent(e)}`)},title:`Show projects tagged ${e}`,className:`tag relative z-10 transition-colors hover:bg-surface-selected ${t}`,children:e})}const v0=/^\d{4}-\d{2}-\d{2}$/;function y0(e){if(!e)return"";if(v0.test(e)){const[s,u,d]=e.split("-").map(Number),c=new Date(s,u-1,d);if(Number.isNaN(c.getTime()))return e;const p=new Date,w=new Date(p.getFullYear(),p.getMonth(),p.getDate()),x=Math.round((w.getTime()-c.getTime())/864e5);return x<=0?"today":x===1?"yesterday":x<7?`${x}d ago`:x<35?`${Math.round(x/7)}w ago`:x<365?`${Math.round(x/30)}mo ago`:`${Math.round(x/365)}y ago`}const t=new Date(e).getTime();if(Number.isNaN(t))return e;const n=Math.round((Date.now()-t)/1e3);if(n<45)return"just now";const r=Math.round(n/60);if(r<60)return`${r}m ago`;const o=Math.round(r/60);if(o<24)return`${o}h ago`;const l=Math.round(o/24);if(l<7)return`${l}d ago`;const i=Math.round(l/7);if(i<5)return`${i}w ago`;const a=Math.round(l/30);return a<12?`${a}mo ago`:`${Math.round(l/365)}y ago`}function J1(e){if(!e)return"";const t=new Date(e).getTime();if(Number.isNaN(t))return e;const n=Math.round((t-Date.now())/1e3);if(n<=30)return"now";const r=Math.round(n/60);if(r<60)return`in ${r}m`;const o=Math.round(r/60);if(o<24)return`in ${o}h`;const l=Math.round(o/24);if(l<7)return`in ${l}d`;const i=Math.round(l/7);if(i<5)return`in ${i}w`;const a=Math.round(l/30);return a<12?`in ${a}mo`:`in ${Math.round(l/365)}y`}function la(e){return!Number.isFinite(e)||e<0?"0":e>=1e6?`${(e/1e6).toFixed(e>=1e7?0:2)}M`:e>=1e3?`${Math.round(e/1e3)}K`:`${Math.round(e)}`}function w0(e){return!Number.isFinite(e)||e<=0?"$0.00":e<.01?"<$0.01":`$${e.toFixed(2)}`}function Y1(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 X1(e){const t=e.inputTokens+e.cacheReadTokens+e.cacheCreationTokens,n=`${la(e.totalTokens)} tokens · ${la(t)} in / ${la(e.outputTokens)} out`;return e.costUsd==null?n:`${n} · ~${w0(e.costUsd)} at API rates`}function Z1(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 x0="This session is being continued from a previous conversation";function q1(e){return e.trimStart().startsWith(x0)}function ew(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 tw(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 rw(e){return/^\s*<local-command-stdout>[\s\S]*<\/local-command-stdout>\s*$/.test(e)}function ow(e){return e.trimStart().startsWith("<task-notification>")}function lw(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 iw(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 aw(e){return e==="killed"||e==="stopped"}function S0(e){const t=Math.max(0,Math.floor(e/1e3)),n=t%60,r=Math.floor(t/60)%60,o=Math.floor(t/3600),l=String(n).padStart(2,"0");return o>0?`${o}:${String(r).padStart(2,"0")}:${l}`:`${r}:${l}`}function ud(e){if(typeof window>"u"||typeof window.matchMedia!="function")return null;try{return window.matchMedia(e)??null}catch{return null}}function ss(e){const[t,n]=E.useState(()=>{var r;return((r=ud(e))==null?void 0:r.matches)??!1});return E.useEffect(()=>{var l;const r=ud(e);if(!r)return;const o=()=>n(!!r.matches);return o(),typeof r.addEventListener=="function"?(r.addEventListener("change",o),()=>r.removeEventListener("change",o)):((l=r.addListener)==null||l.call(r,o),()=>{var i;return(i=r.removeListener)==null?void 0:i.call(r,o)})},[e]),t}function ap(...e){return e.filter(Boolean).join(" ")}const k0="(min-width: 1280px)",E0="(min-width: 900px)",C0=1;function j0(){const e=ss(k0),t=ss(E0);return e?3:t?2:C0}const ia=6,P0=.75,N0=.9,T0=250,_0=3e4;function R0(e){const[,t]=E.useState(0);E.useEffect(()=>{if(!e)return;const n=setInterval(()=>t(r=>r+1),1e3);return()=>clearInterval(n)},[e])}function M0(){const[e,t]=E.useState(new Map);return E.useEffect(()=>pu.onActiveInfos(n=>t(new Map(n))),[]),e}function L0(e){const[t,n]=E.useState(new Map),r=E.useRef(0);return E.useEffect(()=>{if(!e){r.current++,n(new Map);return}let o=!1;const l=async()=>{const s=++r.current;try{const u=await fu.attentionChats(cu);if(o||s!==r.current)return;n(new Map(u.running.map(d=>[d.sessionId,d])))}catch{}},i=setTimeout(()=>void l(),T0),a=setInterval(()=>{document.visibilityState==="visible"&&l()},_0);return()=>{o=!0,clearTimeout(i),clearInterval(a)}},[e]),t}function I0({fill:e}){const t=Math.max(1,Math.min(ia,Math.round(e*ia))),n=e<P0?"bg-accent-solid":e<N0?"bg-warn-solid":"bg-danger-solid";return f.jsx("span",{className:"flex items-center gap-px",title:`Context ${Math.round(e*100)}% full`,"aria-hidden":"true",children:Array.from({length:ia},(r,o)=>f.jsx("span",{className:ap("h-2.5 w-[3px] rounded-[1px]",o<t?n:"bg-edge")},o))})}function D0({projectSlug:e,projectName:t,chatName:n,sessionId:r,startedAt:o,fill:l}){const i=o==null?"—:—":S0(Date.now()-o),a=n??"Running turn";return f.jsxs(Uo,{"data-testid":"fleet-channel",to:`${Zy(e)}/chat/${encodeURIComponent(r)}`,title:`${a} — ${t}`,"aria-label":`${a} in ${t}, running${o==null?"":` for ${i}`}`,className:"focus-visible:focus-ring flex h-6 shrink-0 items-center gap-2 rounded-md border border-edge-subtle bg-surface px-2 text-2xs can-hover:hover:border-edge can-hover:hover:bg-surface-hover",children:[f.jsx("span",{className:"h-1.5 w-1.5 shrink-0 rounded-[1px] bg-accent-solid","aria-hidden":"true"}),f.jsx("span",{className:"max-w-[14ch] truncate font-medium text-fg",children:t}),f.jsx("span",{className:"font-mono tabular text-fg-muted",children:i}),l!=null&&f.jsx(I0,{fill:l})]})}function cd({value:e,unit:t,to:n,tone:r,title:o}){return f.jsxs(Uo,{"data-testid":`fleet-${t}`,to:n,title:o,className:"focus-visible:focus-ring flex h-6 shrink-0 items-center gap-1.5 rounded-md px-1.5 can-hover:hover:bg-surface-hover",children:[f.jsx("span",{"aria-hidden":"true",className:ap("h-1.5 w-1.5 shrink-0 rounded-[1px]",r==="live"&&"bg-accent-solid",r==="attention"&&"bg-warn-solid",r==="rest"&&"bg-edge-strong")}),f.jsx("span",{"data-testid":`fleet-${t}-value`,className:"font-mono tabular text-2xs font-semibold text-fg",children:e}),f.jsx("span",{className:"text-3xs font-semibold uppercase tracking-[0.14em] text-fg-subtle",children:t})]})}function O0({unread:e}){const{projects:t,rootWorkspace:n}=tp(),r=M0(),o=E.useMemo(()=>[...r.keys()].sort().join(","),[r]),l=L0(o);R0(r.size>0);const i=j0(),a=E.useMemo(()=>{const w=new Map;for(const x of t)w.set(x.slug,x.name);return n&&w.set(n.slug,n.name),w},[t,n]),s=E.useMemo(()=>[...r.entries()].map(([w,x])=>{const k=l.get(w);return{sessionId:w,projectSlug:x,projectName:a.get(x)??(k==null?void 0:k.projectName)??x,chatName:(k==null?void 0:k.name)??null,startedAt:pu.turnStartedAt(w),fill:(k==null?void 0:k.contextTokens)!=null&&k.contextLimit?Math.min(1,k.contextTokens/k.contextLimit):null}}).sort((w,x)=>(w.startedAt??1/0)-(x.startedAt??1/0)),[r,l,a]),u=s.slice(0,i),d=s.length-u.length,c=E.useMemo(()=>{let w="";for(const x of n?[...t,n]:t)for(const k of x.chatTurns??[])k.lastTurnCompletedAt>w&&(w=k.lastTurnCompletedAt);return w},[t,n]),p=r.size===0?`Fleet idle. ${e} unread.`:`${r.size} running. ${e} unread.`;return f.jsxs("div",{"data-testid":"fleet-readout",className:"flex h-9 shrink-0 items-center gap-2 border-b border-edge-subtle bg-surface-sunken px-2 sm:px-3",children:[f.jsx(cd,{value:r.size,unit:"running",to:"/",tone:r.size>0?"live":"rest",title:r.size>0?"Turns in flight across every project":"Nothing running"}),f.jsx(cd,{value:e,unit:"unread",to:"/",tone:e>0?"attention":"rest",title:"Chats holding a reply you have not read"}),f.jsx("span",{className:"h-4 w-px shrink-0 bg-edge-subtle","aria-hidden":"true"}),f.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-1.5 overflow-hidden",children:[u.map(w=>f.jsx(D0,{projectSlug:w.projectSlug,projectName:w.projectName,chatName:w.chatName,sessionId:w.sessionId,startedAt:w.startedAt,fill:w.fill},w.sessionId)),d>0&&f.jsxs(Uo,{to:"/",className:"focus-visible:focus-ring shrink-0 rounded-md px-1.5 py-1 font-mono tabular text-2xs text-fg-muted can-hover:hover:bg-surface-hover can-hover:hover:text-fg",title:`${d} more running — open Home for the full list`,children:["+",d]}),s.length===0&&(c?f.jsxs("span",{className:"truncate text-2xs text-fg-subtle",children:["Idle · last turn ",y0(c)]}):f.jsx(Uo,{to:"/",className:"focus-visible:focus-ring truncate rounded-md px-1 text-2xs text-accent can-hover:hover:underline",children:"No turns yet — start a chat →"}))]}),f.jsx("span",{role:"status","aria-live":"polite",className:"sr-only",children:p})]})}function X(e){return{width:16,height:16,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",...e}}const z0=e=>f.jsx("svg",{...X(e),children:f.jsx("path",{d:"M12 5v14M5 12h14"})}),sw=e=>f.jsx("svg",{...X(e),children:f.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48"})}),$0=e=>f.jsxs("svg",{...X(e),children:[f.jsx("path",{d:"M3 10.5 12 3l9 7.5"}),f.jsx("path",{d:"M5 9.5V20a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V9.5"})]}),uw=e=>f.jsx("svg",{...X(e),children:f.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})}),U0=e=>f.jsxs("svg",{...X(e),children:[f.jsx("circle",{cx:"11",cy:"11",r:"7"}),f.jsx("path",{d:"m21 21-4.3-4.3"})]}),cw=e=>f.jsxs("svg",{...X(e),children:[f.jsx("path",{d:"M4 5h16"}),f.jsx("path",{d:"M8 5v6h12"}),f.jsx("path",{d:"M8 11v6h12"})]}),dw=e=>f.jsx("svg",{...X(e),children:f.jsx("path",{d:"M4 6h16M4 12h16M4 18h16"})}),A0=e=>f.jsx("svg",{...X(e),children:f.jsx("path",{d:"M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z"})}),fw=e=>f.jsxs("svg",{...X(e),children:[f.jsx("path",{d:"m22 2-7 20-4-9-9-4Z"}),f.jsx("path",{d:"M22 2 11 13"})]}),hw=e=>f.jsx("svg",{...X(e),children:f.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"})}),pw=e=>f.jsxs("svg",{...X(e),children:[f.jsx("rect",{x:"9",y:"2",width:"6",height:"12",rx:"3"}),f.jsx("path",{d:"M5 10a7 7 0 0 0 14 0"}),f.jsx("path",{d:"M12 17v4M8 21h8"})]}),mw=e=>f.jsx("svg",{...X(e),children:f.jsx("path",{d:"m9 18 6-6-6-6"})}),gw=e=>f.jsx("svg",{...X(e),children:f.jsx("path",{d:"M14.7 6.3a4 4 0 0 0-5.4 5.4L3 18l3 3 6.3-6.3a4 4 0 0 0 5.4-5.4l-2.6 2.6-2-2 2.6-2.6Z"})}),F0=e=>f.jsxs("svg",{...X(e),children:[f.jsx("circle",{cx:"12",cy:"12",r:"3"}),f.jsx("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09a1.65 1.65 0 0 0-1-1.51 1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09a1.65 1.65 0 0 0 1.51-1 1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1Z"})]}),vw=e=>f.jsxs("svg",{...X(e),children:[f.jsx("path",{d:"M10.3 3.9 1.8 18a2 2 0 0 0 1.7 3h17a2 2 0 0 0 1.7-3L13.7 3.9a2 2 0 0 0-3.4 0Z"}),f.jsx("path",{d:"M12 9v4M12 17h.01"})]}),yw=e=>f.jsx("svg",{...X(e),children:f.jsx("path",{d:"M12 3v4M12 17v4M3 12h4M17 12h4M5.6 5.6l2.8 2.8M15.6 15.6l2.8 2.8M5.6 18.4l2.8-2.8M15.6 8.4l2.8-2.8"})}),sp=e=>f.jsx("svg",{...X(e),children:f.jsx("path",{d:"M18 6 6 18M6 6l12 12"})}),ww=e=>f.jsx("svg",{...X(e),children:f.jsx("path",{d:"M13 2 4.5 13.5H11l-1 8.5 8.5-11.5H12z"})}),xw=e=>f.jsx("svg",{...X(e),children:f.jsx("path",{d:"M6 4.5v15l13-7.5z"})}),b0=e=>f.jsx("svg",{...X(e),children:f.jsx("path",{d:"M3 6h18M3 12h18M3 18h18"})}),Sw=e=>f.jsxs("svg",{...X(e),children:[f.jsx("circle",{cx:"12",cy:"12",r:"9"}),f.jsx("path",{d:"M12 7v5l3 2"})]}),kw=e=>f.jsxs("svg",{...X(e),children:[f.jsx("circle",{cx:"12",cy:"5",r:"1"}),f.jsx("circle",{cx:"12",cy:"12",r:"1"}),f.jsx("circle",{cx:"12",cy:"19",r:"1"})]}),Ew=e=>f.jsx("svg",{...X(e),children:f.jsx("path",{d:"M3 6h18M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2m3 0v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6M10 11v6M14 11v6"})}),Cw=e=>f.jsxs("svg",{...X(e),children:[f.jsx("path",{d:"M12 20h9"}),f.jsx("path",{d:"M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4Z"})]}),jw=e=>f.jsxs("svg",{...X(e),children:[f.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8Z"}),f.jsx("path",{d:"M14 2v6h6"})]}),Pw=e=>f.jsxs("svg",{...X(e),children:[f.jsx("path",{d:"M12 17v5"}),f.jsx("path",{d:"M9 10.76V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v6.76a2 2 0 0 0 .59 1.42l1.12 1.12A1 1 0 0 1 17 15H7a1 1 0 0 1-.71-1.7l1.12-1.12A2 2 0 0 0 9 10.76Z"})]}),Nw=e=>f.jsx("svg",{...X(e),children:f.jsx("path",{d:"M20 6 9 17l-5-5"})}),Tw=({open:e,...t})=>e?f.jsxs("svg",{...X(t),children:[f.jsx("path",{d:"M21.2 8.4c.5.38.8.97.8 1.6v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V10a2 2 0 0 1 .8-1.6l8-6a2 2 0 0 1 2.4 0l8 6Z"}),f.jsx("path",{d:"m22 10-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 10"})]}):f.jsxs("svg",{...X(t),children:[f.jsx("rect",{width:"20",height:"16",x:"2",y:"4",rx:"2"}),f.jsx("path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7"})]}),_w=e=>f.jsxs("svg",{...X(e),children:[f.jsx("circle",{cx:"6",cy:"6",r:"3"}),f.jsx("circle",{cx:"6",cy:"18",r:"3"}),f.jsx("circle",{cx:"18",cy:"6",r:"3"}),f.jsx("path",{d:"M6 9v6M18 9a9 9 0 0 1-9 9"})]}),Rw=e=>f.jsxs("svg",{...X(e),children:[f.jsx("path",{d:"M9.5 14.5l-1.7 1.7a4 4 0 0 1-5.66-5.66l1.7-1.7"}),f.jsx("path",{d:"M14.5 9.5l1.7-1.7a4 4 0 0 1 5.66 5.66l-1.7 1.7"}),f.jsx("path",{d:"M8 3.5v2M3.5 8h2M16 20.5v-2M20.5 16h-2"})]}),Mw=e=>f.jsxs("svg",{...X(e),children:[f.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),f.jsx("path",{d:"M17 8l-5-5-5 5M12 3v12"})]}),Lw=e=>f.jsx("svg",{...X(e),children:f.jsx("path",{d:"M4 17l6-5-6-5M12 19h8"})}),Iw=e=>f.jsx("svg",{...X(e),children:f.jsx("path",{d:"M9 19c-5 1.5-5-2.5-7-3m14 6v-3.9a3.4 3.4 0 0 0-1-2.6c3-.3 6.2-1.5 6.2-6.6a5.2 5.2 0 0 0-1.4-3.6 4.8 4.8 0 0 0-.1-3.6s-1.1-.3-3.7 1.4a12.6 12.6 0 0 0-6.6 0C6.5 1.3 5.4 1.6 5.4 1.6a4.8 4.8 0 0 0-.1 3.6 5.2 5.2 0 0 0-1.4 3.6c0 5.1 3.2 6.3 6.2 6.6a3.4 3.4 0 0 0-1 2.6V22"})}),B0=e=>f.jsxs("svg",{...X(e),children:[f.jsx("circle",{cx:"12",cy:"12",r:"4"}),f.jsx("path",{d:"M12 2v2M12 20v2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M2 12h2M20 12h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4"})]}),W0=e=>f.jsx("svg",{...X(e),children:f.jsx("path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z"})}),V0=e=>f.jsxs("svg",{...X(e),children:[f.jsx("path",{d:"M10 13a5 5 0 0 0 7.5.5l3-3a5 5 0 0 0-7-7l-1.5 1.5"}),f.jsx("path",{d:"M14 11a5 5 0 0 0-7.5-.5l-3 3a5 5 0 0 0 7 7l1.5-1.5"})]}),Dw=e=>f.jsx("svg",{...X(e),children:f.jsx("path",{d:"m6 9 6 6 6-6"})}),Ow=e=>f.jsxs("svg",{...X(e),children:[f.jsx("rect",{x:"3",y:"4",width:"18",height:"4",rx:"1"}),f.jsx("path",{d:"M5 8v11a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V8"}),f.jsx("path",{d:"M10 12h4"})]}),zw=e=>f.jsx("svg",{...X(e),children:f.jsx("path",{d:"M12 2.5l2.9 5.88 6.49.94-4.7 4.58 1.11 6.46L12 17.8l-5.8 3.05 1.11-6.46-4.7-4.58 6.49-.94z"})}),H0=["idea","active","paused","blocked","done"];function Q0({open:e,onClose:t,onCreated:n}){const[r,o]=E.useState(""),[l,i]=E.useState(""),[a,s]=E.useState(""),[u,d]=E.useState(""),[c,p]=E.useState("active"),[w,x]=E.useState(""),[k,_]=E.useState(""),[v,h]=E.useState(!1),[g,C]=E.useState(!1),[T,P]=E.useState(null);if(E.useEffect(()=>{e&&(o(""),i(""),s(""),d(""),p("active"),x(""),_(""),h(!1),P(null))},[e]),E.useEffect(()=>{const m=O=>{O.key==="Escape"&&e&&!g&&t()};return window.addEventListener("keydown",m),()=>window.removeEventListener("keydown",m)},[e,g,t]),!e)return null;const M=async m=>{if(m.preventDefault(),!!r.trim()){C(!0),P(null);try{const O=await fu.createProject({name:r.trim(),status:c,group:u||void 0,summary:l.trim()||void 0,repo:w.trim()||void 0,path:k.trim()||void 0,managed:k.trim()&&!w.trim()?v:void 0,domain:a.split(",").map(L=>L.trim()).filter(Boolean)});n(O)}catch(O){P(O instanceof Ao?O.message:"Failed to create project")}finally{C(!1)}}};return f.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-overlay p-4 backdrop-blur-sm",onClick:()=>!g&&t(),children:f.jsxs("form",{className:"w-full max-w-md animate-scale-in rounded-2xl border border-edge bg-surface-raised p-6 shadow-2xl",onClick:m=>m.stopPropagation(),onSubmit:M,children:[f.jsxs("div",{className:"mb-5 flex items-center justify-between",children:[f.jsx("h2",{className:"text-lg font-semibold",children:"New project"}),f.jsx("button",{type:"button",onClick:t,className:"rounded-lg p-1 text-fg-subtle hover:bg-surface-hover hover:text-fg-muted","aria-label":"Close",children:f.jsx(sp,{width:18,height:18})})]}),f.jsxs("label",{className:"mb-4 block",children:[f.jsx("span",{className:"field-label",children:"Name"}),f.jsx("input",{autoFocus:!0,className:"input",value:r,onChange:m=>o(m.target.value),placeholder:"Garage Water Heater Replacement"})]}),f.jsxs("label",{className:"mb-4 block",children:[f.jsx("span",{className:"field-label",children:"Summary (optional)"}),f.jsx("input",{className:"input",value:l,onChange:m=>i(m.target.value),placeholder:"One line on what this project is about"})]}),f.jsxs("label",{className:"mb-4 block",children:[f.jsx("span",{className:"field-label",children:"Area"}),f.jsxs("select",{className:"input",value:u,onChange:m=>d(m.target.value),children:[f.jsx("option",{value:"",children:"Unsorted"}),hu.map(m=>f.jsx("option",{value:m.slug,children:m.label},m.slug))]})]}),f.jsxs("label",{className:"mb-4 block",children:[f.jsx("span",{className:"field-label",children:"Directory on this machine (optional)"}),f.jsx("input",{className:"input",value:k,onChange:m=>_(m.target.value),placeholder:"/home/ed/Code/foo"}),f.jsx("span",{className:"mt-1 block text-xs text-fg-subtle",children:"Where this project's content lives. An existing checkout is used in place — its real history, branches and remotes — and Paddock writes nothing into it. Absolute path; created for you if it doesn't exist."})]}),f.jsxs("label",{className:"mb-4 block",children:[f.jsx("span",{className:"field-label",children:"Git repository URL (optional)"}),f.jsx("input",{className:"input",value:w,onChange:m=>x(m.target.value),placeholder:"https://github.com/owner/repo.git"}),f.jsx("span",{className:"mt-1 block text-xs text-fg-subtle",children:k.trim()?"Cloned into the directory above if it doesn't exist yet; otherwise the directory is used as-is and this just records which repo it is.":"Paddock clones this repo into the project and works in the checkout. Leave both blank for a notes project."})]}),k.trim()&&!w.trim()&&f.jsxs("label",{className:"mb-4 flex cursor-pointer items-start gap-2",children:[f.jsx("input",{type:"checkbox",className:"mt-0.5",checked:v,onChange:m=>h(m.target.checked)}),f.jsxs("span",{className:"text-xs text-fg-muted",children:[f.jsx("span",{className:"font-medium",children:"These are notes — let Paddock curate them."})," ","Its OVERVIEW.md, CHANGELOG.md and CLAUDE.md are written into that directory. Leave unticked for a code checkout you version yourself, and Paddock will write nothing into it."]})]}),f.jsxs("div",{className:"mb-5 grid grid-cols-2 gap-3",children:[f.jsxs("label",{className:"block",children:[f.jsx("span",{className:"field-label",children:"Domain tags"}),f.jsx("input",{className:"input",value:a,onChange:m=>s(m.target.value),placeholder:"home, plumbing"})]}),f.jsxs("label",{className:"block",children:[f.jsx("span",{className:"field-label",children:"Status"}),f.jsx("select",{className:"input capitalize",value:c,onChange:m=>p(m.target.value),children:H0.map(m=>f.jsx("option",{value:m,className:"capitalize",children:m},m))})]})]}),T&&f.jsx("p",{className:"mb-4 rounded-lg bg-danger-soft px-3 py-2 text-sm text-danger",children:T}),f.jsxs("div",{className:"flex justify-end gap-2",children:[f.jsx("button",{type:"button",className:"btn-ghost",onClick:t,disabled:g,children:"Cancel"}),f.jsx("button",{type:"submit",className:"btn-primary",disabled:g||!r.trim(),children:g?"Creating…":"Create project"})]})]})})}const gu="paddock:panewidth:",K0={key:"sidenav",def:288,min:200,max:480},$w={key:"chatlist",def:256,min:220,max:520},G0="(min-width: 1024px)";function Tr(e,t){return Math.min(Math.max(t,e.min),e.max)}function dd(e,t,n){return Tr(n,e+t)}function J0(e){try{const t=localStorage.getItem(gu+e.key);if(t==null)return null;const n=Number.parseFloat(t);return Number.isFinite(n)?Tr(e,n):null}catch{return null}}function Y0(e,t){try{localStorage.setItem(gu+e.key,String(Tr(e,t)))}catch{}}function X0(e){try{localStorage.removeItem(gu+e.key)}catch{}}function Z0(e){const t=ss(G0),[n,r]=E.useState(()=>J0(e)),o=Tr(e,n??e.def);return{isDesktop:t,width:o,style:t?{width:o}:void 0,preview:l=>r(Tr(e,l)),commit:l=>{const i=Tr(e,l);r(i),Y0(e,i)},reset:()=>{r(null),X0(e)},spec:e}}function q0({spec:e,width:t,onPreview:n,onCommit:r,onReset:o,label:l}){const i=E.useRef(null),a=E.useRef(t);a.current=t;const s=16;return f.jsx("div",{role:"separator","aria-orientation":"vertical","aria-label":l,"aria-valuenow":Math.round(t),"aria-valuemin":e.min,"aria-valuemax":e.max,tabIndex:0,onPointerDown:u=>{i.current={startX:u.clientX,startWidth:t},u.currentTarget.setPointerCapture(u.pointerId)},onPointerMove:u=>{i.current&&n(dd(i.current.startWidth,u.clientX-i.current.startX,e))},onPointerUp:u=>{if(i.current){i.current=null;try{u.currentTarget.releasePointerCapture(u.pointerId)}catch{}r(a.current)}},onDoubleClick:o,onKeyDown:u=>{if(u.key==="ArrowLeft"||u.key==="ArrowRight"){u.preventDefault();const d=dd(t,u.key==="ArrowRight"?s:-s,e);n(d),r(d)}},title:"Drag to resize · double-click to reset",className:"group/resizer absolute inset-y-0 right-0 z-10 hidden w-1.5 -mr-0.5 cursor-ew-resize touch-none lg:block",children:f.jsx("span",{className:"absolute inset-y-0 right-0 w-px bg-edge transition group-hover/resizer:w-0.5 group-hover/resizer:bg-accent-solid group-focus/resizer:w-0.5 group-focus/resizer:bg-accent-solid"})})}function e1(e){const[t,n]=E.useState(new Map),r=E.useRef(new Map),[o,l]=E.useState(0);return E.useEffect(()=>{const i=r.current;for(const a of e)for(const s of a.chatTurns??[]){m0(s.sessionId,s.lastSeen);const u=Date.parse(s.lastTurnCompletedAt);if(!Number.isFinite(u))continue;const d=i.get(s.sessionId);!d||u>d.at?i.set(s.sessionId,{slug:a.slug,at:u,unread:s.unread}):d.unread=s.unread}if(e.length>0){const a=new Set(e.map(s=>s.slug));for(const[s,u]of i)a.has(u.slug)||i.delete(s)}l(a=>a+1)},[e]),E.useEffect(()=>{const i=a=>{var d;const s=((d=a.detail)==null?void 0:d.sessionIds)??[];let u=!1;for(const c of s)u=r.current.delete(c)||u;u&&l(c=>c+1)};return window.addEventListener(as,i),()=>window.removeEventListener(as,i)},[]),E.useEffect(()=>{const i=new Map;return pu.onActiveInfos(a=>{for(const[s,u]of i)a.has(s)||r.current.set(s,{slug:u,at:Date.now()});i.clear();for(const[s,u]of a)i.set(s,u);n(new Map(a)),l(s=>s+1)})},[]),E.useEffect(()=>{const i=()=>l(a=>a+1);return window.addEventListener(is,i),()=>window.removeEventListener(is,i)},[]),E.useMemo(()=>{const i=new Map,a=s=>{let u=i.get(s);return u||(u={unread:0,inflight:0},i.set(s,u)),u};for(const[s,{slug:u,at:d,unread:c}]of r.current)!t.has(s)&&(c||d>p0(s))&&(a(u).unread+=1);for(const s of t.values())a(s).inflight+=1;return i},[t,o])}function t1(){const{projects:e,rootWorkspace:t,loading:n,upsert:r}=tp(),{dark:o,toggle:l}=o0(),[i,a]=E.useState(!1),[s,u]=E.useState(!1),d=ji(),c=tr(),p=rp(),w=i0(),x=Z0(K0),k=c.pathname==="/"||c.pathname==="/projects"||c.pathname.startsWith("/chat"),_=c.pathname.startsWith("/projects/")||k;E.useEffect(()=>{a(!1)},[c.pathname]),E.useEffect(()=>{document.title=p.name},[p.name]);const v=E.useMemo(()=>{const P=new Map;for(const M of e){const m=M.group??"",O=P.get(m);O?O.push(M):P.set(m,[M])}return u0(P.keys()).map(M=>[M,P.get(M)??[]])},[e]),h=E.useMemo(()=>t?[...e,t]:e,[e,t]),g=e1(h),C=g.get(cu),T=E.useMemo(()=>{let P=0;for(const M of g.values())P+=M.unread;return P},[g]);return f.jsxs("div",{className:"flex h-[100dvh] flex-col overflow-hidden bg-surface lg:flex-row",children:[!_&&f.jsxs("header",{className:"pt-safe flex items-center gap-2 border-b border-edge px-3 pb-2 lg:hidden",children:[f.jsx("button",{type:"button",onClick:()=>a(!0),"aria-label":"Open menu",className:"btn-subtle -ml-1 px-2 py-2",children:f.jsx(b0,{width:20,height:20})}),f.jsxs(An,{to:"/",className:"flex items-center gap-2",children:[f.jsx(fd,{brand:p,className:"h-7 w-7 text-sm"}),f.jsx("span",{className:"text-md font-semibold tracking-tight",children:p.name})]})]}),i&&f.jsx("div",{className:"fixed inset-0 z-30 bg-overlay backdrop-blur-sm lg:hidden","aria-hidden":"true",onClick:()=>a(!1)}),f.jsxs("aside",{style:x.style,className:`fixed inset-y-0 left-0 z-40 flex w-72 max-w-[85%] shrink-0 flex-col border-r border-edge bg-surface shadow-2xl transition-transform duration-200 ease-out lg:relative lg:z-auto lg:max-w-none lg:translate-x-0 lg:bg-surface-raised/50 lg:shadow-none ${i?"translate-x-0":"-translate-x-full"}`,children:[x.isDesktop&&f.jsx(q0,{spec:x.spec,width:x.width,onPreview:x.preview,onCommit:x.commit,onReset:x.reset,label:"Resize sidebar"}),f.jsxs("div",{className:"flex items-center gap-2 px-5 py-4",children:[f.jsxs(An,{to:"/",className:"group flex items-center gap-2",children:[f.jsx(fd,{brand:p,className:"h-8 w-8 text-base"}),f.jsx("span",{className:"text-lg font-semibold tracking-tight",children:p.name})]}),f.jsx("button",{type:"button",onClick:()=>a(!1),"aria-label":"Close menu",className:"btn-subtle ml-auto px-2 py-2 lg:hidden",children:f.jsx(sp,{width:18,height:18})})]}),f.jsx("div",{className:"px-3 pb-1",children:f.jsxs(An,{to:"/",end:!0,className:({isActive:P})=>`btn-subtle w-full justify-start ${P?"bg-surface-selected":""}`,title:"The root workspace — every project, and the instance's own chats",children:[f.jsx($0,{width:16,height:16}),"Home",f.jsx(up,{badge:C,className:"ml-auto"})]})}),f.jsxs("div",{className:"mt-5 mb-1 flex items-center justify-between pr-3",children:[f.jsx(An,{to:qy(),className:"section-label hover:text-accent",children:"Projects"}),f.jsx("button",{type:"button",onClick:()=>u(!0),"aria-label":"New Project",title:"New Project",className:"btn-subtle -mr-1 px-1.5 py-1 text-fg-subtle hover:text-accent",children:f.jsx(z0,{width:14,height:14})})]}),f.jsxs("nav",{className:"flex-1 overflow-y-auto px-2 pb-4",children:[n&&f.jsx("div",{className:"space-y-2 px-2 py-2",children:[0,1,2].map(P=>f.jsx("div",{className:"h-10 animate-pulse rounded-lg bg-surface-active"},P))}),!n&&e.length===0&&f.jsx("p",{className:"px-3 py-2 text-sm text-fg-muted",children:"No projects yet."}),!n&&e.length>0&&v.map(([P,M])=>f.jsxs("div",{className:"mb-2",children:[v.length>1&&f.jsx("div",{className:"px-2.5 pb-1 pt-2 text-3xs font-semibold uppercase tracking-wider text-fg-subtle",children:s0(P)}),M.map(m=>f.jsx(r1,{project:m,badge:g.get(m.slug)},m.slug))]},P||"unsorted"))]}),f.jsxs("div",{className:"border-t border-edge px-3 py-3",children:[f.jsxs(An,{to:"/config",className:({isActive:P})=>`btn-subtle w-full justify-start ${P?"bg-surface-selected":""}`,title:"Instance config — paddock.config.yaml (restart required)",children:[f.jsx(F0,{width:15,height:15}),"Config"]}),f.jsxs(An,{to:"/discover",className:({isActive:P})=>`btn-subtle mt-1 w-full justify-start ${P?"bg-surface-selected":""}`,title:"Find directories with existing Claude Code history to import",children:[f.jsx(U0,{width:15,height:15}),"Discover"]}),w.enabled&&f.jsxs("a",{href:w.path,target:"_blank",rel:"noreferrer",className:"btn-subtle mt-1 w-full justify-start",title:"OpenAPI / Swagger reference (opens in a new tab)",children:[f.jsx(V0,{width:15,height:15}),"Swagger API"]}),f.jsxs("button",{type:"button",onClick:l,className:"btn-subtle mt-1 w-full justify-start","aria-label":o?"Switch to light mode":"Switch to dark mode",title:"Toggle light / dark theme",children:[o?f.jsx(B0,{width:15,height:15}):f.jsx(W0,{width:15,height:15}),o?"Light mode":"Dark mode"]}),f.jsxs("p",{className:"mt-2 px-2 text-2xs text-fg-subtle",children:["v","0.69.0"]})]})]}),f.jsxs("div",{className:"flex min-w-0 flex-1 flex-col overflow-hidden",children:[f.jsx(O0,{unread:T}),f.jsx("main",{className:"min-h-0 min-w-0 flex-1 overflow-hidden",children:f.jsx(E.Suspense,{fallback:f.jsx(n1,{}),children:f.jsx(Ty,{context:{openNav:()=>a(!0)}})})})]}),f.jsx(Q0,{open:s,onClose:()=>u(!1),onCreated:P=>{r(P),u(!1),d(`/projects/${P.slug}/chat`)}})]})}function fd({brand:e,className:t=""}){return f.jsx("span",{className:`flex shrink-0 items-center justify-center overflow-hidden rounded-lg bg-accent-solid text-accent-fg shadow-sm ${t}`,children:a0(e.logo)?f.jsx("img",{src:e.logo,alt:"",className:"h-full w-full object-cover"}):e.logo})}function n1(){return f.jsxs("div",{className:"flex h-full items-center justify-center","aria-busy":"true","aria-live":"polite",children:[f.jsx("span",{className:"h-6 w-6 animate-spin rounded-full border-2 border-edge-strong border-t-accent"}),f.jsx("span",{className:"sr-only",children:"Loading…"})]})}function r1({project:e,badge:t}){return f.jsxs(An,{to:`/projects/${e.slug}`,className:({isActive:n})=>`group mb-0.5 flex flex-col gap-1 rounded-lg px-2.5 py-2 text-sm transition-colors ${n?"bg-surface-selected":"hover:bg-surface-hover"}`,children:[f.jsxs("span",{className:"flex items-center justify-between gap-2",children:[f.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[f.jsx(A0,{width:13,height:13,className:"shrink-0 text-fg-subtle group-hover:text-fg-muted"}),f.jsx("span",{className:"truncate font-medium",children:e.name})]}),f.jsx(up,{badge:t})]}),e.domain.length>0&&f.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden pl-[18px]",children:[e.domain.slice(0,2).map(n=>f.jsx(g0,{tag:n,className:"max-w-[7rem] truncate"},n)),e.domain.length>2&&f.jsxs("span",{className:"shrink-0 text-2xs text-fg-subtle",children:["+",e.domain.length-2]})]})]})}function up({badge:e,className:t=""}){const n=(e==null?void 0:e.unread)??0,r=(e==null?void 0:e.inflight)??0;return n===0&&r===0?null:f.jsxs("span",{className:`flex shrink-0 items-center gap-1.5 ${t}`,children:[r>0&&f.jsxs("span",{className:"flex items-center gap-1 text-2xs tabular text-fg-muted",title:`${r} chat${r===1?"":"s"} in flight`,"aria-label":`${r} chat${r===1?"":"s"} in flight`,children:[f.jsx("span",{"aria-hidden":"true",className:"h-2.5 w-2.5 spin-eco rounded-full border-[1.5px] border-edge-strong border-t-transparent"}),r]}),n>0&&f.jsx("span",{className:"inline-flex min-w-[1.1rem] items-center justify-center rounded-full bg-accent-solid px-1.5 py-0.5 text-2xs font-semibold leading-none tabular text-accent-fg",title:`${n} unread ${n===1?"reply":"replies"}`,"aria-label":`${n} unread ${n===1?"reply":"replies"}`,children:n})]})}const cp="paddock:chunkReloadAt",o1=1e4,hd=/dynamically imported module|module script|importing a module|failed to fetch|unable to preload|load failed|error loading/i;function l1(e){return e?e instanceof Error?e.name==="ChunkLoadError"?!0:hd.test(e.message):hd.test(String(e)):!1}function vu(){try{return typeof sessionStorage<"u"?sessionStorage:void 0}catch{return}}function i1(e=Date.now(),t=vu()){if(!t)return!1;const n=t.getItem(cp);if(!n)return!1;const r=Number(n);return Number.isFinite(r)&&e-r<o1}function a1(e=Date.now(),t=vu()){try{t==null||t.setItem(cp,String(e))}catch{}}function s1(e,t=Date.now(),n=vu()){return l1(e)&&!i1(t,n)?"reload":"show"}function u1(){const e=Xh(),t=s1(e);if(E.useEffect(()=>{t==="reload"&&(a1(),window.location.reload())},[t]),t==="reload")return f.jsxs("div",{className:"flex h-[100dvh] items-center justify-center bg-surface","aria-busy":"true","aria-live":"polite",children:[f.jsx("span",{className:"h-6 w-6 animate-spin rounded-full border-2 border-edge-strong border-t-accent"}),f.jsx("span",{className:"sr-only",children:"Updating…"})]});const n=e instanceof Error?e.message:typeof e=="string"?e:"";return f.jsxs("div",{className:"flex h-[100dvh] flex-col items-center justify-center gap-4 bg-surface px-6 text-center",children:[f.jsxs("div",{children:[f.jsx("h1",{className:"text-lg font-semibold tracking-tight",children:"Something went wrong"}),f.jsx("p",{className:"mt-1 max-w-md text-sm text-fg-muted",children:"The app hit an unexpected error. Reloading usually fixes it."}),n?f.jsx("p",{className:"mt-2 max-w-md break-words font-mono text-2xs text-fg-subtle",children:n}):null]}),f.jsx("button",{className:"btn-primary",onClick:()=>window.location.reload(),children:"Reload"})]})}function c1(){typeof navigator>"u"||!("serviceWorker"in navigator)||window.addEventListener("load",()=>{const e=navigator.serviceWorker,t=!!e.controller;let n=!1;e.addEventListener("controllerchange",()=>{n||!t||(n=!0,window.location.reload())}),e.register("/sw.js").catch(()=>{})})}const yu=e=>e<0?0:e>1?1:e;function wu(e){return e<=.0031308?12.92*e:1.055*Math.pow(e,1/2.4)-.055}function Mt(e){return e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function xu({L:e,a:t,b:n}){const r=(e+.3963377774*t+.2158037573*n)**3,o=(e-.1055613458*t-.0638541728*n)**3,l=(e-.0894841775*t-1.291485548*n)**3;return[4.0767416621*r-3.3077115913*o+.2309699292*l,-1.2684380046*r+2.6097574011*o-.3413193965*l,-.0041960863*r-.7034186147*o+1.707614701*l]}function us(e,t,n){const r=Math.cbrt(.4122214708*e+.5363325363*t+.0514459929*n),o=Math.cbrt(.2119034982*e+.6806995451*t+.1073969566*n),l=Math.cbrt(.0883024619*e+.2817188376*t+.6299787005*n);return{L:.2104542553*r+.793617785*o-.0040720468*l,a:1.9779984951*r-2.428592205*o+.4505937099*l,b:.0259040371*r+.7827717662*o-.808675766*l}}function Fo(e,t,n,r=1){const o=n*Math.PI/180,l=xu({L:e,a:t*Math.cos(o),b:t*Math.sin(o)}),[i,a,s]=l.map(u=>yu(wu(u)));return{r:i,g:a,b:s,a:r}}function pd(e,t,n){const r=n*Math.PI/180;return xu({L:e,a:t*Math.cos(r),b:t*Math.sin(r)}).map(wu).every(o=>o>=-.0015&&o<=1.0015)}function pn({r:e,g:t,b:n}){const r=o=>Math.round(yu(o)*255).toString(16).padStart(2,"0");return`#${r(e)}${r(t)}${r(n)}`}function Ze({r:e,g:t,b:n}){const[r,o,l]=[e,t,n].map(Mt);return .2126*r+.7152*o+.0722*l}function d1(e,t){if(e.a>=1)return e;const n=e.a;return{r:e.r*n+t.r*(1-n),g:e.g*n+t.g*(1-n),b:e.b*n+t.b*(1-n),a:1}}function Qe(e,t){const n=Ze(d1(e,t)),r=Ze(t),[o,l]=n>r?[n,r]:[r,n];return(o+.05)/(l+.05)}const md={white:{r:1,g:1,b:1,a:1},black:{r:0,g:0,b:0,a:1},transparent:{r:0,g:0,b:0,a:0}};function aa(e){const t=[];let n=0,r="";for(const o of e)o==="("?n++:o===")"&&n--,o===","&&n===0?(t.push(r.trim()),r=""):r+=o;return r.trim()&&t.push(r.trim()),t}function ir(e,t){return!e.startsWith(`${t}(`)||!e.endsWith(")")?null:e.slice(t.length+1,-1)}function cn(e){const t=e.endsWith("%")?Number(e.slice(0,-1))/100:Number(e);if(!Number.isFinite(t))throw new Error(`not a number: ${e}`);return t}function Sr(e,t,n=0){if(n>24)throw new Error(`var() cycle resolving ${e}`);const r=e.trim();if(md[r])return md[r];if(r.startsWith("#")){let s=r.slice(1);if(s.length===3&&(s=[...s].map(d=>d+d).join("")),s.length!==6)throw new Error(`bad hex: ${r}`);const u=parseInt(s,16);return{r:(u>>16&255)/255,g:(u>>8&255)/255,b:(u&255)/255,a:1}}const o=ir(r,"var");if(o!==null){const[s,...u]=aa(o),d=t[s]??u.join(",");if(!d)throw new Error(`undefined custom property: ${s}`);return Sr(d,t,n+1)}const l=ir(r,"oklch");if(l!==null){const[s,u]=l.split("/"),d=s.trim().split(/\s+/);if(d.length!==3)throw new Error(`bad oklch(): ${r}`);return Fo(cn(d[0]),cn(d[1]),cn(d[2]),u?cn(u.trim()):1)}const i=ir(r,"rgb")??ir(r,"rgba");if(i!==null){const s=i.trim(),u=ir(s,"var");if(u!==null){const[w]=aa(u),x=t[w];if(!x)throw new Error(`undefined custom property: ${w}`);return Sr(`rgb(${x})`,t,n+1)}const[d,c]=s.split("/"),p=d.trim().split(/[\s,]+/);if(p.length<3)throw new Error(`bad rgb(): ${r}`);return{r:cn(p[0])/255,g:cn(p[1])/255,b:cn(p[2])/255,a:c?cn(c.trim()):1}}const a=ir(r,"color-mix");if(a!==null){const[s,u,d]=aa(a),c=s.trim();if(c!=="in oklab"&&c!=="in srgb")throw new Error(`only \`in oklab\` and \`in srgb\` color-mix are supported, got: ${s}`);const p=gd(u),w=gd(d);let x=p.pct,k=w.pct;x===null&&k===null?(x=.5,k=.5):x===null?x=1-k:k===null&&(k=1-x);const _=x+k,v=x/_,h=Sr(p.color,t,n+1),g=Sr(w.color,t,n+1);return c==="in srgb"?f1(h,g,v):h1(h,g,v)}throw new Error(`unsupported colour value: ${r}`)}function gd(e){const t=/\s+(-?[\d.]+)%$/.exec(e.trim());return t?{color:e.trim().slice(0,t.index).trim(),pct:Number(t[1])/100}:{color:e.trim(),pct:null}}function f1(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 h1(e,t,n){const r=us(Mt(e.r),Mt(e.g),Mt(e.b)),o=us(Mt(t.r),Mt(t.g),Mt(t.b)),l={L:r.L*n+o.L*(1-n),a:r.a*n+o.a*(1-n),b:r.b*n+o.b*(1-n)},[i,a,s]=xu(l).map(u=>yu(wu(u)));return{r:i,g:a,b:s,a:e.a*n+t.a*(1-n)}}function Tn({r:e,g:t,b:n}){const{L:r,a:o,b:l}=us(Mt(e),Mt(t),Mt(n)),i=Math.hypot(o,l),a=i<1e-6?0:(Math.atan2(l,o)*180/Math.PI+360)%360;return{L:r,C:i,H:a}}const Lt=4.5,dp=3,jt=.12,fp=["--accent","--accent-600","--accent-700","--accent-solid","--accent-solid-hover","--accent-text"];function pt(e,t){const n=getComputedStyle(e).getPropertyValue(t).trim();if(!n)return null;const r=/^\d+(\.\d+)?( \d+(\.\d+)?){2}$/.test(n)?`rgb(${n})`:n;try{return Sr(r,{})}catch{return null}}function p1(e,t,n){let r=0,o=1;for(let l=0;l<32;l++){const i=(r+o)/2;Ze(Fo(i,t,n))<e?r=i:o=i}return(r+o)/2}function hp(e,t,n){if(pd(e,t,n))return t;let r=0,o=t;for(let l=0;l<24;l++){const i=(r+o)/2;pd(e,i,n)?r=i:o=i}return r}function sa(e,t,n,r,o){const l=Ze(r);let i=t,a=.5;for(let s=0;s<4;s++){const u=p1(l,i,n);let d=o?0:u,c=o?u:1;for(let p=0;p<28;p++){const w=(d+c)/2,x=Qe(Fo(w,i,n),r)>=e;o?x?d=w:c=w:x?c=w:d=w}a=o?d:c,i=hp(a,t,n)}return{L:a,C:i,rgb:Fo(a,i,n)}}const m1=.75;function _r(e,t,n,r,o,l=e){const i=sa(e,t,n,r,o),a=c=>c.C>=t*m1;if(a(i)||l>=e)return{...i,hit:Qe(i.rgb,r)>=e-.01};let s=l,u=e,d=sa(l,t,n,r,o);for(let c=0;c<16;c++){const p=(s+u)/2,w=sa(p,t,n,r,o);a(w)?(d=w,s=p):u=p}return{...d,hit:Qe(d.rgb,r)>=l-.01}}function ua({r:e,g:t,b:n}){const r=o=>Math.round(Math.max(0,Math.min(1,o))*255);return`${r(e)} ${r(t)} ${r(n)}`}const pp=["--surface","--surface-raised","--surface-sunken","--surface-hover","--surface-active","--surface-selected","--border-subtle","--border","--border-strong","--text","--text-muted","--text-subtle","--scroll-thumb"],vd=["--text","--text-muted","--text-subtle"],g1=["--surface","--surface-raised","--surface-sunken","--surface-hover","--surface-active","--surface-selected"];function mp(e=document.documentElement){for(const t of pp)e.style.removeProperty(t)}function v1(e,t,n=document.documentElement){mp(n);for(const o of pp){const l=pt(n,o);if(!l)continue;const{L:i,C:a}=Tn(l),s=vd.includes(o),u=Math.max(a,t*(s?.5:1));n.style.setProperty(o,pn(Fo(i,hp(i,u,e),e)))}let r=1/0;for(const o of vd){const l=pt(n,o);if(l)for(const i of g1){const a=pt(n,i);a&&(r=Math.min(r,Qe(l,a)))}}return r}function gp(e=document.documentElement){for(const t of fp)e.style.removeProperty(t)}function vp(e,t){const n=fp.map(r=>[r,e.style.getPropertyValue(r)]);gp(e);try{return t()}finally{for(const[r,o]of n)o&&e.style.setProperty(r,o)}}function y1(e=document.documentElement){return vp(e,()=>{const t=pt(e,"--accent");return t?Tn(t).H:0})}const ro={r:1,g:1,b:1,a:1};function yp(e=document.documentElement){return vp(e,()=>w1(e))}function w1(e){const t={accent:pt(e,"--accent")??ro,a600:pt(e,"--accent-600")??ro,a700:pt(e,"--accent-700")??ro},n=pt(e,"--accent-fg")??ro,r=pt(e,"--surface")??ro,o=["--surface","--surface-raised","--surface-sunken"].map(a=>pt(e,a)).filter(a=>a!==null),l=o.length?o:[r],i=l.reduce((a,s)=>Qe(t.a700,a)<Qe(t.a700,s)?a:s);return{fg:n,surface:r,surfaces:l,targets:{accent:Math.max(Qe(t.accent,r),dp+jt),a600:Math.max(Qe(t.a600,n),Lt+jt),a700:Math.max(l.reduce((a,s)=>Math.min(a,Qe(t.a700,s)),1/0),Lt+jt)},chroma:{accent:Tn(t.accent).C,a600:Tn(t.a600).C,a700:Tn(t.a700).C},darker:{accent:Ze(t.accent)<Ze(r),a600:Ze(n)>Ze(t.a600),a700:Ze(t.a700)<Ze(i)},a700Bg:i}}function x1(e,t){const n=Lt+jt;return{accent:_r(e.targets.accent,e.chroma.accent,t,e.surface,e.darker.accent,dp+jt),a600:_r(e.targets.a600,e.chroma.a600,t,e.fg,e.darker.a600,n),a700:_r(e.targets.a700,e.chroma.a700,t,e.a700Bg,e.darker.a700,n)}}function Uw(e,t=document.documentElement){const n=yp(t);return e.map(r=>pn(_r(n.targets.a600,n.chroma.a600,r,n.fg,n.darker.a600,Lt+jt).rgb))}function S1(e,t=document.documentElement,n={}){const r=t.classList.contains("dark")?"dark":"light",o=n.context??yp(t),l=x1(o,e),{a600:i,a700:a,accent:s}=l,u={C:o.chroma.a700};gp(t),t.style.setProperty("--accent",ua(s.rgb)),t.style.setProperty("--accent-600",ua(i.rgb)),t.style.setProperty("--accent-700",ua(a.rgb));const d={};for(const g of["--accent-fg","--accent-solid","--accent-solid-hover","--accent-text","--surface","--surface-raised","--surface-sunken","--accent-soft"])d[g]=pt(t,g);const c=[],p=d["--accent-fg"]??o.fg,w=(g,C,T)=>{const P=d[g];if(!P)return 1/0;let M=Qe(P,p),m=!1;if(M<T+jt){const{C:O}=Tn(P),L=_r(T+jt,Math.max(O,o.chroma.a600),e,p,Ze(P)<Ze(p),Lt+jt);t.style.setProperty(g,pn(L.rgb)),M=Qe(L.rgb,p),m=!0}return c.push({label:C,fg:"--accent-fg",bg:g,ratio:M,floor:T,repaired:m}),M},x=w("--accent-solid","Primary button",Lt);w("--accent-solid-hover","Primary button, hovered",Math.min(x+.6,12));const k=[];for(const g of["--surface","--surface-raised","--surface-sunken","--accent-soft"]){const C=d[g];C&&k.push({name:g,c:C})}let _=1/0;const v=d["--accent-text"];if(v&&k.length){const g=k.reduce((T,P)=>Qe(v,T.c)<Qe(v,P.c)?T:P,k[0]);_=Qe(v,g.c);let C=!1;if(_<Lt+jt){const{C:T}=Tn(v),P=_r(Lt+jt,T||u.C,e,g.c,Ze(v)<Ze(g.c));t.style.setProperty("--accent-text",pn(P.rgb)),_=k.reduce((M,m)=>Math.min(M,Qe(P.rgb,m.c)),1/0),C=!0}c.push({label:"Accent text",fg:"--accent-text",bg:g.name,ratio:_,floor:Lt,repaired:C})}const h={};if(!n.live)for(const g of["--accent-solid","--accent-solid-hover","--accent-text"]){const C=pt(t,g);C&&(h[g]=pn(C))}return{hue:e,mode:r,channels:{accent:pn(s.rgb),accent600:pn(i.rgb),accent700:pn(a.rgb)},applied:h,checks:c,ok:c.every(g=>g.ratio>=g.floor-.005)&&x>=Lt}}const k1=[{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."}],Aw=[{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}],Fw=[{level:0,label:"None"},{level:1,label:"A little"},{level:2,label:"More"}];function E1(e=document.documentElement){const t=rp().accent;if(t&&t.toLowerCase()!==np.accent.toLowerCase())try{return Tn(Sr(t,{})).H}catch{}return y1(e)}const yd={theme:"foundation",hue:null,tint:0},wp="paddock:appearance",wd="paddock:appearance-cache";function C1(){try{const e=localStorage.getItem(wp);if(!e)return yd;const t=JSON.parse(e);return{theme:k1.some(n=>n.id===t.theme)?t.theme:"foundation",hue:typeof t.hue=="number"?(t.hue%360+360)%360:null,tint:t.tint===1||t.tint===2?t.tint:0}}catch{return yd}}function j1(e){try{localStorage.setItem(wp,JSON.stringify(e))}catch{}}function P1(e,t,n){try{const r=JSON.parse(localStorage.getItem(wd)||"{}"),o=`${e}:${t?"dark":"light"}`;n?r[o]={...n.applied,"--accent":n.channels.accent}:delete r[o],localStorage.setItem(wd,JSON.stringify(r))}catch{}}function N1(e,t=document.documentElement){t.setAttribute("data-theme",e.theme);const n=e.hue??E1(t);let r=null;e.tint===0?mp(t):r=v1(n,M1[e.tint],t);const o=S1(n,t);return o&&r!==null&&(o.checks.push({label:"Body text on the tinted ground",fg:"--text-*",bg:"--surface-*",ratio:r,floor:4.5,repaired:!1}),o.ok=o.ok&&r>=4.5),P1(e.theme,t.classList.contains("dark"),o),o}function T1(e,t){j1(e);const n=N1(e,t);return window.dispatchEvent(new CustomEvent(_1,{detail:n})),n}const _1="paddock:appearance";function R1(){const e=()=>T1(C1());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 M1=[0,.008,.018],xp=E.lazy(()=>Kt(()=>import("./ProjectsGrid-CfDehr5s.js"),__vite__mapDeps([0,1])).then(e=>({default:e.ProjectsGrid}))),Pe=E.lazy(()=>Kt(()=>import("./ProjectView-WIODXM93.js").then(e=>e.a),__vite__mapDeps([2,1,3,4,5])).then(e=>({default:e.ProjectView}))),L1=E.lazy(()=>Kt(()=>import("./ProjectRedirect-COrC7Yvg.js"),__vite__mapDeps([6,5])).then(e=>({default:e.ProjectRedirect}))),I1=E.lazy(()=>Kt(()=>import("./InstanceConfigPage-COc2rsu6.js"),__vite__mapDeps([7,4,8])).then(e=>({default:e.InstanceConfigPage}))),D1=E.lazy(()=>Kt(()=>import("./DiscoverPage-vz1s8GYQ.js"),__vite__mapDeps([9,10,4,8])).then(e=>({default:e.DiscoverPage}))),O1=E.lazy(()=>Kt(()=>import("./RootHome-DniHfYAw.js"),__vite__mapDeps([11,10,4,8,2,1,3,5])).then(e=>({default:e.RootHome})));R1();const Sp=()=>document.documentElement.setAttribute("data-tab-hidden",document.hidden?"true":"false");document.addEventListener("visibilitychange",Sp);Sp();function z1(){const{tag:e}=gy();return f.jsx(xp,{filterTag:e?decodeURIComponent(e):void 0})}const $1=zy([{path:"/",element:f.jsx(t1,{}),errorElement:f.jsx(u1,{}),children:[{index:!0,element:f.jsx(O1,{})},{path:"projects",element:f.jsx(xp,{})},{path:"tags/:tag",element:f.jsx(z1,{})},{path:"projects/:slug",element:f.jsx(L1,{})},{path:"projects/:slug/home",element:f.jsx(Pe,{})},{path:"projects/:slug/chat",element:f.jsx(Pe,{})},{path:"projects/:slug/chat/:sessionId",element:f.jsx(Pe,{})},{path:"projects/:slug/files",element:f.jsx(Pe,{})},{path:"projects/:slug/files/*",element:f.jsx(Pe,{})},{path:"projects/:slug/changes",element:f.jsx(Pe,{})},{path:"projects/:slug/changes/:file",element:f.jsx(Pe,{})},{path:"projects/:slug/history",element:f.jsx(Pe,{})},{path:"projects/:slug/settings",element:f.jsx(Pe,{})},{path:"projects/:slug/triggers",element:f.jsx(Pe,{})},{path:"projects/:slug/hooks",element:f.jsx(Pe,{})},{path:"chat",element:f.jsx(Pe,{root:!0})},{path:"chat/:sessionId",element:f.jsx(Pe,{root:!0})},{path:"files",element:f.jsx(Pe,{root:!0})},{path:"files/*",element:f.jsx(Pe,{root:!0})},{path:"changes",element:f.jsx(Pe,{root:!0})},{path:"changes/:file",element:f.jsx(Pe,{root:!0})},{path:"history",element:f.jsx(Pe,{root:!0})},{path:"triggers",element:f.jsx(Pe,{root:!0})},{path:"settings",element:f.jsx(Pe,{root:!0})},{path:"config",element:f.jsx(I1,{})},{path:"discover",element:f.jsx(D1,{})}]}]);ca.createRoot(document.getElementById("root")).render(f.jsx(Ld.StrictMode,{children:f.jsx(t0,{children:f.jsx(Vy,{router:$1})})}));c1();export{ww as $,_1 as A,_w as B,uw as C,vw as D,U0 as E,Nw as F,Ao as G,A1 as H,F0 as I,A0 as J,Lw as K,Uo as L,b0 as M,Q0 as N,Dw as O,z0 as P,kw as Q,cu as R,yw as S,g0 as T,Cw as U,Ew as V,U1 as W,sp as X,pw as Y,hw as Z,jw as _,ji as a,V0 as a0,fw as a1,q1 as a2,ew as a3,rw as a4,nw as a5,tw as a6,ow as a7,iw as a8,lw as a9,K1 as aA,m0 as aB,p0 as aC,tr as aD,B1 as aE,W1 as aF,Z0 as aG,b1 as aH,Zy as aI,G1 as aJ,V1 as aK,$w as aL,S0 as aa,cw as ab,w0 as ac,la as ad,X1 as ae,Kt as af,ou as ag,aw as ah,Z1 as ai,gw as aj,pu as ak,sw as al,Mw as am,Iw as an,Pw as ao,hu as ap,xw as aq,J1 as ar,dw as as,q0 as at,Y1 as au,Rw as av,Ow as aw,Tw as ax,zw as ay,Q1 as az,fu as b,Sw as c,y0 as d,H1 as e,s0 as f,qy as g,mw as h,gy as i,f as j,F1 as k,ap as l,Sd as m,C1 as n,u0 as o,Uw as p,k1 as q,E as r,T1 as s,Aw as t,tp as u,Fw as v,gp as w,S1 as x,yp as y,ss as z};
|
|
70
|
+
*/function Ur(){return Ur=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Ur.apply(this,arguments)}function Zh(e,t){if(e==null)return{};var n={},r=Object.keys(e),o,l;for(l=0;l<r.length;l++)o=r[l],!(t.indexOf(o)>=0)&&(n[o]=e[o]);return n}function My(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Ly(e,t){return e.button===0&&(!t||t==="_self")&&!My(e)}const Iy=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","unstable_viewTransition"],Dy=["aria-current","caseSensitive","className","end","style","to","unstable_viewTransition","children"],Oy="6";try{window.__reactRouterVersion=Oy}catch{}function zy(e,t){return Vv({basename:void 0,future:Ur({},void 0,{v7_prependBasename:!0}),history:pv({window:void 0}),hydrationData:$y(),routes:e,mapRouteProperties:Ry,unstable_dataStrategy:void 0,unstable_patchRoutesOnNavigation:void 0,window:void 0}).initialize()}function $y(){var e;let t=(e=window)==null?void 0:e.__staticRouterHydrationData;return t&&t.errors&&(t=Ur({},t,{errors:Uy(t.errors)})),t}function Uy(e){if(!e)return null;let t=Object.entries(e),n={};for(let[r,o]of t)if(o&&o.__type==="RouteErrorResponse")n[r]=new oi(o.status,o.statusText,o.data,o.internal===!0);else if(o&&o.__type==="Error"){if(o.__subType){let l=window[o.__subType];if(typeof l=="function")try{let i=new l(o.message);i.stack="",n[r]=i}catch{}}if(n[r]==null){let l=new Error(o.message);l.stack="",n[r]=l}}else n[r]=o;return n}const qh=E.createContext({isTransitioning:!1}),Ay=E.createContext(new Map),Fy="startTransition",ld=tm[Fy],by="flushSync",id=hv[by];function By(e){ld?ld(e):e()}function no(e){id?id(e):e()}class Wy{constructor(){this.status="pending",this.promise=new Promise((t,n)=>{this.resolve=r=>{this.status==="pending"&&(this.status="resolved",t(r))},this.reject=r=>{this.status==="pending"&&(this.status="rejected",n(r))}})}}function Vy(e){let{fallbackElement:t,router:n,future:r}=e,[o,l]=E.useState(n.state),[i,a]=E.useState(),[s,u]=E.useState({isTransitioning:!1}),[d,c]=E.useState(),[p,w]=E.useState(),[x,k]=E.useState(),_=E.useRef(new Map),{v7_startTransition:v}=r||{},h=E.useCallback(m=>{v?By(m):m()},[v]),g=E.useCallback((m,O)=>{let{deletedFetchers:L,unstable_flushSync:H,unstable_viewTransitionOpts:oe}=O;L.forEach(de=>_.current.delete(de)),m.fetchers.forEach((de,rt)=>{de.data!==void 0&&_.current.set(rt,de.data)});let ge=n.window==null||n.window.document==null||typeof n.window.document.startViewTransition!="function";if(!oe||ge){H?no(()=>l(m)):h(()=>l(m));return}if(H){no(()=>{p&&(d&&d.resolve(),p.skipTransition()),u({isTransitioning:!0,flushSync:!0,currentLocation:oe.currentLocation,nextLocation:oe.nextLocation})});let de=n.window.document.startViewTransition(()=>{no(()=>l(m))});de.finished.finally(()=>{no(()=>{c(void 0),w(void 0),a(void 0),u({isTransitioning:!1})})}),no(()=>w(de));return}p?(d&&d.resolve(),p.skipTransition(),k({state:m,currentLocation:oe.currentLocation,nextLocation:oe.nextLocation})):(a(m),u({isTransitioning:!0,flushSync:!1,currentLocation:oe.currentLocation,nextLocation:oe.nextLocation}))},[n.window,p,d,_,h]);E.useLayoutEffect(()=>n.subscribe(g),[n,g]),E.useEffect(()=>{s.isTransitioning&&!s.flushSync&&c(new Wy)},[s]),E.useEffect(()=>{if(d&&i&&n.window){let m=i,O=d.promise,L=n.window.document.startViewTransition(async()=>{h(()=>l(m)),await O});L.finished.finally(()=>{c(void 0),w(void 0),a(void 0),u({isTransitioning:!1})}),w(L)}},[h,i,d,n.window]),E.useEffect(()=>{d&&i&&o.location.key===i.location.key&&d.resolve()},[d,p,o.location,i]),E.useEffect(()=>{!s.isTransitioning&&x&&(a(x.state),u({isTransitioning:!0,flushSync:!1,currentLocation:x.currentLocation,nextLocation:x.nextLocation}),k(void 0))},[s.isTransitioning,x]),E.useEffect(()=>{},[]);let C=E.useMemo(()=>({createHref:n.createHref,encodeLocation:n.encodeLocation,go:m=>n.navigate(m),push:(m,O,L)=>n.navigate(m,{state:O,preventScrollReset:L==null?void 0:L.preventScrollReset}),replace:(m,O,L)=>n.navigate(m,{replace:!0,state:O,preventScrollReset:L==null?void 0:L.preventScrollReset})}),[n]),T=n.basename||"/",P=E.useMemo(()=>({router:n,navigator:C,static:!1,basename:T}),[n,C,T]),M=E.useMemo(()=>({v7_relativeSplatPath:n.future.v7_relativeSplatPath}),[n.future.v7_relativeSplatPath]);return E.createElement(E.Fragment,null,E.createElement(Qo.Provider,{value:P},E.createElement(su.Provider,{value:o},E.createElement(Ay.Provider,{value:_.current},E.createElement(qh.Provider,{value:s},E.createElement(_y,{basename:T,location:o.location,navigationType:o.historyAction,navigator:C,future:M},o.initialized||n.future.v7_partialHydration?E.createElement(Hy,{routes:n.routes,future:n.future,state:o}):t))))),null)}const Hy=E.memo(Qy);function Qy(e){let{routes:t,future:n,state:r}=e;return vy(t,void 0,r,n)}const Ky=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",Gy=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Uo=E.forwardRef(function(t,n){let{onClick:r,relative:o,reloadDocument:l,replace:i,state:a,target:s,to:u,preventScrollReset:d,unstable_viewTransition:c}=t,p=Zh(t,Iy),{basename:w}=E.useContext(rn),x,k=!1;if(typeof u=="string"&&Gy.test(u)&&(x=u,Ky))try{let g=new URL(window.location.href),C=u.startsWith("//")?new URL(g.protocol+u):new URL(u),T=tn(C.pathname,w);C.origin===g.origin&&T!=null?u=T+C.search+C.hash:k=!0}catch{}let _=hy(u,{relative:o}),v=Yy(u,{replace:i,state:a,target:s,preventScrollReset:d,relative:o,unstable_viewTransition:c});function h(g){r&&r(g),g.defaultPrevented||v(g)}return E.createElement("a",Ur({},p,{href:x||_,onClick:k||l?r:h,ref:n,target:s}))}),An=E.forwardRef(function(t,n){let{"aria-current":r="page",caseSensitive:o=!1,className:l="",end:i=!1,style:a,to:s,unstable_viewTransition:u,children:d}=t,c=Zh(t,Dy),p=Pi(s,{relative:c.relative}),w=tr(),x=E.useContext(su),{navigator:k,basename:_}=E.useContext(rn),v=x!=null&&Xy(p)&&u===!0,h=k.encodeLocation?k.encodeLocation(p).pathname:p.pathname,g=w.pathname,C=x&&x.navigation&&x.navigation.location?x.navigation.location.pathname:null;o||(g=g.toLowerCase(),C=C?C.toLowerCase():null,h=h.toLowerCase()),C&&_&&(C=tn(C,_)||C);const T=h!=="/"&&h.endsWith("/")?h.length-1:h.length;let P=g===h||!i&&g.startsWith(h)&&g.charAt(T)==="/",M=C!=null&&(C===h||!i&&C.startsWith(h)&&C.charAt(h.length)==="/"),m={isActive:P,isPending:M,isTransitioning:v},O=P?r:void 0,L;typeof l=="function"?L=l(m):L=[l,P?"active":null,M?"pending":null,v?"transitioning":null].filter(Boolean).join(" ");let H=typeof a=="function"?a(m):a;return E.createElement(Uo,Ur({},c,{"aria-current":O,className:L,ref:n,style:H,to:s,unstable_viewTransition:u}),typeof d=="function"?d(m):d)});var ls;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(ls||(ls={}));var ad;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(ad||(ad={}));function Jy(e){let t=E.useContext(Qo);return t||Y(!1),t}function Yy(e,t){let{target:n,replace:r,state:o,preventScrollReset:l,relative:i,unstable_viewTransition:a}=t===void 0?{}:t,s=ji(),u=tr(),d=Pi(e,{relative:i});return E.useCallback(c=>{if(Ly(c,n)){c.preventDefault();let p=r!==void 0?r:Zn(u)===Zn(d);s(e,{replace:p,state:o,preventScrollReset:l,relative:i,unstable_viewTransition:a})}},[u,s,d,r,o,n,e,l,i,a])}function Xy(e,t){t===void 0&&(t={});let n=E.useContext(qh);n==null&&Y(!1);let{basename:r}=Jy(ls.useViewTransitionState),o=Pi(e,{relative:t.relative});if(!n.isTransitioning)return!1;let l=tn(n.currentLocation.pathname,r)||n.currentLocation.pathname,i=tn(n.nextLocation.pathname,r)||n.nextLocation.pathname;return ri(o.pathname,i)!=null||ri(o.pathname,l)!=null}const cu="";function du(e){return e===cu}function G(e){return du(e)?"/api/root":`/api/projects/${encodeURIComponent(e)}`}function Zy(e){return du(e)?"":`/projects/${e}`}function b1(e){return e===""?"/":`${e}/home`}function qy(){return"/projects"}function B1(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 W1(e,t){const n=`${t}/files`;if(!e.startsWith(n))return"";const r=e.slice(n.length).replace(/^\//,"");return r?r.split("/").filter(Boolean).map(o=>{try{return decodeURIComponent(o)}catch{return o}}).join("/"):""}function V1(e){if(!e)return"#";const t=e.trim().replace(/\.git$/i,"");if(/^https?:\/\//i.test(t))return t;const n=/^git@([^:]+):(.+)$/.exec(t);if(n)return`https://${n[1]}/${n[2]}`;const r=/^ssh:\/\/git@([^/]+)\/(.+)$/i.exec(t);return r?`https://${r[1]}/${r[2]}`:"#"}const xr="";async function W(e,t){const n=await fetch(`${xr}${e}`,{headers:{"content-type":"application/json",...(t==null?void 0:t.headers)??{}},...t});if(!n.ok){let r=n.statusText;try{const o=await n.json();o.error&&(r=o.error)}catch{}throw new Ao(r,n.status)}return await n.json()}async function e0(e,t){const n=await fetch(`${xr}${e}`,t);if(!n.ok){let r=n.statusText;try{const o=JSON.parse(await n.text());o.error&&(r=o.error)}catch{}throw new Ao(r,n.status)}return n.text()}class Ao extends Error{constructor(t,n){super(t),this.status=n,this.name="ApiError"}}const fu={async me(){return W("/api/me")},async markChatSeen(e,t,n,r){const o=`${G(e)}/chats/${encodeURIComponent(t)}/seen`;await W(o,{method:"POST",body:JSON.stringify({...n!==void 0?{when:n}:{},...r!=null&&r.keepUnread?{keepUnread:!0}:{}})})},async markChatUnread(e,t,n){const r=`${G(e)}/chats/${encodeURIComponent(t)}/unread`;await W(r,{method:"POST",body:JSON.stringify({unread:n})})},async projectRuns(e,t){const n=t!==void 0?`?limit=${encodeURIComponent(t)}`:"";return W(`${G(e)}/runs${n}`)},async markRunsSeen(e,t){await W(`${G(e)}/runs/seen`,{method:"POST",body:JSON.stringify(t!==void 0?{when:t}:{})})},async getModels(){return W("/api/models")},async getInstanceConfig(){return W("/api/instance-config")},async updateInstanceConfig(e,t){return W("/api/instance-config",{method:"PUT",body:JSON.stringify(t===void 0?{patch:e}:{patch:e,expectedVersion:t})})},async uploadAttachments(e,t,n){const r=new FormData;for(const l of n)r.append("files",l,l.name);const o=await fetch(`${xr}${G(e)}/chats/${encodeURIComponent(t)}/upload`,{method:"POST",body:r});if(!o.ok){let l=o.statusText;try{const i=await o.json();i.error&&(l=i.error)}catch{}throw new Ao(l,o.status)}return await o.json()},async projectCommands(e){const{commands:t}=await W(`${G(e)}/commands`);return t},async listProjects(){const{projects:e,root:t}=await W("/api/projects");return{projects:e,root:t??null}},async getProjectDetail(e){return W(`${G(e)}`)},async attentionChats(e){const t=await W(`${G(e)}/chats/attention`);return{running:t.running??[],unread:t.unread??[]}},async createProject(e){const{project:t}=await W("/api/projects",{method:"POST",body:JSON.stringify(e)});return t},async updateProject(e,t){const{project:n}=await W(`${G(e)}`,{method:"PATCH",body:JSON.stringify(t)});return n},async promoteProject(e,t){const{project:n}=await W(`${G(e)}/promote`,{method:"POST",body:JSON.stringify({repo:t})});return n},async deleteProject(e){await W(`${G(e)}`,{method:"DELETE"})},async deleteProjectChat(e,t){await W(`${G(e)}/chats/${encodeURIComponent(t)}`,{method:"DELETE"})},async renameProjectChat(e,t,n){await W(`${G(e)}/chats/${encodeURIComponent(t)}`,{method:"PATCH",body:JSON.stringify({name:n})})},async archiveProjectChat(e,t,n){await W(`${G(e)}/chats/${encodeURIComponent(t)}/archive`,{method:"POST",body:JSON.stringify({archived:n})})},async starProjectChat(e,t,n){await W(`${G(e)}/chats/${encodeURIComponent(t)}/star`,{method:"POST",body:JSON.stringify({starred:n})})},async archiveProjectChats(e,t,n){await W(`${G(e)}/chats/batch/archive`,{method:"POST",body:JSON.stringify({sessionIds:t,archived:n})})},async markChatsUnread(e,t,n){await W(`${G(e)}/chats/batch/unread`,{method:"POST",body:JSON.stringify({sessionIds:t,unread:n})})},async deleteProjectChats(e,t){const n=await W(`${G(e)}/chats/batch/delete`,{method:"POST",body:JSON.stringify({sessionIds:t})});return{removed:n.removed??[],failed:n.failed??[]}},async detachProjectChat(e,t,n){await W(`${G(e)}/chats/${encodeURIComponent(t)}/detach`,{method:"POST",body:JSON.stringify({detached:n})})},async promoteChat(e,t,n){return W(`${G(e)}/chats/${encodeURIComponent(t)}/promote`,{method:"POST",body:JSON.stringify(n)})},async forkChat(e,t,n,r){const{sessionId:o}=await W(`${G(e)}/chats/${encodeURIComponent(t)}/fork`,{method:"POST",body:JSON.stringify({name:n,fromUuid:r})});return o},async revertChat(e,t,n){const{removed:r}=await W(`${G(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 W(`${G(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 W(`${G(e)}/files/${encodeURIComponent(t)}`)},projectFileRawUrl(e,t){return`${xr}${G(e)}/files/${encodeURIComponent(t)}?raw=1`},chatFileRawUrl(e){return`${xr}/api/chat-files/${encodeURIComponent(e)}`},async pinFile(e,t){const{project:n}=await W(`${G(e)}/pins`,{method:"PUT",body:JSON.stringify({file:t})});return n},async unpinFile(e,t){const{project:n}=await W(`${G(e)}/pins/${encodeURIComponent(t)}`,{method:"DELETE"});return n},async listProjectChats(e){const{chats:t}=await W(`${G(e)}/chats`);return t},async getAdoptableChats(e){return W(`${G(e)}/adoptable-chats`)},async adoptChats(e,t){return W(`${G(e)}/adopt-chats`,{method:"POST",body:JSON.stringify(t??{})})},async unadoptChats(e,t){return W(`${G(e)}/unadopt-chats`,{method:"POST",body:JSON.stringify(t??{})})},async chatUsage(e,t){const n=t?`?scope=${t}`:"",{usage:r}=await W(`${G(e)}/chats/usage${n}`);return r},async projectChatMessages(e,t){const{messages:n}=await W(`${G(e)}/chats/${encodeURIComponent(t)}/messages`);return n},async subagentMessages(e,t,n){const r=`${G(e)}/chats/${encodeURIComponent(t)}`,{messages:o}=await W(`${r}/subagents/${encodeURIComponent(n)}/messages`);return o},async chatContext(e,t){const n=`${G(e)}/chats/${encodeURIComponent(t)}/context`,{usage:r}=await W(n);return r},async listTriggers(e){return W(`${G(e)}/triggers`)},async putTrigger(e,t,n){const{trigger:r}=await W(`${G(e)}/triggers/${encodeURIComponent(t)}`,{method:"PUT",body:JSON.stringify(n)});return r},async deleteTrigger(e,t){await W(`${G(e)}/triggers/${encodeURIComponent(t)}`,{method:"DELETE"})},async triggerRuntime(e){return W(`${G(e)}/triggers/runtime`)},async runTrigger(e,t){const{sessionId:n}=await W(`${G(e)}/triggers/${encodeURIComponent(t)}/run`,{method:"POST",body:"{}"});return n},async gitInfo(){return W("/api/git")},async gitStatus(e){return W(`${G(e)}/git/status`)},async gitDiff(e,t){const n=t?`?file=${encodeURIComponent(t)}`:"";return e0(`${G(e)}/git/diff${n}`)},async gitCommit(e,t,n){return W(`${G(e)}/git/commit`,{method:"POST",body:JSON.stringify(n?{message:t,files:n}:{message:t})})},async gitPush(){return W("/api/git/push",{method:"POST"})},async githubConnect(){return W("/api/git/github/connect",{method:"POST"})},async githubPoll(e){return W("/api/git/github/poll",{method:"POST",body:JSON.stringify({deviceCode:e})})},async githubDisconnect(){await W("/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 W(`/api/discover${n?`?${n}`:""}`)},async discoverSessions(e){return W(`/api/discover/sessions?dir=${encodeURIComponent(e)}`)},async transcriptionStatus(){return W("/api/transcription")},async transcribe(e,t="dictation.webm",n){const r=new FormData;r.append("file",e,t);const o=await fetch(`${xr}/api/transcribe`,{method:"POST",body:r,signal:n});if(!o.ok){let i=o.statusText;try{const a=await o.json();a.error&&(i=a.error)}catch{}throw new Ao(i,o.status)}const{text:l}=await o.json();return l}},ep=E.createContext(null);function t0({children:e}){const[t,n]=E.useState([]),[r,o]=E.useState(null),[l,i]=E.useState(!0),[a,s]=E.useState(null),u=E.useRef(!1),d=E.useCallback(async()=>{u.current||i(!0),s(null);try{const{projects:x,root:k}=await fu.listProjects();u.current=!0,n(x),k&&o(k)}catch(x){s(x instanceof Error?x.message:"Failed to load projects")}finally{i(!1)}},[]),c=E.useCallback(x=>{if(du(x.slug)){o(x);return}n(k=>[x,...k.filter(_=>_.slug!==x.slug)])},[]),p=E.useCallback(x=>{n(k=>k.filter(_=>_.slug!==x))},[]);E.useEffect(()=>{d()},[d]);const w=E.useMemo(()=>({projects:t,rootWorkspace:r,loading:l,error:a,refresh:d,upsert:c,remove:p}),[t,r,l,a,d,c,p]);return f.jsx(ep.Provider,{value:w,children:e})}function tp(){const e=E.useContext(ep);if(!e)throw new Error("useProjects must be used within ProjectsProvider");return e}const n0="paddock:theme";function r0(){return typeof document<"u"&&document.documentElement.classList.contains("dark")}function o0(){const[e,t]=E.useState(r0),n=E.useCallback(()=>{t(r=>{const o=!r;document.documentElement.classList.toggle("dark",o);try{localStorage.setItem(n0,o?"dark":"light")}catch{}return o})},[]);return{dark:e,toggle:n}}const np={name:"Paddock",logo:"🐎",accent:"#c2603c"},l0={enabled:!1,path:"/open-api"};function rp(){const e=globalThis.__PADDOCK_CONFIG__;return{...np,...(e==null?void 0:e.brand)??{}}}function i0(){const e=globalThis.__PADDOCK_CONFIG__;return{...l0,...(e==null?void 0:e.openapi)??{}}}function a0(e){return/^(https?:\/\/|\/)/i.test(e.trim())}const hu=[{slug:"homelab",label:"Homelab",blurb:"Servers, networking, self-hosted services."},{slug:"house",label:"House",blurb:"Physical home systems — water, climate, power, garden."},{slug:"side-projects",label:"Side Projects",blurb:"Apps and ideas of your own."}],sd="",op=new Map(hu.map(e=>[e.slug,e]));function s0(e){if(!e)return"Unsorted";const t=op.get(e);return t?t.label:e.split("-").map(n=>n.charAt(0).toUpperCase()+n.slice(1)).join(" ")}function H1(e){var t;return(t=op.get(e))==null?void 0:t.blurb}function u0(e){const t=new Set(e),n=[];for(const o of hu)t.has(o.slug)&&(n.push(o.slug),t.delete(o.slug));const r=t.delete(sd);return n.push(...[...t].sort()),r&&n.push(sd),n}const lp=25e3,ip=1e4,c0=lp+ip+5e3,d0=500,f0=1e4;class h0{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.activeListeners=new Set,this.activeInfoListeners=new Set,this.knownSessions=new Set;const n=`${window.location.protocol==="https:"?"wss":"ws"}://${window.location.host}`;if(this.url=`${n.replace(/^http/,"ws")}/ws`,typeof window<"u"){const r=()=>this.ensureLive();window.addEventListener("online",r),window.addEventListener("focus",r),typeof document<"u"&&document.addEventListener("visibilitychange",()=>{document.visibilityState==="visible"&&this.ensureLive()})}}get state(){return this._state}onState(t){return this.stateListeners.add(t),t(this._state),()=>this.stateListeners.delete(t)}setState(t){if(this._state!==t){this._state=t;for(const n of this.stateListeners)n(t)}}onActiveSessions(t){return this.activeListeners.add(t),t(new Set(this.activeSessions.keys())),this.connect(),()=>this.activeListeners.delete(t)}onActiveInfos(t){return this.activeInfoListeners.add(t),t(new Map(this.activeSessions)),this.connect(),()=>this.activeInfoListeners.delete(t)}turnStartedAt(t){return this.activeStartedAt.get(t)??null}backgroundWork(t){return this.backgroundTasks.get(t)??[]}onBackgroundWork(t,n){const r=(o,l)=>{o===t&&n(l)};return this.backgroundListeners.add(r),n(this.backgroundWork(t)),this.connect(),()=>this.backgroundListeners.delete(r)}setActive(t,n,r,o){const l=this.activeSessions.has(t);if(n?(this.activeSessions.set(t,r),o!=null&&!this.activeStartedAt.has(t)&&this.activeStartedAt.set(t,o)):(this.activeSessions.delete(t),this.activeStartedAt.delete(t)),this.activeSessions.has(t)!==l){const i=new Set(this.activeSessions.keys());for(const s of this.activeListeners)s(i);const a=new Map(this.activeSessions);for(const s of this.activeInfoListeners)s(a)}}subscribe(t,n,r){const o=Symbol("chat-sub"),l={projectSlug:t,sessionId:n,handlers:r,lastSeq:-1,turnActive:!1};return this.subs.set(o,l),this.connect(),n&&this.attachSession(l,!1),{setSessionId:i=>{const a=this.subs.get(o);a&&(a.sessionId=i,i&&this.attachSession(a,!1))},unsubscribe:()=>{this.subs.delete(o)}}}attachSession(t,n){t.sessionId&&(this.knownSessions.add(t.sessionId),this.transmit(JSON.stringify({type:"chat:subscribe",payload:{projectSlug:t.projectSlug,sessionId:t.sessionId,wantReplay:n,lastSeq:t.lastSeq}})))}send(t,n,r,o){const l={projectSlug:t,sessionId:r,message:n};o!=null&&o.preloadContext&&(l.preloadContext=!0),o!=null&&o.model&&(l.model=o.model),o!=null&&o.attachments&&o.attachments.length>0&&(l.attachments=o.attachments),this.markTurnStart(t,r),this.transmit(JSON.stringify({type:"chat:send",payload:l}))}setQueued(t,n,r,o,l){const i={projectSlug:t,sessionId:n,text:r,qid:o};l&&l.length>0&&(i.attachments=l.map(a=>({id:a.id,filename:a.filename,kind:a.kind}))),this.transmit(JSON.stringify({type:"chat:set_queue",payload:i}))}markTurnStart(t,n){for(const r of this.subs.values())r.projectSlug===t&&r.sessionId===n&&(r.lastSeq=-1,r.turnActive=!0)}sendCommand(t,n,r){this.markTurnStart(t,r),this.transmit(JSON.stringify({type:"chat:command",payload:{projectSlug:t,sessionId:r,command:n}}))}cancel(t){this.transmit(JSON.stringify({type:"chat:cancel",payload:{jobId:t}}))}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<c0}wantsSocket(){return this.subs.size>0||this.activeListeners.size>0||this.activeInfoListeners.size>0}ensureLive(){var n;if(!this.wantsSocket())return;const t=(n=this.ws)==null?void 0:n.readyState;t===WebSocket.OPEN?this.sendPing():t!==WebSocket.CONNECTING&&(this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.reconnectAttempts=0,this.connect())}flushOutbox(){var n;if(((n=this.ws)==null?void 0:n.readyState)!==WebSocket.OPEN||this.outbox.length===0)return;const t=this.outbox;this.outbox=[];for(const r of t)this.ws.send(r)}connect(){if(this.manualClose=!1,this.ws&&(this.ws.readyState===WebSocket.OPEN||this.ws.readyState===WebSocket.CONNECTING))return;this.setState("connecting");let t;try{t=new WebSocket(this.url)}catch{this.scheduleReconnect();return}this.ws=t,t.onopen=()=>{this.reconnectAttempts=0,this.awaitingPong=!1,this.lastPongAt=Date.now(),this.setState("open"),this.flushOutbox();for(const n of this.subs.values())n.sessionId&&this.attachSession(n,n.turnActive);this.startPing()},t.onclose=()=>{this.stopPing(),this.setState("closed"),this.manualClose||this.scheduleReconnect()},t.onerror=()=>{t.close()},t.onmessage=n=>this.dispatch(n.data)}startPing(){this.stopPing(),this.pingTimer=setInterval(()=>this.sendPing(),lp)}sendPing(){var t;if(!(((t=this.ws)==null?void 0:t.readyState)!==WebSocket.OPEN||this.awaitingPong)){this.awaitingPong=!0;try{this.ws.send(JSON.stringify({type:"ping"}))}catch{this.awaitingPong=!1,this.ws.close();return}this.pongTimer=setTimeout(()=>{var n;this.pongTimer=null,this.awaitingPong&&((n=this.ws)==null||n.close())},ip)}}stopPing(){this.pingTimer&&clearInterval(this.pingTimer),this.pingTimer=null,this.pongTimer&&clearTimeout(this.pongTimer),this.pongTimer=null,this.awaitingPong=!1}scheduleReconnect(){if(this.reconnectTimer)return;const t=Math.min(f0,d0*2**this.reconnectAttempts);this.reconnectAttempts+=1,this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.connect()},t)}route(t,n){const r=[...this.subs.values()].filter(l=>l.projectSlug===t);if(r.length===0)return;if(n){const l=r.find(i=>i.sessionId===n);if(l)return l;if(this.knownSessions.has(n))return}const o=r.find(l=>l.sessionId===null);if(o)return o;if(n===null&&r.length===1)return r[0]}dispatch(t){var u,d,c,p,w,x,k,_,v,h,g,C,T,P,M,m,O,L,H,oe,ge,de,rt,Ye,wt,D,U,Q;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}const r=n.payload.projectSlug;if(r==null)return;if(n.type==="chat:error"){const A=this.route(r,null);(d=A==null?void 0:(u=A.handlers).onError)==null||d.call(u,n.payload.error);return}if(n.type==="chat:resync"){const A=this.route(r,n.payload.sessionId);(p=A==null?void 0:(c=A.handlers).onResync)==null||p.call(c);return}if(n.type==="chat:background"){const{sessionId:A,tasks:Z}=n.payload;if(A){const ue=Array.isArray(Z)?Z:[];ue.length===0?this.backgroundTasks.delete(A):this.backgroundTasks.set(A,ue);for(const q of this.backgroundListeners)q(A,ue)}return}if(n.type==="chat:active"){this.setActive(n.payload.sessionId,n.payload.running,r,n.payload.startedAt);for(const A of this.subs.values())A.projectSlug===r&&A.sessionId===n.payload.sessionId&&((x=(w=A.handlers).onActive)==null||x.call(w,{running:n.payload.running,turnRunning:n.payload.turnRunning??n.payload.running,jobId:n.payload.jobId}));return}if(n.type==="chat:queued_flushed"){const{sessionId:A,text:Z,attachments:ue}=n.payload;if(A){Kt(async()=>{const{writeQueued:q,writeQueuedId:_e,writeQueuedAttachments:le}=await import("./queued-CagZVfWU.js");return{writeQueued:q,writeQueuedId:_e,writeQueuedAttachments:le}},[]).then(({writeQueued:q,writeQueuedId:_e,writeQueuedAttachments:le})=>{q(A,r,null),_e(A,r,null),le(A,r,[])});for(const q of this.subs.values())q.projectSlug===r&&q.sessionId===A&&((_=(k=q.handlers).onQueuedFlushed)==null||_.call(k,{text:Z,attachments:ue}))}return}if(n.type==="chat:queued_state"){const{sessionId:A,text:Z,qid:ue,reason:q,attachments:_e}=n.payload;if(A){const le=Z&&Z.length>0?Z:null,Ue=_e??[],$t=le!==null||Ue.length>0;Kt(async()=>{const{writeQueued:Ut,writeQueuedId:on,writeQueuedAttachments:Wr}=await import("./queued-CagZVfWU.js");return{writeQueued:Ut,writeQueuedId:on,writeQueuedAttachments:Wr}},[]).then(({writeQueued:Ut,writeQueuedId:on,writeQueuedAttachments:Wr})=>{Ut(A,r,le),on(A,r,$t?ue??null:null),Wr(A,r,Ue)});for(const Ut of this.subs.values())Ut.projectSlug===r&&Ut.sessionId===A&&((h=(v=Ut.handlers).onQueuedState)==null||h.call(v,{text:le,attachments:Ue,qid:ue,reason:q}))}return}if(n.type==="chat:queued_returned"){const{sessionId:A,text:Z,attachments:ue}=n.payload;if(A&&typeof Z=="string"){Kt(async()=>{const{writeQueued:q,writeQueuedId:_e,writeQueuedAttachments:le}=await import("./queued-CagZVfWU.js");return{writeQueued:q,writeQueuedId:_e,writeQueuedAttachments:le}},[]).then(({writeQueued:q,writeQueuedId:_e,writeQueuedAttachments:le})=>{q(A,r,null),_e(A,r,null),le(A,r,[])});for(const q of this.subs.values())q.projectSlug===r&&q.sessionId===A&&((C=(g=q.handlers).onQueuedReturned)==null||C.call(g,{text:Z,attachments:ue}))}return}if(n.type==="chat:killed_task"){const{sessionId:A,summary:Z,timestamp:ue}=n.payload;if(A)for(const q of this.subs.values())q.projectSlug===r&&q.sessionId===A&&((P=(T=q.handlers).onKilledTask)==null||P.call(T,{summary:Z??"",timestamp:ue??""}));return}const{sessionId:o,jobId:l}=n.payload,i=this.route(r,o);if(!i)return;const a={sessionId:o,jobId:l},s=n.payload.seq;switch(typeof s=="number"&&s>i.lastSeq&&(i.lastSeq=s),i.turnActive=n.type!=="chat:complete",n.type){case"chat:response":(m=(M=i.handlers).onResponse)==null||m.call(M,n.payload.chunk,a);break;case"chat:tool_call":(L=(O=i.handlers).onToolCall)==null||L.call(O,{toolName:n.payload.toolName,inputSummary:n.payload.inputSummary,output:n.payload.output,isError:n.payload.isError,durationMs:n.payload.durationMs,toolUseId:n.payload.toolUseId,subagentType:n.payload.subagentType,description:n.payload.description,hasSubagent:n.payload.hasSubagent},a);break;case"chat:tool_start":(oe=(H=i.handlers).onToolStart)==null||oe.call(H,{toolName:n.payload.toolName,inputSummary:n.payload.inputSummary,toolUseId:n.payload.toolUseId,output:"",isError:!1,pending:!0,subagentType:n.payload.subagentType,description:n.payload.description,hasSubagent:n.payload.hasSubagent},a);break;case"chat:message_boundary":(de=(ge=i.handlers).onMessageBoundary)==null||de.call(ge,a);break;case"chat:injected":(Ye=(rt=i.handlers).onInjected)==null||Ye.call(rt,{sender:n.payload.sender,content:n.payload.content,timestamp:n.payload.timestamp},a);break;case"chat:notice":(D=(wt=i.handlers).onNotice)==null||D.call(wt,n.payload.notice,a);break;case"chat:complete":(Q=(U=i.handlers).onComplete)==null||Q.call(U,{...a,success:n.payload.success,error:n.payload.error,model:n.payload.model,usage:n.payload.usage});break}}}const pu=new h0,Yt=new Map,is="paddock:lastSeen-changed";function mu(e){try{window.dispatchEvent(new CustomEvent(is,{detail:{sessionId:e}}))}catch{}}function p0(e){return Yt.get(e)??0}function m0(e,t){!t||!Number.isFinite(t)||t<=(Yt.get(e)??0)||(Yt.set(e,t),mu(e))}function Q1(e,t=Date.now()){const n=Yt.get(e)??0;return t<=n||(Yt.set(e,t),mu(e)),n}function K1(e,t,n){Yt.get(e)===n&&(t?Yt.set(e,t):Yt.delete(e),mu(e))}const as="paddock:chats-gone";function G1(e){if(e.length!==0){for(const t of e)Yt.delete(t);try{window.dispatchEvent(new CustomEvent(as,{detail:{sessionIds:e}}))}catch{}}}function g0({tag:e,className:t=""}){const n=ji();return f.jsx("button",{type:"button",onClick:r=>{r.preventDefault(),r.stopPropagation(),n(`/tags/${encodeURIComponent(e)}`)},title:`Show projects tagged ${e}`,className:`tag relative z-10 transition-colors hover:bg-surface-selected ${t}`,children:e})}const v0=/^\d{4}-\d{2}-\d{2}$/;function y0(e){if(!e)return"";if(v0.test(e)){const[s,u,d]=e.split("-").map(Number),c=new Date(s,u-1,d);if(Number.isNaN(c.getTime()))return e;const p=new Date,w=new Date(p.getFullYear(),p.getMonth(),p.getDate()),x=Math.round((w.getTime()-c.getTime())/864e5);return x<=0?"today":x===1?"yesterday":x<7?`${x}d ago`:x<35?`${Math.round(x/7)}w ago`:x<365?`${Math.round(x/30)}mo ago`:`${Math.round(x/365)}y ago`}const t=new Date(e).getTime();if(Number.isNaN(t))return e;const n=Math.round((Date.now()-t)/1e3);if(n<45)return"just now";const r=Math.round(n/60);if(r<60)return`${r}m ago`;const o=Math.round(r/60);if(o<24)return`${o}h ago`;const l=Math.round(o/24);if(l<7)return`${l}d ago`;const i=Math.round(l/7);if(i<5)return`${i}w ago`;const a=Math.round(l/30);return a<12?`${a}mo ago`:`${Math.round(l/365)}y ago`}function J1(e){if(!e)return"";const t=new Date(e).getTime();if(Number.isNaN(t))return e;const n=Math.round((t-Date.now())/1e3);if(n<=30)return"now";const r=Math.round(n/60);if(r<60)return`in ${r}m`;const o=Math.round(r/60);if(o<24)return`in ${o}h`;const l=Math.round(o/24);if(l<7)return`in ${l}d`;const i=Math.round(l/7);if(i<5)return`in ${i}w`;const a=Math.round(l/30);return a<12?`in ${a}mo`:`in ${Math.round(l/365)}y`}function la(e){return!Number.isFinite(e)||e<0?"0":e>=1e6?`${(e/1e6).toFixed(e>=1e7?0:2)}M`:e>=1e3?`${Math.round(e/1e3)}K`:`${Math.round(e)}`}function w0(e){return!Number.isFinite(e)||e<=0?"$0.00":e<.01?"<$0.01":`$${e.toFixed(2)}`}function Y1(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 X1(e){const t=e.inputTokens+e.cacheReadTokens+e.cacheCreationTokens,n=`${la(e.totalTokens)} tokens · ${la(t)} in / ${la(e.outputTokens)} out`;return e.costUsd==null?n:`${n} · ~${w0(e.costUsd)} at API rates`}function Z1(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 x0="This session is being continued from a previous conversation";function q1(e){return e.trimStart().startsWith(x0)}function ew(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 tw(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 rw(e){return/^\s*<local-command-stdout>[\s\S]*<\/local-command-stdout>\s*$/.test(e)}function ow(e){return e.trimStart().startsWith("<task-notification>")}function lw(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 iw(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 aw(e){return e==="killed"||e==="stopped"}function S0(e){const t=Math.max(0,Math.floor(e/1e3)),n=t%60,r=Math.floor(t/60)%60,o=Math.floor(t/3600),l=String(n).padStart(2,"0");return o>0?`${o}:${String(r).padStart(2,"0")}:${l}`:`${r}:${l}`}function ud(e){if(typeof window>"u"||typeof window.matchMedia!="function")return null;try{return window.matchMedia(e)??null}catch{return null}}function ss(e){const[t,n]=E.useState(()=>{var r;return((r=ud(e))==null?void 0:r.matches)??!1});return E.useEffect(()=>{var l;const r=ud(e);if(!r)return;const o=()=>n(!!r.matches);return o(),typeof r.addEventListener=="function"?(r.addEventListener("change",o),()=>r.removeEventListener("change",o)):((l=r.addListener)==null||l.call(r,o),()=>{var i;return(i=r.removeListener)==null?void 0:i.call(r,o)})},[e]),t}function ap(...e){return e.filter(Boolean).join(" ")}const k0="(min-width: 1280px)",E0="(min-width: 900px)",C0=1;function j0(){const e=ss(k0),t=ss(E0);return e?3:t?2:C0}const ia=6,P0=.75,N0=.9,T0=250,_0=3e4;function R0(e){const[,t]=E.useState(0);E.useEffect(()=>{if(!e)return;const n=setInterval(()=>t(r=>r+1),1e3);return()=>clearInterval(n)},[e])}function M0(){const[e,t]=E.useState(new Map);return E.useEffect(()=>pu.onActiveInfos(n=>t(new Map(n))),[]),e}function L0(e){const[t,n]=E.useState(new Map),r=E.useRef(0);return E.useEffect(()=>{if(!e){r.current++,n(new Map);return}let o=!1;const l=async()=>{const s=++r.current;try{const u=await fu.attentionChats(cu);if(o||s!==r.current)return;n(new Map(u.running.map(d=>[d.sessionId,d])))}catch{}},i=setTimeout(()=>void l(),T0),a=setInterval(()=>{document.visibilityState==="visible"&&l()},_0);return()=>{o=!0,clearTimeout(i),clearInterval(a)}},[e]),t}function I0({fill:e}){const t=Math.max(1,Math.min(ia,Math.round(e*ia))),n=e<P0?"bg-accent-solid":e<N0?"bg-warn-solid":"bg-danger-solid";return f.jsx("span",{className:"flex items-center gap-px",title:`Context ${Math.round(e*100)}% full`,"aria-hidden":"true",children:Array.from({length:ia},(r,o)=>f.jsx("span",{className:ap("h-2.5 w-[3px] rounded-[1px]",o<t?n:"bg-edge")},o))})}function D0({projectSlug:e,projectName:t,chatName:n,sessionId:r,startedAt:o,fill:l}){const i=o==null?"—:—":S0(Date.now()-o),a=n??"Running turn";return f.jsxs(Uo,{"data-testid":"fleet-channel",to:`${Zy(e)}/chat/${encodeURIComponent(r)}`,title:`${a} — ${t}`,"aria-label":`${a} in ${t}, running${o==null?"":` for ${i}`}`,className:"focus-visible:focus-ring flex h-6 shrink-0 items-center gap-2 rounded-md border border-edge-subtle bg-surface px-2 text-2xs can-hover:hover:border-edge can-hover:hover:bg-surface-hover",children:[f.jsx("span",{className:"h-1.5 w-1.5 shrink-0 rounded-[1px] bg-accent-solid","aria-hidden":"true"}),f.jsx("span",{className:"max-w-[14ch] truncate font-medium text-fg",children:t}),f.jsx("span",{className:"font-mono tabular text-fg-muted",children:i}),l!=null&&f.jsx(I0,{fill:l})]})}function cd({value:e,unit:t,to:n,tone:r,title:o}){return f.jsxs(Uo,{"data-testid":`fleet-${t}`,to:n,title:o,className:"focus-visible:focus-ring flex h-6 shrink-0 items-center gap-1.5 rounded-md px-1.5 can-hover:hover:bg-surface-hover",children:[f.jsx("span",{"aria-hidden":"true",className:ap("h-1.5 w-1.5 shrink-0 rounded-[1px]",r==="live"&&"bg-accent-solid",r==="attention"&&"bg-warn-solid",r==="rest"&&"bg-edge-strong")}),f.jsx("span",{"data-testid":`fleet-${t}-value`,className:"font-mono tabular text-2xs font-semibold text-fg",children:e}),f.jsx("span",{className:"text-3xs font-semibold uppercase tracking-[0.14em] text-fg-subtle",children:t})]})}function O0({unread:e}){const{projects:t,rootWorkspace:n}=tp(),r=M0(),o=E.useMemo(()=>[...r.keys()].sort().join(","),[r]),l=L0(o);R0(r.size>0);const i=j0(),a=E.useMemo(()=>{const w=new Map;for(const x of t)w.set(x.slug,x.name);return n&&w.set(n.slug,n.name),w},[t,n]),s=E.useMemo(()=>[...r.entries()].map(([w,x])=>{const k=l.get(w);return{sessionId:w,projectSlug:x,projectName:a.get(x)??(k==null?void 0:k.projectName)??x,chatName:(k==null?void 0:k.name)??null,startedAt:pu.turnStartedAt(w),fill:(k==null?void 0:k.contextTokens)!=null&&k.contextLimit?Math.min(1,k.contextTokens/k.contextLimit):null}}).sort((w,x)=>(w.startedAt??1/0)-(x.startedAt??1/0)),[r,l,a]),u=s.slice(0,i),d=s.length-u.length,c=E.useMemo(()=>{let w="";for(const x of n?[...t,n]:t)for(const k of x.chatTurns??[])k.lastTurnCompletedAt>w&&(w=k.lastTurnCompletedAt);return w},[t,n]),p=r.size===0?`Fleet idle. ${e} unread.`:`${r.size} running. ${e} unread.`;return f.jsxs("div",{"data-testid":"fleet-readout",className:"flex h-9 shrink-0 items-center gap-2 border-b border-edge-subtle bg-surface-sunken px-2 sm:px-3",children:[f.jsx(cd,{value:r.size,unit:"running",to:"/",tone:r.size>0?"live":"rest",title:r.size>0?"Turns in flight across every project":"Nothing running"}),f.jsx(cd,{value:e,unit:"unread",to:"/",tone:e>0?"attention":"rest",title:"Chats holding a reply you have not read"}),f.jsx("span",{className:"h-4 w-px shrink-0 bg-edge-subtle","aria-hidden":"true"}),f.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-1.5 overflow-hidden",children:[u.map(w=>f.jsx(D0,{projectSlug:w.projectSlug,projectName:w.projectName,chatName:w.chatName,sessionId:w.sessionId,startedAt:w.startedAt,fill:w.fill},w.sessionId)),d>0&&f.jsxs(Uo,{to:"/",className:"focus-visible:focus-ring shrink-0 rounded-md px-1.5 py-1 font-mono tabular text-2xs text-fg-muted can-hover:hover:bg-surface-hover can-hover:hover:text-fg",title:`${d} more running — open Home for the full list`,children:["+",d]}),s.length===0&&(c?f.jsxs("span",{className:"truncate text-2xs text-fg-subtle",children:["Idle · last turn ",y0(c)]}):f.jsx(Uo,{to:"/",className:"focus-visible:focus-ring truncate rounded-md px-1 text-2xs text-accent can-hover:hover:underline",children:"No turns yet — start a chat →"}))]}),f.jsx("span",{role:"status","aria-live":"polite",className:"sr-only",children:p})]})}function X(e){return{width:16,height:16,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",...e}}const z0=e=>f.jsx("svg",{...X(e),children:f.jsx("path",{d:"M12 5v14M5 12h14"})}),sw=e=>f.jsx("svg",{...X(e),children:f.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48"})}),$0=e=>f.jsxs("svg",{...X(e),children:[f.jsx("path",{d:"M3 10.5 12 3l9 7.5"}),f.jsx("path",{d:"M5 9.5V20a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V9.5"})]}),uw=e=>f.jsx("svg",{...X(e),children:f.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})}),U0=e=>f.jsxs("svg",{...X(e),children:[f.jsx("circle",{cx:"11",cy:"11",r:"7"}),f.jsx("path",{d:"m21 21-4.3-4.3"})]}),cw=e=>f.jsxs("svg",{...X(e),children:[f.jsx("path",{d:"M4 5h16"}),f.jsx("path",{d:"M8 5v6h12"}),f.jsx("path",{d:"M8 11v6h12"})]}),dw=e=>f.jsx("svg",{...X(e),children:f.jsx("path",{d:"M4 6h16M4 12h16M4 18h16"})}),A0=e=>f.jsx("svg",{...X(e),children:f.jsx("path",{d:"M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z"})}),fw=e=>f.jsxs("svg",{...X(e),children:[f.jsx("path",{d:"m22 2-7 20-4-9-9-4Z"}),f.jsx("path",{d:"M22 2 11 13"})]}),hw=e=>f.jsx("svg",{...X(e),children:f.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"})}),pw=e=>f.jsxs("svg",{...X(e),children:[f.jsx("rect",{x:"9",y:"2",width:"6",height:"12",rx:"3"}),f.jsx("path",{d:"M5 10a7 7 0 0 0 14 0"}),f.jsx("path",{d:"M12 17v4M8 21h8"})]}),mw=e=>f.jsx("svg",{...X(e),children:f.jsx("path",{d:"m9 18 6-6-6-6"})}),gw=e=>f.jsx("svg",{...X(e),children:f.jsx("path",{d:"M14.7 6.3a4 4 0 0 0-5.4 5.4L3 18l3 3 6.3-6.3a4 4 0 0 0 5.4-5.4l-2.6 2.6-2-2 2.6-2.6Z"})}),F0=e=>f.jsxs("svg",{...X(e),children:[f.jsx("circle",{cx:"12",cy:"12",r:"3"}),f.jsx("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09a1.65 1.65 0 0 0-1-1.51 1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09a1.65 1.65 0 0 0 1.51-1 1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1Z"})]}),vw=e=>f.jsxs("svg",{...X(e),children:[f.jsx("path",{d:"M10.3 3.9 1.8 18a2 2 0 0 0 1.7 3h17a2 2 0 0 0 1.7-3L13.7 3.9a2 2 0 0 0-3.4 0Z"}),f.jsx("path",{d:"M12 9v4M12 17h.01"})]}),yw=e=>f.jsx("svg",{...X(e),children:f.jsx("path",{d:"M12 3v4M12 17v4M3 12h4M17 12h4M5.6 5.6l2.8 2.8M15.6 15.6l2.8 2.8M5.6 18.4l2.8-2.8M15.6 8.4l2.8-2.8"})}),sp=e=>f.jsx("svg",{...X(e),children:f.jsx("path",{d:"M18 6 6 18M6 6l12 12"})}),ww=e=>f.jsx("svg",{...X(e),children:f.jsx("path",{d:"M13 2 4.5 13.5H11l-1 8.5 8.5-11.5H12z"})}),xw=e=>f.jsx("svg",{...X(e),children:f.jsx("path",{d:"M6 4.5v15l13-7.5z"})}),b0=e=>f.jsx("svg",{...X(e),children:f.jsx("path",{d:"M3 6h18M3 12h18M3 18h18"})}),Sw=e=>f.jsxs("svg",{...X(e),children:[f.jsx("circle",{cx:"12",cy:"12",r:"9"}),f.jsx("path",{d:"M12 7v5l3 2"})]}),kw=e=>f.jsxs("svg",{...X(e),children:[f.jsx("circle",{cx:"12",cy:"5",r:"1"}),f.jsx("circle",{cx:"12",cy:"12",r:"1"}),f.jsx("circle",{cx:"12",cy:"19",r:"1"})]}),Ew=e=>f.jsx("svg",{...X(e),children:f.jsx("path",{d:"M3 6h18M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2m3 0v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6M10 11v6M14 11v6"})}),Cw=e=>f.jsxs("svg",{...X(e),children:[f.jsx("path",{d:"M12 20h9"}),f.jsx("path",{d:"M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4Z"})]}),jw=e=>f.jsxs("svg",{...X(e),children:[f.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8Z"}),f.jsx("path",{d:"M14 2v6h6"})]}),Pw=e=>f.jsxs("svg",{...X(e),children:[f.jsx("path",{d:"M12 17v5"}),f.jsx("path",{d:"M9 10.76V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v6.76a2 2 0 0 0 .59 1.42l1.12 1.12A1 1 0 0 1 17 15H7a1 1 0 0 1-.71-1.7l1.12-1.12A2 2 0 0 0 9 10.76Z"})]}),Nw=e=>f.jsx("svg",{...X(e),children:f.jsx("path",{d:"M20 6 9 17l-5-5"})}),Tw=({open:e,...t})=>e?f.jsxs("svg",{...X(t),children:[f.jsx("path",{d:"M21.2 8.4c.5.38.8.97.8 1.6v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V10a2 2 0 0 1 .8-1.6l8-6a2 2 0 0 1 2.4 0l8 6Z"}),f.jsx("path",{d:"m22 10-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 10"})]}):f.jsxs("svg",{...X(t),children:[f.jsx("rect",{width:"20",height:"16",x:"2",y:"4",rx:"2"}),f.jsx("path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7"})]}),_w=e=>f.jsxs("svg",{...X(e),children:[f.jsx("circle",{cx:"6",cy:"6",r:"3"}),f.jsx("circle",{cx:"6",cy:"18",r:"3"}),f.jsx("circle",{cx:"18",cy:"6",r:"3"}),f.jsx("path",{d:"M6 9v6M18 9a9 9 0 0 1-9 9"})]}),Rw=e=>f.jsxs("svg",{...X(e),children:[f.jsx("path",{d:"M9.5 14.5l-1.7 1.7a4 4 0 0 1-5.66-5.66l1.7-1.7"}),f.jsx("path",{d:"M14.5 9.5l1.7-1.7a4 4 0 0 1 5.66 5.66l-1.7 1.7"}),f.jsx("path",{d:"M8 3.5v2M3.5 8h2M16 20.5v-2M20.5 16h-2"})]}),Mw=e=>f.jsxs("svg",{...X(e),children:[f.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),f.jsx("path",{d:"M17 8l-5-5-5 5M12 3v12"})]}),Lw=e=>f.jsx("svg",{...X(e),children:f.jsx("path",{d:"M4 17l6-5-6-5M12 19h8"})}),Iw=e=>f.jsx("svg",{...X(e),children:f.jsx("path",{d:"M9 19c-5 1.5-5-2.5-7-3m14 6v-3.9a3.4 3.4 0 0 0-1-2.6c3-.3 6.2-1.5 6.2-6.6a5.2 5.2 0 0 0-1.4-3.6 4.8 4.8 0 0 0-.1-3.6s-1.1-.3-3.7 1.4a12.6 12.6 0 0 0-6.6 0C6.5 1.3 5.4 1.6 5.4 1.6a4.8 4.8 0 0 0-.1 3.6 5.2 5.2 0 0 0-1.4 3.6c0 5.1 3.2 6.3 6.2 6.6a3.4 3.4 0 0 0-1 2.6V22"})}),B0=e=>f.jsxs("svg",{...X(e),children:[f.jsx("circle",{cx:"12",cy:"12",r:"4"}),f.jsx("path",{d:"M12 2v2M12 20v2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M2 12h2M20 12h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4"})]}),W0=e=>f.jsx("svg",{...X(e),children:f.jsx("path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z"})}),V0=e=>f.jsxs("svg",{...X(e),children:[f.jsx("path",{d:"M10 13a5 5 0 0 0 7.5.5l3-3a5 5 0 0 0-7-7l-1.5 1.5"}),f.jsx("path",{d:"M14 11a5 5 0 0 0-7.5-.5l-3 3a5 5 0 0 0 7 7l1.5-1.5"})]}),Dw=e=>f.jsx("svg",{...X(e),children:f.jsx("path",{d:"m6 9 6 6 6-6"})}),Ow=e=>f.jsxs("svg",{...X(e),children:[f.jsx("rect",{x:"3",y:"4",width:"18",height:"4",rx:"1"}),f.jsx("path",{d:"M5 8v11a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V8"}),f.jsx("path",{d:"M10 12h4"})]}),zw=e=>f.jsx("svg",{...X(e),children:f.jsx("path",{d:"M12 2.5l2.9 5.88 6.49.94-4.7 4.58 1.11 6.46L12 17.8l-5.8 3.05 1.11-6.46-4.7-4.58 6.49-.94z"})}),H0=["idea","active","paused","blocked","done"];function Q0({open:e,onClose:t,onCreated:n}){const[r,o]=E.useState(""),[l,i]=E.useState(""),[a,s]=E.useState(""),[u,d]=E.useState(""),[c,p]=E.useState("active"),[w,x]=E.useState(""),[k,_]=E.useState(""),[v,h]=E.useState(!1),[g,C]=E.useState(!1),[T,P]=E.useState(null);if(E.useEffect(()=>{e&&(o(""),i(""),s(""),d(""),p("active"),x(""),_(""),h(!1),P(null))},[e]),E.useEffect(()=>{const m=O=>{O.key==="Escape"&&e&&!g&&t()};return window.addEventListener("keydown",m),()=>window.removeEventListener("keydown",m)},[e,g,t]),!e)return null;const M=async m=>{if(m.preventDefault(),!!r.trim()){C(!0),P(null);try{const O=await fu.createProject({name:r.trim(),status:c,group:u||void 0,summary:l.trim()||void 0,repo:w.trim()||void 0,path:k.trim()||void 0,managed:k.trim()&&!w.trim()?v:void 0,domain:a.split(",").map(L=>L.trim()).filter(Boolean)});n(O)}catch(O){P(O instanceof Ao?O.message:"Failed to create project")}finally{C(!1)}}};return f.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-overlay p-4 backdrop-blur-sm",onClick:()=>!g&&t(),children:f.jsxs("form",{className:"w-full max-w-md animate-scale-in rounded-2xl border border-edge bg-surface-raised p-6 shadow-2xl",onClick:m=>m.stopPropagation(),onSubmit:M,children:[f.jsxs("div",{className:"mb-5 flex items-center justify-between",children:[f.jsx("h2",{className:"text-lg font-semibold",children:"New project"}),f.jsx("button",{type:"button",onClick:t,className:"rounded-lg p-1 text-fg-subtle hover:bg-surface-hover hover:text-fg-muted","aria-label":"Close",children:f.jsx(sp,{width:18,height:18})})]}),f.jsxs("label",{className:"mb-4 block",children:[f.jsx("span",{className:"field-label",children:"Name"}),f.jsx("input",{autoFocus:!0,className:"input",value:r,onChange:m=>o(m.target.value),placeholder:"Garage Water Heater Replacement"})]}),f.jsxs("label",{className:"mb-4 block",children:[f.jsx("span",{className:"field-label",children:"Summary (optional)"}),f.jsx("input",{className:"input",value:l,onChange:m=>i(m.target.value),placeholder:"One line on what this project is about"})]}),f.jsxs("label",{className:"mb-4 block",children:[f.jsx("span",{className:"field-label",children:"Area"}),f.jsxs("select",{className:"input",value:u,onChange:m=>d(m.target.value),children:[f.jsx("option",{value:"",children:"Unsorted"}),hu.map(m=>f.jsx("option",{value:m.slug,children:m.label},m.slug))]})]}),f.jsxs("label",{className:"mb-4 block",children:[f.jsx("span",{className:"field-label",children:"Directory on this machine (optional)"}),f.jsx("input",{className:"input",value:k,onChange:m=>_(m.target.value),placeholder:"/home/ed/Code/foo"}),f.jsx("span",{className:"mt-1 block text-xs text-fg-subtle",children:"Where this project's content lives. An existing checkout is used in place — its real history, branches and remotes — and Paddock writes nothing into it. Absolute path; created for you if it doesn't exist."})]}),f.jsxs("label",{className:"mb-4 block",children:[f.jsx("span",{className:"field-label",children:"Git repository URL (optional)"}),f.jsx("input",{className:"input",value:w,onChange:m=>x(m.target.value),placeholder:"https://github.com/owner/repo.git"}),f.jsx("span",{className:"mt-1 block text-xs text-fg-subtle",children:k.trim()?"Cloned into the directory above if it doesn't exist yet; otherwise the directory is used as-is and this just records which repo it is.":"Paddock clones this repo into the project and works in the checkout. Leave both blank for a notes project."})]}),k.trim()&&!w.trim()&&f.jsxs("label",{className:"mb-4 flex cursor-pointer items-start gap-2",children:[f.jsx("input",{type:"checkbox",className:"mt-0.5",checked:v,onChange:m=>h(m.target.checked)}),f.jsxs("span",{className:"text-xs text-fg-muted",children:[f.jsx("span",{className:"font-medium",children:"These are notes — let Paddock curate them."})," ","Its OVERVIEW.md, CHANGELOG.md and CLAUDE.md are written into that directory. Leave unticked for a code checkout you version yourself, and Paddock will write nothing into it."]})]}),f.jsxs("div",{className:"mb-5 grid grid-cols-2 gap-3",children:[f.jsxs("label",{className:"block",children:[f.jsx("span",{className:"field-label",children:"Domain tags"}),f.jsx("input",{className:"input",value:a,onChange:m=>s(m.target.value),placeholder:"home, plumbing"})]}),f.jsxs("label",{className:"block",children:[f.jsx("span",{className:"field-label",children:"Status"}),f.jsx("select",{className:"input capitalize",value:c,onChange:m=>p(m.target.value),children:H0.map(m=>f.jsx("option",{value:m,className:"capitalize",children:m},m))})]})]}),T&&f.jsx("p",{className:"mb-4 rounded-lg bg-danger-soft px-3 py-2 text-sm text-danger",children:T}),f.jsxs("div",{className:"flex justify-end gap-2",children:[f.jsx("button",{type:"button",className:"btn-ghost",onClick:t,disabled:g,children:"Cancel"}),f.jsx("button",{type:"submit",className:"btn-primary",disabled:g||!r.trim(),children:g?"Creating…":"Create project"})]})]})})}const gu="paddock:panewidth:",K0={key:"sidenav",def:288,min:200,max:480},$w={key:"chatlist",def:256,min:220,max:520},G0="(min-width: 1024px)";function Tr(e,t){return Math.min(Math.max(t,e.min),e.max)}function dd(e,t,n){return Tr(n,e+t)}function J0(e){try{const t=localStorage.getItem(gu+e.key);if(t==null)return null;const n=Number.parseFloat(t);return Number.isFinite(n)?Tr(e,n):null}catch{return null}}function Y0(e,t){try{localStorage.setItem(gu+e.key,String(Tr(e,t)))}catch{}}function X0(e){try{localStorage.removeItem(gu+e.key)}catch{}}function Z0(e){const t=ss(G0),[n,r]=E.useState(()=>J0(e)),o=Tr(e,n??e.def);return{isDesktop:t,width:o,style:t?{width:o}:void 0,preview:l=>r(Tr(e,l)),commit:l=>{const i=Tr(e,l);r(i),Y0(e,i)},reset:()=>{r(null),X0(e)},spec:e}}function q0({spec:e,width:t,onPreview:n,onCommit:r,onReset:o,label:l}){const i=E.useRef(null),a=E.useRef(t);a.current=t;const s=16;return f.jsx("div",{role:"separator","aria-orientation":"vertical","aria-label":l,"aria-valuenow":Math.round(t),"aria-valuemin":e.min,"aria-valuemax":e.max,tabIndex:0,onPointerDown:u=>{i.current={startX:u.clientX,startWidth:t},u.currentTarget.setPointerCapture(u.pointerId)},onPointerMove:u=>{i.current&&n(dd(i.current.startWidth,u.clientX-i.current.startX,e))},onPointerUp:u=>{if(i.current){i.current=null;try{u.currentTarget.releasePointerCapture(u.pointerId)}catch{}r(a.current)}},onDoubleClick:o,onKeyDown:u=>{if(u.key==="ArrowLeft"||u.key==="ArrowRight"){u.preventDefault();const d=dd(t,u.key==="ArrowRight"?s:-s,e);n(d),r(d)}},title:"Drag to resize · double-click to reset",className:"group/resizer absolute inset-y-0 right-0 z-10 hidden w-1.5 -mr-0.5 cursor-ew-resize touch-none lg:block",children:f.jsx("span",{className:"absolute inset-y-0 right-0 w-px bg-edge transition group-hover/resizer:w-0.5 group-hover/resizer:bg-accent-solid group-focus/resizer:w-0.5 group-focus/resizer:bg-accent-solid"})})}function e1(e){const[t,n]=E.useState(new Map),r=E.useRef(new Map),[o,l]=E.useState(0);return E.useEffect(()=>{const i=r.current;for(const a of e)for(const s of a.chatTurns??[]){m0(s.sessionId,s.lastSeen);const u=Date.parse(s.lastTurnCompletedAt);if(!Number.isFinite(u))continue;const d=i.get(s.sessionId);!d||u>d.at?i.set(s.sessionId,{slug:a.slug,at:u,unread:s.unread}):d.unread=s.unread}if(e.length>0){const a=new Set(e.map(s=>s.slug));for(const[s,u]of i)a.has(u.slug)||i.delete(s)}l(a=>a+1)},[e]),E.useEffect(()=>{const i=a=>{var d;const s=((d=a.detail)==null?void 0:d.sessionIds)??[];let u=!1;for(const c of s)u=r.current.delete(c)||u;u&&l(c=>c+1)};return window.addEventListener(as,i),()=>window.removeEventListener(as,i)},[]),E.useEffect(()=>{const i=new Map;return pu.onActiveInfos(a=>{for(const[s,u]of i)a.has(s)||r.current.set(s,{slug:u,at:Date.now()});i.clear();for(const[s,u]of a)i.set(s,u);n(new Map(a)),l(s=>s+1)})},[]),E.useEffect(()=>{const i=()=>l(a=>a+1);return window.addEventListener(is,i),()=>window.removeEventListener(is,i)},[]),E.useMemo(()=>{const i=new Map,a=s=>{let u=i.get(s);return u||(u={unread:0,inflight:0},i.set(s,u)),u};for(const[s,{slug:u,at:d,unread:c}]of r.current)!t.has(s)&&(c||d>p0(s))&&(a(u).unread+=1);for(const s of t.values())a(s).inflight+=1;return i},[t,o])}function t1(){const{projects:e,rootWorkspace:t,loading:n,upsert:r}=tp(),{dark:o,toggle:l}=o0(),[i,a]=E.useState(!1),[s,u]=E.useState(!1),d=ji(),c=tr(),p=rp(),w=i0(),x=Z0(K0),k=c.pathname==="/"||c.pathname==="/projects"||c.pathname.startsWith("/chat"),_=c.pathname.startsWith("/projects/")||k;E.useEffect(()=>{a(!1)},[c.pathname]),E.useEffect(()=>{document.title=p.name},[p.name]);const v=E.useMemo(()=>{const P=new Map;for(const M of e){const m=M.group??"",O=P.get(m);O?O.push(M):P.set(m,[M])}return u0(P.keys()).map(M=>[M,P.get(M)??[]])},[e]),h=E.useMemo(()=>t?[...e,t]:e,[e,t]),g=e1(h),C=g.get(cu),T=E.useMemo(()=>{let P=0;for(const M of g.values())P+=M.unread;return P},[g]);return f.jsxs("div",{className:"flex h-[100dvh] flex-col overflow-hidden bg-surface lg:flex-row",children:[!_&&f.jsxs("header",{className:"pt-safe flex items-center gap-2 border-b border-edge px-3 pb-2 lg:hidden",children:[f.jsx("button",{type:"button",onClick:()=>a(!0),"aria-label":"Open menu",className:"btn-subtle -ml-1 px-2 py-2",children:f.jsx(b0,{width:20,height:20})}),f.jsxs(An,{to:"/",className:"flex items-center gap-2",children:[f.jsx(fd,{brand:p,className:"h-7 w-7 text-sm"}),f.jsx("span",{className:"text-md font-semibold tracking-tight",children:p.name})]})]}),i&&f.jsx("div",{className:"fixed inset-0 z-30 bg-overlay backdrop-blur-sm lg:hidden","aria-hidden":"true",onClick:()=>a(!1)}),f.jsxs("aside",{style:x.style,className:`fixed inset-y-0 left-0 z-40 flex w-72 max-w-[85%] shrink-0 flex-col border-r border-edge bg-surface shadow-2xl transition-transform duration-200 ease-out lg:relative lg:z-auto lg:max-w-none lg:translate-x-0 lg:bg-surface-raised/50 lg:shadow-none ${i?"translate-x-0":"-translate-x-full"}`,children:[x.isDesktop&&f.jsx(q0,{spec:x.spec,width:x.width,onPreview:x.preview,onCommit:x.commit,onReset:x.reset,label:"Resize sidebar"}),f.jsxs("div",{className:"flex items-center gap-2 px-5 py-4",children:[f.jsxs(An,{to:"/",className:"group flex items-center gap-2",children:[f.jsx(fd,{brand:p,className:"h-8 w-8 text-base"}),f.jsx("span",{className:"text-lg font-semibold tracking-tight",children:p.name})]}),f.jsx("button",{type:"button",onClick:()=>a(!1),"aria-label":"Close menu",className:"btn-subtle ml-auto px-2 py-2 lg:hidden",children:f.jsx(sp,{width:18,height:18})})]}),f.jsx("div",{className:"px-3 pb-1",children:f.jsxs(An,{to:"/",end:!0,className:({isActive:P})=>`btn-subtle w-full justify-start ${P?"bg-surface-selected":""}`,title:"The root workspace — every project, and the instance's own chats",children:[f.jsx($0,{width:16,height:16}),"Home",f.jsx(up,{badge:C,className:"ml-auto"})]})}),f.jsxs("div",{className:"mt-5 mb-1 flex items-center justify-between pr-3",children:[f.jsx(An,{to:qy(),className:"section-label hover:text-accent",children:"Projects"}),f.jsx("button",{type:"button",onClick:()=>u(!0),"aria-label":"New Project",title:"New Project",className:"btn-subtle -mr-1 px-1.5 py-1 text-fg-subtle hover:text-accent",children:f.jsx(z0,{width:14,height:14})})]}),f.jsxs("nav",{className:"flex-1 overflow-y-auto px-2 pb-4",children:[n&&f.jsx("div",{className:"space-y-2 px-2 py-2",children:[0,1,2].map(P=>f.jsx("div",{className:"h-10 animate-pulse rounded-lg bg-surface-active"},P))}),!n&&e.length===0&&f.jsx("p",{className:"px-3 py-2 text-sm text-fg-muted",children:"No projects yet."}),!n&&e.length>0&&v.map(([P,M])=>f.jsxs("div",{className:"mb-2",children:[v.length>1&&f.jsx("div",{className:"px-2.5 pb-1 pt-2 text-3xs font-semibold uppercase tracking-wider text-fg-subtle",children:s0(P)}),M.map(m=>f.jsx(r1,{project:m,badge:g.get(m.slug)},m.slug))]},P||"unsorted"))]}),f.jsxs("div",{className:"border-t border-edge px-3 py-3",children:[f.jsxs(An,{to:"/config",className:({isActive:P})=>`btn-subtle w-full justify-start ${P?"bg-surface-selected":""}`,title:"Instance config — paddock.config.yaml (restart required)",children:[f.jsx(F0,{width:15,height:15}),"Config"]}),f.jsxs(An,{to:"/discover",className:({isActive:P})=>`btn-subtle mt-1 w-full justify-start ${P?"bg-surface-selected":""}`,title:"Find directories with existing Claude Code history to import",children:[f.jsx(U0,{width:15,height:15}),"Discover"]}),w.enabled&&f.jsxs("a",{href:w.path,target:"_blank",rel:"noreferrer",className:"btn-subtle mt-1 w-full justify-start",title:"OpenAPI / Swagger reference (opens in a new tab)",children:[f.jsx(V0,{width:15,height:15}),"Swagger API"]}),f.jsxs("button",{type:"button",onClick:l,className:"btn-subtle mt-1 w-full justify-start","aria-label":o?"Switch to light mode":"Switch to dark mode",title:"Toggle light / dark theme",children:[o?f.jsx(B0,{width:15,height:15}):f.jsx(W0,{width:15,height:15}),o?"Light mode":"Dark mode"]}),f.jsxs("p",{className:"mt-2 px-2 text-2xs text-fg-subtle",children:["v","0.70.0"]})]})]}),f.jsxs("div",{className:"flex min-w-0 flex-1 flex-col overflow-hidden",children:[f.jsx(O0,{unread:T}),f.jsx("main",{className:"min-h-0 min-w-0 flex-1 overflow-hidden",children:f.jsx(E.Suspense,{fallback:f.jsx(n1,{}),children:f.jsx(Ty,{context:{openNav:()=>a(!0)}})})})]}),f.jsx(Q0,{open:s,onClose:()=>u(!1),onCreated:P=>{r(P),u(!1),d(`/projects/${P.slug}/chat`)}})]})}function fd({brand:e,className:t=""}){return f.jsx("span",{className:`flex shrink-0 items-center justify-center overflow-hidden rounded-lg bg-accent-solid text-accent-fg shadow-sm ${t}`,children:a0(e.logo)?f.jsx("img",{src:e.logo,alt:"",className:"h-full w-full object-cover"}):e.logo})}function n1(){return f.jsxs("div",{className:"flex h-full items-center justify-center","aria-busy":"true","aria-live":"polite",children:[f.jsx("span",{className:"h-6 w-6 animate-spin rounded-full border-2 border-edge-strong border-t-accent"}),f.jsx("span",{className:"sr-only",children:"Loading…"})]})}function r1({project:e,badge:t}){return f.jsxs(An,{to:`/projects/${e.slug}`,className:({isActive:n})=>`group mb-0.5 flex flex-col gap-1 rounded-lg px-2.5 py-2 text-sm transition-colors ${n?"bg-surface-selected":"hover:bg-surface-hover"}`,children:[f.jsxs("span",{className:"flex items-center justify-between gap-2",children:[f.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[f.jsx(A0,{width:13,height:13,className:"shrink-0 text-fg-subtle group-hover:text-fg-muted"}),f.jsx("span",{className:"truncate font-medium",children:e.name})]}),f.jsx(up,{badge:t})]}),e.domain.length>0&&f.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden pl-[18px]",children:[e.domain.slice(0,2).map(n=>f.jsx(g0,{tag:n,className:"max-w-[7rem] truncate"},n)),e.domain.length>2&&f.jsxs("span",{className:"shrink-0 text-2xs text-fg-subtle",children:["+",e.domain.length-2]})]})]})}function up({badge:e,className:t=""}){const n=(e==null?void 0:e.unread)??0,r=(e==null?void 0:e.inflight)??0;return n===0&&r===0?null:f.jsxs("span",{className:`flex shrink-0 items-center gap-1.5 ${t}`,children:[r>0&&f.jsxs("span",{className:"flex items-center gap-1 text-2xs tabular text-fg-muted",title:`${r} chat${r===1?"":"s"} in flight`,"aria-label":`${r} chat${r===1?"":"s"} in flight`,children:[f.jsx("span",{"aria-hidden":"true",className:"h-2.5 w-2.5 spin-eco rounded-full border-[1.5px] border-edge-strong border-t-transparent"}),r]}),n>0&&f.jsx("span",{className:"inline-flex min-w-[1.1rem] items-center justify-center rounded-full bg-accent-solid px-1.5 py-0.5 text-2xs font-semibold leading-none tabular text-accent-fg",title:`${n} unread ${n===1?"reply":"replies"}`,"aria-label":`${n} unread ${n===1?"reply":"replies"}`,children:n})]})}const cp="paddock:chunkReloadAt",o1=1e4,hd=/dynamically imported module|module script|importing a module|failed to fetch|unable to preload|load failed|error loading/i;function l1(e){return e?e instanceof Error?e.name==="ChunkLoadError"?!0:hd.test(e.message):hd.test(String(e)):!1}function vu(){try{return typeof sessionStorage<"u"?sessionStorage:void 0}catch{return}}function i1(e=Date.now(),t=vu()){if(!t)return!1;const n=t.getItem(cp);if(!n)return!1;const r=Number(n);return Number.isFinite(r)&&e-r<o1}function a1(e=Date.now(),t=vu()){try{t==null||t.setItem(cp,String(e))}catch{}}function s1(e,t=Date.now(),n=vu()){return l1(e)&&!i1(t,n)?"reload":"show"}function u1(){const e=Xh(),t=s1(e);if(E.useEffect(()=>{t==="reload"&&(a1(),window.location.reload())},[t]),t==="reload")return f.jsxs("div",{className:"flex h-[100dvh] items-center justify-center bg-surface","aria-busy":"true","aria-live":"polite",children:[f.jsx("span",{className:"h-6 w-6 animate-spin rounded-full border-2 border-edge-strong border-t-accent"}),f.jsx("span",{className:"sr-only",children:"Updating…"})]});const n=e instanceof Error?e.message:typeof e=="string"?e:"";return f.jsxs("div",{className:"flex h-[100dvh] flex-col items-center justify-center gap-4 bg-surface px-6 text-center",children:[f.jsxs("div",{children:[f.jsx("h1",{className:"text-lg font-semibold tracking-tight",children:"Something went wrong"}),f.jsx("p",{className:"mt-1 max-w-md text-sm text-fg-muted",children:"The app hit an unexpected error. Reloading usually fixes it."}),n?f.jsx("p",{className:"mt-2 max-w-md break-words font-mono text-2xs text-fg-subtle",children:n}):null]}),f.jsx("button",{className:"btn-primary",onClick:()=>window.location.reload(),children:"Reload"})]})}function c1(){typeof navigator>"u"||!("serviceWorker"in navigator)||window.addEventListener("load",()=>{const e=navigator.serviceWorker,t=!!e.controller;let n=!1;e.addEventListener("controllerchange",()=>{n||!t||(n=!0,window.location.reload())}),e.register("/sw.js").catch(()=>{})})}const yu=e=>e<0?0:e>1?1:e;function wu(e){return e<=.0031308?12.92*e:1.055*Math.pow(e,1/2.4)-.055}function Mt(e){return e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function xu({L:e,a:t,b:n}){const r=(e+.3963377774*t+.2158037573*n)**3,o=(e-.1055613458*t-.0638541728*n)**3,l=(e-.0894841775*t-1.291485548*n)**3;return[4.0767416621*r-3.3077115913*o+.2309699292*l,-1.2684380046*r+2.6097574011*o-.3413193965*l,-.0041960863*r-.7034186147*o+1.707614701*l]}function us(e,t,n){const r=Math.cbrt(.4122214708*e+.5363325363*t+.0514459929*n),o=Math.cbrt(.2119034982*e+.6806995451*t+.1073969566*n),l=Math.cbrt(.0883024619*e+.2817188376*t+.6299787005*n);return{L:.2104542553*r+.793617785*o-.0040720468*l,a:1.9779984951*r-2.428592205*o+.4505937099*l,b:.0259040371*r+.7827717662*o-.808675766*l}}function Fo(e,t,n,r=1){const o=n*Math.PI/180,l=xu({L:e,a:t*Math.cos(o),b:t*Math.sin(o)}),[i,a,s]=l.map(u=>yu(wu(u)));return{r:i,g:a,b:s,a:r}}function pd(e,t,n){const r=n*Math.PI/180;return xu({L:e,a:t*Math.cos(r),b:t*Math.sin(r)}).map(wu).every(o=>o>=-.0015&&o<=1.0015)}function pn({r:e,g:t,b:n}){const r=o=>Math.round(yu(o)*255).toString(16).padStart(2,"0");return`#${r(e)}${r(t)}${r(n)}`}function Ze({r:e,g:t,b:n}){const[r,o,l]=[e,t,n].map(Mt);return .2126*r+.7152*o+.0722*l}function d1(e,t){if(e.a>=1)return e;const n=e.a;return{r:e.r*n+t.r*(1-n),g:e.g*n+t.g*(1-n),b:e.b*n+t.b*(1-n),a:1}}function Qe(e,t){const n=Ze(d1(e,t)),r=Ze(t),[o,l]=n>r?[n,r]:[r,n];return(o+.05)/(l+.05)}const md={white:{r:1,g:1,b:1,a:1},black:{r:0,g:0,b:0,a:1},transparent:{r:0,g:0,b:0,a:0}};function aa(e){const t=[];let n=0,r="";for(const o of e)o==="("?n++:o===")"&&n--,o===","&&n===0?(t.push(r.trim()),r=""):r+=o;return r.trim()&&t.push(r.trim()),t}function ir(e,t){return!e.startsWith(`${t}(`)||!e.endsWith(")")?null:e.slice(t.length+1,-1)}function cn(e){const t=e.endsWith("%")?Number(e.slice(0,-1))/100:Number(e);if(!Number.isFinite(t))throw new Error(`not a number: ${e}`);return t}function Sr(e,t,n=0){if(n>24)throw new Error(`var() cycle resolving ${e}`);const r=e.trim();if(md[r])return md[r];if(r.startsWith("#")){let s=r.slice(1);if(s.length===3&&(s=[...s].map(d=>d+d).join("")),s.length!==6)throw new Error(`bad hex: ${r}`);const u=parseInt(s,16);return{r:(u>>16&255)/255,g:(u>>8&255)/255,b:(u&255)/255,a:1}}const o=ir(r,"var");if(o!==null){const[s,...u]=aa(o),d=t[s]??u.join(",");if(!d)throw new Error(`undefined custom property: ${s}`);return Sr(d,t,n+1)}const l=ir(r,"oklch");if(l!==null){const[s,u]=l.split("/"),d=s.trim().split(/\s+/);if(d.length!==3)throw new Error(`bad oklch(): ${r}`);return Fo(cn(d[0]),cn(d[1]),cn(d[2]),u?cn(u.trim()):1)}const i=ir(r,"rgb")??ir(r,"rgba");if(i!==null){const s=i.trim(),u=ir(s,"var");if(u!==null){const[w]=aa(u),x=t[w];if(!x)throw new Error(`undefined custom property: ${w}`);return Sr(`rgb(${x})`,t,n+1)}const[d,c]=s.split("/"),p=d.trim().split(/[\s,]+/);if(p.length<3)throw new Error(`bad rgb(): ${r}`);return{r:cn(p[0])/255,g:cn(p[1])/255,b:cn(p[2])/255,a:c?cn(c.trim()):1}}const a=ir(r,"color-mix");if(a!==null){const[s,u,d]=aa(a),c=s.trim();if(c!=="in oklab"&&c!=="in srgb")throw new Error(`only \`in oklab\` and \`in srgb\` color-mix are supported, got: ${s}`);const p=gd(u),w=gd(d);let x=p.pct,k=w.pct;x===null&&k===null?(x=.5,k=.5):x===null?x=1-k:k===null&&(k=1-x);const _=x+k,v=x/_,h=Sr(p.color,t,n+1),g=Sr(w.color,t,n+1);return c==="in srgb"?f1(h,g,v):h1(h,g,v)}throw new Error(`unsupported colour value: ${r}`)}function gd(e){const t=/\s+(-?[\d.]+)%$/.exec(e.trim());return t?{color:e.trim().slice(0,t.index).trim(),pct:Number(t[1])/100}:{color:e.trim(),pct:null}}function f1(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 h1(e,t,n){const r=us(Mt(e.r),Mt(e.g),Mt(e.b)),o=us(Mt(t.r),Mt(t.g),Mt(t.b)),l={L:r.L*n+o.L*(1-n),a:r.a*n+o.a*(1-n),b:r.b*n+o.b*(1-n)},[i,a,s]=xu(l).map(u=>yu(wu(u)));return{r:i,g:a,b:s,a:e.a*n+t.a*(1-n)}}function Tn({r:e,g:t,b:n}){const{L:r,a:o,b:l}=us(Mt(e),Mt(t),Mt(n)),i=Math.hypot(o,l),a=i<1e-6?0:(Math.atan2(l,o)*180/Math.PI+360)%360;return{L:r,C:i,H:a}}const Lt=4.5,dp=3,jt=.12,fp=["--accent","--accent-600","--accent-700","--accent-solid","--accent-solid-hover","--accent-text"];function pt(e,t){const n=getComputedStyle(e).getPropertyValue(t).trim();if(!n)return null;const r=/^\d+(\.\d+)?( \d+(\.\d+)?){2}$/.test(n)?`rgb(${n})`:n;try{return Sr(r,{})}catch{return null}}function p1(e,t,n){let r=0,o=1;for(let l=0;l<32;l++){const i=(r+o)/2;Ze(Fo(i,t,n))<e?r=i:o=i}return(r+o)/2}function hp(e,t,n){if(pd(e,t,n))return t;let r=0,o=t;for(let l=0;l<24;l++){const i=(r+o)/2;pd(e,i,n)?r=i:o=i}return r}function sa(e,t,n,r,o){const l=Ze(r);let i=t,a=.5;for(let s=0;s<4;s++){const u=p1(l,i,n);let d=o?0:u,c=o?u:1;for(let p=0;p<28;p++){const w=(d+c)/2,x=Qe(Fo(w,i,n),r)>=e;o?x?d=w:c=w:x?c=w:d=w}a=o?d:c,i=hp(a,t,n)}return{L:a,C:i,rgb:Fo(a,i,n)}}const m1=.75;function _r(e,t,n,r,o,l=e){const i=sa(e,t,n,r,o),a=c=>c.C>=t*m1;if(a(i)||l>=e)return{...i,hit:Qe(i.rgb,r)>=e-.01};let s=l,u=e,d=sa(l,t,n,r,o);for(let c=0;c<16;c++){const p=(s+u)/2,w=sa(p,t,n,r,o);a(w)?(d=w,s=p):u=p}return{...d,hit:Qe(d.rgb,r)>=l-.01}}function ua({r:e,g:t,b:n}){const r=o=>Math.round(Math.max(0,Math.min(1,o))*255);return`${r(e)} ${r(t)} ${r(n)}`}const pp=["--surface","--surface-raised","--surface-sunken","--surface-hover","--surface-active","--surface-selected","--border-subtle","--border","--border-strong","--text","--text-muted","--text-subtle","--scroll-thumb"],vd=["--text","--text-muted","--text-subtle"],g1=["--surface","--surface-raised","--surface-sunken","--surface-hover","--surface-active","--surface-selected"];function mp(e=document.documentElement){for(const t of pp)e.style.removeProperty(t)}function v1(e,t,n=document.documentElement){mp(n);for(const o of pp){const l=pt(n,o);if(!l)continue;const{L:i,C:a}=Tn(l),s=vd.includes(o),u=Math.max(a,t*(s?.5:1));n.style.setProperty(o,pn(Fo(i,hp(i,u,e),e)))}let r=1/0;for(const o of vd){const l=pt(n,o);if(l)for(const i of g1){const a=pt(n,i);a&&(r=Math.min(r,Qe(l,a)))}}return r}function gp(e=document.documentElement){for(const t of fp)e.style.removeProperty(t)}function vp(e,t){const n=fp.map(r=>[r,e.style.getPropertyValue(r)]);gp(e);try{return t()}finally{for(const[r,o]of n)o&&e.style.setProperty(r,o)}}function y1(e=document.documentElement){return vp(e,()=>{const t=pt(e,"--accent");return t?Tn(t).H:0})}const ro={r:1,g:1,b:1,a:1};function yp(e=document.documentElement){return vp(e,()=>w1(e))}function w1(e){const t={accent:pt(e,"--accent")??ro,a600:pt(e,"--accent-600")??ro,a700:pt(e,"--accent-700")??ro},n=pt(e,"--accent-fg")??ro,r=pt(e,"--surface")??ro,o=["--surface","--surface-raised","--surface-sunken"].map(a=>pt(e,a)).filter(a=>a!==null),l=o.length?o:[r],i=l.reduce((a,s)=>Qe(t.a700,a)<Qe(t.a700,s)?a:s);return{fg:n,surface:r,surfaces:l,targets:{accent:Math.max(Qe(t.accent,r),dp+jt),a600:Math.max(Qe(t.a600,n),Lt+jt),a700:Math.max(l.reduce((a,s)=>Math.min(a,Qe(t.a700,s)),1/0),Lt+jt)},chroma:{accent:Tn(t.accent).C,a600:Tn(t.a600).C,a700:Tn(t.a700).C},darker:{accent:Ze(t.accent)<Ze(r),a600:Ze(n)>Ze(t.a600),a700:Ze(t.a700)<Ze(i)},a700Bg:i}}function x1(e,t){const n=Lt+jt;return{accent:_r(e.targets.accent,e.chroma.accent,t,e.surface,e.darker.accent,dp+jt),a600:_r(e.targets.a600,e.chroma.a600,t,e.fg,e.darker.a600,n),a700:_r(e.targets.a700,e.chroma.a700,t,e.a700Bg,e.darker.a700,n)}}function Uw(e,t=document.documentElement){const n=yp(t);return e.map(r=>pn(_r(n.targets.a600,n.chroma.a600,r,n.fg,n.darker.a600,Lt+jt).rgb))}function S1(e,t=document.documentElement,n={}){const r=t.classList.contains("dark")?"dark":"light",o=n.context??yp(t),l=x1(o,e),{a600:i,a700:a,accent:s}=l,u={C:o.chroma.a700};gp(t),t.style.setProperty("--accent",ua(s.rgb)),t.style.setProperty("--accent-600",ua(i.rgb)),t.style.setProperty("--accent-700",ua(a.rgb));const d={};for(const g of["--accent-fg","--accent-solid","--accent-solid-hover","--accent-text","--surface","--surface-raised","--surface-sunken","--accent-soft"])d[g]=pt(t,g);const c=[],p=d["--accent-fg"]??o.fg,w=(g,C,T)=>{const P=d[g];if(!P)return 1/0;let M=Qe(P,p),m=!1;if(M<T+jt){const{C:O}=Tn(P),L=_r(T+jt,Math.max(O,o.chroma.a600),e,p,Ze(P)<Ze(p),Lt+jt);t.style.setProperty(g,pn(L.rgb)),M=Qe(L.rgb,p),m=!0}return c.push({label:C,fg:"--accent-fg",bg:g,ratio:M,floor:T,repaired:m}),M},x=w("--accent-solid","Primary button",Lt);w("--accent-solid-hover","Primary button, hovered",Math.min(x+.6,12));const k=[];for(const g of["--surface","--surface-raised","--surface-sunken","--accent-soft"]){const C=d[g];C&&k.push({name:g,c:C})}let _=1/0;const v=d["--accent-text"];if(v&&k.length){const g=k.reduce((T,P)=>Qe(v,T.c)<Qe(v,P.c)?T:P,k[0]);_=Qe(v,g.c);let C=!1;if(_<Lt+jt){const{C:T}=Tn(v),P=_r(Lt+jt,T||u.C,e,g.c,Ze(v)<Ze(g.c));t.style.setProperty("--accent-text",pn(P.rgb)),_=k.reduce((M,m)=>Math.min(M,Qe(P.rgb,m.c)),1/0),C=!0}c.push({label:"Accent text",fg:"--accent-text",bg:g.name,ratio:_,floor:Lt,repaired:C})}const h={};if(!n.live)for(const g of["--accent-solid","--accent-solid-hover","--accent-text"]){const C=pt(t,g);C&&(h[g]=pn(C))}return{hue:e,mode:r,channels:{accent:pn(s.rgb),accent600:pn(i.rgb),accent700:pn(a.rgb)},applied:h,checks:c,ok:c.every(g=>g.ratio>=g.floor-.005)&&x>=Lt}}const k1=[{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."}],Aw=[{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}],Fw=[{level:0,label:"None"},{level:1,label:"A little"},{level:2,label:"More"}];function E1(e=document.documentElement){const t=rp().accent;if(t&&t.toLowerCase()!==np.accent.toLowerCase())try{return Tn(Sr(t,{})).H}catch{}return y1(e)}const yd={theme:"foundation",hue:null,tint:0},wp="paddock:appearance",wd="paddock:appearance-cache";function C1(){try{const e=localStorage.getItem(wp);if(!e)return yd;const t=JSON.parse(e);return{theme:k1.some(n=>n.id===t.theme)?t.theme:"foundation",hue:typeof t.hue=="number"?(t.hue%360+360)%360:null,tint:t.tint===1||t.tint===2?t.tint:0}}catch{return yd}}function j1(e){try{localStorage.setItem(wp,JSON.stringify(e))}catch{}}function P1(e,t,n){try{const r=JSON.parse(localStorage.getItem(wd)||"{}"),o=`${e}:${t?"dark":"light"}`;n?r[o]={...n.applied,"--accent":n.channels.accent}:delete r[o],localStorage.setItem(wd,JSON.stringify(r))}catch{}}function N1(e,t=document.documentElement){t.setAttribute("data-theme",e.theme);const n=e.hue??E1(t);let r=null;e.tint===0?mp(t):r=v1(n,M1[e.tint],t);const o=S1(n,t);return o&&r!==null&&(o.checks.push({label:"Body text on the tinted ground",fg:"--text-*",bg:"--surface-*",ratio:r,floor:4.5,repaired:!1}),o.ok=o.ok&&r>=4.5),P1(e.theme,t.classList.contains("dark"),o),o}function T1(e,t){j1(e);const n=N1(e,t);return window.dispatchEvent(new CustomEvent(_1,{detail:n})),n}const _1="paddock:appearance";function R1(){const e=()=>T1(C1());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 M1=[0,.008,.018],xp=E.lazy(()=>Kt(()=>import("./ProjectsGrid-DKvySDUQ.js"),__vite__mapDeps([0,1])).then(e=>({default:e.ProjectsGrid}))),Pe=E.lazy(()=>Kt(()=>import("./ProjectView-iuiUIoIl.js").then(e=>e.a),__vite__mapDeps([2,1,3,4,5])).then(e=>({default:e.ProjectView}))),L1=E.lazy(()=>Kt(()=>import("./ProjectRedirect-bstvMvM9.js"),__vite__mapDeps([6,5])).then(e=>({default:e.ProjectRedirect}))),I1=E.lazy(()=>Kt(()=>import("./InstanceConfigPage-B1ei1FDo.js"),__vite__mapDeps([7,4,8])).then(e=>({default:e.InstanceConfigPage}))),D1=E.lazy(()=>Kt(()=>import("./DiscoverPage-C1khyCvD.js"),__vite__mapDeps([9,10,4,8])).then(e=>({default:e.DiscoverPage}))),O1=E.lazy(()=>Kt(()=>import("./RootHome-CD_37qb-.js"),__vite__mapDeps([11,10,4,8,2,1,3,5])).then(e=>({default:e.RootHome})));R1();const Sp=()=>document.documentElement.setAttribute("data-tab-hidden",document.hidden?"true":"false");document.addEventListener("visibilitychange",Sp);Sp();function z1(){const{tag:e}=gy();return f.jsx(xp,{filterTag:e?decodeURIComponent(e):void 0})}const $1=zy([{path:"/",element:f.jsx(t1,{}),errorElement:f.jsx(u1,{}),children:[{index:!0,element:f.jsx(O1,{})},{path:"projects",element:f.jsx(xp,{})},{path:"tags/:tag",element:f.jsx(z1,{})},{path:"projects/:slug",element:f.jsx(L1,{})},{path:"projects/:slug/home",element:f.jsx(Pe,{})},{path:"projects/:slug/chat",element:f.jsx(Pe,{})},{path:"projects/:slug/chat/:sessionId",element:f.jsx(Pe,{})},{path:"projects/:slug/files",element:f.jsx(Pe,{})},{path:"projects/:slug/files/*",element:f.jsx(Pe,{})},{path:"projects/:slug/changes",element:f.jsx(Pe,{})},{path:"projects/:slug/changes/:file",element:f.jsx(Pe,{})},{path:"projects/:slug/history",element:f.jsx(Pe,{})},{path:"projects/:slug/settings",element:f.jsx(Pe,{})},{path:"projects/:slug/triggers",element:f.jsx(Pe,{})},{path:"projects/:slug/hooks",element:f.jsx(Pe,{})},{path:"chat",element:f.jsx(Pe,{root:!0})},{path:"chat/:sessionId",element:f.jsx(Pe,{root:!0})},{path:"files",element:f.jsx(Pe,{root:!0})},{path:"files/*",element:f.jsx(Pe,{root:!0})},{path:"changes",element:f.jsx(Pe,{root:!0})},{path:"changes/:file",element:f.jsx(Pe,{root:!0})},{path:"history",element:f.jsx(Pe,{root:!0})},{path:"triggers",element:f.jsx(Pe,{root:!0})},{path:"settings",element:f.jsx(Pe,{root:!0})},{path:"config",element:f.jsx(I1,{})},{path:"discover",element:f.jsx(D1,{})}]}]);ca.createRoot(document.getElementById("root")).render(f.jsx(Ld.StrictMode,{children:f.jsx(t0,{children:f.jsx(Vy,{router:$1})})}));c1();export{ww as $,_1 as A,_w as B,uw as C,vw as D,U0 as E,Nw as F,Ao as G,A1 as H,F0 as I,A0 as J,Lw as K,Uo as L,b0 as M,Q0 as N,Dw as O,z0 as P,kw as Q,cu as R,yw as S,g0 as T,Cw as U,Ew as V,U1 as W,sp as X,pw as Y,hw as Z,jw as _,ji as a,V0 as a0,fw as a1,q1 as a2,ew as a3,rw as a4,nw as a5,tw as a6,ow as a7,iw as a8,lw as a9,Q1 as aA,K1 as aB,m0 as aC,p0 as aD,tr as aE,B1 as aF,W1 as aG,Z0 as aH,b1 as aI,Zy as aJ,G1 as aK,V1 as aL,$w as aM,S0 as aa,cw as ab,w0 as ac,la as ad,X1 as ae,Kt as af,ou as ag,aw as ah,Z1 as ai,gw as aj,pu as ak,sw as al,Mw as am,Iw as an,Pw as ao,hu as ap,du as aq,xw as ar,J1 as as,dw as at,q0 as au,Y1 as av,Rw as aw,Ow as ax,Tw as ay,zw as az,fu as b,Sw as c,y0 as d,H1 as e,s0 as f,qy as g,mw as h,gy as i,f as j,F1 as k,ap as l,Sd as m,C1 as n,u0 as o,Uw as p,k1 as q,E as r,T1 as s,Aw as t,tp as u,Fw as v,gp as w,S1 as x,yp as y,ss as z};
|
|
71
71
|
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{_ as a,l as s,L as o,e as i}from"./mermaid.core-
|
|
1
|
+
import{_ as a,l as s,L as o,e as i}from"./mermaid.core-BZDABcuq.js";import{p as g}from"./wardley-L42UT6IY-DNaNoaJm.js";import"./index-BeuEs7dL.js";var p={parse:a(async r=>{const e=await g("info",r);s.debug(e)},"parse")},v={version:"11.15.0"},d=a(()=>v.version,"getVersion"),m={getVersion:d},c=a((r,e,n)=>{s.debug(`rendering info diagram
|
|
2
2
|
`+r);const t=o(e);i(t,100,400,!0),t.append("g").append("text").attr("x",100).attr("y",40).attr("class","version").attr("font-size",32).style("text-anchor","middle").text(`v${n}`)},"draw"),l={draw:c},b={parser:p,db:m,renderer:l};export{b as diagram};
|
|
3
3
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{_ as o,c as ot,a4 as ut,L as dt,al as yt,A as ft,k as pt,q as it,a as gt,b as kt,g as mt,s as wt,t as _t,e as bt}from"./mermaid.core-
|
|
1
|
+
import{_ as o,c as ot,a4 as ut,L as dt,al as yt,A as ft,k as pt,q as it,a as gt,b as kt,g as mt,s as wt,t as _t,e as bt}from"./mermaid.core-BZDABcuq.js";import"./index-BeuEs7dL.js";var tt=function(){var e=o(function(M,t,s,i){for(s=s||{},i=M.length;i--;s[M[i]]=t);return s},"o"),h=[1,4],r=[1,14],a=[1,12],l=[1,13],y=[6,7,8],f=[1,20],d=[1,18],m=[1,19],c=[6,7,11],k=[1,6,13,14],g=[1,23],_=[1,24],x=[1,6,7,11,13,14],N={trace:o(function(){},"trace"),yy:{},symbols_:{error:2,start:3,ishikawa:4,spaceLines:5,SPACELINE:6,NL:7,ISHIKAWA:8,document:9,stop:10,EOF:11,statement:12,SPACELIST:13,TEXT:14,$accept:0,$end:1},terminals_:{2:"error",6:"SPACELINE",7:"NL",8:"ISHIKAWA",11:"EOF",13:"SPACELIST",14:"TEXT"},productions_:[0,[3,1],[3,2],[5,1],[5,2],[5,2],[4,2],[4,3],[10,1],[10,1],[10,1],[10,2],[10,2],[9,3],[9,2],[12,2],[12,1],[12,1],[12,1]],performAction:o(function(t,s,i,u,p,n,v){var w=n.length-1;switch(p){case 6:case 7:return u;case 15:u.addNode(n[w-1].length,n[w].trim());break;case 16:u.addNode(0,n[w].trim());break}},"anonymous"),table:[{3:1,4:2,5:3,6:[1,5],8:h},{1:[3]},{1:[2,1]},{4:6,6:[1,7],7:[1,8],8:h},{6:r,7:[1,10],9:9,12:11,13:a,14:l},e(y,[2,3]),{1:[2,2]},e(y,[2,4]),e(y,[2,5]),{1:[2,6],6:r,12:15,13:a,14:l},{6:r,9:16,12:11,13:a,14:l},{6:f,7:d,10:17,11:m},e(c,[2,18],{14:[1,21]}),e(c,[2,16]),e(c,[2,17]),{6:f,7:d,10:22,11:m},{1:[2,7],6:r,12:15,13:a,14:l},e(k,[2,14],{7:g,11:_}),e(x,[2,8]),e(x,[2,9]),e(x,[2,10]),e(c,[2,15]),e(k,[2,13],{7:g,11:_}),e(x,[2,11]),e(x,[2,12])],defaultActions:{2:[2,1],6:[2,2]},parseError:o(function(t,s){if(s.recoverable)this.trace(t);else{var i=new Error(t);throw i.hash=s,i}},"parseError"),parse:o(function(t){var s=this,i=[0],u=[],p=[null],n=[],v=this.table,w="",I=0,S=0,L=2,E=1,R=n.slice.call(arguments,1),b=Object.create(this.lexer),C={yy:{}};for(var F in this.yy)Object.prototype.hasOwnProperty.call(this.yy,F)&&(C.yy[F]=this.yy[F]);b.setInput(t,C.yy),C.yy.lexer=b,C.yy.parser=this,typeof b.yylloc>"u"&&(b.yylloc={});var T=b.yylloc;n.push(T);var D=b.options&&b.options.ranges;typeof C.yy.parseError=="function"?this.parseError=C.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function j(P){i.length=i.length-2*P,p.length=p.length-P,n.length=n.length-P}o(j,"popStack");function z(){var P;return P=u.pop()||b.lex()||E,typeof P!="number"&&(P instanceof Array&&(u=P,P=u.pop()),P=s.symbols_[P]||P),P}o(z,"lex");for(var A,W,B,K,H={},X,V,et,Y;;){if(W=i[i.length-1],this.defaultActions[W]?B=this.defaultActions[W]:((A===null||typeof A>"u")&&(A=z()),B=v[W]&&v[W][A]),typeof B>"u"||!B.length||!B[0]){var Q="";Y=[];for(X in v[W])this.terminals_[X]&&X>L&&Y.push("'"+this.terminals_[X]+"'");b.showPosition?Q="Parse error on line "+(I+1)+`:
|
|
2
2
|
`+b.showPosition()+`
|
|
3
3
|
Expecting `+Y.join(", ")+", got '"+(this.terminals_[A]||A)+"'":Q="Parse error on line "+(I+1)+": Unexpected "+(A==E?"end of input":"'"+(this.terminals_[A]||A)+"'"),this.parseError(Q,{text:b.match,token:this.terminals_[A]||A,line:b.yylineno,loc:T,expected:Y})}if(B[0]instanceof Array&&B.length>1)throw new Error("Parse Error: multiple actions possible at state: "+W+", token: "+A);switch(B[0]){case 1:i.push(A),p.push(b.yytext),n.push(b.yylloc),i.push(B[1]),A=null,S=b.yyleng,w=b.yytext,I=b.yylineno,T=b.yylloc;break;case 2:if(V=this.productions_[B[1]][1],H.$=p[p.length-V],H._$={first_line:n[n.length-(V||1)].first_line,last_line:n[n.length-1].last_line,first_column:n[n.length-(V||1)].first_column,last_column:n[n.length-1].last_column},D&&(H._$.range=[n[n.length-(V||1)].range[0],n[n.length-1].range[1]]),K=this.performAction.apply(H,[w,S,I,C.yy,B[1],p,n].concat(R)),typeof K<"u")return K;V&&(i=i.slice(0,-1*V*2),p=p.slice(0,-1*V),n=n.slice(0,-1*V)),i.push(this.productions_[B[1]][0]),p.push(H.$),n.push(H._$),et=v[i[i.length-2]][i[i.length-1]],i.push(et);break;case 3:return!0}}return!0},"parse")},O=function(){var M={EOF:1,parseError:o(function(s,i){if(this.yy.parser)this.yy.parser.parseError(s,i);else throw new Error(s)},"parseError"),setInput:o(function(t,s){return this.yy=s||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:o(function(){var t=this._input[0];this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t;var s=t.match(/(?:\r\n?|\n).*/g);return s?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},"input"),unput:o(function(t){var s=t.length,i=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-s),this.offset-=s;var u=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),i.length-1&&(this.yylineno-=i.length-1);var p=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:i?(i.length===u.length?this.yylloc.first_column:0)+u[u.length-i.length].length-i[0].length:this.yylloc.first_column-s},this.options.ranges&&(this.yylloc.range=[p[0],p[0]+this.yyleng-s]),this.yyleng=this.yytext.length,this},"unput"),more:o(function(){return this._more=!0,this},"more"),reject:o(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
|
|
4
4
|
`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:o(function(t){this.unput(this.match.slice(t))},"less"),pastInput:o(function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:o(function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:o(function(){var t=this.pastInput(),s=new Array(t.length+1).join("-");return t+this.upcomingInput()+`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{g as gt}from"./chunk-FMBD7UC4-
|
|
1
|
+
import{g as gt}from"./chunk-FMBD7UC4-lb_8q4JY.js";import{a as mt,g as lt,h as xt,d as kt}from"./chunk-ND2GUHAM-DOwgGlQ_.js";import{g as _t,s as vt,a as bt,b as wt,t as Tt,q as St,_ as s,c as R,d as G,e as $t,A as Mt}from"./mermaid.core-BZDABcuq.js";import{d as it}from"./arc-BJPb3ViJ.js";import"./index-BeuEs7dL.js";var U=function(){var t=s(function(h,r,n,l){for(n=n||{},l=h.length;l--;n[h[l]]=r);return n},"o"),e=[6,8,10,11,12,14,16,17,18],a=[1,9],f=[1,10],i=[1,11],u=[1,12],p=[1,13],o=[1,14],g={trace:s(function(){},"trace"),yy:{},symbols_:{error:2,start:3,journey:4,document:5,EOF:6,line:7,SPACE:8,statement:9,NEWLINE:10,title:11,acc_title:12,acc_title_value:13,acc_descr:14,acc_descr_value:15,acc_descr_multiline_value:16,section:17,taskName:18,taskData:19,$accept:0,$end:1},terminals_:{2:"error",4:"journey",6:"EOF",8:"SPACE",10:"NEWLINE",11:"title",12:"acc_title",13:"acc_title_value",14:"acc_descr",15:"acc_descr_value",16:"acc_descr_multiline_value",17:"section",18:"taskName",19:"taskData"},productions_:[0,[3,3],[5,0],[5,2],[7,2],[7,1],[7,1],[7,1],[9,1],[9,2],[9,2],[9,1],[9,1],[9,2]],performAction:s(function(r,n,l,y,d,c,v){var k=c.length-1;switch(d){case 1:return c[k-1];case 2:this.$=[];break;case 3:c[k-1].push(c[k]),this.$=c[k-1];break;case 4:case 5:this.$=c[k];break;case 6:case 7:this.$=[];break;case 8:y.setDiagramTitle(c[k].substr(6)),this.$=c[k].substr(6);break;case 9:this.$=c[k].trim(),y.setAccTitle(this.$);break;case 10:case 11:this.$=c[k].trim(),y.setAccDescription(this.$);break;case 12:y.addSection(c[k].substr(8)),this.$=c[k].substr(8);break;case 13:y.addTask(c[k-1],c[k]),this.$="task";break}},"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},t(e,[2,2],{5:3}),{6:[1,4],7:5,8:[1,6],9:7,10:[1,8],11:a,12:f,14:i,16:u,17:p,18:o},t(e,[2,7],{1:[2,1]}),t(e,[2,3]),{9:15,11:a,12:f,14:i,16:u,17:p,18:o},t(e,[2,5]),t(e,[2,6]),t(e,[2,8]),{13:[1,16]},{15:[1,17]},t(e,[2,11]),t(e,[2,12]),{19:[1,18]},t(e,[2,4]),t(e,[2,9]),t(e,[2,10]),t(e,[2,13])],defaultActions:{},parseError:s(function(r,n){if(n.recoverable)this.trace(r);else{var l=new Error(r);throw l.hash=n,l}},"parseError"),parse:s(function(r){var n=this,l=[0],y=[],d=[null],c=[],v=this.table,k="",C=0,Q=0,yt=2,D=1,dt=c.slice.call(arguments,1),_=Object.create(this.lexer),I={yy:{}};for(var O in this.yy)Object.prototype.hasOwnProperty.call(this.yy,O)&&(I.yy[O]=this.yy[O]);_.setInput(r,I.yy),I.yy.lexer=_,I.yy.parser=this,typeof _.yylloc>"u"&&(_.yylloc={});var Y=_.yylloc;c.push(Y);var ft=_.options&&_.options.ranges;typeof I.yy.parseError=="function"?this.parseError=I.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function pt(w){l.length=l.length-2*w,d.length=d.length-w,c.length=c.length-w}s(pt,"popStack");function tt(){var w;return w=y.pop()||_.lex()||D,typeof w!="number"&&(w instanceof Array&&(y=w,w=y.pop()),w=n.symbols_[w]||w),w}s(tt,"lex");for(var b,A,T,q,F={},N,M,et,z;;){if(A=l[l.length-1],this.defaultActions[A]?T=this.defaultActions[A]:((b===null||typeof b>"u")&&(b=tt()),T=v[A]&&v[A][b]),typeof T>"u"||!T.length||!T[0]){var X="";z=[];for(N in v[A])this.terminals_[N]&&N>yt&&z.push("'"+this.terminals_[N]+"'");_.showPosition?X="Parse error on line "+(C+1)+`:
|
|
2
2
|
`+_.showPosition()+`
|
|
3
3
|
Expecting `+z.join(", ")+", got '"+(this.terminals_[b]||b)+"'":X="Parse error on line "+(C+1)+": Unexpected "+(b==D?"end of input":"'"+(this.terminals_[b]||b)+"'"),this.parseError(X,{text:_.match,token:this.terminals_[b]||b,line:_.yylineno,loc:Y,expected:z})}if(T[0]instanceof Array&&T.length>1)throw new Error("Parse Error: multiple actions possible at state: "+A+", token: "+b);switch(T[0]){case 1:l.push(b),d.push(_.yytext),c.push(_.yylloc),l.push(T[1]),b=null,Q=_.yyleng,k=_.yytext,C=_.yylineno,Y=_.yylloc;break;case 2:if(M=this.productions_[T[1]][1],F.$=d[d.length-M],F._$={first_line:c[c.length-(M||1)].first_line,last_line:c[c.length-1].last_line,first_column:c[c.length-(M||1)].first_column,last_column:c[c.length-1].last_column},ft&&(F._$.range=[c[c.length-(M||1)].range[0],c[c.length-1].range[1]]),q=this.performAction.apply(F,[k,Q,C,I.yy,T[1],d,c].concat(dt)),typeof q<"u")return q;M&&(l=l.slice(0,-1*M*2),d=d.slice(0,-1*M),c=c.slice(0,-1*M)),l.push(this.productions_[T[1]][0]),d.push(F.$),c.push(F._$),et=v[l[l.length-2]][l[l.length-1]],l.push(et);break;case 3:return!0}}return!0},"parse")},m=function(){var h={EOF:1,parseError:s(function(n,l){if(this.yy.parser)this.yy.parser.parseError(n,l);else throw new Error(n)},"parseError"),setInput:s(function(r,n){return this.yy=n||this.yy||{},this._input=r,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:s(function(){var r=this._input[0];this.yytext+=r,this.yyleng++,this.offset++,this.match+=r,this.matched+=r;var n=r.match(/(?:\r\n?|\n).*/g);return n?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),r},"input"),unput:s(function(r){var n=r.length,l=r.split(/(?:\r\n?|\n)/g);this._input=r+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-n),this.offset-=n;var y=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),l.length-1&&(this.yylineno-=l.length-1);var d=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:l?(l.length===y.length?this.yylloc.first_column:0)+y[y.length-l.length].length-l[0].length:this.yylloc.first_column-n},this.options.ranges&&(this.yylloc.range=[d[0],d[0]+this.yyleng-n]),this.yyleng=this.yytext.length,this},"unput"),more:s(function(){return this._more=!0,this},"more"),reject:s(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
|
|
4
4
|
`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:s(function(r){this.unput(this.match.slice(r))},"less"),pastInput:s(function(){var r=this.matched.substr(0,this.matched.length-this.match.length);return(r.length>20?"...":"")+r.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:s(function(){var r=this.match;return r.length<20&&(r+=this._input.substr(0,20-r.length)),(r.substr(0,20)+(r.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:s(function(){var r=this.pastInput(),n=new Array(r.length+1).join("-");return r+this.upcomingInput()+`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{_ as c,l as te,c as W,L as fe,ah as ye,ai as be,aj as me,af as _e,I as Y,i as G,v as ke,J as Ee,ac as Se,ad as le,ae as ce}from"./mermaid.core-
|
|
1
|
+
import{_ as c,l as te,c as W,L as fe,ah as ye,ai as be,aj as me,af as _e,I as Y,i as G,v as ke,J as Ee,ac as Se,ad as le,ae as ce}from"./mermaid.core-BZDABcuq.js";import{g as Ne}from"./chunk-FMBD7UC4-lb_8q4JY.js";import"./index-BeuEs7dL.js";var $=function(){var t=c(function(_,s,n,a){for(n=n||{},a=_.length;a--;n[_[a]]=s);return n},"o"),g=[1,4],d=[1,13],r=[1,12],p=[1,15],k=[1,16],f=[1,20],h=[1,19],L=[6,7,8],C=[1,26],w=[1,24],N=[1,25],i=[6,7,11],j=[1,31],x=[6,7,11,24],P=[1,6,13,16,17,20,23],M=[1,35],U=[1,36],A=[1,6,7,11,13,16,17,20,23],H=[1,38],V={trace:c(function(){},"trace"),yy:{},symbols_:{error:2,start:3,mindMap:4,spaceLines:5,SPACELINE:6,NL:7,KANBAN:8,document:9,stop:10,EOF:11,statement:12,SPACELIST:13,node:14,shapeData:15,ICON:16,CLASS:17,nodeWithId:18,nodeWithoutId:19,NODE_DSTART:20,NODE_DESCR:21,NODE_DEND:22,NODE_ID:23,SHAPE_DATA:24,$accept:0,$end:1},terminals_:{2:"error",6:"SPACELINE",7:"NL",8:"KANBAN",11:"EOF",13:"SPACELIST",16:"ICON",17:"CLASS",20:"NODE_DSTART",21:"NODE_DESCR",22:"NODE_DEND",23:"NODE_ID",24:"SHAPE_DATA"},productions_:[0,[3,1],[3,2],[5,1],[5,2],[5,2],[4,2],[4,3],[10,1],[10,1],[10,1],[10,2],[10,2],[9,3],[9,2],[12,3],[12,2],[12,2],[12,2],[12,1],[12,2],[12,1],[12,1],[12,1],[12,1],[14,1],[14,1],[19,3],[18,1],[18,4],[15,2],[15,1]],performAction:c(function(s,n,a,o,u,e,B){var l=e.length-1;switch(u){case 6:case 7:return o;case 8:o.getLogger().trace("Stop NL ");break;case 9:o.getLogger().trace("Stop EOF ");break;case 11:o.getLogger().trace("Stop NL2 ");break;case 12:o.getLogger().trace("Stop EOF2 ");break;case 15:o.getLogger().info("Node: ",e[l-1].id),o.addNode(e[l-2].length,e[l-1].id,e[l-1].descr,e[l-1].type,e[l]);break;case 16:o.getLogger().info("Node: ",e[l].id),o.addNode(e[l-1].length,e[l].id,e[l].descr,e[l].type);break;case 17:o.getLogger().trace("Icon: ",e[l]),o.decorateNode({icon:e[l]});break;case 18:case 23:o.decorateNode({class:e[l]});break;case 19:o.getLogger().trace("SPACELIST");break;case 20:o.getLogger().trace("Node: ",e[l-1].id),o.addNode(0,e[l-1].id,e[l-1].descr,e[l-1].type,e[l]);break;case 21:o.getLogger().trace("Node: ",e[l].id),o.addNode(0,e[l].id,e[l].descr,e[l].type);break;case 22:o.decorateNode({icon:e[l]});break;case 27:o.getLogger().trace("node found ..",e[l-2]),this.$={id:e[l-1],descr:e[l-1],type:o.getType(e[l-2],e[l])};break;case 28:this.$={id:e[l],descr:e[l],type:0};break;case 29:o.getLogger().trace("node found ..",e[l-3]),this.$={id:e[l-3],descr:e[l-1],type:o.getType(e[l-2],e[l])};break;case 30:this.$=e[l-1]+e[l];break;case 31:this.$=e[l];break}},"anonymous"),table:[{3:1,4:2,5:3,6:[1,5],8:g},{1:[3]},{1:[2,1]},{4:6,6:[1,7],7:[1,8],8:g},{6:d,7:[1,10],9:9,12:11,13:r,14:14,16:p,17:k,18:17,19:18,20:f,23:h},t(L,[2,3]),{1:[2,2]},t(L,[2,4]),t(L,[2,5]),{1:[2,6],6:d,12:21,13:r,14:14,16:p,17:k,18:17,19:18,20:f,23:h},{6:d,9:22,12:11,13:r,14:14,16:p,17:k,18:17,19:18,20:f,23:h},{6:C,7:w,10:23,11:N},t(i,[2,24],{18:17,19:18,14:27,16:[1,28],17:[1,29],20:f,23:h}),t(i,[2,19]),t(i,[2,21],{15:30,24:j}),t(i,[2,22]),t(i,[2,23]),t(x,[2,25]),t(x,[2,26]),t(x,[2,28],{20:[1,32]}),{21:[1,33]},{6:C,7:w,10:34,11:N},{1:[2,7],6:d,12:21,13:r,14:14,16:p,17:k,18:17,19:18,20:f,23:h},t(P,[2,14],{7:M,11:U}),t(A,[2,8]),t(A,[2,9]),t(A,[2,10]),t(i,[2,16],{15:37,24:j}),t(i,[2,17]),t(i,[2,18]),t(i,[2,20],{24:H}),t(x,[2,31]),{21:[1,39]},{22:[1,40]},t(P,[2,13],{7:M,11:U}),t(A,[2,11]),t(A,[2,12]),t(i,[2,15],{24:H}),t(x,[2,30]),{22:[1,41]},t(x,[2,27]),t(x,[2,29])],defaultActions:{2:[2,1],6:[2,2]},parseError:c(function(s,n){if(n.recoverable)this.trace(s);else{var a=new Error(s);throw a.hash=n,a}},"parseError"),parse:c(function(s){var n=this,a=[0],o=[],u=[null],e=[],B=this.table,l="",z=0,ie=0,ue=2,re=1,ge=e.slice.call(arguments,1),m=Object.create(this.lexer),T={yy:{}};for(var J in this.yy)Object.prototype.hasOwnProperty.call(this.yy,J)&&(T.yy[J]=this.yy[J]);m.setInput(s,T.yy),T.yy.lexer=m,T.yy.parser=this,typeof m.yylloc>"u"&&(m.yylloc={});var q=m.yylloc;e.push(q);var de=m.options&&m.options.ranges;typeof T.yy.parseError=="function"?this.parseError=T.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function pe(S){a.length=a.length-2*S,u.length=u.length-S,e.length=e.length-S}c(pe,"popStack");function ae(){var S;return S=o.pop()||m.lex()||re,typeof S!="number"&&(S instanceof Array&&(o=S,S=o.pop()),S=n.symbols_[S]||S),S}c(ae,"lex");for(var E,R,v,Q,F={},X,I,oe,K;;){if(R=a[a.length-1],this.defaultActions[R]?v=this.defaultActions[R]:((E===null||typeof E>"u")&&(E=ae()),v=B[R]&&B[R][E]),typeof v>"u"||!v.length||!v[0]){var Z="";K=[];for(X in B[R])this.terminals_[X]&&X>ue&&K.push("'"+this.terminals_[X]+"'");m.showPosition?Z="Parse error on line "+(z+1)+`:
|
|
2
2
|
`+m.showPosition()+`
|
|
3
3
|
Expecting `+K.join(", ")+", got '"+(this.terminals_[E]||E)+"'":Z="Parse error on line "+(z+1)+": Unexpected "+(E==re?"end of input":"'"+(this.terminals_[E]||E)+"'"),this.parseError(Z,{text:m.match,token:this.terminals_[E]||E,line:m.yylineno,loc:q,expected:K})}if(v[0]instanceof Array&&v.length>1)throw new Error("Parse Error: multiple actions possible at state: "+R+", token: "+E);switch(v[0]){case 1:a.push(E),u.push(m.yytext),e.push(m.yylloc),a.push(v[1]),E=null,ie=m.yyleng,l=m.yytext,z=m.yylineno,q=m.yylloc;break;case 2:if(I=this.productions_[v[1]][1],F.$=u[u.length-I],F._$={first_line:e[e.length-(I||1)].first_line,last_line:e[e.length-1].last_line,first_column:e[e.length-(I||1)].first_column,last_column:e[e.length-1].last_column},de&&(F._$.range=[e[e.length-(I||1)].range[0],e[e.length-1].range[1]]),Q=this.performAction.apply(F,[l,ie,z,T.yy,v[1],u,e].concat(ge)),typeof Q<"u")return Q;I&&(a=a.slice(0,-1*I*2),u=u.slice(0,-1*I),e=e.slice(0,-1*I)),a.push(this.productions_[v[1]][0]),u.push(F.$),e.push(F._$),oe=B[a[a.length-2]][a[a.length-1]],a.push(oe);break;case 3:return!0}}return!0},"parse")},y=function(){var _={EOF:1,parseError:c(function(n,a){if(this.yy.parser)this.yy.parser.parseError(n,a);else throw new Error(n)},"parseError"),setInput:c(function(s,n){return this.yy=n||this.yy||{},this._input=s,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:c(function(){var s=this._input[0];this.yytext+=s,this.yyleng++,this.offset++,this.match+=s,this.matched+=s;var n=s.match(/(?:\r\n?|\n).*/g);return n?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),s},"input"),unput:c(function(s){var n=s.length,a=s.split(/(?:\r\n?|\n)/g);this._input=s+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-n),this.offset-=n;var o=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),a.length-1&&(this.yylineno-=a.length-1);var u=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:a?(a.length===o.length?this.yylloc.first_column:0)+o[o.length-a.length].length-a[0].length:this.yylloc.first_column-n},this.options.ranges&&(this.yylloc.range=[u[0],u[0]+this.yyleng-n]),this.yyleng=this.yytext.length,this},"unput"),more:c(function(){return this._more=!0,this},"more"),reject:c(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
|
|
4
4
|
`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:c(function(s){this.unput(this.match.slice(s))},"less"),pastInput:c(function(){var s=this.matched.substr(0,this.matched.length-this.match.length);return(s.length>20?"...":"")+s.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:c(function(){var s=this.match;return s.length<20&&(s+=this._input.substr(0,20-s.length)),(s.substr(0,20)+(s.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:c(function(){var s=this.pastInput(),n=new Array(s.length+1).join("-");return s+this.upcomingInput()+`
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b7 as j,b8 as p,b9 as w,ba as k,bb as q}from"./mermaid.core-
|
|
1
|
+
import{b7 as j,b8 as p,b9 as w,ba as k,bb as q}from"./mermaid.core-BZDABcuq.js";import{i as D}from"./init-Gi6I4Gst.js";import{e as g,f as F,a as z,b as B}from"./defaultLocale-DX6XiGOO.js";function M(n,r){return n==null||r==null?NaN:n<r?-1:n>r?1:n>=r?0:NaN}function I(n,r){return n==null||r==null?NaN:r<n?-1:r>n?1:r>=n?0:NaN}function R(n){let r,t,e;n.length!==2?(r=M,t=(o,c)=>M(n(o),c),e=(o,c)=>n(o)-c):(r=n===M||n===I?n:P,t=n,e=n);function u(o,c,i=0,h=o.length){if(i<h){if(r(c,c)!==0)return h;do{const l=i+h>>>1;t(o[l],c)<0?i=l+1:h=l}while(i<h)}return i}function f(o,c,i=0,h=o.length){if(i<h){if(r(c,c)!==0)return h;do{const l=i+h>>>1;t(o[l],c)<=0?i=l+1:h=l}while(i<h)}return i}function a(o,c,i=0,h=o.length){const l=u(o,c,i,h-1);return l>i&&e(o[l-1],c)>-e(o[l],c)?l-1:l}return{left:u,center:a,right:f}}function P(){return 0}function V(n){return n===null?NaN:+n}const $=R(M),x=$.right;R(V).center;const O=Math.sqrt(50),T=Math.sqrt(10),C=Math.sqrt(2);function v(n,r,t){const e=(r-n)/Math.max(0,t),u=Math.floor(Math.log10(e)),f=e/Math.pow(10,u),a=f>=O?10:f>=T?5:f>=C?2:1;let o,c,i;return u<0?(i=Math.pow(10,-u)/a,o=Math.round(n*i),c=Math.round(r*i),o/i<n&&++o,c/i>r&&--c,i=-i):(i=Math.pow(10,u)*a,o=Math.round(n/i),c=Math.round(r/i),o*i<n&&++o,c*i>r&&--c),c<o&&.5<=t&&t<2?v(n,r,t*2):[o,c,i]}function E(n,r,t){if(r=+r,n=+n,t=+t,!(t>0))return[];if(n===r)return[n];const e=r<n,[u,f,a]=e?v(r,n,t):v(n,r,t);if(!(f>=u))return[];const o=f-u+1,c=new Array(o);if(e)if(a<0)for(let i=0;i<o;++i)c[i]=(f-i)/-a;else for(let i=0;i<o;++i)c[i]=(f-i)*a;else if(a<0)for(let i=0;i<o;++i)c[i]=(u+i)/-a;else for(let i=0;i<o;++i)c[i]=(u+i)*a;return c}function y(n,r,t){return r=+r,n=+n,t=+t,v(n,r,t)[2]}function G(n,r,t){r=+r,n=+n,t=+t;const e=r<n,u=e?y(r,n,t):y(n,r,t);return(e?-1:1)*(u<0?1/-u:u)}function H(n,r){r||(r=[]);var t=n?Math.min(r.length,n.length):0,e=r.slice(),u;return function(f){for(u=0;u<t;++u)e[u]=n[u]*(1-f)+r[u]*f;return e}}function J(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}function K(n,r){var t=r?r.length:0,e=n?Math.min(t,n.length):0,u=new Array(e),f=new Array(t),a;for(a=0;a<e;++a)u[a]=d(n[a],r[a]);for(;a<t;++a)f[a]=r[a];return function(o){for(a=0;a<e;++a)f[a]=u[a](o);return f}}function L(n,r){var t=new Date;return n=+n,r=+r,function(e){return t.setTime(n*(1-e)+r*e),t}}function Q(n,r){var t={},e={},u;(n===null||typeof n!="object")&&(n={}),(r===null||typeof r!="object")&&(r={});for(u in r)u in n?t[u]=d(n[u],r[u]):e[u]=r[u];return function(f){for(u in t)e[u]=t[u](f);return e}}function d(n,r){var t=typeof r,e;return r==null||t==="boolean"?j(r):(t==="number"?p:t==="string"?(e=w(r))?(r=e,k):q:r instanceof w?k:r instanceof Date?L:J(r)?H:Array.isArray(r)?K:typeof r.valueOf!="function"&&typeof r.toString!="function"||isNaN(r)?Q:p)(n,r)}function U(n,r){return n=+n,r=+r,function(t){return Math.round(n*(1-t)+r*t)}}function W(n){return Math.max(0,-g(Math.abs(n)))}function X(n,r){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(g(r)/3)))*3-g(Math.abs(n)))}function Y(n,r){return n=Math.abs(n),r=Math.abs(r)-n,Math.max(0,g(r)-g(n))+1}function Z(n){return function(){return n}}function _(n){return+n}var A=[0,1];function m(n){return n}function N(n,r){return(r-=n=+n)?function(t){return(t-n)/r}:Z(isNaN(r)?NaN:.5)}function b(n,r){var t;return n>r&&(t=n,n=r,r=t),function(e){return Math.max(n,Math.min(r,e))}}function nn(n,r,t){var e=n[0],u=n[1],f=r[0],a=r[1];return u<e?(e=N(u,e),f=t(a,f)):(e=N(e,u),f=t(f,a)),function(o){return f(e(o))}}function rn(n,r,t){var e=Math.min(n.length,r.length)-1,u=new Array(e),f=new Array(e),a=-1;for(n[e]<n[0]&&(n=n.slice().reverse(),r=r.slice().reverse());++a<e;)u[a]=N(n[a],n[a+1]),f[a]=t(r[a],r[a+1]);return function(o){var c=x(n,o,1,e)-1;return f[c](u[c](o))}}function en(n,r){return r.domain(n.domain()).range(n.range()).interpolate(n.interpolate()).clamp(n.clamp()).unknown(n.unknown())}function tn(){var n=A,r=A,t=d,e,u,f,a=m,o,c,i;function h(){var s=Math.min(n.length,r.length);return a!==m&&(a=b(n[0],n[s-1])),o=s>2?rn:nn,c=i=null,l}function l(s){return s==null||isNaN(s=+s)?f:(c||(c=o(n.map(e),r,t)))(e(a(s)))}return l.invert=function(s){return a(u((i||(i=o(r,n.map(e),p)))(s)))},l.domain=function(s){return arguments.length?(n=Array.from(s,_),h()):n.slice()},l.range=function(s){return arguments.length?(r=Array.from(s),h()):r.slice()},l.rangeRound=function(s){return r=Array.from(s),t=U,h()},l.clamp=function(s){return arguments.length?(a=s?!0:m,h()):a!==m},l.interpolate=function(s){return arguments.length?(t=s,h()):t},l.unknown=function(s){return arguments.length?(f=s,l):f},function(s,S){return e=s,u=S,h()}}function un(){return tn()(m,m)}function an(n,r,t,e){var u=G(n,r,t),f;switch(e=F(e??",f"),e.type){case"s":{var a=Math.max(Math.abs(n),Math.abs(r));return e.precision==null&&!isNaN(f=X(u,a))&&(e.precision=f),z(e,a)}case"":case"e":case"g":case"p":case"r":{e.precision==null&&!isNaN(f=Y(u,Math.max(Math.abs(n),Math.abs(r))))&&(e.precision=f-(e.type==="e"));break}case"f":case"%":{e.precision==null&&!isNaN(f=W(u))&&(e.precision=f-(e.type==="%")*2);break}}return B(e)}function on(n){var r=n.domain;return n.ticks=function(t){var e=r();return E(e[0],e[e.length-1],t??10)},n.tickFormat=function(t,e){var u=r();return an(u[0],u[u.length-1],t??10,e)},n.nice=function(t){t==null&&(t=10);var e=r(),u=0,f=e.length-1,a=e[u],o=e[f],c,i,h=10;for(o<a&&(i=a,a=o,o=i,i=u,u=f,f=i);h-- >0;){if(i=y(a,o,t),i===c)return e[u]=a,e[f]=o,r(e);if(i>0)a=Math.floor(a/i)*i,o=Math.ceil(o/i)*i;else if(i<0)a=Math.ceil(a*i)/i,o=Math.floor(o*i)/i;else break;c=i}return n},n}function fn(){var n=un();return n.copy=function(){return en(n,fn())},D.apply(n,arguments),on(n)}export{en as a,R as b,un as c,fn as l,G as t};
|
|
2
2
|
|