@yuriai/web 0.2.34-beta.4 → 0.2.34

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/dist/assets/{AssistantContactStatus-C4ThLOq7.js → AssistantContactStatus-PWo73pfN.js} +3 -3
  2. package/dist/assets/{AssistantUnreadBadge-hQZ4K5Mn.js → AssistantUnreadBadge-PRiDJ-Ys.js} +1 -1
  3. package/dist/assets/{AssistantView-Co3DeAd6.js → AssistantView-Cuz4v_fG.js} +1 -1
  4. package/dist/assets/{DiagramView-pYJ_rr2l.js → DiagramView-dxbQ6MXl.js} +1 -1
  5. package/dist/assets/{GuiPluginSurface-DpmtEUSJ.js → GuiPluginSurface--HkD4nKM.js} +1 -1
  6. package/dist/assets/MarkdownRenderer-CJAX6rqh.js +2 -0
  7. package/dist/assets/{MarkdownRendererImpl-B6ErJ4EB.js → MarkdownRendererImpl-BcRYBCHW.js} +1 -1
  8. package/dist/assets/{MarkstreamRendererImpl-j17VTK2L.js → MarkstreamRendererImpl-zQ6bU9wm.js} +1 -1
  9. package/dist/assets/{MobileDetailNavigation-CFf-QNEw.js → MobileDetailNavigation-pEUXnpqd.js} +1 -1
  10. package/dist/assets/{MobileShareBridge-lEVFU_Ro.js → MobileShareBridge-13ws-R6X.js} +1 -1
  11. package/dist/assets/{MobileTabPageHeader-C5Dtuye8.js → MobileTabPageHeader-BxUA9rmy.js} +1 -1
  12. package/dist/assets/{MultiRunWindow-Bd8zpRcz.js → MultiRunWindow-BEMTJndj.js} +1 -1
  13. package/dist/assets/{SettingsView-BVjXaBTd.js → SettingsView-DI-zla9J.js} +1 -1
  14. package/dist/assets/{SettingsWindow-BwIlvY3O.js → SettingsWindow-Cdhi7oJR.js} +1 -1
  15. package/dist/assets/{SetupTourDialog-NZvWHSCg.js → SetupTourDialog-DoeHKyr7.js} +1 -1
  16. package/dist/assets/{TerminalView-U8j8Kko_.js → TerminalView-BIKNgq3M.js} +1 -1
  17. package/dist/assets/{ToolOutputDialog-BFHLF7uh.js → ToolOutputDialog-Wq2Qn7Nh.js} +1 -1
  18. package/dist/assets/{VoiceSettings-CFcLPtb6.js → VoiceSettings-Y1dbxZXa.js} +1 -1
  19. package/dist/assets/{appThemeRegistry-BPdYCLOO.js → appThemeRegistry-ClsRp7sO.js} +1 -1
  20. package/dist/assets/{capgoAdapter-iYI-U-Ut.js → capgoAdapter-C3LxG5Eu.js} +1 -1
  21. package/dist/assets/{gitApi-C1vpN1bY.js → gitApi-DxUmZcUw.js} +1 -1
  22. package/dist/assets/{insertionBoundaries-B4bC9qgT.js → insertionBoundaries-DUy8i_LT.js} +1 -1
  23. package/dist/assets/{main-BmWysO0j.js → main-B1kgopEY.js} +2 -2
  24. package/dist/assets/{main-DSCosXET.js → main-D7TMj7hd.js} +4 -4
  25. package/dist/assets/{mcpQueries-Di9eZpfK.js → mcpQueries-UE2a-IBc.js} +1 -1
  26. package/dist/assets/{miniChat-Cey3lBWf.js → miniChat-D-04iNeR.js} +2 -2
  27. package/dist/assets/{mobile-C5TNBQsM.js → mobile-CDPRNGIg.js} +2 -2
  28. package/dist/assets/{mobileBackNavigation-BkqQCUgK.js → mobileBackNavigation-DaCBsLLk.js} +1 -1
  29. package/dist/assets/{multirun-BMtax1t7.js → multirun-C-f8cwos.js} +1 -1
  30. package/dist/assets/{native-config-gu6Y4GgW.js → native-config-C32KBsgV.js} +1 -1
  31. package/dist/assets/{projectMeta-BWbhUUto.js → projectMeta-DD7W5l0p.js} +1 -1
  32. package/dist/assets/{pwa-COSzAKZr.js → pwa-BApESewB.js} +1 -1
  33. package/dist/assets/{queue-abort-optimistic-DtYEhMau.js → queue-abort-optimistic-DEras0MF.js} +1 -1
  34. package/dist/assets/{readiness-B-XfWILI.js → readiness-DSB26e24.js} +1 -1
  35. package/dist/assets/{renderElectronMiniChatApp-CSjCLgOn.js → renderElectronMiniChatApp-BzRnk_52.js} +2 -2
  36. package/dist/assets/{renderMobileApp-Cz0fF7ge.js → renderMobileApp-BEWiG7ie.js} +4 -4
  37. package/dist/assets/{runtimeConfig-BHspntnx.js → runtimeConfig-CRxel2dc.js} +1 -1
  38. package/dist/assets/{runtimeEndpointReset-DIBGo-YW.js → runtimeEndpointReset-Dc7CPkqY.js} +3 -3
  39. package/dist/assets/{sessionLookup-C5PqXLxX.js → sessionLookup-CV0eH5rT.js} +1 -1
  40. package/dist/assets/{speechSettingsQueries-CH_dJTpo.js → speechSettingsQueries-C_e3XdqK.js} +1 -1
  41. package/dist/assets/types-DUFadVpY.js +2 -0
  42. package/dist/assets/{useAppFontEffects-WiAE9DFB.js → useAppFontEffects-B-VpUGq4.js} +5 -5
  43. package/dist/assets/{useDesktopWindowControlsLayout-CA5WUl2y.js → useDesktopWindowControlsLayout-DMCQ5xgT.js} +1 -1
  44. package/dist/assets/{useEffectiveDirectory-Bs2Faeyd.js → useEffectiveDirectory-F4aXdQ21.js} +1 -1
  45. package/dist/assets/{useMobileNavigationStore-_FYcDNuL.js → useMobileNavigationStore-DHX2bCjA.js} +4 -4
  46. package/dist/assets/{usePluginsStore-CXtG20Qq.js → usePluginsStore-YObSp0OZ.js} +1 -1
  47. package/dist/assets/{useWorkerHighlightedLines-Deu-7c07.js → useWorkerHighlightedLines-Di0GTxuY.js} +1 -1
  48. package/dist/index.html +5 -5
  49. package/dist/mini-chat.html +5 -5
  50. package/dist/mobile.html +5 -5
  51. package/package.json +1 -1
  52. package/dist/assets/MarkdownRenderer-DGzKU_XU.js +0 -2
  53. package/dist/assets/types-C5r6A1vW.js +0 -2
