@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,2 +1,2 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/assistant-attachment-cache-bRIIESGe.js","assets/rolldown-runtime-hePW80VL.js","assets/runtime-auth-DA-qfGHk.js","assets/runtime-switch-DEPKHgdL.js","assets/runtime-fetch-V-iMWR8t.js","assets/reasoning-projection-client-BEhVknv9.js","assets/runtime-file-resource-Bc_ss-sW.js","assets/platform-CiUKDeXd.js","assets/runtimeAPIRegistry-C2VogTny.js","assets/vendor-pathe-vBmvQE8f.js","assets/vendor-base-ui-wXsskyKm.js","assets/vendor-react-BkccXcWz.js","assets/vendor-tanstack-react-query-DIb_ItL-.js","assets/vendor-tanstack-query-core-BSjXNgF_.js","assets/yuriEvents-BFrD5fMU.js","assets/path-utils-jGozTg9d.js","assets/vendor-reactuses-core-DjKFMfz7.js","assets/vendor-lodash-es-BS45jPoZ.js","assets/vendor-js-cookie-hSOiFTtX.js","assets/vendor-aparajita-capacitor-secure-storage-xol_6BsB.js","assets/runtime-file-store-BVRgEtI-.js","assets/brand-storage-migration-Bhz6UOBJ.js"])))=>i.map(i=>d[i]);
2
- import"./rolldown-runtime-hePW80VL.js";import{i as e,l as t}from"./runtime-switch-DEPKHgdL.js";import{n}from"./runtime-fetch-V-iMWR8t.js";import{A as r,I as i,f as a,j as o,p as s}from"./platform-CiUKDeXd.js";import{f as c,s as l,v as u}from"./desktopHosts-BsTrBVja.js";import{i as d,n as f,r as p}from"./desktopRelayRestore-BxbRKak_.js";import{ot as m,st as h}from"./vendor-base-ui-wXsskyKm.js";import{n as g}from"./vendor-react-BkccXcWz.js";import{r as _}from"./vendor-tanstack-query-core-BSjXNgF_.js";import{i as v,n as ee,r as te,s as ne,u as re}from"./vendor-tanstack-react-query-DIb_ItL-.js";import{c as y,l as ie}from"./yuriEvents-BFrD5fMU.js";import{o as ae}from"./vendor-aparajita-capacitor-secure-storage-xol_6BsB.js";import{o as oe}from"./session-startup-barrier-DT-hIBRf.js";import{Bi as se,t as b}from"./ui-DrAJTWV6.js";import{n as ce,t as le}from"./i18n-DXc6czdR.js";import{i as x,t as S}from"./store-C1ifDY0C.js";import{i as ue,n as de,r as fe,t as pe}from"./vendor-simplewebauthn-browser-Dwhcdg_5.js";var C=g(),w=[`desktopHostSwitch`],T=class extends Error{result;host;constructor(e,t){super(e.reason),this.name=`DesktopHostSwitchError`,this.result=e,this.host=t}},E=(e,t)=>S(x.getState().dictionary,e,t),me=async e=>{let{host:n}=e;if(n.id===`local`){if(i()&&!s())return await o(`desktop_switch_to_local`),{ok:!0,via:`direct`,status:{status:`ok`,latencyMs:0}};let r=(e.localApiOrigin||``).trim();if(!r)throw new T({ok:!1,status:{status:`unreachable`,latencyMs:0},reason:`unreachable`},n);return t({apiBaseUrl:r,clientToken:e.localClientToken||null,runtimeKey:p(n)}),{ok:!0,via:`direct`,status:{status:`ok`,latencyMs:0}}}let r=await d(n,{cachedProbe:e.cachedProbe});if(!r.ok)throw new T(r,n);return r},D=null,he=()=>D||(D=new _(y,{mutationKey:w,mutationFn:me,onError:(e,t)=>{if(!(e instanceof T)){b.error(E(`desktopHostSwitcher.toast.instanceUnreachable`,{host:u(t.host.label)}),{description:e instanceof Error?e.message:String(e)});return}if(e.result.reason!==`unsupported`){if(e.result.status.status===`auth`){if(c(e.host)){b.error(E(`mobile.connect.pairing.expired`),{description:E(`desktopHostSwitcher.pairing.reconnectHint`),action:{label:E(`settings.remoteInstances.openLocalManager`),onClick:()=>{l().catch(()=>b.error(E(`sessionAuth.error.networkTitle`)))}}});return}b.error(E(`desktopHostSwitcher.status.authRequired`));return}b.error(E(`desktopHostSwitcher.toast.instanceUnreachable`,{host:u(t.host.label)}))}}}),D.subscribe(()=>void 0),D),ge=async e=>{if(f(e.host))return{ok:!0,via:`direct`,status:e.cachedProbe?.status===`ok`?e.cachedProbe:{status:`ok`,latencyMs:0}};if(y.isMutating({mutationKey:w})>0)return{ok:!1,status:{status:`unreachable`,latencyMs:0},reason:`unsupported`};try{return await he().mutate(e)}catch(e){return e instanceof T?e.result:{ok:!1,status:{status:`unreachable`,latencyMs:0},reason:`unreachable`}}},_e=e=>{let t=(0,C.c)(2),n=e!==void 0&&e,r;return t[0]===n?r=t[1]:(r={mutationKey:w,predicate:e=>!n||!e.state.variables?.inlineProgress},t[0]=n,t[1]=r),te(r)>0},ve=()=>{let e=(0,C.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={filters:{mutationKey:w,status:`pending`},select:ye},e[0]=t):t=e[0],v(t)[0]?.host.id??null};function ye(e){return e.state.variables}var O=e=>typeof e==`object`&&!!e,k=(e,t)=>{let n=e[t];return typeof n==`string`?n:null},A=(e,t)=>{let n=e[t];return typeof n==`number`&&Number.isFinite(n)?n:null},j=(e,t)=>{let n=e[t];return typeof n==`boolean`?n:null},M=e=>Array.isArray(e)?e.filter(e=>typeof e==`string`):[],N=()=>r()?(e,t)=>o(e,t):null,P=e=>{if(!O(e))return;let t=j(e,`enabled`)??!1,n=k(e,`store`)?.toLowerCase()===`settings`?`settings`:`never`,r=k(e,`value`);return{enabled:t,store:n,...r?{value:r}:{}}},be=e=>e===`remote`||e===`dynamic`?e:`local`,xe=e=>{if(!O(e))return null;let t=k(e,`id`);if(!t)return null;let n=j(e,`enabled`)??!0,r=be(k(e,`type`)),i=k(e,`localHost`)||k(e,`local_host`)||void 0,a=A(e,`localPort`)??A(e,`local_port`)??void 0,o=k(e,`remoteHost`)||k(e,`remote_host`)||void 0,s=A(e,`remotePort`)??A(e,`remote_port`)??void 0;return{id:t,enabled:n,type:r,...i?{localHost:i}:{},...typeof a==`number`?{localPort:a}:{},...o?{remoteHost:o}:{},...typeof s==`number`?{remotePort:s}:{}}},Se=e=>{if(!O(e))return null;let t=k(e,`id`),n=k(e,`sshCommand`)||k(e,`ssh_command`);if(!t||!n)return null;let r=k(e,`nickname`),i=e.sshParsed,a=O(i)?{destination:k(i,`destination`)||``,args:M(i.args)}:void 0,o=O(e.remoteYuri)?e.remoteYuri:O(e.remote_yuri)?e.remote_yuri:{},s=O(e.localForward)?e.localForward:O(e.local_forward)?e.local_forward:{},c=O(e.auth)?e.auth:{},l=k(o,`mode`)?.toLowerCase()===`external`?`external`:`managed`,u=k(o,`installMethod`)||k(o,`install_method`),d=u===`npm`||u===`download_release`||u===`upload_bundle`?u:`bun`,f=k(s,`bindHost`)||k(s,`bind_host`)||`127.0.0.1`,p=f===`localhost`||f===`0.0.0.0`?f:`127.0.0.1`,m=(Array.isArray(e.portForwards)?e.portForwards:Array.isArray(e.port_forwards)?e.port_forwards:[]).map(e=>xe(e)).filter(e=>!!e),h=A(o,`preferredPort`)??A(o,`preferred_port`),g=A(s,`preferredLocalPort`)??A(s,`preferred_local_port`),_=P(c.sshPassword||c.ssh_password),v=P(c.yuriPassword||c.yuri_password);return{id:t,...r?{nickname:r}:{},sshCommand:n,...a&&a.destination?{sshParsed:a}:{},connectionTimeoutSec:A(e,`connectionTimeoutSec`)??A(e,`connection_timeout_sec`)??60,remoteYuri:{mode:l,keepRunning:j(o,`keepRunning`)??j(o,`keep_running`)??!0,relayHost:j(o,`relayHost`)??j(o,`relay_host`)??!0,...h?{preferredPort:h}:{},installMethod:d,uploadBundleOverSsh:j(o,`uploadBundleOverSsh`)??j(o,`upload_bundle_over_ssh`)??!1},localForward:{...g?{preferredLocalPort:g}:{},bindHost:p},auth:{..._?{sshPassword:_}:{},...v?{yuriPassword:v}:{}},portForwards:m}},Ce=e=>{switch(e){case`config_resolved`:case`auth_check`:case`master_connecting`:case`remote_probe`:case`installing`:case`updating`:case`server_detecting`:case`server_starting`:case`forwarding`:case`ready`:case`degraded`:case`error`:return e;default:return`idle`}},F=e=>{if(!O(e))return null;let t=k(e,`id`);return t?{id:t,phase:Ce(k(e,`phase`)),...k(e,`detail`)?{detail:k(e,`detail`)||void 0}:{},...k(e,`localUrl`)||k(e,`local_url`)?{localUrl:k(e,`localUrl`)||k(e,`local_url`)||void 0}:{},...typeof(A(e,`localPort`)??A(e,`local_port`))==`number`?{localPort:A(e,`localPort`)??A(e,`local_port`)??void 0}:{},...typeof(A(e,`remotePort`)??A(e,`remote_port`))==`number`?{remotePort:A(e,`remotePort`)??A(e,`remote_port`)??void 0}:{},startedByUs:j(e,`startedByUs`)??j(e,`started_by_us`)??!1,retryAttempt:A(e,`retryAttempt`)??A(e,`retry_attempt`)??0,requiresUserAction:j(e,`requiresUserAction`)??j(e,`requires_user_action`)??!1,...k(e,`errorCode`)||k(e,`error_code`)?{errorCode:k(e,`errorCode`)||k(e,`error_code`)||void 0}:{},updatedAtMs:A(e,`updatedAtMs`)??A(e,`updated_at_ms`)??Date.now()}:null},we=e=>{if(!O(e))return null;let t=k(e,`host`),n=k(e,`source`),r=k(e,`sshCommand`)||k(e,`ssh_command`);return!t||!n||!r?null:{host:t,source:n,sshCommand:r,pattern:j(e,`pattern`)??!1}},Te=(e,t)=>({id:e,sshCommand:t,connectionTimeoutSec:60,remoteYuri:{mode:`managed`,keepRunning:!0,relayHost:!0,installMethod:`bun`,uploadBundleOverSsh:!1},localForward:{bindHost:`127.0.0.1`},auth:{},portForwards:[]}),Ee=async()=>{let e=N();if(!e)return{instances:[]};let t=await e(`desktop_ssh_instances_get`);return O(t)?{instances:(Array.isArray(t.instances)?t.instances:Array.isArray(t.desktopSshInstances)?t.desktopSshInstances:[]).map(e=>Se(e)).filter(e=>!!e)}:{instances:[]}},De=async e=>{let t=N();t&&await t(`desktop_ssh_instances_set`,{config:{instances:e.instances}})},Oe=async()=>{let e=N();if(!e)return[];let t=await e(`desktop_ssh_import_hosts`);return Array.isArray(t)?t.map(e=>we(e)).filter(e=>!!e):[]},ke=async e=>{let t=N();t&&await t(`desktop_ssh_connect`,{id:e})},Ae=async e=>{let t=N();t&&await t(`desktop_ssh_disconnect`,{id:e})},je=async e=>{let t=N();if(!t)return[];let n=await t(`desktop_ssh_status`,{...e?{id:e}:{}});return Array.isArray(n)?n.map(e=>F(e)).filter(e=>!!e):[]},Me=async(e,t)=>{let n=N();if(!n)return[];let r=await n(`desktop_ssh_logs`,{id:e,...typeof t==`number`?{limit:t}:{}});return Array.isArray(r)?r.filter(e=>typeof e==`string`):[]},Ne=async e=>{let t=N();t&&await t(`desktop_ssh_logs_clear`,{id:e})},Pe=(e,t)=>{let n=Math.max(0,Math.trunc(Number(e.fileGroups)||0)),r=Math.max(0,Math.trunc(Number(e.singleFiles)||0)),i=Math.max(0,Math.trunc(Number(e.directories)||0));return{fileGroups:Array.from({length:n},()=>!0),singleFiles:Array.from({length:r},()=>!0),directories:Array.from({length:i},()=>!0),agentsRoot:!0,providerCredentials:t?.includeProviderCredentials===!0,magpie:!1}},Fe=e=>{if(!O(e))return null;let t=k(e,`path`),n=A(e,`bytes`);return!t||n===null?null:{path:t,bytes:n}},Ie=e=>{if(!O(e))return null;let t=k(e,`path`),n=A(e,`fileCount`)??A(e,`file_count`),r=A(e,`bytes`);return!t||n===null||r===null?null:{path:t,fileCount:n,bytes:r}},Le=e=>{if(e==null||!O(e))return null;let t=A(e,`fileCount`)??A(e,`file_count`),n=A(e,`bytes`);return t===null||n===null?null:{fileCount:t,bytes:n}},I=e=>{if(e==null||!O(e))return null;let t=A(e,`bytes`);return t===null?null:{bytes:t}},L=e=>{if(!O(e))return null;let t=Array.isArray(e.files)?e.files:null,n=Array.isArray(e.directories)?e.directories:null,r=M(e.deletes),i=A(e,`totalBytes`)??A(e,`total_bytes`);if(!t||!n||i===null||!(`agentsRoot`in e)&&!(`agents_root`in e))return null;let a=t.map(e=>Fe(e)).filter(e=>!!e),o=n.map(e=>Ie(e)).filter(e=>!!e);if(a.length!==t.length||o.length!==n.length)return null;let s=e.agentsRoot??e.agents_root,c=s==null?null:Le(s);if(s!=null&&c===null||!(`providerCredentials`in e))return null;let l=I(e.providerCredentials);if(e.providerCredentials!==null&&l===null)return null;let u=e.direction===`pull`||e.direction===`push`?e.direction:void 0,d=e.selections,f=O(d)?{fileGroups:Array.isArray(d.fileGroups)?d.fileGroups.map(e=>e!==!1):[],singleFiles:Array.isArray(d.singleFiles)?d.singleFiles.map(e=>e!==!1):[],directories:Array.isArray(d.directories)?d.directories.map(e=>e!==!1):[],agentsRoot:d.agentsRoot!==!1,providerCredentials:d.providerCredentials===!0,magpie:d.magpie===!0}:void 0,p=R(e.selectionShape??e.selection_shape);return{files:a,directories:o,agentsRoot:c,providerCredentials:l,magpieAvailable:e.magpieAvailable===!0,magpie:I(e.magpie),deletes:r,totalBytes:i,...u?{direction:u}:{},...f?{selections:f}:{},...p?{selectionShape:p}:{}}},R=e=>{if(!O(e))return null;let t=A(e,`fileGroups`)??A(e,`file_groups`),n=A(e,`singleFiles`)??A(e,`single_files`),r=A(e,`directories`);return t===null||n===null||r===null||t<0||n<0||r<0?null:{fileGroups:t,singleFiles:n,directories:r}},Re=e=>{if(!O(e))return null;let t=L(e.plan);if(!t)return null;let n=R(e.selectionShape??e.selection_shape)??t.selectionShape??null;return{plan:t,remoteExisting:M(e.remoteExisting??e.remote_existing),remoteAgentsRootExists:j(e,`remoteAgentsRootExists`)??j(e,`remote_agents_root_exists`)??!1,remoteProviderCredentialsExists:j(e,`remoteProviderCredentialsExists`)??!1,...n?{selectionShape:n}:{}}},ze=e=>{if(!O(e)||j(e,`ok`)!==!0)return null;let t=A(e,`files`),n=A(e,`directories`),r=A(e,`deletes`),i=A(e,`totalBytes`)??A(e,`total_bytes`);if(t===null||n===null||r===null||i===null||!(`agentsRoot`in e)&&!(`agents_root`in e))return null;let a=e.agentsRoot??e.agents_root,o=null;if(a!=null){if(!O(a))return null;let e=A(a,`fileCount`)??A(a,`file_count`);if(e===null)return null;o={fileCount:e}}if(!(`providerCredentials`in e))return null;let s=I(e.providerCredentials);if(e.providerCredentials!==null&&s===null)return null;let c=M(e.magpieWarnings).filter(e=>e===`sign_in_required`||e===`plugin_install_failed`||e===`agent_settings_skipped`);return{ok:!0,files:t,directories:n,deletes:r,totalBytes:i,agentsRoot:o,providerCredentials:s,...c.length?{magpieWarnings:c}:{}}},Be=async(e={})=>{let t=N();if(!t)return console.error(`[desktopSsh] config sync local scan skipped: desktop IPC bridge is unavailable in this window`),null;let n=await t(`desktop_ssh_sync_opencode_config`,{stage:`local`,...e.direction?{direction:e.direction}:{},...e.selections?{selections:e.selections}:{}});if(!O(n))return console.error(`[desktopSsh] config sync local scan returned a non-object payload`,n),null;let r=L(n.plan);if(!r)return console.error(`[desktopSsh] config sync local scan plan payload was not recognized`,n),null;let i=R(n.selectionShape??n.selection_shape)??r.selectionShape??null;return i?{...r,selectionShape:i}:r},Ve=async(e,t={})=>{let n=N();if(!n)return console.error(`[desktopSsh] config sync preview skipped: desktop IPC bridge is unavailable in this window`),null;let r=await n(`desktop_ssh_sync_opencode_config`,{id:e,...t.targetKind?{targetKind:t.targetKind}:{},...t.direction?{direction:t.direction}:{},...t.selections?{selections:t.selections}:{}}),i=Re(r);return i||console.error(`[desktopSsh] config sync preview payload was not recognized`,r),i},He=async(e,t={})=>{let n=N();if(!n)return console.error(`[desktopSsh] config sync apply skipped: desktop IPC bridge is unavailable in this window`),null;let r=await n(`desktop_ssh_sync_opencode_config`,{id:e,apply:!0,...t.targetKind?{targetKind:t.targetKind}:{},...t.direction?{direction:t.direction}:{},...t.selections?{selections:t.selections}:{}}),i=ze(r);return i||console.error(`[desktopSsh] config sync apply payload was not recognized`,r),i},Ue=async e=>{if(!r())return async()=>{};let t=window.__YURI_DESKTOP__?.listen;if(typeof t!=`function`)return async()=>{};let n=await t(`yuri:ssh-instance-status`,t=>{let n=F(t?.payload);n&&e(n)});return async()=>{await n()}},We=new Set([`shellStartup`,`configSync`,`nodeRuntimeMissing`,`packageManagerMissing`,`nativeBinding`,`yuriCliMissing`,`yuriRegistry`,`yuriInstall`,`yuriCliIncompatible`,`opencodeInstall`,`serverStart`,`sshAuth`,`sshUnreachable`,`timeout`,`unknown`]),Ge=e=>typeof e==`string`&&We.has(e),Ke=e=>{let t=String(e||``);return/shell startup|fresh .* shell|SSH command did not start/i.test(t)?`shellStartup`:/Initial SSH config sync failed/i.test(t)?`configSync`:/requires Node\.js \d+|no supported Node runtime/i.test(t)?`nodeRuntimeMissing`:/neither bun nor npm/i.test(t)?`packageManagerMissing`:/better-sqlite3|node_gyp_bins|gyp ERR|failed to prepare better-sqlite3/i.test(t)?`nativeBinding`:/Yuri installation completed but the executable is unavailable/i.test(t)?`yuriCliMissing`:/could not reach the npm registry|ENOTFOUND|ECONNREFUSED|ETIMEDOUT|EAI_AGAIN|CERT_HAS_EXPIRED|UNABLE_TO_GET_ISSUER_CERT|self-signed certificate|registry\.npmjs|npm error code E404|npm ERR! code E404|getaddrinfo/i.test(t)?`yuriRegistry`:/Failed to install Yuri/i.test(t)?`yuriInstall`:/Unknown option:\s*--relay-host|does not advertise --relay-host|does not support --relay-host/i.test(t)||/Unknown option:/i.test(t)?`yuriCliIncompatible`:/Failed to install OpenCode|OpenCode CLI/i.test(t)?`opencodeInstall`:/failed to become reachable|Managed Yuri server failed/i.test(t)?`serverStart`:/Permission denied|Authentication failed|publickey|keyboard-interactive/i.test(t)?`sshAuth`:/Could not resolve hostname|Connection refused|Connection timed out|ControlMaster connection timed out|SSH master process exited|Network is unreachable/i.test(t)?`sshUnreachable`:/Timed out waiting for SSH|Timed out waiting for forwarded/i.test(t)?`timeout`:`unknown`},z=(e,t)=>Ge(e)?e:Ke(t),B=e=>{switch(e){case`shellStartup`:return`desktopHostSwitcher.sshError.shellStartup.title`;case`configSync`:return`desktopHostSwitcher.sshError.configSync.title`;case`nodeRuntimeMissing`:return`desktopHostSwitcher.sshError.nodeRuntimeMissing.title`;case`packageManagerMissing`:return`desktopHostSwitcher.sshError.packageManagerMissing.title`;case`nativeBinding`:return`desktopHostSwitcher.sshError.nativeBinding.title`;case`yuriCliMissing`:return`desktopHostSwitcher.sshError.yuriCliMissing.title`;case`yuriRegistry`:return`desktopHostSwitcher.sshError.yuriRegistry.title`;case`yuriInstall`:return`desktopHostSwitcher.sshError.yuriInstall.title`;case`yuriCliIncompatible`:return`desktopHostSwitcher.sshError.yuriCliIncompatible.title`;case`opencodeInstall`:return`desktopHostSwitcher.sshError.opencodeInstall.title`;case`serverStart`:return`desktopHostSwitcher.sshError.serverStart.title`;case`sshAuth`:return`desktopHostSwitcher.sshError.sshAuth.title`;case`sshUnreachable`:return`desktopHostSwitcher.sshError.sshUnreachable.title`;case`timeout`:return`desktopHostSwitcher.sshError.timeout.title`;default:return`desktopHostSwitcher.sshError.unknown.title`}},V=e=>{switch(e){case`shellStartup`:return`desktopHostSwitcher.sshError.shellStartup.guidance`;case`configSync`:return`desktopHostSwitcher.sshError.configSync.guidance`;case`nodeRuntimeMissing`:return`desktopHostSwitcher.sshError.nodeRuntimeMissing.guidance`;case`packageManagerMissing`:return`desktopHostSwitcher.sshError.packageManagerMissing.guidance`;case`nativeBinding`:return`desktopHostSwitcher.sshError.nativeBinding.guidance`;case`yuriCliMissing`:return`desktopHostSwitcher.sshError.yuriCliMissing.guidance`;case`yuriRegistry`:return`desktopHostSwitcher.sshError.yuriRegistry.guidance`;case`yuriInstall`:return`desktopHostSwitcher.sshError.yuriInstall.guidance`;case`yuriCliIncompatible`:return`desktopHostSwitcher.sshError.yuriCliIncompatible.guidance`;case`opencodeInstall`:return`desktopHostSwitcher.sshError.opencodeInstall.guidance`;case`serverStart`:return`desktopHostSwitcher.sshError.serverStart.guidance`;case`sshAuth`:return`desktopHostSwitcher.sshError.sshAuth.guidance`;case`sshUnreachable`:return`desktopHostSwitcher.sshError.sshUnreachable.guidance`;case`timeout`:return`desktopHostSwitcher.sshError.timeout.guidance`;default:return`desktopHostSwitcher.sshError.unknown.guidance`}},H=e=>e===`unknown`||e===`yuriCliIncompatible`,qe=(e,t,n)=>{let r=typeof n==`string`?n.trim():``;return!H(t)||!r||r===e?e:`${e}\n${r}`},U=m();function Je(e){let t=(0,C.c)(27),{errorCode:n,detail:r,className:i}=e,{t:a}=le(),o,s,c,l,u,d;if(t[0]!==i||t[1]!==r||t[2]!==n||t[3]!==a){let e=z(n,r);o=a(V(e));let f;t[10]===r?f=t[11]:(f=typeof r==`string`?r.trim():``,t[10]=r,t[11]=f),s=f,c=H(e)&&!!s&&s!==o,t[12]===i?d=t[13]:(d=oe(`space-y-1`,i),t[12]=i,t[13]=d),l=`typography-ui-label text-[var(--status-error)]`,u=a(B(e)),t[0]=i,t[1]=r,t[2]=n,t[3]=a,t[4]=o,t[5]=s,t[6]=c,t[7]=l,t[8]=u,t[9]=d}else o=t[4],s=t[5],c=t[6],l=t[7],u=t[8],d=t[9];let f;t[14]!==l||t[15]!==u?(f=(0,U.jsx)(`p`,{className:l,children:u}),t[14]=l,t[15]=u,t[16]=f):f=t[16];let p;t[17]===o?p=t[18]:(p=(0,U.jsx)(`p`,{className:`typography-meta text-muted-foreground`,children:o}),t[17]=o,t[18]=p);let m;t[19]!==s||t[20]!==c?(m=c?(0,U.jsx)(`p`,{className:`typography-meta break-words text-muted-foreground`,children:s}):null,t[19]=s,t[20]=c,t[21]=m):m=t[21];let h;return t[22]!==d||t[23]!==f||t[24]!==p||t[25]!==m?(h=(0,U.jsxs)(`div`,{className:d,children:[f,p,m]}),t[22]=d,t[23]=f,t[24]=p,t[25]=m,t[26]=h):h=t[26],h}var Ye=`/auth/passkey/authenticate/options`,Xe=`/auth/passkey/authenticate/verify`,Ze=`/auth/passkey/register/options`,Qe=`/auth/passkey/register/verify`,$e=`/api/passkeys`,et=`/auth/passkey/status`,tt=`/api/auth/reset`,nt={enabled:!1,hasPasskeys:!1,passkeyCount:0,rpID:null},W=async(e,t)=>n(e,{method:`POST`,credentials:`include`,headers:{"Content-Type":`application/json`,Accept:`application/json`},body:t===void 0?void 0:JSON.stringify(t)}),G=async(e,t)=>{try{let t=await e.json();if(t&&typeof t.error==`string`&&t.error.trim())return t.error}catch{}return t},rt=e=>e instanceof ue&&e.code===`ERROR_CEREMONY_ABORTED`,it=()=>{fe.cancelCeremony()},K=()=>typeof window>`u`?{supported:!1,reason:`Passkeys are unavailable outside the browser.`}:window.isSecureContext?{supported:!0,reason:``}:{supported:!1,reason:`Passkeys require HTTPS or localhost.`},at=async()=>{let e=K();if(!e.supported)throw Error(e.reason);let t=await W(Ze,{label:typeof navigator.userAgent==`string`&&navigator.userAgent.trim()?navigator.userAgent:`This device`});if(!t.ok)throw Error(await G(t,`Could not start passkey setup.`));let{requestId:n,optionsJSON:r}=await t.json(),i=await W(Qe,{requestId:n,response:await de({optionsJSON:r})});if(!i.ok)throw Error(await G(i,`Could not finish passkey setup.`));return i.json().catch(()=>null)},ot=async(e,t={})=>{let n=K();if(!n.supported)throw Error(n.reason);let r=await W(Ye);if(!r.ok)throw Error(await G(r,`Passkey sign-in is not available right now.`));let{requestId:i,optionsJSON:a}=await r.json(),o=await W(Xe,{requestId:i,response:await pe({optionsJSON:a}),trustDevice:e,issueClientToken:t.issueClientToken===!0,clientLabel:t.clientLabel,clientKind:t.clientKind,dedupeKey:t.dedupeKey});if(!o.ok)throw Error(await G(o,`Passkey sign-in failed.`));return o.json().catch(()=>null)},st=async()=>{let e=await n(et,{method:`GET`,credentials:`include`,headers:{Accept:`application/json`}});if(!e.ok)return nt;let t=await e.json().catch(()=>null);return{enabled:t?.enabled===!0,hasPasskeys:t?.hasPasskeys===!0,passkeyCount:typeof t?.passkeyCount==`number`?t.passkeyCount:0,rpID:typeof t?.rpID==`string`&&t.rpID?t.rpID:null}},ct=async()=>{let e=await n($e,{method:`GET`,credentials:`include`,headers:{Accept:`application/json`}});if(!e.ok)throw Error(await G(e,`Could not load passkeys.`));let t=await e.json().catch(()=>null);return Array.isArray(t?.passkeys)?t.passkeys:[]},lt=async e=>{let t=await n(`${$e}/${encodeURIComponent(e)}`,{method:`DELETE`,credentials:`include`,headers:{Accept:`application/json`}});if(!t.ok)throw Error(await G(t,`Could not remove passkey.`));return t.json().catch(()=>null)},ut=async()=>{let e=await W(tt);if(!e.ok)throw Error(await G(e,`Could not clear saved authentication.`));try{let{clearAssistantAttachmentCacheAll:e}=await ae(async()=>{let{clearAssistantAttachmentCacheAll:e}=await import(`./assistant-attachment-cache-bRIIESGe.js`).then(e=>e.t);return{clearAssistantAttachmentCacheAll:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21])),{invalidateRuntimeAuthSession:t}=await ae(async()=>{let{invalidateRuntimeAuthSession:e}=await import(`./runtime-auth-DA-qfGHk.js`).then(e=>e.m);return{invalidateRuntimeAuthSession:e}},__vite__mapDeps([2,1]));await e(`auth-reset`),t()}catch{}return e.json().catch(()=>null)};h();var q=(e,t)=>S(x.getState().dictionary,e,t),dt=e=>{let t=new Date(e),n=new Date,r=(e,t)=>e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate(),i=new Date(n);return i.setDate(n.getDate()-1),r(t,n)?q(`common.date.today`):r(t,i)?q(`common.date.yesterday`):t.toLocaleDateString(ce(),{month:`short`,day:`numeric`,year:`numeric`}).replace(`,`,``)},ft=e=>{let t=new Date;if(((e,t)=>e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate())(new Date(e),t)){let t=Date.now()-e;return t<6e4?q(`common.relative.justNow`):t<36e5?q(`common.relative.minutesAgoShort`,{count:Math.floor(t/6e4)}):q(`common.relative.hoursAgoShort`,{count:Math.floor(t/36e5)})}return dt(e)},pt=e=>{let t=Math.max(0,Date.now()-e),n=6e4,r=60*n,i=24*r,a=7*i,o=365*i;return t<r?q(`common.relative.minutesAgoCompact`,{count:Math.max(1,Math.floor(t/n))}):t<i?q(`common.relative.hoursAgoCompact`,{count:Math.floor(t/r)}):t<a?q(`common.relative.daysAgoCompact`,{count:Math.floor(t/i)}):t<5*a?q(`common.relative.weeksAgoCompact`,{count:Math.floor(t/a)}):t<o?q(`common.relative.monthsAgoCompact`,{count:Math.floor(t/2592e6)}):q(`common.relative.yearsAgoCompact`,{count:Math.floor(t/o)})},mt=(e,t)=>ht(a(e),a(t)),ht=(e,t)=>!e||!t?!1:e===t?!0:t===`/`?e.startsWith(`/`):e.startsWith(`${t}/`),J=e=>e.toLowerCase().replace(/^opencode[/-]?/i,``).replace(/[-_]/g,``).trim(),gt=(e,t)=>e?J(e)!==J(t):!1,_t=e=>{if(typeof e==`number`&&Number.isFinite(e))return e;if(typeof e==`string`&&e.trim().length>0){let t=Number(e);if(Number.isFinite(t))return t}},vt=e=>_t(e.time?.created)??0,yt=(e,t,n)=>{let r=n.has(e.id),i=n.has(t.id);return r===i?r&&i?vt(t)-vt(e):se(t)-se(e):r?-1:1},bt=e=>{let t=new Map;return e.forEach(e=>{t.set(e.id,e)}),Array.from(t.values())},xt=e=>`__archived__:${e}`,St=(e,t)=>{let n=a(e.directory??null),r=a(e.project?.worktree??null),i=n??r;if(!i)return`unassigned`;if(t&&i===t)return`project root`;let o=(t&&i.startsWith(`${t}/`)?i.slice(t.length+1):i).split(`/`).filter(Boolean);return o[o.length-1]??`unassigned`},Ct=`box-border w-full px-2 py-1.5 text-left typography-micro text-muted-foreground/70 select-none`,wt=`bg-[color-mix(in_srgb,var(--surface-foreground)_6%,transparent)] dark:bg-[color-mix(in_srgb,var(--surface-foreground)_11%,transparent)]`,Tt=`hover:bg-[color-mix(in_srgb,var(--surface-foreground)_3.5%,transparent)] dark:hover:bg-[color-mix(in_srgb,var(--surface-foreground)_8%,transparent)]`,Et=e=>{let t=Math.max(0,e);return t===0?8:30+(t-1)*14},Dt=(e,t)=>{if(!t)return e;let n=e.toLowerCase(),r=t.toLowerCase(),i=r.length;if(i===0)return e;let a=[],o=0,s=n.indexOf(r,o);for(;s!==-1;){s>o&&a.push(e.slice(o,s));let t=e.slice(s,s+i);a.push((0,U.jsx)(`mark`,{className:`bg-transparent font-[inherit] text-[var(--primary-base)]`,children:t},`${s}-${t}`)),o=s+i,s=n.indexOf(r,o)}return o<e.length&&a.push(e.slice(o)),a.length>0?a:e},Ot=`/api/browser-providers`,kt=`/api/browser-providers/selection`,At=/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/,jt=200,Mt=e=>`/api/browser-providers/${encodeURIComponent(e)}/surface/ws`,Y=e=>!!e&&typeof e==`object`&&!Array.isArray(e),X=e=>typeof e==`string`&&At.test(e)?e:null,Nt=e=>{if(!Y(e))return null;let t=X(e.id),n=typeof e.name==`string`?e.name.trim():``;return!t||!n||n.length>jt?null:{id:t,name:n,surface:e.surface===!0}},Pt=e=>{if(!Y(e)||!Array.isArray(e.providers))return null;let t=[],n=new Set;for(let r of e.providers){let e=Nt(r);!e||n.has(e.id)||(n.add(e.id),t.push(e))}let r=X(e.selectedId);return{providers:t,selectedId:r&&n.has(r)?r:null}},Ft=e=>{if(!Y(e))return null;let t=X(e.selectedId);return t?{selectedId:t}:null},It=e=>e?.selectedId?e.providers.find(t=>t.id===e.selectedId)??null:null,Lt=e=>!!(e&&e.providers.length>0),Rt=e=>It(e)!==null,Z=e=>typeof e==`number`&&Number.isFinite(e),zt=e=>{if(!Y(e)||typeof e.type!=`string`)return null;if(e.type===`hello`&&typeof e.viewerId==`string`&&e.viewerId.length>0)return{type:`hello`,viewerId:e.viewerId};if(e.type===`frame`){let t=e.mime===`image/jpeg`||e.mime===`image/png`?e.mime:null;if(!t||!Z(e.seq)||!Z(e.width)||!Z(e.height)||!Z(e.bytes)||e.bytes<1||typeof e.agentActive!=`boolean`)return null;let n=typeof e.title==`string`?e.title:void 0;return{type:`frame`,seq:e.seq,width:e.width,height:e.height,mime:t,bytes:e.bytes,title:n,agentActive:e.agentActive}}if(e.type===`control`){let t=e.controller===`none`||e.controller===`agent`||e.controller===`user`?e.controller:null;return!t||typeof e.mine!=`boolean`?null:{type:`control`,controller:t,mine:e.mine}}return e.type===`resized`&&Z(e.width)&&Z(e.height)?{type:`resized`,width:e.width,height:e.height}:e.type===`error`&&typeof e.code==`string`&&typeof e.message==`string`?{type:`error`,code:e.code,message:e.message}:e.type===`ended`&&(e.reason===`service-stopped`||e.reason===`extension-unavailable`||e.reason===`host-shutdown`)?{type:`ended`,reason:e.reason}:null},Q=class extends Error{status;constructor(e){super(`browser_provider_request_failed:${e}`),this.name=`BrowserProviderRequestError`,this.status=e}},$=(t=e())=>ie.browserProviders.catalog(t),Bt=async e=>{let t=await e.text();if(!t)return null;try{return JSON.parse(t)}catch{return null}},Vt=async e=>{let t=await n(Ot,{method:`GET`,headers:{Accept:`application/json`},signal:e}),r=await Bt(t);if(!t.ok)throw new Q(t.status);let i=Pt(r);if(!i)throw new Q(t.status||502);return i},Ht=(t=e())=>({queryKey:$(t),queryFn:({signal:e})=>Vt(e),staleTime:5e3,refetchOnWindowFocus:!0,refetchInterval:e=>{let t=e.state.error;return t instanceof Q&&(t.status===404||t.status===501)?!1:15e3}}),Ut=e=>{let t=(0,C.c)(3),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=Ht(),t[0]=n):n=t[0];let r=e?.enabled??!0,i;return t[1]===r?i=t[2]:(i={...n,enabled:r},t[1]=r,t[2]=i),ne(i)},Wt=(t=y,n=e())=>t.getQueryData($(n))??null,Gt=(e,t)=>e?.providers.some(e=>e.id===t)?{providers:e.providers,selectedId:t}:null,Kt=async(t,r=y,i)=>{let a=e(),o=await n(kt,{method:`PUT`,headers:{Accept:`application/json`,"Content-Type":`application/json`},body:JSON.stringify({id:t}),signal:i}),s=await Bt(o);if(!o.ok)throw new Q(o.status);let c=Ft(s);if(!c||c.selectedId!==t||e()!==a)throw new Q(o.status||502);let l=Gt(r.getQueryData($(a)),c.selectedId);if(!l)throw new Q(409);return l},qt=()=>{let t=(0,C.c)(2),n=re(),r;return t[0]===n?r=t[1]:(r={mutationFn:e=>Kt(e,n),onMutate:async t=>{let r=e(),i=$(r);await n.cancelQueries({queryKey:i});let a=n.getQueryData(i),o=Gt(a,t);return o&&n.setQueryData(i,o),{previous:a,key:i,transport:r}},onError:(t,r,i)=>{!i||e()!==i.transport||n.setQueryData(i.key,i.previous)},onSuccess:(t,r,i)=>{!i||e()!==i.transport||n.setQueryData(i.key,t)}},t[0]=n,t[1]=r),ee(r)},Jt=[`standalone`,`minimal-ui`,`fullscreen`,`window-controls-overlay`],Yt=`yuri.pwaRecentSessions`,Xt=e=>typeof window>`u`||typeof window.matchMedia!=`function`?!1:window.matchMedia(`(display-mode: ${e})`).matches,Zt=()=>typeof window>`u`?`browser`:typeof document<`u`&&document.referrer.startsWith(`android-app://`)?`twa`:window.navigator.standalone?`standalone`:Jt.find(e=>Xt(e))??`browser`;export{ge as $,rt as A,Te as B,St as C,st as D,nt as E,qe as F,De as G,Ae as H,z as I,je as J,Me as K,V as L,ut as M,lt as N,ct as O,Je as P,Ue as Q,B as R,Dt as S,it as T,Oe as U,ke as V,Ee as W,Be as X,He as Y,Ve as Z,xt as _,qt as a,mt as b,Rt as c,wt as d,_e as et,Tt as f,ft as g,pt as h,Ut as i,at as j,K as k,Lt as l,bt as m,Zt as n,Mt as o,yt as p,Ne as q,Wt as r,zt as s,Yt as t,ve as tt,Ct as u,Et as v,ot as w,J as x,gt as y,Pe as z};
2
+ import"./rolldown-runtime-hePW80VL.js";import{i as e,l as t}from"./runtime-switch-DEPKHgdL.js";import{n}from"./runtime-fetch-V-iMWR8t.js";import{A as r,I as i,f as a,j as o,p as s}from"./platform-CiUKDeXd.js";import{f as c,s as l,v as u}from"./desktopHosts-BsTrBVja.js";import{i as d,n as f,r as p}from"./desktopRelayRestore-BxbRKak_.js";import{ot as m,st as h}from"./vendor-base-ui-wXsskyKm.js";import{n as g}from"./vendor-react-BkccXcWz.js";import{r as _}from"./vendor-tanstack-query-core-BSjXNgF_.js";import{i as v,n as ee,r as te,s as ne,u as re}from"./vendor-tanstack-react-query-DIb_ItL-.js";import{c as y,l as ie}from"./yuriEvents-BFrD5fMU.js";import{o as ae}from"./vendor-aparajita-capacitor-secure-storage-xol_6BsB.js";import{o as oe}from"./session-startup-barrier-DT-hIBRf.js";import{Bi as se,t as b}from"./ui-ee2iN869.js";import{n as ce,t as le}from"./i18n-DXc6czdR.js";import{i as x,t as S}from"./store-C1ifDY0C.js";import{i as ue,n as de,r as fe,t as pe}from"./vendor-simplewebauthn-browser-Dwhcdg_5.js";var C=g(),w=[`desktopHostSwitch`],T=class extends Error{result;host;constructor(e,t){super(e.reason),this.name=`DesktopHostSwitchError`,this.result=e,this.host=t}},E=(e,t)=>S(x.getState().dictionary,e,t),me=async e=>{let{host:n}=e;if(n.id===`local`){if(i()&&!s())return await o(`desktop_switch_to_local`),{ok:!0,via:`direct`,status:{status:`ok`,latencyMs:0}};let r=(e.localApiOrigin||``).trim();if(!r)throw new T({ok:!1,status:{status:`unreachable`,latencyMs:0},reason:`unreachable`},n);return t({apiBaseUrl:r,clientToken:e.localClientToken||null,runtimeKey:p(n)}),{ok:!0,via:`direct`,status:{status:`ok`,latencyMs:0}}}let r=await d(n,{cachedProbe:e.cachedProbe});if(!r.ok)throw new T(r,n);return r},D=null,he=()=>D||(D=new _(y,{mutationKey:w,mutationFn:me,onError:(e,t)=>{if(!(e instanceof T)){b.error(E(`desktopHostSwitcher.toast.instanceUnreachable`,{host:u(t.host.label)}),{description:e instanceof Error?e.message:String(e)});return}if(e.result.reason!==`unsupported`){if(e.result.status.status===`auth`){if(c(e.host)){b.error(E(`mobile.connect.pairing.expired`),{description:E(`desktopHostSwitcher.pairing.reconnectHint`),action:{label:E(`settings.remoteInstances.openLocalManager`),onClick:()=>{l().catch(()=>b.error(E(`sessionAuth.error.networkTitle`)))}}});return}b.error(E(`desktopHostSwitcher.status.authRequired`));return}b.error(E(`desktopHostSwitcher.toast.instanceUnreachable`,{host:u(t.host.label)}))}}}),D.subscribe(()=>void 0),D),ge=async e=>{if(f(e.host))return{ok:!0,via:`direct`,status:e.cachedProbe?.status===`ok`?e.cachedProbe:{status:`ok`,latencyMs:0}};if(y.isMutating({mutationKey:w})>0)return{ok:!1,status:{status:`unreachable`,latencyMs:0},reason:`unsupported`};try{return await he().mutate(e)}catch(e){return e instanceof T?e.result:{ok:!1,status:{status:`unreachable`,latencyMs:0},reason:`unreachable`}}},_e=e=>{let t=(0,C.c)(2),n=e!==void 0&&e,r;return t[0]===n?r=t[1]:(r={mutationKey:w,predicate:e=>!n||!e.state.variables?.inlineProgress},t[0]=n,t[1]=r),te(r)>0},ve=()=>{let e=(0,C.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={filters:{mutationKey:w,status:`pending`},select:ye},e[0]=t):t=e[0],v(t)[0]?.host.id??null};function ye(e){return e.state.variables}var O=e=>typeof e==`object`&&!!e,k=(e,t)=>{let n=e[t];return typeof n==`string`?n:null},A=(e,t)=>{let n=e[t];return typeof n==`number`&&Number.isFinite(n)?n:null},j=(e,t)=>{let n=e[t];return typeof n==`boolean`?n:null},M=e=>Array.isArray(e)?e.filter(e=>typeof e==`string`):[],N=()=>r()?(e,t)=>o(e,t):null,P=e=>{if(!O(e))return;let t=j(e,`enabled`)??!1,n=k(e,`store`)?.toLowerCase()===`settings`?`settings`:`never`,r=k(e,`value`);return{enabled:t,store:n,...r?{value:r}:{}}},be=e=>e===`remote`||e===`dynamic`?e:`local`,xe=e=>{if(!O(e))return null;let t=k(e,`id`);if(!t)return null;let n=j(e,`enabled`)??!0,r=be(k(e,`type`)),i=k(e,`localHost`)||k(e,`local_host`)||void 0,a=A(e,`localPort`)??A(e,`local_port`)??void 0,o=k(e,`remoteHost`)||k(e,`remote_host`)||void 0,s=A(e,`remotePort`)??A(e,`remote_port`)??void 0;return{id:t,enabled:n,type:r,...i?{localHost:i}:{},...typeof a==`number`?{localPort:a}:{},...o?{remoteHost:o}:{},...typeof s==`number`?{remotePort:s}:{}}},Se=e=>{if(!O(e))return null;let t=k(e,`id`),n=k(e,`sshCommand`)||k(e,`ssh_command`);if(!t||!n)return null;let r=k(e,`nickname`),i=e.sshParsed,a=O(i)?{destination:k(i,`destination`)||``,args:M(i.args)}:void 0,o=O(e.remoteYuri)?e.remoteYuri:O(e.remote_yuri)?e.remote_yuri:{},s=O(e.localForward)?e.localForward:O(e.local_forward)?e.local_forward:{},c=O(e.auth)?e.auth:{},l=k(o,`mode`)?.toLowerCase()===`external`?`external`:`managed`,u=k(o,`installMethod`)||k(o,`install_method`),d=u===`npm`||u===`download_release`||u===`upload_bundle`?u:`bun`,f=k(s,`bindHost`)||k(s,`bind_host`)||`127.0.0.1`,p=f===`localhost`||f===`0.0.0.0`?f:`127.0.0.1`,m=(Array.isArray(e.portForwards)?e.portForwards:Array.isArray(e.port_forwards)?e.port_forwards:[]).map(e=>xe(e)).filter(e=>!!e),h=A(o,`preferredPort`)??A(o,`preferred_port`),g=A(s,`preferredLocalPort`)??A(s,`preferred_local_port`),_=P(c.sshPassword||c.ssh_password),v=P(c.yuriPassword||c.yuri_password);return{id:t,...r?{nickname:r}:{},sshCommand:n,...a&&a.destination?{sshParsed:a}:{},connectionTimeoutSec:A(e,`connectionTimeoutSec`)??A(e,`connection_timeout_sec`)??60,remoteYuri:{mode:l,keepRunning:j(o,`keepRunning`)??j(o,`keep_running`)??!0,relayHost:j(o,`relayHost`)??j(o,`relay_host`)??!0,...h?{preferredPort:h}:{},installMethod:d,uploadBundleOverSsh:j(o,`uploadBundleOverSsh`)??j(o,`upload_bundle_over_ssh`)??!1},localForward:{...g?{preferredLocalPort:g}:{},bindHost:p},auth:{..._?{sshPassword:_}:{},...v?{yuriPassword:v}:{}},portForwards:m}},Ce=e=>{switch(e){case`config_resolved`:case`auth_check`:case`master_connecting`:case`remote_probe`:case`installing`:case`updating`:case`server_detecting`:case`server_starting`:case`forwarding`:case`ready`:case`degraded`:case`error`:return e;default:return`idle`}},F=e=>{if(!O(e))return null;let t=k(e,`id`);return t?{id:t,phase:Ce(k(e,`phase`)),...k(e,`detail`)?{detail:k(e,`detail`)||void 0}:{},...k(e,`localUrl`)||k(e,`local_url`)?{localUrl:k(e,`localUrl`)||k(e,`local_url`)||void 0}:{},...typeof(A(e,`localPort`)??A(e,`local_port`))==`number`?{localPort:A(e,`localPort`)??A(e,`local_port`)??void 0}:{},...typeof(A(e,`remotePort`)??A(e,`remote_port`))==`number`?{remotePort:A(e,`remotePort`)??A(e,`remote_port`)??void 0}:{},startedByUs:j(e,`startedByUs`)??j(e,`started_by_us`)??!1,retryAttempt:A(e,`retryAttempt`)??A(e,`retry_attempt`)??0,requiresUserAction:j(e,`requiresUserAction`)??j(e,`requires_user_action`)??!1,...k(e,`errorCode`)||k(e,`error_code`)?{errorCode:k(e,`errorCode`)||k(e,`error_code`)||void 0}:{},updatedAtMs:A(e,`updatedAtMs`)??A(e,`updated_at_ms`)??Date.now()}:null},we=e=>{if(!O(e))return null;let t=k(e,`host`),n=k(e,`source`),r=k(e,`sshCommand`)||k(e,`ssh_command`);return!t||!n||!r?null:{host:t,source:n,sshCommand:r,pattern:j(e,`pattern`)??!1}},Te=(e,t)=>({id:e,sshCommand:t,connectionTimeoutSec:60,remoteYuri:{mode:`managed`,keepRunning:!0,relayHost:!0,installMethod:`bun`,uploadBundleOverSsh:!1},localForward:{bindHost:`127.0.0.1`},auth:{},portForwards:[]}),Ee=async()=>{let e=N();if(!e)return{instances:[]};let t=await e(`desktop_ssh_instances_get`);return O(t)?{instances:(Array.isArray(t.instances)?t.instances:Array.isArray(t.desktopSshInstances)?t.desktopSshInstances:[]).map(e=>Se(e)).filter(e=>!!e)}:{instances:[]}},De=async e=>{let t=N();t&&await t(`desktop_ssh_instances_set`,{config:{instances:e.instances}})},Oe=async()=>{let e=N();if(!e)return[];let t=await e(`desktop_ssh_import_hosts`);return Array.isArray(t)?t.map(e=>we(e)).filter(e=>!!e):[]},ke=async e=>{let t=N();t&&await t(`desktop_ssh_connect`,{id:e})},Ae=async e=>{let t=N();t&&await t(`desktop_ssh_disconnect`,{id:e})},je=async e=>{let t=N();if(!t)return[];let n=await t(`desktop_ssh_status`,{...e?{id:e}:{}});return Array.isArray(n)?n.map(e=>F(e)).filter(e=>!!e):[]},Me=async(e,t)=>{let n=N();if(!n)return[];let r=await n(`desktop_ssh_logs`,{id:e,...typeof t==`number`?{limit:t}:{}});return Array.isArray(r)?r.filter(e=>typeof e==`string`):[]},Ne=async e=>{let t=N();t&&await t(`desktop_ssh_logs_clear`,{id:e})},Pe=(e,t)=>{let n=Math.max(0,Math.trunc(Number(e.fileGroups)||0)),r=Math.max(0,Math.trunc(Number(e.singleFiles)||0)),i=Math.max(0,Math.trunc(Number(e.directories)||0));return{fileGroups:Array.from({length:n},()=>!0),singleFiles:Array.from({length:r},()=>!0),directories:Array.from({length:i},()=>!0),agentsRoot:!0,providerCredentials:t?.includeProviderCredentials===!0,magpie:!1}},Fe=e=>{if(!O(e))return null;let t=k(e,`path`),n=A(e,`bytes`);return!t||n===null?null:{path:t,bytes:n}},Ie=e=>{if(!O(e))return null;let t=k(e,`path`),n=A(e,`fileCount`)??A(e,`file_count`),r=A(e,`bytes`);return!t||n===null||r===null?null:{path:t,fileCount:n,bytes:r}},Le=e=>{if(e==null||!O(e))return null;let t=A(e,`fileCount`)??A(e,`file_count`),n=A(e,`bytes`);return t===null||n===null?null:{fileCount:t,bytes:n}},I=e=>{if(e==null||!O(e))return null;let t=A(e,`bytes`);return t===null?null:{bytes:t}},L=e=>{if(!O(e))return null;let t=Array.isArray(e.files)?e.files:null,n=Array.isArray(e.directories)?e.directories:null,r=M(e.deletes),i=A(e,`totalBytes`)??A(e,`total_bytes`);if(!t||!n||i===null||!(`agentsRoot`in e)&&!(`agents_root`in e))return null;let a=t.map(e=>Fe(e)).filter(e=>!!e),o=n.map(e=>Ie(e)).filter(e=>!!e);if(a.length!==t.length||o.length!==n.length)return null;let s=e.agentsRoot??e.agents_root,c=s==null?null:Le(s);if(s!=null&&c===null||!(`providerCredentials`in e))return null;let l=I(e.providerCredentials);if(e.providerCredentials!==null&&l===null)return null;let u=e.direction===`pull`||e.direction===`push`?e.direction:void 0,d=e.selections,f=O(d)?{fileGroups:Array.isArray(d.fileGroups)?d.fileGroups.map(e=>e!==!1):[],singleFiles:Array.isArray(d.singleFiles)?d.singleFiles.map(e=>e!==!1):[],directories:Array.isArray(d.directories)?d.directories.map(e=>e!==!1):[],agentsRoot:d.agentsRoot!==!1,providerCredentials:d.providerCredentials===!0,magpie:d.magpie===!0}:void 0,p=R(e.selectionShape??e.selection_shape);return{files:a,directories:o,agentsRoot:c,providerCredentials:l,magpieAvailable:e.magpieAvailable===!0,magpie:I(e.magpie),deletes:r,totalBytes:i,...u?{direction:u}:{},...f?{selections:f}:{},...p?{selectionShape:p}:{}}},R=e=>{if(!O(e))return null;let t=A(e,`fileGroups`)??A(e,`file_groups`),n=A(e,`singleFiles`)??A(e,`single_files`),r=A(e,`directories`);return t===null||n===null||r===null||t<0||n<0||r<0?null:{fileGroups:t,singleFiles:n,directories:r}},Re=e=>{if(!O(e))return null;let t=L(e.plan);if(!t)return null;let n=R(e.selectionShape??e.selection_shape)??t.selectionShape??null;return{plan:t,remoteExisting:M(e.remoteExisting??e.remote_existing),remoteAgentsRootExists:j(e,`remoteAgentsRootExists`)??j(e,`remote_agents_root_exists`)??!1,remoteProviderCredentialsExists:j(e,`remoteProviderCredentialsExists`)??!1,...n?{selectionShape:n}:{}}},ze=e=>{if(!O(e)||j(e,`ok`)!==!0)return null;let t=A(e,`files`),n=A(e,`directories`),r=A(e,`deletes`),i=A(e,`totalBytes`)??A(e,`total_bytes`);if(t===null||n===null||r===null||i===null||!(`agentsRoot`in e)&&!(`agents_root`in e))return null;let a=e.agentsRoot??e.agents_root,o=null;if(a!=null){if(!O(a))return null;let e=A(a,`fileCount`)??A(a,`file_count`);if(e===null)return null;o={fileCount:e}}if(!(`providerCredentials`in e))return null;let s=I(e.providerCredentials);if(e.providerCredentials!==null&&s===null)return null;let c=M(e.magpieWarnings).filter(e=>e===`sign_in_required`||e===`plugin_install_failed`||e===`agent_settings_skipped`);return{ok:!0,files:t,directories:n,deletes:r,totalBytes:i,agentsRoot:o,providerCredentials:s,...c.length?{magpieWarnings:c}:{}}},Be=async(e={})=>{let t=N();if(!t)return console.error(`[desktopSsh] config sync local scan skipped: desktop IPC bridge is unavailable in this window`),null;let n=await t(`desktop_ssh_sync_opencode_config`,{stage:`local`,...e.direction?{direction:e.direction}:{},...e.selections?{selections:e.selections}:{}});if(!O(n))return console.error(`[desktopSsh] config sync local scan returned a non-object payload`,n),null;let r=L(n.plan);if(!r)return console.error(`[desktopSsh] config sync local scan plan payload was not recognized`,n),null;let i=R(n.selectionShape??n.selection_shape)??r.selectionShape??null;return i?{...r,selectionShape:i}:r},Ve=async(e,t={})=>{let n=N();if(!n)return console.error(`[desktopSsh] config sync preview skipped: desktop IPC bridge is unavailable in this window`),null;let r=await n(`desktop_ssh_sync_opencode_config`,{id:e,...t.targetKind?{targetKind:t.targetKind}:{},...t.direction?{direction:t.direction}:{},...t.selections?{selections:t.selections}:{}}),i=Re(r);return i||console.error(`[desktopSsh] config sync preview payload was not recognized`,r),i},He=async(e,t={})=>{let n=N();if(!n)return console.error(`[desktopSsh] config sync apply skipped: desktop IPC bridge is unavailable in this window`),null;let r=await n(`desktop_ssh_sync_opencode_config`,{id:e,apply:!0,...t.targetKind?{targetKind:t.targetKind}:{},...t.direction?{direction:t.direction}:{},...t.selections?{selections:t.selections}:{}}),i=ze(r);return i||console.error(`[desktopSsh] config sync apply payload was not recognized`,r),i},Ue=async e=>{if(!r())return async()=>{};let t=window.__YURI_DESKTOP__?.listen;if(typeof t!=`function`)return async()=>{};let n=await t(`yuri:ssh-instance-status`,t=>{let n=F(t?.payload);n&&e(n)});return async()=>{await n()}},We=new Set([`shellStartup`,`configSync`,`nodeRuntimeMissing`,`packageManagerMissing`,`nativeBinding`,`yuriCliMissing`,`yuriRegistry`,`yuriInstall`,`yuriCliIncompatible`,`opencodeInstall`,`serverStart`,`sshAuth`,`sshUnreachable`,`timeout`,`unknown`]),Ge=e=>typeof e==`string`&&We.has(e),Ke=e=>{let t=String(e||``);return/shell startup|fresh .* shell|SSH command did not start/i.test(t)?`shellStartup`:/Initial SSH config sync failed/i.test(t)?`configSync`:/requires Node\.js \d+|no supported Node runtime/i.test(t)?`nodeRuntimeMissing`:/neither bun nor npm/i.test(t)?`packageManagerMissing`:/better-sqlite3|node_gyp_bins|gyp ERR|failed to prepare better-sqlite3/i.test(t)?`nativeBinding`:/Yuri installation completed but the executable is unavailable/i.test(t)?`yuriCliMissing`:/could not reach the npm registry|ENOTFOUND|ECONNREFUSED|ETIMEDOUT|EAI_AGAIN|CERT_HAS_EXPIRED|UNABLE_TO_GET_ISSUER_CERT|self-signed certificate|registry\.npmjs|npm error code E404|npm ERR! code E404|getaddrinfo/i.test(t)?`yuriRegistry`:/Failed to install Yuri/i.test(t)?`yuriInstall`:/Unknown option:\s*--relay-host|does not advertise --relay-host|does not support --relay-host/i.test(t)||/Unknown option:/i.test(t)?`yuriCliIncompatible`:/Failed to install OpenCode|OpenCode CLI/i.test(t)?`opencodeInstall`:/failed to become reachable|Managed Yuri server failed/i.test(t)?`serverStart`:/Permission denied|Authentication failed|publickey|keyboard-interactive/i.test(t)?`sshAuth`:/Could not resolve hostname|Connection refused|Connection timed out|ControlMaster connection timed out|SSH master process exited|Network is unreachable/i.test(t)?`sshUnreachable`:/Timed out waiting for SSH|Timed out waiting for forwarded/i.test(t)?`timeout`:`unknown`},z=(e,t)=>Ge(e)?e:Ke(t),B=e=>{switch(e){case`shellStartup`:return`desktopHostSwitcher.sshError.shellStartup.title`;case`configSync`:return`desktopHostSwitcher.sshError.configSync.title`;case`nodeRuntimeMissing`:return`desktopHostSwitcher.sshError.nodeRuntimeMissing.title`;case`packageManagerMissing`:return`desktopHostSwitcher.sshError.packageManagerMissing.title`;case`nativeBinding`:return`desktopHostSwitcher.sshError.nativeBinding.title`;case`yuriCliMissing`:return`desktopHostSwitcher.sshError.yuriCliMissing.title`;case`yuriRegistry`:return`desktopHostSwitcher.sshError.yuriRegistry.title`;case`yuriInstall`:return`desktopHostSwitcher.sshError.yuriInstall.title`;case`yuriCliIncompatible`:return`desktopHostSwitcher.sshError.yuriCliIncompatible.title`;case`opencodeInstall`:return`desktopHostSwitcher.sshError.opencodeInstall.title`;case`serverStart`:return`desktopHostSwitcher.sshError.serverStart.title`;case`sshAuth`:return`desktopHostSwitcher.sshError.sshAuth.title`;case`sshUnreachable`:return`desktopHostSwitcher.sshError.sshUnreachable.title`;case`timeout`:return`desktopHostSwitcher.sshError.timeout.title`;default:return`desktopHostSwitcher.sshError.unknown.title`}},V=e=>{switch(e){case`shellStartup`:return`desktopHostSwitcher.sshError.shellStartup.guidance`;case`configSync`:return`desktopHostSwitcher.sshError.configSync.guidance`;case`nodeRuntimeMissing`:return`desktopHostSwitcher.sshError.nodeRuntimeMissing.guidance`;case`packageManagerMissing`:return`desktopHostSwitcher.sshError.packageManagerMissing.guidance`;case`nativeBinding`:return`desktopHostSwitcher.sshError.nativeBinding.guidance`;case`yuriCliMissing`:return`desktopHostSwitcher.sshError.yuriCliMissing.guidance`;case`yuriRegistry`:return`desktopHostSwitcher.sshError.yuriRegistry.guidance`;case`yuriInstall`:return`desktopHostSwitcher.sshError.yuriInstall.guidance`;case`yuriCliIncompatible`:return`desktopHostSwitcher.sshError.yuriCliIncompatible.guidance`;case`opencodeInstall`:return`desktopHostSwitcher.sshError.opencodeInstall.guidance`;case`serverStart`:return`desktopHostSwitcher.sshError.serverStart.guidance`;case`sshAuth`:return`desktopHostSwitcher.sshError.sshAuth.guidance`;case`sshUnreachable`:return`desktopHostSwitcher.sshError.sshUnreachable.guidance`;case`timeout`:return`desktopHostSwitcher.sshError.timeout.guidance`;default:return`desktopHostSwitcher.sshError.unknown.guidance`}},H=e=>e===`unknown`||e===`yuriCliIncompatible`,qe=(e,t,n)=>{let r=typeof n==`string`?n.trim():``;return!H(t)||!r||r===e?e:`${e}\n${r}`},U=m();function Je(e){let t=(0,C.c)(27),{errorCode:n,detail:r,className:i}=e,{t:a}=le(),o,s,c,l,u,d;if(t[0]!==i||t[1]!==r||t[2]!==n||t[3]!==a){let e=z(n,r);o=a(V(e));let f;t[10]===r?f=t[11]:(f=typeof r==`string`?r.trim():``,t[10]=r,t[11]=f),s=f,c=H(e)&&!!s&&s!==o,t[12]===i?d=t[13]:(d=oe(`space-y-1`,i),t[12]=i,t[13]=d),l=`typography-ui-label text-[var(--status-error)]`,u=a(B(e)),t[0]=i,t[1]=r,t[2]=n,t[3]=a,t[4]=o,t[5]=s,t[6]=c,t[7]=l,t[8]=u,t[9]=d}else o=t[4],s=t[5],c=t[6],l=t[7],u=t[8],d=t[9];let f;t[14]!==l||t[15]!==u?(f=(0,U.jsx)(`p`,{className:l,children:u}),t[14]=l,t[15]=u,t[16]=f):f=t[16];let p;t[17]===o?p=t[18]:(p=(0,U.jsx)(`p`,{className:`typography-meta text-muted-foreground`,children:o}),t[17]=o,t[18]=p);let m;t[19]!==s||t[20]!==c?(m=c?(0,U.jsx)(`p`,{className:`typography-meta break-words text-muted-foreground`,children:s}):null,t[19]=s,t[20]=c,t[21]=m):m=t[21];let h;return t[22]!==d||t[23]!==f||t[24]!==p||t[25]!==m?(h=(0,U.jsxs)(`div`,{className:d,children:[f,p,m]}),t[22]=d,t[23]=f,t[24]=p,t[25]=m,t[26]=h):h=t[26],h}var Ye=`/auth/passkey/authenticate/options`,Xe=`/auth/passkey/authenticate/verify`,Ze=`/auth/passkey/register/options`,Qe=`/auth/passkey/register/verify`,$e=`/api/passkeys`,et=`/auth/passkey/status`,tt=`/api/auth/reset`,nt={enabled:!1,hasPasskeys:!1,passkeyCount:0,rpID:null},W=async(e,t)=>n(e,{method:`POST`,credentials:`include`,headers:{"Content-Type":`application/json`,Accept:`application/json`},body:t===void 0?void 0:JSON.stringify(t)}),G=async(e,t)=>{try{let t=await e.json();if(t&&typeof t.error==`string`&&t.error.trim())return t.error}catch{}return t},rt=e=>e instanceof ue&&e.code===`ERROR_CEREMONY_ABORTED`,it=()=>{fe.cancelCeremony()},K=()=>typeof window>`u`?{supported:!1,reason:`Passkeys are unavailable outside the browser.`}:window.isSecureContext?{supported:!0,reason:``}:{supported:!1,reason:`Passkeys require HTTPS or localhost.`},at=async()=>{let e=K();if(!e.supported)throw Error(e.reason);let t=await W(Ze,{label:typeof navigator.userAgent==`string`&&navigator.userAgent.trim()?navigator.userAgent:`This device`});if(!t.ok)throw Error(await G(t,`Could not start passkey setup.`));let{requestId:n,optionsJSON:r}=await t.json(),i=await W(Qe,{requestId:n,response:await de({optionsJSON:r})});if(!i.ok)throw Error(await G(i,`Could not finish passkey setup.`));return i.json().catch(()=>null)},ot=async(e,t={})=>{let n=K();if(!n.supported)throw Error(n.reason);let r=await W(Ye);if(!r.ok)throw Error(await G(r,`Passkey sign-in is not available right now.`));let{requestId:i,optionsJSON:a}=await r.json(),o=await W(Xe,{requestId:i,response:await pe({optionsJSON:a}),trustDevice:e,issueClientToken:t.issueClientToken===!0,clientLabel:t.clientLabel,clientKind:t.clientKind,dedupeKey:t.dedupeKey});if(!o.ok)throw Error(await G(o,`Passkey sign-in failed.`));return o.json().catch(()=>null)},st=async()=>{let e=await n(et,{method:`GET`,credentials:`include`,headers:{Accept:`application/json`}});if(!e.ok)return nt;let t=await e.json().catch(()=>null);return{enabled:t?.enabled===!0,hasPasskeys:t?.hasPasskeys===!0,passkeyCount:typeof t?.passkeyCount==`number`?t.passkeyCount:0,rpID:typeof t?.rpID==`string`&&t.rpID?t.rpID:null}},ct=async()=>{let e=await n($e,{method:`GET`,credentials:`include`,headers:{Accept:`application/json`}});if(!e.ok)throw Error(await G(e,`Could not load passkeys.`));let t=await e.json().catch(()=>null);return Array.isArray(t?.passkeys)?t.passkeys:[]},lt=async e=>{let t=await n(`${$e}/${encodeURIComponent(e)}`,{method:`DELETE`,credentials:`include`,headers:{Accept:`application/json`}});if(!t.ok)throw Error(await G(t,`Could not remove passkey.`));return t.json().catch(()=>null)},ut=async()=>{let e=await W(tt);if(!e.ok)throw Error(await G(e,`Could not clear saved authentication.`));try{let{clearAssistantAttachmentCacheAll:e}=await ae(async()=>{let{clearAssistantAttachmentCacheAll:e}=await import(`./assistant-attachment-cache-bRIIESGe.js`).then(e=>e.t);return{clearAssistantAttachmentCacheAll:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21])),{invalidateRuntimeAuthSession:t}=await ae(async()=>{let{invalidateRuntimeAuthSession:e}=await import(`./runtime-auth-DA-qfGHk.js`).then(e=>e.m);return{invalidateRuntimeAuthSession:e}},__vite__mapDeps([2,1]));await e(`auth-reset`),t()}catch{}return e.json().catch(()=>null)};h();var q=(e,t)=>S(x.getState().dictionary,e,t),dt=e=>{let t=new Date(e),n=new Date,r=(e,t)=>e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate(),i=new Date(n);return i.setDate(n.getDate()-1),r(t,n)?q(`common.date.today`):r(t,i)?q(`common.date.yesterday`):t.toLocaleDateString(ce(),{month:`short`,day:`numeric`,year:`numeric`}).replace(`,`,``)},ft=e=>{let t=new Date;if(((e,t)=>e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate())(new Date(e),t)){let t=Date.now()-e;return t<6e4?q(`common.relative.justNow`):t<36e5?q(`common.relative.minutesAgoShort`,{count:Math.floor(t/6e4)}):q(`common.relative.hoursAgoShort`,{count:Math.floor(t/36e5)})}return dt(e)},pt=e=>{let t=Math.max(0,Date.now()-e),n=6e4,r=60*n,i=24*r,a=7*i,o=365*i;return t<r?q(`common.relative.minutesAgoCompact`,{count:Math.max(1,Math.floor(t/n))}):t<i?q(`common.relative.hoursAgoCompact`,{count:Math.floor(t/r)}):t<a?q(`common.relative.daysAgoCompact`,{count:Math.floor(t/i)}):t<5*a?q(`common.relative.weeksAgoCompact`,{count:Math.floor(t/a)}):t<o?q(`common.relative.monthsAgoCompact`,{count:Math.floor(t/2592e6)}):q(`common.relative.yearsAgoCompact`,{count:Math.floor(t/o)})},mt=(e,t)=>ht(a(e),a(t)),ht=(e,t)=>!e||!t?!1:e===t?!0:t===`/`?e.startsWith(`/`):e.startsWith(`${t}/`),J=e=>e.toLowerCase().replace(/^opencode[/-]?/i,``).replace(/[-_]/g,``).trim(),gt=(e,t)=>e?J(e)!==J(t):!1,_t=e=>{if(typeof e==`number`&&Number.isFinite(e))return e;if(typeof e==`string`&&e.trim().length>0){let t=Number(e);if(Number.isFinite(t))return t}},vt=e=>_t(e.time?.created)??0,yt=(e,t,n)=>{let r=n.has(e.id),i=n.has(t.id);return r===i?r&&i?vt(t)-vt(e):se(t)-se(e):r?-1:1},bt=e=>{let t=new Map;return e.forEach(e=>{t.set(e.id,e)}),Array.from(t.values())},xt=e=>`__archived__:${e}`,St=(e,t)=>{let n=a(e.directory??null),r=a(e.project?.worktree??null),i=n??r;if(!i)return`unassigned`;if(t&&i===t)return`project root`;let o=(t&&i.startsWith(`${t}/`)?i.slice(t.length+1):i).split(`/`).filter(Boolean);return o[o.length-1]??`unassigned`},Ct=`box-border w-full px-2 py-1.5 text-left typography-micro text-muted-foreground/70 select-none`,wt=`bg-[color-mix(in_srgb,var(--surface-foreground)_6%,transparent)] dark:bg-[color-mix(in_srgb,var(--surface-foreground)_11%,transparent)]`,Tt=`hover:bg-[color-mix(in_srgb,var(--surface-foreground)_3.5%,transparent)] dark:hover:bg-[color-mix(in_srgb,var(--surface-foreground)_8%,transparent)]`,Et=e=>{let t=Math.max(0,e);return t===0?8:30+(t-1)*14},Dt=(e,t)=>{if(!t)return e;let n=e.toLowerCase(),r=t.toLowerCase(),i=r.length;if(i===0)return e;let a=[],o=0,s=n.indexOf(r,o);for(;s!==-1;){s>o&&a.push(e.slice(o,s));let t=e.slice(s,s+i);a.push((0,U.jsx)(`mark`,{className:`bg-transparent font-[inherit] text-[var(--primary-base)]`,children:t},`${s}-${t}`)),o=s+i,s=n.indexOf(r,o)}return o<e.length&&a.push(e.slice(o)),a.length>0?a:e},Ot=`/api/browser-providers`,kt=`/api/browser-providers/selection`,At=/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/,jt=200,Mt=e=>`/api/browser-providers/${encodeURIComponent(e)}/surface/ws`,Y=e=>!!e&&typeof e==`object`&&!Array.isArray(e),X=e=>typeof e==`string`&&At.test(e)?e:null,Nt=e=>{if(!Y(e))return null;let t=X(e.id),n=typeof e.name==`string`?e.name.trim():``;return!t||!n||n.length>jt?null:{id:t,name:n,surface:e.surface===!0}},Pt=e=>{if(!Y(e)||!Array.isArray(e.providers))return null;let t=[],n=new Set;for(let r of e.providers){let e=Nt(r);!e||n.has(e.id)||(n.add(e.id),t.push(e))}let r=X(e.selectedId);return{providers:t,selectedId:r&&n.has(r)?r:null}},Ft=e=>{if(!Y(e))return null;let t=X(e.selectedId);return t?{selectedId:t}:null},It=e=>e?.selectedId?e.providers.find(t=>t.id===e.selectedId)??null:null,Lt=e=>!!(e&&e.providers.length>0),Rt=e=>It(e)!==null,Z=e=>typeof e==`number`&&Number.isFinite(e),zt=e=>{if(!Y(e)||typeof e.type!=`string`)return null;if(e.type===`hello`&&typeof e.viewerId==`string`&&e.viewerId.length>0)return{type:`hello`,viewerId:e.viewerId};if(e.type===`frame`){let t=e.mime===`image/jpeg`||e.mime===`image/png`?e.mime:null;if(!t||!Z(e.seq)||!Z(e.width)||!Z(e.height)||!Z(e.bytes)||e.bytes<1||typeof e.agentActive!=`boolean`)return null;let n=typeof e.title==`string`?e.title:void 0;return{type:`frame`,seq:e.seq,width:e.width,height:e.height,mime:t,bytes:e.bytes,title:n,agentActive:e.agentActive}}if(e.type===`control`){let t=e.controller===`none`||e.controller===`agent`||e.controller===`user`?e.controller:null;return!t||typeof e.mine!=`boolean`?null:{type:`control`,controller:t,mine:e.mine}}return e.type===`resized`&&Z(e.width)&&Z(e.height)?{type:`resized`,width:e.width,height:e.height}:e.type===`error`&&typeof e.code==`string`&&typeof e.message==`string`?{type:`error`,code:e.code,message:e.message}:e.type===`ended`&&(e.reason===`service-stopped`||e.reason===`extension-unavailable`||e.reason===`host-shutdown`)?{type:`ended`,reason:e.reason}:null},Q=class extends Error{status;constructor(e){super(`browser_provider_request_failed:${e}`),this.name=`BrowserProviderRequestError`,this.status=e}},$=(t=e())=>ie.browserProviders.catalog(t),Bt=async e=>{let t=await e.text();if(!t)return null;try{return JSON.parse(t)}catch{return null}},Vt=async e=>{let t=await n(Ot,{method:`GET`,headers:{Accept:`application/json`},signal:e}),r=await Bt(t);if(!t.ok)throw new Q(t.status);let i=Pt(r);if(!i)throw new Q(t.status||502);return i},Ht=(t=e())=>({queryKey:$(t),queryFn:({signal:e})=>Vt(e),staleTime:5e3,refetchOnWindowFocus:!0,refetchInterval:e=>{let t=e.state.error;return t instanceof Q&&(t.status===404||t.status===501)?!1:15e3}}),Ut=e=>{let t=(0,C.c)(3),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=Ht(),t[0]=n):n=t[0];let r=e?.enabled??!0,i;return t[1]===r?i=t[2]:(i={...n,enabled:r},t[1]=r,t[2]=i),ne(i)},Wt=(t=y,n=e())=>t.getQueryData($(n))??null,Gt=(e,t)=>e?.providers.some(e=>e.id===t)?{providers:e.providers,selectedId:t}:null,Kt=async(t,r=y,i)=>{let a=e(),o=await n(kt,{method:`PUT`,headers:{Accept:`application/json`,"Content-Type":`application/json`},body:JSON.stringify({id:t}),signal:i}),s=await Bt(o);if(!o.ok)throw new Q(o.status);let c=Ft(s);if(!c||c.selectedId!==t||e()!==a)throw new Q(o.status||502);let l=Gt(r.getQueryData($(a)),c.selectedId);if(!l)throw new Q(409);return l},qt=()=>{let t=(0,C.c)(2),n=re(),r;return t[0]===n?r=t[1]:(r={mutationFn:e=>Kt(e,n),onMutate:async t=>{let r=e(),i=$(r);await n.cancelQueries({queryKey:i});let a=n.getQueryData(i),o=Gt(a,t);return o&&n.setQueryData(i,o),{previous:a,key:i,transport:r}},onError:(t,r,i)=>{!i||e()!==i.transport||n.setQueryData(i.key,i.previous)},onSuccess:(t,r,i)=>{!i||e()!==i.transport||n.setQueryData(i.key,t)}},t[0]=n,t[1]=r),ee(r)},Jt=[`standalone`,`minimal-ui`,`fullscreen`,`window-controls-overlay`],Yt=`yuri.pwaRecentSessions`,Xt=e=>typeof window>`u`||typeof window.matchMedia!=`function`?!1:window.matchMedia(`(display-mode: ${e})`).matches,Zt=()=>typeof window>`u`?`browser`:typeof document<`u`&&document.referrer.startsWith(`android-app://`)?`twa`:window.navigator.standalone?`standalone`:Jt.find(e=>Xt(e))??`browser`;export{ge as $,rt as A,Te as B,St as C,st as D,nt as E,qe as F,De as G,Ae as H,z as I,je as J,Me as K,V as L,ut as M,lt as N,ct as O,Je as P,Ue as Q,B as R,Dt as S,it as T,Oe as U,ke as V,Ee as W,Be as X,He as Y,Ve as Z,xt as _,qt as a,mt as b,Rt as c,wt as d,_e as et,Tt as f,ft as g,pt as h,Ut as i,at as j,K as k,Lt as l,bt as m,Zt as n,Mt as o,yt as p,Ne as q,Wt as r,zt as s,Yt as t,ve as tt,Ct as u,Et as v,ot as w,J as x,gt as y,Pe as z};