@puddle-code/cli 0.3.8 → 0.3.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/CHANGELOG.md +7 -5
  2. package/dist/host-control.mjs +288 -171
  3. package/dist/index.js +319 -200
  4. package/dist/public/assets/App-CNB4a07v.js +2 -0
  5. package/dist/public/assets/Dashboard-v3OproVW.js +1 -0
  6. package/dist/public/assets/EditorTabClose-DwhahpvS.js +1 -0
  7. package/dist/public/assets/FindWidget-CVH9U-_P.js +1 -0
  8. package/dist/public/assets/{LazyTerminal-CdXNqTZt.js → LazyTerminal-CgQryH0p.js} +2 -2
  9. package/dist/public/assets/{ModelRefcount-HPszadg6.js → ModelRefcount-njA_f4bS.js} +1 -1
  10. package/dist/public/assets/NewProjectDialog-BT8rR4yn.js +1 -0
  11. package/dist/public/assets/NotebookWidget-Cwd77EGL.js +7 -0
  12. package/dist/public/assets/PaneEditorBody-RaUBrZPu.js +303 -0
  13. package/dist/public/assets/PdfViewer-Bppu4-0-.js +2 -0
  14. package/dist/public/assets/SettingsDialog-CaHklYzG.js +8 -0
  15. package/dist/public/assets/{Terminal-CMOPxTVY.js → Terminal-_10Xyj1h.js} +5 -5
  16. package/dist/public/assets/Workspace-GgVr1uYN.js +20 -0
  17. package/dist/public/assets/_virtual_notebook-widget-runtime-Dro422xS.js +6966 -0
  18. package/dist/public/assets/api-i6xNY3bF.js +1 -0
  19. package/dist/public/assets/auth-GfOuXpIe.js +64 -0
  20. package/dist/public/assets/{buffer-store-Da5Z0NEV.js → buffer-store-eMnMxbpI.js} +1 -1
  21. package/dist/public/assets/{button-Chvl9hcE.js → button-BgeBH2Uc.js} +1 -1
  22. package/dist/public/assets/command-D7m0dmA-.js +1 -0
  23. package/dist/public/assets/context-DW21k43a.js +1 -0
  24. package/dist/public/assets/{context-menu-CnmULRW3.js → context-menu-CMWkmDu6.js} +1 -1
  25. package/dist/public/assets/copy-CGsu8426.js +1 -0
  26. package/dist/public/assets/dialog-BMWRC2HO.js +41 -0
  27. package/dist/public/assets/disclosure-CHXbNzgZ.js +1 -0
  28. package/dist/public/assets/dist-BOS6OKSE.js +1 -0
  29. package/dist/public/assets/dist-C_x5-hi8.js +1 -0
  30. package/dist/public/assets/{dist-BCwJL3w9.js → dist-Cde1E3eV.js} +1 -1
  31. package/dist/public/assets/{dist-DmyIHyF9.js → dist-Ds3438NL.js} +1 -1
  32. package/dist/public/assets/errors-O9DWXa3f.js +1 -0
  33. package/dist/public/assets/forward-link-RM7_5Shu.js +1 -0
  34. package/dist/public/assets/hotkeys-1uTWFYAL.js +1 -0
  35. package/dist/public/assets/index-CPHfr3MU.css +2 -0
  36. package/dist/public/assets/{index-BfBbMcnA.js → index-np8JXeG6.js} +3 -3
  37. package/dist/public/assets/input-CxgRsoVg.js +1 -0
  38. package/dist/public/assets/jsx-runtime-By8HlURe.js +1 -0
  39. package/dist/public/assets/{markdown-mermaid-CltyCx0-.js → markdown-mermaid-CNYDlgGt.js} +1 -1
  40. package/dist/public/assets/media-refresh-store-Bu4kWCGq.js +1 -0
  41. package/dist/public/assets/notification-delivery-Dfvdt_1U.js +1 -0
  42. package/dist/public/assets/{popover-CTPDNtFu.js → popover-CCHRaCvX.js} +1 -1
  43. package/dist/public/assets/preview-kind-DiWpvEc0.js +1 -0
  44. package/dist/public/assets/protocol-support-BGmIChNK.js +1 -0
  45. package/dist/public/assets/{jsx-runtime-ffCh33zF.js → react-dom-cJyBB_A4.js} +1 -1
  46. package/dist/public/assets/{scroll-restoration-hslkZdX5.js → scroll-restoration-OVgiE4G9.js} +1 -1
  47. package/dist/public/assets/select-Bg0rWqco.js +1 -0
  48. package/dist/public/assets/selection-actions-D875GPFU.js +1 -0
  49. package/dist/public/assets/{session-order-B9wDgtkQ.js → session-order-f7QxTbVD.js} +1 -1
  50. package/dist/public/assets/{switch-CeNFnG6w.js → switch-DhNyUV8C.js} +1 -1
  51. package/dist/public/assets/use-ui-state-CHqXhyx4.js +1 -0
  52. package/dist/public/assets/{ws-CT7jDKHs.js → ws-CMPCIzY4.js} +1 -1
  53. package/dist/public/index.html +5 -4
  54. package/dist/pudl.js +305 -188
  55. package/package.json +1 -1
  56. package/dist/public/assets/App-DldUYF2U.js +0 -2
  57. package/dist/public/assets/Dashboard-Bjrw6phb.js +0 -1
  58. package/dist/public/assets/EditorTabClose-BunNsUEz.js +0 -1
  59. package/dist/public/assets/FindWidget-BSK2PIfO.js +0 -1
  60. package/dist/public/assets/NewProjectDialog-BCtrjbMj.js +0 -1
  61. package/dist/public/assets/PaneEditorBody-KksboOhO.js +0 -302
  62. package/dist/public/assets/PdfViewer-CfWAV5F2.js +0 -2
  63. package/dist/public/assets/SettingsDialog-LIv4FuS1.js +0 -8
  64. package/dist/public/assets/Workspace-GWsJrLJW.js +0 -20
  65. package/dist/public/assets/auth-B4b-NPwe.js +0 -64
  66. package/dist/public/assets/copy-DD43yC2P.js +0 -1
  67. package/dist/public/assets/dialog-Bnex_wlx.js +0 -1
  68. package/dist/public/assets/disclosure-BQ-uiP85.js +0 -1
  69. package/dist/public/assets/dist-Cg-J2BAP.js +0 -1
  70. package/dist/public/assets/dist-Rswij5M_.js +0 -1
  71. package/dist/public/assets/errors-C-GJcBJ-.js +0 -1
  72. package/dist/public/assets/es2015-CrC2hHeB.js +0 -41
  73. package/dist/public/assets/index-BxtQ6WUO.css +0 -2
  74. package/dist/public/assets/input-Dx89yXF4.js +0 -1
  75. package/dist/public/assets/media-refresh-store-WCjZVi4Y.js +0 -1
  76. package/dist/public/assets/notification-delivery-vK2Y-rON.js +0 -1
  77. package/dist/public/assets/preview-kind-CJ9RTgbs.js +0 -1
  78. package/dist/public/assets/protocol-support-Q_1mBit9.js +0 -1
  79. package/dist/public/assets/select-iSqC2X51.js +0 -1
  80. package/dist/public/assets/selection-actions-Cith0Z9x.js +0 -1
  81. package/dist/public/assets/use-ui-state-xScqhALU.js +0 -1
