@openchambery/web 1.18.2-beta.13 → 1.18.2-beta.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/dist/assets/{AgentAvatar-BzRb9sP6.js → AgentAvatar-B4fj9PIe.js} +1 -1
  2. package/dist/assets/AssistantView-BKlbxZyK.js +1 -0
  3. package/dist/assets/{ChatContainer-hDTv6UXl.js → ChatContainer-BH5Q0OcG.js} +9 -9
  4. package/dist/assets/{DiagramView-1hFDtyEy.js → DiagramView-fK3UrzlE.js} +1 -1
  5. package/dist/assets/{FadeInOnReveal-oeyB_nIi.js → FadeInOnReveal-CKKU6fKI.js} +1 -1
  6. package/dist/assets/{Icon-DHaR0peD.js → Icon-DiIuWOuC.js} +1 -1
  7. package/dist/assets/{MarkdownRendererImpl-5BLw0qYH.js → MarkdownRendererImpl-DrRS_Mj-.js} +1 -1
  8. package/dist/assets/{MobileDetailNavigation-DIyVGM50.js → MobileDetailNavigation-iyCRQGq6.js} +1 -1
  9. package/dist/assets/{MobileShareBridge-BQM-WOll.js → MobileShareBridge-CEz3kBX3.js} +1 -1
  10. package/dist/assets/{MobileSurface-KZ-kuSM-.js → MobileSurface-BW5JgI5O.js} +1 -1
  11. package/dist/assets/{MultiRunWindow-DPOSSmY_.js → MultiRunWindow-5nJ89UeU.js} +1 -1
  12. package/dist/assets/{OnboardingScreen-BZHN7C2r.js → OnboardingScreen-CNMknKIz.js} +1 -1
  13. package/dist/assets/{OverlayScrollbar-C2pMNVMM.js → OverlayScrollbar-C2PKulfj.js} +1 -1
  14. package/dist/assets/{SettingsView-DxL07Iba.js → SettingsView-DlMRauNf.js} +1 -1
  15. package/dist/assets/{SettingsWindow-DJ2o4zvh.js → SettingsWindow-BMGjq7sz.js} +1 -1
  16. package/dist/assets/{TerminalView-BB3tvloy.js → TerminalView-CjsjAgBp.js} +1 -1
  17. package/dist/assets/{ToolOutputDialog-D7DqChuM.js → ToolOutputDialog-CnO6gAC7.js} +1 -1
  18. package/dist/assets/{appThemeRegistry-DhaoeTus.js → appThemeRegistry-CXo91lud.js} +2 -2
  19. package/dist/assets/{button-DCUMIXDC.js → button-DaAoVF4X.js} +1 -1
  20. package/dist/assets/{clipboard-DF5tFLDb.js → clipboard-DDtEAXwp.js} +1 -1
  21. package/dist/assets/{collapsible-DNg5bLKV.js → collapsible-BmuQu0dq.js} +1 -1
  22. package/dist/assets/{context-menu-D88vCGyB.js → context-menu-DbYwL067.js} +1 -1
  23. package/dist/assets/{desktopHosts-DSgGxDpI.js → desktopHosts-ZK_vkdzL.js} +1 -1
  24. package/dist/assets/{desktopRelayRestore-DVIx7jsz.js → desktopRelayRestore-CewM6-g5.js} +1 -1
  25. package/dist/assets/{diagram-cjvFqVa8.js → diagram-DAE4CZy2.js} +1 -1
  26. package/dist/assets/{dialog-DaSIYgrj.js → dialog-CLUnqzNl.js} +1 -1
  27. package/dist/assets/{fileQueries-DXvhIL_U.js → fileQueries-CmWYnRVz.js} +1 -1
  28. package/dist/assets/{gitApi-DVNC4iYD.js → gitApi-DbudVv-1.js} +1 -1
  29. package/dist/assets/{gitApiHttp-SLrnr8a5.js → gitApiHttp-BxGAFLTf.js} +1 -1
  30. package/dist/assets/{input-QS3IWgY5.js → input-XiL2-2gG.js} +1 -1
  31. package/dist/assets/{insertionBoundaries-hcIB6RSd.js → insertionBoundaries-C3LQiAH4.js} +1 -1
  32. package/dist/assets/{main-D4aa2ZJz.js → main-CoT0vDkM.js} +2 -2
  33. package/dist/assets/{main-CQrMAdMF.js → main-DNIq2ApI.js} +12 -12
  34. package/dist/assets/{markdown-worker-D-OR2e_G.js → markdown-worker-BDyY0vt6.js} +1 -1
  35. package/dist/assets/{markdownTheme-y_Rf6mLa.js → markdownTheme-D-aLQZaM.js} +1 -1
  36. package/dist/assets/{miniChat-4N2-z2vf.js → miniChat-MmffZf1Z.js} +2 -2
  37. package/dist/assets/mobile-DWXVmge1.js +2 -0
  38. package/dist/assets/{multirun-Co8LbTjb.js → multirun-CkvHavte.js} +1 -1
  39. package/dist/assets/{persistence-oSFWyKgV.js → persistence-D1lIuyqO.js} +1 -1
  40. package/dist/assets/{projectMeta-D-ncdr5Z.js → projectMeta-B493xmWa.js} +1 -1
  41. package/dist/assets/{radio-CD4P-ogh.js → radio-CgKdnGSl.js} +1 -1
  42. package/dist/assets/{renderElectronMiniChatApp-D5QcQTL0.js → renderElectronMiniChatApp-KQLIgpz7.js} +2 -2
  43. package/dist/assets/{renderMobileApp-CnZZVbHU.js → renderMobileApp-Dv-6ehQM.js} +4 -4
  44. package/dist/assets/{runtimeConfig-n4QAk1lU.js → runtimeConfig-BXCt7ZsQ.js} +1 -1
  45. package/dist/assets/runtimeEndpointReset-COE06B3r.js +145 -0
  46. package/dist/assets/{sortable-tabs-strip-DQsv96ke.js → sortable-tabs-strip-B6nysrlL.js} +1 -1
  47. package/dist/assets/{terminalApi-_NnfkxgP.js → terminalApi-DpiAJlil.js} +1 -1
  48. package/dist/assets/{tooltip-xEnco9xY.js → tooltip-BLugzWq-.js} +1 -1
  49. package/dist/assets/{url-DIZgk80M.js → url-DMs_PgIC.js} +1 -1
  50. package/dist/assets/{useAppFontEffects-DygV6JSW.js → useAppFontEffects-BxqiSjTE.js} +5 -5
  51. package/dist/assets/{useDesktopWindowControlsLayout-Cj63sNDg.js → useDesktopWindowControlsLayout-tw70hQqL.js} +1 -1
  52. package/dist/assets/{useEffectiveDirectory-Dc904Fjg.js → useEffectiveDirectory-DvMBtKLj.js} +1 -1
  53. package/dist/assets/{useFontPreferences-B-QHyR3C.js → useFontPreferences-92Qg-98H.js} +1 -1
  54. package/dist/assets/{useMobileNavigationStore-DNoNQA4y.js → useMobileNavigationStore-Y1jVRW3U.js} +2 -2
  55. package/dist/assets/{useSessionAutoCleanup-bBkcz_hu.js → useSessionAutoCleanup-C1joiK7e.js} +1 -1
  56. package/dist/assets/{useWorkerHighlightedLines-mhBD0Do9.js → useWorkerHighlightedLines-BsIvNEvi.js} +1 -1
  57. package/dist/assets/{utils-Dxsi3J3l.js → utils-BxJEIWv5.js} +1 -1
  58. package/dist/index.html +7 -7
  59. package/dist/mini-chat.html +7 -7
  60. package/dist/mobile.html +7 -7
  61. package/package.json +1 -1
  62. package/dist/assets/AssistantView-Bbqfj9CK.js +0 -1
  63. package/dist/assets/mobile-C-RRGcDW.js +0 -2
  64. package/dist/assets/runtimeEndpointReset-BQ5F5VZS.js +0 -145
