@puddle-code/cli 0.5.6 → 0.5.8
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/CHANGELOG.md +5 -7
- package/dist/host-control.mjs +20 -1
- package/dist/index.js +51 -6
- package/dist/public/assets/App-B8Qq_mnE.js +14 -0
- package/dist/public/assets/{CompilationCommandForm-DXHvwQ8Y.js → CompilationCommandForm--aglvHpg.js} +1 -1
- package/dist/public/assets/Dashboard-CLdNA8WP.js +1 -0
- package/dist/public/assets/DraftRecovery-Da7OryXQ.js +1 -0
- package/dist/public/assets/EditorTabClose-CQ73_M1i.js +1 -0
- package/dist/public/assets/{FileCloseScope-DoZ0oLf8.js → FileCloseScope-B527gWqW.js} +1 -1
- package/dist/public/assets/{FileEditorSettingsMenu-BbRHII96.js → FileEditorSettingsMenu-X23c7860.js} +1 -1
- package/dist/public/assets/{FindWidget-ET5pwkkB.js → FindWidget-FJWGUnZT.js} +1 -1
- package/dist/public/assets/HuddlePane-BLBAcqwy.js +219 -0
- package/dist/public/assets/{LazyTerminal-DnrWO9aI.js → LazyTerminal-Cu5V6ejk.js} +2 -2
- package/dist/public/assets/{NotebookWidget-BDdx0BOy.js → NotebookWidget-CXmf3IRw.js} +2 -2
- package/dist/public/assets/{PaneEditorBody-C1uu9cRG.js → PaneEditorBody-DdnVw9lV.js} +19 -19
- package/dist/public/assets/{PdfViewer-DLCPKybn.js → PdfViewer-CSMNKPo1.js} +1 -1
- package/dist/public/assets/ReadOnlyDiff-BwUPy5CW.js +2 -0
- package/dist/public/assets/{ReleaseNotesDialog-B9fRaZNN.js → ReleaseNotesDialog-B1DpXA1c.js} +1 -1
- package/dist/public/assets/Ripple-D1mXgP5b.js +11 -0
- package/dist/public/assets/SettingsDialog-Dxyi7dhn.js +8 -0
- package/dist/public/assets/{Terminal-BP1tyPdf.js → Terminal-J5WMTjuY.js} +6 -6
- package/dist/public/assets/Workspace-DQDh6TQ7.js +20 -0
- package/dist/public/assets/api-DhfvolrJ.js +1 -0
- package/dist/public/assets/auth-BPXeEntX.js +1 -0
- package/dist/public/assets/{button-D-qeQvl5.js → button-BNH9tKwf.js} +1 -1
- package/dist/public/assets/{chevron-right-DUkOv15w.js → chevron-right-6pjfw_yV.js} +1 -1
- package/dist/public/assets/{colour-picker-DZdAiaVI.js → colour-picker-Dwq4M4eT.js} +1 -1
- package/dist/public/assets/{command-BeX8pm7h.js → command-RRKOl81e.js} +1 -1
- package/dist/public/assets/{content-state-CROLtMfN.js → content-state-PQEVgsS8.js} +1 -1
- package/dist/public/assets/{context-NsaMZKAN.js → context-CvPVX4oN.js} +1 -1
- package/dist/public/assets/context-menu-CaNn4t1W.js +1 -0
- package/dist/public/assets/{control-tray-CjoJunx1.js → control-tray-jUtkASPS.js} +1 -1
- package/dist/public/assets/dialog-DfdBRe6G.js +41 -0
- package/dist/public/assets/{disclosure-CpSwsC7J.js → disclosure-oYVpfMYO.js} +1 -1
- package/dist/public/assets/dist-CNoWjXWo.js +1 -0
- package/dist/public/assets/dist-DMpqv5CF.js +1 -0
- package/dist/public/assets/{drafts-CBbjQQbz.js → drafts-CqDYmkTF.js} +1 -1
- package/dist/public/assets/editor-context-Bijx3uIG.js +5 -0
- package/dist/public/assets/editor-links-Djdkea3i.js +1 -0
- package/dist/public/assets/{editor-sync-BOfDr2yY.js → editor-sync-C6zSf7t5.js} +1 -1
- package/dist/public/assets/{errors-CviT-mvB.js → errors-SnGDjajv.js} +1 -1
- package/dist/public/assets/expanding-content-CKYjs3iT.js +1 -0
- package/dist/public/assets/{file-editor-settings-BXTs1F7S.js → file-editor-settings-XayiLMfU.js} +1 -1
- package/dist/public/assets/{file-links-CgOYgoMC.js → file-links-CEjYCLBn.js} +1 -1
- package/dist/public/assets/forward-link-BT0QTRVB.js +1 -0
- package/dist/public/assets/hotkeys-B417biB9.js +1 -0
- package/dist/public/assets/index-C0F5B-UN.js +10 -0
- package/dist/public/assets/index-CbJEmhvZ.css +2 -0
- package/dist/public/assets/{react-dom-cJyBB_A4.js → jsx-runtime-ffCh33zF.js} +1 -1
- package/dist/public/assets/local-store-DKFKEHML.js +276 -0
- package/dist/public/assets/notification-delivery-yJcsFWYx.js +1 -0
- package/dist/public/assets/{popover-Okyclsx8.js → popover-CNEMQBFf.js} +1 -1
- package/dist/public/assets/{preferences-CvSHA-AA.js → preferences-BP2Incj1.js} +1 -1
- package/dist/public/assets/{profile-icons-BI2xFWcB.js → profile-icons-BmQVYS_o.js} +1 -1
- package/dist/public/assets/profile-store-BnferXV3.js +1 -0
- package/dist/public/assets/project-actions-DX_j3cML.js +1 -0
- package/dist/public/assets/project-drag-DZbLfoWj.js +1 -0
- package/dist/public/assets/{protocol-support-iXloAH0N.js → protocol-support-DIWnYJkt.js} +1 -1
- package/dist/public/assets/queries-C9DYtGQW.js +1 -0
- package/dist/public/assets/{render-rich-content-fo4uQVWR.js → render-rich-content-Br9yR6jZ.js} +2 -2
- package/dist/public/assets/{scroll-restoration-C_ly1bKS.js → scroll-restoration-C-VTTLs8.js} +1 -1
- package/dist/public/assets/select-DHaYbZVV.js +1 -0
- package/dist/public/assets/selection-actions-DX3EnNRv.js +1 -0
- package/dist/public/assets/{session-display-BUDNzNmg.js → session-display-DHxCigRa.js} +1 -1
- package/dist/public/assets/session-order-BK0vJanT.js +1 -0
- package/dist/public/assets/state-BegCSQn_.js +1 -0
- package/dist/public/assets/{switch-CGrhQUXr.js → switch-DZ2lisDt.js} +1 -1
- package/dist/public/assets/{tooltip-Ek-eHPZu.js → tooltip-CtT-5xHL.js} +1 -1
- package/dist/public/assets/use-arrangement-ready-CMe547fb.js +1 -0
- package/dist/public/assets/use-desktop-state-xeH1nq63.js +2 -0
- package/dist/public/assets/view-state-store-Cr1BaTzj.js +1 -0
- package/dist/public/assets/window-context-DddmcmmO.js +2 -0
- package/dist/public/assets/{ws-CDXOuBYB.js → ws-fD2y3o7n.js} +1 -1
- package/dist/public/index.html +6 -6
- package/dist/pudl.js +20 -1
- package/package.json +1 -1
- package/dist/public/assets/App-nkMPe95U.js +0 -16
- package/dist/public/assets/Dashboard-CoGS2W82.js +0 -1
- package/dist/public/assets/DraftRecovery-B8Ld4_1b.js +0 -1
- package/dist/public/assets/EditorTabClose-CGYLU9GK.js +0 -1
- package/dist/public/assets/HuddlePane-LF3pjMQM.js +0 -219
- package/dist/public/assets/ReadOnlyDiff-C7ZSVRt-.js +0 -2
- package/dist/public/assets/Ripple-Dzg6tdOM.js +0 -11
- package/dist/public/assets/SettingsDialog-wkV1PX96.js +0 -8
- package/dist/public/assets/Workspace-BAWfBTc9.js +0 -20
- package/dist/public/assets/api-CrP4jl9e.js +0 -1
- package/dist/public/assets/auth-1SSLu56b.js +0 -1
- package/dist/public/assets/dialog-CTN-Lln6.js +0 -41
- package/dist/public/assets/dist-BOS6OKSE.js +0 -1
- package/dist/public/assets/dist-BcrNV8NP.js +0 -1
- package/dist/public/assets/dist-NuV8HBEc.js +0 -1
- package/dist/public/assets/editor-context-T5zIHY3K.js +0 -5
- package/dist/public/assets/expanding-content-91gc88rm.js +0 -1
- package/dist/public/assets/forward-link-qOyuWj08.js +0 -1
- package/dist/public/assets/hotkeys-nP8gYtE7.js +0 -1
- package/dist/public/assets/index-BB_BPKbu.css +0 -2
- package/dist/public/assets/index-CYyz1r9Q.js +0 -10
- package/dist/public/assets/jsx-runtime-By8HlURe.js +0 -1
- package/dist/public/assets/local-store-Dy1Cd8sn.js +0 -276
- package/dist/public/assets/notification-delivery-CtlAdV8W.js +0 -1
- package/dist/public/assets/profile-store-D4lZiXgL.js +0 -2
- package/dist/public/assets/project-actions-Ck504AFM.js +0 -1
- package/dist/public/assets/project-drag-BnkK15qk.js +0 -1
- package/dist/public/assets/queries-BSkHGZG8.js +0 -1
- package/dist/public/assets/select-DzQdQNsv.js +0 -1
- package/dist/public/assets/selection-actions-CWu4uTBo.js +0 -1
- package/dist/public/assets/session-order-b3nCJcCG.js +0 -1
- package/dist/public/assets/state-CuUqRNo7.js +0 -1
- package/dist/public/assets/use-arrangement-ready-1vmV5np6.js +0 -1
- package/dist/public/assets/use-desktop-state-CBTzsmlz.js +0 -2
- package/dist/public/assets/view-state-store-Dqk7M5ei.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{t as n}from"./jsx-runtime-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{t as n}from"./jsx-runtime-ffCh33zF.js";import{t as r}from"./utils-B6KiDbIe.js";import{C as i,E as a,T as o,g as s}from"./dialog-DfdBRe6G.js";import{o as c}from"./x-CbfJFzGo.js";import{v as l}from"./dist-CNoWjXWo.js";import{o as u}from"./select-DHaYbZVV.js";import{t as d}from"./createLucideIcon-DyMAgLa3.js";var f=d(`bot`,[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]),p=d(`palette`,[[`path`,{d:`M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z`,key:`e79jfc`}],[`circle`,{cx:`13.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`1okk4w`}],[`circle`,{cx:`17.5`,cy:`10.5`,r:`.5`,fill:`currentColor`,key:`f64h9f`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`.5`,fill:`currentColor`,key:`qy21gx`}],[`circle`,{cx:`8.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`fotxhn`}]]),m=d(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),h=d(`zap`,[[`path`,{d:`M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z`,key:`1xq2db`}]]),g=e(t(),1),_=n(),v=`Switch`,[y,b]=o(v),[x,S]=y(v);function C(e){let{__scopeSwitch:t,checked:n,children:r,defaultChecked:i,disabled:a,form:o,name:c,onCheckedChange:l,required:u,value:d=`on`,internal_do_not_use_render:f}=e,[p,m]=s({prop:n,defaultProp:i??!1,onChange:l,caller:v}),[h,y]=g.useState(null),[b,S]=g.useState(null),C={checked:p,setChecked:m,disabled:a,control:h,setControl:y,name:c,form:o,value:d,hasConsumerStoppedPropagationRef:g.useRef(!1),required:u,defaultChecked:i,isFormControl:!h||!!o||!!h.closest(`form`),bubbleInput:b,setBubbleInput:S};return(0,_.jsx)(x,{scope:t,...C,children:j(f)?f(C):r})}var w=`SwitchTrigger`,T=g.forwardRef(({__scopeSwitch:e,onClick:t,...n},r)=>{let{control:o,form:s,value:l,disabled:u,checked:d,required:f,setControl:p,setChecked:m,hasConsumerStoppedPropagationRef:h,isFormControl:v,bubbleInput:y}=S(w,e),b=c(r,p),x=g.useRef(d);return g.useEffect(()=>{let e=s?o?.ownerDocument.getElementById(s):o?.form;if(e instanceof HTMLFormElement){let t=()=>m(x.current);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[o,s,m]),(0,_.jsx)(i.button,{type:`button`,role:`switch`,"aria-checked":d,"aria-required":f,"data-state":M(d),"data-disabled":u?``:void 0,disabled:u,value:l,...n,ref:b,onClick:a(t,e=>{m(e=>!e),y&&v&&(h.current=e.isPropagationStopped(),h.current||e.stopPropagation())})})});T.displayName=w;var E=g.forwardRef((e,t)=>{let{__scopeSwitch:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c,onCheckedChange:l,form:u,...d}=e;return(0,_.jsx)(C,{__scopeSwitch:n,checked:i,defaultChecked:a,disabled:s,required:o,onCheckedChange:l,name:r,form:u,value:c,internal_do_not_use_render:({isFormControl:e})=>(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(T,{...d,ref:t,__scopeSwitch:n}),e&&(0,_.jsx)(A,{__scopeSwitch:n})]})})});E.displayName=v;var D=`SwitchThumb`,O=g.forwardRef((e,t)=>{let{__scopeSwitch:n,...r}=e,a=S(D,n);return(0,_.jsx)(i.span,{"data-state":M(a.checked),"data-disabled":a.disabled?``:void 0,...r,ref:t})});O.displayName=D;var k=`SwitchBubbleInput`,A=g.forwardRef(({__scopeSwitch:e,...t},n)=>{let{control:r,hasConsumerStoppedPropagationRef:a,checked:o,defaultChecked:s,required:d,disabled:f,name:p,value:m,form:h,bubbleInput:v,setBubbleInput:y}=S(k,e),b=c(n,y),x=u(o),C=l(r);g.useEffect(()=>{let e=v;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set,r=!a.current;if(x!==o&&n){let t=new Event(`click`,{bubbles:r});n.call(e,o),e.dispatchEvent(t)}},[v,x,o,a]);let w=g.useRef(o);return(0,_.jsx)(i.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:s??w.current,required:d,disabled:f,name:p,value:m,form:h,...t,tabIndex:-1,ref:b,style:{...t.style,...C,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})});A.displayName=k;function j(e){return typeof e==`function`}function M(e){return e?`checked`:`unchecked`}function N({className:e,...t}){return(0,_.jsx)(E,{className:r(`peer group/switch inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full disabled:cursor-not-allowed disabled:opacity-50`,e),...t,children:(0,_.jsx)(`span`,{className:`pointer-events-none inline-flex h-5 w-9 shrink-0 items-center rounded-full bg-border transition-colors group-hover/switch:bg-border/70 group-data-[state=checked]/switch:bg-action host-accent:group-data-[state=unchecked]/switch:bg-explorer-hover host-accent:group-data-[state=unchecked]/switch:group-hover/switch:bg-explorer-selection/50`,children:(0,_.jsx)(O,{className:`block size-4 rounded-full bg-ground shadow-sm transition-[translate] duration-200 ease-out data-[state=checked]:translate-x-[1.125rem] data-[state=unchecked]:translate-x-0.5`})})})}export{f as a,p as i,h as n,m as r,N as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{t as n}from"./jsx-runtime-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{t as n}from"./jsx-runtime-ffCh33zF.js";import{t as r}from"./utils-B6KiDbIe.js";import{C as i,E as a,T as o,_ as s,g as c,v as l,x as u,y as d}from"./dialog-DfdBRe6G.js";import{i as f,o as p}from"./x-CbfJFzGo.js";import{_ as m,g as h,h as g,i as _,m as v,p as y,u as b}from"./dist-CNoWjXWo.js";import{c as x}from"./select-DHaYbZVV.js";var S=e(t(),1),C=n(),[w,T]=o(`Tooltip`,[m]),E=m(),D=`TooltipProvider`,O=700,k=`tooltip.open`,[A,j]=w(D),M=e=>{let{__scopeTooltip:t,delayDuration:n=O,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=S.useRef(!0),s=S.useRef(!1),c=S.useRef(0);return S.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,C.jsx)(A,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:S.useCallback(()=>{r<=0||(window.clearTimeout(c.current),o.current=!1)},[r]),onClose:S.useCallback(()=>{r<=0||(window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r))},[r]),isPointerInTransitRef:s,onPointerInTransitChange:S.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})};M.displayName=D;var N=`Tooltip`,[P,F]=w(N),I=e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:s}=e,l=j(N,e.__scopeTooltip),u=E(t),[f,p]=S.useState(null),m=d(),g=S.useRef(0),_=o??l.disableHoverableContent,v=s??l.delayDuration,y=S.useRef(!1),[b,x]=c({prop:r,defaultProp:i??!1,onChange:e=>{e?(l.onOpen(),document.dispatchEvent(new CustomEvent(k))):l.onClose(),a?.(e)},caller:N}),w=S.useMemo(()=>b?y.current?`delayed-open`:`instant-open`:`closed`,[b]),T=S.useCallback(()=>{window.clearTimeout(g.current),g.current=0,y.current=!1,x(!0)},[x]),D=S.useCallback(()=>{window.clearTimeout(g.current),g.current=0,x(!1)},[x]),O=S.useCallback(()=>{window.clearTimeout(g.current),g.current=window.setTimeout(()=>{y.current=!0,x(!0),g.current=0},v)},[v,x]);return S.useEffect(()=>()=>{g.current&&=(window.clearTimeout(g.current),0)},[]),(0,C.jsx)(h,{...u,children:(0,C.jsx)(P,{scope:t,contentId:m,open:b,stateAttribute:w,trigger:f,onTriggerChange:p,onTriggerEnter:S.useCallback(()=>{l.isOpenDelayedRef.current?O():T()},[l.isOpenDelayedRef,O,T]),onTriggerLeave:S.useCallback(()=>{_?D():(window.clearTimeout(g.current),g.current=0)},[D,_]),onOpen:T,onClose:D,disableHoverableContent:_,children:n})})};I.displayName=N;var L=`TooltipTrigger`,R=S.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,o=F(L,n),s=j(L,n),c=E(n),l=p(t,S.useRef(null),o.onTriggerChange),u=S.useRef(!1),d=S.useRef(!1),f=S.useCallback(()=>u.current=!1,[]);return S.useEffect(()=>()=>document.removeEventListener(`pointerup`,f),[f]),(0,C.jsx)(y,{asChild:!0,...c,children:(0,C.jsx)(i.button,{"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute,...r,ref:l,onPointerMove:a(e.onPointerMove,e=>{e.pointerType!==`touch`&&!d.current&&!s.isPointerInTransitRef.current&&(o.onTriggerEnter(),d.current=!0)}),onPointerLeave:a(e.onPointerLeave,()=>{o.onTriggerLeave(),d.current=!1}),onPointerDown:a(e.onPointerDown,()=>{o.open&&o.onClose(),u.current=!0,document.addEventListener(`pointerup`,f,{once:!0})}),onFocus:a(e.onFocus,()=>{u.current||o.onOpen()}),onBlur:a(e.onBlur,o.onClose),onClick:a(e.onClick,o.onClose)})})});R.displayName=L;var z=`TooltipPortal`,[B,V]=w(z,{forceMount:void 0}),H=e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=F(z,t);return(0,C.jsx)(B,{scope:t,forceMount:n,children:(0,C.jsx)(s,{present:n||a.open,children:(0,C.jsx)(l,{asChild:!0,container:i,children:r})})})};H.displayName=z;var U=`TooltipContent`,W=S.forwardRef((e,t)=>{let n=V(U,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=F(U,e.__scopeTooltip);return(0,C.jsx)(s,{present:r||o.open,children:o.disableHoverableContent?(0,C.jsx)(Y,{side:i,...a,ref:t}):(0,C.jsx)(G,{side:i,...a,ref:t})})}),G=S.forwardRef((e,t)=>{let n=F(U,e.__scopeTooltip),r=j(U,e.__scopeTooltip),i=S.useRef(null),a=p(t,i),[o,s]=S.useState(null),{trigger:c,onClose:l}=n,u=i.current,{onPointerInTransitChange:d}=r,f=S.useCallback(()=>{s(null),d(!1)},[d]),m=S.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=$(r,Q(r,n.getBoundingClientRect())),a=ee(t.getBoundingClientRect()),o=ne([...i,...a]);s(o),d(!0)},[d]);return S.useEffect(()=>()=>f(),[f]),S.useEffect(()=>{if(c&&u){let e=e=>m(e,u),t=e=>m(e,c);return c.addEventListener(`pointerleave`,e),u.addEventListener(`pointerleave`,t),()=>{c.removeEventListener(`pointerleave`,e),u.removeEventListener(`pointerleave`,t)}}},[c,u,m,f]),S.useEffect(()=>{if(o){let e=e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=c?.contains(t)||u?.contains(t),i=!te(n,o);r?f():i&&(f(),l())};return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[c,u,o,l,f]),(0,C.jsx)(Y,{...e,ref:a})}),[K,q]=w(N,{isInside:!1}),J=f(`TooltipContent`),Y=S.forwardRef((e,t)=>{let{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:a,onPointerDownOutside:o,...s}=e,c=F(U,n),l=E(n),{onClose:d}=c;return S.useEffect(()=>(document.addEventListener(k,d),()=>document.removeEventListener(k,d)),[d]),S.useEffect(()=>{if(c.trigger){let e=e=>{e.target instanceof Node&&e.target.contains(c.trigger)&&d()};return window.addEventListener(`scroll`,e,{capture:!0}),()=>window.removeEventListener(`scroll`,e,{capture:!0})}},[c.trigger,d]),(0,C.jsx)(u,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:d,children:(0,C.jsxs)(g,{"data-state":c.stateAttribute,...l,...s,ref:t,style:{...s.style,"--radix-tooltip-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-tooltip-content-available-width":`var(--radix-popper-available-width)`,"--radix-tooltip-content-available-height":`var(--radix-popper-available-height)`,"--radix-tooltip-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-tooltip-trigger-height":`var(--radix-popper-anchor-height)`},children:[(0,C.jsx)(J,{children:r}),(0,C.jsx)(K,{scope:n,isInside:!0,children:(0,C.jsx)(x,{id:c.contentId,role:`tooltip`,children:i||r})})]})})});W.displayName=U;var X=`TooltipArrow`,Z=S.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=E(n);return q(X,n).isInside?null:(0,C.jsx)(v,{...i,...r,ref:t})});Z.displayName=X;function Q(e,t){let n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(n,r,i,a)){case a:return`left`;case i:return`right`;case n:return`top`;case r:return`bottom`;default:throw Error(`unreachable`)}}function $(e,t,n=5){let r=[];switch(t){case`top`:r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case`bottom`:r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case`left`:r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case`right`:r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function ee(e){let{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}function te(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function ne(e){let t=e.slice();return t.sort((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:+(e.y>t.y)),re(t)}function re(e){if(e.length<=1)return e.slice();let t=[];for(let n=0;n<e.length;n++){let r=e[n];for(;t.length>=2;){let e=t[t.length-1],n=t[t.length-2];if((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x))t.pop();else break}t.push(r)}t.pop();let n=[];for(let t=e.length-1;t>=0;t--){let r=e[t];for(;n.length>=2;){let e=n[n.length-1],t=n[n.length-2];if((e.x-t.x)*(r.y-t.y)>=(e.y-t.y)*(r.x-t.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var ie=M,ae=I,oe=R,se=H,ce=W,le=ie,ue=ae,de=oe;function fe({className:e,sideOffset:t=4,portalled:n=!0,...i}){let a=(0,C.jsx)(ce,{sideOffset:t,className:r(`z-50 overflow-hidden px-2 py-1 text-xs text-fg`,_,b,`overlay-tooltip-motion`,e),...i});return n?(0,C.jsx)(se,{children:a}):a}export{de as i,fe as n,le as r,ue as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{t as n}from"./jsx-runtime-ffCh33zF.js";import{a as r,n as i}from"./window-context-DddmcmmO.js";import{t as a}from"./use-desktop-state-xeH1nq63.js";import{t as o}from"./createLucideIcon-DyMAgLa3.js";import{i as s}from"./profile-store-BnferXV3.js";import{r as c}from"./context-menu-CaNn4t1W.js";import{n as l}from"./errors-SnGDjajv.js";import{a as u,r as d}from"./project-actions-DX_j3cML.js";var f=o(`app-window`,[[`rect`,{x:`2`,y:`4`,width:`20`,height:`16`,rx:`2`,key:`izxlao`}],[`path`,{d:`M10 4v4`,key:`pp8u80`}],[`path`,{d:`M2 8h20`,key:`d11cs7`}],[`path`,{d:`M6 4v4`,key:`1svtjw`}]]),p=o(`archive-restore`,[[`rect`,{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`,key:`1wp1u1`}],[`path`,{d:`M4 8v11a2 2 0 0 0 2 2h2`,key:`tvwodi`}],[`path`,{d:`M20 8v11a2 2 0 0 1-2 2h-2`,key:`1gkqxj`}],[`path`,{d:`m9 15 3-3 3 3`,key:`1pd0qc`}],[`path`,{d:`M12 12v9`,key:`192myk`}]]),m=o(`archive`,[[`rect`,{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`,key:`1wp1u1`}],[`path`,{d:`M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8`,key:`1s80jp`}],[`path`,{d:`M10 12h4`,key:`a56b0p`}]]),h=o(`arrow-left-to-line`,[[`path`,{d:`M3 19V5`,key:`rwsyhb`}],[`path`,{d:`m13 6-6 6 6 6`,key:`1yhaz7`}],[`path`,{d:`M7 12h14`,key:`uoisry`}]]),g=n();function _({projectId:e}){let t=s(),n=r(),a=i()?.identity;return!t||!n?.windows?.projects?null:a?.kind===`project`&&a.projectId===e?n.closeWindow?(0,g.jsxs)(c,{onSelect:()=>{u().catch(l)},children:[(0,g.jsx)(h,{}),`Return project to host`]}):null:(0,g.jsxs)(c,{onSelect:()=>{d(t,e).catch(l)},children:[(0,g.jsx)(f,{}),`Open project in window`]})}var v=e(t(),1);function y(e,t){(0,v.useEffect)(()=>{e&&t&&a.mounted(e)},[e,t])}export{f as a,p as i,_ as n,m as r,y as t};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/project-actions-DX_j3cML.js","assets/rolldown-runtime-QTnfLwEv.js","assets/local-store-DKFKEHML.js","assets/window-context-DddmcmmO.js","assets/react-CZI7_Jkm.js","assets/jsx-runtime-ffCh33zF.js","assets/preload-helper-Czpn1I53.js","assets/queries-C9DYtGQW.js","assets/editor-links-Djdkea3i.js","assets/client-settings-BdKglwtW.js","assets/api-DhfvolrJ.js","assets/auth-BPXeEntX.js","assets/profile-store-BnferXV3.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{n as e,r as t}from"./rolldown-runtime-QTnfLwEv.js";import{t as n}from"./react-CZI7_Jkm.js";import{$ as r,Y as i,Yt as a,Z as o,c as s,f as c,m as l,p as u}from"./local-store-DKFKEHML.js";import{t as d}from"./client-settings-BdKglwtW.js";import{t as f}from"./preload-helper-Czpn1I53.js";import{a as p,i as m,n as h,r as g}from"./window-context-DddmcmmO.js";import{At as _,Dt as v,Et as ee,It as y,Lt as b,Mt as te,Ot as ne,Pt as re,Rt as ie,Tt as x,i as ae,jt as S,kt as oe,n as se,t as ce,wt as le,xt as ue,yt as de}from"./queries-C9DYtGQW.js";import{t as C}from"./profile-store-BnferXV3.js";import{n as w}from"./errors-SnGDjajv.js";import{a as fe,n as pe,o as T}from"./preview-kind-CJ9RTgbs.js";import{n as E,t as me}from"./content-state-PQEVgsS8.js";import{t as he}from"./debounce-B9DrqirV.js";var ge=class extends ie{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,t,n){let r=new de({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=D(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=D(e);if(typeof t==`string`){let n=this.#t.get(t);if(n)if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=D(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}else return!0}runNext(e){let t=D(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){x.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>oe(t,e))}findAll(e={}){return this.getAll().filter(t=>oe(e,t))}notify(e){x.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return x.batch(()=>Promise.all(e.map(e=>e.continue().catch(S))))}};function D(e){return e.options.scope?.id}var _e=class extends ie{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??ne(r,t),a=this.get(i);return a||(a=new ue({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){x.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>_(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>_(e,t)):t}notify(e){x.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){x.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){x.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},ve=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new _e,this.#t=e.mutationCache||new ge,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=b.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=le.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(re(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=ee(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return x.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;x.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return x.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=x.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(S).catch(S)}invalidateQueries(e,t={}){return x.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=x.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(S)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(S)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(re(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(S).catch(S)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(S).catch(S)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return le.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(v(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{te(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(v(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{te(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=ne(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===y&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},O=t(n(),1),ye=new ve({defaultOptions:{queries:{retry:1,staleTime:5e3}},mutationCache:new ge({onError:e=>w(e)})});function k(){return crypto.randomUUID()}function A(e){return e.type===`huddle`?`huddle:${e.session}`:e.type===`terminal`?`term:${e.session}`:`editor:${fe(e.tab)}`}function be(e,t){return A(e)===A(t)}function xe(e){return e.type===`terminal`}function Se(e){return e.type===`editor`&&(e.tab.view===`linked`||e.tab.view===`locked`)}function j(e=[],t){let n=e.map(A),r=t&&n.includes(t)?t:n.length>0?n[0]:null;return{kind:`leaf`,id:k(),tabs:e,activeKey:r,previewKey:null}}function M(e,t,n){return{kind:`split`,id:k(),direction:e,children:t,sizes:n??t.map(()=>100/Math.max(1,t.length))}}function N(e,t){if(e.kind===`leaf`)return e.id===t?e:null;for(let n of e.children){let e=N(n,t);if(e)return e}return null}function Ce(e,t){if(e.kind===`leaf`)return e.tabs.some(e=>A(e)===t)?e:null;for(let n of e.children){let e=Ce(n,t);if(e)return e}return null}function P(e){return e.kind===`leaf`?[e]:e.children.flatMap(P)}function F(e){return P(e).flatMap(e=>e.tabs)}function we(e){return e.kind===`leaf`?[e.id]:[e.id,...e.children.flatMap(we)]}function Te(e){let t=we(e);return new Set(t).size!==t.length}function Ee(e){return e.kind===`leaf`?{...e,id:k()}:{...e,id:k(),children:e.children.map(Ee)}}function I(e){if(!Te(e))return e;let t=new Set,n=e=>{let r=t.has(e.id)?k():e.id;return t.add(r),e.kind===`leaf`?{...e,id:r}:{...e,id:r,children:e.children.map(n)}};return n(e)}function De(e){let t=e.tabs.map(A),n=e.activeKey&&t.includes(e.activeKey)?e.activeKey:t[0]??null,r=e.previewKey&&t.includes(e.previewKey)?e.previewKey:null;return n===e.activeKey&&r===(e.previewKey??null)?e:{...e,activeKey:n,previewKey:r}}function L(e){if(e.kind===`leaf`)return De(e);let t=e.children.map(L),n=[],r=[];t.forEach((t,i)=>{let a=e.sizes[i]??1;if(t.kind===`split`&&t.direction===e.direction){let e=t.sizes.reduce((e,t)=>e+t,0)||t.children.length;t.children.forEach((i,o)=>{n.push(i),r.push(a*(t.sizes[o]??1)/e)})}else n.push(t),r.push(a)});let i=[],a=[];return n.forEach((e,t)=>{e.kind===`leaf`&&e.tabs.length===0||(i.push(e),a.push(r[t]??1))}),i.length===0?j([]):i.length===1?i[0]:{...e,children:i,sizes:a}}function R(e,t,n){return e.kind===`leaf`?e.id===t?n(e):e:{...e,children:e.children.map(e=>R(e,t,n))}}function Oe(e,t,n){return R(e,t,e=>{if(!e.tabs.some(e=>A(e)===n))return e;let t=e.tabs.filter(e=>A(e)!==n),r=e.activeKey===n?ke(e,n):e.activeKey;return{...e,tabs:t,activeKey:r}})}function ke(e,t){let n=e.tabs.findIndex(e=>A(e)===t);if(n===-1)return e.activeKey;let r=e.tabs.filter(e=>A(e)!==t);return r.length===0?null:A(r[Math.min(n,r.length-1)])}function Ae(e,t,n){let r=e.tabs.filter(e=>!be(e,t)),i=n===void 0?r.length:Math.max(0,Math.min(n,r.length)),a=[...r.slice(0,i),t,...r.slice(i)];return{...e,tabs:a,activeKey:A(t)}}function je(e,t,n,r){let i=n===`left`||n===`right`?`row`:`col`,a=n===`left`||n===`top`;return L(R(e,t,e=>{let t=j([r]);return M(i,a?[t,e]:[e,t],[50,50])}))}function Me(e,t){let{fromLeafId:n,toLeafId:r,edge:i}=t;if(n===r)return e;let a=N(e,n),o=N(e,r);if(!a||!o)return e;if(i===`center`){let t=e=>e.kind===`leaf`?e.id===n?o:e.id===r?a:e:{...e,children:e.children.map(t)};return t(e)}return Ne(L(R(e,n,e=>({...e,tabs:[],activeKey:null,previewKey:null}))),a,r,i)}function Ne(e,t,n,r){let i=r===`left`||r===`right`?`row`:`col`,a=r===`left`||r===`top`;return L(R(e,n,e=>M(i,a?[t,e]:[e,t],[50,50])))}function Pe(e,t){let{ref:n,toLeafId:r,edge:i}=t,a=A(n),o=t.copy===!0&&!xe(n),s=t.index;if(i===`center`&&s!==void 0){let t=N(e,r)?.tabs.findIndex(e=>A(e)===a)??-1;t!==-1&&t<s&&--s}let c=o?e:Oe(e,t.fromLeafId,a);if(i===`center`){let e=R(c,r,e=>Ae(e,n,s));return!N(e,r)&&!Ce(e,a)?z(L(Fe(e,n)),a):z(L(e),a)}return N(c,r)?z(je(c,r,i,n),a):L(j([n]))}function Fe(e,t){let n=P(e)[0];return n?R(e,n.id,e=>Ae(e,t)):j([t])}function Ie(e,t,n){return L(R(e,t,e=>e.tabs.some(e=>A(e)===n)?{...e,tabs:e.tabs.filter(e=>A(e)!==n),activeKey:e.activeKey===n?ke(e,n):e.activeKey}:e))}function Le(e,t,n){let r=A(n);return L(R(e,t,e=>{let t=e.previewKey===r?null:e.previewKey;return e.tabs.some(e=>be(e,n))?{...e,activeKey:r,previewKey:t}:{...e,tabs:[...e.tabs,n],activeKey:r,previewKey:t}}))}function Re(e,t,n){let r=A(n);return L(R(e,t,e=>e.tabs.some(e=>A(e)===r)?{...e,tabs:e.tabs.map(e=>A(e)===r?n:e),previewKey:e.previewKey===r?null:e.previewKey}:{...e,tabs:[...e.tabs,n]}))}function ze(e,t,n){let r=A(n);return R(e,t,e=>({...e,tabs:e.tabs.map(e=>A(e)===r?n:e)}))}function Be(e,t,n){let r=fe(t),i=e=>e.kind===`split`?{...e,children:e.children.map(i)}:{...e,tabs:e.tabs.map(e=>e.type===`editor`&&fe(e.tab)===r?{...e,tab:{...e.tab,compile_mode:n}}:e)};return i(e)}function Ve(e,t){return e.type!==`editor`||t.type!==`editor`||e.tab.view!==`preview`||t.tab.view!==void 0||pe(t.tab.path)===null?t:{...t,tab:{...t.tab,view:`preview`}}}function He(e,t,n){let r=A(n);return L(R(e,t,e=>{if(e.tabs.some(e=>be(e,n)))return{...e,activeKey:r};let t=e.previewKey?e.tabs.findIndex(t=>A(t)===e.previewKey):-1,i=t>=0?e.tabs[t]:void 0,a=e.tabs.length>1&&i!==void 0&&i.type===`editor`&&!Se(i),o=i?Ve(i,n):n,s=a?e.tabs.map((e,n)=>n===t?o:e):[...e.tabs,o];return{...e,tabs:s,activeKey:r,previewKey:r}}))}function z(e,t){let n=e=>e.kind===`leaf`?e.previewKey===t?{...e,previewKey:null}:e:{...e,children:e.children.map(n)};return n(e)}function Ue(e,t,n,r){return R(e,t,e=>{let t=e.tabs.findIndex(e=>e.type===`editor`&&A(e)===n),i=t>=0?e.tabs[t]:void 0;if(i===void 0||i.type!==`editor`)return e;let a={...i,tab:{...i.tab,view:r}},o=A(a);if(o===n)return{...e,tabs:e.tabs.map((e,n)=>n===t?a:e)};let s=e.tabs.some((e,n)=>n!==t&&A(e)===o),c=s?e.tabs.filter((e,n)=>n!==t):e.tabs.map((e,n)=>n===t?a:e);return{...e,tabs:c,activeKey:e.activeKey===n?o:e.activeKey,previewKey:e.previewKey===n?s?null:o:e.previewKey??null}})}function We(e,t){let n=T(e);return n!==`commit`&&n!==`untitled`&&e.session===t.session&&e.path===t.path&&e.root===t.root}function Ge(e,t,n){if(n===t.path)return e;let r=!1,i=e=>{if(e.kind===`split`){let t=e.children.map(i);return t.some((t,n)=>t!==e.children[n])?{...e,children:t}:e}let a=new Map,o=!1,s=e.tabs.map(e=>{if(e.type!==`editor`||!We(e.tab,t))return e;let r={...e,tab:{...e.tab,path:n}};return a.set(A(e),A(r)),o=!0,r});if(!o)return e;r=!0;let c=e.activeKey,l=e.previewKey??null;return{...e,tabs:s,activeKey:c===null?null:a.get(c)??c,previewKey:l===null?null:a.get(l)??l}},a=i(e);return r?a:e}function Ke(e){if(e.type!==`editor`)return null;let t=e.tab,n=T(t);return n!==`file`&&n!==`external`||t.view===`linked`||t.view===`locked`||pe(t.path)===null?null:t}function qe(e,t){let n=Ke(t);if(!n)return e;let r=!1,i=e=>{if(e.kind===`split`)return{...e,children:e.children.map(i)};let t=!1,a=e.tabs.map(e=>{if(e.type!==`editor`||!Se(e))return e;let r=e.tab;return r.session===n.session&&r.path===n.path&&(r.root??``)===(n.root??``)&&T(r)===T(n)?e:(t=!0,{type:`editor`,tab:{session:n.session,path:n.path,...n.kind===void 0?{}:{kind:n.kind},...n.root===void 0?{}:{root:n.root},view:r.view}})});return t?(r=!0,{...e,tabs:a}):e},a=i(e);return r?a:e}function Je(e,t){return e.session===t.session&&e.path===t.path&&(e.root??``)===(t.root??``)&&T(e)===T(t)}function Ye(e,t,n){let r=P(e).flatMap(e=>e.tabs.flatMap(n=>n.type!==`editor`||n.tab.view===`linked`||n.tab.view===`locked`||!Je(n.tab,t)?[]:[{leafId:e.id,ref:n}]));return r.find(({leafId:e})=>e===n)??r.find(({ref:e})=>(e.tab.view??`source`)===`source`)??r[0]??null}function Xe(e,t,n){return R(e,t,e=>e.tabs.some(e=>A(e)===n)?{...e,activeKey:n}:e)}function Ze(e,t,n){function r(e){return e.kind===`leaf`?e:e.id===t&&n.length===e.children.length?{...e,children:e.children.map(r),sizes:[...n]}:{...e,children:e.children.map(r)}}return r(e)}function Qe(e){let t=e.type===`editor`?e.tab.session:e.session;return t===`00000000-0000-0000-0000-000000000000`?null:t}function $e(e){return t=>{let n=Qe(t);return n===null||e.has(n)}}function B(e,t){let n=e=>e.kind===`leaf`?{...e,tabs:e.tabs.filter(t)}:{...e,children:e.children.map(n)};return L(n(e))}function et(e){let t=new Set,n=[];for(let r of e){let e=L(B(r,e=>!t.has(A(e)))),i=F(e);if(i.length!==0){for(let e of i)t.add(A(e));n.push(e)}}return n.length===0?j([]):I(n.length===1?n[0]:L(M(`row`,n)))}function V(e){let t=e.editor_tabs.map(e=>({type:`editor`,tab:e})),n=e.session_tabs.map(e=>({type:`terminal`,session:e})),r=e.active_editor_tab?A({type:`editor`,tab:e.active_editor_tab}):null,i=e.active_session?`term:${e.active_session}`:null;if(t.length===0&&n.length===0)return j([]);if(t.length===0)return j(n,i);if(n.length===0)return j(t,r);let a=e.layout,o=typeof a.editor==`number`?a.editor:40,s=typeof a.session==`number`?a.session:60;return L(M(`col`,[j(t,r),j(n,i)],[o,s]))}var tt={layout_tree:null,active_session:null,layout_ref:null};function nt(e){return e.type===`editor`?e.tab.session:e.session}function rt(e,t){let n=new Set;for(let[r,i]of Object.entries(e))if(!(r===t||!i.layout_tree))for(let e of F(i.layout_tree))e.type===`terminal`&&n.add(e.session);return[...n]}function H(e,t){let n=e.project_layouts[t];return{...e,layout_tree:n?.layout_tree??null,active_session:n?.active_session??null,layout_ref:n?.layout_ref??null,session_tabs:[],editor_tabs:[],active_editor_tab:null}}function it(e,t,n){return n?{loaded:e.loaded,snapshot:H(e.snapshot,t),current:()=>H(e.current(),t),update(n){let r={},i={...n};if(`layout_tree`in n&&(r.layout_tree=n.layout_tree??null,delete i.layout_tree),`active_session`in n&&(r.active_session=n.active_session??null,delete i.active_session),`layout_ref`in n&&(r.layout_ref=n.layout_ref??null,delete i.layout_ref),Object.keys(r).length>0){let n=e.current().project_layouts;i.project_layouts={...n,[t]:{...n[t]??tt,...r}}}Object.keys(i).length>0&&e.update(i)}}:e}function at(e,t,n,r){let i=e.layout_tree??V(e),a={};for(let o of t)a[o]={layout_tree:Ee(B(i,e=>{let i=nt(e);return i===`00000000-0000-0000-0000-000000000000`?o===(r??t[0]):n.get(i)===o})),active_session:e.active_session!==null&&n.get(e.active_session)===o?e.active_session:null,layout_ref:null};return{layout_mode:`project`,project_layouts:a}}function ot(e,t,n={}){return{...e,...t,...n}}function st(e,t,n){let r=t.layout_tree?B(t.layout_tree,e=>{let t=nt(e);return t===`00000000-0000-0000-0000-000000000000`||n.alive.has(t)}):null,i=t.active_session!==null&&n.alive.has(t.active_session)?t.active_session:null;if(t.scope===`profile`)return{projectBased:!1,patch:{layout_mode:`profile`,layout_tree:r,active_session:i,layout_ref:t.id}};let a=t.project_id??n.currentProject??n.projectIds[0]??``,o={layout_tree:r,active_session:i,layout_ref:t.id};if((e.layout_mode??`profile`)===`project`)return{projectBased:!0,patch:{project_layouts:{...e.project_layouts,[a]:o}}};let s=at(e,n.projectIds,n.sessionProject,a);return{projectBased:!0,patch:{...s,project_layouts:ot(s.project_layouts??{},e.project_layouts,{[a]:o})}}}function ct(e,t){let n=e.project_layouts,r=[...t.filter(e=>e in n),...Object.keys(n).filter(e=>!t.includes(e))].map(e=>n[e]);return{layout_mode:`profile`,project_layouts:{},layout_tree:et(r.map(e=>e.layout_tree).filter(e=>e!==null)),active_session:r.map(e=>e.active_session).find(e=>e!==null)??null,layout_ref:null}}function U(e,t,n,r,i){let a={};for(let[o,s]of Object.entries(e)){let e=o.indexOf(`[`);if(!(e<0))try{let c=JSON.parse(o.slice(e));if(!Array.isArray(c)||c.length!==3||typeof c[0]!=`string`)continue;let l=JSON.parse(c[0]);if(!Array.isArray(l)||l.length!==3||typeof l[0]!=`string`||typeof l[1]!=`string`||typeof l[2]!=`string`||i!==void 0&&!i.has(l[2])||!l[0].endsWith(`:${n}`))continue;let u=t.get(l[1]);if(!u)continue;let d=`${l[0].slice(0,-n.length)}${r}`;a[o.slice(0,e)+JSON.stringify([JSON.stringify([d,u,l[2]]),...c.slice(1)])]=s}catch{}}return a}function W(e,t){return new Set(e?t.filter(t=>F(e).some(e=>o(e,t))).map(E):[])}function lt(e,t){return e.kind===`leaf`?e.id===t?j():e:L({...e,children:e.children.map(e=>lt(e,t))})}function ut(e,t,n){let r=e.snapshot,i=r.layout_mode===`project`?H(r,t):r,a=i.layout_tree,o=a&&N(a,n);if(!a||!o)throw Error(`The pane has changed; try opening it again`);let s=lt(a,n),c=i.active_session&&F(s).some(e=>e.type!==`editor`&&e.session===i.active_session)?i.active_session:null,l=r.layout_mode===`project`?{...r,project_layouts:{...r.project_layouts,[t]:{...r.project_layouts[t],layout_tree:s,active_session:c}}}:{...r,layout_tree:s,active_session:c},u=o.tabs.find(e=>A(e)===o.activeKey);return G(e,l,{...i,layout_mode:`profile`,layout_tree:o,project_layouts:{},session_tabs:[],editor_tabs:[],active_editor_tab:null,active_session:u&&u.type!==`editor`?u.session:null,layout_ref:null},t)}function dt(e,t,n,r){let i=e.snapshot,a=A(n),o=l(n),s=(i.layout_mode===`project`?[t,...Object.keys(i.project_layouts).filter(e=>e!==t)].map(e=>({id:e,snapshot:H(i,e)})):[{id:t,snapshot:i}]).flatMap(e=>(e.snapshot.layout_tree?P(e.snapshot.layout_tree):[]).filter(e=>(!r||r===e.id)&&e.tabs.some(e=>l(e)===o)).map(t=>({scope:e,leaf:t}))).at(0);if(r&&!s)throw Error(`The tab has changed; try opening it again`);let c=s?.leaf.tabs.find(e=>l(e)===o)??n,u=j([c]);s&&(u.id=s.leaf.id);let d=i;if(s){let e=Ie(s.scope.snapshot.layout_tree,s.leaf.id,a),t=s.scope.snapshot.active_session,n=t&&F(e).some(e=>e.type!==`editor`&&e.session===t)?t:null;d=i.layout_mode===`project`?{...i,project_layouts:{...i.project_layouts,[s.scope.id]:{...i.project_layouts[s.scope.id],layout_tree:e,active_session:n}}}:{...i,layout_tree:e,active_session:n}}let f={...i.layout_mode===`project`?H(i,t):i,layout_mode:`profile`,project_layouts:{},layout_tree:u,session_tabs:[],editor_tabs:[],active_editor_tab:null,layout_ref:null,active_session:c.type===`editor`?null:c.session};return G(e,d,f,s?.scope.id??t)}function G(e,t,n,r){let i=W(n.layout_tree,e.buffers),a=W(t.layout_mode===`project`?null:t.layout_tree,e.buffers);if(t.layout_mode===`project`)for(let n of Object.values(t.project_layouts))for(let t of W(n.layout_tree,e.buffers))a.add(t);return{source:{snapshot:t,buffers:e.buffers.filter(e=>!i.has(E(e))||a.has(E(e))),views:e.views},destination:{snapshot:n,buffers:e.buffers.filter(e=>i.has(E(e))),views:{...e.views,...U(e.views,new Map(P(n.layout_tree).map(e=>[e.id,e.id])),e.snapshot.layout_mode===`project`?`project:${r}`:`profile`,`profile`)}}}}function ft(e,t){let n=new Map(e.buffers.map(e=>[E(e),e]));for(let e of t.buffers){let t=E(e),r=n.get(t);if(r&&(r.content!==e.content||r.baseMtimeMs!==e.baseMtimeMs||!a(r.baseRevision,e.baseRevision)))throw Error(`Both windows have different unsaved edits to ${e.path}`);n.set(t,e)}return[...n.values()]}function K(e,t,n){let r=e.layout_mode===`project`&&n!==void 0,i=r?e.project_layouts[n]?.layout_tree:e.layout_tree,a=i?F(i):[],s=t.filter(e=>!a.some(t=>o(t,e))).map(e=>({type:`editor`,tab:{session:e.session,path:e.path,...e.root===void 0?{}:{root:e.root},kind:e.session===`00000000-0000-0000-0000-000000000000`?`untitled`:`file`,view:`source`}}));if(!s.length)return e;let c=j(s),l=i?I(L(M(`row`,[i,c]))):c;return r?{...e,project_layouts:{...e.project_layouts,[n]:{...e.project_layouts[n]??{active_session:null,layout_ref:null},layout_tree:l}}}:{...e,layout_tree:l}}function q(e,t,n,r){let i=e.snapshot,a=i.layout_mode===`project`?H(i,t):i,o=a.layout_tree??V(a),s=e=>{let i=e.type===`editor`?e.tab.session:e.session;return i===`00000000-0000-0000-0000-000000000000`?t===r:n.get(i)===t},c=i.layout_mode===`project`?o:B(o,s),u=new Set(F(c).map(l)),d=Object.fromEntries(Object.entries(i.project_layouts).map(([e,t])=>[e,{...t,layout_tree:t.layout_tree?B(t.layout_tree,e=>!u.has(l(e))):null,active_session:t.active_session&&F(c).some(e=>e.type!==`editor`&&e.session===t.active_session)?null:t.active_session}])),f=i.layout_mode===`project`?j():B(o,e=>!s(e)),p=(e,t)=>t!==null&&F(e).some(e=>e.type!==`editor`&&e.session===t);return G(e,i.layout_mode===`project`?{...i,project_layouts:{...i.project_layouts,[t]:{layout_tree:f,active_session:null,layout_ref:null}}}:{...i,layout_tree:f,project_layouts:d,active_session:p(f,i.active_session)?i.active_session:null},{...a,layout_tree:c,layout_mode:`profile`,project_layouts:{},session_tabs:[],editor_tabs:[],active_editor_tab:null,active_session:p(c,a.active_session)?a.active_session:null,layout_ref:i.layout_mode===`project`?a.layout_ref:null},t)}function pt(e,t,n){if(t.snapshot.layout_mode!==`profile`||!t.snapshot.layout_tree)throw Error(`The returned project has no isolated workspace`);let r=ft(e,t),i=e.snapshot,a=i.layout_mode===`project`?H(i,n):i,o=t.snapshot.layout_tree,s=new Set(F(o).flatMap(e=>e.type===`terminal`?[e.session]:[])),c=e=>B(e,e=>e.type!==`terminal`||!s.has(e.session)),l=c(a.layout_tree??V(a)),u=new Set,d=e=>{e&&(u.add(e.id),e.kind===`split`&&e.children.forEach(d))};d(l),i.layout_mode===`project`&&Object.values(i.project_layouts).forEach(e=>d(e.layout_tree));let f=new Map,p=e=>{let t=e.id;for(;u.has(t);)t=crypto.randomUUID();return u.add(t),e.kind===`leaf`?(f.set(e.id,t),{...e,id:t}):{...e,id:t,children:e.children.map(p)}},m=p(o),h=F(l).length?L({kind:`split`,id:crypto.randomUUID(),direction:`row`,children:[l,m],sizes:[50,50]}):m,g=t.snapshot,_={...i,layout:g.layout,explorer_pin:g.explorer_pin,explorer_open:g.explorer_open,sidebar_mode:g.sidebar_mode,sidebar_collapsed:g.sidebar_collapsed,sessions_collapsed:g.sessions_collapsed,session_order:[...new Set([...g.session_order,...i.session_order])]};if(i.layout_mode===`project`){let e={...i.project_layouts};for(let[t,r]of Object.entries(e))t===n||!r.layout_tree||(e[t]={...r,layout_tree:c(r.layout_tree),active_session:r.active_session&&s.has(r.active_session)?null:r.active_session});e[n]={layout_tree:h,active_session:g.active_session,layout_ref:g.layout_ref},_={..._,project_layouts:e}}else{let e={...i.project_layouts};delete e[n];for(let[t,n]of Object.entries(e))n.layout_tree&&(e[t]={...n,layout_tree:c(n.layout_tree),active_session:n.active_session&&s.has(n.active_session)?null:n.active_session});_={..._,layout_tree:h,project_layouts:e,active_session:g.active_session}}return _=K(_,t.buffers,n),{snapshot:_,buffers:r,views:{...e.views,...U(t.views,f,`profile`,i.layout_mode===`project`?`project:${n}`:`profile`)}}}function J(e){return e.layout_mode===`project`?Object.entries(e.project_layouts).map(([e,t])=>({scope:`project:${e}`,tree:t.layout_tree})):[{scope:`profile`,tree:e.layout_tree}]}function mt(e,t,n){return{...e,layout_mode:t?.layout_mode??`profile`,layout_tree:t?.layout_tree??j(),active_session:t?.active_session??null,project_layouts:Object.fromEntries(Object.entries(t?.project_layouts??{}).map(([e,t])=>[e,{...t,layout_ref:null}])),layout_ref:n??null,session_tabs:[],editor_tabs:[],active_editor_tab:null}}function ht(e,t,n,r,i,a){let o={...t?.project_layouts[n]??{layout_tree:j(),active_session:null},layout_ref:a??null};if(e.layout_mode===`project`)return{...e,project_layouts:{...e.project_layouts,[n]:o}};let s=q({snapshot:e,buffers:[],views:{}},n,r,i??``).source.snapshot,c=[s.layout_tree,o.layout_tree].filter(e=>e!==null).filter(e=>F(e).length>0),l=c.length?I(L(c.length===1?c[0]:M(`row`,c))):j();return{...e,layout_tree:l,active_session:o.active_session??s.active_session,project_layouts:{...e.project_layouts,[n]:o},session_tabs:[],editor_tabs:[],active_editor_tab:null}}function gt(e,t){let n={...e.views};for(let r of t)for(let t of J(r.snapshot))if(t.tree){for(let i of J(e.snapshot))if(i.tree)for(let e of P(t.tree))for(let a of P(i.tree)){let o=new Set(a.tabs.map(l)),s=new Set(e.tabs.filter(e=>o.has(l(e))).map(A));s.size&&Object.assign(n,U(r.views,new Map([[e.id,a.id]]),t.scope,i.scope,s))}}return n}var _t=(e,t)=>e.content===t.content&&e.baseMtimeMs===t.baseMtimeMs&&a(e.baseRevision,t.baseRevision),vt=e=>/^\/project\/([0-9a-f]{10})/.exec(e??``)?.[1];function yt(e,t,n){let r=t.entries.flatMap(e=>(e.version?.content.buffers??[]).map(t=>({entry:e,buffer:t}))),i=new Map;for(let{buffer:e}of r){let t=E(e),n=i.get(t)??[];n.some(t=>_t(t,e))||n.push(e),i.set(t,n)}let a=new Map(e.map(e=>[e.identity.id,new Set(r.filter(({buffer:t})=>J(e.content.snapshot).flatMap(({tree:e})=>e?F(e):[]).some(e=>o(e,t))).map(({buffer:e})=>E(e)))]));for(let n of e){let e=t.entries.find(e=>e.identity.id===n.identity.id);for(let t of a.get(n.identity.id)){let r=i.get(t);if(!r?.length)continue;let a=e?.version?.content.buffers.find(e=>E(e)===t);if(!a&&r.length>1)throw Error(`Windows have different unsaved edits to ${r[0].path}; keep their separate windows or resolve those edits first`);n.content.buffers.push(a??r[0])}}for(let{entry:i,buffer:a}of r){let r=E(a);if(e.some(e=>e.content.buffers.some(e=>E(e)===r&&_t(e,a))))continue;let o=t.request.scope===`project`&&i.identity.kind!==`host`?t.request.projectId:n.get(a.session)??(i.identity.kind===`host`?vt(i.route):i.identity.projectId),s=e.find(e=>e.identity.id===i.identity.id);if(t.request.scope===`project`&&i.identity.kind===`host`&&o!==t.request.projectId&&s){s.content.buffers.push(a);continue}let c=e.find(e=>e.identity.kind===`project`&&e.identity.projectId===o),l=(s?.identity.kind===`host`?c??s:s)??c??e.find(e=>e.identity.kind===`host`),u=l.content.buffers.find(e=>E(e)===r);if(u&&!_t(u,a))throw Error(`Both windows have different unsaved edits to ${a.path}`);u||l.content.buffers.push(a);let d=l.identity.kind===`host`?o??vt(l.route):l.identity.projectId;if(l.content.snapshot.layout_mode===`project`&&(d??=Object.keys(l.content.snapshot.project_layouts)[0],!d))throw Error(`Open a project before recovering these unsaved files into its layout`);l.content.snapshot=K(l.content.snapshot,[a],d),l.identity.kind===`host`&&d&&l.route===`/`&&(l.route=`/project/${d}`)}}function bt(e,t){let{request:n}=e,i=e.entries.find(t=>t.identity.id===e.ownerId);if(i?.identity.kind!==`host`||!i.version)throw Error(`The host layout has not loaded`);let a=[],o=new Map(e.slots.map(e=>[e.identity.id,e])),s=new Set([e.ownerId,...o.keys()]);for(let r of e.entries){if(!s.has(r.identity.id))continue;let e=o.get(r.identity.id),c=n.arrangement.windows.find(t=>t.key===e?.key),l=r.version?.content??{...i.version.content,buffers:[],views:{}},u=r.identity.kind===`host`,d=/^\/project\/([0-9a-f]{10})/.exec(r.route??``)?.[1],f=u&&n.scope===`project`?ht(l.snapshot,c,n.projectId,t,d,n.layoutRef):mt(l.snapshot,c,u?n.layoutRef:void 0),p=r.identity.kind===`host`?n.scope===`project`?n.projectId:c?.project_id:r.identity.projectId,m=n.arrangement.windows.some(e=>e.kind===`project`&&e.project_id===p),h=p&&(!u||!m)?`/project/${p}`:`/`;a.push({identity:r.identity,content:{snapshot:f,buffers:[],views:l.views},route:h})}yt(a,e,t);for(let t of a){let n=e.entries.filter(e=>e.version).sort((e,n)=>Number(e.identity.id===t.identity.id)-Number(n.identity.id===t.identity.id)).map(e=>e.version.content);t.content.views=gt(t.content,n)}return c.parse({changes:e.entries.map(e=>{let t=a.find(t=>t.identity.id===e.identity.id);return t?{id:e.identity.id,content:t.content,route:t.route}:{id:e.identity.id,content:{snapshot:r.parse({}),buffers:[],views:{}},route:e.route??`/`}})})}var xt=class{preference;pending;constructor(e){this.preference=e}request(e){this.pending=e}select(e,t,n,r){return r?this.pending=void 0:e!==this.preference&&(this.pending=e),this.preference=e,n!==void 0&&n===`project`===this.pending&&(this.pending=void 0),t||r?this.pending??(n===void 0?e:n===`project`):e}},St=class{profileId;bridge;content;reportError;onSaved;staged;snapshot=r.parse({});revision=0;generation=0;savedGeneration=0;ready=!1;durable=!1;frozen=!1;checkpointing=!1;loading=null;writing=null;timer;listeners=new Set;constructor(e,t,n,r,i,a=!1){this.profileId=e,this.bridge=t,this.content=n,this.reportError=r,this.onSaved=i,this.staged=a,this.frozen=a}get=()=>this.snapshot;loaded=()=>this.ready;restored=()=>this.durable;locked=()=>this.frozen;subscribe=e=>(this.listeners.add(e),()=>this.listeners.delete(e));notify(){for(let e of this.listeners)e()}load(e){return this.loading||=(async()=>{let t=await this.bridge.read(this.profileId);if(t)this.requireSupported(t.content.snapshot),this.durable=!0,this.revision=t.revision,this.snapshot=t.content.snapshot,this.content.restore(t.content);else{if(this.staged)throw Error(`The prepared window is no longer available`);let t=await e();this.requireSupported(t),this.snapshot=t,this.content.restore({snapshot:this.snapshot,buffers:[],views:{}})}this.ready=!0,this.notify(),t||(this.generation++,await this.flush())})().catch(e=>{throw this.loading=null,e}),this.loading}update(e){if(!this.ready)throw Error(`Window working set has not loaded`);if(this.staged)return;if(this.frozen)throw Error(`Window transfer is pending`);let t={...this.snapshot,...e};this.requireSupported(t),this.snapshot=t,this.changed(),this.notify()}requireSupported(e){if(!this.bridge.huddles&&i(e))throw Error(`Update the desktop app before opening this workspace: it contains huddle tabs`)}changed(){!this.ready||this.staged||(this.generation++,!this.frozen&&(clearTimeout(this.timer),this.timer=setTimeout(()=>{this.timer=void 0,this.flush().catch(this.reportError)},250)))}flush(){if(clearTimeout(this.timer),this.timer=void 0,this.staged)return Promise.resolve();if(this.writing)return this.writing;let e=this.drain().finally(()=>{this.writing===e&&(this.writing=null)});return this.writing=e,e}async drain(){for(;this.savedGeneration<this.generation;){let e=this.generation,t={snapshot:this.snapshot,...this.content.capture(this.snapshot)},n;try{n=await this.bridge.write({profileId:this.profileId,revision:this.revision,content:t})}catch(e){let r=await this.bridge.read(this.profileId).catch(()=>null);if(!r||r.revision<=this.revision||JSON.stringify(r.content)!==JSON.stringify(t))throw e;n=r}this.revision=n.revision,this.savedGeneration=e,this.onSaved?.(n)}}async freeze(e=`transfer`){if(!this.ready||this.frozen)throw Error(`Window cannot start another transfer`);this.frozen=!0,this.checkpointing=e===`checkpoint`,this.generation++,this.notify();try{return await this.flush(),{revision:this.revision,content:{snapshot:this.snapshot,...this.content.capture(this.snapshot)}}}catch(e){throw this.frozen=!1,this.notify(),e}}resume(){!this.frozen||this.staged||(this.frozen=!1,this.checkpointing=!1,this.changed(),this.notify())}async checkpoint(){if(await this.loading,this.ready){if(this.frozen)throw Error(`A window transfer is still pending`);await this.freeze(`checkpoint`)}}resumeCheckpoint(){this.checkpointing&&this.resume()}matchesCapture(e){if(!this.frozen||this.revision!==e.revision)return!1;let t={snapshot:this.snapshot,buffers:this.content.capture(this.snapshot).buffers};return JSON.stringify(t)===JSON.stringify({snapshot:e.content.snapshot,buffers:e.content.buffers})}sealedCapture(){if(!this.ready||!this.frozen||this.writing)throw Error(`Window is not sealed`);return{revision:this.revision,content:{snapshot:this.snapshot,...this.content.capture(this.snapshot)}}}beginStaging(){if(!this.frozen||this.staged||this.writing)throw Error(`Window cannot stage a transfer`);this.staged=!0}stage(e){if(!this.frozen||!this.staged||this.writing||e.revision!==this.revision)throw Error(`Window state changed before staging`);this.snapshot=e.content.snapshot,this.content.restore(e.content),this.notify()}adopt(e,t,n){if(!this.frozen||this.writing)throw Error(`Window is not ready to adopt a transfer`);if(e.revision<this.revision)throw Error(`Window revision moved backwards`);let r=e=>JSON.stringify([e.session,e.path,e.root??null]),i=new Map(t?.content.buffers.map(e=>[r(e),e])),a=t?this.content.capture(this.snapshot).buffers.filter(e=>JSON.stringify(i.get(r(e)))!==JSON.stringify(e)):[],o=new Map(e.content.buffers.map(e=>[r(e),e]));for(let e of a)o.set(r(e),e);return this.snapshot=a.length?K(e.content.snapshot,a,n):e.content.snapshot,this.revision=e.revision,this.durable=!0,this.content.restore(a.length?{...e.content,snapshot:this.snapshot,buffers:[...o.values()]}:e.content),this.savedGeneration=this.generation,this.frozen=!1,this.staged=!1,this.checkpointing=!1,this.notify(),a.length&&(this.changed(),this.reportError(Error(`An edit finished during the move. Its latest text remains open in this window for review.`))),a.length}};function Ct(e){let t={...e.base,project_layouts:{...e.base.project_layouts}},n=(e,t)=>e?et([e,t]):t;for(let{identity:r,snapshot:i}of e.detached)if(!(r.kind===`host`||!i.layout_tree))if(t.layout_mode===`project`){let e=t.project_layouts[r.projectId];t.project_layouts[r.projectId]={layout_tree:n(e?.layout_tree??null,i.layout_tree),active_session:e?.active_session??i.active_session,layout_ref:e?.layout_ref??null}}else t.layout_tree=n(t.layout_tree,i.layout_tree);return t}var Y=null,X=null;function wt(e){return Y=e,()=>{Y===e&&(Tt(),Y=null)}}function Tt(){X?.abort(),X=null}function Et(e){if(X)return;if(!Y)throw Error(`Wait for this pane to finish loading before closing it`);let t=new AbortController;X=t,Y(t.signal).catch(e).finally(()=>{X===t&&(X=null)})}async function Dt(e,t,n,r,i,a,o,c,l,u){let d=Promise.resolve(),f=e.onCommand(f=>{d=d.then(async()=>{let d=s.parse(f),p,m,h;try{if(d.kind===`checkpoint`){Tt(),n(!0);let e=(await Promise.allSettled([...t()].map(e=>e.checkpoint()))).find(e=>e.status===`rejected`);if(e?.status===`rejected`)throw e.reason}else if(d.kind===`review-close`)Et(r);else if(d.kind===`plan-layout`){if(!u)throw Error(`Window layout planning is unavailable`);h=await u(d)}else if(d.kind===`seal-layout`||d.kind===`stage-layout`||d.kind===`verify-layout`||d.kind===`finish-layout`){if(!l)throw Error(`This window cannot stage a layout arrangement`);m=await l(d)}else if(d.kind===`activate-tab`){if(!i)throw Error(`This window cannot activate the requested tab`);await i(d)}else if(d.kind===`resume`){for(let e of t())e.resume();n(!1)}else if(d.kind===`navigate-project`||d.kind===`open-project`){if(!c)throw Error(`Project window navigation is unavailable`);c(d)}else if(d.kind===`move-pane`||d.kind===`move-tab`||d.kind===`move-project`){if(!o)throw Error(`This window cannot move the requested pane`);o(d)}else{if(!a)throw Error(`This window cannot receive a transfer`);m=await a(d)}}catch(e){p=(e instanceof Error?e.message:`Could not save this window`).slice(0,2048)}await e.reply({id:d.id,...p?{error:p}:{},...m?{version:m}:{},...h?{arrangement:h}:{}})}).catch(r)});try{await e.ready()}catch(e){throw f(),e}return f}function Ot(e,t,n,r){return At(e,t,n,{kind:`pane`,placement:r})}function kt(e,t,n,r){return At(e,t,n,{kind:`tab`,placement:r})}function At(e,t,n,r){let{placement:i}=r,a=t.snapshot.layout_tree;if(a?.kind!==`leaf`||t.snapshot.layout_mode===`project`||Object.keys(t.snapshot.project_layouts).length!==0)throw Error(`Only an isolated pane can be docked`);if(r.kind===`tab`&&a.tabs.length!==1)throw Error(`A tab drop requires exactly one tab`);let o=ft(e,t),s=e.snapshot,c=s.layout_mode===`project`?H(s,n):s,l=c.layout_tree??V(c),u=i?.paneId??P(l).at(-1).id;if(!N(l,u))throw Error(`The destination pane has changed`);let d=new Set,f=e=>{e&&(d.add(e.id),e.kind===`split`&&e.children.forEach(f))};if(f(l),s.layout_mode===`project`)for(let e of Object.values(s.project_layouts))f(e.layout_tree);let p=r.kind===`tab`&&r.placement.edge===`center`,m=p?u:a.id;if(!p)for(;d.has(m);)m=crypto.randomUUID();let h={...a,id:m},g=new Set(a.tabs.flatMap(e=>e.type===`terminal`?[e.session]:[])),_=e=>B(e,e=>e.type!==`terminal`||!g.has(e.session)),v=e=>e.kind===`leaf`?e.id===m?e:_(e):{...e,children:e.children.map(v)},ee=B(v(p?Pe(l,{ref:a.tabs[0],fromLeafId:``,toLeafId:u,edge:`center`,index:r.placement?.index,copy:!0}):Ne(l,h,u,i?.edge===`center`?`right`:i?.edge??`right`)),()=>!0),y=t.snapshot.active_session&&g.has(t.snapshot.active_session)?t.snapshot.active_session:null,b;if(s.layout_mode===`project`){let e={...s.project_layouts};for(let[t,r]of Object.entries(e))t===n||!r.layout_tree||F(r.layout_tree).some(e=>e.type===`terminal`&&g.has(e.session))&&(e[t]={...r,layout_tree:_(r.layout_tree),active_session:r.active_session&&g.has(r.active_session)?null:r.active_session});e[n]={...e[n]??{layout_ref:null},layout_tree:ee,active_session:y},b={...s,project_layouts:e}}else b={...s,layout_tree:ee,active_session:y};return{snapshot:b,buffers:o,views:{...e.views,...U(t.views,new Map([[a.id,m]]),`profile`,s.layout_mode===`project`?`project:${n}`:`profile`,r.kind===`tab`?new Set(a.tabs.map(A)):void 0)}}}var jt=class{environment;pending=null;constructor(e){this.environment=e}async command(e){if(e.kind===`plan-pane`||e.kind===`plan-tab`||e.kind===`plan-project`)return this.plan(e);let t=this.pending;if(!t){if(e.kind===`cancel-window`)return;throw Error(`The destination plan is unavailable`)}if(e.transferId!==t.id||e.profileId!==t.profileId)throw Error(`The destination belongs to another transfer`);if(e.kind===`cancel-window`){t.staged&&this.environment.suspend(!0);let e=t.owner.adopt(t.original,t.staged??t.original,t.projectId);this.environment.navigate(t.route),this.environment.staging(),this.pending=null,this.environment.suspend(!1),this.environment.fence(!1),e&&await t.owner.flush();return}if(this.environment.activeProfile()!==t.profileId||!t.owner.matchesCapture(t.original))throw Error(`The destination changed while preparing the move`);if(t.owner.beginStaging(),this.environment.suspend(!0),await Promise.resolve(),!t.owner.matchesCapture(t.original))throw Error(`The destination changed while releasing its views`);let n=await this.environment.read(t.profileId);if(!n||JSON.stringify(n)!==JSON.stringify(t.planned))throw Error(`The prepared destination has changed`);t.owner.stage(n),t.staged=n,this.environment.staging(t.id),this.environment.navigate(t.destinationRoute),this.environment.suspend(!1)}async plan(e){if(this.pending)throw Error(`This window is already receiving a transfer`);if(this.environment.activeProfile()!==e.profileId)throw Error(`Select the same profile in the destination window before docking`);let t=await this.environment.owner(e.profileId);if(this.environment.activeProfile()!==e.profileId)throw Error(`The destination profile changed`);this.environment.fence(!0);let n;try{n=await t.freeze();let r=u.parse({revision:n.revision,content:e.kind===`plan-project`?pt(n.content,e.content,e.projectId):e.kind===`plan-pane`?Ot(n.content,e.content,e.projectId,e.placement):kt(n.content,e.content,e.projectId,e.placement)});return this.pending={id:e.transferId,profileId:e.profileId,projectId:e.projectId,owner:t,original:n,planned:r,route:this.environment.route(),destinationRoute:e.kind===`plan-project`?e.route??`/project/${e.projectId}`:`/project/${e.projectId}`},r}catch(e){throw n&&t.resume(),t.locked()||this.environment.fence(!1),e}}async committed(e,t){let n=this.pending;if(!n||n.id!==e)return!1;if(!n.staged)throw Error(`Destination has not mounted its prepared state`);let r=n.owner.adopt(t,n.staged,n.projectId);return this.pending=null,this.environment.staging(),this.environment.fence(!1),r&&await n.owner.flush(),!0}},Mt=(e,t)=>JSON.stringify(e)===JSON.stringify(t),Nt=e=>/^\/project\/([0-9a-f]{10})/.exec(e)?.[1],Pt=class{environment;mountTimeoutMs;pending=null;finished=null;constructor(e,t=8e3){this.environment=e,this.mountTimeoutMs=t}async command(e){if(this.finished?.id===e.arrangementId){if(e.kind===`finish-layout`&&e.profileId===this.finished.profileId&&e.outcome===this.finished.outcome)return;throw Error(`This layout arrangement has already finished`)}if(this.pending&&(this.pending.id!==e.arrangementId||this.pending.profileId!==e.profileId))throw Error(`This window belongs to another layout arrangement`);if(e.kind===`seal-layout`)return this.seal(e);if(e.kind===`stage-layout`)return this.stage(e);let t=this.pending;if(!t&&e.kind===`finish-layout`&&e.outcome===`cancelled`&&this.environment.initialArrangement()===e.arrangementId){let n=await this.environment.owner(e.profileId);t=this.pending={id:e.arrangementId,profileId:e.profileId,owner:n,originalRoute:this.environment.route(),mounted:!1,verified:!1}}if(!t&&e.kind===`finish-layout`&&e.outcome===`cancelled`&&!this.environment.initialArrangement()){if(this.checkProfile(e.profileId),(await this.environment.owner(e.profileId)).locked())throw Error(`Another operation still owns this window`);this.finished={id:e.arrangementId,profileId:e.profileId,outcome:`cancelled`},this.environment.fence(!1);return}if(!t)throw Error(`The window layout plan is unavailable`);if(e.kind===`finish-layout`)return this.finish(t,e.outcome);if(t.planned&&!t.mounted)throw Error(`The window has not mounted its prepared layout`);let n=t.planned??t.original;if(!n)throw Error(`The window layout capture is unavailable`);if(this.checkProfile(t.profileId),this.environment.route()!==(t.destinationRoute??t.originalRoute))throw Error(`The window route changed while applying its layout`);if(this.environment.suspend(!0),await Promise.resolve(),!t.owner.matchesCapture(n))throw Error(`The prepared layout changed while releasing its views`);return t.verified=!0,n}checkProfile(e){if(this.environment.activeProfile()!==e)throw Error(`The window profile changed while applying its layout`)}async seal(e){if(this.checkProfile(e.profileId),this.pending){if(!this.pending.original||this.pending.planned||!this.pending.owner.matchesCapture(this.pending.original))throw Error(`The window has changed since layout capture`);return this.pending.original}if(this.environment.initialArrangement())throw Error(`A prepared window cannot start another layout`);let t=await this.environment.owner(e.profileId);this.checkProfile(e.profileId),this.environment.fence(!0);try{let n=await t.freeze();if(this.pending={id:e.arrangementId,profileId:e.profileId,owner:t,original:n,originalRoute:this.environment.route(),mounted:!1,verified:!1},t.beginStaging(),this.environment.suspend(!0),await Promise.resolve(),!t.matchesCapture(n))throw Error(`The window changed while releasing its views`);return n}catch(e){throw t.locked()||this.environment.fence(!1),e}}async stage(e){this.checkProfile(e.profileId);let t=this.pending;if(!t){if(this.environment.initialArrangement()!==e.arrangementId)throw Error(`The window was not prepared for this layout`);let n=await this.environment.owner(e.profileId);this.checkProfile(e.profileId),t=this.pending={id:e.arrangementId,profileId:e.profileId,owner:n,originalRoute:this.environment.route(),mounted:!1,verified:!1}}if(t.planned){if(!Mt(t.planned,e.version)||t.destinationRoute!==e.route)throw Error(`The prepared window layout changed`);if(!t.mounted)throw Error(`The prepared window did not finish mounting`);return t.planned}if(this.environment.fence(!0),this.environment.suspend(!0),await Promise.resolve(),!t.owner.matchesCapture(t.original??e.version))throw Error(`The window changed before staging its layout`);let n=await this.environment.read(e.profileId);if(this.checkProfile(e.profileId),!n||!Mt(n,e.version))throw Error(`The durable prepared window layout changed`);t.owner.stage(n),t.planned=n,t.verified=!1,t.destinationRoute=e.route,this.environment.staging(t.id),this.environment.navigate(e.route);let r=new Promise((e,n)=>{let r=setTimeout(()=>{t.ready=void 0,n(Error(`The prepared window did not finish mounting`))},this.mountTimeoutMs);t.ready=()=>{clearTimeout(r),e()}});try{return this.environment.suspend(!1),await r,this.checkProfile(e.profileId),n}catch(e){throw t.ready?.(),t.ready=void 0,this.environment.suspend(!0),e}}mounted(e){let t=this.pending;!t?.planned||t.profileId!==e||this.environment.activeProfile()!==e||t.destinationRoute!==this.environment.route()||!t.ready||(t.mounted=!0,t.ready(),t.ready=void 0)}async finish(e,t){if(t===`committed`&&this.checkProfile(e.profileId),t===`committed`&&(!e.verified||!e.planned))throw Error(`The layout must be verified before accepting its commit`);if(this.environment.suspend(!0),await Promise.resolve(),t===`cancelled`&&!e.original){let t=await this.environment.read(e.profileId),n=e.planned&&e.owner.matchesCapture(e.planned),r=e.owner.sealedCapture();if(!n){let n=new Set(r.content.buffers.map(E));for(let e of t?.content.buffers??[])n.has(E(e))||(r.content.buffers.push(e),n.add(E(e)));r.content.snapshot=K(r.content.snapshot,r.content.buffers,Nt(this.environment.route())),e.owner.stage(r)}return e.planned=r,e.destinationRoute=this.environment.route(),e.mounted=!0,e.verified=!1,e.planned}let n=t===`committed`?{...e.planned,revision:e.planned.revision+1}:e.original,r=await this.environment.read(e.profileId);if(!r||!Mt(r,n))throw Error(`The durable layout outcome has not been confirmed`);let i=t===`committed`?e.destinationRoute:e.originalRoute,a=e.owner.adopt(r,e.planned??e.original,Nt(i));this.environment.navigate(i),this.environment.staging(),this.finished={id:e.id,profileId:e.profileId,outcome:t},this.pending=null,this.environment.suspend(!1),this.environment.fence(!1),a&&await e.owner.flush()}};async function Ft(e,t,n,r,i,a,o,s){await Z(e,{...t,preparePane:e=>n.prepare(e)},r,e=>q(e,r,i,a),s,o)}async function It(e,t,n,r,i,a){if(!t.prepareProjectDock)throw Error(`Project docking is unavailable`);i(!0);let o,s=!1;try{o=await e.freeze(),e.beginStaging(),a(!0),await Promise.resolve(),e.adopt(o,o,n),s=!0,await Z(e,{...t,preparePane:e=>t.prepareProjectDock({...e,destinationId:r})},n,e=>({destination:e,source:{snapshot:{...e.snapshot,layout_mode:`profile`,layout_tree:j(),project_layouts:{},session_tabs:[],editor_tabs:[],active_session:null,active_editor_tab:null,layout_ref:null},buffers:[],views:{}}}),i)}catch(t){throw!s&&o&&e.adopt(o,o,n),e.locked()||(a(!1),i(!1)),t}}async function Lt(e,t,n,r,i){await Z(e,t,n,e=>ut(e,n,r),i)}function Rt(e,t,n,r,i,a,o){return Z(e,t,n,e=>dt(e,n,r,a),i,o).then(()=>void 0)}async function zt(e,t,n,r,i,a,o,s,c){if(!t.prepareDock||!t.retire)throw Error(`Pane docking is unavailable`);await Vt(e,t,await Z(e,{...t,preparePane:e=>t.prepareDock({...e,destinationId:i,placement:s,destinationProjectId:c})},n,e=>ut(e,n,r),a),n,a,o)}async function Bt(e,t,n,r,i,a,o,s,c,l){if(!t.prepareTabDock)throw Error(`Tab window transfers are unavailable`);let u=await Z(e,{...t,preparePane:e=>t.prepareTabDock({...e,...i})},n,e=>dt(e,n,r,c),a,l);s&&await Vt(e,t,u,n,a,o)}async function Vt(e,t,n,r,i,a){if(!t.retire)return;i(!0);let o;try{let i=await e.freeze();o=i,e.beginStaging(),a(!0),await Promise.resolve(),e.adopt(i,i,r);let s=await e.freeze();o=s;let c=s.content.snapshot,l=c.layout_mode===`project`?Object.values(c.project_layouts).map(e=>e.layout_tree):[c.layout_tree];if(s.content.buffers.length||l.some(e=>e&&F(e).length)){e.adopt(s),s.content.buffers.length&&(e.update(K(c,s.content.buffers,r)),await e.flush());return}await t.retire({...n,revision:s.revision})}catch(t){throw o&&e.locked()?e.adopt(o,o,r):e.resume(),t}finally{e.locked()||(a(!1),i(!1))}}async function Z(e,t,n,r,i,a){if(!e.loaded()||e.locked())throw Error(`The workspace is not ready to detach`);let o={id:crypto.randomUUID(),profileId:e.profileId},s,c=async t=>{e.adopt(t,s,n)&&await e.flush()};i(!0);try{s=await e.freeze();let i=r(s.content);if(await t.preparePane({...o,projectId:n,revision:s.revision,...i,...a?{sourceRoute:a}:{}}),!e.matchesCapture(s))throw Error(`The pane changed while opening its window; please try again`);await c(await t.commit(o))}catch(n){if(!e.locked())throw n;let r=await t.observe(o).catch(()=>null);if(r?.status===`committed`&&r.version)return await c(r.version),o;if(r?.status===`prepared`){let e=await t.cancel(o);if(e.status===`committed`&&e.version)return await c(e.version),o;if(e.status!==`cancelled`)throw Error(`Could not confirm cancellation; the pane has been kept in place`,{cause:n})}else if(!r)throw Error(`Could not confirm the transfer outcome; reload this window to recover its saved state`,{cause:n});throw e.resume(),n}finally{e.locked()||i(!1)}return o}var Ht=e({arrangementParticipant:()=>qt,desktopProjectLayoutMode:()=>Xt,desktopWorkingSet:()=>$,destinationTransfer:()=>Jt,registerDesktopWindowLifecycle:()=>Yt,requestDesktopProjectLayoutMode:()=>Zt,useDesktopUiState:()=>Qt}),Q=new Map,Ut=new Map,Wt=r.parse({}),Gt=()=>()=>void 0,Kt=async e=>{let t=$(e);if(!t)throw Error(`Window working set is unavailable`);return await t.load(async()=>(await se(e))?.ui_state??Wt),t},qt=new Pt({activeProfile:C,owner:Kt,read:e=>p().windows.read(e),initialArrangement:()=>h()?.stagingArrangement,fence:m,suspend:g,staging:e=>{let t=h();t&&(e?t.stagingArrangement=e:delete t.stagingArrangement)},route:()=>window.location.pathname,navigate:e=>window.history.replaceState(null,``,e)}),Jt=new jt({activeProfile:C,owner:Kt,read:e=>p().windows.read(e),fence:m,suspend:g,staging:e=>{let t=h();t&&(e?t.stagingTransfer=e:delete t.stagingTransfer)},route:()=>window.location.pathname,navigate:e=>window.history.replaceState(null,``,e)});async function Yt(){let e=p()?.windows?.lifecycle;e&&await Dt(e,()=>[...Q.values()].map(e=>({checkpoint:()=>e.checkpoint(),resume:()=>e.resumeCheckpoint()})),e=>m(e||[...Q.values()].some(e=>e.locked())),w,async({profileId:e,ref:t})=>{let n=$(e);if(!n)throw Error(`Window working set is unavailable`);await n.load(async()=>{throw Error(`Window working set is unavailable`)});let r=n.get().layout_tree,i=l(t),a=r&&P(r).find(e=>e.tabs.some(e=>l(e)===i)),o=a?.tabs.find(e=>l(e)===i);if(!r||!a||!o)throw Error(`The tab is no longer in this window`);n.update({layout_tree:Xe(r,a.id,A(o))})},e=>Jt.command(e),e=>{let t=h(),n=$(e.profileId),r=p()?.windows?.transfers;if(!t||e.kind===`move-pane`&&(t.identity.kind!==`pane`||t.identity.projectId!==e.projectId)||e.kind===`move-project`&&(t.identity.kind!==`project`||t.identity.projectId!==e.projectId)||t.identity.kind!==`host`&&t.identity.profileId!==e.profileId||C()!==e.profileId||!n?.loaded()||n.locked()||!r)throw Error(`The dragged pane is no longer available`);let i=window.location.pathname.split(`/session/`)[0];if(e.kind===`move-project`){It(n,r,e.projectId,e.destinationId,m,g).catch(w);return}(e.kind===`move-tab`?Bt(n,r,e.projectId,e.ref,{destinationId:e.destinationId,destinationProjectId:e.destinationProjectId,placement:e.placement},m,g,t.identity.kind===`pane`,e.paneId,i):zt(n,r,e.projectId,e.paneId,e.destinationId,m,g,e.placement,e.destinationProjectId)).then(()=>{e.kind===`move-tab`&&window.location.pathname!==i&&(window.history.replaceState(null,``,i),window.dispatchEvent(new PopStateEvent(`popstate`)))}).catch(w)},e=>{f(async()=>{let{handleProjectCommand:e}=await import(`./project-actions-DX_j3cML.js`).then(e=>e.i);return{handleProjectCommand:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12])).then(({handleProjectCommand:t})=>t(e)).catch(w)},e=>qt.command(e),async e=>{if(h()?.identity.id!==e.ownerId||C()!==e.request.profileId)throw Error(`The layout owner changed`);let t=await ce(ye);if(C()!==e.request.profileId)throw Error(`The layout profile changed`);return bt(e,new Map(t.map(e=>[e.id,e.project_id])))})}function $(e){let t=p()?.windows;if(!t||!h())return null;let n=Q.get(e);if(!n){let r=me(e),i=he(t=>{ae(e,Ct(t)).catch(w)},2e3);n=new St(e,t,r,w,e=>{e.seed&&i(e.seed)},h()?.stagingTransfer!==void 0||h()?.stagingArrangement!==void 0);let a=n;r.subscribe(()=>a.changed()),Q.set(e,n),Ut.set(e,new xt(d().projectBasedLayout))}return n}function Xt(e){let t=C(),n=h(),r=t?Q.get(t):void 0;return!t||n?.identity.kind!==`host`||!r?null:Ut.get(t).select(e,r.restored(),r.get().layout_mode,n.stagingArrangement!==void 0)}function Zt(e){let t=C();t&&h()?.identity.kind===`host`&&Ut.get(t)?.request(e)}function Qt(e){let t=(0,O.useMemo)(()=>e?$(e):null,[e]),n=(0,O.useSyncExternalStore)(t?.subscribe??Gt,t?.get??(()=>Wt)),r=(0,O.useSyncExternalStore)(t?.subscribe??Gt,t?.loaded??(()=>!1)),[i,a]=(0,O.useState)(null);if((0,O.useEffect)(()=>{if(!t||!e)return;let n=!0;return t.load(async()=>{if(h()?.identity.kind!==`host`)throw Error(`This detached workspace could not be restored`);return(await se(e))?.ui_state??Wt}).catch(e=>{n&&a(e instanceof Error?e:Error(`Could not restore this workspace`))}),()=>{n=!1,t.flush().catch(w)}},[t,e]),i)throw i;return t?{loaded:r,snapshot:n,current:t.get,update:e=>t.update(e)}:null}export{Me as A,He as B,Re as C,V as D,$e as E,Ce as F,qe as G,B as H,Ke as I,Ye as J,Be as K,j as L,N as M,F as N,Ie as O,Xe as P,M as R,ct as S,P as T,Ge as U,z as V,Ze as W,ze as X,A as Y,ye as Z,st as _,Zt as a,it as b,zt as c,It as d,Rt as f,pt as g,q as h,Jt as i,Pe as j,I as k,Lt as l,wt as m,Xt as n,Qt as o,Tt as p,Ue as q,$ as r,Ht as s,qt as t,Ft as u,ot as v,Le as w,at as x,rt as y,L as z};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{n}from"./local-store-DKFKEHML.js";import{n as r}from"./window-context-DddmcmmO.js";import{t as i}from"./profile-store-BnferXV3.js";import{t as a}from"./content-state-PQEVgsS8.js";var o=e(t(),1),s=(0,o.createContext)(``);function c(e,t){let r=(0,o.useContext)(s);return n(JSON.stringify([r,e,t]))}var l=class{limit;namespace;persistBrowser;entries=new Map;browserLoaded=!1;browserWrite=null;constructor(e=500,t,n=!1){this.limit=e,this.namespace=t,this.persistBrowser=n}loadBrowser(){if(!(!this.persistBrowser||!this.namespace||this.browserLoaded)){this.browserLoaded=!0;try{let e=sessionStorage.getItem(`puddle.views.${this.namespace}`);if(e&&e.length<=1024*1024&&new TextEncoder().encode(e).length<=1024*1024){let t=JSON.parse(e);if(Array.isArray(t)&&t.length<=this.limit)for(let e of t)Array.isArray(e)&&e.length===2&&typeof e[0]==`string`&&e[0].length<=1024&&this.entries.set(e[0],e[1])}}catch{}typeof window<`u`&&window.addEventListener(`pagehide`,this.flushBrowser)}}flushBrowser=()=>{if(this.browserWrite!==null&&clearTimeout(this.browserWrite),this.browserWrite=null,!(!this.persistBrowser||!this.namespace))try{let e=JSON.stringify([...this.entries]);e.length<=1024*1024&&new TextEncoder().encode(e).length<=1024*1024&&sessionStorage.setItem(`puddle.views.${this.namespace}`,e)}catch{}};desktopState(){if(!this.namespace||!r())return null;let e=i();return e?a(e):null}trim(){for(;this.entries.size>this.limit;){let e=this.entries.keys().next().value;if(e===void 0)break;this.entries.delete(e)}}get(e){let t=this.desktopState();t||this.loadBrowser();let n=t?t.view(`${this.namespace}:${e}`):this.entries.get(e);return n!==void 0&&(this.entries.delete(e),this.entries.set(e,n),this.trim()),n}set(e,t){let n=this.desktopState();n||this.loadBrowser(),n?.setView(`${this.namespace}:${e}`,t),this.entries.delete(e),this.entries.set(e,t),this.trim(),!n&&this.persistBrowser&&this.browserWrite===null&&(this.browserWrite=setTimeout(this.flushBrowser,250))}copyKeys(e){let t=this.desktopState();t||this.loadBrowser();let n=`${this.namespace}:`,r=t?Object.entries(t.viewSnapshot()).filter(([e])=>e.startsWith(n)).map(([e,t])=>[e.slice(n.length),t]):[...this.entries];for(let[t,n]of r){let r=e(t);r&&r!==t&&this.set(r,n)}}};export{s as n,c as r,l as t};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/use-desktop-state-xeH1nq63.js","assets/rolldown-runtime-QTnfLwEv.js","assets/react-CZI7_Jkm.js","assets/local-store-DKFKEHML.js","assets/client-settings-BdKglwtW.js","assets/preload-helper-Czpn1I53.js","assets/queries-C9DYtGQW.js","assets/jsx-runtime-ffCh33zF.js","assets/editor-links-Djdkea3i.js","assets/api-DhfvolrJ.js","assets/auth-BPXeEntX.js","assets/profile-store-BnferXV3.js","assets/errors-SnGDjajv.js","assets/dist-DMpqv5CF.js","assets/preview-kind-CJ9RTgbs.js","assets/content-state-PQEVgsS8.js","assets/debounce-B9DrqirV.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{n}from"./jsx-runtime-ffCh33zF.js";import{g as r,h as i}from"./local-store-DKFKEHML.js";import{t as a}from"./preload-helper-Czpn1I53.js";var o=e(n(),1),s=e(t(),1);async function c(){let e=l()?.windows?.reload;e?await e():window.location.reload()}function l(){return window.puddleDesktop}function u(){let[e,t]=(0,s.useState)({fullScreen:!1,animate:!1});return(0,s.useEffect)(()=>{let e=l();if(!e)return;let n=!0;e.isFullScreen?.()?.then(e=>{n&&t({fullScreen:e,animate:!1})});let r=e.onFullScreenChange?.(e=>t({fullScreen:e,animate:!0}));return()=>{n=!1,r?.()}},[]),e}var d=[`keydown`,`keyup`,`beforeinput`,`pointerdown`,`drop`],f=e=>{e.preventDefault(),e.stopImmediatePropagation()};function p(e){let t=document.getElementById(`root`);t&&(t.inert=e);for(let t of d)e?window.addEventListener(t,f,!0):window.removeEventListener(t,f,!0);e&&document.activeElement instanceof HTMLElement&&document.activeElement.blur()}var m=null,h=null,g=!1,_=new Set,v=e=>(_.add(e),()=>{_.delete(e)});function y(e){(0,o.flushSync)(()=>{g=e;for(let e of _)e()})}function b(){return m}function x(){if(!h){let e=l()?.windows;h=e?e.context().then(async e=>{m={identity:r.parse(e.identity),hostId:e.hostId,...e.stagingTransfer?{stagingTransfer:i.parse(e.stagingTransfer)}:{},...e.stagingArrangement?{stagingArrangement:i.parse(e.stagingArrangement)}:{}},(m.stagingTransfer||m.stagingArrangement)&&p(!0);let{registerDesktopWindowLifecycle:t}=await a(async()=>{let{registerDesktopWindowLifecycle:e}=await import(`./use-desktop-state-xeH1nq63.js`).then(e=>e.s);return{registerDesktopWindowLifecycle:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]));await t()}):Promise.resolve()}return h}function S({children:e}){let t=(0,s.useSyncExternalStore)(v,()=>g),[n,r]=(0,s.useState)(()=>!l()?.windows||m!==null),[i,a]=(0,s.useState)(null);if((0,s.useEffect)(()=>{let e=!0;return x().then(()=>{e&&r(!0)},t=>{e&&a(t instanceof Error?t:Error(`Could not restore this window`))}),()=>{e=!1}},[]),i)throw i;return n&&!t?e:null}export{l as a,p as i,b as n,c as o,y as r,u as s,S as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./local-store-
|
|
1
|
+
import{r as e}from"./local-store-DKFKEHML.js";import{n as t,r as n}from"./auth-BPXeEntX.js";import{n as r}from"./dist-DMpqv5CF.js";var i=500,a=1e4;function o(e,t){return`${e} ${t}`}var s=new class{ws=null;open=!1;backoff=i;reconnectTimer=null;theme=null;terminals=new Map;notificationListeners=new Set;statusListeners=new Set;renameListeners=new Set;accountListeners=new Set;switchListeners=new Set;sessionsChangedListeners=new Set;hostUpdatesListeners=new Set;connectionListeners=new Set;shellWaiters=new Map;attach(e,t,n,r,i){let a={session:e,term:t,cols:n,rows:r,handlers:i,ready:!1,live:!1,pendingResize:!1};return this.terminals.set(o(e,t),a),this.ensureConnected(),this.open&&this.send({t:`attach`,session:e,term:t,cols:n,rows:r}),()=>this.detach(e,t)}detach(e,t){this.terminals.delete(o(e,t))&&this.open&&this.send({t:`detach`,session:e,term:t})}write(e,t,n){this.open&&this.terminals.get(o(e,t))?.ready&&this.send({t:`stdin`,session:e,term:t,data:n})}resize(e,t,n,r){let i=this.terminals.get(o(e,t));i&&(i.cols=n,i.rows=r,this.open&&i.ready?this.send({t:`resize`,session:e,term:t,cols:n,rows:r}):i.pendingResize=!0)}spawnShell(e){return this.ensureConnected(),this.open?new Promise((t,n)=>{let r=this.shellWaiters.get(e)??[];r.push({resolve:t,reject:n}),this.shellWaiters.set(e,r),this.open&&this.send({t:`spawn-shell`,session:e})}):Promise.reject(Error(`Connection is unavailable`))}killShell(e,t){this.open&&this.send({t:`kill-shell`,session:e,term:t})}onStatus(e){return this.statusListeners.add(e),this.ensureConnected(),()=>this.statusListeners.delete(e)}onAgentNotification(e){return this.notificationListeners.add(e),this.ensureConnected(),()=>this.notificationListeners.delete(e)}onRenamed(e){return this.renameListeners.add(e),this.ensureConnected(),()=>this.renameListeners.delete(e)}onAccount(e){return this.accountListeners.add(e),this.ensureConnected(),()=>this.accountListeners.delete(e)}onSessionSwitched(e){return this.switchListeners.add(e),this.ensureConnected(),()=>this.switchListeners.delete(e)}onSessionsChanged(e){return this.sessionsChangedListeners.add(e),this.ensureConnected(),()=>this.sessionsChangedListeners.delete(e)}onConnectionChange(e){return this.connectionListeners.add(e),()=>this.connectionListeners.delete(e)}onHostUpdatesChanged(e){return this.hostUpdatesListeners.add(e),this.ensureConnected(),()=>this.hostUpdatesListeners.delete(e)}isConnected(){return this.open}reportTheme(e,t){this.theme&&this.theme.fg===e&&this.theme.bg===t||(this.theme={fg:e,bg:t},this.open&&this.send({t:`theme`,fg:e,bg:t}))}reset(){this.ws?.close()}switchHost(){let e=this.ws;this.ws=null,this.open=!1,this.reconnectTimer&&clearTimeout(this.reconnectTimer),this.reconnectTimer=null,this.terminals.clear();for(let e of this.shellWaiters.values())for(let t of e)t.reject(Error(`Host changed`));this.shellWaiters.clear(),e?.close();for(let e of this.connectionListeners)e(!1)}ensureConnected(){this.ws||this.reconnectTimer||this.connect()}connect(){let r=n.get(),a=e();if(!r&&!a)return;let o=window.location.protocol===`https:`?`wss`:`ws`,s=a?a.socket():new WebSocket(`${o}://${window.location.host}/ws`);this.ws=s,s.addEventListener(`open`,()=>{if(this.ws!==s){s.close();return}a||s.send(JSON.stringify({t:`auth`,token:r}))}),s.addEventListener(`message`,e=>{if(this.ws!==s)return;let t;try{t=JSON.parse(String(e.data))}catch{return}if(t.t===`authenticated`){if(this.open)return;this.open=!0,this.backoff=i,this.send({t:`subscribe-status`}),this.theme&&this.send({t:`theme`,...this.theme});for(let e of this.terminals.values()){e.ready=!1,e.pendingResize=!1;let{session:t,term:n,cols:r,rows:i}=e;this.send({t:`attach`,session:t,term:n,cols:r,rows:i})}for(let e of this.connectionListeners)e(!0)}else this.open&&this.handle(t)}),s.addEventListener(`close`,e=>{if(this.ws!==s)return;let n=this.open;this.open=!1,this.ws=null;for(let e of this.shellWaiters.values())for(let t of e)t.reject(Error(`Connection lost; operation outcome is unknown`));if(this.shellWaiters.clear(),n)for(let e of this.connectionListeners)e(!1);if(e.code===4401&&e.reason===`browser_rejected`){t();return}this.scheduleReconnect()})}scheduleReconnect(){this.reconnectTimer||this.terminals.size===0&&this.statusListeners.size===0&&this.notificationListeners.size===0&&this.renameListeners.size===0&&this.accountListeners.size===0&&this.switchListeners.size===0&&this.sessionsChangedListeners.size===0||(this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.connect()},this.backoff),this.backoff=Math.min(this.backoff*2,a))}send(e){this.open&&this.ws?.readyState===WebSocket.OPEN&&this.ws.send(JSON.stringify(e))}handle(e){switch(e.t){case`agent-notification`:for(let t of this.notificationListeners)t(e);break;case`replay`:{let t=this.terminals.get(o(e.session,e.term));if(!t)break;if(t.ready=!0,t.pendingResize){t.pendingResize=!1;let{session:e,term:n,cols:r,rows:i}=t;this.send({t:`resize`,session:e,term:n,cols:r,rows:i})}t.handlers.onData(e.data,e.t);break}case`output`:this.terminals.get(o(e.session,e.term))?.handlers.onData(e.data,e.t);break;case`exit`:{let t=this.terminals.get(o(e.session,e.term));t&&(t.ready=!1,t.handlers.onExit?.(e.code)),e.term===`agent`&&t&&(t.live=!1);break}case`status`:{let t=[`starting`,`running`,`waiting_input`].includes(e.status);for(let n of this.terminals.values())if(!(n.session!==e.session||n.term!==`agent`)){if(t&&!n.live){n.ready=!1,n.pendingResize=!1;let{session:e,term:t,cols:r,rows:i}=n;this.send({t:`attach`,session:e,term:t,cols:r,rows:i})}n.live=t}for(let t of this.statusListeners)t({session:e.session,status:e.status,last_activity_at:e.last_activity_at});break}case`renamed`:for(let t of this.renameListeners)t({session:e.session,title:e.title,agent_title:e.agent_title,osc_title:e.osc_title});break;case`account`:for(let t of this.accountListeners)t({account_id:e.account_id,profile_id:e.profile_id,logged_in:e.logged_in});break;case`session-switched`:for(let t of this.switchListeners)t(e);break;case`sessions-changed`:for(let t of this.sessionsChangedListeners)t(e);break;case`host-updates-changed`:for(let e of this.hostUpdatesListeners)e();break;case`shell-spawned`:{let t=this.shellWaiters.get(e.session)?.shift();t&&t.resolve(e.term);break}case`notice`:(e.level===`warning`?r.warning:r.error)(e.title,{...e.detail===void 0?{}:{description:e.detail},duration:12e3});break;case`error`:r.error(`Connection error`,{description:e.message});break}}};export{s as t};
|
package/dist/public/index.html
CHANGED
|
@@ -48,17 +48,17 @@
|
|
|
48
48
|
// Storage disabled or unreadable: the module's own init still runs.
|
|
49
49
|
}
|
|
50
50
|
</script>
|
|
51
|
-
<script type="module" crossorigin src="/assets/index-
|
|
51
|
+
<script type="module" crossorigin src="/assets/index-C0F5B-UN.js"></script>
|
|
52
52
|
<link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-QTnfLwEv.js">
|
|
53
53
|
<link rel="modulepreload" crossorigin href="/assets/react-CZI7_Jkm.js">
|
|
54
|
-
<link rel="modulepreload" crossorigin href="/assets/
|
|
55
|
-
<link rel="modulepreload" crossorigin href="/assets/local-store-
|
|
56
|
-
<link rel="modulepreload" crossorigin href="/assets/auth-
|
|
54
|
+
<link rel="modulepreload" crossorigin href="/assets/jsx-runtime-ffCh33zF.js">
|
|
55
|
+
<link rel="modulepreload" crossorigin href="/assets/local-store-DKFKEHML.js">
|
|
56
|
+
<link rel="modulepreload" crossorigin href="/assets/auth-BPXeEntX.js">
|
|
57
57
|
<link rel="modulepreload" crossorigin href="/assets/client-settings-BdKglwtW.js">
|
|
58
|
+
<link rel="modulepreload" crossorigin href="/assets/editor-links-Djdkea3i.js">
|
|
58
59
|
<link rel="modulepreload" crossorigin href="/assets/theme-swfNLod9.js">
|
|
59
|
-
<link rel="modulepreload" crossorigin href="/assets/jsx-runtime-By8HlURe.js">
|
|
60
60
|
<link rel="modulepreload" crossorigin href="/assets/preload-helper-Czpn1I53.js">
|
|
61
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
61
|
+
<link rel="stylesheet" crossorigin href="/assets/index-CbJEmhvZ.css">
|
|
62
62
|
</head>
|
|
63
63
|
<body>
|
|
64
64
|
<div id="root"></div>
|
package/dist/pudl.js
CHANGED
|
@@ -14,7 +14,7 @@ import { parseArgs } from "node:util";
|
|
|
14
14
|
import { setTimeout as delay } from "node:timers/promises";
|
|
15
15
|
|
|
16
16
|
// ../shared/src/protocol.ts
|
|
17
|
-
var PROTOCOL_VERSION = { major: 28, minor:
|
|
17
|
+
var PROTOCOL_VERSION = { major: 28, minor: 36 };
|
|
18
18
|
function supportsApplicationFeature(peer, introduced, client = PROTOCOL_VERSION) {
|
|
19
19
|
return peer?.major === client.major && (peer.major > introduced.major || peer.major === introduced.major && peer.minor >= introduced.minor);
|
|
20
20
|
}
|
|
@@ -14592,6 +14592,7 @@ var versionResponseSchema = external_exports.object({
|
|
|
14592
14592
|
remote_notifications: external_exports.boolean().optional(),
|
|
14593
14593
|
remote_notification_previews: external_exports.boolean().optional(),
|
|
14594
14594
|
remote_image_uploads: external_exports.boolean().optional(),
|
|
14595
|
+
remote_project_catalogue: external_exports.boolean().optional(),
|
|
14595
14596
|
/** Exact admitted device has a current host-approved maintenance grant (application 26). */
|
|
14596
14597
|
remote_host_updates: external_exports.boolean().optional(),
|
|
14597
14598
|
protocol: external_exports.object({
|
|
@@ -18463,6 +18464,22 @@ var projectSchema = external_exports.object({
|
|
|
18463
18464
|
created_at: isoTimestamp,
|
|
18464
18465
|
updated_at: isoTimestamp
|
|
18465
18466
|
});
|
|
18467
|
+
var projectSessionCountsSchema = external_exports.object({
|
|
18468
|
+
total: external_exports.number().int().nonnegative(),
|
|
18469
|
+
running: external_exports.number().int().nonnegative(),
|
|
18470
|
+
waiting_input: external_exports.number().int().nonnegative(),
|
|
18471
|
+
interrupted: external_exports.number().int().nonnegative()
|
|
18472
|
+
});
|
|
18473
|
+
var projectCatalogueSchema = external_exports.object({
|
|
18474
|
+
projects: external_exports.array(
|
|
18475
|
+
external_exports.object({
|
|
18476
|
+
project: projectSchema,
|
|
18477
|
+
repo_path: external_exports.string(),
|
|
18478
|
+
sessions: projectSessionCountsSchema
|
|
18479
|
+
})
|
|
18480
|
+
),
|
|
18481
|
+
project_order: external_exports.record(profileId, external_exports.array(projectId))
|
|
18482
|
+
});
|
|
18466
18483
|
var createProjectRequestSchema = external_exports.object({
|
|
18467
18484
|
profile_id: profileId,
|
|
18468
18485
|
repo_id: rowId,
|
|
@@ -22009,12 +22026,14 @@ var desktopWindowCommandReplySchema = external_exports.object({
|
|
|
22009
22026
|
});
|
|
22010
22027
|
|
|
22011
22028
|
// ../shared/src/desktop/windows/effects.ts
|
|
22029
|
+
var desktopNotificationProfileSchema = profileId.nullable();
|
|
22012
22030
|
var desktopWindowEffectsStatusSchema = external_exports.object({
|
|
22013
22031
|
hostOffers: external_exports.boolean(),
|
|
22014
22032
|
desktopOffers: external_exports.boolean()
|
|
22015
22033
|
});
|
|
22016
22034
|
var desktopNotificationClaimSchema = external_exports.object({
|
|
22017
22035
|
id: external_exports.string().min(1).max(256),
|
|
22036
|
+
profileId: profileId.optional(),
|
|
22018
22037
|
/** Old status-only hosts lack unique event ids; their duplicate window deliveries expire. */
|
|
22019
22038
|
legacy: external_exports.boolean().optional()
|
|
22020
22039
|
}).strict();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@puddle-code/cli",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.8",
|
|
4
4
|
"description": "puddle \u2014 self-hosted orchestrator for CLI coding agents: serves the frontend UI and connects it to local or SSH hosts.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://github.com/PerceptronV/puddle-code#readme",
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ReleaseNotesDialog-B9fRaZNN.js","assets/rolldown-runtime-QTnfLwEv.js","assets/react-CZI7_Jkm.js","assets/jsx-runtime-By8HlURe.js","assets/purify.es-D8QhFVkO.js","assets/dialog-CTN-Lln6.js","assets/react-dom-cJyBB_A4.js","assets/utils-B6KiDbIe.js","assets/x-CbfJFzGo.js","assets/createLucideIcon-DyMAgLa3.js","assets/dialog-BX0tebJL.css","assets/queue-4USHmW_D.js","assets/markdown-it-CWoG9_Dn.js","assets/markdown-Dj7Cr7RL.js","assets/source-anchor-map-BNxSa_bJ.js","assets/math-CSw6sgCC.js","assets/math-delimiters-BCnTi7Ii.js","assets/SettingsDialog-wkV1PX96.js","assets/protocol-support-iXloAH0N.js","assets/local-store-Dy1Cd8sn.js","assets/LazyTerminal-DnrWO9aI.js","assets/preload-helper-Czpn1I53.js","assets/dist-NuV8HBEc.js","assets/chevron-right-DUkOv15w.js","assets/notification-delivery-CtlAdV8W.js","assets/theme-swfNLod9.js","assets/api-CrP4jl9e.js","assets/auth-1SSLu56b.js","assets/profile-store-D4lZiXgL.js","assets/queries-BSkHGZG8.js","assets/colour-picker-DZdAiaVI.js","assets/profile-icons-BI2xFWcB.js","assets/switch-CGrhQUXr.js","assets/select-DzQdQNsv.js","assets/chevron-down--sjpQEHH.js","assets/session-display-BUDNzNmg.js","assets/ws-CDXOuBYB.js","assets/dist-BOS6OKSE.js","assets/notification-delivery-BZzMYzIP.css","assets/client-settings-BdKglwtW.js","assets/index-CYyz1r9Q.js","assets/index-BB_BPKbu.css","assets/use-desktop-state-CBTzsmlz.js","assets/errors-CviT-mvB.js","assets/preview-kind-CJ9RTgbs.js","assets/content-state-CROLtMfN.js","assets/debounce-B9DrqirV.js","assets/button-D-qeQvl5.js","assets/shield-check-CY69Ons-.js","assets/code-DRWf9a5s.js","assets/disclosure-CpSwsC7J.js","assets/rotate-ccw-CNjR2LSi.js","assets/trash-2-WYPJMQLN.js","assets/hotkeys-nP8gYtE7.js","assets/control-tray-CjoJunx1.js","assets/control-tray-CG26TqqQ.css","assets/use-debounced-value-C86N-mOK.js","assets/popover-Okyclsx8.js","assets/preferences-CvSHA-AA.js","assets/CompilationCommandForm-DXHvwQ8Y.js","assets/SettingsDialog-CJX0gDhJ.css","assets/Dashboard-CoGS2W82.js","assets/square-terminal-CrlDquCd.js","assets/session-order-b3nCJcCG.js","assets/motion-Bd_MB9cH.js","assets/dist-BcrNV8NP.js","assets/use-arrangement-ready-1vmV5np6.js","assets/project-actions-Ck504AFM.js","assets/expanding-content-91gc88rm.js","assets/Workspace-BAWfBTc9.js","assets/forward-link-qOyuWj08.js","assets/editor-context-T5zIHY3K.js","assets/tooltip-Ek-eHPZu.js","assets/DraftRecovery-B8Ld4_1b.js","assets/whole-word-2m2pmAFT.js","assets/selection-actions-CWu4uTBo.js","assets/copy-CGsu8426.js","assets/state-CuUqRNo7.js","assets/view-state-store-Dqk7M5ei.js","assets/search-Ct_rLLa4.js","assets/project-drag-BnkK15qk.js","assets/drafts-CBbjQQbz.js","assets/buffer-logic-D9FvoilV.js","assets/scroll-restoration-C_ly1bKS.js","assets/FileCloseScope-DoZ0oLf8.js","assets/file-links-CgOYgoMC.js","assets/Workspace-CiATCR9s.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{t as n}from"./react-dom-cJyBB_A4.js";import{C as r,c as i,o as a}from"./protocol-support-iXloAH0N.js";import{An as o,Cn as s,En as c,G as l,I as u,K as d,Q as f,W as p,Y as m,g as h,gn as g,i as _,kn as v,r as y,w as b}from"./local-store-Dy1Cd8sn.js";import{C as x,D as S,E as C,T as ee,_ as w,a as T,d as E,g as te,h as ne,i as re,j as ie,k as D,l as ae,m as oe,o as O,p as se,s as ce,t as le,u as ue,w as de}from"./notification-delivery-CtlAdV8W.js";import{r as fe}from"./auth-1SSLu56b.js";import{i as pe,r as me,t as he}from"./client-settings-BdKglwtW.js";import{c as ge,n as _e,r as ve,s as ye,t as be}from"./theme-swfNLod9.js";import{t as xe}from"./jsx-runtime-By8HlURe.js";import{t as Se}from"./preload-helper-Czpn1I53.js";import{n as k}from"./api-CrP4jl9e.js";import{a as Ce,d as we,i as A,l as j,n as Te,o as M,r as Ee,t as De,u as Oe}from"./profile-store-D4lZiXgL.js";import{t as ke}from"./forward-link-qOyuWj08.js";import{A as Ae,B as je,C as Me,F as Ne,H as Pe,I as Fe,L as Ie,P as Le,T as Re,U as ze,V as Be,W as Ve,X as He,b as Ue,c as We,et as Ge,h as Ke,ht as qe,i as Je,it as Ye,j as Xe,k as Ze,l as Qe,m as $e,mt as et,n as tt,o as nt,r as rt,s as it,t as at,v as ot}from"./queries-BSkHGZG8.js";import{D as st,H as ct,N as lt,R as ut,Z as N,_ as dt,g as ft,h as pt,k as mt,o as ht,r as gt,z as _t}from"./use-desktop-state-CBTzsmlz.js";import{a as vt,c as P,d as yt,i as bt,l as xt,n as St,o as Ct,r as wt,s as Tt,t as Et,u as Dt}from"./square-terminal-CrlDquCd.js";import{t as Ot}from"./motion-Bd_MB9cH.js";import{t as F}from"./utils-B6KiDbIe.js";import{a as kt,c as At,f as jt,h as Mt,o as Nt,r as Pt,s as Ft}from"./session-order-b3nCJcCG.js";import{o as It,r as Lt,s as Rt,t as zt}from"./dialog-CTN-Lln6.js";import{n as I,t as Bt}from"./dist-BOS6OKSE.js";import{f as Vt,r as Ht}from"./dist-NuV8HBEc.js";import{a as Ut,i as Wt,n as Gt,r as Kt,t as qt}from"./select-DzQdQNsv.js";import{i as L,n as R,r as Jt,t as z}from"./tooltip-Ek-eHPZu.js";import{n as Yt,t as B}from"./button-D-qeQvl5.js";import{n as V,r as Xt}from"./chevron-right-DUkOv15w.js";import{a as Zt,n as Qt,o as $t,r as en,t as tn}from"./colour-picker-DZdAiaVI.js";import{t as H}from"./createLucideIcon-DyMAgLa3.js";import{i as nn,r as rn}from"./profile-icons-BI2xFWcB.js";import{a as an,i as on,r as sn,t as cn}from"./switch-CGrhQUXr.js";import{t as ln}from"./copy-CGsu8426.js";import{n as un,r as dn,t as fn}from"./expanding-content-91gc88rm.js";import{n as pn,t as mn}from"./disclosure-CpSwsC7J.js";import{t as hn}from"./save-BT7q_AMN.js";import{t as gn}from"./settings-2-CInoy48z.js";import{t as _n}from"./trash-2-WYPJMQLN.js";import{C as vn,D as yn,E as bn,O as xn,S as Sn,T as Cn,_ as wn,b as Tn,c as En,d as Dn,f as U,g as On,h as kn,i as An,k as jn,l as Mn,m as Nn,o as Pn,r as Fn,u as In,v as Ln,x as Rn,y as zn}from"./project-drag-BnkK15qk.js";import{a as Bn,r as W}from"./session-display-BUDNzNmg.js";import{a as Vn,c as Hn,d as G,f as Un,h as Wn,i as Gn,m as Kn,o as qn,r as Jn,s as Yn,u as Xn}from"./hotkeys-nP8gYtE7.js";import{t as Zn}from"./control-tray-CjoJunx1.js";import{n as K}from"./errors-CviT-mvB.js";import{t as q}from"./ws-CDXOuBYB.js";import{a as Qn,c as $n,i as er,n as tr,o as nr,r as rr,s as ir}from"./command-BeX8pm7h.js";import{n as ar,r as or,t as sr}from"./popover-Okyclsx8.js";import{n as cr,r as lr,t as ur}from"./queue-4USHmW_D.js";import{n as dr,t as fr}from"./project-actions-Ck504AFM.js";var J=e(t(),1),Y=xe();function pr(){let[e,t]=(0,J.useState)(`Opening forwarded application…`);return(0,J.useEffect)(()=>{if(!/^\/forward\/([^/]+)\/(\d+)$/.exec(window.location.pathname)){t(`This forwarding link is invalid.`);return}let e=!0;return ke(new URL(window.location.href)).then(t=>{e&&window.location.replace(t)}).catch(()=>{e&&t(`The application is unavailable. Reconnect to Puddle and open this link again.`)}),()=>{e=!1}},[]),(0,Y.jsx)(`p`,{className:`p-8 text-sm text-fg-secondary`,children:e})}var mr=class extends J.Component{state={error:null};static getDerivedStateFromError(e){return{error:e}}componentDidUpdate(e){this.state.error!==null&&e.resetOn!==this.props.resetOn&&this.setState({error:null})}componentDidCatch(e,t){console.error(`Puddle: the ${this.props.scope} crashed`,e,t.componentStack)}render(){let{error:e}=this.state;return e===null?this.props.children:(0,Y.jsxs)(`div`,{className:`flex h-full min-h-40 flex-col items-center justify-center gap-4 px-8 py-10 text-center`,children:[(0,Y.jsxs)(`p`,{className:`text-sm text-fg`,children:[`The `,this.props.scope,` stopped rendering.`]}),(0,Y.jsx)(`p`,{className:`max-w-lg font-mono text-2xs leading-relaxed text-interrupted`,children:e.message||String(e)}),(0,Y.jsx)(`p`,{className:`max-w-sm text-2xs leading-relaxed text-fg-muted`,children:`Your sessions and their worktrees are on the daemon and untouched; the layout is saved. The console has the full stack.`}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,Y.jsx)(`button`,{type:`button`,onClick:()=>this.setState({error:null}),className:`text-2xs font-medium text-fg-gold transition-colors hover:underline`,children:`Try again`}),(0,Y.jsx)(`button`,{type:`button`,onClick:()=>{Oe().catch(e=>this.setState({error:e instanceof Error?e:Error(`Could not reload this window`)}))},className:`text-2xs text-fg-muted transition-colors hover:text-fg`,children:`Reload`})]})]})}};function hr(){return(0,Y.jsx)(Bt,{theme:(0,J.useSyncExternalStore)(ye,ve),position:`bottom-right`,toastOptions:{style:{background:`var(--bg-elevated)`,border:`none`,boxShadow:`var(--ui-overlay-shadow)`,borderRadius:`var(--ui-surface-radius)`,outline:`1px solid var(--border)`,color:`var(--text-primary)`},classNames:{description:`whitespace-pre-wrap break-words font-mono text-2xs leading-snug max-h-40 overflow-y-auto`}}})}function gr(){return(0,Y.jsx)(`div`,{className:`flex min-h-screen items-center justify-center bg-ground`,children:(0,Y.jsxs)(`div`,{className:`flex w-full max-w-md flex-col gap-10 px-8 pb-24`,children:[(0,Y.jsx)(`h1`,{className:`font-mono text-2xl font-semibold text-fg`,children:`Puddle`}),(0,Y.jsxs)(`div`,{className:`flex flex-col gap-3 text-sm leading-relaxed text-fg-secondary`,children:[(0,Y.jsxs)(`p`,{children:[`Authorise this browser by running`,` `,(0,Y.jsx)(`span`,{className:`font-mono text-accent`,children:`puddle launch`}),` in a terminal.`]}),(0,Y.jsx)(`p`,{children:`Use the link it opens. Your sessions, drafts and layouts stay in place.`})]})]})})}var _r=e(n(),1),vr=`a, button, [role="button"], [role="slider"], input, select, textarea, summary, label, [onclick], .cursor-pointer`,yr=`.monaco-editor`;function br(e,t){return e?.closest(yr)&&!e.closest(t)?`text`:e?.closest(vr)?`interactive`:`default`}function xr(e,t=`.no-custom-caret`){(0,J.useEffect)(()=>{let n=e.current;if(!n)return;let r=window.matchMedia(`(pointer: fine)`),i=0,a=null,o=null,s=!0,c=!1,l=new MutationObserver(()=>d()),u=()=>{a&&!i&&(i=requestAnimationFrame(p))},d=()=>{s=!0,c=!0,u()},f=()=>{cancelAnimationFrame(i),i=0,a=null,o=null,s=!0,l.disconnect(),n.style.opacity=`0`},p=()=>{if(i=0,!a)return;let{x:e,y:u}=a,d=c?document.elementFromPoint(e,u):a.target;if(a.target=d,c=!1,d instanceof HTMLIFrameElement||!r.matches){f();return}if(n.style.transform=`translate3d(${e}px, ${u}px, 0) translate(-50%, -50%)`,n.style.opacity=`1`,!s&&d===o)return;if(s=!1,o=d,l.disconnect(),d&&d!==n&&!n.contains(d)){l.observe(d,{attributes:!0,childList:!0});for(let e of d.childNodes)e.nodeType===Node.TEXT_NODE&&l.observe(e,{characterData:!0});for(let e=d.parentElement;e;e=e.parentElement)l.observe(e,{attributes:!0,childList:!0})}l.observe(document.head,{attributes:!0,childList:!0,characterData:!0,subtree:!0});let p=d?.closest(yr),m=br(d,t),h=m===`text`,g=m===`interactive`,_=h;if(h&&p){let e=getComputedStyle(p);n.style.setProperty(`--custom-cursor-caret-height`,`${Math.round(Number.parseFloat(e.fontSize)*1.3)}px`)}else if(!g&&d&&!d.closest(t)&&Array.from(d.childNodes).some(e=>e.nodeType===Node.TEXT_NODE&&e.textContent?.trim())){let e=getComputedStyle(d);e.userSelect!==`none`&&(_=!0,n.style.setProperty(`--custom-cursor-caret-height`,`${Math.round(Number.parseFloat(e.fontSize)*1.3)}px`))}n.classList.toggle(`is-interactive`,g),n.classList.toggle(`is-text`,_)},m=e=>{if(e.pointerType===`touch`||!r.matches){f();return}a={x:e.clientX,y:e.clientY,target:e.target instanceof Element?e.target:null},c=!1,u()},h=()=>{r.matches?d():f()};return window.addEventListener(`pointermove`,m,{passive:!0}),document.documentElement.addEventListener(`pointerleave`,f),window.addEventListener(`blur`,f),window.addEventListener(`resize`,d),document.addEventListener(`scroll`,d,!0),document.addEventListener(`focusin`,d),document.addEventListener(`focusout`,d),document.addEventListener(`pointerdown`,d),document.addEventListener(`pointerup`,d),r.addEventListener(`change`,h),document.fonts.addEventListener(`loadingdone`,d),()=>{window.removeEventListener(`pointermove`,m),document.documentElement.removeEventListener(`pointerleave`,f),window.removeEventListener(`blur`,f),window.removeEventListener(`resize`,d),document.removeEventListener(`scroll`,d,!0),document.removeEventListener(`focusin`,d),document.removeEventListener(`focusout`,d),document.removeEventListener(`pointerdown`,d),document.removeEventListener(`pointerup`,d),r.removeEventListener(`change`,h),document.fonts.removeEventListener(`loadingdone`,d),f()}},[t,e])}var Sr=[`top`,`right`,`bottom`,`left`];function Cr(){let e=(0,J.useRef)(null);return xr(e),(0,Y.jsx)(`div`,{ref:e,className:`custom-cursor drafting-cursor`,"aria-hidden":`true`,children:Sr.map(e=>(0,Y.jsx)(`span`,{className:`drafting-cursor-tick`,"data-side":e},e))})}function wr(){let e=(0,J.useRef)(null);return xr(e),(0,Y.jsx)(`div`,{ref:e,className:`custom-cursor invert-cursor`,"aria-hidden":`true`})}var Tr=`h1, h2, h3, h4, h5, h6, .no-rangefinder-caret`,X=40.5,Z=4.05,Er=Z*Math.sqrt(3)/2;function Dr(){let e=[],t=[],n=X/2,r=Math.ceil(n/Er)+1,i=e=>Math.round(e*100)/100,a=e=>`M${e.map(([e,t])=>`${i(e)} ${i(t)}`).join(`L`)}Z`;for(let i=-r;i<r;i+=1){let o=n+i*Er,s=o+Er,c=(i%2+2)%2*(Z/2);for(let i=-r;i<r;i+=1){let r=n+i*Z+c,l=[[r+Z/2,o],[r,s],[r+Z,s]],u=[[r+Z/2,o],[r+3*Z/2,o],[r+Z,s]],d=e=>{let t=e.map(([e])=>e),n=e.map(([,e])=>e);return Math.max(...t)>0&&Math.min(...t)<X&&Math.max(...n)>0&&Math.min(...n)<X};d(l)&&e.push(a(l)),d(u)&&t.push(a(u))}}return{light:e.join(``),dark:t.join(``)}}var Or=Dr();function kr(){let e=(0,J.useRef)(null);return xr(e,Tr),(0,Y.jsx)(`div`,{ref:e,className:`custom-cursor rangefinder-cursor`,"aria-hidden":`true`,children:(0,Y.jsxs)(`svg`,{className:`rangefinder-cursor-facets`,viewBox:`0 0 ${X} ${X}`,focusable:`false`,children:[(0,Y.jsx)(`path`,{className:`rangefinder-cursor-facet-light`,d:Or.light}),(0,Y.jsx)(`path`,{className:`rangefinder-cursor-facet-dark`,d:Or.dark})]})})}function Ar(){let{cursorPackage:e}=pe(),t=null;switch(e){case`rangefinder`:t=(0,Y.jsx)(kr,{});break;case`drafting`:t=(0,Y.jsx)(Cr,{});break;case`invert`:t=(0,Y.jsx)(wr,{});break;case`system`:return null}return(0,_r.createPortal)(t,document.body)}var jr=H(`corner-down-left`,[[`path`,{d:`M20 4v7a4 4 0 0 1-4 4H4`,key:`6o5b7l`}],[`path`,{d:`m9 10-5 5 5 5`,key:`1kshq7`}]]),Mr=H(`layout-template`,[[`rect`,{width:`18`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`f1a2em`}],[`rect`,{width:`9`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`jqznyg`}],[`rect`,{width:`5`,height:`7`,x:`16`,y:`14`,rx:`1`,key:`q5h2i8`}]]),Nr=H(`monitor-cog`,[[`path`,{d:`M12 17v4`,key:`1riwvh`}],[`path`,{d:`m14.305 7.53.923-.382`,key:`1mlnsw`}],[`path`,{d:`m15.228 4.852-.923-.383`,key:`82mpwg`}],[`path`,{d:`m16.852 3.228-.383-.924`,key:`ln4sir`}],[`path`,{d:`m16.852 8.772-.383.923`,key:`1dejw0`}],[`path`,{d:`m19.148 3.228.383-.924`,key:`192kgf`}],[`path`,{d:`m19.53 9.696-.382-.924`,key:`fiavlr`}],[`path`,{d:`m20.772 4.852.924-.383`,key:`1j8mgp`}],[`path`,{d:`m20.772 7.148.924.383`,key:`zix9be`}],[`path`,{d:`M22 13v2a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7`,key:`1tnzv8`}],[`path`,{d:`M8 21h8`,key:`1ev6f3`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}]]),Pr=H(`notebook-pen`,[[`path`,{d:`M13.4 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-7.4`,key:`re6nr2`}],[`path`,{d:`M2 6h4`,key:`aawbzj`}],[`path`,{d:`M2 10h4`,key:`l0bgd4`}],[`path`,{d:`M2 14h4`,key:`1gsvsf`}],[`path`,{d:`M2 18h4`,key:`1bu2t1`}],[`path`,{d:`M21.378 5.626a1 1 0 1 0-3.004-3.004l-5.01 5.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z`,key:`pqwjuv`}]]),Fr=H(`settings`,[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]);function Ir(){let e=Pe(),t=Ke(),[n,r]=(0,J.useState)(``),[i,a]=(0,J.useState)(g),o=()=>{n.trim()&&t.mutate({name:n.trim(),branch_prefix:i.trim()},{onSuccess:e=>Ee(e.id)})},s=(e.data?.length??0)>0;return(0,Y.jsx)(`div`,{className:`flex min-h-screen items-center justify-center bg-ground`,children:(0,Y.jsxs)(`div`,{className:`flex w-full max-w-md flex-col gap-10 px-8 pb-16`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Y.jsx)(`h1`,{className:`font-mono text-2xl font-semibold text-fg`,children:`Puddle`}),(0,Y.jsx)(`p`,{className:`text-sm text-fg-secondary`,children:`Who is working?`})]}),s&&(0,Y.jsx)(`div`,{className:`flex flex-col`,children:e.data.map(e=>(0,Y.jsxs)(`button`,{onClick:()=>Ee(e.id),className:`flex items-center gap-3 rounded-md px-3 py-2.5 text-left transition-colors hover:bg-elevated active:bg-border/70`,children:[(0,Y.jsx)(D,{icon:e.icon,colour:e.icon_colour,className:`size-5`}),(0,Y.jsx)(`span`,{className:F(`text-base`,Qt(e.icon_colour)||`text-fg`),style:en(e.icon_colour),children:e.name}),e.branch_prefix&&(0,Y.jsxs)(`span`,{className:`ml-auto text-2xs text-fg-muted`,children:[e.branch_prefix,`…`]})]},e.id))}),(0,Y.jsxs)(`form`,{className:`flex flex-col gap-5`,onSubmit:e=>{e.preventDefault(),o()},children:[s&&(0,Y.jsx)(`p`,{className:`text-2xs font-medium uppercase tracking-wide text-fg-muted`,children:`or create a profile`}),(0,Y.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,Y.jsx)($t,{htmlFor:`profile-name`,children:`Name`}),(0,Y.jsx)(V,{id:`profile-name`,placeholder:`e.g. alice`,value:n,onChange:e=>r(e.target.value),className:`h-10`,autoFocus:!s})]}),(0,Y.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,Y.jsx)($t,{htmlFor:`branch-prefix`,children:`Branch prefix`}),(0,Y.jsx)(V,{id:`branch-prefix`,placeholder:`no prefix`,value:i,onChange:e=>a(e.target.value),className:`h-10`})]}),t.error&&(0,Y.jsx)(`p`,{className:`text-xs text-danger`,children:t.error.message}),(0,Y.jsx)(B,{type:`submit`,size:`lg`,className:`self-start px-6`,disabled:!n.trim()||t.isPending,children:`Create profile`})]})]})})}function Lr({kind:e,colour:t,onRename:n,onColour:r,custom:i=!0,pending:a=!1,onUpdates:o}){let[s,c]=(0,J.useState)(!1);return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(Nt,{children:[(0,Y.jsxs)(Ft,{onSelect:n,children:[(0,Y.jsx)(Zt,{}),`Rename `,e]}),(0,Y.jsxs)(Ft,{onSelect:()=>c(!0),children:[(0,Y.jsx)(on,{}),`Change `,e,` colour`]}),o&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(At,{}),(0,Y.jsxs)(Ft,{onSelect:o,children:[(0,Y.jsx)(sn,{}),`Host updates`]})]})]}),(0,Y.jsx)(zt,{open:s,onOpenChange:c,children:(0,Y.jsxs)(Lt,{children:[(0,Y.jsx)(It,{children:(0,Y.jsx)(Rt,{children:e===`host`?`Host accent`:`Profile colour`})}),(0,Y.jsx)(tn,{value:t,onChange:r,onCustomChange:i?r:void 0,disabled:a,label:e===`host`?`Host accent`:`Profile colour`})]})})]})}function Rr(){let e=Ze(),{icon:t}=S(),n=A(),r=Kn()[`host.peek`],{showHostOnFocus:i}=pe(),[a,o]=(0,J.useState)(null),s=/Mac/.test(navigator.platform),c=(0,J.useRef)(!1),l=(0,J.useRef)(-1/0);return(0,J.useEffect)(()=>{let e,t=document.hidden||!document.hasFocus(),n=-1/0,a,u=()=>{clearTimeout(e),e=void 0},d=()=>{u(),c.current=!1,o(null)},f=()=>{t=!0,d()},p=()=>{if(document.hidden)return;let r=performance.now(),a=r-l.current>=(s?750:250);l.current=r;let f=t;t=!1,!(!f||!a||!i||c.current)&&(n=r,u(),o(`focus`),e=setTimeout(()=>{if(!s||Ot())return d();o(`focus-closing`),e=setTimeout(d,120)},s?400:1200))},m=t=>{t instanceof KeyboardEvent&&[`Meta`,`Alt`,`Control`,`Shift`].includes(t.key)||t.type===`pointerdown`&&performance.now()-n<100||e!==void 0&&d()},h=r?.split(`+`)??[],g=h.at(-1),_={Meta:`meta`,Control:`ctrl`,Alt:`alt`,Shift:`shift`},v=e=>{c.current&&(e.key===`Escape`&&(e.preventDefault(),e.stopPropagation()),(e.type===`keyup`&&(e.code===g||h.includes(_[e.key]??_[e.code.replace(/(Left|Right)$/,``)]??``))||e.key===`Escape`||h.includes(`meta`)&&!e.metaKey||h.includes(`ctrl`)&&!e.ctrlKey||h.includes(`alt`)&&!e.altKey||h.includes(`shift`)&&!e.shiftKey)&&d())},y=()=>{document.hidden?f():p()},b=G(`host.peek`,()=>{c.current||document.hidden||(u(),c.current=!0,o(`shortcut`))});window.addEventListener(`keyup`,v,!0),window.addEventListener(`keydown`,v,!0),window.addEventListener(`blur`,f),window.addEventListener(`pagehide`,f),window.addEventListener(`focus`,p),window.addEventListener(`keydown`,m,!0),window.addEventListener(`pointerdown`,m,!0),window.addEventListener(`wheel`,m,{passive:!0,capture:!0}),document.addEventListener(`visibilitychange`,y);let x=j()?.onWindowFocusChange?.(e=>{let n=e!==a;a=e,e?n&&(t=!0,p()):f()});return()=>{x?.(),b(),window.removeEventListener(`keyup`,v,!0),window.removeEventListener(`keydown`,v,!0),window.removeEventListener(`blur`,f),window.removeEventListener(`pagehide`,f),window.removeEventListener(`focus`,p),window.removeEventListener(`keydown`,m,!0),window.removeEventListener(`pointerdown`,m,!0),window.removeEventListener(`wheel`,m,!0),document.removeEventListener(`visibilitychange`,y),d()}},[r,s,n,i]),a?(0,_r.createPortal)((0,Y.jsx)(`div`,{"data-host-peek":!0,"data-state":a===`focus-closing`?`closed`:a===`focus`&&s?`instant-open`:`open`,className:`overlay-backdrop-motion fixed inset-0 z-[200] flex items-center justify-center p-8 text-fg backdrop-blur-[8px]`,style:a===`shortcut`?void 0:{pointerEvents:`none`,...a===`focus-closing`?{animationFillMode:`forwards`,opacity:0}:{}},onPointerDown:e=>e.preventDefault(),role:`status`,"aria-live":`polite`,children:(0,Y.jsxs)(`div`,{className:`flex max-w-full flex-col items-center gap-6 px-12 py-10 text-center`,children:[(0,Y.jsx)(C,{icon:t,className:`size-[clamp(4.5rem,13.5vmin,10.5rem)] shrink-0`}),(0,Y.jsx)(`span`,{className:`max-w-full break-words font-sans text-[clamp(0.8333rem,1.75vw,1.75rem)] leading-tight font-medium`,children:rt(e.data)??`Host`})]})}),document.body):null}function zr(){let e=Ue().data?.protocol,t=e!==void 0&&(e.major>25||e.major===25&&e.minor>=5),{data:n}=Ye({queryKey:[`storage`],queryFn:()=>k(`GET`,`/api/storage`),enabled:t&&!y(),refetchInterval:1e4,retry:!1});if(!t||y()||!n)return null;let r=n.volumes.filter(e=>e.level!==`ok`);if(!n.logs_degraded&&!n.database_degraded&&r.length===0)return null;let i=r.some(e=>e.level===`critical`);return(0,Y.jsxs)(`div`,{role:`status`,className:`flex shrink-0 items-start gap-2 px-3 py-2 text-xs text-warning`,children:[(0,Y.jsx)(jn,{className:`mt-0.5 size-3.5 shrink-0`,"aria-hidden":`true`}),(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[n.database_degraded&&(0,Y.jsx)(`p`,{children:`Storage is full. Changes cannot be saved. Live session status may be unsaved.`}),n.logs_degraded&&(0,Y.jsx)(`p`,{children:`Terminal history is temporarily not being saved. Live terminals remain connected.`}),i&&(0,Y.jsx)(`p`,{children:`Storage is critically low. Free space or inodes before starting new sessions or worktrees.`}),r.length>0&&(0,Y.jsx)(mn,{summary:`${r.length} storage ${r.length===1?`location needs`:`locations need`} attention`,children:(0,Y.jsx)(`div`,{className:`max-h-32 overflow-y-auto pl-4`,children:r.map(e=>(0,Y.jsxs)(`p`,{className:`break-all text-fg-secondary`,children:[e.level===`unknown`?`Could not check storage`:`Low storage`,` at`,` `,e.path,e.available_bytes!==null&&` · ${Math.round(e.available_bytes/1024**2).toLocaleString()} MiB available`,e.available_inodes!==null&&` · ${e.available_inodes.toLocaleString()} inodes available`]},e.path))})})]})]})}var Br=new class{transport;reload;pause;phase=`idle`;pending=null;constructor(e=fetch,t=Oe,n=e=>new Promise(t=>setTimeout(t,e))){this.transport=e,this.reload=t,this.pause=n}refresh(e=12e4){return this.pending||=this.run(e).finally(()=>{this.pending=null}),this.pending}async run(e){this.phase=`requesting`;let t={authorization:`Bearer ${fe.get()??``}`,"content-type":`application/json`};try{let n=await this.transport(`/frontend/refresh`,{method:`POST`,headers:t,signal:AbortSignal.timeout(1e4),body:JSON.stringify({refreshId:crypto.randomUUID()})});if(n.status!==202)throw Error(`refresh rejected`);let r=u.parse(await n.json());this.phase=`waiting`;let i=Date.now()+e;for(;Date.now()<i;){await this.pause(1e3);try{let e=await this.transport(`/frontend/status`,{headers:t,cache:`no-store`,signal:AbortSignal.timeout(3e3)});if(!e.ok)continue;let n=b.parse(await e.json());if(n.instance===r.instance||n.refreshId!==r.refreshId||n.upstream!==`ready`)continue}catch{continue}return await this.reload(),this.phase=`complete`,!0}}catch{}return this.phase=`failed`,!1}},Q=null;function Vr(e){return Q=e,()=>{Q===e&&(Q=null)}}function Hr(){Q?.()}var Ur=new Set;function Wr(){return[...Ur].flatMap(e=>e())}function Gr({onNewSession:e,onNewProject:t}){let[n,r]=(0,J.useState)(!1),[i,a]=(0,J.useState)(`commands`),[o,s]=(0,J.useState)(``),[c,l]=(0,J.useState)(null),[u,d]=(0,J.useState)(!1),f=P(),p=xt(),m=A(),h=p.id,g=Ve(m??void 0),_=Be(m??void 0),v=Ge(h),y=Sn(),b=Kn();(0,J.useEffect)(()=>G(`palette.toggle`,()=>r(e=>!e)),[]),(0,J.useEffect)(()=>bn(()=>r(!0)),[]),(0,J.useEffect)(()=>{n||(a(`commands`),s(``),l(null),d(!1))},[n]);let x=(0,J.useMemo)(()=>{let n=[],r=Pt((g.data??[]).filter(e=>!e.archived),_.data?.projectOrder??[]);for(let[e,t]of r.entries()){let r=Jn[e];n.push({id:`project-${t.id}`,group:`Projects`,label:t.name,icon:dn,keywords:`switch project open`,shortcut:r?qn(b[r.id]??``):void 0,run:()=>void f(`/project/${t.id}`)})}for(let e of v.data??[])e.status!==`archived`&&n.push({id:`session-${e.id}`,group:`Sessions`,label:y(e),icon:Et,keywords:`switch session ${e.branch}`,run:()=>void f(`/project/${e.project_id}/session/${e.id}`)});return h!==void 0&&e&&n.push({id:`new-agent`,group:`Actions`,label:`New agent`,icon:an,keywords:`new agent create start session`,run:()=>e()},{id:`new-terminal`,group:`Actions`,label:`New terminal`,icon:Et,keywords:`new terminal create start shell session`,run:()=>e({kind:`terminal`})}),h!==void 0&&n.push({id:`open-path`,group:`Actions`,label:`Open path`,icon:dn,keywords:`open path file directory folder editor tree browse absolute relative home`,closeOnRun:!1,run:()=>{s(``),l(null),a(`path`)}}),t&&n.push({id:`new-project`,group:`Actions`,label:`New project`,icon:pn,keywords:`new project open create repository repo workspace`,run:t}),n.push({id:`theme-dark`,group:`Theme`,label:`Switch theme: dark`,icon:nn,keywords:`switch theme dark appearance`,run:()=>void be(`dark`)},{id:`theme-light`,group:`Theme`,label:`Switch theme: light`,icon:rn,keywords:`switch theme light appearance`,run:()=>void be(`light`)},{id:`theme-system`,group:`Theme`,label:`Switch theme: system`,icon:Nr,keywords:`switch theme system appearance`,run:()=>void be(`system`)},{id:`open-settings`,group:`Actions`,label:`Settings`,icon:Fr,keywords:`open settings preferences options configure`,run:()=>W()},{id:`switch-profile`,group:`Actions`,label:`Switch profile`,icon:Bn,keywords:`switch profile identity user change`,run:()=>Te.set(null)},{id:`refresh-connection`,group:`Actions`,label:`Refresh connection`,icon:sn,keywords:`refresh connection reconnect restart frontend tunnel ssh daemon`,run:()=>Hr()}),[...n,...Wr()]},[b,g.data,_.data?.projectOrder,v.data,h,f,e,t,y]),S=(0,J.useMemo)(()=>{let e=new Map;for(let t of x){let n=e.get(t.group)??[];n.push(t),e.set(t.group,n)}return[...e.entries()]},[x]),C=async()=>{let e=o.trim();if(!(e===``||u)){d(!0),l(null);try{await vn(e),r(!1)}catch(e){l(e instanceof Error?e.message:`Could not open that path.`)}finally{d(!1)}}};return(0,Y.jsxs)(tr,{open:n,onOpenChange:r,children:[(0,Y.jsx)(Qn,{value:o,onValueChange:e=>{s(e),l(null)},placeholder:i===`path`?`Enter a path…`:`Type a command or search…`,onKeyDown:e=>{i===`path`&&(e.key===`Enter`?(e.preventDefault(),e.stopPropagation(),C()):e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),a(`commands`),s(``),l(null)))}}),i===`path`?(0,Y.jsx)(ir,{children:(0,Y.jsxs)(`div`,{className:`px-3 py-3 text-xs text-fg-muted`,children:[(0,Y.jsx)(`p`,{children:`Relative paths start from the bound worktree or project. Absolute and ~ paths work too.`}),(0,Y.jsx)(`p`,{className:c?`mt-2 text-danger`:`mt-2`,"aria-live":`polite`,children:c??(u?`Opening…`:`Press Enter to open.`)})]})}):(0,Y.jsxs)(ir,{children:[(0,Y.jsx)(rr,{children:`Nothing matches.`}),S.map(([e,t])=>(0,Y.jsx)(er,{heading:e,children:t.map(e=>{let t=e.icon;return(0,Y.jsxs)(nr,{value:`${e.label} ${e.keywords??``}`,onSelect:()=>{e.closeOnRun!==!1&&r(!1),e.run()},children:[t&&(0,Y.jsx)(t,{}),e.label,e.shortcut&&(0,Y.jsx)($n,{children:e.shortcut})]},e.id)})},e))]})]})}function Kr(){let e=document.activeElement;return e instanceof Element&&e.closest(`.xterm`)!==null}function qr(){let e=document.activeElement;return e instanceof Element&&e.closest(`.monaco-editor`)!==null}function Jr(){let e=P(),t=A(),n=Ve(t??void 0),r=Be(t??void 0),i=r.data?.hotkeys;return(0,J.useEffect)(()=>{Un(i&&typeof i==`object`?i:void 0)},[i]),(0,J.useEffect)(()=>{if(t===null)return;let i=Pt((n.data??[]).filter(e=>!e.archived),r.data?.projectOrder??[]),a=Jn.map((t,n)=>G(t.id,()=>{let t=i[n];t&&e(`/project/${t.id}`)}));return()=>a.forEach(e=>e())},[e,t,n.data,r.data?.projectOrder]),(0,J.useEffect)(()=>G(`window.close`,()=>{let e=j();e?.closeWindow?e.closeWindow():window.close()}),[]),(0,J.useEffect)(()=>{let e=e=>{if(e.target instanceof Element&&e.target.closest(`[data-hotkey-recording]`))return;let t=Vn(e);if(!t)return;let n=Gn(t);if(!n)return;let r=Yn(n);if(!r||!Xn(r,qr())||r.deferInTerminal&&Kr())return;let i=Hn(n);i&&(e.preventDefault(),e.stopPropagation(),(!r.hold||!e.repeat)&&i())},t=e=>{let t=Vn(e);if(!t)return;let n=Gn(t);if(!n)return;let r=Yn(n);if(!r||r.editor&&qr()||r.deferInTerminal&&Kr())return;let i=Hn(n);i&&(e.preventDefault(),i())};return window.addEventListener(`keydown`,e,!0),window.addEventListener(`keydown`,t),()=>{window.removeEventListener(`keydown`,e,!0),window.removeEventListener(`keydown`,t)}},[]),null}var Yr=4e3;function Xr(){let[e,t]=(0,J.useState)(`hidden`),n=(0,J.useRef)(e);n.current=e,(0,J.useEffect)(()=>{let e=null,r=q.onConnectionChange(r=>{if(r){e!==null&&clearTimeout(e),e=null,n.current===`lost`&&t(`hidden`);return}e!==null||n.current!==`hidden`||(e=setTimeout(()=>{e=null,n.current===`hidden`&&t(`lost`)},Yr))});return()=>{r(),e!==null&&clearTimeout(e)}},[]);let r=(0,J.useCallback)(async()=>{n.current!==`refreshing`&&(t(`refreshing`),await Br.refresh()||(I.error(`The frontend has not come back — it may need a terminal (ssh re-auth): puddle refresh`),t(q.isConnected()?`hidden`:`lost`)))},[]);return(0,J.useEffect)(()=>Vr(()=>void r()),[r]),e===`hidden`?null:(0,Y.jsxs)(`div`,{className:`flex shrink-0 items-center gap-3 bg-elevated px-3 py-2`,children:[(0,Y.jsx)(`span`,{className:`text-xs text-fg-secondary`,children:e===`refreshing`?`Restarting the frontend.`:`Connection to the daemon lost.`}),e===`lost`&&(0,Y.jsxs)(B,{size:`sm`,className:`ml-auto`,onClick:()=>void r(),children:[(0,Y.jsx)(sn,{}),`Refresh connection`]})]})}function Zr({label:e,percentage:t,hint:n}){let r=Math.max(0,Math.min(100,t));return(0,Y.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(`span`,{className:`w-24 shrink-0 truncate text-2xs text-fg-muted`,title:e,children:e}),(0,Y.jsx)(`span`,{className:`relative h-1.5 min-w-0 flex-1 overflow-hidden rounded-full bg-border`,children:(0,Y.jsx)(`span`,{className:`absolute inset-y-0 left-0 rounded-full ${r>=90?`bg-danger`:r>=75?`bg-warning`:`bg-action`}`,style:{width:`${r}%`}})}),(0,Y.jsxs)(`span`,{className:`shrink-0 text-2xs tabular-nums text-fg-muted`,children:[Math.round(r),`%`,n?` · ${n}`:``]})]})}function Qr(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function $r(e){if(e===null)return`never`;let t=new Date(e).getTime(),n=Math.max(0,Math.round((Date.now()-t)/1e3));if(n<60)return`just now`;let r=Math.round(n/60);if(r<60)return`${r}m ago`;let i=Math.round(r/60);return i<24?`${i}h ago`:`${Math.round(i/24)}d ago`}function ei({account:e,onLogin:t,onStartSession:n,installed:r=!0}){let i=nt(e.id),a=e.logged_in?n:r?t:null,o=i.data?.subscription;return(0,Y.jsxs)(`div`,{className:`rounded-md px-2 py-2 transition-colors hover:bg-elevated`,children:[(0,Y.jsxs)(`button`,{type:`button`,disabled:a===null,onClick:()=>a?.(),className:`flex w-full items-center gap-3 text-left disabled:cursor-default`,children:[(0,Y.jsx)(`span`,{className:`size-2 shrink-0 rounded-full ${e.logged_in?`bg-success`:`bg-idle`}`,"aria-hidden":!0}),(0,Y.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Y.jsx)(`span`,{className:`block truncate text-sm text-fg`,children:e.label}),(0,Y.jsxs)(`span`,{className:`block text-2xs text-fg-muted`,children:[e.logged_in?`logged in`:`logged out`,i.data&&(0,Y.jsxs)(Y.Fragment,{children:[` · `,i.data.session_count,` session`,i.data.session_count===1?``:`s`,i.data.active_session_count>0&&` (${i.data.active_session_count} active)`,` · `,`last `,$r(i.data.last_activity_at)]})]}),i.data?.agent_usage&&(0,Y.jsxs)(`span`,{className:`block text-2xs text-fg-muted`,children:[Qr(i.data.agent_usage.input_tokens),` in ·`,` `,Qr(i.data.agent_usage.output_tokens),` out ·`,` `,Qr(i.data.agent_usage.cache_read_input_tokens),` cached ·`,` `,i.data.agent_usage.message_count,` msgs`]}),i.data?.live_usage?.context_used_percentage!=null&&(0,Y.jsx)(`span`,{className:`mt-1 block`,children:(0,Y.jsx)(Zr,{label:`context`,percentage:i.data.live_usage.context_used_percentage})})]}),(0,Y.jsx)(`span`,{className:`shrink-0 text-2xs text-fg-muted`,children:r?e.logged_in?n?`new agent`:``:(0,Y.jsxs)(`span`,{className:`flex items-center gap-1 text-warning`,children:[(0,Y.jsx)(ie,{className:`size-3`}),`sign in`]}):`unavailable`})]}),o!=null&&o.windows.length>0&&(0,Y.jsx)(`div`,{className:`mt-2 flex flex-col gap-1 pl-5`,children:o.windows.map(e=>(0,Y.jsx)(Zr,{label:e.label,percentage:e.used_percentage,hint:e.resets==null?void 0:`resets ${e.resets}`},e.key))})]})}function ti(){let[e,t]=(0,J.useState)(!1),[n,r]=(0,J.useState)(!1),i=A(),a=Pe(),o=Fe(),s=a.data?.find(e=>e.id===i),c=it(i??void 0),l=We(),u=Xe(),{open:d,handler:f}=Rn(),[p,m]=(0,J.useState)(null),h=e=>u.mutate(e.id,{onSuccess:t=>m({stream:t.stream,label:`${e.agent_type}/${e.label}`}),onError:e=>K(e)}),g=e=>{t(!1),d({accountId:e.id})},_=e=>{r(!1);let t=e.trim();!i||!t||t===s?.name||o.mutate({id:i,name:t},{onError:e=>K(e)})},v=`profile-trigger font-sans compact:h-7 compact:px-1.5`;return n&&s?(0,Y.jsxs)(`div`,{className:Yt({variant:`ghost`,size:`sm`,className:v}),style:en(s.icon_colour),children:[(0,Y.jsx)(D,{icon:s.icon,colour:s.icon_colour}),(0,Y.jsx)(yn,{initial:s.name,maxLength:100,fitContent:!0,className:Qt(s.icon_colour),onCommit:_,onCancel:()=>r(!1)})]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(kt,{onOpenChange:e=>{e&&t(!1)},children:[(0,Y.jsxs)(sr,{open:e,onOpenChange:t,children:[(0,Y.jsxs)(z,{children:[(0,Y.jsx)(L,{asChild:!0,children:(0,Y.jsx)(or,{asChild:!0,children:(0,Y.jsx)(jt,{asChild:!0,children:(0,Y.jsxs)(B,{variant:`ghost`,size:`sm`,className:v,children:[(0,Y.jsx)(D,{icon:s?.icon,colour:s?.icon_colour}),(0,Y.jsx)(`span`,{className:Qt(s?.icon_colour),style:en(s?.icon_colour),...xn(()=>{t(!1),r(!0)}),children:s?.name??`…`})]})})})}),(0,Y.jsx)(R,{children:`Profile`})]}),(0,Y.jsxs)(ar,{className:`w-[28rem] max-w-[calc(100vw-1rem)]`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(l.data??[]).map(e=>{let t=c.data?.filter(t=>t.agent_type===e.id)??[];if(t.length===0)return null;let n=e.available!==!1;return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,Y.jsxs)(`span`,{className:`px-2 text-2xs font-medium uppercase tracking-wide text-fg-muted`,children:[e.display_name,!n&&(0,Y.jsxs)(`span`,{className:`ml-2 normal-case tracking-normal text-fg-muted`,children:[`not installed — no `,e.binary??e.id,` on PATH`]})]}),t.map(e=>(0,Y.jsx)(ei,{account:e,onLogin:()=>h(e),onStartSession:f&&n?()=>g(e):null,installed:n},e.id))]},e.id)}),c.data?.length===0&&(0,Y.jsx)(`p`,{className:`px-2 text-sm text-fg-muted`,children:`No accounts yet — add one in settings.`})]}),(0,Y.jsxs)(`div`,{className:`mt-4 flex items-center gap-2`,children:[(0,Y.jsxs)(B,{variant:`ghost`,size:`sm`,onClick:()=>{t(!1),W(`accounts`)},children:[(0,Y.jsx)(pn,{}),`Add account`]}),(0,Y.jsxs)(B,{variant:`ghost`,size:`sm`,className:`ml-auto`,onClick:()=>{t(!1),Te.set(null)},children:[(0,Y.jsx)(gn,{}),`Switch profile`]})]})]})]}),(0,Y.jsx)(Lr,{kind:`profile`,colour:s?.icon_colour,onRename:()=>{t(!1),r(!0)},onColour:e=>{i&&o.mutate({id:i,icon_colour:e},{onError:K})},pending:o.isPending||!i})]}),p&&(0,Y.jsx)(x,{stream:p.stream,label:p.label,onClose:()=>m(null)})]})}function ni(e=`hostOffers`){let t=j()?.windows?.effects,[n,r]=(0,J.useState)(()=>!t||null);return(0,J.useEffect)(()=>{if(!t)return;let n=!0,i=!1,a=t=>{let i=_.safeParse(t);n&&i.success&&r(i.data[e])},o=t.onChanged(e=>{i=!0,a(e)});return t.status().then(e=>{i||a(e)}).catch(()=>{n&&!i&&r(!1)}),()=>{n=!1,o()}},[t,e]),n}var ri=`desktop-update`,ii=null;function ai(){let e=ni(`desktopOffers`);return(0,J.useEffect)(()=>{e===!1&&I.dismiss(ri)},[e]),e?(0,Y.jsx)(oi,{}):null}function oi(){return(0,J.useEffect)(()=>{let e=j();if(e?.updateReady===void 0||e.onUpdateReady===void 0)return;let t=!0,n=e=>{!t||ii===e||(ii=e,I(`Puddle ${e} is downloaded and ready.`,{id:ri,duration:1/0,closeButton:!0,action:{label:`Restart to update`,onClick:()=>{j()?.installUpdate?.(),I.loading(`Restarting into Puddle ${e}…`,{id:`${ri}-restarting`,duration:1/0})}}}))};e.updateReady().then(e=>{e!==null&&n(e)});let r=e.onUpdateReady(n);return()=>{t=!1,r()}},[]),null}var si=new te,ci=new Set;function li({onReview:e}={}){let t=ni();return se(),(0,J.useEffect)(()=>{if(t===!1){for(let e of ci)I.dismiss(e);ci.clear()}},[t]),t?(0,Y.jsx)(ui,{onReview:e}):null}function ui({onReview:e}){let t=oe(),n=E(),r=rt(Ze().data),i=ne();return(0,J.useEffect)(()=>{if(!(!n||!r||t.isError))for(let n of si.take(i,w(t.data))){let t=n.component===`daemon`?`Daemon`:`Runtime software`,a=`host-update-${i}-${n.component}-${n.version}`;ci.add(a),I(`${r}: ${t} ${n.version} is available.`,{id:a,duration:1/0,closeButton:!0,action:{label:`Review update`,onClick:e??(()=>W(`host`))}})}},[t.data,t.isError,r,n,i,e]),null}function di({hostKey:e,enabled:t=!0}){let n=Ye({queryKey:[`host`],queryFn:async({signal:e})=>s.parse(await k(`GET`,`/api/host`,void 0,e)),staleTime:1/0,enabled:t&&!e,retry:!1}),r=e??(n.data?ur(n.data):void 0),i=y(),a=i?.generation,o=Ye({queryKey:[`release-notes`,r],queryFn:async({signal:e})=>{let t=c.parse(await k(`GET`,`/api/release-notes`,void 0,e));if(y()!==i||i?.generation!==a)throw Error(`Release notes connection changed`);return t},enabled:t&&!!r,staleTime:1/0,retry:!1});return(0,J.useEffect)(()=>{t&&r&&o.data&&!o.isError&&lr(r,o.data)},[t,r,o.data,o.isError]),null}var fi=(0,J.lazy)(()=>Se(()=>import(`./ReleaseNotesDialog-B9fRaZNN.js`).then(e=>({default:e.ReleaseNotesDialog})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16])));function pi({remote:e=!1}){let t=(0,J.useSyncExternalStore)(cr.subscribe,cr.snapshot)[0];return(0,J.useEffect)(()=>{let t=e?[`frontend`,`remote`]:[`frontend`];cr.enqueue(`browser`,t.map(e=>({component:e,version:`0.5.6`,markdown:`## [0.5.6] — 2026-11-14
|
|
3
|
-
|
|
4
|
-
### Frontend
|
|
5
|
-
|
|
6
|
-
#### Fixed
|
|
7
|
-
|
|
8
|
-
- Prevent an uncaught abort error when a host connection closes while its SSH control channel is still opening.
|
|
9
|
-
- Keep SSH password and 2FA prompts stable during reconnection by preventing competing background authentication and cancelling pending authentication when refreshing the connection.
|
|
10
|
-
|
|
11
|
-
### Daemon
|
|
12
|
-
|
|
13
|
-
#### Fixed
|
|
14
|
-
|
|
15
|
-
- Restore automatic cleanup of unused installed versions when Finder adds \`.DS_Store\`, and continue bounded cleanup every five minutes while work remains, preserving active builds, recent releases and recovery references.
|
|
16
|
-
`})))},[e]),t?(0,Y.jsx)(J.Suspense,{fallback:null,children:(0,Y.jsx)(fi,{current:t})}):null}function mi(){let e=A(),t=Pe().data?.find(t=>t.id===e),n=Be(e??void 0),r=He(e??void 0,void 0),i=pe(),a=O(),o=ce(),s=Ie(e??``),c=Fe(),l=ot(),[u,d]=(0,J.useReducer)(e=>e+1,0);(0,J.useEffect)(()=>ye(()=>d()),[]);let f=(0,J.useRef)(null);(0,J.useEffect)(()=>{f.current=null},[t?.name]);let p=a.data?.available===!0?a.data.file:void 0,m=t!==void 0&&e!==null&&n.data!==void 0&&r.data!==void 0&&p!==void 0,h=t&&p?T(p,t.name):void 0,g=s.isPending||c.isPending||l.isPending||o.isPending||n.isFetching||r.isFetching;(0,J.useEffect)(()=>{if(!m||!h?.enabled||g)return;let a={client:i,theme:ge(),profileSettings:n.data,profile:t,scratchpad:r.data},u={setClient:e=>me(e),setTheme:e=>{typeof e==`string`&&be(e)},patchProfileSettings:e=>s.mutate(e),patchProfileColumns:t=>c.mutate({id:e,...t}),createScratchpad:t=>{for(let n of t)l.mutate({profile_id:e,scope:`profile`,title:n.title??void 0,body:n.body,tags:n.tags,agent_type:n.agent_type??void 0})}},d=JSON.stringify(h.doc);if(f.current!==d){f.current=d,ae(h.doc,u,a,h.groups);return}let p=ue(h.groups,a),_=JSON.stringify(p);_!==d&&(f.current=_,o.mutate({profile:t.name,entry:{...h,doc:p,updatedAt:new Date().toISOString()}}))})}function hi(e){let t=t=>{let n=o.safeParse(t);n.success&&e(n.data)},n=j()?.onNotificationClick?.((e,n)=>t(n)),r=e=>{e.data?.t===`notification-click`&&t(e.data.target)};return navigator.serviceWorker?.addEventListener(`message`,r),()=>{n?.(),navigator.serviceWorker?.removeEventListener(`message`,r)}}var gi=5e3,_i=`[data-notification-session]`;function vi(e){let t=null,n=()=>{t=null},r=e=>e.target instanceof Element?e.target.closest(_i):null,i=e=>{if(!e.isTrusted)return;let n=r(e),i=n?.dataset.notificationSession;t=n&&i?{element:n,session:i,at:performance.now()}:null},a=e=>{r(e)!==t?.element&&n()},o=[`pointerdown`,`keydown`,`input`,`paste`];for(let t of o)e.addEventListener(t,i,!0);return e.addEventListener(`focusin`,a,!0),e.addEventListener(`visibilitychange`,n),e.defaultView?.addEventListener(`blur`,n),{isInteracting(n){return t!==null&&t.session===n&&performance.now()-t.at<gi&&e.visibilityState===`visible`&&e.hasFocus()&&t.element.isConnected&&t.element.dataset.notificationSession===n&&t.element.getClientRects().length>0},dispose(){n();for(let t of o)e.removeEventListener(t,i,!0);e.removeEventListener(`focusin`,a,!0),e.removeEventListener(`visibilitychange`,n),e.defaultView?.removeEventListener(`blur`,n)}}}var yi=new Set,bi=e=>!!e&&yi.has(e);async function xi(e,t){let n=j()?.windows?.effects;if(!n)return!0;try{return await n.claimNotification({id:e,...t?{legacy:!0}:{}})}catch{return!1}}async function Si(e){let t=j()?.windows,n=t?.projects;if(!n||e.host)return!1;let r=await N.fetchQuery({queryKey:[`project`,e.project],queryFn:()=>k(`GET`,`/api/projects/${e.project}`),staleTime:1e4}),i={profileId:r.project.profile_id,route:`/project/${e.project}/session/${e.session}`};return await t?.transfers?.focusPane?.({profileId:i.profileId,ref:m(r.sessions.find(t=>t.id===e.session)??{id:e.session,kind:`agent`})})||await n.route(i)||await fr({...i,kind:`navigate-project`}),!0}var Ci=v.parse({});function wi(e){return e.prefs.muted_projects.includes(e.projectId)?{desktop:!1,sound:!1}:{desktop:e.prefs.desktop&&(e.permission===`granted`||e.permission===`unverified`)&&(e.prefs.when_focused||!e.sessionFocused),sound:e.prefs.sound}}function Ti(e,t){for(let[,n]of e.getQueriesData({queryKey:[`sessions`]})){let e=n?.find(e=>e.id===t);if(e)return e}for(let[,n]of e.getQueriesData({queryKey:[`project`]})){let e=n?.sessions.find(e=>e.id===t);if(e)return e}}function Ei(e){return e.title??e.agent_title??e.osc_title??e.id.slice(0,8)}function Di(){try{let e=new AudioContext,t=e.createGain();t.gain.value=.04,t.connect(e.destination);for(let[n,r]of[[880,0],[1318.5,.09]]){let i=e.createOscillator();i.type=`sine`,i.frequency.value=n,i.connect(t),i.start(e.currentTime+r),i.stop(e.currentTime+r+.12)}setTimeout(()=>void e.close(),400)}catch{}}function Oi(){let e=P(),t=(0,J.useRef)(null);(0,J.useEffect)(()=>{let e=vi(document);return t.current=e,()=>{t.current=null,e.dispose()}},[]),(0,J.useEffect)(()=>hi(t=>{t.host||Si(t).then(n=>{n||e(`/project/${t.project}/session/${t.session}`,{state:{notificationSession:t.session}})}).catch(K)}),[e]),ki(t=>{e(`/project/${t.project_id}/session/${t.id}`,{state:{notificationSession:t.id}})},e=>t.current?.isInteracting(e.id)??!1)}function ki(e,t=()=>document.hasFocus()){let n=qe(),r=(0,J.useRef)(e);r.current=e;let i=(0,J.useRef)(t);i.current=t;let a=rt(Ze().data)??`Puddle`,o=(0,J.useRef)(a);o.current=a;let[s,c]=(0,J.useState)(0);zn(`shell`,s>0?`(${s}) ${a}`:a),(0,J.useEffect)(()=>{let e=new Set;c(0);let t=!0,a=async e=>{if(!await xi(e.id??`${e.session}:${e.activity??`waiting`}`,!e.id)||!t)return;let a=Ti(n,e.session);if(!a)try{a=(await at(n)).find(t=>t.id===e.session)}catch{return}if(!t||!a)return;let s=a,c,l;try{let e=await n.fetchQuery({queryKey:[`project`,s.project_id],queryFn:()=>k(`GET`,`/api/projects/${s.project_id}`),staleTime:1e4});if(!t)return;l=e.project;let r=l.profile_id,i=await n.fetchQuery({queryKey:[`profile-settings`,r],queryFn:()=>k(`GET`,`/api/profiles/${r}/settings`),staleTime:1e4});c=v.catch(Ci).parse(i.notifications??{})}catch{return}if(!t)return;let u=wi({prefs:c,projectId:s.project_id,sessionFocused:i.current(s),permission:re()});u.sound&&Di(),u.desktop&&!bi(y()?.scope)&&await le({id:e.id?`puddle-event-${e.id}`:`puddle-agent-${s.id}`,title:e.content?.title??Ei(s).slice(0,160),body:e.content?.body??(e.reason===`exited`?`Agent finished running`:`Waiting for your input`),target:{project:s.project_id,session:s.id,...y()?.notificationHost?{host:y().notificationHost}:{}}},()=>{t&&r.current(s)},{host:o.current,project:l})},s=q.onAgentNotification(e=>{a(e)}),l=q.onStatus(t=>{let r=e.has(t.session);t.status===`waiting_input`?e.add(t.session):e.delete(t.session),c(e.size),!(t.status!==`waiting_input`||r)&&n.fetchQuery({queryKey:[`version`],queryFn:()=>k(`GET`,`/api/version`),staleTime:1/0}).then(e=>{if(!(e.protocol.major>22||e.protocol.major===22&&e.protocol.minor>=3))return a({session:t.session,reason:`waiting_input`,activity:t.last_activity_at})}).catch(()=>{})});return()=>{t=!1,l(),s()}},[n])}function Ai({initial:e,defaultScope:t,allowProject:n=!0,agents:r,onSave:i,onCancel:a}){let[o,s]=(0,J.useState)(e?.title??``),[c,l]=(0,J.useState)(e?.body??``),[u,d]=(0,J.useState)(n?e?.scope??t:`profile`),[f,p]=(0,J.useState)((e?.tags??[]).join(`, `)),[m,h]=(0,J.useState)(e?.agent_type??null),g=()=>{let e=c.trim();e&&i({title:o.trim()||null,body:e,scope:u,tags:f.split(`,`).map(e=>e.trim()).filter(Boolean),agent_type:m})};return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,Y.jsx)(V,{value:o,placeholder:`Title (optional)`,spellCheck:!1,onChange:e=>s(e.target.value),onKeyDown:e=>e.stopPropagation(),className:`h-9 text-sm font-medium`}),(0,Y.jsx)(Xt,{autoFocus:!0,value:c,placeholder:`Prompt or note…`,spellCheck:!1,rows:10,onChange:e=>l(e.target.value),onKeyDown:e=>{e.stopPropagation(),e.key===`Escape`?a():e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&g()},className:`resize-y text-sm leading-relaxed`}),(0,Y.jsx)(V,{value:f,placeholder:`tags, comma, separated`,spellCheck:!1,onChange:e=>p(e.target.value),onKeyDown:e=>e.stopPropagation(),className:`h-8 text-xs`}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[n&&(0,Y.jsxs)(`label`,{className:`flex items-center gap-1.5 text-2xs text-fg-secondary`,children:[(0,Y.jsx)(cn,{checked:u===`profile`,onCheckedChange:e=>d(e?`profile`:`project`)}),`Profile-wide`]}),(0,Y.jsx)(`div`,{className:`ml-auto flex items-center gap-1`,children:r.map(e=>(0,Y.jsxs)(`button`,{type:`button`,title:e.display_name,"aria-pressed":m===e.id,onClick:()=>h(t=>t===e.id?null:e.id),className:F(`rounded-md p-1 transition-colors`,m===e.id?`bg-surface text-fg`:`text-fg-gold hover:bg-surface hover:text-fg`),children:[(0,Y.jsx)(Ln,{type:e.id,className:`size-3.5`}),(0,Y.jsx)(`span`,{className:`sr-only`,children:e.display_name})]},e.id))})]}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-end gap-1.5`,children:[(0,Y.jsx)(B,{variant:`ghost`,size:`sm`,onClick:a,children:`Cancel`}),(0,Y.jsx)(B,{size:`sm`,disabled:!c.trim(),onClick:g,children:`Save`})]})]})}function ji(){let e=wn(),t=A(),n=xt().id,r=He(t??void 0,n).data??[],i=We().data??[],a=ot(),o=je(),s=Re(),c=On(),[l,u]=(0,J.useState)(null),[d,f]=(0,J.useState)(null),[p,m]=(0,J.useState)(null),[h,g]=(0,J.useState)(null),[_,v]=(0,J.useState)(null);(0,J.useEffect)(()=>G(`scratchpad.toggle`,kn),[]),(0,J.useEffect)(()=>{e||(u(null),f(null),m(null))},[e]);let y=(0,J.useMemo)(()=>[...new Set(r.flatMap(e=>e.tags))].sort((e,t)=>e.localeCompare(t)),[r]),b=(0,J.useMemo)(()=>[...new Set(r.map(e=>e.agent_type).filter(e=>e!==null))],[r]),x=d!==null||p!==null,S=r.filter(e=>(d===null||e.tags.includes(d))&&(p===null||e.agent_type===p)),C=x?S:_??r,ee=e=>{t&&(a.mutate({profile_id:t,scope:e.scope,project_id:e.scope===`project`?n:void 0,title:e.title??void 0,body:e.body,tags:e.tags,agent_type:e.agent_type??void 0}),u(null))},w=(e,t)=>{o.mutate({id:e,scope:t.scope,project_id:t.scope===`project`?n??null:null,title:t.title,body:t.body,tags:t.tags,agent_type:t.agent_type}),u(null)},T=(e,t)=>{let n=_??r,i=n.findIndex(t=>t.id===e),a=n.findIndex(e=>e.id===t);if(i===-1||a===-1||i===a)return;let o=n.slice(),[s]=o.splice(i,1);o.splice(a,0,s),v(o)},E=()=>{let e=h,t=_;if(g(null),v(null),e===null||!t)return;let n=t.findIndex(t=>t.id===e);if(n===-1)return;let r=t[n-1],i=t[n+1],a=r?i?(r.position+i.position)/2:r.position+1:(i?i.position:0)-1;o.mutate({id:e,position:a})},te=e=>{navigator.clipboard?.writeText(e.body),I.success(`Copied to clipboard`)};return(0,Y.jsxs)(sr,{open:e,onOpenChange:Nn,children:[(0,Y.jsxs)(z,{children:[(0,Y.jsx)(L,{asChild:!0,children:(0,Y.jsx)(or,{asChild:!0,children:(0,Y.jsxs)(B,{variant:`ghost`,size:`icon`,className:`compact:h-7 compact:w-7`,children:[(0,Y.jsx)(Pr,{}),(0,Y.jsx)(`span`,{className:`sr-only`,children:`Scratchpad`})]})})}),(0,Y.jsx)(R,{children:`Scratchpad`})]}),(0,Y.jsxs)(ar,{className:`w-[34rem] max-w-[calc(100vw-1rem)] p-0`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 px-5 pb-2 pt-4`,children:[(0,Y.jsx)(`span`,{className:`text-2xs font-medium uppercase tracking-wide text-fg-gold`,children:`Scratchpad`}),(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>u(l===`new`?null:`new`),className:F(Ht,`ml-auto`),children:[(0,Y.jsx)(pn,{className:`size-4`}),(0,Y.jsx)(`span`,{className:`sr-only`,children:`New entry`})]})]}),(y.length>0||b.length>0)&&(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1 px-5 pb-2`,children:[y.map(e=>(0,Y.jsx)(`button`,{type:`button`,onClick:()=>f(t=>t===e?null:e),className:F(`rounded-full px-2 py-0.5 text-2xs transition-colors`,d===e?`bg-action text-action-ink`:`bg-surface text-fg-secondary hover:text-fg`),children:e},e)),b.map(e=>(0,Y.jsx)(`button`,{type:`button`,"aria-pressed":p===e,onClick:()=>m(t=>t===e?null:e),className:F(`rounded-md p-1 transition-colors`,p===e?`bg-action text-action-ink`:`text-fg-gold hover:bg-surface`),children:(0,Y.jsx)(Ln,{type:e,className:`size-3.5`})},e))]}),(0,Y.jsxs)(`div`,{className:`no-scrollbar max-h-[65vh] overflow-y-auto px-2 pb-3`,children:[(0,Y.jsx)(fn,{expanded:l===`new`,children:l===`new`&&(0,Y.jsx)(`div`,{className:`px-3 py-2`,children:(0,Y.jsx)(Ai,{defaultScope:n?`project`:`profile`,allowProject:n!==void 0,agents:i,onSave:ee,onCancel:()=>u(null)})})}),C.length===0&&l!==`new`&&(0,Y.jsx)(`p`,{className:`px-3 py-3 text-sm text-fg-muted`,children:x?`Nothing matches this filter.`:`No entries yet — press + to add a reusable prompt or note.`}),(0,Y.jsx)(`ul`,{className:`flex flex-col`,children:C.map(e=>(0,Y.jsx)(`li`,{draggable:!x&&l===null,onDragStart:t=>{t.dataTransfer.effectAllowed=`move`,g(e.id)},onDragOver:t=>{h!==null&&(t.preventDefault(),h!==e.id&&T(h,e.id))},onDragEnd:E,className:F(`transition-opacity`,h===e.id&&`opacity-50`),children:(0,Y.jsx)(fn,{expanded:l===e.id,children:l===e.id?(0,Y.jsx)(`div`,{className:`px-3 py-2`,children:(0,Y.jsx)(Ai,{initial:e,defaultScope:e.scope,allowProject:n!==void 0||e.scope===`project`,agents:i,onSave:t=>w(e.id,t),onCancel:()=>u(null)})}):(0,Y.jsx)(Mi,{entry:e,onInsert:c?()=>{c(e.body),Nn(!1)}:null,onCopy:()=>te(e),onEdit:()=>u(e.id),onDelete:()=>s.mutate(e.id)})})},e.id))})]})]})]})}function Mi({entry:e,onInsert:t,onCopy:n,onEdit:r,onDelete:i}){let[a,o]=(0,J.useState)(!1);return(0,Y.jsxs)(`div`,{onClick:e=>{e.target.closest(`button`)||r()},className:`cursor-pointer rounded-md px-3 py-2.5 transition-colors hover:bg-surface`,children:[e.title&&(0,Y.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:e.title}),(0,Y.jsx)(`p`,{className:F(`line-clamp-3 whitespace-pre-wrap text-sm text-fg-secondary`,e.title&&`mt-0.5`),children:e.body}),a?(0,Y.jsxs)(`div`,{className:`mt-2 flex items-center gap-3`,children:[(0,Y.jsx)(`span`,{className:`text-2xs text-fg-muted`,children:`Delete this entry? This can’t be undone.`}),(0,Y.jsx)(`button`,{type:`button`,onClick:()=>{o(!1),i()},className:F(Vt,`text-danger`),children:`Delete`}),(0,Y.jsx)(`button`,{type:`button`,onClick:()=>o(!1),className:Vt,children:`Cancel`})]}):(0,Y.jsxs)(`div`,{className:`mt-2 flex items-center gap-1.5`,children:[(0,Y.jsx)(`span`,{className:`text-2xs uppercase tracking-wide text-fg-muted`,children:e.scope===`profile`?`Profile-wide`:`Project`}),e.agent_type&&(0,Y.jsx)(Ln,{type:e.agent_type,className:`size-3 text-fg-gold`}),e.tags.map(e=>(0,Y.jsx)(`span`,{className:`rounded-full bg-surface px-1.5 text-2xs text-fg-secondary`,children:e},e)),(0,Y.jsxs)(Zn,{label:`Scratchpad entry actions`,className:`ml-auto`,children:[t&&(0,Y.jsx)(Ni,{icon:jr,label:`Insert into focused terminal`,onClick:t}),(0,Y.jsx)(Ni,{icon:ln,label:`Copy`,onClick:n}),(0,Y.jsx)(Ni,{icon:Zt,label:`Edit`,onClick:r}),(0,Y.jsx)(Ni,{icon:_n,label:`Delete`,onClick:()=>o(!0)})]})]})]})}function Ni({icon:e,label:t,onClick:n}){return(0,Y.jsxs)(z,{children:[(0,Y.jsx)(L,{asChild:!0,children:(0,Y.jsxs)(`button`,{type:`button`,onClick:n,className:Ht,children:[(0,Y.jsx)(e,{className:`size-3.5`}),(0,Y.jsx)(`span`,{className:`sr-only`,children:t})]})}),(0,Y.jsx)(R,{children:t})]})}var Pi=e=>({layout_tree:e.layout_tree,active_session:e.active_session});function Fi(e,t,n,r){if(t===`project`&&!n)throw Error(`Select a project before saving its windows`);let i=e.flatMap(({identity:e,snapshot:i,visibleProject:a})=>{if(t===`project`&&e.kind!==`host`&&e.projectId!==n)return[];let o=i;if(t===`project`&&e.kind===`host`){let e=pt({snapshot:i,buffers:[],views:{}},n,r,a??``).destination.snapshot;o={...i,layout_mode:`project`,layout_tree:null,active_session:null,project_layouts:{[n]:{...Pi(e),layout_ref:null}}}}let s=o.layout_mode===`project`?o.layout_tree:o.layout_tree??st(o);return[p.parse({key:e.kind===`host`?`host`:e.kind===`project`?`project-${e.projectId}`:e.id,kind:e.kind,project_id:e.kind===`host`?t===`project`?n:a:e.projectId,layout_mode:o.layout_mode??`profile`,layout_tree:s,active_session:o.active_session,project_layouts:Object.fromEntries(Object.entries(o.project_layouts).map(([e,t])=>[e,Pi(t)]))})]}),a=l.parse({version:1,windows:i}),o=d(a,t,n);if(o)throw Error(o);let s=new Set,c=i.flatMap(e=>e.layout_mode===`project`?Object.values(e.project_layouts).map(e=>e.layout_tree):[e.layout_tree]).filter(e=>e!==null).map(e=>ct(e,e=>e.type===`editor`?!0:s.has(e.session)?!1:(s.add(e.session),!0))).filter(e=>lt(e).length!==0);return{window_arrangement:a,layout_tree:c.length?mt(_t(c.length===1?c[0]:ut(`row`,c))):null,active_session:i.flatMap(e=>e.layout_mode===`project`?Object.values(e.project_layouts).map(e=>e.active_session):[e.active_session]).find(e=>e!==null&&s.has(e))??null}}function Ii(e,t,n,r){let i=e.entries.filter(e=>e.open).map(e=>({identity:e.identity,snapshot:e.snapshot,visibleProject:/^\/project\/([0-9a-f]{10})/.exec(e.route??``)?.[1]??null})),a=i.find(e=>e.identity.kind===`host`);for(let n of e.entries){if(!n.returnedProject||n.open||n.identity.kind!==`project`)continue;if(!a)throw Error(`The host layout has not loaded`);if(!n.snapshot.layout_tree)continue;let e=a.snapshot;a.snapshot=ft({snapshot:e,buffers:[],views:{}},{snapshot:n.snapshot,buffers:[],views:{}},n.identity.projectId).snapshot,t===`project`&&e.layout_mode===`project`&&(a.snapshot={...a.snapshot,project_layouts:{...e.project_layouts,[n.identity.projectId]:a.snapshot.project_layouts[n.identity.projectId]}})}return Fi(i,t,n,r)}function Li(e){return JSON.stringify(e.windows.map(e=>JSON.stringify({kind:e.kind,project:e.kind===`host`?null:e.project_id,mode:e.layout_mode,tree:U(e.layout_tree),slices:Object.entries(e.project_layouts).sort(([e],[t])=>e.localeCompare(t)).map(([e,t])=>[e,U(t.layout_tree)])})).sort())}function Ri(e){if(e.window_arrangement)return e.window_arrangement;let t={layout_tree:e.layout_tree,active_session:e.active_session};return l.parse({version:1,windows:[{key:`host`,kind:`host`,project_id:e.project_id,layout_mode:e.scope===`project`?`project`:`profile`,...e.scope===`project`?{layout_tree:null,active_session:null}:t,project_layouts:e.scope===`project`?{[e.project_id]:t}:{}}]})}var zi=new class{running=!1;uncertain=null;listeners=new Set;busy=()=>this.running;subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});async apply(e,t){if(!e.apply||!e.observe)throw Error(`Update the desktop app to load window layouts`);if(this.running)throw Error(`A window layout is already loading`);this.running=!0,this.listeners.forEach(e=>e());try{if(this.uncertain){let t=await e.observe(this.uncertain);throw t.status!==`committed`&&t.status!==`cancelled`?Error(`The previous layout outcome is still unknown. Reopen the host window to recover before loading another layout.`):(this.uncertain=null,Error(`The previous layout was ${t.status}. Choose the desired layout again to load it.`))}this.uncertain={id:t.id,profileId:t.profileId};let n;try{n=await e.apply(t)}catch{n=await e.observe(this.uncertain)}return(n.status===`committed`||n.status===`cancelled`)&&(this.uncertain=null),n}finally{this.running=!1,this.listeners.forEach(e=>e())}}};function Bi(e,t,n,i){let a=M(),o=a!==null,s=j()?.windows?.layouts,c=Ue().data?.protocol,l=!!s?.apply&&!!s.observe&&r(c,{major:26,minor:17}),u=a?.identity.kind===`host`,d=ht(o&&u?e:null),f=(0,J.useSyncExternalStore)(zi.subscribe,zi.busy),p=i===`profile`?``:i??(n?.scope===`project`?n.projectId:``),m=p?`project`:`profile`,h=Ye({queryKey:[`native-layout-capture`,a?.identity.id,e,m,p],enabled:o&&u&&l&&t&&!!e&&!!d?.loaded&&!f,retry:!1,staleTime:0,queryFn:async()=>{if(!s||!e||De()!==e)throw Error(`The active profile changed`);let t=await at(N),n=await s.capture({profileId:e,scope:m,...p?{projectId:p}:{}});if(De()!==e)throw Error(`The active profile changed`);return Ii(n,m,p||null,new Map(t.map(e=>[e.id,e.project_id])))}}),g=d?.snapshot,_=(0,J.useRef)(g);(0,J.useEffect)(()=>{let e=_.current!==g;_.current=g,e&&o&&u&&l&&t&&g&&!f&&N.invalidateQueries({queryKey:[`native-layout-capture`,a.identity.id]})},[o,u,l,t,g,f,a]),(0,J.useEffect)(()=>{if(!o||!u||!l||!t||f)return;let e=()=>{N.invalidateQueries({queryKey:[`native-layout-capture`,a.identity.id]})};window.addEventListener(`focus`,e);let n=j()?.onWindowFocusChange?.(t=>{t&&e()});return()=>{window.removeEventListener(`focus`,e),n?.()}},[o,u,l,t,f,a]);let v=o&&!l?`Window layouts require an updated desktop app and host (application 26.17 or later).`:h.error?.message??null;if(!o||!u||!l||!e||!d?.loaded)return{native:o,bridge:null,busy:f,error:v};let y=()=>{if(De()!==e)throw Error(`The active profile changed`)};return{native:o,bridge:{native:!0,scope:m,projectId:p,layoutRef:p?d.snapshot.project_layouts[p]?.layout_ref??d.snapshot.layout_ref:d.snapshot.layout_ref,signature:h.error||h.isStale&&h.isFetching?``:h.data?Li(h.data.window_arrangement):``,savedSignature:e=>Li(Ri(e)),capture:async()=>{y();let e=await h.refetch({throwOnError:!0});if(!e.data)throw Error(`The window layout could not be captured`);return y(),e.data},adopt:async t=>{y();let n=gt(e),r=n.get(),i=t.project_id?r.project_layouts[t.project_id]:void 0;n.update(i&&t.project_id?{project_layouts:{...r.project_layouts,[t.project_id]:{...i,layout_ref:t.id}}}:{layout_ref:t.id}),await n.flush()},apply:async t=>{y();let n=await zi.apply(s,{id:crypto.randomUUID(),profileId:e,scope:t.scope,...t.project_id?{projectId:t.project_id}:{},arrangement:Ri(t),layoutRef:t.id});if(n.status!==`committed`)throw Error(n.error??(n.status===`cancelled`?`The layout was cancelled; your previous windows remain available.`:`The layout outcome is not confirmed. Load again to check its recorded outcome.`));return n.error&&I.warning(n.error),!0}},busy:f||h.isFetching,error:v}}var Vi=f.parse({});function Hi(e,t){let[n,r]=(0,J.useState)(null),i=(0,J.useRef)({profileId:e,enabled:t});i.current={profileId:e,enabled:t};let a=Qe(t).data,o=Ve(e??void 0,t&&e!==null).data;return(0,J.useEffect)(()=>{if(!t||e===null){r(null);return}let n=!1,i;try{i=An(sessionStorage.getItem(Pn(e)))}catch{i={kind:`absent`}}if(i.kind===`present`){r(i.snapshot);return}return tt(e).then(e=>{n||r(e?e.ui_state:Vi)}).catch(()=>{n||r(Vi)}),()=>{n=!0}},[t,e]),(0,J.useMemo)(()=>{if(!t||e===null||n===null)return null;let s=t=>{r(t),Je(e,t).catch(e=>console.warn(`ui-state save failed: ${e.message}`));try{sessionStorage.setItem(Pn(e),JSON.stringify(t))}catch(e){console.warn(`ui-state write failed: ${e.message}`)}},c=e=>{if(!a||!o)return!1;let{patch:t,projectBased:r}=dt(n,e,{alive:new Set(a.filter(e=>e.status!==`archived`).map(e=>e.id)),sessionProject:new Map(a.map(e=>[e.id,e.project_id])),projectIds:o.map(e=>e.id),currentProject:null}),i={...n,...t};return s(i),he().projectBasedLayout!==r&&me({projectBasedLayout:r}),!0},l=Object.fromEntries(Object.entries(n.project_layouts).map(([e,t])=>[e,{layoutRef:t.layout_ref,signature:U(t.layout_tree)}]));return(n.layout_mode??`profile`)===`project`?{headless:!0,scope:`project`,projectId:``,layoutRef:null,signature:U(null),slices:l,capture:()=>({layout_tree:null,active_session:null}),apply:c}:{scope:`profile`,projectId:``,layoutRef:n.layout_ref,signature:U(n.layout_tree),slices:l,capture:()=>({layout_tree:n.layout_tree,active_session:n.active_session}),adopt:e=>{i.current.enabled&&i.current.profileId===e.profile_id&&s({...n,layout_ref:e.id})},apply:c}},[t,e,n,a,o])}var Ui=U(null);function Wi(){let e=Dn(),t=P(),n=A(),r=In(),[i,a]=(0,J.useState)(null),o=Bi(n,e,r,i),s=Hi(n,!o.native&&e&&r===null),c=o.native?o.bridge:r??s,[l,u]=(0,J.useState)(!1),d=(0,J.useRef)(!1),f=l||o.busy,p=async e=>{if(!(d.current||o.busy)){d.current=!0,u(!0);try{await e()}catch(e){K(e)}finally{d.current=!1,u(!1)}}},m=Ae(n??void 0,void 0).data??[],h=Ve(n??void 0,e&&n!==null).data??[],g=$e(),_=Ne(),v=Me(),[y,b]=(0,J.useState)(``),[x,S]=(0,J.useState)(!1),[C,ee]=(0,J.useState)(null);(0,J.useEffect)(()=>{let e=M()?.identity.kind;if(!e||e===`host`)return G(`layouts.toggle`,Mn)},[]),(0,J.useEffect)(()=>{e||(b(``),S(!1),ee(null),a(null))},[e]);let w=c?.headless===!0,T=c===null||w?null:m.find(e=>e.id===c.layoutRef&&(!c.native||e.scope===c.scope&&(e.scope===`profile`||e.project_id===c.projectId)))??null,E=c!==null&&!w&&(T===null?c.signature!==Ui:(c.savedSignature?.(T)??U(T.layout_tree))!==c.signature),te=e=>{let t=c?.slices?.[e];if(!t)return!1;let n=t.layoutRef===null?null:m.find(e=>e.id===t.layoutRef)??null;return n?U(n.layout_tree)!==t.signature:t.signature!==Ui},ne=e=>c===null?!1:c.native?!O(e)||!c.signature||c.savedSignature?.(e)!==c.signature:e.scope===`profile`?c.scope===`profile`&&E:e.project_id===null?!1:c.scope===`project`?!w&&e.project_id===c.projectId?E:te(e.project_id):E||te(e.project_id),re=e=>T!==null&&e.id===T.id,ie=e=>(e===null?void 0:h.find(t=>t.id===e)?.name)??`Project`,D=c!==null&&!w&&c.scope===`project`?m.filter(e=>e.scope===`profile`||e.project_id===c.projectId):m,ae=[...D.some(e=>e.scope===`profile`)?[{key:`profile`,name:`Profile-wide`}]:[],...[...new Set(D.flatMap(e=>e.project_id===null?[]:[e.project_id]))].map(e=>({key:e,name:ie(e)})).sort((e,t)=>e.name.localeCompare(t.name))],oe=C===null?D:C===`profile`?D.filter(e=>e.scope===`profile`):D.filter(e=>e.project_id===C),O=e=>c!==null&&e.scope===c.scope&&(c.scope===`profile`||e.project_id===c.projectId),se=async e=>{c?.adopt?await c.adopt(e):await c?.apply(e)},ce=async(e,t,r)=>{if(!c||!n)return;let i=await g.mutateAsync({profile_id:n,scope:c.scope,...c.scope===`project`?{project_id:c.projectId}:{},name:e,...t});r&&await se(i)},le=e=>p(async()=>{if(!c)return;let t=O(e)?e:m.find(t=>t.name===e.name&&O(t)),n=await c.capture();t?await se(await _.mutateAsync({id:t.id,...n})):await ce(e.name,n,!0)}),ue=(e,t)=>p(async()=>{await ce(t,{layout_tree:e.layout_tree,active_session:e.active_session,...O(e)&&e.window_arrangement?{window_arrangement:e.window_arrangement}:{}},!1)}),de=e=>p(async()=>{if(c){if(!await c.apply(e)){I.error(`Workspace is still loading — try again in a moment`);return}!c.native&&e.project_id!==null&&e.project_id!==c.projectId&&t(`/project/${e.project_id}`),En(!1)}});return(0,Y.jsxs)(sr,{open:e,onOpenChange:En,children:[(0,Y.jsxs)(z,{children:[(0,Y.jsx)(L,{asChild:!0,children:(0,Y.jsx)(or,{asChild:!0,children:(0,Y.jsxs)(B,{variant:`ghost`,size:`icon`,className:`compact:h-7 compact:w-7`,children:[(0,Y.jsx)(Mr,{}),(0,Y.jsx)(`span`,{className:`sr-only`,children:`Layouts`})]})})}),(0,Y.jsx)(R,{children:`Layouts`})]}),(0,Y.jsxs)(ar,{className:`w-[26rem] max-w-[calc(100vw-1rem)] p-0`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 px-5 pb-2 pt-4`,children:[(0,Y.jsx)(`span`,{className:`text-2xs font-medium uppercase tracking-wide text-fg-gold`,children:`Layouts`}),c!==null&&!w&&(0,Y.jsxs)(`button`,{type:`button`,disabled:f,onClick:()=>S(e=>!e),className:F(`inline-flex size-[var(--ui-control-height)] shrink-0 cursor-pointer items-center justify-center rounded-[var(--ui-radius)] text-fg transition-colors hover:bg-elevated disabled:pointer-events-none disabled:opacity-50`,`ml-auto`),children:[(0,Y.jsx)(pn,{className:`size-4`}),(0,Y.jsx)(`span`,{className:`sr-only`,children:`Save the current layout as a new layout`})]})]}),o.native&&(0,Y.jsxs)(`div`,{className:`px-5 pb-3`,children:[(0,Y.jsxs)(qt,{value:c?.scope===`project`?c.projectId:`profile`,onValueChange:a,disabled:f,children:[(0,Y.jsx)(Wt,{"aria-label":`Save layout for`,className:`h-8 text-sm`,children:(0,Y.jsx)(Ut,{})}),(0,Y.jsxs)(Gt,{children:[(0,Y.jsx)(Kt,{value:`profile`,children:`Profile-wide`}),h.map(e=>(0,Y.jsx)(Kt,{value:e.id,children:e.name},e.id))]})]}),o.error&&(0,Y.jsx)(`p`,{role:`status`,className:`pt-2 text-sm text-fg-muted`,children:o.error})]}),(0,Y.jsx)(fn,{expanded:c!==null&&!w&&(T===null||x),children:c===null?(0,Y.jsx)(`p`,{className:`px-5 pb-3 text-sm text-fg-muted`,children:`Loading the profile’s layout state…`}):w?(0,Y.jsx)(`p`,{className:`px-5 pb-3 text-sm text-fg-muted`,children:`Project-based layout is on — every project keeps its own layout. Open a project to name or save it; loading works from here.`}):(T===null||x)&&(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2 px-5 pb-3`,children:[T===null&&(0,Y.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,Y.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:`Unnamed layout`}),(0,Y.jsx)(`span`,{className:`text-2xs uppercase tracking-wide text-fg-muted`,children:c.scope===`profile`?`Profile-wide`:`Project`}),(0,Y.jsx)(`span`,{className:`ml-auto text-2xs text-interrupted`,children:`Unsaved`})]}),(0,Y.jsxs)(`form`,{className:`flex items-center gap-1.5`,onSubmit:e=>{e.preventDefault();let t=y.trim();t&&p(async()=>{await ce(t,await c.capture(),!0),b(``),S(!1)})},children:[(0,Y.jsx)(V,{autoFocus:x,value:y,placeholder:T===null?`Name this layout…`:`Save as a new layout…`,spellCheck:!1,onChange:e=>b(e.target.value),onKeyDown:e=>{e.stopPropagation(),e.key===`Escape`&&S(!1)},className:`h-8 flex-1 text-sm`}),(0,Y.jsx)(B,{size:`sm`,type:`submit`,disabled:f||!y.trim(),children:`Save`}),T!==null&&(0,Y.jsx)(B,{variant:`ghost`,size:`sm`,onClick:()=>S(!1),children:`Cancel`})]})]})}),ae.length>1&&(0,Y.jsx)(`div`,{className:`flex flex-wrap items-center gap-1 px-5 pb-2`,children:ae.map(e=>(0,Y.jsx)(qi,{active:C===e.key,onClick:()=>ee(t=>t===e.key?null:e.key),children:e.name},e.key))}),(0,Y.jsxs)(`div`,{inert:f||void 0,"aria-busy":f,className:`no-scrollbar max-h-[60vh] overflow-y-auto px-2 pb-3`,children:[oe.length===0&&(0,Y.jsx)(`p`,{className:`px-3 py-3 text-sm text-fg-muted`,children:C===null?`No layouts yet — name and save the current layout to keep it.`:`Nothing matches this filter.`}),(0,Y.jsx)(`ul`,{className:`flex flex-col`,children:oe.map(e=>(0,Y.jsx)(`li`,{children:(0,Y.jsx)(Gi,{layout:e,projectLabel:e.scope===`profile`?null:ie(e.project_id),isCurrent:re(e),dirty:E,loadable:c!==null&&!f,savable:c!==null&&!w&&!f,confirmBeforeLoad:ne(e),overwrites:O(e),onLoad:()=>de(e),onRename:t=>_.mutate({id:e.id,name:t}),onDelete:()=>v.mutate(e.id),onSaveAs:()=>le(e),onDuplicate:t=>ue(e,t)})},e.id))})]})]})]})}function Gi({layout:e,projectLabel:t,isCurrent:n,dirty:r,loadable:i,savable:a,confirmBeforeLoad:o,overwrites:s,onLoad:c,onRename:l,onDelete:u,onSaveAs:d,onDuplicate:f}){let[p,m]=(0,J.useState)(null),[h,g]=(0,J.useState)(null),[_,v]=(0,J.useState)(e.name),y=()=>{if(!(!i||h!==null)){if(o&&p!==`load`){m(`load`);return}m(null),c()}},b=t=>{m(null),v(t===`rename`?e.name:`${e.name} copy`),g(t)},x=()=>{if(n){d();return}m(`save`)},S=n?r?`unsaved`:`active`:null;return(0,Y.jsxs)(`div`,{onClick:e=>{e.target.closest(`button, input`)||y()},className:F(`rounded-md px-3 py-2.5 transition-colors`,i&&`cursor-pointer hover:bg-surface`),children:[h===null?(0,Y.jsxs)(`p`,{className:F(`flex items-baseline gap-2 text-sm font-medium`,S===`active`?`text-success`:S===`unsaved`?`text-interrupted`:`text-fg`),children:[e.name,S!==null&&(0,Y.jsx)(`span`,{className:`text-2xs font-normal`,children:S===`active`?`Active`:`Unsaved`})]}):(0,Y.jsxs)(`form`,{className:`flex items-center gap-1.5`,onSubmit:t=>{t.preventDefault();let n=_.trim();n&&(h===`rename`?n!==e.name&&l(n):f(n)),g(null)},children:[(0,Y.jsx)(V,{autoFocus:!0,value:_,spellCheck:!1,onChange:e=>v(e.target.value),onKeyDown:e=>{e.stopPropagation(),e.key===`Escape`&&g(null)},className:`h-7 flex-1 text-sm`}),(0,Y.jsx)(B,{size:`sm`,type:`submit`,disabled:!_.trim(),children:h===`rename`?`Rename`:`Save`})]}),p===`save`?(0,Y.jsx)(Ki,{question:s?`Overwrite “${e.name}” with the current layout?`:`Save the current layout as “${e.name}” here?`,verb:s?`Overwrite`:`Save`,onConfirm:()=>{m(null),d()},onCancel:()=>m(null)}):p===`delete`?(0,Y.jsx)(Ki,{question:`Delete this layout? This can’t be undone.`,verb:`Delete`,onConfirm:()=>{m(null),u()},onCancel:()=>m(null)}):p===`load`?(0,Y.jsx)(Ki,{question:`Loading discards unsaved layout changes.`,verb:`Load`,onConfirm:y,onCancel:()=>m(null)}):(0,Y.jsxs)(`div`,{className:`mt-2 flex items-center gap-1.5`,children:[t!==null&&(0,Y.jsx)(`span`,{className:`text-2xs uppercase tracking-wide text-fg-muted`,children:t}),(0,Y.jsxs)(Zn,{label:`Layout actions`,className:`ml-auto`,children:[a&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Ji,{icon:hn,label:n?`Save`:`Save the current layout as “${e.name}”`,onClick:x}),(0,Y.jsx)(Ji,{icon:ln,label:`Duplicate`,onClick:()=>b(`duplicate`)})]}),(0,Y.jsx)(Ji,{icon:Zt,label:`Rename`,onClick:()=>b(`rename`)}),(0,Y.jsx)(Ji,{icon:_n,label:`Delete`,onClick:()=>m(`delete`)})]})]})]})}function Ki({question:e,verb:t,onConfirm:n,onCancel:r}){return(0,Y.jsxs)(`div`,{className:`mt-2 flex items-center gap-3`,children:[(0,Y.jsx)(`span`,{className:`text-2xs text-fg-muted`,children:e}),(0,Y.jsx)(`button`,{type:`button`,onClick:n,className:F(Vt,`text-danger`),children:t}),(0,Y.jsx)(`button`,{type:`button`,onClick:r,className:Vt,children:`Cancel`})]})}function qi({active:e,onClick:t,children:n}){return(0,Y.jsx)(`button`,{type:`button`,"aria-pressed":e,onClick:t,className:F(`rounded-full px-2 py-0.5 text-2xs transition-colors`,e?`bg-action text-action-ink`:`bg-surface text-fg-secondary hover:text-fg`),children:n})}function Ji({icon:e,label:t,onClick:n}){return(0,Y.jsxs)(z,{children:[(0,Y.jsx)(L,{asChild:!0,children:(0,Y.jsxs)(`button`,{type:`button`,onClick:n,className:Ht,children:[(0,Y.jsx)(e,{className:`size-3.5`}),(0,Y.jsx)(`span`,{className:`sr-only`,children:t})]})}),(0,Y.jsx)(R,{children:t})]})}var $=j()!==void 0&&/Mac/.test(navigator.platform),Yi=(0,J.lazy)(()=>Se(()=>import(`./SettingsDialog-wkV1PX96.js`).then(e=>({default:e.SettingsDialog})),__vite__mapDeps([17,1,2,18,19,20,3,21,7,22,6,5,8,9,10,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60])));function Xi(){let e=qe();(0,J.useEffect)(()=>{let t=t=>{for(let[n,r]of e.getQueriesData({queryKey:[`sessions`]}))r&&e.setQueryData(n,r.map(t));for(let[n,r]of e.getQueriesData({queryKey:[`project`]}))r&&e.setQueryData(n,{...r,sessions:r.sessions.map(t)})},n=q.onStatus(e=>t(t=>t.id===e.session?{...t,status:e.status,last_activity_at:e.last_activity_at}:t)),r=q.onRenamed(e=>t(t=>t.id===e.session?{...t,title:e.title,agent_title:`agent_title`in e?e.agent_title:t.agent_title,osc_title:`osc_title`in e?e.osc_title:t.osc_title}:t)),i=q.onAccount(t=>{for(let[n,r]of e.getQueriesData({queryKey:[`accounts`]}))r&&e.setQueryData(n,r.map(e=>e.id===t.account_id?{...e,logged_in:t.logged_in}:e))}),a=t=>{e.invalidateQueries({queryKey:[`sessions`]});for(let n of t)e.invalidateQueries({queryKey:[`project`,n]})},o=q.onSessionsChanged(e=>a(e.project_ids)),s=q.onSessionSwitched(e=>a([e.target_project]));return()=>{n(),r(),i(),o(),s()}},[e])}function Zi(){let e=A(),t=Ie(e??``),n=Ue().data?.protocol,r=S(),i=Ze(),o=Le(),[s,c]=(0,J.useState)(!1),l=rt(i.data),u=e=>{c(!1);let t=e.trim();t!==l&&o.mutate({displayName:t===i.data?.hostname?``:t},{onError:e=>K(e)})},d=(0,Y.jsx)(C,{icon:r.icon}),f=F(`host-identity flex h-full shrink-0 items-center gap-2 px-4`,$&&`[-webkit-app-region:no-drag]`),p=`truncate font-sans text-xs font-normal`;return s&&l!==void 0?(0,Y.jsxs)(`div`,{className:f,children:[d,(0,Y.jsx)(yn,{initial:i.data?.displayName??l,maxLength:64,className:F(p,`w-40`),onCommit:u,onCancel:()=>c(!1)})]}):(0,Y.jsxs)(kt,{children:[(0,Y.jsx)(jt,{asChild:!0,children:(0,Y.jsxs)(wt,{to:`/`,className:F(f,`hover:bg-elevated focus-visible:bg-elevated`),title:`All projects`,children:[d,l!==void 0&&(0,Y.jsx)(`span`,{className:p,...xn(()=>c(!0)),children:l})]})}),(0,Y.jsx)(Lr,{kind:`host`,colour:r.colour,onRename:()=>c(!0),onColour:n=>{e&&t.mutate({hostColour:n},{onError:K})},pending:t.isPending||!e,custom:a(n),onUpdates:()=>W(`host`)})]})}function Qi(){let e=xt(),t=Wn(`palette.toggle`),n=ze(e.id).data?.project,r=n!==void 0&&n.id===e.id?n.name:void 0;return(0,Y.jsx)(`button`,{type:`button`,onClick:Cn,className:F(`flex h-full min-w-0 w-full cursor-pointer items-center justify-center gap-2 bg-transparent px-2 font-normal text-fg-muted transition-colors hover:bg-elevated focus-visible:bg-elevated`,$&&`[-webkit-app-region:no-drag]`),children:(0,Y.jsxs)(`span`,{className:F(`pointer-events-none absolute left-1/2 top-1/2 flex max-w-[40%] -translate-x-1/2 -translate-y-1/2 items-center gap-2`,r&&Qt(n?.colour)),style:r?en(n?.colour):void 0,children:[(0,Y.jsx)(`span`,{className:`truncate text-xs`,children:r??`Puddle`}),(0,Y.jsx)(`span`,{className:`shrink-0 text-2xs`,children:t})]})})}function $i(){let e=S(),{fullScreen:t,animate:n}=we(),r=$&&!t;return(0,Y.jsxs)(`header`,{"data-host-colour":e.colour??void 0,onClick:e=>{let t=e.target;e.currentTarget.contains(t)&&(t.closest(`[data-header-section], [aria-label="Workspace controls"], button, a, input`)||Cn())},className:F(`host-header island-outline relative grid shrink-0 cursor-pointer grid-cols-[auto_1px_minmax(0,1fr)_1px_auto] items-center overflow-hidden rounded-[var(--ui-surface-radius)] bg-surface`,`h-9`,!$&&`mx-1.5 mt-1.5`,r&&`pl-[84px] [-webkit-app-region:drag]`,n&&`transition-[padding] duration-200 ease-out`),children:[r&&(0,Y.jsx)(`div`,{"aria-hidden":`true`,className:`pointer-events-none absolute left-[84px] top-1/2 h-5 w-px -translate-y-1/2 bg-border`}),(0,Y.jsx)(`div`,{"data-header-section":!0,className:`flex h-full min-w-0 cursor-default items-center overflow-hidden`,children:(0,Y.jsx)(Zi,{})}),(0,Y.jsx)(`div`,{"aria-hidden":`true`,className:`h-5 w-px bg-border`}),(0,Y.jsx)(Qi,{}),(0,Y.jsx)(`div`,{"aria-hidden":`true`,className:`h-5 w-px bg-border`}),(0,Y.jsxs)(Zn,{label:`Workspace controls`,className:F(`shell-header-actions h-full justify-self-end rounded-none!`,$&&`[-webkit-app-region:no-drag]`),children:[(0,Y.jsxs)(z,{children:[(0,Y.jsx)(L,{asChild:!0,children:(0,Y.jsxs)(B,{variant:`ghost`,size:`icon`,className:`compact:h-7 compact:w-7`,onClick:()=>W(),children:[(0,Y.jsx)(Fr,{}),(0,Y.jsx)(`span`,{className:`sr-only`,children:`Settings`})]})}),(0,Y.jsx)(R,{children:`Settings`})]}),(0,Y.jsx)(Wi,{}),(0,Y.jsx)(ji,{}),(0,Y.jsx)(ti,{})]})]})}function ea(){let e=Fn();Xi(),mi(),Oi();let{handler:t}=Rn(),n=A(),{pathname:r}=Tt(),[a,o]=(0,J.useState)(!1),s=Ue(),c=s.data!==void 0&&i(s.data.protocol);return(0,J.useEffect)(()=>{if(!c)return;let e=()=>{let e=_e();q.reportTheme(e(`--text-primary`),e(`--bg-base`))};return e(),ye(e)},[c]),(0,Y.jsxs)(`div`,{ref:e.ref,"data-project-window-drop-target":e.enabled||void 0,className:`relative flex h-screen flex-col overflow-hidden overscroll-y-none bg-ground`,children:[e.active&&(0,Y.jsx)(`div`,{className:`pointer-events-none absolute inset-1.5 z-50 flex items-center justify-center rounded-[var(--ui-surface-radius)] bg-accent/20`,children:(0,Y.jsx)(`span`,{role:`status`,className:`rounded-[var(--ui-radius)] bg-surface px-4 py-2 text-sm text-fg shadow-lg`,children:`Return project here`})}),(0,Y.jsx)(ee,{}),(0,Y.jsx)(de,{}),(0,Y.jsx)(Rr,{}),(!M()||M()?.identity.kind===`host`)&&(0,Y.jsx)($i,{}),(0,Y.jsx)(`main`,{className:`min-h-0 flex-1`,children:(0,Y.jsx)(mr,{resetOn:r,scope:r.startsWith(`/project/`)?`workspace`:`view`,children:(0,Y.jsx)(Mt,{className:`h-full`,motionKey:r.startsWith(`/project/`)?`workspace`:r,children:(0,Y.jsx)(bt,{})})})}),(0,Y.jsx)(zr,{}),(0,Y.jsx)(Xr,{}),(0,Y.jsx)(ai,{}),(0,Y.jsx)(li,{}),(0,Y.jsx)(di,{}),(0,Y.jsx)(pi,{}),(0,Y.jsx)(Gr,{onNewSession:t??void 0,onNewProject:()=>o(!0)}),n!==null&&(0,Y.jsx)(un,{profileId:n,open:a,onOpenChange:o}),(0,Y.jsx)(J.Suspense,{fallback:null,children:(0,Y.jsx)(Yi,{})}),(0,Y.jsx)(Jr,{})]})}function ta(){return(0,Y.jsx)(Tn,{children:(0,Y.jsx)(ea,{})})}function na({children:e}){let t=(0,J.useContext)(Dt),n=Tt(),r=A(),i=j()?.windows?.projects,a=M(),o=(0,J.useRef)(null),[,s]=(0,J.useState)(0),c=(0,J.useRef)(0),l=`${r}:${n.pathname}`,u=a?.identity,d=u&&u.kind!==`host`&&(n.pathname===`/project/${u.projectId}`||n.pathname.startsWith(`/project/${u.projectId}/session/`));(a?.stagingTransfer||a?.stagingArrangement||d)&&(o.current=l);let f=(0,J.useMemo)(()=>{if(!i||!r)return t;let e=e=>(...a)=>{let[s]=a,l=(typeof s==`string`?s:yt(s)).split(/[?#]/)[0]||n.pathname;if(!h.safeParse(l).success){t.navigator[e](...a);return}let u=++c.current;i.route({profileId:r,route:l}).then(n=>{u!==c.current||n||(o.current=`${r}:${l}`,t.navigator[e](...a))}).catch(K)};return{...t,navigator:{...t.navigator,push:e(`push`),replace:e(`replace`)}}},[i,r,t,n.pathname]);return(0,J.useEffect)(()=>{if(!i||!r||o.current===l)return;let e=!0,t=()=>{let e=a?.identity,t=e&&e.kind!==`host`?`/project/${e.projectId}`:`/`;o.current=`${r}:${t}`,dr(t),s(e=>e+1)};return i.route({profileId:r,route:n.pathname}).then(n=>{e&&(n?t():(o.current=l,s(e=>e+1)))}).catch(n=>{e&&(K(n),t())}),()=>{e=!1}},[i,r,l,n.pathname,a]),i&&r&&o.current!==l?null:(0,Y.jsx)(Dt.Provider,{value:f,children:e})}var ra=(0,J.lazy)(()=>Se(()=>import(`./Dashboard-CoGS2W82.js`).then(e=>({default:e.Dashboard})),__vite__mapDeps([61,1,2,18,19,20,3,21,7,22,6,5,8,9,10,23,28,29,26,27,62,63,64,39,65,47,30,66,42,43,37,44,45,46,67,68,56,53,36]))),ia=(0,J.lazy)(()=>Se(()=>import(`./Workspace-BAWfBTc9.js`).then(e=>({default:e.Workspace})),__vite__mapDeps([69,1,2,6,18,19,20,3,21,7,22,5,8,9,10,23,39,40,27,25,41,26,28,70,29,71,37,42,43,44,45,46,62,64,63,65,33,34,72,47,30,66,67,73,54,55,32,74,75,76,36,77,78,50,79,52,80,35,53,81,82,83,84,59,85,86])));function aa(){let e=A(),t=Pe(),n=M()?.identity,r=n!==void 0&&n.kind!==`host`,i=e!==null&&t.data!==void 0&&!r&&!t.data.some(t=>t.id===e),a=e===null||i;return(0,Y.jsx)(Mt,{className:`h-screen`,motionKey:a?`profiles`:`frontend`,children:a?(0,Y.jsx)(Ir,{}):(0,Y.jsx)(St,{useTransitions:!1,children:(0,Y.jsx)(na,{children:(0,Y.jsx)(J.Suspense,{fallback:null,children:(0,Y.jsx)(Ct,{children:(0,Y.jsxs)(vt,{element:(0,Y.jsx)(ta,{}),children:[(0,Y.jsx)(vt,{path:`/`,element:(0,Y.jsx)(ra,{})}),(0,Y.jsx)(vt,{path:`/project/:id`,element:(0,Y.jsx)(ia,{})}),(0,Y.jsx)(vt,{path:`/project/:id/session/:sid`,element:(0,Y.jsx)(ia,{})})]})})})})})})}function oa(){let e=(0,J.useSyncExternalStore)(fe.subscribe,fe.get);return(0,Y.jsx)(et,{client:N,children:(0,Y.jsxs)(Jt,{delayDuration:300,children:[(0,Y.jsx)(Ar,{}),(0,Y.jsx)(mr,{scope:`app`,children:e?window.location.pathname.startsWith(`/forward/`)?(0,Y.jsx)(pr,{}):(0,Y.jsx)(Ce,{children:(0,Y.jsx)(aa,{})}):(0,Y.jsx)(gr,{})}),(0,Y.jsx)(hr,{})]})})}export{oa as App};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{s as n,y as r}from"./protocol-support-iXloAH0N.js";import{j as i}from"./local-store-Dy1Cd8sn.js";import{i as a,o,s,t as c}from"./LazyTerminal-DnrWO9aI.js";import{t as l}from"./jsx-runtime-By8HlURe.js";import{i as u}from"./profile-store-D4lZiXgL.js";import{L as d,R as f,V as p,W as m,Y as h,b as g,et as _}from"./queries-BSkHGZG8.js";import{r as v,t as y}from"./square-terminal-CrlDquCd.js";import{t as b}from"./utils-B6KiDbIe.js";import{a as x,f as S,i as C,o as w,r as T,s as E}from"./session-order-b3nCJcCG.js";import{a as D,o as O,r as k,s as ee,t as te}from"./dialog-CTN-Lln6.js";import{t as A}from"./button-D-qeQvl5.js";import{n as j,t as M}from"./chevron-right-DUkOv15w.js";import{a as N,n as P,o as F,r as I,t as L}from"./colour-picker-DZdAiaVI.js";import{i as R,n as z,r as B,t as V}from"./use-arrangement-ready-1vmV5np6.js";import{n as H,r as U,t as W}from"./expanding-content-91gc88rm.js";import{h as G}from"./hotkeys-nP8gYtE7.js";import{n as K}from"./errors-CviT-mvB.js";import{t as q}from"./ws-CDXOuBYB.js";var J=e(t(),1),Y=l(),X=!1;function ne(){let[e,t]=(0,J.useState)(X),[n,r]=(0,J.useState)(null);(0,J.useEffect)(()=>{if(!e)return;let t=!1;return q.spawnShell(i).then(e=>{t||r(e)}),()=>{t=!0}},[e]);let a=()=>{X=!1,t(!1),r(null)};return{open:e,term:n,toggle:()=>{e?(n&&q.killShell(i,n),a()):(X=!0,t(!0))},onExit:a}}function re({term:e,onExit:t}){return(0,Y.jsx)(`div`,{className:`h-72 shrink-0 pb-6`,children:(0,Y.jsx)(`div`,{className:`mx-auto size-full max-w-4xl px-6`,children:(0,Y.jsx)(`div`,{className:`workspace-surface island-outline size-full bg-surface p-1`,children:(0,Y.jsx)(`div`,{className:`size-full overflow-hidden rounded-[var(--ui-radius)] bg-ground p-1`,children:e!==null&&(0,Y.jsx)(c,{stream:`home`,term:e,onExit:t})})})})})}var ie=`group block w-full island-outline rounded-[var(--ui-surface-radius)] bg-surface p-4 text-left transition-colors hover:bg-elevated`,ae=[{status:`running`,colour:`bg-running`},{status:`waiting_input`,colour:`bg-waiting`},{status:`interrupted`,colour:`bg-interrupted`}];function oe({project:e,repoPath:t,sessions:n}){let r=n.filter(e=>e.status!==`archived`);return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`h2`,{style:I(e.colour),className:b(`truncate pr-16 text-base font-semibold`,P(e.colour)||`text-fg group-hover:text-accent`),children:e.name}),(0,Y.jsx)(`p`,{className:`mt-1 truncate text-2xs text-fg-muted`,children:t??`…`}),(0,Y.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-3 text-2xs text-fg-muted tabular-nums`,children:[(0,Y.jsxs)(`span`,{children:[r.length,` session`,r.length===1?``:`s`]}),ae.map(({status:e,colour:t})=>{let n=r.filter(t=>t.status===e).length;return n>0?(0,Y.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,Y.jsx)(`span`,{className:`size-1.5 rounded-full ${t}`}),n,` `,e.replace(`_`,` `)]},e):null})]})]})}function Z({icon:e,label:t,onClick:n}){return(0,Y.jsx)(`button`,{type:`button`,"aria-label":t,title:t,onClick:e=>{e.preventDefault(),e.stopPropagation(),n()},className:`flex items-center rounded-md p-1.5 text-fg-muted transition-colors hover:bg-ground hover:text-fg`,children:(0,Y.jsx)(e,{className:`size-4`})})}function Q({project:e,repoPath:t,draggable:i,dragging:a,onDragStart:c,onDragEnd:l,onDragOver:u}){let d=f(),p=g().data?.protocol,m=r(p),h=_(e.id),[y,C]=(0,J.useState)(!1),[T,M]=(0,J.useState)(e.name),[V,H]=(0,J.useState)(s(e)),[U,W]=(0,J.useState)(e.colour??null),G=t=>d.mutate({id:e.id,archived:t},{onError:e=>K(e)}),q=()=>{M(e.name),W(e.colour??null),H(s(e)),C(!0)},X=()=>{let t=T.trim(),n=o(V);if(!t){C(!1);return}let r={...t===e.name?{}:{name:t},...n&&n!==s(e)?{abbrev:n}:{},...m&&U!==(e.colour??null)?{colour:U}:{}};if(Object.keys(r).length===0){C(!1);return}d.mutate({id:e.id,...r},{onSuccess:()=>C(!1),onError:e=>K(e)})};return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(x,{children:[(0,Y.jsx)(S,{asChild:!0,children:(0,Y.jsxs)(`div`,{draggable:i,onDragStart:c,onDragEnd:l,onDragOver:u,className:b(`group relative transition-opacity`,a&&`opacity-50`),children:[(0,Y.jsx)(v,{draggable:!1,to:`/project/${e.id}`,className:ie,children:(0,Y.jsx)(oe,{project:e,repoPath:t,sessions:h.data??[]})}),(0,Y.jsx)(`div`,{className:`absolute right-2 top-2 hidden gap-0.5 group-hover:flex has-[[data-state=open]]:flex pointer-coarse:flex`,children:e.archived?(0,Y.jsx)(Z,{icon:R,label:`Reopen project`,onClick:()=>G(!1)}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Z,{icon:N,label:`Edit project`,onClick:q}),(0,Y.jsx)(Z,{icon:B,label:`Archive project`,onClick:()=>G(!0)})]})})]})}),(0,Y.jsxs)(w,{children:[(0,Y.jsx)(z,{projectId:e.id}),e.archived?(0,Y.jsxs)(E,{onSelect:()=>G(!1),children:[(0,Y.jsx)(R,{}),` Reopen`]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(E,{onSelect:q,children:[(0,Y.jsx)(N,{}),` Edit`]}),(0,Y.jsxs)(E,{onSelect:()=>G(!0),children:[(0,Y.jsx)(B,{}),` Archive`]})]})]})]}),(0,Y.jsx)(te,{open:y,onOpenChange:C,children:(0,Y.jsxs)(k,{children:[(0,Y.jsx)(O,{children:(0,Y.jsx)(ee,{children:`Edit project`})}),(0,Y.jsxs)(`form`,{className:`flex flex-col gap-3`,onSubmit:e=>{e.preventDefault(),X()},children:[(0,Y.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,Y.jsx)(F,{htmlFor:`project-name-${e.id}`,children:`Name`}),(0,Y.jsx)(j,{id:`project-name-${e.id}`,value:T,className:P(U),style:I(U),onChange:e=>M(e.target.value),autoFocus:!0})]}),(0,Y.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,Y.jsx)(F,{htmlFor:`project-abbrev-${e.id}`,children:`Abbreviation`}),(0,Y.jsx)(j,{id:`project-abbrev-${e.id}`,maxLength:5,value:V,onChange:e=>H(o(e.target.value)),className:`w-24 uppercase`}),(0,Y.jsxs)(`p`,{className:`text-2xs text-fg-muted`,children:[`Up to `,5,` characters — the label on the collapsed sidebar rail.`]})]}),m&&(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Y.jsx)(`span`,{className:`text-xs text-fg-secondary`,children:`Colour`}),(0,Y.jsx)(L,{value:U,onChange:W,onCustomChange:n(p)?W:void 0,label:`Project colour`})]}),(0,Y.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Y.jsx)(F,{className:`text-fg-muted`,children:`Path`}),(0,Y.jsx)(`p`,{className:`truncate text-2xs text-fg-muted`,children:t??`…`})]}),(0,Y.jsxs)(D,{children:[(0,Y.jsx)(A,{type:`button`,variant:`ghost`,onClick:()=>C(!1),children:`Cancel`}),(0,Y.jsx)(A,{type:`submit`,disabled:!T.trim()||d.isPending,children:`Save`})]})]})]})})]})}function $({icon:e,label:t,hint:n,onClick:r}){return(0,Y.jsxs)(`button`,{type:`button`,onClick:r,className:`group flex flex-col island-outline rounded-[var(--ui-surface-radius)] bg-surface p-4 text-left transition-colors hover:bg-elevated`,children:[(0,Y.jsxs)(`h2`,{className:`flex items-center gap-2 truncate text-base font-semibold text-fg group-hover:text-accent`,children:[(0,Y.jsx)(e,{className:`size-4 shrink-0`}),t]}),(0,Y.jsx)(`p`,{className:`mt-1 truncate text-2xs text-fg-muted`,children:n})]})}function se(){let e=u();V(e,!0);let t=m(e??void 0),n=h(),r=p(e??void 0),i=d(e??``),[o,s]=(0,J.useState)(!1),[c,l]=(0,J.useState)(null),[f,g]=(0,J.useState)(!1),_=ne(),v=G(`palette.toggle`),x=e=>n.data?.find(t=>t.id===e)?.path,S=t.data??[],w=r.data?.projectOrder??[],E=T(S.filter(e=>!e.archived),w),D=S.filter(e=>e.archived),O=(e,t)=>{e!==t&&i.mutate({projectOrder:C(E.map(e=>e.id),e,t)})};return(0,Y.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,Y.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:(0,Y.jsxs)(`div`,{className:`mx-auto max-w-4xl p-6`,children:[S.length===0&&(0,Y.jsxs)(`div`,{className:`mb-8 mt-16 flex flex-col items-center gap-3 text-center`,children:[(0,Y.jsx)(a,{className:`size-8 text-fg-muted`}),(0,Y.jsxs)(`p`,{className:`text-sm text-fg-secondary`,children:[`No projects yet — open one below, or press `,v,`.`]})]}),(0,Y.jsxs)(`div`,{className:`grid auto-rows-fr grid-cols-1 gap-3 sm:grid-cols-2`,children:[E.map(e=>(0,Y.jsx)(Q,{project:e,repoPath:x(e.repo_id),draggable:!0,dragging:c===e.id,onDragStart:()=>l(e.id),onDragEnd:()=>l(null),onDragOver:t=>{t.preventDefault(),c&&c!==e.id&&O(c,e.id)}},e.id)),(0,Y.jsx)($,{icon:U,label:`Open project`,hint:`Point at a repository on this host`,onClick:()=>s(!0)}),(0,Y.jsx)($,{icon:y,label:_.open?`Close terminal`:`Open terminal`,hint:_.open?`End the shell below`:`A shell at ~ for cloning repositories`,onClick:_.toggle})]}),D.length>0&&(0,Y.jsxs)(`div`,{className:`mt-6`,children:[(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>g(e=>!e),className:`flex items-center gap-1.5 px-1 py-1.5 text-2xs uppercase tracking-wide text-fg-muted transition-colors hover:text-fg`,children:[(0,Y.jsx)(M,{className:b(`size-3 transition-transform`,f&&`rotate-90`)}),(0,Y.jsx)(B,{className:`size-3`}),(0,Y.jsx)(`span`,{children:`Archived`}),(0,Y.jsx)(`span`,{className:`tabular-nums`,children:D.length})]}),f&&(0,Y.jsx)(`div`,{className:`mt-2 grid grid-cols-1 gap-3 sm:grid-cols-2`,children:D.map(e=>(0,Y.jsx)(Q,{project:e,repoPath:x(e.repo_id),draggable:!1,dragging:!1,onDragStart:()=>{},onDragEnd:()=>{},onDragOver:()=>{}},e.id))})]})]})}),(0,Y.jsx)(W,{expanded:_.open,children:_.open&&(0,Y.jsx)(re,{term:_.term,onExit:_.onExit})}),e!==null&&(0,Y.jsx)(H,{profileId:e,open:o,onOpenChange:s})]})}export{se as Dashboard};
|