@@ -1 +0,0 @@
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{O as r}from"./auth-B4b-NPwe.js";import{A as i,M as a,P as o,_t as s}from"./protocol-support-Q_1mBit9.js";import{a as c,c as l,g as u,h as d,o as f,p,s as ee,u as m}from"./es2015-CrC2hHeB.js";import{c as h,n as g,o as _}from"./x-DCpy1q13.js";import{c as v,d as y,l as te,s as b,u as ne}from"./input-Dx89yXF4.js";import{i as x}from"./dist-BCwJL3w9.js";import{t as S}from"./createLucideIcon-DyMAgLa3.js";import{n as re,s as ie}from"./switch-CeNFnG6w.js";import{a as C,n as ae,o as w}from"./preview-kind-CJ9RTgbs.js";import{t as oe}from"./debounce-B9DrqirV.js";var T=e(t(),1),E=n(),[D,se]=d(`Tooltip`,[y]),O=y(),ce=`TooltipProvider`,le=700,k=`tooltip.open`,[ue,A]=D(ce),de=e=>{let{__scopeTooltip:t,delayDuration:n=le,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=T.useRef(!0),s=T.useRef(!1),c=T.useRef(0);return T.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,E.jsx)(ue,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:T.useCallback(()=>{r<=0||(window.clearTimeout(c.current),o.current=!1)},[r]),onClose:T.useCallback(()=>{r<=0||(window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r))},[r]),isPointerInTransitRef:s,onPointerInTransitChange:T.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})};de.displayName=ce;var j=`Tooltip`,[fe,M]=D(j),pe=e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:s}=e,u=A(j,e.__scopeTooltip),d=O(t),[f,p]=T.useState(null),ee=l(),m=T.useRef(0),h=o??u.disableHoverableContent,g=s??u.delayDuration,_=T.useRef(!1),[v,y]=c({prop:r,defaultProp:i??!1,onChange:e=>{e?(u.onOpen(),document.dispatchEvent(new CustomEvent(k))):u.onClose(),a?.(e)},caller:j}),te=T.useMemo(()=>v?_.current?`delayed-open`:`instant-open`:`closed`,[v]),b=T.useCallback(()=>{window.clearTimeout(m.current),m.current=0,_.current=!1,y(!0)},[y]),x=T.useCallback(()=>{window.clearTimeout(m.current),m.current=0,y(!1)},[y]),S=T.useCallback(()=>{window.clearTimeout(m.current),m.current=window.setTimeout(()=>{_.current=!0,y(!0),m.current=0},g)},[g,y]);return T.useEffect(()=>()=>{m.current&&=(window.clearTimeout(m.current),0)},[]),(0,E.jsx)(ne,{...d,children:(0,E.jsx)(fe,{scope:t,contentId:ee,open:v,stateAttribute:te,trigger:f,onTriggerChange:p,onTriggerEnter:T.useCallback(()=>{u.isOpenDelayedRef.current?S():b()},[u.isOpenDelayedRef,S,b]),onTriggerLeave:T.useCallback(()=>{h?x():(window.clearTimeout(m.current),m.current=0)},[x,h]),onOpen:b,onClose:x,disableHoverableContent:h,children:n})})};pe.displayName=j;var N=`TooltipTrigger`,me=T.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=M(N,n),a=A(N,n),o=O(n),s=h(t,T.useRef(null),i.onTriggerChange),c=T.useRef(!1),l=T.useRef(!1),d=T.useCallback(()=>c.current=!1,[]);return T.useEffect(()=>()=>document.removeEventListener(`pointerup`,d),[d]),(0,E.jsx)(b,{asChild:!0,...o,children:(0,E.jsx)(p.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:s,onPointerMove:u(e.onPointerMove,e=>{e.pointerType!==`touch`&&!l.current&&!a.isPointerInTransitRef.current&&(i.onTriggerEnter(),l.current=!0)}),onPointerLeave:u(e.onPointerLeave,()=>{i.onTriggerLeave(),l.current=!1}),onPointerDown:u(e.onPointerDown,()=>{i.open&&i.onClose(),c.current=!0,document.addEventListener(`pointerup`,d,{once:!0})}),onFocus:u(e.onFocus,()=>{c.current||i.onOpen()}),onBlur:u(e.onBlur,i.onClose),onClick:u(e.onClick,i.onClose)})})});me.displayName=N;var P=`TooltipPortal`,[he,ge]=D(P,{forceMount:void 0}),_e=e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=M(P,t);return(0,E.jsx)(he,{scope:t,forceMount:n,children:(0,E.jsx)(f,{present:n||a.open,children:(0,E.jsx)(ee,{asChild:!0,container:i,children:r})})})};_e.displayName=P;var F=`TooltipContent`,ve=T.forwardRef((e,t)=>{let n=ge(F,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=M(F,e.__scopeTooltip);return(0,E.jsx)(f,{present:r||o.open,children:o.disableHoverableContent?(0,E.jsx)(Ce,{side:i,...a,ref:t}):(0,E.jsx)(ye,{side:i,...a,ref:t})})}),ye=T.forwardRef((e,t)=>{let n=M(F,e.__scopeTooltip),r=A(F,e.__scopeTooltip),i=T.useRef(null),a=h(t,i),[o,s]=T.useState(null),{trigger:c,onClose:l}=n,u=i.current,{onPointerInTransitChange:d}=r,f=T.useCallback(()=>{s(null),d(!1)},[d]),p=T.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=De(r,Ee(r,n.getBoundingClientRect())),a=Oe(t.getBoundingClientRect()),o=Ae([...i,...a]);s(o),d(!0)},[d]);return T.useEffect(()=>()=>f(),[f]),T.useEffect(()=>{if(c&&u){let e=e=>p(e,u),t=e=>p(e,c);return c.addEventListener(`pointerleave`,e),u.addEventListener(`pointerleave`,t),()=>{c.removeEventListener(`pointerleave`,e),u.removeEventListener(`pointerleave`,t)}}},[c,u,p,f]),T.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=!ke(n,o);r?f():i&&(f(),l())};return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[c,u,o,l,f]),(0,E.jsx)(Ce,{...e,ref:a})}),[be,xe]=D(j,{isInside:!1}),Se=_(`TooltipContent`),Ce=T.forwardRef((e,t)=>{let{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:a,onPointerDownOutside:o,...s}=e,c=M(F,n),l=O(n),{onClose:u}=c;return T.useEffect(()=>(document.addEventListener(k,u),()=>document.removeEventListener(k,u)),[u]),T.useEffect(()=>{if(c.trigger){let e=e=>{e.target instanceof Node&&e.target.contains(c.trigger)&&u()};return window.addEventListener(`scroll`,e,{capture:!0}),()=>window.removeEventListener(`scroll`,e,{capture:!0})}},[c.trigger,u]),(0,E.jsx)(m,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:u,children:(0,E.jsxs)(te,{"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,E.jsx)(Se,{children:r}),(0,E.jsx)(be,{scope:n,isInside:!0,children:(0,E.jsx)(x,{id:c.contentId,role:`tooltip`,children:i||r})})]})})});ve.displayName=F;var we=`TooltipArrow`,Te=T.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=O(n);return xe(we,n).isInside?null:(0,E.jsx)(v,{...i,...r,ref:t})});Te.displayName=we;function Ee(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 De(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 Oe(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 ke(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 Ae(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)),je(t)}function je(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 Me=de,Ne=pe,Pe=me,Fe=_e,Ie=ve,Le=Me,Re=Ne,ze=Pe;function Be({className:e,sideOffset:t=4,...n}){return(0,E.jsx)(Fe,{children:(0,E.jsx)(Ie,{sideOffset:t,className:g(`z-50 overflow-hidden rounded-md bg-elevated px-2 py-1 text-xs text-fg shadow-lg`,e),...n})})}var Ve=S(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]);function He({initial:e,maxLength:t,className:n,onCommit:r,onCancel:i}){let[a,o]=(0,T.useState)(e);return(0,E.jsx)(`input`,{autoFocus:!0,value:a,maxLength:t,onFocus:e=>e.currentTarget.select(),onChange:e=>o(e.target.value),onBlur:()=>r(a),onKeyDown:e=>{e.stopPropagation(),e.key===`Enter`?r(a):e.key===`Escape`&&i()},className:g(`bg-transparent outline-none`,n)})}function Ue(e){return{onClick:e=>{e.detail===2&&e.preventDefault()},onDoubleClick:t=>{t.preventDefault(),e()}}}var I=null;function We(e){return I=e,()=>{I===e&&(I=null)}}function Ge(){I?.()}var L=null;function Ke(e){return L=e,()=>{L===e&&(L=null)}}async function qe(e){if(!L)throw Error(`Open a project before opening a path.`);await L(e)}function Je(){let e=s(i()??void 0).data?.tabTitleTemplate;return(0,T.useCallback)(t=>re(t,e),[e])}var Ye=(0,T.createContext)({open:()=>void 0,handler:null,setHandler:()=>void 0});function Xe({children:e}){let[t,n]=(0,T.useState)(null),r=(0,T.useCallback)(e=>n(()=>e),[]),i=(0,T.useCallback)(e=>t?.(e),[t]),a=(0,T.useMemo)(()=>({open:i,handler:t,setHandler:r}),[i,t,r]);return(0,E.jsx)(Ye.Provider,{value:a,children:e})}function Ze(){return(0,T.useContext)(Ye)}function Qe({className:e,strokeScale:t=1}){return(0,E.jsxs)(`svg`,{viewBox:`0 0 24 24`,className:e,fill:`none`,stroke:`currentColor`,strokeWidth:1.8*t,strokeLinecap:`round`,"aria-hidden":!0,children:[(0,E.jsx)(`line`,{x1:`12`,y1:`12`,x2:`22`,y2:`12`}),(0,E.jsx)(`line`,{x1:`12`,y1:`12`,x2:`17`,y2:`20.66`}),(0,E.jsx)(`line`,{x1:`12`,y1:`12`,x2:`7`,y2:`20.66`}),(0,E.jsx)(`line`,{x1:`12`,y1:`12`,x2:`2`,y2:`12`}),(0,E.jsx)(`line`,{x1:`12`,y1:`12`,x2:`7`,y2:`3.34`}),(0,E.jsx)(`line`,{x1:`12`,y1:`12`,x2:`17`,y2:`3.34`}),(0,E.jsx)(`line`,{x1:`12`,y1:`12`,x2:`17.63`,y2:`15.25`}),(0,E.jsx)(`line`,{x1:`12`,y1:`12`,x2:`12`,y2:`18.5`}),(0,E.jsx)(`line`,{x1:`12`,y1:`12`,x2:`6.37`,y2:`15.25`}),(0,E.jsx)(`line`,{x1:`12`,y1:`12`,x2:`6.37`,y2:`8.75`}),(0,E.jsx)(`line`,{x1:`12`,y1:`12`,x2:`12`,y2:`5.5`}),(0,E.jsx)(`line`,{x1:`12`,y1:`12`,x2:`17.63`,y2:`8.75`})]})}function $e({className:e,strokeScale:t=1}){return(0,E.jsxs)(`svg`,{viewBox:`0 0 24 24`,className:e,fill:`none`,stroke:`currentColor`,strokeWidth:1.6*t,"aria-hidden":!0,children:[(0,E.jsx)(`ellipse`,{cx:`12`,cy:`12`,rx:`4`,ry:`9`}),(0,E.jsx)(`ellipse`,{cx:`12`,cy:`12`,rx:`4`,ry:`9`,transform:`rotate(60 12 12)`}),(0,E.jsx)(`ellipse`,{cx:`12`,cy:`12`,rx:`4`,ry:`9`,transform:`rotate(120 12 12)`})]})}function et({className:e,strokeScale:t=1}){return(0,E.jsxs)(`svg`,{viewBox:`0 0 24 24`,className:e,fill:`none`,stroke:`currentColor`,strokeWidth:1.8*t,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":!0,children:[(0,E.jsx)(`path`,{d:`M8 4H4v16h4`}),(0,E.jsx)(`path`,{d:`M16 4h4v16h-4`}),(0,E.jsx)(`rect`,{x:`10.5`,y:`10.5`,width:`3`,height:`3`,fill:`currentColor`,stroke:`none`})]})}function tt({className:e}){return(0,E.jsx)(`svg`,{viewBox:`0 0 24 24`,className:e,fill:`currentColor`,"aria-hidden":!0,children:(0,E.jsx)(`path`,{d:`M12 1.5c0 5.8 4.7 10.5 10.5 10.5C16.7 12 12 16.7 12 22.5 12 16.7 7.3 12 1.5 12 7.3 12 12 7.3 12 1.5Z`})})}function nt({type:e,className:t,strokeScale:n=1}){switch(e){case`claude-code`:return(0,E.jsx)(Qe,{className:t,strokeScale:n});case`codex`:return(0,E.jsx)($e,{className:t,strokeScale:n});case`opencode`:return(0,E.jsx)(et,{className:t,strokeScale:n});case`gemini-cli`:return(0,E.jsx)(tt,{className:t});default:return(0,E.jsx)(ie,{className:t,strokeWidth:2*n})}}var R=new Set,z=!1,rt=null;function it(){for(let e of R)e()}function at(e){return R.add(e),()=>R.delete(e)}function ot(e){z!==e&&(z=e,it())}function st(){ot(!z)}function ct(){return(0,T.useSyncExternalStore)(at,()=>z)}function lt(e){rt=e,it()}function ut(){return(0,T.useSyncExternalStore)(at,()=>rt)}function B(){return crypto.randomUUID()}function V(e){return e.type===`terminal`?`term:${e.session}`:`editor:${C(e.tab)}`}function H(e,t){return V(e)===V(t)}function dt(e){return e.type===`terminal`}function ft(e){return e.type===`editor`&&(e.tab.view===`linked`||e.tab.view===`locked`)}function U(e=[],t){let n=e.map(V),r=t&&n.includes(t)?t:n.length>0?n[0]:null;return{kind:`leaf`,id:B(),tabs:e,activeKey:r,previewKey:null}}function W(e,t,n){return{kind:`split`,id:B(),direction:e,children:t,sizes:n??t.map(()=>100/Math.max(1,t.length))}}function G(e,t){if(e.kind===`leaf`)return e.id===t?e:null;for(let n of e.children){let e=G(n,t);if(e)return e}return null}function K(e,t){if(e.kind===`leaf`)return e.tabs.some(e=>V(e)===t)?e:null;for(let n of e.children){let e=K(n,t);if(e)return e}return null}function q(e){return e.kind===`leaf`?[e]:e.children.flatMap(q)}function J(e){return q(e).flatMap(e=>e.tabs)}function pt(e){return e.kind===`leaf`?[e.id]:[e.id,...e.children.flatMap(pt)]}function mt(e){let t=pt(e);return new Set(t).size!==t.length}function ht(e){return e.kind===`leaf`?{...e,id:B()}:{...e,id:B(),children:e.children.map(ht)}}function gt(e){if(!mt(e))return e;let t=new Set,n=e=>{let r=t.has(e.id)?B():e.id;return t.add(r),e.kind===`leaf`?{...e,id:r}:{...e,id:r,children:e.children.map(n)}};return n(e)}function _t(e){let t=e.tabs.map(V),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 Y(e){if(e.kind===`leaf`)return _t(e);let t=e.children.map(Y),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?U([]):i.length===1?i[0]:{...e,children:i,sizes:a}}function X(e,t,n){return e.kind===`leaf`?e.id===t?n(e):e:{...e,children:e.children.map(e=>X(e,t,n))}}function vt(e,t,n){return X(e,t,e=>{if(!e.tabs.some(e=>V(e)===n))return e;let t=e.tabs.filter(e=>V(e)!==n),r=e.activeKey===n?yt(e,n):e.activeKey;return{...e,tabs:t,activeKey:r}})}function yt(e,t){let n=e.tabs.findIndex(e=>V(e)===t);if(n===-1)return e.activeKey;let r=e.tabs.filter(e=>V(e)!==t);return r.length===0?null:V(r[Math.min(n,r.length-1)])}function bt(e,t,n){let r=e.tabs.filter(e=>!H(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:V(t)}}function xt(e,t,n,r){let i=n===`left`||n===`right`?`row`:`col`,a=n===`left`||n===`top`;return Y(X(e,t,e=>{let t=U([r]);return W(i,a?[t,e]:[e,t],[50,50])}))}function St(e,t){let{ref:n,toLeafId:r,edge:i}=t,a=V(n),o=t.copy===!0&&!dt(n),s=t.index;if(i===`center`&&s!==void 0){let t=G(e,r)?.tabs.findIndex(e=>V(e)===a)??-1;t!==-1&&t<s&&--s}let c=o?e:vt(e,t.fromLeafId,a);if(i===`center`){let e=X(c,r,e=>bt(e,n,s));return!G(e,r)&&!K(e,a)?Z(Y(Ct(e,n)),a):Z(Y(e),a)}return G(c,r)?Z(xt(c,r,i,n),a):Y(U([n]))}function Ct(e,t){let n=q(e)[0];return n?X(e,n.id,e=>bt(e,t)):U([t])}function wt(e,t,n){return Y(X(e,t,e=>e.tabs.some(e=>V(e)===n)?{...e,tabs:e.tabs.filter(e=>V(e)!==n),activeKey:e.activeKey===n?yt(e,n):e.activeKey}:e))}function Tt(e,t,n){let r=V(n);return Y(X(e,t,e=>{let t=e.previewKey===r?null:e.previewKey;return e.tabs.some(e=>H(e,n))?{...e,activeKey:r,previewKey:t}:{...e,tabs:[...e.tabs,n],activeKey:r,previewKey:t}}))}function Et(e,t,n){let r=V(n);return Y(X(e,t,e=>e.tabs.some(e=>V(e)===r)?{...e,tabs:e.tabs.map(e=>V(e)===r?n:e),previewKey:e.previewKey===r?null:e.previewKey}:{...e,tabs:[...e.tabs,n]}))}function Dt(e,t,n){let r=V(n);return X(e,t,e=>({...e,tabs:e.tabs.map(e=>V(e)===r?n:e)}))}function Ot(e,t,n){let r=C(t),i=e=>e.kind===`split`?{...e,children:e.children.map(i)}:{...e,tabs:e.tabs.map(e=>e.type===`editor`&&C(e.tab)===r?{...e,tab:{...e.tab,compile_mode:n}}:e)};return i(e)}function kt(e,t){return e.type!==`editor`||t.type!==`editor`||e.tab.view!==`preview`||t.tab.view!==void 0||ae(t.tab.path)===null?t:{...t,tab:{...t.tab,view:`preview`}}}function At(e,t,n){let r=V(n);return Y(X(e,t,e=>{if(e.tabs.some(e=>H(e,n)))return{...e,activeKey:r};let t=e.previewKey?e.tabs.findIndex(t=>V(t)===e.previewKey):-1,i=t>=0?e.tabs[t]:void 0,a=i!==void 0&&!dt(i)&&!ft(i),o=a?kt(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 jt(e,t,n,r){return X(e,t,e=>{let t=e.tabs.findIndex(e=>e.type===`editor`&&V(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=V(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&&V(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 Mt(e,t){let n=w(e);return n!==`commit`&&n!==`untitled`&&e.session===t.session&&e.path===t.path&&e.root===t.root}function Nt(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`||!Mt(e.tab,t))return e;let r={...e,tab:{...e.tab,path:n}};return a.set(V(e),V(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 Pt(e){if(e.type!==`editor`)return null;let t=e.tab,n=w(t);return n!==`file`&&n!==`external`||t.view===`linked`||t.view===`locked`||ae(t.path)===null?null:t}function Ft(e,t){let n=Pt(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`||!ft(e))return e;let r=e.tab;return r.session===n.session&&r.path===n.path&&(r.root??``)===(n.root??``)&&w(r)===w(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 It(e,t){return e.session===t.session&&e.path===t.path&&(e.root??``)===(t.root??``)&&w(e)===w(t)}function Lt(e,t,n){let r=q(e).flatMap(e=>e.tabs.flatMap(n=>n.type!==`editor`||n.tab.view===`linked`||n.tab.view===`locked`||!It(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 Rt(e,t,n){return X(e,t,e=>e.tabs.some(e=>V(e)===n)?{...e,activeKey:n}:e)}function zt(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 Bt(e){let t=e.type===`terminal`?e.session:e.tab.session;return t===`00000000-0000-0000-0000-000000000000`?null:t}function Vt(e){return t=>{let n=Bt(t);return n===null||e.has(n)}}function Q(e,t){let n=e=>e.kind===`leaf`?{...e,tabs:e.tabs.filter(t)}:{...e,children:e.children.map(n)};return Y(n(e))}function Ht(e){let t=new Set,n=[];for(let r of e){let e=Y(Q(r,e=>!t.has(V(e)))),i=J(e);if(i.length!==0){for(let e of i)t.add(V(e));n.push(e)}}return n.length===0?U([]):gt(n.length===1?n[0]:Y(W(`row`,n)))}function Ut(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?V({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 U([]);if(t.length===0)return U(n,i);if(n.length===0)return U(t,r);let a=e.layout,o=typeof a.editor==`number`?a.editor:40,s=typeof a.session==`number`?a.session:60;return Y(W(`col`,[U(t,r),U(n,i)],[o,s]))}function Wt(e){return JSON.stringify(Gt(e))}function Gt(e){return e===null?null:e.kind===`leaf`?e.tabs.length===0?null:{t:e.tabs.map(V)}:{d:e.direction,s:e.sizes.map(e=>Math.round(e*10)/10),c:e.children.map(Gt)}}var Kt=new Set,$=!1,qt=null;function Jt(){for(let e of Kt)e()}function Yt(e){return Kt.add(e),()=>Kt.delete(e)}function Xt(e){$!==e&&($=e,Jt())}function Zt(){Xt(!$)}function Qt(){return(0,T.useSyncExternalStore)(Yt,()=>$)}function $t(e){qt=e,Jt()}function en(){return(0,T.useSyncExternalStore)(Yt,()=>qt)}var tn={layout_tree:null,active_session:null,layout_ref:null};function nn(e){return e.type===`terminal`?e.session:e.tab.session}function rn(e,t){let n=new Set;for(let[r,i]of Object.entries(e))if(!(r===t||!i.layout_tree))for(let e of J(i.layout_tree))e.type===`terminal`&&n.add(e.session);return[...n]}function an(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 on(e,t,n){return n?{loaded:e.loaded,snapshot:an(e.snapshot,t),current:()=>an(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]??tn,...r}}}Object.keys(i).length>0&&e.update(i)}}:e}function sn(e,t,n,r){let i=e.layout_tree??Ut(e),a={};for(let o of t)a[o]={layout_tree:ht(Q(i,e=>{let i=nn(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 cn(e,t,n={}){return{...e,...t,...n}}function ln(e,t,n){let r=t.layout_tree?Q(t.layout_tree,e=>{let t=nn(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=sn(e,n.projectIds,n.sessionProject,a);return{projectBased:!0,patch:{...s,project_layouts:cn(s.project_layouts??{},e.project_layouts,{[a]:o})}}}function un(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:Ht(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}}var dn=2e3,fn=r.parse({});function pn(e){return`puddle.ws.${e}`}function mn(e){if(e===null)return{kind:`absent`};try{return{kind:`present`,snapshot:r.parse(JSON.parse(e))}}catch{return{kind:`corrupt`}}}function hn(){let e=i(),[t,n]=(0,T.useState)(!1),[r,s]=(0,T.useState)(fn),c=(0,T.useRef)(r);c.current=r;let l=(0,T.useRef)(null),u=(0,T.useMemo)(()=>oe((e,t)=>{o(e,t).catch(e=>console.warn(`ui-state save failed: ${e.message}`))},dn),[]);return(0,T.useEffect)(()=>{if(e===null){l.current=null;return}let t=pn(e);l.current=t;let r=!1;n(!1),s(fn);let i;try{i=mn(sessionStorage.getItem(t)),i.kind===`corrupt`&&sessionStorage.removeItem(t)}catch(e){console.warn(`ui-state read failed: ${e.message}`),i={kind:`absent`}}return i.kind===`present`?(s(i.snapshot),n(!0)):a(e).then(e=>{r||(e&&s(e.ui_state),n(!0))}).catch(e=>{console.warn(`ui-state load failed: ${e.message}`),r||n(!0)}),()=>{r=!0,u.flush()}},[e,u]),{loaded:t,snapshot:r,current:()=>c.current,update(t){if(e===null)return;let n={...c.current,...t};c.current=n,s(n);let r=l.current??pn(e);u(e,n);try{sessionStorage.setItem(r,JSON.stringify(n))}catch(e){console.warn(`ui-state write failed: ${e.message}`)}}}}export{We as $,At as A,Dt as B,St as C,K as D,Rt as E,Ft as F,ct as G,ot as H,Ot as I,Ze as J,nt as K,jt as L,Q as M,Nt as N,Pt as O,zt as P,Ge as Q,Lt as R,gt as S,J as T,st as U,lt as V,ut as W,qe as X,Je as Y,Ke as Z,Tt as _,cn as a,Le as at,Ut as b,sn as c,Xt as d,He as et,Zt as f,Et as g,Wt as h,ln as i,Be as it,Z as j,U as k,un as l,Qt as m,hn as n,Ve as nt,rn as o,ze as ot,en as p,Xe as q,pn as r,Re as rt,on as s,mn as t,Ue as tt,$t as u,q as v,G as w,wt as x,Vt as y,V as z};