@@ -1,4 +1,4 @@
1
- import{n as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,n}from"./runtime-switch-DEZ1K7qW.js";import{n as r}from"./runtime-fetch-D0YWp3FJ.js";import{t as i}from"./runtimeAPIRegistry-C2VogTny.js";import{$ as a,A as o,At as s,D as c,F as l,G as u,H as d,I as f,J as p,K as m,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,m as ye,nt as be,ot as xe,pt as Se,q as Ce,r as we,s as Te,st as Ee,tt as De,ut as Oe,v as ke,vt as Ae,x as je,y as Me}from"./gitApiHttp-MWsHNHuo.js";import{ki as h,p as g,u as Ne}from"./useMobileNavigationStore-_FYcDNuL.js";var _=`/api/magic-prompts`,Pe=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.
1
+ import{n as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,n}from"./runtime-switch-DEZ1K7qW.js";import{n as r}from"./runtime-fetch-D0YWp3FJ.js";import{t as i}from"./runtimeAPIRegistry-C2VogTny.js";import{$ as a,A as o,At as s,D as c,F as l,G as u,H as d,I as f,J as p,K as m,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,m as ye,nt as be,ot as xe,pt as Se,q as Ce,r as we,s as Te,st as Ee,tt as De,ut as Oe,v as ke,vt as Ae,x as je,y as Me}from"./gitApiHttp-MWsHNHuo.js";import{ki as h,p as g,u as Ne}from"./useMobileNavigationStore-DHX2bCjA.js";var _=`/api/magic-prompts`,Pe=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{r as e}from"./rolldown-runtime-hePW80VL.js";import{c as t,i as n}from"./runtime-switch-DEZ1K7qW.js";import{T as r}from"./desktop-BAmoc_34.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}from"./gitApiHttp-MWsHNHuo.js";import{r as d,x as f}from"./useUIStore-BerIUSLP.js";import{A as p,k as m}from"./bootstrap-C8paoQ0j.js";import{n as h}from"./vendor-react-DlzBev0S.js";import{i as g}from"./vendor-reactuses-core-DWo5Wn6R.js";import{f as ee,r as _,u as te}from"./button-C-gRcs_2.js";import{$r as v,Kr as y,Qn as b,St as x,V as S,Wi as ne,Zn as C,_a as re,ea as ie,ft as ae,ki as oe,p as w,va as T,w as E,x as D}from"./useMobileNavigationStore-_FYcDNuL.js";import{a as se,g as O,o as ce,p as le,s as ue}from"./fileMentionAutocompleteState-BZJqfgae.js";import{t as k}from"./AgentAvatar-DLzcNrQ0.js";import{n as A}from"./Icon-OJf0qBKf.js";import{g as j,v as M}from"./gitApi-C1vpN1bY.js";import{c as de,d as fe,l as pe,n as me,r as he,t as ge}from"./fileMentionTouchSelection-ByaQJcTS.js";import{n as _e}from"./textarea-BHgcxJdC.js";import{f as ve,o as N}from"./projectMeta-BWbhUUto.js";var ye=(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=O([...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)},be=(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}),P=(e,t)=>e.highlightedIndex===t.highlightedIndex&&be(e.rows,t.rows),F=(e,t)=>be(e,t)?e:t.slice(),xe=(e,t,n)=>{e&&(t.current&&P(t.current,n)||(t.current=n,e(n)))},Se=(e,t)=>{t.current=null,e?.({rows:[],highlightedIndex:0})},I=e(c(),1),L=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},R=e=>/^[A-Za-z]:\//.test(e)?e.toLowerCase():e,z=(e,t)=>{let n=L(t),r=L(e);if(!n||!r)return!1;let i=R(n),a=R(r);return a===i||a.startsWith(`${i}/`)},Ce=e=>{if(!e||typeof e!=`object`)return{};let t=e,n={};for(let[e,r]of Object.entries(t)){let t=L(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=>L(e)).filter(e=>z(e,t)))):[],o=Array.isArray(i.expandedPaths)?Array.from(new Set(i.expandedPaths.filter(e=>typeof e==`string`).map(e=>L(e)).filter(e=>z(e,t)))):[],s=typeof i.selectedPath==`string`?L(i.selectedPath):null,c=s&&z(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},B=(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},V=e=>e?{...e,touchedAt:Date.now()}:{openPaths:[],selectedPath:null,expandedPaths:[],touchedAt:Date.now()},we=i()(o(a((e,t)=>({byRoot:{},addOpenPath:(t,n,r)=>{let i=L((t||``).trim()),a=L((n||``).trim());!i||!a||!r?.allowOutsideRoot&&!z(a,i)||e(e=>{let t=e.byRoot[i],n=V(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:B({...e.byRoot,[i]:{...n,openPaths:o,selectedPath:s}},20)}})},removeOpenPath:(t,n)=>{let r=L((t||``).trim()),i=L((n||``).trim());!r||!i||e(e=>{let t=e.byRoot[r];if(!t)return e;let n=R(i),a=e=>R(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:B({...e.byRoot,[r]:{...t,openPaths:s,selectedPath:c,touchedAt:Date.now()}},20)}})},removeOpenPathsByPrefix:(t,n)=>{let r=L((t||``).trim()),i=L((n||``).trim());!r||!i||e(e=>{let t=e.byRoot[r];if(!t)return e;let n=R(i),a=n.endsWith(`/`)?n:`${n}/`,o=e=>{let t=R(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:B({...e.byRoot,[r]:{...t,openPaths:s,selectedPath:c,touchedAt:Date.now()}},20)}})},removeExpandedPathsByPrefix:(t,n)=>{let r=L((t||``).trim()),i=L((n||``).trim());!r||!i||e(e=>{let t=e.byRoot[r];if(!t)return e;let n=R(i),a=n.endsWith(`/`)?n:`${n}/`,o=t.expandedPaths.filter(e=>{let t=R(e);return t!==n&&!t.startsWith(a)});return o.length===t.expandedPaths.length?e:{byRoot:B({...e.byRoot,[r]:{...t,expandedPaths:o,touchedAt:Date.now()}},20)}})},setSelectedPath:(t,n,r)=>{let i=L((t||``).trim()),a=n?L(n.trim()):null;!i||a&&!r?.allowOutsideRoot&&!z(a,i)||e(e=>{let t=e.byRoot[i],n=V(t),r=a&&!n.openPaths.includes(a)?[...n.openPaths,a]:n.openPaths;return t&&t.selectedPath===a&&r===t.openPaths?e:{byRoot:B({...e.byRoot,[i]:{...n,openPaths:r,selectedPath:a}},20)}})},ensureSelectedPath:e=>{let n=L((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=L((t||``).trim()),i=L((n||``).trim());!r||!i||!z(i,r)||e(e=>{let t=e.byRoot[r],n=V(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:B({...e.byRoot,[r]:{...n,expandedPaths:a}},20)}})},expandPath:(t,n)=>{let r=L((t||``).trim()),i=L((n||``).trim());!r||!i||!z(i,r)||e(e=>{let t=e.byRoot[r],n=V(t);return n.expandedPaths.includes(i)&&t?e:{byRoot:B({...e.byRoot,[r]:{...n,expandedPaths:[...n.expandedPaths,i]}},20)}})},expandPaths:(t,n)=>{let r=L((t||``).trim());if(!r||!n||n.length===0)return;let i=n.map(e=>L((e||``).trim())).filter(e=>e&&z(e,r));i.length!==0&&e(e=>{let t=e.byRoot[r],n=V(t),a=new Set(n.expandedPaths),o=i.filter(e=>!a.has(e));return o.length===0?e:{byRoot:B({...e.byRoot,[r]:{...n,expandedPaths:[...n.expandedPaths,...o]}},20)}})}}),{name:`files-view-tabs-store`,version:2,storage:f(),migrate:e=>{if(!e||typeof e!=`object`)return{byRoot:{}};let t=e.byRoot;return{byRoot:Ce(t)}},partialize:e=>({byRoot:Ce(e.byRoot)})}),{name:`files-view-tabs-store`})),H=h(),Te=(e,t)=>{let n=(0,H.c)(4),r=t===void 0?200:t,[i,a]=I.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]),I.useEffect(o,s),i},Ee=()=>{let e=(0,H.c)(17),t=w(De),n=x(),r;e[0]===t?r=e[1]:(r=e=>t?e.getAttachment(t):void 0,e[0]=t,e[1]=r);let i=E(r),a=w(Oe),o=w(ke),s=T(Ae),c=T(je),u=l(Me);if(t){let r;e[2]===i?r=e[3]:(r=D(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 De(e){return e.currentSessionId}function Oe(e){return e.worktreeMetadata}function ke(e){return e.newSessionDraft}function Ae(e){return e.activeProjectId}function je(e){return e.projects}function Me(e){return e.currentDirectory}var U=s(),W=`bg-transparent font-[inherit] text-[var(--primary-base)]`,G=(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,U.jsx)(`mark`,{className:W,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},K=I.forwardRef(({searchQuery:e,onFileSelect:t,onAgentSelect:n,onSkillSelect:r,onSessionSelect:i,onClose:a,style:o,onRowsChange:s},c)=>{let{t:l}=ee(),f=Ee()??``,h=w(e=>e.currentSessionId),b=v(e=>e.activeSessions),x=S({enabled:!!i}),C=T(e=>e.activeProjectId),re=T(e=>e.projects),ae=I.useMemo(()=>re.find(e=>e.id===C)?.path??null,[C,re]),E=I.useMemo(()=>{let e=ae||f;return e?e.replace(/\\/g,`/`).replace(/\/+$/,``):null},[ae,f]),D=we(e=>E?e.byRoot[E]:void 0),O=oe(e=>e.agents),j=u(e=>e.searchFiles),M=Te(e,180),fe=p(),pe=m(),[ve,N]=I.useState([]),[ye,be]=I.useState(!1),[P,F]=I.useState(0),L=I.useRef(0),R=I.useRef({query:e,directory:f,ids:[]}),[z,Ce]=I.useState(360),[B,V]=I.useState({}),[H,De]=I.useState({}),Oe=I.useRef([]),ke=I.useRef([]),Ae=I.useRef([]),je=I.useRef(null),Me=I.useRef(null),W=I.useRef(null);W.current||=ge();let K=d(e=>e.isMobile),q=(e??``).trim(),J=ie({directory:f||null}),Ne=I.useMemo(()=>r?J.data??[]:[],[r,J.data]),Pe=I.useMemo(()=>{if(!E||!D)return[];let e=[D.selectedPath,...D.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(`${E}/`)?e.slice(E.length+1):e;n.push({name:i,path:e,relativePath:a,extension:i.includes(`.`)?i.split(`.`).pop()?.toLowerCase():void 0})}return ue(n,q,{limit:6})},[q,E,D]),Fe=I.useMemo(()=>n?ne(O).filter(e=>e.mode!==`primary`):[],[O,n]),Y=I.useMemo(()=>i?se({sessions:y(b,x),currentSessionId:h,searchQuery:q}):[],[b,h,x,q,i]),Ie=Pe,Le=ve,X=I.useMemo(()=>de({skills:Ne,agents:Fe,sessions:Y,recentFiles:Ie,pathHits:Le,searchQuery:q,untitledSession:l(`chat.fileMentionAutocomplete.untitledSession`),sessionBadge:l(`chat.fileMentionAutocomplete.sessionType`),skillBadge:l(`chat.commandAutocomplete.badge.skill`)}),[Ne,Fe,Y,Ie,Le,q,l]);I.useEffect(()=>{let e=e=>{let t=e.target;!t||!je.current||je.current.contains(t)||a()};return document.addEventListener(`pointerdown`,e,!0),()=>{document.removeEventListener(`pointerdown`,e,!0)}},[a]),I.useEffect(()=>{if(!f){N([]);return}let e=(M??``).trim(),t=le(e);if(!t){N([]);return}let n=!1;be(!0);let r={includeHidden:fe,respectGitignore:!pe};return Promise.all([j(f,t,80,{...r,type:`file`}),j(f,t,40,{...r,type:`directory`})]).then(([t,r])=>{if(n)return;let i=new Set(Pe.map(e=>e.path));N(ce({files:t,directories:r,query:e,excludePaths:i,limit:20}))}).catch(()=>{n||N([])}).finally(()=>{n||be(!1)}),()=>{n=!0}},[f,M,Pe,j,fe,pe]),I.useLayoutEffect(()=>{let t=R.current,n=t.ids[L.current],r=t.query===e&&t.directory===f?Math.max(0,X.findIndex(e=>e.id===n)):0;R.current={query:e,directory:f,ids:X.map(e=>e.id)},L.current=r,F(r)},[X,e,f]),I.useEffect(()=>{V({}),De({})},[X]),I.useEffect(()=>{Oe.current[P]?.scrollIntoView({block:`nearest`})},[P]),I.useEffect(()=>{let e=null,t=()=>{e!==null&&cancelAnimationFrame(e),e=requestAnimationFrame(()=>{let e={},t={};ke.current.forEach((n,r)=>{if(!n)return;let i=Ae.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}}),V(e),De(t)})};return t(),window.addEventListener(`resize`,t),()=>{e!==null&&cancelAnimationFrame(e),window.removeEventListener(`resize`,t)}},[X]),I.useEffect(()=>{let e=ke.current[P];if(!e)return;let t=()=>{let t=e.clientWidth;t>0&&Ce(t)};if(t(),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(t);return n.observe(e),()=>{n.disconnect()}},[P]);let Re=g(e=>{t(e)}),ze=g(e=>{n?.(e)}),Be=g(e=>{i?.(e)}),Ve=g(e=>{r?.(e)}),He=(e,t)=>({onMouseDown:e=>e.preventDefault(),onPointerDown:e=>{e.pointerType===`touch`&&W.current?.pointerDown(e.clientX,e.clientY)},onPointerMove:e=>{e.pointerType===`touch`&&W.current?.pointerMove(e.clientX,e.clientY)},onPointerUp:e=>{e.pointerType===`touch`&&(W.current?.pointerUp(t)??!1)&&(e.preventDefault(),e.stopPropagation())},onPointerCancel:()=>W.current?.pointerCancel(),onClick:()=>{W.current?.click(t)},onMouseMove:()=>{L.current=e,F(e)}}),Ue=e=>{let t=X.length;if(t===0)return;let n=(e%t+t)%t,r=X[n];if(r.agentName!==void 0){ze(r.agentName);return}if(r.id.startsWith(`skill:`)){let e=Ne.find(e=>r.id===`skill:${e.name}-${e.scope}`);e&&Ve(e);return}if(r.id.startsWith(`session:`)){let e=Y.find(e=>r.id===`session:${e.id}`);e&&Be(e);return}let i=r.id.startsWith(`recent:`)?Ie.find(e=>r.id===`recent:${e.path}`):Le.find(e=>r.id===`file:${e.path}`);i&&Re(i)};I.useEffect(()=>{xe(s,Me,{rows:X,highlightedIndex:P})},[s,P,X]);let We=I.useRef(s);return We.current=s,I.useEffect(()=>()=>{Se(We.current,Me)},[]),I.useImperativeHandle(c,()=>({acceptIndex:e=>{Ue(e)},handleKeyDown:e=>{if(e===`Escape`){a();return}let t=X.length;if(t!==0){if(e===`ArrowDown`){L.current=(L.current+1)%t,F(L.current);return}if(e===`ArrowUp`){L.current=(L.current-1+t)%t,F(L.current);return}(e===`Enter`||e===`Tab`)&&Ue(L.current)}}})),(0,U.jsxs)(me,{ref:je,isMobile:K,className:`max-w-[640px] max-h-64`,style:o,children:[(0,U.jsx)(_e,{preventOverscroll:!0,outerClassName:`flex-1 min-h-0`,className:`px-0`,children:(0,U.jsxs)(`div`,{className:`py-1`,children:[X.map((e,t)=>{let n=e.id.startsWith(`file:`)||e.id.startsWith(`recent:`),r=n?te(e.title,{maxLength:60}):e.title,i=P===t,a=B[t]??!1,o=H[t]??2.6;return(0,U.jsxs)(`div`,{"data-mention-id":e.id,ref:e=>{Oe.current[t]=e},className:_(`flex items-center gap-2 px-3 py-1.5 cursor-pointer typography-ui-label rounded-lg`,K&&`min-h-11`,he(K,i),!K&&i&&`text-interactive-selection-foreground`),...He(t,()=>Ue(t)),children:[(0,U.jsx)(`span`,{className:`flex size-5 shrink-0 items-center justify-center`,children:e.agentName===void 0?(0,U.jsx)(A,{name:e.iconName,className:`size-3.5 text-current`}):(0,U.jsx)(k,{name:e.agentName,size:20})}),(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 items-baseline gap-2`,children:[(0,U.jsxs)(`span`,{ref:e=>{ke.current[t]=e},className:_(`relative block min-w-0 overflow-hidden`,n&&a&&i&&`file-mention-marquee-container`),style:i?{"--file-mention-marquee-width":`${z}px`,"--file-mention-marquee-duration":`${o}s`}:void 0,title:e.title,children:[(0,U.jsx)(`span`,{ref:e=>{Ae.current[t]=e},className:`absolute invisible whitespace-nowrap pointer-events-none`,"aria-hidden":!0,children:e.title}),n&&a&&i?(0,U.jsx)(`span`,{className:`inline-block whitespace-nowrap file-mention-marquee`,children:G(e.title,q)}):(0,U.jsx)(`span`,{className:`block truncate`,children:G(r,q)})]}),e.trailingLabel?(0,U.jsx)(`span`,{className:_(`max-w-[40%] shrink-0 truncate text-muted-foreground`,K?`typography-micro`:`typography-meta`),children:e.trailingLabel}):null]}),e.subtitle?(0,U.jsx)(`div`,{className:_(`truncate text-muted-foreground`,K?`typography-micro`:`typography-meta`),children:G(e.subtitle,q)}):null]})]},e.id)}),ye&&Le.length===0?(0,U.jsx)(`div`,{className:`flex items-center justify-center py-3`,children:(0,U.jsx)(A,{name:`refresh`,className:`h-4 w-4 animate-spin text-muted-foreground`})}):null,!ye&&X.length===0&&(0,U.jsx)(`div`,{className:`px-3 py-2 typography-ui-label text-muted-foreground`,children:l(`chat.fileMentionAutocomplete.empty`)})]})}),!K&&(0,U.jsx)(`div`,{className:`px-3 pt-1 pb-1.5 border-t typography-meta text-muted-foreground`,children:l(`chat.autocomplete.keyboardHint`)})]})}),q=new Set([`new`,`fork`,`compact`,`reload`,`undo`,`redo`,`model`,`btw`]),J=(e,t)=>{if(!t||e.isSkill)return!1;let n=e.name?.trim().toLowerCase();return!!(n&&q.has(n))},Ne=(e,t)=>!e||t({name:e}),Pe=` `,Fe=(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]===Pe&&e[r-2]===`/`&&(r-=2),e[r]===`/`?{start:r,end:n}:null},Y=`text-[10px] leading-none uppercase font-bold tracking-tight px-1.5 py-1 rounded border flex-shrink-0`,Ie=_(Y,`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)]`),Le=_(Y,`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)]`),X=_(Y,`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)]`),Re=_(Y,`bg-[var(--surface-muted)] text-muted-foreground border-[var(--interactive-border)]/60`),ze=(e,t)=>e.length===t.length&&e.every((e,n)=>e.id===t[n]?.id&&e.description===t[n]?.description),Be=e=>{let t=!!e.sessionID;return{hasSession:t,canStartSessionCommand:t||e.hasNewDraft}},Ve=I.forwardRef(({searchQuery:e,onCommandSelect:t,onClose:n,directory:i,style:a,commandPolicy:o,commandContext:s,onRowsChange:c},l)=>{let{t:u}=ee(),f=d(e=>e.isMobile),p=w(e=>e.currentSessionId),m=w(e=>!!e.newSessionDraft?.open),h=w(I.useCallback(e=>p?e.getDirectoryForSession(p):void 0,[p])),g=ae(p??``,h??void 0),te=I.useMemo(()=>s??{sessionID:p??null,hasMessages:g.length>0,hasNewDraft:m},[s,p,g.length,m]),{hasSession:v,canStartSessionCommand:y}=I.useMemo(()=>Be(te),[te]),b=te.hasMessages,[x,S]=I.useState([]),[ne,C]=I.useState(!1),ie=re({directory:i}),oe=I.useMemo(()=>ie.data??[],[ie.data]),T=ie.isFetching,[E,D]=I.useState(0),se=I.useRef(0),O=I.useRef(!1),ce=I.useRef([]),le=I.useRef(null),ue=I.useRef(!1),k=I.useRef(null),j=I.useRef(!1),M=I.useRef(null);I.useEffect(()=>{let e=e=>{let t=e.target;!t||!le.current||le.current.contains(t)||n()};return document.addEventListener(`pointerdown`,e,!0),()=>{document.removeEventListener(`pointerdown`,e,!0)}},[n]),I.useEffect(()=>{(async()=>{C(T);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},...v&&!b?[{id:`yuri:init`,name:`init`,source:`yuri`,description:u(`chat.commandAutocomplete.command.initDescription`),isBuiltIn:!0}]:[],...v?[{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}]:[],...v?[{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=ye(n.filter(e=>(i||e.name!==`init`)&&(o?.(e)??!0)),e);S(e=>ze(e,a)?e:a)}catch{let t=!b,n=ye([{id:`yuri:new`,name:`new`,source:`yuri`,description:u(`chat.commandAutocomplete.command.newDescription`),isBuiltIn:!0},...v&&!b?[{id:`yuri:init`,name:`init`,source:`yuri`,description:u(`chat.commandAutocomplete.command.initDescription`),isBuiltIn:!0}]:[],...v?[{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}]:[],...v?[{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=>ze(e,n)?e:n)}finally{C(!1)}})()},[e,b,v,y,oe,T,u,o]),I.useEffect(()=>{D(0)},[x]),I.useEffect(()=>{se.current=E},[E]),I.useEffect(()=>{ce.current[E]?.scrollIntoView({block:`nearest`})},[E]),I.useEffect(()=>{xe(c,M,{rows:pe(x,{skill:u(`chat.commandAutocomplete.badge.skill`),command:u(`chat.commandAutocomplete.badge.command`),system:u(`chat.commandAutocomplete.badge.system`)}),highlightedIndex:E})},[x,c,E,u]);let de=I.useRef(c);de.current=c,I.useEffect(()=>()=>{Se(de.current,M)},[]),I.useImperativeHandle(l,()=>({acceptIndex:(e,n=!0)=>{let r=x[e];r&&t(r,J(r,n))},handleKeyDown:e=>{let r=x.length;if(e===`Escape`){n();return}if(r!==0){if(e===`ArrowDown`){O.current=!0,D(e=>(e+1)%r);return}if(e===`ArrowUp`){O.current=!0,D(e=>(e-1+r)%r);return}if(e===`Enter`||e===`Tab`){let n=(se.current%r+r)%r,i=x[n];i&&t(i,J(i,e===`Enter`))}}}}),[x,n,t]);let ge=e=>{let t=fe(e);switch(e.name){case`new`:return(0,U.jsx)(A,{name:t,className:`h-3.5 w-3.5`});case`init`:return(0,U.jsx)(A,{name:t,className:`h-3.5 w-3.5 text-green-500`});case`undo`:return(0,U.jsx)(A,{name:t,className:`h-3.5 w-3.5 text-orange-500`});case`redo`:return(0,U.jsx)(A,{name:t,className:`h-3.5 w-3.5 text-orange-500`});case`timeline`:case`reload`:return(0,U.jsx)(A,{name:t,className:`h-3.5 w-3.5`});case`compact`:return(0,U.jsx)(A,{name:t,className:`h-3.5 w-3.5 text-purple-500`});case`goal`:return(0,U.jsx)(A,{name:t,className:`h-3.5 w-3.5`});case`review`:return(0,U.jsx)(A,{name:t,className:`h-3.5 w-3.5 text-blue-500`});case`test`:case`build`:case`run`:return(0,U.jsx)(A,{name:t,className:`h-3.5 w-3.5 text-cyan-500`});default:return e.isBuiltIn?(0,U.jsx)(A,{name:t,className:`h-3.5 w-3.5 text-yellow-500`}):(0,U.jsx)(A,{name:t,className:`h-3.5 w-3.5 text-muted-foreground`})}};return(0,U.jsxs)(me,{ref:le,isMobile:f,className:`max-w-[450px] max-h-64`,style:a,children:[(0,U.jsx)(_e,{preventOverscroll:!0,outerClassName:`flex-1 min-h-0`,className:`px-0 py-1.5`,children:ne?(0,U.jsx)(`div`,{className:`flex items-center justify-center py-4`,children:(0,U.jsx)(A,{name:`refresh`,className:`h-4 w-4 animate-spin text-muted-foreground`})}):(0,U.jsxs)(`div`,{children:[x.map((n,r)=>{let i=n.isBuiltIn,a=n.isYuri;return(0,U.jsxs)(`div`,{ref:e=>{ce.current[r]=e},className:_(`flex gap-2 px-2 py-2 cursor-pointer rounded-lg`,f?`items-center`:`items-start`,he(f,r===E),!f&&r===E&&`bg-interactive-selection/35`),onMouseDown:e=>e.preventDefault(),onPointerDown:e=>{e.pointerType===`touch`&&(k.current={x:e.clientX,y:e.clientY},j.current=!1)},onPointerMove:e=>{if(e.pointerType!==`touch`||!k.current)return;let t=e.clientX-k.current.x,n=e.clientY-k.current.y;Math.hypot(t,n)>6&&(j.current=!0)},onPointerUp:e=>{if(e.pointerType!==`touch`)return;let r=j.current;k.current=null,j.current=!1,!r&&(e.preventDefault(),e.stopPropagation(),ue.current=!0,t(n,J(n,f)))},onPointerCancel:()=>{k.current=null,j.current=!1},onClick:()=>{if(ue.current){ue.current=!1;return}t(n,J(n,f))},onMouseMove:()=>{O.current=!1,D(r)},children:[(0,U.jsx)(`div`,{className:_(!f&&`mt-0.5`),children:ge(n)}),(0,U.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsxs)(`span`,{className:`typography-ui-label font-medium`,children:[`/`,G(n.name,e)]}),n.isSkill?(0,U.jsx)(`span`,{className:Ie,children:u(`chat.commandAutocomplete.badge.skill`)}):(0,U.jsx)(`span`,{className:Ie,children:u(`chat.commandAutocomplete.badge.command`)}),a?(0,U.jsx)(`span`,{className:Re,children:`Yuri`}):i?(0,U.jsx)(`span`,{className:Re,children:u(`chat.commandAutocomplete.badge.system`)}):n.scope?(0,U.jsx)(`span`,{className:n.scope===`project`?X:Le,children:n.scope}):null,n.agent&&(0,U.jsx)(`span`,{className:Re,children:n.agent})]}),n.description&&!f&&(0,U.jsx)(`div`,{className:`typography-meta text-muted-foreground mt-0.5 truncate`,children:G(n.description,e)})]})]},n.id)}),x.length===0&&(0,U.jsx)(`div`,{className:`px-3 py-2 typography-ui-label text-muted-foreground`,children:u(`chat.commandAutocomplete.empty`)})]})}),!f&&(0,U.jsx)(`div`,{className:`px-3 pt-1 pb-1.5 border-t typography-meta text-muted-foreground`,children:u(`chat.autocomplete.keyboardHint`)})]})});Ve.displayName=`CommandAutocomplete`;var He=e=>e instanceof Error?e.name===`AbortError`||e.name===`CancelledError`||e.name===`Error`&&e.message===`CancelledError`:!1,Ue=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&&gt(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 b(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(He(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>Ue||!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=[],_=()=>{let e=g;return g+=1,e<m.length?m[e]:null},te=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=_();if(!e)return;try{ee.push(await te(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 S=new Map(x.diffCache),ne=Date.now();ee.forEach(e=>{!e.diff.isBinary&&e.diff.original===``&&e.diff.modified===``||S.set(e.path,{...e.diff,fetchedAt:ne})});let C=mt(S);b.set(n,{...x,diffCache:C}),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>=Ue)&&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,H.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,H.c)(3),i=I.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,H.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,H.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,H.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,H.c)(3),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=new Map,t[0]=n):n=t[0];let r=I.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,H.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,H.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,H.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 ve(e);try{let n=Mt((await j(e)).branches?.[t]?.tracking||null);if(n?.remote)return n.remote}catch{}try{let t=Mt((await M(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 N(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{Ne as C,we as D,Te as E,F as O,Fe as S,Ee 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,K as w,Ve 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-DEZ1K7qW.js";import{T as r}from"./desktop-BAmoc_34.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}from"./gitApiHttp-MWsHNHuo.js";import{r as d,x as f}from"./useUIStore-BerIUSLP.js";import{A as p,k as m}from"./bootstrap-C8paoQ0j.js";import{n as h}from"./vendor-react-DlzBev0S.js";import{i as g}from"./vendor-reactuses-core-DWo5Wn6R.js";import{f as ee,r as _,u as te}from"./button-C-gRcs_2.js";import{$r as v,Kr as y,Qn as b,St as x,V as S,Wi as ne,Zn as C,_a as re,ea as ie,ft as ae,ki as oe,p as w,va as T,w as E,x as D}from"./useMobileNavigationStore-DHX2bCjA.js";import{a as se,g as O,o as ce,p as le,s as ue}from"./fileMentionAutocompleteState-BZJqfgae.js";import{t as k}from"./AgentAvatar-DLzcNrQ0.js";import{n as A}from"./Icon-OJf0qBKf.js";import{g as j,v as M}from"./gitApi-DxUmZcUw.js";import{c as de,d as fe,l as pe,n as me,r as he,t as ge}from"./fileMentionTouchSelection-ByaQJcTS.js";import{n as _e}from"./textarea-BHgcxJdC.js";import{f as ve,o as N}from"./projectMeta-DD7W5l0p.js";var ye=(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=O([...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)},be=(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}),P=(e,t)=>e.highlightedIndex===t.highlightedIndex&&be(e.rows,t.rows),F=(e,t)=>be(e,t)?e:t.slice(),xe=(e,t,n)=>{e&&(t.current&&P(t.current,n)||(t.current=n,e(n)))},Se=(e,t)=>{t.current=null,e?.({rows:[],highlightedIndex:0})},I=e(c(),1),L=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},R=e=>/^[A-Za-z]:\//.test(e)?e.toLowerCase():e,z=(e,t)=>{let n=L(t),r=L(e);if(!n||!r)return!1;let i=R(n),a=R(r);return a===i||a.startsWith(`${i}/`)},Ce=e=>{if(!e||typeof e!=`object`)return{};let t=e,n={};for(let[e,r]of Object.entries(t)){let t=L(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=>L(e)).filter(e=>z(e,t)))):[],o=Array.isArray(i.expandedPaths)?Array.from(new Set(i.expandedPaths.filter(e=>typeof e==`string`).map(e=>L(e)).filter(e=>z(e,t)))):[],s=typeof i.selectedPath==`string`?L(i.selectedPath):null,c=s&&z(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},B=(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},V=e=>e?{...e,touchedAt:Date.now()}:{openPaths:[],selectedPath:null,expandedPaths:[],touchedAt:Date.now()},we=i()(o(a((e,t)=>({byRoot:{},addOpenPath:(t,n,r)=>{let i=L((t||``).trim()),a=L((n||``).trim());!i||!a||!r?.allowOutsideRoot&&!z(a,i)||e(e=>{let t=e.byRoot[i],n=V(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:B({...e.byRoot,[i]:{...n,openPaths:o,selectedPath:s}},20)}})},removeOpenPath:(t,n)=>{let r=L((t||``).trim()),i=L((n||``).trim());!r||!i||e(e=>{let t=e.byRoot[r];if(!t)return e;let n=R(i),a=e=>R(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:B({...e.byRoot,[r]:{...t,openPaths:s,selectedPath:c,touchedAt:Date.now()}},20)}})},removeOpenPathsByPrefix:(t,n)=>{let r=L((t||``).trim()),i=L((n||``).trim());!r||!i||e(e=>{let t=e.byRoot[r];if(!t)return e;let n=R(i),a=n.endsWith(`/`)?n:`${n}/`,o=e=>{let t=R(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:B({...e.byRoot,[r]:{...t,openPaths:s,selectedPath:c,touchedAt:Date.now()}},20)}})},removeExpandedPathsByPrefix:(t,n)=>{let r=L((t||``).trim()),i=L((n||``).trim());!r||!i||e(e=>{let t=e.byRoot[r];if(!t)return e;let n=R(i),a=n.endsWith(`/`)?n:`${n}/`,o=t.expandedPaths.filter(e=>{let t=R(e);return t!==n&&!t.startsWith(a)});return o.length===t.expandedPaths.length?e:{byRoot:B({...e.byRoot,[r]:{...t,expandedPaths:o,touchedAt:Date.now()}},20)}})},setSelectedPath:(t,n,r)=>{let i=L((t||``).trim()),a=n?L(n.trim()):null;!i||a&&!r?.allowOutsideRoot&&!z(a,i)||e(e=>{let t=e.byRoot[i],n=V(t),r=a&&!n.openPaths.includes(a)?[...n.openPaths,a]:n.openPaths;return t&&t.selectedPath===a&&r===t.openPaths?e:{byRoot:B({...e.byRoot,[i]:{...n,openPaths:r,selectedPath:a}},20)}})},ensureSelectedPath:e=>{let n=L((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=L((t||``).trim()),i=L((n||``).trim());!r||!i||!z(i,r)||e(e=>{let t=e.byRoot[r],n=V(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:B({...e.byRoot,[r]:{...n,expandedPaths:a}},20)}})},expandPath:(t,n)=>{let r=L((t||``).trim()),i=L((n||``).trim());!r||!i||!z(i,r)||e(e=>{let t=e.byRoot[r],n=V(t);return n.expandedPaths.includes(i)&&t?e:{byRoot:B({...e.byRoot,[r]:{...n,expandedPaths:[...n.expandedPaths,i]}},20)}})},expandPaths:(t,n)=>{let r=L((t||``).trim());if(!r||!n||n.length===0)return;let i=n.map(e=>L((e||``).trim())).filter(e=>e&&z(e,r));i.length!==0&&e(e=>{let t=e.byRoot[r],n=V(t),a=new Set(n.expandedPaths),o=i.filter(e=>!a.has(e));return o.length===0?e:{byRoot:B({...e.byRoot,[r]:{...n,expandedPaths:[...n.expandedPaths,...o]}},20)}})}}),{name:`files-view-tabs-store`,version:2,storage:f(),migrate:e=>{if(!e||typeof e!=`object`)return{byRoot:{}};let t=e.byRoot;return{byRoot:Ce(t)}},partialize:e=>({byRoot:Ce(e.byRoot)})}),{name:`files-view-tabs-store`})),H=h(),Te=(e,t)=>{let n=(0,H.c)(4),r=t===void 0?200:t,[i,a]=I.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]),I.useEffect(o,s),i},Ee=()=>{let e=(0,H.c)(17),t=w(De),n=x(),r;e[0]===t?r=e[1]:(r=e=>t?e.getAttachment(t):void 0,e[0]=t,e[1]=r);let i=E(r),a=w(Oe),o=w(ke),s=T(Ae),c=T(je),u=l(Me);if(t){let r;e[2]===i?r=e[3]:(r=D(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 De(e){return e.currentSessionId}function Oe(e){return e.worktreeMetadata}function ke(e){return e.newSessionDraft}function Ae(e){return e.activeProjectId}function je(e){return e.projects}function Me(e){return e.currentDirectory}var U=s(),W=`bg-transparent font-[inherit] text-[var(--primary-base)]`,G=(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,U.jsx)(`mark`,{className:W,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},K=I.forwardRef(({searchQuery:e,onFileSelect:t,onAgentSelect:n,onSkillSelect:r,onSessionSelect:i,onClose:a,style:o,onRowsChange:s},c)=>{let{t:l}=ee(),f=Ee()??``,h=w(e=>e.currentSessionId),b=v(e=>e.activeSessions),x=S({enabled:!!i}),C=T(e=>e.activeProjectId),re=T(e=>e.projects),ae=I.useMemo(()=>re.find(e=>e.id===C)?.path??null,[C,re]),E=I.useMemo(()=>{let e=ae||f;return e?e.replace(/\\/g,`/`).replace(/\/+$/,``):null},[ae,f]),D=we(e=>E?e.byRoot[E]:void 0),O=oe(e=>e.agents),j=u(e=>e.searchFiles),M=Te(e,180),fe=p(),pe=m(),[ve,N]=I.useState([]),[ye,be]=I.useState(!1),[P,F]=I.useState(0),L=I.useRef(0),R=I.useRef({query:e,directory:f,ids:[]}),[z,Ce]=I.useState(360),[B,V]=I.useState({}),[H,De]=I.useState({}),Oe=I.useRef([]),ke=I.useRef([]),Ae=I.useRef([]),je=I.useRef(null),Me=I.useRef(null),W=I.useRef(null);W.current||=ge();let K=d(e=>e.isMobile),q=(e??``).trim(),J=ie({directory:f||null}),Ne=I.useMemo(()=>r?J.data??[]:[],[r,J.data]),Pe=I.useMemo(()=>{if(!E||!D)return[];let e=[D.selectedPath,...D.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(`${E}/`)?e.slice(E.length+1):e;n.push({name:i,path:e,relativePath:a,extension:i.includes(`.`)?i.split(`.`).pop()?.toLowerCase():void 0})}return ue(n,q,{limit:6})},[q,E,D]),Fe=I.useMemo(()=>n?ne(O).filter(e=>e.mode!==`primary`):[],[O,n]),Y=I.useMemo(()=>i?se({sessions:y(b,x),currentSessionId:h,searchQuery:q}):[],[b,h,x,q,i]),Ie=Pe,Le=ve,X=I.useMemo(()=>de({skills:Ne,agents:Fe,sessions:Y,recentFiles:Ie,pathHits:Le,searchQuery:q,untitledSession:l(`chat.fileMentionAutocomplete.untitledSession`),sessionBadge:l(`chat.fileMentionAutocomplete.sessionType`),skillBadge:l(`chat.commandAutocomplete.badge.skill`)}),[Ne,Fe,Y,Ie,Le,q,l]);I.useEffect(()=>{let e=e=>{let t=e.target;!t||!je.current||je.current.contains(t)||a()};return document.addEventListener(`pointerdown`,e,!0),()=>{document.removeEventListener(`pointerdown`,e,!0)}},[a]),I.useEffect(()=>{if(!f){N([]);return}let e=(M??``).trim(),t=le(e);if(!t){N([]);return}let n=!1;be(!0);let r={includeHidden:fe,respectGitignore:!pe};return Promise.all([j(f,t,80,{...r,type:`file`}),j(f,t,40,{...r,type:`directory`})]).then(([t,r])=>{if(n)return;let i=new Set(Pe.map(e=>e.path));N(ce({files:t,directories:r,query:e,excludePaths:i,limit:20}))}).catch(()=>{n||N([])}).finally(()=>{n||be(!1)}),()=>{n=!0}},[f,M,Pe,j,fe,pe]),I.useLayoutEffect(()=>{let t=R.current,n=t.ids[L.current],r=t.query===e&&t.directory===f?Math.max(0,X.findIndex(e=>e.id===n)):0;R.current={query:e,directory:f,ids:X.map(e=>e.id)},L.current=r,F(r)},[X,e,f]),I.useEffect(()=>{V({}),De({})},[X]),I.useEffect(()=>{Oe.current[P]?.scrollIntoView({block:`nearest`})},[P]),I.useEffect(()=>{let e=null,t=()=>{e!==null&&cancelAnimationFrame(e),e=requestAnimationFrame(()=>{let e={},t={};ke.current.forEach((n,r)=>{if(!n)return;let i=Ae.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}}),V(e),De(t)})};return t(),window.addEventListener(`resize`,t),()=>{e!==null&&cancelAnimationFrame(e),window.removeEventListener(`resize`,t)}},[X]),I.useEffect(()=>{let e=ke.current[P];if(!e)return;let t=()=>{let t=e.clientWidth;t>0&&Ce(t)};if(t(),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(t);return n.observe(e),()=>{n.disconnect()}},[P]);let Re=g(e=>{t(e)}),ze=g(e=>{n?.(e)}),Be=g(e=>{i?.(e)}),Ve=g(e=>{r?.(e)}),He=(e,t)=>({onMouseDown:e=>e.preventDefault(),onPointerDown:e=>{e.pointerType===`touch`&&W.current?.pointerDown(e.clientX,e.clientY)},onPointerMove:e=>{e.pointerType===`touch`&&W.current?.pointerMove(e.clientX,e.clientY)},onPointerUp:e=>{e.pointerType===`touch`&&(W.current?.pointerUp(t)??!1)&&(e.preventDefault(),e.stopPropagation())},onPointerCancel:()=>W.current?.pointerCancel(),onClick:()=>{W.current?.click(t)},onMouseMove:()=>{L.current=e,F(e)}}),Ue=e=>{let t=X.length;if(t===0)return;let n=(e%t+t)%t,r=X[n];if(r.agentName!==void 0){ze(r.agentName);return}if(r.id.startsWith(`skill:`)){let e=Ne.find(e=>r.id===`skill:${e.name}-${e.scope}`);e&&Ve(e);return}if(r.id.startsWith(`session:`)){let e=Y.find(e=>r.id===`session:${e.id}`);e&&Be(e);return}let i=r.id.startsWith(`recent:`)?Ie.find(e=>r.id===`recent:${e.path}`):Le.find(e=>r.id===`file:${e.path}`);i&&Re(i)};I.useEffect(()=>{xe(s,Me,{rows:X,highlightedIndex:P})},[s,P,X]);let We=I.useRef(s);return We.current=s,I.useEffect(()=>()=>{Se(We.current,Me)},[]),I.useImperativeHandle(c,()=>({acceptIndex:e=>{Ue(e)},handleKeyDown:e=>{if(e===`Escape`){a();return}let t=X.length;if(t!==0){if(e===`ArrowDown`){L.current=(L.current+1)%t,F(L.current);return}if(e===`ArrowUp`){L.current=(L.current-1+t)%t,F(L.current);return}(e===`Enter`||e===`Tab`)&&Ue(L.current)}}})),(0,U.jsxs)(me,{ref:je,isMobile:K,className:`max-w-[640px] max-h-64`,style:o,children:[(0,U.jsx)(_e,{preventOverscroll:!0,outerClassName:`flex-1 min-h-0`,className:`px-0`,children:(0,U.jsxs)(`div`,{className:`py-1`,children:[X.map((e,t)=>{let n=e.id.startsWith(`file:`)||e.id.startsWith(`recent:`),r=n?te(e.title,{maxLength:60}):e.title,i=P===t,a=B[t]??!1,o=H[t]??2.6;return(0,U.jsxs)(`div`,{"data-mention-id":e.id,ref:e=>{Oe.current[t]=e},className:_(`flex items-center gap-2 px-3 py-1.5 cursor-pointer typography-ui-label rounded-lg`,K&&`min-h-11`,he(K,i),!K&&i&&`text-interactive-selection-foreground`),...He(t,()=>Ue(t)),children:[(0,U.jsx)(`span`,{className:`flex size-5 shrink-0 items-center justify-center`,children:e.agentName===void 0?(0,U.jsx)(A,{name:e.iconName,className:`size-3.5 text-current`}):(0,U.jsx)(k,{name:e.agentName,size:20})}),(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 items-baseline gap-2`,children:[(0,U.jsxs)(`span`,{ref:e=>{ke.current[t]=e},className:_(`relative block min-w-0 overflow-hidden`,n&&a&&i&&`file-mention-marquee-container`),style:i?{"--file-mention-marquee-width":`${z}px`,"--file-mention-marquee-duration":`${o}s`}:void 0,title:e.title,children:[(0,U.jsx)(`span`,{ref:e=>{Ae.current[t]=e},className:`absolute invisible whitespace-nowrap pointer-events-none`,"aria-hidden":!0,children:e.title}),n&&a&&i?(0,U.jsx)(`span`,{className:`inline-block whitespace-nowrap file-mention-marquee`,children:G(e.title,q)}):(0,U.jsx)(`span`,{className:`block truncate`,children:G(r,q)})]}),e.trailingLabel?(0,U.jsx)(`span`,{className:_(`max-w-[40%] shrink-0 truncate text-muted-foreground`,K?`typography-micro`:`typography-meta`),children:e.trailingLabel}):null]}),e.subtitle?(0,U.jsx)(`div`,{className:_(`truncate text-muted-foreground`,K?`typography-micro`:`typography-meta`),children:G(e.subtitle,q)}):null]})]},e.id)}),ye&&Le.length===0?(0,U.jsx)(`div`,{className:`flex items-center justify-center py-3`,children:(0,U.jsx)(A,{name:`refresh`,className:`h-4 w-4 animate-spin text-muted-foreground`})}):null,!ye&&X.length===0&&(0,U.jsx)(`div`,{className:`px-3 py-2 typography-ui-label text-muted-foreground`,children:l(`chat.fileMentionAutocomplete.empty`)})]})}),!K&&(0,U.jsx)(`div`,{className:`px-3 pt-1 pb-1.5 border-t typography-meta text-muted-foreground`,children:l(`chat.autocomplete.keyboardHint`)})]})}),q=new Set([`new`,`fork`,`compact`,`reload`,`undo`,`redo`,`model`,`btw`]),J=(e,t)=>{if(!t||e.isSkill)return!1;let n=e.name?.trim().toLowerCase();return!!(n&&q.has(n))},Ne=(e,t)=>!e||t({name:e}),Pe=` `,Fe=(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]===Pe&&e[r-2]===`/`&&(r-=2),e[r]===`/`?{start:r,end:n}:null},Y=`text-[10px] leading-none uppercase font-bold tracking-tight px-1.5 py-1 rounded border flex-shrink-0`,Ie=_(Y,`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)]`),Le=_(Y,`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)]`),X=_(Y,`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)]`),Re=_(Y,`bg-[var(--surface-muted)] text-muted-foreground border-[var(--interactive-border)]/60`),ze=(e,t)=>e.length===t.length&&e.every((e,n)=>e.id===t[n]?.id&&e.description===t[n]?.description),Be=e=>{let t=!!e.sessionID;return{hasSession:t,canStartSessionCommand:t||e.hasNewDraft}},Ve=I.forwardRef(({searchQuery:e,onCommandSelect:t,onClose:n,directory:i,style:a,commandPolicy:o,commandContext:s,onRowsChange:c},l)=>{let{t:u}=ee(),f=d(e=>e.isMobile),p=w(e=>e.currentSessionId),m=w(e=>!!e.newSessionDraft?.open),h=w(I.useCallback(e=>p?e.getDirectoryForSession(p):void 0,[p])),g=ae(p??``,h??void 0),te=I.useMemo(()=>s??{sessionID:p??null,hasMessages:g.length>0,hasNewDraft:m},[s,p,g.length,m]),{hasSession:v,canStartSessionCommand:y}=I.useMemo(()=>Be(te),[te]),b=te.hasMessages,[x,S]=I.useState([]),[ne,C]=I.useState(!1),ie=re({directory:i}),oe=I.useMemo(()=>ie.data??[],[ie.data]),T=ie.isFetching,[E,D]=I.useState(0),se=I.useRef(0),O=I.useRef(!1),ce=I.useRef([]),le=I.useRef(null),ue=I.useRef(!1),k=I.useRef(null),j=I.useRef(!1),M=I.useRef(null);I.useEffect(()=>{let e=e=>{let t=e.target;!t||!le.current||le.current.contains(t)||n()};return document.addEventListener(`pointerdown`,e,!0),()=>{document.removeEventListener(`pointerdown`,e,!0)}},[n]),I.useEffect(()=>{(async()=>{C(T);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},...v&&!b?[{id:`yuri:init`,name:`init`,source:`yuri`,description:u(`chat.commandAutocomplete.command.initDescription`),isBuiltIn:!0}]:[],...v?[{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}]:[],...v?[{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=ye(n.filter(e=>(i||e.name!==`init`)&&(o?.(e)??!0)),e);S(e=>ze(e,a)?e:a)}catch{let t=!b,n=ye([{id:`yuri:new`,name:`new`,source:`yuri`,description:u(`chat.commandAutocomplete.command.newDescription`),isBuiltIn:!0},...v&&!b?[{id:`yuri:init`,name:`init`,source:`yuri`,description:u(`chat.commandAutocomplete.command.initDescription`),isBuiltIn:!0}]:[],...v?[{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}]:[],...v?[{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=>ze(e,n)?e:n)}finally{C(!1)}})()},[e,b,v,y,oe,T,u,o]),I.useEffect(()=>{D(0)},[x]),I.useEffect(()=>{se.current=E},[E]),I.useEffect(()=>{ce.current[E]?.scrollIntoView({block:`nearest`})},[E]),I.useEffect(()=>{xe(c,M,{rows:pe(x,{skill:u(`chat.commandAutocomplete.badge.skill`),command:u(`chat.commandAutocomplete.badge.command`),system:u(`chat.commandAutocomplete.badge.system`)}),highlightedIndex:E})},[x,c,E,u]);let de=I.useRef(c);de.current=c,I.useEffect(()=>()=>{Se(de.current,M)},[]),I.useImperativeHandle(l,()=>({acceptIndex:(e,n=!0)=>{let r=x[e];r&&t(r,J(r,n))},handleKeyDown:e=>{let r=x.length;if(e===`Escape`){n();return}if(r!==0){if(e===`ArrowDown`){O.current=!0,D(e=>(e+1)%r);return}if(e===`ArrowUp`){O.current=!0,D(e=>(e-1+r)%r);return}if(e===`Enter`||e===`Tab`){let n=(se.current%r+r)%r,i=x[n];i&&t(i,J(i,e===`Enter`))}}}}),[x,n,t]);let ge=e=>{let t=fe(e);switch(e.name){case`new`:return(0,U.jsx)(A,{name:t,className:`h-3.5 w-3.5`});case`init`:return(0,U.jsx)(A,{name:t,className:`h-3.5 w-3.5 text-green-500`});case`undo`:return(0,U.jsx)(A,{name:t,className:`h-3.5 w-3.5 text-orange-500`});case`redo`:return(0,U.jsx)(A,{name:t,className:`h-3.5 w-3.5 text-orange-500`});case`timeline`:case`reload`:return(0,U.jsx)(A,{name:t,className:`h-3.5 w-3.5`});case`compact`:return(0,U.jsx)(A,{name:t,className:`h-3.5 w-3.5 text-purple-500`});case`goal`:return(0,U.jsx)(A,{name:t,className:`h-3.5 w-3.5`});case`review`:return(0,U.jsx)(A,{name:t,className:`h-3.5 w-3.5 text-blue-500`});case`test`:case`build`:case`run`:return(0,U.jsx)(A,{name:t,className:`h-3.5 w-3.5 text-cyan-500`});default:return e.isBuiltIn?(0,U.jsx)(A,{name:t,className:`h-3.5 w-3.5 text-yellow-500`}):(0,U.jsx)(A,{name:t,className:`h-3.5 w-3.5 text-muted-foreground`})}};return(0,U.jsxs)(me,{ref:le,isMobile:f,className:`max-w-[450px] max-h-64`,style:a,children:[(0,U.jsx)(_e,{preventOverscroll:!0,outerClassName:`flex-1 min-h-0`,className:`px-0 py-1.5`,children:ne?(0,U.jsx)(`div`,{className:`flex items-center justify-center py-4`,children:(0,U.jsx)(A,{name:`refresh`,className:`h-4 w-4 animate-spin text-muted-foreground`})}):(0,U.jsxs)(`div`,{children:[x.map((n,r)=>{let i=n.isBuiltIn,a=n.isYuri;return(0,U.jsxs)(`div`,{ref:e=>{ce.current[r]=e},className:_(`flex gap-2 px-2 py-2 cursor-pointer rounded-lg`,f?`items-center`:`items-start`,he(f,r===E),!f&&r===E&&`bg-interactive-selection/35`),onMouseDown:e=>e.preventDefault(),onPointerDown:e=>{e.pointerType===`touch`&&(k.current={x:e.clientX,y:e.clientY},j.current=!1)},onPointerMove:e=>{if(e.pointerType!==`touch`||!k.current)return;let t=e.clientX-k.current.x,n=e.clientY-k.current.y;Math.hypot(t,n)>6&&(j.current=!0)},onPointerUp:e=>{if(e.pointerType!==`touch`)return;let r=j.current;k.current=null,j.current=!1,!r&&(e.preventDefault(),e.stopPropagation(),ue.current=!0,t(n,J(n,f)))},onPointerCancel:()=>{k.current=null,j.current=!1},onClick:()=>{if(ue.current){ue.current=!1;return}t(n,J(n,f))},onMouseMove:()=>{O.current=!1,D(r)},children:[(0,U.jsx)(`div`,{className:_(!f&&`mt-0.5`),children:ge(n)}),(0,U.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsxs)(`span`,{className:`typography-ui-label font-medium`,children:[`/`,G(n.name,e)]}),n.isSkill?(0,U.jsx)(`span`,{className:Ie,children:u(`chat.commandAutocomplete.badge.skill`)}):(0,U.jsx)(`span`,{className:Ie,children:u(`chat.commandAutocomplete.badge.command`)}),a?(0,U.jsx)(`span`,{className:Re,children:`Yuri`}):i?(0,U.jsx)(`span`,{className:Re,children:u(`chat.commandAutocomplete.badge.system`)}):n.scope?(0,U.jsx)(`span`,{className:n.scope===`project`?X:Le,children:n.scope}):null,n.agent&&(0,U.jsx)(`span`,{className:Re,children:n.agent})]}),n.description&&!f&&(0,U.jsx)(`div`,{className:`typography-meta text-muted-foreground mt-0.5 truncate`,children:G(n.description,e)})]})]},n.id)}),x.length===0&&(0,U.jsx)(`div`,{className:`px-3 py-2 typography-ui-label text-muted-foreground`,children:u(`chat.commandAutocomplete.empty`)})]})}),!f&&(0,U.jsx)(`div`,{className:`px-3 pt-1 pb-1.5 border-t typography-meta text-muted-foreground`,children:u(`chat.autocomplete.keyboardHint`)})]})});Ve.displayName=`CommandAutocomplete`;var He=e=>e instanceof Error?e.name===`AbortError`||e.name===`CancelledError`||e.name===`Error`&&e.message===`CancelledError`:!1,Ue=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&&gt(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 b(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(He(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>Ue||!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=[],_=()=>{let e=g;return g+=1,e<m.length?m[e]:null},te=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=_();if(!e)return;try{ee.push(await te(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 S=new Map(x.diffCache),ne=Date.now();ee.forEach(e=>{!e.diff.isBinary&&e.diff.original===``&&e.diff.modified===``||S.set(e.path,{...e.diff,fetchedAt:ne})});let C=mt(S);b.set(n,{...x,diffCache:C}),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>=Ue)&&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,H.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,H.c)(3),i=I.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,H.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,H.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,H.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,H.c)(3),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=new Map,t[0]=n):n=t[0];let r=I.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,H.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,H.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,H.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 ve(e);try{let n=Mt((await j(e)).branches?.[t]?.tracking||null);if(n?.remote)return n.remote}catch{}try{let t=Mt((await M(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 N(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{Ne as C,we as D,Te as E,F as O,Fe as S,Ee 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,K as w,Ve as x,Q as y};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/vendor-workbox-window-15MWHJyx.js","assets/rolldown-runtime-hePW80VL.js","assets/renderMobileApp-Cz0fF7ge.js","assets/runtime-auth-DBn9yahL.js","assets/runtime-switch-DEZ1K7qW.js","assets/runtime-fetch-D0YWp3FJ.js","assets/runtimeAPIRegistry-C2VogTny.js","assets/vendor-zustand-vDaAPGfl.js","assets/vendor-base-ui-CzHs0bHY.js","assets/gitApiHttp-MWsHNHuo.js","assets/desktop-BAmoc_34.js","assets/vendor-opencode-client-cQ47ywrT.js","assets/vendor-effect-X1Hqc7ba.js","assets/brand-storage-bootstrap-D4BW3w-M.js","assets/brand-storage-migration-Bhz6UOBJ.js","assets/useUIStore-BerIUSLP.js","assets/bootstrap-C8paoQ0j.js","assets/vendor-react-DlzBev0S.js","assets/queryRuntime-2dx7jbt9.js","assets/vendor-tanstack-query-core-Y_YoRHtC.js","assets/pathNormalization-ewtPqJWn.js","assets/vendor-pathe-vBmvQE8f.js","assets/runtime-ead7P81A.js","assets/runtime-file-resource-BP4P52ry.js","assets/fileQueries-C2Rs6TPz.js","assets/vendor-tanstack-react-query-B-Wpqq5J.js","assets/runtime-file-store-BVRgEtI-.js","assets/path-utils-jGozTg9d.js","assets/vendor-aparajita-capacitor-secure-storage-xol_6BsB.js","assets/platform-sEg2IOLZ.js","assets/capgoAdapter-iYI-U-Ut.js","assets/types-C5r6A1vW.js","assets/vendor-pierre-diffs-BFiZ3IhI.js","assets/vendor-hast-util-to-html-Bw_SgZ1t.js","assets/vendor-character-entities-legacy-Wut6vMuj.js","assets/vendor-character-entities-html4-DlN_yAFd.js","assets/vendor-ccount-CyGsA0u7.js","assets/vendor-comma-separated-tokens-B9ouxNNS.js","assets/vendor-oniguruma-to-es-CrHzjjSU.js","assets/vendor-oniguruma-parser-D2DIvhSP.js","assets/vendor-diff-Dq7CZNim.js","assets/vendor-lru_map-BMOrLc9L.js","assets/vendor-sonner-BEHGipm5.js","assets/vendor-reactuses-core-DWo5Wn6R.js","assets/vendor-lodash-es-BS45jPoZ.js","assets/vendor-js-cookie-hSOiFTtX.js","assets/button-C-gRcs_2.js","assets/store-OjrIiXCx.js","assets/tour-DDI0Zg7l.js","assets/vendor-class-variance-authority-BLUaYARZ.js","assets/vendor-tailwind-merge-BicNWLTg.js","assets/MobileShareBridge-lEVFU_Ro.js","assets/MobileDetailNavigation-CFf-QNEw.js","assets/useMobileNavigationStore-_FYcDNuL.js","assets/useAssistantUIStore-D25VqrpK.js","assets/vendor-zod-DZzbCm1s.js","assets/vendor-opencode-schema-DWT45VBX.js","assets/Icon-OJf0qBKf.js","assets/AgentAvatar-DLzcNrQ0.js","assets/agentColors-DWSbQXy2.js","assets/vendor-dicebear-core-CV95S5Pg.js","assets/vendor-dicebear-styles-C4OfoX7R.js","assets/dualLimitLru-D8Sphgua.js","assets/useThemeSystem-CNzUUkFn.js","assets/vendor-framer-motion-DDMKlXiP.js","assets/dialog-3UseH0hM.js","assets/dialog-CTYD3Sbr.css","assets/rasterizePng-056Poix7.js","assets/gitApi-C1vpN1bY.js","assets/useAppFontEffects-WiAE9DFB.js","assets/desktopHosts-BLU1tGSX.js","assets/desktopRelayRestore-2BIIs8mZ.js","assets/fileMentionAutocompleteState-BZJqfgae.js","assets/vendor-fuse.js-DB5wDJbI.js","assets/vendor-fuzzysort-ukaRp9PC.js","assets/vendor-simplewebauthn-browser-Dwhcdg_5.js","assets/checkbox-BrJBzET8.js","assets/input-CmLlZdeD.js","assets/tooltip-Degmpxnd.js","assets/pwa-COSzAKZr.js","assets/MobileResizableSheet-DuAi_epR.js","assets/MobileWindowStack-DGLdgoGr.js","assets/select-J8r9SxHt.js","assets/device-w1ioiqv3.js","assets/textarea-BHgcxJdC.js","assets/OverlayScrollbar-CZD1yU06.js","assets/dropdown-menu.styles-BDla58Rm.js","assets/projectMeta-BWbhUUto.js","assets/vendor-dnd-kit-core-DK4OoOTr.js","assets/vendor-dnd-kit-accessibility-BOtnpZt5.js","assets/vendor-dnd-kit-sortable-Cv69eQm1.js","assets/YuriLogo-CMUoGUHc.js","assets/themes-BgDJcxRc.js","assets/scheduledTaskNavigation-Cq5yavoC.js","assets/theme-validation-BGYdrOu7.js","assets/sessionLookup-C5PqXLxX.js","assets/useDictation-DFVJpRbm.js","assets/LoadingImage-sZ5omN5L.js","assets/ImageLoadingPlaceholder-DlQbo9CM.js","assets/image-loading-DKQOYtti.js","assets/image-loading-D9Z_BASK.css","assets/sessionLookup-8C8nv-EP.css","assets/fileMentionTouchSelection-ByaQJcTS.js","assets/insertionBoundaries-B4bC9qgT.js","assets/appThemeRegistry-BPdYCLOO.js","assets/queue-abort-optimistic-DtYEhMau.js","assets/MarkdownRenderer-DGzKU_XU.js","assets/useEffectiveDirectory-Bs2Faeyd.js","assets/markdownHeightCache-xNkQdlqi.js","assets/url-MRa-FtQa.js","assets/toolHelpers-iEHVHQ9p.js","assets/react-a6PrrNTm.js","assets/FadeInOnReveal-BRrU2ivL.js","assets/useWorkerHighlightedLines-Deu-7c07.js","assets/markdownTheme-CHNl6tUv.js","assets/markdown-worker-oBGEB9Eg.js","assets/vendor-tanstack-react-virtual-DSFNK3qc.js","assets/vendor-cmdk-C_tivUtr.js","assets/vendor-aria-hidden-BbL3cEyI.js","assets/sortable-tabs-strip-CiP6RIQa.js","assets/speechSettingsQueries-CH_dJTpo.js","assets/vendor-motion-C9oiAdx-.js","assets/useStreamingTextThrottle-VhgGU_te.js","assets/useFontPreferences-CEK8G_Ps.js","assets/terminalApi-BMWW_0wH.js","assets/useAppFontEffects-RpgNbjA4.css","assets/tap-LkQum5bB.js","assets/MobileTabPageHeader-C5Dtuye8.js","assets/vendor-codemirror-autocomplete-C0FrlFqZ.js","assets/vendor-codemirror-lang-angular-Cm7vBE3E.js","assets/vendor-codemirror-lang-json-DowyFczU.js","assets/vendor-codemirror-lang-markdown-npWBZIoE.js","assets/vendor-codemirror-lang-python-OPRdU26g.js","assets/vendor-codemirror-legacy-modes-DwltVFbT.js","assets/mcpQueries-Di9eZpfK.js","assets/usePluginsStore-CXtG20Qq.js","assets/collapsible-B7esGYLd.js","assets/vendor-codemirror-commands-5saeUOVY.js","assets/vendor-codemirror-search-hZY-L2l8.js","assets/vendor-replit-codemirror-vim-BmQmU1lR.js","assets/vendor-codemirror-language-data-B3pLWvv-.js","assets/projectActions-BX0cjZoq.js","assets/AssistantContactStatus-C4ThLOq7.js","assets/assistant-attachment-cache-oatc8F4t.js","assets/runtimeEndpointReset-DIBGo-YW.js","assets/YuriWordmark-DHYo0FlR.js","assets/mobileBackNavigation-BkqQCUgK.js","assets/AssistantUnreadBadge-hQZ4K5Mn.js","assets/context-menu-DWn1nSZC.js","assets/readiness-B-XfWILI.js","assets/native-errors-06if6eu-.js","assets/appearance--vFosLNi.js","assets/vendor-cron-parser-BmO80h0C.js","assets/runtimeEndpointReset-BP4JwHFJ.css","assets/SettingsView-BVjXaBTd.js","assets/native-config-gu6Y4GgW.js","assets/vendor-qrcode-D7jBCyl-.js","assets/vendor-dijkstrajs-BAzPDGZM.js","assets/VoiceSettings-CFcLPtb6.js","assets/VoiceSettings-C0HSdVvS.css","assets/GuiPluginWindow-BykPaQeY.js","assets/vendor-yaml-C9KlJAlj.js","assets/AssistantView-Co3DeAd6.js","assets/touch-gestures-CErgaXZ7.js","assets/renderMobileApp-1G4-5u-t.css","assets/src-BgE3FRXg.css","assets/main-DSCosXET.js","assets/useDesktopWindowControlsLayout-CA5WUl2y.js","assets/historyImportQueries-C8VK9R5_.js","assets/diagram-Bnra5_6g.js","assets/vendor-react-drawio-Dyg1-39Q.js","assets/multirun-BMtax1t7.js","assets/vendor-zumer-snapdom-yq9vlCKr.js","assets/vendor-html-to-image-BDMm2v6d.js","assets/main-qSeeJRW1.css"])))=>i.map(i=>d[i]);
2
- import{n as e,t}from"./runtimeConfig-BHspntnx.js";import{o as n}from"./vendor-aparajita-capacitor-secure-storage-xol_6BsB.js";/* empty css */var r=`true`,i=`false`,a=r===`true`,o=i===`true`;function s(e={}){let{immediate:t=!1,onNeedReload:r,onNeedRefresh:i,onOfflineReady:s,onRegistered:c,onRegisteredSW:l,onRegisterError:u}=e,d,f,p,m=async(e=!0)=>{await f,a||p?.()};async function h(){if(`serviceWorker`in navigator){if(d=await n(async()=>{let{Workbox:e}=await import(`./vendor-workbox-window-15MWHJyx.js`).then(e=>e.t);return{Workbox:e}},__vite__mapDeps([0,1])).then(({Workbox:e})=>new e(`/sw.js`,{scope:`/`,type:`classic`})).catch(e=>{u?.(e)}),!d)return;if(p=()=>{d?.messageSkipWaiting()},!o)if(a)d.addEventListener(`activated`,e=>{(e.isUpdate||e.isExternal)&&(r?r():window.location.reload())}),d.addEventListener(`installed`,e=>{e.isUpdate||s?.()});else{let e=!1,t=()=>{e=!0,d?.addEventListener(`controlling`,e=>{e.isUpdate&&(r?r():window.location.reload())}),i?.()};d.addEventListener(`installed`,n=>{n.isUpdate===void 0?n.isExternal===void 0?!e&&s?.():n.isExternal?t():!e&&s?.():n.isUpdate||s?.()}),d.addEventListener(`waiting`,t)}d.register({immediate:t}).then(e=>{l?l(`/sw.js`,e):c?.(e)}).catch(e=>{u?.(e)})}}return f=h(),m}window.__YURI_RUNTIME_APIS__=t();var c=()=>typeof window>`u`||typeof window.matchMedia!=`function`?!1:window.matchMedia(`(pointer: coarse)`).matches,l=(()=>{let e=new URLSearchParams(window.location.search).get(`surface`);if(e===`mobile`)return`mobile`;if(e===`desktop`)return`desktop`;let t=Math.min(window.innerWidth||0,window.screen?.width||window.innerWidth||0),n=navigator.maxTouchPoints||0;return t>0&&t<=760&&(n>0||c())?`mobile`:`desktop`})();window.__YURI_SURFACE__=l;var u=()=>!(!(`serviceWorker`in navigator)||!window.isSecureContext||window.location.protocol!==`http:`&&window.location.protocol!==`https:`||document.prerendering||String(document.visibilityState)===`prerender`),d=e=>{let t=!1,n=()=>{t||u()&&(t=!0,e())},r=()=>{setTimeout(n,0)};document.readyState===`complete`?r():window.addEventListener(`load`,r,{once:!0}),(document.prerendering||String(document.visibilityState)===`prerender`)&&document.addEventListener(`visibilitychange`,n,{once:!0})},f=()=>{d(()=>{try{s({onRegisterError(e){console.warn(`[PWA] service worker registration skipped:`,e)}})}catch(e){console.warn(`[PWA] service worker registration skipped:`,e)}})},p=`yuri.dev.module-reload`,m=(e,t)=>{console.error(`[yuri] failed to load ${t}:`,e)};l===`mobile`?n(async()=>{let{renderMobileApp:e}=await import(`./renderMobileApp-Cz0fF7ge.js`);return{renderMobileApp:e}},__vite__mapDeps([2,1,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165])).then(({renderMobileApp:e})=>{try{sessionStorage.removeItem(p)}catch{}e(window.__YURI_RUNTIME_APIS__??t())}).catch(e=>m(e,`renderMobileApp`)):e().then(()=>n(()=>import(`./main-DSCosXET.js`),__vite__mapDeps([166,1,3,4,5,10,6,70,7,8,9,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,124,31,29,128,32,33,34,35,36,37,38,39,40,41,43,44,45,46,47,48,49,50,52,53,42,54,55,56,57,63,64,65,66,68,69,71,72,73,74,59,62,58,60,61,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,67,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,125,127,129,130,131,132,133,134,135,136,137,138,139,140,141,167,144,145,146,147,148,149,150,151,152,153,168,169,170,171,172,173,174,165]))).then(()=>{try{sessionStorage.removeItem(p)}catch{}}).catch(e=>m(e,`desktop main`)),f();
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/vendor-workbox-window-15MWHJyx.js","assets/rolldown-runtime-hePW80VL.js","assets/renderMobileApp-BEWiG7ie.js","assets/runtime-auth-DBn9yahL.js","assets/runtime-switch-DEZ1K7qW.js","assets/runtime-fetch-D0YWp3FJ.js","assets/runtimeAPIRegistry-C2VogTny.js","assets/vendor-zustand-vDaAPGfl.js","assets/vendor-base-ui-CzHs0bHY.js","assets/gitApiHttp-MWsHNHuo.js","assets/desktop-BAmoc_34.js","assets/vendor-opencode-client-cQ47ywrT.js","assets/vendor-effect-X1Hqc7ba.js","assets/brand-storage-bootstrap-D4BW3w-M.js","assets/brand-storage-migration-Bhz6UOBJ.js","assets/useUIStore-BerIUSLP.js","assets/bootstrap-C8paoQ0j.js","assets/vendor-react-DlzBev0S.js","assets/queryRuntime-2dx7jbt9.js","assets/vendor-tanstack-query-core-Y_YoRHtC.js","assets/pathNormalization-ewtPqJWn.js","assets/vendor-pathe-vBmvQE8f.js","assets/runtime-ead7P81A.js","assets/runtime-file-resource-BP4P52ry.js","assets/fileQueries-C2Rs6TPz.js","assets/vendor-tanstack-react-query-B-Wpqq5J.js","assets/runtime-file-store-BVRgEtI-.js","assets/path-utils-jGozTg9d.js","assets/vendor-aparajita-capacitor-secure-storage-xol_6BsB.js","assets/platform-sEg2IOLZ.js","assets/capgoAdapter-C3LxG5Eu.js","assets/types-DUFadVpY.js","assets/vendor-pierre-diffs-BFiZ3IhI.js","assets/vendor-hast-util-to-html-Bw_SgZ1t.js","assets/vendor-character-entities-legacy-Wut6vMuj.js","assets/vendor-character-entities-html4-DlN_yAFd.js","assets/vendor-ccount-CyGsA0u7.js","assets/vendor-comma-separated-tokens-B9ouxNNS.js","assets/vendor-oniguruma-to-es-CrHzjjSU.js","assets/vendor-oniguruma-parser-D2DIvhSP.js","assets/vendor-diff-Dq7CZNim.js","assets/vendor-lru_map-BMOrLc9L.js","assets/vendor-sonner-BEHGipm5.js","assets/vendor-reactuses-core-DWo5Wn6R.js","assets/vendor-lodash-es-BS45jPoZ.js","assets/vendor-js-cookie-hSOiFTtX.js","assets/button-C-gRcs_2.js","assets/store-OjrIiXCx.js","assets/tour-DDI0Zg7l.js","assets/vendor-class-variance-authority-BLUaYARZ.js","assets/vendor-tailwind-merge-BicNWLTg.js","assets/MobileShareBridge-13ws-R6X.js","assets/MobileDetailNavigation-pEUXnpqd.js","assets/useMobileNavigationStore-DHX2bCjA.js","assets/useAssistantUIStore-D25VqrpK.js","assets/vendor-zod-DZzbCm1s.js","assets/vendor-opencode-schema-DWT45VBX.js","assets/Icon-OJf0qBKf.js","assets/AgentAvatar-DLzcNrQ0.js","assets/agentColors-DWSbQXy2.js","assets/vendor-dicebear-core-CV95S5Pg.js","assets/vendor-dicebear-styles-C4OfoX7R.js","assets/dualLimitLru-D8Sphgua.js","assets/useThemeSystem-CNzUUkFn.js","assets/vendor-framer-motion-DDMKlXiP.js","assets/dialog-3UseH0hM.js","assets/dialog-CTYD3Sbr.css","assets/rasterizePng-056Poix7.js","assets/gitApi-DxUmZcUw.js","assets/useAppFontEffects-B-VpUGq4.js","assets/desktopHosts-BLU1tGSX.js","assets/desktopRelayRestore-2BIIs8mZ.js","assets/fileMentionAutocompleteState-BZJqfgae.js","assets/vendor-fuse.js-DB5wDJbI.js","assets/vendor-fuzzysort-ukaRp9PC.js","assets/vendor-simplewebauthn-browser-Dwhcdg_5.js","assets/checkbox-BrJBzET8.js","assets/input-CmLlZdeD.js","assets/tooltip-Degmpxnd.js","assets/pwa-BApESewB.js","assets/MobileResizableSheet-DuAi_epR.js","assets/MobileWindowStack-DGLdgoGr.js","assets/select-J8r9SxHt.js","assets/device-w1ioiqv3.js","assets/textarea-BHgcxJdC.js","assets/OverlayScrollbar-CZD1yU06.js","assets/dropdown-menu.styles-BDla58Rm.js","assets/projectMeta-DD7W5l0p.js","assets/vendor-dnd-kit-core-DK4OoOTr.js","assets/vendor-dnd-kit-accessibility-BOtnpZt5.js","assets/vendor-dnd-kit-sortable-Cv69eQm1.js","assets/YuriLogo-CMUoGUHc.js","assets/themes-BgDJcxRc.js","assets/scheduledTaskNavigation-Cq5yavoC.js","assets/theme-validation-BGYdrOu7.js","assets/sessionLookup-CV0eH5rT.js","assets/useDictation-DFVJpRbm.js","assets/LoadingImage-sZ5omN5L.js","assets/ImageLoadingPlaceholder-DlQbo9CM.js","assets/image-loading-DKQOYtti.js","assets/image-loading-D9Z_BASK.css","assets/sessionLookup-8C8nv-EP.css","assets/fileMentionTouchSelection-ByaQJcTS.js","assets/insertionBoundaries-DUy8i_LT.js","assets/appThemeRegistry-ClsRp7sO.js","assets/queue-abort-optimistic-DEras0MF.js","assets/MarkdownRenderer-CJAX6rqh.js","assets/useEffectiveDirectory-F4aXdQ21.js","assets/markdownHeightCache-xNkQdlqi.js","assets/url-MRa-FtQa.js","assets/toolHelpers-iEHVHQ9p.js","assets/react-a6PrrNTm.js","assets/FadeInOnReveal-BRrU2ivL.js","assets/useWorkerHighlightedLines-Di0GTxuY.js","assets/markdownTheme-CHNl6tUv.js","assets/markdown-worker-oBGEB9Eg.js","assets/vendor-tanstack-react-virtual-DSFNK3qc.js","assets/vendor-cmdk-C_tivUtr.js","assets/vendor-aria-hidden-BbL3cEyI.js","assets/sortable-tabs-strip-CiP6RIQa.js","assets/speechSettingsQueries-C_e3XdqK.js","assets/vendor-motion-C9oiAdx-.js","assets/useStreamingTextThrottle-VhgGU_te.js","assets/useFontPreferences-CEK8G_Ps.js","assets/terminalApi-BMWW_0wH.js","assets/useAppFontEffects-RpgNbjA4.css","assets/tap-LkQum5bB.js","assets/MobileTabPageHeader-BxUA9rmy.js","assets/vendor-codemirror-autocomplete-C0FrlFqZ.js","assets/vendor-codemirror-lang-angular-Cm7vBE3E.js","assets/vendor-codemirror-lang-json-DowyFczU.js","assets/vendor-codemirror-lang-markdown-npWBZIoE.js","assets/vendor-codemirror-lang-python-OPRdU26g.js","assets/vendor-codemirror-legacy-modes-DwltVFbT.js","assets/mcpQueries-UE2a-IBc.js","assets/usePluginsStore-YObSp0OZ.js","assets/collapsible-B7esGYLd.js","assets/vendor-codemirror-commands-5saeUOVY.js","assets/vendor-codemirror-search-hZY-L2l8.js","assets/vendor-replit-codemirror-vim-BmQmU1lR.js","assets/vendor-codemirror-language-data-B3pLWvv-.js","assets/projectActions-BX0cjZoq.js","assets/AssistantContactStatus-PWo73pfN.js","assets/assistant-attachment-cache-oatc8F4t.js","assets/runtimeEndpointReset-Dc7CPkqY.js","assets/YuriWordmark-DHYo0FlR.js","assets/mobileBackNavigation-DaCBsLLk.js","assets/AssistantUnreadBadge-PRiDJ-Ys.js","assets/context-menu-DWn1nSZC.js","assets/readiness-DSB26e24.js","assets/native-errors-06if6eu-.js","assets/appearance--vFosLNi.js","assets/vendor-cron-parser-BmO80h0C.js","assets/runtimeEndpointReset-BP4JwHFJ.css","assets/SettingsView-DI-zla9J.js","assets/native-config-C32KBsgV.js","assets/vendor-qrcode-D7jBCyl-.js","assets/vendor-dijkstrajs-BAzPDGZM.js","assets/VoiceSettings-Y1dbxZXa.js","assets/VoiceSettings-C0HSdVvS.css","assets/GuiPluginWindow-BykPaQeY.js","assets/vendor-yaml-C9KlJAlj.js","assets/AssistantView-Cuz4v_fG.js","assets/touch-gestures-CErgaXZ7.js","assets/renderMobileApp-1G4-5u-t.css","assets/src-BgE3FRXg.css","assets/main-D7TMj7hd.js","assets/useDesktopWindowControlsLayout-DMCQ5xgT.js","assets/historyImportQueries-C8VK9R5_.js","assets/diagram-Bnra5_6g.js","assets/vendor-react-drawio-Dyg1-39Q.js","assets/multirun-C-f8cwos.js","assets/vendor-zumer-snapdom-yq9vlCKr.js","assets/vendor-html-to-image-BDMm2v6d.js","assets/main-qSeeJRW1.css"])))=>i.map(i=>d[i]);
2
+ import{n as e,t}from"./runtimeConfig-CRxel2dc.js";import{o as n}from"./vendor-aparajita-capacitor-secure-storage-xol_6BsB.js";/* empty css */var r=`true`,i=`false`,a=r===`true`,o=i===`true`;function s(e={}){let{immediate:t=!1,onNeedReload:r,onNeedRefresh:i,onOfflineReady:s,onRegistered:c,onRegisteredSW:l,onRegisterError:u}=e,d,f,p,m=async(e=!0)=>{await f,a||p?.()};async function h(){if(`serviceWorker`in navigator){if(d=await n(async()=>{let{Workbox:e}=await import(`./vendor-workbox-window-15MWHJyx.js`).then(e=>e.t);return{Workbox:e}},__vite__mapDeps([0,1])).then(({Workbox:e})=>new e(`/sw.js`,{scope:`/`,type:`classic`})).catch(e=>{u?.(e)}),!d)return;if(p=()=>{d?.messageSkipWaiting()},!o)if(a)d.addEventListener(`activated`,e=>{(e.isUpdate||e.isExternal)&&(r?r():window.location.reload())}),d.addEventListener(`installed`,e=>{e.isUpdate||s?.()});else{let e=!1,t=()=>{e=!0,d?.addEventListener(`controlling`,e=>{e.isUpdate&&(r?r():window.location.reload())}),i?.()};d.addEventListener(`installed`,n=>{n.isUpdate===void 0?n.isExternal===void 0?!e&&s?.():n.isExternal?t():!e&&s?.():n.isUpdate||s?.()}),d.addEventListener(`waiting`,t)}d.register({immediate:t}).then(e=>{l?l(`/sw.js`,e):c?.(e)}).catch(e=>{u?.(e)})}}return f=h(),m}window.__YURI_RUNTIME_APIS__=t();var c=()=>typeof window>`u`||typeof window.matchMedia!=`function`?!1:window.matchMedia(`(pointer: coarse)`).matches,l=(()=>{let e=new URLSearchParams(window.location.search).get(`surface`);if(e===`mobile`)return`mobile`;if(e===`desktop`)return`desktop`;let t=Math.min(window.innerWidth||0,window.screen?.width||window.innerWidth||0),n=navigator.maxTouchPoints||0;return t>0&&t<=760&&(n>0||c())?`mobile`:`desktop`})();window.__YURI_SURFACE__=l;var u=()=>!(!(`serviceWorker`in navigator)||!window.isSecureContext||window.location.protocol!==`http:`&&window.location.protocol!==`https:`||document.prerendering||String(document.visibilityState)===`prerender`),d=e=>{let t=!1,n=()=>{t||u()&&(t=!0,e())},r=()=>{setTimeout(n,0)};document.readyState===`complete`?r():window.addEventListener(`load`,r,{once:!0}),(document.prerendering||String(document.visibilityState)===`prerender`)&&document.addEventListener(`visibilitychange`,n,{once:!0})},f=()=>{d(()=>{try{s({onRegisterError(e){console.warn(`[PWA] service worker registration skipped:`,e)}})}catch(e){console.warn(`[PWA] service worker registration skipped:`,e)}})},p=`yuri.dev.module-reload`,m=(e,t)=>{console.error(`[yuri] failed to load ${t}:`,e)};l===`mobile`?n(async()=>{let{renderMobileApp:e}=await import(`./renderMobileApp-BEWiG7ie.js`);return{renderMobileApp:e}},__vite__mapDeps([2,1,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165])).then(({renderMobileApp:e})=>{try{sessionStorage.removeItem(p)}catch{}e(window.__YURI_RUNTIME_APIS__??t())}).catch(e=>m(e,`renderMobileApp`)):e().then(()=>n(()=>import(`./main-D7TMj7hd.js`),__vite__mapDeps([166,1,3,4,5,10,6,70,7,8,9,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,124,31,29,128,32,33,34,35,36,37,38,39,40,41,43,44,45,46,47,48,49,50,52,53,42,54,55,56,57,63,64,65,66,68,69,71,72,73,74,59,62,58,60,61,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,67,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,125,127,129,130,131,132,133,134,135,136,137,138,139,140,141,167,144,145,146,147,148,149,150,151,152,153,168,169,170,171,172,173,174,165]))).then(()=>{try{sessionStorage.removeItem(p)}catch{}}).catch(e=>m(e,`desktop main`)),f();