@yuriai/web 0.3.3-beta.2 → 0.3.3-beta.6

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 (127) hide show
  1. package/dist/assets/{AgentAvatar-tFfpSF5F.js → AgentAvatar-CrUv9gTt.js} +1 -1
  2. package/dist/assets/{AssistantConversationSurface-B-iO-AUW.js → AssistantConversationSurface-Cc6aVDu6.js} +3 -3
  3. package/dist/assets/{AssistantSessionCard-DTPufGP2.js → AssistantSessionCard-BmhD5W6i.js} +2 -2
  4. package/dist/assets/{AssistantUnreadBadge-BV2cbiJo.js → AssistantUnreadBadge-ChMjxJpd.js} +1 -1
  5. package/dist/assets/{AssistantView-iKt4ZcoR.js → AssistantView-DvvRhVy5.js} +1 -1
  6. package/dist/assets/{DiagramView-SHoXhtXa.js → DiagramView-Bx4MHn6w.js} +1 -1
  7. package/dist/assets/{FadeInOnReveal-4E61VUmD.js → FadeInOnReveal-CCYD6XoW.js} +1 -1
  8. package/dist/assets/{GuiPluginPage-Bt5j7vkr.js → GuiPluginPage-Dk98X93G.js} +1 -1
  9. package/dist/assets/{GuiPluginSurface-Bs9Pauc8.js → GuiPluginSurface-D7HG0akj.js} +1 -1
  10. package/dist/assets/{GuiPluginWindow-cnUkWFge.js → GuiPluginWindow-GczL--5K.js} +1 -1
  11. package/dist/assets/Icon-Di_QdcPG.js +1 -0
  12. package/dist/assets/{ImageLoadingPlaceholder-BBMhxtKr.js → ImageLoadingPlaceholder-Bl9JFPan.js} +1 -1
  13. package/dist/assets/{LoadingImage-6BZsPXXb.js → LoadingImage-C4cAJD72.js} +1 -1
  14. package/dist/assets/{MarkdownRenderer-Bjl6sXps.js → MarkdownRenderer-B5s2OsEB.js} +2 -2
  15. package/dist/assets/{MarkdownRendererImpl-tZSoVcrU.js → MarkdownRendererImpl-D-UkyQuG.js} +2 -2
  16. package/dist/assets/{MarkstreamRendererImpl-Br2_lE4f.js → MarkstreamRendererImpl-CR66WFFY.js} +1 -1
  17. package/dist/assets/{MobileDetailNavigation-B7vAsqVU.js → MobileDetailNavigation-BBD0XNgQ.js} +1 -1
  18. package/dist/assets/{MobileResizableSheet-BJs0jEqn.js → MobileResizableSheet-BnyO-EeM.js} +1 -1
  19. package/dist/assets/{MobileShareBridge-Cb9GvxGv.js → MobileShareBridge-B9_01pMV.js} +1 -1
  20. package/dist/assets/MobileSurface-D80bMoDS.js +2 -0
  21. package/dist/assets/{MultiRunWindow-DPM25lxz.js → MultiRunWindow-CHNKLgpu.js} +1 -1
  22. package/dist/assets/{OnboardingScreen-D7ns1Tb2.js → OnboardingScreen-IW7mgTbp.js} +1 -1
  23. package/dist/assets/{OverlayScrollbar-B1PH1Jtv.js → OverlayScrollbar-Y8emBCvD.js} +1 -1
  24. package/dist/assets/{RemoteAssistantSessionCard-BLp9NZhL.js → RemoteAssistantSessionCard-CsS0IEzX.js} +1 -1
  25. package/dist/assets/{SettingsView-CaC2DI4Z.js → SettingsView-DsdNryfB.js} +10 -10
  26. package/dist/assets/{SettingsWindow-gVPRXQDh.js → SettingsWindow-Duoh0yJA.js} +1 -1
  27. package/dist/assets/{SetupTourDialog-BoQIvdEP.js → SetupTourDialog-CorV2qZg.js} +1 -1
  28. package/dist/assets/{TerminalView-CxlIRxha.js → TerminalView-Dkk1cVgf.js} +3 -3
  29. package/dist/assets/{ToolOutputDialog-Bsx1wpVW.js → ToolOutputDialog-BnOil_Y-.js} +1 -1
  30. package/dist/assets/{VoiceSettings-DhA9feRU.js → VoiceSettings-ciGa8WKn.js} +2 -2
  31. package/dist/assets/{YuriLogo-BKdnDJwl.js → YuriLogo-BJ6Ao0du.js} +1 -1
  32. package/dist/assets/{capgoAdapter-vj-M8YQp.js → capgoAdapter-BR9RFIfy.js} +1 -1
  33. package/dist/assets/{checkbox-DVMeOiMB.js → checkbox-Dytz3_ID.js} +1 -1
  34. package/dist/assets/{collapsible-D_R6x2Q_.js → collapsible-BBQwZmAQ.js} +1 -1
  35. package/dist/assets/{context-menu-BFDbtdmK.js → context-menu-xDEMpuCk.js} +1 -1
  36. package/dist/assets/{diagram-CrjNCLmc.js → diagram-DSwu2yKQ.js} +1 -1
  37. package/dist/assets/dialog-D9CkSNCA.css +1 -0
  38. package/dist/assets/{dialog-CHzvxSP4.js → dialog-Dzn-bQVo.js} +1 -1
  39. package/dist/assets/{es-DuTK1iYh.js → es-DeIqmCOk.js} +1 -1
  40. package/dist/assets/{fileMentionTouchSelection-D9GbR7zD.js → fileMentionTouchSelection-CFrWx6JK.js} +1 -1
  41. package/dist/assets/{fileReferenceActions-DLTUzjwi.js → fileReferenceActions-I56JyL1L.js} +1 -1
  42. package/dist/assets/{fr-C_XToFWm.js → fr-6zgvS9k_.js} +1 -1
  43. package/dist/assets/{gitApi-i_uT8MNk.js → gitApi-Cxw-b-S_.js} +1 -1
  44. package/dist/assets/gitApiHttp-CODO8JTV.js +3 -0
  45. package/dist/assets/{i18n-BvjeIWrT.js → i18n-Bfzj0WR9.js} +1 -1
  46. package/dist/assets/{input-Ck9_Qln_.js → input-D7D-3e9R.js} +1 -1
  47. package/dist/assets/insertionBoundaries-JO44Mllr.js +1 -0
  48. package/dist/assets/{ja-D0pDybpB.js → ja-DQM9NnCu.js} +1 -1
  49. package/dist/assets/{ko-CAzlaaDJ.js → ko-BSB5UaTU.js} +1 -1
  50. package/dist/assets/main-BVNVtnJ2.js +169 -0
  51. package/dist/assets/{main-_RMi6lwy.js → main-ezlqSGuw.js} +2 -2
  52. package/dist/assets/{markdownHeightCache-CnLR3-I2.js → markdownHeightCache-BPOYloX8.js} +1 -1
  53. package/dist/assets/{mcpQueries-MmcRk0_G.js → mcpQueries-D1Y8jS59.js} +1 -1
  54. package/dist/assets/{miniChat-CEE6OnLk.js → miniChat-DjyhdG-q.js} +2 -2
  55. package/dist/assets/{mobile-Cc6EYN5S.js → mobile-jNSOJK8S.js} +2 -2
  56. package/dist/assets/{mobileBackNavigation-C6UPWCkI.js → mobileBackNavigation-CDjFrmY0.js} +1 -1
  57. package/dist/assets/{mobileConnections-D8TC3-vN.js → mobileConnections-CAWX3Kcj.js} +2 -2
  58. package/dist/assets/multirun-Cm02Mr2G.js +3 -0
  59. package/dist/assets/{native-config-JMwpif8a.js → native-config-DsW9-ijz.js} +1 -1
  60. package/dist/assets/{navigation-toBhZ-X8.js → navigation-DPATOY-c.js} +1 -1
  61. package/dist/assets/{openRemoteProjectSession-BD2tHXKw.js → openRemoteProjectSession-DyFX_iVc.js} +1 -1
  62. package/dist/assets/{pl-BvjbUcJV.js → pl-CLtzYvN2.js} +1 -1
  63. package/dist/assets/projectMeta-CfR3wyL_.js +1 -0
  64. package/dist/assets/{pt-BR-D71qrP91.js → pt-BR-DHHBbOs_.js} +1 -1
  65. package/dist/assets/pwa-NS2m1emq.js +2 -0
  66. package/dist/assets/{queue-abort-optimistic-BizaMpYT.js → queue-abort-optimistic-b6yciGim.js} +1 -1
  67. package/dist/assets/{react-DeCzn0Uc.js → react-Tx7JylRi.js} +1 -1
  68. package/dist/assets/{readiness-CekKZ6au.js → readiness-DSoWdMsS.js} +2 -2
  69. package/dist/assets/{reference-history-cPgFTsku.js → reference-history-C-uAk3vA.js} +1 -1
  70. package/dist/assets/{remoteSessionReference-Da4ThgtH.js → remoteSessionReference-Dt-1LC6L.js} +1 -1
  71. package/dist/assets/renderElectronMiniChatApp-P2AchMs8.js +2 -0
  72. package/dist/assets/renderMobileApp-MngDLpRV.js +29 -0
  73. package/dist/assets/{runtimeConfig-CPU1CoUI.js → runtimeConfig-BL7RTChM.js} +1 -1
  74. package/dist/assets/runtimeEndpointReset-DtqLL5aK.js +151 -0
  75. package/dist/assets/{scheduledTaskNavigation-CdBHn9ti.js → scheduledTaskNavigation-DkvuAc9T.js} +1 -1
  76. package/dist/assets/{select-BnDfHG_T.js → select-CFaRXt8t.js} +1 -1
  77. package/dist/assets/{sessionLookup-mQtUvdep.js → sessionLookup-5sf3gI5Y.js} +1 -1
  78. package/dist/assets/{sortable-tabs-strip-BwnT5maB.js → sortable-tabs-strip-CbBdtUqa.js} +1 -1
  79. package/dist/assets/{speechSettingsQueries-mH-OoFPq.js → speechSettingsQueries-BiYS8kXM.js} +1 -1
  80. package/dist/assets/src-AdfuQoIg.css +2 -0
  81. package/dist/assets/{store-Dj5cSf8B.js → store-DHAsbqgT.js} +3 -3
  82. package/dist/assets/{terminalApi-CwTOFYhX.js → terminalApi-G5w9aIzr.js} +1 -1
  83. package/dist/assets/{textarea-CVswImHY.js → textarea-BmnYSVu_.js} +1 -1
  84. package/dist/assets/{tooltip-DovnVenD.js → tooltip-R2z0xQFW.js} +1 -1
  85. package/dist/assets/{types-CnPxR5yQ.js → types-e0zJKRUL.js} +1 -1
  86. package/dist/assets/{uk-C7c1Zece.js → uk-CyIloyBp.js} +1 -1
  87. package/dist/assets/{useAppFontEffects-wm0ojvh7.js → useAppFontEffects-oL2HGfzG.js} +32 -32
  88. package/dist/assets/{useAssistantUIStore-CI42fWZh.js → useAssistantUIStore-MY4QWnVQ.js} +1 -1
  89. package/dist/assets/useDesktopWindowControlsLayout-BuN9KNjx.js +1 -0
  90. package/dist/assets/{useDictation-OLmxagFb.js → useDictation-BNEvKslr.js} +1 -1
  91. package/dist/assets/{useEffectiveDirectory-BN5qbhev.js → useEffectiveDirectory-gMI2T7Pz.js} +1 -1
  92. package/dist/assets/{useFontPreferences-DN1mCOsX.js → useFontPreferences-BqPDrGZM.js} +1 -1
  93. package/dist/assets/{useMobileNavigationStore-oveTY29a.js → useMobileNavigationStore-DRQ4Efws.js} +12 -12
  94. package/dist/assets/{usePluginsStore-DErHgEFY.js → usePluginsStore-Bj97xU5Y.js} +1 -1
  95. package/dist/assets/{useProjectRuntimeAPIs-B-ShHy6s.js → useProjectRuntimeAPIs-BfWU7Tyh.js} +1 -1
  96. package/dist/assets/{useStreamingTextThrottle-BOvHQRrH.js → useStreamingTextThrottle-DrOvDNCU.js} +1 -1
  97. package/dist/assets/useUIStore-mVT8ipsT.js +1 -0
  98. package/dist/assets/{zh-CN-D2ENuI1-.js → zh-CN-BTolbntg.js} +1 -1
  99. package/dist/assets/{zh-TW-C40BXFhK.js → zh-TW-D00IKXY1.js} +1 -1
  100. package/dist/index.html +9 -9
  101. package/dist/mini-chat.html +9 -9
  102. package/dist/mobile.html +2 -2
  103. package/package.json +1 -1
  104. package/server/lib/opencode/settings-helpers.js +6 -0
  105. package/server/lib/opencode/settings-helpers.test.js +8 -0
  106. package/server/lib/session-index/DOCUMENTATION.md +27 -0
  107. package/server/lib/session-index/event-ingest.js +6 -2
  108. package/server/lib/session-index/event-ingest.test.js +12 -0
  109. package/server/lib/session-index/routes.js +26 -0
  110. package/server/lib/session-index/routes.test.js +53 -0
  111. package/server/lib/session-index/service.js +79 -1
  112. package/server/lib/session-index/service.test.js +125 -1
  113. package/dist/assets/Icon-DebSeH2D.js +0 -1
  114. package/dist/assets/MobileSurface-BaT1L70D.js +0 -2
  115. package/dist/assets/dialog-DYOEW9DC.css +0 -1
  116. package/dist/assets/gitApiHttp-BgUDBfaJ.js +0 -3
  117. package/dist/assets/insertionBoundaries-BFmZupL3.js +0 -1
  118. package/dist/assets/main-RbzEHxam.js +0 -169
  119. package/dist/assets/multirun-BJgG4Ymw.js +0 -3
  120. package/dist/assets/projectMeta-Bh7dUtdB.js +0 -1
  121. package/dist/assets/pwa-B2AKIaf6.js +0 -2
  122. package/dist/assets/renderElectronMiniChatApp-CmmEVsXV.js +0 -2
  123. package/dist/assets/renderMobileApp-D1D1s_ia.js +0 -29
  124. package/dist/assets/runtimeEndpointReset-Bwa7I9vS.js +0 -151
  125. package/dist/assets/src-2lmG4z55.css +0 -2
  126. package/dist/assets/useDesktopWindowControlsLayout-BBizNJUb.js +0 -1
  127. package/dist/assets/useUIStore-DjizmHAt.js +0 -1
