@puddle-code/cli 0.4.15 → 0.4.17
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 +33 -2
- package/dist/index.js +5 -3
- package/dist/public/assets/App-ZtJSRE8n.js +40 -0
- package/dist/public/assets/CompilationCommandForm-BGIgFAkM.js +1 -0
- package/dist/public/assets/Dashboard-B_m3VKHu.js +1 -0
- package/dist/public/assets/EditorTabClose-CNB0NsZQ.js +1 -0
- package/dist/public/assets/FileEditorSettingsMenu-JUB6GRyp.js +1 -0
- package/dist/public/assets/FindWidget-ET5pwkkB.js +1 -0
- package/dist/public/assets/LazyTerminal-SbouF2Y_.js +2 -0
- package/dist/public/assets/{ModelRefcount-BeuZdwWp.js → ModelRefcount-Bbr8zY_6.js} +1 -1
- package/dist/public/assets/{NotebookWidget-CH5zoEVV.js → NotebookWidget-9z2Xca7D.js} +1 -1
- package/dist/public/assets/{PaneEditorBody-DESTR4r3.js → PaneEditorBody-nc1Z681y.js} +10 -10
- package/dist/public/assets/{PdfViewer-BH-FXEVV.js → PdfViewer-FWSPsqTc.js} +1 -1
- package/dist/public/assets/{ReleaseNotesDialog-jEU0I1rq.js → ReleaseNotesDialog-sQVKJ6dm.js} +1 -1
- package/dist/public/assets/Ripple-B2KIWnc_.js +11 -0
- package/dist/public/assets/Ripple-DYosRAZ1.css +1 -0
- package/dist/public/assets/SettingsDialog-DKnJSEij.js +8 -0
- package/dist/public/assets/{Terminal-Gq862tY-.js → Terminal-B2FWGxlE.js} +6 -6
- package/dist/public/assets/Workspace-CiATCR9s.css +1 -0
- package/dist/public/assets/Workspace-DUBYqpNS.js +20 -0
- package/dist/public/assets/api-BwP0jv_V.js +1 -0
- package/dist/public/assets/{archive-i9DnVa-v.js → archive-BYp06n6i.js} +1 -1
- package/dist/public/assets/auth-DYEjEl0U.js +64 -0
- package/dist/public/assets/buffer-store-fV6iYuCU.js +1 -0
- package/dist/public/assets/button-D-qeQvl5.js +1 -0
- package/dist/public/assets/{chevron-down-HQLVE6o5.js → chevron-down--sjpQEHH.js} +1 -1
- package/dist/public/assets/chevron-right-DUkOv15w.js +1 -0
- package/dist/public/assets/code-DRWf9a5s.js +1 -0
- package/dist/public/assets/command-BeX8pm7h.js +1 -0
- package/dist/public/assets/context-B6lkZJoM.js +1 -0
- package/dist/public/assets/control-tray-CjoJunx1.js +1 -0
- package/dist/public/assets/{copy-D0Theg4Q.js → copy-CGsu8426.js} +1 -1
- package/dist/public/assets/createLucideIcon-DyMAgLa3.js +1 -0
- package/dist/public/assets/dialog-CTN-Lln6.js +41 -0
- package/dist/public/assets/dist-BcrNV8NP.js +1 -0
- package/dist/public/assets/dist-NuV8HBEc.js +1 -0
- package/dist/public/assets/dist-cvE69gWt.js +1 -0
- package/dist/public/assets/{errors-efDAjyqa.js → errors-CD96hLph.js} +1 -1
- package/dist/public/assets/expanding-content-UT_6Fp5v.js +1 -0
- package/dist/public/assets/file-editor-settings-CzybzK8S.js +1 -0
- package/dist/public/assets/file-links-BWU9Vnfc.js +1 -0
- package/dist/public/assets/{forward-link-BfAPpjGN.js → forward-link-CkdngF7C.js} +1 -1
- package/dist/public/assets/index-DtbUW4I4.css +2 -0
- package/dist/public/assets/{index-Cg9SFK_d.js → index-ncmnNFLA.js} +3 -3
- package/dist/public/assets/languages-MEV5hj_8.js +16 -0
- package/dist/public/assets/local-store-yUq3FKdV.js +1 -0
- package/dist/public/assets/media-refresh-store-Dxq65ATq.js +1 -0
- package/dist/public/assets/notification-delivery-NbIhmidu.js +1 -0
- package/dist/public/assets/popover-Okyclsx8.js +1 -0
- package/dist/public/assets/preferences-BX4iJsv8.js +1 -0
- package/dist/public/assets/preview-kind-CJ9RTgbs.js +1 -0
- package/dist/public/assets/profile-store-B54YLXa8.js +1 -0
- package/dist/public/assets/{protocol-support-BwRR1kRO.js → protocol-support-sBpa8MZK.js} +1 -1
- package/dist/public/assets/render-rich-content-BoTeqQfi.css +1 -0
- package/dist/public/assets/render-rich-content-cSjuhT75.js +4 -0
- package/dist/public/assets/{rotate-ccw-BI2k_h3A.js → rotate-ccw-CNjR2LSi.js} +1 -1
- package/dist/public/assets/{scroll-restoration-wdDB8mmu.js → scroll-restoration-D-jpZqdR.js} +1 -1
- package/dist/public/assets/search-Ct_rLLa4.js +1 -0
- package/dist/public/assets/select-CCBPniW9.js +1 -0
- package/dist/public/assets/selection-actions-C33evFaY.js +1 -0
- package/dist/public/assets/session-order-DilOGTOO.js +1 -0
- package/dist/public/assets/settings-2-CInoy48z.js +1 -0
- package/dist/public/assets/switch-B3zcD6GH.js +1 -0
- package/dist/public/assets/trash-2-DQeNROsF.js +1 -0
- package/dist/public/assets/use-ui-state-BLOunpIh.js +1 -0
- package/dist/public/assets/utils-B6KiDbIe.js +1 -0
- package/dist/public/assets/view-state-store-BLCtem0t.js +1 -0
- package/dist/public/assets/{whole-word-BJjKpISQ.js → whole-word-2m2pmAFT.js} +1 -1
- package/dist/public/assets/ws-DkbvXbTZ.js +1 -0
- package/dist/public/assets/x-CbfJFzGo.js +1 -0
- package/dist/public/index.html +4 -3
- package/package.json +1 -1
- package/dist/public/assets/App-Dlrlhlup.js +0 -9
- package/dist/public/assets/CompilationCommandForm-DQjUhaHj.js +0 -1
- package/dist/public/assets/Dashboard-B2o7orBK.js +0 -1
- package/dist/public/assets/EditorTabClose-CQnXn4Ha.js +0 -1
- package/dist/public/assets/FindWidget-Bh_7yWNg.js +0 -1
- package/dist/public/assets/LazyTerminal-D4QV7VEc.js +0 -2
- package/dist/public/assets/Ripple-BM7RYwkx.css +0 -1
- package/dist/public/assets/Ripple-DxqgViCr.js +0 -12
- package/dist/public/assets/SettingsDialog-BcWnMD7A.js +0 -8
- package/dist/public/assets/Workspace-CuAYZ1-B.css +0 -1
- package/dist/public/assets/Workspace-DVji-hSU.js +0 -20
- package/dist/public/assets/api-CULxlzTe.js +0 -1
- package/dist/public/assets/arrow-down-CtYa-Aya.js +0 -1
- package/dist/public/assets/auth-C3ruG3fE.js +0 -64
- package/dist/public/assets/buffer-store-Bh2IilxW.js +0 -16
- package/dist/public/assets/button-DtByPSFL.js +0 -1
- package/dist/public/assets/code-Cf4ftdOa.js +0 -1
- package/dist/public/assets/command--8Svn0Z-.js +0 -1
- package/dist/public/assets/context-D1MuDP6X.js +0 -1
- package/dist/public/assets/control-tray-c9uXOo-i.js +0 -1
- package/dist/public/assets/createLucideIcon-C9A1vLE-.js +0 -1
- package/dist/public/assets/dialog-DtvE8ATK.js +0 -41
- package/dist/public/assets/dist-B8heQ9Kq.js +0 -1
- package/dist/public/assets/dist-BeQvHdsz.js +0 -1
- package/dist/public/assets/dist-DZg8Dwbr.js +0 -1
- package/dist/public/assets/dist-Dac0re_p.js +0 -1
- package/dist/public/assets/expanding-content-CKyt4o9s.js +0 -1
- package/dist/public/assets/index-D_XpA70m.css +0 -2
- package/dist/public/assets/media-refresh-store-CYiYB60R.js +0 -1
- package/dist/public/assets/notification-delivery-B-zt57w8.js +0 -1
- package/dist/public/assets/popover-D5HmbdQ7.js +0 -1
- package/dist/public/assets/preferences-xuDDL7Pm.js +0 -1
- package/dist/public/assets/preview-kind-CPkO-rSz.js +0 -1
- package/dist/public/assets/render-rich-content-DAJtX81B.js +0 -4
- package/dist/public/assets/select-CGxTz4dh.js +0 -1
- package/dist/public/assets/selection-actions-DMOj1EOB.js +0 -1
- package/dist/public/assets/session-order-iVRWTB-C.js +0 -1
- package/dist/public/assets/square-terminal-CIkfNq3I.js +0 -1
- package/dist/public/assets/switch-DYr-iPWY.js +0 -1
- package/dist/public/assets/use-ui-state-TZnzSo9V.js +0 -1
- package/dist/public/assets/view-state-store-DVvLMbeY.js +0 -1
- package/dist/public/assets/waves-horizontal-CLDJf7Dd.js +0 -1
- package/dist/public/assets/ws-DjQ6OZLM.js +0 -1
- package/dist/public/assets/x-DV6-RYI2.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"./react-dom-cJyBB_A4.js";import{t as r}from"./jsx-runtime-By8HlURe.js";import{n as i,t as a}from"./createLucideIcon-C9A1vLE-.js";import{C as o,E as s,S as c,T as l,_ as u,b as d,f,g as p,h as m,m as h,p as g,v as _,x as v,y}from"./dialog-DtvE8ATK.js";import{a as b,n as x}from"./dist-DZg8Dwbr.js";import{_ as S,b as C,c as w,d as T,f as E,g as D,n as O,t as k,u as A,v as j,y as ee}from"./dist-Dac0re_p.js";import{a as te,t as M}from"./dist-BeQvHdsz.js";import{t as N}from"./chevron-down-HQLVE6o5.js";var P=a(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),F=e(t(),1),I=e(n(),1);function L(e,[t,n]){return Math.min(n,Math.max(t,e))}var R=r(),z=[` `,`Enter`,`ArrowUp`,`ArrowDown`],B=[` `,`Enter`],V=`Select`,[H,U,ne]=O(V),[W,re]=l(V,[ne,C]),G=C(),[ie,K]=W(V),[ae,oe]=W(V),se=`SelectProvider`;function ce(e){let{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:a,value:o,defaultValue:s,onValueChange:c,dir:l,name:u,autoComplete:d,disabled:f,required:m,form:h,internal_do_not_use_render:g}=e,_=G(t),[v,b]=F.useState(null),[x,S]=F.useState(null),[C,w]=F.useState(!1),T=k(l),[E,D]=p({prop:r,defaultProp:i??!1,onChange:a,caller:V}),[O,A]=p({prop:o,defaultProp:s,onChange:c,caller:V}),j=F.useRef(null),te=F.useRef(O);F.useEffect(()=>{let e=h?v?.ownerDocument.getElementById(h):v?.form;if(e instanceof HTMLFormElement){let t=()=>A(te.current);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[h,v,A]);let M=!v||!!h||!!v.closest(`form`),[N,P]=F.useState(new Set),I=y(),L=Array.from(N).map(e=>e.props.value).join(`;`),z=F.useCallback(e=>{P(t=>new Set(t).add(e))},[]),B=F.useCallback(e=>{P(t=>{let n=new Set(t);return n.delete(e),n})},[]),U={required:m,trigger:v,onTriggerChange:b,valueNode:x,onValueNodeChange:S,valueNodeHasChildren:C,onValueNodeHasChildrenChange:w,contentId:I,value:O,onValueChange:A,open:E,onOpenChange:D,dir:T,triggerPointerDownPosRef:j,disabled:f,name:u,autoComplete:d,form:h,nativeOptions:N,nativeSelectKey:L,isFormControl:M};return(0,R.jsx)(ee,{..._,children:(0,R.jsx)(ie,{scope:t,...U,children:(0,R.jsx)(H.Provider,{scope:t,children:(0,R.jsx)(ae,{scope:t,onNativeOptionAdd:z,onNativeOptionRemove:B,children:nt(g)?g(U):n})})})})}ce.displayName=se;var le=e=>{let{__scopeSelect:t,children:n,...r}=e;return(0,R.jsx)(ce,{__scopeSelect:t,...r,internal_do_not_use_render:({isFormControl:e})=>(0,R.jsxs)(R.Fragment,{children:[n,e?(0,R.jsx)(tt,{__scopeSelect:t}):null]})})};le.displayName=V;var ue=`SelectTrigger`,de=F.forwardRef((e,t)=>{let{__scopeSelect:n,disabled:r=!1,...i}=e,a=G(n),c=K(ue,n),l=c.disabled||r,u=b(t,c.onTriggerChange),d=U(n),f=F.useRef(`touch`),[p,m,h]=rt(e=>{let t=d().filter(e=>!e.disabled),n=it(t,e,t.find(e=>e.value===c.value));n!==void 0&&c.onValueChange(n.value)}),g=e=>{l||(c.onOpenChange(!0),h()),e&&(c.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return(0,R.jsx)(D,{asChild:!0,...a,children:(0,R.jsx)(o.button,{type:`button`,role:`combobox`,"aria-controls":c.open?c.contentId:void 0,"aria-expanded":c.open,"aria-required":c.required,"aria-autocomplete":`none`,dir:c.dir,"data-state":c.open?`open`:`closed`,disabled:l,"data-disabled":l?``:void 0,"data-placeholder":$(c.value)?``:void 0,...i,ref:u,onClick:s(i.onClick,e=>{e.currentTarget.focus(),f.current!==`mouse`&&g(e)}),onPointerDown:s(i.onPointerDown,e=>{f.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&e.pointerType===`mouse`&&(g(e),e.preventDefault())}),onKeyDown:s(i.onKeyDown,e=>{let t=p.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&m(e.key),!(t&&e.key===` `)&&z.includes(e.key)&&(g(),e.preventDefault())})})})});de.displayName=ue;var fe=`SelectValue`,pe=F.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,children:a,placeholder:s=``,...c}=e,l=K(fe,n),{onValueNodeHasChildrenChange:u}=l,f=a!==void 0,p=b(t,l.onValueNodeChange);d(()=>{u(f)},[u,f]);let m=$(l.value);return(0,R.jsx)(o.span,{...c,asChild:!m&&c.asChild,ref:p,style:{pointerEvents:`none`},children:(0,R.jsx)(F.Fragment,{children:m?s:a},m?`placeholder`:`value`)})});pe.displayName=fe;var me=`SelectIcon`,he=F.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,...i}=e;return(0,R.jsx)(o.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})});he.displayName=me;var ge=`SelectPortal`,[_e,ve]=W(ge,{forceMount:void 0}),ye=e=>{let{__scopeSelect:t,forceMount:n,...r}=e;return(0,R.jsx)(_e,{scope:e.__scopeSelect,forceMount:n,children:(0,R.jsx)(_,{asChild:!0,...r})})};ye.displayName=ge;var q=`SelectContent`,be=F.forwardRef((e,t)=>{let n=ve(q,e.__scopeSelect),{forceMount:r=n.forceMount,...i}=e,a=K(q,e.__scopeSelect),[o,s]=F.useState();return d(()=>{s(new DocumentFragment)},[]),(0,R.jsx)(u,{present:r||a.open,children:({present:e})=>e?(0,R.jsx)(Te,{...i,ref:t}):(0,R.jsx)(xe,{...i,fragment:o})})});be.displayName=q;var xe=F.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,fragment:i}=e;return i?I.createPortal((0,R.jsx)(Se,{scope:n,children:(0,R.jsx)(H.Slot,{scope:n,children:(0,R.jsx)(`div`,{ref:t,children:r})})}),i):null});xe.displayName=`SelectContentFragment`;var J=10,[Se,Y]=W(q),Ce=`SelectContentImpl`,we=x(`SelectContent.RemoveScroll`),Te=F.forwardRef((e,t)=>{let{__scopeSelect:n}=e,{position:r=`item-aligned`,onCloseAutoFocus:i,onEscapeKeyDown:a,onPointerDownOutside:o,side:c,sideOffset:l,align:u,alignOffset:d,arrowPadding:p,collisionBoundary:_,collisionPadding:y,sticky:x,hideWhenDetached:S,avoidCollisions:C,...w}=e,T=K(q,n),[E,D]=F.useState(null),[O,k]=F.useState(null),A=b(t,D),[j,ee]=F.useState(null),[te,M]=F.useState(null),N=U(n),[P,I]=F.useState(!1),L=F.useRef(!1);F.useEffect(()=>{if(E)return g(E)},[E]),m();let z=F.useCallback(e=>{let[t,...n]=N().map(e=>e.ref.current),[r]=n.slice(-1),i=document.activeElement;for(let n of e)if(n===i||(n?.scrollIntoView({block:`nearest`}),n===t&&O&&(O.scrollTop=0),n===r&&O&&(O.scrollTop=O.scrollHeight),n?.focus(),document.activeElement!==i))return},[N,O]),B=F.useCallback(()=>z([j,E]),[z,j,E]);F.useEffect(()=>{P&&B()},[P,B]);let{onOpenChange:V,triggerPointerDownPosRef:H}=T;F.useEffect(()=>{if(E){let e={x:0,y:0},t=t=>{e={x:Math.abs(Math.round(t.pageX)-(H.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(H.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():n.composedPath().includes(E)||V(!1),document.removeEventListener(`pointermove`,t),H.current=null};return H.current!==null&&(document.addEventListener(`pointermove`,t),document.addEventListener(`pointerup`,n,{capture:!0,once:!0})),()=>{document.removeEventListener(`pointermove`,t),document.removeEventListener(`pointerup`,n,{capture:!0})}}},[E,V,H]),F.useEffect(()=>{let e=()=>V(!1);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[V]);let[ne,W]=rt(e=>{let t=N().filter(e=>!e.disabled),n=it(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current?.focus())}),re=F.useCallback((e,t,n)=>{let r=!L.current&&!n;(T.value!==void 0&&T.value===t||r)&&(ee(e),r&&(L.current=!0))},[T.value]),G=F.useCallback(()=>E?.focus(),[E]),ie=F.useCallback((e,t,n)=>{let r=!L.current&&!n;(T.value!==void 0&&T.value===t||r)&&M(e)},[T.value]),ae=r===`popper`?X:De,oe=ae===X?{side:c,sideOffset:l,align:u,alignOffset:d,arrowPadding:p,collisionBoundary:_,collisionPadding:y,sticky:x,hideWhenDetached:S,avoidCollisions:C}:{};return(0,R.jsx)(Se,{scope:n,content:E,viewport:O,onViewportChange:k,itemRefCallback:re,selectedItem:j,onItemLeave:G,itemTextRefCallback:ie,focusSelectedItem:B,selectedItemText:te,position:r,isPositioned:P,searchRef:ne,children:(0,R.jsx)(f,{as:we,allowPinchZoom:!0,children:(0,R.jsx)(h,{asChild:!0,trapped:T.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:s(i,e=>{T.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,R.jsx)(v,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>T.onOpenChange(!1),children:(0,R.jsx)(ae,{role:`listbox`,id:T.contentId,"data-state":T.open?`open`:`closed`,dir:T.dir,onContextMenu:e=>e.preventDefault(),...w,...oe,onPlaced:()=>I(!0),ref:A,style:{display:`flex`,flexDirection:`column`,outline:`none`,...w.style},onKeyDown:s(w.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&W(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=N().filter(e=>!e.disabled).map(e=>e.ref.current);if([`ArrowUp`,`End`].includes(e.key)&&(t=t.slice().reverse()),[`ArrowUp`,`ArrowDown`].includes(e.key)){let n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>z(t)),e.preventDefault()}})})})})})})});Te.displayName=Ce;var Ee=`SelectItemAlignedPosition`,De=F.forwardRef((e,t)=>{let{__scopeSelect:n,onPlaced:r,...i}=e,a=K(q,n),s=Y(q,n),[c,l]=F.useState(null),[u,f]=F.useState(null),p=b(t,f),m=U(n),h=F.useRef(!1),g=F.useRef(!0),{viewport:_,selectedItem:v,selectedItemText:y,focusSelectedItem:x}=s,S=F.useCallback(()=>{if(a.trigger&&a.valueNode&&c&&u&&_&&v&&y){let e=a.trigger.getBoundingClientRect(),t=u.getBoundingClientRect(),n=a.valueNode.getBoundingClientRect(),i=y.getBoundingClientRect();if(a.dir!==`rtl`){let r=i.left-t.left,a=n.left-r,o=e.left-a,s=e.width+o,l=Math.max(s,t.width),u=window.innerWidth-J,d=L(a,[J,Math.max(J,u-l)]);c.style.minWidth=s+`px`,c.style.left=d+`px`}else{let r=t.right-i.right,a=window.innerWidth-n.right-r,o=window.innerWidth-e.right-a,s=e.width+o,l=Math.max(s,t.width),u=window.innerWidth-J,d=L(a,[J,Math.max(J,u-l)]);c.style.minWidth=s+`px`,c.style.right=d+`px`}let o=m(),s=window.innerHeight-J*2,l=_.scrollHeight,d=window.getComputedStyle(u),f=parseInt(d.borderTopWidth,10),p=parseInt(d.paddingTop,10),g=parseInt(d.borderBottomWidth,10),b=parseInt(d.paddingBottom,10),x=f+p+l+b+g,S=Math.min(v.offsetHeight*5,x),C=window.getComputedStyle(_),w=parseInt(C.paddingTop,10),T=parseInt(C.paddingBottom,10),E=e.top+e.height/2-J,D=s-E,O=v.offsetHeight/2,k=v.offsetTop+O,A=f+p+k,j=x-A;if(A<=E){let e=o.length>0&&v===o[o.length-1].ref.current;c.style.bottom=`0px`;let t=u.clientHeight-_.offsetTop-_.offsetHeight,n=A+Math.max(D,O+(e?T:0)+t+g);c.style.height=n+`px`}else{let e=o.length>0&&v===o[0].ref.current;c.style.top=`0px`;let t=Math.max(E,f+_.offsetTop+(e?w:0)+O)+j;c.style.height=t+`px`,_.scrollTop=A-E+_.offsetTop}c.style.margin=`${J}px 0`,c.style.minHeight=S+`px`,c.style.maxHeight=s+`px`,r?.(),requestAnimationFrame(()=>h.current=!0)}},[m,a.trigger,a.valueNode,c,u,_,v,y,a.dir,r]);d(()=>S(),[S]);let[C,w]=F.useState();return d(()=>{u&&w(window.getComputedStyle(u).zIndex)},[u]),(0,R.jsx)(ke,{scope:n,contentWrapper:c,shouldExpandOnScrollRef:h,onScrollButtonChange:F.useCallback(e=>{e&&g.current===!0&&(S(),x?.(),g.current=!1)},[S,x]),children:(0,R.jsx)(`div`,{ref:l,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:C},children:(0,R.jsx)(o.div,{...i,ref:p,style:{boxSizing:`border-box`,maxHeight:`100%`,...i.style}})})})});De.displayName=Ee;var Oe=`SelectPopperPosition`,X=F.forwardRef((e,t)=>{let{__scopeSelect:n,align:r=`start`,collisionPadding:i=J,...a}=e,o=G(n);return(0,R.jsx)(j,{...o,...a,ref:t,align:r,collisionPadding:i,style:{boxSizing:`border-box`,...a.style,"--radix-select-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-select-content-available-width":`var(--radix-popper-available-width)`,"--radix-select-content-available-height":`var(--radix-popper-available-height)`,"--radix-select-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-select-trigger-height":`var(--radix-popper-anchor-height)`}})});X.displayName=Oe;var[ke,Ae]=W(q,{}),je=`SelectViewport`,Me=F.forwardRef((e,t)=>{let{__scopeSelect:n,nonce:r,...i}=e,a=Y(je,n),c=Ae(je,n),l=b(t,a.onViewportChange),u=F.useRef(0);return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}`},nonce:r}),(0,R.jsx)(H.Slot,{scope:n,children:(0,R.jsx)(o.div,{"data-radix-select-viewport":``,role:`presentation`,...i,ref:l,style:{position:`relative`,flex:1,overflow:`hidden auto`,...i.style},onScroll:s(i.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=c;if(r?.current&&n){let e=Math.abs(u.current-t.scrollTop);if(e>0){let r=window.innerHeight-J*2,i=parseFloat(n.style.minHeight),a=parseFloat(n.style.height),o=Math.max(i,a);if(o<r){let i=o+e,a=Math.min(r,i),s=i-a;n.style.height=a+`px`,n.style.bottom===`0px`&&(t.scrollTop=s>0?s:0,n.style.justifyContent=`flex-end`)}}}u.current=t.scrollTop})})})]})});Me.displayName=je;var Ne=`SelectGroup`,[Pe,Fe]=W(Ne),Ie=F.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=y();return(0,R.jsx)(Pe,{scope:n,id:i,children:(0,R.jsx)(o.div,{role:`group`,"aria-labelledby":i,...r,ref:t})})});Ie.displayName=Ne;var Le=`SelectLabel`,Re=F.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=Fe(Le,n);return(0,R.jsx)(o.div,{id:i.id,...r,ref:t})});Re.displayName=Le;var Z=`SelectItem`,[ze,Be]=W(Z),Ve=F.forwardRef((e,t)=>{let{__scopeSelect:n,value:r,disabled:i=!1,textValue:a,...l}=e,u=K(Z,n),d=Y(Z,n),f=u.value===r,[p,m]=F.useState(a??``),[h,g]=F.useState(!1),_=b(t,c(e=>d.itemRefCallback?.(e,r,i))),v=y(),x=F.useRef(`touch`),S=()=>{i||(u.onValueChange(r),u.onOpenChange(!1))};return(0,R.jsx)(ze,{scope:n,value:r,disabled:i,textId:v,isSelected:f,onItemTextChange:F.useCallback(e=>{m(t=>t||(e?.textContent??``).trim())},[]),children:(0,R.jsx)(H.ItemSlot,{scope:n,value:r,disabled:i,textValue:p,children:(0,R.jsx)(o.div,{role:`option`,"aria-labelledby":v,"data-highlighted":h?``:void 0,"aria-selected":f&&h,"data-state":f?`checked`:`unchecked`,"aria-disabled":i||void 0,"data-disabled":i?``:void 0,tabIndex:i?void 0:-1,...l,ref:_,onFocus:s(l.onFocus,()=>g(!0)),onBlur:s(l.onBlur,()=>g(!1)),onClick:s(l.onClick,()=>{x.current!==`mouse`&&S()}),onPointerUp:s(l.onPointerUp,()=>{x.current===`mouse`&&S()}),onPointerDown:s(l.onPointerDown,e=>{x.current=e.pointerType}),onPointerMove:s(l.onPointerMove,e=>{x.current=e.pointerType,i?d.onItemLeave?.():x.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:s(l.onPointerLeave,e=>{e.currentTarget===document.activeElement&&d.onItemLeave?.()}),onKeyDown:s(l.onKeyDown,e=>{i||e.target!==e.currentTarget||d.searchRef?.current!==``&&e.key===` `||(B.includes(e.key)&&S(),e.key===` `&&e.preventDefault())})})})})});Ve.displayName=Z;var Q=`SelectItemText`,He=F.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,...a}=e,s=K(Q,n),l=Y(Q,n),u=Be(Q,n),f=oe(Q,n),[p,m]=F.useState(null),h=c(e=>l.itemTextRefCallback?.(e,u.value,u.disabled)),g=b(t,m,u.onItemTextChange,h),_=p?.textContent,v=F.useMemo(()=>(0,R.jsx)(`option`,{value:u.value,disabled:u.disabled,children:_},u.value),[u.disabled,u.value,_]),{onNativeOptionAdd:y,onNativeOptionRemove:x}=f;return d(()=>(y(v),()=>x(v)),[y,x,v]),(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(o.span,{id:u.textId,...a,ref:g}),u.isSelected&&s.valueNode&&!s.valueNodeHasChildren&&!$(s.value)?I.createPortal(a.children,s.valueNode):null]})});He.displayName=Q;var Ue=`SelectItemIndicator`,We=F.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return Be(Ue,n).isSelected?(0,R.jsx)(o.span,{"aria-hidden":!0,...r,ref:t}):null});We.displayName=Ue;var Ge=`SelectScrollUpButton`,Ke=F.forwardRef((e,t)=>{let n=Y(Ge,e.__scopeSelect),r=Ae(Ge,e.__scopeSelect),[i,a]=F.useState(!1),o=b(t,r.onScrollButtonChange);return d(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollTop>0;a(e)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,R.jsx)(Ye,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null});Ke.displayName=Ge;var qe=`SelectScrollDownButton`,Je=F.forwardRef((e,t)=>{let n=Y(qe,e.__scopeSelect),r=Ae(qe,e.__scopeSelect),[i,a]=F.useState(!1),o=b(t,r.onScrollButtonChange);return d(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight,n=Math.ceil(t.scrollTop)<e;a(n)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,R.jsx)(Ye,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null});Je.displayName=qe;var Ye=F.forwardRef((e,t)=>{let{__scopeSelect:n,onAutoScroll:r,...i}=e,a=Y(`SelectScrollButton`,n),c=F.useRef(null),l=U(n),u=F.useCallback(()=>{c.current!==null&&(window.clearInterval(c.current),c.current=null)},[]);return F.useEffect(()=>()=>u(),[u]),d(()=>{l().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[l]),(0,R.jsx)(o.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:s(i.onPointerDown,()=>{c.current===null&&(c.current=window.setInterval(r,50))}),onPointerMove:s(i.onPointerMove,()=>{a.onItemLeave?.(),c.current===null&&(c.current=window.setInterval(r,50))}),onPointerLeave:s(i.onPointerLeave,()=>{u()})})}),Xe=`SelectSeparator`,Ze=F.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return(0,R.jsx)(o.div,{"aria-hidden":!0,...r,ref:t})});Ze.displayName=Xe;var Qe=`SelectArrow`,$e=F.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=G(n);return Y(Qe,n).position===`popper`?(0,R.jsx)(S,{...i,...r,ref:t}):null});$e.displayName=Qe;var et=`SelectBubbleInput`,tt=F.forwardRef(({__scopeSelect:e,...t},n)=>{let r=K(et,e),{value:i,onValueChange:a,required:s,disabled:c,name:l,autoComplete:u,form:d}=r,{nativeOptions:f,nativeSelectKey:p}=r,m=F.useRef(null),h=b(n,m),g=i??``,_=M(g),v=Array.from(f).some(e=>(e.props.value??``)===``);return F.useEffect(()=>{let e=m.current;if(!e)return;let t=window.HTMLSelectElement.prototype,n=Object.getOwnPropertyDescriptor(t,`value`).set;if(_!==g&&n){let t=new Event(`change`,{bubbles:!0});n.call(e,g),e.dispatchEvent(t)}},[_,g]),(0,R.jsxs)(o.select,{"aria-hidden":!0,required:s,tabIndex:-1,name:l,autoComplete:u,disabled:c,form:d,onChange:e=>a(e.target.value),...t,style:{...te,...t.style},ref:h,defaultValue:g,children:[$(i)&&!v?(0,R.jsx)(`option`,{value:``}):null,Array.from(f)]},p)});tt.displayName=et;function nt(e){return typeof e==`function`}function $(e){return e===``||e===void 0}function rt(e){let t=c(e),n=F.useRef(``),r=F.useRef(0),i=F.useCallback(e=>{let i=n.current+e;t(i),(function e(t){n.current=t,window.clearTimeout(r.current),t!==``&&(r.current=window.setTimeout(()=>e(``),1e3))})(i)},[t]),a=F.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return F.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}function it(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=at(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.textValue.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function at(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var ot=le,st=pe;function ct({className:e,children:t,...n}){return(0,R.jsxs)(de,{className:i(`flex h-[var(--ui-field-height)] w-full cursor-pointer items-center justify-between gap-2 px-2.5 [&>span]:truncate`,w,e),...n,children:[t,(0,R.jsx)(he,{asChild:!0,children:(0,R.jsx)(N,{className:`size-3.5 shrink-0 text-fg-muted`})})]})}function lt({className:e,children:t,position:n=`popper`,...r}){return(0,R.jsx)(ye,{children:(0,R.jsx)(be,{position:n,sideOffset:4,className:i(`z-50 max-h-72 min-w-[var(--radix-select-trigger-width)] max-w-[var(--radix-select-content-available-width)] overflow-y-auto`,E,`overlay-select-motion`,e),...r,children:(0,R.jsx)(Me,{children:t})})})}function ut({className:e,children:t,detail:n,...r}){return(0,R.jsxs)(Ve,{className:i(T,A,`py-1.5 pl-7 pr-2`,e),...r,children:[(0,R.jsx)(`span`,{className:`absolute left-2 flex size-3.5 items-center justify-center`,children:(0,R.jsx)(We,{children:(0,R.jsx)(P,{className:`size-3.5`})})}),(0,R.jsx)(He,{children:t}),n]})}export{st as a,ct as i,lt as n,P as o,ut as r,ot as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{A as n,X as r,a as i,d as a,et as o,f as s,j as c,o as l,v as u}from"./auth-C3ruG3fE.js";import{t as d}from"./jsx-runtime-By8HlURe.js";import{r as f}from"./index-Cg9SFK_d.js";import{n as p}from"./api-CULxlzTe.js";import{t as m}from"./ws-DjQ6OZLM.js";import{t as h}from"./createLucideIcon-C9A1vLE-.js";import{n as g}from"./dist-BOS6OKSE.js";import{t as _}from"./button-DtByPSFL.js";import{t as v}from"./copy-D0Theg4Q.js";import{t as y}from"./x-DV6-RYI2.js";var b=h(`clipboard-paste`,[[`path`,{d:`M11 14h10`,key:`1w8e9d`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v1.344`,key:`1e62lh`}],[`path`,{d:`m17 18 4-4-4-4`,key:`z2g111`}],[`path`,{d:`M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 1.793-1.113`,key:`bjbb7m`}],[`rect`,{x:`8`,y:`2`,width:`8`,height:`4`,rx:`1`,key:`ublpy`}]]),x=h(`eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]);function S(){return f.get()}var C=n.options.join(`,`),w=a.imageBytes,T=20*1024*1024;async function E(e,t,r){r?.throwIfAborted();let i=n.safeParse(e.type);if(!i.success)throw Error(`Choose a PNG, JPEG, GIF or WebP image.`);if(e.size===0)throw Error(`This image is empty.`);if(e.size>T)throw Error(`Choose an image smaller than 20 MiB.`);if(!t||e.size<=w)return{blob:e,mime:i.data,resized:!1};if(i.data===`image/gif`)throw Error(`Choose a GIF no larger than 4 MiB for remote access.`);let a=await createImageBitmap(e);try{r?.throwIfAborted();let e=document.createElement(`canvas`),t=e.getContext(`2d`);if(!t)throw Error(`Could not prepare this image.`);let o=i.data===`image/jpeg`?`image/jpeg`:`image/webp`,s=Math.min(1,2048/Math.max(a.width,a.height));for(let i=0;i<8;i++){e.width=Math.max(1,Math.round(a.width*s)),e.height=Math.max(1,Math.round(a.height*s)),t.drawImage(a,0,0,e.width,e.height);for(let t of[.85,.7,.55]){let i=await new Promise(n=>e.toBlob(n,o,t));if(r?.throwIfAborted(),i&&i.size<=w)return{blob:i,mime:n.parse(i.type),resized:!0}}s*=.75}throw Error(`This image is too large to attach remotely. Choose a smaller image.`)}finally{a.close()}}var D=new WeakSet,ee=Math.floor((u.requestBytes-1024)*3/4);async function O(e,t,n,i,l,u,d){let f=e.generation,p=()=>{if(u?.throwIfAborted(),l(),e.generation!==f)throw Error(`The connection changed; the image upload was interrupted.`)};if(p(),!n.size||n.size>a.imageBytes)throw Error(`The prepared image must be no larger than 4 MiB.`);if(D.has(e))throw Error(`An image upload is already in progress.`);D.add(e);let m=crypto.randomUUID(),h=`/api/worktrees/${t}/paste-upload`,g=!1,_=!1,v=async(t,n,r)=>{p();let i=await e.request(t,n,r,u),a=await i.json();if(p(),!i.ok){let e=o.safeParse(a);throw Error(e.success?e.data.error.message:`The image upload failed.`)}return a},y=e=>v(`POST`,h,e),b=async e=>{let t=new Uint8Array(await e.arrayBuffer());return p(),btoa(Array.from(t,e=>String.fromCharCode(e)).join(``))};try{let e=r.parse(await v(`GET`,`/api/version`));if(d?.(0,n.size),!e.remote_image_uploads){if(n.size>ee)throw Error(`Update the host connector to upload images larger than 191 KiB.`);let e=await b(n),r=c.parse(await v(`POST`,`/api/worktrees/${t}/paste`,{mime:i,data:e}));return d?.(n.size,n.size),r}if(g=!0,s.parse(await y({action:`start`,upload:m,mime:i,size:n.size})).received!==0)throw Error(`Invalid image upload acknowledgement.`);for(let e=0;e<n.size;e+=a.chunkBytes){let t=n.slice(e,e+a.chunkBytes),r=await b(t),i=s.parse(await y({action:`chunk`,upload:m,offset:e,data:r}));if(i.received!==e+t.size)throw Error(`Invalid image upload acknowledgement.`);d?.(i.received,n.size)}let o=c.parse(await y({action:`finish`,upload:m}));return _=!0,o}finally{if(g&&!_&&e.generation===f)try{l(),e.request(`POST`,h,{action:`cancel`,upload:m}).catch(()=>{})}catch{}D.delete(e)}}function k(e,t,n){if(t.startsWith(`login-`)||t===`home`)return!1;let r=Array.from(e.clipboardData?.items??[]);if(r.some(e=>e.type===`text/plain`))return!1;let i=r.find(e=>e.kind===`file`&&e.type.startsWith(`image/`));if(!i)return!1;let a=i.getAsFile();return a?(A(a,t,n).then(({resized:e})=>{e&&g(`Image resized for remote access`)}).catch(e=>{g.error(e instanceof Error?`Image paste failed: ${e.message}`:`Image paste failed`)}),!0):!1}async function A(e,t,n,r={}){if(t.startsWith(`login-`)||t===`home`)throw Error(`Open a project terminal to attach an image.`);let i=l(),a=i?.generation,o=()=>{if(l()!==i||i?.generation!==a||!m.isConnected())throw Error(`The terminal connection changed; the image was not inserted.`)};r.signal?.throwIfAborted(),o(),r.onProgress?.({stage:`preparing`});let{blob:s,mime:u,resized:d}=await E(e,i!==null,r.signal);o();let f=i?await O(i,t,s,u,o,r.signal,(e,t)=>r.onProgress?.(e===t?{stage:`saving`}:{stage:`uploading`,received:e,total:t})):await(async()=>{let e=await j(s);return o(),r.signal?.throwIfAborted(),c.parse(await p(`POST`,`/api/worktrees/${t}/paste`,{mime:u,data:e}))})();return r.signal?.throwIfAborted(),o(),r.onProgress?.({stage:`inserting`}),r.insert?r.insert(`${f.path} `):i?await i.input(t,n,`${f.path} `):m.write(t,n,`${f.path} `),{resized:d}}function j(e){return new Promise((t,n)=>{let r=new FileReader;r.onload=()=>t(String(r.result).replace(/^data:[^,]*,/,``)),r.onerror=()=>n(r.error??Error(`could not read the clipboard image`)),r.readAsDataURL(e)})}var M=e(t(),1),N={ctrl:1,alt:2,shift:4},P=/^(?:\[[ABCD]|O[ABCD]|\[1;([2-8])[ABCD])$/,F=e=>e.startsWith(`\x1B`)?P.exec(e.slice(1)):null;function I(e){return!e.startsWith(`\x1B`)||e===`\x1B`||F(e)!==null||e===`\x1B[Z`}function L(e,t){if(!t)return e;let n=(t&N.ctrl)!==0,r=(t&N.alt)!==0,i=(t&N.shift)!==0,a=!!i|(r?2:0)|(n?4:0),o=F(e);if(o)return`\x1b[1;${1+(a|(o[1]?Number(o[1])-1:0))}${e.slice(-1)}`;if(!I(e))return e;if(e===` `||e===`\x1B[Z`)return i||e===`\x1B[Z`?`\x1B[Z`:` `;if(e===`\r`&&i)return`\x1b[13;${1+a}u`;if(i&&e.length===1){let t="`1234567890-=[]\\;',./".indexOf(e);t===-1?/[a-z]/.test(e)&&(e=e.toUpperCase()):e=`~!@#$%^&*()_+{}|:"<>?`[t]}if(n&&e.length===1){let t=e.toUpperCase().charCodeAt(0);t>=64&&t<=95?e=String.fromCharCode(t-64):e===` `?e=`\0`:e===`?`&&(e=``)}return r?`\x1b${e}`:e}function te(e){return e.length===3&&(e.startsWith(`\x1B[`)||e.startsWith(`\x1BO`))&&`ABCD`.includes(e[2])}var R=new Map,z=new Map,B=new Map,V=new Map,H=new Set,U=e=>(H.add(e),()=>{H.delete(e)}),W=()=>{for(let e of H)e()},G=(e,t)=>i(JSON.stringify([e,t]));function K(e,t){return(0,M.useSyncExternalStore)(U,()=>R.has(G(e,t)))}function q(e,t,n,r,i){let a=G(e,t);return R.set(a,n),r&&z.set(a,r),i?B.set(a,i):B.delete(a),W(),()=>{R.get(a)===n&&(R.delete(a),z.delete(a),B.delete(a),V.delete(a),W())}}function J(e,t){z.get(G(e,t))?.()}function Y(e,t){return(0,M.useSyncExternalStore)(U,()=>V.get(G(e,t))??0)}function X(e,t,n){let r=G(e,t);V.set(r,(V.get(r)??0)^n),W()}function Z(e,t,n){let r=G(e,t),i=V.get(r)??0;return!i||!I(n)?n:(V.delete(r),W(),L(n,i))}async function ne(e,t,n,r=!1){let i=G(e,t),a=R.get(i);if(!a)throw Error(`Wait for the terminal to attach; nothing was sent`);let o=r?`${a(n)}\r`:Z(e,t,n);!r&&te(o)&&B.get(i)?.()&&(o=`\x1bO${o.slice(-1)}`),await Q(e,t,o)}async function re(e,t,n){let r=G(e,t),i=R.get(r),a=l(),o=a?.generation;if(!i||!n()||!m.isConnected())throw Error(`Wait for the terminal to attach; nothing was pasted.`);let s;try{let n=navigator.clipboard.readText();J(e,t),s=await n}catch{throw Error(`Could not read the clipboard. Allow clipboard access or use your keyboard’s Paste action.`)}if(!n()||R.get(r)!==i||l()!==a||a?.generation!==o||!m.isConnected())throw Error(`The terminal changed; nothing was pasted. Try again in the active terminal.`);s&&await Q(e,t,i(s))}async function Q(e,t,n){let r=l();if(r)await r.input(e,t,n);else{if(!m.isConnected())throw Error(`Terminal is disconnected; nothing was sent`);m.write(e,t,n)}}var $=d();function ie({text:e,label:t,clear:n,paste:r}){let[i,a]=(0,M.useState)(!1);return(0,$.jsxs)(`div`,{role:`toolbar`,"aria-label":t,onPointerDown:e=>e.preventDefault(),className:`absolute right-2 top-2 z-20 flex gap-1 rounded-md bg-elevated p-1 shadow-lg`,children:[(0,$.jsxs)(_,{variant:`ghost`,size:`sm`,disabled:!e||i,onClick:async()=>{try{await navigator.clipboard.writeText(e),n()}catch{g.error(`Could not copy the selection. Try again.`)}},children:[(0,$.jsx)(v,{}),` Copy`]}),r&&(0,$.jsxs)(_,{variant:`ghost`,size:`sm`,disabled:i,onClick:async()=>{if(!i){a(!0);try{await r(),n()}catch(e){g.error(e instanceof Error?e.message:`Could not paste. Try again.`)}finally{a(!1)}}},children:[(0,$.jsx)(b,{}),` Paste`]}),(0,$.jsx)(_,{variant:`ghost`,size:`icon`,"aria-label":`Clear selection`,disabled:i,onClick:n,children:(0,$.jsx)(y,{})})]})}export{q as a,K as c,k as d,A as f,x as h,re as i,Y as l,S as m,Z as n,ne as o,C as p,J as r,X as s,ie as t,N as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import"./auth-C3ruG3fE.js";import{t as n}from"./jsx-runtime-By8HlURe.js";import{t as r}from"./preload-helper-Czpn1I53.js";import{n as i,t as a}from"./motion-Bd_MB9cH.js";import{n as o,t as s}from"./createLucideIcon-C9A1vLE-.js";import{C as c,E as l,T as u,g as d}from"./dialog-DtvE8ATK.js";import{d as f,f as p,r as m,u as h}from"./dist-Dac0re_p.js";import{_ as g,a as _,c as v,d as y,f as b,g as x,h as S,i as ee,l as C,m as te,n as ne,o as re,p as ie,r as ae,s as oe,t as se,u as ce}from"./dist-B8heQ9Kq.js";var le=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,ue=/^[\\/]{2}/;function de(e,t){return t+e.replace(/\\/g,`/`)}var fe=`popstate`;function pe(e){return typeof e==`object`&&!!e&&`pathname`in e&&`search`in e&&`hash`in e&&`state`in e&&`key`in e}function me(e={}){function t(e,t){let n=t.state?.masked,{pathname:r,search:i,hash:a}=n||e.location;return _e(``,{pathname:r,search:i,hash:a},t.state&&t.state.usr||null,t.state&&t.state.key||`default`,n?{pathname:e.location.pathname,search:e.location.search,hash:e.location.hash}:void 0)}function n(e,t){return typeof t==`string`?t:E(t)}return ve(t,n,null,e)}function w(e,t){if(e===!1||e==null)throw Error(t)}function T(e,t){if(!e){typeof console<`u`&&console.warn(t);try{throw Error(t)}catch{}}}function he(){return Math.random().toString(36).substring(2,10)}function ge(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function _e(e,t,n=null,r,i){return{pathname:typeof e==`string`?e:e.pathname,search:``,hash:``,...typeof t==`string`?D(t):t,state:n,key:t&&t.key||r||he(),mask:i}}function E({pathname:e=`/`,search:t=``,hash:n=``}){return t&&t!==`?`&&(e+=t.charAt(0)===`?`?t:`?`+t),n&&n!==`#`&&(e+=n.charAt(0)===`#`?n:`#`+n),e}function D(e){let t={};if(e){let n=e.indexOf(`#`);n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf(`?`);r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function ve(e,t,n,r={}){let{window:i=document.defaultView,v5Compat:a=!1}=r,o=i.history,s=`POP`,c=null,l=u();l??(l=0,o.replaceState({...o.state,idx:l},``));function u(){return(o.state||{idx:null}).idx}function d(){s=`POP`;let e=u(),t=e==null?null:e-l;l=e,c&&c({action:s,location:h.location,delta:t})}function f(e,t){s=`PUSH`;let r=pe(e)?e:_e(h.location,e,t);n&&n(r,e),l=u()+1;let d=ge(r,l),f=h.createHref(r.mask||r);try{o.pushState(d,``,f)}catch(e){if(e instanceof DOMException&&e.name===`DataCloneError`)throw e;i.location.assign(f)}a&&c&&c({action:s,location:h.location,delta:1})}function p(e,t){s=`REPLACE`;let r=pe(e)?e:_e(h.location,e,t);n&&n(r,e),l=u();let i=ge(r,l),d=h.createHref(r.mask||r);o.replaceState(i,``,d),a&&c&&c({action:s,location:h.location,delta:0})}function m(e){return ye(i,e)}let h={get action(){return s},get location(){return e(i,o)},listen(e){if(c)throw Error(`A history only accepts one active listener`);return i.addEventListener(fe,d),c=e,()=>{i.removeEventListener(fe,d),c=null}},createHref(e){return t(i,e)},createURL:m,encodeLocation(e){let t=m(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:f,replace:p,go(e){return o.go(e)}};return h}function ye(e,t,n=!1){let r=`http://localhost`;e&&(r=e.location.origin===`null`?e.location.href:e.location.origin),w(r,`No window.location.(origin|href) available to create URL`);let i=typeof t==`string`?t:E(t);return i=i.replace(/ $/,`%20`),!n&&ue.test(i)&&(i=r+i),new URL(i,r)}var O=e(t(),1);function be(e,t,n=`/`){return xe(e,t,n,!1)}function xe(e,t,n,r,i){let a=A((typeof t==`string`?D(t):t).pathname||`/`,n);if(a==null)return null;let o=i??Ce(e),s=null,c=Ve(a);for(let e=0;s==null&&e<o.length;++e)s=Re(o[e],c,r);return s}function Se(e,t){let{route:n,pathname:r,params:i}=e;return{id:n.id,pathname:r,params:i,loaderData:t[n.id],handle:n.handle}}function Ce(e){let t=we(e);return Ee(t),t}function we(e,t=[],n=[],r=``,i=!1){let a=(e,a,o=i,s)=>{let c={relativePath:s===void 0?e.path||``:s,caseSensitive:e.caseSensitive===!0,childrenIndex:a,route:e};if(c.relativePath.startsWith(`/`)){if(!c.relativePath.startsWith(r)&&o)return;w(c.relativePath.startsWith(r),`Absolute route path "${c.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),c.relativePath=c.relativePath.slice(r.length)}let l=j([r,c.relativePath]),u=n.concat(c);e.children&&e.children.length>0&&(w(e.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${l}".`),we(e.children,t,u,l,o)),!(e.path==null&&!e.index)&&t.push({path:l,score:Ie(l,e.index),routesMeta:u.map((e,t)=>{let[n,r]=Be(e.relativePath,e.caseSensitive,t===u.length-1);return{...e,matcher:n,compiledParams:r}})})};return e.forEach((e,t)=>{if(e.path===``||!e.path?.includes(`?`))a(e,t);else for(let n of Te(e.path))a(e,t,!0,n)}),t}function Te(e){let t=e.split(`/`);if(t.length===0)return[];let[n,...r]=t,i=n.endsWith(`?`),a=n.replace(/\?$/,``);if(r.length===0)return i?[a,``]:[a];let o=Te(r.join(`/`)),s=[];return s.push(...o.map(e=>e===``?a:[a,e].join(`/`))),i&&s.push(...o),s.map(t=>e.startsWith(`/`)&&t===``?`/`:t)}function Ee(e){e.sort((e,t)=>e.score===t.score?Le(e.routesMeta.map(e=>e.childrenIndex),t.routesMeta.map(e=>e.childrenIndex)):t.score-e.score)}var De=/^:[\w-]+$/,Oe=/^:[\w-]+/,ke=3.5,Ae=3,je=2,Me=1,Ne=10,Pe=-2,Fe=e=>e===`*`;function Ie(e,t){let n=e.split(`/`),r=n.length;return n.some(Fe)&&(r+=Pe),t&&(r+=je),n.filter(e=>!Fe(e)).reduce((e,t)=>e+(De.test(t)?Ae:Oe.test(t)?ke:t===``?Me:Ne),r)}function Le(e,t){return e.length===t.length&&e.slice(0,-1).every((e,n)=>e===t[n])?e[e.length-1]-t[t.length-1]:0}function Re(e,t,n=!1){let{routesMeta:r}=e,i={},a=`/`,o=[];for(let e=0;e<r.length;++e){let s=r[e],c=e===r.length-1,l=a===`/`?t:t.slice(a.length)||`/`,u={path:s.relativePath,caseSensitive:s.caseSensitive,end:c},d=s.matcher&&s.compiledParams?ze(u,l,s.matcher,s.compiledParams):k(u,l),f=s.route;if(!d&&c&&n&&!r[r.length-1].route.index&&(d=k({path:s.relativePath,caseSensitive:s.caseSensitive,end:!1},l)),!d)return null;Object.assign(i,d.params),o.push({params:i,pathname:j([a,d.pathname]),pathnameBase:Xe(j([a,d.pathnameBase])),route:f}),d.pathnameBase!==`/`&&(a=j([a,d.pathnameBase]))}return o}function k(e,t){typeof e==`string`&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=Be(e.path,e.caseSensitive,e.end);return ze(e,t,n,r)}function ze(e,t,n,r){let i=t.match(n);if(!i)return null;let a=i[0],o=a.replace(/(.)\/+$/,`$1`),s=i.slice(1);return{params:r.reduce((e,{paramName:t,isOptional:n},r)=>{if(t===`*`){let e=s[r]||``;o=a.slice(0,a.length-e.length).replace(/(.)\/+$/,`$1`)}let i=s[r];return n&&!i?e[t]=void 0:e[t]=(i||``).replace(/%2F/g,`/`),e},{}),pathname:a,pathnameBase:o,pattern:e}}function Be(e,t=!1,n=!0){T(e===`*`||!e.endsWith(`*`)||e.endsWith(`/*`),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,`/*`)}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,`/*`)}".`);let r=[],i=`^`+e.replace(/\/*\*?$/,``).replace(/^\/*/,`/`).replace(/[\\.*+^${}|()[\]]/g,`\\$&`).replace(/\/:([\w-]+)(\?)?/g,(e,t,n,i,a)=>{if(r.push({paramName:t,isOptional:n!=null}),n){let t=a.charAt(i+e.length);return t&&t!==`/`?`/([^\\/]*)`:`(?:/([^\\/]*))?`}return`/([^\\/]+)`}).replace(/\/([\w-]+)\?(?=\/|$|\()/g,`(?:/$1)?`);return e.endsWith(`*`)?(r.push({paramName:`*`}),i+=e===`*`||e===`/*`?`(.*)$`:`(?:\\/(.+)|\\/*)$`):n?i+=`\\/*$`:e!==``&&e!==`/`&&(i+=`(?:(?=\\/|$))`),[new RegExp(i,t?void 0:`i`),r]}function Ve(e){try{return e.split(`/`).map(e=>decodeURIComponent(e).replace(/\//g,`%2F`)).join(`/`)}catch(t){return T(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function A(e,t){if(t===`/`)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith(`/`)?t.length-1:t.length,r=e.charAt(n);return r&&r!==`/`?null:e.slice(n)||`/`}function He(e,t=`/`){let{pathname:n,search:r=``,hash:i=``}=typeof e==`string`?D(e):e,a;return n?(n=Je(n),a=n.startsWith(`/`)?Ue(n.substring(1),`/`):Ue(n,t)):a=t,{pathname:a,search:Ze(r),hash:Qe(i)}}function Ue(e,t){let n=Ye(t).split(`/`);return e.split(`/`).forEach(e=>{e===`..`?n.length>1&&n.pop():e!==`.`&&n.push(e)}),n.length>1?n.join(`/`):`/`}function We(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function Ge(e){return e.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function Ke(e){let t=Ge(e);return t.map((e,n)=>n===t.length-1?e.pathname:e.pathnameBase)}function qe(e,t,n,r=!1){let i;typeof e==`string`?i=D(e):(i={...e},w(!i.pathname||!i.pathname.includes(`?`),We(`?`,`pathname`,`search`,i)),w(!i.pathname||!i.pathname.includes(`#`),We(`#`,`pathname`,`hash`,i)),w(!i.search||!i.search.includes(`#`),We(`#`,`search`,`hash`,i)));let a=e===``||i.pathname===``,o=a?`/`:i.pathname,s;if(o==null)s=n;else{let e=t.length-1;if(!r&&o.startsWith(`..`)){let t=o.split(`/`);for(;t[0]===`..`;)t.shift(),--e;i.pathname=t.join(`/`)}s=e>=0?t[e]:`/`}let c=He(i,s),l=o&&o!==`/`&&o.endsWith(`/`),u=(a||o===`.`)&&n.endsWith(`/`);return!c.pathname.endsWith(`/`)&&(l||u)&&(c.pathname+=`/`),c}var Je=e=>e.replace(/[\\/]{2,}/g,`/`),j=e=>Je(e.join(`/`)),Ye=e=>e.replace(/\/+$/,``),Xe=e=>Ye(e).replace(/^\/*/,`/`),Ze=e=>!e||e===`?`?``:e.startsWith(`?`)?e:`?`+e,Qe=e=>!e||e===`#`?``:e.startsWith(`#`)?e:`#`+e,$e=class{status;statusText;data;error;internal;constructor(e,t,n,r=!1){this.status=e,this.statusText=t||``,this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function et(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.internal==`boolean`&&`data`in e}function tt(e){return j(e.map(e=>e.route.path).filter(Boolean))||`/`}var nt=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function rt(e,t){let n=e;if(typeof n!=`string`||!le.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,i=!1;if(nt)try{let e=new URL(window.location.href),r=ue.test(n)?new URL(de(n,e.protocol)):new URL(n),a=A(r.pathname,t);r.origin===e.origin&&a!=null?n=a+r.search+r.hash:i=!0}catch{T(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:i,to:n}}var it=[`POST`,`PUT`,`PATCH`,`DELETE`];new Set(it);var at=[`GET`,...it];new Set(at);var ot=[`about:`,`blob:`,`chrome:`,`chrome-untrusted:`,`content:`,`data:`,`devtools:`,`file:`,`filesystem:`,`javascript:`];function st(e){try{return ot.includes(new URL(e).protocol)}catch{return!1}}var M=O.createContext(null);M.displayName=`DataRouter`;var N=O.createContext(null);N.displayName=`DataRouterState`;var ct=O.createContext(!1);function lt(){return O.useContext(ct)}var ut=O.createContext({isTransitioning:!1});ut.displayName=`ViewTransition`;var dt=O.createContext(new Map);dt.displayName=`Fetchers`;var ft=O.createContext(null);ft.displayName=`Await`;var P=O.createContext(null);P.displayName=`Navigation`;var F=O.createContext(null);F.displayName=`Location`;var I=O.createContext({outlet:null,matches:[],isDataRoute:!1});I.displayName=`Route`;var pt=O.createContext(null);pt.displayName=`RouteError`;var mt=`REACT_ROUTER_ERROR`,ht=`REDIRECT`,gt=`ROUTE_ERROR_RESPONSE`;function _t(e){if(e.startsWith(`${mt}:${ht}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`&&typeof t.location==`string`&&typeof t.reloadDocument==`boolean`&&typeof t.replace==`boolean`)return t}catch{}}function vt(e){if(e.startsWith(`${mt}:${gt}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`)return new $e(t.status,t.statusText,t.data)}catch{}}function yt(e,{relative:t}={}){w(L(),`useHref() may be used only in the context of a <Router> component.`);let{basename:n,navigator:r}=O.useContext(P),{hash:i,pathname:a,search:o}=z(e,{relative:t}),s=a;return n!==`/`&&(s=a===`/`?n:j([n,a])),r.createHref({pathname:s,search:o,hash:i})}function L(){return O.useContext(F)!=null}function R(){return w(L(),`useLocation() may be used only in the context of a <Router> component.`),O.useContext(F).location}var bt=`You should call navigate() in a React.useEffect(), not when your component is first rendered.`;function xt(){let{isDataRoute:e}=O.useContext(I);return e?Ut():St()}function St(){w(L(),`useNavigate() may be used only in the context of a <Router> component.`);let e=O.useContext(M),{basename:t,navigator:n}=O.useContext(P),{matches:r}=O.useContext(I),{pathname:i}=R(),a=JSON.stringify(Ke(r)),o=O.useRef(!1);return O.useLayoutEffect(()=>{o.current=!0}),O.useCallback((r,s={})=>{if(T(o.current,bt),!o.current)return;if(typeof r==`number`){n.go(r);return}let c=qe(r,JSON.parse(a),i,s.relative===`path`);e==null&&t!==`/`&&(c.pathname=c.pathname===`/`?t:j([t,c.pathname])),(s.replace?n.replace:n.push)(c,s.state,s)},[t,n,a,i,e])}var Ct=O.createContext(null);function wt(e){let t=O.useContext(I).outlet;return O.useMemo(()=>t&&O.createElement(Ct.Provider,{value:e},t),[t,e])}function Tt(){let{matches:e}=O.useContext(I);return e[e.length-1]?.params??{}}function z(e,{relative:t}={}){let{matches:n}=O.useContext(I),{pathname:r}=R(),i=JSON.stringify(Ke(n));return O.useMemo(()=>qe(e,JSON.parse(i),r,t===`path`),[e,i,r,t])}function Et(e,t){return Dt(e,t)}function Dt(e,t,n){w(L(),`useRoutes() may be used only in the context of a <Router> component.`);let{navigator:r}=O.useContext(P),{matches:i}=O.useContext(I),a=i[i.length-1],o=a?a.params:{};a&&a.pathname;let s=a?a.pathnameBase:`/`;a&&a.route;let c=R(),l;if(t){let e=typeof t==`string`?D(t):t;w(s===`/`||e.pathname?.startsWith(s),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${s}" but pathname "${e.pathname}" was given in the \`location\` prop.`),l=e}else l=c;let u=l.pathname||`/`,d=u;if(s!==`/`){let e=s.replace(/^\//,``).split(`/`);d=`/`+u.replace(/^\//,``).split(`/`).slice(e.length).join(`/`)}let f=n&&n.state.matches.length?n.state.matches.map(e=>Object.assign(e,{route:n.manifest[e.route.id]||e.route})):be(e,{pathname:d}),p=Pt(f&&f.map(e=>Object.assign({},e,{params:Object.assign({},o,e.params),pathname:j([s,r.encodeLocation?r.encodeLocation(e.pathname.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathname]),pathnameBase:e.pathnameBase===`/`?s:j([s,r.encodeLocation?r.encodeLocation(e.pathnameBase.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathnameBase])})),i,n);return t&&p?O.createElement(F.Provider,{value:{location:{pathname:`/`,search:``,hash:``,state:null,key:`default`,mask:void 0,...l},navigationType:`POP`}},p):p}function Ot(){let e=Ht(),t=et(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null;return O.createElement(O.Fragment,null,O.createElement(`h2`,null,`Unexpected Application Error!`),O.createElement(`h3`,{style:{fontStyle:`italic`}},t),n?O.createElement(`pre`,{style:{padding:`0.5rem`,backgroundColor:`rgba(200,200,200, 0.5)`}},n):null,null)}var kt=O.createElement(Ot,null),At=class extends O.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static contextType=ct;static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!==`idle`&&e.revalidation===`idle`?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error===void 0?t.error:e.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error(`React Router caught the following error during render`,e)}render(){let e=this.state.error;if(this.context&&typeof e==`object`&&e&&`digest`in e&&typeof e.digest==`string`){let t=vt(e.digest);t&&(e=t)}let t=e===void 0?this.props.children:O.createElement(I.Provider,{value:this.props.routeContext},O.createElement(pt.Provider,{value:e,children:this.props.component}));return this.context?O.createElement(Mt,{error:e},t):t}},jt=new WeakMap;function Mt({children:e,error:t}){let{basename:n}=O.useContext(P);if(typeof t==`object`&&t&&`digest`in t&&typeof t.digest==`string`){let e=_t(t.digest);if(e){let r=jt.get(t);if(r)throw r;let i=rt(e.location,n),a=i.absoluteURL||i.to;if(st(a))throw Error(`Invalid redirect location`);if(nt&&!jt.get(t))if(i.isExternal||e.reloadDocument)window.location.href=a;else{let n=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(i.to,{replace:e.replace}));throw jt.set(t,n),n}return O.createElement(`meta`,{httpEquiv:`refresh`,content:`0;url=${a}`})}}return e}function Nt({routeContext:e,match:t,children:n}){let r=O.useContext(M);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),O.createElement(I.Provider,{value:e},n)}function Pt(e,t=[],n){let r=n?.state;if(e==null){if(!r)return null;if(r.errors)e=r.matches;else if(t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let i=e,a=r?.errors;if(a!=null){let e=i.findIndex(e=>e.route.id&&a?.[e.route.id]!==void 0);w(e>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(a).join(`,`)}`),i=i.slice(0,Math.min(i.length,e+1))}let o=!1,s=-1;if(n&&r){o=r.renderFallback;for(let e=0;e<i.length;e++){let t=i[e];if((t.route.HydrateFallback||t.route.hydrateFallbackElement)&&(s=e),t.route.id){let{loaderData:e,errors:a}=r,c=t.route.loader&&!e.hasOwnProperty(t.route.id)&&(!a||a[t.route.id]===void 0);if(t.route.lazy||c){n.isStatic&&(o=!0),i=s>=0?i.slice(0,s+1):[i[0]];break}}}}let c=n?.onError,l=r&&c?(e,t)=>{c(e,{location:r.location,params:r.matches?.[0]?.params??{},pattern:tt(r.matches),errorInfo:t})}:void 0;return i.reduceRight((e,n,c)=>{let u,d=!1,f=null,p=null;r&&(u=a&&n.route.id?a[n.route.id]:void 0,f=n.route.errorElement||kt,o&&(s<0&&c===0?(Gt(`route-fallback`,!1,"No `HydrateFallback` element provided to render during initial hydration"),d=!0,p=null):s===c&&(d=!0,p=n.route.hydrateFallbackElement||null)));let m=t.concat(i.slice(0,c+1)),h=()=>{let t;return t=u?f:d?p:n.route.Component?O.createElement(n.route.Component,null):n.route.element?n.route.element:e,O.createElement(Nt,{match:n,routeContext:{outlet:e,matches:m,isDataRoute:r!=null},children:t})};return r&&(n.route.ErrorBoundary||n.route.errorElement||c===0)?O.createElement(At,{location:r.location,revalidation:r.revalidation,component:f,error:u,children:h(),routeContext:{outlet:null,matches:m,isDataRoute:!0},onError:l}):h()},null)}function Ft(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function It(e){let t=O.useContext(M);return w(t,Ft(e)),t}function Lt(e){let t=O.useContext(N);return w(t,Ft(e)),t}function Rt(e){let t=O.useContext(I);return w(t,Ft(e)),t}function B(e){let t=Rt(e),n=t.matches[t.matches.length-1];return w(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function zt(){return B(`useRouteId`)}function Bt(){let e=Lt(`useNavigation`);return O.useMemo(()=>{let{matches:t,historyAction:n,...r}=e.navigation;return r},[e.navigation])}function Vt(){let{matches:e,loaderData:t}=Lt(`useMatches`);return O.useMemo(()=>e.map(e=>Se(e,t)),[e,t])}function Ht(){let e=O.useContext(pt),t=Lt(`useRouteError`),n=B(`useRouteError`);return e===void 0?t.errors?.[n]:e}function Ut(){let{router:e}=It(`useNavigate`),t=B(`useNavigate`),n=O.useRef(!1);return O.useLayoutEffect(()=>{n.current=!0}),O.useCallback(async(r,i={})=>{T(n.current,bt),n.current&&(typeof r==`number`?await e.navigate(r):await e.navigate(r,{fromRouteId:t,...i}))},[e,t])}var Wt={};function Gt(e,t,n){!t&&!Wt[e]&&(Wt[e]=!0,T(!1,n))}O.memo(Kt);function Kt({routes:e,manifest:t,future:n,state:r,isStatic:i,onError:a}){return Dt(e,void 0,{manifest:t,state:r,isStatic:i,onError:a,future:n})}function qt(e){return wt(e.context)}function Jt(e){w(!1,`A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.`)}function Yt({basename:e=`/`,children:t=null,location:n,navigationType:r=`POP`,navigator:i,static:a=!1,useTransitions:o}){w(!L(),`You cannot render a <Router> inside another <Router>. You should never have more than one in your app.`);let s=e.replace(/^\/*/,`/`),c=O.useMemo(()=>({basename:s,navigator:i,static:a,useTransitions:o,future:{}}),[s,i,a,o]);typeof n==`string`&&(n=D(n));let{pathname:l=`/`,search:u=``,hash:d=``,state:f=null,key:p=`default`,mask:m}=n,h=O.useMemo(()=>{let e=A(l,s);return e==null?null:{location:{pathname:e,search:u,hash:d,state:f,key:p,mask:m},navigationType:r}},[s,l,u,d,f,p,r,m]);return T(h!=null,`<Router basename="${s}"> is not able to match the URL "${l}${u}${d}" because it does not start with the basename, so the <Router> won't render anything.`),h==null?null:O.createElement(P.Provider,{value:c},O.createElement(F.Provider,{children:t,value:h}))}function Xt({children:e,location:t}){return Et(V(e),t)}O.Component;function V(e,t=[]){let n=[];return O.Children.forEach(e,(e,r)=>{if(!O.isValidElement(e))return;let i=[...t,r];if(e.type===O.Fragment){n.push.apply(n,V(e.props.children,i));return}w(e.type===Jt,`[${typeof e.type==`string`?e.type:e.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`);let a=e.props;w(!a.index||!a.children,`An index route cannot have child routes.`);let o={id:a.id||i.join(`-`),caseSensitive:a.caseSensitive,element:a.element,Component:a.Component,index:a.index,path:a.path,middleware:a.middleware,loader:a.loader,action:a.action,hydrateFallbackElement:a.hydrateFallbackElement,HydrateFallback:a.HydrateFallback,errorElement:a.errorElement,ErrorBoundary:a.ErrorBoundary,shouldRevalidate:a.shouldRevalidate,handle:a.handle,lazy:a.lazy};a.children&&(o.children=V(a.children,i)),n.push(o)}),n}var H=`application/x-www-form-urlencoded`;function U(e){return typeof HTMLElement<`u`&&e instanceof HTMLElement}function Zt(e){return U(e)&&e.tagName.toLowerCase()===`button`}function Qt(e){return U(e)&&e.tagName.toLowerCase()===`form`}function $t(e){return U(e)&&e.tagName.toLowerCase()===`input`}function en(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function tn(e,t){return e.button===0&&(!t||t===`_self`)&&!en(e)}var W=null;function nn(){if(W===null)try{new FormData(document.createElement(`form`),0),W=!1}catch{W=!0}return W}var rn=new Set([`application/x-www-form-urlencoded`,`multipart/form-data`,`text/plain`]);function an(e){return e!=null&&!rn.has(e)?(T(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${H}"`),null):e}function on(e,t){let n,r,i,a,o;if(Qt(e)){let o=e.getAttribute(`action`);r=o?A(o,t):null,n=e.getAttribute(`method`)||`get`,i=an(e.getAttribute(`enctype`))||H,a=new FormData(e)}else if(Zt(e)||$t(e)&&(e.type===`submit`||e.type===`image`)){let o=e.form;if(o==null)throw Error(`Cannot submit a <button> or <input type="submit"> without a <form>`);let s=e.getAttribute(`formaction`)||o.getAttribute(`action`);if(r=s?A(s,t):null,n=e.getAttribute(`formmethod`)||o.getAttribute(`method`)||`get`,i=an(e.getAttribute(`formenctype`))||an(o.getAttribute(`enctype`))||H,a=new FormData(o,e),!nn()){let{name:t,type:n,value:r}=e;if(n===`image`){let e=t?`${t}.`:``;a.append(`${e}x`,`0`),a.append(`${e}y`,`0`)}else t&&a.append(t,r)}}else if(U(e))throw Error(`Cannot submit element that is not <form>, <button>, or <input type="submit|image">`);else n=`get`,r=null,i=H,o=e;return a&&i===`text/plain`&&(o=a,a=void 0),{action:r,method:n.toLowerCase(),encType:i,formData:a,body:o}}function sn(e,t){if(e===!1||e==null)throw Error(t)}var cn={"&":`\\u0026`,">":`\\u003e`,"<":`\\u003c`,"\u2028":`\\u2028`,"\u2029":`\\u2029`},ln=/[&><\u2028\u2029]/g;function un(e){return e.replace(ln,e=>cn[e])}function dn(e,t){let n=typeof e==`string`?new URL(e,typeof window>`u`?`server://singlefetch/`:window.location.origin):e;return n.pathname.endsWith(`/`)?n.pathname=`${n.pathname}_.${t}`:n.pathname=`${n.pathname}.${t}`,n}async function fn(e,t){if(e.id in t)return t[e.id];try{let n=await r(()=>import(e.module),[]);return t[e.id]=n,n}catch(t){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(t),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function pn(e){return e!=null&&typeof e.page==`string`}function mn(e){return e==null?!1:e.href==null?e.rel===`preload`&&typeof e.imageSrcSet==`string`&&typeof e.imageSizes==`string`:typeof e.rel==`string`&&typeof e.href==`string`}async function hn(e,t,n){return bn((await Promise.all(e.map(async e=>{let r=t.routes[e.route.id];if(r){let e=await fn(r,n);return e.links?e.links():[]}return[]}))).flat(1).filter(mn).filter(e=>e.rel===`stylesheet`||e.rel===`preload`).map(e=>e.rel===`stylesheet`?{...e,rel:`prefetch`,as:`style`}:{...e,rel:`prefetch`}))}function gn(e,t,n,r,i,a){let o=(e,t)=>!n[t]||e.route.id!==n[t].route.id,s=(e,t)=>n[t].pathname!==e.pathname||n[t].route.path?.endsWith(`*`)&&n[t].params[`*`]!==e.params[`*`];return a===`assets`?t.filter((e,t)=>o(e,t)||s(e,t)):a===`data`?t.filter((t,a)=>{let c=r.routes[t.route.id];if(!c||!c.hasLoader)return!1;if(o(t,a)||s(t,a))return!0;if(t.route.shouldRevalidate){let r=t.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:t.params,defaultShouldRevalidate:!0});if(typeof r==`boolean`)return r}return!0}):[]}function _n(e,t,{includeHydrateFallback:n}={}){return vn(e.map(e=>{let r=t.routes[e.route.id];if(!r)return[];let i=[r.module];return r.clientActionModule&&(i=i.concat(r.clientActionModule)),r.clientLoaderModule&&(i=i.concat(r.clientLoaderModule)),n&&r.hydrateFallbackModule&&(i=i.concat(r.hydrateFallbackModule)),r.imports&&(i=i.concat(r.imports)),i}).flat(1))}function vn(e){return[...new Set(e)]}function yn(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function bn(e,t){let n=new Set,r=new Set(t);return e.reduce((e,i)=>{if(t&&!pn(i)&&i.as===`script`&&i.href&&r.has(i.href))return e;let a=JSON.stringify(yn(i));return n.has(a)||(n.add(a),e.push({key:a,link:i})),e},[])}function xn(){let e=O.useContext(M);return sn(e,`You must render this element inside a <DataRouterContext.Provider> element`),e}function Sn(){let e=O.useContext(N);return sn(e,`You must render this element inside a <DataRouterStateContext.Provider> element`),e}var G=O.createContext(void 0);G.displayName=`FrameworkContext`;function Cn(){let e=O.useContext(G);return sn(e,`You must render this element inside a <HydratedRouter> element`),e}function wn(e,t){let n=O.useContext(G),[r,i]=O.useState(!1),[a,o]=O.useState(!1),{onFocus:s,onBlur:c,onMouseEnter:l,onMouseLeave:u,onTouchStart:d}=t,f=O.useRef(null);O.useEffect(()=>{if(e===`render`&&o(!0),e===`viewport`){let e=new IntersectionObserver(e=>{e.forEach(e=>{o(e.isIntersecting)})},{threshold:.5});return f.current&&e.observe(f.current),()=>{e.disconnect()}}},[e]),O.useEffect(()=>{if(r){let e=setTimeout(()=>{o(!0)},100);return()=>{clearTimeout(e)}}},[r]);let p=()=>{i(!0)},m=()=>{i(!1),o(!1)};return n?e===`intent`?[a,f,{onFocus:K(s,p),onBlur:K(c,m),onMouseEnter:K(l,p),onMouseLeave:K(u,m),onTouchStart:K(d,p)}]:[a,f,{}]:[!1,f,{}]}function K(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function Tn({page:e,...t}){let n=lt(),{nonce:r}=Cn(),{router:i}=xn(),a=O.useMemo(()=>be(i.routes,e,i.basename),[i.routes,e,i.basename]);return a?(t.nonce==null&&r&&(t={...t,nonce:r}),n?O.createElement(Dn,{page:e,matches:a,...t}):O.createElement(On,{page:e,matches:a,...t})):null}function En(e){let{manifest:t,routeModules:n}=Cn(),[r,i]=O.useState([]);return O.useEffect(()=>{let r=!1;return hn(e,t,n).then(e=>{r||i(e)}),()=>{r=!0}},[e,t,n]),r}function Dn({page:e,matches:t,...n}){let r=R(),i=O.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=dn(e,`rsc`),i=!1,a=[];for(let e of t)typeof e.route.shouldRevalidate==`function`?i=!0:a.push(e.route.id);return i&&a.length>0&&n.searchParams.set(`_routes`,a.join(`,`)),[n.pathname+n.search]},[e,r,t]);return O.createElement(O.Fragment,null,i.map(e=>O.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})))}function On({page:e,matches:t,...n}){let r=R(),{manifest:i,routeModules:a}=Cn(),{loaderData:o,matches:s}=Sn(),c=O.useMemo(()=>gn(e,t,s,i,r,`data`),[e,t,s,i,r]),l=O.useMemo(()=>gn(e,t,s,i,r,`assets`),[e,t,s,i,r]),u=O.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=new Set,s=!1;if(t.forEach(e=>{let t=i.routes[e.route.id];!t||!t.hasLoader||(!c.some(t=>t.route.id===e.route.id)&&e.route.id in o&&a[e.route.id]?.shouldRevalidate||t.hasClientLoader?s=!0:n.add(e.route.id))}),n.size===0)return[];let l=dn(e,`data`);return s&&n.size>0&&l.searchParams.set(`_routes`,t.filter(e=>n.has(e.route.id)).map(e=>e.route.id).join(`,`)),[l.pathname+l.search]},[o,r,i,c,t,e,a]),d=O.useMemo(()=>_n(l,i),[l,i]),f=En(l);return O.createElement(O.Fragment,null,u.map(e=>O.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})),d.map(e=>O.createElement(`link`,{key:e,rel:`modulepreload`,href:e,...n})),f.map(({key:e,link:t})=>O.createElement(`link`,{key:e,nonce:n.nonce,...t,crossOrigin:t.crossOrigin??n.crossOrigin})))}function kn(...e){return t=>{e.forEach(e=>{typeof e==`function`?e(t):e!=null&&(e.current=t)})}}var An=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;try{An&&(window.__reactRouterVersion=`8.2.0`)}catch{}function jn({basename:e,children:t,useTransitions:n,window:r}){let i=O.useRef(null);i.current??=me({window:r,v5Compat:!0});let a=i.current,[o,s]=O.useState({action:a.action,location:a.location}),c=O.useCallback(e=>{n===!1?s(e):O.startTransition(()=>s(e))},[n]);return O.useLayoutEffect(()=>a.listen(c),[a,c]),O.createElement(Yt,{basename:e,children:t,location:o.location,navigationType:o.action,navigator:a,useTransitions:n})}function Mn({basename:e,children:t,history:n,useTransitions:r}){let[i,a]=O.useState({action:n.action,location:n.location}),o=O.useCallback(e=>{r===!1?a(e):O.startTransition(()=>a(e))},[r]);return O.useLayoutEffect(()=>n.listen(o),[n,o]),O.createElement(Yt,{basename:e,children:t,location:i.location,navigationType:i.action,navigator:n,useTransitions:r})}Mn.displayName=`unstable_HistoryRouter`;var Nn=O.forwardRef(function({onClick:e,discover:t=`render`,prefetch:n=`none`,relative:r,reloadDocument:i,replace:a,mask:o,state:s,target:c,to:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f,...p},m){let{basename:h,navigator:g,useTransitions:_}=O.useContext(P),v=typeof l==`string`&&le.test(l),y=rt(l,h);l=y.to;let b=yt(l,{relative:r}),x=R(),S=null;if(o){let e=qe(o,[],x.mask?x.mask.pathname:`/`,!0);h!==`/`&&(e.pathname=e.pathname===`/`?h:j([h,e.pathname])),S=g.createHref(e)}let[ee,C,te]=wn(n,p),ne=Bn(l,{replace:a,mask:o,state:s,target:c,preventScrollReset:u,relative:r,viewTransition:d,defaultShouldRevalidate:f,useTransitions:_});function re(t){e&&e(t),t.defaultPrevented||ne(t)}let ie=!(y.isExternal||i),ae=O.createElement(`a`,{...p,...te,href:(ie?S:void 0)||y.absoluteURL||b,onClick:ie?re:e,ref:kn(m,C),target:c,"data-discover":!v&&t===`render`?`true`:void 0});return ee&&!v?O.createElement(O.Fragment,null,ae,O.createElement(Tn,{page:b})):ae});Nn.displayName=`Link`;var Pn=O.forwardRef(function({"aria-current":e=`page`,caseSensitive:t=!1,className:n=``,end:r=!1,style:i,to:a,viewTransition:o,children:s,...c},l){let u=z(a,{relative:c.relative}),d=R(),f=O.useContext(N),{navigator:p,basename:m}=O.useContext(P),h=f!=null&&Jn(u)&&o===!0,g=p.encodeLocation?p.encodeLocation(u).pathname:u.pathname,_=d.pathname,v=f&&f.navigation&&f.navigation.location?f.navigation.location.pathname:null;t||(_=_.toLowerCase(),v=v?v.toLowerCase():null,g=g.toLowerCase()),v&&m&&(v=A(v,m)||v);let y=g!==`/`&&g.endsWith(`/`)?g.length-1:g.length,b=_===g||!r&&_.startsWith(g)&&_.charAt(y)===`/`,x=v!=null&&(v===g||!r&&v.startsWith(g)&&v.charAt(g.length)===`/`),S={isActive:b,isPending:x,isTransitioning:h},ee=b?e:void 0,C;C=typeof n==`function`?n(S):[n,b?`active`:null,x?`pending`:null,h?`transitioning`:null].filter(Boolean).join(` `);let te=typeof i==`function`?i(S):i;return O.createElement(Nn,{...c,"aria-current":ee,className:C,ref:l,style:te,to:a,viewTransition:o},typeof s==`function`?s(S):s)});Pn.displayName=`NavLink`;var Fn=O.forwardRef(({discover:e=`render`,fetcherKey:t,navigate:n,reloadDocument:r,replace:i,state:a,method:o=`get`,action:s,onSubmit:c,relative:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f,...p},m)=>{let{useTransitions:h}=O.useContext(P),g=Un(),_=Wn(s,{relative:l}),v=o.toLowerCase()===`get`?`get`:`post`,y=typeof s==`string`&&le.test(s);return O.createElement(`form`,{ref:m,method:v,action:_,onSubmit:r?c:e=>{if(c&&c(e),e.defaultPrevented)return;e.preventDefault();let r=e.nativeEvent.submitter,s=r?.getAttribute(`formmethod`)||o,p=()=>g(r||e.currentTarget,{fetcherKey:t,method:s,navigate:n,replace:i,state:a,relative:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f});h&&n!==!1?O.startTransition(()=>p()):p()},...p,"data-discover":!y&&e===`render`?`true`:void 0})});Fn.displayName=`Form`;function In({getKey:e,storageKey:t,...n}){let r=O.useContext(G),{basename:i}=O.useContext(P),a=R(),o=Vt();Kn({getKey:e,storageKey:t});let s=O.useMemo(()=>{if(!r||!e)return null;let t=Gn(a,o,i,e);return t===a.key?null:t},[]);if(!r||r.isSpaMode)return null;let c=((e,t)=>{if(!window.history.state||!window.history.state.key){let e=Math.random().toString(32).slice(2);window.history.replaceState({key:e},``)}try{let n=JSON.parse(sessionStorage.getItem(e)||`{}`)[t||window.history.state.key];typeof n==`number`&&window.scrollTo(0,n)}catch(t){console.error(t),sessionStorage.removeItem(e)}}).toString();return n.nonce==null&&r?.nonce&&(n.nonce=r.nonce),O.createElement(`script`,{...n,suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:`(${c})(${un(JSON.stringify(t||q))}, ${un(JSON.stringify(s))})`}})}In.displayName=`ScrollRestoration`;function Ln(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Rn(e){let t=O.useContext(M);return w(t,Ln(e)),t}function zn(e){let t=O.useContext(N);return w(t,Ln(e)),t}function Bn(e,{target:t,replace:n,mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,defaultShouldRevalidate:c,useTransitions:l}={}){let u=xt(),d=R(),f=z(e,{relative:o});return O.useCallback(p=>{if(tn(p,t)){p.preventDefault();let t=n===void 0?E(d)===E(f):n,m=()=>u(e,{replace:t,mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,defaultShouldRevalidate:c});l?O.startTransition(()=>m()):m()}},[d,u,f,n,r,i,t,e,a,o,s,c,l])}var Vn=0,Hn=()=>`__${String(++Vn)}__`;function Un(){let{router:e}=Rn(`useSubmit`),{basename:t}=O.useContext(P),n=zt(),r=e.fetch,i=e.navigate;return O.useCallback(async(e,a={})=>{let{action:o,method:s,encType:c,formData:l,body:u}=on(e,t);a.navigate===!1?await r(a.fetcherKey||Hn(),n,a.action||o,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,flushSync:a.flushSync}):await i(a.action||o,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,replace:a.replace,state:a.state,fromRouteId:n,flushSync:a.flushSync,viewTransition:a.viewTransition})},[r,i,t,n])}function Wn(e,{relative:t}={}){let{basename:n}=O.useContext(P),r=O.useContext(I);w(r,`useFormAction must be used inside a RouteContext`);let[i]=r.matches.slice(-1),a={...z(e||`.`,{relative:t})},o=R();if(e==null){a.search=o.search;let e=new URLSearchParams(a.search),t=e.getAll(`index`);if(t.some(e=>e===``)){e.delete(`index`),t.filter(e=>e).forEach(t=>e.append(`index`,t));let n=e.toString();a.search=n?`?${n}`:``}}return(!e||e===`.`)&&i.route.index&&(a.search=a.search?a.search.replace(/^\?/,`?index&`):`?index`),n!==`/`&&(a.pathname=a.pathname===`/`?n:j([n,a.pathname])),E(a)}var q=`react-router-scroll-positions`,J={};function Gn(e,t,n,r){let i=null;return r&&(i=r(n===`/`?e:{...e,pathname:A(e.pathname,n)||e.pathname},t)),i??=e.key,i}function Kn({getKey:e,storageKey:t}={}){let{router:n}=Rn(`useScrollRestoration`),{restoreScrollPosition:r,preventScrollReset:i}=zn(`useScrollRestoration`),{basename:a}=O.useContext(P),o=R(),s=Vt(),c=Bt();O.useEffect(()=>(window.history.scrollRestoration=`manual`,()=>{window.history.scrollRestoration=`auto`}),[]),qn(O.useCallback(()=>{if(c.state===`idle`){let t=Gn(o,s,a,e);J[t]=window.scrollY}try{sessionStorage.setItem(t||q,JSON.stringify(J))}catch(e){T(!1,`Failed to save scroll positions in sessionStorage, <ScrollRestoration /> will not work properly (${e}).`)}window.history.scrollRestoration=`auto`},[c.state,e,a,o,s,t])),typeof document<`u`&&(O.useLayoutEffect(()=>{try{let e=sessionStorage.getItem(t||q);e&&(J=JSON.parse(e))}catch{}},[t]),O.useLayoutEffect(()=>{let t=n?.enableScrollRestoration(J,()=>window.scrollY,e?(t,n)=>Gn(t,n,a,e):void 0);return()=>t&&t()},[n,a,e]),O.useLayoutEffect(()=>{if(r!==!1){if(typeof r==`number`){window.scrollTo(0,r);return}try{if(o.hash){let e=document.getElementById(decodeURIComponent(o.hash.slice(1)));if(e){e.scrollIntoView();return}}}catch{T(!1,`"${o.hash.slice(1)}" is not a decodable element ID. The view will not scroll to it.`)}i!==!0&&window.scrollTo(0,0)}},[o,r,i]))}function qn(e,t){let{capture:n}=t||{};O.useEffect(()=>{let t=n==null?void 0:{capture:n};return window.addEventListener(`pagehide`,e,t),()=>{window.removeEventListener(`pagehide`,e,t)}},[e,n])}function Jn(e,{relative:t}={}){let n=O.useContext(ut);w(n!=null,"`useViewTransitionState` must be used within `react-router/dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=Rn(`useViewTransitionState`),i=z(e,{relative:t});if(!n.isTransitioning)return!1;let a=A(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=A(n.nextLocation.pathname,r)||n.nextLocation.pathname;return k(i.pathname,o)!=null||k(i.pathname,a)!=null}var Yn=0,Y=new Set,Xn=()=>Yn>0;function Zn(e,t,n){if(a()||!t){e();return}for(let e of Y)e.cancel();Y.clear();let r=new Map([...document.querySelectorAll(`[data-workspace-pane]`)].filter(e=>!e.closest(`[data-motion-snapshot]`)).map(e=>[e.dataset.workspacePane,e.getBoundingClientRect()]));Yn++;try{e()}finally{requestAnimationFrame(()=>{if(Yn--,a())return;let e=n();if(!e)return;let i=e.closest(`[data-workspace-pane]`),o=(e,t,n)=>{let r=e.getBoundingClientRect();if(!r.width||!r.height)return;let i=t.left-r.left,a=t.top-r.top,o=Math.max(.02,t.width/r.width),s=Math.max(.02,t.height/r.height),c=e.animate((n?[{transform:`translate(${i}px, ${a}px) scale(${o}, ${s})`,opacity:.4,offset:0},{transform:`translate(${i*.25}px, ${a*.35}px) scale(${o+(1-o)*.85}, ${s+(1-s)*.5})`,opacity:1,offset:.55},{transform:`none`,opacity:1,offset:1}]:[{transform:`translate(${i}px, ${a}px)`,width:`${t.width}px`,height:`${t.height}px`},{transform:`none`,width:`${r.width}px`,height:`${r.height}px`}]).map(e=>({...e,transformOrigin:`top left`})),{duration:320,easing:`cubic-bezier(0.2, 0.7, 0.2, 1)`});c.effect?.updateTiming({fill:`none`}),Y.add(c),c.finished.then(()=>Y.delete(c),()=>Y.delete(c))};for(let e of document.querySelectorAll(`[data-workspace-pane]`)){if(e.closest(`[data-motion-snapshot]`))continue;let n=r.get(e.dataset.workspacePane);if(e===i&&!n)o(e,t,!0);else if(n){let t=e.getBoundingClientRect();(n.x!==t.x||n.y!==t.y||n.width!==t.width||n.height!==t.height)&&o(e,n,!1)}}i&&e!==i&&r.has(i.dataset.workspacePane)&&o(e,t,!0);let s=new MutationObserver(()=>{if(a())for(let e of Y)e.cancel()});s.observe(document.documentElement,{attributes:!0,attributeFilter:[`data-reduce-motion`]}),Promise.allSettled([...Y].map(e=>e.finished)).then(()=>s.disconnect())})}}var X=n(),Qn=class extends O.Component{live=(0,O.createRef)();layers=(0,O.createRef)();animations=[];clear=()=>{this.animations.forEach(e=>e.cancel()),this.animations=[],this.layers.current?.replaceChildren()};getSnapshotBeforeUpdate(e){if(e.motionKey===this.props.motionKey||e.presentKeys?.includes(this.props.motionKey)&&this.props.presentKeys?.includes(e.motionKey)||e.preview&&this.props.preview||this.props.reduced||Xn())return null;let t=this.live.current;if(!t||!t.getBoundingClientRect().width)return null;let n=t.cloneNode(!0),r=t.querySelectorAll(`canvas`);n.querySelectorAll(`canvas`).forEach((e,t)=>{let n=r[t];if(!(!n||!n.width||!n.height))try{e.getContext(`2d`)?.drawImage(n,0,0)}catch{}}),n.querySelectorAll(`[data-motion-snapshot]`).forEach(e=>e.remove()),n.querySelectorAll(`iframe, audio, video, object, embed`).forEach(e=>e.remove());for(let e of[n,...n.querySelectorAll(`*`)])for(let t of e.getAttributeNames())(t===`id`||t===`autofocus`||t.startsWith(`data-`))&&e.removeAttribute(t);n.inert=!0,n.setAttribute(`aria-hidden`,`true`),n.dataset.motionSnapshot=``;let i=getComputedStyle(t),a=t.getBoundingClientRect();return n.style.width=`${a.width}px`,n.style.height=`${a.height}px`,n.style.opacity=i.opacity,n.style.scale=i.scale,n}componentDidUpdate(e,t,n){if(this.props.reduced||Xn()||e.motionKey!==this.props.motionKey&&e.presentKeys?.includes(this.props.motionKey)&&this.props.presentKeys?.includes(e.motionKey)||e.preview&&this.props.preview&&e.motionKey!==this.props.motionKey){this.clear();return}if(e.motionKey===this.props.motionKey)return;this.clear();let r=this.live.current;if(!r)return;n&&(this.layers.current?.append(n),this.animations.push(n.animate([{opacity:n.style.opacity,scale:n.style.scale},{opacity:0,scale:`0.97`}],{duration:180,easing:`ease-in`,fill:`forwards`})));let i=r.animate([{opacity:0,scale:`0.97`},{opacity:1,scale:`1`}],{duration:180,easing:`ease-out`});this.animations.push(i),i.finished.then(()=>{this.animations.includes(i)&&this.clear()},()=>{})}componentWillUnmount(){this.clear()}render(){return(0,X.jsxs)(`div`,{className:o(`relative min-h-0 min-w-0`,this.props.className),"data-content-motion":!0,children:[(0,X.jsx)(`div`,{ref:this.live,className:`size-full min-h-0 min-w-0`,children:this.props.children}),(0,X.jsx)(`div`,{ref:this.layers,className:`pointer-events-none absolute inset-0 z-30 overflow-hidden`,inert:!0,"aria-hidden":`true`})]})}};function $n(e){return(0,X.jsx)(Qn,{...e,reduced:i()})}var er=s(`corner-left-up`,[[`path`,{d:`M14 9 9 4 4 9`,key:`1af5af`}],[`path`,{d:`M20 20h-7a4 4 0 0 1-4-4V4`,key:`1blwi3`}]]),Z=`ContextMenu`,[tr,nr]=u(Z,[g]),Q=g(),[rr,ir]=tr(Z),ar=e=>{let{__scopeContextMenu:t,children:n,onOpenChange:r,open:i,dir:a,modal:o=!0}=e,s=O.useRef(!1);{let e=O.useRef(!1);O.useEffect(()=>{i===!0&&!s.current&&!e.current&&(e.current=!0,console.warn("ContextMenu: The `open` prop has been set to `true` before the user has interacted with the trigger, so its position is indeterminate. This is likely unintended and will result in the menu being anchored to the top-left corner of the viewport."))},[i])}let[c,l]=d({prop:i,defaultProp:!1,onChange:r,caller:Z}),u=Q(t);return(0,X.jsx)(rr,{scope:t,open:c,onOpenChange:l,modal:o,hasInteractedRef:s,children:(0,X.jsx)(b,{...u,dir:a,open:c,onOpenChange:l,modal:o,children:n})})};ar.displayName=Z;var or=`ContextMenuTrigger`,sr=O.forwardRef((e,t)=>{let{__scopeContextMenu:n,disabled:r=!1,...i}=e,a=ir(or,n),o=Q(n),[s,u]=O.useState({x:0,y:0}),d=O.useMemo(()=>({current:{getBoundingClientRect:()=>DOMRect.fromRect({width:0,height:0,...s})}}),[s]),f=O.useRef(0),p=O.useCallback(()=>window.clearTimeout(f.current),[]),m=e=>{a.hasInteractedRef.current=!0,u({x:e.clientX,y:e.clientY}),a.onOpenChange(!0)};return O.useEffect(()=>p,[p]),O.useEffect(()=>void(r&&p()),[r,p]),(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(se,{...o,virtualRef:d}),(0,X.jsx)(c.span,{"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,...i,ref:t,style:{WebkitTouchCallout:`none`,...e.style},onContextMenu:r?e.onContextMenu:l(e.onContextMenu,e=>{p(),m(e),e.preventDefault()}),onPointerDown:r?e.onPointerDown:l(e.onPointerDown,$(e=>{p(),a.open&&a.onOpenChange(!1),f.current=window.setTimeout(()=>m(e),700)})),onPointerMove:r?e.onPointerMove:l(e.onPointerMove,$(p)),onPointerCancel:r?e.onPointerCancel:l(e.onPointerCancel,$(p)),onPointerUp:r?e.onPointerUp:l(e.onPointerUp,$(p))})]})});sr.displayName=or;var cr=`ContextMenuPortal`,lr=e=>{let{__scopeContextMenu:t,...n}=e,r=Q(t);return(0,X.jsx)(C,{...r,...n})};lr.displayName=cr;var ur=`ContextMenuContent`,dr=O.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=ir(ur,n),a=Q(n),o=O.useRef(!1);return(0,X.jsx)(ee,{...a,...r,ref:t,side:`right`,sideOffset:2,align:`start`,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),!t.defaultPrevented&&o.current&&t.preventDefault(),o.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),!t.defaultPrevented&&!i.modal&&(o.current=!0)},style:{...e.style,"--radix-context-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-context-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-context-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-context-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-context-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});dr.displayName=ur;var fr=`ContextMenuGroup`,pr=O.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Q(n);return(0,X.jsx)(_,{...i,...r,ref:t})});pr.displayName=fr;var mr=`ContextMenuLabel`,hr=O.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Q(n);return(0,X.jsx)(v,{...i,...r,ref:t})});hr.displayName=mr;var gr=`ContextMenuItem`,_r=O.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Q(n);return(0,X.jsx)(re,{...i,...r,ref:t})});_r.displayName=gr;var vr=`ContextMenuCheckboxItem`,yr=O.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Q(n);return(0,X.jsx)(ae,{...i,...r,ref:t})});yr.displayName=vr;var br=`ContextMenuRadioGroup`,xr=O.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Q(n);return(0,X.jsx)(ce,{...i,...r,ref:t})});xr.displayName=br;var Sr=`ContextMenuRadioItem`,Cr=O.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Q(n);return(0,X.jsx)(y,{...i,...r,ref:t})});Cr.displayName=Sr;var wr=`ContextMenuItemIndicator`,Tr=O.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Q(n);return(0,X.jsx)(oe,{...i,...r,ref:t})});Tr.displayName=wr;var Er=`ContextMenuSeparator`,Dr=O.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Q(n);return(0,X.jsx)(ie,{...i,...r,ref:t})});Dr.displayName=Er;var Or=`ContextMenuArrow`,kr=O.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Q(n);return(0,X.jsx)(ne,{...i,...r,ref:t})});kr.displayName=Or;var Ar=`ContextMenuSub`,jr=e=>{let{__scopeContextMenu:t,children:n,onOpenChange:r,open:i,defaultOpen:a}=e,o=Q(t),[s,c]=d({prop:i,defaultProp:a??!1,onChange:r,caller:Ar});return(0,X.jsx)(te,{...o,open:s,onOpenChange:c,children:n})};jr.displayName=Ar;var Mr=`ContextMenuSubTrigger`,Nr=O.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Q(n);return(0,X.jsx)(x,{...i,...r,ref:t})});Nr.displayName=Mr;var Pr=`ContextMenuSubContent`,Fr=O.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Q(n);return(0,X.jsx)(S,{...i,...r,ref:t,style:{...e.style,"--radix-context-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-context-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-context-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-context-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-context-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});Fr.displayName=Pr;function $(e){return t=>t.pointerType===`mouse`?void 0:e(t)}var Ir=ar,Lr=sr,Rr=lr,zr=dr,Br=_r,Vr=Dr,Hr=jr,Ur=Nr,Wr=Fr,Gr=Ir,Kr=Lr,qr=Hr;function Jr({className:e,...t}){return(0,X.jsx)(Rr,{children:(0,X.jsx)(zr,{className:o(`z-50 min-w-36 overflow-hidden`,p,`overlay-context-menu-motion`,e),...t})})}function Yr({className:e,...t}){return(0,X.jsx)(Br,{className:o(f,h,`[&_svg]:size-3.5`,e),...t})}function Xr({className:e,children:t,...n}){return(0,X.jsxs)(Ur,{className:o(f,h,`data-[state=open]:bg-action data-[state=open]:text-action-ink [&_svg]:size-3.5`,e),...n,children:[t,(0,X.jsx)(m,{className:`ml-auto`})]})}function Zr({className:e,...t}){return(0,X.jsx)(Rr,{children:(0,X.jsx)(Wr,{className:o(`z-50 min-w-36 overflow-hidden`,p,`overlay-context-menu-motion`,e),...t})})}function Qr({className:e,...t}){return(0,X.jsx)(Vr,{className:o(`-mx-1 my-1 h-px bg-border`,e),...t})}function $r(){return{onClick:e=>{e.detail===2&&e.preventDefault()},onDoubleClick:e=>{e.preventDefault(),e.currentTarget.dispatchEvent(new MouseEvent(`contextmenu`,{bubbles:!0,cancelable:!0,clientX:e.clientX,clientY:e.clientY,button:2}))}}}function ei(e){let t=Date.parse(e.created_at);return Number.isNaN(t)?0:t}function ti(e,t){let n=new Map(t.map((e,t)=>[e,t])),r=[],i=[];for(let t of e)(n.has(t.id)?r:i).push(t);return r.sort((e,t)=>n.get(e.id)-n.get(t.id)),i.sort((e,t)=>ei(t)-ei(e)),[...i,...r]}function ni(e,t,n){if(t===n)return[...e];let r=e.filter(e=>e!==t),i=r.indexOf(n);return i===-1?[...e]:(r.splice(i,0,t),r)}function ri(e,t,n){if(t===n)return null;let r=e.find(e=>e.sessions.some(e=>e.id===t));if(!r||!r.sessions.some(e=>e.id===n))return null;let i=e.flatMap(e=>e.sessions.map(e=>e.id)),a=ni(i,t,n);return a.some((e,t)=>e!==i[t])?a:null}function ii(e,t){let n=new Set(e);return[...e,...t.filter(e=>!n.has(e))]}export{xt as C,R as S,jn as _,Gr as a,Jt as b,Qr as c,Xr as d,Kr as f,Zn as g,$n as h,ni as i,qr as l,er as m,ri as n,Jr as o,$r as p,ti as r,Yr as s,ii as t,Zr as u,Nn as v,Tt as w,Xt as x,qt as y};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./createLucideIcon-C9A1vLE-.js";var t=e(`square-terminal`,[[`path`,{d:`m7 11 2-2-2-2`,key:`1lz0vl`}],[`path`,{d:`M11 13h4`,key:`1p7l4v`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}]]);export{t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{U as n}from"./auth-C3ruG3fE.js";import{t as r}from"./jsx-runtime-By8HlURe.js";import{n as i,t as a}from"./createLucideIcon-C9A1vLE-.js";import{C as o,E as s,T as c,g as l}from"./dialog-DtvE8ATK.js";import{a as u}from"./dist-DZg8Dwbr.js";import{r as d,x as f}from"./dist-Dac0re_p.js";import{t as p}from"./dist-BeQvHdsz.js";var m=a(`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`}]]),h=a(`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`}]]),g=a(`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`}]]),_=a(`user-round`,[[`circle`,{cx:`12`,cy:`8`,r:`5`,key:`1hypcn`}],[`path`,{d:`M20 21a8 8 0 0 0-16 0`,key:`rfgkzh`}]]),v=a(`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`}]]),y=r();function b({summary:e,summaryClassName:t,className:n,children:r,...a}){return(0,y.jsxs)(`details`,{className:i(`[&[open]>summary>svg]:rotate-90`,n),...a,children:[(0,y.jsxs)(`summary`,{className:i(`flex cursor-pointer select-none list-none items-center gap-1 text-fg-secondary transition-colors hover:text-fg [&::-webkit-details-marker]:hidden`,t),children:[(0,y.jsx)(d,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),e]}),r]})}var x=e(t(),1),S=new Set;function C(e){let t=/^#settings\/([\w-]+)$/.exec(e);return t?t[1]:null}var w=C(window.location.hash);function T(){let e=w?`#settings/${w}`:``;window.location.hash!==e&&history.replaceState(null,``,window.location.pathname+window.location.search+e)}function E(e){if(e!==w){w=e;for(let e of S)e()}queueMicrotask(T)}window.addEventListener(`hashchange`,()=>E(C(window.location.hash))),window.addEventListener(`popstate`,()=>E(C(window.location.hash)));function D(){return(0,x.useSyncExternalStore)(e=>(S.add(e),()=>{S.delete(e)}),()=>w)}function O(e=`appearance`){E(e)}function k(){E(null)}function A(e){return e.title??e.agent_title??e.osc_title??e.id.slice(0,8)}var j=` — `;function M(e){return e.replace(/\/+$/,``).split(`/`).pop()??``}function N(e){return{name:A(e),title:e.title??``,agentName:e.agent_title??``,sequence:e.osc_title??``,branch:e.branch,cwd:M(e.worktree_path),id:e.id.slice(0,8),status:e.status,agent:e.agent_type??``}}function P(e,t){let r=t&&t.length>0?t:n,i=N(e),a=[];for(let e of r.split(/(\$\{[a-zA-Z]+\})/)){if(e===``)continue;let t=/^\$\{([a-zA-Z]+)\}$/.exec(e)?.[1];t===void 0?a.push({text:e,sep:!1}):t===`separator`?a.push({text:j,sep:!0}):a.push({text:i[t]??e,sep:!1})}let o=[];a.forEach((e,t)=>{if(!e.sep){o.push(e.text);return}let n=o.join(``).trim().length>0,r=a.slice(t+1).some(e=>!e.sep&&e.text.trim().length>0);n&&r&&o.push(e.text)});let s=o.join(``).trim();return s.length>0?s:e.id.slice(0,8)}var F=`Switch`,[I,L]=c(F),[R,z]=I(F);function B(e){let{__scopeSwitch:t,checked:n,children:r,defaultChecked:i,disabled:a,form:o,name:s,onCheckedChange:c,required:u,value:d=`on`,internal_do_not_use_render:f}=e,[p,m]=l({prop:n,defaultProp:i??!1,onChange:c,caller:F}),[h,g]=x.useState(null),[_,v]=x.useState(null),b={checked:p,setChecked:m,disabled:a,control:h,setControl:g,name:s,form:o,value:d,hasConsumerStoppedPropagationRef:x.useRef(!1),required:u,defaultChecked:i,isFormControl:!h||!!o||!!h.closest(`form`),bubbleInput:_,setBubbleInput:v};return(0,y.jsx)(R,{scope:t,...b,children:J(f)?f(b):r})}var V=`SwitchTrigger`,H=x.forwardRef(({__scopeSwitch:e,onClick:t,...n},r)=>{let{control:i,form:a,value:c,disabled:l,checked:d,required:f,setControl:p,setChecked:m,hasConsumerStoppedPropagationRef:h,isFormControl:g,bubbleInput:_}=z(V,e),v=u(r,p),b=x.useRef(d);return x.useEffect(()=>{let e=a?i?.ownerDocument.getElementById(a):i?.form;if(e instanceof HTMLFormElement){let t=()=>m(b.current);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[i,a,m]),(0,y.jsx)(o.button,{type:`button`,role:`switch`,"aria-checked":d,"aria-required":f,"data-state":Y(d),"data-disabled":l?``:void 0,disabled:l,value:c,...n,ref:v,onClick:s(t,e=>{m(e=>!e),_&&g&&(h.current=e.isPropagationStopped(),h.current||e.stopPropagation())})})});H.displayName=V;var U=x.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,y.jsx)(B,{__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,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(H,{...d,ref:t,__scopeSwitch:n}),e&&(0,y.jsx)(q,{__scopeSwitch:n})]})})});U.displayName=F;var W=`SwitchThumb`,G=x.forwardRef((e,t)=>{let{__scopeSwitch:n,...r}=e,i=z(W,n);return(0,y.jsx)(o.span,{"data-state":Y(i.checked),"data-disabled":i.disabled?``:void 0,...r,ref:t})});G.displayName=W;var K=`SwitchBubbleInput`,q=x.forwardRef(({__scopeSwitch:e,...t},n)=>{let{control:r,hasConsumerStoppedPropagationRef:i,checked:a,defaultChecked:s,required:c,disabled:l,name:d,value:m,form:h,bubbleInput:g,setBubbleInput:_}=z(K,e),v=u(n,_),b=p(a),S=f(r);x.useEffect(()=>{let e=g;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set,r=!i.current;if(b!==a&&n){let t=new Event(`click`,{bubbles:r});n.call(e,a),e.dispatchEvent(t)}},[g,b,a,i]);let C=x.useRef(a);return(0,y.jsx)(o.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:s??C.current,required:c,disabled:l,name:d,value:m,form:h,...t,tabIndex:-1,ref:v,style:{...t.style,...S,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})});q.displayName=K;function J(e){return typeof e==`function`}function Y(e){return e?`checked`:`unchecked`}function X({className:e,...t}){return(0,y.jsx)(U,{className:i(`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,y.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,y.jsx)(G,{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{D as a,_ as c,m as d,O as i,g as l,P as n,b as o,k as r,v as s,X as t,h as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{E as n,lt as r,w as i}from"./protocol-support-BwRR1kRO.js";import{F as a}from"./auth-C3ruG3fE.js";import{t as o}from"./jsx-runtime-By8HlURe.js";import{y as s}from"./ws-DjQ6OZLM.js";import{n as c,t as l}from"./createLucideIcon-C9A1vLE-.js";import{C as u,E as d,T as f,_ as p,g as ee,v as m,x as h,y as te}from"./dialog-DtvE8ATK.js";import{a as g,r as _}from"./dist-DZg8Dwbr.js";import{_ as v,b as y,g as b,p as x,s as S,v as ne,y as re}from"./dist-Dac0re_p.js";import{i as ie}from"./dist-BeQvHdsz.js";import{c as ae,n as oe}from"./switch-DYr-iPWY.js";import{a as C,n as se,o as w}from"./preview-kind-CPkO-rSz.js";import{t as ce}from"./debounce-B9DrqirV.js";var T=e(t(),1),E=o(),[D,le]=f(`Tooltip`,[y]),O=y(),ue=`TooltipProvider`,de=700,fe=`tooltip.open`,[pe,k]=D(ue),me=e=>{let{__scopeTooltip:t,delayDuration:n=de,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)(pe,{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})};me.displayName=ue;var A=`Tooltip`,[he,j]=D(A),ge=e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:s}=e,c=k(A,e.__scopeTooltip),l=O(t),[u,d]=T.useState(null),f=te(),p=T.useRef(0),m=o??c.disableHoverableContent,h=s??c.delayDuration,g=T.useRef(!1),[_,v]=ee({prop:r,defaultProp:i??!1,onChange:e=>{e?(c.onOpen(),document.dispatchEvent(new CustomEvent(fe))):c.onClose(),a?.(e)},caller:A}),y=T.useMemo(()=>_?g.current?`delayed-open`:`instant-open`:`closed`,[_]),b=T.useCallback(()=>{window.clearTimeout(p.current),p.current=0,g.current=!1,v(!0)},[v]),x=T.useCallback(()=>{window.clearTimeout(p.current),p.current=0,v(!1)},[v]),S=T.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{g.current=!0,v(!0),p.current=0},h)},[h,v]);return T.useEffect(()=>()=>{p.current&&=(window.clearTimeout(p.current),0)},[]),(0,E.jsx)(re,{...l,children:(0,E.jsx)(he,{scope:t,contentId:f,open:_,stateAttribute:y,trigger:u,onTriggerChange:d,onTriggerEnter:T.useCallback(()=>{c.isOpenDelayedRef.current?S():b()},[c.isOpenDelayedRef,S,b]),onTriggerLeave:T.useCallback(()=>{m?x():(window.clearTimeout(p.current),p.current=0)},[x,m]),onOpen:b,onClose:x,disableHoverableContent:m,children:n})})};ge.displayName=A;var M=`TooltipTrigger`,_e=T.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=j(M,n),a=k(M,n),o=O(n),s=g(t,T.useRef(null),i.onTriggerChange),c=T.useRef(!1),l=T.useRef(!1),f=T.useCallback(()=>c.current=!1,[]);return T.useEffect(()=>()=>document.removeEventListener(`pointerup`,f),[f]),(0,E.jsx)(b,{asChild:!0,...o,children:(0,E.jsx)(u.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:s,onPointerMove:d(e.onPointerMove,e=>{e.pointerType!==`touch`&&!l.current&&!a.isPointerInTransitRef.current&&(i.onTriggerEnter(),l.current=!0)}),onPointerLeave:d(e.onPointerLeave,()=>{i.onTriggerLeave(),l.current=!1}),onPointerDown:d(e.onPointerDown,()=>{i.open&&i.onClose(),c.current=!0,document.addEventListener(`pointerup`,f,{once:!0})}),onFocus:d(e.onFocus,()=>{c.current||i.onOpen()}),onBlur:d(e.onBlur,i.onClose),onClick:d(e.onClick,i.onClose)})})});_e.displayName=M;var N=`TooltipPortal`,[ve,ye]=D(N,{forceMount:void 0}),be=e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=j(N,t);return(0,E.jsx)(ve,{scope:t,forceMount:n,children:(0,E.jsx)(p,{present:n||a.open,children:(0,E.jsx)(m,{asChild:!0,container:i,children:r})})})};be.displayName=N;var P=`TooltipContent`,xe=T.forwardRef((e,t)=>{let n=ye(P,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=j(P,e.__scopeTooltip);return(0,E.jsx)(p,{present:r||o.open,children:o.disableHoverableContent?(0,E.jsx)(Ee,{side:i,...a,ref:t}):(0,E.jsx)(Se,{side:i,...a,ref:t})})}),Se=T.forwardRef((e,t)=>{let n=j(P,e.__scopeTooltip),r=k(P,e.__scopeTooltip),i=T.useRef(null),a=g(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=Ae(r,ke(r,n.getBoundingClientRect())),a=je(t.getBoundingClientRect()),o=Ne([...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=!Me(n,o);r?f():i&&(f(),l())};return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[c,u,o,l,f]),(0,E.jsx)(Ee,{...e,ref:a})}),[Ce,we]=D(A,{isInside:!1}),Te=_(`TooltipContent`),Ee=T.forwardRef((e,t)=>{let{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:a,onPointerDownOutside:o,...s}=e,c=j(P,n),l=O(n),{onClose:u}=c;return T.useEffect(()=>(document.addEventListener(fe,u),()=>document.removeEventListener(fe,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)(h,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:u,children:(0,E.jsxs)(ne,{"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)(Te,{children:r}),(0,E.jsx)(Ce,{scope:n,isInside:!0,children:(0,E.jsx)(ie,{id:c.contentId,role:`tooltip`,children:i||r})})]})})});xe.displayName=P;var De=`TooltipArrow`,Oe=T.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=O(n);return we(De,n).isInside?null:(0,E.jsx)(v,{...i,...r,ref:t})});Oe.displayName=De;function ke(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 Ae(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 je(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 Me(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)),Pe(t)}function Pe(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 Fe=me,Ie=ge,Le=_e,Re=be,ze=xe,Be=Fe,Ve=Ie,He=Le;function Ue({className:e,sideOffset:t=4,...n}){return(0,E.jsx)(Re,{children:(0,E.jsx)(ze,{sideOffset:t,className:c(`z-50 overflow-hidden px-2 py-1 text-xs text-fg`,S,x,`overlay-tooltip-motion`,e),...n})})}var We=l(`triangle-alert`,[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]);function Ge({initial:e,maxLength:t,className:n,fitContent:r=!1,onCommit:i,onCancel:a}){let[o,s]=(0,T.useState)(e),l=(0,E.jsx)(`input`,{autoFocus:!0,value:o,maxLength:t,onFocus:e=>e.currentTarget.select(),onChange:e=>s(e.target.value),onBlur:()=>i(o),onKeyDown:e=>{e.stopPropagation(),e.key===`Enter`?i(o):e.key===`Escape`&&a()},className:c(`bg-transparent outline-none`,r?`col-start-1 row-start-1 w-0 min-w-full p-0`:n)});return r?(0,E.jsxs)(`span`,{className:c(`inline-grid min-w-px`,n),children:[(0,E.jsx)(`span`,{"aria-hidden":`true`,className:`invisible col-start-1 row-start-1 whitespace-pre`,children:o||``}),l]}):l}function Ke(e){return{onClick:e=>{e.detail===2&&e.preventDefault()},onDoubleClick:t=>{t.preventDefault(),e()}}}var F=null;function qe(e){return F=e,()=>{F===e&&(F=null)}}function Je(){F?.()}var I=null;function Ye(e){return I=e,()=>{I===e&&(I=null)}}async function Xe(e){if(!I)throw Error(`Open a project before opening a path.`);await I(e)}function Ze(){let e=r(s()??void 0).data?.tabTitleTemplate;return(0,T.useCallback)(t=>oe(t,e),[e])}var Qe=(0,T.createContext)({open:()=>void 0,handler:null,setHandler:()=>void 0});function $e({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)(Qe.Provider,{value:a,children:e})}function et(){return(0,T.useContext)(Qe)}function tt({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 nt({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 rt({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 it({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 at({type:e,className:t,strokeScale:n=1}){switch(e){case`claude-code`:return(0,E.jsx)(tt,{className:t,strokeScale:n});case`codex`:return(0,E.jsx)(nt,{className:t,strokeScale:n});case`opencode`:return(0,E.jsx)(rt,{className:t,strokeScale:n});case`gemini-cli`:return(0,E.jsx)(it,{className:t});default:return(0,E.jsx)(ae,{className:t,strokeWidth:2*n})}}var L=new Set,R=!1,ot=null;function st(){for(let e of L)e()}function ct(e){return L.add(e),()=>L.delete(e)}function lt(e){R!==e&&(R=e,st())}function ut(){lt(!R)}function dt(){return(0,T.useSyncExternalStore)(ct,()=>R)}function ft(e){ot=e,st()}function pt(){return(0,T.useSyncExternalStore)(ct,()=>ot)}function z(){return crypto.randomUUID()}function B(e){return e.type===`terminal`?`term:${e.session}`:`editor:${C(e.tab)}`}function V(e,t){return B(e)===B(t)}function mt(e){return e.type===`terminal`}function ht(e){return e.type===`editor`&&(e.tab.view===`linked`||e.tab.view===`locked`)}function H(e=[],t){let n=e.map(B),r=t&&n.includes(t)?t:n.length>0?n[0]:null;return{kind:`leaf`,id:z(),tabs:e,activeKey:r,previewKey:null}}function U(e,t,n){return{kind:`split`,id:z(),direction:e,children:t,sizes:n??t.map(()=>100/Math.max(1,t.length))}}function W(e,t){if(e.kind===`leaf`)return e.id===t?e:null;for(let n of e.children){let e=W(n,t);if(e)return e}return null}function G(e,t){if(e.kind===`leaf`)return e.tabs.some(e=>B(e)===t)?e:null;for(let n of e.children){let e=G(n,t);if(e)return e}return null}function K(e){return e.kind===`leaf`?[e]:e.children.flatMap(K)}function q(e){return K(e).flatMap(e=>e.tabs)}function gt(e){return e.kind===`leaf`?[e.id]:[e.id,...e.children.flatMap(gt)]}function _t(e){let t=gt(e);return new Set(t).size!==t.length}function vt(e){return e.kind===`leaf`?{...e,id:z()}:{...e,id:z(),children:e.children.map(vt)}}function yt(e){if(!_t(e))return e;let t=new Set,n=e=>{let r=t.has(e.id)?z():e.id;return t.add(r),e.kind===`leaf`?{...e,id:r}:{...e,id:r,children:e.children.map(n)}};return n(e)}function bt(e){let t=e.tabs.map(B),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 J(e){if(e.kind===`leaf`)return bt(e);let t=e.children.map(J),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?H([]):i.length===1?i[0]:{...e,children:i,sizes:a}}function Y(e,t,n){return e.kind===`leaf`?e.id===t?n(e):e:{...e,children:e.children.map(e=>Y(e,t,n))}}function xt(e,t,n){return Y(e,t,e=>{if(!e.tabs.some(e=>B(e)===n))return e;let t=e.tabs.filter(e=>B(e)!==n),r=e.activeKey===n?St(e,n):e.activeKey;return{...e,tabs:t,activeKey:r}})}function St(e,t){let n=e.tabs.findIndex(e=>B(e)===t);if(n===-1)return e.activeKey;let r=e.tabs.filter(e=>B(e)!==t);return r.length===0?null:B(r[Math.min(n,r.length-1)])}function Ct(e,t,n){let r=e.tabs.filter(e=>!V(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:B(t)}}function wt(e,t,n,r){let i=n===`left`||n===`right`?`row`:`col`,a=n===`left`||n===`top`;return J(Y(e,t,e=>{let t=H([r]);return U(i,a?[t,e]:[e,t],[50,50])}))}function Tt(e,t){let{fromLeafId:n,toLeafId:r,edge:i}=t;if(n===r)return e;let a=W(e,n),o=W(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)}let s=J(Y(e,n,e=>({...e,tabs:[],activeKey:null,previewKey:null}))),c=i===`left`||i===`right`?`row`:`col`,l=i===`left`||i===`top`;return J(Y(s,r,e=>U(c,l?[a,e]:[e,a],[50,50])))}function Et(e,t){let{ref:n,toLeafId:r,edge:i}=t,a=B(n),o=t.copy===!0&&!mt(n),s=t.index;if(i===`center`&&s!==void 0){let t=W(e,r)?.tabs.findIndex(e=>B(e)===a)??-1;t!==-1&&t<s&&--s}let c=o?e:xt(e,t.fromLeafId,a);if(i===`center`){let e=Y(c,r,e=>Ct(e,n,s));return!W(e,r)&&!G(e,a)?X(J(Dt(e,n)),a):X(J(e),a)}return W(c,r)?X(wt(c,r,i,n),a):J(H([n]))}function Dt(e,t){let n=K(e)[0];return n?Y(e,n.id,e=>Ct(e,t)):H([t])}function Ot(e,t,n){return J(Y(e,t,e=>e.tabs.some(e=>B(e)===n)?{...e,tabs:e.tabs.filter(e=>B(e)!==n),activeKey:e.activeKey===n?St(e,n):e.activeKey}:e))}function kt(e,t,n){let r=B(n);return J(Y(e,t,e=>{let t=e.previewKey===r?null:e.previewKey;return e.tabs.some(e=>V(e,n))?{...e,activeKey:r,previewKey:t}:{...e,tabs:[...e.tabs,n],activeKey:r,previewKey:t}}))}function At(e,t,n){let r=B(n);return J(Y(e,t,e=>e.tabs.some(e=>B(e)===r)?{...e,tabs:e.tabs.map(e=>B(e)===r?n:e),previewKey:e.previewKey===r?null:e.previewKey}:{...e,tabs:[...e.tabs,n]}))}function jt(e,t,n){let r=B(n);return Y(e,t,e=>({...e,tabs:e.tabs.map(e=>B(e)===r?n:e)}))}function Mt(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 Nt(e,t){return e.type!==`editor`||t.type!==`editor`||e.tab.view!==`preview`||t.tab.view!==void 0||se(t.tab.path)===null?t:{...t,tab:{...t.tab,view:`preview`}}}function Pt(e,t,n){let r=B(n);return J(Y(e,t,e=>{if(e.tabs.some(e=>V(e,n)))return{...e,activeKey:r};let t=e.previewKey?e.tabs.findIndex(t=>B(t)===e.previewKey):-1,i=t>=0?e.tabs[t]:void 0,a=e.tabs.length>1&&i!==void 0&&!mt(i)&&!ht(i),o=i?Nt(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 X(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 Ft(e,t,n,r){return Y(e,t,e=>{let t=e.tabs.findIndex(e=>e.type===`editor`&&B(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=B(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&&B(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 It(e,t){let n=w(e);return n!==`commit`&&n!==`untitled`&&e.session===t.session&&e.path===t.path&&e.root===t.root}function Lt(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`||!It(e.tab,t))return e;let r={...e,tab:{...e.tab,path:n}};return a.set(B(e),B(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 Rt(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`||se(t.path)===null?null:t}function zt(e,t){let n=Rt(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`||!ht(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 Bt(e,t){return e.session===t.session&&e.path===t.path&&(e.root??``)===(t.root??``)&&w(e)===w(t)}function Vt(e,t,n){let r=K(e).flatMap(e=>e.tabs.flatMap(n=>n.type!==`editor`||n.tab.view===`linked`||n.tab.view===`locked`||!Bt(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 Ht(e,t,n){return Y(e,t,e=>e.tabs.some(e=>B(e)===n)?{...e,activeKey:n}:e)}function Ut(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 Wt(e){let t=e.type===`terminal`?e.session:e.tab.session;return t===`00000000-0000-0000-0000-000000000000`?null:t}function Gt(e){return t=>{let n=Wt(t);return n===null||e.has(n)}}function Z(e,t){let n=e=>e.kind===`leaf`?{...e,tabs:e.tabs.filter(t)}:{...e,children:e.children.map(n)};return J(n(e))}function Kt(e){let t=new Set,n=[];for(let r of e){let e=J(Z(r,e=>!t.has(B(e)))),i=q(e);if(i.length!==0){for(let e of i)t.add(B(e));n.push(e)}}return n.length===0?H([]):yt(n.length===1?n[0]:J(U(`row`,n)))}function qt(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?B({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 H([]);if(t.length===0)return H(n,i);if(n.length===0)return H(t,r);let a=e.layout,o=typeof a.editor==`number`?a.editor:40,s=typeof a.session==`number`?a.session:60;return J(U(`col`,[H(t,r),H(n,i)],[o,s]))}function Jt(e){return JSON.stringify(Yt(e))}function Yt(e){return e===null?null:e.kind===`leaf`?e.tabs.length===0?null:{t:e.tabs.map(B)}:{d:e.direction,s:e.sizes.map(e=>Math.round(e*10)/10),c:e.children.map(Yt)}}var Q=new Set,$=!1,Xt=null;function Zt(){for(let e of Q)e()}function Qt(e){return Q.add(e),()=>Q.delete(e)}function $t(e){$!==e&&($=e,Zt())}function en(){$t(!$)}function tn(){return(0,T.useSyncExternalStore)(Qt,()=>$)}function nn(e){Xt=e,Zt()}function rn(){return(0,T.useSyncExternalStore)(Qt,()=>Xt)}var an={layout_tree:null,active_session:null,layout_ref:null};function on(e){return e.type===`terminal`?e.session:e.tab.session}function sn(e,t){let n=new Set;for(let[r,i]of Object.entries(e))if(!(r===t||!i.layout_tree))for(let e of q(i.layout_tree))e.type===`terminal`&&n.add(e.session);return[...n]}function cn(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 ln(e,t,n){return n?{loaded:e.loaded,snapshot:cn(e.snapshot,t),current:()=>cn(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]??an,...r}}}Object.keys(i).length>0&&e.update(i)}}:e}function un(e,t,n,r){let i=e.layout_tree??qt(e),a={};for(let o of t)a[o]={layout_tree:vt(Z(i,e=>{let i=on(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 dn(e,t,n={}){return{...e,...t,...n}}function fn(e,t,n){let r=t.layout_tree?Z(t.layout_tree,e=>{let t=on(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=un(e,n.projectIds,n.sessionProject,a);return{projectBased:!0,patch:{...s,project_layouts:dn(s.project_layouts??{},e.project_layouts,{[a]:o})}}}function pn(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:Kt(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 mn=2e3,hn=a.parse({});function gn(e){return`puddle.ws.${e}`}function _n(e){if(e===null)return{kind:`absent`};try{return{kind:`present`,snapshot:a.parse(JSON.parse(e))}}catch{return{kind:`corrupt`}}}function vn(){let e=s(),[t,r]=(0,T.useState)(!1),[a,o]=(0,T.useState)(hn),c=(0,T.useRef)(a);c.current=a;let l=(0,T.useRef)(null),u=(0,T.useMemo)(()=>ce((e,t)=>{n(e,t).catch(e=>console.warn(`ui-state save failed: ${e.message}`))},mn),[]);return(0,T.useEffect)(()=>{if(e===null){l.current=null;return}let t=gn(e);l.current=t;let n=!1;r(!1),o(hn);let a;try{a=_n(sessionStorage.getItem(t)),a.kind===`corrupt`&&sessionStorage.removeItem(t)}catch(e){console.warn(`ui-state read failed: ${e.message}`),a={kind:`absent`}}return a.kind===`present`?(o(a.snapshot),r(!0)):i(e).then(e=>{n||(e&&o(e.ui_state),r(!0))}).catch(e=>{console.warn(`ui-state load failed: ${e.message}`),n||r(!0)}),()=>{n=!0,u.flush()}},[e,u]),{loaded:t,snapshot:a,current:()=>c.current,update(t){if(e===null)return;let n={...c.current,...t};c.current=n,o(n);let r=l.current??gn(e);u(e,n);try{sessionStorage.setItem(r,JSON.stringify(n))}catch(e){console.warn(`ui-state write failed: ${e.message}`)}}}}export{Je as $,H as A,B,Tt as C,Ht as D,q as E,Ut as F,pt as G,ft as H,zt as I,$e as J,dt as K,Mt as L,X as M,Z as N,G as O,Lt as P,Ye as Q,Ft as R,yt as S,W as T,lt as U,jt as V,ut as W,Ze as X,et as Y,Xe as Z,kt as _,dn as a,Ue as at,qt as b,un as c,$t as d,qe as et,en as f,At as g,Jt as h,fn as i,Ve as it,Pt as j,Rt as k,pn as l,tn as m,vn as n,Ke as nt,sn as o,Be as ot,rn as p,at as q,gn as r,We as rt,ln as s,He as st,_n as t,Ge as tt,nn as u,K as v,Et as w,Ot as x,Gt as y,Vt as z};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{a as n}from"./auth-C3ruG3fE.js";var r=e(t(),1),i=(0,r.createContext)(``);function a(e,t){let a=(0,r.useContext)(i);return n(JSON.stringify([a,e,t]))}var o=class{limit;entries=new Map;constructor(e=500){this.limit=e}get(e){let t=this.entries.get(e);return t!==void 0&&(this.entries.delete(e),this.entries.set(e,t)),t}set(e,t){for(this.entries.delete(e),this.entries.set(e,t);this.entries.size>this.limit;){let e=this.entries.keys().next().value;if(e===void 0)break;this.entries.delete(e)}}};export{i as n,a as r,o as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./createLucideIcon-C9A1vLE-.js";var t=e(`waves-horizontal`,[[`path`,{d:`M2 12q2.5 2 5 0t5 0 5 0 5 0`,key:`8ddzzs`}],[`path`,{d:`M2 19q2.5 2 5 0t5 0 5 0 5 0`,key:`1wj4st`}],[`path`,{d:`M2 5q2.5 2 5 0t5 0 5 0 5 0`,key:`69x50u`}]]);export{t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{i as n,n as r,o as i,r as a}from"./auth-C3ruG3fE.js";import{n as o}from"./dist-BOS6OKSE.js";var s=e(t(),1);function c(){return window.puddleDesktop}function l(){let[e,t]=(0,s.useState)({fullScreen:!1,animate:!1});return(0,s.useEffect)(()=>{let e=c();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 u=n(`puddle.profile-id`);function d(){let e=(0,s.useSyncExternalStore)(u.subscribe,u.get);return e!==null&&/^[0-9a-f]{10}$/.test(e)?e:null}function f(e){window.location.pathname!==`/`&&window.history.replaceState(null,``,`/`),u.set(e)}var p=[`Layout & tabs`,`Projects`,`Editor`,`Left sidebar`,`Right sidebar`],m=Array.from({length:10},(e,t)=>({id:`project.switch${t}`,label:`Switch to project ${t+1}`,group:`Projects`,defaultBinding:`meta+Digit${t}`})),h=[...m,{id:`host.peek`,label:`Show host identity (hold)`,group:`Layout & tabs`,defaultBinding:typeof navigator<`u`&&/Mac/.test(navigator.platform)?`alt+meta+Slash`:`ctrl+alt+Slash`,hold:!0},{id:`palette.toggle`,label:`Command palette`,group:`Layout & tabs`,defaultBinding:`meta+KeyK`},{id:`tab.close`,label:`Close current tab`,group:`Layout & tabs`,defaultBinding:`ctrl+alt+KeyW`,desktopBinding:`meta+KeyW`},{id:`tab.reopen`,label:`Reopen last closed tab`,group:`Layout & tabs`,defaultBinding:`ctrl+alt+KeyT`,desktopBinding:`shift+meta+KeyT`},{id:`tab.newUntitled`,label:`New untitled file`,group:`Layout & tabs`,defaultBinding:`ctrl+alt+KeyN`,desktopBinding:`meta+KeyN`},{id:`tab.next`,label:`Next tab in pane`,group:`Layout & tabs`,defaultBinding:`ctrl+alt+BracketRight`,desktopBinding:`ctrl+Tab`},{id:`tab.prev`,label:`Previous tab in pane`,group:`Layout & tabs`,defaultBinding:`ctrl+alt+BracketLeft`,desktopBinding:`ctrl+shift+Tab`},{id:`window.close`,label:`Close window`,group:`Layout & tabs`,defaultBinding:`meta+KeyW`,desktopBinding:`shift+meta+KeyW`},{id:`sidebar.left`,label:`Toggle left sidebar`,group:`Layout & tabs`,defaultBinding:`alt+meta+Comma`,desktopBinding:`meta+KeyB`},{id:`sidebar.right`,label:`Toggle right sidebar`,group:`Layout & tabs`,defaultBinding:`alt+meta+Period`,desktopBinding:`shift+meta+KeyB`},{id:`editor.save`,label:`Save`,group:`Editor`,defaultBinding:`meta+KeyS`,editor:!0},{id:`editor.wordWrap`,label:`Toggle word wrap`,group:`Editor`,defaultBinding:`alt+KeyZ`,editor:!0},{id:`nav.files`,label:`Open Files`,group:`Left sidebar`,defaultBinding:`alt+meta+KeyE`},{id:`nav.search`,label:`Open Search`,group:`Left sidebar`,defaultBinding:`alt+meta+KeyF`},{id:`nav.changes`,label:`Open Changes`,group:`Left sidebar`,defaultBinding:`alt+meta+KeyV`},{id:`nav.worktrees`,label:`Open Worktrees`,group:`Left sidebar`,defaultBinding:`alt+meta+KeyB`},{id:`session.newAgent`,label:`New agent`,group:`Right sidebar`,defaultBinding:`ctrl+alt+Backquote`,desktopBinding:`meta+KeyT`},{id:`session.newTerminal`,label:`New terminal`,group:`Right sidebar`,defaultBinding:`ctrl+Backquote`},{id:`scratchpad.toggle`,label:`Toggle Scratchpad`,group:`Right sidebar`,defaultBinding:`alt+meta+KeyS`},{id:`layouts.toggle`,label:`Toggle Layouts`,group:`Right sidebar`,defaultBinding:`alt+meta+KeyL`}],g=new Map(h.map(e=>[e.id,e])),_=typeof window<`u`&&c()!==void 0;function v(e,t=_){return t&&e.desktopBinding?e.desktopBinding:e.defaultBinding}function y(e){let t=e.code;if(!t||/^(Control|Alt|Shift|Meta)(Left|Right)$/.test(t))return null;let n=[];return e.ctrlKey&&n.push(`ctrl`),e.altKey&&n.push(`alt`),e.shiftKey&&n.push(`shift`),e.metaKey&&n.push(`meta`),n.length===0?null:(n.push(t),n.join(`+`))}var b={ctrl:`⌃`,alt:`⌥`,shift:`⇧`,meta:`⌘`},x={Comma:`,`,Period:`.`,Backquote:"`",Slash:`/`,Backslash:`\\`,Minus:`-`,Equal:`=`,Space:`␣`,Enter:`↵`,Escape:`Esc`,Tab:`⇥`,BracketLeft:`[`,BracketRight:`]`};function S(e){return e.startsWith(`Key`)?e.slice(3):e.startsWith(`Digit`)?e.slice(5):x[e]??e}function C(e){if(!e)return`—`;let t=e.split(`+`),n=t.pop()??``;return t.map(e=>b[e]??e).join(``)+S(n)}var w=new Map;function T(e,t){return w.set(e,t),()=>{w.get(e)===t&&w.delete(e)}}var E=e=>w.get(e),D=e=>g.get(e);function O(e,t){return e.hold===!0||e.id===`editor.save`||t&&e.editor!==!0}var k={},A=new Set,j=M();function M(){let e={};for(let t of h)e[t.id]=k[t.id]||v(t);return e}function N(e){k=e??{},j=M(),A.forEach(e=>e())}var P=e=>j[e]??``;function F(e){for(let[t,n]of Object.entries(j))if(n===e)return t}function I(e){return C(L()[e]??``)}function L(){return(0,s.useSyncExternalStore)(e=>(A.add(e),()=>A.delete(e)),()=>j)}var R=500,z=1e4;function B(e,t){return`${e} ${t}`}var V=new class{ws=null;open=!1;backoff=R;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(B(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(B(e,t))&&this.open&&this.send({t:`detach`,session:e,term:t})}write(e,t,n){this.open&&this.terminals.get(B(e,t))?.ready&&this.send({t:`stdin`,session:e,term:t,data:n})}resize(e,t,n,r){let i=this.terminals.get(B(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 e=a.get(),t=i();if(!e&&!t)return;let n=window.location.protocol===`https:`?`wss`:`ws`,o=t?t.socket():new WebSocket(`${n}://${window.location.host}/ws`);this.ws=o,o.addEventListener(`open`,()=>{if(this.ws!==o){o.close();return}t||o.send(JSON.stringify({t:`auth`,token:e}))}),o.addEventListener(`message`,e=>{if(this.ws!==o)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=R,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)}),o.addEventListener(`close`,e=>{if(this.ws!==o)return;let t=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(),t)for(let e of this.connectionListeners)e(!1);if(e.code===4401&&e.reason===`browser_rejected`){r();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,z))}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(B(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(B(e.session,e.term))?.handlers.onData(e.data,e.t);break;case`exit`:{let t=this.terminals.get(B(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`?o.warning:o.error)(e.title,{...e.detail===void 0?{}:{description:e.detail},duration:12e3});break;case`error`:o.error(`Connection error`,{description:e.message});break}}};export{u as _,F as a,c as b,D as c,O as d,T as f,I as g,L as h,m as i,E as l,v as m,h as n,y as o,N as p,p as r,C as s,V as t,P as u,f as v,l as x,d as y};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./createLucideIcon-C9A1vLE-.js";var t=e(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]);export{t};
|