@openchambery/web 2.0.2 → 2.0.4
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/dist/assets/{AgentAvatar-DGyF86jy.js → AgentAvatar-C1MGZ7qC.js} +1 -1
- package/dist/assets/{AssistantView-CWviBCAP.js → AssistantView-Y72USwfd.js} +3 -3
- package/dist/assets/{DiagramView-Cm7xDZ5t.js → DiagramView-Xd0Y9pFL.js} +1 -1
- package/dist/assets/{FadeInOnReveal-B_a083XJ.js → FadeInOnReveal-BMSk_tY-.js} +1 -1
- package/dist/assets/{Icon-BE2hkaYc.js → Icon-BdzPRCSy.js} +1 -1
- package/dist/assets/{MarkdownRenderer-CJ5t5GCJ.js → MarkdownRenderer-D0u2up4b.js} +2 -2
- package/dist/assets/{MarkdownRendererImpl-De4VmTtg.js → MarkdownRendererImpl-CHrzGUh-.js} +1 -1
- package/dist/assets/{MarkstreamRendererImpl-B0zZVAuv.js → MarkstreamRendererImpl-BjOVcyq6.js} +1 -1
- package/dist/assets/{MobileDetailNavigation-BOuvF4sv.js → MobileDetailNavigation-B85bSHfm.js} +1 -1
- package/dist/assets/{MobileShareBridge-Brsf5H1u.js → MobileShareBridge-Clbjij66.js} +2 -2
- package/dist/assets/{MobileTabPageHeader-BLlFC_jN.js → MobileTabPageHeader-CZYnRNrJ.js} +1 -1
- package/dist/assets/{MultiRunWindow-BUdK_rVf.js → MultiRunWindow-DWwuCGKB.js} +1 -1
- package/dist/assets/{OnboardingScreen-CTmsNR65.js → OnboardingScreen-yRdQTR1M.js} +1 -1
- package/dist/assets/{OverlayScrollbar-CVgW_Z9B.js → OverlayScrollbar-C1C2aKOe.js} +1 -1
- package/dist/assets/{SettingsView-LnqgjCmk.js → SettingsView-C5FGGWQn.js} +1 -1
- package/dist/assets/{SettingsWindow-AfOCGfXC.js → SettingsWindow-DtJUb9wU.js} +1 -1
- package/dist/assets/{TerminalView-Csox-OUH.js → TerminalView-CzUc4u4f.js} +1 -1
- package/dist/assets/{ToolOutputDialog-DYnLpM-I.js → ToolOutputDialog-DnP_QW3e.js} +1 -1
- package/dist/assets/{appThemeRegistry-Dh7evuFT.js → appThemeRegistry-Cnz7idBI.js} +1 -1
- package/dist/assets/{button-CcOoDLE1.js → button-CUwjpv-i.js} +1 -1
- package/dist/assets/{collapsible-CSa0Ndgm.js → collapsible-paItOH3A.js} +1 -1
- package/dist/assets/{context-menu-DoTwmMb5.js → context-menu-K6zNumqN.js} +1 -1
- package/dist/assets/{desktopHosts-BsbquPqS.js → desktopHosts-DuftEj8B.js} +1 -1
- package/dist/assets/{desktopRelayRestore-yyvjztgj.js → desktopRelayRestore-g378BdZf.js} +1 -1
- package/dist/assets/{diagram-CZKDkADZ.js → diagram-D6nY5hbD.js} +1 -1
- package/dist/assets/{dialog-Csvrld51.js → dialog-PjKWayIU.js} +1 -1
- package/dist/assets/{fileMentionTouchSelection-DGcKhwNg.js → fileMentionTouchSelection-CMGShRdq.js} +1 -1
- package/dist/assets/{fileQueries-B0hhXD86.js → fileQueries-DuF89nFO.js} +1 -1
- package/dist/assets/{gitApi-DJiNTnOw.js → gitApi-DPIAo6AB.js} +1 -1
- package/dist/assets/{input-C6Y7mytw.js → input-BeVw4D0W.js} +1 -1
- package/dist/assets/{insertionBoundaries-BZ4y7_dO.js → insertionBoundaries-CAhSO2qM.js} +1 -1
- package/dist/assets/{main-C5K1b2p3.js → main-BgNyhmKO.js} +4 -4
- package/dist/assets/{main-D10YD-D5.js → main-CY0Y_T_f.js} +2 -2
- package/dist/assets/{markdownHeightCache-DhLhFBWX.js → markdownHeightCache-CGCWmHgq.js} +1 -1
- package/dist/assets/{mcpQueries-om4qg52L.js → mcpQueries-BCDH_NGG.js} +1 -1
- package/dist/assets/{miniChat-YtAlWDXn.js → miniChat-DscZUsmi.js} +2 -2
- package/dist/assets/{mobile-Bix-1h3p.js → mobile-Be9-z8A1.js} +2 -2
- package/dist/assets/{multirun-Cl0qI_UR.js → multirun-DsxjQIo7.js} +1 -1
- package/dist/assets/{persistence-CwHY3fDg.js → persistence-Dnj1QOdX.js} +1 -1
- package/dist/assets/{platform-Bxaalnc8.js → platform-wu6wSDfg.js} +2 -2
- package/dist/assets/{projectMeta-ClpG1g5k.js → projectMeta-xQxAvK1l.js} +1 -1
- package/dist/assets/{renderElectronMiniChatApp-knc9ALFK.js → renderElectronMiniChatApp-pTn3DEBh.js} +2 -2
- package/dist/assets/{renderMobileApp-DvPGytV9.js → renderMobileApp-BCB81a-l.js} +4 -4
- package/dist/assets/{runtimeConfig-CkGIFPXV.js → runtimeConfig-CKl-mBYT.js} +1 -1
- package/dist/assets/{runtimeEndpointReset-BFrS_Yci.js → runtimeEndpointReset-C5JDWXSU.js} +1 -1
- package/dist/assets/{sessionChangeSummary-DYAsA6Bi.js → sessionChangeSummary-7rvSC3xH.js} +1 -1
- package/dist/assets/{sessionLookup-Bc8f5Scn.js → sessionLookup-B2wYOGDO.js} +1 -1
- package/dist/assets/{sortable-tabs-strip-CKKp4p3Y.js → sortable-tabs-strip-NN4v9dLg.js} +1 -1
- package/dist/assets/{terminalApi-DSJOXNRQ.js → terminalApi-DXyzaX3K.js} +1 -1
- package/dist/assets/{textarea-DUjc3iDJ.js → textarea-Kl-rTWJe.js} +1 -1
- package/dist/assets/{tooltip-CBHR50fA.js → tooltip-DDNnmcXI.js} +1 -1
- package/dist/assets/{url-CEnO45_n.js → url-DNRMq_0R.js} +1 -1
- package/dist/assets/{useAppFontEffects-CU_CeyJe.js → useAppFontEffects-BLbI4EVg.js} +5 -5
- package/dist/assets/{useAssistantUIStore-CXj8c_tt.js → useAssistantUIStore-DBwfg9nX.js} +1 -1
- package/dist/assets/{useDesktopWindowControlsLayout-D5pQxhEz.js → useDesktopWindowControlsLayout-BXno7oRc.js} +1 -1
- package/dist/assets/{useEffectiveDirectory-Cn5YmSaO.js → useEffectiveDirectory-Bl-L1jZ9.js} +1 -1
- package/dist/assets/{useFontPreferences-DGbTdGy3.js → useFontPreferences-Cw2aKlz7.js} +1 -1
- package/dist/assets/{useMobileNavigationStore-Bww4SOiv.js → useMobileNavigationStore-sj7H-l-J.js} +4 -4
- package/dist/assets/{useSessionAutoCleanup--P_vAP6v.js → useSessionAutoCleanup-D_75uDE8.js} +1 -1
- package/dist/assets/{useUIStore-DNkuudYO.js → useUIStore-Dfx6TKvi.js} +1 -1
- package/dist/assets/{useWorkerHighlightedLines-DOkM0xy4.js → useWorkerHighlightedLines-BaI1QA2c.js} +1 -1
- package/dist/index.html +8 -8
- package/dist/mini-chat.html +8 -8
- package/dist/mobile.html +8 -8
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{nt as t,rt as n}from"./vendor-base-ui-CnHfUmDN.js";import{n as r}from"./useUIStore-DNkuudYO.js";import{n as i}from"./vendor-react-DLPElpoQ.js";import{f as a,r as o}from"./button-CcOoDLE1.js";import{n as s}from"./Icon-BE2hkaYc.js";import{i as c}from"./OverlayScrollbar-CVgW_Z9B.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(n(),1),v=t(),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 t=(0,ne.c)(121),{items:n,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=r(oe),{isTablet:Ee}=c(),T=w||Ee,E=_.useRef(null),De;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(De={left:!1,right:!1},t[0]=De):De=t[0];let[D,O]=_.useState(De),k;t[1]===n?k=t[2]:(k=n.map(se),t[1]=n,t[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;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(L=new Map,t[3]=L):L=t[3];let R=_.useRef(L),[z,Pe]=_.useState(null),Fe;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(Fe={activationConstraint:{distance:8}},t[4]=Fe):Fe=t[4];let Ie=p(l(ee,Fe)),Le=ce,Re;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(Re=(e,t)=>{if(t){R.current.set(e,t);return}R.current.delete(e)},t[5]=Re):Re=t[5];let ze=Re,Be;t[6]!==i||t[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)},t[6]=i,t[7]=P,t[8]=Be):Be=t[8];let B=Be,Ve;t[9]===A?Ve=t[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})},t[9]=A,t[10]=Ve);let V=Ve,He;t[11]!==A||t[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()}},t[11]=A,t[12]=V,t[13]=He):He=t[13];let Ue;t[14]!==A||t[15]!==n.length||t[16]!==V?(Ue=[A,n.length,V],t[14]=A,t[15]=n.length,t[16]=V,t[17]=Ue):Ue=t[17],_.useEffect(He,Ue);let We;t[18]!==i||t[19]!==B||t[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()}},t[18]=i,t[19]=B,t[20]=P,t[21]=We):We=t[21];let Ge;t[22]!==i||t[23]!==n.length||t[24]!==B||t[25]!==P?(Ge=[i,n.length,B,P],t[22]=i,t[23]=n.length,t[24]=B,t[25]=P,t[26]=Ge):Ge=t[26],_.useEffect(We,Ge);let Ke;t[27]===B?Ke=t[28]:(Ke=()=>{B()},t[27]=B,t[28]=Ke),_.useLayoutEffect(Ke);let qe;t[29]!==i||t[30]!==A||t[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)}},t[29]=i,t[30]=A,t[31]=V,t[32]=qe):qe=t[32];let Je;t[33]!==i||t[34]!==A||t[35]!==n.length||t[36]!==V?(Je=[i,A,n.length,V],t[33]=i,t[34]=A,t[35]=n.length,t[36]=V,t[37]=Je):Je=t[37],_.useEffect(qe,Je);let Ye;t[38]===y?Ye=t[39]:(Ye=e=>{if(!y)return;let{active:t,over:n}=e;!n||t.id===n.id||y(String(t.id),String(n.id))},t[38]=y,t[39]=Ye);let Xe=Ye,H;t[40]===Se?H=t[41]:(H=o(`relative flex h-full min-w-0 flex-1`,Se),t[40]=Se,t[41]=H);let U;t[42]!==A||t[43]!==D||t[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,t[42]=A,t[43]=D,t[44]=M,t[45]=U):U=t[45];let W;t[46]!==A||t[47]!==D||t[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,t[46]=A,t[47]=D,t[48]=M,t[49]=W):W=t[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;t[50]!==Ze||t[51]!==Qe||t[52]!==$e||t[53]!==et||t[54]!==tt||t[55]!==nt||t[56]!==rt?(G=o(`relative flex h-full min-w-0 flex-1`,Ze,Qe,$e,et,tt,nt,rt),t[50]=Ze,t[51]=Qe,t[52]=$e,t[53]=et,t[54]=tt,t[55]=nt,t[56]=rt,t[57]=G):G=t[57];let K;t[58]===A?K=t[59]:(K=A?{scrollbarWidth:`none`,msOverflowStyle:`none`}:void 0,t[58]=A,t[59]=K);let q;t[60]===Te?q=t[61]:(q=Te(`sortableTabsStrip.aria.tabs`),t[60]=Te,t[61]=q);let J;t[62]!==z||t[63]!==Me||t[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,t[62]=z,t[63]=Me,t[64]=M,t[65]=J):J=t[65];let Y;t[66]!==z||t[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,t[66]=z,t[67]=N,t[68]=Y):Y=t[68];let X;if(t[69]!==I||t[70]!==i||t[71]!==b||t[72]!==C||t[73]!==T||t[74]!==S||t[75]!==x||t[76]!==j||t[77]!==w||t[78]!==A||t[79]!==n||t[80]!==h||t[81]!==m||t[82]!==F||t[83]!==M){let e;t[85]!==I||t[86]!==i||t[87]!==b||t[88]!==C||t[89]!==T||t[90]!==S||t[91]!==x||t[92]!==j||t[93]!==w||t[94]!==A||t[95]!==h||t[96]!==m||t[97]!==F||t[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)},t[85]=I,t[86]=i,t[87]=b,t[88]=C,t[89]=T,t[90]=S,t[91]=x,t[92]=j,t[93]=w,t[94]=A,t[95]=h,t[96]=m,t[97]=F,t[98]=M,t[99]=e):e=t[99],X=n.map(e),t[69]=I,t[70]=i,t[71]=b,t[72]=C,t[73]=T,t[74]=S,t[75]=x,t[76]=j,t[77]=w,t[78]=A,t[79]=n,t[80]=h,t[81]=m,t[82]=F,t[83]=M,t[84]=X}else X=t[84];let Z;t[100]!==G||t[101]!==K||t[102]!==q||t[103]!==J||t[104]!==Y||t[105]!==X?(Z=(0,v.jsxs)(`div`,{ref:E,className:G,style:K,role:`tablist`,"aria-label":q,children:[J,Y,X]}),t[100]=G,t[101]=K,t[102]=q,t[103]=J,t[104]=Y,t[105]=X,t[106]=Z):Z=t[106];let it;t[107]!==H||t[108]!==U||t[109]!==W||t[110]!==Z?(it=(0,v.jsxs)(`div`,{className:H,children:[U,W,Z]}),t[107]=H,t[108]=U,t[109]=W,t[110]=Z,t[111]=it):it=t[111];let at=it;if(!Ne)return at;let ot;t[112]===Symbol.for(`react.memo_cache_sentinel`)?(ot=[re],t[112]=ot):ot=t[112];let Q;t[113]!==Oe||t[114]!==at?(Q=(0,v.jsx)(g,{items:Oe,strategy:te,children:at}),t[113]=Oe,t[114]=at,t[115]=Q):Q=t[115];let st;t[116]===Symbol.for(`react.memo_cache_sentinel`)?(st=(0,v.jsx)(d,{dropAnimation:null}),t[116]=st):st=t[116];let $;return t[117]!==Xe||t[118]!==Ie||t[119]!==Q?($=(0,v.jsxs)(f,{sensors:Ie,collisionDetection:u,onDragEnd:Xe,modifiers:ot,children:[Q,st]}),t[117]=Xe,t[118]=Ie,t[119]=Q,t[120]=$):$=t[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{nt as t,rt as n}from"./vendor-base-ui-CnHfUmDN.js";import{n as r}from"./useUIStore-Dfx6TKvi.js";import{n as i}from"./vendor-react-DLPElpoQ.js";import{f as a,r as o}from"./button-CUwjpv-i.js";import{n as s}from"./Icon-BdzPRCSy.js";import{i as c}from"./OverlayScrollbar-C1C2aKOe.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(n(),1),v=t(),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 t=(0,ne.c)(121),{items:n,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=r(oe),{isTablet:Ee}=c(),T=w||Ee,E=_.useRef(null),De;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(De={left:!1,right:!1},t[0]=De):De=t[0];let[D,O]=_.useState(De),k;t[1]===n?k=t[2]:(k=n.map(se),t[1]=n,t[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;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(L=new Map,t[3]=L):L=t[3];let R=_.useRef(L),[z,Pe]=_.useState(null),Fe;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(Fe={activationConstraint:{distance:8}},t[4]=Fe):Fe=t[4];let Ie=p(l(ee,Fe)),Le=ce,Re;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(Re=(e,t)=>{if(t){R.current.set(e,t);return}R.current.delete(e)},t[5]=Re):Re=t[5];let ze=Re,Be;t[6]!==i||t[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)},t[6]=i,t[7]=P,t[8]=Be):Be=t[8];let B=Be,Ve;t[9]===A?Ve=t[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})},t[9]=A,t[10]=Ve);let V=Ve,He;t[11]!==A||t[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()}},t[11]=A,t[12]=V,t[13]=He):He=t[13];let Ue;t[14]!==A||t[15]!==n.length||t[16]!==V?(Ue=[A,n.length,V],t[14]=A,t[15]=n.length,t[16]=V,t[17]=Ue):Ue=t[17],_.useEffect(He,Ue);let We;t[18]!==i||t[19]!==B||t[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()}},t[18]=i,t[19]=B,t[20]=P,t[21]=We):We=t[21];let Ge;t[22]!==i||t[23]!==n.length||t[24]!==B||t[25]!==P?(Ge=[i,n.length,B,P],t[22]=i,t[23]=n.length,t[24]=B,t[25]=P,t[26]=Ge):Ge=t[26],_.useEffect(We,Ge);let Ke;t[27]===B?Ke=t[28]:(Ke=()=>{B()},t[27]=B,t[28]=Ke),_.useLayoutEffect(Ke);let qe;t[29]!==i||t[30]!==A||t[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)}},t[29]=i,t[30]=A,t[31]=V,t[32]=qe):qe=t[32];let Je;t[33]!==i||t[34]!==A||t[35]!==n.length||t[36]!==V?(Je=[i,A,n.length,V],t[33]=i,t[34]=A,t[35]=n.length,t[36]=V,t[37]=Je):Je=t[37],_.useEffect(qe,Je);let Ye;t[38]===y?Ye=t[39]:(Ye=e=>{if(!y)return;let{active:t,over:n}=e;!n||t.id===n.id||y(String(t.id),String(n.id))},t[38]=y,t[39]=Ye);let Xe=Ye,H;t[40]===Se?H=t[41]:(H=o(`relative flex h-full min-w-0 flex-1`,Se),t[40]=Se,t[41]=H);let U;t[42]!==A||t[43]!==D||t[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,t[42]=A,t[43]=D,t[44]=M,t[45]=U):U=t[45];let W;t[46]!==A||t[47]!==D||t[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,t[46]=A,t[47]=D,t[48]=M,t[49]=W):W=t[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;t[50]!==Ze||t[51]!==Qe||t[52]!==$e||t[53]!==et||t[54]!==tt||t[55]!==nt||t[56]!==rt?(G=o(`relative flex h-full min-w-0 flex-1`,Ze,Qe,$e,et,tt,nt,rt),t[50]=Ze,t[51]=Qe,t[52]=$e,t[53]=et,t[54]=tt,t[55]=nt,t[56]=rt,t[57]=G):G=t[57];let K;t[58]===A?K=t[59]:(K=A?{scrollbarWidth:`none`,msOverflowStyle:`none`}:void 0,t[58]=A,t[59]=K);let q;t[60]===Te?q=t[61]:(q=Te(`sortableTabsStrip.aria.tabs`),t[60]=Te,t[61]=q);let J;t[62]!==z||t[63]!==Me||t[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,t[62]=z,t[63]=Me,t[64]=M,t[65]=J):J=t[65];let Y;t[66]!==z||t[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,t[66]=z,t[67]=N,t[68]=Y):Y=t[68];let X;if(t[69]!==I||t[70]!==i||t[71]!==b||t[72]!==C||t[73]!==T||t[74]!==S||t[75]!==x||t[76]!==j||t[77]!==w||t[78]!==A||t[79]!==n||t[80]!==h||t[81]!==m||t[82]!==F||t[83]!==M){let e;t[85]!==I||t[86]!==i||t[87]!==b||t[88]!==C||t[89]!==T||t[90]!==S||t[91]!==x||t[92]!==j||t[93]!==w||t[94]!==A||t[95]!==h||t[96]!==m||t[97]!==F||t[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)},t[85]=I,t[86]=i,t[87]=b,t[88]=C,t[89]=T,t[90]=S,t[91]=x,t[92]=j,t[93]=w,t[94]=A,t[95]=h,t[96]=m,t[97]=F,t[98]=M,t[99]=e):e=t[99],X=n.map(e),t[69]=I,t[70]=i,t[71]=b,t[72]=C,t[73]=T,t[74]=S,t[75]=x,t[76]=j,t[77]=w,t[78]=A,t[79]=n,t[80]=h,t[81]=m,t[82]=F,t[83]=M,t[84]=X}else X=t[84];let Z;t[100]!==G||t[101]!==K||t[102]!==q||t[103]!==J||t[104]!==Y||t[105]!==X?(Z=(0,v.jsxs)(`div`,{ref:E,className:G,style:K,role:`tablist`,"aria-label":q,children:[J,Y,X]}),t[100]=G,t[101]=K,t[102]=q,t[103]=J,t[104]=Y,t[105]=X,t[106]=Z):Z=t[106];let it;t[107]!==H||t[108]!==U||t[109]!==W||t[110]!==Z?(it=(0,v.jsxs)(`div`,{className:H,children:[U,W,Z]}),t[107]=H,t[108]=U,t[109]=W,t[110]=Z,t[111]=it):it=t[111];let at=it;if(!Ne)return at;let ot;t[112]===Symbol.for(`react.memo_cache_sentinel`)?(ot=[re],t[112]=ot):ot=t[112];let Q;t[113]!==Oe||t[114]!==at?(Q=(0,v.jsx)(g,{items:Oe,strategy:te,children:at}),t[113]=Oe,t[114]=at,t[115]=Q):Q=t[115];let st;t[116]===Symbol.for(`react.memo_cache_sentinel`)?(st=(0,v.jsx)(d,{dropAnimation:null}),t[116]=st):st=t[116];let $;return t[117]!==Xe||t[118]!==Ie||t[119]!==Q?($=(0,v.jsxs)(f,{sensors:Ie,collisionDetection:u,onDragEnd:Xe,modifiers:ot,children:[Q,st]}),t[117]=Xe,t[118]=Ie,t[119]=Q,t[120]=$):$=t[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{p as e}from"./runtime-auth-D66yq6ie.js";import{f as t}from"./runtime-switch-BJM2k_uH.js";import{n}from"./runtime-fetch-CiqQd__Y.js";import{St as r}from"./platform-Bxaalnc8.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=e=>t().websocket(e),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 e()}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=(e,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(t().sse(`/api/terminal/${e}/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=t=>{try{let r=JSON.parse(t.data);r.type===`exit`&&(x().manager?.unbindSession(e),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{p as e}from"./runtime-auth-D66yq6ie.js";import{f as t}from"./runtime-switch-BJM2k_uH.js";import{n}from"./runtime-fetch-CiqQd__Y.js";import{St as r}from"./platform-wu6wSDfg.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=e=>t().websocket(e),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 e()}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=(e,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(t().sse(`/api/terminal/${e}/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=t=>{try{let r=JSON.parse(t.data);r.type===`exit`&&(x().manager?.unbindSession(e),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{nt as t,rt as n,tt as r}from"./vendor-base-ui-CnHfUmDN.js";import{n as i}from"./vendor-react-DLPElpoQ.js";import{f as a,r as o,t as s}from"./button-CcOoDLE1.js";import{n as c}from"./Icon-BE2hkaYc.js";import{t as l}from"./OverlayScrollbar-CVgW_Z9B.js";var u=e(n(),1),d=i(),f=t(),p=e(r(),1),m=0,h=()=>{m=Date.now()+800},g=()=>Date.now()<m,_=(e,t)=>{let n=`flex min-h-0 flex-col bg-background shadow-none`;if(e===`page`)return`${n} h-full w-full`;let r=`${n} pwa-overlay-panel`;return t===`top`?`${r} mx-auto mb-auto max-h-[calc(100dvh-0.75rem)] w-full max-w-lg rounded-b-xl border-x border-b border-border/50`:t===`left`?`${r} h-full w-[min(86vw,24rem)] rounded-r-xl border-r border-y border-border/50`:t===`right`?`${r} ml-auto h-full w-[min(86vw,24rem)] rounded-l-xl border-l border-y border-border/50`:`${r} mx-auto mt-auto max-h-[calc(100dvh-0.75rem)] w-full max-w-lg rounded-t-2xl border-x border-t border-border/50 pb-[max(0.5rem,var(--oc-app-bottom-safe,0px),var(--oc-safe-area-bottom,env(safe-area-inset-bottom,0px)))]`},v=e=>Math.min(1,Math.max(0,Number.isFinite(e)?e:0)),y=(e,t,n)=>{let r=Number.isFinite(t)&&t>0?t:1,i=Math.max(0,Number.isFinite(e)?e:0)/r,a=v(n[0]??1),o=Math.abs(i-a);for(let e=1;e<n.length;e+=1){let t=v(n[e]??a),r=Math.abs(i-t);r<o&&(a=t,o=r)}return a},b=(e,t)=>{let n=v(t),r=`${(1-n)*100}%`;return{progress:n,scrimOpacity:n,surfaceOpacity:n,surfaceTransform:e===`left`?`translate3d(-${r}, 0, 0)`:e===`right`?`translate3d(${r}, 0, 0)`:e===`top`?`translate3d(0, -${r}, 0)`:`translate3d(0, ${r}, 0)`}},x=(e,t)=>{let n=v(t);return e===`present`?n:1-n},S=(e,t)=>e===`present`?+(t===`commit`):t===`commit`?0:1,C=e=>+!!e,w=.72,T=.98,E=[w,T],D=180,O=`cubic-bezier(0.32, 0.72, 0, 1)`,k=64,A=()=>Math.max(1,window.innerHeight),j=(e,t,n=k,r)=>e<=N(t,r)-n,M=(e,t,n)=>Math.min(t*T,Math.max(n?0:t*w,e)),N=(e,t)=>{let n=Math.max(1,e)*w;return t==null||!Number.isFinite(t)?n:Math.min(n,Math.max(0,t))},P=(e,t,n)=>{let r=N(t,n),i=Math.max(1,t)*T;return Math.abs(e-r)<=Math.abs(e-i)?w:T},F=({initialSnapPoint:e=w,fitContent:t=!1,onDismiss:n,dismissThresholdPx:r=k}={})=>{let i=u.useRef(null),a=u.useRef(null),o=u.useRef(null),s=u.useRef(null),c=u.useRef(null),l=u.useRef(null),d=u.useRef(!1),[f,p]=u.useState(e),m=u.useRef(e),h=u.useRef(n);h.current=n;let g=u.useCallback(()=>{o.current!==null&&window.cancelAnimationFrame(o.current),o.current=null},[]),_=u.useCallback((e,n)=>{let r=i.current,a=m.current;if(m.current=e,p(e),g(),s.current=null,c.current?.cancel(),c.current=null,!r)return;let o=n??r.getBoundingClientRect().height;t&&a===.72&&l.current===null&&(l.current=N(A(),o));let u=e===.72?N(A(),t?l.current:void 0):A()*T;if(r.style.height=``,r.style.willChange=``,Math.abs(o-u)<1||typeof r.animate!=`function`||window.matchMedia(`(prefers-reduced-motion: reduce)`).matches)return;let d=r.animate([{height:`${o}px`},{height:`${u}px`}],{duration:D,easing:O,fill:`both`});c.current=d,d.finished.catch(()=>void 0).then(()=>{c.current===d&&(c.current=null,d.cancel())})},[g,t]),v=u.useCallback(e=>{if(!e.isPrimary||e.pointerType===`mouse`&&e.button!==0)return;let n=i.current;if(!n)return;let r=n.getBoundingClientRect().height;t&&m.current===.72&&(l.current=N(A(),r)),c.current?.cancel(),c.current=null,n.style.height=`${r}px`,n.style.willChange=`height`,a.current={pointerId:e.pointerId,startY:e.clientY,startHeight:r,startSnapPoint:m.current,viewportHeight:A()},d.current=!1,e.currentTarget.setPointerCapture(e.pointerId),e.preventDefault()},[t]),b=u.useCallback(e=>{let t=a.current,n=i.current;if(!t||t.pointerId!==e.pointerId||!n)return;let r=t.startY-e.clientY;Math.abs(r)>3&&(d.current=!0),s.current=M(t.startHeight+r,t.viewportHeight,!!h.current),o.current===null&&(o.current=window.requestAnimationFrame(()=>{o.current=null,i.current&&s.current!==null&&(i.current.style.height=`${s.current}px`)})),e.preventDefault()},[]),x=u.useCallback((e,n)=>{let o=a.current,c=i.current;if(!o||o.pointerId!==e.pointerId||!c)return;a.current=null,g();let u=s.current??c.getBoundingClientRect().height;if(s.current=null,e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId),!n&&h.current&&j(u,o.viewportHeight,r,t?l.current:void 0)){c.style.willChange=``,h.current(),e.preventDefault();return}let d=n?o.startSnapPoint:t?P(u,o.viewportHeight,l.current):y(u,o.viewportHeight,E);_(d,u),e.preventDefault()},[g,r,t,_]),S=u.useCallback(()=>{if(d.current){d.current=!1;return}_(m.current===.98?w:T)},[_]),C=u.useCallback(e=>{let t=null;(e.key===`ArrowUp`||e.key===`Home`)&&(t=T),(e.key===`ArrowDown`||e.key===`End`)&&(t=w),(e.key===`Enter`||e.key===` `)&&(t=m.current===.98?w:T),t!==null&&(e.preventDefault(),_(t))},[_]),F=u.useCallback(()=>{a.current=null,g(),s.current=null,c.current?.cancel(),c.current=null,l.current=null,m.current=e,p(e),i.current&&(i.current.style.height=``,i.current.style.willChange=``)},[g,e]);return u.useEffect(()=>()=>{g(),c.current?.cancel()},[g]),{surfaceRef:i,snapPoint:f,handlePointerDown:v,handlePointerMove:b,handlePointerUp:e=>x(e,!1),handlePointerCancel:e=>x(e,!0),handleClick:S,handleKeyDown:C,reset:F}},I=e=>{let t=(0,d.c)(12),{controller:n,ariaLabel:r}=e,i;t[0]===n.snapPoint?i=t[1]:(i=Math.round(n.snapPoint*100),t[0]=n.snapPoint,t[1]=i);let a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,f.jsx)(`div`,{className:`h-1.5 w-11 rounded-full bg-[var(--interactive-border)]`}),t[2]=a):a=t[2];let o;return t[3]!==r||t[4]!==n.handleClick||t[5]!==n.handleKeyDown||t[6]!==n.handlePointerCancel||t[7]!==n.handlePointerDown||t[8]!==n.handlePointerMove||t[9]!==n.handlePointerUp||t[10]!==i?(o=(0,f.jsx)(`div`,{"data-mobile-sheet-snap-handle":!0,role:`separator`,tabIndex:0,"aria-label":r,"aria-orientation":`horizontal`,"aria-valuemin":w*100,"aria-valuemax":T*100,"aria-valuenow":i,className:`flex min-h-8 cursor-ns-resize touch-none justify-center pt-2.5 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-[var(--interactive-focus-ring)]`,onPointerDown:n.handlePointerDown,onPointerMove:n.handlePointerMove,onPointerUp:n.handlePointerUp,onPointerCancel:n.handlePointerCancel,onClick:n.handleClick,onKeyDown:n.handleKeyDown,children:a}),t[3]=r,t[4]=n.handleClick,t[5]=n.handleKeyDown,t[6]=n.handlePointerCancel,t[7]=n.handlePointerDown,t[8]=n.handlePointerMove,t[9]=n.handlePointerUp,t[10]=i,t[11]=o):o=t[11],o},L=new WeakMap;function R(e){L.set(e.currentTarget,!0)}function z(e){if(L.delete(e.currentTarget))return!0;if(e.detail!==0)return!1;if(typeof document>`u`)return!0;let t=document.activeElement,n=e.currentTarget;return n instanceof Node&&t instanceof Node&&n.contains(t)}function B(e){e.target===e.currentTarget&&R(e)}function V(e){return e.target===e.currentTarget&&z(e)}var H=new class{entries=[];listeners=new Set;previousOverflow=null;getSnapshot=()=>this.entries.at(-1)?.id??null;subscribe=e=>(this.listeners.add(e),()=>this.listeners.delete(e));add(e,t){return this.entries=[...this.entries.filter(t=>t.id!==e.id),e],this.entries.length===1&&t&&(this.previousOverflow=t.style.overflow,t.style.overflow=`hidden`),this.emit(),()=>this.remove(e.id,t)}remove(e,t){let n=this.entries.length;this.entries=this.entries.filter(t=>t.id!==e),n>0&&this.entries.length===0&&t&&this.previousOverflow!==null&&(t.style.overflow=this.previousOverflow,this.previousOverflow=null),this.emit()}closeTop(){this.entries.at(-1)?.onClose()}emit(){for(let e of this.listeners)e()}},U=`mobile-sessions`,W=new Map,G=e=>W.get(e)??null,ee=(e,t)=>(W.set(e,t),()=>{W.get(e)===t&&W.delete(e)}),K=`.overlay-scrollbar-container`,q=1,J=e=>e===`left`||e===`right`?`x`:`y`,te=e=>e===`bottom`||e===`right`?1:-1,Y=(e,t,n)=>{let r=J(e)===`x`?t:n;return Math.max(0,r*te(e))},ne=(e,t,n,r,i)=>{let a=Y(e,t,n),o=Math.abs(J(e)===`x`?n:t);return Math.hypot(t,n)>r&&a>0&&o<a*i},re=(e,t)=>Math.min(1,Math.max(0,e/Math.max(1,t))),ie=(e,t,n,r)=>Math.min(r,Math.max(n,e*t)),ae=(e,t,n,r,i)=>e>=n||e>=i&&t>=r,oe=(e,t,n,r,i)=>t!==0&&n>0?t*i/n:r>80?0:e,X=(e,t,n=q)=>{if(t===`bottom`)return e.scrollTop<=n;if(t===`top`)return e.scrollTop>=e.scrollHeight-e.clientHeight-n;if(e.matches?.(`:dir(rtl)`)){let r=e.scrollWidth-e.clientWidth;return t===`right`?Math.abs(e.scrollLeft)<=n:Math.abs(e.scrollLeft)>=r-n}return t===`right`?e.scrollLeft<=n:e.scrollLeft>=e.scrollWidth-e.clientWidth-n},se=(e,t)=>{for(let n=0;n<e.length;n+=1){let r=e.item(n);if(r?.identifier===t)return r}return null},Z=(e,t)=>{let n=window.getComputedStyle(e),r=J(t),i=r===`x`?n.overflowX:n.overflowY,a=r===`x`?e.scrollWidth:e.scrollHeight,o=r===`x`?e.clientWidth:e.clientHeight;return(i===`auto`||i===`scroll`||i===`overlay`)&&a>o},ce=(e,t,n,r)=>{let i=t instanceof Element?t:null,a=i instanceof HTMLElement?i:i?.parentElement??null;for(;a&&e.contains(a);){if(Z(a,n))return a;if(a===e)break;a=a.parentElement}let o=i?.closest(r)??null;return o&&e.contains(o)&&Z(o,n)?o:null},le=e=>{let t=u.useRef(e),n=u.useRef(null),r=u.useRef(null);return t.current=e,u.useCallback(e=>{if(n.current?.(),n.current=null,!e)return;let i=()=>{let e=r.current;r.current=null,e?.active&&e.controller?.finish(`cancel`)},a=(e,t,n)=>{let r=J(e.edge)===`x`?t.clientX:t.clientY,i=n-e.lastTime,a=r-e.lastPrimary;e.velocity=oe(e.velocity,a,i,n-e.lastVelocityTime,te(e.edge)),a!==0&&i>0&&(e.lastVelocityTime=n),e.lastPrimary=r,e.lastTime=n,e.distance=Y(e.edge,t.clientX-e.startX,t.clientY-e.startY)},o=n=>{i();let a=t.current;if(a.disabled||n.touches.length!==1)return;let o=n.target instanceof Element?n.target:null,s=a.reservedTargetSelector?o?.closest(a.reservedTargetSelector):null;if(s&&e.contains(s)||o?.closest(`input, textarea, select, [contenteditable=""], [contenteditable="true"], [data-mobile-sheet-no-dismiss]`))return;let c=n.touches[0],l=ce(e,n.target,a.edge,a.scrollContainerSelector??K);if(l&&!X(l,a.edge))return;let u=e.getBoundingClientRect(),d=J(a.edge)===`x`?u.width||window.innerWidth:u.height||window.innerHeight;r.current={edge:a.edge,motionId:a.motionId,touchId:c.identifier,startX:c.clientX,startY:c.clientY,lastPrimary:J(a.edge)===`x`?c.clientX:c.clientY,lastTime:n.timeStamp,lastVelocityTime:n.timeStamp,velocity:0,distance:0,commitDistance:ie(d,a.commitDistanceRatio??.1,a.minCommitDistance??40,a.maxCommitDistance??64),motionDistance:d,intentDistance:a.intentDistance??8,maxOffAxisRatio:a.maxOffAxisRatio??1,flingVelocity:a.flingVelocity??.65,flingMinDistance:a.flingMinDistance??12,controller:null,active:!1}},s=e=>{let n=r.current;if(!n)return;if(t.current.disabled||e.touches.length!==1){i();return}let o=se(e.touches,n.touchId);if(!o){i();return}if(a(n,o,e.timeStamp),!n.active){if(Math.hypot(o.clientX-n.startX,o.clientY-n.startY)<=n.intentDistance)return;if(!ne(n.edge,o.clientX-n.startX,o.clientY-n.startY,n.intentDistance,n.maxOffAxisRatio)){r.current=null;return}let e=G(n.motionId);if(!e){r.current=null;return}if(!e.begin(`dismiss`)){r.current=null;return}n.active=!0,n.controller=e}n.controller?.update(re(n.distance,n.motionDistance)),e.preventDefault()},c=e=>{let t=r.current;if(!t)return;let n=se(e.changedTouches,t.touchId);if(!n){i();return}if(r.current=null,!t.active)return;a(t,n,e.timeStamp),t.controller?.update(re(t.distance,t.motionDistance));let o=ae(t.distance,t.velocity,t.commitDistance,t.flingVelocity,t.flingMinDistance);t.controller?.finish(o?`commit`:`cancel`),e.preventDefault()},l=()=>i();e.addEventListener(`touchstart`,o,{passive:!0,capture:!0}),e.addEventListener(`touchmove`,s,{passive:!1,capture:!0}),e.addEventListener(`touchend`,c,{passive:!1,capture:!0}),e.addEventListener(`touchcancel`,l,{passive:!0,capture:!0}),n.current=()=>{i(),e.removeEventListener(`touchstart`,o,!0),e.removeEventListener(`touchmove`,s,!0),e.removeEventListener(`touchend`,c,!0),e.removeEventListener(`touchcancel`,l,!0)}},[])},ue=`mobile-overlay-root`,de=200,fe=80,pe=`cubic-bezier(0.32, 0.72, 0, 1)`,me=`a[href], button:not(:disabled), input:not(:disabled), select:not(:disabled), textarea:not(:disabled), [tabindex]:not([tabindex="-1"])`,he=()=>{if(typeof document>`u`)return null;let e=document.getElementById(ue);return e||(e=document.createElement(`div`),e.id=ue,document.body.appendChild(e)),e},ge=()=>typeof window<`u`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches,Q=({id:e,open:t,onOpenChange:n,keepMounted:r=!1,presentation:i=`sheet`,edge:a=`bottom`,children:s,className:c,scrimClassName:l,surfaceClassName:d,surfaceElementRef:m,dismissGesture:h=!1,onExitComplete:v,onPreviewChange:y,ariaLabel:w})=>{let T=u.useRef(null),E=u.useRef(null),D=u.useRef(null),O=u.useRef(t),k=u.useRef(n),A=u.useRef(v),j=u.useRef(y),M=u.useRef(0),N=u.useRef(0),P=u.useRef(null),F=u.useRef([]),I=u.useRef(null),L=u.useRef(`standard`),R=u.useRef(`present`),z=u.useRef(0),U=u.useRef(!1),W=u.useRef(t),G=u.useRef(!1),K=u.useRef(t),q=u.useRef(null),[J,te]=u.useState(t),[Y,ne]=u.useState(t),[re,ie]=u.useState(`standard`),[ae,oe]=u.useState(!1),X=re===`interactive-present`,se=u.useSyncExternalStore(H.subscribe,H.getSnapshot,H.getSnapshot),Z=Y&&!X&&se===e,ce=le({motionId:e,edge:a,disabled:!h,...typeof h==`object`?h:{}}),ue=u.useCallback(e=>{D.current=e,ce(e),typeof m==`function`?m(e):m&&typeof m==`object`&&(m.current=e)},[ce,m]),Q=u.useCallback(()=>{K.current&&(K.current=!1,ne(!1),r||te(!1),A.current?.())},[r]);O.current=t,k.current=n,A.current=v,j.current=y,u.useLayoutEffect(()=>{j.current?.(Y&&X)},[Y,X]),typeof document<`u`&&!T.current&&(T.current=he());let $=u.useCallback(e=>{let t=b(a,e);M.current=t.progress,!(!E.current||!D.current)&&(E.current.style.opacity=String(t.scrimOpacity),D.current.style.transform=t.surfaceTransform,D.current.style.opacity=String(t.surfaceOpacity))},[a]),_e=u.useCallback(()=>{P.current!==null&&window.cancelAnimationFrame(P.current),P.current=null},[]),ve=u.useCallback(()=>{E.current&&(E.current.style.willChange=``),D.current&&(D.current.style.willChange=``)},[]),ye=u.useCallback((e=F.current)=>{for(let t of e)t.cancel();F.current=[]},[]),be=u.useCallback(()=>{_e();let e=I.current;if(e){let t=e.animations[1]?.effect?.getComputedTiming().progress;$(typeof t==`number`&&Number.isFinite(t)?e.from+(e.target-e.from)*t:M.current),ye(e.animations),I.current=null}else ye();ve(),oe(!1)},[$,ye,_e,ve]),xe=u.useCallback((e,t)=>{if(I.current?.target===e)return;be();let n=M.current,r=E.current,i=D.current;if(oe(!0),!r||!i||ge()||n===e){$(e),ve(),oe(!1),t?.();return}let o=b(a,n),s=b(a,e);r.style.willChange=`opacity`,i.style.willChange=`transform, opacity`;let c=Math.max(fe,de*Math.abs(e-n)),l=[r.animate([{opacity:o.scrimOpacity},{opacity:s.scrimOpacity}],{duration:c,easing:pe,fill:`forwards`}),i.animate([{transform:o.surfaceTransform,opacity:o.surfaceOpacity},{transform:s.surfaceTransform,opacity:s.surfaceOpacity}],{duration:c,easing:pe,fill:`forwards`})];F.current=l;let u={from:n,target:e,animations:l};I.current=u,Promise.all(l.map(e=>e.finished.catch(()=>void 0))).then(()=>{I.current===u&&($(e),ye(l),I.current=null,ve(),oe(!1),t?.())})},[$,ye,ve,a,be]);if(u.useLayoutEffect(()=>{G.current=J,J&&$(N.current)},[$,J]),u.useLayoutEffect(()=>{K.current=Y},[Y]),u.useEffect(()=>{t&&!G.current&&(N.current=M.current,te(!0)),t&&!K.current&&(K.current=!0,ne(!0)),G.current&&L.current===`standard`&&xe(C(t),()=>{!O.current&&L.current===`standard`&&Q()})},[Q,t,xe]),u.useLayoutEffect(()=>{!J||L.current!==`standard`||xe(+!!t,()=>{!O.current&&L.current===`standard`&&Q()})},[Q,J,t,xe]),u.useEffect(()=>{if(!(!Y||X))return window.dispatchEvent(new Event(`oc:mobile-overlay-opened`)),()=>{window.dispatchEvent(new Event(`oc:mobile-overlay-closed`))}},[Y,X]),u.useEffect(()=>{if(!(!Y||X))return H.add({id:e,onClose:()=>k.current(!1)},document.body)},[Y,e,X]),u.useEffect(()=>{if(!Y||X||!Z)return;let e=D.current,t=document.activeElement instanceof HTMLElement?document.activeElement:null;e?.focus({preventScroll:!0});let n=t=>{if(t.key===`Escape`&&H.closeTop(),t.key!==`Tab`||!e)return;let n=Array.from(e.querySelectorAll(me)).filter(e=>!e.closest(`[data-mobile-sheet-snap-handle]`)),r=n[0]??e,i=n.at(-1)??e;t.shiftKey&&document.activeElement===r&&(t.preventDefault(),i.focus({preventScroll:!0})),!t.shiftKey&&document.activeElement===i&&(t.preventDefault(),r.focus({preventScroll:!0}))};return document.addEventListener(`keydown`,n),()=>{document.removeEventListener(`keydown`,n),g()||t?.focus({preventScroll:!0})}},[Y,X,Z]),q.current={begin:e=>{if(e===`dismiss`&&(!K.current||L.current===`interactive-present`))return!1;be(),z.current+=1,U.current=!0,R.current=e;let t=e===`present`?`interactive-present`:`interactive-dismiss`;return L.current=t,ie(t),oe(!0),e===`present`&&(N.current=M.current,K.current=!0,ne(!0),te(!0)),!0},update:e=>{U.current&&(N.current=x(R.current,e),P.current===null&&(P.current=window.requestAnimationFrame(()=>{P.current=null,U.current&&$(N.current)})))},finish:e=>{if(!U.current)return;U.current=!1;let t=z.current,n=R.current,r=S(n,e);P.current!==null&&(_e(),$(N.current)),xe(r,()=>{t===z.current&&(e===`commit`&&k.current(n===`present`),n===`present`&&e===`cancel`&&!O.current&&Q(),L.current=`standard`,ie(`standard`),r===0&&Q())})},interrupt:()=>{z.current+=1,U.current=!1;let e=L.current===`interactive-present`&&!O.current;e||(L.current=`standard`,ie(`standard`)),be(),xe(C(O.current),()=>{O.current||Q(),e&&(L.current=`standard`,ie(`standard`))})}},u.useLayoutEffect(()=>{let e=W.current;W.current=t,e&&!t&&L.current!==`standard`&&q.current?.interrupt()},[t]),u.useEffect(()=>{let t=ee(e,{begin:e=>q.current?.begin(e)??!1,update:e=>q.current?.update(e),finish:e=>q.current?.finish(e),interrupt:()=>q.current?.interrupt()});return()=>{t(),_e(),ye(),I.current=null,ve(),q.current=null}},[ye,_e,ve,e]),!J||!T.current)return null;let Se=(0,f.jsx)(`div`,{ref:E,className:o(`oc-mobile-window-motion oc-keyboard-inset-surface fixed inset-0 z-[60] flex flex-col bg-[rgb(0_0_0_/_0.45)]`,ae&&`oc-mobile-window-motion-active`,!Y&&!X&&`pointer-events-none invisible`,l,c),"data-mobile-overlay-active":String(Y),role:X?void 0:`dialog`,"aria-label":X?void 0:w,"aria-modal":Y&&Z?`true`:void 0,"aria-hidden":X||!Y||!Z||void 0,inert:X||!Y||!Z||void 0,onPointerDown:B,onClick:e=>{!Y||X||!Z||V(e)&&k.current(!1)},children:(0,f.jsx)(`div`,{ref:ue,tabIndex:-1,className:o(`oc-mobile-floating-shell`,_(i,a),d),"data-oc-motion-id":e,style:{contain:`layout paint style`},onClick:e=>e.stopPropagation(),children:s})});return(0,p.createPortal)(Se,T.current)},$=u.createContext(null),_e=e=>{let t=(0,d.c)(5),{children:n}=e,r=u.useContext($);if(!r)return null;let i;t[0]===n?i=t[1]:(i=(0,f.jsx)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:n}),t[0]=n,t[1]=i);let a;return t[2]!==r||t[3]!==i?(a=(0,p.createPortal)(i,r),t[2]=r,t[3]=i,t[4]=a):a=t[4],a},ve=e=>{let t=(0,d.c)(45),{id:n,open:r,onOpenChange:i,title:a,leading:l,trailing:p,ariaLabel:m,closeAriaLabel:h,resizeAriaLabel:g,initiallyExpanded:_,fitContent:v,bodyClassName:y,children:b}=e,x=_!==void 0&&_,S=v!==void 0&&v,C=x?T:void 0,w;t[0]===i?w=t[1]:(w=()=>i(!1),t[0]=i,t[1]=w);let E;t[2]!==S||t[3]!==C||t[4]!==w?(E={initialSnapPoint:C,fitContent:S,onDismiss:w},t[2]=S,t[3]=C,t[4]=w,t[5]=E):E=t[5];let D=F(E),[O,k]=u.useState(null),A=a!=null||l!=null||p!=null,j=D.snapPoint===T,M=j||!S,N;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(N={reservedTargetSelector:`[data-mobile-sheet-snap-handle]`},t[6]=N):N=t[6];let P=j?`h-[98dvh] max-h-[98dvh]`:S?`h-auto max-h-[72dvh]`:`h-[72dvh] max-h-[98dvh]`,L=D.surfaceRef,R=D.reset,z=M&&`flex-1`,B;t[7]===z?B=t[8]:(B=o(`flex min-h-0 flex-col`,z),t[7]=z,t[8]=B);let V;t[9]!==g||t[10]!==D?(V=(0,f.jsx)(I,{controller:D,ariaLabel:g}),t[9]=g,t[10]=D,t[11]=V):V=t[11];let H;t[12]!==h||t[13]!==S||t[14]!==A||t[15]!==l||t[16]!==i||t[17]!==a||t[18]!==p?(H=A?(0,f.jsxs)(`div`,{className:S?`flex min-h-9 items-center gap-2 px-4 pb-1`:`flex min-h-10 items-center gap-2 px-4 pb-2`,children:[l?(0,f.jsx)(`div`,{className:`flex shrink-0 items-center`,children:l}):null,(0,f.jsx)(`div`,{className:`min-w-0 flex-1`,children:a}),p?(0,f.jsx)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:p}):null,(0,f.jsx)(`div`,{ref:k,className:`contents`}),(0,f.jsx)(s,{type:`button`,variant:`ghost`,size:`icon`,onClick:()=>i(!1),"aria-label":h,className:`shrink-0 text-muted-foreground`,style:{touchAction:`manipulation`},children:(0,f.jsx)(c,{name:`close`,className:`size-5`})})]}):null,t[12]=h,t[13]=S,t[14]=A,t[15]=l,t[16]=i,t[17]=a,t[18]=p,t[19]=H):H=t[19];let U;t[20]!==V||t[21]!==H?(U=(0,f.jsxs)(`div`,{className:`shrink-0`,children:[V,H]}),t[20]=V,t[21]=H,t[22]=U):U=t[22];let W=M&&`flex-1`,G;t[23]!==y||t[24]!==W?(G=o(`flex min-h-0 flex-col overflow-hidden`,W,y),t[23]=y,t[24]=W,t[25]=G):G=t[25];let ee;t[26]!==b||t[27]!==G?(ee=(0,f.jsx)(`div`,{className:G,"data-page-scroll-lock":`true`,children:b}),t[26]=b,t[27]=G,t[28]=ee):ee=t[28];let K;t[29]!==B||t[30]!==U||t[31]!==ee?(K=(0,f.jsxs)(`div`,{className:B,children:[U,ee]}),t[29]=B,t[30]=U,t[31]=ee,t[32]=K):K=t[32];let q;t[33]!==m||t[34]!==n||t[35]!==i||t[36]!==r||t[37]!==D.reset||t[38]!==D.surfaceRef||t[39]!==K||t[40]!==P?(q=(0,f.jsx)(Q,{id:n,open:r,onOpenChange:i,presentation:`sheet`,edge:`bottom`,dismissGesture:N,ariaLabel:m,surfaceClassName:P,surfaceElementRef:L,onExitComplete:R,children:K}),t[33]=m,t[34]=n,t[35]=i,t[36]=r,t[37]=D.reset,t[38]=D.surfaceRef,t[39]=K,t[40]=P,t[41]=q):q=t[41];let J;return t[42]!==O||t[43]!==q?(J=(0,f.jsx)($.Provider,{value:O,children:q}),t[42]=O,t[43]=q,t[44]=J):J=t[44],J};function ye(e,t){let n=(0,d.c)(3),r;return n[0]!==e||n[1]!==t?(r=n=>{[e,t].forEach(e=>{typeof e==`function`?e(n):e&&typeof e==`object`&&(e.current=n)})},n[0]=e,n[1]=t,n[2]=r):r=n[2],r}var be=u.forwardRef((e,t)=>{let n=(0,d.c)(28),{as:r,orientation:i,offset:a,size:o,isEnabled:s,hideTopShadow:c,hideBottomShadow:l,observeMutations:p,onVisibilityChange:m,style:h,className:g,children:_,...v}=e,y=r===void 0?`div`:r,b=i===void 0?`vertical`:i,x=a===void 0?0:a,S=o===void 0?48:o,C=s===void 0||s,w=c!==void 0&&c,T=l!==void 0&&l,E=p===void 0||p,D=u.useRef(null),O=u.useRef(`none`),k=v[`data-scroll-shadow`];delete v[`data-scroll-shadow`];let A=h,j;n[0]!==S||n[1]!==A?(j={...A},j[`--scroll-shadow-size`]=`${S}px`,n[0]=S,n[1]=A,n[2]=j):j=n[2];let M=j,N=xe,P=Se,F;n[3]!==T||n[4]!==w||n[5]!==C||n[6]!==x||n[7]!==m||n[8]!==b?(F=()=>{let e=D.current;if(!e)return;if(!C){P(e),O.current!==`none`&&(O.current=`none`,m?.(`none`));return}let t=b===`vertical`?e.scrollTop>x+1:e.scrollLeft>x+1,n=b===`vertical`?e.scrollHeight-(e.scrollTop+e.clientHeight)>x+1:e.scrollWidth-(e.scrollLeft+e.clientWidth)>x+1,r=w&&b===`vertical`?!1:t;T&&b===`vertical`&&(n=!1),N(e,r,n,b===`vertical`?`top`:`left`,b===`vertical`?`bottom`:`right`);let i=r&&n?`both`:r?b===`vertical`?`top`:`left`:n?b===`vertical`?`bottom`:`right`:`none`;i!==O.current&&(O.current=i,m?.(i))},n[3]=T,n[4]=w,n[5]=C,n[6]=x,n[7]=m,n[8]=b,n[9]=F):F=n[9];let I=F,L,R;n[10]!==I||n[11]!==C?(L=()=>{C||I()},R=[I,C],n[10]=I,n[11]=C,n[12]=L,n[13]=R):(L=n[12],R=n[13]),u.useLayoutEffect(L,R);let z,B;n[14]!==I||n[15]!==C||n[16]!==E?(z=()=>{let e=D.current;if(!e||!C)return;let t=null,n=()=>{t===null&&(t=requestAnimationFrame(()=>{t=null,I()}))},r=n,i=typeof ResizeObserver<`u`?new ResizeObserver(n):null,a=E&&typeof MutationObserver<`u`?new MutationObserver(n):null;return I(),e.addEventListener(`scroll`,r,{passive:!0}),i?.observe(e),a?.observe(e,{childList:!0,subtree:!0,characterData:!0}),()=>{t!==null&&cancelAnimationFrame(t),e.removeEventListener(`scroll`,r),i?.disconnect(),a?.disconnect()}},B=[I,C,E],n[14]=I,n[15]=C,n[16]=E,n[17]=z,n[18]=B):(z=n[17],B=n[18]),u.useEffect(z,B);let V=ye(D,t),H=k??!0,U;return n[19]!==y||n[20]!==_||n[21]!==g||n[22]!==V||n[23]!==M||n[24]!==b||n[25]!==v||n[26]!==H?(U=(0,f.jsx)(y,{...v,ref:V,className:g,"data-orientation":b,"data-scroll-shadow":H,style:M,children:_}),n[19]=y,n[20]=_,n[21]=g,n[22]=V,n[23]=M,n[24]=b,n[25]=v,n[26]=H,n[27]=U):U=n[27],U});be.displayName=`ScrollShadow`;function xe(e,t,n,r,i){let a=`${r}${i.charAt(0).toUpperCase()}${i.slice(1)}Scroll`;t&&n?(e.dataset[a]=`true`,e.removeAttribute(`data-${r}-scroll`),e.removeAttribute(`data-${i}-scroll`)):(e.dataset[`${r}Scroll`]=String(t),e.dataset[`${i}Scroll`]=String(n),e.removeAttribute(`data-${r}-${i}-scroll`))}function Se(e){[`top`,`bottom`,`top-bottom`,`left`,`right`,`left-right`].forEach(t=>{e.removeAttribute(`data-${t}-scroll`)})}var Ce=u.forwardRef((e,t)=>{let n=(0,d.c)(45),r,i,a,s,c,p,m,h,g,_,v,y,b,x,S,C;n[0]===e?(r=n[1],i=n[2],a=n[3],s=n[4],c=n[5],p=n[6],m=n[7],h=n[8],g=n[9],_=n[10],v=n[11],y=n[12],b=n[13],x=n[14],S=n[15],C=n[16]):({className:i,outerClassName:c,children:r,style:g,minThumbSize:s,hideDelayMs:a,as:_,scrollbarClassName:h,disableHorizontal:v,observeMutations:y,fillContainer:b,preventOverscroll:x,useScrollShadow:S,scrollShadowSize:m,userIntentOnly:C,...p}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a,n[4]=s,n[5]=c,n[6]=p,n[7]=m,n[8]=h,n[9]=g,n[10]=_,n[11]=v,n[12]=y,n[13]=b,n[14]=x,n[15]=S,n[16]=C);let w=_===void 0?`div`:_,T=v!==void 0&&v,E=y===void 0||y,D=b===void 0||b,O=x!==void 0&&x,k=S!==void 0&&S,A=C!==void 0&&C,j=u.useRef(null),M,N;n[17]===Symbol.for(`react.memo_cache_sentinel`)?(M=()=>j.current,N=[],n[17]=M,n[18]=N):(M=n[17],N=n[18]),u.useImperativeHandle(t,M,N);let P=O&&`overscroll-none`,F;n[19]!==c||n[20]!==P?(F=o(`relative flex flex-col min-h-0 w-full overflow-hidden`,P,c),n[19]=c,n[20]=P,n[21]=F):F=n[21];let I;n[22]!==w||n[23]!==r||n[24]!==i||n[25]!==T||n[26]!==D||n[27]!==E||n[28]!==O||n[29]!==p||n[30]!==m||n[31]!==g||n[32]!==k?(I=k?(0,f.jsx)(be,{as:w,ref:j,size:m,className:o(`overlay-scrollbar-target overlay-scrollbar-container`,O&&`overscroll-none`,D?`flex-1 min-h-0 w-full`:`flex-none w-full h-auto`,T?`overflow-y-auto overflow-x-hidden`:`overflow-auto`,i),style:g,observeMutations:E,...p,children:r}):(0,f.jsx)(w,{ref:j,className:o(`overlay-scrollbar-target overlay-scrollbar-container`,O&&`overscroll-none`,D?`flex-1 min-h-0 w-full`:`flex-none w-full h-auto`,T?`overflow-y-auto overflow-x-hidden`:`overflow-auto`,i),style:g,...p,children:r}),n[22]=w,n[23]=r,n[24]=i,n[25]=T,n[26]=D,n[27]=E,n[28]=O,n[29]=p,n[30]=m,n[31]=g,n[32]=k,n[33]=I):I=n[33];let L;n[34]!==T||n[35]!==a||n[36]!==s||n[37]!==E||n[38]!==h||n[39]!==A?(L=(0,f.jsx)(l,{containerRef:j,minThumbSize:s,hideDelayMs:a,className:h,disableHorizontal:T,observeMutations:E,userIntentOnly:A}),n[34]=T,n[35]=a,n[36]=s,n[37]=E,n[38]=h,n[39]=A,n[40]=L):L=n[40];let R;return n[41]!==F||n[42]!==I||n[43]!==L?(R=(0,f.jsxs)(`div`,{className:F,children:[I,L]}),n[41]=F,n[42]=I,n[43]=L,n[44]=R):R=n[44],R});Ce.displayName=`ScrollableOverlay`;function we(e){let t=(0,d.c)(4),{onResizeStart:n,ariaLabel:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,f.jsx)(`svg`,{width:`12`,height:`12`,viewBox:`0 0 12 12`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,"aria-hidden":!0,children:(0,f.jsx)(`path`,{d:`M9.11111 2L2 9.11111M10 6.44444L6.44444 10`,className:`stroke-muted-foreground`,strokeLinecap:`round`})}),t[0]=i):i=t[0];let a;return t[1]!==r||t[2]!==n?(a=(0,f.jsx)(`div`,{role:`separator`,"aria-orientation":`horizontal`,"aria-label":r,onPointerDown:n,className:`pointer-events-auto -m-2 flex size-7 cursor-ns-resize items-end justify-end p-2 touch-none select-none`,children:i}),t[1]=r,t[2]=n,t[3]=a):a=t[3],a}var Te=u.forwardRef((e,t)=>{let n=(0,d.c)(64),r,i,s,c,l,p,m,h,g,_,v,y,b,x;n[0]===e?(r=n[1],i=n[2],s=n[3],c=n[4],l=n[5],p=n[6],m=n[7],h=n[8],g=n[9],_=n[10],v=n[11],y=n[12],b=n[13],x=n[14]):({className:r,outerClassName:m,scrollbarClassName:_,fillContainer:y,useScrollShadow:b,scrollShadowSize:g,hasError:l,resizedHeight:i,onResizeHeightChange:p,disabled:s,simple:v,embedded:x,endSlot:c,...h}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=s,n[4]=c,n[5]=l,n[6]=p,n[7]=m,n[8]=h,n[9]=g,n[10]=_,n[11]=v,n[12]=y,n[13]=b,n[14]=x);let S=y!==void 0&&y,C=b!==void 0&&b,w=x!==void 0&&x,{t:T}=a(),E=u.useRef(null),D=u.useRef(null),[O,k]=u.useState(null),A=i??O,j;n[15]===p?j=n[16]:(j=e=>{let t=E.current;if(!t)return;D.current={startY:e.clientY,startHeight:t.getBoundingClientRect().height};let n=e.currentTarget;n.setPointerCapture(e.pointerId);let r=e=>{let t=D.current;if(!t)return;let n=t.startHeight+(e.clientY-t.startY),r=Math.max(82,n);p?p(r):k(r)},i=()=>{D.current=null,n.removeEventListener(`pointermove`,r),n.removeEventListener(`pointerup`,i),n.removeEventListener(`pointercancel`,i)};n.addEventListener(`pointermove`,r),n.addEventListener(`pointerup`,i),n.addEventListener(`pointercancel`,i),e.preventDefault()},n[15]=p,n[16]=j);let M=j,N;n[17]===Symbol.for(`react.memo_cache_sentinel`)?(N=e=>{if(e.target.closest(`textarea, button, [role="separator"]`))return;let t=E.current?.querySelector(`textarea`);t&&document.activeElement!==t&&(e.preventDefault(),t.focus())},n[17]=N):N=n[17];let P=N;if(v){let e=t,i=S?`[field-sizing:fixed]`:`field-sizing-content`,a;n[18]!==r||n[19]!==i?(a=o(`block w-full appearance-none resize-none bg-transparent text-foreground typography-markdown outline-none`,`px-3 py-2 md:typography-ui-label`,`placeholder:text-muted-foreground focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50`,i,r),n[18]=r,n[19]=i,n[20]=a):a=n[20];let c;return n[21]!==s||n[22]!==S||n[23]!==m||n[24]!==h||n[25]!==g||n[26]!==_||n[27]!==e||n[28]!==a||n[29]!==C?(c=(0,f.jsx)(Ce,{as:`textarea`,ref:e,disableHorizontal:!0,fillContainer:S,useScrollShadow:C,scrollShadowSize:g,outerClassName:m,scrollbarClassName:_,className:a,spellCheck:!1,autoComplete:`off`,autoCorrect:`off`,autoCapitalize:`off`,disabled:s,...h}),n[21]=s,n[22]=S,n[23]=m,n[24]=h,n[25]=g,n[26]=_,n[27]=e,n[28]=a,n[29]=C,n[30]=c):c=n[30],c}let F;n[31]===A?F=n[32]:(F=A===null?void 0:{height:`${A}px`},n[31]=A,n[32]=F);let I;if(n[33]!==w||n[34]!==l||n[35]!==m){let e;n[37]===l?e=n[38]:(e=l&&[`ring-[var(--status-error)]`,`focus-within:ring-2 focus-within:ring-[var(--status-error)]`],n[37]=l,n[38]=e);let t;n[39]===w?t=n[40]:(t=w&&[`rounded-none bg-transparent ring-0`,`hover:[&:not(:focus-within)]:bg-transparent`,`has-[[disabled]]:bg-transparent`],n[39]=w,n[40]=t),I=o(`group/textarea relative flex w-full flex-col rounded-[var(--radius-xl)] bg-[var(--surface-elevated)] pb-2.5`,`ring-1 ring-inset ring-border/60 transition duration-200 ease-out`,`hover:[&:not(:focus-within)]:bg-[var(--surface-subtle)]`,`has-[[disabled]]:pointer-events-none has-[[disabled]]:bg-[var(--surface-subtle)] has-[[disabled]]:ring-transparent`,!l&&[`hover:[&:not(:focus-within)]:ring-transparent`,`focus-within:ring-2 focus-within:ring-[var(--interactive-focus-ring)]`],e,t,m),n[33]=w,n[34]=l,n[35]=m,n[36]=I}else I=n[36];let L;n[41]!==r||n[42]!==s?(L=o(`block w-full flex-1 min-h-0 appearance-none resize-none bg-transparent text-foreground typography-markdown outline-none`,`min-h-[82px] pl-3 pr-2.5 pt-2.5 md:typography-ui-label`,`focus-visible:outline-none disabled:cursor-not-allowed`,!s&&[`placeholder:select-none placeholder:text-muted-foreground placeholder:transition placeholder:duration-200 placeholder:ease-out`,`group-hover/textarea:placeholder:text-foreground/80`,`focus:placeholder:text-foreground/80`],s&&`text-muted-foreground/60 placeholder:text-muted-foreground/60`,r),n[41]=r,n[42]=s,n[43]=L):L=n[43];let R;n[44]!==s||n[45]!==h||n[46]!==t||n[47]!==L?(R=(0,f.jsx)(`textarea`,{ref:t,className:L,spellCheck:!1,autoComplete:`off`,autoCorrect:`off`,autoCapitalize:`off`,disabled:s,...h}),n[44]=s,n[45]=h,n[46]=t,n[47]=L,n[48]=R):R=n[48];let z;n[49]===T?z=n[50]:(z=T(`textarea.resizeHandleAria`),n[49]=T,n[50]=z);let B;n[51]!==M||n[52]!==z?(B=(0,f.jsx)(we,{onResizeStart:M,ariaLabel:z}),n[51]=M,n[52]=z,n[53]=B):B=n[53];let V;n[54]!==c||n[55]!==B?(V=(0,f.jsxs)(`div`,{className:`flex items-center justify-end gap-1.5 pl-3 pr-2.5`,children:[c,B]}),n[54]=c,n[55]=B,n[56]=V):V=n[56];let H;n[57]!==V||n[58]!==R?(H=(0,f.jsxs)(`div`,{className:`flex h-full min-h-0 flex-1 flex-col gap-2`,children:[R,V]}),n[57]=V,n[58]=R,n[59]=H):H=n[59];let U;return n[60]!==H||n[61]!==F||n[62]!==I?(U=(0,f.jsx)(`div`,{ref:E,onPointerDown:P,style:F,className:I,children:H}),n[60]=H,n[61]=F,n[62]=I,n[63]=U):U=n[63],U});Te.displayName=`Textarea`;export{h as C,g as S,B as _,_e as a,T as b,Y as c,ne as d,ae as f,R as g,z as h,ve as i,re as l,G as m,Ce as n,Q as o,U as p,be as r,ie as s,Te as t,oe as u,V as v,F as x,I as y};
|
|
1
|
+
import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{nt as t,rt as n,tt as r}from"./vendor-base-ui-CnHfUmDN.js";import{n as i}from"./vendor-react-DLPElpoQ.js";import{f as a,r as o,t as s}from"./button-CUwjpv-i.js";import{n as c}from"./Icon-BdzPRCSy.js";import{t as l}from"./OverlayScrollbar-C1C2aKOe.js";var u=e(n(),1),d=i(),f=t(),p=e(r(),1),m=0,h=()=>{m=Date.now()+800},g=()=>Date.now()<m,_=(e,t)=>{let n=`flex min-h-0 flex-col bg-background shadow-none`;if(e===`page`)return`${n} h-full w-full`;let r=`${n} pwa-overlay-panel`;return t===`top`?`${r} mx-auto mb-auto max-h-[calc(100dvh-0.75rem)] w-full max-w-lg rounded-b-xl border-x border-b border-border/50`:t===`left`?`${r} h-full w-[min(86vw,24rem)] rounded-r-xl border-r border-y border-border/50`:t===`right`?`${r} ml-auto h-full w-[min(86vw,24rem)] rounded-l-xl border-l border-y border-border/50`:`${r} mx-auto mt-auto max-h-[calc(100dvh-0.75rem)] w-full max-w-lg rounded-t-2xl border-x border-t border-border/50 pb-[max(0.5rem,var(--oc-app-bottom-safe,0px),var(--oc-safe-area-bottom,env(safe-area-inset-bottom,0px)))]`},v=e=>Math.min(1,Math.max(0,Number.isFinite(e)?e:0)),y=(e,t,n)=>{let r=Number.isFinite(t)&&t>0?t:1,i=Math.max(0,Number.isFinite(e)?e:0)/r,a=v(n[0]??1),o=Math.abs(i-a);for(let e=1;e<n.length;e+=1){let t=v(n[e]??a),r=Math.abs(i-t);r<o&&(a=t,o=r)}return a},b=(e,t)=>{let n=v(t),r=`${(1-n)*100}%`;return{progress:n,scrimOpacity:n,surfaceOpacity:n,surfaceTransform:e===`left`?`translate3d(-${r}, 0, 0)`:e===`right`?`translate3d(${r}, 0, 0)`:e===`top`?`translate3d(0, -${r}, 0)`:`translate3d(0, ${r}, 0)`}},x=(e,t)=>{let n=v(t);return e===`present`?n:1-n},S=(e,t)=>e===`present`?+(t===`commit`):t===`commit`?0:1,C=e=>+!!e,w=.72,T=.98,E=[w,T],D=180,O=`cubic-bezier(0.32, 0.72, 0, 1)`,k=64,A=()=>Math.max(1,window.innerHeight),j=(e,t,n=k,r)=>e<=N(t,r)-n,M=(e,t,n)=>Math.min(t*T,Math.max(n?0:t*w,e)),N=(e,t)=>{let n=Math.max(1,e)*w;return t==null||!Number.isFinite(t)?n:Math.min(n,Math.max(0,t))},P=(e,t,n)=>{let r=N(t,n),i=Math.max(1,t)*T;return Math.abs(e-r)<=Math.abs(e-i)?w:T},F=({initialSnapPoint:e=w,fitContent:t=!1,onDismiss:n,dismissThresholdPx:r=k}={})=>{let i=u.useRef(null),a=u.useRef(null),o=u.useRef(null),s=u.useRef(null),c=u.useRef(null),l=u.useRef(null),d=u.useRef(!1),[f,p]=u.useState(e),m=u.useRef(e),h=u.useRef(n);h.current=n;let g=u.useCallback(()=>{o.current!==null&&window.cancelAnimationFrame(o.current),o.current=null},[]),_=u.useCallback((e,n)=>{let r=i.current,a=m.current;if(m.current=e,p(e),g(),s.current=null,c.current?.cancel(),c.current=null,!r)return;let o=n??r.getBoundingClientRect().height;t&&a===.72&&l.current===null&&(l.current=N(A(),o));let u=e===.72?N(A(),t?l.current:void 0):A()*T;if(r.style.height=``,r.style.willChange=``,Math.abs(o-u)<1||typeof r.animate!=`function`||window.matchMedia(`(prefers-reduced-motion: reduce)`).matches)return;let d=r.animate([{height:`${o}px`},{height:`${u}px`}],{duration:D,easing:O,fill:`both`});c.current=d,d.finished.catch(()=>void 0).then(()=>{c.current===d&&(c.current=null,d.cancel())})},[g,t]),v=u.useCallback(e=>{if(!e.isPrimary||e.pointerType===`mouse`&&e.button!==0)return;let n=i.current;if(!n)return;let r=n.getBoundingClientRect().height;t&&m.current===.72&&(l.current=N(A(),r)),c.current?.cancel(),c.current=null,n.style.height=`${r}px`,n.style.willChange=`height`,a.current={pointerId:e.pointerId,startY:e.clientY,startHeight:r,startSnapPoint:m.current,viewportHeight:A()},d.current=!1,e.currentTarget.setPointerCapture(e.pointerId),e.preventDefault()},[t]),b=u.useCallback(e=>{let t=a.current,n=i.current;if(!t||t.pointerId!==e.pointerId||!n)return;let r=t.startY-e.clientY;Math.abs(r)>3&&(d.current=!0),s.current=M(t.startHeight+r,t.viewportHeight,!!h.current),o.current===null&&(o.current=window.requestAnimationFrame(()=>{o.current=null,i.current&&s.current!==null&&(i.current.style.height=`${s.current}px`)})),e.preventDefault()},[]),x=u.useCallback((e,n)=>{let o=a.current,c=i.current;if(!o||o.pointerId!==e.pointerId||!c)return;a.current=null,g();let u=s.current??c.getBoundingClientRect().height;if(s.current=null,e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId),!n&&h.current&&j(u,o.viewportHeight,r,t?l.current:void 0)){c.style.willChange=``,h.current(),e.preventDefault();return}let d=n?o.startSnapPoint:t?P(u,o.viewportHeight,l.current):y(u,o.viewportHeight,E);_(d,u),e.preventDefault()},[g,r,t,_]),S=u.useCallback(()=>{if(d.current){d.current=!1;return}_(m.current===.98?w:T)},[_]),C=u.useCallback(e=>{let t=null;(e.key===`ArrowUp`||e.key===`Home`)&&(t=T),(e.key===`ArrowDown`||e.key===`End`)&&(t=w),(e.key===`Enter`||e.key===` `)&&(t=m.current===.98?w:T),t!==null&&(e.preventDefault(),_(t))},[_]),F=u.useCallback(()=>{a.current=null,g(),s.current=null,c.current?.cancel(),c.current=null,l.current=null,m.current=e,p(e),i.current&&(i.current.style.height=``,i.current.style.willChange=``)},[g,e]);return u.useEffect(()=>()=>{g(),c.current?.cancel()},[g]),{surfaceRef:i,snapPoint:f,handlePointerDown:v,handlePointerMove:b,handlePointerUp:e=>x(e,!1),handlePointerCancel:e=>x(e,!0),handleClick:S,handleKeyDown:C,reset:F}},I=e=>{let t=(0,d.c)(12),{controller:n,ariaLabel:r}=e,i;t[0]===n.snapPoint?i=t[1]:(i=Math.round(n.snapPoint*100),t[0]=n.snapPoint,t[1]=i);let a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,f.jsx)(`div`,{className:`h-1.5 w-11 rounded-full bg-[var(--interactive-border)]`}),t[2]=a):a=t[2];let o;return t[3]!==r||t[4]!==n.handleClick||t[5]!==n.handleKeyDown||t[6]!==n.handlePointerCancel||t[7]!==n.handlePointerDown||t[8]!==n.handlePointerMove||t[9]!==n.handlePointerUp||t[10]!==i?(o=(0,f.jsx)(`div`,{"data-mobile-sheet-snap-handle":!0,role:`separator`,tabIndex:0,"aria-label":r,"aria-orientation":`horizontal`,"aria-valuemin":w*100,"aria-valuemax":T*100,"aria-valuenow":i,className:`flex min-h-8 cursor-ns-resize touch-none justify-center pt-2.5 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-[var(--interactive-focus-ring)]`,onPointerDown:n.handlePointerDown,onPointerMove:n.handlePointerMove,onPointerUp:n.handlePointerUp,onPointerCancel:n.handlePointerCancel,onClick:n.handleClick,onKeyDown:n.handleKeyDown,children:a}),t[3]=r,t[4]=n.handleClick,t[5]=n.handleKeyDown,t[6]=n.handlePointerCancel,t[7]=n.handlePointerDown,t[8]=n.handlePointerMove,t[9]=n.handlePointerUp,t[10]=i,t[11]=o):o=t[11],o},L=new WeakMap;function R(e){L.set(e.currentTarget,!0)}function z(e){if(L.delete(e.currentTarget))return!0;if(e.detail!==0)return!1;if(typeof document>`u`)return!0;let t=document.activeElement,n=e.currentTarget;return n instanceof Node&&t instanceof Node&&n.contains(t)}function B(e){e.target===e.currentTarget&&R(e)}function V(e){return e.target===e.currentTarget&&z(e)}var H=new class{entries=[];listeners=new Set;previousOverflow=null;getSnapshot=()=>this.entries.at(-1)?.id??null;subscribe=e=>(this.listeners.add(e),()=>this.listeners.delete(e));add(e,t){return this.entries=[...this.entries.filter(t=>t.id!==e.id),e],this.entries.length===1&&t&&(this.previousOverflow=t.style.overflow,t.style.overflow=`hidden`),this.emit(),()=>this.remove(e.id,t)}remove(e,t){let n=this.entries.length;this.entries=this.entries.filter(t=>t.id!==e),n>0&&this.entries.length===0&&t&&this.previousOverflow!==null&&(t.style.overflow=this.previousOverflow,this.previousOverflow=null),this.emit()}closeTop(){this.entries.at(-1)?.onClose()}emit(){for(let e of this.listeners)e()}},U=`mobile-sessions`,W=new Map,G=e=>W.get(e)??null,ee=(e,t)=>(W.set(e,t),()=>{W.get(e)===t&&W.delete(e)}),K=`.overlay-scrollbar-container`,q=1,J=e=>e===`left`||e===`right`?`x`:`y`,te=e=>e===`bottom`||e===`right`?1:-1,Y=(e,t,n)=>{let r=J(e)===`x`?t:n;return Math.max(0,r*te(e))},ne=(e,t,n,r,i)=>{let a=Y(e,t,n),o=Math.abs(J(e)===`x`?n:t);return Math.hypot(t,n)>r&&a>0&&o<a*i},re=(e,t)=>Math.min(1,Math.max(0,e/Math.max(1,t))),ie=(e,t,n,r)=>Math.min(r,Math.max(n,e*t)),ae=(e,t,n,r,i)=>e>=n||e>=i&&t>=r,oe=(e,t,n,r,i)=>t!==0&&n>0?t*i/n:r>80?0:e,X=(e,t,n=q)=>{if(t===`bottom`)return e.scrollTop<=n;if(t===`top`)return e.scrollTop>=e.scrollHeight-e.clientHeight-n;if(e.matches?.(`:dir(rtl)`)){let r=e.scrollWidth-e.clientWidth;return t===`right`?Math.abs(e.scrollLeft)<=n:Math.abs(e.scrollLeft)>=r-n}return t===`right`?e.scrollLeft<=n:e.scrollLeft>=e.scrollWidth-e.clientWidth-n},se=(e,t)=>{for(let n=0;n<e.length;n+=1){let r=e.item(n);if(r?.identifier===t)return r}return null},Z=(e,t)=>{let n=window.getComputedStyle(e),r=J(t),i=r===`x`?n.overflowX:n.overflowY,a=r===`x`?e.scrollWidth:e.scrollHeight,o=r===`x`?e.clientWidth:e.clientHeight;return(i===`auto`||i===`scroll`||i===`overlay`)&&a>o},ce=(e,t,n,r)=>{let i=t instanceof Element?t:null,a=i instanceof HTMLElement?i:i?.parentElement??null;for(;a&&e.contains(a);){if(Z(a,n))return a;if(a===e)break;a=a.parentElement}let o=i?.closest(r)??null;return o&&e.contains(o)&&Z(o,n)?o:null},le=e=>{let t=u.useRef(e),n=u.useRef(null),r=u.useRef(null);return t.current=e,u.useCallback(e=>{if(n.current?.(),n.current=null,!e)return;let i=()=>{let e=r.current;r.current=null,e?.active&&e.controller?.finish(`cancel`)},a=(e,t,n)=>{let r=J(e.edge)===`x`?t.clientX:t.clientY,i=n-e.lastTime,a=r-e.lastPrimary;e.velocity=oe(e.velocity,a,i,n-e.lastVelocityTime,te(e.edge)),a!==0&&i>0&&(e.lastVelocityTime=n),e.lastPrimary=r,e.lastTime=n,e.distance=Y(e.edge,t.clientX-e.startX,t.clientY-e.startY)},o=n=>{i();let a=t.current;if(a.disabled||n.touches.length!==1)return;let o=n.target instanceof Element?n.target:null,s=a.reservedTargetSelector?o?.closest(a.reservedTargetSelector):null;if(s&&e.contains(s)||o?.closest(`input, textarea, select, [contenteditable=""], [contenteditable="true"], [data-mobile-sheet-no-dismiss]`))return;let c=n.touches[0],l=ce(e,n.target,a.edge,a.scrollContainerSelector??K);if(l&&!X(l,a.edge))return;let u=e.getBoundingClientRect(),d=J(a.edge)===`x`?u.width||window.innerWidth:u.height||window.innerHeight;r.current={edge:a.edge,motionId:a.motionId,touchId:c.identifier,startX:c.clientX,startY:c.clientY,lastPrimary:J(a.edge)===`x`?c.clientX:c.clientY,lastTime:n.timeStamp,lastVelocityTime:n.timeStamp,velocity:0,distance:0,commitDistance:ie(d,a.commitDistanceRatio??.1,a.minCommitDistance??40,a.maxCommitDistance??64),motionDistance:d,intentDistance:a.intentDistance??8,maxOffAxisRatio:a.maxOffAxisRatio??1,flingVelocity:a.flingVelocity??.65,flingMinDistance:a.flingMinDistance??12,controller:null,active:!1}},s=e=>{let n=r.current;if(!n)return;if(t.current.disabled||e.touches.length!==1){i();return}let o=se(e.touches,n.touchId);if(!o){i();return}if(a(n,o,e.timeStamp),!n.active){if(Math.hypot(o.clientX-n.startX,o.clientY-n.startY)<=n.intentDistance)return;if(!ne(n.edge,o.clientX-n.startX,o.clientY-n.startY,n.intentDistance,n.maxOffAxisRatio)){r.current=null;return}let e=G(n.motionId);if(!e){r.current=null;return}if(!e.begin(`dismiss`)){r.current=null;return}n.active=!0,n.controller=e}n.controller?.update(re(n.distance,n.motionDistance)),e.preventDefault()},c=e=>{let t=r.current;if(!t)return;let n=se(e.changedTouches,t.touchId);if(!n){i();return}if(r.current=null,!t.active)return;a(t,n,e.timeStamp),t.controller?.update(re(t.distance,t.motionDistance));let o=ae(t.distance,t.velocity,t.commitDistance,t.flingVelocity,t.flingMinDistance);t.controller?.finish(o?`commit`:`cancel`),e.preventDefault()},l=()=>i();e.addEventListener(`touchstart`,o,{passive:!0,capture:!0}),e.addEventListener(`touchmove`,s,{passive:!1,capture:!0}),e.addEventListener(`touchend`,c,{passive:!1,capture:!0}),e.addEventListener(`touchcancel`,l,{passive:!0,capture:!0}),n.current=()=>{i(),e.removeEventListener(`touchstart`,o,!0),e.removeEventListener(`touchmove`,s,!0),e.removeEventListener(`touchend`,c,!0),e.removeEventListener(`touchcancel`,l,!0)}},[])},ue=`mobile-overlay-root`,de=200,fe=80,pe=`cubic-bezier(0.32, 0.72, 0, 1)`,me=`a[href], button:not(:disabled), input:not(:disabled), select:not(:disabled), textarea:not(:disabled), [tabindex]:not([tabindex="-1"])`,he=()=>{if(typeof document>`u`)return null;let e=document.getElementById(ue);return e||(e=document.createElement(`div`),e.id=ue,document.body.appendChild(e)),e},ge=()=>typeof window<`u`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches,Q=({id:e,open:t,onOpenChange:n,keepMounted:r=!1,presentation:i=`sheet`,edge:a=`bottom`,children:s,className:c,scrimClassName:l,surfaceClassName:d,surfaceElementRef:m,dismissGesture:h=!1,onExitComplete:v,onPreviewChange:y,ariaLabel:w})=>{let T=u.useRef(null),E=u.useRef(null),D=u.useRef(null),O=u.useRef(t),k=u.useRef(n),A=u.useRef(v),j=u.useRef(y),M=u.useRef(0),N=u.useRef(0),P=u.useRef(null),F=u.useRef([]),I=u.useRef(null),L=u.useRef(`standard`),R=u.useRef(`present`),z=u.useRef(0),U=u.useRef(!1),W=u.useRef(t),G=u.useRef(!1),K=u.useRef(t),q=u.useRef(null),[J,te]=u.useState(t),[Y,ne]=u.useState(t),[re,ie]=u.useState(`standard`),[ae,oe]=u.useState(!1),X=re===`interactive-present`,se=u.useSyncExternalStore(H.subscribe,H.getSnapshot,H.getSnapshot),Z=Y&&!X&&se===e,ce=le({motionId:e,edge:a,disabled:!h,...typeof h==`object`?h:{}}),ue=u.useCallback(e=>{D.current=e,ce(e),typeof m==`function`?m(e):m&&typeof m==`object`&&(m.current=e)},[ce,m]),Q=u.useCallback(()=>{K.current&&(K.current=!1,ne(!1),r||te(!1),A.current?.())},[r]);O.current=t,k.current=n,A.current=v,j.current=y,u.useLayoutEffect(()=>{j.current?.(Y&&X)},[Y,X]),typeof document<`u`&&!T.current&&(T.current=he());let $=u.useCallback(e=>{let t=b(a,e);M.current=t.progress,!(!E.current||!D.current)&&(E.current.style.opacity=String(t.scrimOpacity),D.current.style.transform=t.surfaceTransform,D.current.style.opacity=String(t.surfaceOpacity))},[a]),_e=u.useCallback(()=>{P.current!==null&&window.cancelAnimationFrame(P.current),P.current=null},[]),ve=u.useCallback(()=>{E.current&&(E.current.style.willChange=``),D.current&&(D.current.style.willChange=``)},[]),ye=u.useCallback((e=F.current)=>{for(let t of e)t.cancel();F.current=[]},[]),be=u.useCallback(()=>{_e();let e=I.current;if(e){let t=e.animations[1]?.effect?.getComputedTiming().progress;$(typeof t==`number`&&Number.isFinite(t)?e.from+(e.target-e.from)*t:M.current),ye(e.animations),I.current=null}else ye();ve(),oe(!1)},[$,ye,_e,ve]),xe=u.useCallback((e,t)=>{if(I.current?.target===e)return;be();let n=M.current,r=E.current,i=D.current;if(oe(!0),!r||!i||ge()||n===e){$(e),ve(),oe(!1),t?.();return}let o=b(a,n),s=b(a,e);r.style.willChange=`opacity`,i.style.willChange=`transform, opacity`;let c=Math.max(fe,de*Math.abs(e-n)),l=[r.animate([{opacity:o.scrimOpacity},{opacity:s.scrimOpacity}],{duration:c,easing:pe,fill:`forwards`}),i.animate([{transform:o.surfaceTransform,opacity:o.surfaceOpacity},{transform:s.surfaceTransform,opacity:s.surfaceOpacity}],{duration:c,easing:pe,fill:`forwards`})];F.current=l;let u={from:n,target:e,animations:l};I.current=u,Promise.all(l.map(e=>e.finished.catch(()=>void 0))).then(()=>{I.current===u&&($(e),ye(l),I.current=null,ve(),oe(!1),t?.())})},[$,ye,ve,a,be]);if(u.useLayoutEffect(()=>{G.current=J,J&&$(N.current)},[$,J]),u.useLayoutEffect(()=>{K.current=Y},[Y]),u.useEffect(()=>{t&&!G.current&&(N.current=M.current,te(!0)),t&&!K.current&&(K.current=!0,ne(!0)),G.current&&L.current===`standard`&&xe(C(t),()=>{!O.current&&L.current===`standard`&&Q()})},[Q,t,xe]),u.useLayoutEffect(()=>{!J||L.current!==`standard`||xe(+!!t,()=>{!O.current&&L.current===`standard`&&Q()})},[Q,J,t,xe]),u.useEffect(()=>{if(!(!Y||X))return window.dispatchEvent(new Event(`oc:mobile-overlay-opened`)),()=>{window.dispatchEvent(new Event(`oc:mobile-overlay-closed`))}},[Y,X]),u.useEffect(()=>{if(!(!Y||X))return H.add({id:e,onClose:()=>k.current(!1)},document.body)},[Y,e,X]),u.useEffect(()=>{if(!Y||X||!Z)return;let e=D.current,t=document.activeElement instanceof HTMLElement?document.activeElement:null;e?.focus({preventScroll:!0});let n=t=>{if(t.key===`Escape`&&H.closeTop(),t.key!==`Tab`||!e)return;let n=Array.from(e.querySelectorAll(me)).filter(e=>!e.closest(`[data-mobile-sheet-snap-handle]`)),r=n[0]??e,i=n.at(-1)??e;t.shiftKey&&document.activeElement===r&&(t.preventDefault(),i.focus({preventScroll:!0})),!t.shiftKey&&document.activeElement===i&&(t.preventDefault(),r.focus({preventScroll:!0}))};return document.addEventListener(`keydown`,n),()=>{document.removeEventListener(`keydown`,n),g()||t?.focus({preventScroll:!0})}},[Y,X,Z]),q.current={begin:e=>{if(e===`dismiss`&&(!K.current||L.current===`interactive-present`))return!1;be(),z.current+=1,U.current=!0,R.current=e;let t=e===`present`?`interactive-present`:`interactive-dismiss`;return L.current=t,ie(t),oe(!0),e===`present`&&(N.current=M.current,K.current=!0,ne(!0),te(!0)),!0},update:e=>{U.current&&(N.current=x(R.current,e),P.current===null&&(P.current=window.requestAnimationFrame(()=>{P.current=null,U.current&&$(N.current)})))},finish:e=>{if(!U.current)return;U.current=!1;let t=z.current,n=R.current,r=S(n,e);P.current!==null&&(_e(),$(N.current)),xe(r,()=>{t===z.current&&(e===`commit`&&k.current(n===`present`),n===`present`&&e===`cancel`&&!O.current&&Q(),L.current=`standard`,ie(`standard`),r===0&&Q())})},interrupt:()=>{z.current+=1,U.current=!1;let e=L.current===`interactive-present`&&!O.current;e||(L.current=`standard`,ie(`standard`)),be(),xe(C(O.current),()=>{O.current||Q(),e&&(L.current=`standard`,ie(`standard`))})}},u.useLayoutEffect(()=>{let e=W.current;W.current=t,e&&!t&&L.current!==`standard`&&q.current?.interrupt()},[t]),u.useEffect(()=>{let t=ee(e,{begin:e=>q.current?.begin(e)??!1,update:e=>q.current?.update(e),finish:e=>q.current?.finish(e),interrupt:()=>q.current?.interrupt()});return()=>{t(),_e(),ye(),I.current=null,ve(),q.current=null}},[ye,_e,ve,e]),!J||!T.current)return null;let Se=(0,f.jsx)(`div`,{ref:E,className:o(`oc-mobile-window-motion oc-keyboard-inset-surface fixed inset-0 z-[60] flex flex-col bg-[rgb(0_0_0_/_0.45)]`,ae&&`oc-mobile-window-motion-active`,!Y&&!X&&`pointer-events-none invisible`,l,c),"data-mobile-overlay-active":String(Y),role:X?void 0:`dialog`,"aria-label":X?void 0:w,"aria-modal":Y&&Z?`true`:void 0,"aria-hidden":X||!Y||!Z||void 0,inert:X||!Y||!Z||void 0,onPointerDown:B,onClick:e=>{!Y||X||!Z||V(e)&&k.current(!1)},children:(0,f.jsx)(`div`,{ref:ue,tabIndex:-1,className:o(`oc-mobile-floating-shell`,_(i,a),d),"data-oc-motion-id":e,style:{contain:`layout paint style`},onClick:e=>e.stopPropagation(),children:s})});return(0,p.createPortal)(Se,T.current)},$=u.createContext(null),_e=e=>{let t=(0,d.c)(5),{children:n}=e,r=u.useContext($);if(!r)return null;let i;t[0]===n?i=t[1]:(i=(0,f.jsx)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:n}),t[0]=n,t[1]=i);let a;return t[2]!==r||t[3]!==i?(a=(0,p.createPortal)(i,r),t[2]=r,t[3]=i,t[4]=a):a=t[4],a},ve=e=>{let t=(0,d.c)(45),{id:n,open:r,onOpenChange:i,title:a,leading:l,trailing:p,ariaLabel:m,closeAriaLabel:h,resizeAriaLabel:g,initiallyExpanded:_,fitContent:v,bodyClassName:y,children:b}=e,x=_!==void 0&&_,S=v!==void 0&&v,C=x?T:void 0,w;t[0]===i?w=t[1]:(w=()=>i(!1),t[0]=i,t[1]=w);let E;t[2]!==S||t[3]!==C||t[4]!==w?(E={initialSnapPoint:C,fitContent:S,onDismiss:w},t[2]=S,t[3]=C,t[4]=w,t[5]=E):E=t[5];let D=F(E),[O,k]=u.useState(null),A=a!=null||l!=null||p!=null,j=D.snapPoint===T,M=j||!S,N;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(N={reservedTargetSelector:`[data-mobile-sheet-snap-handle]`},t[6]=N):N=t[6];let P=j?`h-[98dvh] max-h-[98dvh]`:S?`h-auto max-h-[72dvh]`:`h-[72dvh] max-h-[98dvh]`,L=D.surfaceRef,R=D.reset,z=M&&`flex-1`,B;t[7]===z?B=t[8]:(B=o(`flex min-h-0 flex-col`,z),t[7]=z,t[8]=B);let V;t[9]!==g||t[10]!==D?(V=(0,f.jsx)(I,{controller:D,ariaLabel:g}),t[9]=g,t[10]=D,t[11]=V):V=t[11];let H;t[12]!==h||t[13]!==S||t[14]!==A||t[15]!==l||t[16]!==i||t[17]!==a||t[18]!==p?(H=A?(0,f.jsxs)(`div`,{className:S?`flex min-h-9 items-center gap-2 px-4 pb-1`:`flex min-h-10 items-center gap-2 px-4 pb-2`,children:[l?(0,f.jsx)(`div`,{className:`flex shrink-0 items-center`,children:l}):null,(0,f.jsx)(`div`,{className:`min-w-0 flex-1`,children:a}),p?(0,f.jsx)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:p}):null,(0,f.jsx)(`div`,{ref:k,className:`contents`}),(0,f.jsx)(s,{type:`button`,variant:`ghost`,size:`icon`,onClick:()=>i(!1),"aria-label":h,className:`shrink-0 text-muted-foreground`,style:{touchAction:`manipulation`},children:(0,f.jsx)(c,{name:`close`,className:`size-5`})})]}):null,t[12]=h,t[13]=S,t[14]=A,t[15]=l,t[16]=i,t[17]=a,t[18]=p,t[19]=H):H=t[19];let U;t[20]!==V||t[21]!==H?(U=(0,f.jsxs)(`div`,{className:`shrink-0`,children:[V,H]}),t[20]=V,t[21]=H,t[22]=U):U=t[22];let W=M&&`flex-1`,G;t[23]!==y||t[24]!==W?(G=o(`flex min-h-0 flex-col overflow-hidden`,W,y),t[23]=y,t[24]=W,t[25]=G):G=t[25];let ee;t[26]!==b||t[27]!==G?(ee=(0,f.jsx)(`div`,{className:G,"data-page-scroll-lock":`true`,children:b}),t[26]=b,t[27]=G,t[28]=ee):ee=t[28];let K;t[29]!==B||t[30]!==U||t[31]!==ee?(K=(0,f.jsxs)(`div`,{className:B,children:[U,ee]}),t[29]=B,t[30]=U,t[31]=ee,t[32]=K):K=t[32];let q;t[33]!==m||t[34]!==n||t[35]!==i||t[36]!==r||t[37]!==D.reset||t[38]!==D.surfaceRef||t[39]!==K||t[40]!==P?(q=(0,f.jsx)(Q,{id:n,open:r,onOpenChange:i,presentation:`sheet`,edge:`bottom`,dismissGesture:N,ariaLabel:m,surfaceClassName:P,surfaceElementRef:L,onExitComplete:R,children:K}),t[33]=m,t[34]=n,t[35]=i,t[36]=r,t[37]=D.reset,t[38]=D.surfaceRef,t[39]=K,t[40]=P,t[41]=q):q=t[41];let J;return t[42]!==O||t[43]!==q?(J=(0,f.jsx)($.Provider,{value:O,children:q}),t[42]=O,t[43]=q,t[44]=J):J=t[44],J};function ye(e,t){let n=(0,d.c)(3),r;return n[0]!==e||n[1]!==t?(r=n=>{[e,t].forEach(e=>{typeof e==`function`?e(n):e&&typeof e==`object`&&(e.current=n)})},n[0]=e,n[1]=t,n[2]=r):r=n[2],r}var be=u.forwardRef((e,t)=>{let n=(0,d.c)(28),{as:r,orientation:i,offset:a,size:o,isEnabled:s,hideTopShadow:c,hideBottomShadow:l,observeMutations:p,onVisibilityChange:m,style:h,className:g,children:_,...v}=e,y=r===void 0?`div`:r,b=i===void 0?`vertical`:i,x=a===void 0?0:a,S=o===void 0?48:o,C=s===void 0||s,w=c!==void 0&&c,T=l!==void 0&&l,E=p===void 0||p,D=u.useRef(null),O=u.useRef(`none`),k=v[`data-scroll-shadow`];delete v[`data-scroll-shadow`];let A=h,j;n[0]!==S||n[1]!==A?(j={...A},j[`--scroll-shadow-size`]=`${S}px`,n[0]=S,n[1]=A,n[2]=j):j=n[2];let M=j,N=xe,P=Se,F;n[3]!==T||n[4]!==w||n[5]!==C||n[6]!==x||n[7]!==m||n[8]!==b?(F=()=>{let e=D.current;if(!e)return;if(!C){P(e),O.current!==`none`&&(O.current=`none`,m?.(`none`));return}let t=b===`vertical`?e.scrollTop>x+1:e.scrollLeft>x+1,n=b===`vertical`?e.scrollHeight-(e.scrollTop+e.clientHeight)>x+1:e.scrollWidth-(e.scrollLeft+e.clientWidth)>x+1,r=w&&b===`vertical`?!1:t;T&&b===`vertical`&&(n=!1),N(e,r,n,b===`vertical`?`top`:`left`,b===`vertical`?`bottom`:`right`);let i=r&&n?`both`:r?b===`vertical`?`top`:`left`:n?b===`vertical`?`bottom`:`right`:`none`;i!==O.current&&(O.current=i,m?.(i))},n[3]=T,n[4]=w,n[5]=C,n[6]=x,n[7]=m,n[8]=b,n[9]=F):F=n[9];let I=F,L,R;n[10]!==I||n[11]!==C?(L=()=>{C||I()},R=[I,C],n[10]=I,n[11]=C,n[12]=L,n[13]=R):(L=n[12],R=n[13]),u.useLayoutEffect(L,R);let z,B;n[14]!==I||n[15]!==C||n[16]!==E?(z=()=>{let e=D.current;if(!e||!C)return;let t=null,n=()=>{t===null&&(t=requestAnimationFrame(()=>{t=null,I()}))},r=n,i=typeof ResizeObserver<`u`?new ResizeObserver(n):null,a=E&&typeof MutationObserver<`u`?new MutationObserver(n):null;return I(),e.addEventListener(`scroll`,r,{passive:!0}),i?.observe(e),a?.observe(e,{childList:!0,subtree:!0,characterData:!0}),()=>{t!==null&&cancelAnimationFrame(t),e.removeEventListener(`scroll`,r),i?.disconnect(),a?.disconnect()}},B=[I,C,E],n[14]=I,n[15]=C,n[16]=E,n[17]=z,n[18]=B):(z=n[17],B=n[18]),u.useEffect(z,B);let V=ye(D,t),H=k??!0,U;return n[19]!==y||n[20]!==_||n[21]!==g||n[22]!==V||n[23]!==M||n[24]!==b||n[25]!==v||n[26]!==H?(U=(0,f.jsx)(y,{...v,ref:V,className:g,"data-orientation":b,"data-scroll-shadow":H,style:M,children:_}),n[19]=y,n[20]=_,n[21]=g,n[22]=V,n[23]=M,n[24]=b,n[25]=v,n[26]=H,n[27]=U):U=n[27],U});be.displayName=`ScrollShadow`;function xe(e,t,n,r,i){let a=`${r}${i.charAt(0).toUpperCase()}${i.slice(1)}Scroll`;t&&n?(e.dataset[a]=`true`,e.removeAttribute(`data-${r}-scroll`),e.removeAttribute(`data-${i}-scroll`)):(e.dataset[`${r}Scroll`]=String(t),e.dataset[`${i}Scroll`]=String(n),e.removeAttribute(`data-${r}-${i}-scroll`))}function Se(e){[`top`,`bottom`,`top-bottom`,`left`,`right`,`left-right`].forEach(t=>{e.removeAttribute(`data-${t}-scroll`)})}var Ce=u.forwardRef((e,t)=>{let n=(0,d.c)(45),r,i,a,s,c,p,m,h,g,_,v,y,b,x,S,C;n[0]===e?(r=n[1],i=n[2],a=n[3],s=n[4],c=n[5],p=n[6],m=n[7],h=n[8],g=n[9],_=n[10],v=n[11],y=n[12],b=n[13],x=n[14],S=n[15],C=n[16]):({className:i,outerClassName:c,children:r,style:g,minThumbSize:s,hideDelayMs:a,as:_,scrollbarClassName:h,disableHorizontal:v,observeMutations:y,fillContainer:b,preventOverscroll:x,useScrollShadow:S,scrollShadowSize:m,userIntentOnly:C,...p}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a,n[4]=s,n[5]=c,n[6]=p,n[7]=m,n[8]=h,n[9]=g,n[10]=_,n[11]=v,n[12]=y,n[13]=b,n[14]=x,n[15]=S,n[16]=C);let w=_===void 0?`div`:_,T=v!==void 0&&v,E=y===void 0||y,D=b===void 0||b,O=x!==void 0&&x,k=S!==void 0&&S,A=C!==void 0&&C,j=u.useRef(null),M,N;n[17]===Symbol.for(`react.memo_cache_sentinel`)?(M=()=>j.current,N=[],n[17]=M,n[18]=N):(M=n[17],N=n[18]),u.useImperativeHandle(t,M,N);let P=O&&`overscroll-none`,F;n[19]!==c||n[20]!==P?(F=o(`relative flex flex-col min-h-0 w-full overflow-hidden`,P,c),n[19]=c,n[20]=P,n[21]=F):F=n[21];let I;n[22]!==w||n[23]!==r||n[24]!==i||n[25]!==T||n[26]!==D||n[27]!==E||n[28]!==O||n[29]!==p||n[30]!==m||n[31]!==g||n[32]!==k?(I=k?(0,f.jsx)(be,{as:w,ref:j,size:m,className:o(`overlay-scrollbar-target overlay-scrollbar-container`,O&&`overscroll-none`,D?`flex-1 min-h-0 w-full`:`flex-none w-full h-auto`,T?`overflow-y-auto overflow-x-hidden`:`overflow-auto`,i),style:g,observeMutations:E,...p,children:r}):(0,f.jsx)(w,{ref:j,className:o(`overlay-scrollbar-target overlay-scrollbar-container`,O&&`overscroll-none`,D?`flex-1 min-h-0 w-full`:`flex-none w-full h-auto`,T?`overflow-y-auto overflow-x-hidden`:`overflow-auto`,i),style:g,...p,children:r}),n[22]=w,n[23]=r,n[24]=i,n[25]=T,n[26]=D,n[27]=E,n[28]=O,n[29]=p,n[30]=m,n[31]=g,n[32]=k,n[33]=I):I=n[33];let L;n[34]!==T||n[35]!==a||n[36]!==s||n[37]!==E||n[38]!==h||n[39]!==A?(L=(0,f.jsx)(l,{containerRef:j,minThumbSize:s,hideDelayMs:a,className:h,disableHorizontal:T,observeMutations:E,userIntentOnly:A}),n[34]=T,n[35]=a,n[36]=s,n[37]=E,n[38]=h,n[39]=A,n[40]=L):L=n[40];let R;return n[41]!==F||n[42]!==I||n[43]!==L?(R=(0,f.jsxs)(`div`,{className:F,children:[I,L]}),n[41]=F,n[42]=I,n[43]=L,n[44]=R):R=n[44],R});Ce.displayName=`ScrollableOverlay`;function we(e){let t=(0,d.c)(4),{onResizeStart:n,ariaLabel:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,f.jsx)(`svg`,{width:`12`,height:`12`,viewBox:`0 0 12 12`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,"aria-hidden":!0,children:(0,f.jsx)(`path`,{d:`M9.11111 2L2 9.11111M10 6.44444L6.44444 10`,className:`stroke-muted-foreground`,strokeLinecap:`round`})}),t[0]=i):i=t[0];let a;return t[1]!==r||t[2]!==n?(a=(0,f.jsx)(`div`,{role:`separator`,"aria-orientation":`horizontal`,"aria-label":r,onPointerDown:n,className:`pointer-events-auto -m-2 flex size-7 cursor-ns-resize items-end justify-end p-2 touch-none select-none`,children:i}),t[1]=r,t[2]=n,t[3]=a):a=t[3],a}var Te=u.forwardRef((e,t)=>{let n=(0,d.c)(64),r,i,s,c,l,p,m,h,g,_,v,y,b,x;n[0]===e?(r=n[1],i=n[2],s=n[3],c=n[4],l=n[5],p=n[6],m=n[7],h=n[8],g=n[9],_=n[10],v=n[11],y=n[12],b=n[13],x=n[14]):({className:r,outerClassName:m,scrollbarClassName:_,fillContainer:y,useScrollShadow:b,scrollShadowSize:g,hasError:l,resizedHeight:i,onResizeHeightChange:p,disabled:s,simple:v,embedded:x,endSlot:c,...h}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=s,n[4]=c,n[5]=l,n[6]=p,n[7]=m,n[8]=h,n[9]=g,n[10]=_,n[11]=v,n[12]=y,n[13]=b,n[14]=x);let S=y!==void 0&&y,C=b!==void 0&&b,w=x!==void 0&&x,{t:T}=a(),E=u.useRef(null),D=u.useRef(null),[O,k]=u.useState(null),A=i??O,j;n[15]===p?j=n[16]:(j=e=>{let t=E.current;if(!t)return;D.current={startY:e.clientY,startHeight:t.getBoundingClientRect().height};let n=e.currentTarget;n.setPointerCapture(e.pointerId);let r=e=>{let t=D.current;if(!t)return;let n=t.startHeight+(e.clientY-t.startY),r=Math.max(82,n);p?p(r):k(r)},i=()=>{D.current=null,n.removeEventListener(`pointermove`,r),n.removeEventListener(`pointerup`,i),n.removeEventListener(`pointercancel`,i)};n.addEventListener(`pointermove`,r),n.addEventListener(`pointerup`,i),n.addEventListener(`pointercancel`,i),e.preventDefault()},n[15]=p,n[16]=j);let M=j,N;n[17]===Symbol.for(`react.memo_cache_sentinel`)?(N=e=>{if(e.target.closest(`textarea, button, [role="separator"]`))return;let t=E.current?.querySelector(`textarea`);t&&document.activeElement!==t&&(e.preventDefault(),t.focus())},n[17]=N):N=n[17];let P=N;if(v){let e=t,i=S?`[field-sizing:fixed]`:`field-sizing-content`,a;n[18]!==r||n[19]!==i?(a=o(`block w-full appearance-none resize-none bg-transparent text-foreground typography-markdown outline-none`,`px-3 py-2 md:typography-ui-label`,`placeholder:text-muted-foreground focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50`,i,r),n[18]=r,n[19]=i,n[20]=a):a=n[20];let c;return n[21]!==s||n[22]!==S||n[23]!==m||n[24]!==h||n[25]!==g||n[26]!==_||n[27]!==e||n[28]!==a||n[29]!==C?(c=(0,f.jsx)(Ce,{as:`textarea`,ref:e,disableHorizontal:!0,fillContainer:S,useScrollShadow:C,scrollShadowSize:g,outerClassName:m,scrollbarClassName:_,className:a,spellCheck:!1,autoComplete:`off`,autoCorrect:`off`,autoCapitalize:`off`,disabled:s,...h}),n[21]=s,n[22]=S,n[23]=m,n[24]=h,n[25]=g,n[26]=_,n[27]=e,n[28]=a,n[29]=C,n[30]=c):c=n[30],c}let F;n[31]===A?F=n[32]:(F=A===null?void 0:{height:`${A}px`},n[31]=A,n[32]=F);let I;if(n[33]!==w||n[34]!==l||n[35]!==m){let e;n[37]===l?e=n[38]:(e=l&&[`ring-[var(--status-error)]`,`focus-within:ring-2 focus-within:ring-[var(--status-error)]`],n[37]=l,n[38]=e);let t;n[39]===w?t=n[40]:(t=w&&[`rounded-none bg-transparent ring-0`,`hover:[&:not(:focus-within)]:bg-transparent`,`has-[[disabled]]:bg-transparent`],n[39]=w,n[40]=t),I=o(`group/textarea relative flex w-full flex-col rounded-[var(--radius-xl)] bg-[var(--surface-elevated)] pb-2.5`,`ring-1 ring-inset ring-border/60 transition duration-200 ease-out`,`hover:[&:not(:focus-within)]:bg-[var(--surface-subtle)]`,`has-[[disabled]]:pointer-events-none has-[[disabled]]:bg-[var(--surface-subtle)] has-[[disabled]]:ring-transparent`,!l&&[`hover:[&:not(:focus-within)]:ring-transparent`,`focus-within:ring-2 focus-within:ring-[var(--interactive-focus-ring)]`],e,t,m),n[33]=w,n[34]=l,n[35]=m,n[36]=I}else I=n[36];let L;n[41]!==r||n[42]!==s?(L=o(`block w-full flex-1 min-h-0 appearance-none resize-none bg-transparent text-foreground typography-markdown outline-none`,`min-h-[82px] pl-3 pr-2.5 pt-2.5 md:typography-ui-label`,`focus-visible:outline-none disabled:cursor-not-allowed`,!s&&[`placeholder:select-none placeholder:text-muted-foreground placeholder:transition placeholder:duration-200 placeholder:ease-out`,`group-hover/textarea:placeholder:text-foreground/80`,`focus:placeholder:text-foreground/80`],s&&`text-muted-foreground/60 placeholder:text-muted-foreground/60`,r),n[41]=r,n[42]=s,n[43]=L):L=n[43];let R;n[44]!==s||n[45]!==h||n[46]!==t||n[47]!==L?(R=(0,f.jsx)(`textarea`,{ref:t,className:L,spellCheck:!1,autoComplete:`off`,autoCorrect:`off`,autoCapitalize:`off`,disabled:s,...h}),n[44]=s,n[45]=h,n[46]=t,n[47]=L,n[48]=R):R=n[48];let z;n[49]===T?z=n[50]:(z=T(`textarea.resizeHandleAria`),n[49]=T,n[50]=z);let B;n[51]!==M||n[52]!==z?(B=(0,f.jsx)(we,{onResizeStart:M,ariaLabel:z}),n[51]=M,n[52]=z,n[53]=B):B=n[53];let V;n[54]!==c||n[55]!==B?(V=(0,f.jsxs)(`div`,{className:`flex items-center justify-end gap-1.5 pl-3 pr-2.5`,children:[c,B]}),n[54]=c,n[55]=B,n[56]=V):V=n[56];let H;n[57]!==V||n[58]!==R?(H=(0,f.jsxs)(`div`,{className:`flex h-full min-h-0 flex-1 flex-col gap-2`,children:[R,V]}),n[57]=V,n[58]=R,n[59]=H):H=n[59];let U;return n[60]!==H||n[61]!==F||n[62]!==I?(U=(0,f.jsx)(`div`,{ref:E,onPointerDown:P,style:F,className:I,children:H}),n[60]=H,n[61]=F,n[62]=I,n[63]=U):U=n[63],U});Te.displayName=`Textarea`;export{h as C,g as S,B as _,_e as a,T as b,Y as c,ne as d,ae as f,R as g,z as h,ve as i,re as l,G as m,Ce as n,Q as o,U as p,be as r,ie as s,Te as t,oe as u,V as v,F as x,I as y};
|
|
@@ -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{r as d}from"./button-
|
|
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{r as d}from"./button-CUwjpv-i.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{On as e}from"./persistence-
|
|
1
|
+
import{On as e}from"./persistence-Dnj1QOdX.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};
|