@@ -1,3 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{F as t}from"./platform-CiUKDeXd.js";import{a as n,r}from"./vendor-zustand-CNn3HHhT.js";import{ot as i,st as a}from"./vendor-base-ui-fom6orB6.js";import{St as o}from"./gitApiHttp-BgUDBfaJ.js";import"./brand-storage-bootstrap-D4BW3w-M.js";import{_t as s,ft as c,n as l}from"./client-CzjApAA4.js";import{n as u}from"./vendor-react-D5BntRmA.js";import{V as d}from"./runtime-file-resource-CKQQEwNv.js";import{r as f}from"./vendor-reactuses-core-B8s-Rcd-.js";import{r as p}from"./useUIStore-DjizmHAt.js";import{c as m,t as ee}from"./i18n-BvjeIWrT.js";import{Ci as h,Ha as g,In as _,Qr as v,Rn as y,Ur as b,Vr as x,Zi as S,ca as C,f as w,p as T,ua as E,yi as D,zn as O,zr as k}from"./useMobileNavigationStore-oveTY29a.js";import{n as A}from"./Icon-DebSeH2D.js";import{t as te}from"./gitApi-i_uT8MNk.js";import{t as j}from"./checkbox-DVMeOiMB.js";import{t as ne}from"./input-Ck9_Qln_.js";import{i as re,n as M,t as ie}from"./tooltip-DovnVenD.js";import{a as ae}from"./device-BlmHHWT1.js";import{S as oe,_ as N,a as P,c as F,f as I,l as L,m as R,o as z,p as B,r as se,v as V,y as ce}from"./insertionBoundaries-BFmZupL3.js";import{a as H,c as le,d as U,i as W,n as ue,o as G,r as K,s as de,t as fe}from"./select-BnDfHG_T.js";import{r as q,t as pe}from"./textarea-CVswImHY.js";import{a as J,f as Y,h as me,i as X,m as he,n as ge}from"./projectMeta-Bh7dUtdB.js";import{n as _e,r as ve,t as ye}from"./collapsible-D_R6x2Q_.js";var Z=e(a(),1),be=u(),xe=/^[a-z0-9](?:[a-z0-9-]{0,48}[a-z0-9])?$/,Se=/^g[1-9]\d*$/,Q=(e,t,n,r,i)=>{if(!xe.test(e)||t!==void 0&&!Se.test(t)||!n?.trim()||!r?.trim()||n!==n.trim()||r!==r.trim())return null;if(i===void 0)return{groupSlug:e,runGroup:t,providerID:n,modelID:r,fusion:!1};if(i===`fusion`)return{groupSlug:e,runGroup:t,providerID:n,modelID:r,fusion:!0};if(!/^\d+$/.test(i))return null;let a=Number.parseInt(i,10);return!Number.isSafeInteger(a)||a<=0?null:{groupSlug:e,runGroup:t,providerID:n,modelID:r,index:a,fusion:!1}},Ce=e=>{if(!e)return null;let t=e.split(`/`);if(t.length<3||t.length>5)return null;let[n]=t;if(t.length===3)return Q(n,void 0,t[1],t[2],void 0);if(t.length===4){let[,e,r,i]=t;return Se.test(e)?Q(n,e,r,i,void 0):Q(n,void 0,e,r,i)}let[,r,i,a,o]=t;return r===``?Q(n,void 0,i,a,o):Q(n,r,i,a,o)},we=e=>{let t=[e.groupSlug];return e.runGroup&&t.push(e.runGroup),t.push(e.providerID,e.modelID),e.index!==void 0&&t.push(String(e.index)),t.join(`/`)},Te=(e,t,n,r)=>{let i=[e];return r&&i.push(r),i.push(t,n,`fusion`),i.join(`/`)},Ee=e=>e.toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``).substring(0,50),De=(e,t)=>`${Ee(e)}-${Ee(t)}`.substring(0,60),Oe=(e,t)=>`${e}/${t}`,ke=e=>{let t=e.replace(/\\/g,`/`);return t===`/`?`/`:t.length>1?t.replace(/\/+$/,``):t},Ae=(e,t)=>{let n=ke(t),r=e.directory,i=typeof r==`string`&&r.trim().length>0?e:{...e,directory:n};s(e.id,n),T.getState().markSessionAsYuriCreated(e.id),D.getState().upsertSession(i);try{c().ensureChild(n,{bootstrap:!1}).setState(t=>{let n=t.session.findIndex(t=>t.id===e.id);if(n>=0&&t.session[n]===i)return t;let r=n>=0?t.session.map((e,t)=>t===n?i:e):[...t.session,i].sort((e,t)=>e.id.localeCompare(t.id));return{session:r,sessionTotal:Math.max(t.sessionTotal,r.length),limit:Math.max(t.limit,r.length)}})}catch{}return i},je=()=>{let e=g.getState(),t=e.activeProjectId;if(!t)return null;let n=e.projects.find(e=>e.id===t);if(n?.path)return{id:n.id,path:n.path};let r=o.getState().currentDirectory??null;if(r&&r.trim().length>0){let e=r.replace(/\\/g,`/`).replace(/\/+$/,``)||r;return{id:`path:${e}`,path:e}}return null},Me=n()(r(e=>({isLoading:!1,error:null,createMultiRun:async t=>{let n=t.name.trim(),{groups:r,agent:i,files:a,setupCommands:o}=t;if(!n)return e({error:`Group name is required`}),null;if(!r||r.length===0)return e({error:`At least one run group is required`}),null;for(let t=0;t<r.length;t++){if(!r[t].prompt.trim())return e({error:`Group ${t+1}: prompt is required`}),null;if(r[t].models.length<1)return e({error:`Group ${t+1}: select at least 1 model`}),null;if(r[t].models.length>5)return e({error:`Group ${t+1}: maximum 5 models allowed`}),null}e({isLoading:!0,error:null});try{let s=je();if(!s)return e({error:`Select a project`,isLoading:!1}),null;let c=s.path,u=await te(c)&&t.isolateRuns!==!1,d=Ee(n),f=u?await Y(c):void 0,p=u?await L(c):null,m=[],ee=o?.filter(e=>e.trim().length>0)??[];for(let e=0;e<r.length;e++){let n=r[e],i=n.prompt,a=new Map;for(let e of n.models){let t=`${e.providerID}:${e.modelID}`;a.set(t,(a.get(t)||0)+1)}let o=new Map;for(let h of n.models){let n=`${h.providerID}:${h.modelID}`,g=a.get(n)||1,_=(o.get(n)||0)+1;o.set(n,_);let y=De(h.providerID,h.modelID),b=r.length>1?`g${e+1}`:void 0,S=g>1?Oe(d,`${y}/${_}`):Oe(d,y),C=b?`${b}/${S}`:S,w=we({groupSlug:d,runGroup:b,providerID:h.providerID,modelID:h.modelID,index:g>1?_:void 0});try{if(!u){let e=await l.withDirectory(c,()=>l.createSession({title:w}));Ae(e,c),m.push({sessionId:e.id,worktreePath:c,providerID:h.providerID,modelID:h.modelID,variant:h.variant,prompt:i});continue}let e=await F(s,{preferredName:C,mode:`new`,branchName:C,worktreeName:C,startRef:t.worktreeBaseBranch||`HEAD`,setupCommands:ee,returnAfterDirectoryCreated:!0},{resolvedRootTrackingRemote:p}),n={...e,createdFromBranch:f,kind:`standard`};await x(s)&&await v(e.worktreeRoot??e.path);let r=await l.withDirectory(e.path,()=>l.createSession({title:w}));Ae(r,e.path),T.getState().setWorktreeMetadata(r.id,n),m.push({sessionId:r.id,worktreePath:e.path,providerID:h.providerID,modelID:h.modelID,variant:h.variant,prompt:i})}catch(e){console.warn(`[MultiRun] Failed to create session:`,e)}}}let h=o?.filter(e=>e.trim().length>0)??[];h.length>0&&b(s,h).catch(()=>{console.warn(`[MultiRun] Failed to save worktree setup commands`)});let g=m.map(e=>e.sessionId),_=m[0]?.sessionId??null;if(g.length===0)return e({error:`Failed to create any sessions`,isLoading:!1}),null;let y=a?.map(e=>({type:`file`,mime:e.mime,filename:e.filename,url:e.url}));return(async()=>{try{await Promise.allSettled(m.map(async e=>{try{await w({sessionId:e.sessionId,directory:e.worktreePath,content:e.prompt,providerID:e.providerID,modelID:e.modelID,variant:e.variant,agent:i,files:y})}catch(e){console.warn(`[MultiRun] Failed to start run:`,e)}}))}catch(e){console.warn(`[MultiRun] Failed to start runs:`,e)}})(),e({isLoading:!1}),{groupSlug:d,sessionIds:g,firstSessionId:_}}catch(t){return e({error:t instanceof Error?t.message:`Failed to create Multi-Run`,isLoading:!1}),null}},clearError:()=>{e({error:null})}}),{name:`multirun-store`})),$=i(),Ne=`h-7`,Pe=()=>`${Date.now()}-${Math.random().toString(36).substring(2,9)}`,Fe=e=>{let t=(0,be.c)(13),{model:n,instanceIndex:r,totalSameModel:i,onRemove:a}=e,o=n.displayName||`${n.providerID}/${n.modelID}`,s=i>1?`${o} (${r})`:o,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=y(`flex items-center gap-1.5 px-2 rounded-md bg-interactive-selection/20 border border-border/30`,Ne),t[0]=c):c=t[0];let l;t[1]!==n.modelID||t[2]!==n.providerID?(l=(0,$.jsx)(U,{modelId:n.modelID,providerId:n.providerID,className:`h-3.5 w-3.5`}),t[1]=n.modelID,t[2]=n.providerID,t[3]=l):l=t[3];let u;t[4]===s?u=t[5]:(u=(0,$.jsx)(`span`,{className:`typography-meta font-medium truncate max-w-[140px]`,children:s}),t[4]=s,t[5]=u);let d;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,$.jsx)(A,{name:`close`,className:`h-3.5 w-3.5`}),t[6]=d):d=t[6];let f;t[7]===a?f=t[8]:(f=(0,$.jsx)(`button`,{type:`button`,onClick:a,className:`text-muted-foreground hover:text-foreground ml-0.5`,children:d}),t[7]=a,t[8]=f);let p;return t[9]!==l||t[10]!==u||t[11]!==f?(p=(0,$.jsxs)(`div`,{className:c,children:[l,u,f]}),t[9]=l,t[10]=u,t[11]=f,t[12]=p):p=t[12],p},Ie=e=>{let t=(0,be.c)(131),{selectedModels:n,onAdd:r,onRemove:i,onUpdate:a,minModels:o,addButtonLabel:s,showChips:c,maxModels:l,addButtonClassName:u,dropdownSide:d,dropdownClassName:f,containerClassName:m,triggerIcon:h}=e,g=c===void 0||c,v=d===void 0?`top`:d,{t:b}=ee(),x=S(Le),C=S(Re),w=p(ze),T=p(Be),{favoriteModelsList:D,recentModelsList:O}=he(),k=p(Ve),te=p(He),[j,ne]=Z.useState(!1),[re,M]=Z.useState(``),[ie,ae]=Z.useState(null),oe=Z.useRef(null),N=Z.useRef(null),P=l===1,F=l===void 0||n.length<l||P,I;if(t[0]!==n){I=new Map;for(let e of n){let t=`${e.providerID}:${e.modelID}`;I.set(t,(I.get(t)||0)+1)}t[0]=n,t[1]=I}else I=t[1];let L=I,R;t[2]===n?R=t[3]:(R=e=>n.filter(t=>t.providerID===e.providerID&&t.modelID===e.modelID).findIndex(t=>t.instanceId===e.instanceId)+1,t[2]=n,t[3]=R);let z=R,B,se;t[4]!==v||t[5]!==j?(B=()=>{if(!j||!N.current)return;let e=N.current.getBoundingClientRect();if(v===`bottom`){let t=(window.visualViewport?.height??document.documentElement.clientHeight??window.innerHeight)-e.bottom-16-112;ae(Math.max(160,Math.min(320,t)));return}let t=N.current.parentElement;for(;t&&!(t.getAttribute(`role`)===`dialog`||t.hasAttribute(`data-scroll-shadow`));){let e=getComputedStyle(t);if(e.overflow===`auto`||e.overflow===`hidden`||e.overflowY===`auto`||e.overflowY===`hidden`)break;t=t.parentElement}let n=t?t.getBoundingClientRect().top:0,r=e.top-n-16;ae(Math.max(150,Math.min(300,r)))},se=[v,j],t[4]=v,t[5]=j,t[6]=B,t[7]=se):(B=t[6],se=t[7]),Z.useEffect(B,se);let V,ce;t[8]!==F||t[9]!==j?(V=()=>{!F&&j&&(ne(!1),M(``))},ce=[F,j],t[8]=F,t[9]=j,t[10]=V,t[11]=ce):(V=t[10],ce=t[11]),Z.useEffect(V,ce);let H,U;t[12]===j?(H=t[13],U=t[14]):(H=()=>{if(!j)return;let e=e=>{oe.current&&!oe.current.contains(e.target)&&(ne(!1),M(``))};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},U=[j],t[12]=j,t[13]=H,t[14]=U),Z.useEffect(H,U);let G;t[15]!==P||t[16]!==r||t[17]!==a||t[18]!==n.length?(G=e=>{let t={providerID:e.providerID,modelID:e.modelID,displayName:E(e.model,e.modelID)||e.modelID,instanceId:Pe()};P&&n.length>0&&a?a(0,t):r(t),P&&(ne(!1),M(``))},t[15]=P,t[16]=r,t[17]=a,t[18]=n.length,t[19]=G):G=t[19];let K=G,q;t[20]===b?q=t[21]:(q=b(`multirun.modelMultiSelect.search.placeholder`),t[20]=b,t[21]=q);let pe;t[22]===b?pe=t[23]:(pe=b(`multirun.modelMultiSelect.search.noResults`),t[22]=b,t[23]=pe);let J;t[24]===b?J=t[25]:(J=b(`multirun.modelMultiSelect.sections.favorites`),t[24]=b,t[25]=J);let Y;t[26]===b?Y=t[27]:(Y=b(`multirun.modelMultiSelect.sections.recent`),t[26]=b,t[27]=Y);let X;t[28]===b?X=t[29]:(X=b(`multirun.modelMultiSelect.keyboard.hint`),t[28]=b,t[29]=X);let ge;t[30]===b?ge=t[31]:(ge=b(`settings.agents.modelSelector.actions.favorite`),t[30]=b,t[31]=ge);let _e;t[32]===b?_e=t[33]:(_e=b(`settings.agents.modelSelector.actions.unfavorite`),t[32]=b,t[33]=_e);let ve;t[34]===b?ve=t[35]:(ve=b(`chat.modelControls.provider`),t[34]=b,t[35]=ve);let ye;t[36]===b?ye=t[37]:(ye=b(`chat.modelControls.capabilities`),t[36]=b,t[37]=ye);let xe;t[38]===b?xe=t[39]:(xe=b(`chat.modelControls.capability.toolCalling`),t[38]=b,t[39]=xe);let Se;t[40]===b?Se=t[41]:(Se=b(`chat.modelControls.capability.reasoning`),t[40]=b,t[41]=Se);let Q;t[42]===b?Q=t[43]:(Q=b(`chat.modelControls.modality.image`),t[42]=b,t[43]=Q);let Ce;t[44]===b?Ce=t[45]:(Ce=b(`chat.modelControls.modality.video`),t[44]=b,t[45]=Ce);let we;t[46]===b?we=t[47]:(we=b(`chat.modelControls.modality.audio`),t[46]=b,t[47]=we);let Te;t[48]===b?Te=t[49]:(Te=b(`chat.modelControls.costPerMillion`),t[48]=b,t[49]=Te);let Ee;t[50]===b?Ee=t[51]:(Ee=b(`chat.modelControls.costInput`),t[50]=b,t[51]=Ee);let De;t[52]===b?De=t[53]:(De=b(`chat.modelControls.costOutput`),t[52]=b,t[53]=De);let Oe;t[54]!==q||t[55]!==pe||t[56]!==J||t[57]!==Y||t[58]!==X||t[59]!==ge||t[60]!==_e||t[61]!==ve||t[62]!==ye||t[63]!==xe||t[64]!==Se||t[65]!==Q||t[66]!==Ce||t[67]!==we||t[68]!==Te||t[69]!==Ee||t[70]!==De?(Oe={searchPlaceholder:q,noResults:pe,favorites:J,recent:Y,keyboardHint:X,favorite:ge,unfavorite:_e,provider:ve,capabilities:ye,capabilityToolCalling:xe,capabilityReasoning:Se,modalityImage:Q,modalityVideo:Ce,modalityAudio:we,costPerMillion:Te,costInput:Ee,costOutput:De},t[54]=q,t[55]=pe,t[56]=J,t[57]=Y,t[58]=X,t[59]=ge,t[60]=_e,t[61]=ve,t[62]=ye,t[63]=xe,t[64]=Se,t[65]=Q,t[66]=Ce,t[67]=we,t[68]=Te,t[69]=Ee,t[70]=De,t[71]=Oe):Oe=t[71];let ke=Oe,Ae;t[72]===m?Ae=t[73]:(Ae=y(`relative`,m),t[72]=m,t[73]=Ae);let je;t[74]===u?je=t[75]:(je=y(Ne,`!border-border/80 !bg-[var(--surface-subtle)] hover:!bg-[var(--interactive-hover)]/70`,u),t[74]=u,t[75]=je);let Me=!F,Ie;t[76]===j?Ie=t[77]:(Ie=()=>{ne(!j)},t[76]=j,t[77]=Ie);let We;t[78]===h?We=t[79]:(We=h??(0,$.jsx)(A,{name:`add`,className:`h-3.5 w-3.5 mr-1`}),t[78]=h,t[79]=We);let Ge;t[80]!==s||t[81]!==b?(Ge=s??b(`multirun.modelMultiSelect.actions.addModel`),t[80]=s,t[81]=b,t[82]=Ge):Ge=t[82];let Ke;t[83]!==je||t[84]!==Me||t[85]!==Ie||t[86]!==We||t[87]!==Ge?(Ke=(0,$.jsxs)(_,{ref:N,type:`button`,variant:`outline`,size:`sm`,className:je,disabled:Me,onClick:Ie,children:[We,Ge]}),t[83]=je,t[84]=Me,t[85]=Ie,t[86]=We,t[87]=Ge,t[88]=Ke):Ke=t[88];let qe;t[89]!==ie||t[90]!==F||t[91]!==f||t[92]!==v||t[93]!==D||t[94]!==C||t[95]!==K||t[96]!==k||t[97]!==T||t[98]!==j||t[99]!==ke||t[100]!==L||t[101]!==te||t[102]!==x||t[103]!==O||t[104]!==re||t[105]!==w?(qe=j?(0,$.jsx)(`div`,{className:y(`absolute left-0 z-50 w-[min(420px,calc(100vw-2rem))] max-w-[calc(100vw-2rem)] flex flex-col overflow-hidden rounded-xl border border-border/50 shadow-lg`,v===`top`?`bottom-full mb-1`:`top-full mt-1`,f),style:{background:`linear-gradient(var(--surface-elevated),var(--surface-elevated)),linear-gradient(var(--surface-background),var(--surface-background))`},children:(0,$.jsx)(me,{providers:x,providerOrder:te,favoriteModels:D,recentModels:O,getMetadata:C,hiddenModels:k,searchQuery:re,onSearchQueryChange:M,onSelect:K,labels:ke,selectionCount:e=>L.get(`${e.providerID}:${e.modelID}`)||0,disabled:!F,maxHeightClassName:`flex-1`,maxHeightStyle:{maxHeight:ie?`${ie}px`:`300px`},stickyHeaders:!0,tooltipsEnabled:j,isFavorite:e=>T(e.providerID,e.modelID),onToggleFavorite:e=>w(e.providerID,e.modelID),onEscape:()=>{ne(!1),M(``)}})}):null,t[89]=ie,t[90]=F,t[91]=f,t[92]=v,t[93]=D,t[94]=C,t[95]=K,t[96]=k,t[97]=T,t[98]=j,t[99]=ke,t[100]=L,t[101]=te,t[102]=x,t[103]=O,t[104]=re,t[105]=w,t[106]=qe):qe=t[106];let Je;t[107]!==Ae||t[108]!==Ke||t[109]!==qe?(Je=(0,$.jsxs)(`div`,{className:Ae,ref:oe,children:[Ke,qe]}),t[107]=Ae,t[108]=Ke,t[109]=qe,t[110]=Je):Je=t[110];let Ye;t[111]!==z||t[112]!==L||t[113]!==i||t[114]!==a||t[115]!==x||t[116]!==n||t[117]!==g||t[118]!==b?(Ye=g&&n.length>0&&(0,$.jsx)(`div`,{className:`flex flex-col gap-2 w-full`,children:n.map((e,t)=>{let n=`${e.providerID}:${e.modelID}`,r=L.get(n)||1,o=z(e),s=x.find(t=>t.id===e.providerID)?.models?.find(t=>t.id===e.modelID),c=s?.variants?Object.keys(s.variants):[],l=c.length>0,u=e.variant??`__default__`;return(0,$.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,$.jsx)(Fe,{model:e,instanceIndex:o,totalSameModel:r,onRemove:()=>i(t)}),l&&(0,$.jsxs)(fe,{value:u,onValueChange:n=>{if(!a)return;let r=n===`__default__`?void 0:n;a(t,{...e,variant:r})},children:[(0,$.jsxs)(de,{size:`chip`,className:`px-2 gap-1.5 rounded-md !border-border/80 !bg-[var(--surface-subtle)] hover:!bg-[var(--interactive-hover)]/70 typography-meta font-medium text-foreground`,children:[(0,$.jsx)(A,{name:`brain-ai-3`,className:y(`h-3.5 w-3.5 flex-shrink-0`,u===`__default__`?`text-muted-foreground`:`text-[color:var(--status-info)]`)}),(0,$.jsx)(le,{placeholder:b(`multirun.modelMultiSelect.variant.placeholder`),children:e=>e===`__default__`?b(`multirun.modelMultiSelect.variant.default`):e})]}),(0,$.jsxs)(ue,{fitContent:!0,children:[(0,$.jsx)(W,{value:`__default__`,className:`pr-2 [&>span:first-child]:hidden`,children:b(`multirun.modelMultiSelect.variant.default`)}),c.map(Ue)]})]})]},e.instanceId)})}),t[111]=z,t[112]=L,t[113]=i,t[114]=a,t[115]=x,t[116]=n,t[117]=g,t[118]=b,t[119]=Ye):Ye=t[119];let Xe;t[120]!==Je||t[121]!==Ye?(Xe=(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-1.5 items-center`,children:[Je,Ye]}),t[120]=Je,t[121]=Ye,t[122]=Xe):Xe=t[122];let Ze;t[123]!==l||t[124]!==o||t[125]!==n.length||t[126]!==b?(Ze=o!==void 0&&n.length<o&&(0,$.jsx)(`p`,{className:`typography-micro text-muted-foreground`,children:l===void 0?b(`multirun.modelMultiSelect.validation.minOnly`,{min:o}):b(`multirun.modelMultiSelect.validation.minToMax`,{min:o,max:l})}),t[123]=l,t[124]=o,t[125]=n.length,t[126]=b,t[127]=Ze):Ze=t[127];let Qe;return t[128]!==Xe||t[129]!==Ze?(Qe=(0,$.jsxs)(`div`,{className:`space-y-2`,children:[Xe,Ze]}),t[128]=Xe,t[129]=Ze,t[130]=Qe):Qe=t[130],Qe};function Le(e){return e.providers}function Re(e){return e.getModelMetadata}function ze(e){return e.toggleFavoriteModel}function Be(e){return e.isFavoriteModel}function Ve(e){return e.hiddenModels}function He(e){return e.providerOrder}function Ue(e){return(0,$.jsx)(W,{value:e,className:`pr-2 [&>span:first-child]:hidden`,children:e},e)}function We(e){let t=(0,be.c)(30),{git:n}=d(),r=I(e),i=V(e),a=R(e),o=B(e),s=N(Ye),c=N(Je),l,u;t[0]!==e||t[1]!==c||t[2]!==n||t[3]!==i||t[4]!==a?(l=()=>{!e||!n||i!==null||a||c(e,n,{silent:!0})},u=[e,n,c,i,a],t[0]=e,t[1]=c,t[2]=n,t[3]=i,t[4]=a,t[5]=l,t[6]=u):(l=t[5],u=t[6]),Z.useEffect(l,u);let f;t[7]!==r?.all||t[8]!==e||t[9]!==s||t[10]!==n||t[11]!==i?(f=()=>{!e||!n||i===!0&&(r?.all||s(e,n))},t[7]=r?.all,t[8]=e,t[9]=s,t[10]=n,t[11]=i,t[12]=f):f=t[12];let p=r?.all,m;t[13]!==e||t[14]!==s||t[15]!==n||t[16]!==i||t[17]!==p?(m=[e,n,i,p,s],t[13]=e,t[14]=s,t[15]=n,t[16]=i,t[17]=p,t[18]=m):m=t[18],Z.useEffect(f,m);let ee=a||i===!0&&o,h;bb0:{if(!r?.all){let e;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(e=[],t[19]=e):e=t[19],h=e;break bb0}let e;t[20]===r.all?e=t[21]:(e=r.all.filter(qe).sort(),t[20]=r.all,t[21]=e),h=e}let g=h,_;bb1:{if(!r?.all){let e;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(e=[],t[22]=e):e=t[22],_=e;break bb1}let e;t[23]===r.all?e=t[24]:(e=r.all.filter(Ke).map(Ge).sort(),t[23]=r.all,t[24]=e),_=e}let v=_,y;bb2:{if(!e){y=null;break bb2}if(i!==null){y=i;break bb2}if(ee){y=null;break bb2}y=r?.all?!0:null}let b=y,x;return t[25]!==b||t[26]!==ee||t[27]!==g||t[28]!==v?(x={localBranches:g,remoteBranches:v,isLoading:ee,isGitRepository:b},t[25]=b,t[26]=ee,t[27]=g,t[28]=v,t[29]=x):x=t[29],x}function Ge(e){return e.replace(/^remotes\//,``)}function Ke(e){return e.startsWith(`remotes/`)}function qe(e){return!e.startsWith(`remotes/`)}function Je(e){return e.fetchStatus}function Ye(e){return e.fetchBranches}var Xe=({directory:e,value:t,onChange:n,className:r,disabled:i,id:a})=>{let{t:o}=ee(),{localBranches:s,remoteBranches:c,isLoading:l,isGitRepository:u}=We(e),d=Z.useMemo(()=>[...s,...c.map(e=>`remotes/${e}`)],[s,c]);return Z.useEffect(()=>{if(i||l||d.length===0||t&&d.includes(t))return;let r=t,a=!1;return(async()=>{try{let t=e?await Y(e).catch(()=>null):null;if(a)return;let i=localStorage.getItem(P),{sourceBranch:o,shouldClearSavedSourceBranch:s}=z({branches:d,savedSourceBranch:i,rootBranch:t});if(s&&localStorage.removeItem(P),a||r&&d.includes(r))return;o&&n(o)}catch{}})(),()=>{a=!0}},[d,e,i,l,n,t]),(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(fe,{value:t,onValueChange:n,disabled:i||!u||l,children:[(0,$.jsx)(de,{id:a,size:`lg`,className:r??`w-fit typography-meta text-foreground`,children:(0,$.jsx)(le,{placeholder:o(l?`multiRun.branchSelector.status.loadingBranches`:`multiRun.branchSelector.placeholder.selectSourceBranch`)})}),(0,$.jsx)(ue,{className:`max-h-[280px] max-w-[320px]`,children:l?(0,$.jsx)(`div`,{className:`px-2 py-4 text-center typography-meta text-muted-foreground`,children:o(`multiRun.branchSelector.status.loadingBranches`)}):s.length===0&&c.length===0?(0,$.jsx)(`div`,{className:`px-2 py-4 text-center typography-meta text-muted-foreground`,children:o(`multiRun.branchSelector.status.noBranchesFound`)}):(0,$.jsxs)($.Fragment,{children:[s.length>0&&(0,$.jsxs)(K,{children:[(0,$.jsx)(H,{className:`font-semibold text-foreground`,children:o(`multiRun.branchSelector.groups.localBranches`)}),s.map(e=>(0,$.jsx)(W,{value:e,className:`whitespace-normal break-all`,children:e},e))]}),s.length>0&&c.length>0&&(0,$.jsx)(G,{}),c.length>0&&(0,$.jsxs)(K,{children:[(0,$.jsx)(H,{className:`font-semibold text-foreground`,children:o(`multiRun.branchSelector.groups.remoteBranches`)}),c.map(e=>(0,$.jsx)(W,{value:`remotes/${e}`,className:`whitespace-normal break-all`,children:e},`remotes/${e}`))]})]})})]}),u===!1&&(0,$.jsx)(`p`,{className:`typography-micro text-muted-foreground/70 mt-2`,children:o(`multiRun.branchSelector.status.notInGitRepository`)})]})},Ze=e=>{let t=(0,be.c)(36),{value:n,onChange:r,className:i,disabled:a,id:o,portalToBody:s}=e,{t:c}=ee(),l=S(Qe),u=S($e),d=S(et),f;t[0]===l?f=t[1]:(f=l(),t[0]=l,t[1]=f);let p=f,m;t[2]===p?m=t[3]:(m=p.filter(tt),t[2]=p,t[3]=m);let h=m,g,_;t[4]!==p.length||t[5]!==u?(g=()=>{p.length===0&&u()},_=[p.length,u],t[4]=p.length,t[5]=u,t[6]=g,t[7]=_):(g=t[6],_=t[7]),Z.useEffect(g,_);let v,b;t[8]!==d||t[9]!==a||t[10]!==r||t[11]!==h||t[12]!==n?(v=()=>{if(a)return;let e=n.trim();if(e.length>0&&h.some(t=>t.name===e))return;let t=typeof d==`string`&&d.trim().length>0?d.trim():null;if(t&&h.some(e=>e.name===t)){r(t);return}let i=h[0]?.name;i&&r(i)},b=[d,a,r,h,n],t[8]=d,t[9]=a,t[10]=r,t[11]=h,t[12]=n,t[13]=v,t[14]=b):(v=t[13],b=t[14]),Z.useEffect(v,b);let x=n.trim().length>0?n:void 0,C;t[15]===i?C=t[16]:(C=y(`max-w-full typography-meta text-foreground !border-border/80 !bg-[var(--surface-subtle)] hover:!bg-[var(--interactive-hover)]/70 data-[popup-open]:!bg-[var(--interactive-active)]/70`,i),t[15]=i,t[16]=C);let w;t[17]===c?w=t[18]:(w=c(`multirun.agentSelector.placeholder`),t[17]=c,t[18]=w);let T;t[19]===w?T=t[20]:(T=(0,$.jsx)(le,{placeholder:w}),t[19]=w,t[20]=T);let E;t[21]!==o||t[22]!==C||t[23]!==T?(E=(0,$.jsx)(de,{id:o,size:`lg`,className:C,children:T}),t[21]=o,t[22]=C,t[23]=T,t[24]=E):E=t[24];let D;t[25]===h?D=t[26]:(D=h.length>0&&(0,$.jsx)(K,{children:h.map(nt)}),t[25]=h,t[26]=D);let O;t[27]!==s||t[28]!==D?(O=(0,$.jsx)(ue,{fitContent:!0,portalToBody:s,children:D}),t[27]=s,t[28]=D,t[29]=O):O=t[29];let k;return t[30]!==a||t[31]!==r||t[32]!==x||t[33]!==E||t[34]!==O?(k=(0,$.jsxs)(fe,{value:x,onValueChange:r,disabled:a,children:[E,O]}),t[30]=a,t[31]=r,t[32]=x,t[33]=E,t[34]=O,t[35]=k):k=t[35],k};function Qe(e){return e.getVisibleAgents}function $e(e){return e.loadAgents}function et(e){return e.currentAgentName}function tt(e){return C(e.mode)}function nt(e){return(0,$.jsx)(W,{value:e.name,className:`w-auto whitespace-nowrap`,children:e.name},e.name)}var rt=10485760,it=5,at=e=>{let t=(0,be.c)(3),{children:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,$.jsx)(re,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,tabIndex:-1,className:`inline-flex items-center justify-center text-muted-foreground/50 hover:text-muted-foreground transition-colors`,children:(0,$.jsx)(A,{name:`information`,className:`h-3.5 w-3.5`})})}),t[0]=r):r=t[0];let i;return t[1]===n?i=t[2]:(i=(0,$.jsxs)(ie,{children:[r,(0,$.jsx)(M,{side:`top`,className:`max-w-[240px]`,children:n})]}),t[1]=n,t[2]=i),i},ot=e=>{let t=(0,be.c)(9),{htmlFor:n,required:r,children:i,info:a}=e,o;t[0]===r?o=t[1]:(o=r&&(0,$.jsx)(`span`,{className:`text-destructive ml-0.5`,children:`*`}),t[0]=r,t[1]=o);let s;t[2]!==i||t[3]!==n||t[4]!==o?(s=(0,$.jsxs)(`label`,{htmlFor:n,className:`typography-meta font-medium text-foreground`,children:[i,o]}),t[2]=i,t[3]=n,t[4]=o,t[5]=s):s=t[5];let c=a&&a,l;return t[6]!==s||t[7]!==c?(l=(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[s,c]}),t[6]=s,t[7]=c,t[8]=l):l=t[8],l},st=e=>{let t=O(e.path),n=e.icon?X[e.icon]:null,r=e.color?ge[e.color]:void 0,i=(0,$.jsx)(A,{name:n??`folder`,className:`h-3.5 w-3.5`,style:r?{color:r}:void 0});return(0,$.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-1.5`,children:[(0,$.jsx)(`span`,{className:`relative top-px flex h-4 w-4 shrink-0 items-center justify-center overflow-hidden text-muted-foreground`,children:e.iconImage?(0,$.jsx)(J,{project:e,className:`size-full object-contain`,fallback:i}):i}),(0,$.jsx)(`span`,{className:`truncate`,children:t})]})},ct=({initialPrompt:e,onCreated:n,onCancel:r,isWindowed:i=!1})=>{let{t:a}=ee(),[s,c]=Z.useState(``),[l,u]=Z.useState(()=>[{id:Pe(),prompt:``,models:[]}]),[d,p]=Z.useState(``),[v,b]=Z.useState([]),[x,S]=Z.useState(!1),[C,w]=Z.useState([]),[E,D]=Z.useState(!1),[O,te]=Z.useState(!1),[oe,N]=Z.useState(!0),P=Z.useRef(null),F=o(e=>e.currentDirectory??null),I=Z.useMemo(()=>{if(typeof window>`u`)return null;let e=window.__VSCODE_CONFIG__?.workspaceFolder;return typeof e==`string`&&e.trim().length>0?e.trim():null},[]),L=g(e=>e.activeProjectId),R=g(e=>e.setActiveProjectIdOnly),z=g(e=>e.projects),[B,se]=Z.useState(()=>L??null);Z.useEffect(()=>{if(L){se(L);return}!B&&z.length>0&&se(z[0].id)},[L,z,B]);let V=Z.useMemo(()=>B?z.find(e=>e.id===B)??null:null,[z,B]),ce=V?.path??F,H=f(e=>{se(e),e!==L&&R(e)}),U=Z.useMemo(()=>{if(V?.path)return{id:V.id,path:V.path};let e=F??I;return e?{id:`path:${e}`,path:e}:null},[V,F,I]),[G]=Z.useState(()=>typeof window<`u`&&t()),K=Z.useMemo(()=>typeof navigator>`u`?!1:/Macintosh|Mac OS X/.test(navigator.userAgent||``),[]),pe=ae(),J=Z.useMemo(()=>{if(typeof window>`u`)return null;let e=window.__YURI_MACOS_MAJOR__;if(typeof e==`number`&&Number.isFinite(e)&&e>0)return e;if(typeof navigator>`u`)return null;let t=(navigator.userAgent||``).match(/Mac OS X (\d+)[._](\d+)/);if(!t)return null;let n=Number.parseInt(t[1],10),r=Number.parseInt(t[2],10);return Number.isNaN(n)?null:n===10?r:n},[]),Y=Z.useMemo(()=>G&&K||pe?`pl-[5.5rem]`:`pl-3`,[G,K,pe]),me=Z.useMemo(()=>!G||!K||J===null?``:J>=26?`h-12`:J<=15?`h-14`:``,[G,K,J]),X=f(async e=>{e.target.closest(`button, a, input, select, textarea`)||e.button===0&&G&&await m()}),he=f(e=>{r&&e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),r())}),ge=!!r;Z.useEffect(()=>{if(ge)return window.addEventListener(`keydown`,he,!0),()=>window.removeEventListener(`keydown`,he,!0)},[ge]);let[be,xe]=Z.useState(``),{isLoading:Se,isGitRepository:Q}=We(ce),Ce=Z.useRef(!1),we=Q===!0,Te=we&&oe;Z.useEffect(()=>{if(Q===!1){Ce.current=!0,N(!1);return}Q===!0&&Ce.current&&(Ce.current=!1,N(!0))},[Q]);let Ee=Me(e=>e.createMultiRun),De=Me(e=>e.error),Oe=Me(e=>e.clearError);Z.useEffect(()=>{typeof e==`string`&&e.trim().length>0&&u(t=>{let n=[...t];return n.length>0&&!n[0].prompt.trim()&&(n[0]={...n[0],prompt:e}),n})},[e]),Z.useEffect(()=>{if(!U)return;let e=!1;return te(!0),(async()=>{try{let t=await k(U);e||w(t)}catch{}finally{e||te(!1)}})(),()=>{e=!0}},[U]);let ke=f((e,t)=>{u(n=>n.map(n=>n.id===e?{...n,...t}:n))}),Ae=f(e=>{u(t=>t.filter(t=>t.id!==e))}),je=f(()=>{u(e=>[...e,{id:Pe(),prompt:``,models:[]}])}),Ne=async e=>{let t=e.target.files;if(!t)return;let n=0;for(let e=0;e<t.length;e++){let r=t[e];if(r.size>rt){h.error(a(`multirun.launcher.toast.fileTooLarge`,{fileName:r.name}));continue}try{let e=await new Promise((e,t)=>{let n=new FileReader;n.onload=()=>e(n.result),n.onerror=t,n.readAsDataURL(r)});b(t=>[...t,{id:Pe(),filename:r.name,mimeType:r.type||`application/octet-stream`,size:r.size,dataUrl:e}]),n++}catch(e){console.error(`File attach failed`,e),h.error(a(`multirun.launcher.toast.attachFailed`,{fileName:r.name}))}}n>0&&h.success(a(n===1?`multirun.launcher.toast.attachedSingle`:`multirun.launcher.toast.attachedPlural`,{count:n})),P.current&&(P.current.value=``)},Fe=e=>{b(t=>t.filter(t=>t.id!==e))},Ie=Z.useMemo(()=>l.reduce((e,t)=>e+t.models.length,0),[l]),Le=async e=>{e.preventDefault();let t=l.filter(e=>e.prompt.trim()&&e.models.length>=1);if(t.length!==0&&!(Ie<1)){S(!0),Oe();try{B&&B!==L&&R(B);let e=v.map(e=>({mime:e.mimeType,filename:e.filename,url:e.dataUrl})),r=C.filter(e=>e.trim().length>0),i=t.map(e=>({prompt:e.prompt.trim(),models:e.models.map(e=>({providerID:e.providerID,modelID:e.modelID,displayName:e.displayName,variant:e.variant}))})),a={name:s.trim(),groups:i,agent:d||void 0,worktreeBaseBranch:Te?be:void 0,isolateRuns:Te,files:e.length>0?e:void 0,setupCommands:r.length>0?r:void 0},o=await Ee(a);o&&(o.firstSessionId&&T.getState().setCurrentSession(o.firstSessionId),n?.())}finally{S(!1)}}},Re=!!(s.trim()&&l.some(e=>e.prompt.trim()&&e.models.length>=1)&&Ie>=1&&ce&&!Se&&(Q===!1||!Te||be)),ze=C.filter(e=>e.trim()).length;return(0,$.jsxs)(`form`,{onSubmit:Le,className:`flex flex-col h-full bg-background`,children:[i?null:(0,$.jsxs)(`header`,{onMouseDown:X,className:y(`relative flex h-12 shrink-0 items-center justify-center border-b app-region-drag select-none`,Y,me),style:{borderColor:`var(--interactive-border)`},children:[(0,$.jsx)(`h1`,{className:`typography-ui-label font-medium`,children:a(`multirun.launcher.title`)}),r&&(0,$.jsx)(`div`,{className:`absolute right-0 flex items-center pr-3`,children:(0,$.jsxs)(ie,{children:[(0,$.jsx)(re,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,onClick:r,"aria-label":a(`multirun.launcher.actions.closeEsc`),className:`inline-flex h-9 w-9 items-center justify-center p-2 rounded-lg text-muted-foreground hover:text-foreground hover:bg-interactive-hover/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary app-region-no-drag`,children:(0,$.jsx)(A,{name:`close`,className:`h-5 w-5`})})}),(0,$.jsx)(M,{children:(0,$.jsx)(`p`,{children:a(`multirun.launcher.actions.closeEsc`)})})]})})]}),(0,$.jsx)(q,{className:`flex-1 min-h-0 overflow-auto`,size:64,hideTopShadow:!0,children:(0,$.jsx)(`div`,{className:`mx-auto w-full max-w-2xl px-4 sm:px-6 py-5`,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,$.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-x-4 gap-y-3`,children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(ot,{htmlFor:`multirun-project`,required:!0,children:a(`multirun.launcher.project.label`)}),z.length>0?(0,$.jsxs)(fe,{value:B??void 0,onValueChange:H,children:[(0,$.jsx)(de,{id:`multirun-project`,size:`lg`,className:`w-fit max-w-full`,children:V?(0,$.jsx)(le,{children:st(V)}):(0,$.jsx)(le,{placeholder:a(`multirun.launcher.project.placeholder`)})}),(0,$.jsx)(ue,{fitContent:!0,children:z.map(e=>(0,$.jsx)(W,{value:e.id,className:`max-w-[24rem]`,children:st(e)},e.id))})]}):(0,$.jsx)(`p`,{className:`typography-micro text-muted-foreground py-2`,children:a(`multirun.launcher.project.empty`)})]}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(ot,{htmlFor:`group-name`,required:!0,info:(0,$.jsx)(at,{children:a(`multirun.launcher.groupName.info`)}),children:a(`multirun.launcher.groupName.label`)}),(0,$.jsx)(ne,{id:`group-name`,value:s,onChange:e=>c(e.target.value),placeholder:a(`multirun.launcher.groupName.placeholder`),className:`typography-meta w-full`,required:!0})]}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(ot,{htmlFor:`multirun-worktree-base-branch`,info:(0,$.jsx)(at,{children:a(`multirun.launcher.baseBranch.info`)}),children:a(`multirun.launcher.baseBranch.label`)}),(0,$.jsx)(Xe,{directory:ce,value:be,onChange:xe,disabled:!Te,id:`multirun-worktree-base-branch`}),(0,$.jsxs)(`label`,{className:`mt-1.5 flex w-fit items-center gap-1.5 typography-micro text-muted-foreground`,children:[(0,$.jsx)(j,{checked:oe,onChange:N,disabled:!we,ariaLabel:a(`multirun.launcher.isolateRuns.label`)}),(0,$.jsx)(`span`,{children:a(`multirun.launcher.isolateRuns.label`)})]})]}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(ot,{htmlFor:`multirun-agent`,info:(0,$.jsx)(at,{children:a(`multirun.launcher.agent.info`)}),children:a(`multirun.launcher.agent.label`)}),(0,$.jsx)(Ze,{value:d,onChange:p,id:`multirun-agent`})]})]}),(0,$.jsxs)(ye,{open:E,onOpenChange:D,children:[(0,$.jsxs)(ve,{className:`w-full flex items-center gap-2 py-1.5 px-2 -mx-2 rounded-lg hover:bg-[var(--interactive-hover)]/50 transition-colors group`,children:[(0,$.jsx)(A,{name:`terminal`,className:`h-3.5 w-3.5 text-muted-foreground/70`}),(0,$.jsx)(`span`,{className:`typography-meta font-medium text-muted-foreground group-hover:text-foreground transition-colors`,children:a(`multirun.launcher.setupCommands.label`)}),ze>0&&(0,$.jsx)(`span`,{className:`inline-flex items-center justify-center h-4 min-w-4 px-1 rounded-full typography-micro font-medium`,style:{backgroundColor:`var(--primary-base)`,color:`var(--primary-foreground)`,fontSize:`0.625rem`,lineHeight:1},children:ze}),(0,$.jsx)(A,{name:`arrow-down-s`,className:y(`h-3.5 w-3.5 text-muted-foreground/50 transition-transform duration-200 ml-auto`,E&&`rotate-180`)})]}),(0,$.jsx)(_e,{children:(0,$.jsx)(`div`,{className:`pt-2 space-y-1.5`,children:O?(0,$.jsx)(`p`,{className:`typography-meta text-muted-foreground/70 px-2`,children:a(`multirun.launcher.setupCommands.loading`)}):(0,$.jsxs)($.Fragment,{children:[C.map((e,t)=>(0,$.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,$.jsx)(ne,{value:e,onChange:e=>{let n=[...C];n[t]=e.target.value,w(n)},placeholder:a(`multirun.launcher.setupCommands.commandPlaceholder`),className:`h-8 flex-1 font-mono text-xs`}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>w(C.filter((e,n)=>n!==t)),className:`flex-shrink-0 flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground hover:text-destructive hover:bg-destructive/10 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/50`,"aria-label":a(`multirun.launcher.setupCommands.removeCommandAria`),children:(0,$.jsx)(A,{name:`close`,className:`h-3.5 w-3.5`})})]},`${e}-${t}`)),(0,$.jsxs)(`button`,{type:`button`,onClick:()=>w([...C,``]),className:`flex items-center gap-1 typography-meta text-muted-foreground hover:text-foreground transition-colors px-1`,children:[(0,$.jsx)(A,{name:`add`,className:`h-3 w-3`}),a(`multirun.launcher.setupCommands.addCommand`)]})]})})})]}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,$.jsx)(ot,{htmlFor:`prompt`,required:!0,children:a(`multirun.launcher.attachments.label`)}),(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,$.jsx)(`input`,{ref:P,type:`file`,multiple:!0,className:`hidden`,onChange:Ne,accept:`*/*`}),(0,$.jsxs)(ie,{children:[(0,$.jsx)(re,{asChild:!0,children:(0,$.jsxs)(`button`,{type:`button`,onClick:()=>P.current?.click(),className:`inline-flex items-center gap-1 h-6 px-2 rounded-md typography-micro text-muted-foreground hover:text-foreground hover:bg-[var(--interactive-hover)]/50 transition-colors`,children:[(0,$.jsx)(A,{name:`attachment-2`,className:`h-3 w-3`}),a(`multirun.launcher.attachments.attach`)]})}),(0,$.jsx)(M,{children:a(`multirun.launcher.attachments.tooltip`)})]}),v.map(e=>(0,$.jsxs)(`div`,{className:`inline-flex items-center gap-1 px-1.5 py-0.5 rounded-md typography-micro border`,style:{backgroundColor:`var(--surface-elevated)`,borderColor:`var(--interactive-border)`},children:[e.mimeType.startsWith(`image/`)?(0,$.jsx)(A,{name:`file-image`,className:`h-3 w-3 text-muted-foreground`}):(0,$.jsx)(A,{name:`file`,className:`h-3 w-3 text-muted-foreground`}),(0,$.jsx)(`span`,{className:`truncate max-w-[100px]`,title:e.filename,children:e.filename}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>Fe(e.id),className:`text-muted-foreground hover:text-destructive`,children:(0,$.jsx)(A,{name:`close`,className:`h-3 w-3`})})]},e.id))]})]}),l.map((e,t)=>(0,$.jsx)(lt,{group:e,groupIndex:t,canRemove:l.length>1,onUpdate:ke,onRemove:Ae},e.id)),(0,$.jsxs)(`button`,{type:`button`,onClick:je,className:`flex items-center gap-1.5 py-2 px-3 -mx-3 rounded-lg typography-meta font-medium text-muted-foreground hover:text-foreground hover:bg-[var(--interactive-hover)]/50 transition-colors`,children:[(0,$.jsx)(A,{name:`add`,className:`h-3.5 w-3.5`}),a(`multirun.launcher.groups.addGroup`)]}),De&&(0,$.jsx)(`div`,{className:`px-3 py-2 rounded-lg typography-meta`,style:{backgroundColor:`var(--status-error-background)`,color:`var(--status-error)`,borderWidth:1,borderColor:`var(--status-error-border)`},children:De})]})})}),(0,$.jsx)(`div`,{className:`shrink-0 px-4 sm:px-6 py-3`,children:(0,$.jsxs)(`div`,{className:`mx-auto w-full max-w-2xl flex items-center justify-end gap-2`,children:[!Te&&Q!==null?(0,$.jsxs)(`div`,{className:`mr-auto flex min-w-0 items-center gap-1.5 typography-micro text-muted-foreground`,children:[(0,$.jsx)(A,{name:`information`,className:`h-3.5 w-3.5 shrink-0`}),(0,$.jsx)(`span`,{className:`truncate`,children:a(`multirun.launcher.project.gitRequired`)})]}):null,(0,$.jsx)(_,{type:`button`,variant:`ghost`,size:`sm`,onClick:r,children:a(`multirun.launcher.actions.cancel`)}),(0,$.jsx)(_,{type:`submit`,size:`sm`,disabled:!Re||x,children:x?a(`multirun.launcher.actions.creating`):(0,$.jsx)($.Fragment,{children:a(`multirun.launcher.actions.startWithRunCount`,{count:Ie})})})]})})]})},lt=e=>{let t=(0,be.c)(94),{group:n,groupIndex:r,canRemove:i,onUpdate:a,onRemove:o}=e,{t:s}=ee(),[c,l]=Z.useState(!1),[u,d]=Z.useState(``),[p,m]=Z.useState(!1),[h,g]=Z.useState(``),_=Z.useRef(null),v=Z.useRef(null),y=Z.useRef(null),b;t[0]!==n.id||t[1]!==n.models||t[2]!==a?(b=e=>{n.models.length>=it||a(n.id,{models:[...n.models,e]})},t[0]=n.id,t[1]=n.models,t[2]=a,t[3]=b):b=t[3];let x=f(b),S;t[4]!==n.id||t[5]!==n.models||t[6]!==a?(S=e=>{a(n.id,{models:n.models.filter((t,n)=>n!==e)})},t[4]=n.id,t[5]=n.models,t[6]=a,t[7]=S):S=t[7];let C=f(S),w;t[8]!==n.id||t[9]!==n.models||t[10]!==a?(w=(e,t)=>{a(n.id,{models:n.models.map((n,r)=>r===e?t:n)})},t[8]=n.id,t[9]=n.models,t[10]=a,t[11]=w):w=t[11];let T=f(w),E;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(E=(e,t)=>{if(e.startsWith(`/`)){let n=e.indexOf(` `),r=e.indexOf(`
2
- `),i=Math.min(n===-1?e.length:n,r===-1?e.length:r);if(t<=i&&n===-1){g(e.substring(1,i)),m(!0),l(!1);return}}m(!1);let n=e.substring(0,t),r=n.lastIndexOf(`@`);if(r!==-1){let e=r>0?n[r-1]:null,t=n.substring(r+1);(!e||/\s/.test(e))&&!t.includes(` `)&&!t.includes(`
3
- `)?(d(t),l(!0)):l(!1);return}l(!1)},t[12]=E):E=t[12];let D=f(E),O;t[13]!==n.id||t[14]!==a?(O=e=>{a(n.id,{prompt:e})},t[13]=n.id,t[14]=a,t[15]=O):O=t[15];let k=f(O),te;t[16]!==n.prompt||t[17]!==k||t[18]!==D?(te=e=>{let t=n.prompt,r=_.current?.selectionStart??t.length,i=t.substring(0,r).lastIndexOf(`@`),a=e.relativePath&&e.relativePath.trim().length>0?e.relativePath.trim():e.path||e.name,o=se(t,i===-1?r:i,r,`@${a}`);k(o.text),l(!1),d(``),requestAnimationFrame(()=>{let e=_.current;e&&(e.selectionStart=o.caret,e.selectionEnd=o.caret,e.focus()),D(o.text,o.caret)})},t[16]=n.prompt,t[17]=k,t[18]=D,t[19]=te):te=t[19];let j=f(te),ne;t[20]!==n.prompt||t[21]!==k||t[22]!==D?(ne=e=>{let t=n.prompt,r=_.current?.selectionStart??t.length,i=t.substring(0,r).lastIndexOf(`@`),a=se(t,i===-1?r:i,r,`@${e}`);k(a.text),l(!1),d(``),requestAnimationFrame(()=>{let e=_.current;e&&(e.selectionStart=a.caret,e.selectionEnd=a.caret,e.focus()),D(a.text,a.caret)})},t[20]=n.prompt,t[21]=k,t[22]=D,t[23]=ne):ne=t[23];let re=f(ne),M;t[24]!==k||t[25]!==D?(M=e=>{let t=`/${e.name} `;k(t),m(!1),g(``),requestAnimationFrame(()=>{let e=_.current;e&&(e.focus(),e.selectionStart=e.value.length,e.selectionEnd=e.value.length),D(t,t.length)})},t[24]=k,t[25]=D,t[26]=M):M=t[26];let ie=f(M),ae;t[27]!==p||t[28]!==c?(ae=e=>{if(p&&y.current&&(e.key===`Enter`||e.key===`ArrowUp`||e.key===`ArrowDown`||e.key===`Escape`||e.key===`Tab`)){e.preventDefault(),y.current.handleKeyDown(e.key);return}c&&v.current&&(e.key===`Enter`||e.key===`ArrowUp`||e.key===`ArrowDown`||e.key===`Escape`||e.key===`Tab`)&&(e.preventDefault(),v.current.handleKeyDown(e.key))},t[27]=p,t[28]=c,t[29]=ae):ae=t[29];let N=f(ae),P=r+1,F;t[30]!==s||t[31]!==P?(F=s(`multirun.launcher.groups.groupLabel`,{index:P}),t[30]=s,t[31]=P,t[32]=F):F=t[32];let I;t[33]===F?I=t[34]:(I=(0,$.jsx)(`span`,{className:`typography-meta font-medium text-foreground`,children:F}),t[33]=F,t[34]=I);let L;t[35]!==i||t[36]!==n.id||t[37]!==o||t[38]!==s?(L=i&&(0,$.jsx)(`button`,{type:`button`,onClick:()=>o(n.id),className:`inline-flex h-6 w-6 items-center justify-center rounded-md text-muted-foreground hover:text-destructive hover:bg-destructive/10`,"aria-label":s(`multirun.launcher.groups.removeGroup`),children:(0,$.jsx)(A,{name:`close`,className:`h-3.5 w-3.5`})}),t[35]=i,t[36]=n.id,t[37]=o,t[38]=s,t[39]=L):L=t[39];let R;t[40]!==I||t[41]!==L?(R=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[I,L]}),t[40]=I,t[41]=L,t[42]=R):R=t[42];let z;t[43]===s?z=t[44]:(z=s(`multirun.launcher.groups.prompt.label`),t[43]=s,t[44]=z);let B;t[45]===z?B=t[46]:(B=(0,$.jsx)(ot,{required:!0,children:z}),t[45]=z,t[46]=B);let V=n.prompt,H;t[47]!==k||t[48]!==D?(H=e=>{let t=e.target.value;k(t);let n=e.target.selectionStart??t.length;D(t,n)},t[47]=k,t[48]=D,t[49]=H):H=t[49];let le;t[50]===s?le=t[51]:(le=s(`multirun.launcher.groups.prompt.placeholder`),t[50]=s,t[51]=le);let U;t[52]!==n.prompt||t[53]!==N||t[54]!==H||t[55]!==le?(U=(0,$.jsx)(pe,{ref:_,value:V,onChange:H,onKeyDown:N,placeholder:le,className:`typography-meta min-h-[80px] max-h-[200px] resize-none overflow-y-auto field-sizing-content`,required:!0}),t[52]=n.prompt,t[53]=N,t[54]=H,t[55]=le,t[56]=U):U=t[56];let W;t[57]!==h||t[58]!==ie||t[59]!==p?(W=p?(0,$.jsx)(ce,{ref:y,searchQuery:h,onCommandSelect:ie,onClose:()=>m(!1),style:{left:0,top:`auto`,bottom:`calc(100% + 6px)`,marginBottom:0,maxWidth:`100%`}}):null,t[57]=h,t[58]=ie,t[59]=p,t[60]=W):W=t[60];let ue;t[61]!==re||t[62]!==j||t[63]!==u||t[64]!==c?(ue=c?(0,$.jsx)(oe,{ref:v,searchQuery:u,onFileSelect:j,onAgentSelect:re,onSkillSelect:e=>re(e.name),onClose:()=>l(!1),style:{left:0,top:`auto`,bottom:`calc(100% + 6px)`,marginBottom:0,maxWidth:`100%`}}):null,t[61]=re,t[62]=j,t[63]=u,t[64]=c,t[65]=ue):ue=t[65];let G;t[66]!==U||t[67]!==W||t[68]!==ue?(G=(0,$.jsxs)(`div`,{className:`relative`,children:[U,W,ue]}),t[66]=U,t[67]=W,t[68]=ue,t[69]=G):G=t[69];let K;t[70]!==B||t[71]!==G?(K=(0,$.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[B,G]}),t[70]=B,t[71]=G,t[72]=K):K=t[72];let de;t[73]===s?de=t[74]:(de=s(`multirun.launcher.models.info`,{max:it}),t[73]=s,t[74]=de);let fe;t[75]===de?fe=t[76]:(fe=(0,$.jsx)(at,{children:de}),t[75]=de,t[76]=fe);let q;t[77]===s?q=t[78]:(q=s(`multirun.launcher.models.label`),t[77]=s,t[78]=q);let J;t[79]!==fe||t[80]!==q?(J=(0,$.jsx)(ot,{required:!0,info:fe,children:q}),t[79]=fe,t[80]=q,t[81]=J):J=t[81];let Y;t[82]!==n.models||t[83]!==x||t[84]!==C||t[85]!==T?(Y=(0,$.jsx)(Ie,{selectedModels:n.models,onAdd:x,onRemove:C,onUpdate:T,minModels:1,maxModels:it}),t[82]=n.models,t[83]=x,t[84]=C,t[85]=T,t[86]=Y):Y=t[86];let me;t[87]!==J||t[88]!==Y?(me=(0,$.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[J,Y]}),t[87]=J,t[88]=Y,t[89]=me):me=t[89];let X;return t[90]!==R||t[91]!==K||t[92]!==me?(X=(0,$.jsxs)(`div`,{className:`rounded-lg border border-border p-3 space-y-3`,children:[R,K,me]}),t[90]=R,t[91]=K,t[92]=me,t[93]=X):X=t[93],X};export{Te as a,Pe as i,Ze as n,Ce as o,Ie as r,ct as t};
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,n,t as r}from"./runtime-switch-DEPKHgdL.js";import{n as i}from"./runtime-fetch-V-iMWR8t.js";import{a,i as o}from"./vendor-zustand-CNn3HHhT.js";import{ot as s,st as c}from"./vendor-base-ui-fom6orB6.js";import{W as l}from"./gitApiHttp-BgUDBfaJ.js";import{n as u}from"./vendor-react-D5BntRmA.js";import{r as d}from"./useUIStore-DjizmHAt.js";import{n as f,t as p}from"./i18n-BvjeIWrT.js";import{Ci as m,In as h,Jr as g,Kr as _,Nr as v,Rn as y,Wi as b,Wr as x,Xr as S,Yr as C,Zi as w,p as T,qr as ee,ua as te,x as E}from"./useMobileNavigationStore-oveTY29a.js";import{n as D}from"./Icon-DebSeH2D.js";import{d as O,i as ne,l as re,m as ie}from"./gitApi-i_uT8MNk.js";import{t as ae}from"./input-Ck9_Qln_.js";import{n as oe,t as se}from"./tooltip-DovnVenD.js";import{d as ce,l as le}from"./select-BnDfHG_T.js";import{_ as ue,l as de,o as fe,s as pe,t as me,v as he,y as ge}from"./vendor-dnd-kit-core-DRyd7I0I.js";import{n as _e,o as ve,s as ye,t as be}from"./vendor-dnd-kit-sortable-C8S8cyRO.js";import{n as xe}from"./textarea-CVswImHY.js";import{t as Se}from"./vendor-tanstack-react-virtual-WY42p6U6.js";var k=e(c(),1),A=u(),Ce={compact:{notation:`compact`,compactDisplay:`short`,maximumFractionDigits:1,minimumFractionDigits:0},compactTokensShort:{notation:`compact`,compactDisplay:`short`,maximumFractionDigits:1},usd:{style:`currency`,currency:`USD`,maximumFractionDigits:4,minimumFractionDigits:2}},j=null,M={},N=(e,t)=>{j!==t&&(j=t,M.compact=void 0,M.compactTokensShort=void 0,M.usd=void 0);let n=M[e];if(n)return n;let r=new Intl.NumberFormat(t,Ce[e]);return M[e]=r,r},P=(e,t=f())=>N(`compact`,t).format(e),we=(e,t=f())=>N(`compactTokensShort`,t).format(e),F=(e,t=f())=>N(`usd`,t).format(e),Te=(e,t=f())=>e.toLocaleDateString(t,{month:`short`,day:`numeric`,year:`numeric`}),Ee=(e,t=f())=>new Date(e).toLocaleDateString(t,{year:`numeric`,month:`short`,day:`numeric`}),De=(e,t=f())=>new Date(e).toLocaleTimeString(t,{hour:`numeric`,minute:`2-digit`}),Oe=(e,t)=>{if(!e||typeof e!=`object`)return;let n=e[t];return typeof n==`number`&&Number.isFinite(n)?n:void 0},ke=(e,t,n)=>{let r=Oe(t.limit,`context`),i=Oe(t.limit,`output`),a=r??n?.limit?.context,o=i??n?.limit?.output;return a===void 0&&o===void 0?n:{...n??{id:typeof t.id==`string`?t.id:``,providerId:e,name:typeof t.name==`string`?t.name:void 0},limit:{...n?.limit,...a===void 0?{}:{context:a},...o===void 0?{}:{output:o}}}};function I(e){let t=e.toLowerCase().trim();return{lower:t,compact:t.replace(/[^a-z0-9]/g,``),tokens:t.split(/[^a-z0-9]+/).filter(Boolean)}}function Ae(e,t){let n=I(t);if(!n.lower)return!0;let r=I(e);return r.lower.includes(n.lower)||n.compact.length>=2&&r.compact.includes(n.compact)?!0:n.tokens.length!==0&&n.tokens.every(e=>r.tokens.some(t=>t.startsWith(e)||t.includes(e)))}var je=a()(o(e=>({collapsedSections:{},toggleSection:t=>e(e=>{let n={...e.collapsedSections};return n[t]?delete n[t]:n[t]=!0,{collapsedSections:n}})}),{name:`model-picker-collapsed-sections`,version:1})),L=s(),Me={image:{icon:`file-image`,labelKey:`modalityImage`},video:{icon:`file-video`,labelKey:`modalityVideo`},audio:{icon:`file-music`,labelKey:`modalityAudio`}},Ne=e=>e.trim().toLowerCase(),R=e=>{let t=(0,A.c)(5),{iconName:n,label:r}=e,i;t[0]===n?i=t[1]:(i=(0,L.jsx)(D,{name:n,className:`size-3.5`}),t[0]=n,t[1]=i);let a;return t[2]!==r||t[3]!==i?(a=(0,L.jsx)(`span`,{className:`flex size-4 flex-shrink-0 items-center justify-center text-muted-foreground`,title:r,"aria-label":r,role:`img`,children:i}),t[2]=r,t[3]=i,t[4]=a):a=t[4],a},Pe=(e,t)=>{let n=[];e?.tool_call&&t.capabilityToolCalling&&n.push({key:`tool_call`,icon:`tools`,label:t.capabilityToolCalling}),e?.reasoning&&t.capabilityReasoning&&n.push({key:`reasoning`,icon:`brain-ai-3`,label:t.capabilityReasoning});let r=[...e?.modalities?.input??[],...e?.modalities?.output??[]],i=Array.from(new Set(r.map(Ne).filter(Boolean)));for(let e of i){let r=Me[e];if(!r)continue;let i=t[r.labelKey];i&&n.push({key:`modality-${e}`,icon:r.icon,label:i})}return n},Fe=e=>te(e,void 0,{maxLength:40}),Ie=e=>{if(typeof e!=`number`||Number.isNaN(e))return``;if(e===0)return`0`;let t=P(e);return t.endsWith(`.0`)?t.slice(0,-2):t},Le=e=>typeof e!=`number`||!Number.isFinite(e)?`—`:F(e),z=(e,t)=>t?!0:e?!!(e.tool_call||e.reasoning||e.cost?.input!==void 0||e.cost?.output!==void 0||(e.modalities?.input?.length??0)>0||(e.modalities?.output?.length??0)>0):!1,Re=e=>{let t=(0,A.c)(21),{metadata:n,providerName:r,providerID:i,modelID:a,active:o,anchor:s,labels:c,children:l}=e,{t:u}=p(),[d,f]=k.useState(!1),g=`${i}/${a}`,_,v;t[0]===o?(_=t[1],v=t[2]):(_=()=>{if(!o){f(!1);return}let e=window.setTimeout(()=>f(!0),450);return()=>window.clearTimeout(e)},v=[o],t[0]=o,t[1]=_,t[2]=v),k.useEffect(_,v);let y;t[3]!==o||t[4]!==d||t[5]!==n||t[6]!==r?(y=o&&d&&z(n,r),t[3]=o,t[4]=d,t[5]=n,t[6]=r,t[7]=y):y=t[7];let x=y,S,C;if(t[8]!==s||t[9]!==l||t[10]!==c||t[11]!==n||t[12]!==g||t[13]!==r||t[14]!==x||t[15]!==u){let e=x?Pe(n,c):[],i=n?.cost?.input!==void 0||n?.cost?.output!==void 0;S=l,C=x?(0,L.jsx)(se,{open:!0,onOpenChange:V,children:(0,L.jsx)(oe,{anchor:s,side:`right`,sideOffset:8,className:`min-w-52 max-w-xs text-left transition-none data-[starting-style]:opacity-100 data-[starting-style]:scale-100 data-[ending-style]:opacity-100 data-[ending-style]:scale-100`,children:(0,L.jsxs)(`div`,{className:`flex flex-col gap-2 text-left text-xs`,children:[r&&c.provider?(0,L.jsxs)(`div`,{className:`flex items-center justify-between gap-3 text-muted-foreground`,children:[(0,L.jsx)(`span`,{className:`typography-meta font-medium`,children:c.provider}),(0,L.jsx)(`span`,{className:`typography-meta text-foreground`,children:r})]}):null,e.length>0?(0,L.jsxs)(`div`,{className:`flex items-center justify-between gap-3 text-muted-foreground`,children:[(0,L.jsx)(`span`,{className:`typography-meta font-medium shrink-0`,children:c.capabilities}),(0,L.jsx)(`div`,{className:`flex flex-wrap items-center justify-end gap-1`,children:e.map(H)})]}):null,i?(0,L.jsxs)(`div`,{className:`flex items-start justify-between gap-3 text-muted-foreground`,children:[c.costPerMillion?(0,L.jsx)(`span`,{className:`typography-meta font-medium shrink-0`,children:c.costPerMillion}):null,(0,L.jsxs)(`div`,{className:`flex flex-col items-end gap-0.5 min-w-0`,children:[(0,L.jsxs)(`div`,{className:`flex items-center justify-end gap-1.5 min-w-0`,children:[c.costInput?(0,L.jsx)(`span`,{className:`typography-meta shrink-0`,children:c.costInput}):null,(0,L.jsx)(`span`,{className:`typography-meta text-foreground tabular-nums`,children:Le(n?.cost?.input)})]}),(0,L.jsxs)(`div`,{className:`flex items-center justify-end gap-1.5 min-w-0`,children:[c.costOutput?(0,L.jsx)(`span`,{className:`typography-meta shrink-0`,children:c.costOutput}):null,(0,L.jsx)(`span`,{className:`typography-meta text-foreground tabular-nums`,children:Le(n?.cost?.output)})]})]})]}):null,(0,L.jsx)(h,{variant:`ghost`,size:`xs`,className:`h-auto min-h-0 w-full min-w-0 justify-end gap-0 rounded-none p-0 text-right cursor-copy font-normal text-muted-foreground hover:bg-transparent active:bg-transparent`,"aria-label":u(`onboarding.common.copyToClipboard`),title:g,onClick:async e=>{e.stopPropagation();try{(await b(g)).ok?m.success(u(`contextSidebar.actions.copied`)):m.error(u(`filesView.toast.copyFailed`))}catch{m.error(u(`filesView.toast.copyFailed`))}},children:(0,L.jsx)(`span`,{className:`block w-full min-w-0 truncate text-right text-[10px] leading-tight`,children:g})})]})})}):null,t[8]=s,t[9]=l,t[10]=c,t[11]=n,t[12]=g,t[13]=r,t[14]=x,t[15]=u,t[16]=S,t[17]=C}else S=t[16],C=t[17];let w;return t[18]!==S||t[19]!==C?(w=(0,L.jsxs)(L.Fragment,{children:[S,C]}),t[18]=S,t[19]=C,t[20]=w):w=t[20],w},ze=()=>{let e=0,t=new Set,n=new Map,r=e=>{let t=n.get(e);if(t)for(let e of t)e()};return{getSnapshot:()=>e,subscribe:e=>(t.add(e),()=>t.delete(e)),subscribeIndex:(e,t)=>{let r=n.get(e);return r||(r=new Set,n.set(e,r)),r.add(t),()=>{r.delete(t),r.size===0&&n.delete(e)}},set:n=>{if(e===n)return;let i=e;e=n,r(i),r(n);for(let e of t)e()}}},Be=k.memo(e=>{let t=(0,A.c)(12),{store:n,index:r,children:i}=e,a;t[0]!==r||t[1]!==n?(a=()=>n.getSnapshot()===r,t[0]=r,t[1]=n,t[2]=a):a=t[2];let[o,s]=k.useState(a),c,l;t[3]!==r||t[4]!==n?(c=()=>{let e=()=>s(n.getSnapshot()===r);return e(),n.subscribeIndex(r,e)},l=[r,n],t[3]=r,t[4]=n,t[5]=c,t[6]=l):(c=t[5],l=t[6]),k.useEffect(c,l);let u;t[7]!==i||t[8]!==o?(u=i(o),t[7]=i,t[8]=o,t[9]=u):u=t[9];let d;return t[10]===u?d=t[11]:(d=(0,L.jsx)(L.Fragment,{children:u}),t[10]=u,t[11]=d),d}),Ve=e=>{let t=(0,A.c)(11),{store:n,flatModelList:r,footerContent:i,fallback:a}=e,o;t[0]===n?o=t[1]:(o=()=>n.getSnapshot(),t[0]=n,t[1]=o);let[s,c]=k.useState(o),l,u;t[2]===n?(l=t[3],u=t[4]):(l=()=>n.subscribe(()=>c(n.getSnapshot())),u=[n],t[2]=n,t[3]=l,t[4]=u),k.useEffect(l,u);let d=r[s],f;t[5]!==d||t[6]!==a||t[7]!==i?(f=typeof i==`function`?i(d):i??a,t[5]=d,t[6]=a,t[7]=i,t[8]=f):f=t[8];let p;return t[9]===f?p=t[10]:(p=(0,L.jsx)(L.Fragment,{children:f}),t[9]=f,t[10]=p),p},He=e=>{let t=(0,A.c)(21),{id:n,disabled:r,children:i}=e,a=r!==void 0&&r,o;t[0]!==a||t[1]!==n?(o={id:n,disabled:a},t[0]=a,t[1]=n,t[2]=o):o=t[2];let{attributes:s,listeners:c,setNodeRef:l,setActivatorNodeRef:u,transform:d,transition:f,isDragging:p}=ve(o),m;t[3]===d?m=t[4]:(m=ge.Transform.toString(d),t[3]=d,t[4]=m);let h;t[5]!==m||t[6]!==f?(h={transform:m,transition:f},t[5]=m,t[6]=f,t[7]=h):h=t[7];let g=p&&`opacity-60`,_;t[8]===g?_=t[9]:(_=y(g),t[8]=g,t[9]=_);let v;t[10]!==s||t[11]!==i||t[12]!==p||t[13]!==c||t[14]!==u?(v=i({attributes:s,listeners:c,setActivatorNodeRef:u,isDragging:p}),t[10]=s,t[11]=i,t[12]=p,t[13]=c,t[14]=u,t[15]=v):v=t[15];let b;return t[16]!==l||t[17]!==h||t[18]!==_||t[19]!==v?(b=(0,L.jsx)(`div`,{ref:l,style:h,className:_,children:v}),t[16]=l,t[17]=h,t[18]=_,t[19]=v,t[20]=b):b=t[20],b},Ue=e=>{let t=(0,A.c)(21),{id:n,disabled:r,children:i}=e,a=r!==void 0&&r,o;t[0]!==a||t[1]!==n?(o={id:n,disabled:a},t[0]=a,t[1]=n,t[2]=o):o=t[2];let{attributes:s,listeners:c,setNodeRef:l,setActivatorNodeRef:u,transform:d,transition:f,isDragging:p}=ve(o),m;t[3]===d?m=t[4]:(m=ge.Translate.toString(d),t[3]=d,t[4]=m);let h;t[5]!==m||t[6]!==f?(h={transform:m,transition:f},t[5]=m,t[6]=f,t[7]=h):h=t[7];let g=p&&`opacity-60`,_;t[8]===g?_=t[9]:(_=y(g),t[8]=g,t[9]=_);let v;t[10]!==s||t[11]!==i||t[12]!==p||t[13]!==c||t[14]!==u?(v=i({attributes:s,listeners:c,setActivatorNodeRef:u,isDragging:p}),t[10]=s,t[11]=i,t[12]=p,t[13]=c,t[14]=u,t[15]=v):v=t[15];let b;return t[16]!==l||t[17]!==h||t[18]!==_||t[19]!==v?(b=(0,L.jsx)(`div`,{ref:l,style:h,className:_,children:v}),t[16]=l,t[17]=h,t[18]=_,t[19]=v,t[20]=b):b=t[20],b},We=32,Ge=(e,t)=>{if(!t)return;if(!e){t.scrollIntoView({block:`nearest`});return}let n=e.getBoundingClientRect(),r=t.getBoundingClientRect(),i=r.top-n.top+e.scrollTop,a=i+r.height,o=e.scrollTop,s=o+e.clientHeight,c=i<o+We?i-We:a>s?a-e.clientHeight:o,l=Math.max(0,e.scrollHeight-e.clientHeight);e.scrollTop=Math.max(0,Math.min(c,l))},B=({providers:e,favoriteModels:t,recentModels:n,getMetadata:r,searchQuery:i,onSearchQueryChange:a,onSelect:o,labels:s,selectedModel:c,hiddenModels:l=[],allowedProviderIds:u,allowedModelIdsByProvider:d,includeNotSelected:f=!1,onSelectNone:p,selectionCount:m,disabled:h=!1,maxHeightClassName:g=`max-h-[min(400px,calc(100dvh-12rem))] flex-1`,maxHeightStyle:_,sectionHeaderClassName:v,rowClassName:b,stickyHeaders:x=!0,autoFocus:S=!0,onEscape:C,isFavorite:w,onToggleFavorite:T,renderRowEnd:ee,onActiveKeyDown:te,onActiveEntryChange:E,onVariantKey:O,onReorderFavorite:ne,reorderFavoriteAriaLabel:re,reorderFavoriteTitle:ie,providerOrder:oe,onReorderProvider:se,reorderProviderTitle:ge,footerContent:ve,renderVersion:A,tooltipsEnabled:Ce=!0,virtualize:j=!1})=>{let M=k.useRef(null);M.current||=ze();let N=M.current,P=k.useRef([]),we=k.useRef(null),F=k.useRef(!1),Te=k.useRef(null),Ee=je(e=>e.collapsedSections),De=je(e=>e.toggleSection),Oe=k.useMemo(()=>new Set(Object.keys(Ee).filter(e=>Ee[e])),[Ee]),I=i.trim().length>0,[Me,Ne]=k.useState(()=>new Set),R=I?Me:Oe,Pe=he(ue(pe,{activationConstraint:{distance:8}})),Le=he(ue(fe,{activationConstraint:{distance:8}})),z=k.useMemo(()=>!u||u.length===0?null:new Set(u),[u]),We=k.useMemo(()=>d?new Map(Object.entries(d).map(([e,t])=>[e,new Set(t)])):null,[d]),B=k.useCallback((e,t)=>!We||We.get(e)?.has(t)===!0,[We]),V=k.useMemo(()=>new Map(e.map(e=>[e.id,e])),[e]),H=k.useCallback((e,t)=>l.some(n=>n.providerID===e&&n.modelID===t),[l]),U=k.useCallback((e,t)=>{let n=i.trim();return!n||Ae(`${t} ${e}`,n)},[i]),W=k.useMemo(()=>t.filter(({model:e,providerID:t,modelID:n})=>{if(z&&!z.has(t)||!B(t,n)||H(t,n))return!1;let r=V.get(t)?.name||t;return U(Fe(e),r)}),[z,t,B,H,U,V]),G=k.useMemo(()=>n.filter(({model:e,providerID:t,modelID:n})=>{if(z&&!z.has(t)||!B(t,n)||H(t,n))return!1;let r=V.get(t)?.name||t;return U(Fe(e),r)}),[z,B,H,U,V,n]),Ke=k.useMemo(()=>{if(!oe||oe.length===0)return e;let t=new Map(oe.map((e,t)=>[e,t])),n=e.filter(e=>t.has(e.id)).sort((e,n)=>(t.get(e.id)??0)-(t.get(n.id)??0)),r=e.filter(e=>!t.has(e.id));return[...n,...r]},[oe,e]),K=k.useMemo(()=>Ke.filter(e=>!z||z.has(e.id)).map(e=>{let t=(Array.isArray(e.models)?e.models:[]).filter(t=>{let n=typeof t.id==`string`?t.id:``;return!n||H(e.id,n)||!B(e.id,n)?!1:U(Fe(t),e.name||e.id)});return{...e,models:t}}).filter(e=>e.models.length>0),[z,B,H,U,Ke]),{flatModelList:q,modelRowIndices:qe}=k.useMemo(()=>{let e=[],t=new Map,n=(n,r)=>{t.set(`${r}:${n.providerID}:${n.modelID}`,e.length),e.push(n)};return R.has(`favorites`)||W.forEach(e=>n(e,`fav`)),R.has(`recent`)||G.forEach(e=>n(e,`recent`)),K.forEach(e=>{R.has(`provider:${e.id}`)||e.models.forEach(t=>n({model:t,providerID:e.id,modelID:t.id},`provider`))}),{flatModelList:e,modelRowIndices:t}},[R,W,K,G]),[J,Je]=k.useState(16);k.useLayoutEffect(()=>{j&&Je(Number.parseFloat(getComputedStyle(document.documentElement).fontSize)||16)},[j]);let Y=k.useMemo(()=>{if(!j)return[];let e=[],t=0,n=(n,r,i,a)=>{if(e.push({key:n,height:(1.5+(a?.625:0))*J,modelIndex:-1}),!R.has(n))for(let a of r)e.push({key:`${n}:${a.providerID}:${a.modelID}`,height:i*J,modelIndex:t++})};return W.length&&n(`favorites`,W,2.5,!1),G.length&&n(`recent`,G,2.5,W.length>0),K.forEach((e,t)=>n(`provider:${e.id}`,e.models.map(t=>({model:t,providerID:e.id,modelID:t.id})),2,t>0||W.length>0||G.length>0)),e},[R,W,K,G,J,j]),Ye=k.useMemo(()=>({estimateSize:e=>Y[e].height,getItemKey:e=>Y[e].key}),[Y]),Xe=Se({enabled:j,count:Y.length,getScrollElement:()=>we.current,...Ye,paddingStart:.375*J,paddingEnd:.375*J,overscan:6,initialRect:{width:400,height:400}}).getVirtualItems(),Ze=new Set(Xe.map(e=>Y[e.index].modelIndex)),X=q.length>0,Z=!!ne&&i.trim().length===0&&W.length>1,Qe=!!se&&i.trim().length===0&&!z&&K.length>1,$e=k.useMemo(()=>new Map(W.map(e=>[`${e.providerID}:${e.modelID}`,e])),[W]);k.useEffect(()=>{N.set(0)},[i,N]),k.useEffect(()=>{I||Ne(e=>e.size===0?e:new Set)},[I]);let et=k.useCallback(e=>{N.set(e),E?.(q[e])},[q,E,N]),tt=k.useCallback(e=>{let t=q.length;if(t===0)return;F.current=!0,Te.current=null;let n=(N.getSnapshot()+e+t)%t;N.set(n),E?.(q[n]),requestAnimationFrame(()=>Ge(we.current,P.current[n]))},[q,E,N]);k.useEffect(()=>{E?.(q[N.getSnapshot()])},[q,E,N]);let nt=k.useCallback(e=>{if(!e.defaultPrevented){if(e.stopPropagation(),e.key===`ArrowLeft`||e.key===`ArrowRight`){let t=q[N.getSnapshot()];if(t&&O?.(e,t))return}if(te?.(e,q[N.getSnapshot()]),!e.defaultPrevented){if(e.key===`ArrowDown`){e.preventDefault(),tt(1);return}if(e.key===`ArrowUp`){e.preventDefault(),tt(-1);return}if(e.key===`Enter`){e.preventDefault();let t=q[N.getSnapshot()];t&&!h&&o(t);return}e.key===`Escape`&&(e.preventDefault(),C?.())}}},[h,q,tt,te,C,o,O,N]),rt=y(`model-picker-section-header typography-micro font-semibold text-muted-foreground uppercase tracking-wider flex items-center gap-2 px-2 py-1.5`,x&&`sticky top-0 z-10 [background:linear-gradient(var(--surface-elevated),var(--surface-elevated)),linear-gradient(var(--surface-background),var(--surface-background))]`,v),it=(e,t,n,i)=>{let a=qe.get(`${t}:${e.providerID}:${e.modelID}`);if(a===void 0)return null;if(j&&!i?.isDragging&&!(Xe.length?Ze.has(a):a<12))return(0,L.jsx)(`div`,{ref:e=>{P.current[a]=e},className:`model-picker-row-placeholder`,"data-model-section":t,"aria-hidden":`true`},`${t}-${e.providerID}-${e.modelID}`);let l=ke(e.providerID,e.model,r?.(e.providerID,e.modelID)),u=V.get(e.providerID)?.name||e.providerID,d=Ie(l?.limit?.context),f=m?.(e)??0,p=c?.providerID===e.providerID&&c.modelID===e.modelID,g=w?.(e)??!1,_=e=>{let t={x:e.clientX,y:e.clientY},n=Te.current,r=!n||n.x!==t.x||n.y!==t.y;Te.current=t,!(F.current&&!n)&&(F.current&&!r||(F.current&&r&&(F.current=!1),et(a)))};return(0,L.jsx)(Be,{store:N,index:a,renderVersion:A,children:r=>{let c=(0,L.jsxs)(`div`,{ref:e=>{P.current[a]=e},role:`option`,"data-model-section":t,"aria-selected":p,"aria-setsize":j?q.length:void 0,"aria-posinset":j?a+1:void 0,"aria-disabled":h||void 0,tabIndex:-1,onClick:()=>{h||o(e)},onKeyDown:t=>{h||(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),o(e))},onMouseEnter:_,onMouseMove:_,className:y(`model-picker-row w-full text-left px-2 py-1.5 rounded-md typography-meta flex items-center gap-2 cursor-pointer`,!h&&(r?`bg-interactive-selection`:`hover:bg-interactive-hover/50`),h&&`cursor-not-allowed opacity-60`,b),children:[(0,L.jsxs)(`div`,{className:`model-picker-row-main flex items-center gap-1.5 flex-1 min-w-0`,children:[i?(0,L.jsx)(`button`,{type:`button`,ref:i.setActivatorNodeRef,...i.attributes,...i.listeners,disabled:h,onClick:e=>{e.preventDefault(),e.stopPropagation()},className:`model-favorite-drag-handle flex size-4 flex-shrink-0 items-center justify-center text-muted-foreground hover:text-foreground disabled:pointer-events-none`,"aria-label":re,title:ie,children:(0,L.jsx)(D,{name:`draggable`,className:`size-3.5`})}):null,n?(0,L.jsx)(ce,{modelId:e.modelID,providerId:e.providerID,className:`h-3.5 w-3.5 flex-shrink-0`}):null,(0,L.jsxs)(`span`,{className:`model-picker-row-labels contents`,children:[(0,L.jsx)(`span`,{className:`model-picker-row-name font-medium truncate`,children:Fe(e.model)}),(0,L.jsxs)(`span`,{className:`model-picker-row-meta contents`,children:[t===`provider`?null:(0,L.jsx)(`span`,{className:`model-picker-row-provider hidden truncate`,children:u}),d?(0,L.jsx)(`span`,{className:`model-picker-row-context typography-micro text-muted-foreground flex-shrink-0`,children:d}):null]})]})]}),f>0?(0,L.jsxs)(`span`,{className:`typography-micro text-muted-foreground flex-shrink-0`,children:[`x`,f]}):null,ee?.(e,{isHighlighted:r,isSelected:p}),(0,L.jsx)(`span`,{className:y(`model-picker-row-selection size-4 shrink-0`,!p&&`hidden`),children:p?(0,L.jsx)(D,{name:`check`,className:`h-4 w-4 text-primary`}):null}),T?(0,L.jsx)(`button`,{type:`button`,disabled:h,onClick:t=>{t.preventDefault(),t.stopPropagation(),T(e)},className:y(`model-favorite-button flex h-4 w-4 items-center justify-center hover:text-primary/80 flex-shrink-0 disabled:pointer-events-none`,g?`text-primary`:`text-muted-foreground`),"aria-label":g?s.unfavorite:s.favorite,title:g?s.unfavorite:s.favorite,children:(0,L.jsx)(D,{name:g?`star-fill`:`star`,className:`h-3.5 w-3.5`})}):null]});return(0,L.jsx)(Re,{metadata:l,providerName:u,providerID:e.providerID,modelID:e.modelID,active:Ce&&r,anchor:()=>P.current[a],labels:s,children:c})}},`${t}-${e.providerID}-${e.modelID}`)},at=e=>{if(!ne)return;let{active:t,over:n}=e;if(!n||t.id===n.id)return;let r=$e.get(String(t.id)),i=$e.get(String(n.id));!r||!i||ne(r,i)},ot=e=>{if(!se)return;let{active:t,over:n}=e;if(!n||t.id===n.id)return;let r=Ke.map(e=>e.id),i=r.indexOf(String(t.id)),a=r.indexOf(String(n.id));i!==-1&&a!==-1&&se(_e(r,i,a))},Q=e=>R.has(e),st=e=>{if(!I){De(e);return}Ne(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},ct=(e,t,n,r)=>{let i=Q(e),a=t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),st(e))};return r?(0,L.jsxs)(`div`,{ref:r.setActivatorNodeRef,...r.attributes,...r.listeners,role:`button`,tabIndex:0,"aria-expanded":!i,title:ge,className:y(rt,`w-full text-left cursor-grab select-none active:cursor-grabbing`),onClick:()=>st(e),onKeyDown:a,children:[(0,L.jsx)(D,{name:`draggable`,className:`size-3.5 flex-shrink-0 text-muted-foreground/70`}),t,(0,L.jsx)(`span`,{className:`min-w-0 truncate`,children:n}),(0,L.jsx)(`span`,{className:`ml-auto flex size-4 flex-shrink-0 items-center justify-center text-muted-foreground`,children:(0,L.jsx)(D,{name:i?`arrow-right-s`:`arrow-down-s`,className:`size-4`})})]}):(0,L.jsxs)(`button`,{type:`button`,className:y(rt,`w-full text-left cursor-pointer`),onClick:()=>st(e),"aria-expanded":!i,children:[t,(0,L.jsx)(`span`,{className:`min-w-0 truncate`,children:n}),(0,L.jsx)(`span`,{className:`ml-auto flex size-4 flex-shrink-0 items-center justify-center text-muted-foreground`,children:(0,L.jsx)(D,{name:i?`arrow-right-s`:`arrow-down-s`,className:`size-4`})})]})},lt=(e,t,n)=>(0,L.jsxs)(L.Fragment,{children:[t>0?(0,L.jsx)(`div`,{className:`model-picker-section-divider h-px bg-border/40 my-1`}):null,ct(`provider:${e.id}`,(0,L.jsx)(le,{providerId:e.id,className:`h-4 w-4 flex-shrink-0`}),e.name||e.id,n),Q(`provider:${e.id}`)?null:e.models.map(t=>it({model:t,providerID:e.id,modelID:t.id},`provider`,!0))]});return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`div`,{className:`model-picker-search-area p-1.5 pb-1`,children:(0,L.jsxs)(`div`,{className:`relative`,children:[(0,L.jsx)(D,{name:`search`,className:`absolute left-2.5 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground`}),(0,L.jsx)(ae,{type:`text`,placeholder:s.searchPlaceholder,value:i,onChange:e=>a(e.target.value),onKeyDown:nt,className:`model-picker-search h-8 pl-8 typography-meta`,autoFocus:S})]})}),(0,L.jsx)(xe,{ref:we,outerClassName:g,className:`overlay-scrollbar-target--no-gutter`,style:_,children:(0,L.jsxs)(`div`,{className:`model-picker-list px-1`,children:[f?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-2 rounded-md px-2 py-1.5 typography-meta text-muted-foreground hover:bg-interactive-hover/50`,onClick:p,children:[(0,L.jsx)(D,{name:`close`,className:`h-3.5 w-3.5`}),(0,L.jsx)(`span`,{children:s.notSelected}),c?null:(0,L.jsx)(D,{name:`check`,className:`h-4 w-4 text-primary ml-auto`})]}),(0,L.jsx)(`div`,{className:`h-px bg-border/40 my-1`})]}):null,X?null:(0,L.jsx)(`div`,{className:`px-2 py-4 text-center typography-meta text-muted-foreground`,children:s.noResults}),W.length>0?(0,L.jsxs)(`div`,{className:`model-picker-section`,children:[ct(`favorites`,(0,L.jsx)(D,{name:`star-fill`,className:`h-4 w-4 text-primary`}),s.favorites),!Q(`favorites`)&&(Z?(0,L.jsx)(me,{sensors:Pe,collisionDetection:de,onDragEnd:at,children:(0,L.jsx)(be,{items:W.map(e=>`${e.providerID}:${e.modelID}`),strategy:ye,children:W.map(e=>(0,L.jsx)(He,{id:`${e.providerID}:${e.modelID}`,disabled:h,children:t=>it(e,`fav`,!0,t)},`fav-sortable-${e.providerID}-${e.modelID}`))})}):W.map(e=>it(e,`fav`,!0)))]}):null,G.length>0?(0,L.jsxs)(`div`,{className:`model-picker-section`,children:[W.length>0?(0,L.jsx)(`div`,{className:`model-picker-section-divider h-px bg-border/40 my-1`}):null,ct(`recent`,(0,L.jsx)(D,{name:`time`,className:`h-4 w-4`}),s.recent),Q(`recent`)?null:G.map(e=>it(e,`recent`,!0))]}):null,(W.length>0||G.length>0)&&K.length>0?(0,L.jsx)(`div`,{className:`model-picker-section-divider h-px bg-border/40 my-1`}):null,Qe?(0,L.jsx)(me,{sensors:Le,collisionDetection:de,onDragEnd:ot,children:(0,L.jsx)(be,{items:K.map(e=>e.id),strategy:ye,children:K.map((e,t)=>(0,L.jsx)(Ue,{id:e.id,disabled:h,children:n=>lt(e,t,n)},e.id))})}):K.map((e,t)=>(0,L.jsx)(`div`,{children:lt(e,t)},e.id))]})}),(0,L.jsx)(`div`,{className:`model-picker-footer px-3 pt-1 pb-1.5 border-t border-border/40 typography-micro text-muted-foreground`,children:(0,L.jsx)(Ve,{store:N,flatModelList:q,footerContent:ve,fallback:s.keyboardHint})})]})};function V(){}function H(e){let{key:t,icon:n,label:r}=e;return(0,L.jsx)(R,{iconName:n,label:r},t)}function U(e,t,n,r,i){let a=e.find(e=>e.id===n);if(!a)return null;let o=(Array.isArray(a.models)?a.models:[]).find(e=>e.id===r);return!o||t.some(e=>e.providerID===n&&e.modelID===r)?null:i===void 0?{provider:a,model:o,providerID:n,modelID:r}:{provider:a,model:o,providerID:n,modelID:r,variant:i}}var W=e=>{let t=(0,A.c)(30),n=w(G),r=d(Ke),i=d(K),a=d(q),o=e?.currentProviderID??null,s=e?.currentModelID??null,c;if(t[0]!==r||t[1]!==a||t[2]!==n){let e;t[4]!==a||t[5]!==n?(e=e=>{let{providerID:t,modelID:r,variant:i}=e;return U(n,a,t,r,i)},t[4]=a,t[5]=n,t[6]=e):e=t[6],c=r.map(e).filter(qe),t[0]=r,t[1]=a,t[2]=n,t[3]=c}else c=t[3];let l=c,u;if(t[7]!==s||t[8]!==o||t[9]!==r||t[10]!==a||t[11]!==n||t[12]!==i){bb0:{let e;t[14]!==a||t[15]!==n?(e=e=>{let{providerID:t,modelID:r,variant:i}=e;return U(n,a,t,r,i)},t[14]=a,t[15]=n,t[16]=e):e=t[16];let c;t[17]===r?c=t[18]:(c=e=>{let{providerID:t,modelID:n}=e;return!r.some(e=>e.providerID===t&&e.modelID===n)},t[17]=r,t[18]=c);let l=i.map(e).filter(J).filter(c);if(!o||!s){u=l;break bb0}if(r.some(e=>e.providerID===o&&e.modelID===s)){u=l;break bb0}let d;t[19]!==s||t[20]!==o?(d=e=>e.providerID===o&&e.modelID===s,t[19]=s,t[20]=o,t[21]=d):d=t[21];let f=l.findIndex(d);if(f===0){u=l;break bb0}if(f>0){let e=l.slice(),[t]=e.splice(f,1);e.unshift(t),u=e;break bb0}let p;t[22]!==s||t[23]!==o||t[24]!==a||t[25]!==n?(p=U(n,a,o,s),t[22]=s,t[23]=o,t[24]=a,t[25]=n,t[26]=p):p=t[26];let m=p;if(!m){u=l;break bb0}u=[m,...l]}t[7]=s,t[8]=o,t[9]=r,t[10]=a,t[11]=n,t[12]=i,t[13]=u}else u=t[13];let f=u,p;return t[27]!==l||t[28]!==f?(p={favoriteModelsList:l,recentModelsList:f},t[27]=l,t[28]=f,t[29]=p):p=t[29],p};function G(e){return e.providers}function Ke(e){return e.favoriteModels}function K(e){return e.recentModels}function q(e){return e.hiddenModels}function qe(e){return e!==null}function J(e){return e!==null}var Je=e=>{if(!e)return``;let t=e.replace(/\\/g,`/`);return t===`/`?`/`:t.replace(/\/+$/,``)};async function Y(e){let t=Je(e),n=await re(t);return{isDirty:!n.isClean,ahead:n.ahead,behind:n.behind,upstream:n.tracking}}var Ye=6e4,Xe=500,Ze=1048576,X=new Map,Z=new Map,Qe=0,$e=(e,t)=>e.length+t.length,et=(e,t)=>{X.delete(e),X.set(e,{root:t,resolvedAt:Date.now()});let n=0;for(let[e,t]of X)n+=$e(e,t.root);for(;X.size>Xe||n>Ze&&X.size>1;){let e=X.entries().next().value;if(!e)break;n-=$e(e[0],e[1].root),X.delete(e[0])}};function tt(e){if(Qe+=1,typeof e==`string`&&e){let t=Je(e);X.delete(t),Z.delete(t);return}X.clear(),Z.clear()}var nt=async e=>ie(e).catch(()=>e),rt=async e=>{let t=X.get(e);if(t&&Date.now()-t.resolvedAt<Ye)return X.delete(e),X.set(e,t),t.root;t&&X.delete(e);let n=Z.get(e);if(n)return n;let r=Qe,i=nt(e).then(t=>(Qe===r&&et(e,t),t)).catch(()=>e).finally(()=>{Z.get(e)===i&&Z.delete(e)});return Z.set(e,i),i};async function it(e,t){let n=Je(e);if(!n)return`HEAD`;try{let e=await rt(n).catch(()=>n),r=t?.knownBranch?.trim();if(r&&e===n)return r;let i=await re(e);return(typeof i.current==`string`?i.current.trim():``)||`HEAD`}catch{return`HEAD`}}var at=e=>{let t=(e.branch||``).trim(),n=(e.head||``).trim();return t?`branch`:n?`detached`:`unborn`},ot=(e,t)=>({worktreeRoot:t,worktreeStatus:`ready`,headState:at(e),worktreeSource:`existing`}),Q=e=>{let t=e.replace(/\\/g,`/`);return t===`/`?`/`:t.length>1?t.replace(/\/+$/,``):t},st=e=>e.trim().replace(/^refs\/heads\//,``).replace(/^heads\//,``).replace(/\s+/g,`-`).replace(/^\/+|\/+$/g,``).split(`/`).join(`-`).replace(/[^A-Za-z0-9._-]+/g,`-`).replace(/-+/g,`-`).replace(/^-+|-+$/g,``).slice(0,80),ct=e=>e.trim().replace(/^refs\/heads\//,``).replace(/^heads\//,``).replace(/\s+/g,`-`).replace(/^\/+|\/+$/g,``),lt=(e,t)=>{let n=Q(e);n&&T.setState(e=>{let r=!1,i=e=>Q(e.path)!==n&&Q(e.worktreeRoot??e.path)!==n||e.worktreeStatus===t?e:(r=!0,{...e,worktreeStatus:t}),a=e.availableWorktrees,o=!1,s=e.availableWorktrees.map(e=>{let t=i(e);return t!==e&&(o=!0),t});o&&(a=s);let c=e.availableWorktreesByProject;for(let[t,n]of e.availableWorktreesByProject){let r=!1,a=n.map(e=>{let t=i(e);return t!==e&&(r=!0),t});r&&(c===e.availableWorktreesByProject&&(c=new Map(e.availableWorktreesByProject)),c.set(t,a))}let l=e.worktreeMetadata;for(let[t,n]of e.worktreeMetadata){let r=i(n);r!==n&&(l===e.worktreeMetadata&&(l=new Map(e.worktreeMetadata)),l.set(t,r))}return r?{availableWorktrees:a,availableWorktreesByProject:c,worktreeMetadata:l}:{}})},ut=e=>e?.status===`pending`?`pending`:e?.status===`failed`?`invalid`:`ready`,dt=e=>{let t=Q(e),n=t.split(`/`).filter(Boolean);return n[n.length-1]??t},ft=e=>{let t=[];for(let n of e.setupCommands){let r=n.trim();r&&t.push(x(r,{rootWorktreePath:e.projectDirectory}))}let n=t.filter(Boolean).join(` && `);return n.trim().length>0?n:void 0},pt=(e,t)=>{let n=e.mode===`existing`?`existing`:`new`,r=st(e.worktreeName??e.preferredName??``),i=ct(e.branchName??(n===`new`?e.preferredName:void 0)??``),a=ct(e.existingBranch??e.branchName??``),o=(e.startRef||``).trim(),s=ft({projectDirectory:t,setupCommands:Array.isArray(e.setupCommands)?e.setupCommands:[]});return{mode:n,...r?{worktreeName:r}:{},...i?{branchName:i}:{},...a?{existingBranch:a}:{},...o?{startRef:o}:{},...s?{startCommand:s}:{},...e.setUpstream?{setUpstream:!0}:{},...e.upstreamRemote?{upstreamRemote:e.upstreamRemote}:{},...e.upstreamBranch?{upstreamBranch:e.upstreamBranch}:{},...e.ensureRemoteName?{ensureRemoteName:e.ensureRemoteName}:{},...e.ensureRemoteUrl?{ensureRemoteUrl:e.ensureRemoteUrl}:{},...e.returnAfterDirectoryCreated?{returnAfterDirectoryCreated:!0}:{}}},mt=(e,t)=>{if(e.size!==t.size)return!1;for(let[n,r]of e){let e=t.get(n);if(!e||e.length!==r.length)return!1;for(let t=0;t<r.length;t++){let n=r[t],i=e[t];if(n.path!==i.path||n.branch!==i.branch||n.name!==i.name||n.label!==i.label||n.projectDirectory!==i.projectDirectory||n.worktreeRoot!==i.worktreeRoot||n.headState!==i.headState||n.worktreeSource!==i.worktreeSource||n.source!==i.source)return!1}}return!0},ht=new Map,gt=new Map,_t=new Map,vt=new Map,yt=new Map,bt=new WeakMap,xt=3e4,St=``,Ct=()=>{let e=`${n()}\u0000${t()}`;return e!==St&&(St=e,ht.clear(),gt.clear(),_t.clear(),vt.clear(),yt.clear()),e},wt=e=>`${Ct()}\u0000${Q(e)}`,Tt=(e,t=wt(e))=>_t.get(t)??0,Et=e=>{let t=wt(e),n=vt.get(t)??Q(e),r=wt(n);yt.set(r,(yt.get(r)??0)+1);let i=new Set([t,r]);for(let[e,t]of vt)e.startsWith(`${Ct()}\u0000`)&&t===n&&i.add(e);for(let e of i)_t.set(e,(_t.get(e)??0)+1),ht.delete(e);l(n),Q(e)!==n&&l(e)},Dt=async(e,t,n)=>{let r=Q(await ie(e)),i=Q(e),a=`${t}\u0000${r}`,o=n&&bt.get(n);n&&!o&&(o=new Map,bt.set(n,o)),n&&!o?.has(a)&&t===Ct()&&Et(r);let s=yt.get(a)??0,c=o?.get(a);(!c||c.generation!==s)&&(n&&c&&l(r),c={generation:s,value:O.worktree.list(r)},o?.set(a,c));let u=await c.value;t===Ct()&&vt.set(`${t}\u0000${e}`,r);let d=u.filter(e=>typeof e.path==`string`&&e.path.trim().length>0).map(e=>{let t=Q(e.path),n=(e.branch||``).replace(/^refs\/heads\//,``).trim(),i=(e.name||``).trim(),a=ot(e,t);return{source:`sdk`,name:i||dt(t),path:t,projectDirectory:r,branch:n,label:n||i||dt(t),worktreeRoot:a.worktreeRoot,worktreeStatus:a.worktreeStatus,headState:a.headState,worktreeSource:a.worktreeSource}});return v(i,d).sort((e,t)=>{let n=(e.label||e.branch||e.path).toLowerCase(),r=(t.label||t.branch||t.path).toLowerCase();return n.localeCompare(r)})},Ot=async(e,t,n,r)=>{for(;;){let i=Tt(e,t),a=await Dt(e,n,r);if(n!==Ct())return a;if(i===Tt(e,t))return ht.set(t,{value:a,at:Date.now()}),a}};async function kt(e,t){let n=Q(e.path),r=Ct(),i=`${r}\u0000${n}`,a=ht.get(i);if(a&&Date.now()-a.at<xt)return a.value;let o=gt.get(i);if(o)return o;let s=Ot(n,i,r,t).finally(()=>{gt.get(i)===s&&gt.delete(i)});return gt.set(i,s),s}var At=(e,t)=>{let n=ee(e.worktreeRoot??e.path),r=n?.status===`pending`?`pending`:n?.status===`failed`?`invalid`:t?.worktreeStatus;return r&&r!==e.worktreeStatus?{...e,worktreeStatus:r}:e},jt=e=>{let t=new Set([...e].map(Q));if(t.size===0)return;let n=T.getState().worktreeMetadata,r=new Map(n);for(let[e,i]of n)t.has(Q(i.path))&&r.delete(e);for(let[e,n]of E.getState().attachments){let r=typeof n.worktreeRoot==`string`&&n.worktreeRoot.trim()?Q(n.worktreeRoot):``,i=typeof n.cwd==`string`&&n.cwd.trim()?Q(n.cwd):``;(r&&t.has(r)||i&&t.has(i))&&E.getState().clearAttachment(e)}r.size!==n.size&&T.setState({worktreeMetadata:r})};async function Mt(e,t={}){let n=Q(e.path),r=wt(n);_t.set(r,Tt(n)+1),ht.delete(r),gt.delete(r);let i=await kt({...e,path:n},t.refreshBatch??{}),a=vt.get(r);if(t.isCurrent&&!t.isCurrent())return{worktrees:i,addedDirectories:[],removedDirectories:[],repositoryDirectory:a};let o=i,s=[],c=[];return T.setState(e=>{let t=e.availableWorktreesByProject,r=v(n,t.get(n)??[]),a=new Map(r.map(e=>[Q(e.path),e])),l=i.map(e=>At(e,a.get(Q(e.path)))),u=new Set(l.map(e=>Q(e.path)));if(s=l.filter(e=>!a.has(Q(e.path))).map(e=>e.path),c=r.filter(e=>!u.has(Q(e.path))).map(e=>e.path),o=l,r.length===l.length&&r.every((e,t)=>{let n=l[t];return n&&e.path===n.path&&e.branch===n.branch&&e.name===n.name&&e.label===n.label&&e.projectDirectory===n.projectDirectory&&e.worktreeRoot===n.worktreeRoot&&e.headState===n.headState&&e.worktreeSource===n.worktreeSource&&e.source===n.source&&e.worktreeStatus===n.worktreeStatus})&&r.every((e,r)=>e===t.get(n)?.[r])&&r.length===(t.get(n)?.length??0))return{};let d=new Map(t);return d.set(n,l),{availableWorktreesByProject:d,availableWorktrees:[...d.values()].flat()}}),jt(c),{worktrees:o,addedDirectories:s,removedDirectories:c,repositoryDirectory:a}}async function Nt(e,t){let n=Q(e.path),r=Q(await ie(n));vt.set(wt(n),r);let i=n===Q(r)?[]:await O.worktree.list(r),a=pt(t,n),o=await O.worktree.create(n,a),s=typeof o?.name==`string`?o.name:``,c=typeof o?.branch==`string`?o.branch:``,l=typeof o?.path==`string`?o.path:``;if(!s||!l)throw Error(`Worktree create missing name/path`);let u={source:`sdk`,name:s,path:Q(l),projectDirectory:r,branch:c,label:c||s,worktreeRoot:Q(l),worktreeStatus:ut(o?.bootstrapStatus),headState:c?`branch`:`unborn`,worktreeSource:`created-for-session`},d=v(n,[...i.filter(e=>!!e.path).map(e=>({path:e.path,worktreeRoot:e.path,projectDirectory:r,branch:e.branch??``,label:e.branch??``})),u]).find(e=>e.worktreeRoot===u.worktreeRoot)??u,f=d.worktreeRoot??d.path;o?.bootstrapStatus?C(f,o.bootstrapStatus):g(f),S(f,{onFailed:()=>lt(f,`invalid`),onReady:()=>lt(f,`ready`)}),Et(n),tt();let p=n;return T.setState(e=>{let t=new Map(e.availableWorktreesByProject),n=t.get(p)??[];return t.set(p,[...n.filter(e=>Q(e.path)!==d.path),d]),{availableWorktreesByProject:t,availableWorktrees:[...t.values()].flat()}}),d}async function Pt(e,t){let n=e.path,r=pt(t,n);return O.worktree.validate(n,r)}async function Ft(e,t,n){let r=Q(e.path),i=!!n?.deleteRemoteBranch,a=n?.deleteLocalBranch===!0,o=n?.remoteName;if(!(await O.worktree.remove(r,{directory:t.worktreeRoot??t.path,deleteLocalBranch:a}))?.success)throw Error(`Worktree removal failed`);_(t.worktreeRoot??t.path),Et(Q(e.path)),tt();let s=Q(t.worktreeRoot??t.path),c=T.getState().availableWorktreesByProject,l=new Map(c),u=new Set([s,Q(t.path)]);for(let[e,t]of c){let n=t.filter(e=>Q(e.worktreeRoot??e.path)!==s||(u.add(Q(e.path)),!1));n.length!==t.length&&(l.set(e,n),Et(e))}jt(u),T.setState({availableWorktreesByProject:l,availableWorktrees:T.getState().availableWorktrees.filter(e=>Q(e.worktreeRoot??e.path)!==s)});let d=(t.branch||``).replace(/^refs\/heads\//,``).trim();i&&d&&await ne(r,{branch:d,remote:o}).catch(()=>void 0)}var It=200,$=new Map,Lt=[{key:`code`,Icon:`code-box`,label:`Code`},{key:`terminal`,Icon:`terminal-box`,label:`Terminal`},{key:`rocket`,Icon:`rocket`,label:`Rocket`},{key:`flask`,Icon:`flask`,label:`Lab`},{key:`gamepad`,Icon:`gamepad`,label:`Game`},{key:`briefcase`,Icon:`briefcase`,label:`Work`},{key:`home`,Icon:`home`,label:`Home`},{key:`globe`,Icon:`global`,label:`Web`},{key:`leaf`,Icon:`leaf`,label:`Nature`},{key:`shield`,Icon:`shield`,label:`Security`},{key:`palette`,Icon:`palette`,label:`Design`},{key:`server`,Icon:`server`,label:`Server`},{key:`phone`,Icon:`smartphone`,label:`Mobile`},{key:`database`,Icon:`database-2`,label:`Data`},{key:`lightbulb`,Icon:`lightbulb`,label:`Idea`},{key:`music`,Icon:`music`,label:`Music`},{key:`camera`,Icon:`camera`,label:`Media`},{key:`book`,Icon:`book-open`,label:`Docs`},{key:`heart`,Icon:`heart`,label:`Favorite`}],Rt=Object.fromEntries(Lt.map(e=>[e.key,e.Icon])),zt=[{key:`keyword`,label:`Purple`,cssVar:`var(--syntax-keyword)`},{key:`string`,label:`Green`,cssVar:`var(--syntax-string)`},{key:`number`,label:`Pink`,cssVar:`var(--syntax-number)`},{key:`type`,label:`Gold`,cssVar:`var(--syntax-type)`},{key:`constant`,label:`Cyan`,cssVar:`var(--syntax-constant)`},{key:`comment`,label:`Muted`,cssVar:`var(--syntax-comment)`},{key:`error`,label:`Red`,cssVar:`var(--status-error)`},{key:`primary`,label:`Blue`,cssVar:`var(--primary)`},{key:`success`,label:`Green`,cssVar:`var(--status-success)`}],Bt=Object.fromEntries(zt.map(e=>[e.key,e.cssVar])),Vt=(e,t)=>{if(typeof e!=`number`||e<=0)return null;let n=new URLSearchParams({v:String(e)});return typeof t?.iconColor==`string`&&t.iconColor.trim()&&n.set(`iconColor`,t.iconColor.trim()),(t?.themeVariant===`light`||t?.themeVariant===`dark`)&&n.set(`theme`,t.themeVariant),n},Ht=(e,t)=>e?[r()||`same-origin`,e,t.toString()].join(`|`):null,Ut=(e,t,n)=>{let r=Vt(t,n);if(!r)return null;let i=Ht(e,r);return i?{cacheKey:i,projectId:e,query:r}:null},Wt=()=>{for(;$.size>It;){let e=$.keys().next().value;if(typeof e!=`string`)return;let t=$.get(e);t?.url&&typeof URL<`u`&&typeof URL.revokeObjectURL==`function`&&URL.revokeObjectURL(t.url),$.delete(e)}},Gt=e=>{let t=$.get(e.cacheKey);if(t?.url)return Promise.resolve(t.url);if(t?.promise)return t.promise;let n=i(`/api/projects/${encodeURIComponent(e.projectId)}/icon`,{method:`GET`,headers:{Accept:`image/*`},query:e.query}).then(async t=>{if(!t.ok||typeof URL>`u`||typeof URL.createObjectURL!=`function`)return null;let n=await t.blob(),r=URL.createObjectURL(n);return $.set(e.cacheKey,{url:r}),Wt(),r}).catch(()=>null).finally(()=>{let t=$.get(e.cacheKey);t?.promise===n&&!t.url&&$.delete(e.cacheKey)});return $.set(e.cacheKey,{promise:n}),n},Kt=(e,t)=>{let n=(0,A.c)(10),r=e.id,i=e.iconImage?.updatedAt,a=t?.themeVariant,o=t?.iconColor,s;n[0]!==o||n[1]!==r||n[2]!==a||n[3]!==i?(s=Ut(r,i,{themeVariant:a,iconColor:o}),n[0]=o,n[1]=r,n[2]=a,n[3]=i,n[4]=s):s=n[4];let c=s,l;n[5]===c?l=n[6]:(l=()=>c?$.get(c.cacheKey)?.url??null:null,n[5]=c,n[6]=l);let[u,d]=k.useState(l),f,p;return n[7]===c?(f=n[8],p=n[9]):(f=()=>{if(!c){d(null);return}let e=$.get(c.cacheKey)?.url;if(e){d(e);return}let t=!1;return d(null),Gt(c).then(e=>{t||d(e)}),()=>{t=!0}},p=[c],n[7]=c,n[8]=f,n[9]=p),k.useEffect(f,p),u},qt=e=>{let t=(0,A.c)(21),{project:n,options:r,className:i,alt:a,draggable:o,fallback:s,onError:c}=e,l=a===void 0?``:a,u=o!==void 0&&o,d=s===void 0?null:s,f=Kt(n,r),[p,m]=k.useState(!1),h;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(h=()=>{m(!1)},t[0]=h):h=t[0];let g=n.iconImage?.updatedAt,_;if(t[1]!==n.id||t[2]!==f||t[3]!==g?(_=[f,n.id,g],t[1]=n.id,t[2]=f,t[3]=g,t[4]=_):_=t[4],k.useEffect(h,_),!f||p){let e;return t[5]===d?e=t[6]:(e=k.createElement(k.Fragment,null,d),t[5]=d,t[6]=e),e}let v;if(t[7]!==l||t[8]!==i||t[9]!==u||t[10]!==c||t[11]!==f){let e;t[13]===c?e=t[14]:(e=e=>{m(!0),c?.(e)},t[13]=c,t[14]=e);let n;t[15]!==l||t[16]!==i||t[17]!==u||t[18]!==f||t[19]!==e?(n={src:f,alt:l,className:i,draggable:u,onError:e},t[15]=l,t[16]=i,t[17]=u,t[18]=f,t[19]=e,t[20]=n):n=t[20],v=k.createElement(`img`,n),t[7]=l,t[8]=i,t[9]=u,t[10]=c,t[11]=f,t[12]=v}else v=t[12];return v};export{F as C,De as S,ke as _,qt as a,Te as b,kt as c,mt as d,it as f,Ae as g,B as h,Rt as i,Ft as l,W as m,Bt as n,Nt as o,Y as p,Lt as r,Mt as s,zt as t,Pt as u,P as v,Ee as x,we as y};
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/assistant-attachment-cache-BYvIyn1x.js","assets/rolldown-runtime-hePW80VL.js","assets/runtime-auth-DA-qfGHk.js","assets/runtime-switch-DEPKHgdL.js","assets/runtime-fetch-V-iMWR8t.js","assets/reasoning-projection-client-BEhVknv9.js","assets/runtime-file-resource-CKQQEwNv.js","assets/platform-CiUKDeXd.js","assets/runtimeAPIRegistry-C2VogTny.js","assets/vendor-pathe-vBmvQE8f.js","assets/vendor-base-ui-fom6orB6.js","assets/vendor-react-D5BntRmA.js","assets/vendor-tanstack-query-core-BSjXNgF_.js","assets/vendor-tanstack-react-query-ChSd65dm.js","assets/path-utils-jGozTg9d.js","assets/vendor-reactuses-core-B8s-Rcd-.js","assets/vendor-lodash-es-BS45jPoZ.js","assets/vendor-js-cookie-hSOiFTtX.js","assets/vendor-aparajita-capacitor-secure-storage-xol_6BsB.js","assets/runtime-file-store-BVRgEtI-.js","assets/brand-storage-migration-Bhz6UOBJ.js"])))=>i.map(i=>d[i]);
2
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,l as n}from"./runtime-switch-DEPKHgdL.js";import{n as r}from"./runtime-fetch-V-iMWR8t.js";import{A as i,F as a,I as o,f as s,j as c,p as l}from"./platform-CiUKDeXd.js";import{t as u}from"./runtimeAPIRegistry-C2VogTny.js";import{f as d,s as f,v as p}from"./desktopHosts-BsTrBVja.js";import{i as m,n as h,r as g}from"./desktopRelayRestore-BxbRKak_.js";import{A as _,C as v,D as y,E as b,M as x,N as S,O as C,it as w,j as ee,k as T,ot as E,st as D,w as O}from"./vendor-base-ui-fom6orB6.js";import"./brand-storage-bootstrap-D4BW3w-M.js";import{n as k}from"./vendor-react-D5BntRmA.js";import{r as te}from"./vendor-tanstack-query-core-BSjXNgF_.js";import{i as ne,n as re,r as ie,s as A,u as ae}from"./vendor-tanstack-react-query-ChSd65dm.js";import{J as oe,q as j}from"./runtime-file-resource-CKQQEwNv.js";import{o as M}from"./vendor-aparajita-capacitor-secure-storage-xol_6BsB.js";import{n as N,t as se}from"./i18n-BvjeIWrT.js";import{i as P,t as F}from"./store-Dj5cSf8B.js";import{Ci as I,In as ce,Rn as L,Wn as R,Yi as z,Zi as B,ua as le}from"./useMobileNavigationStore-oveTY29a.js";import{n as V}from"./Icon-DebSeH2D.js";import{i as H,n as U,r as ue,t as de}from"./vendor-simplewebauthn-browser-Dwhcdg_5.js";import{t as fe}from"./input-Ck9_Qln_.js";import{g as pe,h as me,m as he,p as ge,t as _e}from"./MobileResizableSheet-BJs0jEqn.js";import{d as ve,l as ye}from"./select-BnDfHG_T.js";import{n as be}from"./textarea-CVswImHY.js";import{n as xe,r as Se,t as Ce}from"./dropdown-menu.styles-BDla58Rm.js";import{_ as we,g as Te,y as Ee}from"./projectMeta-Bh7dUtdB.js";var W=k(),De=[`desktopHostSwitch`],Oe=class extends Error{result;host;constructor(e,t){super(e.reason),this.name=`DesktopHostSwitchError`,this.result=e,this.host=t}},G=(e,t)=>F(P.getState().dictionary,e,t),ke=async e=>{let{host:t}=e;if(t.id===`local`){if(o()&&!l())return await c(`desktop_switch_to_local`),{ok:!0,via:`direct`,status:{status:`ok`,latencyMs:0}};let r=(e.localApiOrigin||``).trim();if(!r)throw new Oe({ok:!1,status:{status:`unreachable`,latencyMs:0},reason:`unreachable`},t);return n({apiBaseUrl:r,clientToken:e.localClientToken||null,runtimeKey:g(t)}),{ok:!0,via:`direct`,status:{status:`ok`,latencyMs:0}}}let r=await m(t,{cachedProbe:e.cachedProbe});if(!r.ok)throw new Oe(r,t);return r},Ae=null,je=()=>Ae||(Ae=new te(j,{mutationKey:De,mutationFn:ke,onError:(e,t)=>{if(!(e instanceof Oe)){I.error(G(`desktopHostSwitcher.toast.instanceUnreachable`,{host:p(t.host.label)}),{description:e instanceof Error?e.message:String(e)});return}if(e.result.reason!==`unsupported`){if(e.result.status.status===`auth`){if(d(e.host)){I.error(G(`mobile.connect.pairing.expired`),{description:G(`desktopHostSwitcher.pairing.reconnectHint`),action:{label:G(`settings.remoteInstances.openLocalManager`),onClick:()=>{f().catch(()=>I.error(G(`sessionAuth.error.networkTitle`)))}}});return}I.error(G(`desktopHostSwitcher.status.authRequired`));return}I.error(G(`desktopHostSwitcher.toast.instanceUnreachable`,{host:p(t.host.label)}))}}}),Ae.subscribe(()=>void 0),Ae),Me=async e=>{if(h(e.host))return{ok:!0,via:`direct`,status:e.cachedProbe?.status===`ok`?e.cachedProbe:{status:`ok`,latencyMs:0}};if(j.isMutating({mutationKey:De})>0)return{ok:!1,status:{status:`unreachable`,latencyMs:0},reason:`unsupported`};try{return await je().mutate(e)}catch(e){return e instanceof Oe?e.result:{ok:!1,status:{status:`unreachable`,latencyMs:0},reason:`unreachable`}}},Ne=e=>{let t=(0,W.c)(2),n=e!==void 0&&e,r;return t[0]===n?r=t[1]:(r={mutationKey:De,predicate:e=>!n||!e.state.variables?.inlineProgress},t[0]=n,t[1]=r),ie(r)>0},Pe=()=>{let e=(0,W.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={filters:{mutationKey:De,status:`pending`},select:Fe},e[0]=t):t=e[0],ne(t)[0]?.host.id??null};function Fe(e){return e.state.variables}var K=e=>typeof e==`object`&&!!e,q=(e,t)=>{let n=e[t];return typeof n==`string`?n:null},J=(e,t)=>{let n=e[t];return typeof n==`number`&&Number.isFinite(n)?n:null},Y=(e,t)=>{let n=e[t];return typeof n==`boolean`?n:null},Ie=e=>Array.isArray(e)?e.filter(e=>typeof e==`string`):[],X=()=>i()?(e,t)=>c(e,t):null,Le=e=>{if(!K(e))return;let t=Y(e,`enabled`)??!1,n=q(e,`store`)?.toLowerCase()===`settings`?`settings`:`never`,r=q(e,`value`);return{enabled:t,store:n,...r?{value:r}:{}}},Re=e=>e===`remote`||e===`dynamic`?e:`local`,ze=e=>{if(!K(e))return null;let t=q(e,`id`);if(!t)return null;let n=Y(e,`enabled`)??!0,r=Re(q(e,`type`)),i=q(e,`localHost`)||q(e,`local_host`)||void 0,a=J(e,`localPort`)??J(e,`local_port`)??void 0,o=q(e,`remoteHost`)||q(e,`remote_host`)||void 0,s=J(e,`remotePort`)??J(e,`remote_port`)??void 0;return{id:t,enabled:n,type:r,...i?{localHost:i}:{},...typeof a==`number`?{localPort:a}:{},...o?{remoteHost:o}:{},...typeof s==`number`?{remotePort:s}:{}}},Be=e=>{if(!K(e))return null;let t=q(e,`id`),n=q(e,`sshCommand`)||q(e,`ssh_command`);if(!t||!n)return null;let r=q(e,`nickname`),i=e.sshParsed,a=K(i)?{destination:q(i,`destination`)||``,args:Ie(i.args)}:void 0,o=K(e.remoteYuri)?e.remoteYuri:K(e.remote_yuri)?e.remote_yuri:{},s=K(e.localForward)?e.localForward:K(e.local_forward)?e.local_forward:{},c=K(e.auth)?e.auth:{},l=q(o,`mode`)?.toLowerCase()===`external`?`external`:`managed`,u=q(o,`installMethod`)||q(o,`install_method`),d=u===`npm`||u===`download_release`||u===`upload_bundle`?u:`bun`,f=q(s,`bindHost`)||q(s,`bind_host`)||`127.0.0.1`,p=f===`localhost`||f===`0.0.0.0`?f:`127.0.0.1`,m=(Array.isArray(e.portForwards)?e.portForwards:Array.isArray(e.port_forwards)?e.port_forwards:[]).map(e=>ze(e)).filter(e=>!!e),h=J(o,`preferredPort`)??J(o,`preferred_port`),g=J(s,`preferredLocalPort`)??J(s,`preferred_local_port`),_=Le(c.sshPassword||c.ssh_password),v=Le(c.yuriPassword||c.yuri_password);return{id:t,...r?{nickname:r}:{},sshCommand:n,...a&&a.destination?{sshParsed:a}:{},connectionTimeoutSec:J(e,`connectionTimeoutSec`)??J(e,`connection_timeout_sec`)??60,remoteYuri:{mode:l,keepRunning:Y(o,`keepRunning`)??Y(o,`keep_running`)??!0,relayHost:Y(o,`relayHost`)??Y(o,`relay_host`)??!0,...h?{preferredPort:h}:{},installMethod:d,uploadBundleOverSsh:Y(o,`uploadBundleOverSsh`)??Y(o,`upload_bundle_over_ssh`)??!1},localForward:{...g?{preferredLocalPort:g}:{},bindHost:p},auth:{..._?{sshPassword:_}:{},...v?{yuriPassword:v}:{}},portForwards:m}},Ve=e=>{switch(e){case`config_resolved`:case`auth_check`:case`master_connecting`:case`remote_probe`:case`installing`:case`updating`:case`server_detecting`:case`server_starting`:case`forwarding`:case`ready`:case`degraded`:case`error`:return e;default:return`idle`}},He=e=>{if(!K(e))return null;let t=q(e,`id`);return t?{id:t,phase:Ve(q(e,`phase`)),...q(e,`detail`)?{detail:q(e,`detail`)||void 0}:{},...q(e,`localUrl`)||q(e,`local_url`)?{localUrl:q(e,`localUrl`)||q(e,`local_url`)||void 0}:{},...typeof(J(e,`localPort`)??J(e,`local_port`))==`number`?{localPort:J(e,`localPort`)??J(e,`local_port`)??void 0}:{},...typeof(J(e,`remotePort`)??J(e,`remote_port`))==`number`?{remotePort:J(e,`remotePort`)??J(e,`remote_port`)??void 0}:{},startedByUs:Y(e,`startedByUs`)??Y(e,`started_by_us`)??!1,retryAttempt:J(e,`retryAttempt`)??J(e,`retry_attempt`)??0,requiresUserAction:Y(e,`requiresUserAction`)??Y(e,`requires_user_action`)??!1,...q(e,`errorCode`)||q(e,`error_code`)?{errorCode:q(e,`errorCode`)||q(e,`error_code`)||void 0}:{},updatedAtMs:J(e,`updatedAtMs`)??J(e,`updated_at_ms`)??Date.now()}:null},Ue=e=>{if(!K(e))return null;let t=q(e,`host`),n=q(e,`source`),r=q(e,`sshCommand`)||q(e,`ssh_command`);return!t||!n||!r?null:{host:t,source:n,sshCommand:r,pattern:Y(e,`pattern`)??!1}},We=(e,t)=>({id:e,sshCommand:t,connectionTimeoutSec:60,remoteYuri:{mode:`managed`,keepRunning:!0,relayHost:!0,installMethod:`bun`,uploadBundleOverSsh:!1},localForward:{bindHost:`127.0.0.1`},auth:{},portForwards:[]}),Ge=async()=>{let e=X();if(!e)return{instances:[]};let t=await e(`desktop_ssh_instances_get`);return K(t)?{instances:(Array.isArray(t.instances)?t.instances:Array.isArray(t.desktopSshInstances)?t.desktopSshInstances:[]).map(e=>Be(e)).filter(e=>!!e)}:{instances:[]}},Ke=async e=>{let t=X();t&&await t(`desktop_ssh_instances_set`,{config:{instances:e.instances}})},qe=async()=>{let e=X();if(!e)return[];let t=await e(`desktop_ssh_import_hosts`);return Array.isArray(t)?t.map(e=>Ue(e)).filter(e=>!!e):[]},Je=async e=>{let t=X();t&&await t(`desktop_ssh_connect`,{id:e})},Ye=async e=>{let t=X();t&&await t(`desktop_ssh_disconnect`,{id:e})},Xe=async e=>{let t=X();if(!t)return[];let n=await t(`desktop_ssh_status`,{...e?{id:e}:{}});return Array.isArray(n)?n.map(e=>He(e)).filter(e=>!!e):[]},Ze=async(e,t)=>{let n=X();if(!n)return[];let r=await n(`desktop_ssh_logs`,{id:e,...typeof t==`number`?{limit:t}:{}});return Array.isArray(r)?r.filter(e=>typeof e==`string`):[]},Qe=async e=>{let t=X();t&&await t(`desktop_ssh_logs_clear`,{id:e})},$e=(e,t)=>{let n=Math.max(0,Math.trunc(Number(e.fileGroups)||0)),r=Math.max(0,Math.trunc(Number(e.singleFiles)||0)),i=Math.max(0,Math.trunc(Number(e.directories)||0));return{fileGroups:Array.from({length:n},()=>!0),singleFiles:Array.from({length:r},()=>!0),directories:Array.from({length:i},()=>!0),agentsRoot:!0,providerCredentials:t?.includeProviderCredentials===!0,magpie:!1}},et=e=>{if(!K(e))return null;let t=q(e,`path`),n=J(e,`bytes`);return!t||n===null?null:{path:t,bytes:n}},tt=e=>{if(!K(e))return null;let t=q(e,`path`),n=J(e,`fileCount`)??J(e,`file_count`),r=J(e,`bytes`);return!t||n===null||r===null?null:{path:t,fileCount:n,bytes:r}},nt=e=>{if(e==null||!K(e))return null;let t=J(e,`fileCount`)??J(e,`file_count`),n=J(e,`bytes`);return t===null||n===null?null:{fileCount:t,bytes:n}},rt=e=>{if(e==null||!K(e))return null;let t=J(e,`bytes`);return t===null?null:{bytes:t}},it=e=>{if(!K(e))return null;let t=Array.isArray(e.files)?e.files:null,n=Array.isArray(e.directories)?e.directories:null,r=Ie(e.deletes),i=J(e,`totalBytes`)??J(e,`total_bytes`);if(!t||!n||i===null||!(`agentsRoot`in e)&&!(`agents_root`in e))return null;let a=t.map(e=>et(e)).filter(e=>!!e),o=n.map(e=>tt(e)).filter(e=>!!e);if(a.length!==t.length||o.length!==n.length)return null;let s=e.agentsRoot??e.agents_root,c=s==null?null:nt(s);if(s!=null&&c===null||!(`providerCredentials`in e))return null;let l=rt(e.providerCredentials);if(e.providerCredentials!==null&&l===null)return null;let u=e.direction===`pull`||e.direction===`push`?e.direction:void 0,d=e.selections,f=K(d)?{fileGroups:Array.isArray(d.fileGroups)?d.fileGroups.map(e=>e!==!1):[],singleFiles:Array.isArray(d.singleFiles)?d.singleFiles.map(e=>e!==!1):[],directories:Array.isArray(d.directories)?d.directories.map(e=>e!==!1):[],agentsRoot:d.agentsRoot!==!1,providerCredentials:d.providerCredentials===!0,magpie:d.magpie===!0}:void 0,p=at(e.selectionShape??e.selection_shape);return{files:a,directories:o,agentsRoot:c,providerCredentials:l,magpieAvailable:e.magpieAvailable===!0,magpie:rt(e.magpie),deletes:r,totalBytes:i,...u?{direction:u}:{},...f?{selections:f}:{},...p?{selectionShape:p}:{}}},at=e=>{if(!K(e))return null;let t=J(e,`fileGroups`)??J(e,`file_groups`),n=J(e,`singleFiles`)??J(e,`single_files`),r=J(e,`directories`);return t===null||n===null||r===null||t<0||n<0||r<0?null:{fileGroups:t,singleFiles:n,directories:r}},ot=e=>{if(!K(e))return null;let t=it(e.plan);if(!t)return null;let n=at(e.selectionShape??e.selection_shape)??t.selectionShape??null;return{plan:t,remoteExisting:Ie(e.remoteExisting??e.remote_existing),remoteAgentsRootExists:Y(e,`remoteAgentsRootExists`)??Y(e,`remote_agents_root_exists`)??!1,remoteProviderCredentialsExists:Y(e,`remoteProviderCredentialsExists`)??!1,...n?{selectionShape:n}:{}}},st=e=>{if(!K(e)||Y(e,`ok`)!==!0)return null;let t=J(e,`files`),n=J(e,`directories`),r=J(e,`deletes`),i=J(e,`totalBytes`)??J(e,`total_bytes`);if(t===null||n===null||r===null||i===null||!(`agentsRoot`in e)&&!(`agents_root`in e))return null;let a=e.agentsRoot??e.agents_root,o=null;if(a!=null){if(!K(a))return null;let e=J(a,`fileCount`)??J(a,`file_count`);if(e===null)return null;o={fileCount:e}}if(!(`providerCredentials`in e))return null;let s=rt(e.providerCredentials);if(e.providerCredentials!==null&&s===null)return null;let c=Ie(e.magpieWarnings).filter(e=>e===`sign_in_required`||e===`plugin_install_failed`||e===`agent_settings_skipped`);return{ok:!0,files:t,directories:n,deletes:r,totalBytes:i,agentsRoot:o,providerCredentials:s,...c.length?{magpieWarnings:c}:{}}},ct=async(e={})=>{let t=X();if(!t)return console.error(`[desktopSsh] config sync local scan skipped: desktop IPC bridge is unavailable in this window`),null;let n=await t(`desktop_ssh_sync_opencode_config`,{stage:`local`,...e.direction?{direction:e.direction}:{},...e.selections?{selections:e.selections}:{}});if(!K(n))return console.error(`[desktopSsh] config sync local scan returned a non-object payload`,n),null;let r=it(n.plan);if(!r)return console.error(`[desktopSsh] config sync local scan plan payload was not recognized`,n),null;let i=at(n.selectionShape??n.selection_shape)??r.selectionShape??null;return i?{...r,selectionShape:i}:r},lt=async(e,t={})=>{let n=X();if(!n)return console.error(`[desktopSsh] config sync preview skipped: desktop IPC bridge is unavailable in this window`),null;let r=await n(`desktop_ssh_sync_opencode_config`,{id:e,...t.targetKind?{targetKind:t.targetKind}:{},...t.direction?{direction:t.direction}:{},...t.selections?{selections:t.selections}:{}}),i=ot(r);return i||console.error(`[desktopSsh] config sync preview payload was not recognized`,r),i},ut=async(e,t={})=>{let n=X();if(!n)return console.error(`[desktopSsh] config sync apply skipped: desktop IPC bridge is unavailable in this window`),null;let r=await n(`desktop_ssh_sync_opencode_config`,{id:e,apply:!0,...t.targetKind?{targetKind:t.targetKind}:{},...t.direction?{direction:t.direction}:{},...t.selections?{selections:t.selections}:{}}),i=st(r);return i||console.error(`[desktopSsh] config sync apply payload was not recognized`,r),i},dt=async e=>{if(!i())return async()=>{};let t=window.__YURI_DESKTOP__?.listen;if(typeof t!=`function`)return async()=>{};let n=await t(`yuri:ssh-instance-status`,t=>{let n=He(t?.payload);n&&e(n)});return async()=>{await n()}},ft=new Set([`shellStartup`,`configSync`,`nodeRuntimeMissing`,`packageManagerMissing`,`nativeBinding`,`yuriCliMissing`,`yuriRegistry`,`yuriInstall`,`yuriCliIncompatible`,`opencodeInstall`,`serverStart`,`sshAuth`,`sshUnreachable`,`timeout`,`unknown`]),pt=e=>typeof e==`string`&&ft.has(e),mt=e=>{let t=String(e||``);return/shell startup|fresh .* shell|SSH command did not start/i.test(t)?`shellStartup`:/Initial SSH config sync failed/i.test(t)?`configSync`:/requires Node\.js \d+|no supported Node runtime/i.test(t)?`nodeRuntimeMissing`:/neither bun nor npm/i.test(t)?`packageManagerMissing`:/better-sqlite3|node_gyp_bins|gyp ERR|failed to prepare better-sqlite3/i.test(t)?`nativeBinding`:/Yuri installation completed but the executable is unavailable/i.test(t)?`yuriCliMissing`:/could not reach the npm registry|ENOTFOUND|ECONNREFUSED|ETIMEDOUT|EAI_AGAIN|CERT_HAS_EXPIRED|UNABLE_TO_GET_ISSUER_CERT|self-signed certificate|registry\.npmjs|npm error code E404|npm ERR! code E404|getaddrinfo/i.test(t)?`yuriRegistry`:/Failed to install Yuri/i.test(t)?`yuriInstall`:/Unknown option:\s*--relay-host|does not advertise --relay-host|does not support --relay-host/i.test(t)||/Unknown option:/i.test(t)?`yuriCliIncompatible`:/Failed to install OpenCode|OpenCode CLI/i.test(t)?`opencodeInstall`:/failed to become reachable|Managed Yuri server failed/i.test(t)?`serverStart`:/Permission denied|Authentication failed|publickey|keyboard-interactive/i.test(t)?`sshAuth`:/Could not resolve hostname|Connection refused|Connection timed out|ControlMaster connection timed out|SSH master process exited|Network is unreachable/i.test(t)?`sshUnreachable`:/Timed out waiting for SSH|Timed out waiting for forwarded/i.test(t)?`timeout`:`unknown`},ht=(e,t)=>pt(e)?e:mt(t),gt=e=>{switch(e){case`shellStartup`:return`desktopHostSwitcher.sshError.shellStartup.title`;case`configSync`:return`desktopHostSwitcher.sshError.configSync.title`;case`nodeRuntimeMissing`:return`desktopHostSwitcher.sshError.nodeRuntimeMissing.title`;case`packageManagerMissing`:return`desktopHostSwitcher.sshError.packageManagerMissing.title`;case`nativeBinding`:return`desktopHostSwitcher.sshError.nativeBinding.title`;case`yuriCliMissing`:return`desktopHostSwitcher.sshError.yuriCliMissing.title`;case`yuriRegistry`:return`desktopHostSwitcher.sshError.yuriRegistry.title`;case`yuriInstall`:return`desktopHostSwitcher.sshError.yuriInstall.title`;case`yuriCliIncompatible`:return`desktopHostSwitcher.sshError.yuriCliIncompatible.title`;case`opencodeInstall`:return`desktopHostSwitcher.sshError.opencodeInstall.title`;case`serverStart`:return`desktopHostSwitcher.sshError.serverStart.title`;case`sshAuth`:return`desktopHostSwitcher.sshError.sshAuth.title`;case`sshUnreachable`:return`desktopHostSwitcher.sshError.sshUnreachable.title`;case`timeout`:return`desktopHostSwitcher.sshError.timeout.title`;default:return`desktopHostSwitcher.sshError.unknown.title`}},_t=e=>{switch(e){case`shellStartup`:return`desktopHostSwitcher.sshError.shellStartup.guidance`;case`configSync`:return`desktopHostSwitcher.sshError.configSync.guidance`;case`nodeRuntimeMissing`:return`desktopHostSwitcher.sshError.nodeRuntimeMissing.guidance`;case`packageManagerMissing`:return`desktopHostSwitcher.sshError.packageManagerMissing.guidance`;case`nativeBinding`:return`desktopHostSwitcher.sshError.nativeBinding.guidance`;case`yuriCliMissing`:return`desktopHostSwitcher.sshError.yuriCliMissing.guidance`;case`yuriRegistry`:return`desktopHostSwitcher.sshError.yuriRegistry.guidance`;case`yuriInstall`:return`desktopHostSwitcher.sshError.yuriInstall.guidance`;case`yuriCliIncompatible`:return`desktopHostSwitcher.sshError.yuriCliIncompatible.guidance`;case`opencodeInstall`:return`desktopHostSwitcher.sshError.opencodeInstall.guidance`;case`serverStart`:return`desktopHostSwitcher.sshError.serverStart.guidance`;case`sshAuth`:return`desktopHostSwitcher.sshError.sshAuth.guidance`;case`sshUnreachable`:return`desktopHostSwitcher.sshError.sshUnreachable.guidance`;case`timeout`:return`desktopHostSwitcher.sshError.timeout.guidance`;default:return`desktopHostSwitcher.sshError.unknown.guidance`}},vt=e=>e===`unknown`||e===`yuriCliIncompatible`,yt=(e,t,n)=>{let r=typeof n==`string`?n.trim():``;return!vt(t)||!r||r===e?e:`${e}\n${r}`},Z=E();function bt(e){let t=(0,W.c)(27),{errorCode:n,detail:r,className:i}=e,{t:a}=se(),o,s,c,l,u,d;if(t[0]!==i||t[1]!==r||t[2]!==n||t[3]!==a){let e=ht(n,r);o=a(_t(e));let f;t[10]===r?f=t[11]:(f=typeof r==`string`?r.trim():``,t[10]=r,t[11]=f),s=f,c=vt(e)&&!!s&&s!==o,t[12]===i?d=t[13]:(d=L(`space-y-1`,i),t[12]=i,t[13]=d),l=`typography-ui-label text-[var(--status-error)]`,u=a(gt(e)),t[0]=i,t[1]=r,t[2]=n,t[3]=a,t[4]=o,t[5]=s,t[6]=c,t[7]=l,t[8]=u,t[9]=d}else o=t[4],s=t[5],c=t[6],l=t[7],u=t[8],d=t[9];let f;t[14]!==l||t[15]!==u?(f=(0,Z.jsx)(`p`,{className:l,children:u}),t[14]=l,t[15]=u,t[16]=f):f=t[16];let p;t[17]===o?p=t[18]:(p=(0,Z.jsx)(`p`,{className:`typography-meta text-muted-foreground`,children:o}),t[17]=o,t[18]=p);let m;t[19]!==s||t[20]!==c?(m=c?(0,Z.jsx)(`p`,{className:`typography-meta break-words text-muted-foreground`,children:s}):null,t[19]=s,t[20]=c,t[21]=m):m=t[21];let h;return t[22]!==d||t[23]!==f||t[24]!==p||t[25]!==m?(h=(0,Z.jsxs)(`div`,{className:d,children:[f,p,m]}),t[22]=d,t[23]=f,t[24]=p,t[25]=m,t[26]=h):h=t[26],h}var xt=`/auth/passkey/authenticate/options`,St=`/auth/passkey/authenticate/verify`,Ct=`/auth/passkey/register/options`,wt=`/auth/passkey/register/verify`,Tt=`/api/passkeys`,Et=`/auth/passkey/status`,Dt=`/api/auth/reset`,Ot={enabled:!1,hasPasskeys:!1,passkeyCount:0,rpID:null},kt=async(e,t)=>r(e,{method:`POST`,credentials:`include`,headers:{"Content-Type":`application/json`,Accept:`application/json`},body:t===void 0?void 0:JSON.stringify(t)}),At=async(e,t)=>{try{let t=await e.json();if(t&&typeof t.error==`string`&&t.error.trim())return t.error}catch{}return t},jt=e=>e instanceof H&&e.code===`ERROR_CEREMONY_ABORTED`,Mt=()=>{ue.cancelCeremony()},Nt=()=>typeof window>`u`?{supported:!1,reason:`Passkeys are unavailable outside the browser.`}:window.isSecureContext?{supported:!0,reason:``}:{supported:!1,reason:`Passkeys require HTTPS or localhost.`},Pt=async()=>{let e=Nt();if(!e.supported)throw Error(e.reason);let t=await kt(Ct,{label:typeof navigator.userAgent==`string`&&navigator.userAgent.trim()?navigator.userAgent:`This device`});if(!t.ok)throw Error(await At(t,`Could not start passkey setup.`));let{requestId:n,optionsJSON:r}=await t.json(),i=await kt(wt,{requestId:n,response:await U({optionsJSON:r})});if(!i.ok)throw Error(await At(i,`Could not finish passkey setup.`));return i.json().catch(()=>null)},Ft=async(e,t={})=>{let n=Nt();if(!n.supported)throw Error(n.reason);let r=await kt(xt);if(!r.ok)throw Error(await At(r,`Passkey sign-in is not available right now.`));let{requestId:i,optionsJSON:a}=await r.json(),o=await kt(St,{requestId:i,response:await de({optionsJSON:a}),trustDevice:e,issueClientToken:t.issueClientToken===!0,clientLabel:t.clientLabel,clientKind:t.clientKind,dedupeKey:t.dedupeKey});if(!o.ok)throw Error(await At(o,`Passkey sign-in failed.`));return o.json().catch(()=>null)},It=async()=>{let e=await r(Et,{method:`GET`,credentials:`include`,headers:{Accept:`application/json`}});if(!e.ok)return Ot;let t=await e.json().catch(()=>null);return{enabled:t?.enabled===!0,hasPasskeys:t?.hasPasskeys===!0,passkeyCount:typeof t?.passkeyCount==`number`?t.passkeyCount:0,rpID:typeof t?.rpID==`string`&&t.rpID?t.rpID:null}},Lt=async()=>{let e=await r(Tt,{method:`GET`,credentials:`include`,headers:{Accept:`application/json`}});if(!e.ok)throw Error(await At(e,`Could not load passkeys.`));let t=await e.json().catch(()=>null);return Array.isArray(t?.passkeys)?t.passkeys:[]},Rt=async e=>{let t=await r(`${Tt}/${encodeURIComponent(e)}`,{method:`DELETE`,credentials:`include`,headers:{Accept:`application/json`}});if(!t.ok)throw Error(await At(t,`Could not remove passkey.`));return t.json().catch(()=>null)},zt=async()=>{let e=await kt(Dt);if(!e.ok)throw Error(await At(e,`Could not clear saved authentication.`));try{let{clearAssistantAttachmentCacheAll:e}=await M(async()=>{let{clearAssistantAttachmentCacheAll:e}=await import(`./assistant-attachment-cache-BYvIyn1x.js`).then(e=>e.t);return{clearAssistantAttachmentCacheAll:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20])),{invalidateRuntimeAuthSession:t}=await M(async()=>{let{invalidateRuntimeAuthSession:e}=await import(`./runtime-auth-DA-qfGHk.js`).then(e=>e.m);return{invalidateRuntimeAuthSession:e}},__vite__mapDeps([2,1]));await e(`auth-reset`),t()}catch{}return e.json().catch(()=>null)},Bt=`__unassigned__`,Vt={mod:`mod`,shift:`shift`,alt:`alt`,option:`alt`,ctrl:`ctrl`,meta:`mod`,cmd:`mod`,command:`mod`},Ht={mod:R()?`⌘`:`Ctrl`,shift:`⇧`,alt:`⌥`,option:`⌥`,ctrl:`⌃`},Ut={comma:`,`,period:`.`,enter:`Enter`,escape:`Esc`,tab:`Tab`,space:`Space`,backspace:`⌫`,delete:`⌦`,arrowup:`↑`,arrowdown:`↓`,arrowleft:`←`,arrowright:`→`,home:`Home`,end:`End`,pageup:`Page Up`,pagedown:`Page Down`,backtick:"`",grave:"`","=":`=`,equal:`=`,plus:`+`,minus:`-`,"-":`-`},Wt=[`mod`,`ctrl`,`shift`,`alt`],Gt={"{":`[`,"}":`]`,":":`;`,'"':`'`,"<":`,`,">":`.`,"?":`/`,"|":`\\`,"~":"`","!":`1`,"@":`2`,"#":`3`,$:`4`,"%":`5`,"^":`6`,"&":`7`,"*":`8`,"(":`9`,")":`0`};function Kt(e){return e.trim().toLowerCase()===Bt}function qt(e){let t=e.toLowerCase();return t===`,`?`comma`:t===`.`?`period`:t===` `?`space`:t===`esc`?`escape`:t===`+`?`plus`:t===`-`||t===`_`?`minus`:t===`arrowup`?`arrowup`:t===`arrowdown`?`arrowdown`:t===`arrowleft`?`arrowleft`:t===`arrowright`?`arrowright`:t==="`"?`backtick`:Gt[t]??t}var Jt=[{id:`open_command_palette`,defaultCombo:`mod+p`,label:`Open command palette`,description:`Open the command palette`,customizable:!0},{id:`focus_input`,defaultCombo:`mod+i`,label:`Focus input`,description:`Focus the chat input field`,customizable:!0},{id:`open_status`,defaultCombo:`mod+shift+o`,label:`Open OpenCode status`,description:`Open the OpenCode status dialog`},{id:`open_settings`,defaultCombo:`mod+comma`,label:`Open settings`,description:`Open the settings panel`,customizable:!0},{id:`toggle_terminal`,defaultCombo:`ctrl+backtick`,label:`Toggle terminal`,description:`Toggle the integrated terminal`,customizable:!0},{id:`toggle_bottom_panel`,defaultCombo:`mod+j`,label:`Toggle bottom panel`,description:`Toggle the bottom panel dock`,customizable:!0},{id:`toggle_terminal_expanded`,defaultCombo:`mod+shift+j`,label:`Toggle terminal expanded`,description:`Toggle terminal expanded or collapsed`,customizable:!0},{id:`new_terminal_tab`,defaultCombo:`mod+t`,label:`New terminal tab`,description:`Create a new terminal tab when the terminal is focused`,customizable:!0},{id:`open_new_terminal`,defaultCombo:`mod+shift+backtick`,label:`Open new terminal`,description:`Open the terminal panel and create a new terminal tab`,customizable:!0},{id:`previous_terminal_tab`,defaultCombo:`mod+shift+[`,label:`Previous terminal tab`,description:`Switch to the previous terminal tab when the terminal is focused`,customizable:!0},{id:`next_terminal_tab`,defaultCombo:`mod+shift+]`,label:`Next terminal tab`,description:`Switch to the next terminal tab when the terminal is focused`,customizable:!0},{id:`toggle_files`,defaultCombo:`mod+shift+f`,label:`Toggle files`,description:`Toggle the files panel`},{id:`toggle_sidebar`,defaultCombo:`mod+b`,label:`Toggle sidebar`,description:`Toggle the session sidebar`,customizable:!0},{id:`open_timeline_dialog`,defaultCombo:`mod+t`,label:`Open conversation timeline`,description:`Search and navigate within current conversation`,customizable:!0},{id:`toggle_prompt_navigator`,defaultCombo:`mod+alt+p`,label:`Toggle prompt navigator`,description:`Show or hide the prompt navigator panel in chat`,customizable:!0},{id:`toggle_right_sidebar`,defaultCombo:`mod+alt+b`,defaultAliases:[`mod+\\`],label:`Toggle review panel`,description:`Toggle the review panel (right sidebar)`,customizable:!0},{id:`open_right_sidebar_git`,defaultCombo:`mod+shift+g`,label:`Open right sidebar Git tab`,description:`Open right sidebar and select Git`,customizable:!0},{id:`open_right_sidebar_files`,defaultCombo:`mod+shift+f`,label:`Open right sidebar Files tab`,description:`Open right sidebar and select Files`,customizable:!0},{id:`cycle_right_sidebar_tab`,defaultCombo:`mod+alt+shift+r`,label:`Cycle right sidebar tab`,description:`Cycle through right sidebar tabs`,customizable:!0},{id:`close_context_panel_tab`,defaultCombo:`mod+w`,label:`Close context panel tab`,description:`Close the active context panel tab (closes the panel when empty)`,customizable:!0},{id:`previous_session`,defaultCombo:`mod+shift+[`,defaultAliases:[`mod+arrowup`],label:`Previous session`,description:`Switch to the previous session`,customizable:!0},{id:`next_session`,defaultCombo:`mod+shift+]`,defaultAliases:[`mod+arrowdown`],label:`Next session`,description:`Switch to the next session`,customizable:!0},{id:`new_chat`,defaultCombo:`mod+n`,label:`New session`,description:`Start a new session`,customizable:!0},{id:`new_chat_worktree`,defaultCombo:`mod+shift+alt+n`,label:`New worktree draft`,description:`Create a new worktree and open a draft in it`,customizable:!0},{id:`new_mini_chat`,defaultCombo:`mod+alt+n`,label:`New Mini Chat window`,description:`Open a new Mini Chat draft window`,customizable:!0},{id:`submit_message`,defaultCombo:`mod+enter`,label:`Submit message`,description:`Submit the current message`},{id:`clear_input`,defaultCombo:`escape`,label:`Clear input`,description:`Clear the input field`},{id:`clear_all_messages`,defaultCombo:`ctrl+c`,label:`Clear all messages`,description:`Clear the composer input and queued messages`,customizable:!0},{id:`open_diff_panel`,defaultCombo:`mod+2`,label:`Open diff panel`,description:`Switch to the diff panel`},{id:`open_terminal_panel`,defaultCombo:`mod+3`,label:`Open terminal panel`,description:`Switch to the terminal panel`},{id:`open_git_panel`,defaultCombo:`mod+4`,label:`Open git panel`,description:`Switch to the git panel`},{id:`open_help`,defaultCombo:`mod+.`,label:`Open keyboard shortcuts`,description:`Show the keyboard shortcuts help`,customizable:!0},{id:`toggle_services_menu`,defaultCombo:`mod+shift+s`,label:`Toggle services menu`,description:`Open or close the services menu`,customizable:!0},{id:`open_usage`,defaultCombo:`mod+shift+c`,label:`Open usage`,description:`Open the usage panel`,customizable:!0},{id:`cycle_services_tab`,defaultCombo:`mod+alt+shift+s`,label:`Cycle services tab`,description:`Cycle through tabs in the services menu`,customizable:!0},{id:`cycle_theme`,defaultCombo:`mod+/`,label:`Cycle theme`,description:`Cycle between light, dark, and system theme`,customizable:!0},{id:`zoom_in`,defaultCombo:`mod+=`,label:`Zoom in`,description:`Increase the webview zoom level`,customizable:!0},{id:`zoom_out`,defaultCombo:`mod+-`,label:`Zoom out`,description:`Decrease the webview zoom level`,customizable:!0},{id:`zoom_reset`,defaultCombo:`mod+0`,label:`Reset zoom`,description:`Reset the webview zoom level to 100%`,customizable:!0},{id:`leader_key`,defaultCombo:`ctrl+x`,label:`Leader key`,description:`Start an OpenCode-style chord, then press M / A / N / C`,customizable:!0},{id:`open_model_selector`,defaultCombo:`mod+shift+m`,label:`Open model selector`,description:`Open model selector while in chat`,customizable:!0},{id:`cycle_thinking_variant`,defaultCombo:`mod+shift+t`,label:`Cycle thinking variant`,description:`Cycle thinking variant while in chat`},{id:`cycle_agent`,defaultCombo:`tab`,label:`Cycle agent`,description:`Cycle agent while the model selector is open`,customizable:!0},{id:`cycle_favorite_model_forward`,defaultCombo:`ctrl+]`,label:`Cycle favorite model forward`,description:`Cycle forward through starred models without opening the picker`,customizable:!0},{id:`cycle_favorite_model_backward`,defaultCombo:`ctrl+[`,label:`Cycle favorite model backward`,description:`Cycle backward through starred models without opening the picker`,customizable:!0},{id:`expand_input`,defaultCombo:`mod+shift+e`,label:`Expand input`,description:`Toggle focus mode for the chat input`,customizable:!0},{id:`toggle_dictation`,defaultCombo:`mod+alt+v`,label:`Voice input`,description:`Start dictation; press again to confirm and insert the transcript`,customizable:!0},{id:`abort_run`,defaultCombo:`escape`,label:`Abort active run`,description:`Abort the currently running task (double press)`},{id:`switch_tab_1`,defaultCombo:`mod+1`,label:`Switch to visible session 1`,description:`Switch to the first visible sidebar session`},{id:`switch_tab_2`,defaultCombo:`mod+2`,label:`Switch to visible session 2`,description:`Switch to the second visible sidebar session`},{id:`switch_tab_3`,defaultCombo:`mod+3`,label:`Switch to visible session 3`,description:`Switch to the third visible sidebar session`},{id:`switch_tab_4`,defaultCombo:`mod+4`,label:`Switch to visible session 4`,description:`Switch to the fourth visible sidebar session`},{id:`switch_tab_5`,defaultCombo:`mod+5`,label:`Switch to visible session 5`,description:`Switch to the fifth visible sidebar session`},{id:`switch_tab_6`,defaultCombo:`mod+6`,label:`Switch to visible session 6`,description:`Switch to the sixth visible sidebar session`},{id:`switch_tab_7`,defaultCombo:`mod+7`,label:`Switch to visible session 7`,description:`Switch to the seventh visible sidebar session`},{id:`switch_tab_8`,defaultCombo:`mod+8`,label:`Switch to visible session 8`,description:`Switch to the eighth visible sidebar session`},{id:`switch_tab_9`,defaultCombo:`mod+9`,label:`Switch to visible session 9`,description:`Switch to the ninth visible sidebar session`}];function Yt(e){if(Kt(e))return Bt;let t=e.toLowerCase().trim().split(`+`).map(e=>e.trim()).filter(Boolean),n=new Set,r=``;for(let e of t){let t=e===`,`?`comma`:e===`.`?`period`:e,i=Vt[t];if(i){n.add(i);continue}r=t}return[...Wt.filter(e=>n.has(e)),r].filter(Boolean).join(`+`)}function Xt(e){return Kt(e)?!0:Zt(e).key.trim().length>0}function Zt(e){if(Kt(e))return{modifiers:new Set,key:Bt};let t=Yt(e).split(`+`),n=new Set,r=``;for(let e of t){let t=Vt[e];t?n.add(t):r=e}return{modifiers:n,key:r}}function Qt(e){if(Kt(e))return`Unassigned`;let t=Zt(e);if(!t.key&&t.modifiers.size===0)return`Unassigned`;let n=[];for(let e of Wt)t.modifiers.has(e)&&n.push(Ht[e]);if(t.key){let e=Ut[t.key.toLowerCase()]||t.key.toUpperCase();n.push(e)}return n.join(` + `)}function $t(e){return Jt.find(t=>t.id===e)}function en(){return Jt.filter(e=>e.customizable===!0)}function tn(e,t){let n=$t(e);if(!n)return``;let r=t?.[e];if(typeof r==`string`){if(r.trim().toLowerCase()===`__unassigned__`)return``;let e=Yt(r);if(e===`__unassigned__`)return Bt;if(Xt(e))return e}return n.defaultCombo}function nn(e,t){let n=$t(e);if(!n)return[];let r=tn(e,t);return r===n.defaultCombo?[n.defaultCombo,...n.defaultAliases??[]]:r?[r]:[]}function rn(e){if(Kt(e))return!1;let t=Zt(e);if(!t.modifiers.has(`mod`))return!1;let n=t.key.toLowerCase();return new Set([`w`,`t`,`r`,`p`,`s`,`f`,`l`,`n`]).has(n)&&!t.modifiers.has(`shift`)&&!t.modifiers.has(`alt`)}function an(e,t){let n=typeof t==`string`?t:t.defaultCombo;if(Kt(n))return!1;let r=Zt(n),i=r.modifiers.has(`mod`),o=r.modifiers.has(`shift`),s=r.modifiers.has(`alt`),c=r.modifiers.has(`ctrl`),l=R()&&a(),u=R(),d=l?e.metaKey:u&&e.metaKey||e.ctrlKey;if(i&&!d||!i&&e.metaKey||o!==e.shiftKey||s!==e.altKey)return!1;if(c){if(!e.ctrlKey)return!1}else{let t=i&&!l&&e.ctrlKey;if(e.ctrlKey&&!t)return!1}let f=e.key;return(!f||f===`Dead`)&&e.code===`Backquote`&&(f="`"),e.altKey&&(e.code.startsWith(`Key`)&&e.code.length===4?f=e.code.slice(3).toLowerCase():e.code.startsWith(`Digit`)&&e.code.length===6&&(f=e.code.slice(5))),qt(f)===qt(r.key)}function on(){return R()?`⌘`:`Ctrl`}function sn(e,t,n){if(an(e,n))return!0;let r=Yt(n),i=R()&&a(),o=R();return!(i?e.metaKey:o&&e.metaKey||e.ctrlKey)||e.altKey||i&&e.ctrlKey&&!e.metaKey?!1:t===`in`&&r===`mod+=`?e.key===`+`||e.code===`NumpadAdd`:t===`out`&&(r===`mod+-`||r===`mod+minus`)?e.key===`_`||e.code===`NumpadSubtract`:!1}var Q=e(D(),1),cn=Q.createContext(null),ln=e=>e?e.closest(`[data-slot="dialog-content"], [role="dialog"]`):null;function un(e,t){return e&&Q.isValidElement(t)?{render:t}:{children:t}}function dn(e){let t=(0,W.c)(9),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let[r,i]=Q.useState(null),a;t[2]===r?a=t[3]:(a={portalContainer:r,setPortalContainer:i},t[2]=r,t[3]=a);let o=a,s;t[4]===n?s=t[5]:(s=(0,Z.jsx)(b,{...n}),t[4]=n,t[5]=s);let c;return t[6]!==o||t[7]!==s?(c=(0,Z.jsx)(cn.Provider,{value:o,children:s}),t[6]=o,t[7]=s,t[8]=c):c=t[8],c}function fn(e){let t=(0,W.c)(22),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({asChild:n,children:r,onPointerDownCapture:a,onFocusCapture:i,...o}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s=Q.useContext(cn),c;t[6]===s?c=t[7]:(c=e=>{if(!s)return;let t=e instanceof HTMLElement?e:null;s.setPortalContainer(ln(t))},t[6]=s,t[7]=c);let l=c,u;t[8]!==n||t[9]!==r?(u=un(n,r),t[8]=n,t[9]=r,t[10]=u):u=t[10];let d=u,f;t[11]!==a||t[12]!==l?(f=e=>{l(e.currentTarget),a?.(e)},t[11]=a,t[12]=l,t[13]=f):f=t[13];let p;t[14]!==i||t[15]!==l?(p=e=>{l(e.currentTarget),i?.(e)},t[14]=i,t[15]=l,t[16]=p):p=t[16];let m;return t[17]!==o||t[18]!==d||t[19]!==f||t[20]!==p?(m=(0,Z.jsx)(O,{"data-slot":`dropdown-menu-trigger`,onPointerDownCapture:f,onFocusCapture:p,...o,...d}),t[17]=o,t[18]=d,t[19]=f,t[20]=p,t[21]=m):m=t[21],m}function pn(e){let t=(0,W.c)(40),n,r,i,a,o,s,c,l,u,d,f,p,m;if(t[0]!==e){let{className:h,sideOffset:g,align:_,side:v,alignOffset:y,anchor:b,portalToBody:x,positionerClassName:S,style:C,children:w,onCloseAutoFocus:ee,collisionPadding:T,collisionAvoidance:E,...D}=e;o=h,d=g,n=_,l=v,r=y,i=b,f=x,s=S,u=C,a=w,p=T,m=E,c=D,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c,t[8]=l,t[9]=u,t[10]=d,t[11]=f,t[12]=p,t[13]=m}else n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7],l=t[8],u=t[9],d=t[10],f=t[11],p=t[12],m=t[13];let h=d===void 0?4:d,g=f!==void 0&&f,v=p===void 0?8:p,y;t[14]===m?y=t[15]:(y=m===void 0?{side:`shift`,align:`shift`}:m,t[14]=m,t[15]=y);let b=y,S=Q.useContext(cn),C=g?void 0:S?.portalContainer||void 0,w;t[16]===s?w=t[17]:(w=L(`app-region-no-drag z-50`,s),t[16]=s,t[17]=w);let T;t[18]===u?T=t[19]:(T={color:`var(--surface-elevated-foreground)`,...u},t[18]=u,t[19]=T);let E;t[20]===o?E=t[21]:(E=L(xe,o),t[20]=o,t[21]=E);let D;t[22]!==a||t[23]!==c||t[24]!==T||t[25]!==E?(D=(0,Z.jsx)(x,{"data-slot":`dropdown-menu-content`,style:T,className:E,...c,children:a}),t[22]=a,t[23]=c,t[24]=T,t[25]=E,t[26]=D):D=t[26];let O;t[27]!==n||t[28]!==r||t[29]!==i||t[30]!==b||t[31]!==v||t[32]!==l||t[33]!==h||t[34]!==D||t[35]!==w?(O=(0,Z.jsx)(_,{anchor:i,sideOffset:h,align:n,side:l,alignOffset:r,collisionPadding:v,collisionAvoidance:b,className:w,children:D}),t[27]=n,t[28]=r,t[29]=i,t[30]=b,t[31]=v,t[32]=l,t[33]=h,t[34]=D,t[35]=w,t[36]=O):O=t[36];let k;return t[37]!==O||t[38]!==C?(k=(0,Z.jsx)(ee,{container:C,children:O}),t[37]=O,t[38]=C,t[39]=k):k=t[39],k}function mn(e){let t=(0,W.c)(24),n,r,i,a,o,s,c,l;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7],l=t[8]):({className:i,inset:a,variant:l,asChild:n,children:r,onSelect:s,onClick:o,...c}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c,t[8]=l);let u=l===void 0?`default`:l,d;t[9]!==n||t[10]!==r?(d=un(n,r),t[9]=n,t[10]=r,t[11]=d):d=t[11];let f=d,p;t[12]!==o||t[13]!==s?(p=e=>{o?.(e),e.defaultPrevented||s?.(e)},t[12]=o,t[13]=s,t[14]=p):p=t[14];let m=p,h;t[15]===i?h=t[16]:(h=L(Ce,i),t[15]=i,t[16]=h);let g;return t[17]!==m||t[18]!==a||t[19]!==c||t[20]!==f||t[21]!==h||t[22]!==u?(g=(0,Z.jsx)(S,{"data-slot":`dropdown-menu-item`,"data-inset":a,"data-variant":u,className:h,...c,onClick:m,...f}),t[17]=m,t[18]=a,t[19]=c,t[20]=f,t[21]=h,t[22]=u,t[23]=g):g=t[23],g}function hn(e){let t=(0,W.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,Z.jsx)(T,{"data-slot":`dropdown-menu-radio-group`,...n}),t[2]=n,t[3]=r),r}function gn(e){let t=(0,W.c)(11),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:r,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===r?a=t[5]:(a=L(`data-[highlighted]:bg-interactive-hover hover:bg-interactive-hover data-[checked]:bg-interactive-selection data-[checked]:text-interactive-selection-foreground relative flex cursor-pointer items-start gap-2 rounded-lg py-1 pl-2 pr-8 typography-ui-label outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-3.5`,r),t[4]=r,t[5]=a);let o;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(`span`,{className:`pointer-events-none absolute right-2 flex size-3.5 items-center justify-center text-primary`,children:(0,Z.jsx)(y,{children:(0,Z.jsx)(V,{name:`check`,className:`size-3`})})}),t[6]=o):o=t[6];let s;return t[7]!==n||t[8]!==i||t[9]!==a?(s=(0,Z.jsxs)(C,{"data-slot":`dropdown-menu-radio-item`,className:a,...i,children:[o,n]}),t[7]=n,t[8]=i,t[9]=a,t[10]=s):s=t[10],s}function _n(e){let t=(0,W.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,inset:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===n?a=t[5]:(a=L(`px-2 py-1 typography-ui-label font-medium data-[inset]:pl-8`,n),t[4]=n,t[5]=a);let o;return t[6]!==r||t[7]!==i||t[8]!==a?(o=(0,Z.jsx)(`div`,{"data-slot":`dropdown-menu-label`,"data-inset":r,className:a,...i}),t[6]=r,t[7]=i,t[8]=a,t[9]=o):o=t[9],o}function vn(e){let t=(0,W.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=L(Se,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(v,{"data-slot":`dropdown-menu-separator`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var yn=e(w(),1),bn=`mobile-overlay-root`,xn=16,Sn=200,Cn=[],wn=0,Tn=``,En=0,Dn=()=>{if(typeof document>`u`)return null;let e=document.getElementById(bn);return e||(e=document.createElement(`div`),e.id=bn,document.body.appendChild(e)),e},On=({open:e,title:t,onClose:n,children:r,footer:i,className:a,contentMaxHeightClassName:o,renderHeader:s,containedBody:c=!1,closeAriaLabel:l})=>{let u=Q.useRef(null),d=Q.useRef(Symbol(`mobile-overlay`)),f=Q.useRef(n);f.current=n;let[p,m]=Q.useState(!1),[h,g]=Q.useState(!1);if(typeof document<`u`&&!u.current&&(u.current=Dn()),Q.useEffect(()=>{if(!e){m(!1),g(!1);return}let t=window.setTimeout(()=>m(!0),xn),n=window.setTimeout(()=>g(!0),266);return()=>{window.clearTimeout(t),window.clearTimeout(n)}},[e]),Q.useLayoutEffect(()=>{if(e)return En===0&&window.dispatchEvent(new Event(`yuri:mobile-overlay-opened`)),En+=1,()=>{En=Math.max(0,En-1),En===0&&window.dispatchEvent(new Event(`yuri:mobile-overlay-closed`))}},[e]),Q.useEffect(()=>{if(!e)return;let t=d.current;Cn.push(t),wn===0&&(Tn=document.body.style.overflow),wn+=1,document.body.style.overflow=`hidden`;let n=e=>{e.key===`Escape`&&Cn[Cn.length-1]===t&&f.current()};return document.addEventListener(`keydown`,n),()=>{let e=Cn.lastIndexOf(t);e>=0&&Cn.splice(e,1),wn=Math.max(0,wn-1),wn===0&&(document.body.style.overflow=Tn),document.removeEventListener(`keydown`,n)}},[e]),!e||!u.current)return null;let _=o??`max-h-[min(70vh,520px)]`,v=(0,Z.jsx)(`div`,{className:L(`yuri-keyboard-inset-surface fixed inset-0 z-[60] flex flex-col bg-[rgb(0_0_0_/_0.45)] transition-opacity duration-200 ease-out`,!h&&`yuri-keyboard-inset-snap`,p?`opacity-100`:`opacity-0`),role:`dialog`,"aria-modal":`true`,"aria-label":t,onPointerDown:me,onClick:e=>{pe(e)&&n()},children:(0,Z.jsxs)(`div`,{className:L(`mt-auto flex max-h-[calc(100dvh-0.75rem)] min-h-0 w-full flex-col rounded-t-xl border-x border-t border-border/50 bg-background pb-[max(0.5rem,var(--yuri-app-bottom-safe,0px),var(--yuri-safe-area-bottom,env(safe-area-inset-bottom,0px)))] shadow-none pwa-overlay-panel`,`mx-auto max-w-lg`,a),style:{transform:p?`none`:`translateY(100%)`,transition:`transform ${Sn}ms cubic-bezier(0.32, 0.72, 0, 1)`},onClick:e=>e.stopPropagation(),children:[(()=>{let e=(0,Z.jsx)(`button`,{type:`button`,onClick:n,className:L(`flex items-center justify-center rounded-lg text-muted-foreground hover:bg-interactive-hover`,c?`size-11`:`h-8 w-8`),"aria-label":l??t,children:(0,Z.jsx)(V,{name:`close`,className:`h-4 w-4`})});return s?s(e):(0,Z.jsxs)(`div`,{className:`flex items-center justify-between px-3 py-2 border-b border-border/40`,children:[(0,Z.jsx)(`h2`,{className:`typography-ui-label font-semibold text-foreground`,children:t}),e]})})(),c?(0,Z.jsx)(`div`,{className:L(`flex min-h-0 flex-1 flex-col overflow-hidden`,_),children:r}):(0,Z.jsx)(be,{useScrollShadow:!0,disableHorizontal:!0,preventOverscroll:!0,outerClassName:L(`min-h-0 flex-1`,_),className:`px-2 py-2 pwa-overlay-scroll`,children:r}),i?(0,Z.jsx)(`div`,{className:`shrink-0 border-t border-border/40 px-3 py-2`,children:i}):null]})});return(0,yn.createPortal)(v,u.current)},kn=8,An=e=>typeof e!=`number`||Number.isNaN(e)?``:Ee(e),jn=(e,t,n)=>{let r=e.find(e=>e.id===t)?.models?.find(e=>e.id===n);return r?.variants?Object.keys(r.variants):[]},Mn=e=>{let t=(0,W.c)(54),{open:n,onClose:r,selectedProviderID:i,selectedModelID:a,resolveSelectedVariant:o,onSelect:s,providers:c,favoriteModels:l,recentModels:u,hiddenModels:d,allowedProviderIds:f,allowedModelIdsByProvider:p,providerOrder:m,variantSelectionEnabled:h,isFavorite:g,onToggleFavorite:_,getMetadata:v,view:y,onViewChange:b}=e,x;t[0]===d?x=t[1]:(x=d===void 0?[]:d,t[0]=d,t[1]=x);let S=x,C=h===void 0||h,{t:w}=se(),ee=Q.useId(),[T,E]=Q.useState(``),D;t[2]===i?D=t[3]:(D=()=>new Set(i?[i]:[]),t[2]=i,t[3]=D);let[O,k]=Q.useState(D),[te,ne]=Q.useState(null),[re,ie]=Q.useState(`model`),[A,ae]=Q.useState(null),oe=Q.useRef(!1),j=y??re,M,N;t[4]!==n||t[5]!==i?(M=()=>{n&&!oe.current&&k(new Set(i?[i]:[])),n||(E(``),ne(null),ie(`model`),ae(null)),oe.current=n},N=[n,i],t[4]=n,t[5]=i,t[6]=M,t[7]=N):(M=t[6],N=t[7]),Q.useEffect(M,N);let P;t[8]===b?P=t[9]:(P=e=>{ie(e),b?.(e)},t[8]=b,t[9]=P);let F=P,I=j===`variant`&&!!(A??(i&&a)),L=`mobile-model-picker-sheet-${ee}`,R;t[10]===r?R=t[11]:(R=e=>{e||r()},t[10]=r,t[11]=R);let z;t[12]!==I||t[13]!==F||t[14]!==w?(z=I?(0,Z.jsx)(ce,{type:`button`,variant:`ghost`,size:`icon`,onClick:()=>F(`model`),"aria-label":w(`onboarding.common.actions.back`),children:(0,Z.jsx)(V,{name:`arrow-left`,className:`size-5`})}):void 0,t[12]=I,t[13]=F,t[14]=w,t[15]=z):z=t[15];let B;t[16]!==I||t[17]!==w?(B=w(I?`chat.modelControls.thinking`:`chat.modelControls.selectModel`),t[16]=I,t[17]=w,t[18]=B):B=t[18];let le;t[19]===w?le=t[20]:(le=w(`mobile.surface.closeAria`),t[19]=w,t[20]=le);let H;t[21]===w?H=t[22]:(H=w(`mobile.sessions.sheet.resizeAria`),t[21]=w,t[22]=H);let U;t[23]!==j||t[24]!==p||t[25]!==f||t[26]!==te||t[27]!==O||t[28]!==l||t[29]!==v||t[30]!==S||t[31]!==g||t[32]!==s||t[33]!==_||t[34]!==m||t[35]!==c||t[36]!==T||t[37]!==u||t[38]!==o||t[39]!==a||t[40]!==i||t[41]!==F||t[42]!==C||t[43]!==A?(U=(0,Z.jsx)(Nn,{query:T,onQueryChange:E,expandedProviders:O,onExpandedProvidersChange:k,expandedModelKey:te,onExpandedModelKeyChange:ne,activeView:j,setView:F,variantTarget:A,onVariantTargetChange:ae,selectedProviderID:i,selectedModelID:a,resolveSelectedVariant:o,onSelect:s,providers:c,favoriteModels:l,recentModels:u,hiddenModels:S,allowedProviderIds:f,allowedModelIdsByProvider:p,providerOrder:m,variantSelectionEnabled:C,isFavorite:g,onToggleFavorite:_,getMetadata:v}),t[23]=j,t[24]=p,t[25]=f,t[26]=te,t[27]=O,t[28]=l,t[29]=v,t[30]=S,t[31]=g,t[32]=s,t[33]=_,t[34]=m,t[35]=c,t[36]=T,t[37]=u,t[38]=o,t[39]=a,t[40]=i,t[41]=F,t[42]=C,t[43]=A,t[44]=U):U=t[44];let ue;return t[45]!==n||t[46]!==z||t[47]!==B||t[48]!==le||t[49]!==H||t[50]!==U||t[51]!==L||t[52]!==R?(ue=(0,Z.jsx)(_e,{id:L,open:n,onOpenChange:R,leading:z,ariaLabel:B,closeAriaLabel:le,resizeAriaLabel:H,bodyClassName:`px-2`,keyboardInset:!1,children:U}),t[45]=n,t[46]=z,t[47]=B,t[48]=le,t[49]=H,t[50]=U,t[51]=L,t[52]=R,t[53]=ue):ue=t[53],ue},Nn=e=>{let t=(0,W.c)(117),{query:n,onQueryChange:r,expandedProviders:i,onExpandedProvidersChange:a,expandedModelKey:o,onExpandedModelKeyChange:s,activeView:c,setView:l,variantTarget:u,onVariantTargetChange:d,selectedProviderID:f,selectedModelID:p,resolveSelectedVariant:m,onSelect:h,providers:g,favoriteModels:_,recentModels:v,hiddenModels:y,allowedProviderIds:b,allowedModelIdsByProvider:x,providerOrder:S,variantSelectionEnabled:C,isFavorite:w,onToggleFavorite:ee,getMetadata:T}=e,{t:E}=se(),D;t[0]===b?D=t[1]:(D=b&&b.length>0?new Set(b):null,t[0]=b,t[1]=D);let O=D,k;t[2]===x?k=t[3]:(k=x?new Map(Object.entries(x).map(Pn)):null,t[2]=x,t[3]=k);let te=k,ne;t[4]===y?ne=t[5]:(ne=new Set(y.map(Fn)),t[4]=y,t[5]=ne);let re=ne,ie;t[6]===g?ie=t[7]:(ie=new Map(g.map(In)),t[6]=g,t[7]=ie);let A=ie,ae;bb0:{if(!S?.length){ae=g;break bb0}let e;t[8]===S?e=t[9]:(e=new Map(S.map(Ln)),t[8]=S,t[9]=e);let n=e,r;if(t[10]!==g||t[11]!==n){let e;t[13]===n?e=t[14]:(e=(e,t)=>{let r=n.get(e.id),i=n.get(t.id);return r===void 0&&i===void 0?0:r===void 0?1:i===void 0?-1:r-i},t[13]=n,t[14]=e),r=[...g].sort(e),t[10]=g,t[11]=n,t[12]=r}else r=t[12];ae=r}let oe=ae,j;t[15]!==te||t[16]!==O||t[17]!==re?(j=(e,t)=>O&&!O.has(e)||te&&te.get(e)?.has(t)!==!0?!1:!re.has(`${e}:${t}`),t[15]=te,t[16]=O,t[17]=re,t[18]=j):j=t[18];let M=j,N;t[19]!==A||t[20]!==n?(N=e=>{let t=n.trim();if(!t)return!0;let r=A.get(e.providerID)?.name||e.providerID,i=le(e.model,e.modelID,{maxLength:40});return Te(`${r} ${i}`,t)||Te(`${e.providerID} ${e.modelID}`,t)},t[19]=A,t[20]=n,t[21]=N):N=t[21];let P=N,F;if(t[22]!==_||t[23]!==M||t[24]!==P){let e;t[26]!==M||t[27]!==P?(e=e=>M(e.providerID,e.modelID)&&P(e),t[26]=M,t[27]=P,t[28]=e):e=t[28],F=_.filter(e),t[22]=_,t[23]=M,t[24]=P,t[25]=F}else F=t[25];let I=F,ce;if(t[29]!==M||t[30]!==P||t[31]!==v){let e;t[33]!==M||t[34]!==P?(e=e=>M(e.providerID,e.modelID)&&P(e),t[33]=M,t[34]=P,t[35]=e):e=t[35],ce=v.filter(e),t[29]=M,t[30]=P,t[31]=v,t[32]=ce}else ce=t[32];let R=ce,z;if(t[36]!==O||t[37]!==M||t[38]!==oe||t[39]!==n){let e=n.trim(),r;t[41]===O?r=t[42]:(r=e=>!O||O.has(e.id),t[41]=O,t[42]=r),z=oe.filter(r).map(t=>{let n=e.length>0&&(Te(t.name||t.id,e)||Te(t.id,e));return{provider:t,models:(t.models??[]).filter(r=>{let i=typeof r.id==`string`?r.id:``;if(!i||!M(t.id,i))return!1;if(n||!e)return!0;let a=t.name||t.id;return Te(`${a} ${le(r,i,{maxLength:40})}`,e)||Te(`${t.id} ${i}`,e)})}}).filter(Rn),t[36]=O,t[37]=M,t[38]=oe,t[39]=n,t[40]=z}else z=t[40];let B=z,H;t[43]===E?H=t[44]:(H=e=>{if(!e?.trim())return E(`chat.modelControls.default`);let t=e.trim();return/^\d+(\.\d+)?$/.test(t)?t:t.charAt(0).toUpperCase()+t.slice(1)},t[43]=E,t[44]=H);let U=H,ue;t[45]===E?ue=t[46]:(ue=e=>{let t=[];e?.tool_call&&t.push({key:`tool_call`,icon:`tools`,label:E(`chat.modelControls.capability.toolCalling`)}),e?.reasoning&&t.push({key:`reasoning`,icon:`brain-ai-3`,label:E(`chat.modelControls.capability.reasoning`)});let n={text:{icon:`text`,label:E(`chat.modelControls.modality.text`)},image:{icon:`file-image`,label:E(`chat.modelControls.modality.image`)},video:{icon:`file-video`,label:E(`chat.modelControls.modality.video`)},audio:{icon:`file-music`,label:E(`chat.modelControls.modality.audio`)},pdf:{icon:`file-pdf`,label:E(`chat.modelControls.modality.pdf`)}};for(let r of[...e?.modalities?.input??[],...e?.modalities?.output??[]]){let e=r.trim().toLowerCase(),i=n[e];i&&!t.some(t=>t.key===e)&&t.push({key:e,...i})}return t},t[45]=E,t[46]=ue);let de=ue,pe;t[47]!==d||t[48]!==l?(pe=(e,t,n)=>{d(n===void 0?{providerID:e,modelID:t}:{providerID:e,modelID:t,variant:n}),l(`variant`)},t[47]=d,t[48]=l,t[49]=pe):pe=t[49];let me=pe,ge;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(ge={onPointerDown:he,onClickCapture:zn},t[50]=ge):ge=t[50];let _e=ge,xe;t[51]!==o||t[52]!==U||t[53]!==T||t[54]!==de||t[55]!==w||t[56]!==s||t[57]!==h||t[58]!==ee||t[59]!==me||t[60]!==A||t[61]!==g||t[62]!==m||t[63]!==p||t[64]!==f||t[65]!==E||t[66]!==C?(xe=(e,t)=>{let n=t===void 0?{}:t,{model:r,providerID:i,modelID:a}=e,c=`${i}:${a}`,l=i===f&&a===p,u=we(i,r,T?.(i,a)),d=C?jn(g,i,a):[],_=m(i,a),v=n.preferRememberedVariant&&e.variant!==void 0&&d.includes(e.variant)?e.variant:void 0,y=v===void 0?_:v,b=l||v===void 0?_:v,x=[void 0,...d].slice(0,kn),S=o===c,D=de(u),O=u?.limit?.context?`${An(u.limit.context)} ctx`:null;return(0,Z.jsxs)(`div`,{className:L(`border-b border-border/30 last:border-b-0`,l&&`bg-interactive-selection/15 text-interactive-selection-foreground`),children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 px-2 py-1.5`,children:[(0,Z.jsx)(`button`,{type:`button`,..._e,onClick:()=>h(i,a,y),className:`flex min-w-0 flex-1 items-start gap-2 rounded-lg text-left focus:outline-none focus-visible:ring-1 focus-visible:ring-primary`,children:(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[n.showProvider?(0,Z.jsx)(`span`,{className:`truncate text-[10px] leading-none text-muted-foreground/60`,children:A.get(i)?.name||i}):null,(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,Z.jsx)(ve,{modelId:a,providerId:i,className:`size-3.5 flex-shrink-0`}),(0,Z.jsx)(`span`,{className:`truncate typography-meta font-medium text-foreground`,children:le(r,a,{maxLength:40})}),l?(0,Z.jsx)(V,{name:`check`,className:`size-4 flex-shrink-0 text-primary`}):null]}),O||D.length>0?(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 overflow-hidden typography-micro text-muted-foreground`,children:[O?(0,Z.jsx)(`span`,{className:`flex-shrink-0 whitespace-nowrap`,children:O}):null,O&&D.length>0?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`h-3 w-px flex-shrink-0 bg-border/50`}):null,(0,Z.jsx)(`div`,{className:`flex min-w-0 items-center gap-1 overflow-hidden whitespace-nowrap pl-0.5`,children:D.map(e=>{let{key:t,icon:n,label:r}=e;return(0,Z.jsx)(`span`,{className:`flex size-4 flex-shrink-0 items-center justify-center text-muted-foreground`,title:r,"aria-label":r,children:(0,Z.jsx)(V,{name:n,className:`size-3`})},`${c}-${t}`)})})]}):null]})}),d.length>0?(0,Z.jsxs)(`button`,{type:`button`,..._e,onClick:()=>s(e=>e===c?null:c),className:`flex flex-shrink-0 items-center gap-0.5 typography-micro font-medium text-muted-foreground hover:text-foreground`,"aria-expanded":S,"aria-label":E(S?`chat.modelControls.hideThinkingModes`:`chat.modelControls.showThinkingModes`),children:[(0,Z.jsx)(`span`,{className:`whitespace-nowrap`,children:U(b)}),(0,Z.jsx)(V,{name:S?`arrow-down-s`:`arrow-right-s`,className:`size-3.5`})]}):null,(0,Z.jsx)(`button`,{type:`button`,..._e,onClick:e=>{e.preventDefault(),e.stopPropagation(),ee(i,a)},className:L(`model-favorite-button flex size-5 flex-shrink-0 items-center justify-center hover:text-primary/80`,w(i,a)?`text-primary`:`text-muted-foreground`),"aria-label":w(i,a)?E(`chat.modelControls.unfavoriteAria`):E(`chat.modelControls.favoriteAria`),title:w(i,a)?E(`chat.modelControls.removeFromFavorites`):E(`chat.modelControls.addToFavorites`),children:(0,Z.jsx)(V,{name:w(i,a)?`star-fill`:`star`,className:`size-4`})})]}),S&&d.length>0?(0,Z.jsx)(`div`,{className:`border-t border-border/30 p-2`,children:(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[x.map(e=>{let t=e===b||!e&&!b;return(0,Z.jsx)(`button`,{type:`button`,..._e,onClick:()=>h(i,a,e),className:L(`inline-flex items-center rounded-full border px-2.5 py-1 typography-meta font-medium`,t?`border-primary/30 bg-primary/10 text-foreground`:`border-border/40 text-muted-foreground hover:bg-interactive-hover/50`),"aria-pressed":t,children:U(e)},`${c}-${e??`default`}`)}),x.length<d.length+1?(0,Z.jsx)(`button`,{type:`button`,..._e,onClick:()=>me(i,a,b),className:`inline-flex items-center rounded-full border border-border/40 px-2.5 py-1 typography-meta font-medium text-muted-foreground hover:bg-interactive-hover/50`,"aria-label":E(`chat.modelControls.moreThinkingModes`),children:E(`inlineComment.actions.showMore`)}):null]})}):null]},`mobile-model-${c}`)},t[51]=o,t[52]=U,t[53]=T,t[54]=de,t[55]=w,t[56]=s,t[57]=h,t[58]=ee,t[59]=me,t[60]=A,t[61]=g,t[62]=m,t[63]=p,t[64]=f,t[65]=E,t[66]=C,t[67]=xe):xe=t[67];let Se=xe,Ce,Ee,De,Oe,G,ke,Ae,je,Me,Ne;if(t[68]!==c||t[69]!==i||t[70]!==I||t[71]!==B||t[72]!==R||t[73]!==U||t[74]!==s||t[75]!==a||t[76]!==r||t[77]!==h||t[78]!==g||t[79]!==n||t[80]!==Se||t[81]!==m||t[82]!==p||t[83]!==f||t[84]!==E||t[85]!==u){let e=u??(c===`variant`&&f&&p?{providerID:f,modelID:p}:null),o=e?jn(g,e.providerID,e.modelID):[],l;bb1:{if(!e){l=void 0;break bb1}if(e.providerID===f&&e.modelID===p){l=m(e.providerID,e.modelID);break bb1}l=(e.variant!==void 0&&o.includes(e.variant)?e.variant:void 0)??m(e.providerID,e.modelID)}let d=l,_=I.length>0||R.length>0||B.length>0,v=c===`variant`&&!!e;Me=`flex min-h-0 flex-1 flex-col gap-2`,t[96]!==v||t[97]!==s||t[98]!==r||t[99]!==n||t[100]!==E?(Ne=v?null:(0,Z.jsxs)(`div`,{className:`relative z-10 shrink-0`,"data-mobile-sheet-no-dismiss":``,"data-mobile-sheet-search":``,children:[(0,Z.jsx)(V,{name:`search`,className:`pointer-events-none absolute left-2 top-1/2 size-3.5 -translate-y-1/2 text-muted-foreground`}),(0,Z.jsx)(fe,{type:`text`,value:n,onChange:e=>{r(e.target.value),s(null)},placeholder:E(`chat.modelControls.searchProvidersOrModels`),className:`h-9 rounded-xl border-border/40 bg-[var(--surface-elevated)] pl-7 typography-meta`,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,enterKeyHint:`search`,inputMode:`search`}),n?(0,Z.jsx)(`button`,{type:`button`,onClick:()=>{r(``),s(null)},className:`absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground`,"aria-label":E(`chat.modelControls.clearSearch`),children:(0,Z.jsx)(V,{name:`close-circle`,className:`size-4`})}):null]}),t[96]=v,t[97]=s,t[98]=r,t[99]=n,t[100]=E,t[101]=Ne):Ne=t[101],Ce=be,Oe=!0,G=!0,ke=!0,Ae=`min-h-0 flex-1`,je=`overscroll-contain`,Ee=`flex flex-col gap-2`,De=v&&e?(0,Z.jsx)(`div`,{className:`flex flex-col gap-1.5`,children:[void 0,...o].map(t=>{let n=t===d||!t&&!d;return(0,Z.jsxs)(`button`,{type:`button`,className:L(`flex w-full items-center justify-between gap-2 rounded-xl border px-2 py-1.5 text-left focus:outline-none focus-visible:ring-1 focus-visible:ring-primary`,n?`border-primary/30 bg-primary/10`:`border-border/40`),..._e,onClick:()=>h(e.providerID,e.modelID,t),children:[(0,Z.jsx)(`span`,{className:`typography-meta font-medium text-foreground`,children:U(t)}),n?(0,Z.jsx)(V,{name:`check`,className:`size-4 flex-shrink-0 text-primary`}):null]},t??`default`)})}):(0,Z.jsxs)(Z.Fragment,{children:[_?null:(0,Z.jsx)(`div`,{className:`px-3 py-8 text-center typography-meta text-muted-foreground`,children:E(`chat.modelControls.noProvidersOrModelsFound`)}),I.length>0?(0,Z.jsxs)(`div`,{className:`overflow-hidden rounded-xl border border-border/40 bg-[var(--surface-elevated)]`,children:[(0,Z.jsxs)(`div`,{className:`px-2 py-1.5 text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:[(0,Z.jsx)(V,{name:`star-fill`,className:`mr-1.5 inline-block size-3 text-primary`}),E(`chat.modelControls.favorites`)]}),(0,Z.jsx)(`div`,{className:`flex flex-col border-t border-border/30`,children:I.map(e=>Se(e,{showProvider:!0,preferRememberedVariant:!0}))})]}):null,R.length>0?(0,Z.jsxs)(`div`,{className:`overflow-hidden rounded-xl border border-border/40 bg-[var(--surface-elevated)]`,children:[(0,Z.jsxs)(`div`,{className:`px-2 py-1.5 text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:[(0,Z.jsx)(V,{name:`time`,className:`mr-1.5 inline-block size-3`}),E(`chat.modelControls.recent`)]}),(0,Z.jsx)(`div`,{className:`flex flex-col border-t border-border/30`,children:R.map(e=>Se(e,{showProvider:!0,preferRememberedVariant:!0}))})]}):null,B.map(e=>{let{provider:t,models:r}=e,o=i.has(t.id)||n.trim().length>0;return(0,Z.jsxs)(`div`,{className:`overflow-hidden rounded-xl border border-border/40 bg-[var(--surface-elevated)]`,children:[(0,Z.jsxs)(`button`,{type:`button`,..._e,onClick:()=>{n.trim()||a(e=>{let n=new Set(e);return n.has(t.id)?n.delete(t.id):n.add(t.id),n})},className:`flex w-full items-center justify-between gap-1.5 px-2 py-1.5 text-left`,"aria-expanded":o,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(ye,{providerId:t.id,className:`size-3.5`}),(0,Z.jsx)(`span`,{className:`typography-meta font-medium text-foreground`,children:t.name||t.id}),t.id===f?(0,Z.jsx)(`span`,{className:`typography-micro text-primary/80`,children:E(`chat.modelControls.current`)}):null]}),(0,Z.jsx)(V,{name:o?`arrow-down-s`:`arrow-right-s`,className:`size-3 text-muted-foreground`})]}),o?(0,Z.jsx)(`div`,{className:`flex flex-col border-t border-border/30`,children:r.map(e=>Se({model:e,providerID:t.id,modelID:e.id}))}):null]},t.id)})]}),t[68]=c,t[69]=i,t[70]=I,t[71]=B,t[72]=R,t[73]=U,t[74]=s,t[75]=a,t[76]=r,t[77]=h,t[78]=g,t[79]=n,t[80]=Se,t[81]=m,t[82]=p,t[83]=f,t[84]=E,t[85]=u,t[86]=Ce,t[87]=Ee,t[88]=De,t[89]=Oe,t[90]=G,t[91]=ke,t[92]=Ae,t[93]=je,t[94]=Me,t[95]=Ne}else Ce=t[86],Ee=t[87],De=t[88],Oe=t[89],G=t[90],ke=t[91],Ae=t[92],je=t[93],Me=t[94],Ne=t[95];let Pe;t[102]!==Ee||t[103]!==De?(Pe=(0,Z.jsx)(`div`,{className:Ee,children:De}),t[102]=Ee,t[103]=De,t[104]=Pe):Pe=t[104];let Fe;t[105]!==Ce||t[106]!==Oe||t[107]!==G||t[108]!==ke||t[109]!==Ae||t[110]!==je||t[111]!==Pe?(Fe=(0,Z.jsx)(Ce,{useScrollShadow:Oe,disableHorizontal:G,preventOverscroll:ke,outerClassName:Ae,className:je,children:Pe}),t[105]=Ce,t[106]=Oe,t[107]=G,t[108]=ke,t[109]=Ae,t[110]=je,t[111]=Pe,t[112]=Fe):Fe=t[112];let K;return t[113]!==Me||t[114]!==Ne||t[115]!==Fe?(K=(0,Z.jsxs)(`div`,{className:Me,children:[Ne,Fe]}),t[113]=Me,t[114]=Ne,t[115]=Fe,t[116]=K):K=t[116],K};function Pn(e){let[t,n]=e;return[t,new Set(n)]}function Fn(e){return`${e.providerID}:${e.modelID}`}function In(e){return[e.id,e]}function Ln(e,t){return[e,t]}function Rn(e){return e.models.length>0}function zn(e){ge(e)||(e.preventDefault(),e.stopPropagation())}function Bn(){let e=(0,W.c)(5),t=B(Wn),n=B(Un),r=B(Hn),i=B(Vn),a=t||i,o=!a&&r===`init_error`,s=!a&&!o,c;return e[0]!==n||e[1]!==a||e[2]!==o||e[3]!==s?(c={isReady:a,isLoading:s,isUnavailable:o,connectionPhase:n},e[0]=n,e[1]=a,e[2]=o,e[3]=s,e[4]=c):c=e[4],c}function Vn(e){return e.providers.length>0}function Hn(e){return e.lastDisconnectReason}function Un(e){return e.connectionPhase}function Wn(e){return e.isInitialized}var Gn=e=>e??u()?.github,Kn=(e=t())=>oe.github.auth(e),qn=async(e,t)=>{if(e)return e.authStatus();let n=await r(`/api/github/auth/status`,{method:`GET`,headers:{Accept:`application/json`},signal:t}),i=await n.json().catch(()=>null);if(!n.ok||!i)throw Error(i?.error||n.statusText||`Failed to load GitHub status`);return i},Jn=(e,n=t())=>{let r=Gn(e);return{queryKey:Kn(n),queryFn:async({signal:e})=>qn(r,e),retry:2}},Yn=e=>!!e&&typeof e==`object`&&`authStatus`in e,Xn=e=>{let t=(0,W.c)(5),n=Yn(e)?e:void 0,r=Yn(e)?void 0:e?.enabled,i;t[0]===n?i=t[1]:(i=Jn(n),t[0]=n,t[1]=i);let a;return t[2]!==r||t[3]!==i?(a={...i,enabled:r},t[2]=r,t[3]=i,t[4]=a):a=t[4],A(a)},Zn=(e=j,n=t())=>e.getQueryData(Kn(n))??null,Qn=async(e,n,r)=>t()===r?e.fetchQuery({...Jn(n,r),staleTime:0}):e.getQueryData(Kn(r))??null,$n=(e=j,n,r=t())=>{e.setQueryData(Kn(r),n)},er=e=>{if(e===`12h`)return!0;if(e===`24h`)return!1},tr=(e,t,n={})=>{let r=e instanceof Date?e:new Date(e);return Number.isFinite(r.getTime())?r.toLocaleTimeString(N(),{hour:n.hour??`numeric`,minute:`2-digit`,second:n.precision===`second`?`2-digit`:void 0,hour12:er(t)}):n.fallback??``},nr=(e,t,n)=>{let r=e instanceof Date?e:new Date(e);return Number.isFinite(r.getTime())?r.toLocaleString(N(),{...n,hour12:n.hour?er(t):n.hour12}):``},rr=e=>e===`allow`||e===`deny`||e===`ask`;function ir(e){return!!e&&typeof e==`object`&&!Array.isArray(e)}function ar(e){return ir(e)?typeof e.action==`string`&&typeof e.resource==`string`&&rr(e.effect)?{action:e.action,resource:e.resource,effect:e.effect}:typeof e.permission==`string`&&typeof e.pattern==`string`&&rr(e.action)?{action:e.permission,resource:e.pattern,effect:e.action}:null:null}function or(e){if(Array.isArray(e))return e.flatMap(e=>{let t=ar(e);return t?[t]:[]});if(rr(e))return[{action:`*`,resource:`*`,effect:e}];if(!ir(e))return[];let t=[];for(let[n,r]of Object.entries(e))if(n!==`__originalKeys`){if(rr(r)){t.push({action:n,resource:`*`,effect:r});continue}if(ir(r))for(let[e,i]of Object.entries(r))rr(i)&&t.push({action:n,resource:e,effect:i})}return t}function sr(e){return or(e)}var $=e=>F(P.getState().dictionary,e),cr=e=>typeof e!=`number`||!Number.isFinite(e)?null:Math.max(0,Math.min(100,Math.round(e))),lr=e=>typeof e!=`number`||!Number.isFinite(e)?`-`:`${Math.round(e)}%`,ur=(e,t)=>e??lr(t),dr=(e,t,n=`auto`)=>{if(!e)return t??``;try{let r=new Date(e);if(!Number.isFinite(r.getTime()))return t??``;let i=new Date;return r.toDateString()===i.toDateString()?tr(r,n,{fallback:t??``}):nr(r,n,{month:`short`,day:`numeric`,weekday:`short`,hour:`numeric`,minute:`2-digit`})}catch{return t??``}},fr=e=>e===null?`safe`:e>=80?`critical`:e>=50?`warn`:`safe`,pr=e=>e===`5h`?$(`quota.window.5h`):e===`7d`?$(`quota.window.7d`):e===`7d-sonnet`?$(`quota.window.7dSonnet`):e===`7d-opus`?$(`quota.window.7dOpus`):e===`weekly`?$(`quota.window.weekly`):e===`daily`?$(`quota.window.daily`):e===`monthly`?$(`quota.window.monthly`):e===`credits`?$(`quota.window.credits`):e===`credits_balance`?$(`quota.window.creditsBalance`):e===`billing_cycle`?$(`quota.window.billingCycle`):e===`auto`?$(`quota.window.auto`):e===`api`?$(`quota.window.api`):e===`plan_limit`?$(`quota.window.planLimit`):e===`on_demand`?$(`quota.window.onDemand`):e===`session`?$(`quota.window.session`):e===`premium`?$(`quota.window.premium`):e===`chat`?$(`quota.window.chat`):e===`completions`?$(`quota.window.completions`):e===`premium_interactions`?$(`quota.window.premiumInteractions`):e,mr=e=>{let t=e.toLowerCase().trim();if(t===`5h`)return 18e3;if(t===`7d`||t===`weekly`||t===`7d-sonnet`||t===`7d-opus`)return 604800;if(t===`monthly`)return 2592e3;if(t===`24h`||t===`daily`)return 86400;if(t===`1h`)return 3600;let n=t.match(/^(\d+)h$/);if(n)return parseInt(n[1],10)*3600;let r=t.match(/^(\d+)d$/);return r?parseInt(r[1],10)*86400:null},hr=(e,t,n,r)=>{let i=n;if(i===null&&r&&(i=mr(r)),e===null||t===null||i===null||i<=0)return null;let a=Math.max(0,(t-Date.now())/1e3),o=Math.max(0,Math.min(i,i-a)),s=Math.max(0,Math.min(1,o/i)),c=e/100,l=e>=100&&a>0,u;u=s>.01?Math.min(999,c/s*100):e;let d;d=l?`exhausted`:c<=s?`on-track`:u<=130?`slightly-fast`:`too-fast`;let f=i>=432e3,p=f?86400:3600,m=f?`d`:`h`,h=i/p,g=e/Math.max(o/p,h*.01),_=Number.isFinite(g)?`${Math.min(999.9,Math.max(0,g)).toFixed(1)}%/${m}`:`-`,v=u>100?`+${Math.round(u)}%`:`${Math.round(u)}%`,y=null,b=i/86400;return b>=7&&(y=100/b),{elapsedRatio:s,usageRatio:c,predictedFinalPercent:u,remainingSeconds:a,isExhausted:l,elapsedSeconds:o,totalSeconds:i,status:d,paceRateText:_,predictText:v,dailyAllocationPercent:y}},gr=e=>{switch(e){case`exhausted`:case`too-fast`:return`var(--status-error)`;case`slightly-fast`:return`var(--status-warning)`;case`on-track`:return`var(--status-success)`}},_r=e=>{let t=Math.floor(Math.max(0,Math.floor(e))/60),n=Math.floor(t/60),r=Math.floor(n/24),i=n%24,a=t%60;return r>0?`${r}d ${i}h`:n>0?`${n}h`:t===0?`<1m`:`${a}m`},vr=e=>Math.min(100,Math.max(0,e*100)),yr=(e,t)=>F(P.getState().dictionary,e,t),br=e=>{let t=new Date(e),n=new Date,r=(e,t)=>e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate(),i=new Date(n);return i.setDate(n.getDate()-1),r(t,n)?yr(`common.date.today`):r(t,i)?yr(`common.date.yesterday`):t.toLocaleDateString(N(),{month:`short`,day:`numeric`,year:`numeric`}).replace(`,`,``)},xr=e=>{let t=new Date;if(((e,t)=>e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate())(new Date(e),t)){let t=Date.now()-e;return t<6e4?yr(`common.relative.justNow`):t<36e5?yr(`common.relative.minutesAgoShort`,{count:Math.floor(t/6e4)}):yr(`common.relative.hoursAgoShort`,{count:Math.floor(t/36e5)})}return br(e)},Sr=e=>{let t=Math.max(0,Date.now()-e),n=6e4,r=60*n,i=24*r,a=7*i,o=365*i;return t<r?yr(`common.relative.minutesAgoCompact`,{count:Math.max(1,Math.floor(t/n))}):t<i?yr(`common.relative.hoursAgoCompact`,{count:Math.floor(t/r)}):t<a?yr(`common.relative.daysAgoCompact`,{count:Math.floor(t/i)}):t<5*a?yr(`common.relative.weeksAgoCompact`,{count:Math.floor(t/a)}):t<o?yr(`common.relative.monthsAgoCompact`,{count:Math.floor(t/2592e6)}):yr(`common.relative.yearsAgoCompact`,{count:Math.floor(t/o)})},Cr=(e,t)=>wr(s(e),s(t)),wr=(e,t)=>!e||!t?!1:e===t?!0:t===`/`?e.startsWith(`/`):e.startsWith(`${t}/`),Tr=e=>e.toLowerCase().replace(/^opencode[/-]?/i,``).replace(/[-_]/g,``).trim(),Er=(e,t)=>e?Tr(e)!==Tr(t):!1,Dr=e=>{if(typeof e==`number`&&Number.isFinite(e))return e;if(typeof e==`string`&&e.trim().length>0){let t=Number(e);if(Number.isFinite(t))return t}},Or=e=>Dr(e.time?.created)??0,kr=(e,t,n)=>{let r=n.has(e.id),i=n.has(t.id);return r===i?r&&i?Or(t)-Or(e):z(t)-z(e):r?-1:1},Ar=e=>{let t=new Map;return e.forEach(e=>{t.set(e.id,e)}),Array.from(t.values())},jr=e=>`__archived__:${e}`,Mr=(e,t)=>{let n=s(e.directory??null),r=s(e.project?.worktree??null),i=n??r;if(!i)return`unassigned`;if(t&&i===t)return`project root`;let a=(t&&i.startsWith(`${t}/`)?i.slice(t.length+1):i).split(`/`).filter(Boolean);return a[a.length-1]??`unassigned`},Nr=`box-border w-full px-2 py-1.5 text-left typography-micro text-muted-foreground/70 select-none`,Pr=`bg-[color-mix(in_srgb,var(--surface-foreground)_6%,transparent)] dark:bg-[color-mix(in_srgb,var(--surface-foreground)_11%,transparent)]`,Fr=`hover:bg-[color-mix(in_srgb,var(--surface-foreground)_3.5%,transparent)] dark:hover:bg-[color-mix(in_srgb,var(--surface-foreground)_8%,transparent)]`,Ir=e=>{let t=Math.max(0,e);return t===0?8:30+(t-1)*14},Lr=(e,t)=>{if(!t)return e;let n=e.toLowerCase(),r=t.toLowerCase(),i=r.length;if(i===0)return e;let a=[],o=0,s=n.indexOf(r,o);for(;s!==-1;){s>o&&a.push(e.slice(o,s));let t=e.slice(s,s+i);a.push((0,Z.jsx)(`mark`,{className:`bg-transparent font-[inherit] text-[var(--primary-base)]`,children:t},`${s}-${t}`)),o=s+i,s=n.indexOf(r,o)}return o<e.length&&a.push(e.slice(o)),a.length>0?a:e},Rr=`/api/browser-providers`,zr=`/api/browser-providers/selection`,Br=/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/,Vr=200,Hr=e=>`/api/browser-providers/${encodeURIComponent(e)}/surface/ws`,Ur=e=>!!e&&typeof e==`object`&&!Array.isArray(e),Wr=e=>typeof e==`string`&&Br.test(e)?e:null,Gr=e=>{if(!Ur(e))return null;let t=Wr(e.id),n=typeof e.name==`string`?e.name.trim():``;return!t||!n||n.length>Vr?null:{id:t,name:n,surface:e.surface===!0}},Kr=e=>{if(!Ur(e)||!Array.isArray(e.providers))return null;let t=[],n=new Set;for(let r of e.providers){let e=Gr(r);!e||n.has(e.id)||(n.add(e.id),t.push(e))}let r=Wr(e.selectedId);return{providers:t,selectedId:r&&n.has(r)?r:null}},qr=e=>{if(!Ur(e))return null;let t=Wr(e.selectedId);return t?{selectedId:t}:null},Jr=e=>e?.selectedId?e.providers.find(t=>t.id===e.selectedId)??null:null,Yr=e=>!!(e&&e.providers.length>0),Xr=e=>Jr(e)!==null,Zr=e=>typeof e==`number`&&Number.isFinite(e),Qr=e=>{if(!Ur(e)||typeof e.type!=`string`)return null;if(e.type===`hello`&&typeof e.viewerId==`string`&&e.viewerId.length>0)return{type:`hello`,viewerId:e.viewerId};if(e.type===`frame`){let t=e.mime===`image/jpeg`||e.mime===`image/png`?e.mime:null;if(!t||!Zr(e.seq)||!Zr(e.width)||!Zr(e.height)||!Zr(e.bytes)||e.bytes<1||typeof e.agentActive!=`boolean`)return null;let n=typeof e.title==`string`?e.title:void 0;return{type:`frame`,seq:e.seq,width:e.width,height:e.height,mime:t,bytes:e.bytes,title:n,agentActive:e.agentActive}}if(e.type===`control`){let t=e.controller===`none`||e.controller===`agent`||e.controller===`user`?e.controller:null;return!t||typeof e.mine!=`boolean`?null:{type:`control`,controller:t,mine:e.mine}}return e.type===`resized`&&Zr(e.width)&&Zr(e.height)?{type:`resized`,width:e.width,height:e.height}:e.type===`error`&&typeof e.code==`string`&&typeof e.message==`string`?{type:`error`,code:e.code,message:e.message}:e.type===`ended`&&(e.reason===`service-stopped`||e.reason===`extension-unavailable`||e.reason===`host-shutdown`)?{type:`ended`,reason:e.reason}:null},$r=class extends Error{status;constructor(e){super(`browser_provider_request_failed:${e}`),this.name=`BrowserProviderRequestError`,this.status=e}},ei=(e=t())=>oe.browserProviders.catalog(e),ti=async e=>{let t=await e.text();if(!t)return null;try{return JSON.parse(t)}catch{return null}},ni=async e=>{let t=await r(Rr,{method:`GET`,headers:{Accept:`application/json`},signal:e}),n=await ti(t);if(!t.ok)throw new $r(t.status);let i=Kr(n);if(!i)throw new $r(t.status||502);return i},ri=(e=t())=>({queryKey:ei(e),queryFn:({signal:e})=>ni(e),staleTime:5e3,refetchOnWindowFocus:!0,refetchInterval:e=>{let t=e.state.error;return t instanceof $r&&(t.status===404||t.status===501)?!1:15e3}}),ii=e=>{let t=(0,W.c)(3),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=ri(),t[0]=n):n=t[0];let r=e?.enabled??!0,i;return t[1]===r?i=t[2]:(i={...n,enabled:r},t[1]=r,t[2]=i),A(i)},ai=(e=j,n=t())=>e.getQueryData(ei(n))??null,oi=(e,t)=>e?.providers.some(e=>e.id===t)?{providers:e.providers,selectedId:t}:null,si=async(e,n=j,i)=>{let a=t(),o=await r(zr,{method:`PUT`,headers:{Accept:`application/json`,"Content-Type":`application/json`},body:JSON.stringify({id:e}),signal:i}),s=await ti(o);if(!o.ok)throw new $r(o.status);let c=qr(s);if(!c||c.selectedId!==e||t()!==a)throw new $r(o.status||502);let l=oi(n.getQueryData(ei(a)),c.selectedId);if(!l)throw new $r(409);return l},ci=()=>{let e=(0,W.c)(2),n=ae(),r;return e[0]===n?r=e[1]:(r={mutationFn:e=>si(e,n),onMutate:async e=>{let r=t(),i=ei(r);await n.cancelQueries({queryKey:i});let a=n.getQueryData(i),o=oi(a,e);return o&&n.setQueryData(i,o),{previous:a,key:i,transport:r}},onError:(e,r,i)=>{!i||t()!==i.transport||n.setQueryData(i.key,i.previous)},onSuccess:(e,r,i)=>{!i||t()!==i.transport||n.setQueryData(i.key,e)}},e[0]=n,e[1]=r),re(r)},li=[`standalone`,`minimal-ui`,`fullscreen`,`window-controls-overlay`],ui=`yuri.pwaRecentSessions`,di=e=>typeof window>`u`||typeof window.matchMedia!=`function`?!1:window.matchMedia(`(display-mode: ${e})`).matches,fi=()=>typeof window>`u`?`browser`:typeof document<`u`&&document.referrer.startsWith(`android-app://`)?`twa`:window.navigator.standalone?`standalone`:li.find(e=>di(e))??`browser`;export{Bt as $,pr as A,qe as At,$n as B,Me as Bt,Mr as C,ht as Ct,dr as D,We as Dt,cr as E,$e as Et,nr as F,Xe as Ft,dn as G,Bn as H,Pe as Ht,tr as I,ut as It,_n as J,pn as K,Jn as L,ct as Lt,fr as M,Ke as Mt,sr as N,Ze as Nt,ur as O,Je as Ot,or as P,Qe as Pt,fn as Q,Zn as R,lt as Rt,Lr as S,yt as St,hr as T,gt as Tt,Mn as U,Xn as V,Ne as Vt,On as W,gn as X,hn as Y,vn as Z,jr as _,jt as _t,ci as a,nn as at,Cr as b,Rt as bt,Xr as c,rn as ct,Pr as d,Ft as dt,an as et,Fr as f,Mt as ft,xr as g,Nt as gt,Sr as h,Lt as ht,ii as i,tn as it,gr as j,Ge as jt,_r as k,Ye as kt,Yr as l,qt as lt,Ar as m,It as mt,fi as n,Qt as nt,Hr as o,on as ot,kr as p,Ot as pt,mn as q,ai as r,en as rt,Qr as s,$t as st,ui as t,sn as tt,Nr as u,Yt as ut,Ir as v,Pt as vt,vr as w,_t as wt,Tr as x,bt as xt,Er as y,zt as yt,Qn as z,dt as zt};
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/gitApi-i_uT8MNk.js","assets/rolldown-runtime-hePW80VL.js","assets/runtime-switch-DEPKHgdL.js","assets/runtime-auth-DA-qfGHk.js","assets/runtime-fetch-V-iMWR8t.js","assets/reasoning-projection-client-BEhVknv9.js","assets/runtimeAPIRegistry-C2VogTny.js","assets/gitApiHttp-BgUDBfaJ.js","assets/platform-CiUKDeXd.js","assets/vendor-pathe-vBmvQE8f.js","assets/vendor-zustand-CNn3HHhT.js","assets/vendor-base-ui-fom6orB6.js","assets/brand-storage-bootstrap-D4BW3w-M.js","assets/brand-storage-migration-Bhz6UOBJ.js","assets/safeStorage-DTOhKN0V.js","assets/client-CzjApAA4.js","assets/vendor-opencode-client-BM2r1f0o.js","assets/vendor-effect-X1Hqc7ba.js","assets/prompt-attachment-upload-Bem87nmm.js","assets/runtime-file-resource-CKQQEwNv.js","assets/vendor-react-D5BntRmA.js","assets/vendor-tanstack-query-core-BSjXNgF_.js","assets/vendor-tanstack-react-query-ChSd65dm.js","assets/path-utils-jGozTg9d.js","assets/vendor-reactuses-core-B8s-Rcd-.js","assets/vendor-lodash-es-BS45jPoZ.js","assets/vendor-js-cookie-hSOiFTtX.js","assets/vendor-aparajita-capacitor-secure-storage-xol_6BsB.js","assets/runtime-file-store-BVRgEtI-.js","assets/useUIStore-DjizmHAt.js","assets/useMobileHtmlPreviewStore-DzzgY1eS.js","assets/uuid-D-SDZijH.js","assets/useMobileNavigationStore-oveTY29a.js","assets/vendor-sonner-Y-KPX915.js","assets/i18n-BvjeIWrT.js","assets/runtime-ead7P81A.js","assets/bootstrap-eLlfzqAI.js","assets/store-Dj5cSf8B.js","assets/tour-CMXP3Kif.js","assets/useAssistantUIStore-CI42fWZh.js","assets/input-store-wWToFdzi.js","assets/remoteProjectQueries-yX3kOkR6.js","assets/vendor-zod-DZzbCm1s.js","assets/vendor-opencode-schema-DWT45VBX.js","assets/vendor-class-variance-authority-BLUaYARZ.js","assets/vendor-tailwind-merge-BicNWLTg.js","assets/toolHelpers-iEHVHQ9p.js"])))=>i.map(i=>d[i]);
2
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{I as t,j as n,m as r}from"./platform-CiUKDeXd.js";import{n as i}from"./runtimeAPIRegistry-C2VogTny.js";import{ot as a,st as o}from"./vendor-base-ui-fom6orB6.js";import{Mt as s,Pt as c,St as l}from"./gitApiHttp-BgUDBfaJ.js";import{n as u}from"./client-CzjApAA4.js";import{n as d,t as f}from"./vendor-react-D5BntRmA.js";import{s as p}from"./vendor-tanstack-react-query-ChSd65dm.js";import{V as m}from"./runtime-file-resource-CKQQEwNv.js";import{c as h,r as g}from"./vendor-reactuses-core-B8s-Rcd-.js";import{o as _}from"./vendor-aparajita-capacitor-secure-storage-xol_6BsB.js";import{r as v}from"./useUIStore-DjizmHAt.js";/* empty css */import{r as y}from"./vendor-sonner-Y-KPX915.js";import{r as b,t as x}from"./i18n-BvjeIWrT.js";import{n as S}from"./store-Dj5cSf8B.js";import{T as C,h as w,n as T,v as E}from"./MobileDetailNavigation-B7vAsqVU.js";import{A as D,Ha as O,In as k,Rn as A,Zi as j,lt as M,p as N,ra as P,tt as ee,x as te,yt as ne}from"./useMobileNavigationStore-oveTY29a.js";import{a as re}from"./MobileShareBridge-Cb9GvxGv.js";import{n as ie}from"./Icon-DebSeH2D.js";import{Bt as ae,C as oe,Gt as se,Ht as F,It as I,Kt as ce,Lt as L,Mt as le,Qt as ue,Rt as de,S as fe,Ut as pe,Vt as me,Wt as he,a as ge,pt as _e,t as ve,x as ye,zt as R}from"./useAppFontEffects-wm0ojvh7.js";import{r as be}from"./tooltip-DovnVenD.js";import{et as z,it as xe}from"./pwa-B2AKIaf6.js";import{o as Se}from"./react-DeCzn0Uc.js";import{o as Ce}from"./MarkdownRenderer-Bjl6sXps.js";import{_ as we,d as Te}from"./insertionBoundaries-BFmZupL3.js";import{c as Ee}from"./image-loading-Dlh4FIPJ.js";import{s as De}from"./projectMeta-Bh7dUtdB.js";import{i as Oe,n as B,r as ke,t as Ae}from"./useDesktopWindowControlsLayout-BBizNJUb.js";import{i as je,n as V,r as H,t as Me}from"./AssistantConversationSurface-B-iO-AUW.js";import{c as Ne}from"./AssistantSessionCard-DTPufGP2.js";var Pe=f(),U=d(),W=e(o(),1),G=a(),Fe=e=>{let t=(0,U.c)(3),{mode:n,children:r}=e,i;return t[0]!==r||t[1]!==n?(i=(0,G.jsx)(_e.Provider,{value:n,children:r}),t[0]=r,t[1]=n,t[2]=i):i=t[2],i},Ie=({children:e,actions:r,mainWindowTarget:i})=>{let{t:a}=x(),[o,s]=W.useState(!1),[c,l]=W.useState(!1),u=W.useRef(!1),d=W.useRef(!1),f=typeof window<`u`?window.__YURI_MACOS_MAJOR__??0:0,p=Number.isFinite(f)&&f>0,{usesFramelessChrome:m,side:h}=Ae(),_={WebkitAppRegion:`no-drag`};W.useEffect(()=>{if(!t())return;let e=!0;return n(`desktop_get_window_pinned`).then(t=>{e&&!d.current&&typeof t?.pinned==`boolean`&&s(t.pinned)}).catch(()=>{}),()=>{e=!1}},[]);let v=g(async()=>{if(!u.current){d.current=!0,u.current=!0,l(!0);try{let e=await n(`desktop_set_window_pinned`,{pinned:!o});if(!e)throw Error(`Window pin state is unavailable`);s(e.pinned)}catch{y.error(a(`miniChat.actions.failed`))}finally{u.current=!1,l(!1)}}}),b=g(async()=>{try{(await n(`desktop_focus_main_window`,i))?.focused&&await n(`desktop_close_current_window`)}catch{y.error(a(`miniChat.actions.failed`))}});return(0,G.jsxs)(`header`,{className:A(`flex shrink-0 items-center gap-3 bg-background pr-3`,p?`pl-[5.5rem]`:`pl-3`,m||f>=26?`h-12`:`min-h-14`),style:{WebkitAppRegion:`drag`},children:[m&&h===`left`?(0,G.jsx)(B,{visible:!0,position:`left`}):null,(0,G.jsx)(`div`,{className:`min-w-0 flex-1`,children:e}),r,(0,G.jsx)(k,{type:`button`,variant:`ghost`,size:`icon`,onClick:v,disabled:c,"aria-pressed":o,"aria-label":a(o?`miniChat.actions.unpinAria`:`miniChat.actions.pinAria`),title:a(o?`miniChat.actions.unpin`:`miniChat.actions.pin`),style:_,children:(0,G.jsx)(ie,{name:o?`pushpin-2-fill`:`pushpin-2`,className:`size-4`})}),(0,G.jsx)(k,{type:`button`,variant:`ghost`,size:`icon`,onClick:b,"aria-label":a(`miniChat.actions.openMainAria`),title:a(`miniChat.actions.openMain`),style:_,children:(0,G.jsx)(ie,{name:`external-link`,className:`size-4`})}),(0,G.jsx)(B,{visible:m&&h===`right`,position:`right`})]})},Le=e=>{let t=typeof e==`string`?e.trim():``;if(!t)return``;let n=typeof window<`u`?window.__YURI_HOME__:``;if(n&&t===n)return`~`;if(n&&t.startsWith(`${n}/`))return`~/${t.slice(n.length+1)}`;let r=t.split(`/`).filter(Boolean);return r.length<=3?t:`.../${r.slice(-3).join(`/`)}`},K=e=>{let t=typeof e==`string`?e.trim():``;if(!t)return``;let n=t.replace(/\\/g,`/`);return n===`/`?`/`:n.replace(/\/+$/,``)},Re=e=>{let t=(0,U.c)(78),{mode:n}=e,{t:r}=x(),i=N(Be),a=N(Ve),o=N(He),s=l(Ue),c=O(We),u=O(Ge),d=j(Ke),f=j(qe),p=ne(),h=M(i??``),g=m(),_=we(Je),v;t[0]===i?v=t[1]:(v=e=>i?e.worktreeMetadata.get(i)?.path??``:``,t[0]=i,t[1]=v);let y=N(v),b;t[2]===i?b=t[3]:(b=e=>i?e.worktreeMetadata.get(i)?.branch?.trim()??null:null,t[2]=i,t[3]=b);let S=N(b),C;t[4]===i?C=t[5]:(C=e=>i?e.getAttachment(i):void 0,t[4]=i,t[5]=C);let w=te(C),T=N(Ye),E;t[6]!==i||t[7]!==p?(E=i?p.find(e=>e.id===i)??null:null,t[6]=i,t[7]=p,t[8]=E):E=t[8];let D=E,k=D?.worktreeMetadata??null,A;t[9]!==a||t[10]!==n||t[11]!==D?.title||t[12]!==r?(A=D?.title?.trim()||r(a||n===`draft`?`miniChat.header.newSession`:`miniChat.header.session`),t[9]=a,t[10]=n,t[11]=D?.title,t[12]=r,t[13]=A):A=t[13];let P=A,re=D?.directory??null,ae;t[14]===re?ae=t[15]:(ae=K(re),t[14]=re,t[15]=ae);let oe=ae,se=y||k?.path||w?.cwd||w?.worktreeRoot||``,F;t[16]===se?F=t[17]:(F=K(se),t[16]=se,t[17]=F);let I=F,ce;t[18]===s?ce=t[19]:(ce=K(s),t[18]=s,t[19]=ce);let L=I||oe||T||ce,le;t[20]===L?le=t[21]:(le=Le(L),t[20]=L,t[21]=le);let ue=le,de;t[22]!==oe||t[23]!==I?(de=e=>{let t=K(I||oe||``);if(!t)return null;for(let n of e.availableWorktreesByProject.values()){let e=n.find(e=>K(e.path)===t)?.branch?.trim();if(e)return e}return null},t[22]=oe,t[23]=I,t[24]=de):de=t[24];let fe=N(de),pe,me;t[25]!==_||t[26]!==L||t[27]!==g.git?(pe=()=>{L&&_(L,g.git).catch(Xe)},me=[_,L,g.git],t[25]=_,t[26]=L,t[27]=g.git,t[28]=pe,t[29]=me):(pe=t[28],me=t[29]),W.useEffect(pe,me),k?.projectDirectory,w?.worktreeRoot;let he;bb0:{let e=k?.projectDirectory??w?.worktreeRoot??null,n;t[30]===e?n=t[31]:(n=K(e),t[30]=e,t[31]=n);let r=n||L;if(!r){he=null;break bb0}let i;t[32]!==r||t[33]!==c?(i=c.map(Ze).filter(e=>e.normalizedPath&&(e.normalizedPath===r||r.startsWith(`${e.normalizedPath}/`))).sort(Qe)[0]??null,t[32]=r,t[33]=c,t[34]=i):i=t[34],he=i}let ge=he,_e;bb1:{let e=ge??u;if(!e){_e=ue||`Yuri`;break bb1}let n;t[35]===e.path?n=t[36]:(n=e.path.split(/[\\/]/).filter(Boolean).at(-1)??e.path,t[35]=e.path,t[36]=n),_e=n}let ve=_e,ye=Te(L||null),R;t[37]!==fe||t[38]!==ye||t[39]!==k?.branch||t[40]!==w?.branch||t[41]!==S?(R=ye||S||k?.branch?.trim()||w?.branch?.trim()||fe,t[37]=fe,t[38]=ye,t[39]=k?.branch,t[40]=w?.branch,t[41]=S,t[42]=R):R=t[42];let be=R,z=be&&be!==`HEAD`?be:null,xe;t[43]===d?xe=t[44]:(xe=d(),t[43]=d,t[44]=xe);let Se=xe,Ce;bb2:{for(let e=h.length-1;e>=0;--e){let t=h[e];if(t.role!==`assistant`||typeof t.providerID!=`string`||typeof t.modelID!=`string`)continue;let n=f.find(e=>e.id===t.providerID)?.models.find(e=>e.id===t.modelID);if(n){Ce=n;break bb2}}Ce=void 0}let Ee=Ce,De=Se?.limit?Se:Ee,B=De&&typeof De.limit==`object`&&De.limit!==null?De.limit:null,Ae=B&&typeof B.context==`number`?B.context:0,je=B&&typeof B.output==`number`?B.output:0,V=ee(i??``,Ae,je),[H,Me]=W.useState(null),Ne;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(Ne={WebkitAppRegion:`no-drag`},t[45]=Ne):Ne=t[45];let Pe=Ne,Fe,Re;t[46]!==V||t[47]!==i?(Fe=()=>{if(!i){Me($e);return}if(V){Me(e=>e&&e.pending===V.pending&&e.totalTokens===V.totalTokens&&e.percentage===V.percentage&&e.contextLimit===V.contextLimit&&(e.outputLimit??0)===(V.outputLimit??0)&&(e.normalizedOutput??0)===(V.normalizedOutput??0)&&e.thresholdLimit===V.thresholdLimit&&e.lastMessageId===V.lastMessageId?e:V);return}Me(et)},Re=[V,i],t[46]=V,t[47]=i,t[48]=Fe,t[49]=Re):(Fe=t[48],Re=t[49]),W.useEffect(Fe,Re);let ze=H&&H.contextLimit>0?Math.min(999,H.totalTokens/H.contextLimit*100):0,tt;t[50]!==s||t[51]!==i||t[52]!==o||t[53]!==L||t[54]!==D?(tt=i?{sessionId:i,directory:D?.directory??s??``}:{mode:`draft`,directory:L||s||``,projectId:o},t[50]=s,t[51]=i,t[52]=o,t[53]=L,t[54]=D,t[55]=tt):tt=t[55];let nt=tt,q;t[56]!==ze||t[57]!==H?(q=H?(0,G.jsx)(Oe,{pending:H.pending,totalTokens:H.totalTokens,percentage:ze,colorPercentage:H.percentage,contextLimit:H.contextLimit,outputLimit:H.outputLimit??0,className:`h-9 shrink-0 pl-1 pr-1 typography-ui-label`,valueClassName:`font-semibold leading-none`,hideIcon:!0,showPercentIcon:!0,percentIconClassName:`h-4.5 w-4.5`}):null,t[56]=ze,t[57]=H,t[58]=q):q=t[58];let J;t[59]===r?J=t[60]:(J=r(`sessions.switcher.openAria`),t[59]=r,t[60]=J);let Y;t[61]===P?Y=t[62]:(Y=(0,G.jsx)(`span`,{className:`truncate typography-ui-label text-[14px] font-normal leading-tight text-foreground max-w-full`,children:P}),t[61]=P,t[62]=Y);let X;t[63]===ve?X=t[64]:(X=(0,G.jsx)(`span`,{className:`truncate`,children:ve}),t[63]=ve,t[64]=X);let Z;t[65]===z?Z=t[66]:(Z=z?(0,G.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-0.5`,children:[(0,G.jsx)(ie,{name:`git-branch`,className:`h-3 w-3 flex-shrink-0 text-muted-foreground/70`}),(0,G.jsx)(`span`,{className:`truncate`,children:z})]}):null,t[65]=z,t[66]=Z);let Q;t[67]!==X||t[68]!==Z?(Q=(0,G.jsxs)(`span`,{className:`flex min-w-0 max-w-full items-center gap-1.5 truncate typography-micro text-[10.5px] font-normal leading-tight text-muted-foreground/75`,children:[X,Z]}),t[67]=X,t[68]=Z,t[69]=Q):Q=t[69];let $;t[70]!==J||t[71]!==Y||t[72]!==Q?($=(0,G.jsx)(ke,{children:(0,G.jsxs)(`button`,{type:`button`,"aria-label":J,style:Pe,className:`flex min-w-0 max-w-full flex-col items-start rounded-md px-1 py-0.5 text-left transition-colors hover:bg-interactive-hover/60 focus-visible:outline-none focus-visible:bg-interactive-hover/60`,children:[Y,Q]})}),t[70]=J,t[71]=Y,t[72]=Q,t[73]=$):$=t[73];let rt;return t[74]!==nt||t[75]!==q||t[76]!==$?(rt=(0,G.jsx)(Ie,{mainWindowTarget:nt,actions:q,children:$}),t[74]=nt,t[75]=q,t[76]=$,t[77]=rt):rt=t[77],rt},ze=e=>{let t=(0,U.c)(9),{mode:n,autoOpenDraft:r,unavailable:i}=e,a=r!==void 0&&r,o=i!==void 0&&i,{t:s}=x(),c;t[0]===n?c=t[1]:(c=(0,G.jsx)(Re,{mode:n}),t[0]=n,t[1]=c);let l;t[2]!==a||t[3]!==s||t[4]!==o?(l=(0,G.jsx)(`main`,{className:`min-h-0 flex-1`,children:o?(0,G.jsx)(`div`,{className:`flex h-full items-center justify-center px-6 text-center typography-ui-label text-muted-foreground`,children:(0,G.jsxs)(`div`,{className:`max-w-sm rounded-lg border border-[var(--interactive-border)] bg-[var(--surface-elevated)] px-4 py-3`,children:[(0,G.jsx)(`div`,{className:`font-medium text-foreground`,children:s(`miniChat.unavailable.title`)}),(0,G.jsx)(`div`,{className:`mt-1 typography-small text-muted-foreground`,children:s(`miniChat.unavailable.description`)})]})}):(0,G.jsx)(Fe,{mode:`mini-chat`,children:(0,G.jsx)(oe,{autoOpenDraft:a})})}),t[2]=a,t[3]=s,t[4]=o,t[5]=l):l=t[5];let u;return t[6]!==c||t[7]!==l?(u=(0,G.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col bg-background text-foreground`,children:[c,l]}),t[6]=c,t[7]=l,t[8]=u):u=t[8],u};function Be(e){return e.currentSessionId}function Ve(e){return!!e.newSessionDraft?.open}function He(e){return e.newSessionDraft?.selectedProjectId??null}function Ue(e){return e.currentDirectory}function We(e){return e.projects}function Ge(e){return e.getActiveProject()}function Ke(e){return e.getCurrentModel}function qe(e){return e.providers}function Je(e){return e.ensureStatus}function Ye(e){return e.newSessionDraft?.open?K(e.newSessionDraft.bootstrapPendingDirectory??e.newSessionDraft.directoryOverride??``):``}function Xe(){}function Ze(e){return{...e,normalizedPath:K(e.path)}}function Qe(e,t){return t.path.length-e.path.length}function $e(e){return e===null?e:null}function et(e){return e===null?e:null}var tt=e=>{for(let t=e.messages.length-1;t>=0;t--){let n=e.messages[t];if(n.parts.some(C)&&Number.isFinite(new Date(n.createdAt).getTime()))return{timestamp:n.createdAt,empty:!1}}return{timestamp:void 0,empty:e.generation>=0&&e.olderComplete&&!e.hasMessageGap}},nt=(e,t)=>{let n=(0,U.c)(5),r;n[0]!==e||n[1]!==t?(r=T(e,t),n[0]=e,n[1]=t,n[2]=r):r=n[2];let i;return n[3]===r?i=n[4]:(i={...r,enabled:!1,select:tt},n[3]=r,n[4]=i),p(i)},q=W.memo(e=>{let t=(0,U.c)(17),{assistantID:n,serverWorking:r,lastContactAt:i}=e,{t:a,locale:o}=x(),s=je(n,r),c=nt(n,Ee()),l;t[0]!==c||t[1]!==i?(l=i!==void 0&&Number.isFinite(new Date(i).getTime())?i:c.data?.timestamp,t[0]=c,t[1]=i,t[2]=l):l=t[2];let u=l,d;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=new Date().toDateString(),t[3]=d):d=t[3];let f=d,p;t[4]===a?p=t[5]:(p=a(`common.date.today`),t[4]=a,t[5]=p);let m=p,h;bb0:{if(u===void 0){h=null;break bb0}let e;t[6]!==o||t[7]!==u||t[8]!==m?(e=V(o,m,new Date(f))(u),t[6]=o,t[7]=u,t[8]=m,t[9]=e):e=t[9],h=e}let g=h,_;t[10]!==c||t[11]!==g||t[12]!==a||t[13]!==s?(_=s?a(`assistants.conversation.typing`):g?a(`assistants.conversation.lastContact`,{time:g}):c.data?.empty?a(`assistants.conversation.neverContacted`):c.isError?a(`assistants.contact.loadFailed`):a(`common.loading`),t[10]=c,t[11]=g,t[12]=a,t[13]=s,t[14]=_):_=t[14];let v=_,y;return t[15]===v?y=t[16]:(y=(0,G.jsx)(`span`,{className:`mt-1 block truncate typography-micro font-normal leading-4 text-muted-foreground/70`,"aria-live":`polite`,title:v,children:v}),t[15]=v,t[16]=y),y}),J=e=>{let t=(0,U.c)(41),{assistantID:r}=e,{t:i}=x(),a=w(),o=E(),s=o.data?.assistants.find(e=>e.id===r),c=j(Y),l,u;t[0]===c?(l=t[1],u=t[2]):(l=()=>{c()},u=[c],t[0]=c,t[1]=l,t[2]=u),W.useEffect(l,u);let d=s?re(s.name).displayName||s.name:i(`assistants.title`),f,p;t[3]===d?(f=t[4],p=t[5]):(f=()=>{document.title=`${d} — Yuri`},p=[d],t[3]=d,t[4]=f,t[5]=p),W.useEffect(f,p);let m;t[6]===i?m=t[7]:(m=e=>{n(`desktop_focus_main_window`,e).catch(()=>y.error(i(`miniChat.actions.failed`)))},t[6]=i,t[7]=m);let h=g(m),_;t[8]!==a||t[9]!==o?(_=()=>{a.refetch(),o.refetch()},t[8]=a,t[9]=o,t[10]=_):_=t[10];let v=g(_),b=a.isPending||o.isPending,S=a.data?.supported&&a.data.enabled&&o.data?.enabled&&s,C;t[11]===r?C=t[12]:(C={assistantID:r},t[11]=r,t[12]=C);let T;t[13]!==s||t[14]!==d?(T=s?(0,G.jsx)(H,{name:s.id,avatarSeed:s.avatarSeed,size:32,label:d,working:!!(s.working||s.activeContactTurn),showWorkingDot:!1}):null,t[13]=s,t[14]=d,t[15]=T):T=t[15];let D;t[16]===d?D=t[17]:(D=(0,G.jsx)(`div`,{className:`truncate typography-ui-label text-[14px] leading-tight`,title:d,children:d}),t[16]=d,t[17]=D);let O;t[18]===s?O=t[19]:(O=s?(0,G.jsx)(q,{assistantID:s.id,serverWorking:!!(s.working||s.activeContactTurn),lastContactAt:s.latestMessagePreview?.createdAt}):null,t[18]=s,t[19]=O);let A;t[20]!==O||t[21]!==D?(A=(0,G.jsxs)(`div`,{className:`min-w-0`,children:[D,O]}),t[20]=O,t[21]=D,t[22]=A):A=t[22];let M;t[23]!==A||t[24]!==T?(M=(0,G.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[T,A]}),t[23]=A,t[24]=T,t[25]=M):M=t[25];let N;t[26]!==M||t[27]!==C?(N=(0,G.jsx)(Ie,{mainWindowTarget:C,children:M}),t[26]=M,t[27]=C,t[28]=N):N=t[28];let P;t[29]!==s||t[30]!==S||t[31]!==a.isError||t[32]!==b||t[33]!==h||t[34]!==v||t[35]!==o.isError||t[36]!==i?(P=b?(0,G.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center`,"aria-busy":`true`,"aria-label":i(`common.loading`),children:(0,G.jsx)(ie,{name:`loader-4`,className:`size-6 animate-spin text-muted-foreground`})}):S?(0,G.jsx)(Ne.Provider,{value:h,children:(0,G.jsx)(Me,{assistant:s,active:!0,warning:o.isError?i(`assistants.state.staleSnapshot`):null})}):(0,G.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col items-center justify-center gap-4 px-6 text-center text-muted-foreground`,children:[(0,G.jsx)(`p`,{children:i(`assistants.state.unavailable`)}),a.isError||o.isError?(0,G.jsx)(k,{onClick:v,children:i(`startup.initRecovery.retry`)}):null]}),t[29]=s,t[30]=S,t[31]=a.isError,t[32]=b,t[33]=h,t[34]=v,t[35]=o.isError,t[36]=i,t[37]=P):P=t[37];let ee;return t[38]!==N||t[39]!==P?(ee=(0,G.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col overflow-clip bg-background text-foreground`,children:[N,P]}),t[38]=N,t[39]=P,t[40]=ee):ee=t[40],ee};function Y(e){return e.initializeApp}var X=(e=!1)=>{document.querySelector(e?`textarea`:`textarea[data-chat-input="true"]`)?.focus()},Z=(e=!1)=>{let t=v(e=>e.shortcutOverrides),i=l(e=>e.currentDirectory),a=O(e=>e.getActiveProject()),o=N(e=>e.openNewSessionDraft);W.useEffect(()=>{let s=e=>xe(e,t),c=t=>{if(z(t,s(`focus_input`))){t.preventDefault(),X(e);return}if(r()&&z(t,s(`close_context_panel_tab`))){t.preventDefault(),n(`desktop_close_current_window`).catch(e=>{console.warn(`[mini-chat-shortcuts] failed to close current window`,e)});return}if(r()&&z(t,s(`new_mini_chat`))){t.preventDefault(),n(`desktop_open_draft_mini_chat_window`,{directory:i||a?.path||``,projectId:a?.id??null})?.catch(e=>{console.warn(`[mini-chat-shortcuts] failed to open draft mini chat window`,e)});return}if(e)return;if(z(t,s(`new_chat`))){t.preventDefault(),o({selectedProjectId:a?.id??null,directoryOverride:i||a?.path||null,preserveDirectoryOverride:!!(i||a?.path)}),X();return}if(z(t,s(`open_model_selector`))){t.preventDefault();let{isModelSelectorOpen:e,setModelSelectorOpen:n}=v.getState();n(!e,{instant:!0});return}if(z(t,s(`cycle_thinking_variant`))){let e=j.getState();if(e.getCurrentModelVariants().length===0)return;t.preventDefault(),e.cycleCurrentVariant();let n=j.getState().currentVariant,r=N.getState().currentSessionId,i=j.getState().currentAgentName,a=j.getState().currentProviderId,o=j.getState().currentModelId;r&&i&&a&&o&&P.getState().saveAgentModelVariantForSession(r,i,a,o,n),i&&a&&o&&j.getState().saveAgentModelSelection(i,a,o,n);return}let c=z(t,s(`cycle_favorite_model_forward`)),l=z(t,s(`cycle_favorite_model_backward`));if(c||l){let{favoriteModels:e,addRecentModel:n}=v.getState();if(e.length===0)return;t.preventDefault();let{currentProviderId:r,currentModelId:i,providers:a,setProvider:o,setModel:s,setCurrentVariant:l}=j.getState(),u=e[(e.findIndex(e=>e.providerID===r&&e.modelID===i)+(c?1:-1)+e.length)%e.length];o(u.providerID),s(u.modelID);let d=a.find(e=>e.id===u.providerID)?.models?.find(e=>e.id===u.modelID),f=d?.variants?Object.keys(d.variants):[],p=u.variant!==void 0&&f.includes(u.variant)?u.variant:void 0;l(p),n(u.providerID,u.modelID,p)}};return window.addEventListener(`keydown`,c),()=>window.removeEventListener(`keydown`,c)},[a?.id,a?.path,e,i,o,t])},Q=`yuri:mini-chat-presence`,$=()=>{let e=typeof window<`u`?new URLSearchParams(window.location.search):new URLSearchParams;return{mode:e.get(`mode`)===`assistant`?`assistant`:e.get(`mode`)===`session`?`session`:`draft`,assistantID:e.get(`assistantID`)?.trim()||``,sessionId:e.get(`sessionId`)?.trim()||null,directory:e.get(`directory`)?.trim()||null,projectId:e.get(`projectId`)?.trim()||null}},rt=({config:e})=>{let t=ne(),n=l(e=>e.currentDirectory),r=l(e=>e.setDirectory),i=O(e=>e.projects),a=N(e=>e.currentSessionId),o=N(e=>!!e.newSessionDraft?.open),s=N(e=>e.newSessionDraft?.open?e.newSessionDraft.bootstrapPendingDirectory??e.newSessionDraft.directoryOverride??``:``),c=N(e=>e.setCurrentSession),u=N(e=>e.openNewSessionDraft),d=j(e=>e.initializeApp),f=j(e=>e.isInitialized),p=le();W.useEffect(()=>{d()},[d]),W.useEffect(()=>{if(f)return;let e=!0,t=0,n=window.setInterval(()=>{if(e){if(t+=1,t>10){window.clearInterval(n);return}j.getState().isInitialized||j.getState().initializeApp()}},1e3);return()=>{e=!1,window.clearInterval(n)}},[f]);let m=W.useRef(!1);W.useEffect(()=>{if(!m.current&&e.mode===`session`&&e.directory){if(n===e.directory){m.current=!0;return}r(e.directory,{showOverlay:!1}),m.current=!0}},[e.directory,e.mode,n,r]),W.useEffect(()=>{e.mode!==`draft`||!o||a||!s||n===s||r(s,{showOverlay:!1})},[e.mode,n,a,s,o,r]),de({enabled:!0,source:`electronMiniChat:recovery`});let v=W.useRef(!1);W.useEffect(()=>{if(v.current||e.mode!==`session`||!e.sessionId)return;if(a===e.sessionId){v.current=!0;return}if(a){v.current=!0;return}let n=t.find(t=>t.id===e.sessionId);if(!n){p.ensureSessionRenderable(e.sessionId);return}let r=n.directory??e.directory;c(e.sessionId,r),v.current=!0},[e,a,t,c,p]);let y=h(t),b=g(e=>{let t=e.detail,n=typeof t?.sessionId==`string`?t.sessionId.trim():``;if(!n||N.getState().currentSessionId===n)return;let r=typeof t?.directory==`string`&&t.directory.trim().length>0?t.directory.trim():y.current.find(e=>e.id===n)?.directory??null;p.ensureSessionRenderable(n),c(n,r),v.current=!0});W.useEffect(()=>(window.addEventListener(`yuri:open-session`,b),()=>window.removeEventListener(`yuri:open-session`,b)),[b]),W.useEffect(()=>{e.mode!==`draft`||o||a||u({selectedProjectId:e.projectId,directoryOverride:e.directory,preserveDirectoryOverride:!!e.directory})},[e,a,o,u]),W.useEffect(()=>{if(i.length===0)return;let e=!1;return(async()=>{await Promise.all(i.map(async t=>{let n=t.path.replace(/\\/g,`/`).replace(/\/+$/,``);if(n)try{if(!(we.getState().directories.get(n)?.isGitRepo??await _(()=>import(`./gitApi-i_uT8MNk.js`).then(e=>e.f).then(e=>e.checkIsGitRepository(n)),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46])))||e)return;await De({id:t.id,path:n},{isCurrent:()=>!e})}catch{}}))})(),()=>{e=!0}},[i]);let x=W.useRef(!1);return W.useEffect(()=>{if(x.current||!f)return;let t=()=>{if(x.current)return;x.current=!0;let e=typeof document<`u`?document.getElementById(`initial-loading`):null;e&&(e.classList.add(`fade-out`),window.setTimeout(()=>e.remove(),300))},n=e.mode===`session`?a===e.sessionId:o,r=window.setTimeout(t,n?100:1500);return()=>window.clearTimeout(r)},[f,e.mode,e.sessionId,a,o]),null},it=()=>{let e=(0,U.c)(4),t=N(pt),n=l(mt),r,i;return e[0]!==n||e[1]!==t?(r=()=>{if(!t||!n||typeof BroadcastChannel>`u`)return;let e=new BroadcastChannel(Q),r=r=>{e.postMessage({type:`mini-chat-session-presence`,sessionId:t,directory:n,viewed:r})};r(!0);let i=window.setInterval(()=>r(!0),5e3),a=()=>r(!1);return window.addEventListener(`beforeunload`,a),()=>{window.clearInterval(i),window.removeEventListener(`beforeunload`,a),r(!1),e.close()}},i=[n,t],e[0]=n,e[1]=t,e[2]=r,e[3]=i):(r=e[2],i=e[3]),W.useEffect(r,i),null},at=e=>{let t=(0,U.c)(6),n=ne(),r=N(ht),[i,a]=W.useState(!1),o,s;return t[0]!==e.mode||t[1]!==e.sessionId||t[2]!==r||t[3]!==n?(o=()=>{if(e.mode!==`session`||!e.sessionId||r===e.sessionId){a(!1);return}if(n.some(t=>t.id===e.sessionId)){a(!1);return}let t=window.setTimeout(()=>a(!0),5e3);return()=>window.clearTimeout(t)},s=[e.mode,e.sessionId,r,n],t[0]=e.mode,t[1]=e.sessionId,t[2]=r,t[3]=n,t[4]=o,t[5]=s):(o=t[4],s=t[5]),W.useEffect(o,s),i};function ot(e){let t=(0,U.c)(16),{apis:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=$(),t[0]=r):r=t[0];let a=r,o=l(ut),s=N(lt),c=N(ct),d,f;t[1]===o?(d=t[2],f=t[3]):(d=()=>{u.setDirectory(o||a.directory||void 0)},f=[a.directory,o],t[1]=o,t[2]=d,t[3]=f),W.useEffect(d,f);let p,m;t[4]===n?(p=t[5],m=t[6]):(p=()=>(i(n),st),m=[n],t[4]=n,t[5]=p,t[6]=m),W.useEffect(p,m),ve(),Z(a.mode===`assistant`);let h;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(h={enabled:!0},t[7]=h):h=t[7],fe(h);let g;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(g=u.getSdkClient(),t[8]=g):g=t[8];let _=o||a.directory||``,v=a.mode!==`assistant`&&!(c&&s===null),y;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,G.jsx)(be,{delayDuration:300,skipDelayDuration:150,children:(0,G.jsxs)(`div`,{className:`h-full text-foreground bg-background`,children:[(0,G.jsx)(ft,{config:a}),(0,G.jsx)(I,{})]})}),t[9]=y):y=t[9];let b;t[10]===n?b=t[11]:(b=(0,G.jsx)(L,{apis:n,children:y}),t[10]=n,t[11]=b);let x;return t[12]!==b||t[13]!==_||t[14]!==v?(x=(0,G.jsx)(Se,{children:(0,G.jsx)(D,{sdk:g,directory:_,bootstrapDirectory:v,children:b})}),t[12]=b,t[13]=_,t[14]=v,t[15]=x):x=t[15],x}function st(){return i(null)}function ct(e){return!!e.newSessionDraft?.open}function lt(e){return e.currentSessionId}function ut(e){return e.currentDirectory}var dt=()=>(ye(),null),ft=e=>{let t=(0,U.c)(14),{config:n}=e,r=at(n);if(n.mode===`assistant`){let e;return t[0]===n.assistantID?e=t[1]:(e=(0,G.jsx)(J,{assistantID:n.assistantID}),t[0]=n.assistantID,t[1]=e),e}let i;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,G.jsx)(dt,{}),t[2]=i):i=t[2];let a;t[3]===n?a=t[4]:(a=(0,G.jsx)(rt,{config:n}),t[3]=n,t[4]=a);let o,s;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,G.jsx)(it,{}),s=(0,G.jsx)(ge,{embeddedBackgroundWorkEnabled:!0}),t[5]=o,t[6]=s):(o=t[5],s=t[6]);let c=n.mode===`draft`,l;t[7]!==n.mode||t[8]!==r||t[9]!==c?(l=(0,G.jsx)(ze,{mode:n.mode,autoOpenDraft:c,unavailable:r}),t[7]=n.mode,t[8]=r,t[9]=c,t[10]=l):l=t[10];let u;return t[11]!==a||t[12]!==l?(u=(0,G.jsxs)(G.Fragment,{children:[i,a,o,s,l]}),t[11]=a,t[12]=l,t[13]=u):u=t[13],u};function pt(e){return e.currentSessionId}function mt(e){return e.currentDirectory}function ht(e){return e.currentSessionId}var gt=()=>{S(),s().then(()=>{Promise.all([c(),ue()]).catch(e=>{console.error(`[mini-chat-main] settings init failed:`,e)}),F(),me(),ae()}).catch(e=>{console.error(`[mini-chat-main] appearance init failed:`,e)})};function _t(e){Ce(),gt();let t=document.getElementById(`root`);if(!t)throw Error(`Root element not found`);(0,Pe.createRoot)(t).render((0,G.jsx)(W.StrictMode,{children:(0,G.jsx)(R,{children:(0,G.jsx)(b,{children:(0,G.jsx)(pe,{children:(0,G.jsx)(he,{children:(0,G.jsx)(se,{children:(0,G.jsx)(ce,{children:(0,G.jsx)(ot,{apis:e})})})})})})})}))}export{_t as renderElectronMiniChatApp};