@yuriai/web 0.3.3 → 0.3.4

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 (93) hide show
  1. package/dist/assets/{AgentSelector-DpOQ7dyw.js → AgentSelector-uBoLtut8.js} +1 -1
  2. package/dist/assets/{ArchivedSessionsDialog-nqnWb-Vc.js → ArchivedSessionsDialog-DZcicxVO.js} +1 -1
  3. package/dist/assets/{AssistantConversationSurface-CKXgty02.js → AssistantConversationSurface-36aP0hRf.js} +3 -3
  4. package/dist/assets/{AssistantSessionCard-C2-2fJul.js → AssistantSessionCard-CZ-1oJiE.js} +2 -2
  5. package/dist/assets/{AssistantView-BR8hsjOv.js → AssistantView-8fyAae7J.js} +1 -1
  6. package/dist/assets/{AssistantsSettingsPage-Bwid1xE0.js → AssistantsSettingsPage-DD6spbXz.js} +1 -1
  7. package/dist/assets/{BinaryFileFallback-Cb3uP7y1.js → BinaryFileFallback-DgYaMG9f.js} +1 -1
  8. package/dist/assets/{BtwPanel-9VAdk_qa.js → BtwPanel-BkobGcf3.js} +1 -1
  9. package/dist/assets/{BusyDots-DeDkh4Ke.js → BusyDots-COTTwItx.js} +1 -1
  10. package/dist/assets/{ChatContainer-wP6o_O4K.js → ChatContainer-BfQ7RXwY.js} +8 -8
  11. package/dist/assets/{ChatView-DU_2-cfD.js → ChatView-ByMRjY1h.js} +1 -1
  12. package/dist/assets/{DiagramView-CaefmjA4.js → DiagramView-DGnmjS2b.js} +1 -1
  13. package/dist/assets/{DiffView-BaqthIvq.js → DiffView-Bbit6OZ8.js} +1 -1
  14. package/dist/assets/{ErrorBoundary-_5B1xjgZ.js → ErrorBoundary-D7QcwhmL.js} +1 -1
  15. package/dist/assets/{FadeInOnReveal-BYHr1gqj.js → FadeInOnReveal-B3uT04YJ.js} +1 -1
  16. package/dist/assets/{GuiPluginMount-Btp3mJT2.js → GuiPluginMount-TC5FELtQ.js} +1 -1
  17. package/dist/assets/{GuiPluginPage-DM_RLx6u.js → GuiPluginPage-BPjU8N49.js} +1 -1
  18. package/dist/assets/{GuiPluginSurface-KiyqqEKU.js → GuiPluginSurface-CYPH6XzX.js} +1 -1
  19. package/dist/assets/{MarkdownRenderer-D7p9Iflj.js → MarkdownRenderer-VvziwyJB.js} +2 -2
  20. package/dist/assets/{MarkdownRendererImpl-BZc_jUrV.js → MarkdownRendererImpl-D8q0FMnr.js} +1 -1
  21. package/dist/assets/{MarkstreamRendererImpl-BUk_c3g1.js → MarkstreamRendererImpl-U_m_ZKG7.js} +1 -1
  22. package/dist/assets/{MobileAssistantSettingsPage-BBIiFN2g.js → MobileAssistantSettingsPage-Dgq5FMho.js} +1 -1
  23. package/dist/assets/{MobileBtwPage-DVZm5hrZ.js → MobileBtwPage-DQUkSO6N.js} +1 -1
  24. package/dist/assets/{MobileChangesSurface-CiqsGZsg.js → MobileChangesSurface-DsYNmAuM.js} +1 -1
  25. package/dist/assets/{MobileChatScreen-DDenVTX8.js → MobileChatScreen-p356_BCN.js} +1 -1
  26. package/dist/assets/{MobileFilesSurface-DIVH9aPV.js → MobileFilesSurface-CF3EW_SK.js} +2 -2
  27. package/dist/assets/{MobileHtmlNetworkBoundary-TBxrF4jJ.js → MobileHtmlNetworkBoundary-DlPF4iPS.js} +2 -2
  28. package/dist/assets/{MobileSettingsTab-MmDnxG47.js → MobileSettingsTab-DaTtRHo1.js} +1 -1
  29. package/dist/assets/{MobileShareBridge-DAlGSXoj.js → MobileShareBridge-CZpFYmiy.js} +1 -1
  30. package/dist/assets/{ModelSelector-HJmXcB3j.js → ModelSelector-EmtltPnd.js} +1 -1
  31. package/dist/assets/{MultiRunWindow-BmxVnblA.js → MultiRunWindow-CeSxAB8w.js} +1 -1
  32. package/dist/assets/{OnboardingScreen-DnEtIaxG.js → OnboardingScreen-BubjTNcy.js} +1 -1
  33. package/dist/assets/{PierreDiffViewer-B1e1H6br.js → PierreDiffViewer-DVKsdwJR.js} +1 -1
  34. package/dist/assets/{RemoteAssistantSessionCard-BgL7oxAK.js → RemoteAssistantSessionCard-DAoFvZht.js} +1 -1
  35. package/dist/assets/{RemoteDesktopPanel-DBrEQwpr.js → RemoteDesktopPanel-f3vRj4ZP.js} +1 -1
  36. package/dist/assets/{ScheduledTasksDialog-BVh0yaZR.js → ScheduledTasksDialog-D_hBP47Y.js} +1 -1
  37. package/dist/assets/{SettingsView-CLE6ra3s.js → SettingsView-DEU94-h1.js} +1 -1
  38. package/dist/assets/{SettingsWindow-DpzeOekS.js → SettingsWindow-DMVAV_el.js} +1 -1
  39. package/dist/assets/{SetupTourDialog-CY_CU5qU.js → SetupTourDialog-BlR7FJvd.js} +1 -1
  40. package/dist/assets/{TerminalView-mO5f0Axl.js → TerminalView-Xcwp3SG1.js} +1 -1
  41. package/dist/assets/{TextSelectionMenu-VsKriqtT.js → TextSelectionMenu-h8iUeNzE.js} +1 -1
  42. package/dist/assets/{ToolOutputDialog-DqCCsC-N.js → ToolOutputDialog-DpaaQ1uZ.js} +1 -1
  43. package/dist/assets/{auto-read-context-DVGIDEr6.js → auto-read-context-ClBUErN2.js} +1 -1
  44. package/dist/assets/{capgoAdapter-94K243Zv.js → capgoAdapter-pfQJmvW2.js} +1 -1
  45. package/dist/assets/{chatUpwardIntent-tvLWGs9Q.js → chatUpwardIntent-B2NrGMm-.js} +1 -1
  46. package/dist/assets/{gitApi-BWsBS_2N.js → gitApi-CoVwjIDy.js} +1 -1
  47. package/dist/assets/{insertionBoundaries-BSDUOMHN.js → insertionBoundaries-Btqgsu1M.js} +1 -1
  48. package/dist/assets/{main-DAbyAg5_.js → main-CXH2hObl.js} +4 -4
  49. package/dist/assets/{main-CHO9s_kb.js → main-ClH7cLKr.js} +2 -2
  50. package/dist/assets/{mcpQueries-1WNtiFYh.js → mcpQueries-Rmp1BKeo.js} +1 -1
  51. package/dist/assets/{miniChat-BZMkNMht.js → miniChat-B_Bw6udu.js} +2 -2
  52. package/dist/assets/{mobile-C9XDDOHq.js → mobile-BR73yoNi.js} +2 -2
  53. package/dist/assets/{mobileBackNavigation-DF_uhF-i.js → mobileBackNavigation-C94n2eLT.js} +1 -1
  54. package/dist/assets/{mobileConnections-DjT1L-_m.js → mobileConnections-x07fHO_5.js} +2 -2
  55. package/dist/assets/{multirun-D34EMeEj.js → multirun-CKQymP08.js} +1 -1
  56. package/dist/assets/{native-config-DSpTDz3F.js → native-config-DVg8_Zx1.js} +1 -1
  57. package/dist/assets/{nativeComposerCover-DXFy97OQ.js → nativeComposerCover-Bhv1EKPT.js} +1 -1
  58. package/dist/assets/{navigation-jU0HUH9s.js → navigation-D1klsD7k.js} +1 -1
  59. package/dist/assets/{openRemoteProjectSession-Bm_nafYw.js → openRemoteProjectSession-DNr74gHD.js} +1 -1
  60. package/dist/assets/{pluginPresentation-DexqrdQ0.js → pluginPresentation-DtyC8NF2.js} +1 -1
  61. package/dist/assets/{pwa-BaWpUiOR.js → pwa-CtDladgB.js} +1 -1
  62. package/dist/assets/{queue-abort-optimistic-UwpgXn4g.js → queue-abort-optimistic-DFbWDRKT.js} +1 -1
  63. package/dist/assets/{reference-history-DBxnA_fF.js → reference-history-IEuzG8KC.js} +1 -1
  64. package/dist/assets/{remoteSessionReference-Cug8RfIG.js → remoteSessionReference-ex07CtrZ.js} +1 -1
  65. package/dist/assets/{renderElectronMiniChatApp-CqrlQAsJ.js → renderElectronMiniChatApp-DM9y9qXo.js} +2 -2
  66. package/dist/assets/{renderMobileApp-CwcwGOox.js → renderMobileApp-DqpPYtZI.js} +4 -4
  67. package/dist/assets/{runtimeConfig-zzeYHX6k.js → runtimeConfig-CyvlrO58.js} +1 -1
  68. package/dist/assets/{runtimeEndpointReset-DUD-TCLY.js → runtimeEndpointReset-C0zNrsI9.js} +3 -3
  69. package/dist/assets/{sessionLookup-4zOaVAuF.js → sessionLookup-DQOiycHr.js} +1 -1
  70. package/dist/assets/{sessionOwnership-CEkPFbS4.js → sessionOwnership-BjhXe6pi.js} +1 -1
  71. package/dist/assets/{speechSettingsQueries-DQnPLEf3.js → speechSettingsQueries-BmkXNn4w.js} +1 -1
  72. package/dist/assets/{types-s_oc_LRs.js → types-DpcA-uDW.js} +1 -1
  73. package/dist/assets/{ui-DrAJTWV6.js → ui-ee2iN869.js} +12 -12
  74. package/dist/assets/{useAppFontEffects-nvkTSYHB.js → useAppFontEffects-rbTKcF0f.js} +2 -2
  75. package/dist/assets/{useDesktopWindowControlsLayout-i6qqpMbd.js → useDesktopWindowControlsLayout-BOkRz-p9.js} +1 -1
  76. package/dist/assets/{useEffectiveDirectory-BxolHzt4.js → useEffectiveDirectory-DiJBIfai.js} +1 -1
  77. package/dist/assets/{useGitStore-B641o_o0.js → useGitStore-Bv8xmXDa.js} +1 -1
  78. package/dist/assets/{useMcpConfigStore-BUSvv0Bl.js → useMcpConfigStore-DKTl0PvE.js} +1 -1
  79. package/dist/assets/{useMobileTranscriptSyncHint-86i3xO8J.js → useMobileTranscriptSyncHint-DM8WG7kz.js} +1 -1
  80. package/dist/assets/{useModelLists-Ca085-di.js → useModelLists-Bf60FIJu.js} +1 -1
  81. package/dist/assets/{useOpenCodeReadiness-CsNcdsCJ.js → useOpenCodeReadiness-Dm6BjA1T.js} +1 -1
  82. package/dist/assets/{usePluginsStore-ZHQOW-R5.js → usePluginsStore-Du4WlceO.js} +1 -1
  83. package/dist/assets/{useProjectGitActions-1QRsD7Rb.js → useProjectGitActions-D3B9ma9z.js} +1 -1
  84. package/dist/assets/{useProjectGitStore-C1K6WpCe.js → useProjectGitStore-DzU2pvrH.js} +1 -1
  85. package/dist/assets/{useProjectRuntimeAPIs-BItoD9Bt.js → useProjectRuntimeAPIs-tjGuODhu.js} +1 -1
  86. package/dist/assets/{useSessionBtwStore-BCHq3UOB.js → useSessionBtwStore-CwvlMabN.js} +1 -1
  87. package/dist/assets/{useStreamingTextThrottle-DGAjmaMZ.js → useStreamingTextThrottle-C9SaKeil.js} +1 -1
  88. package/dist/assets/{worktreeManager-QmahFqHc.js → worktreeManager-DGu8M01Z.js} +1 -1
  89. package/dist/assets/{worktreeSourceBranchPreference-B5Fldnhm.js → worktreeSourceBranchPreference-CuLKwxkx.js} +1 -1
  90. package/dist/index.html +5 -5
  91. package/dist/mini-chat.html +5 -5
  92. package/dist/mobile.html +1 -1
  93. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{E as t}from"./runtime-auth-DA-qfGHk.js";import{c as n,i as r,l as i,n as a,r as o,t as s}from"./runtime-switch-DEPKHgdL.js";import{n as c}from"./runtime-fetch-V-iMWR8t.js";import{A as l,C as u,E as d,F as f,J as p,P as m,R as h,T as g,X as _,et as v,g as y,j as b,n as x,nt as S,ot as C,p as w,t as T,tt as E,w as D,z as O}from"./platform-CiUKDeXd.js";import{t as k}from"./runtimeAPIRegistry-C2VogTny.js";import{_ as A,a as j,d as M,g as N,i as P,n as F,p as I,r as L,s as R,t as z,v as B,y as V}from"./desktopHosts-BsTrBVja.js";import{n as H}from"./desktopRelayRestore-BxbRKak_.js";import{a as U,i as W,r as ee,t as te}from"./vendor-zustand-CTekDqaS.js";import{ot as ne,st as re}from"./vendor-base-ui-wXsskyKm.js";import{Ft as G,Ht as ie,Lt as ae,Rt as oe,St as se,an as ce,hn as le,in as ue}from"./gitApiHttp-Dd-FwgCq.js";import"./brand-storage-bootstrap-D4BW3w-M.js";import{t as de}from"./safeStorage-DTOhKN0V.js";import{n as fe,ut as pe}from"./client-B_907PBv.js";import{n as me}from"./vendor-react-BkccXcWz.js";import{i as he,n as ge,o as _e,s as ve,u as ye}from"./vendor-tanstack-react-query-DIb_ItL-.js";import{c as be}from"./yuriEvents-BFrD5fMU.js";import{E as xe,R as Se}from"./runtime-file-resource-Bc_ss-sW.js";import{i as Ce,o as we,r as Te}from"./vendor-reactuses-core-DjKFMfz7.js";import{c as Ee,d as De,h as Oe,r as K,u as ke}from"./useUIStore-C3ewjGgP.js";import{o as Ae}from"./useMobileHtmlPreviewStore-BYunNOBo.js";import{t as je}from"./uuid-D-SDZijH.js";import{Q as Me,S as Ne,U as Pe,lt as Fe}from"./vendor-codemirror-autocomplete-C0FrlFqZ.js";import{r as Ie}from"./vendor-sonner-DX3nfJx4.js";import{i as q,l as Le,o as J}from"./session-startup-barrier-DT-hIBRf.js";import{n as Y}from"./Icon-DmykXZL1.js";import{$n as Re,Aa as ze,At as Be,Ba as Ve,Ca as He,Gi as Ue,Hi as We,Ja as Ge,Ki as Ke,Ma as qe,Na as Je,Oa as Ye,Oi as Xe,Qn as Ze,Sa as Qe,Ti as $e,U as et,Ui as tt,Va as nt,_a as rt,_r as it,aa as at,ba as ot,ca as st,da as ct,er as lt,f as ut,fa as dt,ga as ft,ha as pt,ia as mt,ja as ht,ka as gt,la as _t,ma as vt,pa as yt,qi as bt,sa as xt,t as X,ur as St,va as Ct,vi as wt,wa as Tt,xa as Et,ya as Dt,za as Ot}from"./ui-DrAJTWV6.js";import{n as kt,t as At}from"./i18n-DXc6czdR.js";import{a as jt}from"./toolHelpers-iEHVHQ9p.js";import{i as Mt}from"./useAssistantUIStore-CpJZ4Rqs.js";import{t as Nt}from"./ScrollableOverlay-stxT7gLf.js";import{a as Pt,i as Ft,n as It,o as Lt,r as Rt,t as zt}from"./dialog-BeFBA6ja.js";import{i as Bt,n as Vt,t as Ht}from"./tooltip-CpTbxEOE.js";import{n as Ut}from"./useThemeSystem-BIXghnHj.js";import{a as Wt}from"./react-CPBNl-S9.js";import{n as Gt,r as Kt}from"./device-EIfSfSWk.js";import{a as Z,c as qt,n as Jt,o as Yt,r as Xt,t as Zt}from"./dropdown-menu-BblI9sN2.js";import{a as Qt,n as $t,r as en,t as tn}from"./context-menu-CKlB6wxo.js";import{n as nn,r as rn,t as an}from"./collapsible-Z0IjDAMO.js";import{t as on}from"./textarea-ZiXxEOHK.js";import{n as sn}from"./appThemeRegistry-BdjrGBQ4.js";import{C as cn,S as ln,_ as un,v as dn,x as fn,y as pn}from"./gitApi-BWsBS_2N.js";import{M as mn,k as hn,n as gn}from"./mobileBackNavigation-DF_uhF-i.js";import{r as _n,t as vn}from"./GuiPluginMount-Btp3mJT2.js";import{t as yn}from"./input-Cf16qJ6g.js";import{n as bn}from"./MarkdownRenderer-D7p9Iflj.js";import{a as xn}from"./markdownHeightCache-CHGGNhWI.js";import{a as Sn,d as Cn,f as wn,i as Tn,o as En,t as Dn,u as On}from"./shortcuts-WkN3Gh8v.js";import{u as kn}from"./assistantQueries-NdPqu6rx.js";import{t as An}from"./MobileDetailNavigation-ldTzGo19.js";import{$ as jn,A as Mn,B as Nn,D as Pn,E as Fn,F as In,I as Ln,K as Rn,L as zn,M as Bn,N as Vn,O as Hn,P as Un,T as Wn,X as Gn,Y as Kn,Z as qn,a as Jn,et as Yn,i as Xn,j as Zn,k as Qn,l as $n,q as er,r as tr,z as nr}from"./pwa-BaWpUiOR.js";import{t as rr}from"./ErrorBoundary-_5B1xjgZ.js";import{t as ir}from"./ProviderLogo-DA98yu7M.js";import{c as ar,i as or,n as sr,s as cr,t as lr}from"./select-vZCgcnYG.js";import{a as ur}from"./githubAuthQueries-DqregESf.js";import{a as dr,i as fr,n as pr}from"./projectMeta-vIaGFaQr.js";import{t as mr}from"./sortable-tabs-strip-DmtfYPz0.js";import{n as hr}from"./timeFormat-dCsf2MQv.js";import{n as gr,t as _r}from"./permission-rules-DoQUXKll.js";import{a as vr,c as yr,i as br,l as xr,n as Sr,r as Cr,s as wr,u as Tr}from"./useQuotaStore-CSn2pk3T.js";import{a as Er,i as Dr,l as Or,n as kr,s as Ar,t as jr}from"./quota-CqWNkFzw.js";import{a as Mr,c as Nr,o as Pr,s as Fr}from"./router-DXUi1sBd.js";import{a as Ir,c as Lr,i as Rr,l as zr,n as Br,o as Vr,r as Hr,s as Ur,u as Wr,v as Gr,y as Kr}from"./sessionOwnership-CEkPFbS4.js";import{t as qr}from"./switch-CNmsFYfY.js";import{a as Jr,c as Yr,d as Xr,l as Zr,o as Qr,u as $r}from"./mcpQueries-1WNtiFYh.js";import{a as ei,i as ti,n as ni,o as ri,r as ii,t as ai}from"./SettingsGroup-CvaPYznp.js";import{a as oi,i as si,n as ci,o as li,r as ui,t as di}from"./useMcpConfigStore-BUSvv0Bl.js";import{a as fi,c as pi,i as mi,l as hi,o as gi,r as _i,s as vi,t as yi,u as bi}from"./usePluginsStore-ZHQOW-R5.js";import{t as xi}from"./MobileTabPageHeader-D6P4K98S.js";import{n as Si}from"./MobileSurface-cmaGf3hZ.js";import{t as Ci}from"./GuiPluginWindow-BkAFJyFd.js";import{c as wi,i as Ti,l as Ei,n as Di,o as Oi,s as ki,t as Ai}from"./pluginPresentation-DexqrdQ0.js";import{t as ji}from"./ModelSelector-HJmXcB3j.js";import{t as Mi}from"./AgentSelector-DpOQ7dyw.js";import{i as Ni,n as Pi,r as Fi,t as Ii}from"./AssistantsSettingsPage-Bwid1xE0.js";import{t as Li}from"./vendor-qrcode-D7jBCyl-.js";import{a as Ri,c as zi,d as Bi,f as Vi,i as Hi,l as Ui,m as Wi,n as Gi,o as Ki,r as qi,s as Ji,u as Yi}from"./ArchivedSessionsDialog-nqnWb-Vc.js";import{n as Xi,t as Zi}from"./vendor-yaml-C9KlJAlj.js";var Q=e(re(),1),Qi=me(),$i=`useCommandsStore`,ea=new Set([`init`,`review`]),ta=e=>ea.has(e.name),na=async(e,t)=>{await ze(be,e,t),r()===t&&Ot(`commands`,{source:$i})},ra=U()(ee(W(e=>({selectedCommandName:null,commandDraft:null,setSelectedCommand:t=>e({selectedCommandName:t}),setCommandDraft:t=>e({commandDraft:t}),loadCommands:async()=>{let e=ht(),t=r();try{return await ze(be,e,t),!0}catch{return!1}},createCommand:async t=>ia(`POST`,t.name,t,e),updateCommand:async(t,n)=>ia(`PATCH`,t,n,e),deleteCommand:async t=>ia(`DELETE`,t,void 0,e),getCommandByName:e=>gt().find(t=>t.name===e)}),{name:`commands-store`,storage:de(),partialize:e=>({selectedCommandName:e.selectedCommandName})}),{name:`commands-store`}));async function ia(e,t,n,i){let a=ht(),o=r();try{let s={};if(e===`POST`&&(s.template=n?.template||``,n?.description&&(s.description=n.description),n?.agent&&(s.agent=n.agent),n?.model&&(s.model=n.model),n?.scope&&(s.scope=n.scope)),e===`PATCH`)for(let e of[`description`,`agent`,`model`,`template`])n?.[e]!==void 0&&(s[e]=n[e]);let l=a?`?directory=${encodeURIComponent(a)}`:``,u=await c(`/api/config/commands/${encodeURIComponent(t)}${l}`,{method:e,headers:e===`DELETE`?a?{"x-opencode-directory":a}:void 0:{"Content-Type":`application/json`,...a?{"x-opencode-directory":a}:{}},...e===`DELETE`?{}:{body:JSON.stringify(s)}}),d=await u.json().catch(()=>null);if(!u.ok)throw Error(d?.error||`Failed to ${e.toLowerCase()} command`);return r()!==o||(await na(a,o),r()!==o)||e===`DELETE`&&i({selectedCommandName:null}),!0}catch(e){return console.error(`[CommandsStore] Command mutation failed:`,e),!1}}typeof window<`u`&&(window.__zustand_commands_store__=ra),nt(e=>{e.source!==$i&&Ve(e,`commands`)&&ra.getState().loadCommands()});var aa=()=>{let e=fe.getDirectory();if(typeof e==`string`&&e.trim().length>0)return e;try{let e=window.__zustand_directory_store__;if(e)return e.getState().currentDirectory}catch{}return null},oa=`useSkillsStore`,sa=e=>{if(e&&Object.prototype.hasOwnProperty.call(e,`directory`))return typeof e.directory==`string`&&e.directory.trim()||null;let t=aa();return typeof t==`string`&&t.trim()||null},ca=U()(ee(W((e,t)=>({selectedSkillName:null,skillDraft:null,setSelectedSkill:t=>{e({selectedSkillName:t})},setSkillDraft:t=>{e({skillDraft:t})},loadSkills:async()=>{try{return await dt(be,aa(),r()),!0}catch{return!1}},getSkillDetail:async e=>{try{let t=aa(),n=t?`?directory=${encodeURIComponent(t)}`:``,r=await c(`/api/config/skills/${encodeURIComponent(e)}${n}`);return r.ok?await r.json():null}catch{return null}},createSkill:async(e,t)=>{try{let n={name:e.name,description:e.description};e.instructions&&(n.instructions=e.instructions),e.scope&&(n.scope=e.scope),e.source&&(n.source=e.source),e.supportingFiles&&(n.supportingFiles=e.supportingFiles);let i=sa(t),a=r(),o=i?`?directory=${encodeURIComponent(i)}`:``,s=await c(`/api/config/skills/${encodeURIComponent(e.name)}${o}`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(n)}),l=await s.json().catch(()=>null);if(!s.ok){let e=l?.error||`Failed to create skill`;throw Error(e)}return await la({directory:i,transportIdentity:a}),!0}catch{return!1}},updateSkill:async(e,t,n)=>{try{let i={};t.description!==void 0&&(i.description=t.description),t.instructions!==void 0&&(i.instructions=t.instructions),t.supportingFiles!==void 0&&(i.supportingFiles=t.supportingFiles),t.targetPath!==void 0&&(i.targetPath=t.targetPath);let a=sa(n),o=r(),s=a?`?directory=${encodeURIComponent(a)}`:``,l=await c(`/api/config/skills/${encodeURIComponent(e)}${s}`,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify(i)}),u=await l.json().catch(()=>null);if(!l.ok){let e=u?.error||`Failed to update skill`;throw Error(e)}return await la({directory:a,transportIdentity:o}),!0}catch{return!1}},deleteSkill:async(n,i)=>{try{let a=sa(i),o=r(),s=a?`?directory=${encodeURIComponent(a)}`:``,l=await c(`/api/config/skills/${encodeURIComponent(n)}${s}`,{method:`DELETE`}),u=await l.json().catch(()=>null);if(!l.ok){let e=u?.error||`Failed to delete skill`;throw Error(e)}return await la({directory:a,transportIdentity:o}),r()===o&&t().selectedSkillName===n&&e({selectedSkillName:null}),!0}catch{return!1}},getSkillByName:e=>ct(be,aa()).find(t=>t.name===e),readSupportingFile:async(e,t)=>{try{let n=aa(),r=n?`&directory=${encodeURIComponent(n)}`:``,i=await c(`/api/config/skills/${encodeURIComponent(e)}/files/${encodeURIComponent(t)}?${r.slice(1)}`);return i.ok?(await i.json()).content??null:null}catch{return null}},writeSupportingFile:async(e,t,n)=>{try{let r=aa(),i=r?`?directory=${encodeURIComponent(r)}`:``;return(await c(`/api/config/skills/${encodeURIComponent(e)}/files/${encodeURIComponent(t)}${i}`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({content:n})})).ok}catch{return!1}},deleteSupportingFile:async(e,t)=>{try{let n=aa(),r=n?`?directory=${encodeURIComponent(n)}`:``;return(await c(`/api/config/skills/${encodeURIComponent(e)}/files/${encodeURIComponent(t)}${r}`,{method:`DELETE`})).ok}catch{return!1}}}),{name:`skills-store`,storage:de(),partialize:e=>({selectedSkillName:e.selectedSkillName})}),{name:`skills-store`}));typeof window<`u`&&(window.__zustand_skills_store__=ca);async function la(e){let t=e&&`directory`in e?e.directory?.trim()||null:aa(),n=e?.transportIdentity??r();r()===n&&(await dt(be,t,n),r()===n&&(await rt(be,t,n),r()===n&&Ot(`skills`,{source:oa})))}var ua=null;ua||=nt(e=>{if(e.source!==oa&&Ve(e,`skills`)){let e=aa(),t=r();dt(be,e,t).then(()=>rt(be,e,t)).catch(()=>void 0)}});var da=/^#[0-9a-fA-F]{6}$/,fa=/^\{file:.+\}$/i,pa=e=>[...e].sort((e,t)=>{let n=e.permission.localeCompare(t.permission);return n===0?e.pattern.localeCompare(t.pattern):n}),ma=(e,t)=>{let n=pa(e),r=pa(t);return n.length===r.length&&n.every((e,t)=>{let n=r[t];return e.permission===n.permission&&e.pattern===n.pattern&&e.action===n.action})},ha=(e,t)=>t?e.globalPermission!==t.globalPermission||!ma(e.permissionRules,t.permissionRules):!1,ga=e=>e===`bash`?`shell`:e===`task`?`subagent`:e===`write`||e===`patch`?`edit`:e,_a=(e,t)=>{let n=[{action:`*`,resource:`*`,effect:e}];for(let e of t)!e.permission||!e.pattern||(e.permission!==`*`||e.pattern!==`*`)&&n.push({action:ga(e.permission),resource:e.pattern,effect:e.action});return n},va=e=>{let t=e.trim();return t===``?null:t},ya=({isNewAgent:e,agentName:t,draftScope:n,initialScope:r,draftHasExplicitPermission:i,current:a,initial:o,confirmDrop:s})=>{let c=_a(a.globalPermission,a.permissionRules);if(e){let e=a.description.trim(),r=va(a.model),l=a.system.trim(),u=ha(a,o)||i;return{name:t,mode:a.mode,...e?{description:e}:{},...r?{model:r}:{},...l?{system:l}:{},...u?{permissions:c}:{},...n?{scope:n}:{},...s?{confirmDrop:!0}:{}}}let l={name:t,...s?{confirmDrop:!0}:{}};return o?(a.description!==o.description&&(l.description=a.description.trim()||null),a.mode!==o.mode&&(l.mode=a.mode),a.model!==o.model&&(l.model=va(a.model)),a.system!==o.system&&(l.system=a.system.trim()||null),ha(a,o)&&(l.permissions=c),n&&r&&n!==r&&(l.scope=n),l):l},ba=e=>{if(e){if(typeof e.prompt==`string`)return fa.test(e.prompt.trim())?void 0:e.prompt;if(typeof e.system==`string`)return e.system}},xa=e=>{let t=e?.model?.providerID,n=e?.model?.modelID||e?.model?.id;if(!t||!n)return``;let r=e?.model?.variant||e?.variant;return r?`${t}/${n}#${r}`:`${t}/${n}`},Sa=e=>{let t=e.trim(),n=t.indexOf(`/`);if(n<=0||n>=t.length-1)return null;let r=t.slice(0,n),i=t.slice(n+1),a=i.indexOf(`#`);return a===-1?{providerId:r,modelId:i,variant:``}:{providerId:r,modelId:i.slice(0,a),variant:i.slice(a+1)}},Ca=e=>da.test(e.trim()),wa=e=>{let t=e.trim();return t&&t.charAt(0).toUpperCase()+t.slice(1)},$=ne(),Ta=e=>{let t=(0,Qi.c)(37),{className:n}=e,{t:r}=At(),i=Je(Ea),a=Je(Da),o=Je(Oa),s=h(),c;t[0]===i?c=t[1]:(c=[...i].sort(ka),t[0]=i,t[1]=c);let l=c,u;bb0:{if(l.length===0){u=null;break bb0}let e;t[2]!==a||t[3]!==l?(e=l.find(e=>e.id===a)??l[0],t[2]=a,t[3]=l,t[4]=e):e=t[4],u=e}let d=u;if(s||l.length===0)return null;let f;t[5]!==d?.path||t[6]!==r?(f=d?.path.split(`/`).filter(Boolean).pop()||d?.path||r(`settings.shared.projectSelector.fallbackProject`),t[5]=d?.path,t[6]=r,t[7]=f):f=t[7];let p=f,m;t[8]===n?m=t[9]:(m=J(n),t[8]=n,t[9]=m);let g;t[10]===r?g=t[11]:(g=r(`settings.shared.projectSelector.switchProjectAria`),t[10]=r,t[11]=g);let _;t[12]===r?_=t[13]:(_=r(`settings.shared.projectSelector.switchProjectTitle`),t[12]=r,t[13]=_);let v,y;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(v=J(`yuri-settings-sidebar-picker text-foreground appearance-none flex h-8 w-full min-w-0 rounded-lg px-3 py-1`,`flex items-center gap-1.5 text-left`),y=(0,$.jsx)(Y,{name:`folder`,className:`h-4 w-4 text-muted-foreground`}),t[14]=v,t[15]=y):(v=t[14],y=t[15]);let b;t[16]===p?b=t[17]:(b=(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate typography-ui-label font-medium`,children:p}),t[16]=p,t[17]=b);let x;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,$.jsx)(Y,{name:`arrow-down-s`,className:`size-4 opacity-50`}),t[18]=x):x=t[18];let S;t[19]!==g||t[20]!==_||t[21]!==b?(S=(0,$.jsx)(qt,{asChild:!0,children:(0,$.jsxs)(`button`,{type:`button`,"aria-label":g,title:_,className:v,children:[y,b,x]})}),t[19]=g,t[20]=_,t[21]=b,t[22]=S):S=t[22];let C=d?.id??``,w;t[23]===o?w=t[24]:(w=e=>{e&&o(e)},t[23]=o,t[24]=w);let T;t[25]===l?T=t[26]:(T=l.map(Aa),t[25]=l,t[26]=T);let E;t[27]!==C||t[28]!==w||t[29]!==T?(E=(0,$.jsx)(Jt,{align:`start`,className:`w-auto`,children:(0,$.jsx)(Z,{value:C,onValueChange:w,children:T})}),t[27]=C,t[28]=w,t[29]=T,t[30]=E):E=t[30];let D;t[31]!==S||t[32]!==E?(D=(0,$.jsxs)(Zt,{children:[S,E]}),t[31]=S,t[32]=E,t[33]=D):D=t[33];let O;return t[34]!==D||t[35]!==m?(O=(0,$.jsx)(`div`,{className:m,children:D}),t[34]=D,t[35]=m,t[36]=O):O=t[36],O};function Ea(e){return e.projects}function Da(e){return e.activeProjectId}function Oa(e){return e.setActiveProject}function ka(e,t){return(e.label||e.path).localeCompare(t.label||t.path)}function Aa(e){let t=e.path.split(`/`).filter(Boolean).pop()||e.path;return(0,$.jsx)(Yt,{value:e.id,children:(0,$.jsx)(`span`,{className:`min-w-0 truncate typography-ui`,children:t})},e.id)}function ja(e,t){return`opencode:sidebar-group:${e}:${t}`}var Ma=e=>{let t=(0,Qi.c)(57),{label:n,count:r,storageKey:i,defaultExpanded:a,variant:o,labelPrefix:s,children:c}=e,l=a===void 0||a,u=o===void 0?`sidebar`:o,d;t[0]!==n||t[1]!==i?(d=ja(i,n),t[0]=n,t[1]=i,t[2]=d):d=t[2];let f=d,p=Q.useId(),m;t[3]!==l||t[4]!==f?(m=()=>{try{let e=localStorage.getItem(f);if(e!==null)return e===`true`}catch{}return l},t[3]=l,t[4]=f,t[5]=m):m=t[5];let[h,g]=(0,Q.useState)(m),_,v;if(t[6]!==h||t[7]!==f?(_=()=>{try{localStorage.setItem(f,String(h))}catch{}},v=[f,h],t[6]=h,t[7]=f,t[8]=_,t[9]=v):(_=t[8],v=t[9]),(0,Q.useEffect)(_,v),u===`settings-card`){let e;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(e=()=>g(Na),t[10]=e):e=t[10];let i;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(i=J(`flex w-full items-center gap-1 text-left`,`text-inherit transition-colors duration-150 hover:text-foreground`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/50`),t[11]=i):i=t[11];let a=!h&&`-rotate-90`,o;t[12]===a?o=t[13]:(o=J(`h-3.5 w-3.5 flex-shrink-0 transition-transform duration-200`,a),t[12]=a,t[13]=o);let l;t[14]===o?l=t[15]:(l=(0,$.jsx)(Y,{name:`arrow-down-s`,className:o}),t[14]=o,t[15]=l);let u=s?`${s} · `:``,d;t[16]!==n||t[17]!==u?(d=(0,$.jsxs)(`span`,{className:`min-w-0 flex-1 truncate`,children:[u,n]}),t[16]=n,t[17]=u,t[18]=d):d=t[18];let f;t[19]===r?f=t[20]:(f=(0,$.jsx)(`span`,{className:`ml-1 tabular-nums opacity-60`,children:r}),t[19]=r,t[20]=f);let m;t[21]!==p||t[22]!==h||t[23]!==l||t[24]!==d||t[25]!==f?(m=(0,$.jsxs)(`button`,{type:`button`,onClick:e,"aria-expanded":h,"aria-controls":p,className:i,children:[l,d,f]}),t[21]=p,t[22]=h,t[23]=l,t[24]=d,t[25]=f,t[26]=m):m=t[26];let _=!h&&`hidden`,v;t[27]===_?v=t[28]:(v=J(_),t[27]=_,t[28]=v);let y;return t[29]!==c||t[30]!==p||t[31]!==m||t[32]!==v?(y=(0,$.jsx)(ni,{label:m,cardClassName:v,cardId:p,children:c}),t[29]=c,t[30]=p,t[31]=m,t[32]=v,t[33]=y):y=t[33],y}let y;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(y=()=>g(Pa),t[34]=y):y=t[34];let b;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(b=J(`flex w-full items-center gap-1 rounded-md px-2 py-1 text-left`,`text-xs font-semibold uppercase tracking-wide text-muted-foreground`,`hover:bg-[var(--interactive-hover)] transition-colors duration-150`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/50`),t[35]=b):b=t[35];let x=!h&&`-rotate-90`,S;t[36]===x?S=t[37]:(S=J(`h-3.5 w-3.5 flex-shrink-0 transition-transform duration-200`,x),t[36]=x,t[37]=S);let C;t[38]===S?C=t[39]:(C=(0,$.jsx)(Y,{name:`arrow-down-s`,className:S}),t[38]=S,t[39]=C);let w;t[40]===n?w=t[41]:(w=(0,$.jsx)(`span`,{className:`flex-1 truncate`,children:n}),t[40]=n,t[41]=w);let T;t[42]===r?T=t[43]:(T=(0,$.jsx)(`span`,{className:`ml-1 tabular-nums opacity-60`,children:r}),t[42]=r,t[43]=T);let E;t[44]!==p||t[45]!==h||t[46]!==C||t[47]!==w||t[48]!==T?(E=(0,$.jsxs)(`button`,{type:`button`,onClick:y,"aria-expanded":h,"aria-controls":p,className:b,children:[C,w,T]}),t[44]=p,t[45]=h,t[46]=C,t[47]=w,t[48]=T,t[49]=E):E=t[49];let D=!h,O;t[50]!==c||t[51]!==p||t[52]!==D?(O=(0,$.jsx)(`div`,{id:p,hidden:D,className:`mt-0.5 space-y-0.5 ml-2 pl-3 border-l-2 border-[var(--interactive-border)]`,children:c}),t[50]=c,t[51]=p,t[52]=D,t[53]=O):O=t[53];let k;return t[54]!==E||t[55]!==O?(k=(0,$.jsxs)(`div`,{children:[E,O]}),t[54]=E,t[55]=O,t[56]=k):k=t[56],k};function Na(e){return!e}function Pa(e){return!e}var Fa=e=>e===`bash`?`shell`:e===`task`?`subagent`:e===`write`||e===`patch`?`edit`:e,Ia=e=>{let t=gr(e).map(e=>({action:Fa(e.action),resource:e.resource,effect:e.effect}));return t.length>0?t:void 0},La=(e,t)=>{let n=e,r=mt(e)?void 0:typeof n.system==`string`?n.system:typeof e.prompt==`string`?e.prompt:void 0,i=typeof n.color==`string`&&Ca(n.color)?n.color:void 0;return{name:t,scope:n.scope||`user`,description:e.description,model:xa(e)||null,...r?{system:r}:{},mode:e.mode,...typeof n.steps==`number`?{steps:n.steps}:{},...e.hidden===!0?{hidden:!0}:{},...n.disabledOverride?{disabled:!0}:{},...i?{color:i}:{},permissions:Ia(n.permissions??e.permission)}},Ra=({onItemSelect:e})=>{let{t}=At(),[n,r]=Q.useState(null),[i,a]=Q.useState(``),[o,s]=Q.useState(null),[c,l]=Q.useState(null),[u,d]=Q.useState(!1),[f,p]=Q.useState(null),{selectedAgentName:m,setSelectedAgent:h,setAgentDraft:g,createAgent:_,deleteAgent:v,loadAgents:y}=_t(te(e=>({selectedAgentName:e.selectedAgentName,setSelectedAgent:e.setSelectedAgent,setAgentDraft:e.setAgentDraft,createAgent:e.createAgent,deleteAgent:e.deleteAgent,loadAgents:e.loadAgents}))),{data:b=[]}=Tt();Q.useEffect(()=>{y()},[y]);let x=()=>{let t=`new-agent`,n=t,r=1;for(;b.some(e=>e.name===n);)n=`${t}-${r}`,r++;g({name:n,scope:`user`}),h(n),e?.()},S=async e=>{if(mt(e)){X.error(t(`settings.agents.sidebar.toast.builtInCannotDelete`));return}s(e),l(`delete`)},C=async e=>{mt(e)&&(s(e),l(`reset`))},w=()=>{s(null),l(null)},T=async()=>{if(!(!o||!c)){d(!0);try{let e=await v(o.name,o.scope);e.ok?(e.requiresManualRestart?X.warning(t(`settings.agents.page.toast.savedManualRestart`)):c===`delete`?X.success(t(`settings.agents.sidebar.toast.agentDeleted`,{name:o.name})):X.success(t(`settings.agents.sidebar.toast.agentReset`,{name:o.name})),w()):c===`delete`?X.error(t(`settings.agents.sidebar.toast.deleteFailed`)):X.error(t(`settings.agents.sidebar.toast.resetFailed`))}catch(e){let n=e instanceof Error?e.message:``,r=/built-in|not deletable|not found/i.test(n);c===`delete`?X.error(t(r?`settings.agents.sidebar.toast.definitionNotFound`:`settings.agents.sidebar.toast.deleteFailed`)):X.error(t(`settings.agents.sidebar.toast.resetFailed`))}d(!1)}},E=e=>{let t=e.name,n=1,r=`${t}-copy`;for(;b.some(e=>e.name===r);)n++,r=`${t}-copy-${n}`;g(La(e,r)),h(r)},D=e=>{a(e.name),r(e)},O=async()=>{if(!n)return;let e=i.trim().replace(/\s+/g,`-`);if(!e){X.error(t(`settings.agents.sidebar.toast.agentNameRequired`));return}if(e===n.name){r(null);return}if(b.some(t=>t.name===e)){X.error(t(`settings.agents.sidebar.toast.agentExists`));return}let a=n,o=await _({...La(n,e),scope:a.scope});if(o.ok){let r=await v(n.name,a.scope);r.ok?(o.requiresManualRestart||r.requiresManualRestart?X.warning(t(`settings.agents.page.toast.savedManualRestart`)):X.success(t(`settings.agents.sidebar.toast.agentRenamed`,{name:e})),h(e)):X.error(t(`settings.agents.sidebar.toast.removeOldAfterRenameFailed`))}else X.error(t(`settings.agents.sidebar.toast.renameFailed`));r(null)},k=e=>{switch(e){case`primary`:return(0,$.jsx)(Y,{name:`ai-agent`,className:`h-3 w-3 text-primary`});case`all`:return(0,$.jsx)(Y,{name:`ai-agent-fill`,className:`h-3 w-3 text-primary`});case`subagent`:return(0,$.jsx)(Y,{name:`robot`,className:`h-3 w-3 text-primary`});default:return null}},A=b.filter(e=>{let t=e;return!at(e)||!!t.scope||t.disabledOverride===!0}),j=A.filter(mt),M=A.filter(e=>!mt(e)),{groupedCustomAgents:N,ungroupedCustomAgents:P}=(0,Q.useMemo)(()=>{let e={},t=[];for(let n of M){let r=n;r.group?(e[r.group]||(e[r.group]=[]),e[r.group].push(n)):t.push(n)}return{groupedCustomAgents:Object.keys(e).sort((e,t)=>e.localeCompare(t)).map(t=>({name:t,agents:e[t]})),ungroupedCustomAgents:t}},[M]),F=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,$.jsx)(`span`,{children:t(`settings.agents.sidebar.section.custom`)}),(0,$.jsx)(q,{"data-settings-item":`agents.create`,size:`icon`,variant:`ghost`,onClick:x,"aria-label":t(`settings.agents.page.title.new`),children:(0,$.jsx)(Y,{name:`add`,className:`h-4 w-4`})})]});return(0,$.jsxs)(`div`,{className:`yuri-settings-page-content h-full overflow-y-auto bg-background p-3`,children:[(0,$.jsx)(Ta,{}),(0,$.jsx)($.Fragment,{children:A.length===0?(0,$.jsx)(ni,{children:(0,$.jsxs)(`div`,{className:`yuri-settings-group-row py-12 text-center text-muted-foreground`,children:[(0,$.jsx)(Y,{name:`robot-2`,className:`mx-auto mb-3 h-10 w-10 opacity-50`}),(0,$.jsx)(`p`,{className:`typography-ui-label font-medium`,children:t(`settings.agents.sidebar.empty.title`)}),(0,$.jsx)(`p`,{className:`typography-meta mt-1 opacity-75`,children:t(`settings.agents.sidebar.empty.description`)})]})}):(0,$.jsxs)($.Fragment,{children:[j.length>0&&(0,$.jsx)(ni,{label:t(`settings.agents.sidebar.section.builtIn`),children:j.map(t=>(0,$.jsx)(za,{agent:t,isSelected:m===t.name,onSelect:()=>{h(t.name),e?.()},onReset:()=>C(t),onDuplicate:()=>E(t),getAgentModeIcon:k,isMenuOpen:f===t.name,onMenuOpenChange:e=>p(e?t.name:null)},t.name))}),M.length>0&&(0,$.jsxs)($.Fragment,{children:[N.map(({name:n,agents:r})=>(0,$.jsx)(Ma,{label:n,count:r.length,storageKey:`agents`,variant:`settings-card`,labelPrefix:t(`settings.agents.sidebar.section.custom`),children:r.map(t=>(0,$.jsx)(za,{agent:t,isSelected:m===t.name,onSelect:()=>{h(t.name),e?.()},onRename:()=>D(t),onDelete:()=>S(t),onDuplicate:()=>E(t),getAgentModeIcon:k,isMenuOpen:f===t.name,onMenuOpenChange:e=>p(e?t.name:null)},t.name))},n)),P.length>0?(0,$.jsx)(ni,{label:F,children:P.map(t=>(0,$.jsx)(za,{agent:t,isSelected:m===t.name,onSelect:()=>{h(t.name),e?.()},onRename:()=>D(t),onDelete:()=>S(t),onDuplicate:()=>E(t),getAgentModeIcon:k,isMenuOpen:f===t.name,onMenuOpenChange:e=>p(e?t.name:null)},t.name))}):(0,$.jsx)(ni,{label:F,cardClassName:`hidden`,children:(0,$.jsx)(`span`,{})})]}),M.length===0&&(0,$.jsx)(ni,{label:F,cardClassName:`hidden`,children:(0,$.jsx)(`span`,{})})]})}),(0,$.jsx)(zt,{open:o!==null&&c!==null,onOpenChange:e=>{!e&&!u&&w()},children:(0,$.jsxs)(It,{className:`max-w-md`,children:[(0,$.jsxs)(Pt,{children:[(0,$.jsx)(Lt,{children:t(c===`delete`?`settings.agents.sidebar.dialog.deleteTitle`:`settings.agents.sidebar.dialog.resetTitle`)}),(0,$.jsx)(Rt,{children:t(c===`delete`?`settings.agents.sidebar.dialog.deleteDescription`:`settings.agents.sidebar.dialog.resetDescription`,{name:o?.name??``})})]}),(0,$.jsxs)(Ft,{children:[(0,$.jsx)(q,{size:`sm`,variant:`ghost`,onClick:w,disabled:u,children:t(`settings.common.actions.cancel`)}),(0,$.jsx)(q,{size:`sm`,onClick:T,disabled:u,children:t(c===`delete`?`settings.common.actions.delete`:`settings.common.actions.reset`)})]})]})}),(0,$.jsx)(zt,{open:n!==null,onOpenChange:e=>!e&&r(null),children:(0,$.jsxs)(It,{children:[(0,$.jsxs)(Pt,{children:[(0,$.jsx)(Lt,{children:t(`settings.agents.sidebar.renameDialog.title`)}),(0,$.jsx)(Rt,{children:t(`settings.agents.sidebar.renameDialog.description`,{name:n?.name??``})})]}),(0,$.jsx)(yn,{value:i,onChange:e=>a(e.target.value),placeholder:t(`settings.agents.sidebar.renameDialog.placeholder`),className:`text-foreground placeholder:text-muted-foreground`,onKeyDown:e=>{e.key===`Enter`&&O()}}),(0,$.jsxs)(Ft,{children:[(0,$.jsx)(q,{size:`sm`,variant:`ghost`,onClick:()=>r(null),children:t(`settings.common.actions.cancel`)}),(0,$.jsx)(q,{size:`sm`,onClick:O,children:t(`settings.common.actions.rename`)})]})]})})]})},za=e=>{let t=(0,Qi.c)(55),{agent:n,isSelected:r,onSelect:i,onDelete:a,onReset:o,onRename:s,onDuplicate:c,getAgentModeIcon:l,isMenuOpen:u,onMenuOpenChange:d}=e,{t:f}=At(),p=n,m;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(m=Gt(),t[0]=m):m=t[0];let h=m,[g,_]=Q.useState(!1),v;t[1]!==a||t[2]!==c||t[3]!==s||t[4]!==o||t[5]!==f?(v=e=>(0,$.jsxs)($.Fragment,{children:[s&&(0,$.jsxs)(e,{onClick:e=>{e.stopPropagation(),s()},children:[(0,$.jsx)(Y,{name:`edit`,className:`h-4 w-4 mr-px`}),f(`settings.common.actions.rename`)]}),(0,$.jsxs)(e,{onClick:e=>{e.stopPropagation(),c()},children:[(0,$.jsx)(Y,{name:`file-copy`,className:`h-4 w-4 mr-px`}),f(`settings.common.actions.duplicate`)]}),o&&(0,$.jsxs)(e,{onClick:e=>{e.stopPropagation(),o()},children:[(0,$.jsx)(Y,{name:`restart`,className:`h-4 w-4 mr-px`}),f(`settings.common.actions.reset`)]}),a&&(0,$.jsxs)(e,{onClick:e=>{e.stopPropagation(),a()},className:`text-destructive focus:text-destructive`,children:[(0,$.jsx)(Y,{name:`delete-bin`,className:`h-4 w-4 mr-px text-inherit`}),f(`settings.common.actions.delete`)]})]}),t[1]=a,t[2]=c,t[3]=s,t[4]=o,t[5]=f,t[6]=v):v=t[6];let y=v,b=r?`bg-interactive-selection`:`hover:bg-interactive-hover`,x;t[7]===b?x=t[8]:(x=J(`yuri-settings-group-row group relative flex items-center transition-colors duration-150 select-none`,b),t[7]=b,t[8]=x);let S;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(S=h?void 0:e=>{e.preventDefault(),_(!0)},t[9]=S):S=t[9];let C;t[10]===x?C=t[11]:(C=(0,$.jsx)(`div`,{className:x,onContextMenu:S}),t[10]=x,t[11]=C);let w;t[12]===n.name?w=t[13]:(w=wa(n.name),t[12]=n.name,t[13]=w);let T;t[14]===w?T=t[15]:(T=(0,$.jsx)(`span`,{className:`typography-ui-label font-normal truncate text-foreground`,children:w}),t[14]=w,t[15]=T);let E;t[16]!==n.mode||t[17]!==l?(E=l(n.mode),t[16]=n.mode,t[17]=l,t[18]=E):E=t[18];let D;t[19]!==n||t[20]!==p.disabledOverride||t[21]!==p.scope||t[22]!==f?(D=(p.scope||mt(n)||p.disabledOverride)&&(0,$.jsx)(`span`,{className:`typography-micro text-muted-foreground bg-muted px-1 rounded flex-shrink-0 leading-none pb-px border border-border/50`,children:p.disabledOverride?f(`settings.agents.sidebar.badge.disabled`):mt(n)?f(`settings.agents.sidebar.badge.system`):p.scope===`project`?f(`settings.common.scope.project`):f(`settings.common.scope.global`)}),t[19]=n,t[20]=p.disabledOverride,t[21]=p.scope,t[22]=f,t[23]=D):D=t[23];let O;t[24]!==D||t[25]!==T||t[26]!==E?(O=(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[T,E,D]}),t[24]=D,t[25]=T,t[26]=E,t[27]=O):O=t[27];let k;t[28]===n.description?k=t[29]:(k=n.description&&(0,$.jsx)(`div`,{className:`typography-micro text-muted-foreground/60 truncate leading-tight`,children:n.description}),t[28]=n.description,t[29]=k);let A;t[30]!==i||t[31]!==O||t[32]!==k?(A=(0,$.jsxs)(`button`,{onClick:i,className:`flex min-w-0 flex-1 flex-col gap-0 rounded-sm text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/50`,tabIndex:0,children:[O,k]}),t[30]=i,t[31]=O,t[32]=k,t[33]=A):A=t[33];let j;t[34]===d?j=t[35]:(j=e=>{e&&_(!1),d(e)},t[34]=d,t[35]=j);let M;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,$.jsx)(qt,{asChild:!0,children:(0,$.jsx)(q,{size:`sm`,variant:`ghost`,className:`h-6 w-6 px-0 flex-shrink-0 -mr-1 opacity-100 transition-opacity md:opacity-0 md:group-hover:opacity-100`,children:(0,$.jsx)(Y,{name:`more-2`,className:`h-3.5 w-3.5`})})}),t[36]=M):M=t[36];let N;t[37]===y?N=t[38]:(N=(0,$.jsx)(Jt,{align:`end`,className:`w-fit min-w-20`,children:y(Xt)}),t[37]=y,t[38]=N);let P;t[39]!==u||t[40]!==j||t[41]!==N?(P=(0,$.jsxs)(Zt,{open:u,onOpenChange:j,children:[M,N]}),t[39]=u,t[40]=j,t[41]=N,t[42]=P):P=t[42];let F;t[43]!==A||t[44]!==P?(F=(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center`,children:[A,P]}),t[43]=A,t[44]=P,t[45]=F):F=t[45];let I;t[46]!==F||t[47]!==C?(I=(0,$.jsx)(Qt,{render:C,children:F}),t[46]=F,t[47]=C,t[48]=I):I=t[48];let L;t[49]===y?L=t[50]:(L=(0,$.jsx)($t,{className:`w-fit min-w-20`,children:y(en)}),t[49]=y,t[50]=L);let R;return t[51]!==g||t[52]!==I||t[53]!==L?(R=(0,$.jsxs)(tn,{open:g,onOpenChange:_,children:[I,L]}),t[51]=g,t[52]=I,t[53]=L,t[54]=R):R=t[54],R};function Ba(e){return!!e&&typeof e==`object`&&!Array.isArray(e)}function Va(e){return typeof e==`string`&&e.length>0?e:void 0}function Ha(e){let t=Ba(e)?e:null,n=t&&Array.isArray(t.data)?t.data:Array.isArray(e)?e:null;if(!n)throw Error(`permission saved: expected list payload`);return n.map(e=>{if(!Ba(e))throw Error(`permission saved: invalid rule`);let t=Va(e.id),n=Va(e.projectID),r=Va(e.action),i=Va(e.resource);if(!t||!n||!r||!i)throw Error(`permission saved: invalid rule`);return{id:t,projectID:n,action:r,resource:i}})}async function Ua(e,t){if(!e.trim())throw Error(`permission saved: directory required`);t?.throwIfAborted();let n=await fe.getApiClient().location.get({location:{directory:e}},{signal:t});t?.throwIfAborted();let r=Va(n?.project?.id);if(!r)throw Error(`permission saved: project ID required`);return r}async function Wa(e){e.signal?.throwIfAborted();let t=await fe.getApiClient().permission.saved.list({projectID:e.projectID??void 0},{signal:e.signal});e.signal?.throwIfAborted();let n=Ha(t);if(e.projectID&&n.some(t=>t.projectID!==e.projectID))throw Error(`permission saved: project mismatch`);return n}async function Ga(e){e.signal?.throwIfAborted(),await fe.getApiClient().permission.saved.remove({id:e.id},{signal:e.signal})}function Ka(e){if(e.entry?.sdk(),e.transport!==r()||e.generation!==a())throw Error(`Saved permission runtime changed`)}var qa=e=>_e({queryKey:[e.transport,e.generation,`saved-permission-project`,e.directory,...e.entry?e.entry.queryScope:[]],queryFn:async({signal:t})=>{Ka(e);let n=e.entry?(await e.entry.sdk().location.get({location:{directory:e.directory}},{signal:t})).project?.id:await Ua(e.directory,t);if(Ka(e),!n)throw Error(`Saved permission project ID required`);return n},retry:!1}),Ja=e=>_e({queryKey:[e.transport,e.generation,`saved-permissions`,e.directory,e.projectID,...e.entry?e.entry.queryScope:[]],queryFn:async({signal:t})=>{if(Ka(e),!e.directory||!e.projectID)throw Error(`Saved permission scope required`);let n=e.entry?Ha(await e.entry.sdk().permission.saved.list({projectID:e.projectID},{signal:t})):await Wa({projectID:e.projectID,signal:t});if(Ka(e),n.some(t=>t.projectID!==e.projectID))throw Error(`Saved permission project mismatch`);return n},retry:!1});function Ya(e){let t=(0,Qi.c)(3),i=xe(),o=(0,Q.useSyncExternalStore)(n,a,a),s={transport:r(),generation:o,directory:i?.entry.location.directory??e.trim(),entry:i?.entry},c=ve({...qa(s),enabled:!!s.directory}),l={...s,projectID:c.data??``},u=Ja(l),d=!!(s.directory&&c.data)&&!c.isError,f;return t[0]!==u||t[1]!==d?(f={...u,enabled:d},t[0]=u,t[1]=d,t[2]=f):f=t[2],{project:c,list:ve(f),scope:l}}async function Xa(e,t,n){Ka(t);let i=Ja(t).queryKey;if(!e.getQueryData(i)?.some(e=>e.id===n&&e.projectID===t.projectID))throw Error(`Saved permission is outside the captured scope`);t.entry?await t.entry.sdk().permission.saved.remove({id:n}):await Ga({id:n}),t.entry&&Ka(t),t.transport===r()&&t.generation===a()&&(await e.cancelQueries({queryKey:i,exact:!0}),t.entry&&Ka(t),t.transport===r()&&t.generation===a()&&e.setQueryData(i,e=>e?.filter(e=>e.id!==n)))}var Za=()=>{let e=(0,Qi.c)(49),{t}=At(),n=se(Qa),r=ye(),{project:i,list:a,scope:o}=Ya(n),s;e[0]===r?s=e[1]:(s={mutationFn:e=>{let{scope:t,id:n}=e;return Xa(r,t,n)}},e[0]=r,e[1]=s);let c=ge(s),l;e[2]!==c.variables||e[3]!==o?(l=c.variables&&JSON.stringify(c.variables.scope)===JSON.stringify(o),e[2]=c.variables,e[3]=o,e[4]=l):l=e[4];let u=l,d=i.isError||a.isError,f=!!o.directory&&(i.isPending||a.isPending)&&!d,p;e[5]===a.data?p=e[6]:(p=a.data??[],e[5]=a.data,e[6]=p);let m=p,h;e[7]!==c||e[8]!==o?(h=e=>c.mutate({scope:o,id:e}),e[7]=c,e[8]=o,e[9]=h):h=e[9];let g=Te(h),_;e[10]!==a||e[11]!==i?(_=()=>{i.isError?i.refetch():a.refetch()},e[10]=a,e[11]=i,e[12]=_):_=e[12];let v=Te(_);if(!d&&!f&&m.length===0)return null;let y;e[13]===t?y=e[14]:(y=t(`settings.permissions.saved.title`),e[13]=t,e[14]=y);let b;e[15]!==f||e[16]!==t?(b=f?t(`common.loading`):void 0,e[15]=f,e[16]=t,e[17]=b):b=e[17];let x;e[18]!==d||e[19]!==a.isFetching||e[20]!==i.isFetching||e[21]!==v||e[22]!==t?(x=d&&(0,$.jsx)(ii,{label:(0,$.jsx)(`span`,{role:`alert`,children:t(`settings.permissions.saved.loadFailed`)}),children:(0,$.jsx)(q,{type:`button`,variant:`ghost`,size:`xs`,onClick:v,disabled:i.isFetching||a.isFetching,children:t(`settings.permissions.saved.retry`)})}),e[18]=d,e[19]=a.isFetching,e[20]=i.isFetching,e[21]=v,e[22]=t,e[23]=x):x=e[23];let S;e[24]!==c.isError||e[25]!==u||e[26]!==t?(S=u&&c.isError&&(0,$.jsx)(ii,{label:(0,$.jsx)(`span`,{role:`alert`,children:t(`settings.permissions.saved.deleteFailed`)}),children:null}),e[24]=c.isError,e[25]=u,e[26]=t,e[27]=S):S=e[27];let C;if(e[28]!==c.isPending||e[29]!==d||e[30]!==g||e[31]!==m||e[32]!==f||e[33]!==u||e[34]!==t){let n;e[36]!==c.isPending||e[37]!==d||e[38]!==g||e[39]!==f||e[40]!==u||e[41]!==t?(n=e=>(0,$.jsx)(ii,{label:(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`span`,{children:e.action}),(0,$.jsx)(`span`,{className:`typography-micro text-muted-foreground font-mono`,children:e.resource})]}),children:(0,$.jsx)(q,{type:`button`,variant:`ghost`,size:`xs`,disabled:d||f||!!(u&&c.isPending),onClick:()=>void g(e.id),children:t(`settings.permissions.saved.delete`)})},e.id),e[36]=c.isPending,e[37]=d,e[38]=g,e[39]=f,e[40]=u,e[41]=t,e[42]=n):n=e[42],C=m.map(n),e[28]=c.isPending,e[29]=d,e[30]=g,e[31]=m,e[32]=f,e[33]=u,e[34]=t,e[35]=C}else C=e[35];let w;return e[43]!==y||e[44]!==b||e[45]!==x||e[46]!==S||e[47]!==C?(w=(0,$.jsx)(`div`,{"data-settings-item":`permissions.saved`,className:`mb-6`,children:(0,$.jsxs)(ni,{label:y,description:b,children:[x,S,C]})}),e[43]=y,e[44]=b,e[45]=x,e[46]=S,e[47]=C,e[48]=w):w=e[48],w};function Qa(e){return e.currentDirectory}var $a=[`*`,`read`,`edit`,`glob`,`grep`,`shell`,`subagent`,`skill`,`webfetch`,`websearch`,`question`,`external_directory`,`execute`,`browser`],eo={"*":`settings.agents.page.permissions.defaultLabel`,shell:`settings.agents.page.permissions.shell`,bash:`settings.agents.page.permissions.shell`,subagent:`settings.agents.page.permissions.subagent`,task:`settings.agents.page.permissions.subagent`,edit:`settings.agents.page.permissions.edit`,write:`settings.agents.page.permissions.edit`,patch:`settings.agents.page.permissions.edit`,apply_patch:`settings.agents.page.permissions.edit`,multiedit:`settings.agents.page.permissions.edit`,external_directory:`settings.agents.page.permissions.externalDirectory`,question:`settings.agents.page.permissions.question`,read:`settings.agents.page.permissions.read`,glob:`settings.agents.page.permissions.glob`,grep:`settings.agents.page.permissions.grep`,skill:`settings.agents.page.permissions.skill`,webfetch:`settings.agents.page.permissions.webfetch`,websearch:`settings.agents.page.permissions.websearch`,execute:`settings.agents.page.permissions.execute`,browser:`settings.agents.page.permissions.browser`,session_rename:`chat.tools.display.session_rename`,session_move:`chat.tools.display.session_move`},to=e=>e===`allow`||e===`ask`||e===`deny`,no=(e,t)=>`${e}::${t}`,ro=e=>e===`bash`?`shell`:e===`task`?`subagent`:e===`write`||e===`patch`?`edit`:e,io=e=>{let t=new Map;for(let n of e){let e=ro(n.permission);!e||e===`invalid`||n.pattern&&to(n.action)&&t.set(no(e,n.pattern),{permission:e,pattern:n.pattern,action:n.action})}return Array.from(t.values())},ao=e=>{let t=new Map;for(let n of io(e))t.set(no(n.permission,n.pattern),n);return t},oo=e=>[...e].sort((e,t)=>{let n=e.permission.localeCompare(t.permission);return n===0?e.pattern.localeCompare(t.pattern):n}),so=(e,t)=>{let n=oo(io(e)),r=oo(io(t));return n.length===r.length&&n.every((e,t)=>{let n=r[t];return e.permission===n.permission&&e.pattern===n.pattern&&e.action===n.action})},co=e=>e.find(e=>e.permission===`*`&&e.pattern===`*`)?.action??`allow`,lo=(e,t)=>io(e).filter(e=>e.permission!==`*`||e.pattern!==`*`).filter(e=>e.pattern!==`*`||e.action!==t),uo=e=>{if(Array.isArray(e))return io(e.flatMap(e=>!e||typeof e!=`object`||typeof e.action!=`string`||typeof e.resource!=`string`||!to(e.effect)?[]:[{permission:e.action,pattern:e.resource,action:e.effect}]));if(to(e))return[{permission:`*`,pattern:`*`,action:e}];if(!e||typeof e!=`object`||Array.isArray(e))return[];let t=[];for(let[n,r]of Object.entries(e))if(n!==`__originalKeys`){if(to(r)){t.push({permission:n,pattern:`*`,action:r});continue}if(r&&typeof r==`object`&&!Array.isArray(r))for(let[e,i]of Object.entries(r))to(i)&&t.push({permission:n,pattern:e,action:i})}return t},fo=()=>{let{t:e}=At(),{selectedAgentName:t,getAgentByName:n,createAgent:r,updateAgent:i,agentDraft:a,setAgentDraft:o}=_t(te(e=>({selectedAgentName:e.selectedAgentName,getAgentByName:e.getAgentByName,createAgent:e.createAgent,updateAgent:e.updateAgent,agentDraft:e.agentDraft,setAgentDraft:e.setAgentDraft}))),{data:s=[]}=Tt(),l=t?n(t):null,u=!!(a&&a.name===t&&!l),[d,f]=Q.useState(``),[p,m]=Q.useState(`user`),[h,g]=Q.useState(``),[_,v]=Q.useState(`subagent`),[y,b]=Q.useState(``),[x,S]=Q.useState(``),[C,w]=Q.useState(!1),[T,E]=Q.useState(`allow`),[D,O]=Q.useState([]),[k,A]=Q.useState([]),[j,M]=Q.useState(``),[N,P]=Q.useState(`*`),[F,I]=Q.useState(!1),[L,R]=Q.useState(!1),z=Q.useRef(null),B=se(e=>e.currentDirectory??null),[V,H]=Q.useState([]),U=et(e=>e.permission);Q.useEffect(()=>{let e=!1;return(async()=>{let t=await fe.listToolIds({directory:B});if(e)return;let n=new Set([`write`,`patch`,`multiedit`]),r=t.map(e=>typeof e==`string`?e.trim():``).filter(Boolean).filter(e=>e!==`*`).filter(e=>e!==`invalid`).filter(e=>!n.has(e));H(Array.from(new Set(r)).sort((e,t)=>e.localeCompare(t)))})(),()=>{e=!0}},[B]);let W=Q.useMemo(()=>{let e=new Set;for(let t of s){let n=io(uo(t.permissions??t.permission));for(let t of n)t.permission&&t.permission!==`*`&&t.permission!==`invalid`&&e.add(t.permission)}for(let t of Object.values(U))for(let n of t){let t=n.permission?.trim();t&&t!==`invalid`&&e.add(t)}for(let t of V)e.add(t);return Array.from(e).sort((e,t)=>e.localeCompare(t))},[s,U,V]),ee=Q.useMemo(()=>ao(D),[D]),ne=Q.useMemo(()=>ao(k),[k]),re=e=>ne.get(no(e,`*`))?.action,G=e=>k.filter(t=>t.permission===e&&t.pattern!==`*`).sort((e,t)=>e.pattern.localeCompare(t.pattern)),ie=Q.useMemo(()=>{let e=new Set;for(let t of $a)e.add(t);for(let t of W)e.add(t);return Array.from(e).sort((e,t)=>e.localeCompare(t))},[W]),ae=e=>{let t=e===`*`?T:re(e)??T,n=G(e),r=n.reduce((e,t)=>(e[t.action]=(e[t.action]??0)+1,e),{allow:0,ask:0,deny:0}),i=[`allow`,`ask`,`deny`].filter(e=>r[e]>0).map(e=>`${r[e]} ${e}`).join(`, `);return{defaultAction:t,patternRulesCount:n.length,patternSummary:i,hasDefaultHint:!1}},oe=t=>e(t===`allow`?`settings.common.permission.allow`:t===`deny`?`settings.common.permission.deny`:`settings.common.permission.ask`),ce=t=>t===`global`?e(`settings.common.scope.global`):oe(t),le=Q.useMemo(()=>{let e=new Set;for(let t of $a)e.add(t);for(let t of W)e.add(t);return Array.from(e).sort((e,t)=>e.localeCompare(t))},[W]),ue=(e,t,n)=>{A(r=>{let i=ao(r);return i.set(no(e,t),{permission:e,pattern:t,action:n}),Array.from(i.values())})},de=(e,t)=>{A(n=>{let r=ao(n);return r.delete(no(e,t)),Array.from(r.values())})},pe=(e,t)=>{let n=ee.get(no(e,t));if(n){ue(e,t,n.action);return}de(e,t)},me=(e,t,n)=>{ue(e,t,n)},he=e=>{E(e),A(t=>t.filter(t=>t.pattern!==`*`||t.action!==e))},ge=t=>{let n=j.trim();if(!n){X.error(e(`settings.agents.page.toast.permissionNameRequired`));return}let r=N.trim()||`*`;if(n===`*`&&r===`*`){he(t),M(``),P(`*`);return}r===`*`&&n!==`*`&&t===T?de(n,`*`):ue(n,r,t),M(``),P(`*`)},_e=t=>{let n=eo[t];return n?e(n):t.split(/[_-]+/g).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)};Q.useEffect(()=>{M(``),P(`*`);let e=e=>{let t=io(e),n=co(t),r=lo(t,n);return E(n),O(r),A(r),{global:n,rules:r}};if(u&&a){let t=a.name||``,n=a.scope||`user`,r=a.description||``,i=a.mode||`subagent`,o=a.model||``,s=a.system||``;f(t),m(n),g(r),v(i),b(o),S(s),w(!1);let c=e(uo(a.permissions));z.current={draftName:t,draftScope:n,description:r,mode:i,model:o,system:s,globalPermission:c.global,permissionRules:c.rules};return}if(l&&t===l.name){let t=l,n=l.description||``,r=l.mode||`subagent`,i=xa(l),a=t.scope===`project`?`project`:`user`;m(a),g(n),v(r),b(i),S(``),w(!1);let o=e(uo(t.permissions??l.permission));z.current={draftName:``,draftScope:a,description:n,mode:r,model:i,system:``,globalPermission:o.global,permissionRules:o.rules}}},[a,u,l,t]),Q.useEffect(()=>{if(!t||u)return;let e=new AbortController,n=ht();return c(`/api/config/agents/${encodeURIComponent(t)}/config`,{signal:e.signal,headers:n?{"x-opencode-directory":n}:{}}).then(async t=>{if(!t.ok||e.signal.aborted)return;let n=ba((await t.json()).config);e.signal.aborted||n===void 0||!z.current||(S(n),z.current={...z.current,system:n})}).catch(()=>void 0),()=>e.abort()},[u,t]);let ve=Q.useMemo(()=>{let e=z.current;return e?!!(u&&d!==e.draftName||p!==e.draftScope||h!==e.description||_!==e.mode||y!==e.model||x!==e.system||T!==e.globalPermission||!so(k,e.permissionRules)):!1},[h,d,p,T,u,_,y,k,x]),ye=(!u&&l?l.document:void 0)?.dropped?.map(e=>e.key)??[],be=!L&&ve;return t?(0,$.jsx)(Nt,{outerClassName:`h-full`,className:`w-full`,children:(0,$.jsxs)(`div`,{className:`yuri-settings-page-content mx-auto w-full max-w-3xl p-3 sm:p-6 sm:pt-8`,children:[(0,$.jsx)(ei,{actions:(0,$.jsx)(q,{type:`button`,size:`sm`,onClick:async()=>{let n=u?d.trim().replace(/\s+/g,`-`):t?.trim();if(!n){X.error(e(`settings.agents.sidebar.toast.agentNameRequired`));return}if(u&&s.some(e=>e.name===n)){X.error(e(`settings.agents.sidebar.toast.agentExists`));return}R(!0);try{let t={description:h,mode:_,model:y,system:x,globalPermission:T,permissionRules:k},s=z.current,c=s?{description:s.description,mode:s.mode,model:s.model,system:s.system,globalPermission:s.globalPermission,permissionRules:s.permissionRules}:null,l=ya({isNewAgent:u,agentName:n,draftScope:p,initialScope:s?.draftScope,draftHasExplicitPermission:u&&a?.permissions!==void 0,current:t,initial:c,confirmDrop:C}),d;u?(d=await r(l),d.ok&&o(null)):d=await i(n,l),d.ok?d.requiresManualRestart?X.warning(e(`settings.agents.page.toast.savedManualRestart`)):X.success(e(`settings.agents.page.toast.savedNextRequest`)):X.error(e(u?`settings.agents.page.toast.createFailed`:`settings.agents.page.toast.updateFailed`))}catch(t){console.error(`Error saving agent:`,t);let n=t instanceof Error&&t.message?t.message:e(`settings.agents.page.toast.saveUnexpectedError`);X.error(n)}finally{R(!1)}},disabled:!be,"aria-busy":L,children:e(L?`settings.common.actions.saving`:`settings.common.actions.saveChanges`)}),children:(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`h2`,{className:`typography-ui-header font-semibold text-foreground truncate`,children:u?e(`settings.agents.page.title.new`):wa(t??``)}),(0,$.jsx)(`p`,{className:`typography-meta text-muted-foreground truncate`,children:e(u?`settings.agents.page.subtitle.new`:`settings.agents.page.subtitle.edit`)})]})}),(0,$.jsx)(Za,{}),ye.length>0?(0,$.jsxs)(`div`,{className:`mt-3 flex flex-col gap-2`,children:[(0,$.jsx)(`p`,{className:`typography-meta text-muted-foreground`,children:e(`settings.agents.page.legacy.dropped`,{fields:ye.join(`, `)})}),(0,$.jsx)(ti,{checked:C,onChange:w,label:e(`settings.agents.page.legacy.confirmDrop`),ariaLabel:e(`settings.agents.page.legacy.confirmDrop`)})]}):null,(0,$.jsxs)(ni,{label:e(`settings.agents.page.section.identityRole`),children:[(0,$.jsx)(ii,{itemId:`agents.scope`,label:e(`settings.agents.page.field.scope`),children:(0,$.jsxs)(lr,{value:p,onValueChange:e=>m(e),children:[(0,$.jsx)(cr,{className:`w-fit min-w-[100px]`,children:(0,$.jsx)(ar,{placeholder:e(`settings.agents.page.field.scopePlaceholder`),children:t=>(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(Y,{name:t===`project`?`folder`:`user-3`,className:`h-3.5 w-3.5`}),(0,$.jsx)(`span`,{children:e(t===`project`?`settings.common.scope.project`:`settings.common.scope.global`)})]})})}),(0,$.jsxs)(sr,{align:`end`,children:[(0,$.jsx)(or,{value:`user`,children:(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(Y,{name:`user-3`,className:`h-3.5 w-3.5`}),(0,$.jsx)(`span`,{children:e(`settings.common.scope.global`)})]})}),(0,$.jsx)(or,{value:`project`,children:(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(Y,{name:`folder`,className:`h-3.5 w-3.5`}),(0,$.jsx)(`span`,{children:e(`settings.common.scope.project`)})]})})]})]})}),u&&(0,$.jsx)(ii,{itemId:`agents.name`,label:e(`settings.agents.page.field.agentName`),children:(0,$.jsxs)(`div`,{className:`flex items-center`,children:[(0,$.jsx)(`span`,{className:`typography-ui-label text-muted-foreground mr-1`,children:`@`}),(0,$.jsx)(yn,{value:d,onChange:e=>f(e.target.value),placeholder:e(`settings.agents.page.field.agentNamePlaceholder`),className:`h-7 w-40 px-2`})]})}),(0,$.jsx)(ii,{label:e(`settings.common.field.description`),className:`yuri-settings-split-row-stacked`,children:(0,$.jsx)(on,{embedded:!0,value:h,onChange:e=>g(e.target.value),placeholder:e(`settings.agents.page.field.descriptionPlaceholder`),rows:2,className:`w-full resize-none min-h-[60px] bg-transparent`})}),(0,$.jsx)(ii,{itemId:`agents.mode`,className:`yuri-settings-agents-mode-row`,label:(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,$.jsx)(`span`,{children:e(`settings.agents.page.field.mode`)}),(0,$.jsxs)(Ht,{children:[(0,$.jsx)(Bt,{asChild:!0,children:(0,$.jsx)(Y,{name:`information`,className:`h-3.5 w-3.5 text-muted-foreground/60 cursor-help`})}),(0,$.jsx)(Vt,{sideOffset:8,className:`max-w-xs`,children:e(`settings.agents.page.field.modeTooltip`)})]})]}),children:(0,$.jsxs)(`div`,{className:`flex flex-nowrap items-center justify-end gap-1`,children:[(0,$.jsx)(q,{variant:`chip`,size:`xs`,"aria-pressed":_===`primary`,onClick:()=>v(`primary`),className:`!font-normal shrink-0`,children:e(`settings.agents.page.mode.primary`)}),(0,$.jsx)(q,{variant:`chip`,size:`xs`,"aria-pressed":_===`subagent`,onClick:()=>v(`subagent`),className:`!font-normal shrink-0`,children:e(`settings.agents.page.mode.subagent`)}),(0,$.jsx)(q,{variant:`chip`,size:`xs`,"aria-pressed":_===`all`,onClick:()=>v(`all`),className:`!font-normal shrink-0`,children:e(`settings.agents.page.mode.all`)})]})})]}),(0,$.jsx)(ni,{label:e(`settings.agents.page.section.modelParameters`),children:(0,$.jsx)(ii,{itemId:`agents.model`,label:e(`settings.agents.page.field.overrideModel`),children:(0,$.jsx)(ji,{providerId:Sa(y)?.providerId??``,modelId:Sa(y)?.modelId??``,variant:Sa(y)?.variant??``,onChange:(e,t,n)=>{b(e&&t?n?`${e}/${t}#${n}`:`${e}/${t}`:``)},className:`yuri-settings-inline-value`})})}),(0,$.jsx)(ai,{itemId:`agents.system-prompt`,label:e(`settings.agents.page.section.systemPrompt`),className:`yuri-settings-split-row-stacked`,children:(0,$.jsx)(on,{embedded:!0,value:x,onChange:e=>S(e.target.value),placeholder:e(`settings.agents.page.field.systemPromptPlaceholder`),rows:8,className:`w-full font-mono typography-meta min-h-[120px] max-h-[60vh] bg-transparent resize-y`})}),(0,$.jsx)(`div`,{"data-settings-item":`agents.permissions`,children:(0,$.jsx)(ni,{label:(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,$.jsx)(`span`,{children:e(`settings.agents.page.section.toolPermissions`)}),(0,$.jsx)(q,{variant:`outline`,size:`xs`,className:`!font-normal`,onClick:()=>I(e=>!e),children:e(F?`settings.agents.page.permissions.hideEditor`:`settings.agents.page.permissions.advancedEditor`)})]}),children:F?(0,$.jsxs)(`div`,{className:`space-y-6 p-2`,children:[(0,$.jsx)(ii,{label:(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`span`,{children:e(`settings.agents.page.permissions.globalDefault`)}),(0,$.jsx)(`span`,{className:`typography-micro text-muted-foreground/70 font-mono`,children:`*`})]}),children:(0,$.jsxs)(lr,{value:T,onValueChange:e=>he(e),children:[(0,$.jsx)(cr,{className:`w-[100px]`,children:(0,$.jsx)(ar,{children:oe(T)})}),(0,$.jsxs)(sr,{children:[(0,$.jsx)(or,{value:`allow`,children:e(`settings.common.permission.allow`)}),(0,$.jsx)(or,{value:`ask`,children:e(`settings.common.permission.ask`)}),(0,$.jsx)(or,{value:`deny`,children:e(`settings.common.permission.deny`)})]})]})}),(0,$.jsx)(`div`,{className:`space-y-4`,children:ie.filter(e=>e!==`*`).map(t=>{let n=_e(t),{defaultAction:r,patternRulesCount:i}=ae(t),a=re(t),o=a??`global`,s=G(t),c=[`allow`,`ask`,`deny`].filter(e=>e!==T);return(0,$.jsxs)(`div`,{className:`border-t border-[var(--surface-subtle)] pt-2`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between py-1`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`typography-ui-label text-foreground`,children:n}),(0,$.jsx)(`span`,{className:`typography-micro text-muted-foreground/70 font-mono`,children:t})]}),(0,$.jsx)(`div`,{className:`typography-micro text-muted-foreground`,children:i>0?e(`settings.agents.page.permissions.globalSummary`,{summary:r}):r})]}),(0,$.jsxs)(`div`,{className:`space-y-1 pl-2 mt-1`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2 py-0.5`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-wrap items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`typography-micro text-muted-foreground`,children:e(`settings.agents.page.permissions.pattern`)}),(0,$.jsx)(`span`,{className:`typography-micro font-mono text-foreground bg-[var(--surface-muted)] px-1 rounded`,children:`*`}),a&&(0,$.jsx)(q,{size:`sm`,variant:`ghost`,onClick:()=>pe(t,`*`),className:`px-1.5 py-0 h-5`,children:(0,$.jsx)(Y,{name:`subtract`,className:`h-3.5 w-3.5 text-muted-foreground hover:text-foreground`})})]}),(0,$.jsxs)(lr,{value:o,onValueChange:e=>{if(e===`global`){de(t,`*`);return}ue(t,`*`,e)},children:[(0,$.jsx)(cr,{className:`w-[90px] shrink-0`,children:(0,$.jsx)(ar,{children:ce(o)})}),(0,$.jsxs)(sr,{children:[(0,$.jsx)(or,{value:`global`,children:e(`settings.common.scope.global`)}),c.map(e=>(0,$.jsx)(or,{value:e,className:`capitalize`,children:oe(e)},e))]})]})]}),s.map(t=>{let n=no(t.permission,t.pattern),r=ee.get(n),i=!r,a=!!(r&&r.action!==t.action);return(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2 py-0.5 border-t border-[var(--surface-subtle)]`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-wrap items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`typography-micro text-muted-foreground`,children:e(`settings.agents.page.permissions.pattern`)}),(0,$.jsx)(`span`,{className:`min-w-0 break-all typography-micro font-mono text-foreground bg-[var(--surface-muted)] px-1 rounded`,children:t.pattern}),i&&(0,$.jsx)(`span`,{className:`typography-micro text-[var(--status-success)]`,children:e(`settings.common.badge.new`)}),a&&(0,$.jsx)(`span`,{className:`typography-micro text-[var(--status-warning)]`,children:e(`settings.common.badge.modified`)}),(i||a)&&(0,$.jsx)(q,{size:`sm`,variant:`ghost`,onClick:()=>i?de(t.permission,t.pattern):pe(t.permission,t.pattern),className:`px-1.5 py-0 h-5`,children:(0,$.jsx)(Y,{name:`subtract`,className:`h-3.5 w-3.5 text-muted-foreground hover:text-foreground`})})]}),(0,$.jsxs)(lr,{value:t.action,onValueChange:e=>me(t.permission,t.pattern,e),children:[(0,$.jsx)(cr,{className:`w-[90px] shrink-0`,children:(0,$.jsx)(ar,{children:oe(t.action)})}),(0,$.jsxs)(sr,{children:[(0,$.jsx)(or,{value:`allow`,children:e(`settings.common.permission.allow`)}),(0,$.jsx)(or,{value:`ask`,children:e(`settings.common.permission.ask`)}),(0,$.jsx)(or,{value:`deny`,children:e(`settings.common.permission.deny`)})]})]})]},n)})]})]},t)})}),(0,$.jsxs)(`div`,{className:`border-t border-[var(--surface-subtle)] pt-3`,children:[(0,$.jsx)(`h4`,{className:`typography-ui-label text-foreground mb-2`,children:e(`settings.agents.page.permissions.addCustomRule`)}),(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2`,children:[(0,$.jsxs)(lr,{value:j,onValueChange:M,children:[(0,$.jsx)(cr,{className:`w-auto max-w-full sm:w-[160px]`,children:j?(0,$.jsx)(`span`,{className:`truncate`,children:_e(j)}):(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:e(`settings.agents.page.permissions.permissionPlaceholder`)})}),(0,$.jsx)(sr,{children:le.map(e=>(0,$.jsx)(or,{value:e,children:(0,$.jsx)(`div`,{className:`flex items-center justify-between gap-2 w-full`,children:(0,$.jsx)(`span`,{children:_e(e)})})},e))})]}),(0,$.jsx)(yn,{value:N,onChange:e=>P(e.target.value),placeholder:e(`settings.agents.page.permissions.patternPlaceholder`),className:`h-7 min-w-0 flex-1 basis-32 font-mono text-xs`}),(0,$.jsxs)(`div`,{className:`flex gap-1`,children:[(0,$.jsx)(q,{variant:`outline`,size:`xs`,className:`!font-normal`,onClick:()=>ge(`allow`),children:e(`settings.common.permission.allow`)}),(0,$.jsx)(q,{variant:`outline`,size:`xs`,className:`!font-normal`,onClick:()=>ge(`ask`),children:e(`settings.common.permission.ask`)}),(0,$.jsx)(q,{variant:`outline`,size:`xs`,className:`!font-normal`,onClick:()=>ge(`deny`),children:e(`settings.common.permission.deny`)})]})]})]})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:`typography-micro text-muted-foreground px-3 pt-2`,children:e(`settings.agents.page.permissions.lastMatchHint`)}),_r(gr(k)).map((e,t)=>(0,$.jsx)(ii,{label:(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`typography-micro text-muted-foreground font-mono`,children:t+1}),(0,$.jsx)(`span`,{children:e.action}),(0,$.jsx)(`span`,{className:`typography-micro text-muted-foreground/70 font-mono`,children:e.resource})]}),children:(0,$.jsx)(`span`,{className:J(`typography-micro capitalize px-1.5 py-0.5 rounded`,e.effect===`allow`?`text-[var(--status-success)] bg-[var(--status-success)]/10`:e.effect===`deny`?`text-[var(--status-error)] bg-[var(--status-error)]/10`:`text-[var(--status-warning)] bg-[var(--status-warning)]/10`),children:e.effect})},`${e.action}::${e.resource}::${t}`))]})})})]})}):(0,$.jsx)(Nt,{outerClassName:`h-full`,className:`w-full`,children:(0,$.jsxs)(`div`,{className:`yuri-settings-page-content mx-auto w-full max-w-3xl p-3 sm:p-6 sm:pt-8`,children:[(0,$.jsx)(Za,{}),(0,$.jsx)(`div`,{className:`flex h-full items-center justify-center`,children:(0,$.jsxs)(`div`,{className:`text-center text-muted-foreground`,children:[(0,$.jsx)(Y,{name:`robot-2`,className:`mx-auto mb-3 h-12 w-12 opacity-50`}),(0,$.jsx)(`p`,{className:`typography-body`,children:e(`settings.agents.page.empty.title`)}),(0,$.jsx)(`p`,{className:`typography-meta mt-1 opacity-75`,children:e(`settings.agents.page.empty.description`)})]})})]})})},po=`~/.config/opencode/AGENTS.md`,mo=async(e,t)=>{let n=await e.json().catch(()=>null);return typeof n?.error==`string`&&n.error.trim()?n.error:t},ho=e=>e.length>0&&!e.endsWith(`
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{E as t}from"./runtime-auth-DA-qfGHk.js";import{c as n,i as r,l as i,n as a,r as o,t as s}from"./runtime-switch-DEPKHgdL.js";import{n as c}from"./runtime-fetch-V-iMWR8t.js";import{A as l,C as u,E as d,F as f,J as p,P as m,R as h,T as g,X as _,et as v,g as y,j as b,n as x,nt as S,ot as C,p as w,t as T,tt as E,w as D,z as O}from"./platform-CiUKDeXd.js";import{t as k}from"./runtimeAPIRegistry-C2VogTny.js";import{_ as A,a as j,d as M,g as N,i as P,n as F,p as I,r as L,s as R,t as z,v as B,y as V}from"./desktopHosts-BsTrBVja.js";import{n as H}from"./desktopRelayRestore-BxbRKak_.js";import{a as U,i as W,r as ee,t as te}from"./vendor-zustand-CTekDqaS.js";import{ot as ne,st as re}from"./vendor-base-ui-wXsskyKm.js";import{Ft as G,Ht as ie,Lt as ae,Rt as oe,St as se,an as ce,hn as le,in as ue}from"./gitApiHttp-Dd-FwgCq.js";import"./brand-storage-bootstrap-D4BW3w-M.js";import{t as de}from"./safeStorage-DTOhKN0V.js";import{n as fe,ut as pe}from"./client-B_907PBv.js";import{n as me}from"./vendor-react-BkccXcWz.js";import{i as he,n as ge,o as _e,s as ve,u as ye}from"./vendor-tanstack-react-query-DIb_ItL-.js";import{c as be}from"./yuriEvents-BFrD5fMU.js";import{E as xe,R as Se}from"./runtime-file-resource-Bc_ss-sW.js";import{i as Ce,o as we,r as Te}from"./vendor-reactuses-core-DjKFMfz7.js";import{c as Ee,d as De,h as Oe,r as K,u as ke}from"./useUIStore-C3ewjGgP.js";import{o as Ae}from"./useMobileHtmlPreviewStore-BYunNOBo.js";import{t as je}from"./uuid-D-SDZijH.js";import{Q as Me,S as Ne,U as Pe,lt as Fe}from"./vendor-codemirror-autocomplete-C0FrlFqZ.js";import{r as Ie}from"./vendor-sonner-DX3nfJx4.js";import{i as q,l as Le,o as J}from"./session-startup-barrier-DT-hIBRf.js";import{n as Y}from"./Icon-DmykXZL1.js";import{$n as Re,Aa as ze,At as Be,Ba as Ve,Ca as He,Gi as Ue,Hi as We,Ja as Ge,Ki as Ke,Ma as qe,Na as Je,Oa as Ye,Oi as Xe,Qn as Ze,Sa as Qe,Ti as $e,U as et,Ui as tt,Va as nt,_a as rt,_r as it,aa as at,ba as ot,ca as st,da as ct,er as lt,f as ut,fa as dt,ga as ft,ha as pt,ia as mt,ja as ht,ka as gt,la as _t,ma as vt,pa as yt,qi as bt,sa as xt,t as X,ur as St,va as Ct,vi as wt,wa as Tt,xa as Et,ya as Dt,za as Ot}from"./ui-ee2iN869.js";import{n as kt,t as At}from"./i18n-DXc6czdR.js";import{a as jt}from"./toolHelpers-iEHVHQ9p.js";import{i as Mt}from"./useAssistantUIStore-CpJZ4Rqs.js";import{t as Nt}from"./ScrollableOverlay-stxT7gLf.js";import{a as Pt,i as Ft,n as It,o as Lt,r as Rt,t as zt}from"./dialog-BeFBA6ja.js";import{i as Bt,n as Vt,t as Ht}from"./tooltip-CpTbxEOE.js";import{n as Ut}from"./useThemeSystem-BIXghnHj.js";import{a as Wt}from"./react-CPBNl-S9.js";import{n as Gt,r as Kt}from"./device-EIfSfSWk.js";import{a as Z,c as qt,n as Jt,o as Yt,r as Xt,t as Zt}from"./dropdown-menu-BblI9sN2.js";import{a as Qt,n as $t,r as en,t as tn}from"./context-menu-CKlB6wxo.js";import{n as nn,r as rn,t as an}from"./collapsible-Z0IjDAMO.js";import{t as on}from"./textarea-ZiXxEOHK.js";import{n as sn}from"./appThemeRegistry-BdjrGBQ4.js";import{C as cn,S as ln,_ as un,v as dn,x as fn,y as pn}from"./gitApi-CoVwjIDy.js";import{M as mn,k as hn,n as gn}from"./mobileBackNavigation-C94n2eLT.js";import{r as _n,t as vn}from"./GuiPluginMount-TC5FELtQ.js";import{t as yn}from"./input-Cf16qJ6g.js";import{n as bn}from"./MarkdownRenderer-VvziwyJB.js";import{a as xn}from"./markdownHeightCache-CHGGNhWI.js";import{a as Sn,d as Cn,f as wn,i as Tn,o as En,t as Dn,u as On}from"./shortcuts-WkN3Gh8v.js";import{u as kn}from"./assistantQueries-NdPqu6rx.js";import{t as An}from"./MobileDetailNavigation-ldTzGo19.js";import{$ as jn,A as Mn,B as Nn,D as Pn,E as Fn,F as In,I as Ln,K as Rn,L as zn,M as Bn,N as Vn,O as Hn,P as Un,T as Wn,X as Gn,Y as Kn,Z as qn,a as Jn,et as Yn,i as Xn,j as Zn,k as Qn,l as $n,q as er,r as tr,z as nr}from"./pwa-CtDladgB.js";import{t as rr}from"./ErrorBoundary-D7QcwhmL.js";import{t as ir}from"./ProviderLogo-DA98yu7M.js";import{c as ar,i as or,n as sr,s as cr,t as lr}from"./select-vZCgcnYG.js";import{a as ur}from"./githubAuthQueries-DqregESf.js";import{a as dr,i as fr,n as pr}from"./projectMeta-vIaGFaQr.js";import{t as mr}from"./sortable-tabs-strip-DmtfYPz0.js";import{n as hr}from"./timeFormat-dCsf2MQv.js";import{n as gr,t as _r}from"./permission-rules-DoQUXKll.js";import{a as vr,c as yr,i as br,l as xr,n as Sr,r as Cr,s as wr,u as Tr}from"./useQuotaStore-CSn2pk3T.js";import{a as Er,i as Dr,l as Or,n as kr,s as Ar,t as jr}from"./quota-CqWNkFzw.js";import{a as Mr,c as Nr,o as Pr,s as Fr}from"./router-DXUi1sBd.js";import{a as Ir,c as Lr,i as Rr,l as zr,n as Br,o as Vr,r as Hr,s as Ur,u as Wr,v as Gr,y as Kr}from"./sessionOwnership-BjhXe6pi.js";import{t as qr}from"./switch-CNmsFYfY.js";import{a as Jr,c as Yr,d as Xr,l as Zr,o as Qr,u as $r}from"./mcpQueries-Rmp1BKeo.js";import{a as ei,i as ti,n as ni,o as ri,r as ii,t as ai}from"./SettingsGroup-CvaPYznp.js";import{a as oi,i as si,n as ci,o as li,r as ui,t as di}from"./useMcpConfigStore-DKTl0PvE.js";import{a as fi,c as pi,i as mi,l as hi,o as gi,r as _i,s as vi,t as yi,u as bi}from"./usePluginsStore-Du4WlceO.js";import{t as xi}from"./MobileTabPageHeader-D6P4K98S.js";import{n as Si}from"./MobileSurface-cmaGf3hZ.js";import{t as Ci}from"./GuiPluginWindow-BkAFJyFd.js";import{c as wi,i as Ti,l as Ei,n as Di,o as Oi,s as ki,t as Ai}from"./pluginPresentation-DtyC8NF2.js";import{t as ji}from"./ModelSelector-EmtltPnd.js";import{t as Mi}from"./AgentSelector-uBoLtut8.js";import{i as Ni,n as Pi,r as Fi,t as Ii}from"./AssistantsSettingsPage-DD6spbXz.js";import{t as Li}from"./vendor-qrcode-D7jBCyl-.js";import{a as Ri,c as zi,d as Bi,f as Vi,i as Hi,l as Ui,m as Wi,n as Gi,o as Ki,r as qi,s as Ji,u as Yi}from"./ArchivedSessionsDialog-DZcicxVO.js";import{n as Xi,t as Zi}from"./vendor-yaml-C9KlJAlj.js";var Q=e(re(),1),Qi=me(),$i=`useCommandsStore`,ea=new Set([`init`,`review`]),ta=e=>ea.has(e.name),na=async(e,t)=>{await ze(be,e,t),r()===t&&Ot(`commands`,{source:$i})},ra=U()(ee(W(e=>({selectedCommandName:null,commandDraft:null,setSelectedCommand:t=>e({selectedCommandName:t}),setCommandDraft:t=>e({commandDraft:t}),loadCommands:async()=>{let e=ht(),t=r();try{return await ze(be,e,t),!0}catch{return!1}},createCommand:async t=>ia(`POST`,t.name,t,e),updateCommand:async(t,n)=>ia(`PATCH`,t,n,e),deleteCommand:async t=>ia(`DELETE`,t,void 0,e),getCommandByName:e=>gt().find(t=>t.name===e)}),{name:`commands-store`,storage:de(),partialize:e=>({selectedCommandName:e.selectedCommandName})}),{name:`commands-store`}));async function ia(e,t,n,i){let a=ht(),o=r();try{let s={};if(e===`POST`&&(s.template=n?.template||``,n?.description&&(s.description=n.description),n?.agent&&(s.agent=n.agent),n?.model&&(s.model=n.model),n?.scope&&(s.scope=n.scope)),e===`PATCH`)for(let e of[`description`,`agent`,`model`,`template`])n?.[e]!==void 0&&(s[e]=n[e]);let l=a?`?directory=${encodeURIComponent(a)}`:``,u=await c(`/api/config/commands/${encodeURIComponent(t)}${l}`,{method:e,headers:e===`DELETE`?a?{"x-opencode-directory":a}:void 0:{"Content-Type":`application/json`,...a?{"x-opencode-directory":a}:{}},...e===`DELETE`?{}:{body:JSON.stringify(s)}}),d=await u.json().catch(()=>null);if(!u.ok)throw Error(d?.error||`Failed to ${e.toLowerCase()} command`);return r()!==o||(await na(a,o),r()!==o)||e===`DELETE`&&i({selectedCommandName:null}),!0}catch(e){return console.error(`[CommandsStore] Command mutation failed:`,e),!1}}typeof window<`u`&&(window.__zustand_commands_store__=ra),nt(e=>{e.source!==$i&&Ve(e,`commands`)&&ra.getState().loadCommands()});var aa=()=>{let e=fe.getDirectory();if(typeof e==`string`&&e.trim().length>0)return e;try{let e=window.__zustand_directory_store__;if(e)return e.getState().currentDirectory}catch{}return null},oa=`useSkillsStore`,sa=e=>{if(e&&Object.prototype.hasOwnProperty.call(e,`directory`))return typeof e.directory==`string`&&e.directory.trim()||null;let t=aa();return typeof t==`string`&&t.trim()||null},ca=U()(ee(W((e,t)=>({selectedSkillName:null,skillDraft:null,setSelectedSkill:t=>{e({selectedSkillName:t})},setSkillDraft:t=>{e({skillDraft:t})},loadSkills:async()=>{try{return await dt(be,aa(),r()),!0}catch{return!1}},getSkillDetail:async e=>{try{let t=aa(),n=t?`?directory=${encodeURIComponent(t)}`:``,r=await c(`/api/config/skills/${encodeURIComponent(e)}${n}`);return r.ok?await r.json():null}catch{return null}},createSkill:async(e,t)=>{try{let n={name:e.name,description:e.description};e.instructions&&(n.instructions=e.instructions),e.scope&&(n.scope=e.scope),e.source&&(n.source=e.source),e.supportingFiles&&(n.supportingFiles=e.supportingFiles);let i=sa(t),a=r(),o=i?`?directory=${encodeURIComponent(i)}`:``,s=await c(`/api/config/skills/${encodeURIComponent(e.name)}${o}`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(n)}),l=await s.json().catch(()=>null);if(!s.ok){let e=l?.error||`Failed to create skill`;throw Error(e)}return await la({directory:i,transportIdentity:a}),!0}catch{return!1}},updateSkill:async(e,t,n)=>{try{let i={};t.description!==void 0&&(i.description=t.description),t.instructions!==void 0&&(i.instructions=t.instructions),t.supportingFiles!==void 0&&(i.supportingFiles=t.supportingFiles),t.targetPath!==void 0&&(i.targetPath=t.targetPath);let a=sa(n),o=r(),s=a?`?directory=${encodeURIComponent(a)}`:``,l=await c(`/api/config/skills/${encodeURIComponent(e)}${s}`,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify(i)}),u=await l.json().catch(()=>null);if(!l.ok){let e=u?.error||`Failed to update skill`;throw Error(e)}return await la({directory:a,transportIdentity:o}),!0}catch{return!1}},deleteSkill:async(n,i)=>{try{let a=sa(i),o=r(),s=a?`?directory=${encodeURIComponent(a)}`:``,l=await c(`/api/config/skills/${encodeURIComponent(n)}${s}`,{method:`DELETE`}),u=await l.json().catch(()=>null);if(!l.ok){let e=u?.error||`Failed to delete skill`;throw Error(e)}return await la({directory:a,transportIdentity:o}),r()===o&&t().selectedSkillName===n&&e({selectedSkillName:null}),!0}catch{return!1}},getSkillByName:e=>ct(be,aa()).find(t=>t.name===e),readSupportingFile:async(e,t)=>{try{let n=aa(),r=n?`&directory=${encodeURIComponent(n)}`:``,i=await c(`/api/config/skills/${encodeURIComponent(e)}/files/${encodeURIComponent(t)}?${r.slice(1)}`);return i.ok?(await i.json()).content??null:null}catch{return null}},writeSupportingFile:async(e,t,n)=>{try{let r=aa(),i=r?`?directory=${encodeURIComponent(r)}`:``;return(await c(`/api/config/skills/${encodeURIComponent(e)}/files/${encodeURIComponent(t)}${i}`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({content:n})})).ok}catch{return!1}},deleteSupportingFile:async(e,t)=>{try{let n=aa(),r=n?`?directory=${encodeURIComponent(n)}`:``;return(await c(`/api/config/skills/${encodeURIComponent(e)}/files/${encodeURIComponent(t)}${r}`,{method:`DELETE`})).ok}catch{return!1}}}),{name:`skills-store`,storage:de(),partialize:e=>({selectedSkillName:e.selectedSkillName})}),{name:`skills-store`}));typeof window<`u`&&(window.__zustand_skills_store__=ca);async function la(e){let t=e&&`directory`in e?e.directory?.trim()||null:aa(),n=e?.transportIdentity??r();r()===n&&(await dt(be,t,n),r()===n&&(await rt(be,t,n),r()===n&&Ot(`skills`,{source:oa})))}var ua=null;ua||=nt(e=>{if(e.source!==oa&&Ve(e,`skills`)){let e=aa(),t=r();dt(be,e,t).then(()=>rt(be,e,t)).catch(()=>void 0)}});var da=/^#[0-9a-fA-F]{6}$/,fa=/^\{file:.+\}$/i,pa=e=>[...e].sort((e,t)=>{let n=e.permission.localeCompare(t.permission);return n===0?e.pattern.localeCompare(t.pattern):n}),ma=(e,t)=>{let n=pa(e),r=pa(t);return n.length===r.length&&n.every((e,t)=>{let n=r[t];return e.permission===n.permission&&e.pattern===n.pattern&&e.action===n.action})},ha=(e,t)=>t?e.globalPermission!==t.globalPermission||!ma(e.permissionRules,t.permissionRules):!1,ga=e=>e===`bash`?`shell`:e===`task`?`subagent`:e===`write`||e===`patch`?`edit`:e,_a=(e,t)=>{let n=[{action:`*`,resource:`*`,effect:e}];for(let e of t)!e.permission||!e.pattern||(e.permission!==`*`||e.pattern!==`*`)&&n.push({action:ga(e.permission),resource:e.pattern,effect:e.action});return n},va=e=>{let t=e.trim();return t===``?null:t},ya=({isNewAgent:e,agentName:t,draftScope:n,initialScope:r,draftHasExplicitPermission:i,current:a,initial:o,confirmDrop:s})=>{let c=_a(a.globalPermission,a.permissionRules);if(e){let e=a.description.trim(),r=va(a.model),l=a.system.trim(),u=ha(a,o)||i;return{name:t,mode:a.mode,...e?{description:e}:{},...r?{model:r}:{},...l?{system:l}:{},...u?{permissions:c}:{},...n?{scope:n}:{},...s?{confirmDrop:!0}:{}}}let l={name:t,...s?{confirmDrop:!0}:{}};return o?(a.description!==o.description&&(l.description=a.description.trim()||null),a.mode!==o.mode&&(l.mode=a.mode),a.model!==o.model&&(l.model=va(a.model)),a.system!==o.system&&(l.system=a.system.trim()||null),ha(a,o)&&(l.permissions=c),n&&r&&n!==r&&(l.scope=n),l):l},ba=e=>{if(e){if(typeof e.prompt==`string`)return fa.test(e.prompt.trim())?void 0:e.prompt;if(typeof e.system==`string`)return e.system}},xa=e=>{let t=e?.model?.providerID,n=e?.model?.modelID||e?.model?.id;if(!t||!n)return``;let r=e?.model?.variant||e?.variant;return r?`${t}/${n}#${r}`:`${t}/${n}`},Sa=e=>{let t=e.trim(),n=t.indexOf(`/`);if(n<=0||n>=t.length-1)return null;let r=t.slice(0,n),i=t.slice(n+1),a=i.indexOf(`#`);return a===-1?{providerId:r,modelId:i,variant:``}:{providerId:r,modelId:i.slice(0,a),variant:i.slice(a+1)}},Ca=e=>da.test(e.trim()),wa=e=>{let t=e.trim();return t&&t.charAt(0).toUpperCase()+t.slice(1)},$=ne(),Ta=e=>{let t=(0,Qi.c)(37),{className:n}=e,{t:r}=At(),i=Je(Ea),a=Je(Da),o=Je(Oa),s=h(),c;t[0]===i?c=t[1]:(c=[...i].sort(ka),t[0]=i,t[1]=c);let l=c,u;bb0:{if(l.length===0){u=null;break bb0}let e;t[2]!==a||t[3]!==l?(e=l.find(e=>e.id===a)??l[0],t[2]=a,t[3]=l,t[4]=e):e=t[4],u=e}let d=u;if(s||l.length===0)return null;let f;t[5]!==d?.path||t[6]!==r?(f=d?.path.split(`/`).filter(Boolean).pop()||d?.path||r(`settings.shared.projectSelector.fallbackProject`),t[5]=d?.path,t[6]=r,t[7]=f):f=t[7];let p=f,m;t[8]===n?m=t[9]:(m=J(n),t[8]=n,t[9]=m);let g;t[10]===r?g=t[11]:(g=r(`settings.shared.projectSelector.switchProjectAria`),t[10]=r,t[11]=g);let _;t[12]===r?_=t[13]:(_=r(`settings.shared.projectSelector.switchProjectTitle`),t[12]=r,t[13]=_);let v,y;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(v=J(`yuri-settings-sidebar-picker text-foreground appearance-none flex h-8 w-full min-w-0 rounded-lg px-3 py-1`,`flex items-center gap-1.5 text-left`),y=(0,$.jsx)(Y,{name:`folder`,className:`h-4 w-4 text-muted-foreground`}),t[14]=v,t[15]=y):(v=t[14],y=t[15]);let b;t[16]===p?b=t[17]:(b=(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate typography-ui-label font-medium`,children:p}),t[16]=p,t[17]=b);let x;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,$.jsx)(Y,{name:`arrow-down-s`,className:`size-4 opacity-50`}),t[18]=x):x=t[18];let S;t[19]!==g||t[20]!==_||t[21]!==b?(S=(0,$.jsx)(qt,{asChild:!0,children:(0,$.jsxs)(`button`,{type:`button`,"aria-label":g,title:_,className:v,children:[y,b,x]})}),t[19]=g,t[20]=_,t[21]=b,t[22]=S):S=t[22];let C=d?.id??``,w;t[23]===o?w=t[24]:(w=e=>{e&&o(e)},t[23]=o,t[24]=w);let T;t[25]===l?T=t[26]:(T=l.map(Aa),t[25]=l,t[26]=T);let E;t[27]!==C||t[28]!==w||t[29]!==T?(E=(0,$.jsx)(Jt,{align:`start`,className:`w-auto`,children:(0,$.jsx)(Z,{value:C,onValueChange:w,children:T})}),t[27]=C,t[28]=w,t[29]=T,t[30]=E):E=t[30];let D;t[31]!==S||t[32]!==E?(D=(0,$.jsxs)(Zt,{children:[S,E]}),t[31]=S,t[32]=E,t[33]=D):D=t[33];let O;return t[34]!==D||t[35]!==m?(O=(0,$.jsx)(`div`,{className:m,children:D}),t[34]=D,t[35]=m,t[36]=O):O=t[36],O};function Ea(e){return e.projects}function Da(e){return e.activeProjectId}function Oa(e){return e.setActiveProject}function ka(e,t){return(e.label||e.path).localeCompare(t.label||t.path)}function Aa(e){let t=e.path.split(`/`).filter(Boolean).pop()||e.path;return(0,$.jsx)(Yt,{value:e.id,children:(0,$.jsx)(`span`,{className:`min-w-0 truncate typography-ui`,children:t})},e.id)}function ja(e,t){return`opencode:sidebar-group:${e}:${t}`}var Ma=e=>{let t=(0,Qi.c)(57),{label:n,count:r,storageKey:i,defaultExpanded:a,variant:o,labelPrefix:s,children:c}=e,l=a===void 0||a,u=o===void 0?`sidebar`:o,d;t[0]!==n||t[1]!==i?(d=ja(i,n),t[0]=n,t[1]=i,t[2]=d):d=t[2];let f=d,p=Q.useId(),m;t[3]!==l||t[4]!==f?(m=()=>{try{let e=localStorage.getItem(f);if(e!==null)return e===`true`}catch{}return l},t[3]=l,t[4]=f,t[5]=m):m=t[5];let[h,g]=(0,Q.useState)(m),_,v;if(t[6]!==h||t[7]!==f?(_=()=>{try{localStorage.setItem(f,String(h))}catch{}},v=[f,h],t[6]=h,t[7]=f,t[8]=_,t[9]=v):(_=t[8],v=t[9]),(0,Q.useEffect)(_,v),u===`settings-card`){let e;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(e=()=>g(Na),t[10]=e):e=t[10];let i;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(i=J(`flex w-full items-center gap-1 text-left`,`text-inherit transition-colors duration-150 hover:text-foreground`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/50`),t[11]=i):i=t[11];let a=!h&&`-rotate-90`,o;t[12]===a?o=t[13]:(o=J(`h-3.5 w-3.5 flex-shrink-0 transition-transform duration-200`,a),t[12]=a,t[13]=o);let l;t[14]===o?l=t[15]:(l=(0,$.jsx)(Y,{name:`arrow-down-s`,className:o}),t[14]=o,t[15]=l);let u=s?`${s} · `:``,d;t[16]!==n||t[17]!==u?(d=(0,$.jsxs)(`span`,{className:`min-w-0 flex-1 truncate`,children:[u,n]}),t[16]=n,t[17]=u,t[18]=d):d=t[18];let f;t[19]===r?f=t[20]:(f=(0,$.jsx)(`span`,{className:`ml-1 tabular-nums opacity-60`,children:r}),t[19]=r,t[20]=f);let m;t[21]!==p||t[22]!==h||t[23]!==l||t[24]!==d||t[25]!==f?(m=(0,$.jsxs)(`button`,{type:`button`,onClick:e,"aria-expanded":h,"aria-controls":p,className:i,children:[l,d,f]}),t[21]=p,t[22]=h,t[23]=l,t[24]=d,t[25]=f,t[26]=m):m=t[26];let _=!h&&`hidden`,v;t[27]===_?v=t[28]:(v=J(_),t[27]=_,t[28]=v);let y;return t[29]!==c||t[30]!==p||t[31]!==m||t[32]!==v?(y=(0,$.jsx)(ni,{label:m,cardClassName:v,cardId:p,children:c}),t[29]=c,t[30]=p,t[31]=m,t[32]=v,t[33]=y):y=t[33],y}let y;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(y=()=>g(Pa),t[34]=y):y=t[34];let b;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(b=J(`flex w-full items-center gap-1 rounded-md px-2 py-1 text-left`,`text-xs font-semibold uppercase tracking-wide text-muted-foreground`,`hover:bg-[var(--interactive-hover)] transition-colors duration-150`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/50`),t[35]=b):b=t[35];let x=!h&&`-rotate-90`,S;t[36]===x?S=t[37]:(S=J(`h-3.5 w-3.5 flex-shrink-0 transition-transform duration-200`,x),t[36]=x,t[37]=S);let C;t[38]===S?C=t[39]:(C=(0,$.jsx)(Y,{name:`arrow-down-s`,className:S}),t[38]=S,t[39]=C);let w;t[40]===n?w=t[41]:(w=(0,$.jsx)(`span`,{className:`flex-1 truncate`,children:n}),t[40]=n,t[41]=w);let T;t[42]===r?T=t[43]:(T=(0,$.jsx)(`span`,{className:`ml-1 tabular-nums opacity-60`,children:r}),t[42]=r,t[43]=T);let E;t[44]!==p||t[45]!==h||t[46]!==C||t[47]!==w||t[48]!==T?(E=(0,$.jsxs)(`button`,{type:`button`,onClick:y,"aria-expanded":h,"aria-controls":p,className:b,children:[C,w,T]}),t[44]=p,t[45]=h,t[46]=C,t[47]=w,t[48]=T,t[49]=E):E=t[49];let D=!h,O;t[50]!==c||t[51]!==p||t[52]!==D?(O=(0,$.jsx)(`div`,{id:p,hidden:D,className:`mt-0.5 space-y-0.5 ml-2 pl-3 border-l-2 border-[var(--interactive-border)]`,children:c}),t[50]=c,t[51]=p,t[52]=D,t[53]=O):O=t[53];let k;return t[54]!==E||t[55]!==O?(k=(0,$.jsxs)(`div`,{children:[E,O]}),t[54]=E,t[55]=O,t[56]=k):k=t[56],k};function Na(e){return!e}function Pa(e){return!e}var Fa=e=>e===`bash`?`shell`:e===`task`?`subagent`:e===`write`||e===`patch`?`edit`:e,Ia=e=>{let t=gr(e).map(e=>({action:Fa(e.action),resource:e.resource,effect:e.effect}));return t.length>0?t:void 0},La=(e,t)=>{let n=e,r=mt(e)?void 0:typeof n.system==`string`?n.system:typeof e.prompt==`string`?e.prompt:void 0,i=typeof n.color==`string`&&Ca(n.color)?n.color:void 0;return{name:t,scope:n.scope||`user`,description:e.description,model:xa(e)||null,...r?{system:r}:{},mode:e.mode,...typeof n.steps==`number`?{steps:n.steps}:{},...e.hidden===!0?{hidden:!0}:{},...n.disabledOverride?{disabled:!0}:{},...i?{color:i}:{},permissions:Ia(n.permissions??e.permission)}},Ra=({onItemSelect:e})=>{let{t}=At(),[n,r]=Q.useState(null),[i,a]=Q.useState(``),[o,s]=Q.useState(null),[c,l]=Q.useState(null),[u,d]=Q.useState(!1),[f,p]=Q.useState(null),{selectedAgentName:m,setSelectedAgent:h,setAgentDraft:g,createAgent:_,deleteAgent:v,loadAgents:y}=_t(te(e=>({selectedAgentName:e.selectedAgentName,setSelectedAgent:e.setSelectedAgent,setAgentDraft:e.setAgentDraft,createAgent:e.createAgent,deleteAgent:e.deleteAgent,loadAgents:e.loadAgents}))),{data:b=[]}=Tt();Q.useEffect(()=>{y()},[y]);let x=()=>{let t=`new-agent`,n=t,r=1;for(;b.some(e=>e.name===n);)n=`${t}-${r}`,r++;g({name:n,scope:`user`}),h(n),e?.()},S=async e=>{if(mt(e)){X.error(t(`settings.agents.sidebar.toast.builtInCannotDelete`));return}s(e),l(`delete`)},C=async e=>{mt(e)&&(s(e),l(`reset`))},w=()=>{s(null),l(null)},T=async()=>{if(!(!o||!c)){d(!0);try{let e=await v(o.name,o.scope);e.ok?(e.requiresManualRestart?X.warning(t(`settings.agents.page.toast.savedManualRestart`)):c===`delete`?X.success(t(`settings.agents.sidebar.toast.agentDeleted`,{name:o.name})):X.success(t(`settings.agents.sidebar.toast.agentReset`,{name:o.name})),w()):c===`delete`?X.error(t(`settings.agents.sidebar.toast.deleteFailed`)):X.error(t(`settings.agents.sidebar.toast.resetFailed`))}catch(e){let n=e instanceof Error?e.message:``,r=/built-in|not deletable|not found/i.test(n);c===`delete`?X.error(t(r?`settings.agents.sidebar.toast.definitionNotFound`:`settings.agents.sidebar.toast.deleteFailed`)):X.error(t(`settings.agents.sidebar.toast.resetFailed`))}d(!1)}},E=e=>{let t=e.name,n=1,r=`${t}-copy`;for(;b.some(e=>e.name===r);)n++,r=`${t}-copy-${n}`;g(La(e,r)),h(r)},D=e=>{a(e.name),r(e)},O=async()=>{if(!n)return;let e=i.trim().replace(/\s+/g,`-`);if(!e){X.error(t(`settings.agents.sidebar.toast.agentNameRequired`));return}if(e===n.name){r(null);return}if(b.some(t=>t.name===e)){X.error(t(`settings.agents.sidebar.toast.agentExists`));return}let a=n,o=await _({...La(n,e),scope:a.scope});if(o.ok){let r=await v(n.name,a.scope);r.ok?(o.requiresManualRestart||r.requiresManualRestart?X.warning(t(`settings.agents.page.toast.savedManualRestart`)):X.success(t(`settings.agents.sidebar.toast.agentRenamed`,{name:e})),h(e)):X.error(t(`settings.agents.sidebar.toast.removeOldAfterRenameFailed`))}else X.error(t(`settings.agents.sidebar.toast.renameFailed`));r(null)},k=e=>{switch(e){case`primary`:return(0,$.jsx)(Y,{name:`ai-agent`,className:`h-3 w-3 text-primary`});case`all`:return(0,$.jsx)(Y,{name:`ai-agent-fill`,className:`h-3 w-3 text-primary`});case`subagent`:return(0,$.jsx)(Y,{name:`robot`,className:`h-3 w-3 text-primary`});default:return null}},A=b.filter(e=>{let t=e;return!at(e)||!!t.scope||t.disabledOverride===!0}),j=A.filter(mt),M=A.filter(e=>!mt(e)),{groupedCustomAgents:N,ungroupedCustomAgents:P}=(0,Q.useMemo)(()=>{let e={},t=[];for(let n of M){let r=n;r.group?(e[r.group]||(e[r.group]=[]),e[r.group].push(n)):t.push(n)}return{groupedCustomAgents:Object.keys(e).sort((e,t)=>e.localeCompare(t)).map(t=>({name:t,agents:e[t]})),ungroupedCustomAgents:t}},[M]),F=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,$.jsx)(`span`,{children:t(`settings.agents.sidebar.section.custom`)}),(0,$.jsx)(q,{"data-settings-item":`agents.create`,size:`icon`,variant:`ghost`,onClick:x,"aria-label":t(`settings.agents.page.title.new`),children:(0,$.jsx)(Y,{name:`add`,className:`h-4 w-4`})})]});return(0,$.jsxs)(`div`,{className:`yuri-settings-page-content h-full overflow-y-auto bg-background p-3`,children:[(0,$.jsx)(Ta,{}),(0,$.jsx)($.Fragment,{children:A.length===0?(0,$.jsx)(ni,{children:(0,$.jsxs)(`div`,{className:`yuri-settings-group-row py-12 text-center text-muted-foreground`,children:[(0,$.jsx)(Y,{name:`robot-2`,className:`mx-auto mb-3 h-10 w-10 opacity-50`}),(0,$.jsx)(`p`,{className:`typography-ui-label font-medium`,children:t(`settings.agents.sidebar.empty.title`)}),(0,$.jsx)(`p`,{className:`typography-meta mt-1 opacity-75`,children:t(`settings.agents.sidebar.empty.description`)})]})}):(0,$.jsxs)($.Fragment,{children:[j.length>0&&(0,$.jsx)(ni,{label:t(`settings.agents.sidebar.section.builtIn`),children:j.map(t=>(0,$.jsx)(za,{agent:t,isSelected:m===t.name,onSelect:()=>{h(t.name),e?.()},onReset:()=>C(t),onDuplicate:()=>E(t),getAgentModeIcon:k,isMenuOpen:f===t.name,onMenuOpenChange:e=>p(e?t.name:null)},t.name))}),M.length>0&&(0,$.jsxs)($.Fragment,{children:[N.map(({name:n,agents:r})=>(0,$.jsx)(Ma,{label:n,count:r.length,storageKey:`agents`,variant:`settings-card`,labelPrefix:t(`settings.agents.sidebar.section.custom`),children:r.map(t=>(0,$.jsx)(za,{agent:t,isSelected:m===t.name,onSelect:()=>{h(t.name),e?.()},onRename:()=>D(t),onDelete:()=>S(t),onDuplicate:()=>E(t),getAgentModeIcon:k,isMenuOpen:f===t.name,onMenuOpenChange:e=>p(e?t.name:null)},t.name))},n)),P.length>0?(0,$.jsx)(ni,{label:F,children:P.map(t=>(0,$.jsx)(za,{agent:t,isSelected:m===t.name,onSelect:()=>{h(t.name),e?.()},onRename:()=>D(t),onDelete:()=>S(t),onDuplicate:()=>E(t),getAgentModeIcon:k,isMenuOpen:f===t.name,onMenuOpenChange:e=>p(e?t.name:null)},t.name))}):(0,$.jsx)(ni,{label:F,cardClassName:`hidden`,children:(0,$.jsx)(`span`,{})})]}),M.length===0&&(0,$.jsx)(ni,{label:F,cardClassName:`hidden`,children:(0,$.jsx)(`span`,{})})]})}),(0,$.jsx)(zt,{open:o!==null&&c!==null,onOpenChange:e=>{!e&&!u&&w()},children:(0,$.jsxs)(It,{className:`max-w-md`,children:[(0,$.jsxs)(Pt,{children:[(0,$.jsx)(Lt,{children:t(c===`delete`?`settings.agents.sidebar.dialog.deleteTitle`:`settings.agents.sidebar.dialog.resetTitle`)}),(0,$.jsx)(Rt,{children:t(c===`delete`?`settings.agents.sidebar.dialog.deleteDescription`:`settings.agents.sidebar.dialog.resetDescription`,{name:o?.name??``})})]}),(0,$.jsxs)(Ft,{children:[(0,$.jsx)(q,{size:`sm`,variant:`ghost`,onClick:w,disabled:u,children:t(`settings.common.actions.cancel`)}),(0,$.jsx)(q,{size:`sm`,onClick:T,disabled:u,children:t(c===`delete`?`settings.common.actions.delete`:`settings.common.actions.reset`)})]})]})}),(0,$.jsx)(zt,{open:n!==null,onOpenChange:e=>!e&&r(null),children:(0,$.jsxs)(It,{children:[(0,$.jsxs)(Pt,{children:[(0,$.jsx)(Lt,{children:t(`settings.agents.sidebar.renameDialog.title`)}),(0,$.jsx)(Rt,{children:t(`settings.agents.sidebar.renameDialog.description`,{name:n?.name??``})})]}),(0,$.jsx)(yn,{value:i,onChange:e=>a(e.target.value),placeholder:t(`settings.agents.sidebar.renameDialog.placeholder`),className:`text-foreground placeholder:text-muted-foreground`,onKeyDown:e=>{e.key===`Enter`&&O()}}),(0,$.jsxs)(Ft,{children:[(0,$.jsx)(q,{size:`sm`,variant:`ghost`,onClick:()=>r(null),children:t(`settings.common.actions.cancel`)}),(0,$.jsx)(q,{size:`sm`,onClick:O,children:t(`settings.common.actions.rename`)})]})]})})]})},za=e=>{let t=(0,Qi.c)(55),{agent:n,isSelected:r,onSelect:i,onDelete:a,onReset:o,onRename:s,onDuplicate:c,getAgentModeIcon:l,isMenuOpen:u,onMenuOpenChange:d}=e,{t:f}=At(),p=n,m;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(m=Gt(),t[0]=m):m=t[0];let h=m,[g,_]=Q.useState(!1),v;t[1]!==a||t[2]!==c||t[3]!==s||t[4]!==o||t[5]!==f?(v=e=>(0,$.jsxs)($.Fragment,{children:[s&&(0,$.jsxs)(e,{onClick:e=>{e.stopPropagation(),s()},children:[(0,$.jsx)(Y,{name:`edit`,className:`h-4 w-4 mr-px`}),f(`settings.common.actions.rename`)]}),(0,$.jsxs)(e,{onClick:e=>{e.stopPropagation(),c()},children:[(0,$.jsx)(Y,{name:`file-copy`,className:`h-4 w-4 mr-px`}),f(`settings.common.actions.duplicate`)]}),o&&(0,$.jsxs)(e,{onClick:e=>{e.stopPropagation(),o()},children:[(0,$.jsx)(Y,{name:`restart`,className:`h-4 w-4 mr-px`}),f(`settings.common.actions.reset`)]}),a&&(0,$.jsxs)(e,{onClick:e=>{e.stopPropagation(),a()},className:`text-destructive focus:text-destructive`,children:[(0,$.jsx)(Y,{name:`delete-bin`,className:`h-4 w-4 mr-px text-inherit`}),f(`settings.common.actions.delete`)]})]}),t[1]=a,t[2]=c,t[3]=s,t[4]=o,t[5]=f,t[6]=v):v=t[6];let y=v,b=r?`bg-interactive-selection`:`hover:bg-interactive-hover`,x;t[7]===b?x=t[8]:(x=J(`yuri-settings-group-row group relative flex items-center transition-colors duration-150 select-none`,b),t[7]=b,t[8]=x);let S;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(S=h?void 0:e=>{e.preventDefault(),_(!0)},t[9]=S):S=t[9];let C;t[10]===x?C=t[11]:(C=(0,$.jsx)(`div`,{className:x,onContextMenu:S}),t[10]=x,t[11]=C);let w;t[12]===n.name?w=t[13]:(w=wa(n.name),t[12]=n.name,t[13]=w);let T;t[14]===w?T=t[15]:(T=(0,$.jsx)(`span`,{className:`typography-ui-label font-normal truncate text-foreground`,children:w}),t[14]=w,t[15]=T);let E;t[16]!==n.mode||t[17]!==l?(E=l(n.mode),t[16]=n.mode,t[17]=l,t[18]=E):E=t[18];let D;t[19]!==n||t[20]!==p.disabledOverride||t[21]!==p.scope||t[22]!==f?(D=(p.scope||mt(n)||p.disabledOverride)&&(0,$.jsx)(`span`,{className:`typography-micro text-muted-foreground bg-muted px-1 rounded flex-shrink-0 leading-none pb-px border border-border/50`,children:p.disabledOverride?f(`settings.agents.sidebar.badge.disabled`):mt(n)?f(`settings.agents.sidebar.badge.system`):p.scope===`project`?f(`settings.common.scope.project`):f(`settings.common.scope.global`)}),t[19]=n,t[20]=p.disabledOverride,t[21]=p.scope,t[22]=f,t[23]=D):D=t[23];let O;t[24]!==D||t[25]!==T||t[26]!==E?(O=(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[T,E,D]}),t[24]=D,t[25]=T,t[26]=E,t[27]=O):O=t[27];let k;t[28]===n.description?k=t[29]:(k=n.description&&(0,$.jsx)(`div`,{className:`typography-micro text-muted-foreground/60 truncate leading-tight`,children:n.description}),t[28]=n.description,t[29]=k);let A;t[30]!==i||t[31]!==O||t[32]!==k?(A=(0,$.jsxs)(`button`,{onClick:i,className:`flex min-w-0 flex-1 flex-col gap-0 rounded-sm text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/50`,tabIndex:0,children:[O,k]}),t[30]=i,t[31]=O,t[32]=k,t[33]=A):A=t[33];let j;t[34]===d?j=t[35]:(j=e=>{e&&_(!1),d(e)},t[34]=d,t[35]=j);let M;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,$.jsx)(qt,{asChild:!0,children:(0,$.jsx)(q,{size:`sm`,variant:`ghost`,className:`h-6 w-6 px-0 flex-shrink-0 -mr-1 opacity-100 transition-opacity md:opacity-0 md:group-hover:opacity-100`,children:(0,$.jsx)(Y,{name:`more-2`,className:`h-3.5 w-3.5`})})}),t[36]=M):M=t[36];let N;t[37]===y?N=t[38]:(N=(0,$.jsx)(Jt,{align:`end`,className:`w-fit min-w-20`,children:y(Xt)}),t[37]=y,t[38]=N);let P;t[39]!==u||t[40]!==j||t[41]!==N?(P=(0,$.jsxs)(Zt,{open:u,onOpenChange:j,children:[M,N]}),t[39]=u,t[40]=j,t[41]=N,t[42]=P):P=t[42];let F;t[43]!==A||t[44]!==P?(F=(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center`,children:[A,P]}),t[43]=A,t[44]=P,t[45]=F):F=t[45];let I;t[46]!==F||t[47]!==C?(I=(0,$.jsx)(Qt,{render:C,children:F}),t[46]=F,t[47]=C,t[48]=I):I=t[48];let L;t[49]===y?L=t[50]:(L=(0,$.jsx)($t,{className:`w-fit min-w-20`,children:y(en)}),t[49]=y,t[50]=L);let R;return t[51]!==g||t[52]!==I||t[53]!==L?(R=(0,$.jsxs)(tn,{open:g,onOpenChange:_,children:[I,L]}),t[51]=g,t[52]=I,t[53]=L,t[54]=R):R=t[54],R};function Ba(e){return!!e&&typeof e==`object`&&!Array.isArray(e)}function Va(e){return typeof e==`string`&&e.length>0?e:void 0}function Ha(e){let t=Ba(e)?e:null,n=t&&Array.isArray(t.data)?t.data:Array.isArray(e)?e:null;if(!n)throw Error(`permission saved: expected list payload`);return n.map(e=>{if(!Ba(e))throw Error(`permission saved: invalid rule`);let t=Va(e.id),n=Va(e.projectID),r=Va(e.action),i=Va(e.resource);if(!t||!n||!r||!i)throw Error(`permission saved: invalid rule`);return{id:t,projectID:n,action:r,resource:i}})}async function Ua(e,t){if(!e.trim())throw Error(`permission saved: directory required`);t?.throwIfAborted();let n=await fe.getApiClient().location.get({location:{directory:e}},{signal:t});t?.throwIfAborted();let r=Va(n?.project?.id);if(!r)throw Error(`permission saved: project ID required`);return r}async function Wa(e){e.signal?.throwIfAborted();let t=await fe.getApiClient().permission.saved.list({projectID:e.projectID??void 0},{signal:e.signal});e.signal?.throwIfAborted();let n=Ha(t);if(e.projectID&&n.some(t=>t.projectID!==e.projectID))throw Error(`permission saved: project mismatch`);return n}async function Ga(e){e.signal?.throwIfAborted(),await fe.getApiClient().permission.saved.remove({id:e.id},{signal:e.signal})}function Ka(e){if(e.entry?.sdk(),e.transport!==r()||e.generation!==a())throw Error(`Saved permission runtime changed`)}var qa=e=>_e({queryKey:[e.transport,e.generation,`saved-permission-project`,e.directory,...e.entry?e.entry.queryScope:[]],queryFn:async({signal:t})=>{Ka(e);let n=e.entry?(await e.entry.sdk().location.get({location:{directory:e.directory}},{signal:t})).project?.id:await Ua(e.directory,t);if(Ka(e),!n)throw Error(`Saved permission project ID required`);return n},retry:!1}),Ja=e=>_e({queryKey:[e.transport,e.generation,`saved-permissions`,e.directory,e.projectID,...e.entry?e.entry.queryScope:[]],queryFn:async({signal:t})=>{if(Ka(e),!e.directory||!e.projectID)throw Error(`Saved permission scope required`);let n=e.entry?Ha(await e.entry.sdk().permission.saved.list({projectID:e.projectID},{signal:t})):await Wa({projectID:e.projectID,signal:t});if(Ka(e),n.some(t=>t.projectID!==e.projectID))throw Error(`Saved permission project mismatch`);return n},retry:!1});function Ya(e){let t=(0,Qi.c)(3),i=xe(),o=(0,Q.useSyncExternalStore)(n,a,a),s={transport:r(),generation:o,directory:i?.entry.location.directory??e.trim(),entry:i?.entry},c=ve({...qa(s),enabled:!!s.directory}),l={...s,projectID:c.data??``},u=Ja(l),d=!!(s.directory&&c.data)&&!c.isError,f;return t[0]!==u||t[1]!==d?(f={...u,enabled:d},t[0]=u,t[1]=d,t[2]=f):f=t[2],{project:c,list:ve(f),scope:l}}async function Xa(e,t,n){Ka(t);let i=Ja(t).queryKey;if(!e.getQueryData(i)?.some(e=>e.id===n&&e.projectID===t.projectID))throw Error(`Saved permission is outside the captured scope`);t.entry?await t.entry.sdk().permission.saved.remove({id:n}):await Ga({id:n}),t.entry&&Ka(t),t.transport===r()&&t.generation===a()&&(await e.cancelQueries({queryKey:i,exact:!0}),t.entry&&Ka(t),t.transport===r()&&t.generation===a()&&e.setQueryData(i,e=>e?.filter(e=>e.id!==n)))}var Za=()=>{let e=(0,Qi.c)(49),{t}=At(),n=se(Qa),r=ye(),{project:i,list:a,scope:o}=Ya(n),s;e[0]===r?s=e[1]:(s={mutationFn:e=>{let{scope:t,id:n}=e;return Xa(r,t,n)}},e[0]=r,e[1]=s);let c=ge(s),l;e[2]!==c.variables||e[3]!==o?(l=c.variables&&JSON.stringify(c.variables.scope)===JSON.stringify(o),e[2]=c.variables,e[3]=o,e[4]=l):l=e[4];let u=l,d=i.isError||a.isError,f=!!o.directory&&(i.isPending||a.isPending)&&!d,p;e[5]===a.data?p=e[6]:(p=a.data??[],e[5]=a.data,e[6]=p);let m=p,h;e[7]!==c||e[8]!==o?(h=e=>c.mutate({scope:o,id:e}),e[7]=c,e[8]=o,e[9]=h):h=e[9];let g=Te(h),_;e[10]!==a||e[11]!==i?(_=()=>{i.isError?i.refetch():a.refetch()},e[10]=a,e[11]=i,e[12]=_):_=e[12];let v=Te(_);if(!d&&!f&&m.length===0)return null;let y;e[13]===t?y=e[14]:(y=t(`settings.permissions.saved.title`),e[13]=t,e[14]=y);let b;e[15]!==f||e[16]!==t?(b=f?t(`common.loading`):void 0,e[15]=f,e[16]=t,e[17]=b):b=e[17];let x;e[18]!==d||e[19]!==a.isFetching||e[20]!==i.isFetching||e[21]!==v||e[22]!==t?(x=d&&(0,$.jsx)(ii,{label:(0,$.jsx)(`span`,{role:`alert`,children:t(`settings.permissions.saved.loadFailed`)}),children:(0,$.jsx)(q,{type:`button`,variant:`ghost`,size:`xs`,onClick:v,disabled:i.isFetching||a.isFetching,children:t(`settings.permissions.saved.retry`)})}),e[18]=d,e[19]=a.isFetching,e[20]=i.isFetching,e[21]=v,e[22]=t,e[23]=x):x=e[23];let S;e[24]!==c.isError||e[25]!==u||e[26]!==t?(S=u&&c.isError&&(0,$.jsx)(ii,{label:(0,$.jsx)(`span`,{role:`alert`,children:t(`settings.permissions.saved.deleteFailed`)}),children:null}),e[24]=c.isError,e[25]=u,e[26]=t,e[27]=S):S=e[27];let C;if(e[28]!==c.isPending||e[29]!==d||e[30]!==g||e[31]!==m||e[32]!==f||e[33]!==u||e[34]!==t){let n;e[36]!==c.isPending||e[37]!==d||e[38]!==g||e[39]!==f||e[40]!==u||e[41]!==t?(n=e=>(0,$.jsx)(ii,{label:(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`span`,{children:e.action}),(0,$.jsx)(`span`,{className:`typography-micro text-muted-foreground font-mono`,children:e.resource})]}),children:(0,$.jsx)(q,{type:`button`,variant:`ghost`,size:`xs`,disabled:d||f||!!(u&&c.isPending),onClick:()=>void g(e.id),children:t(`settings.permissions.saved.delete`)})},e.id),e[36]=c.isPending,e[37]=d,e[38]=g,e[39]=f,e[40]=u,e[41]=t,e[42]=n):n=e[42],C=m.map(n),e[28]=c.isPending,e[29]=d,e[30]=g,e[31]=m,e[32]=f,e[33]=u,e[34]=t,e[35]=C}else C=e[35];let w;return e[43]!==y||e[44]!==b||e[45]!==x||e[46]!==S||e[47]!==C?(w=(0,$.jsx)(`div`,{"data-settings-item":`permissions.saved`,className:`mb-6`,children:(0,$.jsxs)(ni,{label:y,description:b,children:[x,S,C]})}),e[43]=y,e[44]=b,e[45]=x,e[46]=S,e[47]=C,e[48]=w):w=e[48],w};function Qa(e){return e.currentDirectory}var $a=[`*`,`read`,`edit`,`glob`,`grep`,`shell`,`subagent`,`skill`,`webfetch`,`websearch`,`question`,`external_directory`,`execute`,`browser`],eo={"*":`settings.agents.page.permissions.defaultLabel`,shell:`settings.agents.page.permissions.shell`,bash:`settings.agents.page.permissions.shell`,subagent:`settings.agents.page.permissions.subagent`,task:`settings.agents.page.permissions.subagent`,edit:`settings.agents.page.permissions.edit`,write:`settings.agents.page.permissions.edit`,patch:`settings.agents.page.permissions.edit`,apply_patch:`settings.agents.page.permissions.edit`,multiedit:`settings.agents.page.permissions.edit`,external_directory:`settings.agents.page.permissions.externalDirectory`,question:`settings.agents.page.permissions.question`,read:`settings.agents.page.permissions.read`,glob:`settings.agents.page.permissions.glob`,grep:`settings.agents.page.permissions.grep`,skill:`settings.agents.page.permissions.skill`,webfetch:`settings.agents.page.permissions.webfetch`,websearch:`settings.agents.page.permissions.websearch`,execute:`settings.agents.page.permissions.execute`,browser:`settings.agents.page.permissions.browser`,session_rename:`chat.tools.display.session_rename`,session_move:`chat.tools.display.session_move`},to=e=>e===`allow`||e===`ask`||e===`deny`,no=(e,t)=>`${e}::${t}`,ro=e=>e===`bash`?`shell`:e===`task`?`subagent`:e===`write`||e===`patch`?`edit`:e,io=e=>{let t=new Map;for(let n of e){let e=ro(n.permission);!e||e===`invalid`||n.pattern&&to(n.action)&&t.set(no(e,n.pattern),{permission:e,pattern:n.pattern,action:n.action})}return Array.from(t.values())},ao=e=>{let t=new Map;for(let n of io(e))t.set(no(n.permission,n.pattern),n);return t},oo=e=>[...e].sort((e,t)=>{let n=e.permission.localeCompare(t.permission);return n===0?e.pattern.localeCompare(t.pattern):n}),so=(e,t)=>{let n=oo(io(e)),r=oo(io(t));return n.length===r.length&&n.every((e,t)=>{let n=r[t];return e.permission===n.permission&&e.pattern===n.pattern&&e.action===n.action})},co=e=>e.find(e=>e.permission===`*`&&e.pattern===`*`)?.action??`allow`,lo=(e,t)=>io(e).filter(e=>e.permission!==`*`||e.pattern!==`*`).filter(e=>e.pattern!==`*`||e.action!==t),uo=e=>{if(Array.isArray(e))return io(e.flatMap(e=>!e||typeof e!=`object`||typeof e.action!=`string`||typeof e.resource!=`string`||!to(e.effect)?[]:[{permission:e.action,pattern:e.resource,action:e.effect}]));if(to(e))return[{permission:`*`,pattern:`*`,action:e}];if(!e||typeof e!=`object`||Array.isArray(e))return[];let t=[];for(let[n,r]of Object.entries(e))if(n!==`__originalKeys`){if(to(r)){t.push({permission:n,pattern:`*`,action:r});continue}if(r&&typeof r==`object`&&!Array.isArray(r))for(let[e,i]of Object.entries(r))to(i)&&t.push({permission:n,pattern:e,action:i})}return t},fo=()=>{let{t:e}=At(),{selectedAgentName:t,getAgentByName:n,createAgent:r,updateAgent:i,agentDraft:a,setAgentDraft:o}=_t(te(e=>({selectedAgentName:e.selectedAgentName,getAgentByName:e.getAgentByName,createAgent:e.createAgent,updateAgent:e.updateAgent,agentDraft:e.agentDraft,setAgentDraft:e.setAgentDraft}))),{data:s=[]}=Tt(),l=t?n(t):null,u=!!(a&&a.name===t&&!l),[d,f]=Q.useState(``),[p,m]=Q.useState(`user`),[h,g]=Q.useState(``),[_,v]=Q.useState(`subagent`),[y,b]=Q.useState(``),[x,S]=Q.useState(``),[C,w]=Q.useState(!1),[T,E]=Q.useState(`allow`),[D,O]=Q.useState([]),[k,A]=Q.useState([]),[j,M]=Q.useState(``),[N,P]=Q.useState(`*`),[F,I]=Q.useState(!1),[L,R]=Q.useState(!1),z=Q.useRef(null),B=se(e=>e.currentDirectory??null),[V,H]=Q.useState([]),U=et(e=>e.permission);Q.useEffect(()=>{let e=!1;return(async()=>{let t=await fe.listToolIds({directory:B});if(e)return;let n=new Set([`write`,`patch`,`multiedit`]),r=t.map(e=>typeof e==`string`?e.trim():``).filter(Boolean).filter(e=>e!==`*`).filter(e=>e!==`invalid`).filter(e=>!n.has(e));H(Array.from(new Set(r)).sort((e,t)=>e.localeCompare(t)))})(),()=>{e=!0}},[B]);let W=Q.useMemo(()=>{let e=new Set;for(let t of s){let n=io(uo(t.permissions??t.permission));for(let t of n)t.permission&&t.permission!==`*`&&t.permission!==`invalid`&&e.add(t.permission)}for(let t of Object.values(U))for(let n of t){let t=n.permission?.trim();t&&t!==`invalid`&&e.add(t)}for(let t of V)e.add(t);return Array.from(e).sort((e,t)=>e.localeCompare(t))},[s,U,V]),ee=Q.useMemo(()=>ao(D),[D]),ne=Q.useMemo(()=>ao(k),[k]),re=e=>ne.get(no(e,`*`))?.action,G=e=>k.filter(t=>t.permission===e&&t.pattern!==`*`).sort((e,t)=>e.pattern.localeCompare(t.pattern)),ie=Q.useMemo(()=>{let e=new Set;for(let t of $a)e.add(t);for(let t of W)e.add(t);return Array.from(e).sort((e,t)=>e.localeCompare(t))},[W]),ae=e=>{let t=e===`*`?T:re(e)??T,n=G(e),r=n.reduce((e,t)=>(e[t.action]=(e[t.action]??0)+1,e),{allow:0,ask:0,deny:0}),i=[`allow`,`ask`,`deny`].filter(e=>r[e]>0).map(e=>`${r[e]} ${e}`).join(`, `);return{defaultAction:t,patternRulesCount:n.length,patternSummary:i,hasDefaultHint:!1}},oe=t=>e(t===`allow`?`settings.common.permission.allow`:t===`deny`?`settings.common.permission.deny`:`settings.common.permission.ask`),ce=t=>t===`global`?e(`settings.common.scope.global`):oe(t),le=Q.useMemo(()=>{let e=new Set;for(let t of $a)e.add(t);for(let t of W)e.add(t);return Array.from(e).sort((e,t)=>e.localeCompare(t))},[W]),ue=(e,t,n)=>{A(r=>{let i=ao(r);return i.set(no(e,t),{permission:e,pattern:t,action:n}),Array.from(i.values())})},de=(e,t)=>{A(n=>{let r=ao(n);return r.delete(no(e,t)),Array.from(r.values())})},pe=(e,t)=>{let n=ee.get(no(e,t));if(n){ue(e,t,n.action);return}de(e,t)},me=(e,t,n)=>{ue(e,t,n)},he=e=>{E(e),A(t=>t.filter(t=>t.pattern!==`*`||t.action!==e))},ge=t=>{let n=j.trim();if(!n){X.error(e(`settings.agents.page.toast.permissionNameRequired`));return}let r=N.trim()||`*`;if(n===`*`&&r===`*`){he(t),M(``),P(`*`);return}r===`*`&&n!==`*`&&t===T?de(n,`*`):ue(n,r,t),M(``),P(`*`)},_e=t=>{let n=eo[t];return n?e(n):t.split(/[_-]+/g).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)};Q.useEffect(()=>{M(``),P(`*`);let e=e=>{let t=io(e),n=co(t),r=lo(t,n);return E(n),O(r),A(r),{global:n,rules:r}};if(u&&a){let t=a.name||``,n=a.scope||`user`,r=a.description||``,i=a.mode||`subagent`,o=a.model||``,s=a.system||``;f(t),m(n),g(r),v(i),b(o),S(s),w(!1);let c=e(uo(a.permissions));z.current={draftName:t,draftScope:n,description:r,mode:i,model:o,system:s,globalPermission:c.global,permissionRules:c.rules};return}if(l&&t===l.name){let t=l,n=l.description||``,r=l.mode||`subagent`,i=xa(l),a=t.scope===`project`?`project`:`user`;m(a),g(n),v(r),b(i),S(``),w(!1);let o=e(uo(t.permissions??l.permission));z.current={draftName:``,draftScope:a,description:n,mode:r,model:i,system:``,globalPermission:o.global,permissionRules:o.rules}}},[a,u,l,t]),Q.useEffect(()=>{if(!t||u)return;let e=new AbortController,n=ht();return c(`/api/config/agents/${encodeURIComponent(t)}/config`,{signal:e.signal,headers:n?{"x-opencode-directory":n}:{}}).then(async t=>{if(!t.ok||e.signal.aborted)return;let n=ba((await t.json()).config);e.signal.aborted||n===void 0||!z.current||(S(n),z.current={...z.current,system:n})}).catch(()=>void 0),()=>e.abort()},[u,t]);let ve=Q.useMemo(()=>{let e=z.current;return e?!!(u&&d!==e.draftName||p!==e.draftScope||h!==e.description||_!==e.mode||y!==e.model||x!==e.system||T!==e.globalPermission||!so(k,e.permissionRules)):!1},[h,d,p,T,u,_,y,k,x]),ye=(!u&&l?l.document:void 0)?.dropped?.map(e=>e.key)??[],be=!L&&ve;return t?(0,$.jsx)(Nt,{outerClassName:`h-full`,className:`w-full`,children:(0,$.jsxs)(`div`,{className:`yuri-settings-page-content mx-auto w-full max-w-3xl p-3 sm:p-6 sm:pt-8`,children:[(0,$.jsx)(ei,{actions:(0,$.jsx)(q,{type:`button`,size:`sm`,onClick:async()=>{let n=u?d.trim().replace(/\s+/g,`-`):t?.trim();if(!n){X.error(e(`settings.agents.sidebar.toast.agentNameRequired`));return}if(u&&s.some(e=>e.name===n)){X.error(e(`settings.agents.sidebar.toast.agentExists`));return}R(!0);try{let t={description:h,mode:_,model:y,system:x,globalPermission:T,permissionRules:k},s=z.current,c=s?{description:s.description,mode:s.mode,model:s.model,system:s.system,globalPermission:s.globalPermission,permissionRules:s.permissionRules}:null,l=ya({isNewAgent:u,agentName:n,draftScope:p,initialScope:s?.draftScope,draftHasExplicitPermission:u&&a?.permissions!==void 0,current:t,initial:c,confirmDrop:C}),d;u?(d=await r(l),d.ok&&o(null)):d=await i(n,l),d.ok?d.requiresManualRestart?X.warning(e(`settings.agents.page.toast.savedManualRestart`)):X.success(e(`settings.agents.page.toast.savedNextRequest`)):X.error(e(u?`settings.agents.page.toast.createFailed`:`settings.agents.page.toast.updateFailed`))}catch(t){console.error(`Error saving agent:`,t);let n=t instanceof Error&&t.message?t.message:e(`settings.agents.page.toast.saveUnexpectedError`);X.error(n)}finally{R(!1)}},disabled:!be,"aria-busy":L,children:e(L?`settings.common.actions.saving`:`settings.common.actions.saveChanges`)}),children:(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`h2`,{className:`typography-ui-header font-semibold text-foreground truncate`,children:u?e(`settings.agents.page.title.new`):wa(t??``)}),(0,$.jsx)(`p`,{className:`typography-meta text-muted-foreground truncate`,children:e(u?`settings.agents.page.subtitle.new`:`settings.agents.page.subtitle.edit`)})]})}),(0,$.jsx)(Za,{}),ye.length>0?(0,$.jsxs)(`div`,{className:`mt-3 flex flex-col gap-2`,children:[(0,$.jsx)(`p`,{className:`typography-meta text-muted-foreground`,children:e(`settings.agents.page.legacy.dropped`,{fields:ye.join(`, `)})}),(0,$.jsx)(ti,{checked:C,onChange:w,label:e(`settings.agents.page.legacy.confirmDrop`),ariaLabel:e(`settings.agents.page.legacy.confirmDrop`)})]}):null,(0,$.jsxs)(ni,{label:e(`settings.agents.page.section.identityRole`),children:[(0,$.jsx)(ii,{itemId:`agents.scope`,label:e(`settings.agents.page.field.scope`),children:(0,$.jsxs)(lr,{value:p,onValueChange:e=>m(e),children:[(0,$.jsx)(cr,{className:`w-fit min-w-[100px]`,children:(0,$.jsx)(ar,{placeholder:e(`settings.agents.page.field.scopePlaceholder`),children:t=>(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(Y,{name:t===`project`?`folder`:`user-3`,className:`h-3.5 w-3.5`}),(0,$.jsx)(`span`,{children:e(t===`project`?`settings.common.scope.project`:`settings.common.scope.global`)})]})})}),(0,$.jsxs)(sr,{align:`end`,children:[(0,$.jsx)(or,{value:`user`,children:(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(Y,{name:`user-3`,className:`h-3.5 w-3.5`}),(0,$.jsx)(`span`,{children:e(`settings.common.scope.global`)})]})}),(0,$.jsx)(or,{value:`project`,children:(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(Y,{name:`folder`,className:`h-3.5 w-3.5`}),(0,$.jsx)(`span`,{children:e(`settings.common.scope.project`)})]})})]})]})}),u&&(0,$.jsx)(ii,{itemId:`agents.name`,label:e(`settings.agents.page.field.agentName`),children:(0,$.jsxs)(`div`,{className:`flex items-center`,children:[(0,$.jsx)(`span`,{className:`typography-ui-label text-muted-foreground mr-1`,children:`@`}),(0,$.jsx)(yn,{value:d,onChange:e=>f(e.target.value),placeholder:e(`settings.agents.page.field.agentNamePlaceholder`),className:`h-7 w-40 px-2`})]})}),(0,$.jsx)(ii,{label:e(`settings.common.field.description`),className:`yuri-settings-split-row-stacked`,children:(0,$.jsx)(on,{embedded:!0,value:h,onChange:e=>g(e.target.value),placeholder:e(`settings.agents.page.field.descriptionPlaceholder`),rows:2,className:`w-full resize-none min-h-[60px] bg-transparent`})}),(0,$.jsx)(ii,{itemId:`agents.mode`,className:`yuri-settings-agents-mode-row`,label:(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,$.jsx)(`span`,{children:e(`settings.agents.page.field.mode`)}),(0,$.jsxs)(Ht,{children:[(0,$.jsx)(Bt,{asChild:!0,children:(0,$.jsx)(Y,{name:`information`,className:`h-3.5 w-3.5 text-muted-foreground/60 cursor-help`})}),(0,$.jsx)(Vt,{sideOffset:8,className:`max-w-xs`,children:e(`settings.agents.page.field.modeTooltip`)})]})]}),children:(0,$.jsxs)(`div`,{className:`flex flex-nowrap items-center justify-end gap-1`,children:[(0,$.jsx)(q,{variant:`chip`,size:`xs`,"aria-pressed":_===`primary`,onClick:()=>v(`primary`),className:`!font-normal shrink-0`,children:e(`settings.agents.page.mode.primary`)}),(0,$.jsx)(q,{variant:`chip`,size:`xs`,"aria-pressed":_===`subagent`,onClick:()=>v(`subagent`),className:`!font-normal shrink-0`,children:e(`settings.agents.page.mode.subagent`)}),(0,$.jsx)(q,{variant:`chip`,size:`xs`,"aria-pressed":_===`all`,onClick:()=>v(`all`),className:`!font-normal shrink-0`,children:e(`settings.agents.page.mode.all`)})]})})]}),(0,$.jsx)(ni,{label:e(`settings.agents.page.section.modelParameters`),children:(0,$.jsx)(ii,{itemId:`agents.model`,label:e(`settings.agents.page.field.overrideModel`),children:(0,$.jsx)(ji,{providerId:Sa(y)?.providerId??``,modelId:Sa(y)?.modelId??``,variant:Sa(y)?.variant??``,onChange:(e,t,n)=>{b(e&&t?n?`${e}/${t}#${n}`:`${e}/${t}`:``)},className:`yuri-settings-inline-value`})})}),(0,$.jsx)(ai,{itemId:`agents.system-prompt`,label:e(`settings.agents.page.section.systemPrompt`),className:`yuri-settings-split-row-stacked`,children:(0,$.jsx)(on,{embedded:!0,value:x,onChange:e=>S(e.target.value),placeholder:e(`settings.agents.page.field.systemPromptPlaceholder`),rows:8,className:`w-full font-mono typography-meta min-h-[120px] max-h-[60vh] bg-transparent resize-y`})}),(0,$.jsx)(`div`,{"data-settings-item":`agents.permissions`,children:(0,$.jsx)(ni,{label:(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,$.jsx)(`span`,{children:e(`settings.agents.page.section.toolPermissions`)}),(0,$.jsx)(q,{variant:`outline`,size:`xs`,className:`!font-normal`,onClick:()=>I(e=>!e),children:e(F?`settings.agents.page.permissions.hideEditor`:`settings.agents.page.permissions.advancedEditor`)})]}),children:F?(0,$.jsxs)(`div`,{className:`space-y-6 p-2`,children:[(0,$.jsx)(ii,{label:(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`span`,{children:e(`settings.agents.page.permissions.globalDefault`)}),(0,$.jsx)(`span`,{className:`typography-micro text-muted-foreground/70 font-mono`,children:`*`})]}),children:(0,$.jsxs)(lr,{value:T,onValueChange:e=>he(e),children:[(0,$.jsx)(cr,{className:`w-[100px]`,children:(0,$.jsx)(ar,{children:oe(T)})}),(0,$.jsxs)(sr,{children:[(0,$.jsx)(or,{value:`allow`,children:e(`settings.common.permission.allow`)}),(0,$.jsx)(or,{value:`ask`,children:e(`settings.common.permission.ask`)}),(0,$.jsx)(or,{value:`deny`,children:e(`settings.common.permission.deny`)})]})]})}),(0,$.jsx)(`div`,{className:`space-y-4`,children:ie.filter(e=>e!==`*`).map(t=>{let n=_e(t),{defaultAction:r,patternRulesCount:i}=ae(t),a=re(t),o=a??`global`,s=G(t),c=[`allow`,`ask`,`deny`].filter(e=>e!==T);return(0,$.jsxs)(`div`,{className:`border-t border-[var(--surface-subtle)] pt-2`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between py-1`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`typography-ui-label text-foreground`,children:n}),(0,$.jsx)(`span`,{className:`typography-micro text-muted-foreground/70 font-mono`,children:t})]}),(0,$.jsx)(`div`,{className:`typography-micro text-muted-foreground`,children:i>0?e(`settings.agents.page.permissions.globalSummary`,{summary:r}):r})]}),(0,$.jsxs)(`div`,{className:`space-y-1 pl-2 mt-1`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2 py-0.5`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-wrap items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`typography-micro text-muted-foreground`,children:e(`settings.agents.page.permissions.pattern`)}),(0,$.jsx)(`span`,{className:`typography-micro font-mono text-foreground bg-[var(--surface-muted)] px-1 rounded`,children:`*`}),a&&(0,$.jsx)(q,{size:`sm`,variant:`ghost`,onClick:()=>pe(t,`*`),className:`px-1.5 py-0 h-5`,children:(0,$.jsx)(Y,{name:`subtract`,className:`h-3.5 w-3.5 text-muted-foreground hover:text-foreground`})})]}),(0,$.jsxs)(lr,{value:o,onValueChange:e=>{if(e===`global`){de(t,`*`);return}ue(t,`*`,e)},children:[(0,$.jsx)(cr,{className:`w-[90px] shrink-0`,children:(0,$.jsx)(ar,{children:ce(o)})}),(0,$.jsxs)(sr,{children:[(0,$.jsx)(or,{value:`global`,children:e(`settings.common.scope.global`)}),c.map(e=>(0,$.jsx)(or,{value:e,className:`capitalize`,children:oe(e)},e))]})]})]}),s.map(t=>{let n=no(t.permission,t.pattern),r=ee.get(n),i=!r,a=!!(r&&r.action!==t.action);return(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2 py-0.5 border-t border-[var(--surface-subtle)]`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-wrap items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`typography-micro text-muted-foreground`,children:e(`settings.agents.page.permissions.pattern`)}),(0,$.jsx)(`span`,{className:`min-w-0 break-all typography-micro font-mono text-foreground bg-[var(--surface-muted)] px-1 rounded`,children:t.pattern}),i&&(0,$.jsx)(`span`,{className:`typography-micro text-[var(--status-success)]`,children:e(`settings.common.badge.new`)}),a&&(0,$.jsx)(`span`,{className:`typography-micro text-[var(--status-warning)]`,children:e(`settings.common.badge.modified`)}),(i||a)&&(0,$.jsx)(q,{size:`sm`,variant:`ghost`,onClick:()=>i?de(t.permission,t.pattern):pe(t.permission,t.pattern),className:`px-1.5 py-0 h-5`,children:(0,$.jsx)(Y,{name:`subtract`,className:`h-3.5 w-3.5 text-muted-foreground hover:text-foreground`})})]}),(0,$.jsxs)(lr,{value:t.action,onValueChange:e=>me(t.permission,t.pattern,e),children:[(0,$.jsx)(cr,{className:`w-[90px] shrink-0`,children:(0,$.jsx)(ar,{children:oe(t.action)})}),(0,$.jsxs)(sr,{children:[(0,$.jsx)(or,{value:`allow`,children:e(`settings.common.permission.allow`)}),(0,$.jsx)(or,{value:`ask`,children:e(`settings.common.permission.ask`)}),(0,$.jsx)(or,{value:`deny`,children:e(`settings.common.permission.deny`)})]})]})]},n)})]})]},t)})}),(0,$.jsxs)(`div`,{className:`border-t border-[var(--surface-subtle)] pt-3`,children:[(0,$.jsx)(`h4`,{className:`typography-ui-label text-foreground mb-2`,children:e(`settings.agents.page.permissions.addCustomRule`)}),(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2`,children:[(0,$.jsxs)(lr,{value:j,onValueChange:M,children:[(0,$.jsx)(cr,{className:`w-auto max-w-full sm:w-[160px]`,children:j?(0,$.jsx)(`span`,{className:`truncate`,children:_e(j)}):(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:e(`settings.agents.page.permissions.permissionPlaceholder`)})}),(0,$.jsx)(sr,{children:le.map(e=>(0,$.jsx)(or,{value:e,children:(0,$.jsx)(`div`,{className:`flex items-center justify-between gap-2 w-full`,children:(0,$.jsx)(`span`,{children:_e(e)})})},e))})]}),(0,$.jsx)(yn,{value:N,onChange:e=>P(e.target.value),placeholder:e(`settings.agents.page.permissions.patternPlaceholder`),className:`h-7 min-w-0 flex-1 basis-32 font-mono text-xs`}),(0,$.jsxs)(`div`,{className:`flex gap-1`,children:[(0,$.jsx)(q,{variant:`outline`,size:`xs`,className:`!font-normal`,onClick:()=>ge(`allow`),children:e(`settings.common.permission.allow`)}),(0,$.jsx)(q,{variant:`outline`,size:`xs`,className:`!font-normal`,onClick:()=>ge(`ask`),children:e(`settings.common.permission.ask`)}),(0,$.jsx)(q,{variant:`outline`,size:`xs`,className:`!font-normal`,onClick:()=>ge(`deny`),children:e(`settings.common.permission.deny`)})]})]})]})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:`typography-micro text-muted-foreground px-3 pt-2`,children:e(`settings.agents.page.permissions.lastMatchHint`)}),_r(gr(k)).map((e,t)=>(0,$.jsx)(ii,{label:(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`typography-micro text-muted-foreground font-mono`,children:t+1}),(0,$.jsx)(`span`,{children:e.action}),(0,$.jsx)(`span`,{className:`typography-micro text-muted-foreground/70 font-mono`,children:e.resource})]}),children:(0,$.jsx)(`span`,{className:J(`typography-micro capitalize px-1.5 py-0.5 rounded`,e.effect===`allow`?`text-[var(--status-success)] bg-[var(--status-success)]/10`:e.effect===`deny`?`text-[var(--status-error)] bg-[var(--status-error)]/10`:`text-[var(--status-warning)] bg-[var(--status-warning)]/10`),children:e.effect})},`${e.action}::${e.resource}::${t}`))]})})})]})}):(0,$.jsx)(Nt,{outerClassName:`h-full`,className:`w-full`,children:(0,$.jsxs)(`div`,{className:`yuri-settings-page-content mx-auto w-full max-w-3xl p-3 sm:p-6 sm:pt-8`,children:[(0,$.jsx)(Za,{}),(0,$.jsx)(`div`,{className:`flex h-full items-center justify-center`,children:(0,$.jsxs)(`div`,{className:`text-center text-muted-foreground`,children:[(0,$.jsx)(Y,{name:`robot-2`,className:`mx-auto mb-3 h-12 w-12 opacity-50`}),(0,$.jsx)(`p`,{className:`typography-body`,children:e(`settings.agents.page.empty.title`)}),(0,$.jsx)(`p`,{className:`typography-meta mt-1 opacity-75`,children:e(`settings.agents.page.empty.description`)})]})})]})})},po=`~/.config/opencode/AGENTS.md`,mo=async(e,t)=>{let n=await e.json().catch(()=>null);return typeof n?.error==`string`&&n.error.trim()?n.error:t},ho=e=>e.length>0&&!e.endsWith(`
2
2
  `)?`${e}\n`:e,go={prompt:``,responseStyleEnabled:!1,responseStylePreset:`concise`,responseStyleCustomInstructions:``},_o=(e,t)=>e===`custom`?t:Ue(e),vo=e=>e===`custom`?`custom`:Ke(e)?e:`concise`,yo={concise:`settings.behavior.page.responseStyle.option.concise`,detailed:`settings.behavior.page.responseStyle.option.detailed`,mentor:`settings.behavior.page.responseStyle.option.mentor`,pushback:`settings.behavior.page.responseStyle.option.pushback`,noFiller:`settings.behavior.page.responseStyle.option.noFiller`,matchEnergy:`settings.behavior.page.responseStyle.option.matchEnergy`,warmPeer:`settings.behavior.page.responseStyle.option.warmPeer`},bo=async(e,t)=>{let n=await c(`/api/config/settings`,{method:`PUT`,headers:{"Content-Type":`application/json`,Accept:`application/json`},body:JSON.stringify(e)});if(!n.ok)throw Error(await mo(n,t));return n.json().catch(()=>null)},xo=()=>{let{t:e}=At(),t=Q.useSyncExternalStore(n,r,r),[i,a]=Q.useState(``),[o,s]=Q.useState(go.responseStyleEnabled),[l,u]=Q.useState(go.responseStylePreset),[d,f]=Q.useState(go.responseStyleCustomInstructions),[p,m]=Q.useState(!1),[h,g]=Q.useState(!1),[_,v]=Q.useState(!1),[y,b]=Q.useState(``),x=Q.useRef(null),S=Q.useRef(null),C=Q.useRef(0),w=Q.useRef(Promise.resolve());Q.useEffect(()=>{let e=!0;return g(!1),x.current=null,S.current=null,C.current+=1,ae(t).then(n=>{if(!e||t!==r())return;let i={enabled:n.responseStyleEnabled===!0,preset:vo(n.responseStylePreset),custom:typeof n.responseStyleCustomInstructions==`string`?n.responseStyleCustomInstructions:``};s(i.enabled),u(i.preset),f(i.custom),bt({enabled:i.enabled,preset:i.preset,customInstructions:i.custom},t),x.current=i,S.current=i,g(!0)}).catch(t=>{e&&t?.name!==`AbortError`&&console.warn(`Failed to load behavior settings:`,t)}),()=>{e=!1,C.current+=1}},[t]),Q.useEffect(()=>{let e=new AbortController,n=!0;return m(!1),v(!1),(async()=>{try{let i=await c(`/api/behavior/agents-md`,{method:`GET`,headers:{Accept:`application/json`},signal:e.signal});if(!i.ok)throw Error(`Behavior prompt request failed (${i.status})`);let o=await i.json().catch(()=>null);if(typeof o?.content!=`string`)throw Error(`Invalid behavior prompt response`);if(!n||t!==r())return;a(o.content),b(o.content),m(!0)}catch(e){n&&e?.name!==`AbortError`&&console.warn(`Failed to load behavior prompt:`,e)}})(),()=>{n=!1,e.abort()}},[t]),Q.useEffect(()=>{if(!h)return;let n={enabled:o,preset:l,custom:d},i=S.current;if(i&&i.enabled===n.enabled&&i.preset===n.preset&&i.custom===n.custom)return;S.current=n;let a=C.current+1;C.current=a;let c=setTimeout(()=>{let i=async()=>{if(t===r())try{let i=await bo({responseStyleEnabled:n.enabled,responseStylePreset:n.preset,responseStyleCustomInstructions:n.custom},e(`settings.behavior.page.toast.saveFailed`));if(t!==r())return;let o=ie(i),c={enabled:o.responseStyleEnabled??n.enabled,preset:o.responseStylePreset??n.preset,custom:o.responseStyleCustomInstructions??n.custom};if(bt({enabled:c.enabled,preset:c.preset,customInstructions:c.custom},t),oe({responseStyleEnabled:c.enabled,responseStylePreset:c.preset,responseStyleCustomInstructions:c.custom},t),x.current=c,a!==C.current)return;S.current=c,s(c.enabled),u(c.preset),f(c.custom)}catch(n){if(t===r()&&a===C.current){let t=x.current;S.current=t,t&&(s(t.enabled),u(t.preset),f(t.custom));let r=n instanceof Error?n.message:e(`settings.behavior.page.toast.saveFailed`);X.error(r)}}};w.current=w.current.then(i,i)},400);return()=>clearTimeout(c)},[o,l,d,h,e,t]);let T=_o(l,d),E=i!==y;return(0,$.jsx)(Nt,{outerClassName:`h-full`,className:`w-full`,children:(0,$.jsxs)(`div`,{className:`yuri-settings-page-content mx-auto w-full max-w-3xl p-3 sm:p-6 sm:pt-8`,children:[(0,$.jsx)(`div`,{className:`space-y-1`,children:(0,$.jsx)(`h2`,{className:`typography-ui-header font-semibold text-foreground`,children:e(`settings.behavior.page.title`)})}),(0,$.jsx)(ni,{itemId:`behavior.system-prompt`,actions:(0,$.jsx)(q,{onClick:async()=>{let n=t;if(n===r()){v(!0);try{let t=ho(i),o=await c(`/api/behavior/agents-md`,{method:`PUT`,headers:{"Content-Type":`application/json`,Accept:`application/json`},body:JSON.stringify({content:t})});if(!o.ok)throw Error(await mo(o,e(`settings.behavior.page.toast.saveFailed`)));if(n!==r()||(await bo({globalBehaviorPrompt:t},e(`settings.behavior.page.toast.saveFailed`)),n!==r()))return;a(t),b(t),X.success(e(`settings.behavior.page.toast.saved`))}catch(t){if(n!==r())return;console.error(`Failed to save behavior:`,t);let i=t instanceof Error?t.message:e(`settings.behavior.page.toast.saveFailed`);X.error(i)}finally{n===r()&&v(!1)}}},disabled:_||!E||!p,size:`sm`,"aria-busy":_,children:e(_?`settings.common.actions.saving`:`settings.common.actions.saveChanges`)}),label:(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,$.jsx)(`span`,{children:e(`settings.behavior.page.section.systemPrompt`)}),(0,$.jsxs)(Ht,{children:[(0,$.jsx)(Bt,{asChild:!0,children:(0,$.jsx)(Y,{name:`information`,className:`h-3.5 w-3.5 text-muted-foreground/60 cursor-help`})}),(0,$.jsx)(Vt,{sideOffset:8,className:`max-w-xs`,children:(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`p`,{className:`font-medium text-foreground`,children:e(`settings.behavior.page.warning.title`)}),(0,$.jsx)(`p`,{children:e(`settings.behavior.page.warning.description`,{path:po})})]})})]})]}),children:(0,$.jsx)(`div`,{className:`yuri-settings-group-row flex flex-col gap-3`,children:(0,$.jsx)(on,{embedded:!0,value:i,onChange:e=>a(e.target.value),placeholder:e(`settings.behavior.page.field.systemPromptPlaceholder`),rows:12,disabled:!p,outerClassName:`min-h-[160px] max-h-[70vh]`,className:`w-full font-mono typography-meta bg-transparent`})})}),(0,$.jsxs)(ni,{itemId:`behavior.response-style`,actions:(0,$.jsx)(ri,{checked:o,onChange:s,disabled:!h,ariaLabel:e(`settings.behavior.page.responseStyle.enableAria`)}),label:(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,$.jsx)(`span`,{children:e(`settings.behavior.page.section.responseStyle`)}),(0,$.jsxs)(Ht,{children:[(0,$.jsx)(Bt,{asChild:!0,children:(0,$.jsx)(Y,{name:`information`,className:`h-3.5 w-3.5 text-muted-foreground/60 cursor-help`})}),(0,$.jsx)(Vt,{sideOffset:8,className:`max-w-xs`,children:e(`settings.behavior.page.responseStyle.tooltip`)})]})]}),children:[(0,$.jsx)(ii,{label:e(`settings.behavior.page.responseStyle.preset`),children:(0,$.jsxs)(lr,{value:l,onValueChange:e=>u(e),disabled:!h||!o,children:[(0,$.jsx)(cr,{className:`w-full sm:w-56`,children:(0,$.jsx)(ar,{children:t=>t===`custom`?e(`settings.behavior.page.responseStyle.option.custom`):Ke(t)?e(yo[t]):null})}),(0,$.jsxs)(sr,{children:[tt.map(t=>(0,$.jsx)(or,{value:t,children:e(yo[t])},t)),(0,$.jsx)(or,{value:`custom`,children:e(`settings.behavior.page.responseStyle.option.custom`)})]})]})}),(0,$.jsx)(`div`,{className:`yuri-settings-group-row`,children:(0,$.jsx)(on,{embedded:!0,value:T,onChange:e=>f(e.target.value),placeholder:e(`settings.behavior.page.responseStyle.customPlaceholder`),rows:5,disabled:!h||!o||l!==`custom`,outerClassName:`min-h-[120px]`,className:`w-full font-mono typography-meta bg-transparent`})})]})]})})},So=e=>{let t=(0,Qi.c)(158),{onItemSelect:n}=e,{t:r}=At(),[i,a]=Q.useState(null),[o,s]=Q.useState(``),[c,l]=Q.useState(null),[u,d]=Q.useState(null),[f,p]=Q.useState(!1),[m,h]=Q.useState(null),{selectedCommandName:g,setSelectedCommand:_,setCommandDraft:v,createCommand:y,deleteCommand:b}=ra(te(wo)),x=qe(),S;t[0]===x.data?S=t[1]:(S=x.data??[],t[0]=x.data,t[1]=S);let C=S,w=vt(),T;t[2]===w.data?T=t[3]:(T=w.data??[],t[2]=w.data,t[3]=T);let E=T,{refetch:D}=w,O,k;t[4]===D?(O=t[5],k=t[6]):(O=()=>{D()},k=[D],t[4]=D,t[5]=O,t[6]=k),Q.useEffect(O,k);let A;t[7]===E?A=t[8]:(A=new Set(E.map(To)),t[7]=E,t[8]=A);let j=A,M;if(t[9]!==C||t[10]!==j){let e;t[12]===j?e=t[13]:(e=e=>!j.has(e.name),t[12]=j,t[13]=e),M=C.filter(e),t[9]=C,t[10]=j,t[11]=M}else M=t[11];let N=M,P,F;t[14]!==g||t[15]!==_||t[16]!==j?(P=()=>{g&&j.has(g)&&_(null)},F=[g,_,j],t[14]=g,t[15]=_,t[16]=j,t[17]=P,t[18]=F):(P=t[17],F=t[18]),Q.useEffect(P,F);let I;t[19]!==C||t[20]!==n||t[21]!==v||t[22]!==_?(I=()=>{let e=`new-command`,t=1;for(;C.some(t=>t.name===e);)e=`new-command-${t}`,t++;v({name:e,scope:`user`}),_(e),n?.()},t[19]=C,t[20]=n,t[21]=v,t[22]=_,t[23]=I):I=t[23];let L=I,R;t[24]===r?R=t[25]:(R=async e=>{if(ta(e)){X.error(r(`settings.commands.sidebar.toast.builtInCannotDelete`));return}l(e),d(`delete`)},t[24]=r,t[25]=R);let z=R,B;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(B=async e=>{ta(e)&&(l(e),d(`reset`))},t[26]=B):B=t[26];let V=B,H;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(H=()=>{l(null),d(null)},t[27]=H):H=t[27];let U=H,W;t[28]!==c||t[29]!==u||t[30]!==b||t[31]!==r?(W=async()=>{!c||!u||(p(!0),await b(c.name)?(u===`delete`?X.success(r(`settings.commands.sidebar.toast.commandDeleted`,{name:c.name})):X.success(r(`settings.commands.sidebar.toast.commandReset`,{name:c.name})),U()):u===`delete`?X.error(r(`settings.commands.sidebar.toast.deleteFailed`)):X.error(r(`settings.commands.sidebar.toast.resetFailed`)),p(!1))},t[28]=c,t[29]=u,t[30]=b,t[31]=r,t[32]=W):W=t[32];let ee=W,ne;t[33]!==C||t[34]!==v||t[35]!==_?(ne=e=>{let t=e.name,n=1,r=`${t}-copy`;for(;C.some(e=>e.name===r);)n++,r=`${t}-copy-${n}`;v({name:r,scope:e.scope||`user`,description:e.description,template:e.template,agent:e.agent,model:e.model}),_(r)},t[33]=C,t[34]=v,t[35]=_,t[36]=ne):ne=t[36];let re=ne,G;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(G=e=>{s(e.name),a(e)},t[37]=G):G=t[37];let ie=G,ae;t[38]!==C||t[39]!==y||t[40]!==b||t[41]!==i||t[42]!==o||t[43]!==_||t[44]!==r?(ae=async()=>{if(!i)return;let e=o.trim().replace(/\s+/g,`-`);if(!e){X.error(r(`settings.commands.sidebar.toast.commandNameRequired`));return}if(e===i.name){a(null);return}if(C.some(t=>t.name===e)){X.error(r(`settings.commands.sidebar.toast.commandExists`));return}await y({name:e,description:i.description,template:i.template,agent:i.agent,model:i.model})?await b(i.name)?(X.success(`Command renamed to "${e}"`),_(e)):X.error(r(`settings.commands.sidebar.toast.removeOldAfterRenameFailed`)):X.error(r(`settings.commands.sidebar.toast.renameFailed`)),a(null)},t[38]=C,t[39]=y,t[40]=b,t[41]=i,t[42]=o,t[43]=_,t[44]=r,t[45]=ae):ae=t[45];let oe=ae,se,ce,le;if(t[46]!==N||t[47]!==L||t[48]!==z||t[49]!==re||t[50]!==n||t[51]!==m||t[52]!==g||t[53]!==_||t[54]!==r){let e=N.filter(ta),i=N.filter(Eo),a;t[58]===r?a=t[59]:(a=r(`settings.commands.sidebar.section.custom`),t[58]=r,t[59]=a);let o;t[60]===a?o=t[61]:(o=(0,$.jsx)(`span`,{children:a}),t[60]=a,t[61]=o);let s;t[62]===r?s=t[63]:(s=r(`settings.commands.page.title.new`),t[62]=r,t[63]=s);let c;t[64]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,$.jsx)(Y,{name:`add`,className:`h-4 w-4`}),t[64]=c):c=t[64];let l;t[65]!==L||t[66]!==s?(l=(0,$.jsx)(q,{"data-settings-item":`commands.create`,size:`icon`,variant:`ghost`,onClick:L,"aria-label":s,children:c}),t[65]=L,t[66]=s,t[67]=l):l=t[67];let u;t[68]!==o||t[69]!==l?(u=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[o,l]}),t[68]=o,t[69]=l,t[70]=u):u=t[70];let d=u;se=`yuri-settings-page-content h-full overflow-y-auto bg-background p-3`,t[71]===Symbol.for(`react.memo_cache_sentinel`)?(ce=(0,$.jsx)(ni,{children:(0,$.jsx)(`div`,{className:`yuri-settings-group-row`,children:(0,$.jsx)(Ta,{})})}),t[71]=ce):ce=t[71],le=(0,$.jsx)($.Fragment,{children:N.length===0?(0,$.jsx)(ni,{label:d,children:(0,$.jsxs)(`div`,{className:`yuri-settings-group-row py-12 text-center text-muted-foreground`,children:[(0,$.jsx)(Y,{name:`terminal-box`,className:`mx-auto mb-3 h-10 w-10 opacity-50`}),(0,$.jsx)(`p`,{className:`typography-ui-label font-medium`,children:r(`settings.commands.sidebar.empty.title`)}),(0,$.jsx)(`p`,{className:`typography-meta mt-1 opacity-75`,children:r(`settings.commands.sidebar.empty.description`)})]})}):(0,$.jsxs)($.Fragment,{children:[e.length>0&&(0,$.jsx)(ni,{label:r(`settings.commands.sidebar.section.builtIn`),children:[...e].sort(Do).map(e=>(0,$.jsx)(Co,{command:e,isSelected:g===e.name,onSelect:()=>{_(e.name),n?.()},onReset:()=>V(e),onDuplicate:()=>re(e),isMenuOpen:m===e.name,onMenuOpenChange:t=>h(t?e.name:null)},e.name))}),i.length>0?(0,$.jsx)(ni,{label:d,children:[...i].sort(Oo).map(e=>(0,$.jsx)(Co,{command:e,isSelected:g===e.name,onSelect:()=>{_(e.name),n?.()},onRename:()=>ie(e),onDelete:()=>z(e),onDuplicate:()=>re(e),isMenuOpen:m===e.name,onMenuOpenChange:t=>h(t?e.name:null)},e.name))}):(0,$.jsx)(ni,{label:d,cardClassName:`hidden`,children:(0,$.jsx)(`span`,{})})]})}),t[46]=N,t[47]=L,t[48]=z,t[49]=re,t[50]=n,t[51]=m,t[52]=g,t[53]=_,t[54]=r,t[55]=se,t[56]=ce,t[57]=le}else se=t[55],ce=t[56],le=t[57];let ue=c!==null&&u!==null,de;t[72]===f?de=t[73]:(de=e=>{!e&&!f&&U()},t[72]=f,t[73]=de);let fe;t[74]!==u||t[75]!==r?(fe=r(u===`delete`?`settings.commands.sidebar.dialog.deleteTitle`:`settings.commands.sidebar.dialog.resetTitle`),t[74]=u,t[75]=r,t[76]=fe):fe=t[76];let pe;t[77]===fe?pe=t[78]:(pe=(0,$.jsx)(Lt,{children:fe}),t[77]=fe,t[78]=pe);let me;t[79]!==c?.name||t[80]!==u||t[81]!==r?(me=r(u===`delete`?`settings.commands.sidebar.dialog.deleteDescription`:`settings.commands.sidebar.dialog.resetDescription`,{name:c?.name??``}),t[79]=c?.name,t[80]=u,t[81]=r,t[82]=me):me=t[82];let he;t[83]===me?he=t[84]:(he=(0,$.jsx)(Rt,{children:me}),t[83]=me,t[84]=he);let ge;t[85]!==pe||t[86]!==he?(ge=(0,$.jsxs)(Pt,{children:[pe,he]}),t[85]=pe,t[86]=he,t[87]=ge):ge=t[87];let _e;t[88]===r?_e=t[89]:(_e=r(`settings.common.actions.cancel`),t[88]=r,t[89]=_e);let ve;t[90]!==f||t[91]!==_e?(ve=(0,$.jsx)(q,{size:`sm`,variant:`ghost`,onClick:U,disabled:f,children:_e}),t[90]=f,t[91]=_e,t[92]=ve):ve=t[92];let ye;t[93]!==u||t[94]!==r?(ye=r(u===`delete`?`settings.common.actions.delete`:`settings.common.actions.reset`),t[93]=u,t[94]=r,t[95]=ye):ye=t[95];let be;t[96]!==ee||t[97]!==f||t[98]!==ye?(be=(0,$.jsx)(q,{size:`sm`,onClick:ee,disabled:f,children:ye}),t[96]=ee,t[97]=f,t[98]=ye,t[99]=be):be=t[99];let xe;t[100]!==ve||t[101]!==be?(xe=(0,$.jsxs)(Ft,{children:[ve,be]}),t[100]=ve,t[101]=be,t[102]=xe):xe=t[102];let Se;t[103]!==ge||t[104]!==xe?(Se=(0,$.jsxs)(It,{className:`max-w-md`,children:[ge,xe]}),t[103]=ge,t[104]=xe,t[105]=Se):Se=t[105];let Ce;t[106]!==ue||t[107]!==de||t[108]!==Se?(Ce=(0,$.jsx)(zt,{open:ue,onOpenChange:de,children:Se}),t[106]=ue,t[107]=de,t[108]=Se,t[109]=Ce):Ce=t[109];let we=i!==null,Te;t[110]===Symbol.for(`react.memo_cache_sentinel`)?(Te=e=>!e&&a(null),t[110]=Te):Te=t[110];let Ee;t[111]===r?Ee=t[112]:(Ee=r(`settings.commands.sidebar.renameDialog.title`),t[111]=r,t[112]=Ee);let De;t[113]===Ee?De=t[114]:(De=(0,$.jsx)(Lt,{children:Ee}),t[113]=Ee,t[114]=De);let Oe=i?.name??``,K;t[115]!==r||t[116]!==Oe?(K=r(`settings.commands.sidebar.renameDialog.description`,{name:Oe}),t[115]=r,t[116]=Oe,t[117]=K):K=t[117];let ke;t[118]===K?ke=t[119]:(ke=(0,$.jsx)(Rt,{children:K}),t[118]=K,t[119]=ke);let Ae;t[120]!==De||t[121]!==ke?(Ae=(0,$.jsxs)(Pt,{children:[De,ke]}),t[120]=De,t[121]=ke,t[122]=Ae):Ae=t[122];let je;t[123]===Symbol.for(`react.memo_cache_sentinel`)?(je=e=>s(e.target.value),t[123]=je):je=t[123];let Me;t[124]===r?Me=t[125]:(Me=r(`settings.commands.sidebar.renameDialog.placeholder`),t[124]=r,t[125]=Me);let Ne;t[126]===oe?Ne=t[127]:(Ne=e=>{e.key===`Enter`&&oe()},t[126]=oe,t[127]=Ne);let Pe;t[128]!==o||t[129]!==Me||t[130]!==Ne?(Pe=(0,$.jsx)(yn,{value:o,onChange:je,placeholder:Me,className:`text-foreground placeholder:text-muted-foreground`,onKeyDown:Ne}),t[128]=o,t[129]=Me,t[130]=Ne,t[131]=Pe):Pe=t[131];let Fe;t[132]===Symbol.for(`react.memo_cache_sentinel`)?(Fe=()=>a(null),t[132]=Fe):Fe=t[132];let Ie;t[133]===r?Ie=t[134]:(Ie=r(`settings.common.actions.cancel`),t[133]=r,t[134]=Ie);let Le;t[135]===Ie?Le=t[136]:(Le=(0,$.jsx)(q,{size:`sm`,variant:`ghost`,onClick:Fe,children:Ie}),t[135]=Ie,t[136]=Le);let J;t[137]===r?J=t[138]:(J=r(`settings.common.actions.rename`),t[137]=r,t[138]=J);let Re;t[139]!==oe||t[140]!==J?(Re=(0,$.jsx)(q,{size:`sm`,onClick:oe,children:J}),t[139]=oe,t[140]=J,t[141]=Re):Re=t[141];let ze;t[142]!==Le||t[143]!==Re?(ze=(0,$.jsxs)(Ft,{children:[Le,Re]}),t[142]=Le,t[143]=Re,t[144]=ze):ze=t[144];let Be;t[145]!==Ae||t[146]!==Pe||t[147]!==ze?(Be=(0,$.jsxs)(It,{children:[Ae,Pe,ze]}),t[145]=Ae,t[146]=Pe,t[147]=ze,t[148]=Be):Be=t[148];let Ve;t[149]!==we||t[150]!==Be?(Ve=(0,$.jsx)(zt,{open:we,onOpenChange:Te,children:Be}),t[149]=we,t[150]=Be,t[151]=Ve):Ve=t[151];let He;return t[152]!==se||t[153]!==ce||t[154]!==le||t[155]!==Ce||t[156]!==Ve?(He=(0,$.jsxs)(`div`,{className:se,children:[ce,le,Ce,Ve]}),t[152]=se,t[153]=ce,t[154]=le,t[155]=Ce,t[156]=Ve,t[157]=He):He=t[157],He},Co=e=>{let t=(0,Qi.c)(47),{command:n,isSelected:r,onSelect:i,onDelete:a,onReset:o,onRename:s,onDuplicate:c,isMenuOpen:l,onMenuOpenChange:u}=e,{t:d}=At(),f;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(f=Gt(),t[0]=f):f=t[0];let p=f,[m,h]=Q.useState(!1),g;t[1]!==a||t[2]!==c||t[3]!==s||t[4]!==o||t[5]!==d?(g=e=>(0,$.jsxs)($.Fragment,{children:[s&&(0,$.jsxs)(e,{onClick:e=>{e.stopPropagation(),s()},children:[(0,$.jsx)(Y,{name:`edit`,className:`h-4 w-4 mr-px`}),d(`settings.common.actions.rename`)]}),(0,$.jsxs)(e,{onClick:e=>{e.stopPropagation(),c()},children:[(0,$.jsx)(Y,{name:`file-copy`,className:`h-4 w-4 mr-px`}),d(`settings.common.actions.duplicate`)]}),o&&(0,$.jsxs)(e,{onClick:e=>{e.stopPropagation(),o()},children:[(0,$.jsx)(Y,{name:`restart`,className:`h-4 w-4 mr-px`}),d(`settings.common.actions.reset`)]}),a&&(0,$.jsxs)(e,{onClick:e=>{e.stopPropagation(),a()},className:`text-destructive focus:text-destructive`,children:[(0,$.jsx)(Y,{name:`delete-bin`,className:`h-4 w-4 mr-px text-inherit`}),d(`settings.common.actions.delete`)]})]}),t[1]=a,t[2]=c,t[3]=s,t[4]=o,t[5]=d,t[6]=g):g=t[6];let _=g,v=r?`bg-interactive-selection`:`hover:bg-interactive-hover`,y;t[7]===v?y=t[8]:(y=J(`yuri-settings-group-row group relative flex items-center transition-colors duration-150 select-none`,v),t[7]=v,t[8]=y);let b;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(b=p?void 0:e=>{e.preventDefault(),h(!0)},t[9]=b):b=t[9];let x;t[10]===y?x=t[11]:(x=(0,$.jsx)(`div`,{className:y,onContextMenu:b}),t[10]=y,t[11]=x);let S;t[12]===n.name?S=t[13]:(S=(0,$.jsxs)(`span`,{className:`typography-ui-label font-normal truncate text-foreground`,children:[`/`,n.name]}),t[12]=n.name,t[13]=S);let C;t[14]!==n||t[15]!==d?(C=(n.scope||ta(n))&&(0,$.jsx)(`span`,{className:`typography-micro text-muted-foreground bg-muted px-1 rounded flex-shrink-0 leading-none pb-px border border-border/50`,children:ta(n)?d(`settings.agents.sidebar.badge.system`):n.scope}),t[14]=n,t[15]=d,t[16]=C):C=t[16];let w;t[17]!==S||t[18]!==C?(w=(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[S,C]}),t[17]=S,t[18]=C,t[19]=w):w=t[19];let T;t[20]===n.description?T=t[21]:(T=n.description&&(0,$.jsx)(`div`,{className:`typography-micro text-muted-foreground/60 truncate leading-tight`,children:n.description}),t[20]=n.description,t[21]=T);let E;t[22]!==i||t[23]!==T||t[24]!==w?(E=(0,$.jsxs)(`button`,{onClick:i,className:`flex min-w-0 flex-1 flex-col gap-0 rounded-sm text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/50`,tabIndex:0,children:[w,T]}),t[22]=i,t[23]=T,t[24]=w,t[25]=E):E=t[25];let D;t[26]===u?D=t[27]:(D=e=>{e&&h(!1),u(e)},t[26]=u,t[27]=D);let O;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,$.jsx)(qt,{asChild:!0,children:(0,$.jsx)(q,{size:`sm`,variant:`ghost`,className:`h-6 w-6 px-0 flex-shrink-0 -mr-1 opacity-100 transition-opacity md:opacity-0 md:group-hover:opacity-100`,children:(0,$.jsx)(Y,{name:`more-2`,className:`h-3.5 w-3.5`})})}),t[28]=O):O=t[28];let k;t[29]===_?k=t[30]:(k=(0,$.jsx)(Jt,{align:`end`,className:`w-fit min-w-20`,children:_(Xt)}),t[29]=_,t[30]=k);let A;t[31]!==l||t[32]!==D||t[33]!==k?(A=(0,$.jsxs)(Zt,{open:l,onOpenChange:D,children:[O,k]}),t[31]=l,t[32]=D,t[33]=k,t[34]=A):A=t[34];let j;t[35]!==E||t[36]!==A?(j=(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center`,children:[E,A]}),t[35]=E,t[36]=A,t[37]=j):j=t[37];let M;t[38]!==j||t[39]!==x?(M=(0,$.jsx)(Qt,{render:x,children:j}),t[38]=j,t[39]=x,t[40]=M):M=t[40];let N;t[41]===_?N=t[42]:(N=(0,$.jsx)($t,{className:`w-fit min-w-20`,children:_(en)}),t[41]=_,t[42]=N);let P;return t[43]!==m||t[44]!==M||t[45]!==N?(P=(0,$.jsxs)(tn,{open:m,onOpenChange:h,children:[M,N]}),t[43]=m,t[44]=M,t[45]=N,t[46]=P):P=t[46],P};function wo(e){return{selectedCommandName:e.selectedCommandName,setSelectedCommand:e.setSelectedCommand,setCommandDraft:e.setCommandDraft,createCommand:e.createCommand,deleteCommand:e.deleteCommand}}function To(e){return e.name}function Eo(e){return!ta(e)}function Do(e,t){return e.name.localeCompare(t.name)}function Oo(e,t){return e.name.localeCompare(t.name)}var ko=()=>{let{t:e}=At(),{selectedCommandName:t,createCommand:n,updateCommand:r,commandDraft:i,setCommandDraft:a}=ra(te(e=>({selectedCommandName:e.selectedCommandName,createCommand:e.createCommand,updateCommand:e.updateCommand,commandDraft:e.commandDraft,setCommandDraft:e.setCommandDraft}))),o=qe(),s=Q.useMemo(()=>o.data??[],[o.data]),c=t?s.find(e=>e.name===t):null,l=!!(i&&i.name===t&&!c),[u,d]=Q.useState(``),[f,p]=Q.useState(`user`),[m,h]=Q.useState(``),[g,_]=Q.useState(``),[v,y]=Q.useState(``),[b,x]=Q.useState(``),[S,C]=Q.useState(!1),w=Q.useRef(null);Q.useEffect(()=>{if(l&&i){let e=i.name||``,t=i.scope||`user`,n=i.description||``,r=i.agent||``,a=i.model||``,o=i.template||``;d(e),p(t),h(n),_(r),y(a),x(o),w.current={draftName:e,draftScope:t,description:n,agent:r,model:a,template:o}}else if(c){let e=c.description||``,t=c.agent||``,n=c.model||``,r=c.template||``;h(e),_(t),y(n),x(r),w.current={draftName:``,draftScope:`user`,description:e,agent:t,model:n,template:r}}},[c,l,t,s,i]);let T=Q.useMemo(()=>{let e=w.current;return e?!!(l&&(u!==e.draftName||f!==e.draftScope)||m!==e.description||g!==e.agent||v!==e.model||b!==e.template):!1},[g,m,u,f,l,v,b]);return t?(0,$.jsx)(Nt,{outerClassName:`h-full`,className:`w-full`,children:(0,$.jsxs)(`div`,{className:`yuri-settings-page-content mx-auto w-full max-w-3xl p-3 sm:p-6 sm:pt-8`,children:[(0,$.jsx)(ei,{actions:(0,$.jsxs)(q,{onClick:async()=>{let i=l?u.trim().replace(/\s+/g,`-`):t?.trim();if(!i){X.error(e(`settings.commands.sidebar.toast.commandNameRequired`));return}if(!b.trim()){X.error(e(`settings.commands.page.toast.templateRequired`));return}if(l&&s.some(e=>e.name===i)){X.error(e(`settings.commands.sidebar.toast.commandExists`));return}C(!0);try{let t=g.trim(),o=v.trim(),s=b.trim(),c={name:i,description:m.trim()||void 0,agent:t===``?null:t,model:o===``?null:o,template:s,scope:l?f:void 0},u;l?(u=await n(c),u&&a(null)):u=await r(i,c),u?X.success(e(l?`settings.commands.page.toast.created`:`settings.commands.page.toast.updated`)):X.error(e(l?`settings.commands.page.toast.createFailed`:`settings.commands.page.toast.updateFailed`))}catch(t){console.error(`Error saving command:`,t),X.error(e(`settings.commands.page.toast.saveUnexpectedError`))}finally{C(!1)}},disabled:S||!T,size:`sm`,"aria-busy":S,children:[S?(0,$.jsx)(Y,{name:`loader-4`,className:`size-4 animate-spin motion-reduce:animate-none`}):null,e(S?`settings.common.actions.saving`:`settings.common.actions.saveChanges`)]}),children:(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`h2`,{className:`typography-ui-header font-semibold text-foreground truncate`,children:l?e(`settings.commands.page.title.new`):`/${t}`}),(0,$.jsx)(`p`,{className:`typography-meta text-muted-foreground truncate`,children:e(l?`settings.commands.page.subtitle.new`:`settings.commands.page.subtitle.edit`)})]})}),(0,$.jsxs)(ni,{label:e(`settings.commands.page.section.identity`),children:[l&&(0,$.jsxs)(ii,{itemId:`commands.name`,label:e(`settings.commands.page.field.commandName`),children:[(0,$.jsxs)(`div`,{className:`flex items-center`,children:[(0,$.jsx)(`span`,{className:`typography-ui-label text-muted-foreground mr-1`,children:`/`}),(0,$.jsx)(yn,{value:u,onChange:e=>d(e.target.value),placeholder:e(`settings.commands.page.field.commandNamePlaceholder`),className:`h-7 w-40 px-2`})]}),(0,$.jsxs)(lr,{value:f,onValueChange:e=>p(e),children:[(0,$.jsx)(cr,{className:`w-fit min-w-[100px]`,children:(0,$.jsx)(ar,{placeholder:e(`settings.agents.page.field.scopePlaceholder`)})}),(0,$.jsxs)(sr,{align:`end`,children:[(0,$.jsx)(or,{value:`user`,children:(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(Y,{name:`user-3`,className:`h-3.5 w-3.5`}),(0,$.jsx)(`span`,{children:e(`settings.common.scope.global`)})]})}),(0,$.jsx)(or,{value:`project`,children:(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(Y,{name:`folder`,className:`h-3.5 w-3.5`}),(0,$.jsx)(`span`,{children:e(`settings.common.scope.project`)})]})})]})]})]}),(0,$.jsx)(ii,{label:e(`settings.common.field.description`),className:`yuri-settings-split-row-stacked`,children:(0,$.jsx)(on,{embedded:!0,value:m,onChange:e=>h(e.target.value),placeholder:e(`settings.commands.page.field.descriptionPlaceholder`),rows:2,className:`w-full resize-none min-h-[60px] bg-transparent`})})]}),(0,$.jsxs)(ni,{label:e(`settings.commands.page.section.executionContext`),children:[(0,$.jsx)(ii,{itemId:`commands.agent`,label:e(`settings.commands.page.field.overrideAgent`),children:(0,$.jsx)(Mi,{agentName:g,onChange:e=>_(e),className:`yuri-settings-inline-value`})}),(0,$.jsx)(ii,{itemId:`commands.model`,label:e(`settings.agents.page.field.overrideModel`),children:(0,$.jsx)(ji,{providerId:Ye(v)?.providerId??``,modelId:Ye(v)?.modelId??``,onChange:(e,t)=>{y(e&&t?`${e}/${t}`:``)},className:`yuri-settings-inline-value`})})]}),(0,$.jsx)(ai,{itemId:`commands.template`,label:e(`settings.commands.page.section.template`),description:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`code`,{className:`text-foreground`,children:`$ARGUMENTS`}),` `,e(`settings.commands.page.templateHint.userInput`),` ·`,` `,(0,$.jsx)(`code`,{className:`text-foreground`,children:"!`cmd`"}),` `,e(`settings.commands.page.templateHint.shellOutput`),` ·`,` `,(0,$.jsx)(`code`,{className:`text-foreground`,children:`@file`}),` `,e(`settings.commands.page.templateHint.fileContents`)]}),descriptionPlacement:`outside`,className:`yuri-settings-split-row-stacked`,children:(0,$.jsx)(on,{embedded:!0,value:b,onChange:e=>x(e.target.value),placeholder:e(`settings.commands.page.field.templatePlaceholder`),rows:12,className:`w-full font-mono typography-meta min-h-[160px] max-h-[60vh] bg-transparent resize-y`})})]})}):(0,$.jsx)(`div`,{className:`flex h-full items-center justify-center`,children:(0,$.jsxs)(`div`,{className:`text-center text-muted-foreground`,children:[(0,$.jsx)(Y,{name:`terminal-box`,className:`mx-auto mb-3 h-12 w-12 opacity-50`}),(0,$.jsx)(`p`,{className:`typography-body`,children:e(`settings.commands.page.empty.title`)}),(0,$.jsx)(`p`,{className:`typography-meta mt-1 opacity-75`,children:e(`settings.commands.page.empty.description`)})]})})},Ao=[],jo=e=>{switch(e){case`connected`:return`success`;case`failed`:return`error`;case`needs_auth`:case`needs_client_registration`:return`warning`;default:return`idle`}},Mo=e=>{let t=(0,Qi.c)(5),{tone:n,enabled:r}=e;if(!r){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(`span`,{className:`inline-block h-2 w-2 rounded-full bg-muted-foreground/30 flex-shrink-0`}),t[0]=e):e=t[0],e}let i;t[1]===n?i=t[2]:(i=J(`inline-block h-2 w-2 rounded-full flex-shrink-0`,{success:`bg-[var(--status-success)]`,error:`bg-[var(--status-error)]`,warning:`bg-[var(--status-warning)]`,idle:`bg-muted-foreground/40`}[n]),t[1]=n,t[2]=i);let a;return t[3]===i?a=t[4]:(a=(0,$.jsx)(`span`,{className:i}),t[3]=i,t[4]=a),a},No=e=>{let t=(0,Qi.c)(115),{onItemSelect:n}=e,{t:i}=At(),{selectedMcpName:a,setSelectedMcp:o,setMcpDraft:s,deleteMcp:c}=ci(te(Po)),l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=Zr(),t[0]=l):l=t[0];let u=l,d=$r(u),f=Xr(u),p=d.data??Ao,m;t[1]===f.data?m=t[2]:(m=f.data??{},t[1]=f.data,t[2]=m);let h=m,[g,_]=Q.useState(null),[v,y]=Q.useState(!1),[b,x]=Q.useState(null),[S,C]=Q.useState(null),[w,T]=Q.useState(!1),E;t[3]===p?E=t[4]:(E=p.filter(Fo),t[3]=p,t[4]=E);let D=E,O;t[5]===p?O=t[6]:(O=p.filter(Io),t[5]=p,t[6]=O);let k=O,A;t[7]===w?A=t[8]:(A=()=>{if(w)return;T(!0);let e=new Promise(Lo),t=r();Promise.all([Yr(be,u,t),e]).catch(Ro).finally(()=>{T(!1)})},t[7]=w,t[8]=A);let j=A,M;t[9]!==p||t[10]!==n||t[11]!==s||t[12]!==o?(M=()=>{let e=`new-mcp-server`,t=1;for(;p.some(t=>t.name===e);)e=`new-mcp-server-${t}`,t++;s({name:e,scope:`user`,type:`local`,command:[],url:``,environment:[],headers:[],oauthEnabled:!0,oauthClientId:``,oauthClientSecret:``,oauthScope:``,oauthRedirectUri:``,timeout:``,enabled:!0}),o(e),n?.()},t[9]=p,t[10]=n,t[11]=s,t[12]=o,t[13]=M):M=t[13];let N=M,P;t[14]!==c||t[15]!==g||t[16]!==i?(P=async()=>{if(!g)return;y(!0);let e=await c(g.name,{directory:Zr(),transportIdentity:r()});e.ok?e.reloadFailed?X.warning(e.message||`MCP server "${g.name}" deleted, but OpenCode reload failed`,{description:e.warning||i(`settings.mcp.sidebar.toast.refreshListIfStale`)}):X.success(e.message||i(`settings.mcp.sidebar.toast.serverDeleted`,{name:g.name})):X.error(i(`settings.mcp.sidebar.toast.deleteFailed`)),_(null),y(!1)},t[14]=c,t[15]=g,t[16]=i,t[17]=P):P=t[17];let F=P,I;t[18]===i?I=t[19]:(I=(e,t)=>(0,$.jsxs)(t,{onClick:t=>{t.stopPropagation(),_(e)},className:`text-destructive focus:text-destructive`,children:[(0,$.jsx)(Y,{name:`delete-bin`,className:`h-4 w-4 mr-px text-inherit`}),i(`settings.common.actions.delete`)]}),t[18]=i,t[19]=I);let L=I,R;t[20]===i?R=t[21]:(R=i(`settings.mcp.sidebar.group.userServers`),t[20]=i,t[21]=R);let z;t[22]===R?z=t[23]:(z=(0,$.jsx)(`span`,{children:R}),t[22]=R,t[23]=z);let B;t[24]===i?B=t[25]:(B=i(`settings.mcp.sidebar.actions.refreshStatusAria`),t[24]=i,t[25]=B);let V;t[26]===i?V=t[27]:(V=i(`settings.mcp.sidebar.actions.refreshStatusTitle`),t[26]=i,t[27]=V);let H=w&&`animate-spin`,U;t[28]===H?U=t[29]:(U=J(`h-4 w-4`,H),t[28]=H,t[29]=U);let W;t[30]===U?W=t[31]:(W=(0,$.jsx)(Y,{name:`refresh`,className:U}),t[30]=U,t[31]=W);let ee;t[32]!==j||t[33]!==w||t[34]!==B||t[35]!==V||t[36]!==W?(ee=(0,$.jsx)(q,{type:`button`,size:`icon`,variant:`ghost`,disabled:w,onClick:j,"aria-label":B,title:V,children:W}),t[32]=j,t[33]=w,t[34]=B,t[35]=V,t[36]=W,t[37]=ee):ee=t[37];let ne;t[38]===i?ne=t[39]:(ne=i(`settings.mcp.sidebar.actions.addServerTitle`),t[38]=i,t[39]=ne);let re;t[40]===i?re=t[41]:(re=i(`settings.mcp.sidebar.actions.addServerTitle`),t[40]=i,t[41]=re);let G;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,$.jsx)(Y,{name:`add`,className:`h-4 w-4`}),t[42]=G):G=t[42];let ie;t[43]!==N||t[44]!==ne||t[45]!==re?(ie=(0,$.jsx)(q,{"data-settings-item":`mcp.create`,size:`icon`,variant:`ghost`,onClick:N,"aria-label":ne,title:re,children:G}),t[43]=N,t[44]=ne,t[45]=re,t[46]=ie):ie=t[46];let ae;t[47]!==ee||t[48]!==ie?(ae=(0,$.jsxs)(`div`,{className:`flex items-center gap-1`,children:[ee,ie]}),t[47]=ee,t[48]=ie,t[49]=ae):ae=t[49];let oe;t[50]!==z||t[51]!==ae?(oe=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[z,ae]}),t[50]=z,t[51]=ae,t[52]=oe):oe=t[52];let se=oe,ce;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(ce=(0,$.jsx)(ni,{children:(0,$.jsx)(`div`,{className:`yuri-settings-group-row`,children:(0,$.jsx)(Ta,{})})}),t[53]=ce):ce=t[53];let le;t[54]!==d.data||t[55]!==d.error||t[56]!==d.isError||t[57]!==p.length||t[58]!==h||t[59]!==n||t[60]!==b||t[61]!==D||t[62]!==L||t[63]!==S||t[64]!==a||t[65]!==s||t[66]!==o||t[67]!==f.data||t[68]!==f.error||t[69]!==f.isError||t[70]!==i||t[71]!==k||t[72]!==se?(le=(0,$.jsx)($.Fragment,{children:d.isError&&!d.data?(0,$.jsx)(ni,{label:se,children:(0,$.jsx)(`div`,{className:`yuri-settings-group-row py-12 text-center typography-meta text-[var(--status-error)]`,children:d.error.message})}):p.length===0?(0,$.jsx)(ni,{label:se,children:(0,$.jsxs)(`div`,{className:`yuri-settings-group-row py-12 text-center text-muted-foreground`,children:[(0,$.jsx)(Y,{name:`plug`,className:`mx-auto mb-3 h-10 w-10 opacity-50`}),(0,$.jsx)(`p`,{className:`typography-ui-label font-medium`,children:i(`settings.mcp.sidebar.empty.title`)}),(0,$.jsx)(`p`,{className:`typography-meta mt-1 opacity-75`,children:i(`settings.mcp.sidebar.empty.description`)})]})}):(0,$.jsxs)($.Fragment,{children:[D.length>0&&(0,$.jsx)(ni,{label:i(`settings.mcp.sidebar.group.projectServers`),children:D.map(e=>{let t=jo((h[e.name]??(f.isError&&!f.data?{status:`failed`,error:f.error.message}:void 0))?.status),r=a===e.name,c=Gt();return(0,$.jsxs)(tn,{open:S===e.name,onOpenChange:t=>C(t?e.name:null),children:[(0,$.jsxs)(Qt,{render:(0,$.jsx)(`div`,{className:J(`yuri-settings-group-row group relative flex items-center transition-colors duration-150 select-none`,r?`bg-interactive-selection`:`hover:bg-interactive-hover`),onContextMenu:c?void 0:t=>{t.preventDefault(),C(e.name)}}),children:[(0,$.jsxs)(`button`,{onClick:()=>{o(e.name),s(null),n?.()},className:`flex min-w-0 flex-1 flex-col gap-0 rounded-sm text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/50`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(Mo,{tone:t,enabled:e.enabled}),(0,$.jsx)(`span`,{className:`typography-ui-label font-normal truncate text-foreground`,children:e.name}),(0,$.jsx)(`span`,{title:e.type===`local`?i(`settings.mcp.sidebar.serverType.localTitle`):i(`settings.mcp.sidebar.serverType.remoteTitle`),children:e.type===`local`?(0,$.jsx)(Y,{name:`server`,className:`h-3 w-3 text-muted-foreground/60 flex-shrink-0`}):(0,$.jsx)(Y,{name:`global`,className:`h-3 w-3 text-muted-foreground/60 flex-shrink-0`})})]}),(0,$.jsx)(`div`,{className:`typography-micro text-muted-foreground/60 truncate leading-tight pl-4`,children:e.type===`local`?e.command?.join(` `)??``:e.url??``})]}),(0,$.jsxs)(Zt,{open:b===e.name,onOpenChange:t=>{t&&C(null),x(t?e.name:null)},children:[(0,$.jsx)(qt,{asChild:!0,children:(0,$.jsx)(q,{size:`xs`,variant:`ghost`,className:`flex-shrink-0 -mr-1 opacity-100 transition-opacity md:opacity-0 md:group-hover:opacity-100`,children:(0,$.jsx)(Y,{name:`more-2`,className:`h-3.5 w-3.5`})})}),(0,$.jsx)(Jt,{align:`end`,className:`w-fit min-w-20`,children:L(e,Xt)})]})]}),(0,$.jsx)($t,{className:`w-fit min-w-20`,children:L(e,en)})]},e.name)})}),k.length>0&&(0,$.jsx)(ni,{label:se,children:k.map(e=>{let t=jo((h[e.name]??(f.isError&&!f.data?{status:`failed`,error:f.error.message}:void 0))?.status),r=a===e.name,c=Gt();return(0,$.jsxs)(tn,{open:S===e.name,onOpenChange:t=>C(t?e.name:null),children:[(0,$.jsxs)(Qt,{render:(0,$.jsx)(`div`,{className:J(`yuri-settings-group-row group relative flex items-center transition-colors duration-150 select-none`,r?`bg-interactive-selection`:`hover:bg-interactive-hover`),onContextMenu:c?void 0:t=>{t.preventDefault(),C(e.name)}}),children:[(0,$.jsxs)(`button`,{onClick:()=>{o(e.name),s(null),n?.()},className:`flex min-w-0 flex-1 flex-col gap-0 rounded-sm text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/50`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(Mo,{tone:t,enabled:e.enabled}),(0,$.jsx)(`span`,{className:`typography-ui-label font-normal truncate text-foreground`,children:e.name}),(0,$.jsx)(`span`,{title:e.type===`local`?i(`settings.mcp.sidebar.serverType.localTitle`):i(`settings.mcp.sidebar.serverType.remoteTitle`),children:e.type===`local`?(0,$.jsx)(Y,{name:`server`,className:`h-3 w-3 text-muted-foreground/60 flex-shrink-0`}):(0,$.jsx)(Y,{name:`global`,className:`h-3 w-3 text-muted-foreground/60 flex-shrink-0`})})]}),(0,$.jsx)(`div`,{className:`typography-micro text-muted-foreground/60 truncate leading-tight pl-4`,children:e.type===`local`?e.command?.join(` `)??``:e.url??``})]}),(0,$.jsxs)(Zt,{open:b===e.name,onOpenChange:t=>{t&&C(null),x(t?e.name:null)},children:[(0,$.jsx)(qt,{asChild:!0,children:(0,$.jsx)(q,{size:`xs`,variant:`ghost`,className:`flex-shrink-0 -mr-1 opacity-100 transition-opacity md:opacity-0 md:group-hover:opacity-100`,children:(0,$.jsx)(Y,{name:`more-2`,className:`h-3.5 w-3.5`})})}),(0,$.jsx)(Jt,{align:`end`,className:`w-fit min-w-20`,children:L(e,Xt)})]})]}),(0,$.jsx)($t,{className:`w-fit min-w-20`,children:L(e,en)})]},e.name)})}),k.length===0&&(0,$.jsx)(ni,{label:se,cardClassName:`hidden`,children:(0,$.jsx)(`span`,{})})]})}),t[54]=d.data,t[55]=d.error,t[56]=d.isError,t[57]=p.length,t[58]=h,t[59]=n,t[60]=b,t[61]=D,t[62]=L,t[63]=S,t[64]=a,t[65]=s,t[66]=o,t[67]=f.data,t[68]=f.error,t[69]=f.isError,t[70]=i,t[71]=k,t[72]=se,t[73]=le):le=t[73];let ue=g!==null,de;t[74]===v?de=t[75]:(de=e=>{!e&&!v&&_(null)},t[74]=v,t[75]=de);let fe;t[76]===i?fe=t[77]:(fe=i(`settings.mcp.sidebar.deleteDialog.title`),t[76]=i,t[77]=fe);let pe;t[78]===fe?pe=t[79]:(pe=(0,$.jsx)(Lt,{children:fe}),t[78]=fe,t[79]=pe);let me=g?.name||``,he;t[80]!==i||t[81]!==me?(he=i(`settings.mcp.sidebar.deleteDialog.descriptionPrefix`,{name:me}),t[80]=i,t[81]=me,t[82]=he):he=t[82];let ge;t[83]===Symbol.for(`react.memo_cache_sentinel`)?(ge=(0,$.jsx)(`code`,{className:`text-foreground`,children:`opencode.json`}),t[83]=ge):ge=t[83];let _e;t[84]===he?_e=t[85]:(_e=(0,$.jsxs)(Rt,{children:[he,` `,ge,`.`]}),t[84]=he,t[85]=_e);let ve;t[86]!==pe||t[87]!==_e?(ve=(0,$.jsxs)(Pt,{children:[pe,_e]}),t[86]=pe,t[87]=_e,t[88]=ve):ve=t[88];let ye;t[89]===Symbol.for(`react.memo_cache_sentinel`)?(ye=()=>_(null),t[89]=ye):ye=t[89];let xe;t[90]===i?xe=t[91]:(xe=i(`settings.common.actions.cancel`),t[90]=i,t[91]=xe);let Se;t[92]!==v||t[93]!==xe?(Se=(0,$.jsx)(q,{size:`sm`,variant:`ghost`,onClick:ye,disabled:v,children:xe}),t[92]=v,t[93]=xe,t[94]=Se):Se=t[94];let Ce;t[95]!==v||t[96]!==i?(Ce=i(v?`settings.mcp.sidebar.actions.deleting`:`settings.common.actions.delete`),t[95]=v,t[96]=i,t[97]=Ce):Ce=t[97];let we;t[98]!==F||t[99]!==v||t[100]!==Ce?(we=(0,$.jsx)(q,{size:`sm`,onClick:F,disabled:v,children:Ce}),t[98]=F,t[99]=v,t[100]=Ce,t[101]=we):we=t[101];let Te;t[102]!==Se||t[103]!==we?(Te=(0,$.jsxs)(Ft,{children:[Se,we]}),t[102]=Se,t[103]=we,t[104]=Te):Te=t[104];let Ee;t[105]!==ve||t[106]!==Te?(Ee=(0,$.jsxs)(It,{className:`max-w-md`,children:[ve,Te]}),t[105]=ve,t[106]=Te,t[107]=Ee):Ee=t[107];let De;t[108]!==ue||t[109]!==de||t[110]!==Ee?(De=(0,$.jsx)(zt,{open:ue,onOpenChange:de,children:Ee}),t[108]=ue,t[109]=de,t[110]=Ee,t[111]=De):De=t[111];let Oe;return t[112]!==le||t[113]!==De?(Oe=(0,$.jsxs)(`div`,{className:`yuri-settings-page-content h-full overflow-y-auto bg-background p-3`,children:[ce,le,De]}),t[112]=le,t[113]=De,t[114]=Oe):Oe=t[114],Oe};function Po(e){return{selectedMcpName:e.selectedMcpName,setSelectedMcp:e.setSelectedMcp,setMcpDraft:e.setMcpDraft,deleteMcp:e.deleteMcp}}function Fo(e){return e.scope===`project`}function Io(e){return e.scope!==`project`}function Lo(e){return setTimeout(e,500)}function Ro(e){X.error(e instanceof Error?e.message:String(e))}function zo(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Bo(e){return Array.isArray(e)&&e.every(e=>typeof e==`string`)}function Vo(e,t){return t===void 0?{ok:!1,error:e}:{ok:!1,error:e,parsed:t}}function Ho(e,t,n){return{ok:!0,name:e,type:t,command:Uo(n),url:typeof n.url==`string`?n.url.trim():``,environment:Wo(n,`env`,`environment`),headers:Wo(n,`headers`),oauthEnabled:Go(n),oauthClientId:typeof n.oauth==`object`&&n.oauth!==null?String(n.oauth.clientId??``).trim():``,oauthClientSecret:typeof n.oauth==`object`&&n.oauth!==null?String(n.oauth.clientSecret??``).trim():``,oauthScope:typeof n.oauth==`object`&&n.oauth!==null?String(n.oauth.scope??``).trim():``,oauthRedirectUri:typeof n.oauth==`object`&&n.oauth!==null?String(n.oauth.redirectUri??``).trim():``,timeout:Ko(n),enabled:qo(n)}}function Uo(e){let t=e.command,n=e.args;if(Bo(t)&&Bo(n))return[...t,...n];if(Bo(t))return t;if(typeof t==`string`&&t.trim()){let e=t.trim().split(/\s+/);return Bo(n)?[...e,...n]:e}return Bo(n)?n:[]}function Wo(e,...t){for(let n of t){let t=e[n];if(!zo(t))continue;let r=Object.entries(t).filter(([e,t])=>e&&typeof t==`string`);if(r.length>0)return r.map(([e,t])=>({key:e,value:String(t)}))}return[]}function Go(e){if(e.oauth===!1||e.oauth===null||e.oauth===void 0||!zo(e.oauth))return!1;let t=e.oauth;return!!(typeof t.clientId==`string`&&t.clientId.trim()||typeof t.clientSecret==`string`&&t.clientSecret.trim()||typeof t.scope==`string`&&t.scope.trim()||typeof t.redirectUri==`string`&&t.redirectUri.trim())}function Ko(e){let t=e.timeout;if(typeof t==`number`&&Number.isFinite(t)&&t>0)return String(Math.floor(t));if(typeof t==`string`&&t.trim()){let e=Number(t);if(Number.isFinite(e)&&e>0)return String(Math.floor(e))}return``}function qo(e){return`disabled`in e&&e.disabled===!0?!1:`enabled`in e?!!e.enabled:!0}function Jo(e){let t=e.mcpServers;if(zo(t)){let e=Object.keys(t);if(e.length===1){let n=e[0],r=t[n];if(zo(r))return{name:n,entry:r}}if(e.length>1)return null}let n=Object.keys(e).filter(t=>{let n=e[t];return t!==`mcpServers`&&zo(n)});if(n.length===1){let t=n[0],r=e[t];if(Yo(r))return{name:t,entry:r}}return null}function Yo(e){return e.type===`local`||e.type===`remote`||Array.isArray(e.command)||typeof e.url==`string`||Array.isArray(e.args)}function Xo(e,t){let n;try{let t=e.trim();if(!t)return Vo(`No JSON content provided`);n=JSON.parse(t)}catch(e){return Vo(e instanceof Error?`Invalid JSON: ${e.message}`:`Invalid JSON`)}if(!zo(n))return Vo(`Expected a JSON object, not an array or primitive`);let r=n,i=r.mcpServers;if(zo(i)){let e=Object.keys(i);if(e.length===0)return Vo(`mcpServers object is empty`,n);if(e.length>1)return Vo(`Paste one server at a time. Found `+e.length+` servers in mcpServers`,n);let t=e[0],r=i[t];return zo(r)?Ho(t,Zo(r),r):Vo(`Server entry is not a valid object`,n)}let a=r.mcp;if(zo(a)){let e=Object.keys(a);if(e.length===0)return Vo(`mcp object is empty`,n);if(e.length>1)return Vo(`Paste one server at a time. Found `+e.length+` servers in mcp`,n);let t=e[0],r=a[t];return zo(r)?Ho(t,Zo(r),r):Vo(`Server entry in mcp is not a valid object`,n)}let o=Jo(r);if(o)return Ho(o.name,Zo(o.entry),o.entry);if(Yo(r)){let e=Zo(r);return Ho(typeof r.name==`string`&&r.name.trim()?r.name.trim():t?.fallbackName,e,r)}return Vo(`No recognizable MCP server configuration found in JSON`,n)}function Zo(e){return e.type===`remote`?`remote`:e.type===`local`?`local`:typeof e.url==`string`&&e.url.trim()?`remote`:(Array.isArray(e.command)||typeof e.command==`string`||Array.isArray(e.args),`local`)}function Qo(e,t,n){let r=n?.isNewServer??!1,i=e.name,a=r&&i?i:t.name??``;return{...t,name:a,type:e.type,command:e.type===`local`?e.command:[],url:e.type===`remote`?e.url:``,environment:e.environment,headers:e.type===`remote`?e.headers:[],oauthEnabled:e.type===`remote`&&e.oauthEnabled,oauthClientId:e.type===`remote`?e.oauthClientId:``,oauthClientSecret:e.type===`remote`?e.oauthClientSecret:``,oauthScope:e.type===`remote`?e.oauthScope:``,oauthRedirectUri:e.type===`remote`?e.oauthRedirectUri:``,timeout:e.type===`remote`?e.timeout:``,enabled:e.enabled}}function $o(e){let t=[],n=``,r=!1,i=!1;for(let a=0;a<e.length;a++){let o=e[a];if(o===`'`&&!i){r=!r;continue}if(o===`"`&&!r){i=!i;continue}if((o===` `||o===` `)&&!r&&!i){n&&=(t.push(n),``);continue}n+=o}return n&&t.push(n),t}function es(e){let t=e.trim();if(!t)return{code:null};try{let e=new URL(t).searchParams.get(`code`);if(typeof e==`string`&&e.trim())return{code:e.trim()}}catch{}return{code:t}}var ts=({value:e,onChange:t,pasteCommandTitle:n,pasteCommandLabel:r,pasteSuccess:i,clipboardReadFailed:a,preview:o})=>{let[s,c]=Q.useState(()=>e.join(`
3
3
  `)),l=Q.useRef(e);Q.useEffect(()=>{JSON.stringify(l.current)!==JSON.stringify(e)&&(l.current=e,c(e.join(`
4
4
  `)))},[e]);let u=e=>{t(e.split(`
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{$ as t,Q as n,et as r,ot as i,rt as a,st as o,tt as s}from"./vendor-base-ui-wXsskyKm.js";import{n as c}from"./vendor-react-BkccXcWz.js";import{o as l}from"./session-startup-barrier-DT-hIBRf.js";import{t as u}from"./i18n-DXc6czdR.js";import{SettingsView as d}from"./SettingsView-CLE6ra3s.js";var f=c(),p=e(o(),1),m=i(),h=e=>{let i=(0,f.c)(19),{open:o,onOpenChange:c}=e,{t:h}=u(),_=p.useId(),v=g,y;i[0]===c?y=i[1]:(y=e=>{!e&&v()||c(e)},i[0]=c,i[1]=y);let b;i[2]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,m.jsx)(a,{className:l(`fixed inset-0 z-50 bg-black/50 dark:bg-black/75`,`transition-opacity duration-150 ease-out`,`data-[starting-style]:opacity-0 data-[ending-style]:opacity-0`)}),i[2]=b):b=i[2];let x;i[3]===Symbol.for(`react.memo_cache_sentinel`)?(x=l(`relative pointer-events-auto`,`w-[90vw] max-w-[1200px] h-[85vh] max-h-[900px]`,`rounded-xl border shadow-none overflow-hidden origin-center`,`bg-background`,`transition-all duration-150 ease-out`,`data-[starting-style]:opacity-0 data-[starting-style]:scale-[0.98]`,`data-[ending-style]:opacity-0 data-[ending-style]:scale-[0.98]`,`data-[nested-dialog-open]:brightness-[0.55] dark:data-[nested-dialog-open]:brightness-[0.4]`),i[3]=x):x=i[3];let S;i[4]===h?S=i[5]:(S=h(`settings.window.description`),i[4]=h,i[5]=S);let C;i[6]!==_||i[7]!==S?(C=(0,m.jsx)(s,{id:_,className:`sr-only`,children:S}),i[6]=_,i[7]=S,i[8]=C):C=i[8];let w;i[9]===c?w=i[10]:(w=(0,m.jsx)(d,{onClose:()=>c(!1),isWindowed:!0}),i[9]=c,i[10]=w);let T;i[11]!==_||i[12]!==C||i[13]!==w?(T=(0,m.jsxs)(t,{children:[b,(0,m.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center pointer-events-none`,children:(0,m.jsxs)(r,{"aria-describedby":_,className:x,children:[C,w]})})]}),i[11]=_,i[12]=C,i[13]=w,i[14]=T):T=i[14];let E;return i[15]!==o||i[16]!==y||i[17]!==T?(E=(0,m.jsx)(n,{open:o,onOpenChange:y,children:T}),i[15]=o,i[16]=y,i[17]=T,i[18]=E):E=i[18],E};function g(){return typeof document>`u`?!1:!!document.querySelector(`[data-slot="dropdown-menu-content"][data-open], [data-slot="select-content"][data-open]`)}export{h as SettingsWindow};
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{$ as t,Q as n,et as r,ot as i,rt as a,st as o,tt as s}from"./vendor-base-ui-wXsskyKm.js";import{n as c}from"./vendor-react-BkccXcWz.js";import{o as l}from"./session-startup-barrier-DT-hIBRf.js";import{t as u}from"./i18n-DXc6czdR.js";import{SettingsView as d}from"./SettingsView-DEU94-h1.js";var f=c(),p=e(o(),1),m=i(),h=e=>{let i=(0,f.c)(19),{open:o,onOpenChange:c}=e,{t:h}=u(),_=p.useId(),v=g,y;i[0]===c?y=i[1]:(y=e=>{!e&&v()||c(e)},i[0]=c,i[1]=y);let b;i[2]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,m.jsx)(a,{className:l(`fixed inset-0 z-50 bg-black/50 dark:bg-black/75`,`transition-opacity duration-150 ease-out`,`data-[starting-style]:opacity-0 data-[ending-style]:opacity-0`)}),i[2]=b):b=i[2];let x;i[3]===Symbol.for(`react.memo_cache_sentinel`)?(x=l(`relative pointer-events-auto`,`w-[90vw] max-w-[1200px] h-[85vh] max-h-[900px]`,`rounded-xl border shadow-none overflow-hidden origin-center`,`bg-background`,`transition-all duration-150 ease-out`,`data-[starting-style]:opacity-0 data-[starting-style]:scale-[0.98]`,`data-[ending-style]:opacity-0 data-[ending-style]:scale-[0.98]`,`data-[nested-dialog-open]:brightness-[0.55] dark:data-[nested-dialog-open]:brightness-[0.4]`),i[3]=x):x=i[3];let S;i[4]===h?S=i[5]:(S=h(`settings.window.description`),i[4]=h,i[5]=S);let C;i[6]!==_||i[7]!==S?(C=(0,m.jsx)(s,{id:_,className:`sr-only`,children:S}),i[6]=_,i[7]=S,i[8]=C):C=i[8];let w;i[9]===c?w=i[10]:(w=(0,m.jsx)(d,{onClose:()=>c(!1),isWindowed:!0}),i[9]=c,i[10]=w);let T;i[11]!==_||i[12]!==C||i[13]!==w?(T=(0,m.jsxs)(t,{children:[b,(0,m.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center pointer-events-none`,children:(0,m.jsxs)(r,{"aria-describedby":_,className:x,children:[C,w]})})]}),i[11]=_,i[12]=C,i[13]=w,i[14]=T):T=i[14];let E;return i[15]!==o||i[16]!==y||i[17]!==T?(E=(0,m.jsx)(n,{open:o,onOpenChange:y,children:T}),i[15]=o,i[16]=y,i[17]=T,i[18]=E):E=i[18],E};function g(){return typeof document>`u`?!1:!!document.querySelector(`[data-slot="dropdown-menu-content"][data-open], [data-slot="select-content"][data-open]`)}export{h as SettingsWindow};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,n}from"./runtime-switch-DEPKHgdL.js";import{ot as r,st as i}from"./vendor-base-ui-wXsskyKm.js";import{n as a}from"./vendor-react-BkccXcWz.js";import{s as o}from"./vendor-tanstack-react-query-DIb_ItL-.js";import{c as s}from"./yuriEvents-BFrD5fMU.js";import{r as c}from"./vendor-reactuses-core-DjKFMfz7.js";import{i as l,o as u}from"./session-startup-barrier-DT-hIBRf.js";import{n as d}from"./Icon-DmykXZL1.js";import{Ea as f,Hi as p}from"./ui-DrAJTWV6.js";import{t as m}from"./i18n-DXc6czdR.js";import{a as h,n as g,o as _,t as v}from"./dialog-BeFBA6ja.js";import{n as y}from"./MarkdownRenderer-D7p9Iflj.js";import{t as b}from"./checkbox-BMN5hAVm.js";import{t as x}from"./YuriLogo-Cp6vWDWp.js";import{a as S,i as C}from"./ModelLogo-BkbD514M.js";import{l as w}from"./zhipuai-coding-plan-CcFj8zKy.js";import{t as T}from"./ProviderLogo-DA98yu7M.js";import{n as E}from"./speechSettingsQueries-DQnPLEf3.js";import{n as D,t as O}from"./YuriWordmark-CLGHwobA.js";import{n as k}from"./SettingsGroup-CvaPYznp.js";import{a as A,c as j,n as M,r as N,t as P}from"./usePluginsStore-ZHQOW-R5.js";import{a as F,l as I,n as ee,o as te,r as L,t as R}from"./pluginPresentation-DexqrdQ0.js";import{a as z,c as ne,d as re,l as B,o as V,s as ie,t as H,u as U}from"./historyImportQueries-D00KjUT2.js";var W=e(i(),1),G=a(),K=[{name:`Magpie`,spec:`opencode-magpie-plugin`},{name:`Eficy`,spec:`@eficy/opencode2-plugin`},{name:`yee-profile`,spec:`@yee94/opencode-profile`}];function ae(e,t){return e.some(e=>e.parsedKind===`npm`&&R(e.spec).name===t)}async function q(e,t){let n=[];for(let r of new Set(e)){if(!t.current())throw Error(`Runtime changed`);try{let e=await t.list();if(!t.current())throw Error(`Runtime changed`);ae(e,r)||(await t.create(r)).ok||n.push(r)}catch{n.push(r)}}if(!t.current())throw Error(`Runtime changed`);return{failed:n}}function oe(e,r,i){let a=t(),o=n();return q(e,{current:()=>!i.aborted&&o===n()&&a===t(),list:async()=>(await s.fetchQuery({...N(r,a),staleTime:0})).entries,create:e=>P.getState().createEntry({spec:e,scope:`user`})})}var J=`data:image/svg+xml,%3csvg%20viewBox='0%200%2024%2024'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eClaude%20Code%3c/title%3e%3cpath%20clip-rule='evenodd'%20d='M20.998%2010.949H24v3.102h-3v3.028h-1.487V20H18v-2.921h-1.487V20H15v-2.921H9V20H7.488v-2.921H6V20H4.487v-2.921H3V14.05H0V10.95h3V5h17.998v5.949zM6%2010.949h1.488V8.102H6v2.847zm10.51%200H18V8.102h-1.49v2.847z'%20fill='%23D97757'%20fill-rule='evenodd'/%3e%3c/svg%3e`,Y=`data:image/svg+xml,%3csvg%20viewBox='0%200%2024%2024'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eCodex%3c/title%3e%3cpath%20d='M19.503%200H4.496A4.496%204.496%200%20000%204.496v15.007A4.496%204.496%200%20004.496%2024h15.007A4.496%204.496%200%200024%2019.503V4.496A4.496%204.496%200%200019.503%200z'%20fill='%23fff'/%3e%3cpath%20d='M9.064%203.344a4.578%204.578%200%20012.285-.312c1%20.115%201.891.54%202.673%201.275.01.01.024.017.037.021a.09.09%200%2000.043%200%204.55%204.55%200%20013.046.275l.047.022.116.057a4.581%204.581%200%20012.188%202.399c.209.51.313%201.041.315%201.595a4.24%204.24%200%2001-.134%201.223.123.123%200%2000.03.115c.594.607.988%201.33%201.183%202.17.289%201.425-.007%202.71-.887%203.854l-.136.166a4.548%204.548%200%2001-2.201%201.388.123.123%200%2000-.081.076c-.191.551-.383%201.023-.74%201.494-.9%201.187-2.222%201.846-3.711%201.838-1.187-.006-2.239-.44-3.157-1.302a.107.107%200%2000-.105-.024c-.388.125-.78.143-1.204.138a4.441%204.441%200%2001-1.945-.466%204.544%204.544%200%2001-1.61-1.335c-.152-.202-.303-.392-.414-.617a5.81%205.81%200%2001-.37-.961%204.582%204.582%200%2001-.014-2.298.124.124%200%2000.006-.056.085.085%200%2000-.027-.048%204.467%204.467%200%2001-1.034-1.651%203.896%203.896%200%2001-.251-1.192%205.189%205.189%200%2001.141-1.6c.337-1.112.982-1.985%201.933-2.618.212-.141.413-.251.601-.33.215-.089.43-.164.646-.227a.098.098%200%2000.065-.066%204.51%204.51%200%2001.829-1.615%204.535%204.535%200%20011.837-1.388zm3.482%2010.565a.637.637%200%20000%201.272h3.636a.637.637%200%20100-1.272h-3.636zM8.462%209.23a.637.637%200%2000-1.106.631l1.272%202.224-1.266%202.136a.636.636%200%20101.095.649l1.454-2.455a.636.636%200%2000.005-.64L8.462%209.23z'%20fill='url(%23codex-gradient)'/%3e%3cdefs%3e%3clinearGradient%20gradientUnits='userSpaceOnUse'%20id='codex-gradient'%20x1='12'%20x2='12'%20y1='3'%20y2='21'%3e%3cstop%20stop-color='%23B1A7FF'/%3e%3cstop%20offset='.5'%20stop-color='%237A9DFF'/%3e%3cstop%20offset='1'%20stop-color='%233941FF'/%3e%3c/linearGradient%3e%3c/defs%3e%3c/svg%3e`,X=r(),se={claude:J,codex:Y,cursor:S,dsh:C,opencode:w};function ce({onBusy:e,directory:r=null,onPrimaryChange:i,onComplete:a}){let{t:o,locale:s}=m(),f=t(),p=n(),[h,g]=W.useState([]),[_,v]=W.useState(!1),[y,x]=W.useState(null),S=V(),C=S.data?.state===`running`,w=ie(S.isSuccess&&!C),T=ne(w.data?.id,r,`${S.data?.id??``}:${S.data?.state??``}`,!C&&!w.isFetching&&!w.isError),E=W.useRef(null),D=W.useRef(!1),O=W.useRef(null),k=W.useRef(null),A=c(e),j=c(e=>i?.(e)),M=c((e,t)=>g(n=>t?n.includes(e)?n:[...n,e]:n.filter(t=>t!==e)));W.useEffect(()=>{let e=new AbortController;return E.current=e,()=>{e.abort(),A(!1)}},[f,p,A]);let N=W.useMemo(()=>{let e=B.map(e=>({...e,sessions:[]}));for(let t of w.data?.sessions??[]){let n=e.find(e=>e.id===t.source);n&&n.sessions.length<5&&n.sessions.push(t)}return e.filter(e=>e.sessions.length)},[w.data]),P=!!(O.current&&S.data?.id===O.current&&re(S.data)),F=_||!C&&!P&&(w.isFetching||!w.data||w.isError||S.isError);W.useEffect(()=>{j({disabled:F,background:C})},[F,C,j]);let I=()=>!E.current?.signal.aborted&&f===t()&&p===n(),ee=async e=>{if(!(D.current||!E.current)){D.current=!0,v(!0),A(!0),x(null);try{await e(E.current.signal)}catch(e){I()&&x(e instanceof Error&&/^[a-z_]+$/.test(e.message)?e.message:`import_failed`)}finally{D.current=!1,I()&&(v(!1),A(!1))}}},te=()=>ee(async e=>{if(F)return;if(C||P){I()&&a?.();return}if(!h.length){I()&&a?.();return}let t=await z(h,r,e,f,p);I()&&(O.current=t.id,k.current?.scrollIntoView({block:`start`}))}),L=w.error??S.error,R=y||(L instanceof Error&&/^[a-z_]+$/.test(L.message)?L.message:w.isError||S.isError?`import_failed`:null),G=W.useMemo(()=>new Intl.DateTimeFormat(s,{month:`short`,day:`numeric`}),[s]),K=S.data?U(S.data):null,ae=W.useMemo(()=>new Intl.NumberFormat(s),[s]),q=(e,t)=>{let n=w.data?.counts?.[e],r=n?.value;if(r==null||w.isError)return null;let i=ae.format(r),a=o(n?.approximate?`historyImport.estimatedCount`:`historyImport.sourceCount`,{count:i});return(0,X.jsx)(`span`,{id:t,"data-history-count":e,className:`yuri-import-source-count`,title:a,"aria-label":a,children:w.isFetching?(0,X.jsx)(d,{name:`loader-4`,className:`size-3 animate-spin`,"aria-label":o(`historyImport.scanning`)}):`${n?.approximate?`≈ `:``}${i}`})};return(0,X.jsxs)(`form`,{id:`yuri-tour-import`,className:`yuri-history-import`,"data-history-import":!0,onSubmit:e=>{e.preventDefault(),te()},children:[(0,X.jsx)(`h2`,{ref:k,className:`yuri-import-heading`,children:o(`historyImport.heading`)}),(0,X.jsx)(`p`,{className:`yuri-import-subtitle`,children:o(`historyImport.deduplication`)}),S.data&&!re(S.data)&&(C||O.current===S.data.id)&&(0,X.jsxs)(`div`,{className:`yuri-import-job`,role:`status`,children:[(0,X.jsx)(d,{name:C?`loader-4`:`error-warning`,className:u(`size-4`,C&&`animate-spin`)}),(0,X.jsx)(`span`,{children:o(C&&K?`historyImport.phase.${K.phase}`:`historyImport.state.${S.data.state}`)}),K&&K.total>0&&(0,X.jsxs)(`span`,{className:`tabular-nums`,children:[K.completed,` / `,K.total]}),C&&(0,X.jsx)(l,{variant:`ghost`,size:`icon`,disabled:_,"aria-label":o(`historyImport.cancel`),title:o(`historyImport.cancel`),onClick:()=>void ee(async e=>{await H(S.data.id,e,f),I()&&await S.refetch()}),children:(0,X.jsx)(d,{name:`stop`,className:`size-4`})}),C&&K&&(0,X.jsx)(`progress`,{value:K.total?K.completed:void 0,max:K.total||1,"aria-label":o(`historyImport.progress`)}),S.data.progress?.code&&(0,X.jsxs)(`p`,{role:`alert`,children:[o(`historyImport.failed`),` `,(0,X.jsx)(`code`,{children:S.data.progress.code})]}),S.data.results.some(e=>e.status===`failed`||e.project===`failed`||e.index===`failed`)&&(0,X.jsxs)(`p`,{role:`alert`,children:[o(`historyImport.failed`),[...new Set(S.data.results.filter(e=>e.status===`failed`&&e.code).map(e=>e.code))].map(e=>(0,X.jsxs)(`code`,{children:[` `,e]},e))]})]}),(0,X.jsx)(`div`,{className:`yuri-import-source-grid`,"aria-label":o(`historyImport.sources`),children:B.map(e=>{let t=w.data?.installations?.[e.id],n=o(t===!0?`historyImport.installed`:t===!1?`historyImport.notDetected`:`historyImport.installationUnknown`),r=w.data?.counts?.[e.id]?.value!=null&&!w.isError?` history-import-count-${e.id}`:``;return(0,X.jsxs)(l,{variant:`ghost`,"data-history-source":e.id,className:u(`yuri-import-source-card`,(e.id===`cursor`||e.id===`opencode`)&&`yuri-import-source-cursor`),disabled:_||C,"aria-pressed":h.includes(e.id),"aria-label":e.name,"aria-describedby":`history-import-installed-${e.id}${r}`,onClick:()=>M(e.id,!h.includes(e.id)),children:[(0,X.jsxs)(`span`,{className:`yuri-import-logo-wrap`,children:[(0,X.jsx)(`img`,{src:se[e.id],alt:``,draggable:!1,className:`yuri-import-source-logo`}),(0,X.jsx)(`span`,{id:`history-import-installed-${e.id}`,role:`img`,"aria-label":n,title:n,"data-installed":t===!0?`true`:t===!1?`false`:`unknown`,className:`yuri-import-installation`})]}),(0,X.jsx)(`span`,{className:`yuri-import-source-name`,children:e.name}),q(e.id,`history-import-count-${e.id}`),(0,X.jsx)(`span`,{className:`yuri-import-source-check`,"aria-hidden":`true`,children:(0,X.jsx)(d,{name:`check`,className:`size-3`})})]},e.id)})}),R&&(0,X.jsxs)(`div`,{role:`alert`,className:`yuri-tour-feedback`,children:[(0,X.jsxs)(`p`,{children:[o(R===`history_import_unsupported`?`historyImport.unsupported`:`historyImport.failed`),` `,(0,X.jsx)(`code`,{children:R})]}),(w.isError||S.isError)&&(0,X.jsx)(l,{variant:`ghost`,size:`xs`,disabled:w.isFetching||S.isFetching,onClick:()=>{Promise.all([w.refetch(),S.refetch()])},children:o(`settings.plugins.status.retry`)})]}),w.data&&!w.isFetching&&!w.isError&&!w.data.sessions.length&&!w.data.errors.length&&(0,X.jsx)(`p`,{className:`yuri-tour-feedback`,children:o(`historyImport.empty`)}),N.length>0&&(0,X.jsxs)(`section`,{"aria-label":o(`historyImport.sessions`),children:[(0,X.jsx)(`div`,{className:`yuri-import-list-heading`,children:o(`historyImport.sessions`)}),(0,X.jsx)(`div`,{className:`yuri-import-preview-groups`,children:N.map(e=>(0,X.jsxs)(`section`,{"aria-label":e.name,"data-source-selected":h.includes(e.id),children:[(0,X.jsxs)(`div`,{className:`yuri-import-preview-heading`,children:[(0,X.jsx)(`h3`,{children:e.name}),q(e.id),(0,X.jsx)(b,{checked:h.includes(e.id),disabled:_||C,ariaLabel:e.name,onChange:t=>M(e.id,t)})]}),(0,X.jsx)(`ul`,{className:`yuri-import-session-grid`,children:e.sessions.map(e=>(0,X.jsxs)(`li`,{"data-history-session":e.key,className:u(`yuri-import-session-card`,(e.source===`cursor`||e.source===`opencode`)&&`yuri-import-source-cursor`),title:e.title,children:[(0,X.jsx)(`img`,{src:se[e.source],alt:``,draggable:!1,className:`yuri-import-session-logo`}),(0,X.jsxs)(`span`,{className:`yuri-import-session-copy`,children:[(0,X.jsxs)(`span`,{className:`yuri-import-session-heading`,children:[(0,X.jsx)(`span`,{className:`yuri-import-session-title`,children:e.title}),!T.isError&&T.data?.states[e.key]===`imported`&&(0,X.jsx)(`span`,{className:`yuri-import-session-imported`,"data-history-imported":!0,children:o(`historyImport.alreadyImported`)}),e.updated&&e.updated>0?(0,X.jsx)(`time`,{dateTime:new Date(e.updated).toISOString(),children:G.format(e.updated)}):null]}),e.excerpt&&(0,X.jsx)(`span`,{className:`yuri-import-session-excerpt`,children:e.excerpt})]})]},e.key))})]},e.id))})]})]})}var Z=K.map(e=>e.spec),le=[`tour.models`,`tour.plugins`,`tour.import`,`tour.voice`],ue=[{id:`openai`,name:`OpenAI`},{id:`anthropic`,name:`Anthropic`},{id:`google`,name:`Google Gemini`},{id:`github-copilot`,name:`GitHub Copilot`},{id:`deepseek`,name:`DeepSeek`},{id:`openrouter`,name:`OpenRouter`}];function de(e){let t=(0,G.c)(48),{index:n,info:r,installed:i,selected:a,onSelect:o,onReadme:s}=e,{t:c}=m(),f=K[n],p=r?.kind===`npm-ok`?r:void 0,h=a&&`yuri-tour-card-selected`,g;t[0]===h?g=t[1]:(g=u(`yuri-tour-plugin yuri-tour-select-card`,h),t[0]=h,t[1]=g);let _;t[2]===a?_=t[3]:(_=a&&(0,X.jsx)(d,{name:`check`,className:`size-5`}),t[2]=a,t[3]=_);let v;t[4]===_?v=t[5]:(v=(0,X.jsx)(`span`,{className:`yuri-tour-card-check`,"aria-hidden":`true`,children:_}),t[4]=_,t[5]=v);let y;t[6]!==o||t[7]!==f.name||t[8]!==a||t[9]!==v?(y=(0,X.jsx)(l,{variant:`ghost`,className:`yuri-tour-card-toggle`,"aria-label":f.name,"aria-pressed":a,onClick:o,children:v}),t[6]=o,t[7]=f.name,t[8]=a,t[9]=v,t[10]=y):y=t[10];let b=p?.icon,x;t[11]!==f.name||t[12]!==b?(x=(0,X.jsx)(I,{name:f.name,src:b,size:30}),t[11]=f.name,t[12]=b,t[13]=x):x=t[13];let S;t[14]===f.name?S=t[15]:(S=(0,X.jsx)(`h3`,{className:`typography-ui-label font-medium`,children:f.name}),t[14]=f.name,t[15]=S);let C;t[16]===f.spec?C=t[17]:(C=(0,X.jsx)(`p`,{className:`break-all typography-micro text-muted-foreground`,children:f.spec}),t[16]=f.spec,t[17]=C);let w;t[18]!==S||t[19]!==C?(w=(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[S,C]}),t[18]=S,t[19]=C,t[20]=w):w=t[20];let T;t[21]===p?T=t[22]:(T=p?.latestVersion&&(0,X.jsx)(`span`,{className:`typography-micro text-muted-foreground`,children:p.latestVersion}),t[21]=p,t[22]=T);let E;t[23]!==w||t[24]!==T||t[25]!==x?(E=(0,X.jsxs)(`div`,{className:`flex items-start gap-3 pr-10`,children:[x,w,T]}),t[23]=w,t[24]=T,t[25]=x,t[26]=E):E=t[26];let D;t[27]!==r||t[28]!==p?.description||t[29]!==c?(D=p?.description||c(r?`tour.metadataUnavailable`:`common.loading`),t[27]=r,t[28]=p?.description,t[29]=c,t[30]=D):D=t[30];let O;t[31]===D?O=t[32]:(O=(0,X.jsx)(`p`,{className:`flex-1 typography-meta text-muted-foreground`,children:D}),t[31]=D,t[32]=O);let k=!p,A;t[33]!==s||t[34]!==k?(A=(0,X.jsx)(l,{size:`xs`,variant:`ghost`,className:`yuri-tour-card-link`,disabled:k,onClick:s,children:`README`}),t[33]=s,t[34]=k,t[35]=A):A=t[35];let j;t[36]!==i||t[37]!==c?(j=i&&(0,X.jsx)(`span`,{className:`typography-meta text-muted-foreground`,children:c(`tour.saved`)}),t[36]=i,t[37]=c,t[38]=j):j=t[38];let M;t[39]!==A||t[40]!==j?(M=(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[A,j]}),t[39]=A,t[40]=j,t[41]=M):M=t[41];let N;return t[42]!==E||t[43]!==O||t[44]!==M||t[45]!==g||t[46]!==y?(N=(0,X.jsxs)(`section`,{className:g,children:[y,E,O,M]}),t[42]=E,t[43]=O,t[44]=M,t[45]=g,t[46]=y,t[47]=N):N=t[47],N}function fe(e){let t=(0,G.c)(28),{settings:n,onComplete:r,onBusy:i}=e,{t:a}=m(),o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o={voiceProvider:`volcengine`,sttProvider:`volcengine`,dictationEnabled:!0,showMessageTTSButtons:!0},t[0]=o):o=t[0];let s=L(n,o),l=c(i),u,d;t[1]!==s.saving||t[2]!==l?(u=()=>(l(s.saving),()=>l(!1)),d=[s.saving,l],t[1]=s.saving,t[2]=l,t[3]=u,t[4]=d):(u=t[3],d=t[4]),W.useEffect(u,d);let f;t[5]!==s||t[6]!==r||t[7]!==n.configured?(f=async e=>{e.preventDefault(),!(!n.configured&&!s.draft.apiKey?.trim())&&(await s.save())?.configured&&r()},t[5]=s,t[6]=r,t[7]=n.configured,t[8]=f):f=t[8];let p=f,h;t[9]===p?h=t[10]:(h=e=>void p(e),t[9]=p,t[10]=h);let g;t[11]===a?g=t[12]:(g=a(`settings.voice.volcengine.name`),t[11]=a,t[12]=g);let _,v;t[13]===s?(_=t[14],v=t[15]):(_=(0,X.jsx)(F,{mode:`tts`,form:s}),v=(0,X.jsx)(F,{mode:`asr`,form:s,showCredentials:!1}),t[13]=s,t[14]=_,t[15]=v);let y;t[16]!==g||t[17]!==_||t[18]!==v?(y=(0,X.jsxs)(k,{label:g,children:[_,v]}),t[16]=g,t[17]=_,t[18]=v,t[19]=y):y=t[19];let b;t[20]!==s.draft||t[21]!==n.configured||t[22]!==a?(b=!n.configured&&!s.draft.apiKey?.trim()&&(0,X.jsx)(`p`,{className:`typography-meta text-muted-foreground`,children:a(`settings.providers.page.toast.apiKeyRequired`)}),t[20]=s.draft,t[21]=n.configured,t[22]=a,t[23]=b):b=t[23];let x;return t[24]!==b||t[25]!==h||t[26]!==y?(x=(0,X.jsxs)(`form`,{id:`yuri-tour-voice`,onSubmit:h,className:`yuri-settings-section-stack`,children:[y,b]}),t[24]=b,t[25]=h,t[26]=y,t[27]=x):x=t[27],x}function pe({runtime:e,onClose:r}){let{t:i}=m(),a=A(),c=D(t=>t.progress[e]?.step??0),[b,S]=W.useState(`magpie`),[C,w]=W.useState(),[k,N]=W.useState(Z.slice(1)),[P,F]=W.useState(`tour`),[I,L]=W.useState(null),[R,z]=W.useState(!1),[ne,re]=W.useState({disabled:!0}),[B,V]=W.useState(null),ie=n(),H=t(),U=W.useRef(null),G=W.useRef(!1);W.useEffect(()=>{let e=new AbortController;return U.current=e,()=>e.abort()},[]);let q=j(),J=o({...M(a,Z.slice(1),!1,H,!0),enabled:c===1}),Y=o({...E(H),enabled:c===3}),se=q.data?.entries??[],pe=e=>{let t=p.getState(),n=e&&t.providers.some(t=>t.id===e);S(`other`),w(n?void 0:e),t.setSelectedProvider(n?e:`__add_provider__`),F(`providers`)},Q=()=>!U.current?.signal.aborted&&ie===n()&&H===t(),$=t=>{F(`tour`),V(null),D.getState().move(e,t)},me=()=>{Q()&&r()},he=()=>{c===3?me():$(c+1)},ge=async()=>{if(c===2){he();return}if(!(G.current||R||!U.current)){G.current=!0,z(!0),V(null);try{let e=c===0?b===`magpie`?[Z[0]]:[]:k;if(e.length){let t=await oe(e,a,U.current.signal);if(!Q())return;if(t.failed.length){V(i(`tour.saveFailed`,{names:t.failed.join(`, `)}));return}}if(c===0&&b===`other`){let e=await s.fetchQuery({...f(a,H),staleTime:0});if(!Q())return;if(e.partial||!e.providers.some(e=>Object.keys(e.models).length>0)){V(i(`tour.noModels`));return}await p.getState().loadProviders({directory:a,forceRefresh:!0,source:`setup-tour`})}Q()&&he()}catch{Q()&&V(i(`tour.operationFailed`))}finally{G.current=!1,Q()&&z(!1)}}},_e=()=>{I===null?P===`tour`?c>0&&$(c-1):F(`tour`):L(null)},ve=I===null?void 0:J.data?.[Z[I]],ye=ve?.kind===`npm-ok`?ve.readme:void 0;return(0,X.jsx)(v,{open:!0,onOpenChange:e=>{!e&&!R&&(I!==null||P!==`tour`?_e():me())},children:(0,X.jsxs)(g,{className:`yuri-setup-tour yuri-settings-workspace`,showCloseButton:!1,"aria-describedby":void 0,children:[(0,X.jsx)(`div`,{className:`yuri-tour-watermark`,"aria-hidden":`true`,children:(0,X.jsx)(x,{width:440,height:440})}),(0,X.jsx)(h,{children:(0,X.jsxs)(_,{className:`yuri-tour-title`,children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,children:`👋`}),i(`tour.title`).split(`Yuri`).map((e,t)=>(0,X.jsxs)(W.Fragment,{children:[t>0&&(0,X.jsx)(O,{width:`2.05em`}),(0,X.jsx)(`span`,{children:e.trim()})]},t))]})}),(0,X.jsxs)(`div`,{className:`yuri-tour-body`,children:[(0,X.jsx)(`nav`,{className:`yuri-tour-progress`,"aria-label":i(`tour.title`),children:le.map((e,t)=>(0,X.jsxs)(l,{variant:`ghost`,size:`lg`,disabled:R,"aria-current":c===t?`step`:void 0,onClick:()=>{L(null),$(t)},children:[(0,X.jsx)(`span`,{className:`yuri-tour-number`,"aria-hidden":`true`,children:String(t+1).padStart(2,`0`)}),(0,X.jsx)(`span`,{children:i(e)})]},e))}),(0,X.jsx)(`div`,{className:u(`yuri-tour-content`,P===`providers`&&I===null&&`yuri-tour-provider-content`),children:(0,X.jsxs)(`fieldset`,{disabled:R,className:`contents`,children:[I===null?P===`providers`?(0,X.jsx)(te,{initialConnectionId:C}):P===`voice`&&Y.data?(0,X.jsx)(fe,{settings:Y.data,onComplete:me,onBusy:z}):P===`asr`||P===`tts`?(0,X.jsx)(ee,{section:P}):(0,X.jsxs)(X.Fragment,{children:[c<2&&(c===1&&J.isError||q.isError)&&(0,X.jsxs)(`div`,{role:`alert`,className:`yuri-tour-feedback`,children:[(0,X.jsx)(`p`,{children:i(`tour.metadataUnavailable`)}),(0,X.jsx)(l,{size:`xs`,onClick:()=>{c===1&&J.refetch(),q.refetch()},children:i(`settings.plugins.status.retry`)})]}),c===0&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`section`,{className:u(`yuri-tour-magpie yuri-tour-select-card`,b===`magpie`&&`yuri-tour-card-selected`),children:[(0,X.jsx)(l,{variant:`ghost`,className:`yuri-tour-card-toggle`,"aria-label":`Magpie`,"aria-pressed":b===`magpie`,onClick:()=>S(b===`magpie`?`other`:`magpie`),children:(0,X.jsx)(`span`,{className:`yuri-tour-card-check`,"aria-hidden":`true`,children:b===`magpie`&&(0,X.jsx)(d,{name:`check`,className:`size-5`})})}),(0,X.jsxs)(`div`,{className:`flex w-full items-center gap-3 pr-10`,children:[(0,X.jsx)(T,{providerId:`magpie`,alt:`Magpie`,className:`size-8 shrink-0`}),(0,X.jsx)(`span`,{className:`typography-ui-label`,children:`Magpie`}),(0,X.jsx)(`span`,{className:`yuri-tour-recommended`,children:i(`tour.recommended`)})]}),(0,X.jsx)(`p`,{className:`typography-meta text-muted-foreground`,children:i(`tour.magpieDescription`)}),(0,X.jsxs)(`a`,{className:`yuri-tour-card-link typography-meta text-muted-foreground underline`,href:`https://usemagpie.ai/docs/start`,target:`_blank`,rel:`noreferrer`,children:[i(`tour.docs`),` ↗`]})]}),(0,X.jsxs)(`div`,{className:`yuri-tour-provider-heading`,children:[(0,X.jsx)(`span`,{className:`typography-meta text-muted-foreground`,children:`OpenCode`}),(0,X.jsxs)(`a`,{className:`typography-meta text-muted-foreground underline`,href:`https://opencode.ai/docs/providers/`,target:`_blank`,rel:`noreferrer`,children:[i(`tour.docs`),` ↗`]})]}),(0,X.jsx)(`div`,{className:`yuri-tour-provider-grid`,children:ue.map(e=>(0,X.jsxs)(l,{variant:`ghost`,className:`yuri-tour-provider-choice`,onClick:()=>pe(e.id),children:[(0,X.jsx)(T,{providerId:e.id,alt:e.name,className:`size-6 shrink-0`}),(0,X.jsx)(`span`,{children:e.name})]},e.id))}),(0,X.jsxs)(l,{className:`mt-3`,size:`sm`,variant:`ghost`,onClick:()=>pe(),children:[i(`tour.otherProvider`),(0,X.jsx)(d,{name:`arrow-right-s`,className:`size-4`})]})]}),c===1&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`div`,{className:`yuri-tour-plugins`,children:[1,2].map(e=>(0,X.jsx)(de,{index:e,info:J.data?.[Z[e]],installed:ae(se,Z[e]),selected:k.includes(Z[e]),onSelect:()=>N(t=>t.includes(Z[e])?t.filter(t=>t!==Z[e]):[...t,Z[e]]),onReadme:()=>L(e)},e))}),(0,X.jsxs)(`a`,{className:`mt-4 inline-block typography-meta text-muted-foreground underline underline-offset-4 hover:text-foreground`,href:`https://opencode.ai/docs/ecosystem/#plugins`,target:`_blank`,rel:`noopener noreferrer`,children:[i(`tour.morePlugins`),` ↗`]})]}),c===2&&(0,X.jsx)(ce,{onBusy:z,directory:a,onPrimaryChange:re,onComplete:()=>$(3)}),c===3&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`yuri-tour-voice-intro`,children:[(0,X.jsx)(`h2`,{children:i(`tour.voiceHeading`)}),(0,X.jsx)(`p`,{children:i(`tour.voiceIntro`)})]}),(0,X.jsxs)(`div`,{className:`yuri-tour-voice-capabilities`,children:[(0,X.jsxs)(`section`,{children:[(0,X.jsx)(d,{name:`mic`,className:`yuri-tour-voice-icon`}),(0,X.jsx)(`h3`,{children:i(`settings.voice.page.section.speechRecognition`)}),(0,X.jsx)(`p`,{children:i(`tour.dictationDescription`)}),(0,X.jsxs)(`div`,{className:`yuri-tour-voice-services`,children:[(0,X.jsxs)(`span`,{children:[(0,X.jsx)(`img`,{src:`data:image/svg+xml,%3csvg%20height='24'%20style='flex:none;line-height:1'%20viewBox='0%200%2024%2024'%20width='24'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eDoubao%3c/title%3e%3cpath%20d='M5.31%2015.756c.172-3.75%201.883-5.999%202.549-6.739-3.26%202.058-5.425%205.658-6.358%208.308v1.12C1.501%2021.513%204.226%2024%207.59%2024a6.59%206.59%200%20002.2-.375c.353-.12.7-.248%201.039-.378.913-.899%201.65-1.91%202.243-2.992-4.877%202.431-7.974.072-7.763-4.5l.002.001z'%20fill='%231E37FC'%3e%3c/path%3e%3cpath%20d='M22.57%2010.283c-1.212-.901-4.109-2.404-7.397-2.8.295%203.792.093%208.766-2.1%2012.773a12.782%2012.782%200%2001-2.244%202.992c3.764-1.448%206.746-3.457%208.596-5.219%202.82-2.683%203.353-5.178%203.361-6.66a2.737%202.737%200%2000-.216-1.084v-.002z'%20fill='%2337E1BE'%3e%3c/path%3e%3cpath%20d='M14.303%201.867C12.955.7%2011.248%200%209.39%200%207.532%200%205.883.677%204.545%201.807%202.791%203.29%201.627%205.557%201.5%208.125v9.201c.932-2.65%203.097-6.25%206.357-8.307.5-.318%201.025-.595%201.569-.829%201.883-.801%203.878-.932%205.746-.706-.222-2.83-.718-5.002-.87-5.617h.001z'%20fill='%23A569FF'%3e%3c/path%3e%3cpath%20d='M17.305%204.961a199.47%20199.47%200%2001-1.08-1.094c-.202-.213-.398-.419-.586-.622l-1.333-1.378c.151.615.648%202.786.869%205.617%203.288.395%206.185%201.898%207.396%202.8-1.306-1.275-3.475-3.487-5.266-5.323z'%20fill='%231E37FC'%3e%3c/path%3e%3c/svg%3e`,alt:``,className:`size-4`}),i(`settings.voice.volcengine.name`)]}),(0,X.jsxs)(`span`,{children:[(0,X.jsx)(d,{name:`computer`}),i(`settings.voice.page.provider.local`)]}),(0,X.jsxs)(`span`,{children:[(0,X.jsx)(d,{name:`server`}),i(`settings.voice.page.provider.server`)]})]}),(0,X.jsxs)(l,{size:`sm`,onClick:()=>F(`asr`),children:[i(`tour.configureInput`),(0,X.jsx)(d,{name:`arrow-right-s`,className:`size-4`})]})]}),(0,X.jsxs)(`section`,{children:[(0,X.jsx)(d,{name:`volume-up`,className:`yuri-tour-voice-icon`}),(0,X.jsx)(`h3`,{children:i(`tour.readAloudTitle`)}),(0,X.jsx)(`p`,{children:i(`tour.readAloudDescription`)}),(0,X.jsxs)(`div`,{className:`yuri-tour-voice-services`,children:[(0,X.jsxs)(`span`,{children:[(0,X.jsx)(`img`,{src:`data:image/svg+xml,%3csvg%20height='24'%20style='flex:none;line-height:1'%20viewBox='0%200%2024%2024'%20width='24'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eDoubao%3c/title%3e%3cpath%20d='M5.31%2015.756c.172-3.75%201.883-5.999%202.549-6.739-3.26%202.058-5.425%205.658-6.358%208.308v1.12C1.501%2021.513%204.226%2024%207.59%2024a6.59%206.59%200%20002.2-.375c.353-.12.7-.248%201.039-.378.913-.899%201.65-1.91%202.243-2.992-4.877%202.431-7.974.072-7.763-4.5l.002.001z'%20fill='%231E37FC'%3e%3c/path%3e%3cpath%20d='M22.57%2010.283c-1.212-.901-4.109-2.404-7.397-2.8.295%203.792.093%208.766-2.1%2012.773a12.782%2012.782%200%2001-2.244%202.992c3.764-1.448%206.746-3.457%208.596-5.219%202.82-2.683%203.353-5.178%203.361-6.66a2.737%202.737%200%2000-.216-1.084v-.002z'%20fill='%2337E1BE'%3e%3c/path%3e%3cpath%20d='M14.303%201.867C12.955.7%2011.248%200%209.39%200%207.532%200%205.883.677%204.545%201.807%202.791%203.29%201.627%205.557%201.5%208.125v9.201c.932-2.65%203.097-6.25%206.357-8.307.5-.318%201.025-.595%201.569-.829%201.883-.801%203.878-.932%205.746-.706-.222-2.83-.718-5.002-.87-5.617h.001z'%20fill='%23A569FF'%3e%3c/path%3e%3cpath%20d='M17.305%204.961a199.47%20199.47%200%2001-1.08-1.094c-.202-.213-.398-.419-.586-.622l-1.333-1.378c.151.615.648%202.786.869%205.617%203.288.395%206.185%201.898%207.396%202.8-1.306-1.275-3.475-3.487-5.266-5.323z'%20fill='%231E37FC'%3e%3c/path%3e%3c/svg%3e`,alt:``,className:`size-4`}),i(`settings.voice.volcengine.name`)]}),(0,X.jsxs)(`span`,{children:[(0,X.jsx)(T,{providerId:`openai`,alt:`OpenAI`,className:`size-4`}),`OpenAI`]}),(0,X.jsxs)(`span`,{children:[(0,X.jsx)(d,{name:`computer`}),i(`settings.voice.page.provider.browser`)]}),(0,X.jsxs)(`span`,{children:[(0,X.jsx)(d,{name:`cloud`}),i(`settings.voice.page.provider.custom`)]})]}),(0,X.jsxs)(l,{size:`sm`,onClick:()=>F(`tts`),children:[i(`tour.configureReadAloud`),(0,X.jsx)(d,{name:`arrow-right-s`,className:`size-4`})]})]})]}),(0,X.jsxs)(`section`,{className:`yuri-tour-voice-recommendation`,children:[(0,X.jsx)(`img`,{src:`data:image/svg+xml,%3csvg%20height='24'%20style='flex:none;line-height:1'%20viewBox='0%200%2024%2024'%20width='24'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eDoubao%3c/title%3e%3cpath%20d='M5.31%2015.756c.172-3.75%201.883-5.999%202.549-6.739-3.26%202.058-5.425%205.658-6.358%208.308v1.12C1.501%2021.513%204.226%2024%207.59%2024a6.59%206.59%200%20002.2-.375c.353-.12.7-.248%201.039-.378.913-.899%201.65-1.91%202.243-2.992-4.877%202.431-7.974.072-7.763-4.5l.002.001z'%20fill='%231E37FC'%3e%3c/path%3e%3cpath%20d='M22.57%2010.283c-1.212-.901-4.109-2.404-7.397-2.8.295%203.792.093%208.766-2.1%2012.773a12.782%2012.782%200%2001-2.244%202.992c3.764-1.448%206.746-3.457%208.596-5.219%202.82-2.683%203.353-5.178%203.361-6.66a2.737%202.737%200%2000-.216-1.084v-.002z'%20fill='%2337E1BE'%3e%3c/path%3e%3cpath%20d='M14.303%201.867C12.955.7%2011.248%200%209.39%200%207.532%200%205.883.677%204.545%201.807%202.791%203.29%201.627%205.557%201.5%208.125v9.201c.932-2.65%203.097-6.25%206.357-8.307.5-.318%201.025-.595%201.569-.829%201.883-.801%203.878-.932%205.746-.706-.222-2.83-.718-5.002-.87-5.617h.001z'%20fill='%23A569FF'%3e%3c/path%3e%3cpath%20d='M17.305%204.961a199.47%20199.47%200%2001-1.08-1.094c-.202-.213-.398-.419-.586-.622l-1.333-1.378c.151.615.648%202.786.869%205.617%203.288.395%206.185%201.898%207.396%202.8-1.306-1.275-3.475-3.487-5.266-5.323z'%20fill='%231E37FC'%3e%3c/path%3e%3c/svg%3e`,alt:``,className:`size-6 shrink-0`}),(0,X.jsxs)(`div`,{children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(`h3`,{children:i(`settings.voice.volcengine.name`)}),(0,X.jsx)(`span`,{className:`yuri-tour-recommended`,children:i(`tour.recommended`)})]}),(0,X.jsx)(`p`,{children:i(`tour.voiceAllowance`)})]}),(0,X.jsx)(l,{disabled:!Y.data,size:`sm`,onClick:()=>F(`voice`),children:i(`tour.configureVoice`)})]}),Y.isError&&(0,X.jsxs)(`div`,{role:`alert`,className:`yuri-tour-feedback`,children:[(0,X.jsx)(`p`,{children:i(`settings.voice.volcengine.loadFailed`)}),(0,X.jsx)(l,{size:`xs`,onClick:()=>void Y.refetch(),children:i(`settings.voice.volcengine.retry`)})]})]})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`h3`,{className:`typography-ui-label mb-4`,children:[K[I].name,` · README`]}),ye?(0,X.jsx)(y,{content:ye,enableFileReferences:!1}):(0,X.jsx)(`p`,{className:`typography-meta text-muted-foreground`,children:i(`tour.metadataUnavailable`)})]}),B&&I===null&&(0,X.jsx)(`p`,{role:`alert`,className:`yuri-tour-feedback`,children:B})]})})]}),(0,X.jsxs)(`footer`,{className:`yuri-tour-footer`,children:[(P!==`tour`||I!==null)&&(0,X.jsx)(l,{variant:`ghost`,size:`sm`,disabled:R,onClick:_e,children:i(`onboarding.common.actions.back`)}),I===null&&(0,X.jsxs)(`div`,{className:`ml-auto flex flex-wrap justify-end gap-2`,children:[(0,X.jsx)(l,{variant:`ghost`,size:`sm`,disabled:R,onClick:he,children:i(`tour.later`)}),c===2?(0,X.jsxs)(l,{size:`sm`,type:`submit`,form:`yuri-tour-import`,disabled:R||ne.disabled,"aria-busy":R,children:[R&&(0,X.jsx)(d,{name:`loader-4`,className:`size-3 animate-spin`}),i(ne.background?`historyImport.background`:`historyImport.next`)]}):c===3?(0,X.jsx)(l,{size:`sm`,disabled:R,type:P===`voice`?`submit`:`button`,form:P===`voice`?`yuri-tour-voice`:void 0,onClick:P===`voice`?void 0:me,children:i(P===`voice`?`settings.common.actions.saveChanges`:`tour.finish`)}):(0,X.jsxs)(l,{size:`sm`,disabled:R||c<2&&(!q.data||q.isError),"aria-busy":R,onClick:()=>void ge(),children:[R&&(0,X.jsx)(d,{name:`loader-4`,className:`size-3 animate-spin`}),i(`tour.continue`)]})]})]})]})})}export{pe as SetupTourDialog};
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,n}from"./runtime-switch-DEPKHgdL.js";import{ot as r,st as i}from"./vendor-base-ui-wXsskyKm.js";import{n as a}from"./vendor-react-BkccXcWz.js";import{s as o}from"./vendor-tanstack-react-query-DIb_ItL-.js";import{c as s}from"./yuriEvents-BFrD5fMU.js";import{r as c}from"./vendor-reactuses-core-DjKFMfz7.js";import{i as l,o as u}from"./session-startup-barrier-DT-hIBRf.js";import{n as d}from"./Icon-DmykXZL1.js";import{Ea as f,Hi as p}from"./ui-ee2iN869.js";import{t as m}from"./i18n-DXc6czdR.js";import{a as h,n as g,o as _,t as v}from"./dialog-BeFBA6ja.js";import{n as y}from"./MarkdownRenderer-VvziwyJB.js";import{t as b}from"./checkbox-BMN5hAVm.js";import{t as x}from"./YuriLogo-Cp6vWDWp.js";import{a as S,i as C}from"./ModelLogo-BkbD514M.js";import{l as w}from"./zhipuai-coding-plan-CcFj8zKy.js";import{t as T}from"./ProviderLogo-DA98yu7M.js";import{n as E}from"./speechSettingsQueries-BmkXNn4w.js";import{n as D,t as O}from"./YuriWordmark-CLGHwobA.js";import{n as k}from"./SettingsGroup-CvaPYznp.js";import{a as A,c as j,n as M,r as N,t as P}from"./usePluginsStore-Du4WlceO.js";import{a as F,l as I,n as ee,o as te,r as L,t as R}from"./pluginPresentation-DtyC8NF2.js";import{a as z,c as ne,d as re,l as B,o as V,s as ie,t as H,u as U}from"./historyImportQueries-D00KjUT2.js";var W=e(i(),1),G=a(),K=[{name:`Magpie`,spec:`opencode-magpie-plugin`},{name:`Eficy`,spec:`@eficy/opencode2-plugin`},{name:`yee-profile`,spec:`@yee94/opencode-profile`}];function ae(e,t){return e.some(e=>e.parsedKind===`npm`&&R(e.spec).name===t)}async function q(e,t){let n=[];for(let r of new Set(e)){if(!t.current())throw Error(`Runtime changed`);try{let e=await t.list();if(!t.current())throw Error(`Runtime changed`);ae(e,r)||(await t.create(r)).ok||n.push(r)}catch{n.push(r)}}if(!t.current())throw Error(`Runtime changed`);return{failed:n}}function oe(e,r,i){let a=t(),o=n();return q(e,{current:()=>!i.aborted&&o===n()&&a===t(),list:async()=>(await s.fetchQuery({...N(r,a),staleTime:0})).entries,create:e=>P.getState().createEntry({spec:e,scope:`user`})})}var J=`data:image/svg+xml,%3csvg%20viewBox='0%200%2024%2024'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eClaude%20Code%3c/title%3e%3cpath%20clip-rule='evenodd'%20d='M20.998%2010.949H24v3.102h-3v3.028h-1.487V20H18v-2.921h-1.487V20H15v-2.921H9V20H7.488v-2.921H6V20H4.487v-2.921H3V14.05H0V10.95h3V5h17.998v5.949zM6%2010.949h1.488V8.102H6v2.847zm10.51%200H18V8.102h-1.49v2.847z'%20fill='%23D97757'%20fill-rule='evenodd'/%3e%3c/svg%3e`,Y=`data:image/svg+xml,%3csvg%20viewBox='0%200%2024%2024'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eCodex%3c/title%3e%3cpath%20d='M19.503%200H4.496A4.496%204.496%200%20000%204.496v15.007A4.496%204.496%200%20004.496%2024h15.007A4.496%204.496%200%200024%2019.503V4.496A4.496%204.496%200%200019.503%200z'%20fill='%23fff'/%3e%3cpath%20d='M9.064%203.344a4.578%204.578%200%20012.285-.312c1%20.115%201.891.54%202.673%201.275.01.01.024.017.037.021a.09.09%200%2000.043%200%204.55%204.55%200%20013.046.275l.047.022.116.057a4.581%204.581%200%20012.188%202.399c.209.51.313%201.041.315%201.595a4.24%204.24%200%2001-.134%201.223.123.123%200%2000.03.115c.594.607.988%201.33%201.183%202.17.289%201.425-.007%202.71-.887%203.854l-.136.166a4.548%204.548%200%2001-2.201%201.388.123.123%200%2000-.081.076c-.191.551-.383%201.023-.74%201.494-.9%201.187-2.222%201.846-3.711%201.838-1.187-.006-2.239-.44-3.157-1.302a.107.107%200%2000-.105-.024c-.388.125-.78.143-1.204.138a4.441%204.441%200%2001-1.945-.466%204.544%204.544%200%2001-1.61-1.335c-.152-.202-.303-.392-.414-.617a5.81%205.81%200%2001-.37-.961%204.582%204.582%200%2001-.014-2.298.124.124%200%2000.006-.056.085.085%200%2000-.027-.048%204.467%204.467%200%2001-1.034-1.651%203.896%203.896%200%2001-.251-1.192%205.189%205.189%200%2001.141-1.6c.337-1.112.982-1.985%201.933-2.618.212-.141.413-.251.601-.33.215-.089.43-.164.646-.227a.098.098%200%2000.065-.066%204.51%204.51%200%2001.829-1.615%204.535%204.535%200%20011.837-1.388zm3.482%2010.565a.637.637%200%20000%201.272h3.636a.637.637%200%20100-1.272h-3.636zM8.462%209.23a.637.637%200%2000-1.106.631l1.272%202.224-1.266%202.136a.636.636%200%20101.095.649l1.454-2.455a.636.636%200%2000.005-.64L8.462%209.23z'%20fill='url(%23codex-gradient)'/%3e%3cdefs%3e%3clinearGradient%20gradientUnits='userSpaceOnUse'%20id='codex-gradient'%20x1='12'%20x2='12'%20y1='3'%20y2='21'%3e%3cstop%20stop-color='%23B1A7FF'/%3e%3cstop%20offset='.5'%20stop-color='%237A9DFF'/%3e%3cstop%20offset='1'%20stop-color='%233941FF'/%3e%3c/linearGradient%3e%3c/defs%3e%3c/svg%3e`,X=r(),se={claude:J,codex:Y,cursor:S,dsh:C,opencode:w};function ce({onBusy:e,directory:r=null,onPrimaryChange:i,onComplete:a}){let{t:o,locale:s}=m(),f=t(),p=n(),[h,g]=W.useState([]),[_,v]=W.useState(!1),[y,x]=W.useState(null),S=V(),C=S.data?.state===`running`,w=ie(S.isSuccess&&!C),T=ne(w.data?.id,r,`${S.data?.id??``}:${S.data?.state??``}`,!C&&!w.isFetching&&!w.isError),E=W.useRef(null),D=W.useRef(!1),O=W.useRef(null),k=W.useRef(null),A=c(e),j=c(e=>i?.(e)),M=c((e,t)=>g(n=>t?n.includes(e)?n:[...n,e]:n.filter(t=>t!==e)));W.useEffect(()=>{let e=new AbortController;return E.current=e,()=>{e.abort(),A(!1)}},[f,p,A]);let N=W.useMemo(()=>{let e=B.map(e=>({...e,sessions:[]}));for(let t of w.data?.sessions??[]){let n=e.find(e=>e.id===t.source);n&&n.sessions.length<5&&n.sessions.push(t)}return e.filter(e=>e.sessions.length)},[w.data]),P=!!(O.current&&S.data?.id===O.current&&re(S.data)),F=_||!C&&!P&&(w.isFetching||!w.data||w.isError||S.isError);W.useEffect(()=>{j({disabled:F,background:C})},[F,C,j]);let I=()=>!E.current?.signal.aborted&&f===t()&&p===n(),ee=async e=>{if(!(D.current||!E.current)){D.current=!0,v(!0),A(!0),x(null);try{await e(E.current.signal)}catch(e){I()&&x(e instanceof Error&&/^[a-z_]+$/.test(e.message)?e.message:`import_failed`)}finally{D.current=!1,I()&&(v(!1),A(!1))}}},te=()=>ee(async e=>{if(F)return;if(C||P){I()&&a?.();return}if(!h.length){I()&&a?.();return}let t=await z(h,r,e,f,p);I()&&(O.current=t.id,k.current?.scrollIntoView({block:`start`}))}),L=w.error??S.error,R=y||(L instanceof Error&&/^[a-z_]+$/.test(L.message)?L.message:w.isError||S.isError?`import_failed`:null),G=W.useMemo(()=>new Intl.DateTimeFormat(s,{month:`short`,day:`numeric`}),[s]),K=S.data?U(S.data):null,ae=W.useMemo(()=>new Intl.NumberFormat(s),[s]),q=(e,t)=>{let n=w.data?.counts?.[e],r=n?.value;if(r==null||w.isError)return null;let i=ae.format(r),a=o(n?.approximate?`historyImport.estimatedCount`:`historyImport.sourceCount`,{count:i});return(0,X.jsx)(`span`,{id:t,"data-history-count":e,className:`yuri-import-source-count`,title:a,"aria-label":a,children:w.isFetching?(0,X.jsx)(d,{name:`loader-4`,className:`size-3 animate-spin`,"aria-label":o(`historyImport.scanning`)}):`${n?.approximate?`≈ `:``}${i}`})};return(0,X.jsxs)(`form`,{id:`yuri-tour-import`,className:`yuri-history-import`,"data-history-import":!0,onSubmit:e=>{e.preventDefault(),te()},children:[(0,X.jsx)(`h2`,{ref:k,className:`yuri-import-heading`,children:o(`historyImport.heading`)}),(0,X.jsx)(`p`,{className:`yuri-import-subtitle`,children:o(`historyImport.deduplication`)}),S.data&&!re(S.data)&&(C||O.current===S.data.id)&&(0,X.jsxs)(`div`,{className:`yuri-import-job`,role:`status`,children:[(0,X.jsx)(d,{name:C?`loader-4`:`error-warning`,className:u(`size-4`,C&&`animate-spin`)}),(0,X.jsx)(`span`,{children:o(C&&K?`historyImport.phase.${K.phase}`:`historyImport.state.${S.data.state}`)}),K&&K.total>0&&(0,X.jsxs)(`span`,{className:`tabular-nums`,children:[K.completed,` / `,K.total]}),C&&(0,X.jsx)(l,{variant:`ghost`,size:`icon`,disabled:_,"aria-label":o(`historyImport.cancel`),title:o(`historyImport.cancel`),onClick:()=>void ee(async e=>{await H(S.data.id,e,f),I()&&await S.refetch()}),children:(0,X.jsx)(d,{name:`stop`,className:`size-4`})}),C&&K&&(0,X.jsx)(`progress`,{value:K.total?K.completed:void 0,max:K.total||1,"aria-label":o(`historyImport.progress`)}),S.data.progress?.code&&(0,X.jsxs)(`p`,{role:`alert`,children:[o(`historyImport.failed`),` `,(0,X.jsx)(`code`,{children:S.data.progress.code})]}),S.data.results.some(e=>e.status===`failed`||e.project===`failed`||e.index===`failed`)&&(0,X.jsxs)(`p`,{role:`alert`,children:[o(`historyImport.failed`),[...new Set(S.data.results.filter(e=>e.status===`failed`&&e.code).map(e=>e.code))].map(e=>(0,X.jsxs)(`code`,{children:[` `,e]},e))]})]}),(0,X.jsx)(`div`,{className:`yuri-import-source-grid`,"aria-label":o(`historyImport.sources`),children:B.map(e=>{let t=w.data?.installations?.[e.id],n=o(t===!0?`historyImport.installed`:t===!1?`historyImport.notDetected`:`historyImport.installationUnknown`),r=w.data?.counts?.[e.id]?.value!=null&&!w.isError?` history-import-count-${e.id}`:``;return(0,X.jsxs)(l,{variant:`ghost`,"data-history-source":e.id,className:u(`yuri-import-source-card`,(e.id===`cursor`||e.id===`opencode`)&&`yuri-import-source-cursor`),disabled:_||C,"aria-pressed":h.includes(e.id),"aria-label":e.name,"aria-describedby":`history-import-installed-${e.id}${r}`,onClick:()=>M(e.id,!h.includes(e.id)),children:[(0,X.jsxs)(`span`,{className:`yuri-import-logo-wrap`,children:[(0,X.jsx)(`img`,{src:se[e.id],alt:``,draggable:!1,className:`yuri-import-source-logo`}),(0,X.jsx)(`span`,{id:`history-import-installed-${e.id}`,role:`img`,"aria-label":n,title:n,"data-installed":t===!0?`true`:t===!1?`false`:`unknown`,className:`yuri-import-installation`})]}),(0,X.jsx)(`span`,{className:`yuri-import-source-name`,children:e.name}),q(e.id,`history-import-count-${e.id}`),(0,X.jsx)(`span`,{className:`yuri-import-source-check`,"aria-hidden":`true`,children:(0,X.jsx)(d,{name:`check`,className:`size-3`})})]},e.id)})}),R&&(0,X.jsxs)(`div`,{role:`alert`,className:`yuri-tour-feedback`,children:[(0,X.jsxs)(`p`,{children:[o(R===`history_import_unsupported`?`historyImport.unsupported`:`historyImport.failed`),` `,(0,X.jsx)(`code`,{children:R})]}),(w.isError||S.isError)&&(0,X.jsx)(l,{variant:`ghost`,size:`xs`,disabled:w.isFetching||S.isFetching,onClick:()=>{Promise.all([w.refetch(),S.refetch()])},children:o(`settings.plugins.status.retry`)})]}),w.data&&!w.isFetching&&!w.isError&&!w.data.sessions.length&&!w.data.errors.length&&(0,X.jsx)(`p`,{className:`yuri-tour-feedback`,children:o(`historyImport.empty`)}),N.length>0&&(0,X.jsxs)(`section`,{"aria-label":o(`historyImport.sessions`),children:[(0,X.jsx)(`div`,{className:`yuri-import-list-heading`,children:o(`historyImport.sessions`)}),(0,X.jsx)(`div`,{className:`yuri-import-preview-groups`,children:N.map(e=>(0,X.jsxs)(`section`,{"aria-label":e.name,"data-source-selected":h.includes(e.id),children:[(0,X.jsxs)(`div`,{className:`yuri-import-preview-heading`,children:[(0,X.jsx)(`h3`,{children:e.name}),q(e.id),(0,X.jsx)(b,{checked:h.includes(e.id),disabled:_||C,ariaLabel:e.name,onChange:t=>M(e.id,t)})]}),(0,X.jsx)(`ul`,{className:`yuri-import-session-grid`,children:e.sessions.map(e=>(0,X.jsxs)(`li`,{"data-history-session":e.key,className:u(`yuri-import-session-card`,(e.source===`cursor`||e.source===`opencode`)&&`yuri-import-source-cursor`),title:e.title,children:[(0,X.jsx)(`img`,{src:se[e.source],alt:``,draggable:!1,className:`yuri-import-session-logo`}),(0,X.jsxs)(`span`,{className:`yuri-import-session-copy`,children:[(0,X.jsxs)(`span`,{className:`yuri-import-session-heading`,children:[(0,X.jsx)(`span`,{className:`yuri-import-session-title`,children:e.title}),!T.isError&&T.data?.states[e.key]===`imported`&&(0,X.jsx)(`span`,{className:`yuri-import-session-imported`,"data-history-imported":!0,children:o(`historyImport.alreadyImported`)}),e.updated&&e.updated>0?(0,X.jsx)(`time`,{dateTime:new Date(e.updated).toISOString(),children:G.format(e.updated)}):null]}),e.excerpt&&(0,X.jsx)(`span`,{className:`yuri-import-session-excerpt`,children:e.excerpt})]})]},e.key))})]},e.id))})]})]})}var Z=K.map(e=>e.spec),le=[`tour.models`,`tour.plugins`,`tour.import`,`tour.voice`],ue=[{id:`openai`,name:`OpenAI`},{id:`anthropic`,name:`Anthropic`},{id:`google`,name:`Google Gemini`},{id:`github-copilot`,name:`GitHub Copilot`},{id:`deepseek`,name:`DeepSeek`},{id:`openrouter`,name:`OpenRouter`}];function de(e){let t=(0,G.c)(48),{index:n,info:r,installed:i,selected:a,onSelect:o,onReadme:s}=e,{t:c}=m(),f=K[n],p=r?.kind===`npm-ok`?r:void 0,h=a&&`yuri-tour-card-selected`,g;t[0]===h?g=t[1]:(g=u(`yuri-tour-plugin yuri-tour-select-card`,h),t[0]=h,t[1]=g);let _;t[2]===a?_=t[3]:(_=a&&(0,X.jsx)(d,{name:`check`,className:`size-5`}),t[2]=a,t[3]=_);let v;t[4]===_?v=t[5]:(v=(0,X.jsx)(`span`,{className:`yuri-tour-card-check`,"aria-hidden":`true`,children:_}),t[4]=_,t[5]=v);let y;t[6]!==o||t[7]!==f.name||t[8]!==a||t[9]!==v?(y=(0,X.jsx)(l,{variant:`ghost`,className:`yuri-tour-card-toggle`,"aria-label":f.name,"aria-pressed":a,onClick:o,children:v}),t[6]=o,t[7]=f.name,t[8]=a,t[9]=v,t[10]=y):y=t[10];let b=p?.icon,x;t[11]!==f.name||t[12]!==b?(x=(0,X.jsx)(I,{name:f.name,src:b,size:30}),t[11]=f.name,t[12]=b,t[13]=x):x=t[13];let S;t[14]===f.name?S=t[15]:(S=(0,X.jsx)(`h3`,{className:`typography-ui-label font-medium`,children:f.name}),t[14]=f.name,t[15]=S);let C;t[16]===f.spec?C=t[17]:(C=(0,X.jsx)(`p`,{className:`break-all typography-micro text-muted-foreground`,children:f.spec}),t[16]=f.spec,t[17]=C);let w;t[18]!==S||t[19]!==C?(w=(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[S,C]}),t[18]=S,t[19]=C,t[20]=w):w=t[20];let T;t[21]===p?T=t[22]:(T=p?.latestVersion&&(0,X.jsx)(`span`,{className:`typography-micro text-muted-foreground`,children:p.latestVersion}),t[21]=p,t[22]=T);let E;t[23]!==w||t[24]!==T||t[25]!==x?(E=(0,X.jsxs)(`div`,{className:`flex items-start gap-3 pr-10`,children:[x,w,T]}),t[23]=w,t[24]=T,t[25]=x,t[26]=E):E=t[26];let D;t[27]!==r||t[28]!==p?.description||t[29]!==c?(D=p?.description||c(r?`tour.metadataUnavailable`:`common.loading`),t[27]=r,t[28]=p?.description,t[29]=c,t[30]=D):D=t[30];let O;t[31]===D?O=t[32]:(O=(0,X.jsx)(`p`,{className:`flex-1 typography-meta text-muted-foreground`,children:D}),t[31]=D,t[32]=O);let k=!p,A;t[33]!==s||t[34]!==k?(A=(0,X.jsx)(l,{size:`xs`,variant:`ghost`,className:`yuri-tour-card-link`,disabled:k,onClick:s,children:`README`}),t[33]=s,t[34]=k,t[35]=A):A=t[35];let j;t[36]!==i||t[37]!==c?(j=i&&(0,X.jsx)(`span`,{className:`typography-meta text-muted-foreground`,children:c(`tour.saved`)}),t[36]=i,t[37]=c,t[38]=j):j=t[38];let M;t[39]!==A||t[40]!==j?(M=(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[A,j]}),t[39]=A,t[40]=j,t[41]=M):M=t[41];let N;return t[42]!==E||t[43]!==O||t[44]!==M||t[45]!==g||t[46]!==y?(N=(0,X.jsxs)(`section`,{className:g,children:[y,E,O,M]}),t[42]=E,t[43]=O,t[44]=M,t[45]=g,t[46]=y,t[47]=N):N=t[47],N}function fe(e){let t=(0,G.c)(28),{settings:n,onComplete:r,onBusy:i}=e,{t:a}=m(),o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o={voiceProvider:`volcengine`,sttProvider:`volcengine`,dictationEnabled:!0,showMessageTTSButtons:!0},t[0]=o):o=t[0];let s=L(n,o),l=c(i),u,d;t[1]!==s.saving||t[2]!==l?(u=()=>(l(s.saving),()=>l(!1)),d=[s.saving,l],t[1]=s.saving,t[2]=l,t[3]=u,t[4]=d):(u=t[3],d=t[4]),W.useEffect(u,d);let f;t[5]!==s||t[6]!==r||t[7]!==n.configured?(f=async e=>{e.preventDefault(),!(!n.configured&&!s.draft.apiKey?.trim())&&(await s.save())?.configured&&r()},t[5]=s,t[6]=r,t[7]=n.configured,t[8]=f):f=t[8];let p=f,h;t[9]===p?h=t[10]:(h=e=>void p(e),t[9]=p,t[10]=h);let g;t[11]===a?g=t[12]:(g=a(`settings.voice.volcengine.name`),t[11]=a,t[12]=g);let _,v;t[13]===s?(_=t[14],v=t[15]):(_=(0,X.jsx)(F,{mode:`tts`,form:s}),v=(0,X.jsx)(F,{mode:`asr`,form:s,showCredentials:!1}),t[13]=s,t[14]=_,t[15]=v);let y;t[16]!==g||t[17]!==_||t[18]!==v?(y=(0,X.jsxs)(k,{label:g,children:[_,v]}),t[16]=g,t[17]=_,t[18]=v,t[19]=y):y=t[19];let b;t[20]!==s.draft||t[21]!==n.configured||t[22]!==a?(b=!n.configured&&!s.draft.apiKey?.trim()&&(0,X.jsx)(`p`,{className:`typography-meta text-muted-foreground`,children:a(`settings.providers.page.toast.apiKeyRequired`)}),t[20]=s.draft,t[21]=n.configured,t[22]=a,t[23]=b):b=t[23];let x;return t[24]!==b||t[25]!==h||t[26]!==y?(x=(0,X.jsxs)(`form`,{id:`yuri-tour-voice`,onSubmit:h,className:`yuri-settings-section-stack`,children:[y,b]}),t[24]=b,t[25]=h,t[26]=y,t[27]=x):x=t[27],x}function pe({runtime:e,onClose:r}){let{t:i}=m(),a=A(),c=D(t=>t.progress[e]?.step??0),[b,S]=W.useState(`magpie`),[C,w]=W.useState(),[k,N]=W.useState(Z.slice(1)),[P,F]=W.useState(`tour`),[I,L]=W.useState(null),[R,z]=W.useState(!1),[ne,re]=W.useState({disabled:!0}),[B,V]=W.useState(null),ie=n(),H=t(),U=W.useRef(null),G=W.useRef(!1);W.useEffect(()=>{let e=new AbortController;return U.current=e,()=>e.abort()},[]);let q=j(),J=o({...M(a,Z.slice(1),!1,H,!0),enabled:c===1}),Y=o({...E(H),enabled:c===3}),se=q.data?.entries??[],pe=e=>{let t=p.getState(),n=e&&t.providers.some(t=>t.id===e);S(`other`),w(n?void 0:e),t.setSelectedProvider(n?e:`__add_provider__`),F(`providers`)},Q=()=>!U.current?.signal.aborted&&ie===n()&&H===t(),$=t=>{F(`tour`),V(null),D.getState().move(e,t)},me=()=>{Q()&&r()},he=()=>{c===3?me():$(c+1)},ge=async()=>{if(c===2){he();return}if(!(G.current||R||!U.current)){G.current=!0,z(!0),V(null);try{let e=c===0?b===`magpie`?[Z[0]]:[]:k;if(e.length){let t=await oe(e,a,U.current.signal);if(!Q())return;if(t.failed.length){V(i(`tour.saveFailed`,{names:t.failed.join(`, `)}));return}}if(c===0&&b===`other`){let e=await s.fetchQuery({...f(a,H),staleTime:0});if(!Q())return;if(e.partial||!e.providers.some(e=>Object.keys(e.models).length>0)){V(i(`tour.noModels`));return}await p.getState().loadProviders({directory:a,forceRefresh:!0,source:`setup-tour`})}Q()&&he()}catch{Q()&&V(i(`tour.operationFailed`))}finally{G.current=!1,Q()&&z(!1)}}},_e=()=>{I===null?P===`tour`?c>0&&$(c-1):F(`tour`):L(null)},ve=I===null?void 0:J.data?.[Z[I]],ye=ve?.kind===`npm-ok`?ve.readme:void 0;return(0,X.jsx)(v,{open:!0,onOpenChange:e=>{!e&&!R&&(I!==null||P!==`tour`?_e():me())},children:(0,X.jsxs)(g,{className:`yuri-setup-tour yuri-settings-workspace`,showCloseButton:!1,"aria-describedby":void 0,children:[(0,X.jsx)(`div`,{className:`yuri-tour-watermark`,"aria-hidden":`true`,children:(0,X.jsx)(x,{width:440,height:440})}),(0,X.jsx)(h,{children:(0,X.jsxs)(_,{className:`yuri-tour-title`,children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,children:`👋`}),i(`tour.title`).split(`Yuri`).map((e,t)=>(0,X.jsxs)(W.Fragment,{children:[t>0&&(0,X.jsx)(O,{width:`2.05em`}),(0,X.jsx)(`span`,{children:e.trim()})]},t))]})}),(0,X.jsxs)(`div`,{className:`yuri-tour-body`,children:[(0,X.jsx)(`nav`,{className:`yuri-tour-progress`,"aria-label":i(`tour.title`),children:le.map((e,t)=>(0,X.jsxs)(l,{variant:`ghost`,size:`lg`,disabled:R,"aria-current":c===t?`step`:void 0,onClick:()=>{L(null),$(t)},children:[(0,X.jsx)(`span`,{className:`yuri-tour-number`,"aria-hidden":`true`,children:String(t+1).padStart(2,`0`)}),(0,X.jsx)(`span`,{children:i(e)})]},e))}),(0,X.jsx)(`div`,{className:u(`yuri-tour-content`,P===`providers`&&I===null&&`yuri-tour-provider-content`),children:(0,X.jsxs)(`fieldset`,{disabled:R,className:`contents`,children:[I===null?P===`providers`?(0,X.jsx)(te,{initialConnectionId:C}):P===`voice`&&Y.data?(0,X.jsx)(fe,{settings:Y.data,onComplete:me,onBusy:z}):P===`asr`||P===`tts`?(0,X.jsx)(ee,{section:P}):(0,X.jsxs)(X.Fragment,{children:[c<2&&(c===1&&J.isError||q.isError)&&(0,X.jsxs)(`div`,{role:`alert`,className:`yuri-tour-feedback`,children:[(0,X.jsx)(`p`,{children:i(`tour.metadataUnavailable`)}),(0,X.jsx)(l,{size:`xs`,onClick:()=>{c===1&&J.refetch(),q.refetch()},children:i(`settings.plugins.status.retry`)})]}),c===0&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`section`,{className:u(`yuri-tour-magpie yuri-tour-select-card`,b===`magpie`&&`yuri-tour-card-selected`),children:[(0,X.jsx)(l,{variant:`ghost`,className:`yuri-tour-card-toggle`,"aria-label":`Magpie`,"aria-pressed":b===`magpie`,onClick:()=>S(b===`magpie`?`other`:`magpie`),children:(0,X.jsx)(`span`,{className:`yuri-tour-card-check`,"aria-hidden":`true`,children:b===`magpie`&&(0,X.jsx)(d,{name:`check`,className:`size-5`})})}),(0,X.jsxs)(`div`,{className:`flex w-full items-center gap-3 pr-10`,children:[(0,X.jsx)(T,{providerId:`magpie`,alt:`Magpie`,className:`size-8 shrink-0`}),(0,X.jsx)(`span`,{className:`typography-ui-label`,children:`Magpie`}),(0,X.jsx)(`span`,{className:`yuri-tour-recommended`,children:i(`tour.recommended`)})]}),(0,X.jsx)(`p`,{className:`typography-meta text-muted-foreground`,children:i(`tour.magpieDescription`)}),(0,X.jsxs)(`a`,{className:`yuri-tour-card-link typography-meta text-muted-foreground underline`,href:`https://usemagpie.ai/docs/start`,target:`_blank`,rel:`noreferrer`,children:[i(`tour.docs`),` ↗`]})]}),(0,X.jsxs)(`div`,{className:`yuri-tour-provider-heading`,children:[(0,X.jsx)(`span`,{className:`typography-meta text-muted-foreground`,children:`OpenCode`}),(0,X.jsxs)(`a`,{className:`typography-meta text-muted-foreground underline`,href:`https://opencode.ai/docs/providers/`,target:`_blank`,rel:`noreferrer`,children:[i(`tour.docs`),` ↗`]})]}),(0,X.jsx)(`div`,{className:`yuri-tour-provider-grid`,children:ue.map(e=>(0,X.jsxs)(l,{variant:`ghost`,className:`yuri-tour-provider-choice`,onClick:()=>pe(e.id),children:[(0,X.jsx)(T,{providerId:e.id,alt:e.name,className:`size-6 shrink-0`}),(0,X.jsx)(`span`,{children:e.name})]},e.id))}),(0,X.jsxs)(l,{className:`mt-3`,size:`sm`,variant:`ghost`,onClick:()=>pe(),children:[i(`tour.otherProvider`),(0,X.jsx)(d,{name:`arrow-right-s`,className:`size-4`})]})]}),c===1&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`div`,{className:`yuri-tour-plugins`,children:[1,2].map(e=>(0,X.jsx)(de,{index:e,info:J.data?.[Z[e]],installed:ae(se,Z[e]),selected:k.includes(Z[e]),onSelect:()=>N(t=>t.includes(Z[e])?t.filter(t=>t!==Z[e]):[...t,Z[e]]),onReadme:()=>L(e)},e))}),(0,X.jsxs)(`a`,{className:`mt-4 inline-block typography-meta text-muted-foreground underline underline-offset-4 hover:text-foreground`,href:`https://opencode.ai/docs/ecosystem/#plugins`,target:`_blank`,rel:`noopener noreferrer`,children:[i(`tour.morePlugins`),` ↗`]})]}),c===2&&(0,X.jsx)(ce,{onBusy:z,directory:a,onPrimaryChange:re,onComplete:()=>$(3)}),c===3&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`yuri-tour-voice-intro`,children:[(0,X.jsx)(`h2`,{children:i(`tour.voiceHeading`)}),(0,X.jsx)(`p`,{children:i(`tour.voiceIntro`)})]}),(0,X.jsxs)(`div`,{className:`yuri-tour-voice-capabilities`,children:[(0,X.jsxs)(`section`,{children:[(0,X.jsx)(d,{name:`mic`,className:`yuri-tour-voice-icon`}),(0,X.jsx)(`h3`,{children:i(`settings.voice.page.section.speechRecognition`)}),(0,X.jsx)(`p`,{children:i(`tour.dictationDescription`)}),(0,X.jsxs)(`div`,{className:`yuri-tour-voice-services`,children:[(0,X.jsxs)(`span`,{children:[(0,X.jsx)(`img`,{src:`data:image/svg+xml,%3csvg%20height='24'%20style='flex:none;line-height:1'%20viewBox='0%200%2024%2024'%20width='24'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eDoubao%3c/title%3e%3cpath%20d='M5.31%2015.756c.172-3.75%201.883-5.999%202.549-6.739-3.26%202.058-5.425%205.658-6.358%208.308v1.12C1.501%2021.513%204.226%2024%207.59%2024a6.59%206.59%200%20002.2-.375c.353-.12.7-.248%201.039-.378.913-.899%201.65-1.91%202.243-2.992-4.877%202.431-7.974.072-7.763-4.5l.002.001z'%20fill='%231E37FC'%3e%3c/path%3e%3cpath%20d='M22.57%2010.283c-1.212-.901-4.109-2.404-7.397-2.8.295%203.792.093%208.766-2.1%2012.773a12.782%2012.782%200%2001-2.244%202.992c3.764-1.448%206.746-3.457%208.596-5.219%202.82-2.683%203.353-5.178%203.361-6.66a2.737%202.737%200%2000-.216-1.084v-.002z'%20fill='%2337E1BE'%3e%3c/path%3e%3cpath%20d='M14.303%201.867C12.955.7%2011.248%200%209.39%200%207.532%200%205.883.677%204.545%201.807%202.791%203.29%201.627%205.557%201.5%208.125v9.201c.932-2.65%203.097-6.25%206.357-8.307.5-.318%201.025-.595%201.569-.829%201.883-.801%203.878-.932%205.746-.706-.222-2.83-.718-5.002-.87-5.617h.001z'%20fill='%23A569FF'%3e%3c/path%3e%3cpath%20d='M17.305%204.961a199.47%20199.47%200%2001-1.08-1.094c-.202-.213-.398-.419-.586-.622l-1.333-1.378c.151.615.648%202.786.869%205.617%203.288.395%206.185%201.898%207.396%202.8-1.306-1.275-3.475-3.487-5.266-5.323z'%20fill='%231E37FC'%3e%3c/path%3e%3c/svg%3e`,alt:``,className:`size-4`}),i(`settings.voice.volcengine.name`)]}),(0,X.jsxs)(`span`,{children:[(0,X.jsx)(d,{name:`computer`}),i(`settings.voice.page.provider.local`)]}),(0,X.jsxs)(`span`,{children:[(0,X.jsx)(d,{name:`server`}),i(`settings.voice.page.provider.server`)]})]}),(0,X.jsxs)(l,{size:`sm`,onClick:()=>F(`asr`),children:[i(`tour.configureInput`),(0,X.jsx)(d,{name:`arrow-right-s`,className:`size-4`})]})]}),(0,X.jsxs)(`section`,{children:[(0,X.jsx)(d,{name:`volume-up`,className:`yuri-tour-voice-icon`}),(0,X.jsx)(`h3`,{children:i(`tour.readAloudTitle`)}),(0,X.jsx)(`p`,{children:i(`tour.readAloudDescription`)}),(0,X.jsxs)(`div`,{className:`yuri-tour-voice-services`,children:[(0,X.jsxs)(`span`,{children:[(0,X.jsx)(`img`,{src:`data:image/svg+xml,%3csvg%20height='24'%20style='flex:none;line-height:1'%20viewBox='0%200%2024%2024'%20width='24'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eDoubao%3c/title%3e%3cpath%20d='M5.31%2015.756c.172-3.75%201.883-5.999%202.549-6.739-3.26%202.058-5.425%205.658-6.358%208.308v1.12C1.501%2021.513%204.226%2024%207.59%2024a6.59%206.59%200%20002.2-.375c.353-.12.7-.248%201.039-.378.913-.899%201.65-1.91%202.243-2.992-4.877%202.431-7.974.072-7.763-4.5l.002.001z'%20fill='%231E37FC'%3e%3c/path%3e%3cpath%20d='M22.57%2010.283c-1.212-.901-4.109-2.404-7.397-2.8.295%203.792.093%208.766-2.1%2012.773a12.782%2012.782%200%2001-2.244%202.992c3.764-1.448%206.746-3.457%208.596-5.219%202.82-2.683%203.353-5.178%203.361-6.66a2.737%202.737%200%2000-.216-1.084v-.002z'%20fill='%2337E1BE'%3e%3c/path%3e%3cpath%20d='M14.303%201.867C12.955.7%2011.248%200%209.39%200%207.532%200%205.883.677%204.545%201.807%202.791%203.29%201.627%205.557%201.5%208.125v9.201c.932-2.65%203.097-6.25%206.357-8.307.5-.318%201.025-.595%201.569-.829%201.883-.801%203.878-.932%205.746-.706-.222-2.83-.718-5.002-.87-5.617h.001z'%20fill='%23A569FF'%3e%3c/path%3e%3cpath%20d='M17.305%204.961a199.47%20199.47%200%2001-1.08-1.094c-.202-.213-.398-.419-.586-.622l-1.333-1.378c.151.615.648%202.786.869%205.617%203.288.395%206.185%201.898%207.396%202.8-1.306-1.275-3.475-3.487-5.266-5.323z'%20fill='%231E37FC'%3e%3c/path%3e%3c/svg%3e`,alt:``,className:`size-4`}),i(`settings.voice.volcengine.name`)]}),(0,X.jsxs)(`span`,{children:[(0,X.jsx)(T,{providerId:`openai`,alt:`OpenAI`,className:`size-4`}),`OpenAI`]}),(0,X.jsxs)(`span`,{children:[(0,X.jsx)(d,{name:`computer`}),i(`settings.voice.page.provider.browser`)]}),(0,X.jsxs)(`span`,{children:[(0,X.jsx)(d,{name:`cloud`}),i(`settings.voice.page.provider.custom`)]})]}),(0,X.jsxs)(l,{size:`sm`,onClick:()=>F(`tts`),children:[i(`tour.configureReadAloud`),(0,X.jsx)(d,{name:`arrow-right-s`,className:`size-4`})]})]})]}),(0,X.jsxs)(`section`,{className:`yuri-tour-voice-recommendation`,children:[(0,X.jsx)(`img`,{src:`data:image/svg+xml,%3csvg%20height='24'%20style='flex:none;line-height:1'%20viewBox='0%200%2024%2024'%20width='24'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eDoubao%3c/title%3e%3cpath%20d='M5.31%2015.756c.172-3.75%201.883-5.999%202.549-6.739-3.26%202.058-5.425%205.658-6.358%208.308v1.12C1.501%2021.513%204.226%2024%207.59%2024a6.59%206.59%200%20002.2-.375c.353-.12.7-.248%201.039-.378.913-.899%201.65-1.91%202.243-2.992-4.877%202.431-7.974.072-7.763-4.5l.002.001z'%20fill='%231E37FC'%3e%3c/path%3e%3cpath%20d='M22.57%2010.283c-1.212-.901-4.109-2.404-7.397-2.8.295%203.792.093%208.766-2.1%2012.773a12.782%2012.782%200%2001-2.244%202.992c3.764-1.448%206.746-3.457%208.596-5.219%202.82-2.683%203.353-5.178%203.361-6.66a2.737%202.737%200%2000-.216-1.084v-.002z'%20fill='%2337E1BE'%3e%3c/path%3e%3cpath%20d='M14.303%201.867C12.955.7%2011.248%200%209.39%200%207.532%200%205.883.677%204.545%201.807%202.791%203.29%201.627%205.557%201.5%208.125v9.201c.932-2.65%203.097-6.25%206.357-8.307.5-.318%201.025-.595%201.569-.829%201.883-.801%203.878-.932%205.746-.706-.222-2.83-.718-5.002-.87-5.617h.001z'%20fill='%23A569FF'%3e%3c/path%3e%3cpath%20d='M17.305%204.961a199.47%20199.47%200%2001-1.08-1.094c-.202-.213-.398-.419-.586-.622l-1.333-1.378c.151.615.648%202.786.869%205.617%203.288.395%206.185%201.898%207.396%202.8-1.306-1.275-3.475-3.487-5.266-5.323z'%20fill='%231E37FC'%3e%3c/path%3e%3c/svg%3e`,alt:``,className:`size-6 shrink-0`}),(0,X.jsxs)(`div`,{children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(`h3`,{children:i(`settings.voice.volcengine.name`)}),(0,X.jsx)(`span`,{className:`yuri-tour-recommended`,children:i(`tour.recommended`)})]}),(0,X.jsx)(`p`,{children:i(`tour.voiceAllowance`)})]}),(0,X.jsx)(l,{disabled:!Y.data,size:`sm`,onClick:()=>F(`voice`),children:i(`tour.configureVoice`)})]}),Y.isError&&(0,X.jsxs)(`div`,{role:`alert`,className:`yuri-tour-feedback`,children:[(0,X.jsx)(`p`,{children:i(`settings.voice.volcengine.loadFailed`)}),(0,X.jsx)(l,{size:`xs`,onClick:()=>void Y.refetch(),children:i(`settings.voice.volcengine.retry`)})]})]})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`h3`,{className:`typography-ui-label mb-4`,children:[K[I].name,` · README`]}),ye?(0,X.jsx)(y,{content:ye,enableFileReferences:!1}):(0,X.jsx)(`p`,{className:`typography-meta text-muted-foreground`,children:i(`tour.metadataUnavailable`)})]}),B&&I===null&&(0,X.jsx)(`p`,{role:`alert`,className:`yuri-tour-feedback`,children:B})]})})]}),(0,X.jsxs)(`footer`,{className:`yuri-tour-footer`,children:[(P!==`tour`||I!==null)&&(0,X.jsx)(l,{variant:`ghost`,size:`sm`,disabled:R,onClick:_e,children:i(`onboarding.common.actions.back`)}),I===null&&(0,X.jsxs)(`div`,{className:`ml-auto flex flex-wrap justify-end gap-2`,children:[(0,X.jsx)(l,{variant:`ghost`,size:`sm`,disabled:R,onClick:he,children:i(`tour.later`)}),c===2?(0,X.jsxs)(l,{size:`sm`,type:`submit`,form:`yuri-tour-import`,disabled:R||ne.disabled,"aria-busy":R,children:[R&&(0,X.jsx)(d,{name:`loader-4`,className:`size-3 animate-spin`}),i(ne.background?`historyImport.background`:`historyImport.next`)]}):c===3?(0,X.jsx)(l,{size:`sm`,disabled:R,type:P===`voice`?`submit`:`button`,form:P===`voice`?`yuri-tour-voice`:void 0,onClick:P===`voice`?void 0:me,children:i(P===`voice`?`settings.common.actions.saveChanges`:`tour.finish`)}):(0,X.jsxs)(l,{size:`sm`,disabled:R||c<2&&(!q.data||q.isError),"aria-busy":R,onClick:()=>void ge(),children:[R&&(0,X.jsx)(d,{name:`loader-4`,className:`size-3 animate-spin`}),i(`tour.continue`)]})]})]})]})})}export{pe as SetupTourDialog};