@@ -1 +1 @@
1
- import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{t}from"./useUIStore-5agS8bsW.js";import{nt as n,rt as r}from"./vendor-base-ui-CnHfUmDN.js";import{n as i}from"./vendor-react-DLPElpoQ.js";import{n as a}from"./clipboard-DF5tFLDb.js";import{t as o}from"./utils-Dxsi3J3l.js";import{n as s}from"./Icon-DHaR0peD.js";import{i as c}from"./OverlayScrollbar-C2pMNVMM.js";import{_ as l,l as u,n as d,s as ee,t as f,v as p,y as m}from"./vendor-dnd-kit-core-CvWxUPdb.js";import{o as h,r as te,t as g}from"./vendor-dnd-kit-sortable-hHdP9lLb.js";var ne=i(),_=e(r(),1),v=n(),re=({transform:e})=>({...e,y:0}),ie=e=>{let t=(0,ne.c)(18),{id:n,children:r,className:i}=e,a;t[0]===n?a=t[1]:(a={id:n},t[0]=n,t[1]=a);let{attributes:s,listeners:c,setNodeRef:l,transform:u,transition:d,isDragging:ee}=h(a),f;t[2]===u?f=t[3]:(f=m.Transform.toString(u),t[2]=u,t[3]=f);let p;t[4]!==f||t[5]!==d?(p={transform:f,transition:d},t[4]=f,t[5]=d,t[6]=p):p=t[6];let te=ee&&`opacity-50`,g;t[7]!==i||t[8]!==te?(g=o(`h-full rounded-md`,i,te),t[7]=i,t[8]=te,t[9]=g):g=t[9];let _;return t[10]!==s||t[11]!==r||t[12]!==n||t[13]!==c||t[14]!==l||t[15]!==p||t[16]!==g?(_=(0,v.jsx)(`div`,{ref:l,"data-sortable-tab-id":n,style:p,className:g,...s,...c,children:r}),t[10]=s,t[11]=r,t[12]=n,t[13]=c,t[14]=l,t[15]=p,t[16]=g,t[17]=_):_=t[17],_},ae=e=>{let t=(0,ne.c)(6),{id:n,children:r,className:i}=e,a;t[0]===i?a=t[1]:(a=o(`h-full`,i),t[0]=i,t[1]=a);let s;return t[2]!==r||t[3]!==n||t[4]!==a?(s=(0,v.jsx)(`div`,{className:a,"data-sortable-tab-id":n,children:r}),t[2]=r,t[3]=n,t[4]=a,t[5]=s):s=t[5],s},y=e=>{let n=(0,ne.c)(121),{items:r,activeId:i,onSelect:m,onClose:h,onReorder:y,layoutMode:he,variant:ge,activePillInsetClassName:_e,activePillButtonClassName:b,inactiveTabsIconOnly:ve,iconOnlyActiveTab:ye,animateActivePill:be,activePillLowercase:xe,className:Se}=e,Ce=he===void 0?`scrollable`:he,we=ge===void 0?`default`:ge,x=ve!==void 0&&ve,S=ye!==void 0&&ye,C=xe===void 0||xe,{t:Te}=a(),w=t(oe),{isTablet:Ee}=c(),T=w||Ee,E=_.useRef(null),De;n[0]===Symbol.for(`react.memo_cache_sentinel`)?(De={left:!1,right:!1},n[0]=De):De=n[0];let[D,O]=_.useState(De),k;n[1]===r?k=n[2]:(k=r.map(se),n[1]=r,n[2]=k);let Oe=k,A=Ce===`scrollable`,ke=we==="default",j=we===`active-pill`,Ae=we===`animated`,M=j||Ae,N=ke,P=M||N,F=j&&A,je=M,Me=be??Ae,Ne=typeof y==`function`,I=Ne?ie:ae,L;n[3]===Symbol.for(`react.memo_cache_sentinel`)?(L=new Map,n[3]=L):L=n[3];let R=_.useRef(L),[z,Pe]=_.useState(null),Fe;n[4]===Symbol.for(`react.memo_cache_sentinel`)?(Fe={activationConstraint:{distance:8}},n[4]=Fe):Fe=n[4];let Ie=p(l(ee,Fe)),Le=ce,Re;n[5]===Symbol.for(`react.memo_cache_sentinel`)?(Re=(e,t)=>{if(t){R.current.set(e,t);return}R.current.delete(e)},n[5]=Re):Re=n[5];let ze=Re,Be;n[6]!==i||n[7]!==P?(Be=()=>{if(!P||!i){Pe(le);return}let e=E.current,t=R.current.get(i);if(!e||!t){Pe(ue);return}let n=0,r=0,a=t;for(;a&&a!==e;)n+=a.offsetLeft,r+=a.offsetTop,a=a.offsetParent;let o={left:n,top:r,width:t.offsetWidth,height:t.offsetHeight};Pe(e=>Le(e,o)?e:o)},n[6]=i,n[7]=P,n[8]=Be):Be=n[8];let B=Be,Ve;n[9]===A?Ve=n[10]:(Ve=()=>{if(!A){O({left:!1,right:!1});return}let e=E.current;if(!e){O({left:!1,right:!1});return}O({left:e.scrollLeft>2,right:e.scrollLeft+e.clientWidth<e.scrollWidth-2})},n[9]=A,n[10]=Ve);let V=Ve,He;n[11]!==A||n[12]!==V?(He=()=>{if(!A){O({left:!1,right:!1});return}let e=E.current;if(!e)return;V(),e.addEventListener(`scroll`,V,{passive:!0});let t=new ResizeObserver(V);return t.observe(e),()=>{e.removeEventListener(`scroll`,V),t.disconnect()}},n[11]=A,n[12]=V,n[13]=He):He=n[13];let Ue;n[14]!==A||n[15]!==r.length||n[16]!==V?(Ue=[A,r.length,V],n[14]=A,n[15]=r.length,n[16]=V,n[17]=Ue):Ue=n[17],_.useEffect(He,Ue);let We;n[18]!==i||n[19]!==B||n[20]!==P?(We=()=>{if(!P){Pe(null);return}B();let e=E.current;if(!e)return;let t=new ResizeObserver(B);if(t.observe(e),i){let e=R.current.get(i);e&&t.observe(e)}return()=>{t.disconnect()}},n[18]=i,n[19]=B,n[20]=P,n[21]=We):We=n[21];let Ge;n[22]!==i||n[23]!==r.length||n[24]!==B||n[25]!==P?(Ge=[i,r.length,B,P],n[22]=i,n[23]=r.length,n[24]=B,n[25]=P,n[26]=Ge):Ge=n[26],_.useEffect(We,Ge);let Ke;n[27]===B?Ke=n[28]:(Ke=()=>{B()},n[27]=B,n[28]=Ke),_.useLayoutEffect(Ke);let qe;n[29]!==i||n[30]!==A||n[31]!==V?(qe=()=>{if(!A||!i)return;let e=E.current;if(!e)return;let t=window.requestAnimationFrame(()=>{let t=typeof window.CSS?.escape==`function`?window.CSS.escape(i):i.replace(/"/g,`\\"`),n=e.querySelector(`[data-sortable-tab-id="${t}"]`);n&&(n.scrollIntoView({block:`nearest`,inline:`nearest`}),V())});return()=>{window.cancelAnimationFrame(t)}},n[29]=i,n[30]=A,n[31]=V,n[32]=qe):qe=n[32];let Je;n[33]!==i||n[34]!==A||n[35]!==r.length||n[36]!==V?(Je=[i,A,r.length,V],n[33]=i,n[34]=A,n[35]=r.length,n[36]=V,n[37]=Je):Je=n[37],_.useEffect(qe,Je);let Ye;n[38]===y?Ye=n[39]:(Ye=e=>{if(!y)return;let{active:t,over:n}=e;!n||t.id===n.id||y(String(t.id),String(n.id))},n[38]=y,n[39]=Ye);let Xe=Ye,H;n[40]===Se?H=n[41]:(H=o(`relative flex h-full min-w-0 flex-1`,Se),n[40]=Se,n[41]=H);let U;n[42]!==A||n[43]!==D||n[44]!==M?(U=A&&D.left?(0,v.jsx)(`div`,{className:o(`pointer-events-none absolute inset-y-0 left-0 z-20 bg-gradient-to-r to-transparent`,M?`w-8 from-[var(--surface-background)]`:`w-6 from-background`)}):null,n[42]=A,n[43]=D,n[44]=M,n[45]=U):U=n[45];let W;n[46]!==A||n[47]!==D||n[48]!==M?(W=A&&D.right?(0,v.jsx)(`div`,{className:o(`pointer-events-none absolute inset-y-0 right-0 z-20 bg-gradient-to-l to-transparent`,M?`w-8 from-[var(--surface-background)]`:`w-6 from-background`)}):null,n[46]=A,n[47]=D,n[48]=M,n[49]=W):W=n[49];let Ze=M?`items-center overflow-x-hidden overflow-y-hidden`:`items-stretch`,Qe=M&&`@container/pill-tabs`,$e=M&&`pill-tabs__track`,et=M&&(_e??`gap-0.5 py-0.5`),tt=N&&`items-center overflow-y-hidden`,nt=je&&`rounded-[10px] [corner-shape:squircle] supports-[corner-shape:squircle]:rounded-[50px] bg-[color-mix(in_srgb,var(--foreground)_2%,transparent)] p-0.5 gap-0.5`,rt=A?`overflow-x-auto scrollbar-none`:`overflow-x-hidden`,G;n[50]!==Ze||n[51]!==Qe||n[52]!==$e||n[53]!==et||n[54]!==tt||n[55]!==nt||n[56]!==rt?(G=o(`relative flex h-full min-w-0 flex-1`,Ze,Qe,$e,et,tt,nt,rt),n[50]=Ze,n[51]=Qe,n[52]=$e,n[53]=et,n[54]=tt,n[55]=nt,n[56]=rt,n[57]=G):G=n[57];let K;n[58]===A?K=n[59]:(K=A?{scrollbarWidth:`none`,msOverflowStyle:`none`}:void 0,n[58]=A,n[59]=K);let q;n[60]===Te?q=n[61]:(q=Te(`sortableTabsStrip.aria.tabs`),n[60]=Te,n[61]=q);let J;n[62]!==z||n[63]!==Me||n[64]!==M?(J=M&&z?(0,v.jsx)(`div`,{className:o(`oc-segmented-selected-pill pointer-events-none absolute left-0 top-0 z-0 rounded-[9px] [corner-shape:squircle] supports-[corner-shape:squircle]:rounded-[50px]`),style:{transform:`translate3d(${z.left}px, ${z.top}px, 0)`,width:`${z.width}px`,height:`${z.height}px`,transition:Me?`transform 300ms cubic-bezier(0.65, 0, 0.35, 1), width 300ms cubic-bezier(0.65, 0, 0.35, 1), height 300ms cubic-bezier(0.65, 0, 0.35, 1)`:void 0}}):null,n[62]=z,n[63]=Me,n[64]=M,n[65]=J):J=n[65];let Y;n[66]!==z||n[67]!==N?(Y=N&&z?(0,v.jsx)(`div`,{className:`pointer-events-none absolute left-0 -bottom-px z-10 h-[3px] rounded-t-[2px] bg-[var(--primary-base)]`,style:{transform:`translate3d(${z.left}px, 0, 0)`,width:`${z.width}px`},"aria-hidden":!0}):null,n[66]=z,n[67]=N,n[68]=Y):Y=n[68];let X;if(n[69]!==I||n[70]!==i||n[71]!==b||n[72]!==C||n[73]!==T||n[74]!==S||n[75]!==x||n[76]!==j||n[77]!==w||n[78]!==A||n[79]!==r||n[80]!==h||n[81]!==m||n[82]!==F||n[83]!==M){let e;n[85]!==I||n[86]!==i||n[87]!==b||n[88]!==C||n[89]!==T||n[90]!==S||n[91]!==x||n[92]!==j||n[93]!==w||n[94]!==A||n[95]!==h||n[96]!==m||n[97]!==F||n[98]!==M?(e=e=>{let t=e.id===i,n=x&&M&&!t&&!!e.icon,r=!n,a=!!e.icon&&(!S||t),c=x&&M&&t&&!A&&!F,l=e.closable!==!1&&!!h,u=l&&!!e.icon,d=A||F?void 0:M?c?`flex-none basis-auto`:w?`flex-1 basis-0 min-w-0`:`flex-1 basis-0 min-w-fit`:`min-w-0 flex-1 basis-0`,ee=l?t=>{t.button===1&&(t.preventDefault(),t.stopPropagation(),h?.(e.id))}:void 0,f=l?de:void 0;return(0,v.jsx)(I,{id:e.id,className:d,children:(0,v.jsxs)(`div`,{ref:t=>ze(e.id,t),onAuxClick:ee,onMouseDown:f,className:o(`group flex h-full min-w-0 flex-nowrap items-center`,A||F?`shrink-0`:M?`w-full`:`w-full min-w-0`,M?`relative z-10 bg-transparent`:t?`relative z-10 bg-transparent text-foreground`:`relative z-10 bg-transparent text-muted-foreground hover:text-foreground`),children:[(0,v.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":t,"aria-label":n?e.title??e.label:void 0,onClick:()=>m(e.id),className:o(M?`animated-tabs__button pill-tabs__button relative z-10 flex flex-1 min-w-0 flex-nowrap items-center justify-center rounded-[9px] [corner-shape:squircle] supports-[corner-shape:squircle]:rounded-[50px] text-sm font-medium transition-colors duration-150 !min-h-0`:`flex h-full min-w-0 flex-nowrap items-center typography-micro`,M&&C?`lowercase`:null,M&&(n?`gap-0`:`gap-1.5`),M?F?`shrink-0 whitespace-nowrap px-3 text-center`:A?`max-w-56 shrink-0 px-3 text-center`:n?`px-2 !min-w-0 text-center`:c?`shrink-0 whitespace-nowrap px-3 text-center`:`px-3 text-center`:A?`max-w-56 justify-start truncate px-3 text-left`:`w-full justify-center truncate px-3 text-center`,M?b??(j?w?`h-[38px]`:`h-[31px]`:`h-7`):null,M?t?`text-foreground`:`text-muted-foreground hover:text-foreground`:null,M?`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--interactive-focus-ring)] focus-visible:ring-offset-1 focus-visible:ring-offset-background`:null),title:e.title??e.label,children:M?(0,v.jsxs)(v.Fragment,{children:[a?(0,v.jsxs)(`span`,{className:`relative flex h-4 w-4 shrink-0 items-center justify-center`,children:[(0,v.jsx)(`span`,{className:o(`flex items-center justify-center transition-opacity`,u&&(T?`opacity-0`:`group-hover:opacity-0`)),children:e.icon}),u?(0,v.jsx)(`span`,{role:`button`,tabIndex:-1,className:o(`absolute inset-0 z-20 flex !min-h-0 !min-w-0 items-center justify-center rounded-sm text-muted-foreground transition-opacity hover:text-foreground`,T?`opacity-100`:`opacity-0 group-hover:opacity-100`),onPointerDown:fe,onClick:t=>{t.stopPropagation(),h?.(e.id)},"aria-label":e.closeLabel??`Close ${e.label} tab`,title:e.closeLabel??`Close ${e.label} tab`,children:(0,v.jsx)(s,{name:`close`,className:`h-3.5 w-3.5`})}):null]}):null,r?(0,v.jsx)(`span`,{className:`animated-tabs__label truncate`,children:e.label}):null]}):(0,v.jsxs)(`span`,{className:o(`flex min-w-0 flex-nowrap items-center gap-1.5`,!A&&`justify-center`),children:[a?(0,v.jsxs)(`span`,{className:o(`relative flex h-4 w-4 shrink-0 items-center justify-center transition-colors duration-200 ease-out`,t?`text-[var(--primary-base)]`:`text-muted-foreground`),children:[(0,v.jsx)(`span`,{className:o(`flex items-center justify-center transition-opacity`,u&&(T?`opacity-0`:`group-hover:opacity-0`)),children:e.icon}),u?(0,v.jsx)(`span`,{role:`button`,tabIndex:-1,className:o(`absolute inset-0 z-20 flex !min-h-0 !min-w-0 items-center justify-center rounded-sm text-muted-foreground transition-opacity hover:text-foreground`,T?`opacity-100`:`opacity-0 group-hover:opacity-100`),onPointerDown:pe,onClick:t=>{t.stopPropagation(),h?.(e.id)},"aria-label":e.closeLabel??`Close ${e.label} tab`,title:e.closeLabel??`Close ${e.label} tab`,children:(0,v.jsx)(s,{name:`close`,className:`h-3.5 w-3.5`})}):null]}):null,(0,v.jsx)(`span`,{className:`truncate leading-[1.2]`,children:e.label})]})}),l&&!u?(0,v.jsx)(`button`,{type:`button`,onPointerDown:me,onClick:t=>{t.stopPropagation(),h?.(e.id)},className:o(`relative z-20 inline-flex !min-h-0 !min-w-0 items-center justify-center transition-opacity`,M?`-ml-2.5 mr-1 h-[88%] w-5 self-center !aspect-auto rounded-md`:`aspect-square h-[65%] min-h-4 max-h-5 rounded-sm mr-1`,M?t?`text-muted-foreground hover:bg-transparent hover:text-foreground`:`text-muted-foreground opacity-0 hover:bg-transparent hover:text-foreground group-hover:opacity-100`:t?`text-muted-foreground hover:bg-interactive-hover/60 hover:text-foreground`:`text-muted-foreground opacity-0 hover:bg-interactive-hover/80 hover:text-foreground group-hover:opacity-100`),"aria-label":e.closeLabel??`Close ${e.label} tab`,title:e.closeLabel??`Close ${e.label} tab`,children:(0,v.jsx)(s,{name:`close`,className:`h-3 w-3`})}):null]})},e.id)},n[85]=I,n[86]=i,n[87]=b,n[88]=C,n[89]=T,n[90]=S,n[91]=x,n[92]=j,n[93]=w,n[94]=A,n[95]=h,n[96]=m,n[97]=F,n[98]=M,n[99]=e):e=n[99],X=r.map(e),n[69]=I,n[70]=i,n[71]=b,n[72]=C,n[73]=T,n[74]=S,n[75]=x,n[76]=j,n[77]=w,n[78]=A,n[79]=r,n[80]=h,n[81]=m,n[82]=F,n[83]=M,n[84]=X}else X=n[84];let Z;n[100]!==G||n[101]!==K||n[102]!==q||n[103]!==J||n[104]!==Y||n[105]!==X?(Z=(0,v.jsxs)(`div`,{ref:E,className:G,style:K,role:`tablist`,"aria-label":q,children:[J,Y,X]}),n[100]=G,n[101]=K,n[102]=q,n[103]=J,n[104]=Y,n[105]=X,n[106]=Z):Z=n[106];let it;n[107]!==H||n[108]!==U||n[109]!==W||n[110]!==Z?(it=(0,v.jsxs)(`div`,{className:H,children:[U,W,Z]}),n[107]=H,n[108]=U,n[109]=W,n[110]=Z,n[111]=it):it=n[111];let at=it;if(!Ne)return at;let ot;n[112]===Symbol.for(`react.memo_cache_sentinel`)?(ot=[re],n[112]=ot):ot=n[112];let Q;n[113]!==Oe||n[114]!==at?(Q=(0,v.jsx)(g,{items:Oe,strategy:te,children:at}),n[113]=Oe,n[114]=at,n[115]=Q):Q=n[115];let st;n[116]===Symbol.for(`react.memo_cache_sentinel`)?(st=(0,v.jsx)(d,{dropAnimation:null}),n[116]=st):st=n[116];let $;return n[117]!==Xe||n[118]!==Ie||n[119]!==Q?($=(0,v.jsxs)(f,{sensors:Ie,collisionDetection:u,onDragEnd:Xe,modifiers:ot,children:[Q,st]}),n[117]=Xe,n[118]=Ie,n[119]=Q,n[120]=$):$=n[120],$};function oe(e){return e.isMobile}function se(e){return e.id}function ce(e,t){return!e||!t?e===t:Math.abs(e.left-t.left)<.5&&Math.abs(e.top-t.top)<.5&&Math.abs(e.width-t.width)<.5&&Math.abs(e.height-t.height)<.5}function le(e){return e===null?e:null}function ue(e){return e===null?e:null}function de(e){e.button===1&&e.preventDefault()}function fe(e){e.stopPropagation()}function pe(e){e.stopPropagation()}function me(e){e.stopPropagation()}export{y as t};
1
+ import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{t}from"./useUIStore-5agS8bsW.js";import{nt as n,rt as r}from"./vendor-base-ui-CnHfUmDN.js";import{n as i}from"./vendor-react-DLPElpoQ.js";import{n as a}from"./clipboard-DDtEAXwp.js";import{t as o}from"./utils-BxJEIWv5.js";import{n as s}from"./Icon-DiIuWOuC.js";import{i as c}from"./OverlayScrollbar-C2PKulfj.js";import{_ as l,l as u,n as d,s as ee,t as f,v as p,y as m}from"./vendor-dnd-kit-core-CvWxUPdb.js";import{o as h,r as te,t as g}from"./vendor-dnd-kit-sortable-hHdP9lLb.js";var ne=i(),_=e(r(),1),v=n(),re=({transform:e})=>({...e,y:0}),ie=e=>{let t=(0,ne.c)(18),{id:n,children:r,className:i}=e,a;t[0]===n?a=t[1]:(a={id:n},t[0]=n,t[1]=a);let{attributes:s,listeners:c,setNodeRef:l,transform:u,transition:d,isDragging:ee}=h(a),f;t[2]===u?f=t[3]:(f=m.Transform.toString(u),t[2]=u,t[3]=f);let p;t[4]!==f||t[5]!==d?(p={transform:f,transition:d},t[4]=f,t[5]=d,t[6]=p):p=t[6];let te=ee&&`opacity-50`,g;t[7]!==i||t[8]!==te?(g=o(`h-full rounded-md`,i,te),t[7]=i,t[8]=te,t[9]=g):g=t[9];let _;return t[10]!==s||t[11]!==r||t[12]!==n||t[13]!==c||t[14]!==l||t[15]!==p||t[16]!==g?(_=(0,v.jsx)(`div`,{ref:l,"data-sortable-tab-id":n,style:p,className:g,...s,...c,children:r}),t[10]=s,t[11]=r,t[12]=n,t[13]=c,t[14]=l,t[15]=p,t[16]=g,t[17]=_):_=t[17],_},ae=e=>{let t=(0,ne.c)(6),{id:n,children:r,className:i}=e,a;t[0]===i?a=t[1]:(a=o(`h-full`,i),t[0]=i,t[1]=a);let s;return t[2]!==r||t[3]!==n||t[4]!==a?(s=(0,v.jsx)(`div`,{className:a,"data-sortable-tab-id":n,children:r}),t[2]=r,t[3]=n,t[4]=a,t[5]=s):s=t[5],s},y=e=>{let n=(0,ne.c)(121),{items:r,activeId:i,onSelect:m,onClose:h,onReorder:y,layoutMode:he,variant:ge,activePillInsetClassName:_e,activePillButtonClassName:b,inactiveTabsIconOnly:ve,iconOnlyActiveTab:ye,animateActivePill:be,activePillLowercase:xe,className:Se}=e,Ce=he===void 0?`scrollable`:he,we=ge===void 0?`default`:ge,x=ve!==void 0&&ve,S=ye!==void 0&&ye,C=xe===void 0||xe,{t:Te}=a(),w=t(oe),{isTablet:Ee}=c(),T=w||Ee,E=_.useRef(null),De;n[0]===Symbol.for(`react.memo_cache_sentinel`)?(De={left:!1,right:!1},n[0]=De):De=n[0];let[D,O]=_.useState(De),k;n[1]===r?k=n[2]:(k=r.map(se),n[1]=r,n[2]=k);let Oe=k,A=Ce===`scrollable`,ke=we==="default",j=we===`active-pill`,Ae=we===`animated`,M=j||Ae,N=ke,P=M||N,F=j&&A,je=M,Me=be??Ae,Ne=typeof y==`function`,I=Ne?ie:ae,L;n[3]===Symbol.for(`react.memo_cache_sentinel`)?(L=new Map,n[3]=L):L=n[3];let R=_.useRef(L),[z,Pe]=_.useState(null),Fe;n[4]===Symbol.for(`react.memo_cache_sentinel`)?(Fe={activationConstraint:{distance:8}},n[4]=Fe):Fe=n[4];let Ie=p(l(ee,Fe)),Le=ce,Re;n[5]===Symbol.for(`react.memo_cache_sentinel`)?(Re=(e,t)=>{if(t){R.current.set(e,t);return}R.current.delete(e)},n[5]=Re):Re=n[5];let ze=Re,Be;n[6]!==i||n[7]!==P?(Be=()=>{if(!P||!i){Pe(le);return}let e=E.current,t=R.current.get(i);if(!e||!t){Pe(ue);return}let n=0,r=0,a=t;for(;a&&a!==e;)n+=a.offsetLeft,r+=a.offsetTop,a=a.offsetParent;let o={left:n,top:r,width:t.offsetWidth,height:t.offsetHeight};Pe(e=>Le(e,o)?e:o)},n[6]=i,n[7]=P,n[8]=Be):Be=n[8];let B=Be,Ve;n[9]===A?Ve=n[10]:(Ve=()=>{if(!A){O({left:!1,right:!1});return}let e=E.current;if(!e){O({left:!1,right:!1});return}O({left:e.scrollLeft>2,right:e.scrollLeft+e.clientWidth<e.scrollWidth-2})},n[9]=A,n[10]=Ve);let V=Ve,He;n[11]!==A||n[12]!==V?(He=()=>{if(!A){O({left:!1,right:!1});return}let e=E.current;if(!e)return;V(),e.addEventListener(`scroll`,V,{passive:!0});let t=new ResizeObserver(V);return t.observe(e),()=>{e.removeEventListener(`scroll`,V),t.disconnect()}},n[11]=A,n[12]=V,n[13]=He):He=n[13];let Ue;n[14]!==A||n[15]!==r.length||n[16]!==V?(Ue=[A,r.length,V],n[14]=A,n[15]=r.length,n[16]=V,n[17]=Ue):Ue=n[17],_.useEffect(He,Ue);let We;n[18]!==i||n[19]!==B||n[20]!==P?(We=()=>{if(!P){Pe(null);return}B();let e=E.current;if(!e)return;let t=new ResizeObserver(B);if(t.observe(e),i){let e=R.current.get(i);e&&t.observe(e)}return()=>{t.disconnect()}},n[18]=i,n[19]=B,n[20]=P,n[21]=We):We=n[21];let Ge;n[22]!==i||n[23]!==r.length||n[24]!==B||n[25]!==P?(Ge=[i,r.length,B,P],n[22]=i,n[23]=r.length,n[24]=B,n[25]=P,n[26]=Ge):Ge=n[26],_.useEffect(We,Ge);let Ke;n[27]===B?Ke=n[28]:(Ke=()=>{B()},n[27]=B,n[28]=Ke),_.useLayoutEffect(Ke);let qe;n[29]!==i||n[30]!==A||n[31]!==V?(qe=()=>{if(!A||!i)return;let e=E.current;if(!e)return;let t=window.requestAnimationFrame(()=>{let t=typeof window.CSS?.escape==`function`?window.CSS.escape(i):i.replace(/"/g,`\\"`),n=e.querySelector(`[data-sortable-tab-id="${t}"]`);n&&(n.scrollIntoView({block:`nearest`,inline:`nearest`}),V())});return()=>{window.cancelAnimationFrame(t)}},n[29]=i,n[30]=A,n[31]=V,n[32]=qe):qe=n[32];let Je;n[33]!==i||n[34]!==A||n[35]!==r.length||n[36]!==V?(Je=[i,A,r.length,V],n[33]=i,n[34]=A,n[35]=r.length,n[36]=V,n[37]=Je):Je=n[37],_.useEffect(qe,Je);let Ye;n[38]===y?Ye=n[39]:(Ye=e=>{if(!y)return;let{active:t,over:n}=e;!n||t.id===n.id||y(String(t.id),String(n.id))},n[38]=y,n[39]=Ye);let Xe=Ye,H;n[40]===Se?H=n[41]:(H=o(`relative flex h-full min-w-0 flex-1`,Se),n[40]=Se,n[41]=H);let U;n[42]!==A||n[43]!==D||n[44]!==M?(U=A&&D.left?(0,v.jsx)(`div`,{className:o(`pointer-events-none absolute inset-y-0 left-0 z-20 bg-gradient-to-r to-transparent`,M?`w-8 from-[var(--surface-background)]`:`w-6 from-background`)}):null,n[42]=A,n[43]=D,n[44]=M,n[45]=U):U=n[45];let W;n[46]!==A||n[47]!==D||n[48]!==M?(W=A&&D.right?(0,v.jsx)(`div`,{className:o(`pointer-events-none absolute inset-y-0 right-0 z-20 bg-gradient-to-l to-transparent`,M?`w-8 from-[var(--surface-background)]`:`w-6 from-background`)}):null,n[46]=A,n[47]=D,n[48]=M,n[49]=W):W=n[49];let Ze=M?`items-center overflow-x-hidden overflow-y-hidden`:`items-stretch`,Qe=M&&`@container/pill-tabs`,$e=M&&`pill-tabs__track`,et=M&&(_e??`gap-0.5 py-0.5`),tt=N&&`items-center overflow-y-hidden`,nt=je&&`rounded-[10px] [corner-shape:squircle] supports-[corner-shape:squircle]:rounded-[50px] bg-[color-mix(in_srgb,var(--foreground)_2%,transparent)] p-0.5 gap-0.5`,rt=A?`overflow-x-auto scrollbar-none`:`overflow-x-hidden`,G;n[50]!==Ze||n[51]!==Qe||n[52]!==$e||n[53]!==et||n[54]!==tt||n[55]!==nt||n[56]!==rt?(G=o(`relative flex h-full min-w-0 flex-1`,Ze,Qe,$e,et,tt,nt,rt),n[50]=Ze,n[51]=Qe,n[52]=$e,n[53]=et,n[54]=tt,n[55]=nt,n[56]=rt,n[57]=G):G=n[57];let K;n[58]===A?K=n[59]:(K=A?{scrollbarWidth:`none`,msOverflowStyle:`none`}:void 0,n[58]=A,n[59]=K);let q;n[60]===Te?q=n[61]:(q=Te(`sortableTabsStrip.aria.tabs`),n[60]=Te,n[61]=q);let J;n[62]!==z||n[63]!==Me||n[64]!==M?(J=M&&z?(0,v.jsx)(`div`,{className:o(`oc-segmented-selected-pill pointer-events-none absolute left-0 top-0 z-0 rounded-[9px] [corner-shape:squircle] supports-[corner-shape:squircle]:rounded-[50px]`),style:{transform:`translate3d(${z.left}px, ${z.top}px, 0)`,width:`${z.width}px`,height:`${z.height}px`,transition:Me?`transform 300ms cubic-bezier(0.65, 0, 0.35, 1), width 300ms cubic-bezier(0.65, 0, 0.35, 1), height 300ms cubic-bezier(0.65, 0, 0.35, 1)`:void 0}}):null,n[62]=z,n[63]=Me,n[64]=M,n[65]=J):J=n[65];let Y;n[66]!==z||n[67]!==N?(Y=N&&z?(0,v.jsx)(`div`,{className:`pointer-events-none absolute left-0 -bottom-px z-10 h-[3px] rounded-t-[2px] bg-[var(--primary-base)]`,style:{transform:`translate3d(${z.left}px, 0, 0)`,width:`${z.width}px`},"aria-hidden":!0}):null,n[66]=z,n[67]=N,n[68]=Y):Y=n[68];let X;if(n[69]!==I||n[70]!==i||n[71]!==b||n[72]!==C||n[73]!==T||n[74]!==S||n[75]!==x||n[76]!==j||n[77]!==w||n[78]!==A||n[79]!==r||n[80]!==h||n[81]!==m||n[82]!==F||n[83]!==M){let e;n[85]!==I||n[86]!==i||n[87]!==b||n[88]!==C||n[89]!==T||n[90]!==S||n[91]!==x||n[92]!==j||n[93]!==w||n[94]!==A||n[95]!==h||n[96]!==m||n[97]!==F||n[98]!==M?(e=e=>{let t=e.id===i,n=x&&M&&!t&&!!e.icon,r=!n,a=!!e.icon&&(!S||t),c=x&&M&&t&&!A&&!F,l=e.closable!==!1&&!!h,u=l&&!!e.icon,d=A||F?void 0:M?c?`flex-none basis-auto`:w?`flex-1 basis-0 min-w-0`:`flex-1 basis-0 min-w-fit`:`min-w-0 flex-1 basis-0`,ee=l?t=>{t.button===1&&(t.preventDefault(),t.stopPropagation(),h?.(e.id))}:void 0,f=l?de:void 0;return(0,v.jsx)(I,{id:e.id,className:d,children:(0,v.jsxs)(`div`,{ref:t=>ze(e.id,t),onAuxClick:ee,onMouseDown:f,className:o(`group flex h-full min-w-0 flex-nowrap items-center`,A||F?`shrink-0`:M?`w-full`:`w-full min-w-0`,M?`relative z-10 bg-transparent`:t?`relative z-10 bg-transparent text-foreground`:`relative z-10 bg-transparent text-muted-foreground hover:text-foreground`),children:[(0,v.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":t,"aria-label":n?e.title??e.label:void 0,onClick:()=>m(e.id),className:o(M?`animated-tabs__button pill-tabs__button relative z-10 flex flex-1 min-w-0 flex-nowrap items-center justify-center rounded-[9px] [corner-shape:squircle] supports-[corner-shape:squircle]:rounded-[50px] text-sm font-medium transition-colors duration-150 !min-h-0`:`flex h-full min-w-0 flex-nowrap items-center typography-micro`,M&&C?`lowercase`:null,M&&(n?`gap-0`:`gap-1.5`),M?F?`shrink-0 whitespace-nowrap px-3 text-center`:A?`max-w-56 shrink-0 px-3 text-center`:n?`px-2 !min-w-0 text-center`:c?`shrink-0 whitespace-nowrap px-3 text-center`:`px-3 text-center`:A?`max-w-56 justify-start truncate px-3 text-left`:`w-full justify-center truncate px-3 text-center`,M?b??(j?w?`h-[38px]`:`h-[31px]`:`h-7`):null,M?t?`text-foreground`:`text-muted-foreground hover:text-foreground`:null,M?`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--interactive-focus-ring)] focus-visible:ring-offset-1 focus-visible:ring-offset-background`:null),title:e.title??e.label,children:M?(0,v.jsxs)(v.Fragment,{children:[a?(0,v.jsxs)(`span`,{className:`relative flex h-4 w-4 shrink-0 items-center justify-center`,children:[(0,v.jsx)(`span`,{className:o(`flex items-center justify-center transition-opacity`,u&&(T?`opacity-0`:`group-hover:opacity-0`)),children:e.icon}),u?(0,v.jsx)(`span`,{role:`button`,tabIndex:-1,className:o(`absolute inset-0 z-20 flex !min-h-0 !min-w-0 items-center justify-center rounded-sm text-muted-foreground transition-opacity hover:text-foreground`,T?`opacity-100`:`opacity-0 group-hover:opacity-100`),onPointerDown:fe,onClick:t=>{t.stopPropagation(),h?.(e.id)},"aria-label":e.closeLabel??`Close ${e.label} tab`,title:e.closeLabel??`Close ${e.label} tab`,children:(0,v.jsx)(s,{name:`close`,className:`h-3.5 w-3.5`})}):null]}):null,r?(0,v.jsx)(`span`,{className:`animated-tabs__label truncate`,children:e.label}):null]}):(0,v.jsxs)(`span`,{className:o(`flex min-w-0 flex-nowrap items-center gap-1.5`,!A&&`justify-center`),children:[a?(0,v.jsxs)(`span`,{className:o(`relative flex h-4 w-4 shrink-0 items-center justify-center transition-colors duration-200 ease-out`,t?`text-[var(--primary-base)]`:`text-muted-foreground`),children:[(0,v.jsx)(`span`,{className:o(`flex items-center justify-center transition-opacity`,u&&(T?`opacity-0`:`group-hover:opacity-0`)),children:e.icon}),u?(0,v.jsx)(`span`,{role:`button`,tabIndex:-1,className:o(`absolute inset-0 z-20 flex !min-h-0 !min-w-0 items-center justify-center rounded-sm text-muted-foreground transition-opacity hover:text-foreground`,T?`opacity-100`:`opacity-0 group-hover:opacity-100`),onPointerDown:pe,onClick:t=>{t.stopPropagation(),h?.(e.id)},"aria-label":e.closeLabel??`Close ${e.label} tab`,title:e.closeLabel??`Close ${e.label} tab`,children:(0,v.jsx)(s,{name:`close`,className:`h-3.5 w-3.5`})}):null]}):null,(0,v.jsx)(`span`,{className:`truncate leading-[1.2]`,children:e.label})]})}),l&&!u?(0,v.jsx)(`button`,{type:`button`,onPointerDown:me,onClick:t=>{t.stopPropagation(),h?.(e.id)},className:o(`relative z-20 inline-flex !min-h-0 !min-w-0 items-center justify-center transition-opacity`,M?`-ml-2.5 mr-1 h-[88%] w-5 self-center !aspect-auto rounded-md`:`aspect-square h-[65%] min-h-4 max-h-5 rounded-sm mr-1`,M?t?`text-muted-foreground hover:bg-transparent hover:text-foreground`:`text-muted-foreground opacity-0 hover:bg-transparent hover:text-foreground group-hover:opacity-100`:t?`text-muted-foreground hover:bg-interactive-hover/60 hover:text-foreground`:`text-muted-foreground opacity-0 hover:bg-interactive-hover/80 hover:text-foreground group-hover:opacity-100`),"aria-label":e.closeLabel??`Close ${e.label} tab`,title:e.closeLabel??`Close ${e.label} tab`,children:(0,v.jsx)(s,{name:`close`,className:`h-3 w-3`})}):null]})},e.id)},n[85]=I,n[86]=i,n[87]=b,n[88]=C,n[89]=T,n[90]=S,n[91]=x,n[92]=j,n[93]=w,n[94]=A,n[95]=h,n[96]=m,n[97]=F,n[98]=M,n[99]=e):e=n[99],X=r.map(e),n[69]=I,n[70]=i,n[71]=b,n[72]=C,n[73]=T,n[74]=S,n[75]=x,n[76]=j,n[77]=w,n[78]=A,n[79]=r,n[80]=h,n[81]=m,n[82]=F,n[83]=M,n[84]=X}else X=n[84];let Z;n[100]!==G||n[101]!==K||n[102]!==q||n[103]!==J||n[104]!==Y||n[105]!==X?(Z=(0,v.jsxs)(`div`,{ref:E,className:G,style:K,role:`tablist`,"aria-label":q,children:[J,Y,X]}),n[100]=G,n[101]=K,n[102]=q,n[103]=J,n[104]=Y,n[105]=X,n[106]=Z):Z=n[106];let it;n[107]!==H||n[108]!==U||n[109]!==W||n[110]!==Z?(it=(0,v.jsxs)(`div`,{className:H,children:[U,W,Z]}),n[107]=H,n[108]=U,n[109]=W,n[110]=Z,n[111]=it):it=n[111];let at=it;if(!Ne)return at;let ot;n[112]===Symbol.for(`react.memo_cache_sentinel`)?(ot=[re],n[112]=ot):ot=n[112];let Q;n[113]!==Oe||n[114]!==at?(Q=(0,v.jsx)(g,{items:Oe,strategy:te,children:at}),n[113]=Oe,n[114]=at,n[115]=Q):Q=n[115];let st;n[116]===Symbol.for(`react.memo_cache_sentinel`)?(st=(0,v.jsx)(d,{dropAnimation:null}),n[116]=st):st=n[116];let $;return n[117]!==Xe||n[118]!==Ie||n[119]!==Q?($=(0,v.jsxs)(f,{sensors:Ie,collisionDetection:u,onDragEnd:Xe,modifiers:ot,children:[Q,st]}),n[117]=Xe,n[118]=Ie,n[119]=Q,n[120]=$):$=n[120],$};function oe(e){return e.isMobile}function se(e){return e.id}function ce(e,t){return!e||!t?e===t:Math.abs(e.left-t.left)<.5&&Math.abs(e.top-t.top)<.5&&Math.abs(e.width-t.width)<.5&&Math.abs(e.height-t.height)<.5}function le(e){return e===null?e:null}function ue(e){return e===null?e:null}function de(e){e.button===1&&e.preventDefault()}function fe(e){e.stopPropagation()}function pe(e){e.stopPropagation()}function me(e){e.stopPropagation()}export{y as t};
@@ -1 +1 @@
1
- import{F as e,W as t}from"./useUIStore-5agS8bsW.js";import{kn as n}from"./persistence-oSFWyKgV.js";import{vt as r}from"./gitApiHttp-SLrnr8a5.js";var i=1,a=1,o=0,s=`/api/terminal/ws`,c=1200,l=250,u=2e4,d=5e3,f=`__openchamberTerminalTransportState`,p=new TextEncoder,m=new TextDecoder,h=t=>e().websocket(t),g=e=>{let t=p.encode(JSON.stringify(e)),n=new Uint8Array(t.length+1);return n[0]=i,n.set(t,1),n},_=e=>e?((e.transports??[]).includes(`ws`)||e.preferred===`ws`)&&typeof e.ws?.path==`string`&&e.ws.path.length>0:!1,v=e=>e.streamCapability?.ws?.path??e.inputCapability?.ws?.path??s,y=e=>{switch(e){case`SESSION_NOT_FOUND`:return Error(`Terminal session not found`);case`NOT_BOUND`:return Error(`Terminal session is not bound`);case`WRITE_FAIL`:return Error(`Failed to write to terminal`);case`RATE_LIMIT`:return Error(`Terminal websocket is rate limited`);case`BAD_FRAME`:return Error(`Terminal websocket protocol violation`);default:return Error(`Terminal websocket error`)}},b=class{socket=null;socketUrl=``;boundSessionId=null;requestedSessionId=null;openPromise=null;reconnectTimeout=null;keepaliveInterval=null;closed=!1;subscriptions=new Map;activeSubscriptionToken=null;replayCursorBySession=new Map;configure(e){if(e){if(this.socketUrl===e){this.closed=!1,this.isConnectedOrConnecting()||this.ensureConnected();return}this.socketUrl=e,this.closed=!1,this.resetConnection(),this.ensureConnected()}}subscribe(e,t,n,r){let i=Symbol(e),o={token:i,sessionId:e,onEvent:t,onError:n,maxRetries:r?.maxRetries??3,initialRetryDelay:r?.initialRetryDelay??1e3,maxRetryDelay:r?.maxRetryDelay??8e3,connectionTimeout:r?.connectionTimeout??1e4,retryCount:0,connected:!1,connectionTimeoutId:null};return this.subscriptions.set(i,o),this.activeSubscriptionToken=i,this.requestedSessionId=e,this.ensureConnected(),this.boundSessionId===e&&this.socket&&this.socket.readyState===a?(o.retryCount=0,o.connected=!0,o.onEvent({type:`connected`})):(this.boundSessionId=null,this.startConnectionTimeout(o),this.bindActiveSession()),()=>{if(this.clearConnectionTimeout(o),this.subscriptions.delete(i),this.activeSubscriptionToken===i&&(this.activeSubscriptionToken=null),this.hasSubscriptionForSession(e)||(this.boundSessionId===e&&(this.boundSessionId=null),this.requestedSessionId===e&&(this.requestedSessionId=null)),this.subscriptions.size===0){this.clearReconnectTimeout(),this.resetConnection();return}this.promoteActiveSubscription()}}async sendInput(e,t){if(!e||!t||this.closed||!this.socketUrl)return!1;let n=await this.getOpenSocket(c);if(!n||n.readyState!==a)return!1;try{return this.boundSessionId!==e&&(this.requestedSessionId=e,n.send(g({t:`b`,s:e,r:this.replayCursorBySession.get(e)??0,v:2}))),n.send(t),!0}catch{return this.handleSocketFailure(Error(`Terminal websocket send failed`)),!1}}unbindSession(e){e&&(this.boundSessionId===e&&(this.boundSessionId=null),this.requestedSessionId===e&&(this.requestedSessionId=null))}close(){this.closed=!0,this.clearReconnectTimeout();for(let e of this.subscriptions.values())this.clearConnectionTimeout(e);this.resetConnection(),this.socketUrl=``,this.subscriptions.clear(),this.activeSubscriptionToken=null,this.replayCursorBySession.clear()}prime(){this.closed||!this.socketUrl||this.isConnectedOrConnecting()||this.ensureConnected()}isConnectedOrConnecting(e){return this.closed||e&&this.socketUrl!==e?!1:this.socket&&(this.socket.readyState===a||this.socket.readyState===o)?!0:this.openPromise!==null}getActiveSubscription(){return this.activeSubscriptionToken?this.subscriptions.get(this.activeSubscriptionToken)??null:null}hasSubscriptionForSession(e){for(let t of this.subscriptions.values())if(t.sessionId===e)return!0;return!1}promoteActiveSubscription(){if(this.getActiveSubscription())return;let e=this.subscriptions.values().next().value;if(!e){this.activeSubscriptionToken=null;return}this.activeSubscriptionToken=e.token,this.requestedSessionId=e.sessionId,this.boundSessionId===e.sessionId?e.connected||(e.retryCount=0,e.connected=!0,this.clearConnectionTimeout(e),e.onEvent({type:`connected`})):(this.boundSessionId=null,this.startConnectionTimeout(e),this.bindActiveSession())}emitToSession(e,t){for(let n of this.subscriptions.values())n.sessionId===e&&n.onEvent(t)}markSessionConnected(e,t){for(let n of this.subscriptions.values())n.sessionId===e&&(n.retryCount=0,n.connected=!0,this.clearConnectionTimeout(n),n.onEvent(t))}emitErrorToSession(e,t,n){for(let r of this.subscriptions.values())r.sessionId===e&&(r.connected=!1,n&&this.clearConnectionTimeout(r),r.onError?.(t,n))}startConnectionTimeout(e){this.clearConnectionTimeout(e),e.connectionTimeoutId=setTimeout(()=>{e.connected||!this.subscriptions.has(e.token)||this.getActiveSubscription()?.token===e.token&&this.handleSocketFailure(Error(`Connection timeout`))},e.connectionTimeout)}clearConnectionTimeout(e){e.connectionTimeoutId&&=(clearTimeout(e.connectionTimeoutId),null)}async getOpenSocket(e){if(this.socket&&this.socket.readyState===a||(this.ensureConnected(),this.socket&&this.socket.readyState===a))return this.socket;let t=await Promise.race([this.openPromise??Promise.resolve(null),new Promise(t=>{setTimeout(()=>t(null),e)})]);return t&&t.readyState===a?t:this.socket&&this.socket.readyState===a?this.socket:null}ensureConnected(){this.closed||!this.socketUrl||this.socket&&(this.socket.readyState===a||this.socket.readyState===o)||(this.openPromise||=(this.clearReconnectTimeout(),(async()=>{try{await t()}catch{}return new Promise(e=>{let t=!1,n=null,i=r=>{t||(t=!0,n&&=(clearTimeout(n),null),this.openPromise=null,e(r))};try{let e=r(h(this.socketUrl));e.binaryType=`arraybuffer`,e.onopen=()=>{this.socket=e,this.startKeepalive(),i(e)},e.onmessage=e=>{this.handleSocketMessage(e.data)},e.onerror=()=>{!this.closed&&!this.getActiveSubscription()&&this.scheduleReconnect(Error(`Terminal websocket error`))},e.onclose=()=>{this.socket===e&&(this.socket=null,this.boundSessionId=null,this.stopKeepalive(),this.closed||this.scheduleReconnect(Error(`Terminal stream connection error`))),i(null)},this.socket=e,n=setTimeout(()=>{e.readyState===o&&(e.close(),i(null))},d)}catch{i(null),this.closed||this.scheduleReconnect(Error(`Terminal websocket open failed`))}})})()))}bindActiveSession(){let e=this.getActiveSubscription();if(!(!e||!this.socket||this.socket.readyState!==a)){this.requestedSessionId=e.sessionId;try{this.socket.send(g({t:`b`,s:e.sessionId,r:this.replayCursorBySession.get(e.sessionId)??0,v:2}))}catch{this.handleSocketFailure(Error(`Terminal websocket bind failed`))}}}scheduleReconnect(e){if(this.closed||!this.socketUrl||this.reconnectTimeout)return;this.promoteActiveSubscription();let t=this.getActiveSubscription();if(!t)return;let n=t.retryCount+1,r=t.initialRetryDelay,i=t.maxRetryDelay,a=t.maxRetries;if(n>a){this.clearConnectionTimeout(t),this.emitErrorToSession(t.sessionId,e,!0);return}t.retryCount=n;for(let e of this.subscriptions.values())e.sessionId===t.sessionId&&(e.connected=!1,e.retryCount=n,e.onEvent({type:`reconnecting`,attempt:n,maxAttempts:a}));this.startConnectionTimeout(t);let o=Math.min(r*2**Math.max(n-1,0),i)+Math.floor(Math.random()*l);this.reconnectTimeout=setTimeout(()=>{this.reconnectTimeout=null,this.ensureConnected(),this.bindActiveSession()},o)}clearReconnectTimeout(){this.reconnectTimeout&&=(clearTimeout(this.reconnectTimeout),null)}sendControl(e){if(!this.socket||this.socket.readyState!==a)return!1;try{return this.socket.send(g(e)),!0}catch{return this.handleSocketFailure(Error(`Terminal websocket control send failed`)),!1}}startKeepalive(){this.stopKeepalive(),this.keepaliveInterval=setInterval(()=>{this.closed||this.sendControl({t:`p`,v:2})},u)}stopKeepalive(){this.keepaliveInterval&&=(clearInterval(this.keepaliveInterval),null)}async handleSocketMessage(e){let t=await this.asUint8Array(e);if(t&&t.length>0&&t[0]===i){this.handleControlMessage(t);return}let n=await this.asText(e);if(!n)return;let r=this.boundSessionId??this.requestedSessionId??this.getActiveSubscription()?.sessionId;r&&this.emitToSession(r,{type:`data`,data:n})}handleControlMessage(e){if(e.length<2)return;let t;try{t=JSON.parse(m.decode(e.subarray(1)))}catch{this.handleSocketFailure(Error(`Terminal websocket control parse failed`));return}let n=this.getActiveSubscription();switch(t.t){case`ok`:this.bindActiveSession();return;case`po`:return;case`d`:{let e=t.s??this.boundSessionId??this.requestedSessionId;if(!e)return;typeof t.i==`number`&&Number.isFinite(t.i)&&this.replayCursorBySession.set(e,Math.max(this.replayCursorBySession.get(e)??0,Math.trunc(t.i))),typeof t.d==`string`&&t.d.length>0&&this.emitToSession(e,{type:`data`,data:t.d});return}case`bok`:{let e=t.s??this.requestedSessionId;if(this.boundSessionId=e,!e)return;this.markSessionConnected(e,{type:`connected`,runtime:t.runtime,ptyBackend:t.ptyBackend});return}case`x`:{let e=t.s??this.boundSessionId??n?.sessionId??null;if(!e){this.boundSessionId=null;return}this.boundSessionId===e&&(this.boundSessionId=null),this.requestedSessionId===e&&(this.requestedSessionId=null),this.replayCursorBySession.delete(e);for(let n of this.subscriptions.values())n.sessionId===e&&(n.connected=!1,this.clearConnectionTimeout(n),n.onEvent({type:`exit`,exitCode:t.exitCode,signal:t.signal??null}));return}case`e`:{let e=y(t.c),r=t.f===!0;(t.c===`NOT_BOUND`||t.c===`SESSION_NOT_FOUND`)&&(this.boundSessionId=null);let i=t.s??this.requestedSessionId??n?.sessionId??null;if(i){if(t.c===`SESSION_NOT_FOUND`){this.emitErrorToSession(i,e,!0);return}this.emitErrorToSession(i,e,r)}else n&&(n.connected=!1,r&&this.clearConnectionTimeout(n),n.onError?.(e,r));t.f===!0&&this.handleSocketFailure(e);return}default:return}}async asUint8Array(e){if(e instanceof ArrayBuffer)return new Uint8Array(e);if(e instanceof Uint8Array)return e;if(typeof Blob<`u`&&e instanceof Blob){let t=await e.arrayBuffer();return new Uint8Array(t)}return null}async asText(e){if(typeof e==`string`)return e;let t=await this.asUint8Array(e);return t?m.decode(t):``}handleSocketFailure(e){this.boundSessionId=null,this.requestedSessionId=null,this.resetConnection(),this.scheduleReconnect(e)}resetConnection(){if(this.openPromise=null,this.stopKeepalive(),this.socket){let e=this.socket;this.socket=null,e.onopen=null,e.onmessage=null,e.onerror=null,e.onclose=null,(e.readyState===a||e.readyState===o)&&e.close()}this.boundSessionId=null}},x=()=>{let e=globalThis;return e[f]||(e[f]={inputCapability:null,streamCapability:null,manager:null}),e[f]},S=()=>{let e=x();return e.manager||=new b,e.manager},C=e=>{let t=x();if(t.inputCapability=e?.input??null,t.streamCapability=e?.stream??null,!_(t.inputCapability)&&!_(t.streamCapability)){t.manager?.close(),t.manager=null;return}let n=h(v(t));n&&S().configure(n)},w=async(e,t)=>{let r=await n(`/api/terminal/${e}/input`,{method:`POST`,headers:{"Content-Type":`text/plain`},body:t});if(!r.ok){let e=await r.json().catch(()=>({error:`Failed to send terminal input`}));throw Error(e.error||`Failed to send terminal input`)}};async function T(e){let t=await n(`/api/terminal/create`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({cwd:e.cwd,cols:e.cols??80,rows:e.rows??24})});if(!t.ok){let e=await t.json().catch(()=>({error:`Failed to create terminal`}));throw Error(e.error||`Failed to create terminal session`)}let r=await t.json();return C(r.capabilities),r}var E=(t,n,r,i={})=>{let a=i.maxRetries??3,o=i.initialRetryDelay??1e3,s=i.maxRetryDelay??8e3,c=i.connectionTimeout??1e4,l=null,u=0,d=null,f=null,p=!1,m=!1,h=()=>{d&&=(clearTimeout(d),null),f&&=(clearTimeout(f),null)},g=()=>{p||(p=!0,h(),l&&=(l.close(),null))},_=(e,t)=>{if(!(p||m)){if(u<a&&!t){u+=1;let e=Math.min(o*2**(u-1),s);n({type:`reconnecting`,attempt:u,maxAttempts:a}),d=setTimeout(()=>{!p&&!m&&v()},e);return}r?.(e,!0),g()}},v=()=>{if(p||m||l&&l.readyState!==EventSource.CLOSED)return;l=new EventSource(e().sse(`/api/terminal/${t}/stream`));let i=!1;f=setTimeout(()=>{!i&&l?.readyState!==EventSource.OPEN&&(l?.close(),_(Error(`Connection timeout`),!1))},c),l.onopen=()=>{i||(i=!0,u=0,h(),n({type:`connected`}))},l.onmessage=e=>{try{let r=JSON.parse(e.data);r.type===`exit`&&(x().manager?.unbindSession(t),m=!0,g()),n(r)}catch(e){r?.(e,!1)}},l.onerror=()=>{h();let e=m||l?.readyState===EventSource.CLOSED;l?.close(),l=null,m||_(Error(`Terminal stream connection error`),e)}};return v(),g};function D(e,t,n,r={}){let i=x();if(i.streamCapability&&!_(i.streamCapability))return E(e,t,n,r);let a=S(),o=h(v(i));return o?(a.configure(o),a.subscribe(e,t,n,r)):E(e,t,n,r)}async function O(e,t){let n=x();n.manager&&await n.manager.sendInput(e,t)||await w(e,t)}async function k(e,t,r){let i=await n(`/api/terminal/${e}/resize`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({cols:t,rows:r})});if(!i.ok){let e=await i.json().catch(()=>({error:`Failed to resize terminal`}));throw Error(e.error||`Failed to resize terminal`)}}async function A(e){x().manager?.unbindSession(e);let t=await n(`/api/terminal/${e}`,{method:`DELETE`});if(!t.ok){let e=await t.json().catch(()=>({error:`Failed to close terminal`}));throw Error(e.error||`Failed to close terminal`)}}async function j(e,t){x().manager?.unbindSession(e);let r=await n(`/api/terminal/${e}/restart`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({cwd:t.cwd,cols:t.cols??80,rows:t.rows??24})});if(!r.ok){let e=await r.json().catch(()=>({error:`Failed to restart terminal`}));throw Error(e.error||`Failed to restart terminal`)}let i=await r.json();return C(i.capabilities),i}async function M(e){let t=await n(`/api/terminal/force-kill`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok){let e=await t.json().catch(()=>({error:`Failed to force kill terminal`}));throw Error(e.error||`Failed to force kill terminal`)}e.sessionId&&x().manager?.unbindSession(e.sessionId)}function N(){let e=x();e.manager?.close(),e.manager=null,e.inputCapability=null,e.streamCapability=null}function P(){let e=x();if(e.inputCapability&&e.streamCapability&&!_(e.inputCapability)&&!_(e.streamCapability))return;let t=h(v(e)||s);if(!t)return;let n=S();n.isConnectedOrConnecting(t)||(n.configure(t),n.prime())}export{M as a,j as c,N as i,O as l,D as n,P as o,T as r,k as s,A as t};
1
+ import{F as e,W as t}from"./useUIStore-5agS8bsW.js";import{kn as n}from"./persistence-D1lIuyqO.js";import{vt as r}from"./gitApiHttp-BxGAFLTf.js";var i=1,a=1,o=0,s=`/api/terminal/ws`,c=1200,l=250,u=2e4,d=5e3,f=`__openchamberTerminalTransportState`,p=new TextEncoder,m=new TextDecoder,h=t=>e().websocket(t),g=e=>{let t=p.encode(JSON.stringify(e)),n=new Uint8Array(t.length+1);return n[0]=i,n.set(t,1),n},_=e=>e?((e.transports??[]).includes(`ws`)||e.preferred===`ws`)&&typeof e.ws?.path==`string`&&e.ws.path.length>0:!1,v=e=>e.streamCapability?.ws?.path??e.inputCapability?.ws?.path??s,y=e=>{switch(e){case`SESSION_NOT_FOUND`:return Error(`Terminal session not found`);case`NOT_BOUND`:return Error(`Terminal session is not bound`);case`WRITE_FAIL`:return Error(`Failed to write to terminal`);case`RATE_LIMIT`:return Error(`Terminal websocket is rate limited`);case`BAD_FRAME`:return Error(`Terminal websocket protocol violation`);default:return Error(`Terminal websocket error`)}},b=class{socket=null;socketUrl=``;boundSessionId=null;requestedSessionId=null;openPromise=null;reconnectTimeout=null;keepaliveInterval=null;closed=!1;subscriptions=new Map;activeSubscriptionToken=null;replayCursorBySession=new Map;configure(e){if(e){if(this.socketUrl===e){this.closed=!1,this.isConnectedOrConnecting()||this.ensureConnected();return}this.socketUrl=e,this.closed=!1,this.resetConnection(),this.ensureConnected()}}subscribe(e,t,n,r){let i=Symbol(e),o={token:i,sessionId:e,onEvent:t,onError:n,maxRetries:r?.maxRetries??3,initialRetryDelay:r?.initialRetryDelay??1e3,maxRetryDelay:r?.maxRetryDelay??8e3,connectionTimeout:r?.connectionTimeout??1e4,retryCount:0,connected:!1,connectionTimeoutId:null};return this.subscriptions.set(i,o),this.activeSubscriptionToken=i,this.requestedSessionId=e,this.ensureConnected(),this.boundSessionId===e&&this.socket&&this.socket.readyState===a?(o.retryCount=0,o.connected=!0,o.onEvent({type:`connected`})):(this.boundSessionId=null,this.startConnectionTimeout(o),this.bindActiveSession()),()=>{if(this.clearConnectionTimeout(o),this.subscriptions.delete(i),this.activeSubscriptionToken===i&&(this.activeSubscriptionToken=null),this.hasSubscriptionForSession(e)||(this.boundSessionId===e&&(this.boundSessionId=null),this.requestedSessionId===e&&(this.requestedSessionId=null)),this.subscriptions.size===0){this.clearReconnectTimeout(),this.resetConnection();return}this.promoteActiveSubscription()}}async sendInput(e,t){if(!e||!t||this.closed||!this.socketUrl)return!1;let n=await this.getOpenSocket(c);if(!n||n.readyState!==a)return!1;try{return this.boundSessionId!==e&&(this.requestedSessionId=e,n.send(g({t:`b`,s:e,r:this.replayCursorBySession.get(e)??0,v:2}))),n.send(t),!0}catch{return this.handleSocketFailure(Error(`Terminal websocket send failed`)),!1}}unbindSession(e){e&&(this.boundSessionId===e&&(this.boundSessionId=null),this.requestedSessionId===e&&(this.requestedSessionId=null))}close(){this.closed=!0,this.clearReconnectTimeout();for(let e of this.subscriptions.values())this.clearConnectionTimeout(e);this.resetConnection(),this.socketUrl=``,this.subscriptions.clear(),this.activeSubscriptionToken=null,this.replayCursorBySession.clear()}prime(){this.closed||!this.socketUrl||this.isConnectedOrConnecting()||this.ensureConnected()}isConnectedOrConnecting(e){return this.closed||e&&this.socketUrl!==e?!1:this.socket&&(this.socket.readyState===a||this.socket.readyState===o)?!0:this.openPromise!==null}getActiveSubscription(){return this.activeSubscriptionToken?this.subscriptions.get(this.activeSubscriptionToken)??null:null}hasSubscriptionForSession(e){for(let t of this.subscriptions.values())if(t.sessionId===e)return!0;return!1}promoteActiveSubscription(){if(this.getActiveSubscription())return;let e=this.subscriptions.values().next().value;if(!e){this.activeSubscriptionToken=null;return}this.activeSubscriptionToken=e.token,this.requestedSessionId=e.sessionId,this.boundSessionId===e.sessionId?e.connected||(e.retryCount=0,e.connected=!0,this.clearConnectionTimeout(e),e.onEvent({type:`connected`})):(this.boundSessionId=null,this.startConnectionTimeout(e),this.bindActiveSession())}emitToSession(e,t){for(let n of this.subscriptions.values())n.sessionId===e&&n.onEvent(t)}markSessionConnected(e,t){for(let n of this.subscriptions.values())n.sessionId===e&&(n.retryCount=0,n.connected=!0,this.clearConnectionTimeout(n),n.onEvent(t))}emitErrorToSession(e,t,n){for(let r of this.subscriptions.values())r.sessionId===e&&(r.connected=!1,n&&this.clearConnectionTimeout(r),r.onError?.(t,n))}startConnectionTimeout(e){this.clearConnectionTimeout(e),e.connectionTimeoutId=setTimeout(()=>{e.connected||!this.subscriptions.has(e.token)||this.getActiveSubscription()?.token===e.token&&this.handleSocketFailure(Error(`Connection timeout`))},e.connectionTimeout)}clearConnectionTimeout(e){e.connectionTimeoutId&&=(clearTimeout(e.connectionTimeoutId),null)}async getOpenSocket(e){if(this.socket&&this.socket.readyState===a||(this.ensureConnected(),this.socket&&this.socket.readyState===a))return this.socket;let t=await Promise.race([this.openPromise??Promise.resolve(null),new Promise(t=>{setTimeout(()=>t(null),e)})]);return t&&t.readyState===a?t:this.socket&&this.socket.readyState===a?this.socket:null}ensureConnected(){this.closed||!this.socketUrl||this.socket&&(this.socket.readyState===a||this.socket.readyState===o)||(this.openPromise||=(this.clearReconnectTimeout(),(async()=>{try{await t()}catch{}return new Promise(e=>{let t=!1,n=null,i=r=>{t||(t=!0,n&&=(clearTimeout(n),null),this.openPromise=null,e(r))};try{let e=r(h(this.socketUrl));e.binaryType=`arraybuffer`,e.onopen=()=>{this.socket=e,this.startKeepalive(),i(e)},e.onmessage=e=>{this.handleSocketMessage(e.data)},e.onerror=()=>{!this.closed&&!this.getActiveSubscription()&&this.scheduleReconnect(Error(`Terminal websocket error`))},e.onclose=()=>{this.socket===e&&(this.socket=null,this.boundSessionId=null,this.stopKeepalive(),this.closed||this.scheduleReconnect(Error(`Terminal stream connection error`))),i(null)},this.socket=e,n=setTimeout(()=>{e.readyState===o&&(e.close(),i(null))},d)}catch{i(null),this.closed||this.scheduleReconnect(Error(`Terminal websocket open failed`))}})})()))}bindActiveSession(){let e=this.getActiveSubscription();if(!(!e||!this.socket||this.socket.readyState!==a)){this.requestedSessionId=e.sessionId;try{this.socket.send(g({t:`b`,s:e.sessionId,r:this.replayCursorBySession.get(e.sessionId)??0,v:2}))}catch{this.handleSocketFailure(Error(`Terminal websocket bind failed`))}}}scheduleReconnect(e){if(this.closed||!this.socketUrl||this.reconnectTimeout)return;this.promoteActiveSubscription();let t=this.getActiveSubscription();if(!t)return;let n=t.retryCount+1,r=t.initialRetryDelay,i=t.maxRetryDelay,a=t.maxRetries;if(n>a){this.clearConnectionTimeout(t),this.emitErrorToSession(t.sessionId,e,!0);return}t.retryCount=n;for(let e of this.subscriptions.values())e.sessionId===t.sessionId&&(e.connected=!1,e.retryCount=n,e.onEvent({type:`reconnecting`,attempt:n,maxAttempts:a}));this.startConnectionTimeout(t);let o=Math.min(r*2**Math.max(n-1,0),i)+Math.floor(Math.random()*l);this.reconnectTimeout=setTimeout(()=>{this.reconnectTimeout=null,this.ensureConnected(),this.bindActiveSession()},o)}clearReconnectTimeout(){this.reconnectTimeout&&=(clearTimeout(this.reconnectTimeout),null)}sendControl(e){if(!this.socket||this.socket.readyState!==a)return!1;try{return this.socket.send(g(e)),!0}catch{return this.handleSocketFailure(Error(`Terminal websocket control send failed`)),!1}}startKeepalive(){this.stopKeepalive(),this.keepaliveInterval=setInterval(()=>{this.closed||this.sendControl({t:`p`,v:2})},u)}stopKeepalive(){this.keepaliveInterval&&=(clearInterval(this.keepaliveInterval),null)}async handleSocketMessage(e){let t=await this.asUint8Array(e);if(t&&t.length>0&&t[0]===i){this.handleControlMessage(t);return}let n=await this.asText(e);if(!n)return;let r=this.boundSessionId??this.requestedSessionId??this.getActiveSubscription()?.sessionId;r&&this.emitToSession(r,{type:`data`,data:n})}handleControlMessage(e){if(e.length<2)return;let t;try{t=JSON.parse(m.decode(e.subarray(1)))}catch{this.handleSocketFailure(Error(`Terminal websocket control parse failed`));return}let n=this.getActiveSubscription();switch(t.t){case`ok`:this.bindActiveSession();return;case`po`:return;case`d`:{let e=t.s??this.boundSessionId??this.requestedSessionId;if(!e)return;typeof t.i==`number`&&Number.isFinite(t.i)&&this.replayCursorBySession.set(e,Math.max(this.replayCursorBySession.get(e)??0,Math.trunc(t.i))),typeof t.d==`string`&&t.d.length>0&&this.emitToSession(e,{type:`data`,data:t.d});return}case`bok`:{let e=t.s??this.requestedSessionId;if(this.boundSessionId=e,!e)return;this.markSessionConnected(e,{type:`connected`,runtime:t.runtime,ptyBackend:t.ptyBackend});return}case`x`:{let e=t.s??this.boundSessionId??n?.sessionId??null;if(!e){this.boundSessionId=null;return}this.boundSessionId===e&&(this.boundSessionId=null),this.requestedSessionId===e&&(this.requestedSessionId=null),this.replayCursorBySession.delete(e);for(let n of this.subscriptions.values())n.sessionId===e&&(n.connected=!1,this.clearConnectionTimeout(n),n.onEvent({type:`exit`,exitCode:t.exitCode,signal:t.signal??null}));return}case`e`:{let e=y(t.c),r=t.f===!0;(t.c===`NOT_BOUND`||t.c===`SESSION_NOT_FOUND`)&&(this.boundSessionId=null);let i=t.s??this.requestedSessionId??n?.sessionId??null;if(i){if(t.c===`SESSION_NOT_FOUND`){this.emitErrorToSession(i,e,!0);return}this.emitErrorToSession(i,e,r)}else n&&(n.connected=!1,r&&this.clearConnectionTimeout(n),n.onError?.(e,r));t.f===!0&&this.handleSocketFailure(e);return}default:return}}async asUint8Array(e){if(e instanceof ArrayBuffer)return new Uint8Array(e);if(e instanceof Uint8Array)return e;if(typeof Blob<`u`&&e instanceof Blob){let t=await e.arrayBuffer();return new Uint8Array(t)}return null}async asText(e){if(typeof e==`string`)return e;let t=await this.asUint8Array(e);return t?m.decode(t):``}handleSocketFailure(e){this.boundSessionId=null,this.requestedSessionId=null,this.resetConnection(),this.scheduleReconnect(e)}resetConnection(){if(this.openPromise=null,this.stopKeepalive(),this.socket){let e=this.socket;this.socket=null,e.onopen=null,e.onmessage=null,e.onerror=null,e.onclose=null,(e.readyState===a||e.readyState===o)&&e.close()}this.boundSessionId=null}},x=()=>{let e=globalThis;return e[f]||(e[f]={inputCapability:null,streamCapability:null,manager:null}),e[f]},S=()=>{let e=x();return e.manager||=new b,e.manager},C=e=>{let t=x();if(t.inputCapability=e?.input??null,t.streamCapability=e?.stream??null,!_(t.inputCapability)&&!_(t.streamCapability)){t.manager?.close(),t.manager=null;return}let n=h(v(t));n&&S().configure(n)},w=async(e,t)=>{let r=await n(`/api/terminal/${e}/input`,{method:`POST`,headers:{"Content-Type":`text/plain`},body:t});if(!r.ok){let e=await r.json().catch(()=>({error:`Failed to send terminal input`}));throw Error(e.error||`Failed to send terminal input`)}};async function T(e){let t=await n(`/api/terminal/create`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({cwd:e.cwd,cols:e.cols??80,rows:e.rows??24})});if(!t.ok){let e=await t.json().catch(()=>({error:`Failed to create terminal`}));throw Error(e.error||`Failed to create terminal session`)}let r=await t.json();return C(r.capabilities),r}var E=(t,n,r,i={})=>{let a=i.maxRetries??3,o=i.initialRetryDelay??1e3,s=i.maxRetryDelay??8e3,c=i.connectionTimeout??1e4,l=null,u=0,d=null,f=null,p=!1,m=!1,h=()=>{d&&=(clearTimeout(d),null),f&&=(clearTimeout(f),null)},g=()=>{p||(p=!0,h(),l&&=(l.close(),null))},_=(e,t)=>{if(!(p||m)){if(u<a&&!t){u+=1;let e=Math.min(o*2**(u-1),s);n({type:`reconnecting`,attempt:u,maxAttempts:a}),d=setTimeout(()=>{!p&&!m&&v()},e);return}r?.(e,!0),g()}},v=()=>{if(p||m||l&&l.readyState!==EventSource.CLOSED)return;l=new EventSource(e().sse(`/api/terminal/${t}/stream`));let i=!1;f=setTimeout(()=>{!i&&l?.readyState!==EventSource.OPEN&&(l?.close(),_(Error(`Connection timeout`),!1))},c),l.onopen=()=>{i||(i=!0,u=0,h(),n({type:`connected`}))},l.onmessage=e=>{try{let r=JSON.parse(e.data);r.type===`exit`&&(x().manager?.unbindSession(t),m=!0,g()),n(r)}catch(e){r?.(e,!1)}},l.onerror=()=>{h();let e=m||l?.readyState===EventSource.CLOSED;l?.close(),l=null,m||_(Error(`Terminal stream connection error`),e)}};return v(),g};function D(e,t,n,r={}){let i=x();if(i.streamCapability&&!_(i.streamCapability))return E(e,t,n,r);let a=S(),o=h(v(i));return o?(a.configure(o),a.subscribe(e,t,n,r)):E(e,t,n,r)}async function O(e,t){let n=x();n.manager&&await n.manager.sendInput(e,t)||await w(e,t)}async function k(e,t,r){let i=await n(`/api/terminal/${e}/resize`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({cols:t,rows:r})});if(!i.ok){let e=await i.json().catch(()=>({error:`Failed to resize terminal`}));throw Error(e.error||`Failed to resize terminal`)}}async function A(e){x().manager?.unbindSession(e);let t=await n(`/api/terminal/${e}`,{method:`DELETE`});if(!t.ok){let e=await t.json().catch(()=>({error:`Failed to close terminal`}));throw Error(e.error||`Failed to close terminal`)}}async function j(e,t){x().manager?.unbindSession(e);let r=await n(`/api/terminal/${e}/restart`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({cwd:t.cwd,cols:t.cols??80,rows:t.rows??24})});if(!r.ok){let e=await r.json().catch(()=>({error:`Failed to restart terminal`}));throw Error(e.error||`Failed to restart terminal`)}let i=await r.json();return C(i.capabilities),i}async function M(e){let t=await n(`/api/terminal/force-kill`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok){let e=await t.json().catch(()=>({error:`Failed to force kill terminal`}));throw Error(e.error||`Failed to force kill terminal`)}e.sessionId&&x().manager?.unbindSession(e.sessionId)}function N(){let e=x();e.manager?.close(),e.manager=null,e.inputCapability=null,e.streamCapability=null}function P(){let e=x();if(e.inputCapability&&e.streamCapability&&!_(e.inputCapability)&&!_(e.streamCapability))return;let t=h(v(e)||s);if(!t)return;let n=S();n.isConnectedOrConnecting(t)||(n.configure(t),n.prime())}export{M as a,j as c,N as i,O as l,D as n,P as o,T as r,k as s,A as t};
@@ -1 +1 @@
1
- import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{B as t,H as n,L as r,R as i,U as a,V as o,nt as s,rt as c,z as l}from"./vendor-base-ui-CnHfUmDN.js";import{n as u}from"./vendor-react-DLPElpoQ.js";import{t as d}from"./utils-Dxsi3J3l.js";var f=u(),p=e(c(),1),m=s(),h=600,g=1600,_=10,v=p.createContext(null),y=class extends p.Component{state={hasError:!1};static getDerivedStateFromError(){return{hasError:!0}}render(){return this.state.hasError?this.props.fallback??null:this.props.children}};function b(e){let t=(0,f.c)(12),n,i,a,o,s,c;t[0]===e?(n=t[1],i=t[2],a=t[3],o=t[4],s=t[5],c=t[6]):({delayDuration:s,skipDelayDuration:o,delay:i,closeDelay:n,timeout:c,...a}=e,t[0]=e,t[1]=n,t[2]=i,t[3]=a,t[4]=o,t[5]=s,t[6]=c);let l=i??(s===void 0?0:s),u=n??o,d;return t[7]!==a||t[8]!==l||t[9]!==u||t[10]!==c?(d=(0,m.jsx)(r,{delay:l,closeDelay:u,timeout:c,...a}),t[7]=a,t[8]=l,t[9]=u,t[10]=c,t[11]=d):d=t[11],d}function x(e){let t=(0,f.c)(35),n,r,i,o;t[0]===e?(n=t[1],r=t[2],i=t[3],o=t[4]):({delayDuration:n,open:i,onOpenChange:r,...o}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=o);let[s,c]=p.useState(!1),l=p.useRef(null),u=p.useRef(null),d=p.useRef(null),y=p.useRef(!1),x=i!==void 0,S=x?i:s,C;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(C=()=>{l.current!==null&&(window.clearTimeout(l.current),l.current=null)},t[5]=C):C=t[5];let w=C,T;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(T=()=>{u.current!==null&&(window.clearTimeout(u.current),u.current=null)},t[6]=T):T=t[6];let E=T,D;t[7]===x?D=t[8]:(D=e=>{x||c(e)},t[7]=x,t[8]=D);let O=D,k;t[9]!==x||t[10]!==O?(k=e=>{(e.pointerType===`touch`||e.pointerType===`pen`)&&(w(),E(),d.current={x:e.clientX,y:e.clientY},l.current=window.setTimeout(()=>{x||(y.current=!0,O(!0))},h))},t[9]=x,t[10]=O,t[11]=k):k=t[11];let A;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(A=e=>{let t=d.current;if(!t)return;let n=Math.abs(e.clientX-t.x),r=Math.abs(e.clientY-t.y);(n>_||r>_)&&(w(),d.current=null)},t[12]=A):A=t[12];let j;t[13]===O?j=t[14]:(j=()=>{w(),d.current=null,y.current&&(E(),u.current=window.setTimeout(()=>{y.current=!1,O(!1)},g))},t[13]=O,t[14]=j);let M,N;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(M=e=>{y.current&&(y.current=!1,e.preventDefault(),e.stopPropagation())},N=e=>{y.current&&e.preventDefault()},t[15]=M,t[16]=N):(M=t[15],N=t[16]);let P;t[17]!==k||t[18]!==j?(P={handlePointerDown:k,handlePointerMove:A,handlePointerEnd:j,handleClickCapture:M,handleContextMenu:N},t[17]=k,t[18]=j,t[19]=P):P=t[19];let F=P,I,L;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(I=()=>()=>{w(),E()},L=[E,w],t[20]=I,t[21]=L):(I=t[20],L=t[21]),p.useEffect(I,L);let R;t[22]!==x||t[23]!==r?(R=(e,t)=>{x||c(e),r?.(e,t)},t[22]=x,t[23]=r,t[24]=R):R=t[24];let z=R,B;t[25]!==z||t[26]!==o||t[27]!==S?(B=(0,m.jsx)(a,{open:S,onOpenChange:z,...o}),t[25]=z,t[26]=o,t[27]=S,t[28]=B):B=t[28];let V;t[29]!==F||t[30]!==B?(V=(0,m.jsx)(v.Provider,{value:F,children:B}),t[29]=F,t[30]=B,t[31]=V):V=t[31];let H=V;if(n===void 0)return H;let U;return t[32]!==n||t[33]!==H?(U=(0,m.jsx)(b,{delayDuration:n,children:H}),t[32]=n,t[33]=H,t[34]=U):U=t[34],U}function S(e){let t=(0,f.c)(43),r,i,a,o,s,c,l,u,d;t[0]===e?(r=t[1],i=t[2],a=t[3],o=t[4],s=t[5],c=t[6],l=t[7],u=t[8],d=t[9]):({asChild:r,children:i,onPointerDown:c,onPointerMove:l,onPointerUp:u,onPointerCancel:s,onClickCapture:a,onContextMenu:o,...d}=e,t[0]=e,t[1]=r,t[2]=i,t[3]=a,t[4]=o,t[5]=s,t[6]=c,t[7]=l,t[8]=u,t[9]=d);let h=p.useContext(v),g;t[10]!==r||t[11]!==i?(g=r&&p.isValidElement(i)?{render:i}:{children:i},t[10]=r,t[11]=i,t[12]=g):g=t[12];let _=g,b;t[13]!==h||t[14]!==c?(b=e=>{c?.(e),h?.handlePointerDown(e)},t[13]=h,t[14]=c,t[15]=b):b=t[15];let x;t[16]!==h||t[17]!==l?(x=e=>{l?.(e),h?.handlePointerMove(e)},t[16]=h,t[17]=l,t[18]=x):x=t[18];let S;t[19]!==h||t[20]!==u?(S=e=>{u?.(e),h?.handlePointerEnd()},t[19]=h,t[20]=u,t[21]=S):S=t[21];let C;t[22]!==h||t[23]!==s?(C=e=>{s?.(e),h?.handlePointerEnd()},t[22]=h,t[23]=s,t[24]=C):C=t[24];let w;t[25]!==h||t[26]!==a?(w=e=>{h?.handleClickCapture(e),!e.defaultPrevented&&a?.(e)},t[25]=h,t[26]=a,t[27]=w):w=t[27];let T;t[28]!==h||t[29]!==o?(T=e=>{h?.handleContextMenu(e),!e.defaultPrevented&&o?.(e)},t[28]=h,t[29]=o,t[30]=T):T=t[30];let E;t[31]!==d||t[32]!==_||t[33]!==b||t[34]!==x||t[35]!==S||t[36]!==C||t[37]!==w||t[38]!==T?(E=(0,m.jsx)(n,{"data-slot":`tooltip-trigger`,onPointerDown:b,onPointerMove:x,onPointerUp:S,onPointerCancel:C,onClickCapture:w,onContextMenu:T,...d,..._}),t[31]=d,t[32]=_,t[33]=b,t[34]=x,t[35]=S,t[36]=C,t[37]=w,t[38]=T,t[39]=E):E=t[39];let D;return t[40]!==i||t[41]!==E?(D=(0,m.jsx)(y,{fallback:i,children:E}),t[40]=i,t[41]=E,t[42]=D):D=t[42],D}function C(e){let n=(0,f.c)(23),r,a,s,c,u,p,h;n[0]===e?(r=n[1],a=n[2],s=n[3],c=n[4],u=n[5],p=n[6],h=n[7]):({className:s,sideOffset:h,side:u,align:r,children:a,style:p,...c}=e,n[0]=e,n[1]=r,n[2]=a,n[3]=s,n[4]=c,n[5]=u,n[6]=p,n[7]=h);let g=h===void 0?0:h,_;n[8]===s?_=n[9]:(_=d(`bg-[var(--surface-elevated)] text-[var(--surface-elevated-foreground)] border border-border/60 transition-all duration-150 ease-out data-[starting-style]:opacity-0 data-[starting-style]:scale-95 data-[ending-style]:opacity-0 data-[ending-style]:scale-95 z-50 w-fit origin-[var(--transform-origin)] rounded-xl px-3 py-1.5 typography-meta text-balance overflow-hidden`,s),n[8]=s,n[9]=_);let v;n[10]===p?v=n[11]:(v={...p},n[10]=p,n[11]=v);let b;n[12]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,m.jsx)(i,{className:`fill-[var(--surface-elevated)] z-50 size-2`}),n[12]=b):b=n[12];let x;n[13]!==a||n[14]!==c||n[15]!==_||n[16]!==v?(x=(0,m.jsxs)(l,{"data-slot":`tooltip-content`,className:_,style:v,...c,children:[a,b]}),n[13]=a,n[14]=c,n[15]=_,n[16]=v,n[17]=x):x=n[17];let S;return n[18]!==r||n[19]!==u||n[20]!==g||n[21]!==x?(S=(0,m.jsx)(y,{children:(0,m.jsx)(o,{children:(0,m.jsx)(t,{sideOffset:g,side:u,align:r,className:`z-50`,children:x})})}),n[18]=r,n[19]=u,n[20]=g,n[21]=x,n[22]=S):S=n[22],S}export{S as i,C as n,b as r,x as t};
1
+ import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{B as t,H as n,L as r,R as i,U as a,V as o,nt as s,rt as c,z as l}from"./vendor-base-ui-CnHfUmDN.js";import{n as u}from"./vendor-react-DLPElpoQ.js";import{t as d}from"./utils-BxJEIWv5.js";var f=u(),p=e(c(),1),m=s(),h=600,g=1600,_=10,v=p.createContext(null),y=class extends p.Component{state={hasError:!1};static getDerivedStateFromError(){return{hasError:!0}}render(){return this.state.hasError?this.props.fallback??null:this.props.children}};function b(e){let t=(0,f.c)(12),n,i,a,o,s,c;t[0]===e?(n=t[1],i=t[2],a=t[3],o=t[4],s=t[5],c=t[6]):({delayDuration:s,skipDelayDuration:o,delay:i,closeDelay:n,timeout:c,...a}=e,t[0]=e,t[1]=n,t[2]=i,t[3]=a,t[4]=o,t[5]=s,t[6]=c);let l=i??(s===void 0?0:s),u=n??o,d;return t[7]!==a||t[8]!==l||t[9]!==u||t[10]!==c?(d=(0,m.jsx)(r,{delay:l,closeDelay:u,timeout:c,...a}),t[7]=a,t[8]=l,t[9]=u,t[10]=c,t[11]=d):d=t[11],d}function x(e){let t=(0,f.c)(35),n,r,i,o;t[0]===e?(n=t[1],r=t[2],i=t[3],o=t[4]):({delayDuration:n,open:i,onOpenChange:r,...o}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=o);let[s,c]=p.useState(!1),l=p.useRef(null),u=p.useRef(null),d=p.useRef(null),y=p.useRef(!1),x=i!==void 0,S=x?i:s,C;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(C=()=>{l.current!==null&&(window.clearTimeout(l.current),l.current=null)},t[5]=C):C=t[5];let w=C,T;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(T=()=>{u.current!==null&&(window.clearTimeout(u.current),u.current=null)},t[6]=T):T=t[6];let E=T,D;t[7]===x?D=t[8]:(D=e=>{x||c(e)},t[7]=x,t[8]=D);let O=D,k;t[9]!==x||t[10]!==O?(k=e=>{(e.pointerType===`touch`||e.pointerType===`pen`)&&(w(),E(),d.current={x:e.clientX,y:e.clientY},l.current=window.setTimeout(()=>{x||(y.current=!0,O(!0))},h))},t[9]=x,t[10]=O,t[11]=k):k=t[11];let A;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(A=e=>{let t=d.current;if(!t)return;let n=Math.abs(e.clientX-t.x),r=Math.abs(e.clientY-t.y);(n>_||r>_)&&(w(),d.current=null)},t[12]=A):A=t[12];let j;t[13]===O?j=t[14]:(j=()=>{w(),d.current=null,y.current&&(E(),u.current=window.setTimeout(()=>{y.current=!1,O(!1)},g))},t[13]=O,t[14]=j);let M,N;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(M=e=>{y.current&&(y.current=!1,e.preventDefault(),e.stopPropagation())},N=e=>{y.current&&e.preventDefault()},t[15]=M,t[16]=N):(M=t[15],N=t[16]);let P;t[17]!==k||t[18]!==j?(P={handlePointerDown:k,handlePointerMove:A,handlePointerEnd:j,handleClickCapture:M,handleContextMenu:N},t[17]=k,t[18]=j,t[19]=P):P=t[19];let F=P,I,L;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(I=()=>()=>{w(),E()},L=[E,w],t[20]=I,t[21]=L):(I=t[20],L=t[21]),p.useEffect(I,L);let R;t[22]!==x||t[23]!==r?(R=(e,t)=>{x||c(e),r?.(e,t)},t[22]=x,t[23]=r,t[24]=R):R=t[24];let z=R,B;t[25]!==z||t[26]!==o||t[27]!==S?(B=(0,m.jsx)(a,{open:S,onOpenChange:z,...o}),t[25]=z,t[26]=o,t[27]=S,t[28]=B):B=t[28];let V;t[29]!==F||t[30]!==B?(V=(0,m.jsx)(v.Provider,{value:F,children:B}),t[29]=F,t[30]=B,t[31]=V):V=t[31];let H=V;if(n===void 0)return H;let U;return t[32]!==n||t[33]!==H?(U=(0,m.jsx)(b,{delayDuration:n,children:H}),t[32]=n,t[33]=H,t[34]=U):U=t[34],U}function S(e){let t=(0,f.c)(43),r,i,a,o,s,c,l,u,d;t[0]===e?(r=t[1],i=t[2],a=t[3],o=t[4],s=t[5],c=t[6],l=t[7],u=t[8],d=t[9]):({asChild:r,children:i,onPointerDown:c,onPointerMove:l,onPointerUp:u,onPointerCancel:s,onClickCapture:a,onContextMenu:o,...d}=e,t[0]=e,t[1]=r,t[2]=i,t[3]=a,t[4]=o,t[5]=s,t[6]=c,t[7]=l,t[8]=u,t[9]=d);let h=p.useContext(v),g;t[10]!==r||t[11]!==i?(g=r&&p.isValidElement(i)?{render:i}:{children:i},t[10]=r,t[11]=i,t[12]=g):g=t[12];let _=g,b;t[13]!==h||t[14]!==c?(b=e=>{c?.(e),h?.handlePointerDown(e)},t[13]=h,t[14]=c,t[15]=b):b=t[15];let x;t[16]!==h||t[17]!==l?(x=e=>{l?.(e),h?.handlePointerMove(e)},t[16]=h,t[17]=l,t[18]=x):x=t[18];let S;t[19]!==h||t[20]!==u?(S=e=>{u?.(e),h?.handlePointerEnd()},t[19]=h,t[20]=u,t[21]=S):S=t[21];let C;t[22]!==h||t[23]!==s?(C=e=>{s?.(e),h?.handlePointerEnd()},t[22]=h,t[23]=s,t[24]=C):C=t[24];let w;t[25]!==h||t[26]!==a?(w=e=>{h?.handleClickCapture(e),!e.defaultPrevented&&a?.(e)},t[25]=h,t[26]=a,t[27]=w):w=t[27];let T;t[28]!==h||t[29]!==o?(T=e=>{h?.handleContextMenu(e),!e.defaultPrevented&&o?.(e)},t[28]=h,t[29]=o,t[30]=T):T=t[30];let E;t[31]!==d||t[32]!==_||t[33]!==b||t[34]!==x||t[35]!==S||t[36]!==C||t[37]!==w||t[38]!==T?(E=(0,m.jsx)(n,{"data-slot":`tooltip-trigger`,onPointerDown:b,onPointerMove:x,onPointerUp:S,onPointerCancel:C,onClickCapture:w,onContextMenu:T,...d,..._}),t[31]=d,t[32]=_,t[33]=b,t[34]=x,t[35]=S,t[36]=C,t[37]=w,t[38]=T,t[39]=E):E=t[39];let D;return t[40]!==i||t[41]!==E?(D=(0,m.jsx)(y,{fallback:i,children:E}),t[40]=i,t[41]=E,t[42]=D):D=t[42],D}function C(e){let n=(0,f.c)(23),r,a,s,c,u,p,h;n[0]===e?(r=n[1],a=n[2],s=n[3],c=n[4],u=n[5],p=n[6],h=n[7]):({className:s,sideOffset:h,side:u,align:r,children:a,style:p,...c}=e,n[0]=e,n[1]=r,n[2]=a,n[3]=s,n[4]=c,n[5]=u,n[6]=p,n[7]=h);let g=h===void 0?0:h,_;n[8]===s?_=n[9]:(_=d(`bg-[var(--surface-elevated)] text-[var(--surface-elevated-foreground)] border border-border/60 transition-all duration-150 ease-out data-[starting-style]:opacity-0 data-[starting-style]:scale-95 data-[ending-style]:opacity-0 data-[ending-style]:scale-95 z-50 w-fit origin-[var(--transform-origin)] rounded-xl px-3 py-1.5 typography-meta text-balance overflow-hidden`,s),n[8]=s,n[9]=_);let v;n[10]===p?v=n[11]:(v={...p},n[10]=p,n[11]=v);let b;n[12]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,m.jsx)(i,{className:`fill-[var(--surface-elevated)] z-50 size-2`}),n[12]=b):b=n[12];let x;n[13]!==a||n[14]!==c||n[15]!==_||n[16]!==v?(x=(0,m.jsxs)(l,{"data-slot":`tooltip-content`,className:_,style:v,...c,children:[a,b]}),n[13]=a,n[14]=c,n[15]=_,n[16]=v,n[17]=x):x=n[17];let S;return n[18]!==r||n[19]!==u||n[20]!==g||n[21]!==x?(S=(0,m.jsx)(y,{children:(0,m.jsx)(o,{children:(0,m.jsx)(t,{sideOffset:g,side:u,align:r,className:`z-50`,children:x})})}),n[18]=r,n[19]=u,n[20]=g,n[21]=x,n[22]=S):S=n[22],S}export{S as i,C as n,b as r,x as t};
@@ -1 +1 @@
1
- import{xn as e}from"./persistence-oSFWyKgV.js";var t=e=>{try{return new URL(e)}catch{return null}},n=e=>{let n=t(e.trim());return n?n.protocol===`http:`||n.protocol===`https:`:!1},r=e=>{let n=t(e.trim());return!n||n.protocol!==`http:`&&n.protocol!==`https:`?null:`https://icons.duckduckgo.com/ip3/${n.hostname.toLowerCase()}.ico`},i=new Set([`localhost`,`127.0.0.1`,`0.0.0.0`,`::1`]),a=e=>{let n=t(e.trim());return!n||n.protocol!==`http:`&&n.protocol!==`https:`?!1:i.has(n.hostname.toLowerCase())},o=/\bhttps?:\/\/(?:localhost|127\.0\.0\.1|0\.0\.0\.0|\[::1\])(?::\d{2,5})?(?:\/[^\s<>"'`\u0000-\u001f]*)?/gi,s=e=>{if(!e)return[];let t=e.match(o);if(!t||t.length===0)return[];let n=new Set,r=[];for(let e of t){let t=e.replace(/[),.;:!?'"`]+$/g,``);!t||!a(t)||n.has(t)||(n.add(t),r.push(t))}return r},c=async n=>{if(typeof window>`u`)return!1;let r=n.trim();if(!r)return!1;let i=t(r);if(!i||i.protocol!==`http:`&&i.protocol!==`https:`)return!1;let a=i.toString(),o=e();if(o?.runtime?.isVSCode&&o.vscode?.openExternalUrl)try{return await o.vscode.openExternalUrl(a),!0}catch{return!1}let s=window.__OPENCHAMBER_DESKTOP__;if(s?.openExternal)try{return await s.openExternal(a),!0}catch{}try{return window.open(a,`_blank`,`noopener,noreferrer`),!0}catch{return!1}};export{c as a,a as i,r as n,n as r,s as t};
1
+ import{xn as e}from"./persistence-D1lIuyqO.js";var t=e=>{try{return new URL(e)}catch{return null}},n=e=>{let n=t(e.trim());return n?n.protocol===`http:`||n.protocol===`https:`:!1},r=e=>{let n=t(e.trim());return!n||n.protocol!==`http:`&&n.protocol!==`https:`?null:`https://icons.duckduckgo.com/ip3/${n.hostname.toLowerCase()}.ico`},i=new Set([`localhost`,`127.0.0.1`,`0.0.0.0`,`::1`]),a=e=>{let n=t(e.trim());return!n||n.protocol!==`http:`&&n.protocol!==`https:`?!1:i.has(n.hostname.toLowerCase())},o=/\bhttps?:\/\/(?:localhost|127\.0\.0\.1|0\.0\.0\.0|\[::1\])(?::\d{2,5})?(?:\/[^\s<>"'`\u0000-\u001f]*)?/gi,s=e=>{if(!e)return[];let t=e.match(o);if(!t||t.length===0)return[];let n=new Set,r=[];for(let e of t){let t=e.replace(/[),.;:!?'"`]+$/g,``);!t||!a(t)||n.has(t)||(n.add(t),r.push(t))}return r},c=async n=>{if(typeof window>`u`)return!1;let r=n.trim();if(!r)return!1;let i=t(r);if(!i||i.protocol!==`http:`&&i.protocol!==`https:`)return!1;let a=i.toString(),o=e();if(o?.runtime?.isVSCode&&o.vscode?.openExternalUrl)try{return await o.vscode.openExternalUrl(a),!0}catch{return!1}let s=window.__OPENCHAMBER_DESKTOP__;if(s?.openExternal)try{return await s.openExternal(a),!0}catch{}try{return window.open(a,`_blank`,`noopener,noreferrer`),!0}catch{return!1}};export{c as a,a as i,r as n,n as r,s as t};