@openchambery/web 1.19.0-beta.13 → 1.19.0-beta.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{AgentAvatar-DDcjamcJ.js → AgentAvatar-CWn_73qY.js} +1 -1
- package/dist/assets/AssistantView-IwSiXUWz.js +1 -0
- package/dist/assets/{ChatContainer-DZPnS2OI.js → ChatContainer-CHfM-U1H.js} +42 -42
- package/dist/assets/ContextPanel-BesmM_Hq.js +288 -0
- package/dist/assets/{DiagramView-B9fIP1uk.js → DiagramView-LOmDkMxq.js} +1 -1
- package/dist/assets/{FadeInOnReveal-By2F9vcI.js → FadeInOnReveal-BpIMrqet.js} +1 -1
- package/dist/assets/{Icon-DpjYnXxn.js → Icon-BAf2hhrw.js} +1 -1
- package/dist/assets/{MarkdownRendererImpl-CJZfv3ZG.js → MarkdownRendererImpl-DPQH-RU2.js} +1 -1
- package/dist/assets/{MobileDetailNavigation-TZmiqs_4.js → MobileDetailNavigation-BUKv_Uo6.js} +1 -1
- package/dist/assets/{MobileShareBridge-Cr2Na6iM.js → MobileShareBridge-BB1IN6uM.js} +2 -2
- package/dist/assets/{MobileSurface-B-xtWRhK.js → MobileSurface-BOpXWr2P.js} +1 -1
- package/dist/assets/{MultiRunWindow--TN8qxUx.js → MultiRunWindow-B2fU3VrS.js} +1 -1
- package/dist/assets/{OnboardingScreen-BF8BuaBh.js → OnboardingScreen-CzxsmiJZ.js} +1 -1
- package/dist/assets/OverlayScrollbar-DtQqhl0Z.js +2 -0
- package/dist/assets/{SettingsView-BwtE9Hby.js → SettingsView-TvYN6sVZ.js} +7 -7
- package/dist/assets/{SettingsWindow-D_t2z88w.js → SettingsWindow-M3NdbiCA.js} +1 -1
- package/dist/assets/{TerminalView-BJlWRZwf.js → TerminalView-R3hQJ4xh.js} +1 -1
- package/dist/assets/{ToolOutputDialog-CjP9DdZl.js → ToolOutputDialog-PV9wcM-0.js} +1 -1
- package/dist/assets/{appThemeRegistry-CNcq8eKx.js → appThemeRegistry-6neIzVGD.js} +2 -2
- package/dist/assets/{button-C7OXr4ae.js → button-DfF088a8.js} +1 -1
- package/dist/assets/{clipboard-O3XtpG2j.js → clipboard-DyCy8o-j.js} +1 -1
- package/dist/assets/{collapsible-DaEya6b6.js → collapsible-CVL-5iEB.js} +1 -1
- package/dist/assets/{desktopHosts-Txp4xOVQ.js → desktopHosts-Dzx3McaD.js} +1 -1
- package/dist/assets/{desktopRelayRestore-C_FSEHKM.js → desktopRelayRestore-B9S0Rp5s.js} +1 -1
- package/dist/assets/{dialog-BBR8o-ss.js → dialog-BpUGcA8h.js} +1 -1
- package/dist/assets/{es-Dhnp9uFc.js → es-L71xM_T9.js} +2 -2
- package/dist/assets/{fileQueries-B_fTkH6s.js → fileQueries-_VUJM8AE.js} +1 -1
- package/dist/assets/{fr-BSDdgLmw.js → fr-DDeqVFFE.js} +3 -3
- package/dist/assets/{gitApi-BDP5AvDM.js → gitApi-DgbthnYA.js} +1 -1
- package/dist/assets/{input-BzYA603C.js → input-Ca2tUhgN.js} +1 -1
- package/dist/assets/insertionBoundaries-CS86cw94.js +1 -0
- package/dist/assets/{ja-DSiOtWVF.js → ja-Cb5UuJfO.js} +3 -3
- package/dist/assets/{ko-BHzG9D00.js → ko-BOQuwJW9.js} +3 -3
- package/dist/assets/{main-BE8Iasfv.js → main-Bx60qL5w.js} +2 -2
- package/dist/assets/{main-u_SqzChh.js → main-g8eqXnMj.js} +6 -6
- package/dist/assets/{markdown-worker-W06-MhF5.js → markdown-worker-9Sn2jsDp.js} +1 -1
- package/dist/assets/{markdownTheme-B89dbj3N.js → markdownTheme-DidS-jC5.js} +1 -1
- package/dist/assets/{miniChat-Bt5Y1M49.js → miniChat-DMqaVnTw.js} +2 -2
- package/dist/assets/mobile-DEtYToxR.js +2 -0
- package/dist/assets/multirun-8-0KvduJ.js +4 -0
- package/dist/assets/{persistence-6sclr7B6.js → persistence-aCOlo6ew.js} +2 -2
- package/dist/assets/pl-CPR51X8e.js +15 -0
- package/dist/assets/{platform-CbeLpKPk.js → platform-DxNH_0Fj.js} +1 -1
- package/dist/assets/{projectMeta-CZ1xvqQ_.js → projectMeta-BmFoHMhZ.js} +2 -2
- package/dist/assets/{pt-BR-DPAxb5uf.js → pt-BR-CCmlB4Wg.js} +2 -2
- package/dist/assets/{radio-C21qxMRv.js → radio-PPBD6e7Q.js} +1 -1
- package/dist/assets/renderElectronMiniChatApp-Csec80cI.js +2 -0
- package/dist/assets/renderMobileApp-ChHc_fYD.js +23 -0
- package/dist/assets/{runtimeConfig-D3LuSwdY.js → runtimeConfig-DsXK0cxy.js} +1 -1
- package/dist/assets/runtimeEndpointReset-zuXRvRyZ.js +4 -0
- package/dist/assets/{shikiHighlight-DGtY3zhO.js → shikiHighlight-Bc_zmRSt.js} +1 -1
- package/dist/assets/{sortable-tabs-strip-D9PYWV2n.js → sortable-tabs-strip-CaVP_5XI.js} +1 -1
- package/dist/assets/src-DWqZk4wD.css +2 -0
- package/dist/assets/{store-CXHGSKbF.js → store--ZgdDfa2.js} +4 -4
- package/dist/assets/{terminalApi-BpPeXWIu.js → terminalApi-B36I-z14.js} +1 -1
- package/dist/assets/{tooltip-D_orJMYd.js → tooltip-GC3dg3gO.js} +1 -1
- package/dist/assets/{uk-CI6xwBAp.js → uk-DWxkhZMt.js} +2 -2
- package/dist/assets/{url-BsaBG5-1.js → url-BQHM4bC4.js} +1 -1
- package/dist/assets/{useAppFontEffects-DJPeS83j.js → useAppFontEffects-DD_B-H1n.js} +5 -5
- package/dist/assets/{useAssistantUIStore-BHsHXCKE.js → useAssistantUIStore-DxZsjSPQ.js} +1 -1
- package/dist/assets/{useDesktopWindowControlsLayout-C4K4es4Y.js → useDesktopWindowControlsLayout-DXy7ruaP.js} +1 -1
- package/dist/assets/{useEffectiveDirectory-BwePcDe9.js → useEffectiveDirectory-CQN36mox.js} +1 -1
- package/dist/assets/{useFontPreferences-ckzpXQaJ.js → useFontPreferences-D9h4M7x4.js} +1 -1
- package/dist/assets/{useMobileNavigationStore-DbD0hWMO.js → useMobileNavigationStore-CAd5tbZO.js} +19 -19
- package/dist/assets/{useSessionAutoCleanup-D8XMYMRy.js → useSessionAutoCleanup-CDkgneU_.js} +1 -1
- package/dist/assets/{useUIStore-DzwCfRqr.js → useUIStore-Wyu09VUF.js} +1 -1
- package/dist/assets/{useWorkerHighlightedLines-CGoX-xGT.js → useWorkerHighlightedLines-BuzzhO0I.js} +1 -1
- package/dist/assets/{utils-B1EK5zKa.js → utils-CJdWZupK.js} +1 -1
- package/dist/assets/{zh-CN-DHgsAmCO.js → zh-CN-CnBbxYt8.js} +2 -2
- package/dist/assets/{zh-TW-CZ_DZMCi.js → zh-TW-B6McpMc8.js} +2 -2
- package/dist/index.html +9 -9
- package/dist/mini-chat.html +9 -9
- package/dist/mobile.html +9 -9
- package/package.json +1 -1
- package/server/index.js +4 -14
- package/server/lib/opencode/settings-helpers.js +0 -3
- package/server/lib/opencode/shutdown-runtime.js +0 -2
- package/server/lib/session-goal/DOCUMENTATION.md +3 -3
- package/server/lib/session-goal/runtime.js +3 -3
- package/server/lib/session-title/DOCUMENTATION.md +1 -2
- package/dist/assets/AssistantView-Dw6pykwG.js +0 -1
- package/dist/assets/ContextPanel-BVsxBmy5.js +0 -288
- package/dist/assets/OverlayScrollbar-Ch3J6ASR.js +0 -2
- package/dist/assets/insertionBoundaries-BZq6rsZ4.js +0 -1
- package/dist/assets/mobile-B-5b5wLN.js +0 -2
- package/dist/assets/multirun-Bh8tCLlc.js +0 -4
- package/dist/assets/pl-3z6483I9.js +0 -15
- package/dist/assets/renderElectronMiniChatApp-CIBR-c-z.js +0 -2
- package/dist/assets/renderMobileApp-BuSUOExs.js +0 -23
- package/dist/assets/runtimeEndpointReset-C3MJHiBd.js +0 -4
- package/dist/assets/src-RGaBtbGz.css +0 -2
- package/server/lib/session-assist/DOCUMENTATION.md +0 -62
- package/server/lib/session-assist/runtime.js +0 -376
- package/server/lib/session-assist/runtime.test.js +0 -114
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/vendor-aparajita-capacitor-secure-storage-CjQdwfjS.js","assets/rolldown-runtime-C0FnF6B9.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{$t as t,Xt as n}from"./persistence-6sclr7B6.js";import{nt as r,rt as i}from"./vendor-base-ui-CnHfUmDN.js";import{n as a}from"./platform-CbeLpKPk.js";import{o}from"./vendor-aparajita-capacitor-secure-storage-CjQdwfjS.js";import{n as s}from"./vendor-react-DLPElpoQ.js";import{t as c}from"./utils-B1EK5zKa.js";var l=e(i(),1),u=s(),ee=.85,d=1.2,f=.9,p=`openchamber.designPtScale.v1`;function m(e){return!Number.isFinite(e)||e<=0?1:Math.min(d,Math.max(ee,e))}function h(e){if(!e)return f;let t=e.density,n=(e.xdpi+e.ydpi)/2;return!(t>0)||!(n>=50)||n>800?f:Math.min(f,m(n/t/163))}function g(){if(typeof window>`u`)return 1;try{let e=Number.parseFloat(window.localStorage.getItem(`openchamber.designPtScale.v1`)??``);return window.Capacitor?.getPlatform?.()===`android`?Math.min(f,m(e)):m(e)}catch{return 1}}function _(e){if(!(typeof window>`u`))try{window.localStorage.setItem(p,String(e))}catch{}}function v(e,t=document.documentElement){let n=m(e);t.style.setProperty(`--dpt`,`${n}px`),t.style.setProperty(`--dpt-n`,String(n))}async function y(){if(typeof document>`u`)return 1;v(g());let{Capacitor:e,registerPlugin:t}=await o(async()=>{let{Capacitor:e,registerPlugin:t}=await import(`./vendor-aparajita-capacitor-secure-storage-CjQdwfjS.js`).then(e=>e.i);return{Capacitor:e,registerPlugin:t}},__vite__mapDeps([0,1]));if(!e.isNativePlatform()||e.getPlatform()!==`android`)return v(1),1;if(!e.isPluginAvailable(`OpenChamberPhysicalScale`))return v(f),_(f),f;try{let e=h(await t(`OpenChamberPhysicalScale`).getMetrics());return _(e),v(e),e}catch{return v(f),_(f),f}}var b={xs:0,sm:640,md:768,lg:1024,xl:1280,"2xl":1536},x={isMobile:!1,isTablet:!1,isDesktop:!0,deviceType:`desktop`,screenWidth:1024,breakpoint:`lg`,hasTouchInput:!1,hasTouchOnlyPointer:!1},te=()=>typeof window>`u`?!1:new URLSearchParams(window.location.search).get(`surface`)===`desktop`,S=e=>{if(typeof navigator>`u`)return{isExplicitTablet:!1};let t=navigator.userAgent||``,n=navigator.platform||``,r=/iPad/i.test(t)||(/Macintosh|MacIntel/i.test(t)||/MacIntel/i.test(n))&&e>1,i=/Android/i.test(t)&&!/Mobile/i.test(t),a=/Tablet/i.test(t);return{isExplicitTablet:r||i||a}},C=(e,t,n)=>{if(typeof window>`u`)return;let r=document.documentElement,i=t===`mobile`,a=t===`tablet`;r.classList.remove(`device-mobile`,`device-tablet`,`device-desktop`),r.classList.add(t===`mobile`?`device-mobile`:t===`tablet`?`device-tablet`:`device-desktop`),e?(r.classList.add(`desktop-runtime`),r.style.setProperty(`--is-mobile`,`0`),r.style.setProperty(`--device-type`,`desktop`),r.style.setProperty(`--font-scale`,`1`),r.style.setProperty(`--has-coarse-pointer`,`0`),r.style.setProperty(`--has-touch-input`,`0`),r.classList.remove(`mobile-pointer`)):(r.classList.remove(`desktop-runtime`),r.style.setProperty(`--is-mobile`,i?`1`:`0`),r.style.setProperty(`--device-type`,t),r.style.setProperty(`--font-scale`,i?`0.9`:a?`0.95`:`1`),r.style.setProperty(`--has-coarse-pointer`,n?`1`:`0`),r.style.setProperty(`--has-touch-input`,n?`1`:`0`),n?r.classList.add(`mobile-pointer`):r.classList.remove(`mobile-pointer`)),v(e?1:g(),r)};function w(){let e=window.innerWidth,r=typeof window.matchMedia==`function`,i=r?window.matchMedia(`(pointer: coarse)`):null,o=r?window.matchMedia(`(hover: none)`):null,s=i?.matches??!1,c=o?.matches??!1,l=typeof navigator<`u`?navigator.maxTouchPoints??0:0,u=n()||t()||te(),{isExplicitTablet:ee}=S(l),d=s||c||l>0,f=s||c,p=e>b.md&&e<=b.lg,m=e<=b.md,h=d&&m,g=d&&!h&&(p||ee),_=!d||!g&&e>b.lg,v=`desktop`;u?(h=!1,g=!1,_=!0,v=`desktop`):a()?(h=!0,g=!1,_=!1,v=`mobile`):h?v=`mobile`:g?v=`tablet`:(_=!0,v=`desktop`),C(u,v,d);let y=`xs`;for(let[t,n]of Object.entries(b))e>=n&&(y=t);return{isMobile:h,isTablet:g,isDesktop:_,deviceType:v,screenWidth:e,breakpoint:y,hasTouchInput:d,hasTouchOnlyPointer:f}}var T=(e,t)=>e.isMobile===t.isMobile&&e.isTablet===t.isTablet&&e.isDesktop===t.isDesktop&&e.deviceType===t.deviceType&&e.screenWidth===t.screenWidth&&e.breakpoint===t.breakpoint&&e.hasTouchInput===t.hasTouchInput&&e.hasTouchOnlyPointer===t.hasTouchOnlyPointer,E=new Set,D=null,O,k=null,ne=()=>typeof window>`u`?x:(D||=w(),D),A=()=>{for(let e of E)e()},re=()=>{O=void 0;let e=w();D&&T(D,e)||(D=e,A())},j=()=>{typeof window>`u`||O!==void 0||(O=window.requestAnimationFrame(re))},M=(e,t)=>e?typeof e.addEventListener==`function`?(e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)):typeof e.addListener==`function`?(e.addListener(t),()=>e.removeListener(t)):()=>{}:()=>{},N=()=>{if(typeof window>`u`)return()=>{};D=w(),window.addEventListener(`resize`,j);let e=typeof window.matchMedia==`function`?window.matchMedia(`(pointer: coarse)`):null,t=typeof window.matchMedia==`function`?window.matchMedia(`(hover: none)`):null,n=M(e,j),r=M(t,j);return()=>{window.removeEventListener(`resize`,j),n(),r(),O!==void 0&&(window.cancelAnimationFrame(O),O=void 0)}},P=e=>typeof window>`u`?()=>{}:(E.add(e),k||=N(),()=>{E.delete(e),E.size===0&&k&&(k(),k=null,D=null)});function F(){if(typeof window>`u`||typeof window<`u`&&n())return!1;let e=document.documentElement,t=e.style.getPropertyValue(`--is-mobile`)||getComputedStyle(e).getPropertyValue(`--is-mobile`);return t===`1`||t===`true`}var I=()=>typeof window>`u`?!1:!!(navigator.standalone===!0||window.matchMedia?.(`(display-mode: standalone)`)?.matches||window.matchMedia?.(`(display-mode: fullscreen)`)?.matches),L=()=>{if(typeof window>`u`||n())return!1;let e=typeof navigator<`u`?navigator.maxTouchPoints??0:0;return I()&&e>0&&window.innerWidth>b.md};function R(){let e=(0,u.c)(2),[t,n]=l.useState(ie),r,i;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>{if(typeof window>`u`)return;let e=()=>n(L()),t=window.matchMedia?.(`(display-mode: standalone)`),r=window.matchMedia?.(`(display-mode: fullscreen)`);e(),window.addEventListener(`resize`,e),window.addEventListener(`focus`,e);let i=t=>{t&&(typeof t.addEventListener==`function`?t.addEventListener(`change`,e):typeof t.addListener==`function`&&t.addListener(e))},a=t=>{t&&(typeof t.removeEventListener==`function`?t.removeEventListener(`change`,e):typeof t.removeListener==`function`&&t.removeListener(e))};return i(t),i(r),()=>{window.removeEventListener(`resize`,e),window.removeEventListener(`focus`,e),a(t),a(r)}},i=[],e[0]=r,e[1]=i):(r=e[0],i=e[1]),l.useEffect(r,i),t}function ie(){return L()}var z=()=>typeof window>`u`?`portrait`:window.matchMedia?.(`(orientation: landscape)`)?.matches?`landscape`:`portrait`;function B(){let e=(0,u.c)(2),[t,n]=l.useState(z),r,i;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>{if(typeof window>`u`||typeof window.matchMedia!=`function`)return;let e=window.matchMedia(`(orientation: landscape)`),t=()=>n(e.matches?`landscape`:`portrait`);return t(),M(e,t)},i=[],e[0]=r,e[1]=i):(r=e[0],i=e[1]),l.useEffect(r,i),t}function V(){return l.useSyncExternalStore(P,ne,H)}function H(){return x}var ae=r(),oe=1e3,U=.5,se={length:0,offset:0},ce=(e,t)=>Math.abs(e.length-t.length)<U&&Math.abs(e.offset-t.offset)<U,W=e=>{let t=(0,u.c)(66),{containerRef:n,minThumbSize:r,hideDelayMs:i,className:a,disableHorizontal:o,observeMutations:s,suppressVisibility:ee,userIntentOnly:d}=e,f=r===void 0?32:r,p=i===void 0?1e3:i,m=o!==void 0&&o,h=s===void 0||s,g=ee!==void 0&&ee,_=d!==void 0&&d,[v,y]=l.useState(!1),b;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(b={length:0,offset:0},t[0]=b):b=t[0];let[x,te]=l.useState(b),S;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(S={length:0,offset:0},t[1]=S):S=t[1];let[C,w]=l.useState(S),T=l.useRef(null),E=l.useRef(null),D=l.useRef(null),O=l.useRef(!1),k=l.useRef(!1),ne=l.useRef(0),A;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(A={pointerX:0,pointerY:0,scrollTop:0,scrollLeft:0},t[2]=A):A=t[2];let re=l.useRef(A),j=l.useRef(null),M;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(M=new Set,t[3]=M):M=t[3];let N=l.useRef(M),P;t[4]!==n||t[5]!==m||t[6]!==f?(P=()=>{let e=n.current;if(!e)return;let{scrollHeight:t,clientHeight:r,scrollTop:i,scrollWidth:a,clientWidth:o,scrollLeft:s}=e,c=se;if(t>r){let e=Math.max(r-16,0),n=r/t*e,a=Math.max(f,Math.min(e,n)),o=Math.max(e-a,0);c={length:a,offset:i/Math.max(t-r,1)*o}}te(e=>ce(e,c)?e:c);let l=se;if(!m&&a>o){let e=Math.max(o-16,0),t=o/a*e,n=Math.max(f,Math.min(e,t)),r=Math.max(e-n,0);l={length:n,offset:s/Math.max(a-o,1)*r}}w(e=>ce(e,l)?e:l)},t[4]=n,t[5]=m,t[6]=f,t[7]=P):P=t[7];let F=P,I;t[8]===F?I=t[9]:(I=()=>{D.current===null&&(D.current=requestAnimationFrame(()=>{D.current=null,F()}))},t[8]=F,t[9]=I);let L=I,R;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(R=(e,t)=>{if(!t){N.current.clear();return}let n=new Set;n.add(e),Array.from(e.children).forEach(e=>{n.add(e)}),N.current.forEach(e=>{n.has(e)||t.unobserve(e)}),n.forEach(e=>{N.current.has(e)||t.observe(e)}),N.current=n},t[10]=R):R=t[10];let ie=R,z;t[11]===p?z=t[12]:(z=()=>{T.current&&clearTimeout(T.current),!k.current&&(T.current=setTimeout(()=>y(!1),p))},t[11]=p,t[12]=z);let B=z,V;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(V=()=>{ne.current=Date.now()},t[13]=V):V=t[13];let H=V,U;t[14]!==B||t[15]!==g||t[16]!==F||t[17]!==_?(U=()=>{E.current&&cancelAnimationFrame(E.current),E.current=requestAnimationFrame(()=>{if(F(),g&&!O.current){y(!1);return}if(_&&!O.current&&!(Date.now()-ne.current<=oe)){y(!1);return}y(!0),B()})},t[14]=B,t[15]=g,t[16]=F,t[17]=_,t[18]=U):U=t[18];let W=U,G,le;t[19]!==n||t[20]!==W||t[21]!==h||t[22]!==L||t[23]!==F||t[24]!==_?(G=()=>{let e=n.current;if(!e)return;F(),y(!1);let t=()=>W(),r=e=>{(e.key===`ArrowUp`||e.key===`ArrowDown`||e.key===`PageUp`||e.key===`PageDown`||e.key===`Home`||e.key===`End`||e.key===` `)&&H()};e.addEventListener(`scroll`,t,{passive:!0}),_&&(e.addEventListener(`wheel`,H,{passive:!0}),e.addEventListener(`touchstart`,H,{passive:!0}),e.addEventListener(`touchmove`,H,{passive:!0}),e.addEventListener(`keydown`,r));let i=typeof ResizeObserver<`u`?new ResizeObserver(()=>{L()}):null;ie(e,i);let a=h&&typeof MutationObserver<`u`?new MutationObserver(()=>{ie(e,i),L()}):null;a?.observe(e,{childList:!0});let o=()=>L(),s=()=>L();return e.addEventListener(`input`,o,!0),e.addEventListener(`load`,s,!0),()=>{e.removeEventListener(`scroll`,t),e.removeEventListener(`input`,o,!0),e.removeEventListener(`load`,s,!0),_&&(e.removeEventListener(`wheel`,H),e.removeEventListener(`touchstart`,H),e.removeEventListener(`touchmove`,H),e.removeEventListener(`keydown`,r)),i?.disconnect(),a?.disconnect(),N.current.clear(),T.current&&clearTimeout(T.current),E.current&&cancelAnimationFrame(E.current),D.current&&cancelAnimationFrame(D.current)}},le=[n,W,H,h,L,ie,F,_],t[19]=n,t[20]=W,t[21]=h,t[22]=L,t[23]=F,t[24]=_,t[25]=G,t[26]=le):(G=t[25],le=t[26]),l.useEffect(G,le);let ue,de;t[27]===g?(ue=t[28],de=t[29]):(ue=()=>{g&&(O.current||(y(!1),T.current&&=(clearTimeout(T.current),null)))},de=[g],t[27]=g,t[28]=ue,t[29]=de),l.useEffect(ue,de);let fe;t[30]===n?fe=t[31]:(fe=(e,t)=>{let r=n.current;r&&(O.current=!0,re.current={pointerX:e.clientX,pointerY:e.clientY,scrollTop:r.scrollTop,scrollLeft:r.scrollLeft},j.current=t,H(),y(!0),T.current&&clearTimeout(T.current),e.currentTarget.setPointerCapture(e.pointerId))},t[30]=n,t[31]=fe);let K=fe,pe;t[32]!==n||t[33]!==C.length||t[34]!==x.length?(pe=e=>{if(!O.current)return;let t=n.current;if(!t)return;let r=j.current;if(r===`vertical`){let{pointerY:n,scrollTop:r}=re.current,i=e.clientY-n,a=t.clientHeight,o=Math.max(a-x.length,1),s=Math.max(t.scrollHeight-t.clientHeight,1);t.scrollTop=r+i/o*s}else if(r===`horizontal`){let{pointerX:n,scrollLeft:r}=re.current,i=e.clientX-n,a=t.clientWidth,o=Math.max(a-C.length,1),s=Math.max(t.scrollWidth-t.clientWidth,1);t.scrollLeft=r+i/o*s}},t[32]=n,t[33]=C.length,t[34]=x.length,t[35]=pe):pe=t[35];let q=pe,me;t[36]===B?me=t[37]:(me=e=>{O.current&&(O.current=!1,e.currentTarget.releasePointerCapture(e.pointerId),B())},t[36]=B,t[37]=me);let J=me,he;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(he=()=>{k.current=!0,T.current&&=(clearTimeout(T.current),null)},t[38]=he):he=t[38];let ge=he,_e;t[39]===B?_e=t[40]:(_e=()=>{k.current=!1,B()},t[39]=B,t[40]=_e);let Y=_e,ve=x.length>0,ye=C.length>0;if(!ve&&!ye)return null;let X;t[41]===a?X=t[42]:(X=c(`overlay-scrollbar`,a),t[41]=a,t[42]=X);let be=+!!v,Z;t[43]===be?Z=t[44]:(Z={opacity:be},t[43]=be,t[44]=Z);let Q;t[45]!==K||t[46]!==q||t[47]!==J||t[48]!==Y||t[49]!==ve||t[50]!==x.length||t[51]!==x.offset?(Q=ve&&(0,ae.jsx)(`div`,{className:`overlay-scrollbar__thumb overlay-scrollbar__thumb--vertical`,"data-overlay-scrollbar-thumb":`vertical`,style:{height:`${x.length}px`,top:`${8+x.offset}px`,right:`4px`},onPointerDown:e=>K(e,`vertical`),onPointerMove:q,onPointerUp:J,onPointerCancel:J,onMouseEnter:ge,onMouseLeave:Y}),t[45]=K,t[46]=q,t[47]=J,t[48]=Y,t[49]=ve,t[50]=x.length,t[51]=x.offset,t[52]=Q):Q=t[52];let $;t[53]!==K||t[54]!==q||t[55]!==J||t[56]!==Y||t[57]!==C.length||t[58]!==C.offset||t[59]!==ye?($=ye&&(0,ae.jsx)(`div`,{className:`overlay-scrollbar__thumb overlay-scrollbar__thumb--horizontal`,"data-overlay-scrollbar-thumb":`horizontal`,style:{width:`${C.length}px`,left:`${8+C.offset}px`,bottom:`4px`},onPointerDown:e=>K(e,`horizontal`),onPointerMove:q,onPointerUp:J,onPointerCancel:J,onMouseEnter:ge,onMouseLeave:Y}),t[53]=K,t[54]=q,t[55]=J,t[56]=Y,t[57]=C.length,t[58]=C.offset,t[59]=ye,t[60]=$):$=t[60];let xe;return t[61]!==X||t[62]!==Z||t[63]!==Q||t[64]!==$?(xe=(0,ae.jsxs)(`div`,{className:X,"aria-hidden":`true`,style:Z,children:[Q,$]}),t[61]=X,t[62]=Z,t[63]=Q,t[64]=$,t[65]=xe):xe=t[65],xe};W.displayName=`OverlayScrollbar`;var G=W;export{B as a,V as i,w as n,R as o,F as r,y as s,G as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{A as t,E as n,b as r,t as i,y as a}from"./useUIStore-DzwCfRqr.js";import{$t as o,D as s,d as c,k as l,u,xn as d}from"./persistence-6sclr7B6.js";import{a as f,i as p,r as m}from"./vendor-zustand-B4dlGEM2.js";import{nt as h,rt as g}from"./vendor-base-ui-CnHfUmDN.js";import{B as _,Ct as v,M as y,Mt as b}from"./platform-CbeLpKPk.js";import{n as x}from"./vendor-react-DLPElpoQ.js";import{s as S}from"./vendor-tanstack-react-query-D7pys_c9.js";import{n as C}from"./vendor-reactuses-core-DDoDDyM9.js";import{n as ee}from"./clipboard-O3XtpG2j.js";import{Eo as w,To as te,_ as ne,_r as re,b as ie,ct as ae,dt as T,l as E,lo as D,oa as O,pn as oe,rn as se,st as k,ut as ce}from"./useMobileNavigationStore-DbD0hWMO.js";import{c as A,t as j}from"./utils-B1EK5zKa.js";import{n as M}from"./Icon-DpjYnXxn.js";import{g as N,v as P}from"./gitApi-BDP5AvDM.js";import{A as le,M as F,p as I,s as ue}from"./projectMeta-CZ1xvqQ_.js";var L=e(g(),1),R=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},z=e=>/^[A-Za-z]:\//.test(e)?e.toLowerCase():e,B=(e,t)=>{let n=R(t),r=R(e);if(!n||!r)return!1;let i=z(n),a=z(r);return a===i||a.startsWith(`${i}/`)},de=e=>{if(!e||typeof e!=`object`)return{};let t=e,n={};for(let[e,r]of Object.entries(t)){let t=R(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=>R(e)).filter(e=>B(e,t)))):[],o=Array.isArray(i.expandedPaths)?Array.from(new Set(i.expandedPaths.filter(e=>typeof e==`string`).map(e=>R(e)).filter(e=>B(e,t)))):[],s=typeof i.selectedPath==`string`?R(i.selectedPath):null,c=s&&B(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},V=(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},H=e=>e?{...e,touchedAt:Date.now()}:{openPaths:[],selectedPath:null,expandedPaths:[],touchedAt:Date.now()},fe=f()(m(p((e,t)=>({byRoot:{},addOpenPath:(t,n,r)=>{let i=R((t||``).trim()),a=R((n||``).trim());!i||!a||!r?.allowOutsideRoot&&!B(a,i)||e(e=>{let t=e.byRoot[i],n=H(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:V({...e.byRoot,[i]:{...n,openPaths:o,selectedPath:s}},20)}})},removeOpenPath:(t,n)=>{let r=R((t||``).trim()),i=R((n||``).trim());!r||!i||e(e=>{let t=e.byRoot[r];if(!t)return e;let n=z(i),a=e=>z(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:V({...e.byRoot,[r]:{...t,openPaths:s,selectedPath:c,touchedAt:Date.now()}},20)}})},removeOpenPathsByPrefix:(t,n)=>{let r=R((t||``).trim()),i=R((n||``).trim());!r||!i||e(e=>{let t=e.byRoot[r];if(!t)return e;let n=z(i),a=n.endsWith(`/`)?n:`${n}/`,o=e=>{let t=z(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:V({...e.byRoot,[r]:{...t,openPaths:s,selectedPath:c,touchedAt:Date.now()}},20)}})},removeExpandedPathsByPrefix:(t,n)=>{let r=R((t||``).trim()),i=R((n||``).trim());!r||!i||e(e=>{let t=e.byRoot[r];if(!t)return e;let n=z(i),a=n.endsWith(`/`)?n:`${n}/`,o=t.expandedPaths.filter(e=>{let t=z(e);return t!==n&&!t.startsWith(a)});return o.length===t.expandedPaths.length?e:{byRoot:V({...e.byRoot,[r]:{...t,expandedPaths:o,touchedAt:Date.now()}},20)}})},setSelectedPath:(t,n,r)=>{let i=R((t||``).trim()),a=n?R(n.trim()):null;!i||a&&!r?.allowOutsideRoot&&!B(a,i)||e(e=>{let t=e.byRoot[i],n=H(t),r=a&&!n.openPaths.includes(a)?[...n.openPaths,a]:n.openPaths;return t&&t.selectedPath===a&&r===t.openPaths?e:{byRoot:V({...e.byRoot,[i]:{...n,openPaths:r,selectedPath:a}},20)}})},ensureSelectedPath:e=>{let n=R((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=R((t||``).trim()),i=R((n||``).trim());!r||!i||!B(i,r)||e(e=>{let t=e.byRoot[r],n=H(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:V({...e.byRoot,[r]:{...n,expandedPaths:a}},20)}})},expandPath:(t,n)=>{let r=R((t||``).trim()),i=R((n||``).trim());!r||!i||!B(i,r)||e(e=>{let t=e.byRoot[r],n=H(t);return n.expandedPaths.includes(i)&&t?e:{byRoot:V({...e.byRoot,[r]:{...n,expandedPaths:[...n.expandedPaths,i]}},20)}})},expandPaths:(t,n)=>{let r=R((t||``).trim());if(!r||!n||n.length===0)return;let i=n.map(e=>R((e||``).trim())).filter(e=>e&&B(e,r));i.length!==0&&e(e=>{let t=e.byRoot[r],n=H(t),a=new Set(n.expandedPaths),o=i.filter(e=>!a.has(e));return o.length===0?e:{byRoot:V({...e.byRoot,[r]:{...n,expandedPaths:[...n.expandedPaths,...o]}},20)}})}}),{name:`files-view-tabs-store`,version:2,storage:a(),migrate:e=>{if(!e||typeof e!=`object`)return{byRoot:{}};let t=e.byRoot;return{byRoot:de(t)}},partialize:e=>({byRoot:de(e.byRoot)})}),{name:`files-view-tabs-store`})),U=x(),pe=(e,t)=>{let n=(0,U.c)(4),r=t===void 0?200:t,[i,a]=L.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]),L.useEffect(o,s),i},me=()=>{let e=(0,U.c)(17),t=E(W),n=oe(),r;e[0]===t?r=e[1]:(r=e=>t?e.getAttachment(t):void 0,e[0]=t,e[1]=r);let i=ie(r),a=E(G),o=E(he),s=w(K),c=w(ge),l=v(_e);if(t){let r;e[2]===i?r=e[3]:(r=ne(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 W(e){return e.currentSessionId}function G(e){return e.worktreeMetadata}function he(e){return e.newSessionDraft}function K(e){return e.activeProjectId}function ge(e){return e.projects}function _e(e){return e.currentDirectory}var ve=.4,q=8,J=e=>{let t=e.gap??q,n=Math.max(0,e.popupBottom-e.boundaryTop-t),r=e.viewportHeight*ve,i=Math.floor(Math.min(n,r));return n>=120?Math.min(n,Math.max(120,i)):i},Y=(e,t=0)=>{let n=e.closest(`main`);if(!n)return null;let r=(e.closest(`.mobile-chat-screen__content`)?.parentElement??n.parentElement?.closest(`main`)??n).querySelector(`:scope > .oc-mobile-detail-navigation`)?.getBoundingClientRect().bottom,i=n.getBoundingClientRect().top;return Math.max(r===void 0?i:Math.max(r,i),t)},ye=(e,t)=>{let n=(0,U.c)(3),[r,i]=L.useState(void 0),a;return n[0]!==e||n[1]!==t?(a=()=>{if(!t)return;let n=()=>{let t=e.current;if(!t)return;let n=window.visualViewport,r=Y(t,n?.offsetTop??0);if(r===null)return;let a=n?.height??window.innerHeight,o=J({popupBottom:t.getBoundingClientRect().bottom,boundaryTop:r,viewportHeight:a});i(e=>e===o?e:o)};return n(),window.addEventListener(`resize`,n),window.addEventListener(`oc:keyboard-settled`,n),window.visualViewport?.addEventListener(`resize`,n),window.visualViewport?.addEventListener(`scroll`,n),()=>{window.removeEventListener(`resize`,n),window.removeEventListener(`oc:keyboard-settled`,n),window.visualViewport?.removeEventListener(`resize`,n),window.visualViewport?.removeEventListener(`scroll`,n)}},n[0]=e,n[1]=t,n[2]=a):a=n[2],L.useLayoutEffect(a),t?r:void 0},be=()=>{let e=null,t=!1,n=!1;return{pointerDown:(n,r)=>{e={x:n,y:r},t=!1},pointerMove:(n,r)=>{e&&Math.hypot(n-e.x,r-e.y)>6&&(t=!0)},pointerCancel:()=>{e=null,t=!1},pointerUp:r=>{if(!e)return!1;let i=!t;return e=null,t=!1,i?(n=!0,r(),!0):(n=!0,!1)},click:e=>n?(n=!1,!1):(e(),!0)}},X=h(),Z=L.forwardRef(({searchQuery:e,onFileSelect:t,onAgentSelect:n,onSessionSelect:r,onClose:a,style:o},c)=>{let{t:u}=ee(),d=me()??``,f=E(e=>e.currentSessionId),p=re(e=>e.activeSessions),m=w(e=>e.activeProjectId),h=w(e=>e.projects),g=L.useMemo(()=>h.find(e=>e.id===m)?.path??null,[m,h]),_=L.useMemo(()=>{let e=g||d;return e?e.replace(/\\/g,`/`).replace(/\/+$/,``):null},[g,d]),v=fe(e=>_?e.byRoot[_]:void 0),y=O(e=>e.getVisibleAgents),x=b(e=>e.searchFiles),S=pe(e,180),te=l(),ne=s(),[ie,T]=L.useState([]),[D,oe]=L.useState([]),[se,N]=L.useState(!1),[P,F]=L.useState(0),I=L.useRef(0),[ue,R]=L.useState(360),[z,B]=L.useState({}),[de,V]=L.useState({}),H=L.useRef([]),U=L.useRef([]),W=L.useRef([]),G=L.useRef(null),he=L.useRef(null);he.current||=be();let K=i(e=>e.isMobile),ge=ye(G,K),_e=(e??``).trim(),ve=L.useMemo(()=>{if(!_||!v)return[];let e=[v.selectedPath,...v.openPaths.slice().reverse()].filter(e=>typeof e==`string`&&e.length>0),t=new Set,n=_e.toLowerCase();return e.filter(e=>{if(t.has(e))return!1;t.add(e);let r=e.startsWith(`${_}/`)?e.slice(_.length+1):e;return!n||r.toLowerCase().includes(n)}).slice(0,6).map(e=>{let t=e.replace(/\\/g,`/`),n=t.split(`/`).filter(Boolean).pop()||t;return{name:n,path:t,relativePath:t.startsWith(`${_}/`)?t.slice(_.length+1):t,extension:n.includes(`.`)?n.split(`.`).pop()?.toLowerCase():void 0}})},[_e,_,v]),q=L.useMemo(()=>_e.length>0?D:D.slice(0,2),[D,_e.length]),J=L.useMemo(()=>r?k({sessions:p,currentSessionId:f,searchQuery:_e}):[],[p,f,_e,r]),Y=ve,Z=ie;L.useEffect(()=>{let e=e=>{let t=e.target;!t||!G.current||G.current.contains(t)||a()};return document.addEventListener(`pointerdown`,e,!0),()=>{document.removeEventListener(`pointerdown`,e,!0)}},[a]),L.useEffect(()=>{if(!d){T([]);return}let e=(S??``).trim(),t=ce(e);if(!t){T([]);return}let n=!1;N(!0);let r={includeHidden:te,respectGitignore:!ne};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(ve.map(e=>e.path));T(ae({files:t,directories:r,query:e,excludePaths:i,limit:20}))}).catch(()=>{n||T([])}).finally(()=>{n||N(!1)}),()=>{n=!0}},[d,S,ve,x,te,ne]),L.useEffect(()=>{let t=y(),n=(e??``).trim().toLowerCase(),r=t.filter(e=>e.mode&&e.mode!==`primary`).filter(e=>!n||`${e.name} ${e.description??``}`.toLowerCase().includes(n)).map(e=>({name:e.name,description:e.description,mode:e.mode})).sort((e,t)=>e.name.localeCompare(t.name));oe(r)},[y,e]),L.useEffect(()=>{F(0),B({}),V({})},[Z,Y.length,q.length,J.length]),L.useEffect(()=>{I.current=P},[P]),L.useEffect(()=>{H.current[P]?.scrollIntoView({block:`nearest`})},[P]),L.useEffect(()=>{let e=null,t=()=>{e!==null&&cancelAnimationFrame(e),e=requestAnimationFrame(()=>{let e={},t={};U.current.forEach((n,r)=>{if(!n)return;let i=W.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}}),B(e),V(t)})};return t(),window.addEventListener(`resize`,t),()=>{e!==null&&cancelAnimationFrame(e),window.removeEventListener(`resize`,t)}},[Z,Y]),L.useEffect(()=>{let e=U.current[P];if(!e)return;let t=()=>{let t=e.clientWidth;t>0&&R(t)};if(t(),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(t);return n.observe(e),()=>{n.disconnect()}},[P]);let xe=C(e=>{t(e)}),Se=C(e=>{n?.(e)}),Ce=C(e=>{r?.(e)}),we=(e,t)=>({onMouseDown:e=>e.preventDefault(),onPointerDown:e=>{e.pointerType===`touch`&&he.current?.pointerDown(e.clientX,e.clientY)},onPointerMove:e=>{e.pointerType===`touch`&&he.current?.pointerMove(e.clientX,e.clientY)},onPointerUp:e=>{e.pointerType===`touch`&&(he.current?.pointerUp(t)??!1)&&(e.preventDefault(),e.stopPropagation())},onPointerCancel:()=>he.current?.pointerCancel(),onClick:()=>{he.current?.click(t)},onMouseMove:()=>F(e)});L.useImperativeHandle(c,()=>({handleKeyDown:e=>{if(e===`Escape`){a();return}let t=q.length+J.length+Y.length+Z.length;if(t!==0){if(e===`ArrowDown`){F(e=>(e+1)%t);return}if(e===`ArrowUp`){F(e=>(e-1+t)%t);return}if(e===`Enter`||e===`Tab`){let e=(I.current%t+t)%t;if(e<q.length){let t=q[e];t&&Se(t.name);return}let n=e-q.length;if(n<J.length){let e=J[n];e&&Ce(e);return}let r=n-J.length,i=r<Y.length?Y[r]:Z[r-Y.length];i&&xe(i)}}}}),[Z,Y,q,J,a,xe,Se,Ce]);let Te=e=>{if(e.isDirectory)return(0,X.jsx)(M,{name:`folder-3-fill`,className:`h-3.5 w-3.5 text-current`});switch(e.extension?.toLowerCase()){case`ts`:case`tsx`:case`js`:case`jsx`:return(0,X.jsx)(M,{name:`code`,className:`h-3.5 w-3.5 text-current`});case`json`:return(0,X.jsx)(M,{name:`code`,className:`h-3.5 w-3.5 text-current`});case`md`:case`mdx`:return(0,X.jsx)(M,{name:`file`,className:`h-3.5 w-3.5 text-current`});case`png`:case`jpg`:case`jpeg`:case`gif`:case`svg`:return(0,X.jsx)(M,{name:`file-image`,className:`h-3.5 w-3.5 text-current`});default:return(0,X.jsx)(M,{name:`file-pdf`,className:`h-3.5 w-3.5 text-current`})}};return(0,X.jsxs)(`div`,{ref:G,className:`absolute z-[100] min-w-0 w-full max-w-[640px] max-h-64 bg-background border-2 border-border/60 rounded-xl shadow-none bottom-full mb-2 left-0 flex flex-col`,style:ge===void 0?o:{...o,maxHeight:ge},children:[(0,X.jsx)(le,{preventOverscroll:!0,outerClassName:`flex-1 min-h-0`,className:`px-0`,children:(0,X.jsxs)(`div`,{className:`pb-2`,children:[q.length>0&&(0,X.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)=>(0,X.jsx)(`div`,{ref:e=>{H.current[t]=e},className:j(`flex items-start gap-2 px-3 py-1.5 cursor-pointer typography-ui-label rounded-lg`,K&&`min-h-11`,P===t&&`bg-interactive-selection text-interactive-selection-foreground`),...we(t,()=>Se(e.name)),children:(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsxs)(`div`,{className:`font-semibold truncate`,children:[`@`,e.name]}),e.description&&!K?(0,X.jsx)(`div`,{className:`typography-meta text-muted-foreground truncate`,children:e.description}):null]})},`agent-${e.name}`)),q.length===2&&_e.length===0&&D.length>2&&(0,X.jsx)(`div`,{className:`px-3 py-1 typography-meta text-muted-foreground`,children:u(`chat.fileMentionAutocomplete.searchMoreAgents`)}),J.length>0&&(0,X.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;return(0,X.jsxs)(`div`,{ref:e=>{H.current[n]=e},className:j(`flex items-center gap-2 px-3 py-1.5 cursor-pointer typography-ui-label rounded-lg`,K&&`min-h-11`,P===n&&`bg-interactive-selection text-interactive-selection-foreground`),...we(n,()=>Ce(e)),children:[(0,X.jsx)(M,{name:`chat-thread`,className:`h-4 w-4 flex-shrink-0 text-[var(--primary-base)]`}),(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,title:e.title||u(`chat.fileMentionAutocomplete.untitledSession`),children:e.title||u(`chat.fileMentionAutocomplete.untitledSession`)}),K?null:(0,X.jsx)(`span`,{className:`flex-shrink-0 typography-meta text-muted-foreground`,children:u(`chat.fileMentionAutocomplete.sessionType`)})]},`session-${e.id}`)}),Y.length>0&&(0,X.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=A(r,{maxLength:60}),a=P===n,o=z[n]??!1,s=de[n]??2.6;return(0,X.jsxs)(`div`,{ref:e=>{H.current[n]=e},className:j(`flex items-center gap-2 px-3 py-1.5 cursor-pointer typography-ui-label rounded-lg`,K&&`min-h-11`,a&&`bg-interactive-selection text-interactive-selection-foreground`),...we(n,()=>xe(e)),children:[Te(e),(0,X.jsxs)(`span`,{ref:e=>{U.current[n]=e},className:`relative flex-1 min-w-0 overflow-hidden file-mention-marquee-container`,style:a?{"--file-mention-marquee-width":`${ue}px`,"--file-mention-marquee-duration":`${s}s`}:void 0,"aria-label":r,children:[(0,X.jsx)(`span`,{ref:e=>{W.current[n]=e},className:`absolute invisible whitespace-nowrap pointer-events-none`,"aria-hidden":!0,children:r}),o&&a?(0,X.jsx)(`span`,{className:`inline-block whitespace-nowrap file-mention-marquee`,children:r}):(0,X.jsx)(`span`,{className:`block truncate`,children:i})]})]},`recent-${e.path}`)}),Z.length>0&&(0,X.jsx)(`div`,{className:`px-3 pb-1 pt-2 typography-meta font-medium text-muted-foreground`,children:u(`chat.fileMentionAutocomplete.groups.files`)}),Z.map((e,t)=>{let n=q.length+J.length+Y.length+t,r=e.relativePath||e.name,i=A(r,{maxLength:60}),a=P===n,o=z[n]??!1,s=de[n]??2.6;return(0,X.jsxs)(`div`,{ref:e=>{H.current[n]=e},className:j(`flex items-center gap-2 px-3 py-1.5 cursor-pointer typography-ui-label rounded-lg`,K&&`min-h-11`,a&&`bg-interactive-selection text-interactive-selection-foreground`),...we(n,()=>xe(e)),children:[Te(e),(0,X.jsxs)(`span`,{ref:e=>{U.current[n]=e},className:`relative flex-1 min-w-0 overflow-hidden file-mention-marquee-container`,style:a?{"--file-mention-marquee-width":`${ue}px`,"--file-mention-marquee-duration":`${s}s`}:void 0,"aria-label":r,children:[(0,X.jsx)(`span`,{ref:e=>{W.current[n]=e},className:`absolute invisible whitespace-nowrap pointer-events-none`,"aria-hidden":!0,children:r}),o&&a?(0,X.jsx)(`span`,{className:`inline-block whitespace-nowrap file-mention-marquee`,children:r}):(0,X.jsx)(`span`,{className:`block truncate`,children:i})]})]},e.path)}),se&&Z.length===0?(0,X.jsx)(`div`,{className:`flex items-center justify-center py-3`,children:(0,X.jsx)(M,{name:`refresh`,className:`h-4 w-4 animate-spin text-muted-foreground`})}):null,!se&&Z.length===0&&Y.length===0&&q.length===0&&J.length===0&&(0,X.jsx)(`div`,{className:`px-3 py-2 typography-ui-label text-muted-foreground`,children:u(`chat.fileMentionAutocomplete.empty`)})]})}),!K&&(0,X.jsx)(`div`,{className:`px-3 pt-1 pb-1.5 border-t typography-meta text-muted-foreground`,children:u(`chat.autocomplete.keyboardHint`)})]})}),xe=new Set([`new`,`fork`,`compact`,`undo`,`redo`,`model`,`goal`]),Se=(e,t)=>{if(!t||e.isSkill)return!1;let n=e.name?.trim().toLowerCase();return!!(n&&xe.has(n))},Ce=(e,t)=>!e||t({name:e}),we=` `,Te=(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]===we&&e[r-2]===`/`&&(r-=2),e[r]===`/`?{start:r,end:n}:null},Ee=`text-[10px] leading-none uppercase font-bold tracking-tight px-1.5 py-1 rounded border flex-shrink-0`,De=j(Ee,`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)]`),Oe=j(Ee,`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)]`),ke=j(Ee,`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)]`),Ae=j(Ee,`bg-[var(--surface-muted)] text-muted-foreground border-[var(--interactive-border)]/60`),je=(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=T(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)},Me=(e,t)=>{let n=!!e.sessionID;return{hasSession:n,canStartSessionCommand:n||e.hasNewDraft,canUseReviewHandoffFlow:n&&!t&&!o()}},Ne=L.forwardRef(({searchQuery:e,onCommandSelect:t,onClose:n,directory:r,style:a,commandPolicy:o,commandContext:s},c)=>{let{t:l}=ee(),u=i(e=>e.isMobile),d=E(e=>e.currentSessionId),f=E(e=>!!e.newSessionDraft?.open),p=E(L.useCallback(e=>d?e.getDirectoryForSession(d):void 0,[d])),m=se(d??``,p??void 0),h=L.useMemo(()=>s??{sessionID:d??null,hasMessages:m.length>0,hasNewDraft:f},[s,d,m.length,f]),{hasSession:g,canStartSessionCommand:_,canUseReviewHandoffFlow:v}=L.useMemo(()=>Me(h,u),[h,u]),y=h.hasMessages,[b,x]=L.useState([]),[S,C]=L.useState(!1),w=te({directory:r}),ne=L.useMemo(()=>w.data??[],[w.data]),re=w.isFetching,ie=D({directory:r}),ae=L.useMemo(()=>ie.data??[],[ie.data]),[T,O]=L.useState(0),oe=L.useRef(0),k=L.useRef(!1),ce=L.useRef([]),A=L.useRef(null),N=ye(A,u),P=L.useRef(!1),F=L.useRef(null),I=L.useRef(!1);L.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]),L.useEffect(()=>{(async()=>{C(re);try{let t=ne.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=ae.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:plan-feature`,name:`plan-feature`,source:`openchamber`,description:l(`chat.commandAutocomplete.command.featurePlanDescription`),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,a=r.filter(e=>(i||e.name!==`init`)&&(o?.(e)??!0));x(je(a,e))}catch{let t=!y,n=[{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:plan-feature`,name:`plan-feature`,source:`openchamber`,description:l(`chat.commandAutocomplete.command.featurePlanDescription`),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`)&&(o?.(e)??!0));x(je(n,e))}finally{C(!1)}})()},[e,y,g,_,v,ne,re,ae,l,o]),L.useEffect(()=>{O(0)},[b]),L.useEffect(()=>{oe.current=T},[T]),L.useEffect(()=>{ce.current[T]?.scrollIntoView({block:`nearest`})},[T]),L.useImperativeHandle(c,()=>({handleKeyDown:e=>{let r=b.length;if(e===`Escape`){n();return}if(r!==0){if(e===`ArrowDown`){k.current=!0,O(e=>(e+1)%r);return}if(e===`ArrowUp`){k.current=!0,O(e=>(e-1+r)%r);return}if(e===`Enter`||e===`Tab`){let n=(oe.current%r+r)%r,i=b[n];i&&t(i,Se(i,e===`Enter`))}}}}),[b,n,t]);let ue=e=>{switch(e.name){case`new`:return(0,X.jsx)(M,{name:`add`,className:`h-3.5 w-3.5`});case`init`:return(0,X.jsx)(M,{name:`file`,className:`h-3.5 w-3.5 text-green-500`});case`undo`:return(0,X.jsx)(M,{name:`arrow-go-back`,className:`h-3.5 w-3.5 text-orange-500`});case`redo`:return(0,X.jsx)(M,{name:`arrow-go-forward`,className:`h-3.5 w-3.5 text-orange-500`});case`timeline`:return(0,X.jsx)(M,{name:`time`,className:`h-3.5 w-3.5`});case`compact`:return(0,X.jsx)(M,{name:`scissors`,className:`h-3.5 w-3.5 text-purple-500`});case`goal`:return(0,X.jsx)(M,{name:`target`,className:`h-3.5 w-3.5`});case`review`:return(0,X.jsx)(M,{name:`search-eye`,className:`h-3.5 w-3.5 text-blue-500`});case`test`:case`build`:case`run`:return(0,X.jsx)(M,{name:`terminal-box`,className:`h-3.5 w-3.5 text-cyan-500`});default:return e.isBuiltIn?(0,X.jsx)(M,{name:`flashlight`,className:`h-3.5 w-3.5 text-yellow-500`}):(0,X.jsx)(M,{name:`command`,className:`h-3.5 w-3.5 text-muted-foreground`})}};return(0,X.jsxs)(`div`,{ref:A,className:`absolute z-[100] min-w-0 w-full max-w-[450px] max-h-64 bg-background border-2 border-border/60 rounded-xl shadow-none bottom-full mb-2 left-0 flex flex-col`,style:N===void 0?a:{...a,maxHeight:N},children:[(0,X.jsx)(le,{preventOverscroll:!0,outerClassName:`flex-1 min-h-0`,className:`px-0 pb-2`,children:S?(0,X.jsx)(`div`,{className:`flex items-center justify-center py-4`,children:(0,X.jsx)(M,{name:`refresh`,className:`h-4 w-4 animate-spin text-muted-foreground`})}):(0,X.jsxs)(`div`,{children:[b.map((e,n)=>{let r=e.isBuiltIn,i=e.isOpenChamber;return(0,X.jsxs)(`div`,{ref:e=>{ce.current[n]=e},className:j(`flex gap-2 px-3 py-2 cursor-pointer rounded-lg`,u?`items-center`:`items-start`,n===T&&`bg-interactive-selection`),onMouseDown:e=>e.preventDefault(),onPointerDown:e=>{e.pointerType===`touch`&&(F.current={x:e.clientX,y:e.clientY},I.current=!1)},onPointerMove:e=>{if(e.pointerType!==`touch`||!F.current)return;let t=e.clientX-F.current.x,n=e.clientY-F.current.y;Math.hypot(t,n)>6&&(I.current=!0)},onPointerUp:n=>{if(n.pointerType!==`touch`)return;let r=I.current;F.current=null,I.current=!1,!r&&(n.preventDefault(),n.stopPropagation(),P.current=!0,t(e,Se(e,u)))},onPointerCancel:()=>{F.current=null,I.current=!1},onClick:()=>{if(P.current){P.current=!1;return}t(e,Se(e,u))},onMouseMove:()=>{k.current=!1,O(n)},children:[(0,X.jsx)(`div`,{className:j(!u&&`mt-0.5`),children:ue(e)}),(0,X.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsxs)(`span`,{className:`typography-ui-label font-medium`,children:[`/`,e.name]}),e.isSkill?(0,X.jsx)(`span`,{className:De,children:l(`chat.commandAutocomplete.badge.skill`)}):(0,X.jsx)(`span`,{className:De,children:l(`chat.commandAutocomplete.badge.command`)}),i?(0,X.jsx)(`span`,{className:Ae,children:`OpenChamber`}):r?(0,X.jsx)(`span`,{className:Ae,children:l(`chat.commandAutocomplete.badge.system`)}):e.scope?(0,X.jsx)(`span`,{className:e.scope===`project`?ke:Oe,children:e.scope}):null,e.agent&&(0,X.jsx)(`span`,{className:Ae,children:e.agent})]}),e.description&&!u&&(0,X.jsx)(`div`,{className:`typography-meta text-muted-foreground mt-0.5 truncate`,children:e.description})]})]},e.id)}),b.length===0&&(0,X.jsx)(`div`,{className:`px-3 py-2 typography-ui-label text-muted-foreground`,children:l(`chat.commandAutocomplete.empty`)})]})}),!u&&(0,X.jsx)(`div`,{className:`px-3 pt-1 pb-1.5 border-t typography-meta text-muted-foreground`,children:l(`chat.autocomplete.keyboardHint`)})]})});Ne.displayName=`CommandAutocomplete`;function Pe(e){return(e.description||e.content).replace(/\s+/g,` `).trim().slice(0,120)}var Fe=L.forwardRef((e,t)=>{let n=(0,U.c)(63),{searchQuery:r,onSnippetSelect:a,onClose:o,style:s}=e,{t:c}=ee(),l=L.useRef(null),u=i(Ie),d=ye(l,u),[f,p]=L.useState(0),m=L.useRef(0),h;n[0]===Symbol.for(`react.memo_cache_sentinel`)?(h=[],n[0]=h):h=n[0];let[g,_]=L.useState(h),v;n[1]===Symbol.for(`react.memo_cache_sentinel`)?(v=[],n[1]=v):v=n[1];let y=L.useRef(v),b=F(Le),x=F(Re),S=F(ze),C=F(Be),w=i(Ve),te=i(He),ne,re;n[2]===x?(ne=n[3],re=n[4]):(ne=()=>{x()},re=[x],n[2]=x,n[3]=ne,n[4]=re),L.useEffect(ne,re);let ie,ae;n[5]!==r||n[6]!==b?(ie=()=>{let e=r.trim();if(!e.length){let e=[...b].sort(Ue);_(e),p(+!!e.length);return}let t=T(b,e,We);t.sort(Ge);let n=t.map(Ke);_(n),p(+!!n.length)},ae=[r,b],n[5]=r,n[6]=b,n[7]=ie,n[8]=ae):(ie=n[7],ae=n[8]),L.useEffect(ie,ae);let E,D;n[9]===f?(E=n[10],D=n[11]):(E=()=>{m.current=f,y.current[f]?.scrollIntoView({block:`nearest`})},D=[f],n[9]=f,n[10]=E,n[11]=D),L.useEffect(E,D);let O,oe;n[12]===o?(O=n[13],oe=n[14]):(oe=()=>{let e=e=>{let t=e.target;t&&l.current&&!l.current.contains(t)&&o()};return document.addEventListener(`pointerdown`,e,!0),()=>document.removeEventListener(`pointerdown`,e,!0)},O=[o],n[12]=o,n[13]=O,n[14]=oe),L.useEffect(oe,O);let se;n[15]!==a||n[16]!==r?(se=e=>{let t=r.trim(),n=e.aliases.includes(t)?t:e.name;a(e,n)},n[15]=a,n[16]=r,n[17]=se):se=n[17];let k=se,ce;n[18]!==o||n[19]!==C||n[20]!==w||n[21]!==te||n[22]!==S||n[23]!==b?(ce=()=>{let e=new Set(b.map(qe)),t=`new-snippet`,n=1;for(;e.has(t);)t=`new-snippet-${n++}`;S({name:t,scope:`global`}),C(t),te(`snippets`),w(!0),o()},n[18]=o,n[19]=C,n[20]=w,n[21]=te,n[22]=S,n[23]=b,n[24]=ce):ce=n[24];let A=ce,N,P;n[25]!==k||n[26]!==g||n[27]!==o||n[28]!==A?(N=()=>({handleKeyDown:e=>{if(e===`Escape`){o();return}let t=g.length+1;if(e===`ArrowDown`){p(e=>(e+1)%t);return}if(e===`ArrowUp`){p(e=>(e-1+t)%t);return}if(e===`Enter`||e===`Tab`){if(m.current===0){A();return}let e=g[m.current-1];e&&k(e)}}}),P=[k,g,o,A],n[25]=k,n[26]=g,n[27]=o,n[28]=A,n[29]=N,n[30]=P):(N=n[29],P=n[30]),L.useImperativeHandle(t,N,P);let I;n[31]!==d||n[32]!==s?(I=d===void 0?s:{...s,maxHeight:d},n[31]=d,n[32]=s,n[33]=I):I=n[33];let ue;n[34]===Symbol.for(`react.memo_cache_sentinel`)?(ue=e=>{y.current[0]=e},n[34]=ue):ue=n[34];let R=f===0&&`bg-interactive-selection`,z;n[35]===R?z=n[36]:(z=j(`flex items-center gap-2 px-3 py-1.5 cursor-pointer rounded-lg typography-ui-label`,R),n[35]=R,n[36]=z);let B,de;n[37]===Symbol.for(`react.memo_cache_sentinel`)?(B=()=>p(0),de=(0,X.jsx)(M,{name:`add`,className:`h-3.5 w-3.5 text-muted-foreground`}),n[37]=B,n[38]=de):(B=n[37],de=n[38]);let V;n[39]===c?V=n[40]:(V=c(`chat.snippetAutocomplete.action.addNew`),n[39]=c,n[40]=V);let H;n[41]===V?H=n[42]:(H=(0,X.jsx)(`span`,{className:`font-medium text-foreground`,children:V}),n[41]=V,n[42]=H);let fe;n[43]!==A||n[44]!==z||n[45]!==H?(fe=(0,X.jsxs)(`div`,{ref:ue,className:z,onClick:A,onMouseMove:B,children:[de,H]}),n[43]=A,n[44]=z,n[45]=H,n[46]=fe):fe=n[46];let pe;n[47]!==k||n[48]!==g||n[49]!==u||n[50]!==f||n[51]!==c?(pe=g.length?g.map((e,t)=>(0,X.jsx)(`div`,{ref:e=>{y.current[t+1]=e},className:j(`flex gap-2 px-3 py-1.5 cursor-pointer rounded-lg typography-ui-label`,u?`items-center`:`items-start`,t+1===f&&`bg-interactive-selection`),onClick:()=>k(e),onMouseMove:()=>p(t+1),children:(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsxs)(`span`,{className:`font-semibold truncate`,children:[`#`,e.name]}),(0,X.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:c(`snippets.source.${e.source}`)})]}),!u&&(0,X.jsx)(`div`,{className:`typography-meta text-muted-foreground mt-0.5 truncate`,children:Pe(e)})]})},`${e.source}:${e.filePath}`)):(0,X.jsx)(`div`,{className:`px-3 py-2 typography-ui-label text-muted-foreground`,children:c(`chat.snippetAutocomplete.empty`)}),n[47]=k,n[48]=g,n[49]=u,n[50]=f,n[51]=c,n[52]=pe):pe=n[52];let me;n[53]!==fe||n[54]!==pe?(me=(0,X.jsxs)(le,{preventOverscroll:!0,outerClassName:`flex-1 min-h-0`,className:`px-0 pb-2`,children:[fe,pe]}),n[53]=fe,n[54]=pe,n[55]=me):me=n[55];let W;n[56]!==u||n[57]!==c?(W=!u&&(0,X.jsx)(`div`,{className:`px-3 pt-1 pb-1.5 border-t typography-meta text-muted-foreground`,children:c(`chat.snippetAutocomplete.footer`)}),n[56]=u,n[57]=c,n[58]=W):W=n[58];let G;return n[59]!==I||n[60]!==me||n[61]!==W?(G=(0,X.jsxs)(`div`,{ref:l,className:`absolute z-[100] min-w-0 w-full max-w-[450px] max-h-60 bg-background border-2 border-border/60 rounded-xl shadow-none bottom-full mb-2 left-0 flex flex-col`,style:I,children:[me,W]}),n[59]=I,n[60]=me,n[61]=W,n[62]=G):G=n[62],G});Fe.displayName=`SnippetAutocomplete`;function Ie(e){return e.isMobile}function Le(e){return e.snippets}function Re(e){return e.loadSnippets}function ze(e){return e.setSnippetDraft}function Be(e){return e.setSelectedSnippet}function Ve(e){return e.setSettingsDialogOpen}function He(e){return e.setSettingsPage}function Ue(e,t){return e.source===`project`&&t.source!==`project`?-1:e.source!==`project`&&t.source===`project`?1:e.name.localeCompare(t.name)}function We(e){return[e.name,...e.aliases]}function Ge(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 Ke(e){return e.item}function qe(e){return e.name}var Je=2,Ye=e=>!!e&&typeof e==`object`&&!Array.isArray(e),Xe=e=>{let t=e?.trim().replace(/\\/g,`/`);return t?t.length>1?t.replace(/\/+$/,``):t:null},Ze=e=>Ye(e)&&Array.isArray(e.all)&&e.all.every(e=>typeof e==`string`)&&typeof e.current==`string`&&Ye(e.branches),Qe=(e,t)=>JSON.stringify([e,t]),$e=e=>`version`in e&&e.version===Je&&Ye(e.entries),et=e=>{if(!e)return null;try{let t=JSON.parse(e);return Ye(t)?t.version===Je&&Ye(t.entries)?{version:Je,entries:t.entries}:t:null}catch{return null}},tt=(e,t)=>{try{e.setItem(`oc.gitBranchCache`,JSON.stringify(t))}catch{}},nt=(e,t,n)=>{let r=Xe(e);if(!r||!t)return null;let i;try{i=n.getItem(`oc.gitBranchCache`)}catch{return null}let a=et(i);if(!a)return null;if($e(a))return Ze(a.entries[Qe(t,r)])?a.entries[Qe(t,r)]:null;let o={};for(let[e,n]of Object.entries(a)){let r=Xe(e);r&&Ze(n)&&(o[Qe(t,r)]=n)}return tt(n,{version:Je,entries:o}),o[Qe(t,r)]??null},rt=(e,t,n,r)=>{let i=Xe(e);if(!i||!t||!Ze(n))return;let a=null;try{a=r.getItem(`oc.gitBranchCache`)}catch{return}let o=et(a);tt(r,{version:Je,entries:{...o&&$e(o)?o.entries:{},[Qe(t,i)]:n}})},it=3e4,at=Xe,ot=(e,t=n())=>c.git.branches(at(e),t),st=(e,t=n())=>c.git.remotes(at(e),t),ct=async(e,t,n)=>{n.throwIfAborted();let r=d()?.git,i=t?.getGitBranches?await t.getGitBranches(e,{signal:n}):r?await r.getGitBranches(e,{signal:n}):await y(e,{signal:n});return n.throwIfAborted(),i},lt=async(e,t,n)=>{n.throwIfAborted();let r=d()?.git,i=t?.getRemotes?await t.getRemotes(e,{signal:n}):r?await r.getRemotes(e,{signal:n}):await _(e,{signal:n});return n.throwIfAborted(),i},ut=(e,t,i=n(),a=r())=>{let o=at(e),s=t;return{queryKey:ot(o,i),queryFn:async({signal:e})=>{if(!o)throw Error(`Git branches require a directory`);let t=await ct(o,s,e);return rt(o,i,t,a),t},staleTime:it,gcTime:1/0,initialData:()=>nt(o,i,a)??void 0,initialDataUpdatedAt:0}},dt=(e,t,r=n())=>{let i=at(e),a=t;return{queryKey:st(i,r),queryFn:({signal:e})=>{if(!i)throw Error(`Git remotes require a directory`);return lt(i,a,e)},staleTime:it,gcTime:1/0}},ft=(e,r,i)=>{let a=(0,U.c)(9),o=i===void 0||i,s=L.useSyncExternalStore(t,n,n),c,l,u;a[0]!==e||a[1]!==r||a[2]!==s?(c=at(e),u=S,l=ut(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)},pt=(e,r,i)=>{let a=(0,U.c)(9),o=i===void 0||i,s=L.useSyncExternalStore(t,n,n),c,l,u;a[0]!==e||a[1]!==r||a[2]!==s?(c=at(e),u=S,l=dt(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)},mt=(e,t,r=u,i=n())=>r.fetchQuery(ut(e,t,i)),ht=(e,t,r=u,i=n())=>r.fetchQuery({...ut(e,t,i),staleTime:0}),gt=e=>e instanceof Error?e.name===`AbortError`||e.name===`CancelledError`||e.name===`Error`&&e.message===`CancelledError`:!1,_t=1e4,vt=6e4,yt=5e3,bt=3e4,xt=6e4,St=25,Ct=40,wt=2,Tt=15e3,Et=500,Dt=30,Ot=20971520,kt=new Map,At=new Map,jt=new Map,Mt=new Map,Nt=new Map,Pt=(e,t)=>`${t}:${e}`,Ft=e=>At.get(e)??0,It=e=>{let t=Ft(e)+1;return At.set(e,t),t},Lt=e=>{let t=(jt.get(e)??0)+1;return jt.set(e,t),t},Rt=e=>{let t=kt.get(e);if(t)return t;let n=new Set;return kt.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}),zt=(e,t=Dt,n=Ot)=>{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},Bt=(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},Vt=(e,t)=>!e&&!t?!1:!e||!t||e.remote!==t.remote||e.branch!==t.branch||e.ahead!==t.ahead||e.behind!==t.behind,Ht=(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&&Vt(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&&Bt(e.diffStats,t.diffStats))},Ut=(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},Wt=(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},Gt=e=>!e||e.trim().length===0,Kt=e=>(e||``).trim()===`U`,qt=e=>{let t=(e.index||``).trim(),n=(e.working_dir||``).trim();if(Kt(t)||Kt(n))return e;let r=t===`?`||n===`?`?`A`:t||n||` `;return{...e,index:r,working_dir:` `}},Jt=e=>{let t=(e.index||``).trim(),n=(e.working_dir||``).trim();if(Kt(t)||Kt(n))return e;let r=n||(t===`A`||t===`?`?`?`:t)||` `;return{...e,index:` `,working_dir:r}},Yt=e=>Gt(e.index)&&Gt(e.working_dir),$=f()(m((e,t)=>({directories:new Map,activeDirectory:null,setActiveDirectory:n=>{let{activeDirectory:r,directories:i}=t();if(r!==n)if(r&&It(r),n&&It(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=Pt(n,a),s=Mt.get(o)??(a===`light`?Mt.get(Pt(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)>vt,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(Ht(s.status,u)){c=!0;let r=new Map(t().directories),i=r.get(n)??Q(),s=Ut(i.status,u),l=Wt(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&&It(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})();Mt.set(o,c);try{return await c}finally{Mt.get(o)===c&&Mt.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`?qt(e):Jt(e);t!==e&&(l=!0),Yt(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=Lt(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 ht(r,i,void 0,o):await mt(r,i,void 0,o);if(s!==jt.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(gt(i)||console.error(`Failed to fetch git branches:`,i),s!==jt.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>_t||!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=zt(s);a.set(n,{...o,diffCache:c}),e({directories:a})},clearDiffCache:n=>{It(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,St);await t().prefetchDiffs(e,n,i,{maxFiles:St})},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=Ct}=a,c=new Set(o.status.files.map(e=>e.path)),l=o.status.diffStats,u=Rt(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>Et||d.push(e)}let p=d.slice(0,Math.max(1,s));if(p.length===0)return;let m=Ft(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 ${Tt}ms`)),Tt)}),a=await Promise.race([t,i]);return{path:e,diff:{original:a.original??``,modified:a.modified??``,isBinary:a.isBinary}}},y=async()=>{for(;;){if(m!==Ft(n))return;let e=_();if(!e)return;try{g.push(await v(e))}catch{}finally{u.delete(e)}}},b=Math.min(wt,p.length);if(await Promise.allSettled(Array.from({length:b},()=>y())),p.forEach(e=>u.delete(e)),m!==Ft(n))return;let x=new Map(t().directories),S=x.get(n);if(!S)return;let C=new Map(S.diffCache),ee=Date.now();g.forEach(e=>{!e.diff.isBinary&&e.diff.original===``&&e.diff.modified===``||C.set(e.path,{...e.diff,fetchedAt:ee})});let w=zt(C);x.set(n,{...S,diffCache:w}),e({directories:x})},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<yt||await t().fetchStatus(e,n,{silent:!!r?.status})},ensureAll:(e,n)=>{let r=Nt.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)>=yt)&&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>=bt)&&o.push(t().fetchBranches(e,n)),(!a.log||i-a.lastLogFetch>=_t)&&o.push(t().fetchLog(e,n)),(!a.identity||i-a.lastIdentityFetch>=xt)&&o.push(t().fetchIdentity(e,n)),o.length>0&&await Promise.all(o)})();return Nt.set(e,i),i.finally(()=>{Nt.get(e)===i&&Nt.delete(e)}),i},refresh:async(e,n={})=>{let{activeDirectory:r}=t();r&&await t().fetchAll(r,e,n)}}),{name:`git-store`})),Xt=e=>{let t=(0,U.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)},Zt=e=>{let r=(0,U.c)(3),i=L.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)},Qt=e=>{let t=(0,U.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)},$t=e=>{let t=(0,U.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)},en=e=>{let t=(0,U.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)},tn={current:new Map},nn=()=>$(cn),rn=e=>{let t=(0,U.c)(3),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=new Map,t[0]=n):n=t[0];let r=L.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)},an=e=>{let t=(0,U.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)},on=e=>{let t=(0,U.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)},sn=e=>{let t=(0,U.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 cn(e){let t=tn.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 tn.current=r,r}var ln=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)}},un=e=>String(e||``).trim().replace(/^refs\/heads\//,``).replace(/^heads\//,``).replace(/^remotes\//,``),dn=e=>e.branchName?un(e.branchName):e.mode===`existing`?un(e.existingBranch||e.preferredName||``):un(e.preferredName||``),fn=async e=>{let t=await I(e);try{let n=ln((await N(e)).branches?.[t]?.tracking||null);if(n?.remote)return n.remote}catch{}try{let t=ln((await P(e)).tracking);if(t?.remote)return t.remote}catch{}return null},pn=async(e,t)=>{let n=await fn(e),r=un(t);return!n||!r?null:{setUpstream:!0,upstreamRemote:n,upstreamBranch:r}},mn=async(e,t,n)=>{let r=dn(t),i=n?.resolvedRootTrackingRemote,a=i===void 0?await pn(e,r):i&&un(r)?{setUpstream:!0,upstreamRemote:i,upstreamBranch:un(r)}:null;return a?{...t,setUpstream:t.setUpstream??a.setUpstream,upstreamRemote:t.upstreamRemote||a.upstreamRemote,upstreamBranch:t.upstreamBranch||a.upstreamBranch}:t},hn=async(e,t,n)=>{let r=await mn(e.path,t,n);return ue(e,r)},gn=`oc:lastWorktreeSourceBranch`,_n=({mode:e,sourceBranch:t,linkedPr:n,selectedBranch:r})=>e===`existing-branch`?r||null:n?null:t||null,vn=({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},yn=(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?` `:``}`},bn=(e,t,n)=>{let r=yn(e,t,n);return`${t.length===0&&!/^\s/.test(r)?` `:``}${r}${n.length===0&&!/\s$/.test(r)?` `:``}`},xn=(e,t,n,r)=>{let i=e.slice(0,t),a=e.slice(n),o=bn(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}},Sn=(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]},Cn=(e,t)=>t<e.length&&e[t]===` `?t+1:t;export{ye as A,ft as C,Te as D,Ne as E,pe as M,fe as N,Ce as O,ht as S,Fe as T,Qt as _,gn as a,$ as b,hn as c,nn as d,en as f,an as g,on as h,bn as i,me as j,Z as k,fn as l,sn as m,Sn as n,vn as o,Zt as p,xn as r,_n as s,Cn as t,mn as u,rn as v,pt as w,$t as x,Xt as y};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/renderMobileApp-BuSUOExs.js","assets/rolldown-runtime-C0FnF6B9.js","assets/useUIStore-DzwCfRqr.js","assets/vendor-zustand-B4dlGEM2.js","assets/vendor-base-ui-CnHfUmDN.js","assets/persistence-6sclr7B6.js","assets/vendor-pathe-vBmvQE8f.js","assets/vendor-react-DLPElpoQ.js","assets/vendor-tanstack-query-core-BWz0ose6.js","assets/platform-CbeLpKPk.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-sonner-DVzioF3d.js","assets/vendor-reactuses-core-DDoDDyM9.js","assets/vendor-lodash-es-DfLbG5Af.js","assets/vendor-js-cookie-hSOiFTtX.js","assets/clipboard-O3XtpG2j.js","assets/store-CXHGSKbF.js","assets/MobileShareBridge-Cr2Na6iM.js","assets/useMobileNavigationStore-DbD0hWMO.js","assets/vendor-tanstack-react-query-D7pys_c9.js","assets/useAssistantUIStore-BHsHXCKE.js","assets/vendor-fuse.js-DB5wDJbI.js","assets/MobileDetailNavigation-TZmiqs_4.js","assets/utils-B1EK5zKa.js","assets/vendor-class-variance-authority-BLUaYARZ.js","assets/vendor-tailwind-merge-BicNWLTg.js","assets/Icon-DpjYnXxn.js","assets/button-C7OXr4ae.js","assets/AgentAvatar-DDcjamcJ.js","assets/dialog-BBR8o-ss.js","assets/gitApi-BDP5AvDM.js","assets/useAppFontEffects-DJPeS83j.js","assets/desktopHosts-Txp4xOVQ.js","assets/desktopRelayRestore-C_FSEHKM.js","assets/vendor-simplewebauthn-browser-Dwhcdg_5.js","assets/projectMeta-CZ1xvqQ_.js","assets/input-BzYA603C.js","assets/tooltip-D_orJMYd.js","assets/OverlayScrollbar-Ch3J6ASR.js","assets/vendor-dnd-kit-core-CvWxUPdb.js","assets/vendor-dnd-kit-accessibility-BY5LhhUB.js","assets/vendor-dnd-kit-sortable-hHdP9lLb.js","assets/useSessionAutoCleanup-D8XMYMRy.js","assets/radio-C21qxMRv.js","assets/vendor-codemirror-autocomplete-DHomsvW7.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/vendor-codemirror-language-data-BfYFhIH1.js","assets/markdownTheme-B89dbj3N.js","assets/vendor-pierre-diffs-BenIz2TM.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/ChatContainer-DZPnS2OI.js","assets/useRuntimeAPIs-DSLXJybW.js","assets/appThemeRegistry-CNcq8eKx.js","assets/markdown-worker-W06-MhF5.js","assets/url-BsaBG5-1.js","assets/useEffectiveDirectory-BwePcDe9.js","assets/FadeInOnReveal-By2F9vcI.js","assets/insertionBoundaries-BZq6rsZ4.js","assets/useWorkerHighlightedLines-CGoX-xGT.js","assets/vendor-tanstack-react-virtual-tlDgH6PG.js","assets/vendor-cmdk-CeAGfrLo.js","assets/vendor-aria-hidden-BbL3cEyI.js","assets/sortable-tabs-strip-D9PYWV2n.js","assets/vendor-framer-motion-DFy_BSVd.js","assets/vendor-legendapp-list-WE32lwNk.js","assets/useFontPreferences-ckzpXQaJ.js","assets/terminalApi-BpPeXWIu.js","assets/MobileSurface-B-xtWRhK.js","assets/collapsible-DaEya6b6.js","assets/projectActions-CWvNGKfA.js","assets/ContextPanel-BVsxBmy5.js","assets/shikiHighlight-DGtY3zhO.js","assets/vendor-codemirror-commands-C9DCaJ0C.js","assets/vendor-codemirror-search-D2SOgzph.js","assets/vendor-replit-codemirror-vim-CEibx3EP.js","assets/fileQueries-B_fTkH6s.js","assets/vendor-react-drawio-ECtEwvbc.js","assets/vendor-zumer-snapdom-yq9vlCKr.js","assets/vendor-html-to-image-BDMm2v6d.js","assets/runtimeEndpointReset-C3MJHiBd.js","assets/vendor-cron-parser-CCD11YFT.js","assets/SettingsView-BwtE9Hby.js","assets/vendor-yaml-DIcAK3EC.js","assets/vendor-qrcode-DAuVxiQR.js","assets/vendor-dijkstrajs-DztKuCwY.js","assets/AssistantView-Dw6pykwG.js","assets/src-RGaBtbGz.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{t as e}from"./runtimeConfig-D3LuSwdY.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-BuSUOExs.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])).then(({renderMobileApp:t})=>{t(window.__OPENCHAMBER_RUNTIME_APIS__??e())});
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{t}from"./useUIStore-DzwCfRqr.js";import{Xt as n}from"./persistence-6sclr7B6.js";import{a as r,r as i}from"./vendor-zustand-B4dlGEM2.js";import{nt as a,rt as o}from"./vendor-base-ui-CnHfUmDN.js";import{Ct as s,Nt as c}from"./platform-CbeLpKPk.js";import{n as l}from"./vendor-react-DLPElpoQ.js";import{n as u}from"./vendor-reactuses-core-DDoDDyM9.js";import{l as d,n as f}from"./clipboard-O3XtpG2j.js";import{Eo as p,Kn as m,Qa as h,Rn as g,Xa as _,_r as v,br as y,c as b,l as x,la as S,nr as C,oa as w,pa as T,zn as E}from"./useMobileNavigationStore-DbD0hWMO.js";import{n as D,t as ee}from"./utils-B1EK5zKa.js";import{n as O}from"./Icon-DpjYnXxn.js";import{t as te}from"./button-C7OXr4ae.js";import{n as ne}from"./gitApi-BDP5AvDM.js";import{C as re,M as ie,N as k,O as ae,S as A,_ as j,a as oe,b as se,g as ce,h as le,i as M,j as ue,k as de,n as N,o as P,p as F,v as fe,x as pe,y as I}from"./projectMeta-CZ1xvqQ_.js";import{t as L}from"./input-BzYA603C.js";import{i as R,n as me,t as he}from"./tooltip-D_orJMYd.js";import{o as ge}from"./OverlayScrollbar-Ch3J6ASR.js";import{n as z}from"./useRuntimeAPIs-DSLXJybW.js";import{E as _e,T as ve,a as B,b as V,c as ye,g as H,k as be,l as U,m as W,o as G,p as K,r as xe,x as q}from"./insertionBoundaries-BZq6rsZ4.js";import{n as J,r as Se,t as Ce}from"./collapsible-DaEya6b6.js";var Y=e(o(),1),we=l(),X=/^[a-z0-9](?:[a-z0-9-]{0,48}[a-z0-9])?$/,Z=/^g[1-9]\d*$/,Q=(e,t,n,r,i)=>{if(!X.test(e)||t!==void 0&&!Z.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 Q(n,void 0,t[1],t[2],void 0);if(t.length===4){let[,e,r,i]=t;return Z.test(e)?Q(n,e,r,i,void 0):Q(n,void 0,e,r,i)}let[,r,i,a,o]=t;return r===``?Q(n,void 0,i,a,o):Q(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};T(e.id,n),x.getState().markSessionAsOpenChamberCreated(e.id),v.getState().upsertSession(i);try{S().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=p.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=s.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=r()(i(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 s=Ne();if(!s)return e({error:`Select a project`,isLoading:!1}),null;let l=s.path,u=await ne(l)&&t.isolateRuns!==!1,d=Oe(n),f=u?await F(l):void 0,p=u?await U(l):null,h=[],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 m of n.models){let n=`${m.providerID}:${m.modelID}`,_=a.get(n)||1,v=(o.get(n)||0)+1;o.set(n,v);let y=ke(m.providerID,m.modelID),b=r.length>1?`g${e+1}`:void 0,S=_>1?Ae(d,`${y}/${v}`):Ae(d,y),w=b?`${b}/${S}`:S,T=Ee({groupSlug:d,runGroup:b,providerID:m.providerID,modelID:m.modelID,index:_>1?v:void 0});try{if(!u){let e=await c.withDirectory(l,()=>c.createSession({title:T}));Me(e,l),h.push({sessionId:e.id,worktreePath:l,providerID:m.providerID,modelID:m.modelID,variant:m.variant,prompt:i});continue}let e=await ye(s,{preferredName:w,mode:`new`,branchName:w,worktreeName:w,startRef:t.worktreeBaseBranch||`HEAD`,setupCommands:g,returnAfterDirectoryCreated:!0},{resolvedRootTrackingRemote:p}),n={...e,createdFromBranch:f,kind:`standard`};await E(s)&&await C(e.path);let r=await c.withDirectory(e.path,()=>c.createSession({title:T}));Me(r,e.path),x.getState().setWorktreeMetadata(r.id,n),h.push({sessionId:r.id,worktreePath:e.path,providerID:m.providerID,modelID:m.modelID,variant:m.variant,prompt:i})}catch(e){console.warn(`[MultiRun] Failed to create session:`,e)}}}let _=o?.filter(e=>e.trim().length>0)??[];_.length>0&&m(s,_).catch(()=>{console.warn(`[MultiRun] Failed to save worktree setup commands`)});let v=h.map(e=>e.sessionId),y=h[0]?.sessionId??null;if(v.length===0)return e({error:`Failed to create any sessions`,isLoading:!1}),null;let S=a?.map(e=>({type:`file`,mime:e.mime,filename:e.filename,url:e.url}));return(async()=>{try{let e=ie.getState().expandText;await Promise.allSettled(h.map(async t=>{try{let n=await e(t.prompt).catch(()=>t.prompt);await b({sessionId:t.sessionId,directory:t.worktreePath,content:n,providerID:t.providerID,modelID:t.modelID,variant:t.variant,agent:i,files:S})}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:v,firstSessionId:y}}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`})),$=a(),Fe=`h-7`,Ie=()=>`${Date.now()}-${Math.random().toString(36).substring(2,9)}`,Le=e=>{let t=(0,we.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)(de,{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 n=(0,we.c)(131),{selectedModels:r,onAdd:i,onRemove:a,onUpdate:o,minModels:s,addButtonLabel:c,showChips:l,maxModels:u,addButtonClassName:d,dropdownSide:p,dropdownClassName:m,containerClassName:g,triggerIcon:_}=e,v=l===void 0||l,y=p===void 0?`top`:p,{t:b}=f(),x=w(ze),S=w(Be),C=t(Ve),T=t(He),{favoriteModelsList:E,recentModelsList:D}=ae(),ne=t(Ue),ie=t(We),[k,j]=Y.useState(!1),[oe,se]=Y.useState(``),[M,ue]=Y.useState(null),de=Y.useRef(null),N=Y.useRef(null),P=u===1,F=u===void 0||r.length<u||P,I;if(n[0]!==r){I=new Map;for(let e of r){let t=`${e.providerID}:${e.modelID}`;I.set(t,(I.get(t)||0)+1)}n[0]=r,n[1]=I}else I=n[1];let L=I,R;n[2]===r?R=n[3]:(R=e=>r.filter(t=>t.providerID===e.providerID&&t.modelID===e.modelID).findIndex(t=>t.instanceId===e.instanceId)+1,n[2]=r,n[3]=R);let me=R,he,ge;n[4]!==y||n[5]!==k?(he=()=>{if(!k||!N.current)return;let e=N.current.getBoundingClientRect();if(y===`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=N.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)))},ge=[y,k],n[4]=y,n[5]=k,n[6]=he,n[7]=ge):(he=n[6],ge=n[7]),Y.useEffect(he,ge);let z,_e;n[8]!==F||n[9]!==k?(z=()=>{!F&&k&&(j(!1),se(``))},_e=[F,k],n[8]=F,n[9]=k,n[10]=z,n[11]=_e):(z=n[10],_e=n[11]),Y.useEffect(z,_e);let ve,B;n[12]===k?(ve=n[13],B=n[14]):(ve=()=>{if(!k)return;let e=e=>{de.current&&!de.current.contains(e.target)&&(j(!1),se(``))};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},B=[k],n[12]=k,n[13]=ve,n[14]=B),Y.useEffect(ve,B);let V;n[15]!==P||n[16]!==i||n[17]!==o||n[18]!==r.length?(V=e=>{let t={providerID:e.providerID,modelID:e.modelID,displayName:h(e.model,e.modelID)||e.modelID,instanceId:Ie()};P&&r.length>0&&o?o(0,t):i(t),P&&(j(!1),se(``))},n[15]=P,n[16]=i,n[17]=o,n[18]=r.length,n[19]=V):V=n[19];let ye=V,H;n[20]===b?H=n[21]:(H=b(`multirun.modelMultiSelect.search.placeholder`),n[20]=b,n[21]=H);let be;n[22]===b?be=n[23]:(be=b(`multirun.modelMultiSelect.search.noResults`),n[22]=b,n[23]=be);let U;n[24]===b?U=n[25]:(U=b(`multirun.modelMultiSelect.sections.favorites`),n[24]=b,n[25]=U);let W;n[26]===b?W=n[27]:(W=b(`multirun.modelMultiSelect.sections.recent`),n[26]=b,n[27]=W);let G;n[28]===b?G=n[29]:(G=b(`multirun.modelMultiSelect.keyboard.hint`),n[28]=b,n[29]=G);let K;n[30]===b?K=n[31]:(K=b(`settings.agents.modelSelector.actions.favorite`),n[30]=b,n[31]=K);let xe;n[32]===b?xe=n[33]:(xe=b(`settings.agents.modelSelector.actions.unfavorite`),n[32]=b,n[33]=xe);let q;n[34]===b?q=n[35]:(q=b(`chat.modelControls.provider`),n[34]=b,n[35]=q);let J;n[36]===b?J=n[37]:(J=b(`chat.modelControls.capabilities`),n[36]=b,n[37]=J);let Se;n[38]===b?Se=n[39]:(Se=b(`chat.modelControls.capability.toolCalling`),n[38]=b,n[39]=Se);let Ce;n[40]===b?Ce=n[41]:(Ce=b(`chat.modelControls.capability.reasoning`),n[40]=b,n[41]=Ce);let X;n[42]===b?X=n[43]:(X=b(`chat.modelControls.modality.image`),n[42]=b,n[43]=X);let Z;n[44]===b?Z=n[45]:(Z=b(`chat.modelControls.modality.video`),n[44]=b,n[45]=Z);let Q;n[46]===b?Q=n[47]:(Q=b(`chat.modelControls.modality.audio`),n[46]=b,n[47]=Q);let Te;n[48]===b?Te=n[49]:(Te=b(`chat.modelControls.costPerMillion`),n[48]=b,n[49]=Te);let Ee;n[50]===b?Ee=n[51]:(Ee=b(`chat.modelControls.costInput`),n[50]=b,n[51]=Ee);let De;n[52]===b?De=n[53]:(De=b(`chat.modelControls.costOutput`),n[52]=b,n[53]=De);let Oe;n[54]!==H||n[55]!==be||n[56]!==U||n[57]!==W||n[58]!==G||n[59]!==K||n[60]!==xe||n[61]!==q||n[62]!==J||n[63]!==Se||n[64]!==Ce||n[65]!==X||n[66]!==Z||n[67]!==Q||n[68]!==Te||n[69]!==Ee||n[70]!==De?(Oe={searchPlaceholder:H,noResults:be,favorites:U,recent:W,keyboardHint:G,favorite:K,unfavorite:xe,provider:q,capabilities:J,capabilityToolCalling:Se,capabilityReasoning:Ce,modalityImage:X,modalityVideo:Z,modalityAudio:Q,costPerMillion:Te,costInput:Ee,costOutput:De},n[54]=H,n[55]=be,n[56]=U,n[57]=W,n[58]=G,n[59]=K,n[60]=xe,n[61]=q,n[62]=J,n[63]=Se,n[64]=Ce,n[65]=X,n[66]=Z,n[67]=Q,n[68]=Te,n[69]=Ee,n[70]=De,n[71]=Oe):Oe=n[71];let ke=Oe,Ae;n[72]===g?Ae=n[73]:(Ae=ee(`relative`,g),n[72]=g,n[73]=Ae);let je;n[74]===d?je=n[75]:(je=ee(Fe,`!border-border/80 !bg-[var(--surface-subtle)] hover:!bg-[var(--interactive-hover)]/70`,d),n[74]=d,n[75]=je);let Me=!F,Ne;n[76]===k?Ne=n[77]:(Ne=()=>{j(!k)},n[76]=k,n[77]=Ne);let Pe;n[78]===_?Pe=n[79]:(Pe=_??(0,$.jsx)(O,{name:`add`,className:`h-3.5 w-3.5 mr-1`}),n[78]=_,n[79]=Pe);let Re;n[80]!==c||n[81]!==b?(Re=c??b(`multirun.modelMultiSelect.actions.addModel`),n[80]=c,n[81]=b,n[82]=Re):Re=n[82];let Ke;n[83]!==je||n[84]!==Me||n[85]!==Ne||n[86]!==Pe||n[87]!==Re?(Ke=(0,$.jsxs)(te,{ref:N,type:`button`,variant:`outline`,size:`sm`,className:je,disabled:Me,onClick:Ne,children:[Pe,Re]}),n[83]=je,n[84]=Me,n[85]=Ne,n[86]=Pe,n[87]=Re,n[88]=Ke):Ke=n[88];let qe;n[89]!==M||n[90]!==F||n[91]!==m||n[92]!==y||n[93]!==E||n[94]!==S||n[95]!==ye||n[96]!==ne||n[97]!==T||n[98]!==k||n[99]!==ke||n[100]!==L||n[101]!==ie||n[102]!==x||n[103]!==D||n[104]!==oe||n[105]!==C?(qe=k?(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`,y===`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)(re,{providers:x,providerOrder:ie,favoriteModels:E,recentModels:D,getMetadata:S,hiddenModels:ne,searchQuery:oe,onSearchQueryChange:se,onSelect:ye,labels:ke,selectionCount:e=>L.get(`${e.providerID}:${e.modelID}`)||0,disabled:!F,maxHeightClassName:`flex-1`,maxHeightStyle:{maxHeight:M?`${M}px`:`300px`},stickyHeaders:!0,tooltipsEnabled:k,isFavorite:e=>T(e.providerID,e.modelID),onToggleFavorite:e=>C(e.providerID,e.modelID),onEscape:()=>{j(!1),se(``)}})}):null,n[89]=M,n[90]=F,n[91]=m,n[92]=y,n[93]=E,n[94]=S,n[95]=ye,n[96]=ne,n[97]=T,n[98]=k,n[99]=ke,n[100]=L,n[101]=ie,n[102]=x,n[103]=D,n[104]=oe,n[105]=C,n[106]=qe):qe=n[106];let Je;n[107]!==Ae||n[108]!==Ke||n[109]!==qe?(Je=(0,$.jsxs)(`div`,{className:Ae,ref:de,children:[Ke,qe]}),n[107]=Ae,n[108]=Ke,n[109]=qe,n[110]=Je):Je=n[110];let Ye;n[111]!==me||n[112]!==L||n[113]!==a||n[114]!==o||n[115]!==x||n[116]!==r||n[117]!==v||n[118]!==b?(Ye=v&&r.length>0&&(0,$.jsx)(`div`,{className:`flex flex-col gap-2 w-full`,children:r.map((e,t)=>{let n=`${e.providerID}:${e.modelID}`,r=L.get(n)||1,i=me(e),s=x.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:i,totalSameModel:r,onRemove:()=>a(t)}),l&&(0,$.jsxs)(le,{value:u,onValueChange:n=>{if(!o)return;let r=n===`__default__`?void 0:n;o(t,{...e,variant:r})},children:[(0,$.jsxs)(pe,{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)(A,{placeholder:b(`multirun.modelMultiSelect.variant.placeholder`),children:e=>e===`__default__`?b(`multirun.modelMultiSelect.variant.default`):e})]}),(0,$.jsxs)(ce,{fitContent:!0,children:[(0,$.jsx)(fe,{value:`__default__`,className:`pr-2 [&>span:first-child]:hidden`,children:b(`multirun.modelMultiSelect.variant.default`)}),c.map(Ge)]})]})]},e.instanceId)})}),n[111]=me,n[112]=L,n[113]=a,n[114]=o,n[115]=x,n[116]=r,n[117]=v,n[118]=b,n[119]=Ye):Ye=n[119];let Xe;n[120]!==Je||n[121]!==Ye?(Xe=(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-1.5 items-center`,children:[Je,Ye]}),n[120]=Je,n[121]=Ye,n[122]=Xe):Xe=n[122];let Ze;n[123]!==u||n[124]!==s||n[125]!==r.length||n[126]!==b?(Ze=s!==void 0&&r.length<s&&(0,$.jsx)(`p`,{className:`typography-micro text-muted-foreground`,children:u===void 0?b(`multirun.modelMultiSelect.validation.minOnly`,{min:s}):b(`multirun.modelMultiSelect.validation.minToMax`,{min:s,max:u})}),n[123]=u,n[124]=s,n[125]=r.length,n[126]=b,n[127]=Ze):Ze=n[127];let Qe;return n[128]!==Xe||n[129]!==Ze?(Qe=(0,$.jsxs)(`div`,{className:`space-y-2`,children:[Xe,Ze]}),n[128]=Xe,n[129]=Ze,n[130]=Qe):Qe=n[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)(fe,{value:e,className:`pr-2 [&>span:first-child]:hidden`,children:e},e)}function Ke(e){let t=(0,we.c)(30),{git:n}=z(),r=K(e),i=q(e),a=H(e),o=W(e),s=V(Ze),c=V(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]),Y.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],Y.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=Y.useMemo(()=>[...s,...c.map(e=>`remotes/${e}`)],[s,c]);return Y.useEffect(()=>{if(i||l||d.length===0||t&&d.includes(t))return;let r=t,a=!1;return(async()=>{try{let t=e?await F(e).catch(()=>null):null;if(a)return;let i=localStorage.getItem(B),{sourceBranch:o,shouldClearSavedSourceBranch:s}=G({branches:d,savedSourceBranch:i,rootBranch:t});if(s&&localStorage.removeItem(B),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)(pe,{id:a,size:`lg`,className:r??`w-fit typography-meta text-foreground`,children:(0,$.jsx)(A,{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)(j,{children:[(0,$.jsx)(I,{className:`font-semibold text-foreground`,children:o(`multiRun.branchSelector.groups.localBranches`)}),s.map(e=>(0,$.jsx)(fe,{value:e,className:`whitespace-normal break-all`,children:e},e))]}),s.length>0&&c.length>0&&(0,$.jsx)(se,{}),c.length>0&&(0,$.jsxs)(j,{children:[(0,$.jsx)(I,{className:`font-semibold text-foreground`,children:o(`multiRun.branchSelector.groups.remoteBranches`)}),c.map(e=>(0,$.jsx)(fe,{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,we.c)(36),{value:n,onChange:r,className:i,disabled:a,id:o,portalToBody:s}=e,{t:c}=f(),l=w(et),u=w(tt),d=w(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 g=h,_,v;t[4]!==m.length||t[5]!==u?(_=()=>{m.length===0&&u()},v=[m.length,u],t[4]=m.length,t[5]=u,t[6]=_,t[7]=v):(_=t[6],v=t[7]),Y.useEffect(_,v);let y,b;t[8]!==d||t[9]!==a||t[10]!==r||t[11]!==g||t[12]!==n?(y=()=>{if(a)return;let e=n.trim();if(e.length>0&&g.some(t=>t.name===e))return;let t=typeof d==`string`&&d.trim().length>0?d.trim():null;if(t&&g.some(e=>e.name===t)){r(t);return}let i=g[0]?.name;i&&r(i)},b=[d,a,r,g,n],t[8]=d,t[9]=a,t[10]=r,t[11]=g,t[12]=n,t[13]=y,t[14]=b):(y=t[13],b=t[14]),Y.useEffect(y,b);let x=n.trim().length>0?n:void 0,S;t[15]===i?S=t[16]:(S=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]=S);let C;t[17]===c?C=t[18]:(C=c(`multirun.agentSelector.placeholder`),t[17]=c,t[18]=C);let T;t[19]===C?T=t[20]:(T=(0,$.jsx)(A,{placeholder:C}),t[19]=C,t[20]=T);let E;t[21]!==o||t[22]!==S||t[23]!==T?(E=(0,$.jsx)(pe,{id:o,size:`lg`,className:S,children:T}),t[21]=o,t[22]=S,t[23]=T,t[24]=E):E=t[24];let D;t[25]===g?D=t[26]:(D=g.length>0&&(0,$.jsx)(j,{children:g.map(it)}),t[25]=g,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]!==x||t[33]!==E||t[34]!==O?(te=(0,$.jsxs)(le,{value:x,onValueChange:r,disabled:a,children:[E,O]}),t[30]=a,t[31]=r,t[32]=x,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 _(e.mode)}function it(e){return(0,$.jsx)(fe,{value:e.name,className:`w-auto whitespace-nowrap`,children:e.name},e.name)}var at=10485760,ot=5,st=e=>{let t=(0,we.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)(he,{children:[r,(0,$.jsx)(me,{side:`top`,className:`max-w-[240px]`,children:n})]}),t[1]=n,t[2]=i),i},ct=e=>{let t=(0,we.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?M[e.icon]:null,r=e.color?N[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)(oe,{project:e,className:`size-full object-contain`,fallback:i}):i}),(0,$.jsx)(`span`,{className:`truncate`,children:t})]})},ut=({initialPrompt:e,onCreated:t,onCancel:r,isWindowed:i=!1})=>{let{t:a}=f(),[o,c]=Y.useState(``),[l,m]=Y.useState(()=>[{id:Ie(),prompt:``,models:[]}]),[h,_]=Y.useState(``),[v,b]=Y.useState([]),[S,C]=Y.useState(!1),[w,T]=Y.useState([]),[E,D]=Y.useState(!1),[ne,re]=Y.useState(!1),[ie,ae]=Y.useState(!0),j=Y.useRef(null),oe=s(e=>e.currentDirectory??null),se=Y.useMemo(()=>{if(typeof window>`u`)return null;let e=window.__VSCODE_CONFIG__?.workspaceFolder;return typeof e==`string`&&e.trim().length>0?e.trim():null},[]),M=p(e=>e.activeProjectId),de=p(e=>e.setActiveProjectIdOnly),N=p(e=>e.projects),[P,F]=Y.useState(()=>M??null);Y.useEffect(()=>{if(M){F(M);return}!P&&N.length>0&&F(N[0].id)},[M,N,P]);let I=Y.useMemo(()=>P?N.find(e=>e.id===P)??null:null,[N,P]),z=I?.path??oe,_e=u(e=>{F(e),e!==M&&de(e)}),ve=Y.useMemo(()=>{if(I?.path)return{id:I.id,path:I.path};let e=oe??se;return e?{id:`path:${e}`,path:e}:null},[I,oe,se]),[B]=Y.useState(()=>typeof window<`u`&&n()),V=Y.useMemo(()=>typeof navigator>`u`?!1:/Macintosh|Mac OS X/.test(navigator.userAgent||``),[]),ye=ge(),H=Y.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},[]),be=Y.useMemo(()=>B&&V||ye?`pl-[5.5rem]`:`pl-3`,[B,V,ye]),U=Y.useMemo(()=>!B||!V||H===null?``:H>=26?`h-12`:H<=15?`h-14`:``,[B,V,H]),W=u(async e=>{e.target.closest(`button, a, input, select, textarea`)||e.button===0&&B&&await d()}),G=u(e=>{r&&e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),r())}),K=!!r;Y.useEffect(()=>{if(K)return window.addEventListener(`keydown`,G,!0),()=>window.removeEventListener(`keydown`,G,!0)},[K]);let[xe,q]=Y.useState(``),{isLoading:we,isGitRepository:X}=Ke(z),Z=Y.useRef(!1),Q=X===!0,Te=Q&&ie;Y.useEffect(()=>{if(X===!1){Z.current=!0,ae(!1);return}X===!0&&Z.current&&(Z.current=!1,ae(!0))},[X]);let Ee=Pe(e=>e.createMultiRun),De=Pe(e=>e.error),Oe=Pe(e=>e.clearError);Y.useEffect(()=>{typeof e==`string`&&e.trim().length>0&&m(t=>{let n=[...t];return n.length>0&&!n[0].prompt.trim()&&(n[0]={...n[0],prompt:e}),n})},[e]),Y.useEffect(()=>{if(!ve)return;let e=!1;return re(!0),(async()=>{try{let t=await g(ve);e||T(t)}catch{}finally{e||re(!1)}})(),()=>{e=!0}},[ve]);let ke=u((e,t)=>{m(n=>n.map(n=>n.id===e?{...n,...t}:n))}),Ae=u(e=>{m(t=>t.filter(t=>t.id!==e))}),je=u(()=>{m(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){y.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)});b(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),y.error(a(`multirun.launcher.toast.attachFailed`,{fileName:r.name}))}}n>0&&y.success(a(n===1?`multirun.launcher.toast.attachedSingle`:`multirun.launcher.toast.attachedPlural`,{count:n})),j.current&&(j.current.value=``)},Ne=e=>{b(t=>t.filter(t=>t.id!==e))},Fe=Y.useMemo(()=>l.reduce((e,t)=>e+t.models.length,0),[l]),Le=async e=>{e.preventDefault();let n=l.filter(e=>e.prompt.trim()&&e.models.length>=1);if(n.length!==0&&!(Fe<1)){C(!0),Oe();try{P&&P!==M&&de(P);let e=v.map(e=>({mime:e.mimeType,filename:e.filename,url:e.dataUrl})),r=w.filter(e=>e.trim().length>0),i=n.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:o.trim(),groups:i,agent:h||void 0,worktreeBaseBranch:Te?xe:void 0,isolateRuns:Te,files:e.length>0?e:void 0,setupCommands:r.length>0?r:void 0},s=await Ee(a);s&&(s.firstSessionId&&x.getState().setCurrentSession(s.firstSessionId),t?.())}finally{C(!1)}}},Re=!!(o.trim()&&l.some(e=>e.prompt.trim()&&e.models.length>=1)&&Fe>=1&&z&&!we&&(X===!1||!Te||xe)),ze=w.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:W,className:ee(`relative flex h-12 shrink-0 items-center justify-center border-b app-region-drag select-none`,be,U),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)(he,{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)(me,{children:(0,$.jsx)(`p`,{children:a(`multirun.launcher.actions.closeEsc`)})})]})})]}),(0,$.jsx)(ue,{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`)}),N.length>0?(0,$.jsxs)(le,{value:P??void 0,onValueChange:_e,children:[(0,$.jsx)(pe,{id:`multirun-project`,size:`lg`,className:`w-fit max-w-full`,children:I?(0,$.jsx)(A,{children:lt(I)}):(0,$.jsx)(A,{placeholder:a(`multirun.launcher.project.placeholder`)})}),(0,$.jsx)(ce,{fitContent:!0,children:N.map(e=>(0,$.jsx)(fe,{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:o,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:z,value:xe,onChange:q,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)(k,{checked:ie,onChange:ae,disabled:!Q,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:_,id:`multirun-agent`})]})]}),(0,$.jsxs)(Ce,{open:E,onOpenChange:D,children:[(0,$.jsxs)(Se,{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)(J,{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:[w.map((e,t)=>(0,$.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,$.jsx)(L,{value:e,onChange:e=>{let n=[...w];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(w.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([...w,``]),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:j,type:`file`,multiple:!0,className:`hidden`,onChange:Me,accept:`*/*`}),(0,$.jsxs)(he,{children:[(0,$.jsx)(R,{asChild:!0,children:(0,$.jsxs)(`button`,{type:`button`,onClick:()=>j.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)(me,{children:a(`multirun.launcher.attachments.tooltip`)})]}),v.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&&X!==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||S,children:S?a(`multirun.launcher.actions.creating`):(0,$.jsx)($.Fragment,{children:a(`multirun.launcher.actions.startWithRunCount`,{count:Fe})})})]})})]})},dt=e=>{let t=(0,we.c)(104),{group:n,groupIndex:r,canRemove:i,onUpdate:a,onRemove:o}=e,{t:s}=f(),[c,l]=Y.useState(!1),[d,p]=Y.useState(``),[m,h]=Y.useState(!1),[g,_]=Y.useState(``),[v,y]=Y.useState(!1),[b,x]=Y.useState(``),S=Y.useRef(null),C=Y.useRef(null),w=Y.useRef(null),T=Y.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),ae;t[13]!==n.id||t[14]!==a?(ae=e=>{a(n.id,{prompt:e})},t[13]=n.id,t[14]=a,t[15]=ae):ae=t[15];let A=u(ae),j;t[16]!==n.prompt||t[17]!==A||t[18]!==k?(j=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=xe(t,i===-1?r:i,r,`@${a}`);A(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]=A,t[18]=k,t[19]=j):j=t[19];let oe=u(j),se;t[20]!==n.prompt||t[21]!==A||t[22]!==k?(se=e=>{let t=n.prompt,r=S.current?.selectionStart??t.length,i=t.substring(0,r).lastIndexOf(`@`),a=xe(t,i===-1?r:i,r,`@${e}`);A(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]=A,t[22]=k,t[23]=se):se=t[23];let ce=u(se),le;t[24]!==A||t[25]!==k?(le=e=>{let t=`/${e.name} `;A(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]=A,t[25]=k,t[26]=le):le=t[26];let M=u(le),ue;t[27]!==n.prompt||t[28]!==A||t[29]!==k?(ue=(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;A(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]=A,t[29]=k,t[30]=ue):ue=t[30];let de=u(ue),N;t[31]!==m||t[32]!==c||t[33]!==v?(N=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]=N):N=t[34];let F=u(N),fe=r+1,pe;t[35]!==s||t[36]!==fe?(pe=s(`multirun.launcher.groups.groupLabel`,{index:fe}),t[35]=s,t[36]=fe,t[37]=pe):pe=t[37];let I;t[38]===pe?I=t[39]:(I=(0,$.jsx)(`span`,{className:`typography-meta font-medium text-foreground`,children:pe}),t[38]=pe,t[39]=I);let L;t[40]!==i||t[41]!==n.id||t[42]!==o||t[43]!==s?(L=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]=L):L=t[44];let R;t[45]!==I||t[46]!==L?(R=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[I,L]}),t[45]=I,t[46]=L,t[47]=R):R=t[47];let me;t[48]===s?me=t[49]:(me=s(`multirun.launcher.groups.prompt.label`),t[48]=s,t[49]=me);let he;t[50]===me?he=t[51]:(he=(0,$.jsx)(ct,{required:!0,children:me}),t[50]=me,t[51]=he);let ge=n.prompt,z;t[52]!==A||t[53]!==k?(z=e=>{let t=e.target.value;A(t);let n=e.target.selectionStart??t.length;k(t,n)},t[52]=A,t[53]=k,t[54]=z):z=t[54];let B;t[55]===s?B=t[56]:(B=s(`multirun.launcher.groups.prompt.placeholder`),t[55]=s,t[56]=B);let V;t[57]!==n.prompt||t[58]!==F||t[59]!==z||t[60]!==B?(V=(0,$.jsx)(P,{ref:S,value:ge,onChange:z,onKeyDown:F,placeholder:B,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]=z,t[60]=B,t[61]=V):V=t[61];let ye;t[62]!==g||t[63]!==M||t[64]!==m?(ye=m?(0,$.jsx)(_e,{ref:w,searchQuery:g,onCommandSelect:M,onClose:()=>h(!1),style:{left:0,top:`auto`,bottom:`calc(100% + 6px)`,marginBottom:0,maxWidth:`100%`}}):null,t[62]=g,t[63]=M,t[64]=m,t[65]=ye):ye=t[65];let H;t[66]!==ce||t[67]!==oe||t[68]!==d||t[69]!==c?(H=c?(0,$.jsx)(be,{ref:C,searchQuery:d,onFileSelect:oe,onAgentSelect:ce,onClose:()=>l(!1),style:{left:0,top:`auto`,bottom:`calc(100% + 6px)`,marginBottom:0,maxWidth:`100%`}}):null,t[66]=ce,t[67]=oe,t[68]=d,t[69]=c,t[70]=H):H=t[70];let U;t[71]!==de||t[72]!==v||t[73]!==b?(U=v?(0,$.jsx)(ve,{ref:T,searchQuery:b,onSnippetSelect:de,onClose:()=>y(!1),style:{left:0,top:`auto`,bottom:`calc(100% + 6px)`,marginBottom:0,maxWidth:`100%`}}):null,t[71]=de,t[72]=v,t[73]=b,t[74]=U):U=t[74];let W;t[75]!==V||t[76]!==ye||t[77]!==H||t[78]!==U?(W=(0,$.jsxs)(`div`,{className:`relative`,children:[V,ye,H,U]}),t[75]=V,t[76]=ye,t[77]=H,t[78]=U,t[79]=W):W=t[79];let G;t[80]!==he||t[81]!==W?(G=(0,$.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[he,W]}),t[80]=he,t[81]=W,t[82]=G):G=t[82];let K;t[83]===s?K=t[84]:(K=s(`multirun.launcher.models.info`,{max:ot}),t[83]=s,t[84]=K);let q;t[85]===K?q=t[86]:(q=(0,$.jsx)(st,{children:K}),t[85]=K,t[86]=q);let J;t[87]===s?J=t[88]:(J=s(`multirun.launcher.models.label`),t[87]=s,t[88]=J);let Se;t[89]!==q||t[90]!==J?(Se=(0,$.jsx)(ct,{required:!0,info:q,children:J}),t[89]=q,t[90]=J,t[91]=Se):Se=t[91];let Ce;t[92]!==n.models||t[93]!==D||t[94]!==te||t[95]!==re?(Ce=(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]=Ce):Ce=t[96];let X;t[97]!==Se||t[98]!==Ce?(X=(0,$.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[Se,Ce]}),t[97]=Se,t[98]=Ce,t[99]=X):X=t[99];let Z;return t[100]!==R||t[101]!==G||t[102]!==X?(Z=(0,$.jsxs)(`div`,{className:`rounded-lg border border-border p-3 space-y-3`,children:[R,G,X]}),t[100]=R,t[101]=G,t[102]=X,t[103]=Z):Z=t[103],Z};export{De as a,Ie as i,$e as n,Te as o,Re as r,ut as t};
|