@yuriai/web 0.2.38 → 0.2.39-beta.1
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-qwoC8op7.js +1 -0
- package/dist/assets/AssistantConversationSurface-BmOHENhF.css +1 -0
- package/dist/assets/AssistantConversationSurface-CyJGN78Z.js +3 -0
- package/dist/assets/{AssistantUnreadBadge-DDw7a4MF.js → AssistantUnreadBadge-Hnqqug3k.js} +1 -1
- package/dist/assets/AssistantView-CFadOGiW.js +1 -0
- package/dist/assets/{DiagramView-CrjS-7Qg.js → DiagramView-D1g_U1Ve.js} +1 -1
- package/dist/assets/{FadeInOnReveal-BWkJi5dK.js → FadeInOnReveal-DLWVDmNr.js} +1 -1
- package/dist/assets/{GuiPluginPage-Ct7QUMjH.js → GuiPluginPage-DGrpzWyU.js} +1 -1
- package/dist/assets/{GuiPluginSurface-C1a1HAzL.js → GuiPluginSurface-CU2-fLdm.js} +1 -1
- package/dist/assets/{GuiPluginWindow-CGnY_Jp_.js → GuiPluginWindow-Cear_hK6.js} +1 -1
- package/dist/assets/{Icon-Co7WGN1G.js → Icon-D6eeecf3.js} +1 -1
- package/dist/assets/{ImageLoadingPlaceholder-KEVw1Pg-.js → ImageLoadingPlaceholder-BJguSRQf.js} +1 -1
- package/dist/assets/{LoadingImage-PH45V6oj.js → LoadingImage-C0ebLsVf.js} +1 -1
- package/dist/assets/MarkdownRenderer-Bibq6sQR.js +2 -0
- package/dist/assets/{MarkdownRendererImpl-v1YoJHFp.js → MarkdownRendererImpl-CRMSm9zP.js} +1 -1
- package/dist/assets/{MarkstreamRendererImpl-UwcR7nzW.js → MarkstreamRendererImpl-Cz3f0w5O.js} +1 -1
- package/dist/assets/{MobileDetailNavigation-B8t6gz_S.js → MobileDetailNavigation-BfTbzw3E.js} +1 -1
- package/dist/assets/{MobileResizableSheet-Dd1w8a-6.js → MobileResizableSheet-CSHVXdcc.js} +1 -1
- package/dist/assets/{MobileShareBridge-DCE_Ahre.js → MobileShareBridge-CrnmSDpN.js} +1 -1
- package/dist/assets/{MobileTabPageHeader-BYRAlNQp.js → MobileTabPageHeader-CwAiYIiK.js} +1 -1
- package/dist/assets/{MultiRunWindow-CxjpWlHn.js → MultiRunWindow-A7FOh3y9.js} +1 -1
- package/dist/assets/{OnboardingScreen-4LgzNqG4.js → OnboardingScreen-C4aWPE5g.js} +1 -1
- package/dist/assets/{OverlayScrollbar-BQua3Ko6.js → OverlayScrollbar-BDmFJvuO.js} +1 -1
- package/dist/assets/{SettingsView-DxqpYiwv.js → SettingsView-YvxmCurl.js} +1 -1
- package/dist/assets/{SettingsWindow-DmhZHg_E.js → SettingsWindow-C6sp5FCT.js} +1 -1
- package/dist/assets/{SetupTourDialog-CzNscVSi.js → SetupTourDialog-DAbtAImS.js} +1 -1
- package/dist/assets/{TerminalView-BAqu9LRw.js → TerminalView-bFqYE6E8.js} +1 -1
- package/dist/assets/{ToolOutputDialog-C5b57FEy.js → ToolOutputDialog-BfKFoRx6.js} +1 -1
- package/dist/assets/{VoiceSettings-D4aaoz88.js → VoiceSettings-BFJoynNT.js} +1 -1
- package/dist/assets/{appThemeRegistry-DDaIHQum.js → appThemeRegistry-DzF1KyRO.js} +1 -1
- package/dist/assets/{capgoAdapter-CXcqPnFa.js → capgoAdapter-DomoN2dQ.js} +1 -1
- package/dist/assets/{checkbox-o8x1LJC4.js → checkbox-ClSxDwlM.js} +1 -1
- package/dist/assets/{collapsible-ZLW5y35Q.js → collapsible-Dhf2eN1l.js} +1 -1
- package/dist/assets/{context-menu-Bv2RsqQe.js → context-menu-DQz7Hocu.js} +1 -1
- package/dist/assets/{diagram-hqhzT9yo.js → diagram-BaIvxWpH.js} +1 -1
- package/dist/assets/{dialog-C7D331XW.js → dialog-B1Rrafoy.js} +1 -1
- package/dist/assets/{fileMentionTouchSelection-C3_guqVF.js → fileMentionTouchSelection-CUUCXrKA.js} +1 -1
- package/dist/assets/{gitApi-BOyQ2o3N.js → gitApi-L3nS1oNJ.js} +1 -1
- package/dist/assets/{input-os0CMgxY.js → input-el2PLKbt.js} +1 -1
- package/dist/assets/{insertionBoundaries-CGcJ-kUX.js → insertionBoundaries-DyPQrOsg.js} +1 -1
- package/dist/assets/{main-DmQr5rK8.js → main-5mNQIc25.js} +5 -5
- package/dist/assets/{main-x_36xEI7.js → main-BPnfMzuY.js} +2 -2
- package/dist/assets/{markdownHeightCache-BWCMEzOk.js → markdownHeightCache-DUGTouXi.js} +1 -1
- package/dist/assets/{mcpQueries-C3EdKlJU.js → mcpQueries-B2gQBmMk.js} +1 -1
- package/dist/assets/{miniChat-Dz4oT5h0.js → miniChat-DkaYsaSY.js} +2 -2
- package/dist/assets/{mobile-C2wjDVrA.js → mobile-B-ZWpOj6.js} +2 -2
- package/dist/assets/{mobile-html-network-DuXwrtnU.js → mobile-html-network-dTGXQKw0.js} +2 -2
- package/dist/assets/{mobileBackNavigation-C456iV52.js → mobileBackNavigation-CXTWT9pL.js} +1 -1
- package/dist/assets/{mobileConnections-DrUWc7kd.js → mobileConnections-NoXReTUi.js} +2 -2
- package/dist/assets/{multirun-CdraBH9O.js → multirun-DizITQa8.js} +1 -1
- package/dist/assets/{native-config-3LSj_OuN.js → native-config--mmoJe_H.js} +1 -1
- package/dist/assets/{projectMeta-CyhJE6CA.js → projectMeta-BzvXAJMC.js} +1 -1
- package/dist/assets/{pwa-BzFEQ5Js.js → pwa-BZGtwuiQ.js} +1 -1
- package/dist/assets/{queue-abort-optimistic-CMMw3KSM.js → queue-abort-optimistic-BZ-uX9Xl.js} +1 -1
- package/dist/assets/{react-BJAlol6I.js → react-CnKEwma7.js} +1 -1
- package/dist/assets/{readiness-DmMVD6xM.js → readiness-NhPYDe48.js} +1 -1
- package/dist/assets/renderElectronMiniChatApp-CGDnFkRT.js +2 -0
- package/dist/assets/renderMobileApp-DgTlrPpr.js +29 -0
- package/dist/assets/{runtimeConfig-CAAd0cno.js → runtimeConfig-CBsnA3T3.js} +1 -1
- package/dist/assets/{runtimeEndpointReset-DKk9B2jX.js → runtimeEndpointReset-Co74Bqfs.js} +3 -3
- package/dist/assets/{select-ClX56nrO.js → select-Bn8U3CWh.js} +1 -1
- package/dist/assets/sessionLookup-14_73BfN.js +1 -0
- package/dist/assets/{sortable-tabs-strip-BQbGMaz-.js → sortable-tabs-strip-DdP1ALtI.js} +1 -1
- package/dist/assets/{speechSettingsQueries-85xpCH5y.js → speechSettingsQueries-D4ZaI_pC.js} +1 -1
- package/dist/assets/src-D-W1MV14.css +2 -0
- package/dist/assets/telegram-pattern-Y95HsYL8.svg +4649 -0
- package/dist/assets/{textarea-DpsaIedI.js → textarea-CI1VKA2e.js} +1 -1
- package/dist/assets/{tooltip-pELJ38kd.js → tooltip-Bjzgrs1l.js} +1 -1
- package/dist/assets/types-ChrzXO9y.js +2 -0
- package/dist/assets/{useAppFontEffects-CMJ-srCU.js → useAppFontEffects-DtgrP7dP.js} +13 -13
- package/dist/assets/{useDesktopWindowControlsLayout-DBBGRsuU.js → useDesktopWindowControlsLayout-H91TGqj1.js} +1 -1
- package/dist/assets/{useEffectiveDirectory--tyiZ84r.js → useEffectiveDirectory-C_NYC9Sb.js} +1 -1
- package/dist/assets/{useMobileNavigationStore-Dr61mYqA.js → useMobileNavigationStore-BoZDstLm.js} +4 -4
- package/dist/assets/{usePluginsStore-P6_c6c0m.js → usePluginsStore-B3hliD_2.js} +1 -1
- package/dist/assets/{useStreamingTextThrottle-D3YtOLbE.js → useStreamingTextThrottle-BA4aJ24a.js} +1 -1
- package/dist/assets/{useWorkerHighlightedLines-CO7SlSqM.js → useWorkerHighlightedLines-CEl8asH9.js} +1 -1
- package/dist/index.html +6 -6
- package/dist/mini-chat.html +6 -6
- package/dist/mobile.html +2 -2
- package/package.json +1 -1
- package/dist/assets/AgentAvatar-B2GEBJBG.js +0 -1
- package/dist/assets/AssistantContactStatus-CGFpgAuL.js +0 -3
- package/dist/assets/AssistantView-DpYyl49H.js +0 -1
- package/dist/assets/MarkdownRenderer-CZpY_qyH.js +0 -2
- package/dist/assets/renderElectronMiniChatApp-CVNOL7vy.js +0 -2
- package/dist/assets/renderMobileApp-rVz5UaT-.js +0 -29
- package/dist/assets/sessionLookup-DC2xZn-T.js +0 -1
- package/dist/assets/src-ByI2s7WK.css +0 -2
- package/dist/assets/types-D-KYekEQ.js +0 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{J as t,Y as n,ot as r,st as i}from"./vendor-base-ui-CzHs0bHY.js";import{n as a}from"./vendor-react-DlzBev0S.js";import{Jn as o}from"./useMobileNavigationStore-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{J as t,Y as n,ot as r,st as i}from"./vendor-base-ui-CzHs0bHY.js";import{n as a}from"./vendor-react-DlzBev0S.js";import{Jn as o}from"./useMobileNavigationStore-BoZDstLm.js";import{n as s}from"./Icon-D6eeecf3.js";var c=a(),l=e(i(),1),u=r(),d=l.memo(function(e){let r=(0,c.c)(20),{checked:i,onChange:a,disabled:l,indeterminate:d,ariaLabel:f,className:p,iconClassName:m}=e,h=l!==void 0&&l,g=i||d,_;r[0]===a?_=r[1]:(_=e=>a(!!e),r[0]=a,r[1]=_);let v=g?`border-[color:color-mix(in_srgb,var(--primary-base)_65%,var(--interactive-border))] bg-transparent shadow-none hover:bg-[var(--interactive-hover)] hover:border-[color:color-mix(in_srgb,var(--primary-base)_75%,var(--interactive-border))]`:`border-[var(--interactive-border)] bg-transparent shadow-none hover:bg-[var(--interactive-hover)] hover:border-[var(--interactive-border)]`,y;r[2]!==p||r[3]!==v?(y=o(`group/checkbox relative flex shrink-0 self-center items-center justify-center rounded-[4px] border outline-none`,`h-[14px] w-[14px] min-h-[14px] min-w-[14px]`,`transition-[background-color,border-color,box-shadow] duration-200 ease-out`,v,`focus-visible:ring-2 focus-visible:ring-[var(--interactive-focus-ring)] focus-visible:ring-offset-1 focus-visible:ring-offset-transparent`,`disabled:cursor-not-allowed disabled:opacity-50`,p),r[2]=p,r[3]=v,r[4]=y):y=r[4];let b;r[5]===m?b=r[6]:(b=o(`flex items-center justify-center text-[var(--primary-base)]`,`data-[unchecked]:hidden`,m),r[5]=m,r[6]=b);let x;r[7]===d?x=r[8]:(x=d?(0,u.jsx)(s,{name:`subtract`,className:o(`h-[10px] w-[10px] min-h-[10px] min-w-[10px]`,`text-[var(--primary-base)]`)}):(0,u.jsx)(s,{name:`check`,className:o(`h-[10px] w-[10px] min-h-[10px] min-w-[10px]`,`text-[var(--primary-base)]`)}),r[7]=d,r[8]=x);let S;r[9]!==b||r[10]!==x?(S=(0,u.jsx)(t,{keepMounted:!0,className:b,children:x}),r[9]=b,r[10]=x,r[11]=S):S=r[11];let C;return r[12]!==f||r[13]!==i||r[14]!==h||r[15]!==d||r[16]!==_||r[17]!==y||r[18]!==S?(C=(0,u.jsx)(n,{checked:i,onCheckedChange:_,disabled:h,indeterminate:d,"aria-label":f,className:y,children:S}),r[12]=f,r[13]=i,r[14]=h,r[15]=d,r[16]=_,r[17]=y,r[18]=S,r[19]=C):C=r[19],C});export{d as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{n as t,ot as n,r,st as i,t as a}from"./vendor-base-ui-CzHs0bHY.js";import{n as o}from"./vendor-react-DlzBev0S.js";import{Jn as s}from"./useMobileNavigationStore-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{n as t,ot as n,r,st as i,t as a}from"./vendor-base-ui-CzHs0bHY.js";import{n as o}from"./vendor-react-DlzBev0S.js";import{Jn as s}from"./useMobileNavigationStore-BoZDstLm.js";var c=o(),l=e(i(),1),u=n(),d=r,f=e=>{let n=(0,c.c)(14),r,i,a,o;n[0]===e?(r=n[1],i=n[2],a=n[3],o=n[4]):({className:a,asChild:r,children:i,...o}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a,n[4]=o);let d;n[5]!==r||n[6]!==i?(d=r&&l.isValidElement(i)?{render:i}:{children:i},n[5]=r,n[6]=i,n[7]=d):d=n[7];let f=d,p;n[8]===a?p=n[9]:(p=s(`flex w-full items-center justify-between rounded-lg px-2 py-1.5 text-left text-foreground hover:bg-interactive-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary`,a),n[8]=a,n[9]=p);let m;return n[10]!==o||n[11]!==f||n[12]!==p?(m=(0,u.jsx)(t,{className:p,...o,...f}),n[10]=o,n[11]=f,n[12]=p,n[13]=m):m=n[13],m},p=e=>{let t=(0,c.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=s(`overflow-hidden data-[closed]:animate-collapsible-up data-[open]:animate-collapsible-down`,n),t[3]=n,t[4]=i);let o;return t[5]!==r||t[6]!==i?(o=(0,u.jsx)(a,{className:i,...r}),t[5]=r,t[6]=i,t[7]=o):o=t[7],o};export{p as n,f as r,d as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./rolldown-runtime-hePW80VL.js";import{A as e,B as t,L as n,R as r,a as i,i as a,ot as o,st as s,z as c}from"./vendor-base-ui-CzHs0bHY.js";import{n as l}from"./vendor-react-DlzBev0S.js";import{Jn as u}from"./useMobileNavigationStore-
|
|
1
|
+
import"./rolldown-runtime-hePW80VL.js";import{A as e,B as t,L as n,R as r,a as i,i as a,ot as o,st as s,z as c}from"./vendor-base-ui-CzHs0bHY.js";import{n as l}from"./vendor-react-DlzBev0S.js";import{Jn as u}from"./useMobileNavigationStore-BoZDstLm.js";import{n as d,r as f,t as p}from"./dropdown-menu.styles-BDla58Rm.js";var m=l();s();var h=o();function g(e){let t=(0,m.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,h.jsx)(i,{...n}),t[2]=n,t[3]=r),r}function _(e){let t=(0,m.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,h.jsx)(a,{...n}),t[2]=n,t[3]=r),r}function v(e){let t=(0,m.c)(20),i,a,o,s,l;t[0]===e?(i=t[1],a=t[2],o=t[3],s=t[4],l=t[5]):({className:a,positionerClassName:o,children:i,style:l,...s}=e,t[0]=e,t[1]=i,t[2]=a,t[3]=o,t[4]=s,t[5]=l);let f;t[6]===o?f=t[7]:(f=u(`app-region-no-drag z-50`,o),t[6]=o,t[7]=f);let p;t[8]===l?p=t[9]:(p={color:`var(--surface-elevated-foreground)`,...l},t[8]=l,t[9]=p);let g;t[10]===a?g=t[11]:(g=u(d,a),t[10]=a,t[11]=g);let _;t[12]!==i||t[13]!==s||t[14]!==p||t[15]!==g?(_=(0,h.jsx)(c,{"data-slot":`dropdown-menu-content`,style:p,className:g,...s,children:i}),t[12]=i,t[13]=s,t[14]=p,t[15]=g,t[16]=_):_=t[16];let v;return t[17]!==f||t[18]!==_?(v=(0,h.jsx)(r,{children:(0,h.jsx)(n,{className:f,children:_})}),t[17]=f,t[18]=_,t[19]=v):v=t[19],v}function y(e){let n=(0,m.c)(8),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=u(p,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==a?(o=(0,h.jsx)(t,{className:a,...i}),n[5]=i,n[6]=a,n[7]=o):o=n[7],o}function b(t){let n=(0,m.c)(8),r,i;n[0]===t?(r=n[1],i=n[2]):({className:r,...i}=t,n[0]=t,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=u(f,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==a?(o=(0,h.jsx)(e,{className:a,...i}),n[5]=i,n[6]=a,n[7]=o):o=n[7],o}export{_ as a,b as i,v as n,y as r,g as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{ot as t,st as n}from"./vendor-base-ui-CzHs0bHY.js";import{Jn as r}from"./useMobileNavigationStore-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{ot as t,st as n}from"./vendor-base-ui-CzHs0bHY.js";import{Jn as r}from"./useMobileNavigationStore-BoZDstLm.js";import{t as i}from"./vendor-react-drawio-Dyg1-39Q.js";var a=e(n(),1),o=t(),s=`<mxfile><diagram id="new" name="Page-1"><mxGraphModel dx="0" dy="0" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0"><root><mxCell id="0"/><mxCell id="1" parent="0"/></root></mxGraphModel></diagram></mxfile>`;function c(){if(typeof document>`u`)return!1;let e=document.documentElement.getAttribute(`data-theme`);return e===`dark`||!e&&window.matchMedia(`(prefers-color-scheme: dark)`).matches}var l=a.forwardRef(function({xml:e,readOnly:t,className:n,onChange:l},u){let d=a.useRef(e),f=a.useRef(null),p=a.useRef(!1),[m,h]=a.useState(c),g=a.useRef(e),_=a.useRef(e);_.current!==e&&(_.current=e,g.current=e,d.current=e);let v=a.useRef(m);v.current!==m&&(v.current=m,g.current=d.current);let y=a.useRef(null);a.useEffect(()=>{let e=()=>h(c());e();let t=new MutationObserver(e);return t.observe(document.documentElement,{attributes:!0,attributeFilter:[`data-theme`]}),()=>t.disconnect()},[]),a.useEffect(()=>{let e=setTimeout(()=>{y.current?.querySelector(`.diagrams-iframe`)?.focus()},600);return()=>clearTimeout(e)},[]),a.useImperativeHandle(u,()=>({getXml:()=>d.current}));let b=a.useCallback(()=>{!e&&!p.current&&(p.current=!0,setTimeout(()=>{f.current?.template({})},500))},[e]),x=a.useCallback(e=>{d.current=e.xml,l?.(e.xml)},[l]);return(0,o.jsx)(`div`,{ref:y,className:r(`h-full w-full`,n),children:(0,o.jsx)(i,{ref:f,xml:g.current||s,autosave:!0,urlParameters:{ui:t?`simple`:m?`dark`:`kennedy`,spin:!0,libraries:!t,chrome:t,nav:t,layers:t,noSaveBtn:!0,noExitBtn:!0,saveAndExit:!1},onLoad:b,onAutoSave:x},m?`dark`:`light`)})});export{l as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{$ as t,Q as n,X as r,Z as i,et as a,nt as o,ot as s,rt as c,st as l,tt as u}from"./vendor-base-ui-CzHs0bHY.js";import{n as d}from"./vendor-react-DlzBev0S.js";import{t as f}from"./i18n-BU14awhU.js";import{Jn as p}from"./useMobileNavigationStore-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{$ as t,Q as n,X as r,Z as i,et as a,nt as o,ot as s,rt as c,st as l,tt as u}from"./vendor-base-ui-CzHs0bHY.js";import{n as d}from"./vendor-react-DlzBev0S.js";import{t as f}from"./i18n-BU14awhU.js";import{Jn as p}from"./useMobileNavigationStore-BoZDstLm.js";import{n as m}from"./Icon-D6eeecf3.js";var h=e(l(),1),g=d(),_=s(),v=0;function y(e,t){return e&&h.isValidElement(t)?{render:t}:{children:t}}function b(e){let t=(0,g.c)(4),r;t[0]===e?r=t[1]:({...r}=e,t[0]=e,t[1]=r);let i;return t[2]===r?i=t[3]:(i=(0,_.jsx)(n,{...r}),t[2]=r,t[3]=i),i}function x(e){let t=(0,g.c)(10),n,i,a;t[0]===e?(n=t[1],i=t[2],a=t[3]):({asChild:n,children:i,...a}=e,t[0]=e,t[1]=n,t[2]=i,t[3]=a);let o;t[4]!==n||t[5]!==i?(o=y(n,i),t[4]=n,t[5]=i,t[6]=o):o=t[6];let s=o,c;return t[7]!==a||t[8]!==s?(c=(0,_.jsx)(r,{"data-slot":`dialog-trigger`,...a,...s}),t[7]=a,t[8]=s,t[9]=c):c=t[9],c}function S(e){let n=(0,g.c)(4),r;n[0]===e?r=n[1]:({...r}=e,n[0]=e,n[1]=r);let i;return n[2]===r?i=n[3]:(i=(0,_.jsx)(t,{...r}),n[2]=r,n[3]=i),i}var C=h.forwardRef((e,t)=>{let n=(0,g.c)(10),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===Symbol.for(`react.memo_cache_sentinel`)?(a=[],n[3]=a):a=n[3],h.useEffect(A,a);let o=t,s;n[4]===r?s=n[5]:(s=p(`app-region-no-drag fixed inset-0 z-50 bg-black/50 dark:bg-black/75`,`transition-opacity duration-150 ease-out`,`data-[starting-style]:opacity-0 data-[ending-style]:opacity-0`,r),n[4]=r,n[5]=s);let l;return n[6]!==i||n[7]!==o||n[8]!==s?(l=(0,_.jsx)(c,{ref:o,"data-slot":`dialog-overlay`,className:s,...i}),n[6]=i,n[7]=o,n[8]=s,n[9]=l):l=n[9],l});C.displayName=`DialogOverlay`;function w(e){let t=(0,g.c)(33),n,r,i,s,c,l,u;t[0]===e?(n=t[1],r=t[2],i=t[3],s=t[4],c=t[5],l=t[6],u=t[7]):({className:r,overlayClassName:s,containerClassName:i,children:n,showCloseButton:l,presentation:u,...c}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=s,t[5]=c,t[6]=l,t[7]=u);let d=u===void 0?`default`:u,{t:h}=f(),v=l??d!==`picker`,y=d===`picker`&&`bg-transparent dark:bg-transparent`,b;t[8]!==s||t[9]!==y?(b=p(`rounded-none`,y,s),t[8]=s,t[9]=y,t[10]=b):b=t[10];let x;t[11]===b?x=t[12]:(x=(0,_.jsx)(C,{className:b}),t[11]=b,t[12]=x);let w=i??(d===`picker`?`block p-0`:`items-center p-4`),T;t[13]===w?T=t[14]:(T=p(`fixed inset-0 z-50 flex justify-center pointer-events-none`,w),t[13]=w,t[14]=T);let E=d===`picker`&&`yuri-picker-dialog yuri-mobile-overlay-surface yuri-mobile-overlay-surface--translucent yuri-composer-autocomplete-surface fixed left-1/2 top-[10vh] w-[min(42rem,calc(100vw-3rem))] max-w-none -translate-x-1/2 translate-y-0 gap-0 overflow-hidden rounded-3xl border-0 p-0`,D;t[15]!==r||t[16]!==E?(D=p(`app-region-no-drag relative pointer-events-auto bg-background text-foreground flex flex-col w-full max-w-lg max-h-full gap-4 rounded-xl border p-6 shadow-none overflow-y-auto pwa-dialog-content origin-center`,`transition-all duration-150 ease-out`,`data-[starting-style]:opacity-0 data-[starting-style]:scale-[0.98]`,`data-[ending-style]:opacity-0 data-[ending-style]:scale-[0.98]`,`data-[nested-dialog-open]:brightness-[0.55] dark:data-[nested-dialog-open]:brightness-[0.4]`,E,r),t[15]=r,t[16]=E,t[17]=D):D=t[17];let O;t[18]!==v||t[19]!==h?(O=v&&(0,_.jsxs)(o,{"data-slot":`dialog-close`,className:`ring-offset-background focus:ring-ring data-[open]:bg-interactive-active data-[open]:text-foreground absolute top-2 right-2 rounded-lg opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none text-muted-foreground hover:text-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,children:[(0,_.jsx)(m,{name:`close`}),(0,_.jsx)(`span`,{className:`sr-only`,children:h(`dialog.common.actions.close`)})]}),t[18]=v,t[19]=h,t[20]=O):O=t[20];let k;t[21]!==n||t[22]!==d||t[23]!==c||t[24]!==D||t[25]!==O?(k=(0,_.jsxs)(a,{"data-slot":`dialog-content`,"data-state-slot":`dialog`,"data-presentation":d,className:D,...c,children:[n,O]}),t[21]=n,t[22]=d,t[23]=c,t[24]=D,t[25]=O,t[26]=k):k=t[26];let A;t[27]!==k||t[28]!==T?(A=(0,_.jsx)(`div`,{className:T,children:k}),t[27]=k,t[28]=T,t[29]=A):A=t[29];let j;return t[30]!==A||t[31]!==x?(j=(0,_.jsxs)(S,{children:[x,A]}),t[30]=A,t[31]=x,t[32]=j):j=t[32],j}function T(e){let t=(0,g.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=p(`flex flex-col gap-2 text-center sm:text-left`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,_.jsx)(`div`,{"data-slot":`dialog-header`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function E(e){let t=(0,g.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=p(`flex flex-col-reverse gap-2 bottom-safe-area sm:flex-row sm:justify-end`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,_.jsx)(`div`,{"data-slot":`dialog-footer`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function D(e){let t=(0,g.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let a;t[3]===n?a=t[4]:(a=p(`typography-markdown leading-none font-semibold text-foreground`,n),t[3]=n,t[4]=a);let o;return t[5]!==r||t[6]!==a?(o=(0,_.jsx)(i,{"data-slot":`dialog-title`,className:a,...r}),t[5]=r,t[6]=a,t[7]=o):o=t[7],o}function O(e){let t=(0,g.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=p(`text-muted-foreground typography-ui-label`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,_.jsx)(u,{"data-slot":`dialog-description`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function k(){v=Math.max(0,v-1),v===0&&document.documentElement.classList.remove(`yuri-dialog-open`)}function A(){return v+=1,document.documentElement.classList.add(`yuri-dialog-open`),k}export{T as a,E as i,w as n,D as o,O as r,x as s,b as t};
|
package/dist/assets/{fileMentionTouchSelection-C3_guqVF.js → fileMentionTouchSelection-CUUCXrKA.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{at as t,ot as n,st as r}from"./vendor-base-ui-CzHs0bHY.js";import{Pr as i}from"./gitApiHttp-B1mApXwC.js";import{n as a}from"./vendor-react-DlzBev0S.js";import{Jn as o}from"./useMobileNavigationStore-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{at as t,ot as n,st as r}from"./vendor-base-ui-CzHs0bHY.js";import{Pr as i}from"./gitApiHttp-B1mApXwC.js";import{n as a}from"./vendor-react-DlzBev0S.js";import{Jn as o}from"./useMobileNavigationStore-BoZDstLm.js";import{h as s,i as c,m as l}from"./fileMentionAutocompleteState-BZJqfgae.js";import{r as u,t as d}from"./Icon-D6eeecf3.js";import{t as f}from"./vendor-fuzzysort-ukaRp9PC.js";var p=e=>{switch(e.name){case`new`:return`add`;case`init`:return`file`;case`undo`:return`arrow-go-back`;case`redo`:return`arrow-go-forward`;case`timeline`:return`time`;case`compact`:return`scissors`;case`reload`:return`refresh`;case`goal`:return`target`;case`review`:return`search-eye`;case`test`:case`build`:case`run`:return`terminal-box`;default:return e.isBuiltIn?`flashlight`:`command`}},m=()=>`book-open`,h=e=>{if(e.isDirectory)return`folder-3-fill`;switch(e.extension?.toLowerCase()){case`ts`:case`tsx`:case`js`:case`jsx`:case`json`:return`code`;case`md`:case`mdx`:return`file`;case`png`:case`jpg`:case`jpeg`:case`gif`:case`svg`:return`file-image`;default:return`file-pdf`}},g=()=>`ai-agent`,_=()=>`chat-thread`,v=32,y=(e,t)=>{let n=u[e];return typeof n!=`string`||n.length===0?null:`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="${t}" stroke-width="${d}" stroke-linecap="round" stroke-linejoin="round">${n}</svg>`},b=(e,t)=>{let n=y(e,t);return!n||typeof document>`u`?Promise.resolve(null):new Promise(e=>{let t=new Image;t.decoding=`async`,t.onload=()=>{try{let n=document.createElement(`canvas`);n.width=v,n.height=v;let r=n.getContext(`2d`);if(!r){e(null);return}r.clearRect(0,0,v,v),r.drawImage(t,0,0,v,v);let i=n.toDataURL(`image/png`),a=i.indexOf(`,`);e(a>=0?i.slice(a+1):null)}catch{e(null)}},t.onerror=()=>e(null),t.src=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(n)}`})},x=e(f(),1),S=(e,t)=>e.map(e=>{let n=e.isSkill?t.skill:e.isYuri?`Yuri`:e.isBuiltIn?t.system:e.scope||e.agent||t.command;return{id:e.id,title:`/${e.name}`,subtitle:e.description,badge:n,iconName:p(e)}}),C=({skills:e=[],agents:t,sessions:n,recentFiles:r,pathHits:i,untitledSession:a,sessionBadge:o,skillBadge:c,searchQuery:u=``})=>{let d=[];for(let t of e)d.push({id:`skill:${t.name}-${t.scope}`,title:`@${t.name}`,subtitle:t.description,badge:c??t.scope,iconName:m()});for(let e of t)d.push({id:`agent:${e.name}`,title:`@${e.name}`,subtitle:e.description,iconName:g(),agentName:e.name});for(let e of n)d.push({id:`session:${e.id}`,title:e.title||a,trailingLabel:e.directory?.split(/[\\/]/).filter(Boolean).pop(),badge:o,iconName:_()});let f=u.trim(),p=new Map(d.map((e,t)=>[e.id,t])),v=(e,t)=>x.default.go(f,e,{keys:[`title`,e=>e.id.startsWith(`skill:`)?e.subtitle??``:``,e=>e.id.startsWith(`session:`)?e.id.slice(8):``],threshold:.5,limit:t,scoreFn:e=>{let t=e[0];return Math.max(l(f,e.obj.title,t?.score??0),e[1]?.score??0,e.obj.id.startsWith(`session:`)?s(f,e.obj.id.slice(8)):0)}}),y=f?[...v(d.filter(e=>!e.id.startsWith(`session:`)),10),...v(d.filter(e=>e.id.startsWith(`session:`)),1/0)].sort((e,t)=>t.score-e.score||(p.get(e.obj.id)??0)-(p.get(t.obj.id)??0)).map(e=>e.obj):d.slice();d.length=0;for(let e of r)d.push({id:`recent:${e.path}`,title:e.relativePath||e.name,iconName:h(e)});for(let e of i)d.push({id:`file:${e.path}`,title:e.relativePath||e.name,iconName:h(e)});if(!f)return[...y.filter(e=>!e.id.startsWith(`session:`)),...d,...y.filter(e=>e.id.startsWith(`session:`))];let b=0;return[...y,...d].filter(e=>e.id.startsWith(`session:`)||b++<10)},w=(e,t)=>{if(!e.includes(`/`)||t.size===0)return[];let n=RegExp(`(^|\\s)/(${i})?([A-Za-z0-9][A-Za-z0-9_-]*)(?=$|\\s)`,`g`),r=[],a;for(;(a=n.exec(e))!==null;){let e=a[3]??``;if(!t.has(e.toLowerCase()))continue;let n=a[2]??``,i=a.index+(a[1]?.length??0);r.push({start:i,end:i+1+n.length+e.length,name:e,hasSlot:n.length>0})}return r},T=(e,t,n=e.length)=>{let r=w(e,t).filter(e=>!e.hasSlot);if(r.length===0)return null;let a=e,o=n;for(let e=r.length-1;e>=0;--e){let t=r[e].start+1;a=`${a.slice(0,t)}${i}${a.slice(t)}`,o>t&&(o+=i.length)}return a===e?null:{text:a,caret:o}},E=e=>e.startsWith(i)?e.slice(i.length):e,D=e=>{if(e.inputMode===`shell`)return null;let t=e.text,n=Math.max(0,Math.min(e.cursor,t.length));if(t.startsWith(`/`)){let e=t.indexOf(` `),r=t.indexOf(`
|
|
2
2
|
`),i=Math.min(e===-1?t.length:e,r===-1?t.length:r);if(n<=i&&e===-1)return{kind:`slash-command`,query:E(t.substring(1,i)),tokenStart:0,tokenEnd:i}}let r=t.substring(0,n),i=c({value:t,cursorPosition:n,inputSource:e.mentionInputSource??`manual`,insertedText:e.insertedText});return i===null?null:{kind:`mention`,query:i,tokenStart:r.lastIndexOf(`@`),tokenEnd:n}},O=e=>e===`mention`?`@`:`/`,k=(e,t,n)=>{if(n&&n.tokenStart>=0&&n.tokenEnd>=n.tokenStart&&n.tokenEnd<=e.length&&e.startsWith(O(n.kind),n.tokenStart))return{start:n.tokenStart,end:n.tokenEnd};let r=D({text:e,cursor:t});return r?{start:r.tokenStart,end:r.tokenEnd}:null},A=e(r(),1),j=a(),M=e(t(),1),N=`absolute z-[100] min-w-0 w-full bottom-full mb-2 left-0 flex flex-col rounded-xl`,P=`pointer-events-auto absolute z-[100] min-w-0 flex flex-col rounded-xl`;function F(e,t){return o(e?P:N,`yuri-mobile-overlay-surface yuri-mobile-overlay-surface--translucent yuri-composer-autocomplete-surface`,t)}function I(e,t){return e?`yuri-composer-autocomplete-row`:o(`mx-1.5 hover:bg-[color-mix(in_srgb,var(--interactive-selection)_40%,transparent)]`,t&&`bg-[color-mix(in_srgb,var(--interactive-selection)_40%,transparent)]`)}var L=.4,R=e=>{let t=e.gap??8,n=Math.min(e.composerTop-t,e.visibleBottom-t);return{left:e.composerLeft,width:e.composerWidth,bottom:Math.max(0,e.fixedContainingBottom-n),maxHeight:z({popupBottom:n,boundaryTop:e.boundaryTop,viewportHeight:e.viewportHeight,gap:t})}},z=e=>{let t=e.gap??8,n=Math.max(0,e.popupBottom-e.boundaryTop-t),r=e.viewportHeight*L,i=Math.floor(Math.min(n,r));return n>=120?Math.min(n,Math.max(120,i)):i},B=(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 > .yuri-mobile-detail-navigation`)?.getBoundingClientRect().bottom,i=n.getBoundingClientRect().top;return Math.max(r===void 0?i:Math.max(r,i),t)},V=(e,t)=>{let n=(0,j.c)(5),[r,i]=A.useState(void 0),a;n[0]!==t||n[1]!==e?(a=()=>{if(!t){i(void 0);return}let n=0,r=0,a=()=>{let t=e.current?.parentElement;if(!t)return;let n=t.getBoundingClientRect(),r=window.visualViewport,a=r?.offsetTop??0,o=r?.height??window.innerHeight,s=window.innerHeight,c=a+o,l=B(t,a)??a,u=R({composerTop:n.top,composerLeft:n.left,composerWidth:n.width,fixedContainingBottom:s,visibleBottom:c,boundaryTop:l,viewportHeight:o});i(e=>e&&e.left===u.left&&e.width===u.width&&e.bottom===u.bottom&&e.maxHeight===u.maxHeight?e:u)},o=()=>{a(),n&&window.cancelAnimationFrame(n),r&&window.clearTimeout(r),n=window.requestAnimationFrame(()=>{a(),r=window.setTimeout(a,220)})};return a(),window.addEventListener(`resize`,a),window.addEventListener(`yuri:keyboard-settled`,o),window.addEventListener(`yuri:keyboard-anim`,o),window.visualViewport?.addEventListener(`resize`,a),window.visualViewport?.addEventListener(`scroll`,a),()=>{n&&window.cancelAnimationFrame(n),r&&window.clearTimeout(r),window.removeEventListener(`resize`,a),window.removeEventListener(`yuri:keyboard-settled`,o),window.removeEventListener(`yuri:keyboard-anim`,o),window.visualViewport?.removeEventListener(`resize`,a),window.visualViewport?.removeEventListener(`scroll`,a)}},n[0]=t,n[1]=e,n[2]=a):a=n[2];let o;return n[3]===t?o=n[4]:(o=[t],n[3]=t,n[4]=o),A.useLayoutEffect(a,o),t?r:void 0},H=n(),U=A.forwardRef((e,t)=>{let n=(0,j.c)(24),{isMobile:r,className:i,style:a,children:o}=e,s=A.useRef(null),c=V(s,r),l=typeof document<`u`?document.body:null;if(!r){let e;n[0]===i?e=n[1]:(e=F(!1,i),n[0]=i,n[1]=e);let r;return n[2]!==o||n[3]!==t||n[4]!==a||n[5]!==e?(r=(0,H.jsx)(`div`,{ref:t,className:e,style:a,children:o}),n[2]=o,n[3]=t,n[4]=a,n[5]=e,n[6]=r):r=n[6],r}let u;n[7]===i?u=n[8]:(u=F(!0,i),n[7]=i,n[8]=u);let d;n[9]===c?d=n[10]:(d=c?{left:c.left,width:c.width,bottom:c.bottom,maxHeight:c.maxHeight,overflow:`hidden`}:{visibility:`hidden`},n[9]=c,n[10]=d);let f;n[11]!==a||n[12]!==d?(f={...a,...d},n[11]=a,n[12]=d,n[13]=f):f=n[13];let p;n[14]!==o||n[15]!==t||n[16]!==u||n[17]!==f?(p=(0,H.jsx)(`div`,{className:`pointer-events-none fixed inset-0 z-[100]`,children:(0,H.jsx)(`div`,{ref:t,className:u,style:f,children:o})}),n[14]=o,n[15]=t,n[16]=u,n[17]=f,n[18]=p):p=n[18];let m=p,h;n[19]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,H.jsx)(`span`,{ref:s,className:`hidden`,"aria-hidden":!0}),n[19]=h):h=n[19];let g;n[20]===m?g=n[21]:(g=l?(0,M.createPortal)(m,l):m,n[20]=m,n[21]=g);let _;return n[22]===g?_=n[23]:(_=(0,H.jsxs)(H.Fragment,{children:[h,g]}),n[22]=g,n[23]=_),_});U.displayName=`ComposerAutocompleteLayer`;var W=()=>{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)}};export{D as a,C as c,p as d,k as i,S as l,U as n,T as o,I as r,E as s,W as t,b as u};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,n}from"./runtime-switch-BMjl5Y5W.js";import{n as r}from"./runtime-fetch-DKZOpfzo.js";import{t as i}from"./runtimeAPIRegistry-C2VogTny.js";import{$ as a,A as o,D as s,F as c,G as l,H as u,I as d,J as f,K as p,M as ee,P as te,S as ne,T as re,U as ie,X as ae,Y as oe,_ as se,a as ce,b as le,c as ue,d as de,et as fe,f as pe,ft as me,gt as he,h as ge,ht as _e,k as ve,kn as ye,m as be,nt as xe,ot as Se,pt as Ce,q as we,r as Te,s as Ee,st as De,tt as Oe,ut as ke,v as Ae,vt as je,x as Me,y as Ne}from"./gitApiHttp-B1mApXwC.js";import{Li as m,p as h,u as Pe}from"./useMobileNavigationStore-
|
|
1
|
+
import{n as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,n}from"./runtime-switch-BMjl5Y5W.js";import{n as r}from"./runtime-fetch-DKZOpfzo.js";import{t as i}from"./runtimeAPIRegistry-C2VogTny.js";import{$ as a,A as o,D as s,F as c,G as l,H as u,I as d,J as f,K as p,M as ee,P as te,S as ne,T as re,U as ie,X as ae,Y as oe,_ as se,a as ce,b as le,c as ue,d as de,et as fe,f as pe,ft as me,gt as he,h as ge,ht as _e,k as ve,kn as ye,m as be,nt as xe,ot as Se,pt as Ce,q as we,r as Te,s as Ee,st as De,tt as Oe,ut as ke,v as Ae,vt as je,x as Me,y as Ne}from"./gitApiHttp-B1mApXwC.js";import{Li as m,p as h,u as Pe}from"./useMobileNavigationStore-BoZDstLm.js";var g=`/api/magic-prompts`,Fe=new Map([{id:`git.commit.generate.visible`,title:`Commit Generation Visible Prompt`,group:`Git`,description:`Visible user message for commit message generation.`,template:`You are generating a Conventional Commits subject line from the diffs of the selected files.`},{id:`git.commit.generate.instructions`,title:`Commit Generation Instructions`,group:`Git`,description:`Hidden instructions for commit message generation.`,placeholders:[{key:`selected_files`,description:`Bullet list of currently selected file paths.`}],template:`Return exactly one JSON object and nothing else. Do not include prose, markdown, explanations, or code fences.
|
|
2
2
|
|
|
3
3
|
The JSON object must have exactly this shape:
|
|
4
4
|
{"subject": string, "highlights": string[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./rolldown-runtime-hePW80VL.js";import{ot as e,st as t}from"./vendor-base-ui-CzHs0bHY.js";import{n}from"./vendor-react-DlzBev0S.js";import{Jn as r}from"./useMobileNavigationStore-
|
|
1
|
+
import"./rolldown-runtime-hePW80VL.js";import{ot as e,st as t}from"./vendor-base-ui-CzHs0bHY.js";import{n}from"./vendor-react-DlzBev0S.js";import{Jn as r}from"./useMobileNavigationStore-BoZDstLm.js";var i=n();t();var a=e();function o(e){let t=(0,i.c)(23),n,o,s,c,l,u;t[0]===e?(n=t[1],o=t[2],s=t[3],c=t[4],l=t[5],u=t[6]):({className:o,type:u,bordered:n,placeholder:c,endAdornment:s,...l}=e,t[0]=e,t[1]=n,t[2]=o,t[3]=s,t[4]=c,t[5]=l,t[6]=u);let d=c||` `,f=n!==void 0&&`border border-transparent ring-0 focus:ring-0 aria-invalid:ring-1 aria-invalid:focus:ring-1`,p=n&&`border-[var(--form-surface-border)]`,m=s&&`pe-11`,h;t[7]!==o||t[8]!==f||t[9]!==p||t[10]!==m?(h=r(`text-foreground file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground bg-[var(--surface-elevated)] appearance-none flex h-9 w-full min-w-0 rounded-lg px-3 py-1 typography-markdown outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:typography-ui-label file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:typography-ui-label`,`ring-1 ring-inset ring-border/60 transition duration-200 ease-out`,`hover:[&:not(:focus)]:bg-[var(--surface-subtle)] hover:[&:not(:focus)]:ring-transparent`,`focus:ring-2 focus:ring-[var(--interactive-focus-ring)] focus-visible:outline-none`,`aria-invalid:ring-[var(--status-error)] aria-invalid:focus:ring-[var(--status-error)]`,f,p,o,m),t[7]=o,t[8]=f,t[9]=p,t[10]=m,t[11]=h):h=t[11];let g;t[12]!==n||t[13]!==l||t[14]!==d||t[15]!==h||t[16]!==u?(g=(0,a.jsx)(`input`,{type:u,"data-slot":`input`,"data-bordered":n,placeholder:d,className:h,spellCheck:!1,autoComplete:`off`,autoCorrect:`off`,autoCapitalize:`off`,...l}),t[12]=n,t[13]=l,t[14]=d,t[15]=h,t[16]=u,t[17]=g):g=t[17];let _=g;if(!s)return _;let v;t[18]===s?v=t[19]:(v=(0,a.jsx)(`div`,{"data-slot":`input-end-adornment`,className:`absolute inset-y-0 end-0 flex items-center`,children:s}),t[18]=s,t[19]=v);let y;return t[20]!==_||t[21]!==v?(y=(0,a.jsxs)(`div`,{"data-slot":`input-wrapper`,className:`relative min-w-0 w-full flex-1`,children:[_,v]}),t[20]=_,t[21]=v,t[22]=y):y=t[22],y}export{o as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{c as t,i as n}from"./runtime-switch-BMjl5Y5W.js";import{k as r}from"./platform-DMsFWy1a.js";import{a as i,i as a,r as o}from"./vendor-zustand-vDaAPGfl.js";import{ot as s,st as c}from"./vendor-base-ui-CzHs0bHY.js";import{bt as l,kt as u,nn as d,rn as f}from"./gitApiHttp-B1mApXwC.js";import{r as p,w as m}from"./useUIStore-BF882_0b.js";import{n as h}from"./vendor-react-DlzBev0S.js";import{r as g}from"./vendor-reactuses-core-CuTmqEMK.js";import{t as ee}from"./i18n-BU14awhU.js";import{$r as te,Ea as _,Jn as v,Li as y,Qi as b,R as x,Ta as ne,ar as S,ca as re,ir as C,lt as ie,oi as ae,p as w,tr as oe,v as se,x as T,yt as E}from"./useMobileNavigationStore-Dr61mYqA.js";import{a as ce,g as D,o as le,p as ue,s as de}from"./fileMentionAutocompleteState-BZJqfgae.js";import{t as O}from"./AgentAvatar-B2GEBJBG.js";import{n as k}from"./Icon-Co7WGN1G.js";import{g as A,v as j}from"./gitApi-BOyQ2o3N.js";import{c as fe,d as pe,l as me,n as he,r as ge,t as _e}from"./fileMentionTouchSelection-C3_guqVF.js";import{n as ve}from"./textarea-DpsaIedI.js";import{f as ye,o as be}from"./projectMeta-CyhJE6CA.js";var xe=(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=D([...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)},Se=(e,t)=>e===t||e.length===t.length&&e.every((e,n)=>{let r=t[n];return r!=null&&e.id===r.id&&e.title===r.title&&(e.subtitle??``)===(r.subtitle??``)&&(e.badge??``)===(r.badge??``)&&e.iconName===r.iconName&&e.agentName===r.agentName}),M=(e,t)=>e.highlightedIndex===t.highlightedIndex&&Se(e.rows,t.rows),N=(e,t)=>Se(e,t)?e:t.slice(),Ce=(e,t,n)=>{e&&(t.current&&M(t.current,n)||(t.current=n,e(n)))},we=(e,t)=>{t.current=null,e?.({rows:[],highlightedIndex:0})},P=e(c(),1),F=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},I=e=>/^[A-Za-z]:\//.test(e)?e.toLowerCase():e,L=(e,t)=>{let n=F(t),r=F(e);if(!n||!r)return!1;let i=I(n),a=I(r);return a===i||a.startsWith(`${i}/`)},Te=e=>{if(!e||typeof e!=`object`)return{};let t=e,n={};for(let[e,r]of Object.entries(t)){let t=F(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=>F(e)).filter(e=>L(e,t)))):[],o=Array.isArray(i.expandedPaths)?Array.from(new Set(i.expandedPaths.filter(e=>typeof e==`string`).map(e=>F(e)).filter(e=>L(e,t)))):[],s=typeof i.selectedPath==`string`?F(i.selectedPath):null,c=s&&L(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},R=(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},z=e=>e?{...e,touchedAt:Date.now()}:{openPaths:[],selectedPath:null,expandedPaths:[],touchedAt:Date.now()},Ee=i()(o(a((e,t)=>({byRoot:{},addOpenPath:(t,n,r)=>{let i=F((t||``).trim()),a=F((n||``).trim());!i||!a||!r?.allowOutsideRoot&&!L(a,i)||e(e=>{let t=e.byRoot[i],n=z(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:R({...e.byRoot,[i]:{...n,openPaths:o,selectedPath:s}},20)}})},removeOpenPath:(t,n)=>{let r=F((t||``).trim()),i=F((n||``).trim());!r||!i||e(e=>{let t=e.byRoot[r];if(!t)return e;let n=I(i),a=e=>I(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:R({...e.byRoot,[r]:{...t,openPaths:s,selectedPath:c,touchedAt:Date.now()}},20)}})},removeOpenPathsByPrefix:(t,n)=>{let r=F((t||``).trim()),i=F((n||``).trim());!r||!i||e(e=>{let t=e.byRoot[r];if(!t)return e;let n=I(i),a=n.endsWith(`/`)?n:`${n}/`,o=e=>{let t=I(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:R({...e.byRoot,[r]:{...t,openPaths:s,selectedPath:c,touchedAt:Date.now()}},20)}})},removeExpandedPathsByPrefix:(t,n)=>{let r=F((t||``).trim()),i=F((n||``).trim());!r||!i||e(e=>{let t=e.byRoot[r];if(!t)return e;let n=I(i),a=n.endsWith(`/`)?n:`${n}/`,o=t.expandedPaths.filter(e=>{let t=I(e);return t!==n&&!t.startsWith(a)});return o.length===t.expandedPaths.length?e:{byRoot:R({...e.byRoot,[r]:{...t,expandedPaths:o,touchedAt:Date.now()}},20)}})},setSelectedPath:(t,n,r)=>{let i=F((t||``).trim()),a=n?F(n.trim()):null;!i||a&&!r?.allowOutsideRoot&&!L(a,i)||e(e=>{let t=e.byRoot[i],n=z(t),r=a&&!n.openPaths.includes(a)?[...n.openPaths,a]:n.openPaths;return t&&t.selectedPath===a&&r===t.openPaths?e:{byRoot:R({...e.byRoot,[i]:{...n,openPaths:r,selectedPath:a}},20)}})},ensureSelectedPath:e=>{let n=F((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=F((t||``).trim()),i=F((n||``).trim());!r||!i||!L(i,r)||e(e=>{let t=e.byRoot[r],n=z(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:R({...e.byRoot,[r]:{...n,expandedPaths:a}},20)}})},expandPath:(t,n)=>{let r=F((t||``).trim()),i=F((n||``).trim());!r||!i||!L(i,r)||e(e=>{let t=e.byRoot[r],n=z(t);return n.expandedPaths.includes(i)&&t?e:{byRoot:R({...e.byRoot,[r]:{...n,expandedPaths:[...n.expandedPaths,i]}},20)}})},expandPaths:(t,n)=>{let r=F((t||``).trim());if(!r||!n||n.length===0)return;let i=n.map(e=>F((e||``).trim())).filter(e=>e&&L(e,r));i.length!==0&&e(e=>{let t=e.byRoot[r],n=z(t),a=new Set(n.expandedPaths),o=i.filter(e=>!a.has(e));return o.length===0?e:{byRoot:R({...e.byRoot,[r]:{...n,expandedPaths:[...n.expandedPaths,...o]}},20)}})}}),{name:`files-view-tabs-store`,version:2,storage:m(),migrate:e=>{if(!e||typeof e!=`object`)return{byRoot:{}};let t=e.byRoot;return{byRoot:Te(t)}},partialize:e=>({byRoot:Te(e.byRoot)})}),{name:`files-view-tabs-store`})),B=h(),De=(e,t)=>{let n=(0,B.c)(4),r=t===void 0?200:t,[i,a]=P.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]),P.useEffect(o,s),i},Oe=()=>{let e=(0,B.c)(17),t=w(ke),n=E(),r;e[0]===t?r=e[1]:(r=e=>t?e.getAttachment(t):void 0,e[0]=t,e[1]=r);let i=T(r),a=w(Ae),o=w(je),s=_(Me),c=_(Ne),u=l(Pe);if(t){let r;e[2]===i?r=e[3]:(r=se(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 u??void 0};function ke(e){return e.currentSessionId}function Ae(e){return e.worktreeMetadata}function je(e){return e.newSessionDraft}function Me(e){return e.activeProjectId}function Ne(e){return e.projects}function Pe(e){return e.currentDirectory}var V=s(),H=`bg-transparent font-[inherit] text-[var(--primary-base)]`,U=(e,t)=>{let n=t.trim().toLowerCase();if(!n)return e;let r=e.toLowerCase();if(!r.includes(n))return e;let i=[],a=0,o=r.indexOf(n);for(;o!==-1;)o>a&&i.push(e.slice(a,o)),i.push((0,V.jsx)(`mark`,{className:H,children:e.slice(o,o+n.length)},`${o}-${n}`)),a=o+n.length,o=r.indexOf(n,a);return a<e.length&&i.push(e.slice(a)),i},W=P.forwardRef(({searchQuery:e,onFileSelect:t,onAgentSelect:n,onSkillSelect:r,onSessionSelect:i,onClose:a,style:o,onRowsChange:s},c)=>{let{t:l}=ee(),m=Oe()??``,h=w(e=>e.currentSessionId),ne=ae(e=>e.activeSessions),S=x({enabled:!!i}),C=_(e=>e.activeProjectId),ie=_(e=>e.projects),se=P.useMemo(()=>ie.find(e=>e.id===C)?.path??null,[C,ie]),T=P.useMemo(()=>{let e=se||m;return e?e.replace(/\\/g,`/`).replace(/\/+$/,``):null},[se,m]),E=Ee(e=>T?e.byRoot[T]:void 0),D=y(e=>e.agents),A=u(e=>e.searchFiles),j=De(e,180),pe=f(),me=d(),[ye,be]=P.useState([]),[xe,Se]=P.useState(!1),[M,N]=P.useState(0),F=P.useRef(0),I=P.useRef({query:e,directory:m,ids:[]}),[L,Te]=P.useState(360),[R,z]=P.useState({}),[B,ke]=P.useState({}),Ae=P.useRef([]),je=P.useRef([]),Me=P.useRef([]),Ne=P.useRef(null),Pe=P.useRef(null),H=P.useRef(null);H.current||=_e();let W=p(e=>e.isMobile),G=(e??``).trim(),K=re({directory:m||null}),Fe=P.useMemo(()=>r?K.data??[]:[],[r,K.data]),Ie=P.useMemo(()=>{if(!T||!E)return[];let e=[E.selectedPath,...E.openPaths.slice().reverse()].filter(e=>typeof e==`string`&&e.length>0),t=new Set,n=[];for(let r of e){if(t.has(r))continue;t.add(r);let e=r.replace(/\\/g,`/`),i=e.split(`/`).filter(Boolean).pop()||e,a=e.startsWith(`${T}/`)?e.slice(T.length+1):e;n.push({name:i,path:e,relativePath:a,extension:i.includes(`.`)?i.split(`.`).pop()?.toLowerCase():void 0})}return de(n,G,{limit:6})},[G,T,E]),Le=P.useMemo(()=>n?b(D).filter(e=>e.mode!==`primary`):[],[D,n]),q=P.useMemo(()=>i?ce({sessions:te(ne,S),currentSessionId:h,searchQuery:G}):[],[ne,h,S,G,i]),J=Ie,Re=ye,Y=P.useMemo(()=>fe({skills:Fe,agents:Le,sessions:q,recentFiles:J,pathHits:Re,searchQuery:G,untitledSession:l(`chat.fileMentionAutocomplete.untitledSession`),sessionBadge:l(`chat.fileMentionAutocomplete.sessionType`),skillBadge:l(`chat.commandAutocomplete.badge.skill`)}),[Fe,Le,q,J,Re,G,l]);P.useEffect(()=>{let e=e=>{let t=e.target;!t||!Ne.current||Ne.current.contains(t)||a()};return document.addEventListener(`pointerdown`,e,!0),()=>{document.removeEventListener(`pointerdown`,e,!0)}},[a]),P.useEffect(()=>{if(!m){be([]);return}let e=(j??``).trim(),t=ue(e);if(!t){be([]);return}let n=!1;Se(!0);let r={includeHidden:pe,respectGitignore:!me};return Promise.all([A(m,t,80,{...r,type:`file`}),A(m,t,40,{...r,type:`directory`})]).then(([t,r])=>{if(n)return;let i=new Set(Ie.map(e=>e.path));be(le({files:t,directories:r,query:e,excludePaths:i,limit:20}))}).catch(()=>{n||be([])}).finally(()=>{n||Se(!1)}),()=>{n=!0}},[m,j,Ie,A,pe,me]),P.useLayoutEffect(()=>{let t=I.current,n=t.ids[F.current],r=t.query===e&&t.directory===m?Math.max(0,Y.findIndex(e=>e.id===n)):0;I.current={query:e,directory:m,ids:Y.map(e=>e.id)},F.current=r,N(r)},[Y,e,m]),P.useEffect(()=>{z({}),ke({})},[Y]),P.useEffect(()=>{Ae.current[M]?.scrollIntoView({block:`nearest`})},[M]),P.useEffect(()=>{let e=null,t=()=>{e!==null&&cancelAnimationFrame(e),e=requestAnimationFrame(()=>{let e={},t={};je.current.forEach((n,r)=>{if(!n)return;let i=Me.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}}),z(e),ke(t)})};return t(),window.addEventListener(`resize`,t),()=>{e!==null&&cancelAnimationFrame(e),window.removeEventListener(`resize`,t)}},[Y]),P.useEffect(()=>{let e=je.current[M];if(!e)return;let t=()=>{let t=e.clientWidth;t>0&&Te(t)};if(t(),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(t);return n.observe(e),()=>{n.disconnect()}},[M]);let ze=g(e=>{t(e)}),Be=g(e=>{n?.(e)}),Ve=g(e=>{i?.(e)}),He=g(e=>{r?.(e)}),Ue=(e,t)=>({onMouseDown:e=>e.preventDefault(),onPointerDown:e=>{e.pointerType===`touch`&&H.current?.pointerDown(e.clientX,e.clientY)},onPointerMove:e=>{e.pointerType===`touch`&&H.current?.pointerMove(e.clientX,e.clientY)},onPointerUp:e=>{e.pointerType===`touch`&&(H.current?.pointerUp(t)??!1)&&(e.preventDefault(),e.stopPropagation())},onPointerCancel:()=>H.current?.pointerCancel(),onClick:()=>{H.current?.click(t)},onMouseMove:()=>{F.current=e,N(e)}}),X=e=>{let t=Y.length;if(t===0)return;let n=(e%t+t)%t,r=Y[n];if(r.agentName!==void 0){Be(r.agentName);return}if(r.id.startsWith(`skill:`)){let e=Fe.find(e=>r.id===`skill:${e.name}-${e.scope}`);e&&He(e);return}if(r.id.startsWith(`session:`)){let e=q.find(e=>r.id===`session:${e.id}`);e&&Ve(e);return}let i=r.id.startsWith(`recent:`)?J.find(e=>r.id===`recent:${e.path}`):Re.find(e=>r.id===`file:${e.path}`);i&&ze(i)};P.useEffect(()=>{Ce(s,Pe,{rows:Y,highlightedIndex:M})},[s,M,Y]);let We=P.useRef(s);return We.current=s,P.useEffect(()=>()=>{we(We.current,Pe)},[]),P.useImperativeHandle(c,()=>({acceptIndex:e=>{X(e)},handleKeyDown:e=>{if(e===`Escape`){a();return}let t=Y.length;if(t!==0){if(e===`ArrowDown`){F.current=(F.current+1)%t,N(F.current);return}if(e===`ArrowUp`){F.current=(F.current-1+t)%t,N(F.current);return}(e===`Enter`||e===`Tab`)&&X(F.current)}}})),(0,V.jsxs)(he,{ref:Ne,isMobile:W,className:`max-w-[640px] max-h-64`,style:o,children:[(0,V.jsx)(ve,{preventOverscroll:!0,outerClassName:`flex-1 min-h-0`,className:`px-0`,children:(0,V.jsxs)(`div`,{className:`py-1`,children:[Y.map((e,t)=>{let n=e.id.startsWith(`file:`)||e.id.startsWith(`recent:`),r=n?oe(e.title,{maxLength:60}):e.title,i=M===t,a=R[t]??!1,o=B[t]??2.6;return(0,V.jsxs)(`div`,{"data-mention-id":e.id,ref:e=>{Ae.current[t]=e},className:v(`flex items-center gap-2 px-3 py-1.5 cursor-pointer typography-ui-label rounded-lg`,W&&`min-h-11`,ge(W,i),!W&&i&&`text-interactive-selection-foreground`),...Ue(t,()=>X(t)),children:[(0,V.jsx)(`span`,{className:`flex size-5 shrink-0 items-center justify-center`,children:e.agentName===void 0?(0,V.jsx)(k,{name:e.iconName,className:`size-3.5 text-current`}):(0,V.jsx)(O,{name:e.agentName,size:20})}),(0,V.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,V.jsxs)(`div`,{className:`flex min-w-0 items-baseline gap-2`,children:[(0,V.jsxs)(`span`,{ref:e=>{je.current[t]=e},className:v(`relative block min-w-0 overflow-hidden`,n&&a&&i&&`file-mention-marquee-container`),style:i?{"--file-mention-marquee-width":`${L}px`,"--file-mention-marquee-duration":`${o}s`}:void 0,title:e.title,children:[(0,V.jsx)(`span`,{ref:e=>{Me.current[t]=e},className:`absolute invisible whitespace-nowrap pointer-events-none`,"aria-hidden":!0,children:e.title}),n&&a&&i?(0,V.jsx)(`span`,{className:`inline-block whitespace-nowrap file-mention-marquee`,children:U(e.title,G)}):(0,V.jsx)(`span`,{className:`block truncate`,children:U(r,G)})]}),e.trailingLabel?(0,V.jsx)(`span`,{className:v(`max-w-[40%] shrink-0 truncate text-muted-foreground`,W?`typography-micro`:`typography-meta`),children:e.trailingLabel}):null]}),e.subtitle?(0,V.jsx)(`div`,{className:v(`truncate text-muted-foreground`,W?`typography-micro`:`typography-meta`),children:U(e.subtitle,G)}):null]})]},e.id)}),xe&&Re.length===0?(0,V.jsx)(`div`,{className:`flex items-center justify-center py-3`,children:(0,V.jsx)(k,{name:`refresh`,className:`h-4 w-4 animate-spin text-muted-foreground`})}):null,!xe&&Y.length===0&&(0,V.jsx)(`div`,{className:`px-3 py-2 typography-ui-label text-muted-foreground`,children:l(`chat.fileMentionAutocomplete.empty`)})]})}),!W&&(0,V.jsx)(`div`,{className:`px-3 pt-1 pb-1.5 border-t typography-meta text-muted-foreground`,children:l(`chat.autocomplete.keyboardHint`)})]})}),G=new Set([`new`,`fork`,`compact`,`reload`,`undo`,`redo`,`model`,`btw`]),K=(e,t)=>{if(!t||e.isSkill)return!1;let n=e.name?.trim().toLowerCase();return!!(n&&G.has(n))},Fe=(e,t)=>!e||t({name:e}),Ie=` `,Le=(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]===Ie&&e[r-2]===`/`&&(r-=2),e[r]===`/`?{start:r,end:n}:null},q=`text-[10px] leading-none uppercase font-bold tracking-tight px-1.5 py-1 rounded border flex-shrink-0`,J=v(q,`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)]`),Re=v(q,`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)]`),Y=v(q,`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)]`),ze=v(q,`bg-[var(--surface-muted)] text-muted-foreground border-[var(--interactive-border)]/60`),Be=(e,t)=>e.length===t.length&&e.every((e,n)=>e.id===t[n]?.id&&e.description===t[n]?.description),Ve=e=>{let t=!!e.sessionID;return{hasSession:t,canStartSessionCommand:t||e.hasNewDraft}},He=P.forwardRef(({searchQuery:e,onCommandSelect:t,onClose:n,directory:i,style:a,commandPolicy:o,commandContext:s,onRowsChange:c},l)=>{let{t:u}=ee(),d=p(e=>e.isMobile),f=w(e=>e.currentSessionId),m=w(e=>!!e.newSessionDraft?.open),h=w(P.useCallback(e=>f?e.getDirectoryForSession(f):void 0,[f])),g=ie(f??``,h??void 0),te=P.useMemo(()=>s??{sessionID:f??null,hasMessages:g.length>0,hasNewDraft:m},[s,f,g.length,m]),{hasSession:_,canStartSessionCommand:y}=P.useMemo(()=>Ve(te),[te]),b=te.hasMessages,[x,S]=P.useState([]),[re,C]=P.useState(!1),ae=ne({directory:i}),oe=P.useMemo(()=>ae.data??[],[ae.data]),se=ae.isFetching,[T,E]=P.useState(0),ce=P.useRef(0),D=P.useRef(!1),le=P.useRef([]),ue=P.useRef(null),de=P.useRef(!1),O=P.useRef(null),A=P.useRef(!1),j=P.useRef(null);P.useEffect(()=>{let e=e=>{let t=e.target;!t||!ue.current||ue.current.contains(t)||n()};return document.addEventListener(`pointerdown`,e,!0),()=>{document.removeEventListener(`pointerdown`,e,!0)}},[n]),P.useEffect(()=>{(async()=>{C(se);try{let t=oe.flatMap((e,t)=>e.source===`skill`?[]:[{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,scope:e.scope,reference:e.reference}]),n=[{id:`yuri:new`,name:`new`,source:`yuri`,description:u(`chat.commandAutocomplete.command.newDescription`),isBuiltIn:!0},..._&&!b?[{id:`yuri:init`,name:`init`,source:`yuri`,description:u(`chat.commandAutocomplete.command.initDescription`),isBuiltIn:!0}]:[],..._?[{id:`yuri:btw`,name:`btw`,source:`yuri`,description:u(`chat.btw.description`),isBuiltIn:!0},{id:`yuri:undo`,name:`undo`,source:`yuri`,description:u(`chat.commandAutocomplete.command.undoDescription`),isBuiltIn:!0},{id:`yuri:redo`,name:`redo`,source:`yuri`,description:u(`chat.commandAutocomplete.command.redoDescription`),isBuiltIn:!0},{id:`yuri:fork`,name:`fork`,source:`yuri`,description:u(`chat.commandAutocomplete.command.forkDescription`),isBuiltIn:!0},{id:`yuri:timeline`,name:`timeline`,source:`yuri`,description:u(`chat.commandAutocomplete.command.timelineDescription`),isBuiltIn:!0}]:[],{id:`yuri:model`,name:`model`,source:`yuri`,description:u(`chat.commandAutocomplete.command.modelDescription`),isBuiltIn:!0},{id:`yuri:compact`,name:`compact`,source:`yuri`,description:u(`chat.commandAutocomplete.command.compactDescription`),isBuiltIn:!0},...r()?[{id:`yuri:reload`,name:`reload`,source:`yuri`,description:u(`chat.commandAutocomplete.command.reloadDescription`),isBuiltIn:!0}]:[],..._?[{id:`yuri:summary`,name:`summary`,source:`yuri`,description:u(`chat.commandAutocomplete.command.summaryDescription`),isYuri:!0}]:[],...y?[{id:`yuri:workspace-review`,name:`workspace-review`,source:`yuri`,description:u(`chat.commandAutocomplete.command.workspaceReviewDescription`),isYuri:!0}]:[],...y?[{id:`yuri:craft-goal`,name:`craft-goal`,source:`yuri`,description:u(`chat.commandAutocomplete.command.craftGoalDescription`),isYuri:!0}]:[],...y?[{id:`yuri:catch-up`,name:`catch-up`,source:`yuri`,description:u(`chat.commandAutocomplete.command.catchUpDescription`),isYuri:!0}]:[],...y?[{id:`yuri:debug`,name:`debug`,source:`yuri`,description:u(`chat.commandAutocomplete.command.debugDescription`),isYuri:!0}]:[],...y?[{id:`yuri:weigh`,name:`weigh`,source:`yuri`,description:u(`chat.commandAutocomplete.command.weighDescription`),isYuri:!0}]:[],...y?[{id:`yuri:explore`,name:`explore`,source:`yuri`,description:u(`chat.commandAutocomplete.command.exploreDescription`),isYuri:!0}]:[],...t],i=!b,a=xe(n.filter(e=>(i||e.name!==`init`)&&(o?.(e)??!0)),e);S(e=>Be(e,a)?e:a)}catch{let t=!b,n=xe([{id:`yuri:new`,name:`new`,source:`yuri`,description:u(`chat.commandAutocomplete.command.newDescription`),isBuiltIn:!0},..._&&!b?[{id:`yuri:init`,name:`init`,source:`yuri`,description:u(`chat.commandAutocomplete.command.initDescription`),isBuiltIn:!0}]:[],..._?[{id:`yuri:btw`,name:`btw`,source:`yuri`,description:u(`chat.btw.description`),isBuiltIn:!0},{id:`yuri:undo`,name:`undo`,source:`yuri`,description:u(`chat.commandAutocomplete.command.undoDescription`),isBuiltIn:!0},{id:`yuri:redo`,name:`redo`,source:`yuri`,description:u(`chat.commandAutocomplete.command.redoDescription`),isBuiltIn:!0},{id:`yuri:fork`,name:`fork`,source:`yuri`,description:u(`chat.commandAutocomplete.command.forkDescription`),isBuiltIn:!0},{id:`yuri:timeline`,name:`timeline`,source:`yuri`,description:u(`chat.commandAutocomplete.command.timelineDescription`),isBuiltIn:!0}]:[],{id:`yuri:model`,name:`model`,source:`yuri`,description:u(`chat.commandAutocomplete.command.modelDescription`),isBuiltIn:!0},{id:`yuri:compact`,name:`compact`,source:`yuri`,description:u(`chat.commandAutocomplete.command.compactDescription`),isBuiltIn:!0},...r()?[{id:`yuri:reload`,name:`reload`,source:`yuri`,description:u(`chat.commandAutocomplete.command.reloadDescription`),isBuiltIn:!0}]:[],..._?[{id:`yuri:summary`,name:`summary`,source:`yuri`,description:u(`chat.commandAutocomplete.command.summaryDescription`),isYuri:!0}]:[],...y?[{id:`yuri:workspace-review`,name:`workspace-review`,source:`yuri`,description:u(`chat.commandAutocomplete.command.workspaceReviewDescription`),isYuri:!0}]:[],...y?[{id:`yuri:craft-goal`,name:`craft-goal`,source:`yuri`,description:u(`chat.commandAutocomplete.command.craftGoalDescription`),isYuri:!0}]:[],...y?[{id:`yuri:catch-up`,name:`catch-up`,source:`yuri`,description:u(`chat.commandAutocomplete.command.catchUpDescription`),isYuri:!0}]:[],...y?[{id:`yuri:debug`,name:`debug`,source:`yuri`,description:u(`chat.commandAutocomplete.command.debugDescription`),isYuri:!0}]:[],...y?[{id:`yuri:weigh`,name:`weigh`,source:`yuri`,description:u(`chat.commandAutocomplete.command.weighDescription`),isYuri:!0}]:[],...y?[{id:`yuri:explore`,name:`explore`,source:`yuri`,description:u(`chat.commandAutocomplete.command.exploreDescription`),isYuri:!0}]:[]].filter(e=>(t||e.name!==`init`)&&(o?.(e)??!0)),e);S(e=>Be(e,n)?e:n)}finally{C(!1)}})()},[e,b,_,y,oe,se,u,o]),P.useEffect(()=>{E(0)},[x]),P.useEffect(()=>{ce.current=T},[T]),P.useEffect(()=>{le.current[T]?.scrollIntoView({block:`nearest`})},[T]),P.useEffect(()=>{Ce(c,j,{rows:me(x,{skill:u(`chat.commandAutocomplete.badge.skill`),command:u(`chat.commandAutocomplete.badge.command`),system:u(`chat.commandAutocomplete.badge.system`)}),highlightedIndex:T})},[x,c,T,u]);let fe=P.useRef(c);fe.current=c,P.useEffect(()=>()=>{we(fe.current,j)},[]),P.useImperativeHandle(l,()=>({acceptIndex:(e,n=!0)=>{let r=x[e];r&&t(r,K(r,n))},handleKeyDown:e=>{let r=x.length;if(e===`Escape`){n();return}if(r!==0){if(e===`ArrowDown`){D.current=!0,E(e=>(e+1)%r);return}if(e===`ArrowUp`){D.current=!0,E(e=>(e-1+r)%r);return}if(e===`Enter`||e===`Tab`){let n=(ce.current%r+r)%r,i=x[n];i&&t(i,K(i,e===`Enter`))}}}}),[x,n,t]);let _e=e=>{let t=pe(e);switch(e.name){case`new`:return(0,V.jsx)(k,{name:t,className:`h-3.5 w-3.5`});case`init`:return(0,V.jsx)(k,{name:t,className:`h-3.5 w-3.5 text-green-500`});case`undo`:return(0,V.jsx)(k,{name:t,className:`h-3.5 w-3.5 text-orange-500`});case`redo`:return(0,V.jsx)(k,{name:t,className:`h-3.5 w-3.5 text-orange-500`});case`timeline`:case`reload`:return(0,V.jsx)(k,{name:t,className:`h-3.5 w-3.5`});case`compact`:return(0,V.jsx)(k,{name:t,className:`h-3.5 w-3.5 text-purple-500`});case`goal`:return(0,V.jsx)(k,{name:t,className:`h-3.5 w-3.5`});case`review`:return(0,V.jsx)(k,{name:t,className:`h-3.5 w-3.5 text-blue-500`});case`test`:case`build`:case`run`:return(0,V.jsx)(k,{name:t,className:`h-3.5 w-3.5 text-cyan-500`});default:return e.isBuiltIn?(0,V.jsx)(k,{name:t,className:`h-3.5 w-3.5 text-yellow-500`}):(0,V.jsx)(k,{name:t,className:`h-3.5 w-3.5 text-muted-foreground`})}};return(0,V.jsxs)(he,{ref:ue,isMobile:d,className:`max-w-[450px] max-h-64`,style:a,children:[(0,V.jsx)(ve,{preventOverscroll:!0,outerClassName:`flex-1 min-h-0`,className:`px-0 py-1.5`,children:re?(0,V.jsx)(`div`,{className:`flex items-center justify-center py-4`,children:(0,V.jsx)(k,{name:`refresh`,className:`h-4 w-4 animate-spin text-muted-foreground`})}):(0,V.jsxs)(`div`,{children:[x.map((n,r)=>{let i=n.isBuiltIn,a=n.isYuri;return(0,V.jsxs)(`div`,{ref:e=>{le.current[r]=e},className:v(`flex gap-2 px-2 py-2 cursor-pointer rounded-lg`,d?`items-center`:`items-start`,ge(d,r===T),!d&&r===T&&`bg-interactive-selection/35`),onMouseDown:e=>e.preventDefault(),onPointerDown:e=>{e.pointerType===`touch`&&(O.current={x:e.clientX,y:e.clientY},A.current=!1)},onPointerMove:e=>{if(e.pointerType!==`touch`||!O.current)return;let t=e.clientX-O.current.x,n=e.clientY-O.current.y;Math.hypot(t,n)>6&&(A.current=!0)},onPointerUp:e=>{if(e.pointerType!==`touch`)return;let r=A.current;O.current=null,A.current=!1,!r&&(e.preventDefault(),e.stopPropagation(),de.current=!0,t(n,K(n,d)))},onPointerCancel:()=>{O.current=null,A.current=!1},onClick:()=>{if(de.current){de.current=!1;return}t(n,K(n,d))},onMouseMove:()=>{D.current=!1,E(r)},children:[(0,V.jsx)(`div`,{className:v(!d&&`mt-0.5`),children:_e(n)}),(0,V.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsxs)(`span`,{className:`typography-ui-label font-medium`,children:[`/`,U(n.name,e)]}),n.isSkill?(0,V.jsx)(`span`,{className:J,children:u(`chat.commandAutocomplete.badge.skill`)}):(0,V.jsx)(`span`,{className:J,children:u(`chat.commandAutocomplete.badge.command`)}),a?(0,V.jsx)(`span`,{className:ze,children:`Yuri`}):i?(0,V.jsx)(`span`,{className:ze,children:u(`chat.commandAutocomplete.badge.system`)}):n.scope?(0,V.jsx)(`span`,{className:n.scope===`project`?Y:Re,children:n.scope}):null,n.agent&&(0,V.jsx)(`span`,{className:ze,children:n.agent})]}),n.description&&!d&&(0,V.jsx)(`div`,{className:`typography-meta text-muted-foreground mt-0.5 truncate`,children:U(n.description,e)})]})]},n.id)}),x.length===0&&(0,V.jsx)(`div`,{className:`px-3 py-2 typography-ui-label text-muted-foreground`,children:u(`chat.commandAutocomplete.empty`)})]})}),!d&&(0,V.jsx)(`div`,{className:`px-3 pt-1 pb-1.5 border-t typography-meta text-muted-foreground`,children:u(`chat.autocomplete.keyboardHint`)})]})});He.displayName=`CommandAutocomplete`;var Ue=e=>e instanceof Error?e.name===`AbortError`||e.name===`CancelledError`||e.name===`Error`&&e.message===`CancelledError`:!1,X=1e4,We=6e4,Ge=5e3,Ke=3e4,qe=6e4,Je=25,Ye=40,Xe=2,Ze=15e3,Qe=500,$e=30,et=20971520,tt=new Map,nt=new Map,rt=new Map,it=new Map,at=new Map,ot=new Map,st=new WeakMap,ct=e=>{let t=st.get(e);return t||(t=new Set(e.files.map(e=>e.path)),st.set(e,t)),t},lt=(e,t)=>`${t}:${e}`,ut=e=>nt.get(e)??0,dt=e=>{let t=ut(e)+1;return nt.set(e,t),t},ft=e=>{let t=(rt.get(e)??0)+1;return rt.set(e,t),t},pt=e=>{let t=tt.get(e);if(t)return t;let n=new Set;return tt.set(e,n),n},Z=()=>({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}),mt=(e,t=$e,n=et)=>{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},ht=(e,t)=>!e&&!t?!1:!e||!t||e.remote!==t.remote||e.branch!==t.branch||e.ahead!==t.ahead||e.behind!==t.behind,gt=e=>{let t=e?.trim()??``;return t===`?`?``:t},_t=(e,t)=>{let n=new Set,r=!1,i=!e;e&&(i=e.ahead!==t.ahead||e.behind!==t.behind||e.current!==t.current||e.tracking!==t.tracking||e.isClean!==t.isClean||t.upstreamComparison!==void 0&&ht(e.upstreamComparison,t.upstreamComparison)||t.diffStats!==void 0&&e.diffStats===void 0);let a=new Map;for(let t of e?.files??[])a.set(t.path,t);for(let e of t.files??[]){let t=a.get(e.path);if(!t){n.add(e.path),gt(e.index)&&(r=!0);continue}a.delete(e.path),(t.index!==e.index||t.working_dir!==e.working_dir)&&n.add(e.path),!r&>(t.index)!==gt(e.index)&&(r=!0)}for(let[e,t]of a)n.add(e),gt(t.index)&&(r=!0);let o=t.diffStats,s=e?.diffStats;if(o!==void 0&&o!==s){let e=s??{};for(let t in o){let r=o[t],i=e[t];(!i||i.insertions!==r.insertions||i.deletions!==r.deletions)&&n.add(t)}for(let t in e)t in o||n.add(t)}return{changed:i||n.size>0,changedPaths:n,indexChanged:r}},vt=e=>!e||e.trim().length===0,yt=e=>(e||``).trim()===`U`,bt=e=>{let t=(e.index||``).trim(),n=(e.working_dir||``).trim();if(yt(t)||yt(n))return e;let r=t===`?`||n===`?`?`A`:t||n||` `;return{...e,index:r,working_dir:` `}},xt=e=>{let t=(e.index||``).trim(),n=(e.working_dir||``).trim();if(yt(t)||yt(n))return e;let r=n||(t===`A`||t===`?`?`?`:t)||` `;return{...e,index:` `,working_dir:r}},St=e=>vt(e.index)&&vt(e.working_dir),Q=i()(o((e,t)=>({directories:new Map,activeDirectory:null,setActiveDirectory:n=>{let{activeDirectory:r,directories:i}=t();if(r!==n)if(r&&dt(r),n&&dt(n),n&&!i.has(n)){let t=new Map(i);t.set(n,Z()),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=lt(n,a),s=it.get(o)??(a===`light`?it.get(lt(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||=Z(),!a){let r=new Map(t().directories),i=r.get(n)??Z();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)>We,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),d=t().directories.get(n)??Z(),f=ot.get(n),p=f?.received===u&&f.stored===d.status?null:_t(d.status,u);if(p?.changed){c=!0;let r=new Map(t().directories),i=r.get(n)??Z(),{changedPaths:s,indexChanged:l}=p,d=new Map(i.diffCache);for(let e of s)d.delete(e);let f=s.size>0;f&&dt(n);let m={...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:m,diffCache:d,indexRevision:l?i.indexRevision+1:i.indexRevision,lastRepoCheckAt:o?a:i.lastRepoCheckAt,lastStatusFetch:Date.now(),lastStatusChange:f?Date.now():i.lastStatusChange}),e({directories:r}),ot.set(n,{received:u,stored:m})}else{ot.set(n,{received:u,stored:d.status});let r=new Map(t().directories),i=r.get(n)??Z();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)??Z();r.set(n,{...i,isLoadingStatus:!1}),e({directories:r})}}return c})();it.set(o,c);try{return await c}finally{it.get(o)===c&&it.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`?bt(e):xt(e);t!==e&&(l=!0),St(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=ft(r);{let n=new Map(t().directories),i=n.get(r)??Z();n.set(r,{...i,isLoadingBranches:!0}),e({directories:n})}try{let c=a.force?await S(r,i,void 0,o):await C(r,i,void 0,o);if(s!==rt.get(r)||o!==n())return;let l=new Map(t().directories),u=l.get(r)??Z();l.set(r,{...u,branches:c,branchesTransportIdentity:o,isLoadingBranches:!1,lastBranchesFetch:Date.now()}),e({directories:l})}catch(i){if(Ue(i)||console.error(`Failed to fetch git branches:`,i),s!==rt.get(r)||o!==n())return;let a=new Map(t().directories),c=a.get(r)??Z();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)??Z();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)??Z();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)??Z();i.set(n,{...a,isLoadingLog:!1}),e({directories:i})}},fetchIdentity:async(n,r)=>{{let r=new Map(t().directories),i=r.get(n)??Z();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)??Z();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)??Z();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=Z();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>X||!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)??Z(),s=new Map(o.diffCache);s.set(r,{...i,fetchedAt:Date.now()});let c=mt(s);a.set(n,{...o,diffCache:c}),e({directories:a})},clearDiffCache:n=>{dt(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,Je);await t().prefetchDiffs(e,n,i,{maxFiles:Je})},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=Ye}=a,c=Math.min(Math.max(1,s),$e),l=ct(o.status),u=o.status.diffStats,d=pt(n),f=[],p=new Set;for(let e of i){if(p.size>=c)break;if(!e||p.has(e)||!l.has(e))continue;let t=u?.[e];t&&t.insertions+t.deletions>Qe||(p.add(e),!o.diffCache.has(e)&&(d.has(e)||f.push(e)))}let m=f;if(m.length===0)return;let h=ut(n);if(typeof document<`u`&&document.hidden)return;m.forEach(e=>d.add(e));let g=0,ee=[],te=()=>{let e=g;return g+=1,e<m.length?m[e]:null},_=async e=>{let t=r.getGitFileDiff(n,{path:e}),i=new Promise((e,t)=>{setTimeout(()=>t(Error(`Timed out after ${Ze}ms`)),Ze)}),a=await Promise.race([t,i]);return{path:e,diff:{original:a.original??``,modified:a.modified??``,isBinary:a.isBinary}}},v=async()=>{for(;;){if(h!==ut(n))return;let e=te();if(!e)return;try{ee.push(await _(e))}catch{}finally{d.delete(e)}}},y=Math.min(Xe,m.length);if(await Promise.allSettled(Array.from({length:y},()=>v())),m.forEach(e=>d.delete(e)),h!==ut(n))return;let b=new Map(t().directories),x=b.get(n);if(!x)return;let ne=new Map(x.diffCache),S=Date.now();ee.forEach(e=>{!e.diff.isBinary&&e.diff.original===``&&e.diff.modified===``||ne.set(e.path,{...e.diff,fetchedAt:S})});let re=mt(ne);b.set(n,{...x,diffCache:re}),e({directories:b})},setLogMaxCount:(n,r)=>{let i=new Map(t().directories),a=i.get(n)??Z();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<Ge||await t().fetchStatus(e,n,{silent:!!r?.status})},ensureAll:(e,n)=>{let r=at.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)>=Ge)&&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>=Ke)&&o.push(t().fetchBranches(e,n)),(!a.log||i-a.lastLogFetch>=X)&&o.push(t().fetchLog(e,n)),(!a.identity||i-a.lastIdentityFetch>=qe)&&o.push(t().fetchIdentity(e,n)),o.length>0&&await Promise.all(o)})();return at.set(e,i),i.finally(()=>{at.get(e)===i&&at.delete(e)}),i},refresh:async(e,n={})=>{let{activeDirectory:r}=t();r&&await t().fetchAll(r,e,n)}}),{name:`git-store`})),Ct=e=>{let t=(0,B.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),Q(n)},wt=e=>{let r=(0,B.c)(3),i=P.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],Q(a)},Tt=e=>{let t=(0,B.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),Q(n)},Et=e=>{let t=(0,B.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),Q(n)},Dt=e=>{let t=(0,B.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),Q(n)},Ot=e=>{let t=(0,B.c)(3),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=new Map,t[0]=n):n=t[0];let r=P.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),Q(i)},kt=e=>{let t=(0,B.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),Q(n)},At=e=>{let t=(0,B.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),Q(n)},jt=e=>{let t=(0,B.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),Q(n)},Mt=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)}},$=e=>String(e||``).trim().replace(/^refs\/heads\//,``).replace(/^heads\//,``).replace(/^remotes\//,``),Nt=e=>e.branchName?$(e.branchName):e.mode===`existing`?$(e.existingBranch||e.preferredName||``):$(e.preferredName||``),Pt=async e=>{let t=await ye(e);try{let n=Mt((await A(e)).branches?.[t]?.tracking||null);if(n?.remote)return n.remote}catch{}try{let t=Mt((await j(e)).tracking);if(t?.remote)return t.remote}catch{}return null},Ft=async(e,t)=>{let n=await Pt(e),r=$(t);return!n||!r?null:{setUpstream:!0,upstreamRemote:n,upstreamBranch:r}},It=async(e,t,n)=>{let r=Nt(t),i=n?.resolvedRootTrackingRemote,a=i===void 0?await Ft(e,r):i&&$(r)?{setUpstream:!0,upstreamRemote:i,upstreamBranch:$(r)}:null;return a?{...t,setUpstream:t.setUpstream??a.setUpstream,upstreamRemote:t.upstreamRemote||a.upstreamRemote,upstreamBranch:t.upstreamBranch||a.upstreamBranch}:t},Lt=async(e,t,n)=>{let r=await It(e.path,t,n);return be(e,r)},Rt=`yuri:lastWorktreeSourceBranch`,zt=({mode:e,sourceBranch:t,linkedPr:n,selectedBranch:r})=>e===`existing-branch`?r||null:n?null:t||null,Bt=({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},Vt=(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?` `:``}`},Ht=(e,t,n)=>{let r=Vt(e,t,n);return`${t.length===0&&!/^\s/.test(r)?` `:``}${r}${n.length===0&&!/\s$/.test(r)?` `:``}`},Ut=(e,t,n,r)=>{let i=e.slice(0,t),a=e.slice(n),o=Ht(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}},Wt=(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.some(e=>e.range.start<t.range.end&&t.range.start<e.range.end)?[...e]:[...e,t]},Gt=(e,t)=>t<e.length&&e[t]===` `?t+1:t;export{Fe as C,Ee as D,De as E,N as O,Le as S,Oe as T,Ot as _,Rt as a,Et as b,Lt as c,Dt as d,wt as f,Tt as g,kt as h,Ht as i,Pt as l,At as m,Wt as n,Bt as o,jt as p,Ut as r,zt as s,Gt as t,It as u,Ct as v,W as w,He as x,Q as y};
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{c as t,i as n}from"./runtime-switch-BMjl5Y5W.js";import{k as r}from"./platform-DMsFWy1a.js";import{a as i,i as a,r as o}from"./vendor-zustand-vDaAPGfl.js";import{ot as s,st as c}from"./vendor-base-ui-CzHs0bHY.js";import{bt as l,kt as u,nn as d,rn as f}from"./gitApiHttp-B1mApXwC.js";import{r as p,w as m}from"./useUIStore-BF882_0b.js";import{n as h}from"./vendor-react-DlzBev0S.js";import{r as g}from"./vendor-reactuses-core-CuTmqEMK.js";import{t as ee}from"./i18n-BU14awhU.js";import{$r as te,Ea as _,Jn as v,Li as y,Qi as b,R as x,Ta as ne,ar as S,ca as re,ir as C,lt as ie,oi as ae,p as w,tr as oe,v as se,x as T,yt as E}from"./useMobileNavigationStore-BoZDstLm.js";import{a as ce,g as D,o as le,p as ue,s as de}from"./fileMentionAutocompleteState-BZJqfgae.js";import{t as O}from"./AgentAvatar-qwoC8op7.js";import{n as k}from"./Icon-D6eeecf3.js";import{g as A,v as j}from"./gitApi-L3nS1oNJ.js";import{c as fe,d as pe,l as me,n as he,r as ge,t as _e}from"./fileMentionTouchSelection-CUUCXrKA.js";import{n as ve}from"./textarea-CI1VKA2e.js";import{f as ye,o as be}from"./projectMeta-BzvXAJMC.js";var xe=(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=D([...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)},Se=(e,t)=>e===t||e.length===t.length&&e.every((e,n)=>{let r=t[n];return r!=null&&e.id===r.id&&e.title===r.title&&(e.subtitle??``)===(r.subtitle??``)&&(e.badge??``)===(r.badge??``)&&e.iconName===r.iconName&&e.agentName===r.agentName}),M=(e,t)=>e.highlightedIndex===t.highlightedIndex&&Se(e.rows,t.rows),N=(e,t)=>Se(e,t)?e:t.slice(),Ce=(e,t,n)=>{e&&(t.current&&M(t.current,n)||(t.current=n,e(n)))},we=(e,t)=>{t.current=null,e?.({rows:[],highlightedIndex:0})},P=e(c(),1),F=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},I=e=>/^[A-Za-z]:\//.test(e)?e.toLowerCase():e,L=(e,t)=>{let n=F(t),r=F(e);if(!n||!r)return!1;let i=I(n),a=I(r);return a===i||a.startsWith(`${i}/`)},Te=e=>{if(!e||typeof e!=`object`)return{};let t=e,n={};for(let[e,r]of Object.entries(t)){let t=F(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=>F(e)).filter(e=>L(e,t)))):[],o=Array.isArray(i.expandedPaths)?Array.from(new Set(i.expandedPaths.filter(e=>typeof e==`string`).map(e=>F(e)).filter(e=>L(e,t)))):[],s=typeof i.selectedPath==`string`?F(i.selectedPath):null,c=s&&L(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},R=(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},z=e=>e?{...e,touchedAt:Date.now()}:{openPaths:[],selectedPath:null,expandedPaths:[],touchedAt:Date.now()},Ee=i()(o(a((e,t)=>({byRoot:{},addOpenPath:(t,n,r)=>{let i=F((t||``).trim()),a=F((n||``).trim());!i||!a||!r?.allowOutsideRoot&&!L(a,i)||e(e=>{let t=e.byRoot[i],n=z(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:R({...e.byRoot,[i]:{...n,openPaths:o,selectedPath:s}},20)}})},removeOpenPath:(t,n)=>{let r=F((t||``).trim()),i=F((n||``).trim());!r||!i||e(e=>{let t=e.byRoot[r];if(!t)return e;let n=I(i),a=e=>I(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:R({...e.byRoot,[r]:{...t,openPaths:s,selectedPath:c,touchedAt:Date.now()}},20)}})},removeOpenPathsByPrefix:(t,n)=>{let r=F((t||``).trim()),i=F((n||``).trim());!r||!i||e(e=>{let t=e.byRoot[r];if(!t)return e;let n=I(i),a=n.endsWith(`/`)?n:`${n}/`,o=e=>{let t=I(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:R({...e.byRoot,[r]:{...t,openPaths:s,selectedPath:c,touchedAt:Date.now()}},20)}})},removeExpandedPathsByPrefix:(t,n)=>{let r=F((t||``).trim()),i=F((n||``).trim());!r||!i||e(e=>{let t=e.byRoot[r];if(!t)return e;let n=I(i),a=n.endsWith(`/`)?n:`${n}/`,o=t.expandedPaths.filter(e=>{let t=I(e);return t!==n&&!t.startsWith(a)});return o.length===t.expandedPaths.length?e:{byRoot:R({...e.byRoot,[r]:{...t,expandedPaths:o,touchedAt:Date.now()}},20)}})},setSelectedPath:(t,n,r)=>{let i=F((t||``).trim()),a=n?F(n.trim()):null;!i||a&&!r?.allowOutsideRoot&&!L(a,i)||e(e=>{let t=e.byRoot[i],n=z(t),r=a&&!n.openPaths.includes(a)?[...n.openPaths,a]:n.openPaths;return t&&t.selectedPath===a&&r===t.openPaths?e:{byRoot:R({...e.byRoot,[i]:{...n,openPaths:r,selectedPath:a}},20)}})},ensureSelectedPath:e=>{let n=F((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=F((t||``).trim()),i=F((n||``).trim());!r||!i||!L(i,r)||e(e=>{let t=e.byRoot[r],n=z(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:R({...e.byRoot,[r]:{...n,expandedPaths:a}},20)}})},expandPath:(t,n)=>{let r=F((t||``).trim()),i=F((n||``).trim());!r||!i||!L(i,r)||e(e=>{let t=e.byRoot[r],n=z(t);return n.expandedPaths.includes(i)&&t?e:{byRoot:R({...e.byRoot,[r]:{...n,expandedPaths:[...n.expandedPaths,i]}},20)}})},expandPaths:(t,n)=>{let r=F((t||``).trim());if(!r||!n||n.length===0)return;let i=n.map(e=>F((e||``).trim())).filter(e=>e&&L(e,r));i.length!==0&&e(e=>{let t=e.byRoot[r],n=z(t),a=new Set(n.expandedPaths),o=i.filter(e=>!a.has(e));return o.length===0?e:{byRoot:R({...e.byRoot,[r]:{...n,expandedPaths:[...n.expandedPaths,...o]}},20)}})}}),{name:`files-view-tabs-store`,version:2,storage:m(),migrate:e=>{if(!e||typeof e!=`object`)return{byRoot:{}};let t=e.byRoot;return{byRoot:Te(t)}},partialize:e=>({byRoot:Te(e.byRoot)})}),{name:`files-view-tabs-store`})),B=h(),De=(e,t)=>{let n=(0,B.c)(4),r=t===void 0?200:t,[i,a]=P.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]),P.useEffect(o,s),i},Oe=()=>{let e=(0,B.c)(17),t=w(ke),n=E(),r;e[0]===t?r=e[1]:(r=e=>t?e.getAttachment(t):void 0,e[0]=t,e[1]=r);let i=T(r),a=w(Ae),o=w(je),s=_(Me),c=_(Ne),u=l(Pe);if(t){let r;e[2]===i?r=e[3]:(r=se(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 u??void 0};function ke(e){return e.currentSessionId}function Ae(e){return e.worktreeMetadata}function je(e){return e.newSessionDraft}function Me(e){return e.activeProjectId}function Ne(e){return e.projects}function Pe(e){return e.currentDirectory}var V=s(),H=`bg-transparent font-[inherit] text-[var(--primary-base)]`,U=(e,t)=>{let n=t.trim().toLowerCase();if(!n)return e;let r=e.toLowerCase();if(!r.includes(n))return e;let i=[],a=0,o=r.indexOf(n);for(;o!==-1;)o>a&&i.push(e.slice(a,o)),i.push((0,V.jsx)(`mark`,{className:H,children:e.slice(o,o+n.length)},`${o}-${n}`)),a=o+n.length,o=r.indexOf(n,a);return a<e.length&&i.push(e.slice(a)),i},W=P.forwardRef(({searchQuery:e,onFileSelect:t,onAgentSelect:n,onSkillSelect:r,onSessionSelect:i,onClose:a,style:o,onRowsChange:s},c)=>{let{t:l}=ee(),m=Oe()??``,h=w(e=>e.currentSessionId),ne=ae(e=>e.activeSessions),S=x({enabled:!!i}),C=_(e=>e.activeProjectId),ie=_(e=>e.projects),se=P.useMemo(()=>ie.find(e=>e.id===C)?.path??null,[C,ie]),T=P.useMemo(()=>{let e=se||m;return e?e.replace(/\\/g,`/`).replace(/\/+$/,``):null},[se,m]),E=Ee(e=>T?e.byRoot[T]:void 0),D=y(e=>e.agents),A=u(e=>e.searchFiles),j=De(e,180),pe=f(),me=d(),[ye,be]=P.useState([]),[xe,Se]=P.useState(!1),[M,N]=P.useState(0),F=P.useRef(0),I=P.useRef({query:e,directory:m,ids:[]}),[L,Te]=P.useState(360),[R,z]=P.useState({}),[B,ke]=P.useState({}),Ae=P.useRef([]),je=P.useRef([]),Me=P.useRef([]),Ne=P.useRef(null),Pe=P.useRef(null),H=P.useRef(null);H.current||=_e();let W=p(e=>e.isMobile),G=(e??``).trim(),K=re({directory:m||null}),Fe=P.useMemo(()=>r?K.data??[]:[],[r,K.data]),Ie=P.useMemo(()=>{if(!T||!E)return[];let e=[E.selectedPath,...E.openPaths.slice().reverse()].filter(e=>typeof e==`string`&&e.length>0),t=new Set,n=[];for(let r of e){if(t.has(r))continue;t.add(r);let e=r.replace(/\\/g,`/`),i=e.split(`/`).filter(Boolean).pop()||e,a=e.startsWith(`${T}/`)?e.slice(T.length+1):e;n.push({name:i,path:e,relativePath:a,extension:i.includes(`.`)?i.split(`.`).pop()?.toLowerCase():void 0})}return de(n,G,{limit:6})},[G,T,E]),Le=P.useMemo(()=>n?b(D).filter(e=>e.mode!==`primary`):[],[D,n]),q=P.useMemo(()=>i?ce({sessions:te(ne,S),currentSessionId:h,searchQuery:G}):[],[ne,h,S,G,i]),J=Ie,Re=ye,Y=P.useMemo(()=>fe({skills:Fe,agents:Le,sessions:q,recentFiles:J,pathHits:Re,searchQuery:G,untitledSession:l(`chat.fileMentionAutocomplete.untitledSession`),sessionBadge:l(`chat.fileMentionAutocomplete.sessionType`),skillBadge:l(`chat.commandAutocomplete.badge.skill`)}),[Fe,Le,q,J,Re,G,l]);P.useEffect(()=>{let e=e=>{let t=e.target;!t||!Ne.current||Ne.current.contains(t)||a()};return document.addEventListener(`pointerdown`,e,!0),()=>{document.removeEventListener(`pointerdown`,e,!0)}},[a]),P.useEffect(()=>{if(!m){be([]);return}let e=(j??``).trim(),t=ue(e);if(!t){be([]);return}let n=!1;Se(!0);let r={includeHidden:pe,respectGitignore:!me};return Promise.all([A(m,t,80,{...r,type:`file`}),A(m,t,40,{...r,type:`directory`})]).then(([t,r])=>{if(n)return;let i=new Set(Ie.map(e=>e.path));be(le({files:t,directories:r,query:e,excludePaths:i,limit:20}))}).catch(()=>{n||be([])}).finally(()=>{n||Se(!1)}),()=>{n=!0}},[m,j,Ie,A,pe,me]),P.useLayoutEffect(()=>{let t=I.current,n=t.ids[F.current],r=t.query===e&&t.directory===m?Math.max(0,Y.findIndex(e=>e.id===n)):0;I.current={query:e,directory:m,ids:Y.map(e=>e.id)},F.current=r,N(r)},[Y,e,m]),P.useEffect(()=>{z({}),ke({})},[Y]),P.useEffect(()=>{Ae.current[M]?.scrollIntoView({block:`nearest`})},[M]),P.useEffect(()=>{let e=null,t=()=>{e!==null&&cancelAnimationFrame(e),e=requestAnimationFrame(()=>{let e={},t={};je.current.forEach((n,r)=>{if(!n)return;let i=Me.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}}),z(e),ke(t)})};return t(),window.addEventListener(`resize`,t),()=>{e!==null&&cancelAnimationFrame(e),window.removeEventListener(`resize`,t)}},[Y]),P.useEffect(()=>{let e=je.current[M];if(!e)return;let t=()=>{let t=e.clientWidth;t>0&&Te(t)};if(t(),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(t);return n.observe(e),()=>{n.disconnect()}},[M]);let ze=g(e=>{t(e)}),Be=g(e=>{n?.(e)}),Ve=g(e=>{i?.(e)}),He=g(e=>{r?.(e)}),Ue=(e,t)=>({onMouseDown:e=>e.preventDefault(),onPointerDown:e=>{e.pointerType===`touch`&&H.current?.pointerDown(e.clientX,e.clientY)},onPointerMove:e=>{e.pointerType===`touch`&&H.current?.pointerMove(e.clientX,e.clientY)},onPointerUp:e=>{e.pointerType===`touch`&&(H.current?.pointerUp(t)??!1)&&(e.preventDefault(),e.stopPropagation())},onPointerCancel:()=>H.current?.pointerCancel(),onClick:()=>{H.current?.click(t)},onMouseMove:()=>{F.current=e,N(e)}}),X=e=>{let t=Y.length;if(t===0)return;let n=(e%t+t)%t,r=Y[n];if(r.agentName!==void 0){Be(r.agentName);return}if(r.id.startsWith(`skill:`)){let e=Fe.find(e=>r.id===`skill:${e.name}-${e.scope}`);e&&He(e);return}if(r.id.startsWith(`session:`)){let e=q.find(e=>r.id===`session:${e.id}`);e&&Ve(e);return}let i=r.id.startsWith(`recent:`)?J.find(e=>r.id===`recent:${e.path}`):Re.find(e=>r.id===`file:${e.path}`);i&&ze(i)};P.useEffect(()=>{Ce(s,Pe,{rows:Y,highlightedIndex:M})},[s,M,Y]);let We=P.useRef(s);return We.current=s,P.useEffect(()=>()=>{we(We.current,Pe)},[]),P.useImperativeHandle(c,()=>({acceptIndex:e=>{X(e)},handleKeyDown:e=>{if(e===`Escape`){a();return}let t=Y.length;if(t!==0){if(e===`ArrowDown`){F.current=(F.current+1)%t,N(F.current);return}if(e===`ArrowUp`){F.current=(F.current-1+t)%t,N(F.current);return}(e===`Enter`||e===`Tab`)&&X(F.current)}}})),(0,V.jsxs)(he,{ref:Ne,isMobile:W,className:`max-w-[640px] max-h-64`,style:o,children:[(0,V.jsx)(ve,{preventOverscroll:!0,outerClassName:`flex-1 min-h-0`,className:`px-0`,children:(0,V.jsxs)(`div`,{className:`py-1`,children:[Y.map((e,t)=>{let n=e.id.startsWith(`file:`)||e.id.startsWith(`recent:`),r=n?oe(e.title,{maxLength:60}):e.title,i=M===t,a=R[t]??!1,o=B[t]??2.6;return(0,V.jsxs)(`div`,{"data-mention-id":e.id,ref:e=>{Ae.current[t]=e},className:v(`flex items-center gap-2 px-3 py-1.5 cursor-pointer typography-ui-label rounded-lg`,W&&`min-h-11`,ge(W,i),!W&&i&&`text-interactive-selection-foreground`),...Ue(t,()=>X(t)),children:[(0,V.jsx)(`span`,{className:`flex size-5 shrink-0 items-center justify-center`,children:e.agentName===void 0?(0,V.jsx)(k,{name:e.iconName,className:`size-3.5 text-current`}):(0,V.jsx)(O,{name:e.agentName,size:20})}),(0,V.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,V.jsxs)(`div`,{className:`flex min-w-0 items-baseline gap-2`,children:[(0,V.jsxs)(`span`,{ref:e=>{je.current[t]=e},className:v(`relative block min-w-0 overflow-hidden`,n&&a&&i&&`file-mention-marquee-container`),style:i?{"--file-mention-marquee-width":`${L}px`,"--file-mention-marquee-duration":`${o}s`}:void 0,title:e.title,children:[(0,V.jsx)(`span`,{ref:e=>{Me.current[t]=e},className:`absolute invisible whitespace-nowrap pointer-events-none`,"aria-hidden":!0,children:e.title}),n&&a&&i?(0,V.jsx)(`span`,{className:`inline-block whitespace-nowrap file-mention-marquee`,children:U(e.title,G)}):(0,V.jsx)(`span`,{className:`block truncate`,children:U(r,G)})]}),e.trailingLabel?(0,V.jsx)(`span`,{className:v(`max-w-[40%] shrink-0 truncate text-muted-foreground`,W?`typography-micro`:`typography-meta`),children:e.trailingLabel}):null]}),e.subtitle?(0,V.jsx)(`div`,{className:v(`truncate text-muted-foreground`,W?`typography-micro`:`typography-meta`),children:U(e.subtitle,G)}):null]})]},e.id)}),xe&&Re.length===0?(0,V.jsx)(`div`,{className:`flex items-center justify-center py-3`,children:(0,V.jsx)(k,{name:`refresh`,className:`h-4 w-4 animate-spin text-muted-foreground`})}):null,!xe&&Y.length===0&&(0,V.jsx)(`div`,{className:`px-3 py-2 typography-ui-label text-muted-foreground`,children:l(`chat.fileMentionAutocomplete.empty`)})]})}),!W&&(0,V.jsx)(`div`,{className:`px-3 pt-1 pb-1.5 border-t typography-meta text-muted-foreground`,children:l(`chat.autocomplete.keyboardHint`)})]})}),G=new Set([`new`,`fork`,`compact`,`reload`,`undo`,`redo`,`model`,`btw`]),K=(e,t)=>{if(!t||e.isSkill)return!1;let n=e.name?.trim().toLowerCase();return!!(n&&G.has(n))},Fe=(e,t)=>!e||t({name:e}),Ie=` `,Le=(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]===Ie&&e[r-2]===`/`&&(r-=2),e[r]===`/`?{start:r,end:n}:null},q=`text-[10px] leading-none uppercase font-bold tracking-tight px-1.5 py-1 rounded border flex-shrink-0`,J=v(q,`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)]`),Re=v(q,`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)]`),Y=v(q,`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)]`),ze=v(q,`bg-[var(--surface-muted)] text-muted-foreground border-[var(--interactive-border)]/60`),Be=(e,t)=>e.length===t.length&&e.every((e,n)=>e.id===t[n]?.id&&e.description===t[n]?.description),Ve=e=>{let t=!!e.sessionID;return{hasSession:t,canStartSessionCommand:t||e.hasNewDraft}},He=P.forwardRef(({searchQuery:e,onCommandSelect:t,onClose:n,directory:i,style:a,commandPolicy:o,commandContext:s,onRowsChange:c},l)=>{let{t:u}=ee(),d=p(e=>e.isMobile),f=w(e=>e.currentSessionId),m=w(e=>!!e.newSessionDraft?.open),h=w(P.useCallback(e=>f?e.getDirectoryForSession(f):void 0,[f])),g=ie(f??``,h??void 0),te=P.useMemo(()=>s??{sessionID:f??null,hasMessages:g.length>0,hasNewDraft:m},[s,f,g.length,m]),{hasSession:_,canStartSessionCommand:y}=P.useMemo(()=>Ve(te),[te]),b=te.hasMessages,[x,S]=P.useState([]),[re,C]=P.useState(!1),ae=ne({directory:i}),oe=P.useMemo(()=>ae.data??[],[ae.data]),se=ae.isFetching,[T,E]=P.useState(0),ce=P.useRef(0),D=P.useRef(!1),le=P.useRef([]),ue=P.useRef(null),de=P.useRef(!1),O=P.useRef(null),A=P.useRef(!1),j=P.useRef(null);P.useEffect(()=>{let e=e=>{let t=e.target;!t||!ue.current||ue.current.contains(t)||n()};return document.addEventListener(`pointerdown`,e,!0),()=>{document.removeEventListener(`pointerdown`,e,!0)}},[n]),P.useEffect(()=>{(async()=>{C(se);try{let t=oe.flatMap((e,t)=>e.source===`skill`?[]:[{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,scope:e.scope,reference:e.reference}]),n=[{id:`yuri:new`,name:`new`,source:`yuri`,description:u(`chat.commandAutocomplete.command.newDescription`),isBuiltIn:!0},..._&&!b?[{id:`yuri:init`,name:`init`,source:`yuri`,description:u(`chat.commandAutocomplete.command.initDescription`),isBuiltIn:!0}]:[],..._?[{id:`yuri:btw`,name:`btw`,source:`yuri`,description:u(`chat.btw.description`),isBuiltIn:!0},{id:`yuri:undo`,name:`undo`,source:`yuri`,description:u(`chat.commandAutocomplete.command.undoDescription`),isBuiltIn:!0},{id:`yuri:redo`,name:`redo`,source:`yuri`,description:u(`chat.commandAutocomplete.command.redoDescription`),isBuiltIn:!0},{id:`yuri:fork`,name:`fork`,source:`yuri`,description:u(`chat.commandAutocomplete.command.forkDescription`),isBuiltIn:!0},{id:`yuri:timeline`,name:`timeline`,source:`yuri`,description:u(`chat.commandAutocomplete.command.timelineDescription`),isBuiltIn:!0}]:[],{id:`yuri:model`,name:`model`,source:`yuri`,description:u(`chat.commandAutocomplete.command.modelDescription`),isBuiltIn:!0},{id:`yuri:compact`,name:`compact`,source:`yuri`,description:u(`chat.commandAutocomplete.command.compactDescription`),isBuiltIn:!0},...r()?[{id:`yuri:reload`,name:`reload`,source:`yuri`,description:u(`chat.commandAutocomplete.command.reloadDescription`),isBuiltIn:!0}]:[],..._?[{id:`yuri:summary`,name:`summary`,source:`yuri`,description:u(`chat.commandAutocomplete.command.summaryDescription`),isYuri:!0}]:[],...y?[{id:`yuri:workspace-review`,name:`workspace-review`,source:`yuri`,description:u(`chat.commandAutocomplete.command.workspaceReviewDescription`),isYuri:!0}]:[],...y?[{id:`yuri:craft-goal`,name:`craft-goal`,source:`yuri`,description:u(`chat.commandAutocomplete.command.craftGoalDescription`),isYuri:!0}]:[],...y?[{id:`yuri:catch-up`,name:`catch-up`,source:`yuri`,description:u(`chat.commandAutocomplete.command.catchUpDescription`),isYuri:!0}]:[],...y?[{id:`yuri:debug`,name:`debug`,source:`yuri`,description:u(`chat.commandAutocomplete.command.debugDescription`),isYuri:!0}]:[],...y?[{id:`yuri:weigh`,name:`weigh`,source:`yuri`,description:u(`chat.commandAutocomplete.command.weighDescription`),isYuri:!0}]:[],...y?[{id:`yuri:explore`,name:`explore`,source:`yuri`,description:u(`chat.commandAutocomplete.command.exploreDescription`),isYuri:!0}]:[],...t],i=!b,a=xe(n.filter(e=>(i||e.name!==`init`)&&(o?.(e)??!0)),e);S(e=>Be(e,a)?e:a)}catch{let t=!b,n=xe([{id:`yuri:new`,name:`new`,source:`yuri`,description:u(`chat.commandAutocomplete.command.newDescription`),isBuiltIn:!0},..._&&!b?[{id:`yuri:init`,name:`init`,source:`yuri`,description:u(`chat.commandAutocomplete.command.initDescription`),isBuiltIn:!0}]:[],..._?[{id:`yuri:btw`,name:`btw`,source:`yuri`,description:u(`chat.btw.description`),isBuiltIn:!0},{id:`yuri:undo`,name:`undo`,source:`yuri`,description:u(`chat.commandAutocomplete.command.undoDescription`),isBuiltIn:!0},{id:`yuri:redo`,name:`redo`,source:`yuri`,description:u(`chat.commandAutocomplete.command.redoDescription`),isBuiltIn:!0},{id:`yuri:fork`,name:`fork`,source:`yuri`,description:u(`chat.commandAutocomplete.command.forkDescription`),isBuiltIn:!0},{id:`yuri:timeline`,name:`timeline`,source:`yuri`,description:u(`chat.commandAutocomplete.command.timelineDescription`),isBuiltIn:!0}]:[],{id:`yuri:model`,name:`model`,source:`yuri`,description:u(`chat.commandAutocomplete.command.modelDescription`),isBuiltIn:!0},{id:`yuri:compact`,name:`compact`,source:`yuri`,description:u(`chat.commandAutocomplete.command.compactDescription`),isBuiltIn:!0},...r()?[{id:`yuri:reload`,name:`reload`,source:`yuri`,description:u(`chat.commandAutocomplete.command.reloadDescription`),isBuiltIn:!0}]:[],..._?[{id:`yuri:summary`,name:`summary`,source:`yuri`,description:u(`chat.commandAutocomplete.command.summaryDescription`),isYuri:!0}]:[],...y?[{id:`yuri:workspace-review`,name:`workspace-review`,source:`yuri`,description:u(`chat.commandAutocomplete.command.workspaceReviewDescription`),isYuri:!0}]:[],...y?[{id:`yuri:craft-goal`,name:`craft-goal`,source:`yuri`,description:u(`chat.commandAutocomplete.command.craftGoalDescription`),isYuri:!0}]:[],...y?[{id:`yuri:catch-up`,name:`catch-up`,source:`yuri`,description:u(`chat.commandAutocomplete.command.catchUpDescription`),isYuri:!0}]:[],...y?[{id:`yuri:debug`,name:`debug`,source:`yuri`,description:u(`chat.commandAutocomplete.command.debugDescription`),isYuri:!0}]:[],...y?[{id:`yuri:weigh`,name:`weigh`,source:`yuri`,description:u(`chat.commandAutocomplete.command.weighDescription`),isYuri:!0}]:[],...y?[{id:`yuri:explore`,name:`explore`,source:`yuri`,description:u(`chat.commandAutocomplete.command.exploreDescription`),isYuri:!0}]:[]].filter(e=>(t||e.name!==`init`)&&(o?.(e)??!0)),e);S(e=>Be(e,n)?e:n)}finally{C(!1)}})()},[e,b,_,y,oe,se,u,o]),P.useEffect(()=>{E(0)},[x]),P.useEffect(()=>{ce.current=T},[T]),P.useEffect(()=>{le.current[T]?.scrollIntoView({block:`nearest`})},[T]),P.useEffect(()=>{Ce(c,j,{rows:me(x,{skill:u(`chat.commandAutocomplete.badge.skill`),command:u(`chat.commandAutocomplete.badge.command`),system:u(`chat.commandAutocomplete.badge.system`)}),highlightedIndex:T})},[x,c,T,u]);let fe=P.useRef(c);fe.current=c,P.useEffect(()=>()=>{we(fe.current,j)},[]),P.useImperativeHandle(l,()=>({acceptIndex:(e,n=!0)=>{let r=x[e];r&&t(r,K(r,n))},handleKeyDown:e=>{let r=x.length;if(e===`Escape`){n();return}if(r!==0){if(e===`ArrowDown`){D.current=!0,E(e=>(e+1)%r);return}if(e===`ArrowUp`){D.current=!0,E(e=>(e-1+r)%r);return}if(e===`Enter`||e===`Tab`){let n=(ce.current%r+r)%r,i=x[n];i&&t(i,K(i,e===`Enter`))}}}}),[x,n,t]);let _e=e=>{let t=pe(e);switch(e.name){case`new`:return(0,V.jsx)(k,{name:t,className:`h-3.5 w-3.5`});case`init`:return(0,V.jsx)(k,{name:t,className:`h-3.5 w-3.5 text-green-500`});case`undo`:return(0,V.jsx)(k,{name:t,className:`h-3.5 w-3.5 text-orange-500`});case`redo`:return(0,V.jsx)(k,{name:t,className:`h-3.5 w-3.5 text-orange-500`});case`timeline`:case`reload`:return(0,V.jsx)(k,{name:t,className:`h-3.5 w-3.5`});case`compact`:return(0,V.jsx)(k,{name:t,className:`h-3.5 w-3.5 text-purple-500`});case`goal`:return(0,V.jsx)(k,{name:t,className:`h-3.5 w-3.5`});case`review`:return(0,V.jsx)(k,{name:t,className:`h-3.5 w-3.5 text-blue-500`});case`test`:case`build`:case`run`:return(0,V.jsx)(k,{name:t,className:`h-3.5 w-3.5 text-cyan-500`});default:return e.isBuiltIn?(0,V.jsx)(k,{name:t,className:`h-3.5 w-3.5 text-yellow-500`}):(0,V.jsx)(k,{name:t,className:`h-3.5 w-3.5 text-muted-foreground`})}};return(0,V.jsxs)(he,{ref:ue,isMobile:d,className:`max-w-[450px] max-h-64`,style:a,children:[(0,V.jsx)(ve,{preventOverscroll:!0,outerClassName:`flex-1 min-h-0`,className:`px-0 py-1.5`,children:re?(0,V.jsx)(`div`,{className:`flex items-center justify-center py-4`,children:(0,V.jsx)(k,{name:`refresh`,className:`h-4 w-4 animate-spin text-muted-foreground`})}):(0,V.jsxs)(`div`,{children:[x.map((n,r)=>{let i=n.isBuiltIn,a=n.isYuri;return(0,V.jsxs)(`div`,{ref:e=>{le.current[r]=e},className:v(`flex gap-2 px-2 py-2 cursor-pointer rounded-lg`,d?`items-center`:`items-start`,ge(d,r===T),!d&&r===T&&`bg-interactive-selection/35`),onMouseDown:e=>e.preventDefault(),onPointerDown:e=>{e.pointerType===`touch`&&(O.current={x:e.clientX,y:e.clientY},A.current=!1)},onPointerMove:e=>{if(e.pointerType!==`touch`||!O.current)return;let t=e.clientX-O.current.x,n=e.clientY-O.current.y;Math.hypot(t,n)>6&&(A.current=!0)},onPointerUp:e=>{if(e.pointerType!==`touch`)return;let r=A.current;O.current=null,A.current=!1,!r&&(e.preventDefault(),e.stopPropagation(),de.current=!0,t(n,K(n,d)))},onPointerCancel:()=>{O.current=null,A.current=!1},onClick:()=>{if(de.current){de.current=!1;return}t(n,K(n,d))},onMouseMove:()=>{D.current=!1,E(r)},children:[(0,V.jsx)(`div`,{className:v(!d&&`mt-0.5`),children:_e(n)}),(0,V.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsxs)(`span`,{className:`typography-ui-label font-medium`,children:[`/`,U(n.name,e)]}),n.isSkill?(0,V.jsx)(`span`,{className:J,children:u(`chat.commandAutocomplete.badge.skill`)}):(0,V.jsx)(`span`,{className:J,children:u(`chat.commandAutocomplete.badge.command`)}),a?(0,V.jsx)(`span`,{className:ze,children:`Yuri`}):i?(0,V.jsx)(`span`,{className:ze,children:u(`chat.commandAutocomplete.badge.system`)}):n.scope?(0,V.jsx)(`span`,{className:n.scope===`project`?Y:Re,children:n.scope}):null,n.agent&&(0,V.jsx)(`span`,{className:ze,children:n.agent})]}),n.description&&!d&&(0,V.jsx)(`div`,{className:`typography-meta text-muted-foreground mt-0.5 truncate`,children:U(n.description,e)})]})]},n.id)}),x.length===0&&(0,V.jsx)(`div`,{className:`px-3 py-2 typography-ui-label text-muted-foreground`,children:u(`chat.commandAutocomplete.empty`)})]})}),!d&&(0,V.jsx)(`div`,{className:`px-3 pt-1 pb-1.5 border-t typography-meta text-muted-foreground`,children:u(`chat.autocomplete.keyboardHint`)})]})});He.displayName=`CommandAutocomplete`;var Ue=e=>e instanceof Error?e.name===`AbortError`||e.name===`CancelledError`||e.name===`Error`&&e.message===`CancelledError`:!1,X=1e4,We=6e4,Ge=5e3,Ke=3e4,qe=6e4,Je=25,Ye=40,Xe=2,Ze=15e3,Qe=500,$e=30,et=20971520,tt=new Map,nt=new Map,rt=new Map,it=new Map,at=new Map,ot=new Map,st=new WeakMap,ct=e=>{let t=st.get(e);return t||(t=new Set(e.files.map(e=>e.path)),st.set(e,t)),t},lt=(e,t)=>`${t}:${e}`,ut=e=>nt.get(e)??0,dt=e=>{let t=ut(e)+1;return nt.set(e,t),t},ft=e=>{let t=(rt.get(e)??0)+1;return rt.set(e,t),t},pt=e=>{let t=tt.get(e);if(t)return t;let n=new Set;return tt.set(e,n),n},Z=()=>({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}),mt=(e,t=$e,n=et)=>{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},ht=(e,t)=>!e&&!t?!1:!e||!t||e.remote!==t.remote||e.branch!==t.branch||e.ahead!==t.ahead||e.behind!==t.behind,gt=e=>{let t=e?.trim()??``;return t===`?`?``:t},_t=(e,t)=>{let n=new Set,r=!1,i=!e;e&&(i=e.ahead!==t.ahead||e.behind!==t.behind||e.current!==t.current||e.tracking!==t.tracking||e.isClean!==t.isClean||t.upstreamComparison!==void 0&&ht(e.upstreamComparison,t.upstreamComparison)||t.diffStats!==void 0&&e.diffStats===void 0);let a=new Map;for(let t of e?.files??[])a.set(t.path,t);for(let e of t.files??[]){let t=a.get(e.path);if(!t){n.add(e.path),gt(e.index)&&(r=!0);continue}a.delete(e.path),(t.index!==e.index||t.working_dir!==e.working_dir)&&n.add(e.path),!r&>(t.index)!==gt(e.index)&&(r=!0)}for(let[e,t]of a)n.add(e),gt(t.index)&&(r=!0);let o=t.diffStats,s=e?.diffStats;if(o!==void 0&&o!==s){let e=s??{};for(let t in o){let r=o[t],i=e[t];(!i||i.insertions!==r.insertions||i.deletions!==r.deletions)&&n.add(t)}for(let t in e)t in o||n.add(t)}return{changed:i||n.size>0,changedPaths:n,indexChanged:r}},vt=e=>!e||e.trim().length===0,yt=e=>(e||``).trim()===`U`,bt=e=>{let t=(e.index||``).trim(),n=(e.working_dir||``).trim();if(yt(t)||yt(n))return e;let r=t===`?`||n===`?`?`A`:t||n||` `;return{...e,index:r,working_dir:` `}},xt=e=>{let t=(e.index||``).trim(),n=(e.working_dir||``).trim();if(yt(t)||yt(n))return e;let r=n||(t===`A`||t===`?`?`?`:t)||` `;return{...e,index:` `,working_dir:r}},St=e=>vt(e.index)&&vt(e.working_dir),Q=i()(o((e,t)=>({directories:new Map,activeDirectory:null,setActiveDirectory:n=>{let{activeDirectory:r,directories:i}=t();if(r!==n)if(r&&dt(r),n&&dt(n),n&&!i.has(n)){let t=new Map(i);t.set(n,Z()),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=lt(n,a),s=it.get(o)??(a===`light`?it.get(lt(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||=Z(),!a){let r=new Map(t().directories),i=r.get(n)??Z();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)>We,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),d=t().directories.get(n)??Z(),f=ot.get(n),p=f?.received===u&&f.stored===d.status?null:_t(d.status,u);if(p?.changed){c=!0;let r=new Map(t().directories),i=r.get(n)??Z(),{changedPaths:s,indexChanged:l}=p,d=new Map(i.diffCache);for(let e of s)d.delete(e);let f=s.size>0;f&&dt(n);let m={...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:m,diffCache:d,indexRevision:l?i.indexRevision+1:i.indexRevision,lastRepoCheckAt:o?a:i.lastRepoCheckAt,lastStatusFetch:Date.now(),lastStatusChange:f?Date.now():i.lastStatusChange}),e({directories:r}),ot.set(n,{received:u,stored:m})}else{ot.set(n,{received:u,stored:d.status});let r=new Map(t().directories),i=r.get(n)??Z();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)??Z();r.set(n,{...i,isLoadingStatus:!1}),e({directories:r})}}return c})();it.set(o,c);try{return await c}finally{it.get(o)===c&&it.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`?bt(e):xt(e);t!==e&&(l=!0),St(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=ft(r);{let n=new Map(t().directories),i=n.get(r)??Z();n.set(r,{...i,isLoadingBranches:!0}),e({directories:n})}try{let c=a.force?await S(r,i,void 0,o):await C(r,i,void 0,o);if(s!==rt.get(r)||o!==n())return;let l=new Map(t().directories),u=l.get(r)??Z();l.set(r,{...u,branches:c,branchesTransportIdentity:o,isLoadingBranches:!1,lastBranchesFetch:Date.now()}),e({directories:l})}catch(i){if(Ue(i)||console.error(`Failed to fetch git branches:`,i),s!==rt.get(r)||o!==n())return;let a=new Map(t().directories),c=a.get(r)??Z();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)??Z();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)??Z();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)??Z();i.set(n,{...a,isLoadingLog:!1}),e({directories:i})}},fetchIdentity:async(n,r)=>{{let r=new Map(t().directories),i=r.get(n)??Z();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)??Z();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)??Z();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=Z();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>X||!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)??Z(),s=new Map(o.diffCache);s.set(r,{...i,fetchedAt:Date.now()});let c=mt(s);a.set(n,{...o,diffCache:c}),e({directories:a})},clearDiffCache:n=>{dt(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,Je);await t().prefetchDiffs(e,n,i,{maxFiles:Je})},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=Ye}=a,c=Math.min(Math.max(1,s),$e),l=ct(o.status),u=o.status.diffStats,d=pt(n),f=[],p=new Set;for(let e of i){if(p.size>=c)break;if(!e||p.has(e)||!l.has(e))continue;let t=u?.[e];t&&t.insertions+t.deletions>Qe||(p.add(e),!o.diffCache.has(e)&&(d.has(e)||f.push(e)))}let m=f;if(m.length===0)return;let h=ut(n);if(typeof document<`u`&&document.hidden)return;m.forEach(e=>d.add(e));let g=0,ee=[],te=()=>{let e=g;return g+=1,e<m.length?m[e]:null},_=async e=>{let t=r.getGitFileDiff(n,{path:e}),i=new Promise((e,t)=>{setTimeout(()=>t(Error(`Timed out after ${Ze}ms`)),Ze)}),a=await Promise.race([t,i]);return{path:e,diff:{original:a.original??``,modified:a.modified??``,isBinary:a.isBinary}}},v=async()=>{for(;;){if(h!==ut(n))return;let e=te();if(!e)return;try{ee.push(await _(e))}catch{}finally{d.delete(e)}}},y=Math.min(Xe,m.length);if(await Promise.allSettled(Array.from({length:y},()=>v())),m.forEach(e=>d.delete(e)),h!==ut(n))return;let b=new Map(t().directories),x=b.get(n);if(!x)return;let ne=new Map(x.diffCache),S=Date.now();ee.forEach(e=>{!e.diff.isBinary&&e.diff.original===``&&e.diff.modified===``||ne.set(e.path,{...e.diff,fetchedAt:S})});let re=mt(ne);b.set(n,{...x,diffCache:re}),e({directories:b})},setLogMaxCount:(n,r)=>{let i=new Map(t().directories),a=i.get(n)??Z();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<Ge||await t().fetchStatus(e,n,{silent:!!r?.status})},ensureAll:(e,n)=>{let r=at.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)>=Ge)&&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>=Ke)&&o.push(t().fetchBranches(e,n)),(!a.log||i-a.lastLogFetch>=X)&&o.push(t().fetchLog(e,n)),(!a.identity||i-a.lastIdentityFetch>=qe)&&o.push(t().fetchIdentity(e,n)),o.length>0&&await Promise.all(o)})();return at.set(e,i),i.finally(()=>{at.get(e)===i&&at.delete(e)}),i},refresh:async(e,n={})=>{let{activeDirectory:r}=t();r&&await t().fetchAll(r,e,n)}}),{name:`git-store`})),Ct=e=>{let t=(0,B.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),Q(n)},wt=e=>{let r=(0,B.c)(3),i=P.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],Q(a)},Tt=e=>{let t=(0,B.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),Q(n)},Et=e=>{let t=(0,B.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),Q(n)},Dt=e=>{let t=(0,B.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),Q(n)},Ot=e=>{let t=(0,B.c)(3),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=new Map,t[0]=n):n=t[0];let r=P.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),Q(i)},kt=e=>{let t=(0,B.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),Q(n)},At=e=>{let t=(0,B.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),Q(n)},jt=e=>{let t=(0,B.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),Q(n)},Mt=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)}},$=e=>String(e||``).trim().replace(/^refs\/heads\//,``).replace(/^heads\//,``).replace(/^remotes\//,``),Nt=e=>e.branchName?$(e.branchName):e.mode===`existing`?$(e.existingBranch||e.preferredName||``):$(e.preferredName||``),Pt=async e=>{let t=await ye(e);try{let n=Mt((await A(e)).branches?.[t]?.tracking||null);if(n?.remote)return n.remote}catch{}try{let t=Mt((await j(e)).tracking);if(t?.remote)return t.remote}catch{}return null},Ft=async(e,t)=>{let n=await Pt(e),r=$(t);return!n||!r?null:{setUpstream:!0,upstreamRemote:n,upstreamBranch:r}},It=async(e,t,n)=>{let r=Nt(t),i=n?.resolvedRootTrackingRemote,a=i===void 0?await Ft(e,r):i&&$(r)?{setUpstream:!0,upstreamRemote:i,upstreamBranch:$(r)}:null;return a?{...t,setUpstream:t.setUpstream??a.setUpstream,upstreamRemote:t.upstreamRemote||a.upstreamRemote,upstreamBranch:t.upstreamBranch||a.upstreamBranch}:t},Lt=async(e,t,n)=>{let r=await It(e.path,t,n);return be(e,r)},Rt=`yuri:lastWorktreeSourceBranch`,zt=({mode:e,sourceBranch:t,linkedPr:n,selectedBranch:r})=>e===`existing-branch`?r||null:n?null:t||null,Bt=({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},Vt=(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?` `:``}`},Ht=(e,t,n)=>{let r=Vt(e,t,n);return`${t.length===0&&!/^\s/.test(r)?` `:``}${r}${n.length===0&&!/\s$/.test(r)?` `:``}`},Ut=(e,t,n,r)=>{let i=e.slice(0,t),a=e.slice(n),o=Ht(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}},Wt=(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.some(e=>e.range.start<t.range.end&&t.range.start<e.range.end)?[...e]:[...e,t]},Gt=(e,t)=>t<e.length&&e[t]===` `?t+1:t;export{Fe as C,Ee as D,De as E,N as O,Le as S,Oe as T,Ot as _,Rt as a,Et as b,Lt as c,Dt as d,wt as f,Tt as g,kt as h,Ht as i,Pt as l,At as m,Wt as n,Bt as o,jt as p,Ut as r,zt as s,Gt as t,It as u,Ct as v,W as w,He as x,Q as y};
|