@openchambery/web 1.19.17-beta.2 → 1.19.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/AgentAvatar-CUDJ3_nZ.js +1 -0
- package/dist/assets/AssistantView-Zq6tBjih.js +3 -0
- package/dist/assets/DiagramView-BVkfNci5.js +1 -0
- package/dist/assets/FadeInOnReveal-BLSnyG2Z.js +1 -0
- package/dist/assets/Icon-C9ZHbwqp.js +1 -0
- package/dist/assets/MarkdownRenderer-DSqWFDq7.js +2 -0
- package/dist/assets/{MarkdownRendererImpl-BJd1Vjsc.js → MarkdownRendererImpl-BlRCMmq2.js} +2 -2
- package/dist/assets/MarkstreamRendererImpl-IxPVvQrK.js +3 -0
- package/dist/assets/MobileDetailNavigation-B2fTY2nU.js +1 -0
- package/dist/assets/MobileShareBridge-CQBddgDr.js +4 -0
- package/dist/assets/MobileSurface-DrUFT40n.js +2 -0
- package/dist/assets/MultiRunWindow-B8Cc2NUx.js +1 -0
- package/dist/assets/OnboardingScreen-DSyZtiFS.js +1 -0
- package/dist/assets/OverlayScrollbar-C7fAOAKT.js +2 -0
- package/dist/assets/SettingsView-DxMrhPpR.js +25 -0
- package/dist/assets/SettingsWindow-Cb8yglVO.js +1 -0
- package/dist/assets/TerminalView-BZ_OWmUl.js +8 -0
- package/dist/assets/{ToolOutputDialog-BQ_oXyS_.js → ToolOutputDialog-nhZwyPOH.js} +4 -4
- package/dist/assets/{appThemeRegistry-BDrIDWKH.js → appThemeRegistry-nmKlvHum.js} +1 -1
- package/dist/assets/button-bhVnVYB_.js +1 -0
- package/dist/assets/collapsible-CoWJB_Zl.js +1 -0
- package/dist/assets/context-menu-gSO0b3sQ.js +1 -0
- package/dist/assets/diagram-Dx4UOZUn.js +1 -0
- package/dist/assets/dialog-C2Dw0yqA.js +1 -0
- package/dist/assets/{es-BQb6I8gl.js → es-Bxd4Lyu9.js} +2 -2
- package/dist/assets/{fileMentionTouchSelection-DzdgAvGS.js → fileMentionTouchSelection-DipHuaLB.js} +2 -2
- package/dist/assets/{fr-BjGouC_l.js → fr-DiLDwVZs.js} +2 -2
- package/dist/assets/{gitApi-pLkl_IyQ.js → gitApi-CbhPyoLY.js} +3 -3
- package/dist/assets/input-8Te_vPwB.js +1 -0
- package/dist/assets/insertionBoundaries-DcjuOya1.js +1 -0
- package/dist/assets/{ja-Cw9zliYY.js → ja-CWRlmEJM.js} +2 -2
- package/dist/assets/{ko-Dyz0Dk9b.js → ko-DmIugkgj.js} +2 -2
- package/dist/assets/main-BoTARB6C.js +2 -0
- package/dist/assets/{main-B8fZfA3K.js → main-Cua6NA9P.js} +14 -14
- package/dist/assets/{markdownHeightCache-BL8CUQ0M.js → markdownHeightCache-CT2d4yTV.js} +1 -1
- package/dist/assets/miniChat-alS-GQJT.js +2 -0
- package/dist/assets/mobile-B2jIuTOm.js +2 -0
- package/dist/assets/multirun-DKDs3BMk.js +4 -0
- package/dist/assets/{pl-C7EY-dTH.js → pl-BU9AmdUM.js} +2 -2
- package/dist/assets/projectMeta-D2rOiejm.js +3 -0
- package/dist/assets/{pt-BR-B1uHpjFW.js → pt-BR-DQmEF9QB.js} +2 -2
- package/dist/assets/renderElectronMiniChatApp-CaQsjZiI.js +2 -0
- package/dist/assets/renderMobileApp-BFbbXCSX.js +28 -0
- package/dist/assets/{runtimeConfig-BD1Fo5N5.js → runtimeConfig-DFO2rEBa.js} +1 -1
- package/dist/assets/runtimeEndpointReset-Dl97vnoo.js +147 -0
- package/dist/assets/sessionChangeSummary-CfnRZ0gS.js +2 -0
- package/dist/assets/sessionLookup-CZwBZILA.js +1 -0
- package/dist/assets/sortable-tabs-strip-BmvLnn6O.js +1 -0
- package/dist/assets/src-DZ60kHBP.css +2 -0
- package/dist/assets/{store-ClnJdJSj.js → store-BoixGrYS.js} +3 -3
- package/dist/assets/textarea-DRL916s6.js +1 -0
- package/dist/assets/tooltip-BLznq5KR.js +1 -0
- package/dist/assets/{uk-DgG8v2md.js → uk-Dax66sAC.js} +2 -2
- package/dist/assets/{useAppFontEffects-CN_3Jty7.js → useAppFontEffects-CCaWyCj1.js} +43 -43
- package/dist/assets/useDesktopWindowControlsLayout-CLapWnnJ.js +1 -0
- package/dist/assets/{useEffectiveDirectory-C5Gg7EvP.js → useEffectiveDirectory-Cz772BtQ.js} +1 -1
- package/dist/assets/useMobileNavigationStore-C4HhoiC4.js +413 -0
- package/dist/assets/useSessionAutoCleanup-0sFR1yLV.js +2 -0
- package/dist/assets/{useWorkerHighlightedLines-BSQQkZaO.js → useWorkerHighlightedLines-tFoFZt9Z.js} +2 -2
- package/dist/assets/vendor-zod-Dzk5kdUU.js +39 -0
- package/dist/assets/{zh-CN-C6OFKjeT.js → zh-CN-Du4VC8Z0.js} +2 -2
- package/dist/assets/{zh-TW-BVP99aMr.js → zh-TW-C0bY-Dso.js} +2 -2
- package/dist/index.html +3 -3
- package/dist/mini-chat.html +3 -3
- package/dist/mobile.html +3 -3
- package/package.json +1 -1
- package/server/index.js +51 -0
- package/server/lib/opencode/DOCUMENTATION.md +1 -0
- package/server/lib/opencode/core-routes.js +2 -0
- package/server/lib/opencode/feature-routes-runtime.js +20 -0
- package/server/lib/opencode/feature-routes-runtime.test.js +10 -0
- package/server/lib/opencode/routes.js +14 -1
- package/server/lib/opencode/settings-helpers.js +3 -0
- package/server/lib/opencode/settings-helpers.test.js +12 -0
- package/server/lib/opencode/shutdown-runtime.js +2 -0
- package/server/lib/question-auto-delegate/DOCUMENTATION.md +124 -0
- package/server/lib/question-auto-delegate/core.d.ts +255 -0
- package/server/lib/question-auto-delegate/core.js +1372 -0
- package/server/lib/question-auto-delegate/core.test.js +672 -0
- package/server/lib/question-auto-delegate/routes.js +223 -0
- package/server/lib/question-auto-delegate/routes.test.js +180 -0
- package/server/lib/question-auto-delegate/runtime.js +243 -0
- package/server/lib/session-goal/DOCUMENTATION.md +12 -2
- package/server/lib/session-goal/runtime.js +138 -35
- package/server/lib/session-goal/runtime.test.js +192 -0
- package/dist/assets/AgentAvatar-m1jNq4bX.js +0 -1
- package/dist/assets/AssistantView-DZMTfY1i.js +0 -3
- package/dist/assets/DiagramView-Byf2evGV.js +0 -1
- package/dist/assets/FadeInOnReveal-UGwClbL_.js +0 -1
- package/dist/assets/Icon-D1BcR8Tz.js +0 -1
- package/dist/assets/MarkdownRenderer-YMePGw0Z.js +0 -2
- package/dist/assets/MarkstreamRendererImpl-2oZKPfgd.js +0 -3
- package/dist/assets/MobileDetailNavigation-BeNUCxzK.js +0 -1
- package/dist/assets/MobileShareBridge-3tBtXXJJ.js +0 -4
- package/dist/assets/MobileSurface-ppn0zIpb.js +0 -2
- package/dist/assets/MultiRunWindow-CItY5bZ2.js +0 -1
- package/dist/assets/OnboardingScreen-bIWeMLVx.js +0 -1
- package/dist/assets/OverlayScrollbar-Bahg_P3r.js +0 -2
- package/dist/assets/SettingsView-0-Yqdzh-.js +0 -25
- package/dist/assets/SettingsWindow-1jOWzU2A.js +0 -1
- package/dist/assets/TerminalView-BLOCPFz9.js +0 -8
- package/dist/assets/button-9R-WgVMl.js +0 -1
- package/dist/assets/clipboard-GUUNlWIv.js +0 -1
- package/dist/assets/collapsible-Bbz9KiJf.js +0 -1
- package/dist/assets/context-menu-CSyOhRz8.js +0 -1
- package/dist/assets/diagram-NdsZih8P.js +0 -1
- package/dist/assets/dialog-DhMGbF_B.js +0 -1
- package/dist/assets/input-Cd_1HyQv.js +0 -1
- package/dist/assets/insertionBoundaries-DJvMDCJJ.js +0 -1
- package/dist/assets/main-BGpPyUV2.js +0 -2
- package/dist/assets/miniChat-DHjphqgR.js +0 -2
- package/dist/assets/mobile-DNMX4u7x.js +0 -2
- package/dist/assets/multirun-BINJ2LCE.js +0 -4
- package/dist/assets/projectMeta-BMkGWqtz.js +0 -3
- package/dist/assets/renderElectronMiniChatApp-BonR3p7C.js +0 -2
- package/dist/assets/renderMobileApp-CZqNs2zK.js +0 -28
- package/dist/assets/runtimeEndpointReset-Dpx6GB_U.js +0 -147
- package/dist/assets/sessionChangeSummary-BG7l2heP.js +0 -2
- package/dist/assets/sessionLookup-BZuvc3Aa.js +0 -1
- package/dist/assets/sortable-tabs-strip-dYW6SH62.js +0 -1
- package/dist/assets/src-CO9q_82J.css +0 -2
- package/dist/assets/textarea-B9CmN13Z.js +0 -1
- package/dist/assets/tooltip-DSjr26A_.js +0 -1
- package/dist/assets/useDesktopWindowControlsLayout-C6kAkizT.js +0 -1
- package/dist/assets/useMobileNavigationStore-DDgESrzu.js +0 -413
- package/dist/assets/useSessionAutoCleanup-q2lauc7x.js +0 -2
- package/dist/assets/utils-2ZK8yboQ.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{$ as t,J as n,X as r,Y as i,Z as a,nt as o,rt as s}from"./vendor-base-ui-CnHfUmDN.js";import{n as c}from"./vendor-react-DLPElpoQ.js";import{n as l}from"./clipboard-GUUNlWIv.js";import{t as u}from"./utils-2ZK8yboQ.js";import{t as d}from"./SettingsView-0-Yqdzh-.js";var f=c(),p=e(s(),1),m=o(),h=e=>{let o=(0,f.c)(19),{open:s,onOpenChange:c}=e,{t:h}=l(),_=p.useId(),v=g,y;o[0]===c?y=o[1]:(y=e=>{!e&&v()||c(e)},o[0]=c,o[1]=y);let b;o[2]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,m.jsx)(t,{className:u(`fixed inset-0 z-50 bg-black/50 dark:bg-black/75`,`transition-opacity duration-150 ease-out`,`data-[starting-style]:opacity-0 data-[ending-style]:opacity-0`)}),o[2]=b):b=o[2];let x;o[3]===Symbol.for(`react.memo_cache_sentinel`)?(x=u(`relative pointer-events-auto`,`w-[90vw] max-w-[1200px] h-[85vh] max-h-[900px]`,`rounded-xl border shadow-none overflow-hidden origin-center`,`bg-background`,`transition-all duration-150 ease-out`,`data-[starting-style]:opacity-0 data-[starting-style]:scale-[0.98]`,`data-[ending-style]:opacity-0 data-[ending-style]:scale-[0.98]`,`data-[nested-dialog-open]:brightness-[0.55] dark:data-[nested-dialog-open]:brightness-[0.4]`),o[3]=x):x=o[3];let S;o[4]===h?S=o[5]:(S=h(`settings.window.description`),o[4]=h,o[5]=S);let C;o[6]!==_||o[7]!==S?(C=(0,m.jsx)(a,{id:_,className:`sr-only`,children:S}),o[6]=_,o[7]=S,o[8]=C):C=o[8];let w;o[9]===c?w=o[10]:(w=(0,m.jsx)(d,{onClose:()=>c(!1),isWindowed:!0}),o[9]=c,o[10]=w);let T;o[11]!==_||o[12]!==C||o[13]!==w?(T=(0,m.jsxs)(i,{children:[b,(0,m.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center pointer-events-none`,children:(0,m.jsxs)(r,{"aria-describedby":_,className:x,children:[C,w]})})]}),o[11]=_,o[12]=C,o[13]=w,o[14]=T):T=o[14];let E;return o[15]!==s||o[16]!==y||o[17]!==T?(E=(0,m.jsx)(n,{open:s,onOpenChange:y,children:T}),o[15]=s,o[16]=y,o[17]=T,o[18]=E):E=o[18],E};function g(){return typeof document>`u`?!1:!!document.querySelector(`[data-slot="dropdown-menu-content"][data-open], [data-slot="select-content"][data-open]`)}export{h as SettingsWindow};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{n as t}from"./runtime-fetch-zIalUnbb.js";import{Qt as n}from"./persistence-DwRBC4zl.js";import{nt as r,rt as i,tt as a}from"./vendor-base-ui-CnHfUmDN.js";import{c as o,s,t as c}from"./useUIStore-CxOoCv7B.js";import{o as l}from"./terminalApi-CfgOfnZk.js";import{n as u,r as d,t as f}from"./vendor-ghostty-web-HohRXr3g.js";import{n as ee,t as p}from"./clipboard-GUUNlWIv.js";import{c as m}from"./useMobileNavigationStore-DDgESrzu.js";import{t as h}from"./utils-2ZK8yboQ.js";import{n as g}from"./Icon-D1BcR8Tz.js";import{t as _}from"./button-9R-WgVMl.js";import{n as v}from"./useThemeSystem-DMzWVJaW.js";import{i as y,t as b}from"./OverlayScrollbar-Bahg_P3r.js";import{n as te}from"./useRuntimeAPIs-DSLXJybW.js";import{n as x}from"./useEffectiveDirectory-C5Gg7EvP.js";import{t as S}from"./sortable-tabs-strip-dYW6SH62.js";import{n as C,t as w}from"./useFontPreferences-DCaY8NbU.js";import{r as T}from"./projectActions-CWvNGKfA.js";var E=e(i(),1);function ne(e){let{colors:t}=e,n=t.syntax.base;return{background:t.surface.background,foreground:n.foreground,cursor:t.interactive.cursor,cursorAccent:t.surface.background,selectionBackground:t.interactive.selection,selectionForeground:t.interactive.selectionForeground,selectionInactiveBackground:t.interactive.selection+`50`,black:t.surface.muted,red:t.status.error,green:t.status.success,yellow:t.status.warning,blue:n.function,magenta:n.keyword,cyan:n.type,white:n.foreground,brightBlack:n.comment,brightRed:t.status.error,brightGreen:t.status.success,brightYellow:t.status.warning,brightBlue:n.function,brightMagenta:n.keyword,brightCyan:n.type,brightWhite:t.surface.elevatedForeground}}function re(e,t,n,r,i=!1){return{cursorBlink:!1,cursorStyle:`bar`,fontSize:t,lineHeight:1.15,fontFamily:`${e}, "JetBrainsMonoNL Nerd Font", "FiraCode Nerd Font", "Cascadia Code PL", "Fira Code", "JetBrains Mono", "SFMono-Regular", Menlo, Consolas, "Liberation Mono", "Courier New", monospace`,allowTransparency:!1,theme:{background:n.background,foreground:n.foreground,cursor:n.cursor,cursorAccent:n.cursorAccent,selectionBackground:n.selectionBackground,selectionForeground:n.selectionForeground,black:n.black,red:n.red,green:n.green,yellow:n.yellow,blue:n.blue,magenta:n.magenta,cyan:n.cyan,white:n.white,brightBlack:n.brightBlack,brightRed:n.brightRed,brightGreen:n.brightGreen,brightYellow:n.brightYellow,brightBlue:n.brightBlue,brightMagenta:n.brightMagenta,brightCyan:n.brightCyan,brightWhite:n.brightWhite},scrollback:1e4,ghostty:r,disableStdin:i}}var ie=e(a(),1),D=r(),O=null;function k(){return O||=d.load(),O}function ae(e){if(typeof window>`u`)return null;let t=[e,...Array.from(e.querySelectorAll(`*`))],n=null;for(let e of t){let t=window.getComputedStyle(e).overflowY;if(t===`auto`||t===`scroll`){if(e.scrollHeight-e.clientHeight>2)return e;n||=e}}return n}var oe=E.forwardRef(({sessionKey:e,chunks:t,onInput:n,onResize:r,theme:i,fontFamily:a,fontSize:o,className:s,enableTouchScroll:c,autoFocus:l=!0,isVisible:d=!0},m)=>{let{t:g}=ee(),_=E.useRef(null),v=E.useRef(null),y=E.useRef(null),te=E.useRef(null),x=E.useRef(n),S=E.useRef(r),C=E.useRef(null),w=E.useRef(``),T=E.useRef(null),ne=E.useRef(!1),O=E.useRef(null),oe=E.useRef(!0),A=E.useRef(null),j=E.useRef(null),se=E.useRef(0),ce=E.useRef(null),M=E.useRef(null),N=E.useRef(!1),P=E.useRef(!1),le=E.useRef(null),ue=E.useRef(null),de=E.useRef(null),F=E.useRef(``),fe=E.useRef(null),pe=E.useRef(!c),me=E.useRef(d),[,he]=E.useReducer(e=>e+1,0),[ge,_e]=E.useReducer(e=>e+1,0);x.current=n,S.current=r;let ve=typeof navigator<`u`&&(/Android/i.test(navigator.userAgent)||navigator.userAgentData?.platform===`Android`),I=!!c;E.useEffect(()=>{if(!c){pe.current=!0,me.current=d;return}!me.current&&d&&(pe.current=!1),me.current=d},[c,d]);let ye=E.useCallback(()=>{if(!I)return;let e=_.current,t=ce.current;if(!e)return;let n=[];e.getAttribute(`contenteditable`)===`true`&&n.push(e),n.push(...Array.from(e.querySelectorAll(`[contenteditable="true"]`))),n.forEach(e=>{e.setAttribute(`data-terminal-disabled-contenteditable`,`true`),e.setAttribute(`contenteditable`,`false`),e.setAttribute(`aria-hidden`,`true`),e.tabIndex=-1,e.style.setProperty(`caret-color`,`transparent`),e.style.color=`transparent`,e.style.setProperty(`-webkit-text-fill-color`,`transparent`),e.style.background=`transparent`,e.style.outline=`none`,e.style.boxShadow=`none`,e.style.textShadow=`none`,e.style.setProperty(`user-select`,`none`),e.style.setProperty(`-webkit-user-select`,`none`)}),e.tabIndex=-1,e.removeAttribute(`role`),e.removeAttribute(`aria-multiline`),Array.from(e.querySelectorAll(`textarea`)).forEach(e=>{e.style.setProperty(`caret-color`,`transparent`),e.style.color=`transparent`,e.style.setProperty(`-webkit-text-fill-color`,`transparent`),e.style.background=`transparent`,e.style.border=`0`,e.style.outline=`none`,e.style.boxShadow=`none`,e.style.textShadow=`none`,e.style.fontSize=`0`,e.style.lineHeight=`0`,e!==t&&e.getAttribute(`data-terminal-disabled-input`)!==`true`&&(e.setAttribute(`data-terminal-disabled-input`,`true`),e.setAttribute(`aria-hidden`,`true`),e.tabIndex=-1,e.disabled=!0,e.style.position=`absolute`,e.style.opacity=`0`,e.style.width=`0px`,e.style.height=`0px`,e.style.pointerEvents=`none`,e.style.zIndex=`-1`)})},[I]),L=E.useCallback(e=>{if(fe.current===e)return;let t=y.current;if(t)try{if(typeof t.setOption==`function`){t.setOption(`cursorBlink`,e),fe.current=e;return}t.options&&(t.options.cursorBlink=e,fe.current=e)}catch{}},[]),R=I&&ve,z=E.useCallback((e,t)=>{let n=R?M.current:ce.current,r=_.current;if(!n||!r)return;let i=r.getBoundingClientRect(),a=typeof window<`u`?window.innerWidth:i.width,o=typeof window<`u`?window.innerHeight:i.height,s=i.left+i.width/2,c=i.top+i.height-12,l=typeof e==`number`?e:s,u=typeof t==`number`?t:c,d=Math.max(8,Math.min(a-8,l)),f=Math.max(8,Math.min(o-8,u));n.style.left=`${d}px`,n.style.top=`${f}px`,n.style.bottom=``,(n instanceof HTMLTextAreaElement||n instanceof HTMLInputElement)&&(n.disabled=!1,n.readOnly=!1,n.removeAttribute(`disabled`),n.removeAttribute(`readonly`));try{n.focus({preventScroll:!0})}catch{try{n.focus()}catch{}}},[R]),B=E.useCallback(()=>{if(I){z(),L(!0);return}y.current?.focus(),L(!0)},[z,L,I]),V=E.useCallback(e=>e instanceof HTMLTextAreaElement||e instanceof HTMLInputElement?e.value:e.textContent??``,[]),H=E.useCallback(e=>{if(e instanceof HTMLTextAreaElement||e instanceof HTMLInputElement){e.value=``;return}e.textContent=``},[]),be=E.useCallback(e=>{if(typeof window>`u`||R)return;de.current!==null&&(window.clearTimeout(de.current),de.current=null);let t=0,n=()=>{de.current=window.setTimeout(()=>{de.current=null;let r=V(e);if(!r){if(t+=1,t<3){n();return}return}let i=F.current;F.current=r;let a=r.startsWith(i)?r.slice(i.length):r;a&&x.current(a.replace(/\r\n|\r|\n/g,`\r`)),H(e),F.current=``},t===0?0:24)};n()},[H,V,R]);E.useEffect(()=>{let e=_.current;if(!I||!e||c)return;let t=t=>{let n=t.target;if(n&&n.getAttribute(`data-terminal-hidden-input`)!==`true`&&e.contains(n)){try{n.blur()}catch{}z()}};return e.addEventListener(`focusin`,t,!0),()=>{e.removeEventListener(`focusin`,t,!0)}},[c,I,z]);let U=E.useCallback(()=>{let e=y.current;if(!e||typeof e.getSelection!=`function`)return``;let t=e.getSelection();return typeof t==`string`?t:``},[]),xe=E.useCallback(()=>{if(typeof window>`u`)return``;let e=window.getSelection();if(!e)return``;let t=e.toString();if(!t.trim())return``;let n=_.current;if(!n)return``;let r=e.anchorNode,i=e.focusNode;return r&&!n.contains(r)||i&&!n.contains(i)?``:t},[]),Se=E.useCallback(async()=>{if(typeof document>`u`)return;let e=U()||xe();e.trim()&&await p(e)},[xe,U]),Ce=E.useCallback(()=>U().trim()?!0:!!xe().trim(),[xe,U]);E.useEffect(()=>{if(typeof window>`u`)return;let e=e=>{Ce()&&(e.preventDefault(),Se())};return window.addEventListener(`openchamber:copy`,e),()=>{window.removeEventListener(`openchamber:copy`,e)}},[Se,Ce]);let W=E.useCallback(()=>{w.current=``,T.current!==null&&typeof window<`u`&&window.cancelAnimationFrame(T.current),T.current=null,ne.current=!1,O.current=null},[]),G=E.useCallback(()=>{let e=te.current,t=y.current,n=_.current;if(!e||!t||!n)return;let r=n.getBoundingClientRect();if(!(r.width<24||r.height<24))try{e.fit();let n={cols:t.cols,rows:t.rows},r=C.current;(!r||r.cols!==n.cols||r.rows!==n.rows)&&(C.current=n,S.current(n.cols,n.rows))}catch{}},[]),K=E.useCallback(()=>{if(ne.current)return;let e=y.current;if(!e){W();return}if(!w.current)return;let t=w.current;w.current=``,ne.current=!0,e.write(t,()=>{ne.current=!1,w.current&&(typeof window<`u`?T.current=window.requestAnimationFrame(()=>{T.current=null,K()}):K())})},[W]),we=E.useCallback(()=>{T.current===null&&(typeof window<`u`?T.current=window.requestAnimationFrame(()=>{T.current=null,K()}):K())},[K]),q=E.useCallback(e=>{e&&(w.current+=e,we())},[we]),Te=E.useCallback(()=>{if(A.current?.(),A.current=null,j.current!==null&&typeof window<`u`&&(window.clearTimeout(j.current),j.current=null),!c){se.current=0;return}let e=_.current;if(!e)return;let t=y.current;if(!t)return;se.current=0;let n=2.2,r=2.8,i=.25,a=.05,s=.015,l={lastY:null,lastTime:null,velocity:0,rafId:null,startX:null,startY:null,didMove:!1},u=()=>typeof performance<`u`?performance.now():Date.now(),d=Math.max(12,Math.round(o*1.35)),f=0,ee=e=>{if(!e)return!1;let n=t.getViewportY(),r=f+e,i=Math.trunc(r/d);return f=r-i*d,i!==0&&t.scrollLines(i),t.getViewportY()!==n},p=()=>{l.rafId!==null&&typeof window<`u`&&window.cancelAnimationFrame(l.rafId),l.rafId=null},m={passive:!1,capture:!1};if(typeof window<`u`&&`PointerEvent`in window){let t=Object.assign(l,{pointerId:null,startX:null,startY:null,moved:!1}),o=n=>{if(n.pointerType===`touch`){p(),t.pointerId=n.pointerId,t.startX=n.clientX,t.startY=n.clientY,t.moved=!1,t.lastY=n.clientY,t.lastTime=u(),t.velocity=0;try{e.setPointerCapture(n.pointerId)}catch{}}},d=e=>{if(e.pointerType!==`touch`||t.pointerId!==e.pointerId)return;if(t.startX!==null&&t.startY!==null&&!t.moved){let n=e.clientX-t.startX,r=e.clientY-t.startY;Math.hypot(n,r)>=6&&(t.moved=!0)}if(t.lastY===null){t.lastY=e.clientY,t.lastTime=u();return}let a=t.lastY,o=t.lastTime??u(),s=u();t.lastY=e.clientY,t.lastTime=s;let c=a-e.clientY;if(Math.abs(c)<1)return;let l=Math.max(s-o,8),d=c*(n+Math.min(r,Math.abs(c)/25)),f=d/l;t.velocity=t.velocity*.75+f*i,t.velocity>8?t.velocity=8:t.velocity<-8&&(t.velocity=-8),t.moved&&(e.cancelable&&e.preventDefault(),e.stopPropagation()),ee(d)},f=n=>{if(n.pointerType!==`touch`||t.pointerId!==n.pointerId)return;let r=!t.moved;t.pointerId=null,t.startX=null,t.startY=null,t.moved=!1,t.lastY=null,t.lastTime=null;try{e.releasePointerCapture(n.pointerId)}catch{}if(r){I?z(n.clientX,n.clientY):c&&!pe.current&&(pe.current=!0,y.current?.focus());return}if(typeof window>`u`)return;if(Math.abs(t.velocity)<a){t.velocity=0;return}let i=u(),o=()=>{let e=u(),n=Math.max(e-i,8);i=e;let r=ee(t.velocity*n)??!1,c=Math.sign(t.velocity),l=Math.max(0,Math.abs(t.velocity)-s*n);if(t.velocity=l*c,!r||l<=a){p(),t.velocity=0;return}t.rafId=window.requestAnimationFrame(o)};t.rafId=window.requestAnimationFrame(o)};e.addEventListener(`pointerdown`,o,m),e.addEventListener(`pointermove`,d,m),e.addEventListener(`pointerup`,f,m),e.addEventListener(`pointercancel`,f,m);let h=e.style.touchAction,g=e.style.overscrollBehaviorY;e.style.touchAction=`none`,e.style.overscrollBehaviorY=`contain`,A.current=()=>{p(),j.current!==null&&typeof window<`u`&&(window.clearTimeout(j.current),j.current=null),se.current=0,e.removeEventListener(`pointerdown`,o,m),e.removeEventListener(`pointermove`,d,m),e.removeEventListener(`pointerup`,f,m),e.removeEventListener(`pointercancel`,f,m),e.style.touchAction=h,e.style.overscrollBehaviorY=g};return}let h=e=>{e.touches.length===1&&(p(),l.lastY=e.touches[0].clientY,l.lastTime=u(),l.velocity=0,l.startX=e.touches[0].clientX,l.startY=e.touches[0].clientY,l.didMove=!1)},g=e=>{if(e.touches.length!==1){l.lastY=null,l.lastTime=null,l.velocity=0,l.startX=null,l.startY=null,l.didMove=!1,p();return}let t=e.touches[0].clientX,a=e.touches[0].clientY;if(l.startX!==null&&l.startY!==null&&!l.didMove){let e=t-l.startX,n=a-l.startY;Math.hypot(e,n)>=6&&(l.didMove=!0)}if(l.lastY===null){l.lastY=a,l.lastTime=u();return}let o=l.lastY,s=l.lastTime??u(),c=u();l.lastY=a,l.lastTime=c;let d=o-a;if(Math.abs(d)<1)return;let f=Math.max(c-s,8),m=d*(n+Math.min(r,Math.abs(d)/25)),h=m/f;l.velocity=l.velocity*.75+h*i,l.velocity>8?l.velocity=8:l.velocity<-8&&(l.velocity=-8),l.didMove&&(e.preventDefault(),e.stopPropagation()),ee(m)},v=e=>{let t=!l.didMove;l.lastY=null,l.lastTime=null;let n=l.velocity;if(l.startX=null,l.startY=null,l.didMove=!1,t){let t=e.changedTouches?.[0];I?z(t?.clientX,t?.clientY):c&&!pe.current&&(pe.current=!0,y.current?.focus());return}if(typeof window>`u`)return;if(Math.abs(n)<a){l.velocity=0;return}let r=u(),i=()=>{let e=u(),t=Math.max(e-r,8);r=e;let n=ee(l.velocity*t)??!1,o=Math.sign(l.velocity),c=Math.max(0,Math.abs(l.velocity)-s*t);if(l.velocity=c*o,!n||c<=a){p(),l.velocity=0;return}l.rafId=window.requestAnimationFrame(i)};l.rafId=window.requestAnimationFrame(i)};e.addEventListener(`touchstart`,h,m),e.addEventListener(`touchmove`,g,m),e.addEventListener(`touchend`,v,m),e.addEventListener(`touchcancel`,v,m);let b=e.style.touchAction,te=e.style.overscrollBehaviorY;e.style.touchAction=`none`,e.style.overscrollBehaviorY=`contain`,A.current=()=>{p(),j.current!==null&&typeof window<`u`&&(window.clearTimeout(j.current),j.current=null),se.current=0,e.removeEventListener(`touchstart`,h,m),e.removeEventListener(`touchmove`,g,m),e.removeEventListener(`touchend`,v,m),e.removeEventListener(`touchcancel`,v,m),e.style.touchAction=b,e.style.overscrollBehaviorY=te}},[c,I,z,o]);E.useEffect(()=>{let e=!1,t=null,n=null,r=null,s=[],l=null,d=null,ee=null,p=_.current;if(!p)return;if(p.tabIndex=I?-1:0,I){let e=p.focus.bind(p),t=p;t.focus=((...e)=>{z()}),ee=()=>{t.focus=e}}let m=()=>{L(!0)},h=()=>{L(!1)},g=e=>{let t=e.target;if(t&&p.contains(t)){if(I&&t instanceof HTMLElement){window.setTimeout(()=>{t.blur(),z()},0),L(!1);return}if(c&&!pe.current&&t instanceof HTMLElement){window.setTimeout(()=>{t.blur()},0),L(!1);return}L(!0);return}L(!1)},b=()=>{L(!1)},S=null;return(async()=>{try{let ee=await k();if(e)return;let g=re(a,o,i,ee,!1),_=new u(g);oe.current=!0,I&&(_.focus=()=>{});let b=_;if(typeof b.scrollToBottom==`function`){let e=b.scrollToBottom.bind(b);b.scrollToBottom=()=>{oe.current&&e()},l=()=>{b.scrollToBottom=e}}let C=new f;if(t=_,y.current=_,te.current=C,_.loadAddon(C),_.open(p),c){let e=_.renderer;if(e&&typeof e.renderScrollbar==`function`){let t=e.renderScrollbar.bind(e);e.renderScrollbar=()=>{},d=()=>{e.renderScrollbar=t}}}_e(),fe.current=!1,S=_.textarea??p.querySelector(`textarea`),S&&(S.addEventListener(`focus`,m),S.addEventListener(`blur`,h)),ye(),typeof MutationObserver<`u`&&(r=new MutationObserver(()=>{ye()}),r.observe(p,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`contenteditable`,`role`,`tabindex`,`aria-label`]}));let w=ae(p);w?(w.classList.add(`overlay-scrollbar-target`,`overlay-scrollbar-container`),v.current=w,he()):v.current=null,G();let T=C;typeof T.observeResize==`function`&&T.observeResize(),Te(),s=[_.onData(e=>{x.current(e)}),_.onScroll(e=>{if(typeof e==`number`&&Number.isFinite(e)){let t=typeof _.hasSelection==`function`&&_.hasSelection();oe.current=!t&&e<=.5}}),_.onSelectionChange(()=>{if(typeof _.hasSelection==`function`&&_.hasSelection()){oe.current=!1;return}let e=typeof _.getViewportY==`function`?_.getViewportY():0;oe.current=e<=.5})],n=new ResizeObserver(()=>{G()}),n.observe(p),typeof window<`u`&&window.setTimeout(()=>{G()},0)}catch{}})(),document.addEventListener(`focusin`,g,!0),window.addEventListener(`blur`,b),()=>{e=!0,A.current?.(),A.current=null,document.removeEventListener(`focusin`,g,!0),window.removeEventListener(`blur`,b),s.forEach(e=>e.dispose()),l?.(),l=null,d?.(),d=null,S&&(S.removeEventListener(`focus`,m),S.removeEventListener(`blur`,h)),n?.disconnect(),r?.disconnect(),ee?.(),t?.dispose(),y.current=null,te.current=null,v.current=null,C.current=null,fe.current=null,W()}},[ye,c,G,z,a,o,Te,i,W,L,I]),E.useEffect(()=>{let e=y.current;e&&(e.reset(),W(),C.current=null,G())},[e,ge,G,W]),E.useEffect(()=>{l&&y.current&&B()},[l,B,e,ge]),E.useEffect(()=>(Te(),()=>{A.current?.(),A.current=null}),[Te,e]),E.useEffect(()=>{let e=y.current;if(!e)return;if(t.length===0){O.current!==null&&(e.reset(),W(),G());return}let n=O.current,r;if(n===null)r=t;else{let e=t.findIndex(e=>e.id===n);r=e>=0?t.slice(e+1):t}r.length>0&&q(r.map(e=>e.data).join(``)),O.current=t[t.length-1].id},[t,ge,q,G,W]),E.useImperativeHandle(m,()=>({focus:()=>{B()},clear:()=>{let e=y.current;e&&(e.reset(),W(),G())},fit:()=>{G()}}),[B,G,W]);let J=E.useCallback(e=>{if(!I)return;let t=_.current,n=e.relatedTarget,r=n?.tagName;r===`INPUT`||r===`TEXTAREA`||n?.isContentEditable,n?.getAttribute(`data-terminal-hidden-input`),n&&t?.contains(n)},[I]),Y=E.useCallback(e=>{let t=e.nativeEvent,n=t?.inputType??``,r=typeof t?.data==`string`?t.data:``;if(ue.current=typeof performance<`u`?performance.now():Date.now(),n===`insertCompositionText`){N.current=!0;return}if(!n&&r){if(N.current)return;e.preventDefault(),x.current(r),le.current={type:`insertText`,at:typeof performance<`u`?performance.now():Date.now()},P.current=!0;return}if(n===`insertText`&&r){if(N.current)return;e.preventDefault(),x.current(r),le.current={type:n,at:typeof performance<`u`?performance.now():Date.now()},P.current=!0;return}if(n===`insertLineBreak`){if(N.current)return;e.preventDefault(),x.current(`\r`),le.current={type:n,at:typeof performance<`u`?performance.now():Date.now()},P.current=!0;return}if(n===`deleteContentBackward`){if(N.current)return;e.preventDefault(),x.current(``),le.current={type:n,at:typeof performance<`u`?performance.now():Date.now()},P.current=!0}},[]),X=E.useCallback(e=>{let t=e.currentTarget;if(ue.current=typeof performance<`u`?performance.now():Date.now(),N.current)return;if(P.current){let e=le.current,n=typeof performance<`u`?performance.now():Date.now();if(e&&n-e.at<50){P.current=!1,H(t);return}P.current=!1}let n=V(t);if(!n)return;F.current=n;let r=n.replace(/\r\n|\r|\n/g,`\r`);x.current(r),H(t),F.current=``},[H,V]),Ee=E.useCallback(e=>{e.stopPropagation();let t=e.key.toLowerCase(),n=e.metaKey&&!e.ctrlKey&&!e.altKey&&t===`c`,r=e.ctrlKey&&e.shiftKey&&!e.metaKey&&!e.altKey&&t===`c`;if((n||r)&&Ce()){e.preventDefault(),Se();return}if(e.ctrlKey&&!e.metaKey&&!e.altKey&&e.key.length===1){let t=e.key.toUpperCase();if(t>=`A`&&t<=`Z`){e.preventDefault(),e.nativeEvent?.stopImmediatePropagation(),x.current(String.fromCharCode(t.charCodeAt(0)-64)),H(e.currentTarget);return}}if(e.altKey&&!e.ctrlKey&&!e.metaKey&&e.key.length===1){e.preventDefault(),e.nativeEvent?.stopImmediatePropagation(),x.current(`\x1B`+e.key),H(e.currentTarget);return}let i={ArrowUp:`\x1B[A`,ArrowDown:`\x1B[B`,ArrowRight:`\x1B[C`,ArrowLeft:`\x1B[D`,Escape:`\x1B`,Tab:` `,Delete:`\x1B[3~`,Home:`\x1B[H`,End:`\x1B[F`}[e.key];if(i){e.preventDefault(),x.current(i),H(e.currentTarget);return}let a=e.currentTarget;if(e.nativeEvent?.isComposing)return;let o=le.current,s=typeof performance<`u`?performance.now():Date.now(),c=!!(o&&s-o.at<50);if(e.key===`Enter`){if(c&&o?.type===`insertLineBreak`)return;e.preventDefault(),x.current(`\r`),H(a);return}if(e.key===`Backspace`){if(e.preventDefault(),c&&o?.type===`deleteContentBackward`)return;V(a)||x.current(``)}if(e.key.length===1&&!e.ctrlKey&&!e.metaKey&&!e.altKey){let t=ue.current;t&&s-t<50||(e.preventDefault(),x.current(e.key),P.current=!0,le.current={type:`keydown-text`,at:s})}be(a)},[H,Se,Ce,V,be]),De=E.useCallback(e=>{e.stopPropagation();let t=e.currentTarget;e.nativeEvent?.isComposing||be(t)},[be]),Oe=E.useCallback(e=>{let t=e.currentTarget;N.current=!1;let n=e.data||V(t);if(ue.current=typeof performance<`u`?performance.now():Date.now(),!n)return;let r=n.replace(/\r\n|\r|\n/g,`\r`);x.current(r),H(t),le.current={type:`compositionend`,at:typeof performance<`u`?performance.now():Date.now()},P.current=!0},[H,V]),ke=E.useCallback(e=>{e.stopPropagation();let t=e.clipboardData?.getData(`text`)??``;if(!t)return;e.preventDefault();let n=y.current?.hasBracketedPaste?.()?`\x1b[200~${t}\x1b[201~`:t;x.current(n)},[]),Ae={position:`fixed`,left:0,top:0,width:1,height:1,opacity:0,zIndex:-1,background:`transparent`,color:`transparent`,WebkitTextFillColor:`transparent`,caretColor:`transparent`,textShadow:`none`,WebkitAppearance:`none`,appearance:`none`,resize:`none`,overflow:`hidden`,whiteSpace:`nowrap`,border:`0`,padding:0,margin:0,outline:`none`,outlineOffset:0,fontSize:16,fontWeight:400,pointerEvents:`none`,WebkitUserSelect:`none`,userSelect:`none`};return(0,D.jsxs)(`div`,{ref:_,className:h(`relative h-full w-full terminal-viewport-container`,s),"data-hidden-input-overlay-active":I?`true`:void 0,style:{backgroundColor:i.background},onTouchStart:e=>{if(!(!I||c)&&!Ce()){let t=e.touches?.[0];z(t?.clientX,t?.clientY)}},onClick:e=>{if(!c)if(I){if(Ce())return;z(e.clientX,e.clientY)}else y.current?.focus()},onMouseUp:()=>{!c&&Ce()&&Se()},onTouchEnd:()=>{!c&&Ce()&&Se()},children:[I&&typeof document<`u`?(0,ie.createPortal)((0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`input`,{ref:M,type:`text`,inputMode:`text`,autoCapitalize:`off`,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,tabIndex:-1,enterKeyHint:`send`,"data-terminal-hidden-input":`true`,"aria-label":g(`terminalView.viewport.inputAria`),"aria-hidden":`true`,style:{...Ae,display:R?`block`:`none`},onBlur:J,onBeforeInput:Y,onCompositionStart:()=>{N.current=!0},onInput:X,onKeyDown:Ee,onKeyUp:De,onCompositionEnd:Oe,onPaste:ke}),(0,D.jsx)(`textarea`,{ref:ce,inputMode:`text`,autoCapitalize:`off`,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,tabIndex:-1,enterKeyHint:`send`,"data-terminal-hidden-input":`true`,"aria-label":g(`terminalView.viewport.inputAria`),"aria-hidden":`true`,style:{...Ae,display:R?`none`:`block`},onBlur:J,onBeforeInput:Y,onCompositionStart:()=>{N.current=!0},onInput:X,onKeyDown:Ee,onKeyUp:De,onCompositionEnd:Oe,onPaste:ke})]}),document.body):null,v.current&&!c?(0,D.jsx)(b,{containerRef:v,disableHorizontal:!0,className:`overlay-scrollbar--flush overlay-scrollbar--dense overlay-scrollbar--zero`}):null]})});oe.displayName=`TerminalViewport`;var A=RegExp(`\x1B\\[[0-9;?]*[ -/]*[@-~]`,`g`),j=/(https?:\/\/(?:localhost|127\.0\.0\.1|0\.0\.0\.0|\[(?:::1|::)\])(?::\d{2,5})?(?:\/[^\s<>'"`]*)?)/gi,se=/(?:➜\s*(?:Local|Network):)|\b(?:local|network|loopback|serving|listening|available|ready|started|running|server|vite|webpack|next\.js|astro|sveltekit|nuxt)\b/i,ce=/Serving HTTP on .*? port (\d{2,5})/i,M=new Set([`.`,`,`,`;`,`:`,`!`,`?`]),N=e=>{let t=e;for(;t.length>0;){let e=t[t.length-1];if(e===`)`||e===`]`||e===`}`||e===`>`){let n=e===`)`?`(`:e===`]`?`[`:e===`}`?`{`:`<`,r=t.slice(0,-1);if((r.match(RegExp(`\\${n}`,`g`))||[]).length>(r.match(RegExp(`\\${e}`,`g`))||[]).length)break;t=r;continue}if(M.has(e)){t=t.slice(0,-1);continue}break}return t},P=e=>{let t=N(e);return t=t.replace(`0.0.0.0`,`127.0.0.1`),t=t.replace(`[::1]`,`127.0.0.1`),t=t.replace(`[::]`,`127.0.0.1`),t},le=e=>{if(!e)return null;let t=e.replace(A,``),n=t.match(ce);if(n?.[1]){let e=Number.parseInt(n[1],10);if(Number.isFinite(e)&&e>0&&e<=65535)return`http://127.0.0.1:${e}/`}let r=t.split(`
|
|
2
|
-
`);for(let e of r){if(!se.test(e))continue;let t=Array.from(e.matchAll(j));if(t.length!==0)return P((t.find(e=>{try{return!!new URL(P(e[1])).port}catch{return!1}})??t[0])[1])}return null},ue=async(e,n=1500)=>{if(!e||typeof window>`u`)return!1;let r;try{r=new URL(e)}catch{return!1}if(r.protocol!==`http:`&&r.protocol!==`https:`)return!1;let i=r.hostname.toLowerCase();if(i!==`localhost`&&i!==`127.0.0.1`&&i!==`0.0.0.0`&&i!==`::1`&&i!==`::`)return!1;let a=new AbortController,o=window.setTimeout(()=>a.abort(),n);try{let e=await t(`/api/system/probe-url`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({url:r.toString()}),cache:`no-store`,signal:a.signal});return e.ok?(await e.json().catch(()=>null))?.ok===!0:!1}catch{return!1}finally{window.clearTimeout(o)}},de={esc:`\x1B`,tab:` `,enter:`\r`,"arrow-up":`\x1B[A`,"arrow-down":`\x1B[B`,"arrow-left":`\x1B[D`,"arrow-right":`\x1B[C`},F={ctrl:`5`,cmd:`3`},fe={retry:{maxRetries:3,initialDelayMs:500,maxDelayMs:8e3},connectionTimeoutMs:1e4},pe={retry:{maxRetries:8,initialDelayMs:400,maxDelayMs:8e3},connectionTimeoutMs:15e3},me=(e,t)=>{if(t)switch(e){case`arrow-up`:return`\u001b[1;${F[t]}A`;case`arrow-down`:return`\u001b[1;${F[t]}B`;case`arrow-right`:return`\u001b[1;${F[t]}C`;case`arrow-left`:return`\u001b[1;${F[t]}D`}return de[e]??null},he=()=>{let{t:e}=ee(),{terminal:t,runtime:r}=te(),{currentTheme:i}=v(),{monoFont:a}=w(),u=c(e=>e.terminalFontSize),d=c(e=>e.bottomTerminalHeight),f=c(e=>e.isBottomTerminalExpanded),{isMobile:p,isTablet:b,hasTouchOnlyPointer:re}=y(),ie=p||b,O=(ie||re)&&r.platform===`web`,k=r.platform!==`vscode`,ae=c(e=>e.showTerminalQuickKeysOnDesktop),A=!n()&&(ie||ae),j=m(e=>e.currentSessionId),se=m(e=>e.newSessionDraft),ce=j!==null||se?.open===!0,M=x()??null,N=C(e=>e.sessions),P=C(e=>e.hasHydrated),de=C(e=>e.ensureDirectory),F=C(e=>e.createTab),he=C(e=>e.setActiveTab),ge=C(e=>e.closeTab),_e=C(e=>e.setTabSessionId),ve=C(e=>e.setTabLifecycle),I=C(e=>e.setConnecting),ye=C(e=>e.appendToBuffer),L=C(e=>e.setTabPreviewUrl),R=C(e=>e.clearBuffer),z=c(e=>e.openContextPreview),B=E.useMemo(()=>{if(M)return N.get(M)},[N,M]),V=E.useMemo(()=>B?k?B.activeTabId??B.tabs[0]?.id??null:B.tabs[0]?.id??null:null,[B,k]),H=E.useMemo(()=>{if(B)return V?B.tabs.find(e=>e.id===V)??B.tabs[0]:B.tabs[0]},[B,V]),be=E.useMemo(()=>(B?.tabs??[]).map(t=>({icon:(()=>{let e=t.iconKey?T[t.iconKey]??`terminal`:`terminal`;return(0,D.jsx)(g,{name:e,className:`h-4 w-4`})})(),id:t.id,label:t.label,title:t.label,closeLabel:e(`terminalView.tabs.closeTabTitle`)})),[B?.tabs,e]),U=H?.terminalSessionId??null,xe=H?.lifecycle??`idle`,Se=H?.bufferChunks??[],Ce=H?.isConnecting??!1,W=H?.previewUrl??null,[G,K]=E.useState(null),[we,q]=E.useState(!1),[Te,J]=E.useState(!1),[Y,X]=E.useState(null),[Ee,De]=E.useState(!1),[Oe,ke]=E.useState(0),Ae=E.useRef(null),je=E.useRef(null),Me=E.useRef(V),Ne=E.useRef(U),Pe=E.useRef(M),Fe=E.useRef(null),Ie=E.useRef(null),Le=E.useRef(!1),Re=E.useRef(!1),ze=E.useRef(null),Be=E.useRef(null),Ve=E.useRef(new Set),He=E.useRef(!1),Ue=E.useRef(``),We=E.useRef(new Set),Ge=E.useRef(0),Ke=E.useCallback(()=>{Ue.current=``,We.current.clear(),Ge.current+=1},[]),qe=E.useCallback(()=>{O||typeof document<`u`&&!document.hasFocus()||Fe.current?.focus()},[O]),Je=E.useCallback(()=>{O||Fe.current?.focus()},[O]);E.useEffect(()=>{if(!P||He.current)return;He.current=!0;let e=new Set;for(let[,t]of C.getState().sessions.entries())for(let n of t.tabs)n.terminalSessionId&&e.add(n.terminalSessionId);Ve.current=e},[P]);let Ye=c(e=>e.activeMainTab),Xe=c(e=>e.isBottomTerminalOpen),Ze=c(e=>e.setBottomTerminalOpen),Qe=c(e=>e.setBottomTerminalExpanded),$e=Ye===`terminal`,Z=$e||Xe,[et,tt]=E.useState(Z);E.useEffect(()=>{!Z||r.platform===`vscode`||l()},[Z,r.platform]),E.useEffect(()=>{Z&&tt(!0)},[Z]),E.useEffect(()=>{Re.current=Z},[Z]),E.useEffect(()=>{Ne.current=U},[U]),E.useEffect(()=>{Me.current=V,Ke()},[V,Ke]),E.useEffect(()=>{Pe.current=M},[M]),E.useEffect(()=>{!A&&Y!==null&&X(null)},[A,Y,X]),E.useEffect(()=>{!U&&Y!==null&&X(null)},[U,Y,X]);let Q=E.useCallback(()=>{Ae.current?.(),Ae.current=null,je.current=null,ze.current=null,J(!1)},[]);E.useEffect(()=>()=>{Q(),Ne.current=null},[Q]);let nt=E.useCallback((e,t,n)=>{if(!n)return;let r=`${Ue.current}${n}`.replace(/\r\n|\r/g,`
|
|
3
|
-
`),i=r.split(`
|
|
4
|
-
`),a=r.endsWith(`
|
|
5
|
-
`)?i.join(`
|
|
6
|
-
`):i.slice(0,-1).join(`
|
|
7
|
-
`);if(Ue.current=r.endsWith(`
|
|
8
|
-
`)?``:(i[i.length-1]??``).slice(-1024),!a)return;let o=le(a);if(!o||We.current.has(o))return;let s=Ge.current;We.current.add(o),ue(o).then(n=>{if(We.current.delete(o),!n||Ge.current!==s)return;let r=C.getState().getDirectoryState(e)?.tabs.find(e=>e.id===t);!r||r.previewUrlLocked||r.previewUrl===o||L(e,t,o,{locked:!1,autoOpened:!1})})},[L]),rt=E.useCallback((n,r,i,a=fe,o=!1)=>{if(je.current===i)return;Q(),je.current=i;let s=t.connect(i,{onEvent:a=>{if(je.current===i)switch(a.type){case`connected`:ze.current=i,I(n,r,!1),K(null),q(!1),J(!1),qe(),Be.current===i&&(Be.current=null,t.sendInput(i,`\r`).catch(()=>{}));break;case`reconnecting`:K(null),q(!1),J(!0);break;case`data`:a.data&&(ye(n,r,a.data),nt(n,r,a.data));break;case`exit`:{let t=typeof a.exitCode==`number`?a.exitCode:null,i=typeof a.signal==`number`?a.signal:null,o=!!(C.getState().getDirectoryState(n)?.tabs.find(e=>e.id===r))?.label?.startsWith(`Action:`);ye(n,r,e(`terminalView.stream.processExitedMessage`,{exitCodeSegment:t===null?``:e(`terminalView.stream.processExitedWithCode`,{exitCode:t}),signalSegment:i===null?``:e(`terminalView.stream.processExitedWithSignal`,{signal:i})})),ve(n,r,`exited`),_e(n,r,null),I(n,r,!1),K(o?null:e(`terminalView.error.sessionEnded`)),q(!1),J(!1),Q();break}}},onError:(t,a)=>{if(je.current===i){if(!a){K(null),q(!1);return}if(/session not found/i.test(t.message)||o){J(!1),K(null),q(!1),I(n,r,!0),R(n,r),ve(n,r,`idle`),_e(n,r,null),Q();return}J(!1),K(e(`terminalView.error.connectionFailed`,{message:t.message})),q(!0),I(n,r,!1),R(n,r),ve(n,r,`exited`),_e(n,r,null),Q()}}},a);Ae.current=()=>{s.close(),je.current=null}},[ye,R,Q,qe,nt,I,ve,_e,e,t]);E.useEffect(()=>{let n=!1;if(!(!P||!et)){if(!M){K(e(ce?`terminalView.empty.noWorkingDirectory`:`terminalView.empty.selectSession`));return}return(async()=>{let r=M;if(!Pe.current||Pe.current!==r)return;de(r);let i=C.getState().getDirectoryState(r);if(!i||i.tabs.length===0)return;let a=k?i.activeTabId??i.tabs[0]?.id??null:i.tabs[0]?.id??null;if(!a)return;let o=i.tabs.find(e=>e.id===a)??i.tabs[0],s=o?.terminalSessionId??null,c=o?.lifecycle??`idle`,l=!!o?.label?.startsWith(`Action:`),u=(o?.bufferLength??0)>0||(o?.bufferChunks?.length??0)>0;if(s)return;if(c===`exited`){I(r,a,!1);return}if(l&&u){I(r,a,!1);return}let d=Ie.current;if(!(!d&&Re.current)){K(null),q(!1),J(!1),I(r,a,!0);try{let e=await t.createSession({cwd:r,cols:d?.cols,rows:d?.rows});if(!(!n&&Pe.current===r&&Me.current===a)){try{await t.close(e.sessionId)}catch{}return}if(C.getState().getDirectoryState(r)?.tabs.find(e=>e.id===a)?.terminalSessionId){try{await t.close(e.sessionId)}catch{}return}_e(r,a,e.sessionId)}catch(t){n||(K(t instanceof Error?t.message:e(`terminalView.error.startSessionFailed`)),q(!0),J(!1),I(r,a,!1))}}})(),()=>{n=!0}}},[ce,M,U,xe,V,et,Oe,k,P,de,I,_e,e,t]);let it=E.useRef(rt);it.current=rt;let at=E.useRef(Q);at.current=Q,E.useEffect(()=>{if(!P||!et)return;if(!M){at.current();return}let e=M,t=C.getState().getDirectoryState(e);if(!t||t.tabs.length===0){at.current();return}let n=k?t.activeTabId??t.tabs[0]?.id??null:t.tabs[0]?.id??null;if(!n){at.current();return}let r=t.tabs.find(e=>e.id===n)??t.tabs[0],i=r?.terminalSessionId??null;if(!i){at.current(),Ne.current=null;return}if(je.current===i&&Ae.current){Ne.current=i;return}Ne.current=i;let a=Ve.current.has(i),o=a&&(r?.bufferLength??0)===0&&(r?.bufferChunks?.length??0)===0;a&&Ve.current.delete(i),o&&(Be.current=i),it.current(e,n,i,a?pe:fe,a)},[M,U,V,k,et,P]),E.useEffect(()=>{if(!Z||O)return;if(typeof window>`u`){qe();return}let e=window.requestAnimationFrame(()=>{qe()});return()=>{window.cancelAnimationFrame(e)}},[V,qe,Z,O]);let ot=E.useCallback(async()=>{if(!M||Ee)return;let t=C.getState().getDirectoryState(M),n=k?V??t?.activeTabId??t?.tabs[0]?.id??null:t?.tabs[0]?.id??null;if(n){De(!0),K(null),q(!1),J(!1),Q(),R(M,n),Ke();try{await ge(M,n)}catch(t){K(t instanceof Error?t.message:e(`terminalView.error.restartFailed`)),q(!0),J(!1)}finally{De(!1)}}},[V,R,ge,Q,M,k,Ee,Ke,e]),st=E.useCallback(async()=>{await ot()},[ot]),ct=E.useCallback(()=>{if(!M)return;let e=F(M);he(M,e),K(null),q(!1),J(!1),Q()},[F,Q,M,he]),lt=E.useCallback(e=>{M&&(he(M,e),K(null),q(!1),J(!1),Q())},[Q,M,he]),ut=E.useCallback(e=>{M&&(e===V&&Q(),K(null),q(!1),J(!1),ge(M,e))},[V,ge,Q,M]),dt=E.useCallback(n=>{if(!n||Te)return;let r=n,i=!1;if(Y&&n.length>0){let e=n[0];if(e.length===1&&/[a-zA-Z]/.test(e)){let t=e.toUpperCase();(Y===`ctrl`||Y===`cmd`)&&(r=String.fromCharCode(t.charCodeAt(0)&31),i=!0)}i||=!0}let a=Ne.current;!a||ze.current!==a||(t.sendInput(a,r).catch(t=>{Te||K(t instanceof Error?t.message:e(`terminalView.error.sendInputFailed`))}),i&&(X(null),Je()))},[Y,Je,Te,X,e,t]),ft=E.useCallback((e,n)=>{let r=Ie.current;if((!r||r.cols!==e||r.rows!==n)&&(Ie.current={cols:e,rows:n}),Le.current||(Le.current=!0,ke(e=>e+1)),!Re.current)return;let i=Ne.current;!i||ze.current!==i||t.resize({sessionId:i,cols:e,rows:n}).catch(()=>{})},[t]),pt=E.useCallback(e=>{X(t=>t===e?null:e),Je()},[Je,X]),mt=E.useCallback(e=>{let t=me(e,Y);t&&(dt(t),X(null),Je())},[Y,Je,dt,X]);E.useEffect(()=>{if(!A||!Y||!U)return;let e=e=>{if(e.repeat)return;let t=e.key;if(!t||t===`Control`||t===`Meta`||t===`Alt`||t===`Shift`)return;let n=t.length===1?t.toLowerCase():t,r=e.code??``,i=r.startsWith(`Key`)&&r.length===4?r.slice(3).toUpperCase():null,a=t.length===1&&/[a-zA-Z]/.test(t)?t.toUpperCase():i,o={Tab:`tab`,Enter:`enter`,ArrowUp:`arrow-up`,ArrowDown:`arrow-down`,ArrowLeft:`arrow-left`,ArrowRight:`arrow-right`,Escape:`esc`,tab:`tab`,enter:`enter`,arrowup:`arrow-up`,arrowdown:`arrow-down`,arrowleft:`arrow-left`,arrowright:`arrow-right`,escape:`esc`};if(n in o){e.preventDefault(),e.stopPropagation(),mt(o[n]);return}if(Y===`ctrl`&&a&&a.length===1&&a>=`A`&&a<=`Z`){let t=String.fromCharCode(a.charCodeAt(0)&31);e.preventDefault(),e.stopPropagation(),dt(t),X(null),Je()}};return window.addEventListener(`keydown`,e),()=>{window.removeEventListener(`keydown`,e)}},[Y,mt,dt,Je,A,X,U]);let ht=E.useMemo(()=>{let e=s[o].stack;if(typeof window>`u`)return(s[a]??s[`system-mono`]).stack;let t=window.getComputedStyle(document.documentElement).getPropertyValue(`--font-family-mono`);return t&&t.trim().length>0?t.trim():(s[a]??s[`system-mono`]).stack??e},[a]),gt=E.useMemo(()=>ne(i),[i]),_t=E.useMemo(()=>`${M??`no-dir`}::${V??`no-tab`}`,[M,V]);if(E.useEffect(()=>{if(!Z||O)return;let e=Fe.current;if(!e)return;let t=()=>{e.fit()};if(typeof window<`u`){let e=window.requestAnimationFrame(()=>{t(),qe()}),n=[220,400].map(e=>window.setTimeout(t,e));return()=>{window.cancelAnimationFrame(e),n.forEach(e=>window.clearTimeout(e))}}t()},[qe,Z,O,_t,U]),E.useEffect(()=>{if(O||!Z||!Xe)return;let e=Fe.current;if(!e)return;let t=()=>{e.fit()};if(typeof window<`u`){let e=window.requestAnimationFrame(()=>{t()}),n=[0,80,180,320].map(e=>window.setTimeout(t,e));return()=>{window.cancelAnimationFrame(e),n.forEach(e=>window.clearTimeout(e))}}t()},[d,f,Xe,Z,O]),!ce)return(0,D.jsx)(`div`,{className:`flex h-full items-center justify-center p-4 text-center text-sm text-muted-foreground`,children:e(`terminalView.empty.selectSession`)});if(!M)return(0,D.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-2 p-4 text-center text-sm text-muted-foreground`,children:[(0,D.jsx)(`p`,{children:e(`terminalView.empty.noWorkingDirectoryForSession`)}),(0,D.jsx)(`button`,{onClick:ot,className:`rounded-lg bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground hover:bg-primary/90`,children:e(`terminalView.actions.retry`)})]});let $=!U||Ce||Ee||Te,vt=et,yt=!ie&&Xe&&!$e,bt=(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(_,{type:`button`,size:`sm`,variant:`outline`,className:`h-6 px-2 text-xs`,onClick:()=>mt(`esc`),disabled:$,children:e(`terminalView.quickKeys.escape`)}),(0,D.jsxs)(_,{type:`button`,size:`sm`,variant:`outline`,className:`h-6 w-9 p-0`,onClick:()=>mt(`tab`),disabled:$,children:[(0,D.jsx)(g,{name:`arrow-right`,className:`h-4 w-4`}),(0,D.jsx)(`span`,{className:`sr-only`,children:e(`terminalView.quickKeys.tabAria`)})]}),(0,D.jsxs)(_,{type:`button`,size:`sm`,variant:`chip`,"aria-pressed":Y===`ctrl`,className:`h-6 w-9 p-0`,onClick:()=>pt(`ctrl`),disabled:$,children:[(0,D.jsx)(`span`,{className:`text-xs font-medium`,children:e(`terminalView.quickKeys.controlLabel`)}),(0,D.jsx)(`span`,{className:`sr-only`,children:e(`terminalView.quickKeys.controlModifierAria`)})]}),(0,D.jsxs)(_,{type:`button`,size:`sm`,variant:`chip`,"aria-pressed":Y===`cmd`,className:`h-6 w-9 p-0`,onClick:()=>pt(`cmd`),disabled:$,children:[(0,D.jsx)(g,{name:`command`}),(0,D.jsx)(`span`,{className:`sr-only`,children:e(`terminalView.quickKeys.commandModifierAria`)})]}),(0,D.jsxs)(_,{type:`button`,size:`sm`,variant:`outline`,className:`h-6 w-9 p-0`,onClick:()=>mt(`arrow-up`),disabled:$,children:[(0,D.jsx)(g,{name:`arrow-up`}),(0,D.jsx)(`span`,{className:`sr-only`,children:e(`terminalView.quickKeys.arrowUpAria`)})]}),(0,D.jsxs)(_,{type:`button`,size:`sm`,variant:`outline`,className:`h-6 w-9 p-0`,onClick:()=>mt(`arrow-left`),disabled:$,children:[(0,D.jsx)(g,{name:`arrow-left`}),(0,D.jsx)(`span`,{className:`sr-only`,children:e(`terminalView.quickKeys.arrowLeftAria`)})]}),(0,D.jsxs)(_,{type:`button`,size:`sm`,variant:`outline`,className:`h-6 w-9 p-0`,onClick:()=>mt(`arrow-down`),disabled:$,children:[(0,D.jsx)(g,{name:`arrow-down`}),(0,D.jsx)(`span`,{className:`sr-only`,children:e(`terminalView.quickKeys.arrowDownAria`)})]}),(0,D.jsxs)(_,{type:`button`,size:`sm`,variant:`outline`,className:`h-6 w-9 p-0`,onClick:()=>mt(`arrow-right`),disabled:$,children:[(0,D.jsx)(g,{name:`arrow-right`}),(0,D.jsx)(`span`,{className:`sr-only`,children:e(`terminalView.quickKeys.arrowRightAria`)})]}),(0,D.jsxs)(_,{type:`button`,size:`sm`,variant:`outline`,className:`h-6 w-9 p-0`,onClick:()=>mt(`enter`),disabled:$,children:[(0,D.jsx)(g,{name:`arrow-go-back`}),(0,D.jsx)(`span`,{className:`sr-only`,children:e(`terminalView.quickKeys.enterAria`)})]})]});return(0,D.jsxs)(`div`,{"data-terminal-view":`true`,className:`flex h-full flex-col overflow-hidden bg-[var(--surface-background)]`,children:[(0,D.jsxs)(`div`,{className:h(`app-region-no-drag sticky top-0 z-20 shrink-0 bg-[var(--surface-background)] text-xs`,ie?`px-3 py-1.5`:`pl-3 pr-1.5 py-1`),children:[k&&B?(0,D.jsxs)(`div`,{className:`flex items-center gap-2 pl-1 pr-1`,children:[(0,D.jsx)(`div`,{className:h(`min-w-0 flex-1`,ie?`h-8`:`h-7`),children:(0,D.jsx)(S,{items:be,activeId:V,onSelect:lt,onClose:ut,layoutMode:`scrollable`,variant:`default`,className:`h-full bg-transparent`})}),(0,D.jsx)(_,{type:`button`,size:`xs`,variant:`ghost`,className:h(`shrink-0`,ie?`h-8 w-8 p-0`:`h-7 w-7 p-0`),onClick:ct,title:e(`terminalView.tabs.newTabTitle`),children:(0,D.jsx)(g,{name:`add`,className:`${ie?`h-[18px] w-[18px]`:`h-4 w-4`}`})}),(0,D.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1 overflow-visible`,children:[W?(0,D.jsxs)(_,{type:`button`,size:`xs`,variant:`outline`,className:`h-6 shrink-0 gap-1 px-2`,onClick:()=>{M&&z(M,W)},title:e(`terminalView.preview.openTitle`),children:[(0,D.jsx)(g,{name:`global`,className:`h-3.5 w-3.5 shrink-0`}),(0,D.jsx)(`span`,{className:`whitespace-nowrap`,children:e(`terminalView.preview.open`)})]}):null,yt?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(_,{type:`button`,size:`xs`,variant:`ghost`,onClick:()=>Qe(!f),className:h(`shrink-0 p-0`,p?`h-8 w-8`:`h-7 w-7`),title:e(f?`terminalView.bottomDock.restoreTitle`:`terminalView.bottomDock.expandTitle`),"aria-label":e(f?`terminalView.bottomDock.restoreAria`:`terminalView.bottomDock.expandAria`),children:f?(0,D.jsx)(g,{name:`fullscreen-exit`,className:`h-4 w-4`}):(0,D.jsx)(g,{name:`fullscreen`,className:`h-4 w-4`})}),(0,D.jsx)(_,{type:`button`,size:`xs`,variant:`ghost`,onClick:()=>Ze(!1),className:h(`shrink-0 p-0`,p?`h-8 w-8`:`h-7 w-7`),title:e(`terminalView.bottomDock.closeTitle`),"aria-label":e(`terminalView.bottomDock.closeAria`),children:(0,D.jsx)(g,{name:`close`,className:`h-4 w-4`})})]}):null]})]}):null,!p&&A&&k&&B?(0,D.jsx)(`div`,{className:`mt-2 flex flex-wrap items-center gap-1 pl-1 pr-1`,children:bt}):null,A&&(p||!k||!B)?(0,D.jsx)(`div`,{className:`mt-2 flex flex-wrap items-center gap-1`,children:bt}):null]}),(0,D.jsxs)(`div`,{className:`relative flex-1 overflow-hidden`,style:{backgroundColor:gt.background},children:[(0,D.jsx)(`div`,{className:`h-full w-full box-border pl-4 pr-1.5 pt-3 pb-4`,children:vt?(0,D.jsx)(oe,{ref:e=>{Fe.current=e},sessionKey:_t,chunks:Se,onInput:dt,onResize:ft,theme:gt,fontFamily:ht,fontSize:u,enableTouchScroll:O,autoFocus:!O&&Z,isVisible:Z},_t):null}),!Te&&G&&(0,D.jsxs)(`div`,{className:`absolute inset-x-0 bottom-0 bg-[var(--status-error-background)] px-3 py-2 text-xs text-[var(--status-error-foreground)] flex items-center justify-between gap-2`,children:[(0,D.jsx)(`span`,{children:G}),we&&p&&(0,D.jsx)(_,{size:`sm`,variant:`secondary`,className:`h-6 px-2 py-0 text-xs`,onClick:st,disabled:Ee,title:e(`terminalView.actions.hardRestartTitle`),type:`button`,children:e(`terminalView.actions.hardRestart`)})]})]})]})};export{he as TerminalView};
|
|
@@ -1 +0,0 @@
|
|
|
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"./vendor-react-DLPElpoQ.js";import{t as i}from"./vendor-class-variance-authority-BLUaYARZ.js";import{t as a}from"./utils-2ZK8yboQ.js";var o=r(),s=e(n(),1);function c(e,t){let n=(0,o.c)(3),r;return n[0]!==e||n[1]!==t?(r=n=>{for(let r of[e,t])r&&(typeof r==`function`?r(n):r.current=n)},n[0]=e,n[1]=t,n[2]=r):r=n[2],r}function l(e,t){let n={...t};for(let r in e){let i=t[r],a=e[r];n[r]=/^on[A-Z]/.test(r)&&typeof i==`function`&&typeof a==`function`?(...e)=>{a(...e),i(...e)}:r===`className`&&typeof i==`string`&&typeof a==`string`?`${a} ${i}`:r===`style`&&typeof i==`object`&&typeof a==`object`?{...a,...i}:a}return n}var u=s.forwardRef(function(e,t){let n=(0,o.c)(3),{children:r,...i}=e,a=s.isValidElement(r)?r:null,u=c(t,a?a.ref:void 0);if(!a)return null;let d=l(a.props,i),f;return n[0]!==u||n[1]!==d?(f={...d,ref:u},n[0]=u,n[1]=d,n[2]=f):f=n[2],s.cloneElement(a,f)}),d=t(),f=[`bg-[color-mix(in_srgb,var(--primary-base)_10%,var(--background))]`,`text-[var(--primary-base)]`,`border border-[color-mix(in_srgb,var(--primary-base)_12%,transparent)]`,`hover:bg-[color-mix(in_srgb,var(--primary-base)_16%,var(--background))]`,`active:bg-[color-mix(in_srgb,var(--primary-base)_22%,var(--background))]`,`dark:bg-[color-mix(in_srgb,var(--primary-base)_16%,transparent)]`,`dark:border-[color-mix(in_srgb,var(--primary-base)_20%,transparent)]`,`dark:hover:bg-[color-mix(in_srgb,var(--primary-base)_22%,transparent)]`,`dark:active:bg-[color-mix(in_srgb,var(--primary-base)_30%,transparent)]`].join(` `),p=[`bg-[color-mix(in_srgb,var(--status-error)_7%,var(--background))]`,`text-[var(--status-error)]`,`border border-[color-mix(in_srgb,var(--status-error)_9%,transparent)]`,`hover:bg-[color-mix(in_srgb,var(--status-error)_11%,var(--background))]`,`active:bg-[color-mix(in_srgb,var(--status-error)_16%,var(--background))]`,`dark:bg-[color-mix(in_srgb,var(--status-error)_9%,transparent)]`,`dark:border-[color-mix(in_srgb,var(--status-error)_14%,transparent)]`,`dark:hover:bg-[color-mix(in_srgb,var(--status-error)_14%,transparent)]`,`dark:active:bg-[color-mix(in_srgb,var(--status-error)_20%,transparent)]`].join(` `),m=i([`group relative inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-[10px] [corner-shape:squircle] supports-[corner-shape:squircle]:rounded-[50px] typography-ui-label font-medium tracking-[0.01em] shrink-0 select-none`,`transition-[background-color,border-color,color,opacity,filter,transform] duration-150 ease-out outline-none`,`focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]`,`aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive`,`disabled:pointer-events-none disabled:opacity-50`,`[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`],{variants:{variant:{default:f,destructive:a(p,`focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40`),neutral:`bg-interactive-hover text-foreground border border-border/60 hover:bg-interactive-active`,outline:`bg-[var(--surface-elevated)] text-foreground border border-border/60 hover:bg-interactive-hover hover:text-foreground`,mobileGlass:`oc-mobile-floating-action text-foreground hover:brightness-105 active:bg-interactive-active focus-visible:border-transparent focus-visible:ring-2 focus-visible:ring-[var(--interactive-focus-ring)]`,chip:a(`border border-border/60 bg-transparent text-foreground hover:bg-interactive-hover hover:text-foreground`,`aria-pressed:bg-[color-mix(in_srgb,var(--primary-base)_10%,var(--background))]`,`aria-pressed:text-[var(--primary-base)]`,`aria-pressed:border-[color-mix(in_srgb,var(--primary-base)_12%,transparent)]`,`aria-pressed:hover:bg-[color-mix(in_srgb,var(--primary-base)_16%,var(--background))]`,`aria-pressed:hover:text-[var(--primary-base)]`,`dark:aria-pressed:bg-[color-mix(in_srgb,var(--primary-base)_16%,transparent)]`,`dark:aria-pressed:border-[color-mix(in_srgb,var(--primary-base)_20%,transparent)]`,`dark:aria-pressed:hover:bg-[color-mix(in_srgb,var(--primary-base)_22%,transparent)]`),secondary:`bg-interactive-hover text-foreground hover:bg-interactive-active`,ghost:`text-foreground hover:bg-interactive-hover hover:text-foreground active:bg-interactive-active`,link:`text-primary underline-offset-4 hover:underline`},size:{default:`h-9 px-3.5 has-[>svg]:px-3`,sm:`h-8 gap-1.5 px-2.5 has-[>svg]:px-2 rounded-[9px] supports-[corner-shape:squircle]:rounded-[50px]`,xs:`h-6 gap-1 px-2 typography-micro has-[>svg]:px-1.5 rounded-[7px] supports-[corner-shape:squircle]:rounded-[50px]`,lg:`h-10 px-4 has-[>svg]:px-3.5 rounded-[12px] supports-[corner-shape:squircle]:rounded-[50px]`,icon:`size-9`,mobileIcon:`size-10 min-h-10 min-w-10 rounded-full`}},defaultVariants:{variant:`default`,size:`default`}}),h=new Set([`icon`,`mobileIcon`,`xs`]);function g(e){let t=(0,o.c)(20),n,r,i,s,c,l;t[0]===e?(n=t[1],r=t[2],i=t[3],s=t[4],c=t[5],l=t[6]):({className:n,variant:l,size:i,asChild:s,type:c,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=s,t[5]=c,t[6]=l);let f=s!==void 0&&s,p=f?u:`button`,g;t[7]!==f||t[8]!==c?(g=f?c===void 0?{}:{type:c}:{type:c??`button`},t[7]=f,t[8]=c,t[9]=g):g=t[9];let _=g,v=i!=null&&h.has(i)?`compact`:void 0,y;t[10]!==n||t[11]!==i||t[12]!==l?(y=a(m({variant:l,size:i,className:n})),t[10]=n,t[11]=i,t[12]=l,t[13]=y):y=t[13];let b;return t[14]!==p||t[15]!==v||t[16]!==r||t[17]!==y||t[18]!==_?(b=(0,d.jsx)(p,{"data-slot":`button`,"data-mobile-press-feedback":v,className:y,..._,...r}),t[14]=p,t[15]=v,t[16]=r,t[17]=y,t[18]=_,t[19]=b):b=t[19],b}export{u as n,g as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{Jt as t,Qt as n,Yt as r}from"./persistence-DwRBC4zl.js";import{nt as i,rt as a}from"./vendor-base-ui-CnHfUmDN.js";import{n as o}from"./vendor-react-DLPElpoQ.js";import{a as s,i as c,o as l,t as u}from"./store-ClnJdJSj.js";var d=e(a(),1),f=o(),p=async(e,n)=>{if(!t())throw Error(`Desktop runtime is not available`);return r(e,n)},m=async()=>{if(n())try{await p(`desktop_start_window_drag`)}catch{}},h=async e=>{if(n())try{await p(`desktop_set_window_title`,{title:e})}catch{}},g=async(e,t)=>{if(n())try{await p(`desktop_set_window_theme`,{themeMode:e,themeVariant:t})}catch{}},_=async e=>{if(n())try{await p(`desktop_set_menu_locale`,{locale:e})}catch{}},v=async()=>{if(!n())return null;try{let e=await p(`desktop_get_app_version`);return typeof e==`string`&&e.trim().length>0?e:null}catch{return null}},y=d.createContext(null),b=i(),x=e=>{let t=(0,f.c)(19),{children:n}=e,r=c(S),i=c(C),a=c(w),o=c(T),p,m;t[0]===r?(p=t[1],m=t[2]):(p=()=>{typeof document>`u`||(document.documentElement.lang=r)},m=[r],t[0]=r,t[1]=p,t[2]=m),d.useEffect(p,m);let h,g;t[3]!==a||t[4]!==r?(h=()=>{a===null&&_(r)},g=[r,a],t[3]=a,t[4]=r,t[5]=h,t[6]=g):(h=t[5],g=t[6]),d.useEffect(h,g);let v;t[7]===i?v=t[8]:(v=(e,t)=>u(i,e,t),t[7]=i,t[8]=v);let x=v,E;t[9]===x?E=t[10]:(E=e=>x(l[e]),t[9]=x,t[10]=E);let D;t[11]!==r||t[12]!==o||t[13]!==x||t[14]!==E?(D={locale:r,locales:s,setLocale:o,label:E,t:x},t[11]=r,t[12]=o,t[13]=x,t[14]=E,t[15]=D):D=t[15];let O=D,k;return t[16]!==n||t[17]!==O?(k=(0,b.jsx)(y.Provider,{value:O,children:n}),t[16]=n,t[17]=O,t[18]=k):k=t[18],k};function S(e){return e.locale}function C(e){return e.dictionary}function w(e){return e.loadingLocale}function T(e){return e.setLocale}var E={en:`en-US`,fr:`fr-FR`,"zh-CN":`zh-CN`,"zh-TW":`zh-TW`,uk:`uk-UA`,es:`es-ES`,"pt-BR":`pt-BR`,ko:`ko-KR`,pl:`pl-PL`,ja:`ja-JP`},D=e=>E[e]??`en-US`,O=()=>D(c.getState().locale);function k(){let e=d.useContext(y);if(!e)throw Error(`useI18n must be used within I18nProvider`);return e}async function A(e){let t=null;if(typeof navigator<`u`&&navigator.clipboard?.writeText)try{return await navigator.clipboard.writeText(e),{ok:!0,method:`clipboard`}}catch(e){t=e instanceof Error?e.message:String(e)}if(typeof document<`u`&&document.body){let t=document.createElement(`textarea`);t.value=e,t.setAttribute(`readonly`,``),t.style.position=`fixed`,t.style.top=`-1000px`,t.style.left=`-1000px`,document.body.appendChild(t),t.select(),t.setSelectionRange(0,t.value.length);let n=document.execCommand(`copy`);if(document.body.removeChild(t),n)return{ok:!0,method:`execCommand`}}return{ok:!1,error:t??`Clipboard access denied in current context`}}export{v as a,h as c,x as i,m as l,k as n,p as o,O as r,g as s,A as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{n as t,nt as n,r,rt as i,t as a}from"./vendor-base-ui-CnHfUmDN.js";import{n as o}from"./vendor-react-DLPElpoQ.js";import{t as s}from"./utils-2ZK8yboQ.js";var c=o(),l=e(i(),1),u=n(),d=r,f=e=>{let n=(0,c.c)(14),r,i,a,o;n[0]===e?(r=n[1],i=n[2],a=n[3],o=n[4]):({className:a,asChild:r,children:i,...o}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a,n[4]=o);let d;n[5]!==r||n[6]!==i?(d=r&&l.isValidElement(i)?{render:i}:{children:i},n[5]=r,n[6]=i,n[7]=d):d=n[7];let f=d,p;n[8]===a?p=n[9]:(p=s(`flex w-full items-center justify-between rounded-lg px-2 py-1.5 text-left text-foreground hover:bg-interactive-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary`,a),n[8]=a,n[9]=p);let m;return n[10]!==o||n[11]!==f||n[12]!==p?(m=(0,u.jsx)(t,{className:p,...o,...f}),n[10]=o,n[11]=f,n[12]=p,n[13]=m):m=n[13],m},p=e=>{let t=(0,c.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=s(`overflow-hidden data-[closed]:animate-collapsible-up data-[open]:animate-collapsible-down`,n),t[3]=n,t[4]=i);let o;return t[5]!==r||t[6]!==i?(o=(0,u.jsx)(a,{className:i,...r}),t[5]=r,t[6]=i,t[7]=o):o=t[7],o};export{p as n,f as r,d as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"./rolldown-runtime-C0FnF6B9.js";import{E as e,F as t,I as n,N as r,P as i,a,i as o,nt as s,rt as c}from"./vendor-base-ui-CnHfUmDN.js";import{n as l}from"./vendor-react-DLPElpoQ.js";import{t as u}from"./utils-2ZK8yboQ.js";import{n as d,r as f,t as p}from"./dropdown-menu.styles-Bzo6L3FH.js";var m=l();c();var h=s();function g(e){let t=(0,m.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,h.jsx)(a,{...n}),t[2]=n,t[3]=r),r}function _(e){let t=(0,m.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,h.jsx)(o,{...n}),t[2]=n,t[3]=r),r}function v(e){let n=(0,m.c)(20),a,o,s,c,l;n[0]===e?(a=n[1],o=n[2],s=n[3],c=n[4],l=n[5]):({className:o,positionerClassName:s,children:a,style:l,...c}=e,n[0]=e,n[1]=a,n[2]=o,n[3]=s,n[4]=c,n[5]=l);let f;n[6]===s?f=n[7]:(f=u(`app-region-no-drag z-50`,s),n[6]=s,n[7]=f);let p;n[8]===l?p=n[9]:(p={backgroundColor:`var(--surface-elevated)`,color:`var(--surface-elevated-foreground)`,...l},n[8]=l,n[9]=p);let g;n[10]===o?g=n[11]:(g=u(d,o),n[10]=o,n[11]=g);let _;n[12]!==a||n[13]!==c||n[14]!==p||n[15]!==g?(_=(0,h.jsx)(t,{"data-slot":`dropdown-menu-content`,style:p,className:g,...c,children:a}),n[12]=a,n[13]=c,n[14]=p,n[15]=g,n[16]=_):_=n[16];let v;return n[17]!==f||n[18]!==_?(v=(0,h.jsx)(i,{children:(0,h.jsx)(r,{className:f,children:_})}),n[17]=f,n[18]=_,n[19]=v):v=n[19],v}function y(e){let t=(0,m.c)(8),r,i;t[0]===e?(r=t[1],i=t[2]):({className:r,...i}=e,t[0]=e,t[1]=r,t[2]=i);let a;t[3]===r?a=t[4]:(a=u(p,r),t[3]=r,t[4]=a);let o;return t[5]!==i||t[6]!==a?(o=(0,h.jsx)(n,{className:a,...i}),t[5]=i,t[6]=a,t[7]=o):o=t[7],o}function b(t){let n=(0,m.c)(8),r,i;n[0]===t?(r=n[1],i=n[2]):({className:r,...i}=t,n[0]=t,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=u(f,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==a?(o=(0,h.jsx)(e,{className:a,...i}),n[5]=i,n[6]=a,n[7]=o):o=n[7],o}export{_ as a,b as i,v as n,y as r,g as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{nt as t,rt as n}from"./vendor-base-ui-CnHfUmDN.js";import{t as r}from"./utils-2ZK8yboQ.js";import{t as i}from"./vendor-react-drawio-ECtEwvbc.js";var a=e(n(),1),o=t(),s=`<mxfile><diagram id="new" name="Page-1"><mxGraphModel dx="0" dy="0" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0"><root><mxCell id="0"/><mxCell id="1" parent="0"/></root></mxGraphModel></diagram></mxfile>`;function c(){if(typeof document>`u`)return!1;let e=document.documentElement.getAttribute(`data-theme`);return e===`dark`||!e&&window.matchMedia(`(prefers-color-scheme: dark)`).matches}var l=a.forwardRef(function({xml:e,readOnly:t,className:n,onChange:l},u){let d=a.useRef(e),f=a.useRef(null),p=a.useRef(!1),[m,h]=a.useState(c),g=a.useRef(e),_=a.useRef(e);_.current!==e&&(_.current=e,g.current=e,d.current=e);let v=a.useRef(m);v.current!==m&&(v.current=m,g.current=d.current);let y=a.useRef(null);a.useEffect(()=>{let e=()=>h(c());e();let t=new MutationObserver(e);return t.observe(document.documentElement,{attributes:!0,attributeFilter:[`data-theme`]}),()=>t.disconnect()},[]),a.useEffect(()=>{let e=setTimeout(()=>{y.current?.querySelector(`.diagrams-iframe`)?.focus()},600);return()=>clearTimeout(e)},[]),a.useImperativeHandle(u,()=>({getXml:()=>d.current}));let b=a.useCallback(()=>{!e&&!p.current&&(p.current=!0,setTimeout(()=>{f.current?.template({})},500))},[e]),x=a.useCallback(e=>{d.current=e.xml,l?.(e.xml)},[l]);return(0,o.jsx)(`div`,{ref:y,className:r(`h-full w-full`,n),children:(0,o.jsx)(i,{ref:f,xml:g.current||s,autosave:!0,urlParameters:{ui:t?`simple`:m?`dark`:`kennedy`,spin:!0,libraries:!t,chrome:t,nav:t,layers:t,noSaveBtn:!0,noExitBtn:!0,saveAndExit:!1},onLoad:b,onAutoSave:x},m?`dark`:`light`)})});export{l as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{$ as t,J as n,K as r,Q as i,X as a,Y as o,Z as s,nt as c,q as l,rt as u}from"./vendor-base-ui-CnHfUmDN.js";import{n as d}from"./vendor-react-DLPElpoQ.js";import{n as f}from"./clipboard-GUUNlWIv.js";import{t as p}from"./utils-2ZK8yboQ.js";import{n as m}from"./Icon-D1BcR8Tz.js";var h=[{var:`--status-success`,class:`agent-success`},{var:`--syntax-keyword`,class:`agent-keyword`},{var:`--syntax-type`,class:`agent-type`},{var:`--syntax-function`,class:`agent-function`},{var:`--syntax-number`,class:`agent-number`},{var:`--status-info`,class:`agent-info`},{var:`--status-warning`,class:`agent-warning`},{var:`--syntax-variable`,class:`agent-variable`}];function g(e){if(!e||e===`build`)return h[0];let t=0;for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);t=(t<<5)-t+r,t&=t}return h[1+Math.abs(t)%(h.length-1)]}var _=5,v=Math.ceil(_/2);function y(e){let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),t|=0;return t>>>0}function b(e){let t=Array.from({length:_},()=>Array.from({length:_},()=>!1));if(!e)return t;let n=y(e);for(let e=0;e<_;e++)for(let r=0;r<v;r++){let i=(n&1)==1;n>>>=1,t[e][r]=i,t[e][4-r]=i}return t}var x=d(),S=e(u(),1),C=c(),w=0;function T(e,t){return e&&S.isValidElement(t)?{render:t}:{children:t}}function E(e){let t=(0,x.c)(4),r;t[0]===e?r=t[1]:({...r}=e,t[0]=e,t[1]=r);let i;return t[2]===r?i=t[3]:(i=(0,C.jsx)(n,{...r}),t[2]=r,t[3]=i),i}function D(e){let t=(0,x.c)(10),n,i,a;t[0]===e?(n=t[1],i=t[2],a=t[3]):({asChild:n,children:i,...a}=e,t[0]=e,t[1]=n,t[2]=i,t[3]=a);let o;t[4]!==n||t[5]!==i?(o=T(n,i),t[4]=n,t[5]=i,t[6]=o):o=t[6];let s=o,c;return t[7]!==a||t[8]!==s?(c=(0,C.jsx)(r,{"data-slot":`dialog-trigger`,...a,...s}),t[7]=a,t[8]=s,t[9]=c):c=t[9],c}function O(e){let t=(0,x.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,C.jsx)(o,{...n}),t[2]=n,t[3]=r),r}var k=S.forwardRef((e,n)=>{let r=(0,x.c)(10),i,a;r[0]===e?(i=r[1],a=r[2]):({className:i,...a}=e,r[0]=e,r[1]=i,r[2]=a);let o;r[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=[],r[3]=o):o=r[3],S.useEffect(I,o);let s=n,c;r[4]===i?c=r[5]:(c=p(`fixed inset-0 z-50 bg-black/50 dark:bg-black/75`,`transition-opacity duration-150 ease-out`,`data-[starting-style]:opacity-0 data-[ending-style]:opacity-0`,i),r[4]=i,r[5]=c);let l;return r[6]!==a||r[7]!==s||r[8]!==c?(l=(0,C.jsx)(t,{ref:s,"data-slot":`dialog-overlay`,className:c,...a}),r[6]=a,r[7]=s,r[8]=c,r[9]=l):l=r[9],l});k.displayName=`DialogOverlay`;function A(e){let t=(0,x.c)(29),n,r,o,s,c,l;t[0]===e?(n=t[1],r=t[2],o=t[3],s=t[4],c=t[5],l=t[6]):({className:r,overlayClassName:s,containerClassName:o,children:n,showCloseButton:l,...c}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=o,t[4]=s,t[5]=c,t[6]=l);let u=l===void 0||l,{t:d}=f(),h;t[7]===s?h=t[8]:(h=p(`rounded-none`,s),t[7]=s,t[8]=h);let g;t[9]===h?g=t[10]:(g=(0,C.jsx)(k,{className:h}),t[9]=h,t[10]=g);let _=o??`items-center p-4`,v;t[11]===_?v=t[12]:(v=p(`fixed inset-0 z-50 flex justify-center pointer-events-none`,_),t[11]=_,t[12]=v);let y;t[13]===r?y=t[14]:(y=p(`relative pointer-events-auto bg-background text-foreground flex flex-col w-full max-w-lg max-h-full gap-4 rounded-xl border p-6 shadow-none overflow-y-auto pwa-dialog-content origin-center`,`transition-all duration-150 ease-out`,`data-[starting-style]:opacity-0 data-[starting-style]:scale-[0.98]`,`data-[ending-style]:opacity-0 data-[ending-style]:scale-[0.98]`,`data-[nested-dialog-open]:brightness-[0.55] dark:data-[nested-dialog-open]:brightness-[0.4]`,r),t[13]=r,t[14]=y);let b;t[15]!==u||t[16]!==d?(b=u&&(0,C.jsxs)(i,{"data-slot":`dialog-close`,className:`ring-offset-background focus:ring-ring data-[open]:bg-interactive-active data-[open]:text-foreground absolute top-2 right-2 rounded-lg opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none text-muted-foreground hover:text-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,children:[(0,C.jsx)(m,{name:`close`}),(0,C.jsx)(`span`,{className:`sr-only`,children:d(`dialog.common.actions.close`)})]}),t[15]=u,t[16]=d,t[17]=b):b=t[17];let S;t[18]!==n||t[19]!==c||t[20]!==y||t[21]!==b?(S=(0,C.jsxs)(a,{"data-slot":`dialog-content`,"data-state-slot":`dialog`,className:y,...c,children:[n,b]}),t[18]=n,t[19]=c,t[20]=y,t[21]=b,t[22]=S):S=t[22];let w;t[23]!==v||t[24]!==S?(w=(0,C.jsx)(`div`,{className:v,children:S}),t[23]=v,t[24]=S,t[25]=w):w=t[25];let T;return t[26]!==g||t[27]!==w?(T=(0,C.jsxs)(O,{children:[g,w]}),t[26]=g,t[27]=w,t[28]=T):T=t[28],T}function j(e){let t=(0,x.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=p(`flex flex-col gap-2 text-center sm:text-left`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,C.jsx)(`div`,{"data-slot":`dialog-header`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function M(e){let t=(0,x.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=p(`flex flex-col-reverse gap-2 bottom-safe-area sm:flex-row sm:justify-end`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,C.jsx)(`div`,{"data-slot":`dialog-footer`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function N(e){let t=(0,x.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=p(`typography-markdown leading-none font-semibold text-foreground`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,C.jsx)(l,{"data-slot":`dialog-title`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function P(e){let t=(0,x.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=p(`text-muted-foreground typography-ui-label`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,C.jsx)(s,{"data-slot":`dialog-description`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function F(){w=Math.max(0,w-1),w===0&&document.documentElement.classList.remove(`oc-dialog-open`)}function I(){return w+=1,document.documentElement.classList.add(`oc-dialog-open`),F}export{j as a,b as c,M as i,g as l,A as n,N as o,P as r,D as s,E as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"./rolldown-runtime-C0FnF6B9.js";import{nt as e,rt as t}from"./vendor-base-ui-CnHfUmDN.js";import{n}from"./vendor-react-DLPElpoQ.js";import{t as r}from"./utils-2ZK8yboQ.js";var i=n();t();var a=e();function o(e){let t=(0,i.c)(10),n,o,s;t[0]===e?(n=t[1],o=t[2],s=t[3]):({className:n,type:s,...o}=e,t[0]=e,t[1]=n,t[2]=o,t[3]=s);let c;t[4]===n?c=t[5]:(c=r(`text-foreground file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground bg-[var(--surface-elevated)] appearance-none flex h-9 w-full min-w-0 rounded-lg px-3 py-1 typography-markdown outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:typography-ui-label file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:typography-ui-label`,`ring-1 ring-inset ring-border/60 transition duration-200 ease-out`,`hover:[&:not(:focus)]:bg-[var(--surface-subtle)] hover:[&:not(:focus)]:ring-transparent`,`focus:ring-2 focus:ring-[var(--interactive-focus-ring)] focus-visible:outline-none`,`aria-invalid:ring-[var(--status-error)] aria-invalid:focus:ring-[var(--status-error)]`,n),t[4]=n,t[5]=c);let l;return t[6]!==o||t[7]!==c||t[8]!==s?(l=(0,a.jsx)(`input`,{type:s,"data-slot":`input`,className:c,spellCheck:!1,autoComplete:`off`,autoCorrect:`off`,autoCapitalize:`off`,...o}),t[6]=o,t[7]=c,t[8]=s,t[9]=l):l=t[9],l}export{o as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{c as t,i as n}from"./runtime-switch-LvWDU-SL.js";import{Cn as r,D as i,d as a,k as o,tn as s,u as c}from"./persistence-DwRBC4zl.js";import{a as l,i as u,r as d}from"./vendor-zustand-B4dlGEM2.js";import{nt as f,rt as p}from"./vendor-base-ui-CnHfUmDN.js";import{B as m,Ct as h,M as g,Mt as _}from"./platform-DQ5_LNKO.js";import{b as v,t as ee,y}from"./useUIStore-CxOoCv7B.js";import{n as b}from"./vendor-react-DLPElpoQ.js";import{s as x}from"./vendor-tanstack-react-query-D7pys_c9.js";import{n as S}from"./vendor-reactuses-core-BnW6GxJt.js";import{n as te}from"./clipboard-GUUNlWIv.js";import{Qi as ne,c as C,ct as re,dr as ie,dt as ae,eo as oe,ft as se,g as w,go as T,ho as ce,in as E,lt as D,mn as O,ot as k,st as le,y as A}from"./useMobileNavigationStore-DDgESrzu.js";import{c as j,t as M}from"./utils-2ZK8yboQ.js";import{n as N}from"./Icon-D1BcR8Tz.js";import{g as P,v as F}from"./gitApi-pLkl_IyQ.js";import{f as I,o as L,q as ue}from"./projectMeta-BMkGWqtz.js";import{n as de,r as fe,t as pe}from"./fileMentionTouchSelection-DzdgAvGS.js";import{n as me}from"./textarea-B9CmN13Z.js";var R=e=>{switch(e.name){case`new`:return`add`;case`init`:return`file`;case`undo`:return`arrow-go-back`;case`redo`:return`arrow-go-forward`;case`timeline`:return`time`;case`compact`:return`scissors`;case`goal`:return`target`;case`review`:return`search-eye`;case`test`:case`build`:case`run`:return`terminal-box`;default:return e.isBuiltIn?`flashlight`:`command`}},he=()=>`book-open`,z=e=>{if(e.isDirectory)return`folder-3-fill`;switch(e.extension?.toLowerCase()){case`ts`:case`tsx`:case`js`:case`jsx`:case`json`:return`code`;case`md`:case`mdx`:return`file`;case`png`:case`jpg`:case`jpeg`:case`gif`:case`svg`:return`file-image`;default:return`file-pdf`}},B=()=>`ai-agent`,ge=()=>`chat-thread`,_e=(e,t)=>e.map(e=>{let n=e.isSkill?t.skill:e.isOpenChamber?`OpenChamber`:e.isBuiltIn?t.system:e.scope||e.agent||t.command;return{id:e.id,title:`/${e.name}`,subtitle:e.description,badge:n,iconName:R(e)}}),ve=e=>e.map(e=>({id:`${e.name}-${e.scope}`,title:e.name,subtitle:e.description,badge:e.scope,iconName:he()})),ye=({agents:e,sessions:t,recentFiles:n,pathHits:r,untitledSession:i,sessionBadge:a})=>{let o=[];for(let t of e)o.push({id:`agent:${t.name}`,title:`@${t.name}`,subtitle:t.description,iconName:B()});for(let e of t)o.push({id:`session:${e.id}`,title:e.title||i,badge:a,iconName:ge()});for(let e of n)o.push({id:`recent:${e.path}`,title:e.relativePath||e.name,iconName:z(e)});for(let e of r)o.push({id:`file:${e.path}`,title:e.relativePath||e.name,iconName:z(e)});return o},be=(e,t)=>{let n=t.trim();if(!n)return[...e].sort((e,t)=>e.isBuiltIn===t.isBuiltIn?e.name.localeCompare(t.name):e.isBuiltIn?-1:1);let r=se([...e],n,e=>[e.name,e.description??``]);return r.sort((e,t)=>e.score===t.score?e.item.isBuiltIn===t.item.isBuiltIn?e.item.name.localeCompare(t.item.name):e.item.isBuiltIn?-1:1:e.score-t.score),r.map(e=>e.item)},xe=(e,t)=>e===t||e.length===t.length&&e.every((e,n)=>{let r=t[n];return r!=null&&e.id===r.id&&e.title===r.title&&(e.subtitle??``)===(r.subtitle??``)&&(e.badge??``)===(r.badge??``)&&e.iconName===r.iconName}),Se=(e,t)=>e.highlightedIndex===t.highlightedIndex&&xe(e.rows,t.rows),Ce=(e,t)=>xe(e,t)?e:t.slice(),we=(e,t,n)=>{e&&(t.current&&Se(t.current,n)||(t.current=n,e(n)))},Te=(e,t)=>{t.current=null,e?.({rows:[],highlightedIndex:0})},V=e(p(),1),H=e=>{if(!e)return``;let t=e.replace(/\\/g,`/`),n=t.startsWith(`//`),r=t.replace(/\/+/g,`/`);n&&!r.startsWith(`//`)&&(r=`/${r}`);let i=r===`/`,a=/^[A-Za-z]:\/$/.test(r);return!i&&!a&&(r=r.replace(/\/+$/,``)),r},U=e=>/^[A-Za-z]:\//.test(e)?e.toLowerCase():e,W=(e,t)=>{let n=H(t),r=H(e);if(!n||!r)return!1;let i=U(n),a=U(r);return a===i||a.startsWith(`${i}/`)},G=e=>{if(!e||typeof e!=`object`)return{};let t=e,n={};for(let[e,r]of Object.entries(t)){let t=H(e);if(!t||!r||typeof r!=`object`)continue;let i=r,a=Array.isArray(i.openPaths)?Array.from(new Set(i.openPaths.filter(e=>typeof e==`string`).map(e=>H(e)).filter(e=>W(e,t)))):[],o=Array.isArray(i.expandedPaths)?Array.from(new Set(i.expandedPaths.filter(e=>typeof e==`string`).map(e=>H(e)).filter(e=>W(e,t)))):[],s=typeof i.selectedPath==`string`?H(i.selectedPath):null,c=s&&W(s,t)?s:a[0]??null,l=typeof i.touchedAt==`number`&&Number.isFinite(i.touchedAt)?i.touchedAt:Date.now(),u=n[t];if(u){let e=Array.from(new Set([...u.openPaths,...a])),r=Array.from(new Set([...u.expandedPaths,...o]));n[t]={openPaths:e,selectedPath:u.selectedPath??c??e[0]??null,expandedPaths:r,touchedAt:Math.max(u.touchedAt,l)};continue}n[t]={openPaths:a,selectedPath:c,expandedPaths:o,touchedAt:l}}return n},K=(e,t)=>{let n=Object.entries(e);if(n.length<=t)return e;n.sort((e,t)=>(t[1]?.touchedAt??0)-(e[1]?.touchedAt??0));let r={};for(let[e,i]of n.slice(0,t))r[e]=i;return r},q=e=>e?{...e,touchedAt:Date.now()}:{openPaths:[],selectedPath:null,expandedPaths:[],touchedAt:Date.now()},Ee=l()(d(u((e,t)=>({byRoot:{},addOpenPath:(t,n,r)=>{let i=H((t||``).trim()),a=H((n||``).trim());!i||!a||!r?.allowOutsideRoot&&!W(a,i)||e(e=>{let t=e.byRoot[i],n=q(t),r=n.openPaths.includes(a),o=r?n.openPaths:[...n.openPaths,a],s=n.selectedPath??a;return t&&r&&t.selectedPath===s?e:{byRoot:K({...e.byRoot,[i]:{...n,openPaths:o,selectedPath:s}},20)}})},removeOpenPath:(t,n)=>{let r=H((t||``).trim()),i=H((n||``).trim());!r||!i||e(e=>{let t=e.byRoot[r];if(!t)return e;let n=U(i),a=e=>U(e)===n,o=t.selectedPath?a(t.selectedPath):!1;if(!t.openPaths.some(a)&&!o)return e;let s=t.openPaths.filter(e=>!a(e)),c=o?s[0]??null:t.selectedPath;return{byRoot:K({...e.byRoot,[r]:{...t,openPaths:s,selectedPath:c,touchedAt:Date.now()}},20)}})},removeOpenPathsByPrefix:(t,n)=>{let r=H((t||``).trim()),i=H((n||``).trim());!r||!i||e(e=>{let t=e.byRoot[r];if(!t)return e;let n=U(i),a=n.endsWith(`/`)?n:`${n}/`,o=e=>{let t=U(e);return t===n||t.startsWith(a)},s=t.openPaths.filter(e=>!o(e));if(s.length===t.openPaths.length)return e;let c=t.selectedPath&&o(t.selectedPath)?s[0]??null:t.selectedPath;return{byRoot:K({...e.byRoot,[r]:{...t,openPaths:s,selectedPath:c,touchedAt:Date.now()}},20)}})},removeExpandedPathsByPrefix:(t,n)=>{let r=H((t||``).trim()),i=H((n||``).trim());!r||!i||e(e=>{let t=e.byRoot[r];if(!t)return e;let n=U(i),a=n.endsWith(`/`)?n:`${n}/`,o=t.expandedPaths.filter(e=>{let t=U(e);return t!==n&&!t.startsWith(a)});return o.length===t.expandedPaths.length?e:{byRoot:K({...e.byRoot,[r]:{...t,expandedPaths:o,touchedAt:Date.now()}},20)}})},setSelectedPath:(t,n,r)=>{let i=H((t||``).trim()),a=n?H(n.trim()):null;!i||a&&!r?.allowOutsideRoot&&!W(a,i)||e(e=>{let t=e.byRoot[i],n=q(t),r=a&&!n.openPaths.includes(a)?[...n.openPaths,a]:n.openPaths;return t&&t.selectedPath===a&&r===t.openPaths?e:{byRoot:K({...e.byRoot,[i]:{...n,openPaths:r,selectedPath:a}},20)}})},ensureSelectedPath:e=>{let n=H((e||``).trim());if(!n)return;let r=t().byRoot[n];if(!r||r.selectedPath)return;let i=r.openPaths[0]??null;i&&t().setSelectedPath(n,i)},toggleExpandedPath:(t,n)=>{let r=H((t||``).trim()),i=H((n||``).trim());!r||!i||!W(i,r)||e(e=>{let t=e.byRoot[r],n=q(t),a=n.expandedPaths.includes(i)?n.expandedPaths.filter(e=>e!==i):[...n.expandedPaths,i];return t&&t.expandedPaths===a&&t.selectedPath===n.selectedPath&&t.openPaths===n.openPaths?e:{byRoot:K({...e.byRoot,[r]:{...n,expandedPaths:a}},20)}})},expandPath:(t,n)=>{let r=H((t||``).trim()),i=H((n||``).trim());!r||!i||!W(i,r)||e(e=>{let t=e.byRoot[r],n=q(t);return n.expandedPaths.includes(i)&&t?e:{byRoot:K({...e.byRoot,[r]:{...n,expandedPaths:[...n.expandedPaths,i]}},20)}})},expandPaths:(t,n)=>{let r=H((t||``).trim());if(!r||!n||n.length===0)return;let i=n.map(e=>H((e||``).trim())).filter(e=>e&&W(e,r));i.length!==0&&e(e=>{let t=e.byRoot[r],n=q(t),a=new Set(n.expandedPaths),o=i.filter(e=>!a.has(e));return o.length===0?e:{byRoot:K({...e.byRoot,[r]:{...n,expandedPaths:[...n.expandedPaths,...o]}},20)}})}}),{name:`files-view-tabs-store`,version:2,storage:y(),migrate:e=>{if(!e||typeof e!=`object`)return{byRoot:{}};let t=e.byRoot;return{byRoot:G(t)}},partialize:e=>({byRoot:G(e.byRoot)})}),{name:`files-view-tabs-store`})),J=b(),De=(e,t)=>{let n=(0,J.c)(4),r=t===void 0?200:t,[i,a]=V.useState(e),o,s;return n[0]!==r||n[1]!==e?(o=()=>{let t=window.setTimeout(()=>{a(e)},r);return()=>{window.clearTimeout(t)}},s=[e,r],n[0]=r,n[1]=e,n[2]=o,n[3]=s):(o=n[2],s=n[3]),V.useEffect(o,s),i},Oe=()=>{let e=(0,J.c)(17),t=C(Y),n=O(),r;e[0]===t?r=e[1]:(r=e=>t?e.getAttachment(t):void 0,e[0]=t,e[1]=r);let i=A(r),a=C(X),o=C(ke),s=T(Ae),c=T(je),l=h(Me);if(t){let r;e[2]===i?r=e[3]:(r=w(i),e[2]=i,e[3]=r);let o=r;if(o)return o;let s;e[4]!==t||e[5]!==a?(s=a.get(t),e[4]=t,e[5]=a,e[6]=s):s=e[6];let c=s;if(c?.path)return c.path;let l;if(e[7]!==t||e[8]!==n){let r;e[10]===t?r=e[11]:(r=e=>e.id===t,e[10]=t,e[11]=r),l=n.find(r),e[7]=t,e[8]=n,e[9]=l}else l=e[9];let u=l;if(u?.directory)return u.directory}if(o?.open&&(o.bootstrapPendingDirectory||o.directoryOverride))return(o.bootstrapPendingDirectory||o.directoryOverride)??void 0;if(s){let t;if(e[12]!==s||e[13]!==c){let n;e[15]===s?n=e[16]:(n=e=>e.id===s,e[15]=s,e[16]=n),t=c.find(n),e[12]=s,e[13]=c,e[14]=t}else t=e[14];let n=t;if(n?.path)return n.path}return l??void 0};function Y(e){return e.currentSessionId}function X(e){return e.worktreeMetadata}function ke(e){return e.newSessionDraft}function Ae(e){return e.activeProjectId}function je(e){return e.projects}function Me(e){return e.currentDirectory}var Z=f(),Ne=V.forwardRef(({searchQuery:e,onFileSelect:t,onAgentSelect:n,onSessionSelect:r,onClose:a,style:s,onRowsChange:c},l)=>{let{t:u}=te(),d=Oe()??``,f=C(e=>e.currentSessionId),p=ie(e=>e.activeSessions),m=T(e=>e.activeProjectId),h=T(e=>e.projects),g=V.useMemo(()=>h.find(e=>e.id===m)?.path??null,[m,h]),v=V.useMemo(()=>{let e=g||d;return e?e.replace(/\\/g,`/`).replace(/\/+$/,``):null},[g,d]),y=Ee(e=>v?e.byRoot[v]:void 0),b=ne(e=>e.getVisibleAgents),x=_(e=>e.searchFiles),oe=De(e,180),se=o(),w=i(),[ce,E]=V.useState([]),[O,A]=V.useState([]),[P,F]=V.useState(!1),[I,L]=V.useState(0),ue=V.useRef(0),[R,he]=V.useState(360),[B,ge]=V.useState({}),[_e,ve]=V.useState({}),be=V.useRef([]),xe=V.useRef([]),Se=V.useRef([]),Ce=V.useRef(null),H=V.useRef(null),U=V.useRef(null);U.current||=pe();let W=ee(e=>e.isMobile),G=(e??``).trim(),K=V.useMemo(()=>{if(!v||!y)return[];let e=[y.selectedPath,...y.openPaths.slice().reverse()].filter(e=>typeof e==`string`&&e.length>0),t=new Set,n=[];for(let r of e){if(t.has(r))continue;t.add(r);let e=r.replace(/\\/g,`/`),i=e.split(`/`).filter(Boolean).pop()||e,a=e.startsWith(`${v}/`)?e.slice(v.length+1):e;n.push({name:i,path:e,relativePath:a,extension:i.includes(`.`)?i.split(`.`).pop()?.toLowerCase():void 0})}return D(n,G,{limit:6})},[G,v,y]),q=V.useMemo(()=>G.length>0?O:O.slice(0,2),[O,G.length]),J=V.useMemo(()=>r?k({sessions:p,currentSessionId:f,searchQuery:G}):[],[p,f,G,r]),Y=K,X=ce;V.useEffect(()=>{let e=e=>{let t=e.target;!t||!Ce.current||Ce.current.contains(t)||a()};return document.addEventListener(`pointerdown`,e,!0),()=>{document.removeEventListener(`pointerdown`,e,!0)}},[a]),V.useEffect(()=>{if(!d){E([]);return}let e=(oe??``).trim(),t=ae(e);if(!t){E([]);return}let n=!1;F(!0);let r={includeHidden:se,respectGitignore:!w};return Promise.all([x(d,t,80,{...r,type:`file`}),x(d,t,40,{...r,type:`directory`})]).then(([t,r])=>{if(n)return;let i=new Set(K.map(e=>e.path));E(le({files:t,directories:r,query:e,excludePaths:i,limit:20}))}).catch(()=>{n||E([])}).finally(()=>{n||F(!1)}),()=>{n=!0}},[d,oe,K,x,se,w]),V.useEffect(()=>{let t=b().filter(e=>e.mode&&e.mode!==`primary`).map(e=>({name:e.name,description:e.description,mode:e.mode}));A(re(t,e??``))},[b,e]),V.useEffect(()=>{L(0),ge({}),ve({})},[X,Y.length,q.length,J.length]),V.useEffect(()=>{ue.current=I},[I]),V.useEffect(()=>{be.current[I]?.scrollIntoView({block:`nearest`})},[I]),V.useEffect(()=>{let e=null,t=()=>{e!==null&&cancelAnimationFrame(e),e=requestAnimationFrame(()=>{let e={},t={};xe.current.forEach((n,r)=>{if(!n)return;let i=Se.current[r]?.offsetWidth??n.scrollWidth,a=Math.max(0,i-n.clientWidth),o=a>8;if(e[r]=o,o){let e=Math.max(.6,a/110);t[r]=e}}),ge(e),ve(t)})};return t(),window.addEventListener(`resize`,t),()=>{e!==null&&cancelAnimationFrame(e),window.removeEventListener(`resize`,t)}},[X,Y]),V.useEffect(()=>{let e=xe.current[I];if(!e)return;let t=()=>{let t=e.clientWidth;t>0&&he(t)};if(t(),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(t);return n.observe(e),()=>{n.disconnect()}},[I]);let ke=S(e=>{t(e)}),Ae=S(e=>{n?.(e)}),je=S(e=>{r?.(e)}),Me=(e,t)=>({onMouseDown:e=>e.preventDefault(),onPointerDown:e=>{e.pointerType===`touch`&&U.current?.pointerDown(e.clientX,e.clientY)},onPointerMove:e=>{e.pointerType===`touch`&&U.current?.pointerMove(e.clientX,e.clientY)},onPointerUp:e=>{e.pointerType===`touch`&&(U.current?.pointerUp(t)??!1)&&(e.preventDefault(),e.stopPropagation())},onPointerCancel:()=>U.current?.pointerCancel(),onClick:()=>{U.current?.click(t)},onMouseMove:()=>L(e)}),Ne=e=>{let t=q.length+J.length+Y.length+X.length;if(t===0)return;let n=(e%t+t)%t;if(n<q.length){let e=q[n];e&&Ae(e.name);return}let r=n-q.length;if(r<J.length){let e=J[r];e&&je(e);return}let i=r-J.length,a=i<Y.length?Y[i]:X[i-Y.length];a&&ke(a)};V.useEffect(()=>{we(c,H,{rows:ye({agents:q,sessions:J,recentFiles:Y,pathHits:X,untitledSession:u(`chat.fileMentionAutocomplete.untitledSession`),sessionBadge:u(`chat.fileMentionAutocomplete.sessionType`)}),highlightedIndex:I})},[c,I,u,q,X,Y,J]);let Pe=V.useRef(c);Pe.current=c,V.useEffect(()=>()=>{Te(Pe.current,H)},[]),V.useImperativeHandle(l,()=>({acceptIndex:e=>{Ne(e)},handleKeyDown:e=>{if(e===`Escape`){a();return}let t=q.length+J.length+Y.length+X.length;if(t!==0){if(e===`ArrowDown`){L(e=>(e+1)%t);return}if(e===`ArrowUp`){L(e=>(e-1+t)%t);return}(e===`Enter`||e===`Tab`)&&Ne(ue.current)}}}),[X,Y,q,J,a,ke,Ae,je]);let Fe=e=>(0,Z.jsx)(N,{name:z(e),className:`h-3.5 w-3.5 text-current`});return(0,Z.jsxs)(de,{ref:Ce,isMobile:W,className:`max-w-[640px] max-h-64`,style:s,children:[(0,Z.jsx)(me,{preventOverscroll:!0,outerClassName:`flex-1 min-h-0`,className:`px-0`,children:(0,Z.jsxs)(`div`,{className:`pb-2`,children:[q.length>0&&(0,Z.jsx)(`div`,{className:`px-3 pb-1 pt-2 typography-meta font-medium text-muted-foreground`,children:u(`chat.fileMentionAutocomplete.groups.agents`)}),q.map((e,t)=>{let n=I===t;return(0,Z.jsx)(`div`,{ref:e=>{be.current[t]=e},className:M(`flex items-start gap-2 px-3 py-1.5 cursor-pointer typography-ui-label rounded-lg`,W&&`min-h-11`,fe(W,n),!W&&n&&`text-interactive-selection-foreground`),...Me(t,()=>Ae(e.name)),children:(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsxs)(`div`,{className:`font-semibold truncate`,children:[`@`,e.name]}),e.description&&!W?(0,Z.jsx)(`div`,{className:`typography-meta text-muted-foreground truncate`,children:e.description}):null]})},`agent-${e.name}`)}),q.length===2&&G.length===0&&O.length>2&&(0,Z.jsx)(`div`,{className:`px-3 py-1 typography-meta text-muted-foreground`,children:u(`chat.fileMentionAutocomplete.searchMoreAgents`)}),J.length>0&&(0,Z.jsx)(`div`,{className:`px-3 pb-1 pt-2 typography-meta font-medium text-muted-foreground`,children:u(`chat.fileMentionAutocomplete.groups.sessions`)}),J.map((e,t)=>{let n=q.length+t,r=I===n;return(0,Z.jsxs)(`div`,{ref:e=>{be.current[n]=e},className:M(`flex items-center gap-2 px-3 py-1.5 cursor-pointer typography-ui-label rounded-lg`,W&&`min-h-11`,fe(W,r),!W&&r&&`text-interactive-selection-foreground`),...Me(n,()=>je(e)),children:[(0,Z.jsx)(N,{name:`chat-thread`,className:`h-4 w-4 flex-shrink-0 text-[var(--primary-base)]`}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,title:e.title||u(`chat.fileMentionAutocomplete.untitledSession`),children:e.title||u(`chat.fileMentionAutocomplete.untitledSession`)}),W?null:(0,Z.jsx)(`span`,{className:`flex-shrink-0 typography-meta text-muted-foreground`,children:u(`chat.fileMentionAutocomplete.sessionType`)})]},`session-${e.id}`)}),Y.length>0&&(0,Z.jsx)(`div`,{className:`px-3 pb-1 pt-2 typography-meta font-medium text-muted-foreground`,children:u(`chat.fileMentionAutocomplete.groups.recentFiles`)}),Y.map((e,t)=>{let n=q.length+J.length+t,r=e.relativePath||e.name,i=j(r,{maxLength:60}),a=I===n,o=B[n]??!1,s=_e[n]??2.6;return(0,Z.jsxs)(`div`,{ref:e=>{be.current[n]=e},className:M(`flex items-center gap-2 px-3 py-1.5 cursor-pointer typography-ui-label rounded-lg`,W&&`min-h-11`,fe(W,a),!W&&a&&`text-interactive-selection-foreground`),...Me(n,()=>ke(e)),children:[Fe(e),(0,Z.jsxs)(`span`,{ref:e=>{xe.current[n]=e},className:`relative flex-1 min-w-0 overflow-hidden file-mention-marquee-container`,style:a?{"--file-mention-marquee-width":`${R}px`,"--file-mention-marquee-duration":`${s}s`}:void 0,"aria-label":r,children:[(0,Z.jsx)(`span`,{ref:e=>{Se.current[n]=e},className:`absolute invisible whitespace-nowrap pointer-events-none`,"aria-hidden":!0,children:r}),o&&a?(0,Z.jsx)(`span`,{className:`inline-block whitespace-nowrap file-mention-marquee`,children:r}):(0,Z.jsx)(`span`,{className:`block truncate`,children:i})]})]},`recent-${e.path}`)}),X.length>0&&(0,Z.jsx)(`div`,{className:`px-3 pb-1 pt-2 typography-meta font-medium text-muted-foreground`,children:u(`chat.fileMentionAutocomplete.groups.files`)}),X.map((e,t)=>{let n=q.length+J.length+Y.length+t,r=e.relativePath||e.name,i=j(r,{maxLength:60}),a=I===n,o=B[n]??!1,s=_e[n]??2.6;return(0,Z.jsxs)(`div`,{ref:e=>{be.current[n]=e},className:M(`flex items-center gap-2 px-3 py-1.5 cursor-pointer typography-ui-label rounded-lg`,W&&`min-h-11`,fe(W,a),!W&&a&&`text-interactive-selection-foreground`),...Me(n,()=>ke(e)),children:[Fe(e),(0,Z.jsxs)(`span`,{ref:e=>{xe.current[n]=e},className:`relative flex-1 min-w-0 overflow-hidden file-mention-marquee-container`,style:a?{"--file-mention-marquee-width":`${R}px`,"--file-mention-marquee-duration":`${s}s`}:void 0,"aria-label":r,children:[(0,Z.jsx)(`span`,{ref:e=>{Se.current[n]=e},className:`absolute invisible whitespace-nowrap pointer-events-none`,"aria-hidden":!0,children:r}),o&&a?(0,Z.jsx)(`span`,{className:`inline-block whitespace-nowrap file-mention-marquee`,children:r}):(0,Z.jsx)(`span`,{className:`block truncate`,children:i})]})]},e.path)}),P&&X.length===0?(0,Z.jsx)(`div`,{className:`flex items-center justify-center py-3`,children:(0,Z.jsx)(N,{name:`refresh`,className:`h-4 w-4 animate-spin text-muted-foreground`})}):null,!P&&X.length===0&&Y.length===0&&q.length===0&&J.length===0&&(0,Z.jsx)(`div`,{className:`px-3 py-2 typography-ui-label text-muted-foreground`,children:u(`chat.fileMentionAutocomplete.empty`)})]})}),!W&&(0,Z.jsx)(`div`,{className:`px-3 pt-1 pb-1.5 border-t typography-meta text-muted-foreground`,children:u(`chat.autocomplete.keyboardHint`)})]})}),Pe=new Set([`new`,`fork`,`compact`,`undo`,`redo`,`model`,`goal`]),Fe=(e,t)=>{if(!t||e.isSkill)return!1;let n=e.name?.trim().toLowerCase();return!!(n&&Pe.has(n))},Ie=(e,t)=>!e||t({name:e}),Le=` `,Re=(e,t)=>{let n=Math.max(0,Math.min(t,e.length)),r=n;for(;r>0&&!/\s/.test(e[r-1]);)--r;return r>=2&&e[r-1]===Le&&e[r-2]===`/`&&(r-=2),e[r]===`/`?{start:r,end:n}:null},ze=`text-[10px] leading-none uppercase font-bold tracking-tight px-1.5 py-1 rounded border flex-shrink-0`,Be=M(ze,`bg-[color-mix(in_srgb,var(--primary-base)_12%,transparent)] text-[color-mix(in_srgb,var(--primary-base)_70%,transparent)] border-[color-mix(in_srgb,var(--primary-base)_24%,transparent)]`),Ve=M(ze,`bg-[color-mix(in_srgb,var(--status-success)_12%,transparent)] text-[color-mix(in_srgb,var(--status-success)_70%,transparent)] border-[color-mix(in_srgb,var(--status-success)_24%,transparent)]`),He=M(ze,`bg-[color-mix(in_srgb,var(--status-info)_12%,transparent)] text-[color-mix(in_srgb,var(--status-info)_70%,transparent)] border-[color-mix(in_srgb,var(--status-info)_24%,transparent)]`),Ue=M(ze,`bg-[var(--surface-muted)] text-muted-foreground border-[var(--interactive-border)]/60`),We=(e,t)=>e.length===t.length&&e.every((e,n)=>e.id===t[n]?.id),Ge=(e,t)=>{let n=!!e.sessionID;return{hasSession:n,canStartSessionCommand:n||e.hasNewDraft,canUseReviewHandoffFlow:n&&!t&&!s()}},Ke=V.forwardRef(({searchQuery:e,onCommandSelect:t,onClose:n,directory:r,style:i,commandPolicy:a,commandContext:o,onRowsChange:s},c)=>{let{t:l}=te(),u=ee(e=>e.isMobile),d=C(e=>e.currentSessionId),f=C(e=>!!e.newSessionDraft?.open),p=C(V.useCallback(e=>d?e.getDirectoryForSession(d):void 0,[d])),m=E(d??``,p??void 0),h=V.useMemo(()=>o??{sessionID:d??null,hasMessages:m.length>0,hasNewDraft:f},[o,d,m.length,f]),{hasSession:g,canStartSessionCommand:_,canUseReviewHandoffFlow:v}=V.useMemo(()=>Ge(h,u),[h,u]),y=h.hasMessages,[b,x]=V.useState([]),[S,ne]=V.useState(!1),re=ce({directory:r}),ie=V.useMemo(()=>re.data??[],[re.data]),ae=re.isFetching,se=oe({directory:r}),w=V.useMemo(()=>se.data??[],[se.data]),[T,D]=V.useState(0),O=V.useRef(0),k=V.useRef(!1),le=V.useRef([]),A=V.useRef(null),j=V.useRef(!1),P=V.useRef(null),F=V.useRef(!1),I=V.useRef(null);V.useEffect(()=>{let e=e=>{let t=e.target;!t||!A.current||A.current.contains(t)||n()};return document.addEventListener(`pointerdown`,e,!0),()=>{document.removeEventListener(`pointerdown`,e,!0)}},[n]),V.useEffect(()=>{(async()=>{ne(ae);try{let t=ie.map((e,t)=>({id:`opencode:${e.scope??`global`}:${e.name}:${e.agent??``}:${e.model??``}:${t}`,name:e.name,source:`opencode`,description:e.description,agent:e.agent??void 0,model:e.model??void 0,isBuiltIn:e.isBuiltIn,isSkill:e.source===`skill`,scope:e.scope,reference:e.reference})),n=w.map((e,t)=>({id:`skill:${e.scope}:${e.source??`opencode`}:${e.name}:${t}`,name:e.name,source:`skill`,description:e.description,isSkill:!0,scope:e.scope})),r=[{id:`openchamber:new`,name:`new`,source:`openchamber`,description:l(`chat.commandAutocomplete.command.newDescription`),isBuiltIn:!0},...g&&!y?[{id:`openchamber:init`,name:`init`,source:`openchamber`,description:l(`chat.commandAutocomplete.command.initDescription`),isBuiltIn:!0}]:[],...g?[{id:`openchamber:undo`,name:`undo`,source:`openchamber`,description:l(`chat.commandAutocomplete.command.undoDescription`),isBuiltIn:!0},{id:`openchamber:redo`,name:`redo`,source:`openchamber`,description:l(`chat.commandAutocomplete.command.redoDescription`),isBuiltIn:!0},{id:`openchamber:fork`,name:`fork`,source:`openchamber`,description:l(`chat.commandAutocomplete.command.forkDescription`),isBuiltIn:!0},{id:`openchamber:timeline`,name:`timeline`,source:`openchamber`,description:l(`chat.commandAutocomplete.command.timelineDescription`),isBuiltIn:!0}]:[],{id:`openchamber:model`,name:`model`,source:`openchamber`,description:l(`chat.commandAutocomplete.command.modelDescription`),isBuiltIn:!0},{id:`openchamber:compact`,name:`compact`,source:`openchamber`,description:l(`chat.commandAutocomplete.command.compactDescription`),isBuiltIn:!0},...g?[{id:`openchamber:summary`,name:`summary`,source:`openchamber`,description:l(`chat.commandAutocomplete.command.summaryDescription`),isOpenChamber:!0}]:[],..._?[{id:`openchamber:workspace-review`,name:`workspace-review`,source:`openchamber`,description:l(`chat.commandAutocomplete.command.workspaceReviewDescription`),isOpenChamber:!0}]:[],...v?[{id:`openchamber:handoff-review`,name:`handoff-review`,source:`openchamber`,description:l(`chat.commandAutocomplete.command.handoffReviewDescription`),isOpenChamber:!0}]:[],..._?[{id:`openchamber:craft-goal`,name:`craft-goal`,source:`openchamber`,description:l(`chat.commandAutocomplete.command.craftGoalDescription`),isOpenChamber:!0}]:[],..._?[{id:`openchamber:goal`,name:`goal`,source:`openchamber`,description:l(`chat.goal.button.armAria`),isBuiltIn:!0}]:[],..._?[{id:`openchamber:catch-up`,name:`catch-up`,source:`openchamber`,description:l(`chat.commandAutocomplete.command.catchUpDescription`),isOpenChamber:!0}]:[],..._?[{id:`openchamber:debug`,name:`debug`,source:`openchamber`,description:l(`chat.commandAutocomplete.command.debugDescription`),isOpenChamber:!0}]:[],..._?[{id:`openchamber:weigh`,name:`weigh`,source:`openchamber`,description:l(`chat.commandAutocomplete.command.weighDescription`),isOpenChamber:!0}]:[],..._?[{id:`openchamber:explore`,name:`explore`,source:`openchamber`,description:l(`chat.commandAutocomplete.command.exploreDescription`),isOpenChamber:!0}]:[],...t,...n],i=!y,o=be(r.filter(e=>(i||e.name!==`init`)&&(a?.(e)??!0)),e);x(e=>We(e,o)?e:o)}catch{let t=!y,n=be([{id:`openchamber:new`,name:`new`,source:`openchamber`,description:l(`chat.commandAutocomplete.command.newDescription`),isBuiltIn:!0},...g&&!y?[{id:`openchamber:init`,name:`init`,source:`openchamber`,description:l(`chat.commandAutocomplete.command.initDescription`),isBuiltIn:!0}]:[],...g?[{id:`openchamber:undo`,name:`undo`,source:`openchamber`,description:l(`chat.commandAutocomplete.command.undoDescription`),isBuiltIn:!0},{id:`openchamber:redo`,name:`redo`,source:`openchamber`,description:l(`chat.commandAutocomplete.command.redoDescription`),isBuiltIn:!0},{id:`openchamber:fork`,name:`fork`,source:`openchamber`,description:l(`chat.commandAutocomplete.command.forkDescription`),isBuiltIn:!0},{id:`openchamber:timeline`,name:`timeline`,source:`openchamber`,description:l(`chat.commandAutocomplete.command.timelineDescription`),isBuiltIn:!0}]:[],{id:`openchamber:model`,name:`model`,source:`openchamber`,description:l(`chat.commandAutocomplete.command.modelDescription`),isBuiltIn:!0},{id:`openchamber:compact`,name:`compact`,source:`openchamber`,description:l(`chat.commandAutocomplete.command.compactDescription`),isBuiltIn:!0},...g?[{id:`openchamber:summary`,name:`summary`,source:`openchamber`,description:l(`chat.commandAutocomplete.command.summaryDescription`),isOpenChamber:!0}]:[],..._?[{id:`openchamber:workspace-review`,name:`workspace-review`,source:`openchamber`,description:l(`chat.commandAutocomplete.command.workspaceReviewDescription`),isOpenChamber:!0}]:[],...v?[{id:`openchamber:handoff-review`,name:`handoff-review`,source:`openchamber`,description:l(`chat.commandAutocomplete.command.handoffReviewDescription`),isOpenChamber:!0}]:[],..._?[{id:`openchamber:craft-goal`,name:`craft-goal`,source:`openchamber`,description:l(`chat.commandAutocomplete.command.craftGoalDescription`),isOpenChamber:!0}]:[],..._?[{id:`openchamber:goal`,name:`goal`,source:`openchamber`,description:l(`chat.goal.button.armAria`),isBuiltIn:!0}]:[],..._?[{id:`openchamber:catch-up`,name:`catch-up`,source:`openchamber`,description:l(`chat.commandAutocomplete.command.catchUpDescription`),isOpenChamber:!0}]:[],..._?[{id:`openchamber:debug`,name:`debug`,source:`openchamber`,description:l(`chat.commandAutocomplete.command.debugDescription`),isOpenChamber:!0}]:[],..._?[{id:`openchamber:weigh`,name:`weigh`,source:`openchamber`,description:l(`chat.commandAutocomplete.command.weighDescription`),isOpenChamber:!0}]:[],..._?[{id:`openchamber:explore`,name:`explore`,source:`openchamber`,description:l(`chat.commandAutocomplete.command.exploreDescription`),isOpenChamber:!0}]:[]].filter(e=>(t||e.name!==`init`)&&(a?.(e)??!0)),e);x(e=>We(e,n)?e:n)}finally{ne(!1)}})()},[e,y,g,_,v,ie,ae,w,l,a]),V.useEffect(()=>{D(0)},[b]),V.useEffect(()=>{O.current=T},[T]),V.useEffect(()=>{le.current[T]?.scrollIntoView({block:`nearest`})},[T]),V.useEffect(()=>{we(s,I,{rows:_e(b,{skill:l(`chat.commandAutocomplete.badge.skill`),command:l(`chat.commandAutocomplete.badge.command`),system:l(`chat.commandAutocomplete.badge.system`)}),highlightedIndex:T})},[b,s,T,l]);let L=V.useRef(s);L.current=s,V.useEffect(()=>()=>{Te(L.current,I)},[]),V.useImperativeHandle(c,()=>({acceptIndex:(e,n=!0)=>{let r=b[e];r&&t(r,Fe(r,n))},handleKeyDown:e=>{let r=b.length;if(e===`Escape`){n();return}if(r!==0){if(e===`ArrowDown`){k.current=!0,D(e=>(e+1)%r);return}if(e===`ArrowUp`){k.current=!0,D(e=>(e-1+r)%r);return}if(e===`Enter`||e===`Tab`){let n=(O.current%r+r)%r,i=b[n];i&&t(i,Fe(i,e===`Enter`))}}}}),[b,n,t]);let ue=e=>{let t=R(e);switch(e.name){case`new`:return(0,Z.jsx)(N,{name:t,className:`h-3.5 w-3.5`});case`init`:return(0,Z.jsx)(N,{name:t,className:`h-3.5 w-3.5 text-green-500`});case`undo`:return(0,Z.jsx)(N,{name:t,className:`h-3.5 w-3.5 text-orange-500`});case`redo`:return(0,Z.jsx)(N,{name:t,className:`h-3.5 w-3.5 text-orange-500`});case`timeline`:return(0,Z.jsx)(N,{name:t,className:`h-3.5 w-3.5`});case`compact`:return(0,Z.jsx)(N,{name:t,className:`h-3.5 w-3.5 text-purple-500`});case`goal`:return(0,Z.jsx)(N,{name:t,className:`h-3.5 w-3.5`});case`review`:return(0,Z.jsx)(N,{name:t,className:`h-3.5 w-3.5 text-blue-500`});case`test`:case`build`:case`run`:return(0,Z.jsx)(N,{name:t,className:`h-3.5 w-3.5 text-cyan-500`});default:return e.isBuiltIn?(0,Z.jsx)(N,{name:t,className:`h-3.5 w-3.5 text-yellow-500`}):(0,Z.jsx)(N,{name:t,className:`h-3.5 w-3.5 text-muted-foreground`})}};return(0,Z.jsxs)(de,{ref:A,isMobile:u,className:`max-w-[450px] max-h-64`,style:i,children:[(0,Z.jsx)(me,{preventOverscroll:!0,outerClassName:`flex-1 min-h-0`,className:`px-0 pb-2`,children:S?(0,Z.jsx)(`div`,{className:`flex items-center justify-center py-4`,children:(0,Z.jsx)(N,{name:`refresh`,className:`h-4 w-4 animate-spin text-muted-foreground`})}):(0,Z.jsxs)(`div`,{children:[b.map((e,n)=>{let r=e.isBuiltIn,i=e.isOpenChamber;return(0,Z.jsxs)(`div`,{ref:e=>{le.current[n]=e},className:M(`flex gap-2 px-3 py-2 cursor-pointer rounded-lg`,u?`items-center`:`items-start`,fe(u,n===T)),onMouseDown:e=>e.preventDefault(),onPointerDown:e=>{e.pointerType===`touch`&&(P.current={x:e.clientX,y:e.clientY},F.current=!1)},onPointerMove:e=>{if(e.pointerType!==`touch`||!P.current)return;let t=e.clientX-P.current.x,n=e.clientY-P.current.y;Math.hypot(t,n)>6&&(F.current=!0)},onPointerUp:n=>{if(n.pointerType!==`touch`)return;let r=F.current;P.current=null,F.current=!1,!r&&(n.preventDefault(),n.stopPropagation(),j.current=!0,t(e,Fe(e,u)))},onPointerCancel:()=>{P.current=null,F.current=!1},onClick:()=>{if(j.current){j.current=!1;return}t(e,Fe(e,u))},onMouseMove:()=>{k.current=!1,D(n)},children:[(0,Z.jsx)(`div`,{className:M(!u&&`mt-0.5`),children:ue(e)}),(0,Z.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsxs)(`span`,{className:`typography-ui-label font-medium`,children:[`/`,e.name]}),e.isSkill?(0,Z.jsx)(`span`,{className:Be,children:l(`chat.commandAutocomplete.badge.skill`)}):(0,Z.jsx)(`span`,{className:Be,children:l(`chat.commandAutocomplete.badge.command`)}),i?(0,Z.jsx)(`span`,{className:Ue,children:`OpenChamber`}):r?(0,Z.jsx)(`span`,{className:Ue,children:l(`chat.commandAutocomplete.badge.system`)}):e.scope?(0,Z.jsx)(`span`,{className:e.scope===`project`?He:Ve,children:e.scope}):null,e.agent&&(0,Z.jsx)(`span`,{className:Ue,children:e.agent})]}),e.description&&!u&&(0,Z.jsx)(`div`,{className:`typography-meta text-muted-foreground mt-0.5 truncate`,children:e.description})]})]},e.id)}),b.length===0&&(0,Z.jsx)(`div`,{className:`px-3 py-2 typography-ui-label text-muted-foreground`,children:l(`chat.commandAutocomplete.empty`)})]})}),!u&&(0,Z.jsx)(`div`,{className:`px-3 pt-1 pb-1.5 border-t typography-meta text-muted-foreground`,children:l(`chat.autocomplete.keyboardHint`)})]})});Ke.displayName=`CommandAutocomplete`;function qe(e){return(e.description||e.content).replace(/\s+/g,` `).trim().slice(0,120)}var Je=V.forwardRef((e,t)=>{let n=(0,J.c)(62),{searchQuery:r,onSnippetSelect:i,onClose:a,style:o}=e,{t:s}=te(),c=V.useRef(null),l=ee(Ye),[u,d]=V.useState(0),f=V.useRef(0),p;n[0]===Symbol.for(`react.memo_cache_sentinel`)?(p=[],n[0]=p):p=n[0];let[m,h]=V.useState(p),g;n[1]===Symbol.for(`react.memo_cache_sentinel`)?(g=[],n[1]=g):g=n[1];let _=V.useRef(g),v=ue(Xe),y=ue(Ze),b=ue(Qe),x=ue($e),S=ee(et),ne=ee(tt),C,re;n[2]===y?(C=n[3],re=n[4]):(C=()=>{y()},re=[y],n[2]=y,n[3]=C,n[4]=re),V.useEffect(C,re);let ie,ae;n[5]!==r||n[6]!==v?(ie=()=>{let e=r.trim();if(!e.length){let e=[...v].sort(nt);h(e),d(+!!e.length);return}let t=se(v,e,rt);t.sort(it);let n=t.map(at);h(n),d(+!!n.length)},ae=[r,v],n[5]=r,n[6]=v,n[7]=ie,n[8]=ae):(ie=n[7],ae=n[8]),V.useEffect(ie,ae);let oe,w;n[9]===u?(oe=n[10],w=n[11]):(oe=()=>{f.current=u,_.current[u]?.scrollIntoView({block:`nearest`})},w=[u],n[9]=u,n[10]=oe,n[11]=w),V.useEffect(oe,w);let T,ce;n[12]===a?(T=n[13],ce=n[14]):(ce=()=>{let e=e=>{let t=e.target;t&&c.current&&!c.current.contains(t)&&a()};return document.addEventListener(`pointerdown`,e,!0),()=>document.removeEventListener(`pointerdown`,e,!0)},T=[a],n[12]=a,n[13]=T,n[14]=ce),V.useEffect(ce,T);let E;n[15]!==i||n[16]!==r?(E=e=>{let t=r.trim(),n=e.aliases.includes(t)?t:e.name;i(e,n)},n[15]=i,n[16]=r,n[17]=E):E=n[17];let D=E,O;n[18]!==a||n[19]!==x||n[20]!==S||n[21]!==ne||n[22]!==b||n[23]!==v?(O=()=>{let e=new Set(v.map(ot)),t=`new-snippet`,n=1;for(;e.has(t);)t=`new-snippet-${n++}`;b({name:t,scope:`global`}),x(t),ne(`snippets`),S(!0),a()},n[18]=a,n[19]=x,n[20]=S,n[21]=ne,n[22]=b,n[23]=v,n[24]=O):O=n[24];let k=O,le,A;n[25]!==D||n[26]!==m||n[27]!==a||n[28]!==k?(le=()=>({handleKeyDown:e=>{if(e===`Escape`){a();return}let t=m.length+1;if(e===`ArrowDown`){d(e=>(e+1)%t);return}if(e===`ArrowUp`){d(e=>(e-1+t)%t);return}if(e===`Enter`||e===`Tab`){if(f.current===0){k();return}let e=m[f.current-1];e&&D(e)}}}),A=[D,m,a,k],n[25]=D,n[26]=m,n[27]=a,n[28]=k,n[29]=le,n[30]=A):(le=n[29],A=n[30]),V.useImperativeHandle(t,le,A);let j;n[31]===Symbol.for(`react.memo_cache_sentinel`)?(j=e=>{_.current[0]=e},n[31]=j):j=n[31];let P;n[32]!==l||n[33]!==u?(P=M(`flex items-center gap-2 px-3 py-1.5 cursor-pointer rounded-lg typography-ui-label`,fe(l,u===0)),n[32]=l,n[33]=u,n[34]=P):P=n[34];let F,I;n[35]===Symbol.for(`react.memo_cache_sentinel`)?(F=()=>d(0),I=(0,Z.jsx)(N,{name:`add`,className:`h-3.5 w-3.5 text-muted-foreground`}),n[35]=F,n[36]=I):(F=n[35],I=n[36]);let L;n[37]===s?L=n[38]:(L=s(`chat.snippetAutocomplete.action.addNew`),n[37]=s,n[38]=L);let pe;n[39]===L?pe=n[40]:(pe=(0,Z.jsx)(`span`,{className:`font-medium text-foreground`,children:L}),n[39]=L,n[40]=pe);let R;n[41]!==k||n[42]!==P||n[43]!==pe?(R=(0,Z.jsxs)(`div`,{ref:j,className:P,onClick:k,onMouseMove:F,children:[I,pe]}),n[41]=k,n[42]=P,n[43]=pe,n[44]=R):R=n[44];let he;n[45]!==D||n[46]!==m||n[47]!==l||n[48]!==u||n[49]!==s?(he=m.length?m.map((e,t)=>(0,Z.jsx)(`div`,{ref:e=>{_.current[t+1]=e},className:M(`flex gap-2 px-3 py-1.5 cursor-pointer rounded-lg typography-ui-label`,l?`items-center`:`items-start`,fe(l,t+1===u)),onClick:()=>D(e),onMouseMove:()=>d(t+1),children:(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsxs)(`span`,{className:`font-semibold truncate`,children:[`#`,e.name]}),(0,Z.jsx)(`span`,{className:`text-[10px] leading-none uppercase font-bold tracking-tight px-1.5 py-1 rounded border flex-shrink-0 bg-[var(--surface-muted)] text-muted-foreground border-[var(--interactive-border)]/60`,children:s(`snippets.source.${e.source}`)})]}),!l&&(0,Z.jsx)(`div`,{className:`typography-meta text-muted-foreground mt-0.5 truncate`,children:qe(e)})]})},`${e.source}:${e.filePath}`)):(0,Z.jsx)(`div`,{className:`px-3 py-2 typography-ui-label text-muted-foreground`,children:s(`chat.snippetAutocomplete.empty`)}),n[45]=D,n[46]=m,n[47]=l,n[48]=u,n[49]=s,n[50]=he):he=n[50];let z;n[51]!==R||n[52]!==he?(z=(0,Z.jsxs)(me,{preventOverscroll:!0,outerClassName:`flex-1 min-h-0`,className:`px-0 pb-2`,children:[R,he]}),n[51]=R,n[52]=he,n[53]=z):z=n[53];let B;n[54]!==l||n[55]!==s?(B=!l&&(0,Z.jsx)(`div`,{className:`px-3 pt-1 pb-1.5 border-t typography-meta text-muted-foreground`,children:s(`chat.snippetAutocomplete.footer`)}),n[54]=l,n[55]=s,n[56]=B):B=n[56];let ge;return n[57]!==l||n[58]!==o||n[59]!==z||n[60]!==B?(ge=(0,Z.jsxs)(de,{ref:c,isMobile:l,className:`max-w-[450px] max-h-60`,style:o,children:[z,B]}),n[57]=l,n[58]=o,n[59]=z,n[60]=B,n[61]=ge):ge=n[61],ge});Je.displayName=`SnippetAutocomplete`;function Ye(e){return e.isMobile}function Xe(e){return e.snippets}function Ze(e){return e.loadSnippets}function Qe(e){return e.setSnippetDraft}function $e(e){return e.setSelectedSnippet}function et(e){return e.setSettingsDialogOpen}function tt(e){return e.setSettingsPage}function nt(e,t){return e.source===`project`&&t.source!==`project`?-1:e.source!==`project`&&t.source===`project`?1:e.name.localeCompare(t.name)}function rt(e){return[e.name,...e.aliases]}function it(e,t){return e.score===t.score?e.item.source===`project`&&t.item.source!==`project`?-1:e.item.source!==`project`&&t.item.source===`project`?1:e.item.name.localeCompare(t.item.name):e.score-t.score}function at(e){return e.item}function ot(e){return e.name}var st=2,ct=e=>!!e&&typeof e==`object`&&!Array.isArray(e),lt=e=>{let t=e?.trim().replace(/\\/g,`/`);return t?t.length>1?t.replace(/\/+$/,``):t:null},ut=e=>ct(e)&&Array.isArray(e.all)&&e.all.every(e=>typeof e==`string`)&&typeof e.current==`string`&&ct(e.branches),dt=(e,t)=>JSON.stringify([e,t]),ft=e=>`version`in e&&e.version===st&&ct(e.entries),pt=e=>{if(!e)return null;try{let t=JSON.parse(e);return ct(t)?t.version===st&&ct(t.entries)?{version:st,entries:t.entries}:t:null}catch{return null}},mt=(e,t)=>{try{e.setItem(`oc.gitBranchCache`,JSON.stringify(t))}catch{}},ht=(e,t,n)=>{let r=lt(e);if(!r||!t)return null;let i;try{i=n.getItem(`oc.gitBranchCache`)}catch{return null}let a=pt(i);if(!a)return null;if(ft(a))return ut(a.entries[dt(t,r)])?a.entries[dt(t,r)]:null;let o={};for(let[e,n]of Object.entries(a)){let r=lt(e);r&&ut(n)&&(o[dt(t,r)]=n)}return mt(n,{version:st,entries:o}),o[dt(t,r)]??null},gt=(e,t,n,r)=>{let i=lt(e);if(!i||!t||!ut(n))return;let a=null;try{a=r.getItem(`oc.gitBranchCache`)}catch{return}let o=pt(a);mt(r,{version:st,entries:{...o&&ft(o)?o.entries:{},[dt(t,i)]:n}})},_t=3e4,vt=lt,yt=(e,t=n())=>a.git.branches(vt(e),t),bt=(e,t=n())=>a.git.remotes(vt(e),t),xt=async(e,t,n)=>{n.throwIfAborted();let i=r()?.git,a=t?.getGitBranches?await t.getGitBranches(e,{signal:n}):i?await i.getGitBranches(e,{signal:n}):await g(e,{signal:n});return n.throwIfAborted(),a},St=async(e,t,n)=>{n.throwIfAborted();let i=r()?.git,a=t?.getRemotes?await t.getRemotes(e,{signal:n}):i?await i.getRemotes(e,{signal:n}):await m(e,{signal:n});return n.throwIfAborted(),a},Ct=(e,t,r=n(),i=v())=>{let a=vt(e),o=t;return{queryKey:yt(a,r),queryFn:async({signal:e})=>{if(!a)throw Error(`Git branches require a directory`);let t=await xt(a,o,e);return gt(a,r,t,i),t},staleTime:_t,gcTime:1/0,initialData:()=>ht(a,r,i)??void 0,initialDataUpdatedAt:0}},wt=(e,t,r=n())=>{let i=vt(e),a=t;return{queryKey:bt(i,r),queryFn:({signal:e})=>{if(!i)throw Error(`Git remotes require a directory`);return St(i,a,e)},staleTime:_t,gcTime:1/0}},Tt=(e,r,i)=>{let a=(0,J.c)(9),o=i===void 0||i,s=V.useSyncExternalStore(t,n,n),c,l,u;a[0]!==e||a[1]!==r||a[2]!==s?(c=vt(e),u=x,l=Ct(c,r,s),a[0]=e,a[1]=r,a[2]=s,a[3]=c,a[4]=l,a[5]=u):(c=a[3],l=a[4],u=a[5]);let d=o&&!!c,f;return a[6]!==l||a[7]!==d?(f={...l,enabled:d},a[6]=l,a[7]=d,a[8]=f):f=a[8],u(f)},Et=(e,r,i)=>{let a=(0,J.c)(9),o=i===void 0||i,s=V.useSyncExternalStore(t,n,n),c,l,u;a[0]!==e||a[1]!==r||a[2]!==s?(c=vt(e),u=x,l=wt(c,r,s),a[0]=e,a[1]=r,a[2]=s,a[3]=c,a[4]=l,a[5]=u):(c=a[3],l=a[4],u=a[5]);let d=o&&!!c,f;return a[6]!==l||a[7]!==d?(f={...l,enabled:d},a[6]=l,a[7]=d,a[8]=f):f=a[8],u(f)},Dt=(e,t,r=c,i=n())=>r.fetchQuery(Ct(e,t,i)),Ot=(e,t,r=c,i=n())=>r.fetchQuery({...Ct(e,t,i),staleTime:0}),kt=e=>e instanceof Error?e.name===`AbortError`||e.name===`CancelledError`||e.name===`Error`&&e.message===`CancelledError`:!1,At=1e4,jt=6e4,Mt=5e3,Nt=3e4,Pt=6e4,Ft=25,It=40,Lt=2,Rt=15e3,zt=500,Bt=30,Vt=20971520,Ht=new Map,Ut=new Map,Wt=new Map,Gt=new Map,Kt=new Map,qt=(e,t)=>`${t}:${e}`,Jt=e=>Ut.get(e)??0,Yt=e=>{let t=Jt(e)+1;return Ut.set(e,t),t},Xt=e=>{let t=(Wt.get(e)??0)+1;return Wt.set(e,t),t},Zt=e=>{let t=Ht.get(e);if(t)return t;let n=new Set;return Ht.set(e,n),n},Q=()=>({isGitRepo:null,status:null,branches:null,branchesTransportIdentity:null,log:null,identity:null,diffCache:new Map,indexRevision:0,lastRepoCheckAt:0,lastStatusFetch:0,lastStatusChange:0,lastLogFetch:0,lastBranchesFetch:0,lastIdentityFetch:0,logMaxCount:25,isLoadingStatus:!1,isLoadingLog:!1,isLoadingBranches:!1,isLoadingIdentity:!1}),Qt=(e,t=Bt,n=Vt)=>{let r=0;for(let t of e.values())r+=(t.original?.length??0)+(t.modified?.length??0);if(e.size<=t&&r<=n)return e;let i=Array.from(e.entries()).sort((e,t)=>e[1].fetchedAt-t[1].fetchedAt),a=new Map,o=0;for(let e=i.length-1;e>=0;e--){let[r,s]=i[e],c=(s.original?.length??0)+(s.modified?.length??0);if(a.size>=t)break;o+c>n&&a.size>0||(a.set(r,s),o+=c)}return a},$t=(e,t)=>{if(!e&&!t)return!1;if(!e||!t)return!0;let n=new Set([...Object.keys(e),...Object.keys(t)]);for(let r of n){let n=e[r],i=t[r];if(!(!n&&!i)&&(!n||!i||n.insertions!==i.insertions||n.deletions!==i.deletions))return!0}return!1},en=(e,t)=>!e&&!t?!1:!e||!t||e.remote!==t.remote||e.branch!==t.branch||e.ahead!==t.ahead||e.behind!==t.behind,tn=(e,t)=>{if(!e&&!t)return!1;if(!e||!t)return!0;let n=e.files??[],r=t.files??[];if(n.length!==r.length||e.ahead!==t.ahead||e.behind!==t.behind||e.current!==t.current||e.tracking!==t.tracking||e.isClean!==t.isClean||t.upstreamComparison!==void 0&&en(e.upstreamComparison,t.upstreamComparison))return!0;let i=new Set(n.map(e=>`${e.path}:${e.index}:${e.working_dir}`));for(let e of r)if(!i.has(`${e.path}:${e.index}:${e.working_dir}`))return!0;return!!(t.diffStats!==void 0&&$t(e.diffStats,t.diffStats))},nn=(e,t)=>{let n=new Set;if(!t)return n;let r=e?.files??[],i=t.files??[],a=new Map(r.map(e=>[e.path,e])),o=new Map(i.map(e=>[e.path,e])),s=new Set([...a.keys(),...o.keys()]);for(let e of s){let t=a.get(e),r=o.get(e);if(!t||!r){n.add(e);continue}if(t.index!==r.index||t.working_dir!==r.working_dir){n.add(e);continue}}if(t.diffStats!==void 0){let r=e?.diffStats??{},i=t.diffStats??{},a=new Set([...Object.keys(r),...Object.keys(i)]);for(let e of a){let t=r[e],a=i[e];if(!t||!a){n.add(e);continue}(t.insertions!==a.insertions||t.deletions!==a.deletions)&&n.add(e)}}return n},rn=(e,t)=>{if(!e&&!t)return!1;if(!e||!t)return!0;let n=e.files??[],r=t.files??[],i=e=>{let t=e?.trim()??``;return t===`?`?``:t},a=new Map(n.map(e=>[e.path,i(e.index)])),o=new Map(r.map(e=>[e.path,i(e.index)])),s=new Set([...a.keys(),...o.keys()]);for(let e of s)if((a.get(e)??``)!==(o.get(e)??``))return!0;return!1},an=e=>!e||e.trim().length===0,on=e=>(e||``).trim()===`U`,sn=e=>{let t=(e.index||``).trim(),n=(e.working_dir||``).trim();if(on(t)||on(n))return e;let r=t===`?`||n===`?`?`A`:t||n||` `;return{...e,index:r,working_dir:` `}},cn=e=>{let t=(e.index||``).trim(),n=(e.working_dir||``).trim();if(on(t)||on(n))return e;let r=n||(t===`A`||t===`?`?`?`:t)||` `;return{...e,index:` `,working_dir:r}},ln=e=>an(e.index)&&an(e.working_dir),$=l()(d((e,t)=>({directories:new Map,activeDirectory:null,setActiveDirectory:n=>{let{activeDirectory:r,directories:i}=t();if(r!==n)if(r&&Yt(r),n&&Yt(n),n&&!i.has(n)){let t=new Map(i);t.set(n,Q()),e({activeDirectory:n,directories:t})}else e({activeDirectory:n})},getDirectoryState:e=>t().directories.get(e)??null,fetchStatus:async(n,r,i={})=>{let a=i.mode??`full`,o=qt(n,a),s=Gt.get(o)??(a===`light`?Gt.get(qt(n,`full`)):void 0);if(s)return s;let c=(async()=>{let{silent:a=!1}=i,{directories:o}=t(),s=o.get(n);if(s||=Q(),!a){let r=new Map(t().directories),i=r.get(n)??Q();r.set(n,{...i,isLoadingStatus:!0}),e({directories:r})}let c=!1;try{let a=Date.now(),o=s.isGitRepo!==!0||a-(s.lastRepoCheckAt||0)>jt,l=s.isGitRepo===!0;if(o&&(l=await r.checkIsGitRepository(n)),!l){let r=new Map(t().directories),i=r.get(n)??s;return r.set(n,{...i,isGitRepo:!1,status:null,isLoadingStatus:!1,lastRepoCheckAt:a,lastStatusFetch:a}),e({directories:r}),!1}let u=await r.getGitStatus(n,i.mode?{mode:i.mode}:void 0);if(tn(s.status,u)){c=!0;let r=new Map(t().directories),i=r.get(n)??Q(),s=nn(i.status,u),l=rn(i.status,u),d=new Set((i.status?.files??[]).map(e=>e.path)),f=new Set((u.files??[]).map(e=>e.path)),p=new Map(i.diffCache);for(let e of d)f.has(e)||p.delete(e);for(let e of s)p.delete(e);let m=s.size>0;m&&Yt(n);let h={...u,diffStats:u.diffStats===void 0&&i.status?.diffStats!==void 0?i.status.diffStats:u.diffStats,upstreamComparison:u.upstreamComparison===void 0?i.status?.upstreamComparison:u.upstreamComparison};r.set(n,{...i,isGitRepo:!0,status:h,diffCache:p,indexRevision:l?i.indexRevision+1:i.indexRevision,lastRepoCheckAt:o?a:i.lastRepoCheckAt,lastStatusFetch:Date.now(),lastStatusChange:m?Date.now():i.lastStatusChange}),e({directories:r})}else{let r=new Map(t().directories),i=r.get(n)??Q();r.set(n,{...i,isGitRepo:!0,lastRepoCheckAt:o?a:i.lastRepoCheckAt,lastStatusFetch:Date.now(),lastStatusChange:i.lastStatusChange}),e({directories:r})}}catch(e){console.error(`Failed to fetch git status:`,e)}finally{if(!a){let r=new Map(t().directories),i=r.get(n)??Q();r.set(n,{...i,isLoadingStatus:!1}),e({directories:r})}}return c})();Gt.set(o,c);try{return await c}finally{Gt.get(o)===c&&Gt.delete(o)}},moveStatusPathsOptimistically:(n,r,i)=>{let a=new Set(r.map(e=>e.trim()).filter(Boolean));if(a.size===0)return null;let{directories:o}=t(),s=o.get(n),c=s?.status??null;if(!s||!c)return c;let l=!1,u=[];for(let e of c.files){if(!a.has(e.path)){u.push(e);continue}let t=i===`stage`?sn(e):cn(e);t!==e&&(l=!0),ln(t)?l=!0:u.push(t)}if(!l)return c;let d=new Map(o);return d.set(n,{...s,status:{...c,files:u,isClean:u.length===0},indexRevision:s.indexRevision+1,lastStatusChange:Date.now()}),e({directories:d}),c},restoreStatus:(n,r)=>{let{directories:i}=t(),a=i.get(n);if(!a)return;let o=new Map(i);o.set(n,{...a,status:r,indexRevision:a.indexRevision+1,lastStatusChange:Date.now()}),e({directories:o})},bumpIndexRevision:n=>{let{directories:r}=t(),i=r.get(n);if(!i)return;let a=new Map(r);a.set(n,{...i,indexRevision:i.indexRevision+1}),e({directories:a})},fetchBranches:async(r,i,a={})=>{let o=n(),s=Xt(r);{let n=new Map(t().directories),i=n.get(r)??Q();n.set(r,{...i,isLoadingBranches:!0}),e({directories:n})}try{let c=a.force?await Ot(r,i,void 0,o):await Dt(r,i,void 0,o);if(s!==Wt.get(r)||o!==n())return;let l=new Map(t().directories),u=l.get(r)??Q();l.set(r,{...u,branches:c,branchesTransportIdentity:o,isLoadingBranches:!1,lastBranchesFetch:Date.now()}),e({directories:l})}catch(i){if(kt(i)||console.error(`Failed to fetch git branches:`,i),s!==Wt.get(r)||o!==n())return;let a=new Map(t().directories),c=a.get(r)??Q();a.set(r,{...c,isLoadingBranches:!1}),e({directories:a})}},fetchLog:async(n,r,i)=>{let{directories:a}=t(),o=a.get(n),s=i??o?.logMaxCount??25;{let r=new Map(t().directories),i=r.get(n)??Q();r.set(n,{...i,isLoadingLog:!0}),e({directories:r})}try{let i=await r.getGitLog(n,{maxCount:s}),a=new Map(t().directories),o=a.get(n)??Q();a.set(n,{...o,log:i,isLoadingLog:!1,lastLogFetch:Date.now(),logMaxCount:s}),e({directories:a})}catch(r){console.error(`Failed to fetch git log:`,r);let i=new Map(t().directories),a=i.get(n)??Q();i.set(n,{...a,isLoadingLog:!1}),e({directories:i})}},fetchIdentity:async(n,r)=>{{let r=new Map(t().directories),i=r.get(n)??Q();r.set(n,{...i,isLoadingIdentity:!0}),e({directories:r})}try{let i=await r.getCurrentGitIdentity(n),a=new Map(t().directories),o=a.get(n)??Q();a.set(n,{...o,identity:i,isLoadingIdentity:!1,lastIdentityFetch:Date.now()}),e({directories:a})}catch(r){console.error(`Failed to fetch git identity:`,r);let i=new Map(t().directories),a=i.get(n)??Q();i.set(n,{...a,isLoadingIdentity:!1}),e({directories:i})}},fetchAll:async(n,r,i={})=>{let{directories:a}=t(),o=a.get(n);if(!o){o=Q();let t=new Map(a);t.set(n,o),e({directories:t})}let{force:s=!1,silentIfCached:c=!1}=i,l=Date.now();await t().fetchStatus(n,r,{silent:c&&!!o?.status});let u=t().directories.get(n);if(!u?.isGitRepo)return;await t().fetchBranches(n,r,{force:s});let d=l-(u.lastLogFetch||0);(s||d>At||!u.log)&&await t().fetchLog(n,r),await t().fetchIdentity(n,r)},getDiff:(e,n)=>t().directories.get(e)?.diffCache.get(n)??null,setDiff:(n,r,i)=>{let a=new Map(t().directories),o=a.get(n)??Q(),s=new Map(o.diffCache);s.set(r,{...i,fetchedAt:Date.now()});let c=Qt(s);a.set(n,{...o,diffCache:c}),e({directories:a})},clearDiffCache:n=>{Yt(n);let r=new Map(t().directories),i=r.get(n);i&&(r.set(n,{...i,diffCache:new Map}),e({directories:r}))},fetchAllDiffs:async(e,n)=>{let r=t().directories.get(e);if(!r?.status?.files||r.status.files.length===0)return;let i=r.status.files.map(e=>e.path).slice(0,Ft);await t().prefetchDiffs(e,n,i,{maxFiles:Ft})},prefetchDiffs:async(n,r,i,a={})=>{let o=t().directories.get(n);if(!o?.status?.files||o.status.files.length===0||i.length===0)return;let{maxFiles:s=It}=a,c=new Set(o.status.files.map(e=>e.path)),l=o.status.diffStats,u=Zt(n),d=[],f=new Set;for(let e of i){if(!e||f.has(e)||(f.add(e),!c.has(e))||o.diffCache.has(e)||u.has(e))continue;let t=l?.[e];t&&t.insertions+t.deletions>zt||d.push(e)}let p=d.slice(0,Math.max(1,s));if(p.length===0)return;let m=Jt(n);if(typeof document<`u`&&document.hidden)return;p.forEach(e=>u.add(e));let h=0,g=[],_=()=>{let e=h;return h+=1,e<p.length?p[e]:null},v=async e=>{let t=r.getGitFileDiff(n,{path:e}),i=new Promise((e,t)=>{setTimeout(()=>t(Error(`Timed out after ${Rt}ms`)),Rt)}),a=await Promise.race([t,i]);return{path:e,diff:{original:a.original??``,modified:a.modified??``,isBinary:a.isBinary}}},ee=async()=>{for(;;){if(m!==Jt(n))return;let e=_();if(!e)return;try{g.push(await v(e))}catch{}finally{u.delete(e)}}},y=Math.min(Lt,p.length);if(await Promise.allSettled(Array.from({length:y},()=>ee())),p.forEach(e=>u.delete(e)),m!==Jt(n))return;let b=new Map(t().directories),x=b.get(n);if(!x)return;let S=new Map(x.diffCache),te=Date.now();g.forEach(e=>{!e.diff.isBinary&&e.diff.original===``&&e.diff.modified===``||S.set(e.path,{...e.diff,fetchedAt:te})});let ne=Qt(S);b.set(n,{...x,diffCache:ne}),e({directories:b})},setLogMaxCount:(n,r)=>{let i=new Map(t().directories),a=i.get(n)??Q();i.set(n,{...a,logMaxCount:r}),e({directories:i})},ensureStatus:async(e,n)=>{let r=t().directories.get(e),i=Date.now();r?.status&&i-r.lastStatusFetch<Mt||await t().fetchStatus(e,n,{silent:!!r?.status})},ensureAll:(e,n)=>{let r=Kt.get(e);if(r)return r;let i=(async()=>{let r=t().directories.get(e),i=Date.now();(!r?.status||r.status.diffStats===void 0||i-(r?.lastStatusFetch??0)>=Mt)&&await t().fetchStatus(e,n,{silent:!!r?.status});let a=t().directories.get(e);if(!a?.isGitRepo)return;let o=[];(!a.branches||i-a.lastBranchesFetch>=Nt)&&o.push(t().fetchBranches(e,n)),(!a.log||i-a.lastLogFetch>=At)&&o.push(t().fetchLog(e,n)),(!a.identity||i-a.lastIdentityFetch>=Pt)&&o.push(t().fetchIdentity(e,n)),o.length>0&&await Promise.all(o)})();return Kt.set(e,i),i.finally(()=>{Kt.get(e)===i&&Kt.delete(e)}),i},refresh:async(e,n={})=>{let{activeDirectory:r}=t();r&&await t().fetchAll(r,e,n)}}),{name:`git-store`})),un=e=>{let t=(0,J.c)(2),n;return t[0]===e?n=t[1]:(n=t=>e?t.directories.get(e)?.status??null:null,t[0]=e,t[1]=n),$(n)},dn=e=>{let r=(0,J.c)(3),i=V.useSyncExternalStore(t,n,n),a;return r[0]!==e||r[1]!==i?(a=t=>{if(!e)return null;let n=t.directories.get(e);return n?.branchesTransportIdentity===i?n.branches:null},r[0]=e,r[1]=i,r[2]=a):a=r[2],$(a)},fn=e=>{let t=(0,J.c)(2),n;return t[0]===e?n=t[1]:(n=t=>e?t.directories.get(e)?.log??null:null,t[0]=e,t[1]=n),$(n)},pn=e=>{let t=(0,J.c)(2),n;return t[0]===e?n=t[1]:(n=t=>e?t.directories.get(e)?.isGitRepo??null:null,t[0]=e,t[1]=n),$(n)},mn=e=>{let t=(0,J.c)(2),n;return t[0]===e?n=t[1]:(n=t=>e?t.directories.get(e)?.status?.current?.trim()??null:null,t[0]=e,t[1]=n),$(n)},hn={current:new Map},gn=()=>$(xn),_n=e=>{let t=(0,J.c)(3),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=new Map,t[0]=n):n=t[0];let r=V.useRef(n),i;return t[1]===e?i=t[2]:(i=t=>{let n=r.current,i=n.size===e.length;if(i)for(let r of e){let e=t.directories.get(r),a=n.get(r);if(!a||(e?.isGitRepo??null)!==a.isGitRepo||(e?.status?.current??null)!==a.branch){i=!1;break}}if(i)return n;let a=new Map;for(let n of e){let e=t.directories.get(n);a.set(n,{isGitRepo:e?.isGitRepo??null,branch:e?.status?.current??null})}return r.current=a,a},t[1]=e,t[2]=i),$(i)},vn=e=>{let t=(0,J.c)(2),n;return t[0]===e?n=t[1]:(n=t=>e?t.directories.get(e)?.isLoadingStatus??!1:!1,t[0]=e,t[1]=n),$(n)},yn=e=>{let t=(0,J.c)(2),n;return t[0]===e?n=t[1]:(n=t=>e?t.directories.get(e)?.isLoadingLog??!1:!1,t[0]=e,t[1]=n),$(n)},bn=e=>{let t=(0,J.c)(2),n;return t[0]===e?n=t[1]:(n=t=>e?t.directories.get(e)?.isLoadingBranches??!1:!1,t[0]=e,t[1]=n),$(n)};function xn(e){let t=hn.current,n=t.size===e.directories.size;if(n){for(let[r,i]of e.directories)if(t.get(r)!==(i.status?.current??null)){n=!1;break}}if(n)return t;let r=new Map;for(let[t,n]of e.directories)r.set(t,n.status?.current??null);return hn.current=r,r}var Sn=e=>{let t=String(e||``).trim().replace(/^remotes\//,``);if(!t)return null;let n=t.indexOf(`/`);return n<=0||n>=t.length-1?null:{remote:t.slice(0,n),branch:t.slice(n+1)}},Cn=e=>String(e||``).trim().replace(/^refs\/heads\//,``).replace(/^heads\//,``).replace(/^remotes\//,``),wn=e=>e.branchName?Cn(e.branchName):e.mode===`existing`?Cn(e.existingBranch||e.preferredName||``):Cn(e.preferredName||``),Tn=async e=>{let t=await I(e);try{let n=Sn((await P(e)).branches?.[t]?.tracking||null);if(n?.remote)return n.remote}catch{}try{let t=Sn((await F(e)).tracking);if(t?.remote)return t.remote}catch{}return null},En=async(e,t)=>{let n=await Tn(e),r=Cn(t);return!n||!r?null:{setUpstream:!0,upstreamRemote:n,upstreamBranch:r}},Dn=async(e,t,n)=>{let r=wn(t),i=n?.resolvedRootTrackingRemote,a=i===void 0?await En(e,r):i&&Cn(r)?{setUpstream:!0,upstreamRemote:i,upstreamBranch:Cn(r)}:null;return a?{...t,setUpstream:t.setUpstream??a.setUpstream,upstreamRemote:t.upstreamRemote||a.upstreamRemote,upstreamBranch:t.upstreamBranch||a.upstreamBranch}:t},On=async(e,t,n)=>{let r=await Dn(e.path,t,n);return L(e,r)},kn=`oc:lastWorktreeSourceBranch`,An=({mode:e,sourceBranch:t,linkedPr:n,selectedBranch:r})=>e===`existing-branch`?r||null:n?null:t||null,jn=({branches:e,savedSourceBranch:t,rootBranch:n})=>t&&e.includes(t)&&t?{sourceBranch:t,shouldClearSavedSourceBranch:!1}:{sourceBranch:n&&e.includes(n)?n:e.includes(`main`)?`main`:e.includes(`master`)?`master`:e[0]??``,shouldClearSavedSourceBranch:!!t},Mn=(e,t,n)=>{if(!e)return e;let r=t.length>0&&!/\s$/.test(t)&&!/^\s/.test(e)&&!/[([{]$/.test(t),i=n.length>0&&!/\s$/.test(e)&&!/^\s/.test(n)&&!/^[\])}.,;:!?]/.test(n);return`${r?` `:``}${e}${i?` `:``}`},Nn=(e,t,n)=>{let r=Mn(e,t,n);return`${t.length===0&&!/^\s/.test(r)?` `:``}${r}${n.length===0&&!/\s$/.test(r)?` `:``}`},Pn=(e,t,n,r)=>{let i=e.slice(0,t),a=e.slice(n),o=Nn(r,i,a),s=Math.max(0,o.indexOf(r)),c=i.length+s;return{text:`${i}${o}${a}`,caret:i.length+o.length,start:c,end:c+r.length}},Fn=(e,t)=>{let n=e=>`${e.kind}:${e.value}:${e.range.start}:${e.range.end}`;return new Set(e.map(n)).has(n(t))?[...e]:[...e,t]},In=(e,t)=>t<e.length&&e[t]===` `?t+1:t;export{Oe as A,Tt as C,Re as D,Ke as E,Te as F,ve as I,Ee as M,Ce as N,Ie as O,we as P,Ot as S,Je as T,fn as _,kn as a,$ as b,On as c,gn as d,mn as f,vn as g,yn as h,Nn as i,De as j,Ne as k,Tn as l,bn as m,Fn as n,jn as o,dn as p,Pn as r,An as s,In as t,Dn as u,_n as v,Et as w,pn as x,un as y};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/vendor-workbox-window-qnW0Nbv7.js","assets/rolldown-runtime-C0FnF6B9.js","assets/renderMobileApp-CZqNs2zK.js","assets/runtime-auth-D66yq6ie.js","assets/runtime-switch-LvWDU-SL.js","assets/runtime-fetch-zIalUnbb.js","assets/persistence-DwRBC4zl.js","assets/vendor-zustand-B4dlGEM2.js","assets/vendor-base-ui-CnHfUmDN.js","assets/useUIStore-CxOoCv7B.js","assets/vendor-pathe-vBmvQE8f.js","assets/vendor-react-DLPElpoQ.js","assets/vendor-tanstack-query-core-BWz0ose6.js","assets/platform-DQ5_LNKO.js","assets/vendor-opencode-sdk-C07HQypa.js","assets/vendor-aparajita-capacitor-secure-storage-CjQdwfjS.js","assets/capgoAdapter-DCowZ2ab.js","assets/types-BuiqMmh_.js","assets/vendor-pierre-diffs-DX7XTPG3.js","assets/vendor-hast-util-to-html-B0p1k5Xa.js","assets/vendor-character-entities-legacy-Wut6vMuj.js","assets/vendor-character-entities-html4-DlN_yAFd.js","assets/vendor-ccount-CyGsA0u7.js","assets/vendor-comma-separated-tokens-B9ouxNNS.js","assets/vendor-oniguruma-to-es-CrHzjjSU.js","assets/vendor-oniguruma-parser-D2DIvhSP.js","assets/vendor-diff-Dq7CZNim.js","assets/vendor-lru_map-DpDied8H.js","assets/vendor-sonner-DVzioF3d.js","assets/vendor-reactuses-core-BnW6GxJt.js","assets/vendor-lodash-es-DfLbG5Af.js","assets/vendor-js-cookie-hSOiFTtX.js","assets/clipboard-GUUNlWIv.js","assets/store-ClnJdJSj.js","assets/MobileShareBridge-3tBtXXJJ.js","assets/MobileDetailNavigation-BeNUCxzK.js","assets/vendor-tanstack-react-query-D7pys_c9.js","assets/useMobileNavigationStore-DDgESrzu.js","assets/useAssistantUIStore-CLPCNoj_.js","assets/vendor-fuse.js-DB5wDJbI.js","assets/utils-2ZK8yboQ.js","assets/vendor-class-variance-authority-BLUaYARZ.js","assets/vendor-tailwind-merge-BicNWLTg.js","assets/Icon-D1BcR8Tz.js","assets/button-9R-WgVMl.js","assets/dialog-DhMGbF_B.js","assets/AgentAvatar-m1jNq4bX.js","assets/gitApi-pLkl_IyQ.js","assets/useAppFontEffects-CN_3Jty7.js","assets/desktopHosts-B052a4UK.js","assets/desktopRelayRestore-OjKNXr10.js","assets/vendor-codemirror-autocomplete-DHomsvW7.js","assets/vendor-simplewebauthn-browser-Dwhcdg_5.js","assets/projectMeta-BMkGWqtz.js","assets/input-Cd_1HyQv.js","assets/tooltip-DSjr26A_.js","assets/OverlayScrollbar-Bahg_P3r.js","assets/textarea-B9CmN13Z.js","assets/vendor-dnd-kit-core-CvWxUPdb.js","assets/vendor-dnd-kit-accessibility-BY5LhhUB.js","assets/vendor-dnd-kit-sortable-hHdP9lLb.js","assets/useSessionAutoCleanup-q2lauc7x.js","assets/vendor-codemirror-lang-angular-DShkBD6m.js","assets/vendor-codemirror-lang-json-CYJRHck9.js","assets/vendor-codemirror-lang-markdown-WORgx6ZD.js","assets/vendor-codemirror-lang-python-Du6XQ8Zw.js","assets/vendor-codemirror-legacy-modes-DuRAjNvB.js","assets/useThemeSystem-DMzWVJaW.js","assets/dropdown-menu.styles-Bzo6L3FH.js","assets/vendor-codemirror-language-data-BfYFhIH1.js","assets/markdownTheme-DOfGg-A7.js","assets/useRuntimeAPIs-DSLXJybW.js","assets/insertionBoundaries-DJvMDCJJ.js","assets/fileMentionTouchSelection-DzdgAvGS.js","assets/appThemeRegistry-BDrIDWKH.js","assets/MarkdownRenderer-YMePGw0Z.js","assets/markdownHeightCache-BL8CUQ0M.js","assets/dualLimitLru-D8Sphgua.js","assets/url-CMQwHq4k.js","assets/markdown-worker-CptoICmq.js","assets/useEffectiveDirectory-C5Gg7EvP.js","assets/FadeInOnReveal-UGwClbL_.js","assets/imageSource-BlAJJUEI.js","assets/relay-image-stream-DM7atqJs.js","assets/useWorkerHighlightedLines-BSQQkZaO.js","assets/vendor-tanstack-react-virtual-tlDgH6PG.js","assets/sessionChangeSummary-BG7l2heP.js","assets/vendor-cmdk-CeAGfrLo.js","assets/vendor-aria-hidden-BbL3cEyI.js","assets/sortable-tabs-strip-dYW6SH62.js","assets/vendor-framer-motion-DFy_BSVd.js","assets/vendor-legendapp-list-WE32lwNk.js","assets/useFontPreferences-DCaY8NbU.js","assets/terminalApi-CfgOfnZk.js","assets/MobileSurface-ppn0zIpb.js","assets/collapsible-Bbz9KiJf.js","assets/vendor-codemirror-commands-C9DCaJ0C.js","assets/vendor-codemirror-search-D2SOgzph.js","assets/vendor-replit-codemirror-vim-CEibx3EP.js","assets/projectActions-CWvNGKfA.js","assets/runtimeEndpointReset-Dpx6GB_U.js","assets/sessionLookup-BZuvc3Aa.js","assets/context-menu-CSyOhRz8.js","assets/vendor-cron-parser-CCD11YFT.js","assets/SettingsView-0-Yqdzh-.js","assets/vendor-yaml-DIcAK3EC.js","assets/vendor-qrcode-DAuVxiQR.js","assets/vendor-dijkstrajs-DztKuCwY.js","assets/AssistantView-DZMTfY1i.js","assets/assistant-attachment-cache-C0aRnFkj.js","assets/fileQueries-B_s_B-fH.js","assets/src-CO9q_82J.css","assets/main-B8fZfA3K.js","assets/useDesktopWindowControlsLayout-C6kAkizT.js","assets/diagram-NdsZih8P.js","assets/vendor-react-drawio-ECtEwvbc.js","assets/multirun-BINJ2LCE.js","assets/vendor-zumer-snapdom-yq9vlCKr.js","assets/vendor-html-to-image-BDMm2v6d.js","assets/main-qSeeJRW1.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{n as e,t}from"./runtimeConfig-BD1Fo5N5.js";import{o as n}from"./vendor-aparajita-capacitor-secure-storage-CjQdwfjS.js";/* empty css */var r=`true`,i=`false`,a=r===`true`,o=i===`true`;function s(e={}){let{immediate:t=!1,onNeedReload:r,onNeedRefresh:i,onOfflineReady:s,onRegistered:c,onRegisteredSW:l,onRegisterError:u}=e,d,f,p,m=async(e=!0)=>{await f,a||p?.()};async function h(){if(`serviceWorker`in navigator){if(d=await n(async()=>{let{Workbox:e}=await import(`./vendor-workbox-window-qnW0Nbv7.js`).then(e=>e.t);return{Workbox:e}},__vite__mapDeps([0,1])).then(({Workbox:e})=>new e(`/sw.js`,{scope:`/`,type:`classic`})).catch(e=>{u?.(e)}),!d)return;if(p=()=>{d?.messageSkipWaiting()},!o)if(a)d.addEventListener(`activated`,e=>{(e.isUpdate||e.isExternal)&&(r?r():window.location.reload())}),d.addEventListener(`installed`,e=>{e.isUpdate||s?.()});else{let e=!1,t=()=>{e=!0,d?.addEventListener(`controlling`,e=>{e.isUpdate&&(r?r():window.location.reload())}),i?.()};d.addEventListener(`installed`,n=>{n.isUpdate===void 0?n.isExternal===void 0?!e&&s?.():n.isExternal?t():!e&&s?.():n.isUpdate||s?.()}),d.addEventListener(`waiting`,t)}d.register({immediate:t}).then(e=>{l?l(`/sw.js`,e):c?.(e)}).catch(e=>{u?.(e)})}}return f=h(),m}window.__OPENCHAMBER_RUNTIME_APIS__=t();var c=()=>typeof window>`u`||typeof window.matchMedia!=`function`?!1:window.matchMedia(`(pointer: coarse)`).matches,l=(()=>{let e=new URLSearchParams(window.location.search).get(`surface`);if(e===`mobile`)return`mobile`;if(e===`desktop`)return`desktop`;let t=Math.min(window.innerWidth||0,window.screen?.width||window.innerWidth||0),n=navigator.maxTouchPoints||0;return t>0&&t<=760&&(n>0||c())?`mobile`:`desktop`})();window.__OPENCHAMBER_SURFACE__=l;var u=()=>!(!(`serviceWorker`in navigator)||!window.isSecureContext||window.location.protocol!==`http:`&&window.location.protocol!==`https:`||document.prerendering||String(document.visibilityState)===`prerender`),d=e=>{let t=!1,n=()=>{t||u()&&(t=!0,e())},r=()=>{setTimeout(n,0)};document.readyState===`complete`?r():window.addEventListener(`load`,r,{once:!0}),(document.prerendering||String(document.visibilityState)===`prerender`)&&document.addEventListener(`visibilitychange`,n,{once:!0})},f=()=>{d(()=>{try{s({onRegisterError(e){console.warn(`[PWA] service worker registration skipped:`,e)}})}catch(e){console.warn(`[PWA] service worker registration skipped:`,e)}})},p=`openchamber.dev.module-reload`,m=(e,t)=>{console.error(`[openchamber] failed to load ${t}:`,e)};l===`mobile`?n(async()=>{let{renderMobileApp:e}=await import(`./renderMobileApp-CZqNs2zK.js`);return{renderMobileApp:e}},__vite__mapDeps([2,1,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111])).then(({renderMobileApp:e})=>{try{sessionStorage.removeItem(p)}catch{}e(window.__OPENCHAMBER_RUNTIME_APIS__??t())}).catch(e=>m(e,`renderMobileApp`)):e().then(()=>n(()=>import(`./main-B8fZfA3K.js`),__vite__mapDeps([112,1,3,4,5,6,7,8,9,10,11,12,49,13,14,15,36,93,51,18,19,20,21,22,23,24,25,26,27,29,30,31,32,33,35,37,28,38,39,40,41,42,43,44,45,47,48,50,46,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,94,17,95,96,97,98,99,113,100,101,102,103,114,115,116,117,118,119,111]))).then(()=>{try{sessionStorage.removeItem(p)}catch{}}).catch(e=>m(e,`desktop main`)),f();
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/renderElectronMiniChatApp-BonR3p7C.js","assets/rolldown-runtime-C0FnF6B9.js","assets/persistence-DwRBC4zl.js","assets/runtime-switch-LvWDU-SL.js","assets/runtime-auth-D66yq6ie.js","assets/runtime-fetch-zIalUnbb.js","assets/vendor-zustand-B4dlGEM2.js","assets/vendor-base-ui-CnHfUmDN.js","assets/useUIStore-CxOoCv7B.js","assets/vendor-pathe-vBmvQE8f.js","assets/vendor-react-DLPElpoQ.js","assets/vendor-tanstack-query-core-BWz0ose6.js","assets/platform-DQ5_LNKO.js","assets/vendor-opencode-sdk-C07HQypa.js","assets/vendor-aparajita-capacitor-secure-storage-CjQdwfjS.js","assets/vendor-reactuses-core-BnW6GxJt.js","assets/vendor-lodash-es-DfLbG5Af.js","assets/vendor-js-cookie-hSOiFTtX.js","assets/clipboard-GUUNlWIv.js","assets/store-ClnJdJSj.js","assets/useMobileNavigationStore-DDgESrzu.js","assets/vendor-tanstack-react-query-D7pys_c9.js","assets/vendor-sonner-DVzioF3d.js","assets/useAssistantUIStore-CLPCNoj_.js","assets/vendor-fuse.js-DB5wDJbI.js","assets/utils-2ZK8yboQ.js","assets/vendor-class-variance-authority-BLUaYARZ.js","assets/vendor-tailwind-merge-BicNWLTg.js","assets/Icon-D1BcR8Tz.js","assets/button-9R-WgVMl.js","assets/useAppFontEffects-CN_3Jty7.js","assets/desktopHosts-B052a4UK.js","assets/desktopRelayRestore-OjKNXr10.js","assets/vendor-codemirror-autocomplete-DHomsvW7.js","assets/vendor-pierre-diffs-DX7XTPG3.js","assets/vendor-hast-util-to-html-B0p1k5Xa.js","assets/vendor-character-entities-legacy-Wut6vMuj.js","assets/vendor-character-entities-html4-DlN_yAFd.js","assets/vendor-ccount-CyGsA0u7.js","assets/vendor-comma-separated-tokens-B9ouxNNS.js","assets/vendor-oniguruma-to-es-CrHzjjSU.js","assets/vendor-oniguruma-parser-D2DIvhSP.js","assets/vendor-diff-Dq7CZNim.js","assets/vendor-lru_map-DpDied8H.js","assets/dialog-DhMGbF_B.js","assets/AgentAvatar-m1jNq4bX.js","assets/gitApi-pLkl_IyQ.js","assets/vendor-simplewebauthn-browser-Dwhcdg_5.js","assets/projectMeta-BMkGWqtz.js","assets/input-Cd_1HyQv.js","assets/tooltip-DSjr26A_.js","assets/OverlayScrollbar-Bahg_P3r.js","assets/textarea-B9CmN13Z.js","assets/vendor-dnd-kit-core-CvWxUPdb.js","assets/vendor-dnd-kit-accessibility-BY5LhhUB.js","assets/vendor-dnd-kit-sortable-hHdP9lLb.js","assets/useSessionAutoCleanup-q2lauc7x.js","assets/vendor-codemirror-lang-angular-DShkBD6m.js","assets/vendor-codemirror-lang-json-CYJRHck9.js","assets/vendor-codemirror-lang-markdown-WORgx6ZD.js","assets/vendor-codemirror-lang-python-Du6XQ8Zw.js","assets/vendor-codemirror-legacy-modes-DuRAjNvB.js","assets/useThemeSystem-DMzWVJaW.js","assets/dropdown-menu.styles-Bzo6L3FH.js","assets/vendor-codemirror-language-data-BfYFhIH1.js","assets/markdownTheme-DOfGg-A7.js","assets/useRuntimeAPIs-DSLXJybW.js","assets/insertionBoundaries-DJvMDCJJ.js","assets/fileMentionTouchSelection-DzdgAvGS.js","assets/appThemeRegistry-BDrIDWKH.js","assets/MarkdownRenderer-YMePGw0Z.js","assets/markdownHeightCache-BL8CUQ0M.js","assets/dualLimitLru-D8Sphgua.js","assets/url-CMQwHq4k.js","assets/markdown-worker-CptoICmq.js","assets/useEffectiveDirectory-C5Gg7EvP.js","assets/FadeInOnReveal-UGwClbL_.js","assets/imageSource-BlAJJUEI.js","assets/relay-image-stream-DM7atqJs.js","assets/useWorkerHighlightedLines-BSQQkZaO.js","assets/vendor-tanstack-react-virtual-tlDgH6PG.js","assets/sessionChangeSummary-BG7l2heP.js","assets/vendor-cmdk-CeAGfrLo.js","assets/vendor-aria-hidden-BbL3cEyI.js","assets/sortable-tabs-strip-dYW6SH62.js","assets/vendor-framer-motion-DFy_BSVd.js","assets/vendor-legendapp-list-WE32lwNk.js","assets/useFontPreferences-DCaY8NbU.js","assets/terminalApi-CfgOfnZk.js","assets/useDesktopWindowControlsLayout-C6kAkizT.js","assets/src-CO9q_82J.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{t as e}from"./runtimeConfig-BD1Fo5N5.js";import{o as t}from"./vendor-aparajita-capacitor-secure-storage-CjQdwfjS.js";/* empty css */window.__OPENCHAMBER_RUNTIME_APIS__=e(),t(async()=>{let{renderElectronMiniChatApp:e}=await import(`./renderElectronMiniChatApp-BonR3p7C.js`);return{renderElectronMiniChatApp:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90])).then(({renderElectronMiniChatApp:t})=>{t(window.__OPENCHAMBER_RUNTIME_APIS__??e())});
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/renderMobileApp-CZqNs2zK.js","assets/rolldown-runtime-C0FnF6B9.js","assets/runtime-auth-D66yq6ie.js","assets/runtime-switch-LvWDU-SL.js","assets/runtime-fetch-zIalUnbb.js","assets/persistence-DwRBC4zl.js","assets/vendor-zustand-B4dlGEM2.js","assets/vendor-base-ui-CnHfUmDN.js","assets/useUIStore-CxOoCv7B.js","assets/vendor-pathe-vBmvQE8f.js","assets/vendor-react-DLPElpoQ.js","assets/vendor-tanstack-query-core-BWz0ose6.js","assets/platform-DQ5_LNKO.js","assets/vendor-opencode-sdk-C07HQypa.js","assets/vendor-aparajita-capacitor-secure-storage-CjQdwfjS.js","assets/capgoAdapter-DCowZ2ab.js","assets/types-BuiqMmh_.js","assets/vendor-pierre-diffs-DX7XTPG3.js","assets/vendor-hast-util-to-html-B0p1k5Xa.js","assets/vendor-character-entities-legacy-Wut6vMuj.js","assets/vendor-character-entities-html4-DlN_yAFd.js","assets/vendor-ccount-CyGsA0u7.js","assets/vendor-comma-separated-tokens-B9ouxNNS.js","assets/vendor-oniguruma-to-es-CrHzjjSU.js","assets/vendor-oniguruma-parser-D2DIvhSP.js","assets/vendor-diff-Dq7CZNim.js","assets/vendor-lru_map-DpDied8H.js","assets/vendor-sonner-DVzioF3d.js","assets/vendor-reactuses-core-BnW6GxJt.js","assets/vendor-lodash-es-DfLbG5Af.js","assets/vendor-js-cookie-hSOiFTtX.js","assets/clipboard-GUUNlWIv.js","assets/store-ClnJdJSj.js","assets/MobileShareBridge-3tBtXXJJ.js","assets/MobileDetailNavigation-BeNUCxzK.js","assets/vendor-tanstack-react-query-D7pys_c9.js","assets/useMobileNavigationStore-DDgESrzu.js","assets/useAssistantUIStore-CLPCNoj_.js","assets/vendor-fuse.js-DB5wDJbI.js","assets/utils-2ZK8yboQ.js","assets/vendor-class-variance-authority-BLUaYARZ.js","assets/vendor-tailwind-merge-BicNWLTg.js","assets/Icon-D1BcR8Tz.js","assets/button-9R-WgVMl.js","assets/dialog-DhMGbF_B.js","assets/AgentAvatar-m1jNq4bX.js","assets/gitApi-pLkl_IyQ.js","assets/useAppFontEffects-CN_3Jty7.js","assets/desktopHosts-B052a4UK.js","assets/desktopRelayRestore-OjKNXr10.js","assets/vendor-codemirror-autocomplete-DHomsvW7.js","assets/vendor-simplewebauthn-browser-Dwhcdg_5.js","assets/projectMeta-BMkGWqtz.js","assets/input-Cd_1HyQv.js","assets/tooltip-DSjr26A_.js","assets/OverlayScrollbar-Bahg_P3r.js","assets/textarea-B9CmN13Z.js","assets/vendor-dnd-kit-core-CvWxUPdb.js","assets/vendor-dnd-kit-accessibility-BY5LhhUB.js","assets/vendor-dnd-kit-sortable-hHdP9lLb.js","assets/useSessionAutoCleanup-q2lauc7x.js","assets/vendor-codemirror-lang-angular-DShkBD6m.js","assets/vendor-codemirror-lang-json-CYJRHck9.js","assets/vendor-codemirror-lang-markdown-WORgx6ZD.js","assets/vendor-codemirror-lang-python-Du6XQ8Zw.js","assets/vendor-codemirror-legacy-modes-DuRAjNvB.js","assets/useThemeSystem-DMzWVJaW.js","assets/dropdown-menu.styles-Bzo6L3FH.js","assets/vendor-codemirror-language-data-BfYFhIH1.js","assets/markdownTheme-DOfGg-A7.js","assets/useRuntimeAPIs-DSLXJybW.js","assets/insertionBoundaries-DJvMDCJJ.js","assets/fileMentionTouchSelection-DzdgAvGS.js","assets/appThemeRegistry-BDrIDWKH.js","assets/MarkdownRenderer-YMePGw0Z.js","assets/markdownHeightCache-BL8CUQ0M.js","assets/dualLimitLru-D8Sphgua.js","assets/url-CMQwHq4k.js","assets/markdown-worker-CptoICmq.js","assets/useEffectiveDirectory-C5Gg7EvP.js","assets/FadeInOnReveal-UGwClbL_.js","assets/imageSource-BlAJJUEI.js","assets/relay-image-stream-DM7atqJs.js","assets/useWorkerHighlightedLines-BSQQkZaO.js","assets/vendor-tanstack-react-virtual-tlDgH6PG.js","assets/sessionChangeSummary-BG7l2heP.js","assets/vendor-cmdk-CeAGfrLo.js","assets/vendor-aria-hidden-BbL3cEyI.js","assets/sortable-tabs-strip-dYW6SH62.js","assets/vendor-framer-motion-DFy_BSVd.js","assets/vendor-legendapp-list-WE32lwNk.js","assets/useFontPreferences-DCaY8NbU.js","assets/terminalApi-CfgOfnZk.js","assets/MobileSurface-ppn0zIpb.js","assets/collapsible-Bbz9KiJf.js","assets/vendor-codemirror-commands-C9DCaJ0C.js","assets/vendor-codemirror-search-D2SOgzph.js","assets/vendor-replit-codemirror-vim-CEibx3EP.js","assets/projectActions-CWvNGKfA.js","assets/runtimeEndpointReset-Dpx6GB_U.js","assets/sessionLookup-BZuvc3Aa.js","assets/context-menu-CSyOhRz8.js","assets/vendor-cron-parser-CCD11YFT.js","assets/SettingsView-0-Yqdzh-.js","assets/vendor-yaml-DIcAK3EC.js","assets/vendor-qrcode-DAuVxiQR.js","assets/vendor-dijkstrajs-DztKuCwY.js","assets/AssistantView-DZMTfY1i.js","assets/assistant-attachment-cache-C0aRnFkj.js","assets/fileQueries-B_s_B-fH.js","assets/src-CO9q_82J.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{t as e}from"./runtimeConfig-BD1Fo5N5.js";import{o as t}from"./vendor-aparajita-capacitor-secure-storage-CjQdwfjS.js";/* empty css */window.__OPENCHAMBER_RUNTIME_APIS__=e(),t(async()=>{let{renderMobileApp:e}=await import(`./renderMobileApp-CZqNs2zK.js`);return{renderMobileApp:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110])).then(({renderMobileApp:t})=>{t(window.__OPENCHAMBER_RUNTIME_APIS__??e())});
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{Qt as t}from"./persistence-DwRBC4zl.js";import{a as n,r}from"./vendor-zustand-B4dlGEM2.js";import{nt as i,rt as a}from"./vendor-base-ui-CnHfUmDN.js";import{Ct as o,Nt as s}from"./platform-DQ5_LNKO.js";import{t as c}from"./useUIStore-CxOoCv7B.js";import{n as l}from"./vendor-react-DLPElpoQ.js";import{n as u}from"./vendor-reactuses-core-BnW6GxJt.js";import{l as d,n as f}from"./clipboard-GUUNlWIv.js";import{Bn as p,In as m,Ln as h,Qi as g,Ua as _,Va as v,Xn as y,aa as b,c as x,dr as S,go as C,hr as w,s as T,ta as E}from"./useMobileNavigationStore-DDgESrzu.js";import{n as D,t as ee}from"./utils-2ZK8yboQ.js";import{n as O}from"./Icon-D1BcR8Tz.js";import{t as te}from"./button-9R-WgVMl.js";import{n as ne}from"./gitApi-pLkl_IyQ.js";import{D as re,O as ie,S as k,Z as A,_ as j,a as M,b as ae,f as oe,g as se,h as ce,i as N,m as le,n as ue,q as P,v as F,x as de,y as I}from"./projectMeta-BMkGWqtz.js";import{t as L}from"./input-Cd_1HyQv.js";import{i as R,n as z,t as B}from"./tooltip-DSjr26A_.js";import{o as fe}from"./OverlayScrollbar-Bahg_P3r.js";import{n as V}from"./useRuntimeAPIs-DSLXJybW.js";import{E as pe,T as me,a as H,b as U,c as W,g as he,k as ge,l as G,m as K,o as q,p as J,r as _e,x as Y}from"./insertionBoundaries-DJvMDCJJ.js";import{r as ve,t as ye}from"./textarea-B9CmN13Z.js";import{n as be,r as xe,t as Se}from"./collapsible-Bbz9KiJf.js";var X=e(a(),1),Ce=l(),Z=/^[a-z0-9](?:[a-z0-9-]{0,48}[a-z0-9])?$/,Q=/^g[1-9]\d*$/,we=(e,t,n,r,i)=>{if(!Z.test(e)||t!==void 0&&!Q.test(t)||!n?.trim()||!r?.trim()||n!==n.trim()||r!==r.trim())return null;if(i===void 0)return{groupSlug:e,runGroup:t,providerID:n,modelID:r,fusion:!1};if(i===`fusion`)return{groupSlug:e,runGroup:t,providerID:n,modelID:r,fusion:!0};if(!/^\d+$/.test(i))return null;let a=Number.parseInt(i,10);return!Number.isSafeInteger(a)||a<=0?null:{groupSlug:e,runGroup:t,providerID:n,modelID:r,index:a,fusion:!1}},Te=e=>{if(!e)return null;let t=e.split(`/`);if(t.length<3||t.length>5)return null;let[n]=t;if(t.length===3)return we(n,void 0,t[1],t[2],void 0);if(t.length===4){let[,e,r,i]=t;return Q.test(e)?we(n,e,r,i,void 0):we(n,void 0,e,r,i)}let[,r,i,a,o]=t;return r===``?we(n,void 0,i,a,o):we(n,r,i,a,o)},Ee=e=>{let t=[e.groupSlug];return e.runGroup&&t.push(e.runGroup),t.push(e.providerID,e.modelID),e.index!==void 0&&t.push(String(e.index)),t.join(`/`)},De=(e,t,n,r)=>{let i=[e];return r&&i.push(r),i.push(t,n,`fusion`),i.join(`/`)},Oe=e=>e.toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``).substring(0,50),ke=(e,t)=>`${Oe(e)}-${Oe(t)}`.substring(0,60),Ae=(e,t)=>`${e}/${t}`,je=e=>{let t=e.replace(/\\/g,`/`);return t===`/`?`/`:t.length>1?t.replace(/\/+$/,``):t},Me=(e,t)=>{let n=je(t),r=e.directory,i=typeof r==`string`&&r.trim().length>0?e:{...e,directory:n};b(e.id,n),x.getState().markSessionAsOpenChamberCreated(e.id),S.getState().upsertSession(i);try{E().ensureChild(n,{bootstrap:!1}).setState(t=>{let n=t.session.findIndex(t=>t.id===e.id);if(n>=0&&t.session[n]===i)return t;let r=n>=0?t.session.map((e,t)=>t===n?i:e):[...t.session,i].sort((e,t)=>e.id.localeCompare(t.id));return{session:r,sessionTotal:Math.max(t.sessionTotal,r.length),limit:Math.max(t.limit,r.length)}})}catch{}return i},Ne=()=>{let e=C.getState(),t=e.activeProjectId;if(!t)return null;let n=e.projects.find(e=>e.id===t);if(n?.path)return{id:n.id,path:n.path};let r=o.getState().currentDirectory??null;if(r&&r.trim().length>0){let e=r.replace(/\\/g,`/`).replace(/\/+$/,``)||r;return{id:`path:${e}`,path:e}}return null},Pe=n()(r(e=>({isLoading:!1,error:null,createMultiRun:async t=>{let n=t.name.trim(),{groups:r,agent:i,files:a,setupCommands:o}=t;if(!n)return e({error:`Group name is required`}),null;if(!r||r.length===0)return e({error:`At least one run group is required`}),null;for(let t=0;t<r.length;t++){if(!r[t].prompt.trim())return e({error:`Group ${t+1}: prompt is required`}),null;if(r[t].models.length<1)return e({error:`Group ${t+1}: select at least 1 model`}),null;if(r[t].models.length>5)return e({error:`Group ${t+1}: maximum 5 models allowed`}),null}e({isLoading:!0,error:null});try{let c=Ne();if(!c)return e({error:`Select a project`,isLoading:!1}),null;let l=c.path,u=await ne(l)&&t.isolateRuns!==!1,d=Oe(n),f=u?await oe(l):void 0,m=u?await G(l):null,g=[],_=o?.filter(e=>e.trim().length>0)??[];for(let e=0;e<r.length;e++){let n=r[e],i=n.prompt,a=new Map;for(let e of n.models){let t=`${e.providerID}:${e.modelID}`;a.set(t,(a.get(t)||0)+1)}let o=new Map;for(let p of n.models){let n=`${p.providerID}:${p.modelID}`,v=a.get(n)||1,b=(o.get(n)||0)+1;o.set(n,b);let S=ke(p.providerID,p.modelID),C=r.length>1?`g${e+1}`:void 0,w=v>1?Ae(d,`${S}/${b}`):Ae(d,S),T=C?`${C}/${w}`:w,E=Ee({groupSlug:d,runGroup:C,providerID:p.providerID,modelID:p.modelID,index:v>1?b:void 0});try{if(!u){let e=await s.withDirectory(l,()=>s.createSession({title:E}));Me(e,l),g.push({sessionId:e.id,worktreePath:l,providerID:p.providerID,modelID:p.modelID,variant:p.variant,prompt:i});continue}let e=await W(c,{preferredName:T,mode:`new`,branchName:T,worktreeName:T,startRef:t.worktreeBaseBranch||`HEAD`,setupCommands:_,returnAfterDirectoryCreated:!0},{resolvedRootTrackingRemote:m}),n={...e,createdFromBranch:f,kind:`standard`};await h(c)&&await y(e.path);let r=await s.withDirectory(e.path,()=>s.createSession({title:E}));Me(r,e.path),x.getState().setWorktreeMetadata(r.id,n),g.push({sessionId:r.id,worktreePath:e.path,providerID:p.providerID,modelID:p.modelID,variant:p.variant,prompt:i})}catch(e){console.warn(`[MultiRun] Failed to create session:`,e)}}}let v=o?.filter(e=>e.trim().length>0)??[];v.length>0&&p(c,v).catch(()=>{console.warn(`[MultiRun] Failed to save worktree setup commands`)});let b=g.map(e=>e.sessionId),S=g[0]?.sessionId??null;if(b.length===0)return e({error:`Failed to create any sessions`,isLoading:!1}),null;let C=a?.map(e=>({type:`file`,mime:e.mime,filename:e.filename,url:e.url}));return(async()=>{try{let e=P.getState().expandText;await Promise.allSettled(g.map(async t=>{try{let n=await e(t.prompt).catch(()=>t.prompt);await T({sessionId:t.sessionId,directory:t.worktreePath,content:n,providerID:t.providerID,modelID:t.modelID,variant:t.variant,agent:i,files:C})}catch(e){console.warn(`[MultiRun] Failed to start run:`,e)}}))}catch(e){console.warn(`[MultiRun] Failed to start runs:`,e)}})(),e({isLoading:!1}),{groupSlug:d,sessionIds:b,firstSessionId:S}}catch(t){return e({error:t instanceof Error?t.message:`Failed to create Multi-Run`,isLoading:!1}),null}},clearError:()=>{e({error:null})}}),{name:`multirun-store`})),$=i(),Fe=`h-7`,Ie=()=>`${Date.now()}-${Math.random().toString(36).substring(2,9)}`,Le=e=>{let t=(0,Ce.c)(13),{model:n,instanceIndex:r,totalSameModel:i,onRemove:a}=e,o=n.displayName||`${n.providerID}/${n.modelID}`,s=i>1?`${o} (${r})`:o,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=ee(`flex items-center gap-1.5 px-2 rounded-md bg-interactive-selection/20 border border-border/30`,Fe),t[0]=c):c=t[0];let l;t[1]!==n.modelID||t[2]!==n.providerID?(l=(0,$.jsx)(ie,{modelId:n.modelID,providerId:n.providerID,className:`h-3.5 w-3.5`}),t[1]=n.modelID,t[2]=n.providerID,t[3]=l):l=t[3];let u;t[4]===s?u=t[5]:(u=(0,$.jsx)(`span`,{className:`typography-meta font-medium truncate max-w-[140px]`,children:s}),t[4]=s,t[5]=u);let d;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,$.jsx)(O,{name:`close`,className:`h-3.5 w-3.5`}),t[6]=d):d=t[6];let f;t[7]===a?f=t[8]:(f=(0,$.jsx)(`button`,{type:`button`,onClick:a,className:`text-muted-foreground hover:text-foreground ml-0.5`,children:d}),t[7]=a,t[8]=f);let p;return t[9]!==l||t[10]!==u||t[11]!==f?(p=(0,$.jsxs)(`div`,{className:c,children:[l,u,f]}),t[9]=l,t[10]=u,t[11]=f,t[12]=p):p=t[12],p},Re=e=>{let t=(0,Ce.c)(131),{selectedModels:n,onAdd:r,onRemove:i,onUpdate:a,minModels:o,addButtonLabel:s,showChips:l,maxModels:u,addButtonClassName:d,dropdownSide:p,dropdownClassName:m,containerClassName:h,triggerIcon:v}=e,y=l===void 0||l,b=p===void 0?`top`:p,{t:x}=f(),S=g(ze),C=g(Be),w=c(Ve),T=c(He),{favoriteModelsList:E,recentModelsList:D}=re(),ne=c(Ue),ie=c(We),[A,M]=X.useState(!1),[oe,se]=X.useState(``),[N,ue]=X.useState(null),P=X.useRef(null),F=X.useRef(null),I=u===1,L=u===void 0||n.length<u||I,R;if(t[0]!==n){R=new Map;for(let e of n){let t=`${e.providerID}:${e.modelID}`;R.set(t,(R.get(t)||0)+1)}t[0]=n,t[1]=R}else R=t[1];let z=R,B;t[2]===n?B=t[3]:(B=e=>n.filter(t=>t.providerID===e.providerID&&t.modelID===e.modelID).findIndex(t=>t.instanceId===e.instanceId)+1,t[2]=n,t[3]=B);let fe=B,V,pe;t[4]!==b||t[5]!==A?(V=()=>{if(!A||!F.current)return;let e=F.current.getBoundingClientRect();if(b===`bottom`){let t=(window.visualViewport?.height??document.documentElement.clientHeight??window.innerHeight)-e.bottom-16-112;ue(Math.max(160,Math.min(320,t)));return}let t=F.current.parentElement;for(;t&&!(t.getAttribute(`role`)===`dialog`||t.hasAttribute(`data-scroll-shadow`));){let e=getComputedStyle(t);if(e.overflow===`auto`||e.overflow===`hidden`||e.overflowY===`auto`||e.overflowY===`hidden`)break;t=t.parentElement}let n=t?t.getBoundingClientRect().top:0,r=e.top-n-16;ue(Math.max(150,Math.min(300,r)))},pe=[b,A],t[4]=b,t[5]=A,t[6]=V,t[7]=pe):(V=t[6],pe=t[7]),X.useEffect(V,pe);let me,H;t[8]!==L||t[9]!==A?(me=()=>{!L&&A&&(M(!1),se(``))},H=[L,A],t[8]=L,t[9]=A,t[10]=me,t[11]=H):(me=t[10],H=t[11]),X.useEffect(me,H);let U,W;t[12]===A?(U=t[13],W=t[14]):(U=()=>{if(!A)return;let e=e=>{P.current&&!P.current.contains(e.target)&&(M(!1),se(``))};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},W=[A],t[12]=A,t[13]=U,t[14]=W),X.useEffect(U,W);let he;t[15]!==I||t[16]!==r||t[17]!==a||t[18]!==n.length?(he=e=>{let t={providerID:e.providerID,modelID:e.modelID,displayName:_(e.model,e.modelID)||e.modelID,instanceId:Ie()};I&&n.length>0&&a?a(0,t):r(t),I&&(M(!1),se(``))},t[15]=I,t[16]=r,t[17]=a,t[18]=n.length,t[19]=he):he=t[19];let ge=he,G;t[20]===x?G=t[21]:(G=x(`multirun.modelMultiSelect.search.placeholder`),t[20]=x,t[21]=G);let K;t[22]===x?K=t[23]:(K=x(`multirun.modelMultiSelect.search.noResults`),t[22]=x,t[23]=K);let q;t[24]===x?q=t[25]:(q=x(`multirun.modelMultiSelect.sections.favorites`),t[24]=x,t[25]=q);let J;t[26]===x?J=t[27]:(J=x(`multirun.modelMultiSelect.sections.recent`),t[26]=x,t[27]=J);let _e;t[28]===x?_e=t[29]:(_e=x(`multirun.modelMultiSelect.keyboard.hint`),t[28]=x,t[29]=_e);let Y;t[30]===x?Y=t[31]:(Y=x(`settings.agents.modelSelector.actions.favorite`),t[30]=x,t[31]=Y);let ve;t[32]===x?ve=t[33]:(ve=x(`settings.agents.modelSelector.actions.unfavorite`),t[32]=x,t[33]=ve);let ye;t[34]===x?ye=t[35]:(ye=x(`chat.modelControls.provider`),t[34]=x,t[35]=ye);let be;t[36]===x?be=t[37]:(be=x(`chat.modelControls.capabilities`),t[36]=x,t[37]=be);let xe;t[38]===x?xe=t[39]:(xe=x(`chat.modelControls.capability.toolCalling`),t[38]=x,t[39]=xe);let Se;t[40]===x?Se=t[41]:(Se=x(`chat.modelControls.capability.reasoning`),t[40]=x,t[41]=Se);let Z;t[42]===x?Z=t[43]:(Z=x(`chat.modelControls.modality.image`),t[42]=x,t[43]=Z);let Q;t[44]===x?Q=t[45]:(Q=x(`chat.modelControls.modality.video`),t[44]=x,t[45]=Q);let we;t[46]===x?we=t[47]:(we=x(`chat.modelControls.modality.audio`),t[46]=x,t[47]=we);let Te;t[48]===x?Te=t[49]:(Te=x(`chat.modelControls.costPerMillion`),t[48]=x,t[49]=Te);let Ee;t[50]===x?Ee=t[51]:(Ee=x(`chat.modelControls.costInput`),t[50]=x,t[51]=Ee);let De;t[52]===x?De=t[53]:(De=x(`chat.modelControls.costOutput`),t[52]=x,t[53]=De);let Oe;t[54]!==G||t[55]!==K||t[56]!==q||t[57]!==J||t[58]!==_e||t[59]!==Y||t[60]!==ve||t[61]!==ye||t[62]!==be||t[63]!==xe||t[64]!==Se||t[65]!==Z||t[66]!==Q||t[67]!==we||t[68]!==Te||t[69]!==Ee||t[70]!==De?(Oe={searchPlaceholder:G,noResults:K,favorites:q,recent:J,keyboardHint:_e,favorite:Y,unfavorite:ve,provider:ye,capabilities:be,capabilityToolCalling:xe,capabilityReasoning:Se,modalityImage:Z,modalityVideo:Q,modalityAudio:we,costPerMillion:Te,costInput:Ee,costOutput:De},t[54]=G,t[55]=K,t[56]=q,t[57]=J,t[58]=_e,t[59]=Y,t[60]=ve,t[61]=ye,t[62]=be,t[63]=xe,t[64]=Se,t[65]=Z,t[66]=Q,t[67]=we,t[68]=Te,t[69]=Ee,t[70]=De,t[71]=Oe):Oe=t[71];let ke=Oe,Ae;t[72]===h?Ae=t[73]:(Ae=ee(`relative`,h),t[72]=h,t[73]=Ae);let je;t[74]===d?je=t[75]:(je=ee(Fe,`!border-border/80 !bg-[var(--surface-subtle)] hover:!bg-[var(--interactive-hover)]/70`,d),t[74]=d,t[75]=je);let Me=!L,Ne;t[76]===A?Ne=t[77]:(Ne=()=>{M(!A)},t[76]=A,t[77]=Ne);let Pe;t[78]===v?Pe=t[79]:(Pe=v??(0,$.jsx)(O,{name:`add`,className:`h-3.5 w-3.5 mr-1`}),t[78]=v,t[79]=Pe);let Re;t[80]!==s||t[81]!==x?(Re=s??x(`multirun.modelMultiSelect.actions.addModel`),t[80]=s,t[81]=x,t[82]=Re):Re=t[82];let Ke;t[83]!==je||t[84]!==Me||t[85]!==Ne||t[86]!==Pe||t[87]!==Re?(Ke=(0,$.jsxs)(te,{ref:F,type:`button`,variant:`outline`,size:`sm`,className:je,disabled:Me,onClick:Ne,children:[Pe,Re]}),t[83]=je,t[84]=Me,t[85]=Ne,t[86]=Pe,t[87]=Re,t[88]=Ke):Ke=t[88];let qe;t[89]!==N||t[90]!==L||t[91]!==m||t[92]!==b||t[93]!==E||t[94]!==C||t[95]!==ge||t[96]!==ne||t[97]!==T||t[98]!==A||t[99]!==ke||t[100]!==z||t[101]!==ie||t[102]!==S||t[103]!==D||t[104]!==oe||t[105]!==w?(qe=A?(0,$.jsx)(`div`,{className:ee(`absolute left-0 z-50 w-[min(420px,calc(100vw-2rem))] max-w-[calc(100vw-2rem)] flex flex-col overflow-hidden rounded-xl border border-border/50 shadow-lg`,b===`top`?`bottom-full mb-1`:`top-full mt-1`,m),style:{background:`linear-gradient(var(--surface-elevated),var(--surface-elevated)),linear-gradient(var(--surface-background),var(--surface-background))`},children:(0,$.jsx)(k,{providers:S,providerOrder:ie,favoriteModels:E,recentModels:D,getMetadata:C,hiddenModels:ne,searchQuery:oe,onSearchQueryChange:se,onSelect:ge,labels:ke,selectionCount:e=>z.get(`${e.providerID}:${e.modelID}`)||0,disabled:!L,maxHeightClassName:`flex-1`,maxHeightStyle:{maxHeight:N?`${N}px`:`300px`},stickyHeaders:!0,tooltipsEnabled:A,isFavorite:e=>T(e.providerID,e.modelID),onToggleFavorite:e=>w(e.providerID,e.modelID),onEscape:()=>{M(!1),se(``)}})}):null,t[89]=N,t[90]=L,t[91]=m,t[92]=b,t[93]=E,t[94]=C,t[95]=ge,t[96]=ne,t[97]=T,t[98]=A,t[99]=ke,t[100]=z,t[101]=ie,t[102]=S,t[103]=D,t[104]=oe,t[105]=w,t[106]=qe):qe=t[106];let Je;t[107]!==Ae||t[108]!==Ke||t[109]!==qe?(Je=(0,$.jsxs)(`div`,{className:Ae,ref:P,children:[Ke,qe]}),t[107]=Ae,t[108]=Ke,t[109]=qe,t[110]=Je):Je=t[110];let Ye;t[111]!==fe||t[112]!==z||t[113]!==i||t[114]!==a||t[115]!==S||t[116]!==n||t[117]!==y||t[118]!==x?(Ye=y&&n.length>0&&(0,$.jsx)(`div`,{className:`flex flex-col gap-2 w-full`,children:n.map((e,t)=>{let n=`${e.providerID}:${e.modelID}`,r=z.get(n)||1,o=fe(e),s=S.find(t=>t.id===e.providerID)?.models?.find(t=>t.id===e.modelID),c=s?.variants?Object.keys(s.variants):[],l=c.length>0,u=e.variant??`__default__`;return(0,$.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,$.jsx)(Le,{model:e,instanceIndex:o,totalSameModel:r,onRemove:()=>i(t)}),l&&(0,$.jsxs)(le,{value:u,onValueChange:n=>{if(!a)return;let r=n===`__default__`?void 0:n;a(t,{...e,variant:r})},children:[(0,$.jsxs)(ae,{size:`chip`,className:`px-2 gap-1.5 rounded-md !border-border/80 !bg-[var(--surface-subtle)] hover:!bg-[var(--interactive-hover)]/70 typography-meta font-medium text-foreground`,children:[(0,$.jsx)(O,{name:`brain-ai-3`,className:ee(`h-3.5 w-3.5 flex-shrink-0`,u===`__default__`?`text-muted-foreground`:`text-[color:var(--status-info)]`)}),(0,$.jsx)(de,{placeholder:x(`multirun.modelMultiSelect.variant.placeholder`),children:e=>e===`__default__`?x(`multirun.modelMultiSelect.variant.default`):e})]}),(0,$.jsxs)(ce,{fitContent:!0,children:[(0,$.jsx)(j,{value:`__default__`,className:`pr-2 [&>span:first-child]:hidden`,children:x(`multirun.modelMultiSelect.variant.default`)}),c.map(Ge)]})]})]},e.instanceId)})}),t[111]=fe,t[112]=z,t[113]=i,t[114]=a,t[115]=S,t[116]=n,t[117]=y,t[118]=x,t[119]=Ye):Ye=t[119];let Xe;t[120]!==Je||t[121]!==Ye?(Xe=(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-1.5 items-center`,children:[Je,Ye]}),t[120]=Je,t[121]=Ye,t[122]=Xe):Xe=t[122];let Ze;t[123]!==u||t[124]!==o||t[125]!==n.length||t[126]!==x?(Ze=o!==void 0&&n.length<o&&(0,$.jsx)(`p`,{className:`typography-micro text-muted-foreground`,children:u===void 0?x(`multirun.modelMultiSelect.validation.minOnly`,{min:o}):x(`multirun.modelMultiSelect.validation.minToMax`,{min:o,max:u})}),t[123]=u,t[124]=o,t[125]=n.length,t[126]=x,t[127]=Ze):Ze=t[127];let Qe;return t[128]!==Xe||t[129]!==Ze?(Qe=(0,$.jsxs)(`div`,{className:`space-y-2`,children:[Xe,Ze]}),t[128]=Xe,t[129]=Ze,t[130]=Qe):Qe=t[130],Qe};function ze(e){return e.providers}function Be(e){return e.getModelMetadata}function Ve(e){return e.toggleFavoriteModel}function He(e){return e.isFavoriteModel}function Ue(e){return e.hiddenModels}function We(e){return e.providerOrder}function Ge(e){return(0,$.jsx)(j,{value:e,className:`pr-2 [&>span:first-child]:hidden`,children:e},e)}function Ke(e){let t=(0,Ce.c)(30),{git:n}=V(),r=J(e),i=Y(e),a=he(e),o=K(e),s=U(Ze),c=U(Xe),l,u;t[0]!==e||t[1]!==c||t[2]!==n||t[3]!==i||t[4]!==a?(l=()=>{!e||!n||i!==null||a||c(e,n,{silent:!0})},u=[e,n,c,i,a],t[0]=e,t[1]=c,t[2]=n,t[3]=i,t[4]=a,t[5]=l,t[6]=u):(l=t[5],u=t[6]),X.useEffect(l,u);let d;t[7]!==r?.all||t[8]!==e||t[9]!==s||t[10]!==n||t[11]!==i?(d=()=>{!e||!n||i===!0&&(r?.all||s(e,n))},t[7]=r?.all,t[8]=e,t[9]=s,t[10]=n,t[11]=i,t[12]=d):d=t[12];let f=r?.all,p;t[13]!==e||t[14]!==s||t[15]!==n||t[16]!==i||t[17]!==f?(p=[e,n,i,f,s],t[13]=e,t[14]=s,t[15]=n,t[16]=i,t[17]=f,t[18]=p):p=t[18],X.useEffect(d,p);let m=a||i===!0&&o,h;bb0:{if(!r?.all){let e;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(e=[],t[19]=e):e=t[19],h=e;break bb0}let e;t[20]===r.all?e=t[21]:(e=r.all.filter(Ye).sort(),t[20]=r.all,t[21]=e),h=e}let g=h,_;bb1:{if(!r?.all){let e;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(e=[],t[22]=e):e=t[22],_=e;break bb1}let e;t[23]===r.all?e=t[24]:(e=r.all.filter(Je).map(qe).sort(),t[23]=r.all,t[24]=e),_=e}let v=_,y;bb2:{if(!e){y=null;break bb2}if(i!==null){y=i;break bb2}if(m){y=null;break bb2}y=r?.all?!0:null}let b=y,x;return t[25]!==b||t[26]!==m||t[27]!==g||t[28]!==v?(x={localBranches:g,remoteBranches:v,isLoading:m,isGitRepository:b},t[25]=b,t[26]=m,t[27]=g,t[28]=v,t[29]=x):x=t[29],x}function qe(e){return e.replace(/^remotes\//,``)}function Je(e){return e.startsWith(`remotes/`)}function Ye(e){return!e.startsWith(`remotes/`)}function Xe(e){return e.fetchStatus}function Ze(e){return e.fetchBranches}var Qe=({directory:e,value:t,onChange:n,className:r,disabled:i,id:a})=>{let{t:o}=f(),{localBranches:s,remoteBranches:c,isLoading:l,isGitRepository:u}=Ke(e),d=X.useMemo(()=>[...s,...c.map(e=>`remotes/${e}`)],[s,c]);return X.useEffect(()=>{if(i||l||d.length===0||t&&d.includes(t))return;let r=t,a=!1;return(async()=>{try{let t=e?await oe(e).catch(()=>null):null;if(a)return;let i=localStorage.getItem(H),{sourceBranch:o,shouldClearSavedSourceBranch:s}=q({branches:d,savedSourceBranch:i,rootBranch:t});if(s&&localStorage.removeItem(H),a||r&&d.includes(r))return;o&&n(o)}catch{}})(),()=>{a=!0}},[d,e,i,l,n,t]),(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(le,{value:t,onValueChange:n,disabled:i||!u||l,children:[(0,$.jsx)(ae,{id:a,size:`lg`,className:r??`w-fit typography-meta text-foreground`,children:(0,$.jsx)(de,{placeholder:o(l?`multiRun.branchSelector.status.loadingBranches`:`multiRun.branchSelector.placeholder.selectSourceBranch`)})}),(0,$.jsx)(ce,{className:`max-h-[280px] max-w-[320px]`,children:l?(0,$.jsx)(`div`,{className:`px-2 py-4 text-center typography-meta text-muted-foreground`,children:o(`multiRun.branchSelector.status.loadingBranches`)}):s.length===0&&c.length===0?(0,$.jsx)(`div`,{className:`px-2 py-4 text-center typography-meta text-muted-foreground`,children:o(`multiRun.branchSelector.status.noBranchesFound`)}):(0,$.jsxs)($.Fragment,{children:[s.length>0&&(0,$.jsxs)(se,{children:[(0,$.jsx)(F,{className:`font-semibold text-foreground`,children:o(`multiRun.branchSelector.groups.localBranches`)}),s.map(e=>(0,$.jsx)(j,{value:e,className:`whitespace-normal break-all`,children:e},e))]}),s.length>0&&c.length>0&&(0,$.jsx)(I,{}),c.length>0&&(0,$.jsxs)(se,{children:[(0,$.jsx)(F,{className:`font-semibold text-foreground`,children:o(`multiRun.branchSelector.groups.remoteBranches`)}),c.map(e=>(0,$.jsx)(j,{value:`remotes/${e}`,className:`whitespace-normal break-all`,children:e},`remotes/${e}`))]})]})})]}),u===!1&&(0,$.jsx)(`p`,{className:`typography-micro text-muted-foreground/70 mt-2`,children:o(`multiRun.branchSelector.status.notInGitRepository`)})]})},$e=e=>{let t=(0,Ce.c)(36),{value:n,onChange:r,className:i,disabled:a,id:o,portalToBody:s}=e,{t:c}=f(),l=g(et),u=g(tt),d=g(nt),p;t[0]===l?p=t[1]:(p=l(),t[0]=l,t[1]=p);let m=p,h;t[2]===m?h=t[3]:(h=m.filter(rt),t[2]=m,t[3]=h);let _=h,v,y;t[4]!==m.length||t[5]!==u?(v=()=>{m.length===0&&u()},y=[m.length,u],t[4]=m.length,t[5]=u,t[6]=v,t[7]=y):(v=t[6],y=t[7]),X.useEffect(v,y);let b,x;t[8]!==d||t[9]!==a||t[10]!==r||t[11]!==_||t[12]!==n?(b=()=>{if(a)return;let e=n.trim();if(e.length>0&&_.some(t=>t.name===e))return;let t=typeof d==`string`&&d.trim().length>0?d.trim():null;if(t&&_.some(e=>e.name===t)){r(t);return}let i=_[0]?.name;i&&r(i)},x=[d,a,r,_,n],t[8]=d,t[9]=a,t[10]=r,t[11]=_,t[12]=n,t[13]=b,t[14]=x):(b=t[13],x=t[14]),X.useEffect(b,x);let S=n.trim().length>0?n:void 0,C;t[15]===i?C=t[16]:(C=ee(`max-w-full typography-meta text-foreground !border-border/80 !bg-[var(--surface-subtle)] hover:!bg-[var(--interactive-hover)]/70 data-[popup-open]:!bg-[var(--interactive-active)]/70`,i),t[15]=i,t[16]=C);let w;t[17]===c?w=t[18]:(w=c(`multirun.agentSelector.placeholder`),t[17]=c,t[18]=w);let T;t[19]===w?T=t[20]:(T=(0,$.jsx)(de,{placeholder:w}),t[19]=w,t[20]=T);let E;t[21]!==o||t[22]!==C||t[23]!==T?(E=(0,$.jsx)(ae,{id:o,size:`lg`,className:C,children:T}),t[21]=o,t[22]=C,t[23]=T,t[24]=E):E=t[24];let D;t[25]===_?D=t[26]:(D=_.length>0&&(0,$.jsx)(se,{children:_.map(it)}),t[25]=_,t[26]=D);let O;t[27]!==s||t[28]!==D?(O=(0,$.jsx)(ce,{fitContent:!0,portalToBody:s,children:D}),t[27]=s,t[28]=D,t[29]=O):O=t[29];let te;return t[30]!==a||t[31]!==r||t[32]!==S||t[33]!==E||t[34]!==O?(te=(0,$.jsxs)(le,{value:S,onValueChange:r,disabled:a,children:[E,O]}),t[30]=a,t[31]=r,t[32]=S,t[33]=E,t[34]=O,t[35]=te):te=t[35],te};function et(e){return e.getVisibleAgents}function tt(e){return e.loadAgents}function nt(e){return e.currentAgentName}function rt(e){return v(e.mode)}function it(e){return(0,$.jsx)(j,{value:e.name,className:`w-auto whitespace-nowrap`,children:e.name},e.name)}var at=10485760,ot=5,st=e=>{let t=(0,Ce.c)(3),{children:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,$.jsx)(R,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,tabIndex:-1,className:`inline-flex items-center justify-center text-muted-foreground/50 hover:text-muted-foreground transition-colors`,children:(0,$.jsx)(O,{name:`information`,className:`h-3.5 w-3.5`})})}),t[0]=r):r=t[0];let i;return t[1]===n?i=t[2]:(i=(0,$.jsxs)(B,{children:[r,(0,$.jsx)(z,{side:`top`,className:`max-w-[240px]`,children:n})]}),t[1]=n,t[2]=i),i},ct=e=>{let t=(0,Ce.c)(9),{htmlFor:n,required:r,children:i,info:a}=e,o;t[0]===r?o=t[1]:(o=r&&(0,$.jsx)(`span`,{className:`text-destructive ml-0.5`,children:`*`}),t[0]=r,t[1]=o);let s;t[2]!==i||t[3]!==n||t[4]!==o?(s=(0,$.jsxs)(`label`,{htmlFor:n,className:`typography-meta font-medium text-foreground`,children:[i,o]}),t[2]=i,t[3]=n,t[4]=o,t[5]=s):s=t[5];let c=a&&a,l;return t[6]!==s||t[7]!==c?(l=(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[s,c]}),t[6]=s,t[7]=c,t[8]=l):l=t[8],l},lt=e=>{let t=D(e.path),n=e.icon?N[e.icon]:null,r=e.color?ue[e.color]:void 0,i=(0,$.jsx)(O,{name:n??`folder`,className:`h-3.5 w-3.5`,style:r?{color:r}:void 0});return(0,$.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-1.5`,children:[(0,$.jsx)(`span`,{className:`flex h-4 w-4 shrink-0 items-center justify-center overflow-hidden text-muted-foreground`,children:e.iconImage?(0,$.jsx)(M,{project:e,className:`size-full object-contain`,fallback:i}):i}),(0,$.jsx)(`span`,{className:`truncate`,children:t})]})},ut=({initialPrompt:e,onCreated:n,onCancel:r,isWindowed:i=!1})=>{let{t:a}=f(),[s,c]=X.useState(``),[l,p]=X.useState(()=>[{id:Ie(),prompt:``,models:[]}]),[h,g]=X.useState(``),[_,v]=X.useState([]),[y,b]=X.useState(!1),[S,T]=X.useState([]),[E,D]=X.useState(!1),[ne,re]=X.useState(!1),[ie,k]=X.useState(!0),M=X.useRef(null),oe=o(e=>e.currentDirectory??null),se=X.useMemo(()=>{if(typeof window>`u`)return null;let e=window.__VSCODE_CONFIG__?.workspaceFolder;return typeof e==`string`&&e.trim().length>0?e.trim():null},[]),N=C(e=>e.activeProjectId),ue=C(e=>e.setActiveProjectIdOnly),P=C(e=>e.projects),[F,I]=X.useState(()=>N??null);X.useEffect(()=>{if(N){I(N);return}!F&&P.length>0&&I(P[0].id)},[N,P,F]);let V=X.useMemo(()=>F?P.find(e=>e.id===F)??null:null,[P,F]),pe=V?.path??oe,me=u(e=>{I(e),e!==N&&ue(e)}),H=X.useMemo(()=>{if(V?.path)return{id:V.id,path:V.path};let e=oe??se;return e?{id:`path:${e}`,path:e}:null},[V,oe,se]),[U]=X.useState(()=>typeof window<`u`&&t()),W=X.useMemo(()=>typeof navigator>`u`?!1:/Macintosh|Mac OS X/.test(navigator.userAgent||``),[]),he=fe(),ge=X.useMemo(()=>{if(typeof window>`u`)return null;let e=window.__OPENCHAMBER_MACOS_MAJOR__;if(typeof e==`number`&&Number.isFinite(e)&&e>0)return e;if(typeof navigator>`u`)return null;let t=(navigator.userAgent||``).match(/Mac OS X (\d+)[._](\d+)/);if(!t)return null;let n=Number.parseInt(t[1],10),r=Number.parseInt(t[2],10);return Number.isNaN(n)?null:n===10?r:n},[]),G=X.useMemo(()=>U&&W||he?`pl-[5.5rem]`:`pl-3`,[U,W,he]),K=X.useMemo(()=>!U||!W||ge===null?``:ge>=26?`h-12`:ge<=15?`h-14`:``,[U,W,ge]),q=u(async e=>{e.target.closest(`button, a, input, select, textarea`)||e.button===0&&U&&await d()}),J=u(e=>{r&&e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),r())}),_e=!!r;X.useEffect(()=>{if(_e)return window.addEventListener(`keydown`,J,!0),()=>window.removeEventListener(`keydown`,J,!0)},[_e]);let[Y,ye]=X.useState(``),{isLoading:Ce,isGitRepository:Z}=Ke(pe),Q=X.useRef(!1),we=Z===!0,Te=we&&ie;X.useEffect(()=>{if(Z===!1){Q.current=!0,k(!1);return}Z===!0&&Q.current&&(Q.current=!1,k(!0))},[Z]);let Ee=Pe(e=>e.createMultiRun),De=Pe(e=>e.error),Oe=Pe(e=>e.clearError);X.useEffect(()=>{typeof e==`string`&&e.trim().length>0&&p(t=>{let n=[...t];return n.length>0&&!n[0].prompt.trim()&&(n[0]={...n[0],prompt:e}),n})},[e]),X.useEffect(()=>{if(!H)return;let e=!1;return re(!0),(async()=>{try{let t=await m(H);e||T(t)}catch{}finally{e||re(!1)}})(),()=>{e=!0}},[H]);let ke=u((e,t)=>{p(n=>n.map(n=>n.id===e?{...n,...t}:n))}),Ae=u(e=>{p(t=>t.filter(t=>t.id!==e))}),je=u(()=>{p(e=>[...e,{id:Ie(),prompt:``,models:[]}])}),Me=async e=>{let t=e.target.files;if(!t)return;let n=0;for(let e=0;e<t.length;e++){let r=t[e];if(r.size>at){w.error(a(`multirun.launcher.toast.fileTooLarge`,{fileName:r.name}));continue}try{let e=await new Promise((e,t)=>{let n=new FileReader;n.onload=()=>e(n.result),n.onerror=t,n.readAsDataURL(r)});v(t=>[...t,{id:Ie(),filename:r.name,mimeType:r.type||`application/octet-stream`,size:r.size,dataUrl:e}]),n++}catch(e){console.error(`File attach failed`,e),w.error(a(`multirun.launcher.toast.attachFailed`,{fileName:r.name}))}}n>0&&w.success(a(n===1?`multirun.launcher.toast.attachedSingle`:`multirun.launcher.toast.attachedPlural`,{count:n})),M.current&&(M.current.value=``)},Ne=e=>{v(t=>t.filter(t=>t.id!==e))},Fe=X.useMemo(()=>l.reduce((e,t)=>e+t.models.length,0),[l]),Le=async e=>{e.preventDefault();let t=l.filter(e=>e.prompt.trim()&&e.models.length>=1);if(t.length!==0&&!(Fe<1)){b(!0),Oe();try{F&&F!==N&&ue(F);let e=_.map(e=>({mime:e.mimeType,filename:e.filename,url:e.dataUrl})),r=S.filter(e=>e.trim().length>0),i=t.map(e=>({prompt:e.prompt.trim(),models:e.models.map(e=>({providerID:e.providerID,modelID:e.modelID,displayName:e.displayName,variant:e.variant}))})),a={name:s.trim(),groups:i,agent:h||void 0,worktreeBaseBranch:Te?Y:void 0,isolateRuns:Te,files:e.length>0?e:void 0,setupCommands:r.length>0?r:void 0},o=await Ee(a);o&&(o.firstSessionId&&x.getState().setCurrentSession(o.firstSessionId),n?.())}finally{b(!1)}}},Re=!!(s.trim()&&l.some(e=>e.prompt.trim()&&e.models.length>=1)&&Fe>=1&&pe&&!Ce&&(Z===!1||!Te||Y)),ze=S.filter(e=>e.trim()).length;return(0,$.jsxs)(`form`,{onSubmit:Le,className:`flex flex-col h-full bg-background`,children:[i?null:(0,$.jsxs)(`header`,{onMouseDown:q,className:ee(`relative flex h-12 shrink-0 items-center justify-center border-b app-region-drag select-none`,G,K),style:{borderColor:`var(--interactive-border)`},children:[(0,$.jsx)(`h1`,{className:`typography-ui-label font-medium`,children:a(`multirun.launcher.title`)}),r&&(0,$.jsx)(`div`,{className:`absolute right-0 flex items-center pr-3`,children:(0,$.jsxs)(B,{children:[(0,$.jsx)(R,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,onClick:r,"aria-label":a(`multirun.launcher.actions.closeEsc`),className:`inline-flex h-9 w-9 items-center justify-center p-2 rounded-lg text-muted-foreground hover:text-foreground hover:bg-interactive-hover/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary app-region-no-drag`,children:(0,$.jsx)(O,{name:`close`,className:`h-5 w-5`})})}),(0,$.jsx)(z,{children:(0,$.jsx)(`p`,{children:a(`multirun.launcher.actions.closeEsc`)})})]})})]}),(0,$.jsx)(ve,{className:`flex-1 min-h-0 overflow-auto`,size:64,hideTopShadow:!0,children:(0,$.jsx)(`div`,{className:`mx-auto w-full max-w-2xl px-4 sm:px-6 py-5`,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,$.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-x-4 gap-y-3`,children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(ct,{htmlFor:`multirun-project`,required:!0,children:a(`multirun.launcher.project.label`)}),P.length>0?(0,$.jsxs)(le,{value:F??void 0,onValueChange:me,children:[(0,$.jsx)(ae,{id:`multirun-project`,size:`lg`,className:`w-fit max-w-full`,children:V?(0,$.jsx)(de,{children:lt(V)}):(0,$.jsx)(de,{placeholder:a(`multirun.launcher.project.placeholder`)})}),(0,$.jsx)(ce,{fitContent:!0,children:P.map(e=>(0,$.jsx)(j,{value:e.id,className:`max-w-[24rem]`,children:lt(e)},e.id))})]}):(0,$.jsx)(`p`,{className:`typography-micro text-muted-foreground py-2`,children:a(`multirun.launcher.project.empty`)})]}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(ct,{htmlFor:`group-name`,required:!0,info:(0,$.jsx)(st,{children:a(`multirun.launcher.groupName.info`)}),children:a(`multirun.launcher.groupName.label`)}),(0,$.jsx)(L,{id:`group-name`,value:s,onChange:e=>c(e.target.value),placeholder:a(`multirun.launcher.groupName.placeholder`),className:`typography-meta w-full`,required:!0})]}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(ct,{htmlFor:`multirun-worktree-base-branch`,info:(0,$.jsx)(st,{children:a(`multirun.launcher.baseBranch.info`)}),children:a(`multirun.launcher.baseBranch.label`)}),(0,$.jsx)(Qe,{directory:pe,value:Y,onChange:ye,disabled:!Te,id:`multirun-worktree-base-branch`}),(0,$.jsxs)(`label`,{className:`mt-1.5 flex w-fit items-center gap-1.5 typography-micro text-muted-foreground`,children:[(0,$.jsx)(A,{checked:ie,onChange:k,disabled:!we,ariaLabel:a(`multirun.launcher.isolateRuns.label`)}),(0,$.jsx)(`span`,{children:a(`multirun.launcher.isolateRuns.label`)})]})]}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(ct,{htmlFor:`multirun-agent`,info:(0,$.jsx)(st,{children:a(`multirun.launcher.agent.info`)}),children:a(`multirun.launcher.agent.label`)}),(0,$.jsx)($e,{value:h,onChange:g,id:`multirun-agent`})]})]}),(0,$.jsxs)(Se,{open:E,onOpenChange:D,children:[(0,$.jsxs)(xe,{className:`w-full flex items-center gap-2 py-1.5 px-2 -mx-2 rounded-lg hover:bg-[var(--interactive-hover)]/50 transition-colors group`,children:[(0,$.jsx)(O,{name:`terminal`,className:`h-3.5 w-3.5 text-muted-foreground/70`}),(0,$.jsx)(`span`,{className:`typography-meta font-medium text-muted-foreground group-hover:text-foreground transition-colors`,children:a(`multirun.launcher.setupCommands.label`)}),ze>0&&(0,$.jsx)(`span`,{className:`inline-flex items-center justify-center h-4 min-w-4 px-1 rounded-full typography-micro font-medium`,style:{backgroundColor:`var(--primary-base)`,color:`var(--primary-foreground)`,fontSize:`0.625rem`,lineHeight:1},children:ze}),(0,$.jsx)(O,{name:`arrow-down-s`,className:ee(`h-3.5 w-3.5 text-muted-foreground/50 transition-transform duration-200 ml-auto`,E&&`rotate-180`)})]}),(0,$.jsx)(be,{children:(0,$.jsx)(`div`,{className:`pt-2 space-y-1.5`,children:ne?(0,$.jsx)(`p`,{className:`typography-meta text-muted-foreground/70 px-2`,children:a(`multirun.launcher.setupCommands.loading`)}):(0,$.jsxs)($.Fragment,{children:[S.map((e,t)=>(0,$.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,$.jsx)(L,{value:e,onChange:e=>{let n=[...S];n[t]=e.target.value,T(n)},placeholder:a(`multirun.launcher.setupCommands.commandPlaceholder`),className:`h-8 flex-1 font-mono text-xs`}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>T(S.filter((e,n)=>n!==t)),className:`flex-shrink-0 flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground hover:text-destructive hover:bg-destructive/10 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/50`,"aria-label":a(`multirun.launcher.setupCommands.removeCommandAria`),children:(0,$.jsx)(O,{name:`close`,className:`h-3.5 w-3.5`})})]},`${e}-${t}`)),(0,$.jsxs)(`button`,{type:`button`,onClick:()=>T([...S,``]),className:`flex items-center gap-1 typography-meta text-muted-foreground hover:text-foreground transition-colors px-1`,children:[(0,$.jsx)(O,{name:`add`,className:`h-3 w-3`}),a(`multirun.launcher.setupCommands.addCommand`)]})]})})})]}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,$.jsx)(ct,{htmlFor:`prompt`,required:!0,children:a(`multirun.launcher.attachments.label`)}),(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,$.jsx)(`input`,{ref:M,type:`file`,multiple:!0,className:`hidden`,onChange:Me,accept:`*/*`}),(0,$.jsxs)(B,{children:[(0,$.jsx)(R,{asChild:!0,children:(0,$.jsxs)(`button`,{type:`button`,onClick:()=>M.current?.click(),className:`inline-flex items-center gap-1 h-6 px-2 rounded-md typography-micro text-muted-foreground hover:text-foreground hover:bg-[var(--interactive-hover)]/50 transition-colors`,children:[(0,$.jsx)(O,{name:`attachment-2`,className:`h-3 w-3`}),a(`multirun.launcher.attachments.attach`)]})}),(0,$.jsx)(z,{children:a(`multirun.launcher.attachments.tooltip`)})]}),_.map(e=>(0,$.jsxs)(`div`,{className:`inline-flex items-center gap-1 px-1.5 py-0.5 rounded-md typography-micro border`,style:{backgroundColor:`var(--surface-elevated)`,borderColor:`var(--interactive-border)`},children:[e.mimeType.startsWith(`image/`)?(0,$.jsx)(O,{name:`file-image`,className:`h-3 w-3 text-muted-foreground`}):(0,$.jsx)(O,{name:`file`,className:`h-3 w-3 text-muted-foreground`}),(0,$.jsx)(`span`,{className:`truncate max-w-[100px]`,title:e.filename,children:e.filename}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>Ne(e.id),className:`text-muted-foreground hover:text-destructive`,children:(0,$.jsx)(O,{name:`close`,className:`h-3 w-3`})})]},e.id))]})]}),l.map((e,t)=>(0,$.jsx)(dt,{group:e,groupIndex:t,canRemove:l.length>1,onUpdate:ke,onRemove:Ae},e.id)),(0,$.jsxs)(`button`,{type:`button`,onClick:je,className:`flex items-center gap-1.5 py-2 px-3 -mx-3 rounded-lg typography-meta font-medium text-muted-foreground hover:text-foreground hover:bg-[var(--interactive-hover)]/50 transition-colors`,children:[(0,$.jsx)(O,{name:`add`,className:`h-3.5 w-3.5`}),a(`multirun.launcher.groups.addGroup`)]}),De&&(0,$.jsx)(`div`,{className:`px-3 py-2 rounded-lg typography-meta`,style:{backgroundColor:`var(--status-error-background)`,color:`var(--status-error)`,borderWidth:1,borderColor:`var(--status-error-border)`},children:De})]})})}),(0,$.jsx)(`div`,{className:`shrink-0 px-4 sm:px-6 py-3`,children:(0,$.jsxs)(`div`,{className:`mx-auto w-full max-w-2xl flex items-center justify-end gap-2`,children:[!Te&&Z!==null?(0,$.jsxs)(`div`,{className:`mr-auto flex min-w-0 items-center gap-1.5 typography-micro text-muted-foreground`,children:[(0,$.jsx)(O,{name:`information`,className:`h-3.5 w-3.5 shrink-0`}),(0,$.jsx)(`span`,{className:`truncate`,children:a(`multirun.launcher.project.gitRequired`)})]}):null,(0,$.jsx)(te,{type:`button`,variant:`ghost`,size:`sm`,onClick:r,children:a(`multirun.launcher.actions.cancel`)}),(0,$.jsx)(te,{type:`submit`,size:`sm`,disabled:!Re||y,children:y?a(`multirun.launcher.actions.creating`):(0,$.jsx)($.Fragment,{children:a(`multirun.launcher.actions.startWithRunCount`,{count:Fe})})})]})})]})},dt=e=>{let t=(0,Ce.c)(104),{group:n,groupIndex:r,canRemove:i,onUpdate:a,onRemove:o}=e,{t:s}=f(),[c,l]=X.useState(!1),[d,p]=X.useState(``),[m,h]=X.useState(!1),[g,_]=X.useState(``),[v,y]=X.useState(!1),[b,x]=X.useState(``),S=X.useRef(null),C=X.useRef(null),w=X.useRef(null),T=X.useRef(null),E;t[0]!==n.id||t[1]!==n.models||t[2]!==a?(E=e=>{n.models.length>=ot||a(n.id,{models:[...n.models,e]})},t[0]=n.id,t[1]=n.models,t[2]=a,t[3]=E):E=t[3];let D=u(E),ee;t[4]!==n.id||t[5]!==n.models||t[6]!==a?(ee=e=>{a(n.id,{models:n.models.filter((t,n)=>n!==e)})},t[4]=n.id,t[5]=n.models,t[6]=a,t[7]=ee):ee=t[7];let te=u(ee),ne;t[8]!==n.id||t[9]!==n.models||t[10]!==a?(ne=(e,t)=>{a(n.id,{models:n.models.map((n,r)=>r===e?t:n)})},t[8]=n.id,t[9]=n.models,t[10]=a,t[11]=ne):ne=t[11];let re=u(ne),ie;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(ie=(e,t)=>{if(e.startsWith(`/`)){let n=e.indexOf(` `),r=e.indexOf(`
|
|
2
|
-
`),i=Math.min(n===-1?e.length:n,r===-1?e.length:r);if(t<=i&&n===-1){_(e.substring(1,i)),h(!0),l(!1),y(!1);return}}h(!1);let n=e.substring(0,t),r=n.lastIndexOf(`#`);if(r!==-1){let e=r>0?n[r-1]:null,t=n.substring(r+1);if((!e||/\s/.test(e))&&!t.includes(` `)&&!t.includes(`
|
|
3
|
-
`)){x(t),y(!0),l(!1);return}}y(!1);let i=n.lastIndexOf(`@`);if(i!==-1){let e=i>0?n[i-1]:null,t=n.substring(i+1);(!e||/\s/.test(e))&&!t.includes(` `)&&!t.includes(`
|
|
4
|
-
`)?(p(t),l(!0)):l(!1);return}l(!1)},t[12]=ie):ie=t[12];let k=u(ie),A;t[13]!==n.id||t[14]!==a?(A=e=>{a(n.id,{prompt:e})},t[13]=n.id,t[14]=a,t[15]=A):A=t[15];let j=u(A),M;t[16]!==n.prompt||t[17]!==j||t[18]!==k?(M=e=>{let t=n.prompt,r=S.current?.selectionStart??t.length,i=t.substring(0,r).lastIndexOf(`@`),a=e.relativePath&&e.relativePath.trim().length>0?e.relativePath.trim():e.path||e.name,o=_e(t,i===-1?r:i,r,`@${a}`);j(o.text),l(!1),p(``),requestAnimationFrame(()=>{let e=S.current;e&&(e.selectionStart=o.caret,e.selectionEnd=o.caret,e.focus()),k(o.text,o.caret)})},t[16]=n.prompt,t[17]=j,t[18]=k,t[19]=M):M=t[19];let ae=u(M),oe;t[20]!==n.prompt||t[21]!==j||t[22]!==k?(oe=e=>{let t=n.prompt,r=S.current?.selectionStart??t.length,i=t.substring(0,r).lastIndexOf(`@`),a=_e(t,i===-1?r:i,r,`@${e}`);j(a.text),l(!1),p(``),requestAnimationFrame(()=>{let e=S.current;e&&(e.selectionStart=a.caret,e.selectionEnd=a.caret,e.focus()),k(a.text,a.caret)})},t[20]=n.prompt,t[21]=j,t[22]=k,t[23]=oe):oe=t[23];let se=u(oe),ce;t[24]!==j||t[25]!==k?(ce=e=>{let t=`/${e.name} `;j(t),h(!1),_(``),y(!1),requestAnimationFrame(()=>{let e=S.current;e&&(e.focus(),e.selectionStart=e.value.length,e.selectionEnd=e.value.length),k(t,t.length)})},t[24]=j,t[25]=k,t[26]=ce):ce=t[26];let N=u(ce),le;t[27]!==n.prompt||t[28]!==j||t[29]!==k?(le=(e,t)=>{let r=n.prompt,i=S.current?.selectionStart??r.length,a=r.substring(0,i).lastIndexOf(`#`),o=a===-1?i:a,s=`${r.substring(0,o)}#${t} ${r.substring(i)}`,c=o+t.length+2;j(s),y(!1),x(``),requestAnimationFrame(()=>{let e=S.current;e&&(e.selectionStart=c,e.selectionEnd=c,e.focus()),k(s,c)})},t[27]=n.prompt,t[28]=j,t[29]=k,t[30]=le):le=t[30];let ue=u(le),P;t[31]!==m||t[32]!==c||t[33]!==v?(P=e=>{if(m&&w.current&&(e.key===`Enter`||e.key===`ArrowUp`||e.key===`ArrowDown`||e.key===`Escape`||e.key===`Tab`)){e.preventDefault(),w.current.handleKeyDown(e.key);return}c&&C.current&&(e.key===`Enter`||e.key===`ArrowUp`||e.key===`ArrowDown`||e.key===`Escape`||e.key===`Tab`)&&(e.preventDefault(),C.current.handleKeyDown(e.key)),v&&T.current&&(e.key===`Enter`||e.key===`ArrowUp`||e.key===`ArrowDown`||e.key===`Escape`||e.key===`Tab`)&&(e.preventDefault(),T.current.handleKeyDown(e.key))},t[31]=m,t[32]=c,t[33]=v,t[34]=P):P=t[34];let F=u(P),de=r+1,I;t[35]!==s||t[36]!==de?(I=s(`multirun.launcher.groups.groupLabel`,{index:de}),t[35]=s,t[36]=de,t[37]=I):I=t[37];let L;t[38]===I?L=t[39]:(L=(0,$.jsx)(`span`,{className:`typography-meta font-medium text-foreground`,children:I}),t[38]=I,t[39]=L);let R;t[40]!==i||t[41]!==n.id||t[42]!==o||t[43]!==s?(R=i&&(0,$.jsx)(`button`,{type:`button`,onClick:()=>o(n.id),className:`inline-flex h-6 w-6 items-center justify-center rounded-md text-muted-foreground hover:text-destructive hover:bg-destructive/10`,"aria-label":s(`multirun.launcher.groups.removeGroup`),children:(0,$.jsx)(O,{name:`close`,className:`h-3.5 w-3.5`})}),t[40]=i,t[41]=n.id,t[42]=o,t[43]=s,t[44]=R):R=t[44];let z;t[45]!==L||t[46]!==R?(z=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[L,R]}),t[45]=L,t[46]=R,t[47]=z):z=t[47];let B;t[48]===s?B=t[49]:(B=s(`multirun.launcher.groups.prompt.label`),t[48]=s,t[49]=B);let fe;t[50]===B?fe=t[51]:(fe=(0,$.jsx)(ct,{required:!0,children:B}),t[50]=B,t[51]=fe);let V=n.prompt,H;t[52]!==j||t[53]!==k?(H=e=>{let t=e.target.value;j(t);let n=e.target.selectionStart??t.length;k(t,n)},t[52]=j,t[53]=k,t[54]=H):H=t[54];let U;t[55]===s?U=t[56]:(U=s(`multirun.launcher.groups.prompt.placeholder`),t[55]=s,t[56]=U);let W;t[57]!==n.prompt||t[58]!==F||t[59]!==H||t[60]!==U?(W=(0,$.jsx)(ye,{ref:S,value:V,onChange:H,onKeyDown:F,placeholder:U,className:`typography-meta min-h-[80px] max-h-[200px] resize-none overflow-y-auto field-sizing-content`,required:!0}),t[57]=n.prompt,t[58]=F,t[59]=H,t[60]=U,t[61]=W):W=t[61];let he;t[62]!==g||t[63]!==N||t[64]!==m?(he=m?(0,$.jsx)(pe,{ref:w,searchQuery:g,onCommandSelect:N,onClose:()=>h(!1),style:{left:0,top:`auto`,bottom:`calc(100% + 6px)`,marginBottom:0,maxWidth:`100%`}}):null,t[62]=g,t[63]=N,t[64]=m,t[65]=he):he=t[65];let G;t[66]!==se||t[67]!==ae||t[68]!==d||t[69]!==c?(G=c?(0,$.jsx)(ge,{ref:C,searchQuery:d,onFileSelect:ae,onAgentSelect:se,onClose:()=>l(!1),style:{left:0,top:`auto`,bottom:`calc(100% + 6px)`,marginBottom:0,maxWidth:`100%`}}):null,t[66]=se,t[67]=ae,t[68]=d,t[69]=c,t[70]=G):G=t[70];let K;t[71]!==ue||t[72]!==v||t[73]!==b?(K=v?(0,$.jsx)(me,{ref:T,searchQuery:b,onSnippetSelect:ue,onClose:()=>y(!1),style:{left:0,top:`auto`,bottom:`calc(100% + 6px)`,marginBottom:0,maxWidth:`100%`}}):null,t[71]=ue,t[72]=v,t[73]=b,t[74]=K):K=t[74];let q;t[75]!==W||t[76]!==he||t[77]!==G||t[78]!==K?(q=(0,$.jsxs)(`div`,{className:`relative`,children:[W,he,G,K]}),t[75]=W,t[76]=he,t[77]=G,t[78]=K,t[79]=q):q=t[79];let J;t[80]!==fe||t[81]!==q?(J=(0,$.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[fe,q]}),t[80]=fe,t[81]=q,t[82]=J):J=t[82];let Y;t[83]===s?Y=t[84]:(Y=s(`multirun.launcher.models.info`,{max:ot}),t[83]=s,t[84]=Y);let ve;t[85]===Y?ve=t[86]:(ve=(0,$.jsx)(st,{children:Y}),t[85]=Y,t[86]=ve);let be;t[87]===s?be=t[88]:(be=s(`multirun.launcher.models.label`),t[87]=s,t[88]=be);let xe;t[89]!==ve||t[90]!==be?(xe=(0,$.jsx)(ct,{required:!0,info:ve,children:be}),t[89]=ve,t[90]=be,t[91]=xe):xe=t[91];let Se;t[92]!==n.models||t[93]!==D||t[94]!==te||t[95]!==re?(Se=(0,$.jsx)(Re,{selectedModels:n.models,onAdd:D,onRemove:te,onUpdate:re,minModels:1,maxModels:ot}),t[92]=n.models,t[93]=D,t[94]=te,t[95]=re,t[96]=Se):Se=t[96];let Z;t[97]!==xe||t[98]!==Se?(Z=(0,$.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[xe,Se]}),t[97]=xe,t[98]=Se,t[99]=Z):Z=t[99];let Q;return t[100]!==z||t[101]!==J||t[102]!==Z?(Q=(0,$.jsxs)(`div`,{className:`rounded-lg border border-border p-3 space-y-3`,children:[z,J,Z]}),t[100]=z,t[101]=J,t[102]=Z,t[103]=Q):Q=t[103],Q};export{De as a,Ie as i,$e as n,Te as o,Re as r,ut as t};
|