@yuriai/web 0.3.6-beta.7 → 0.3.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (277) hide show
  1. package/README.md +19 -3
  2. package/bin/install-portable.sh +102 -0
  3. package/bin/install-portable.test.js +112 -0
  4. package/bin/lib/DOCUMENTATION.md +2 -0
  5. package/bin/lib/cli-startup.js +7 -2
  6. package/bin/lib/cli-startup.portable.test.js +30 -0
  7. package/bin/lib/commands-serve.js +4 -1
  8. package/bin/lib/commands-update.js +3 -0
  9. package/bin/lib/commands-update.test.js +18 -0
  10. package/dist/assets/{AgentAvatar-BAQBlzA3.js → AgentAvatar-BOvjZ-DI.js} +1 -1
  11. package/dist/assets/{AgentSelector-J9hP4-Bk.js → AgentSelector-Dl_zIOMk.js} +1 -1
  12. package/dist/assets/ArchivedSessionsDialog-Cr9Ji-RY.js +1 -0
  13. package/dist/assets/{AssistantConversationSurface-_A2W4Tnz.js → AssistantConversationSurface-CLdjNFeJ.js} +3 -3
  14. package/dist/assets/{AssistantSessionCard-DwFD8GED.js → AssistantSessionCard-BufyrOfo.js} +2 -2
  15. package/dist/assets/{AssistantUnreadBadge-CE-vFrqq.js → AssistantUnreadBadge-Dn9HAEDr.js} +1 -1
  16. package/dist/assets/{AssistantView-CwbzFAMd.js → AssistantView-Cg0wPomu.js} +1 -1
  17. package/dist/assets/{AssistantWorkingAvatar-BsEtliRi.js → AssistantWorkingAvatar-1KNjr2A2.js} +1 -1
  18. package/dist/assets/{AssistantsSettingsPage-D9VPa4dh.js → AssistantsSettingsPage-DeYfZAYH.js} +1 -1
  19. package/dist/assets/BinaryFileFallback-DfD02fS_.js +1 -0
  20. package/dist/assets/{BtwPanel-BKb8rDF4.js → BtwPanel-B_2w8P0X.js} +2 -2
  21. package/dist/assets/BusyDots-CAv4ygIO.js +4 -0
  22. package/dist/assets/{ChatContainer-ZnwOYIsK.js → ChatContainer-Dgv075jT.js} +23 -23
  23. package/dist/assets/ChatView-Cr71C0ZB.js +3 -0
  24. package/dist/assets/{DiagramView-DlPmGnFF.js → DiagramView-CTnpBsWU.js} +1 -1
  25. package/dist/assets/{DiffView-C4OcFwR2.js → DiffView-j_yWF1Mz.js} +2 -2
  26. package/dist/assets/{DiffViewToggle-DP9SqcOq.js → DiffViewToggle-CYusbmY5.js} +1 -1
  27. package/dist/assets/{ErrorBoundary-4W-EnYOU.js → ErrorBoundary-yr_JeVdx.js} +1 -1
  28. package/dist/assets/{FadeInOnReveal-nGKSFTqz.js → FadeInOnReveal-C56koblQ.js} +1 -1
  29. package/dist/assets/{GuiPluginMount-c2DXwGOK.js → GuiPluginMount-CBJiLdzR.js} +1 -1
  30. package/dist/assets/{GuiPluginPage-DqdVVRyY.js → GuiPluginPage-DJa8gFLk.js} +1 -1
  31. package/dist/assets/{GuiPluginSurface-CHSyQ4aq.js → GuiPluginSurface-Cc7q80jp.js} +1 -1
  32. package/dist/assets/{GuiPluginTitlebarItems-CBKus1Mw.js → GuiPluginTitlebarItems-rbK3leaL.js} +1 -1
  33. package/dist/assets/{GuiPluginWindow-AKqPYEmj.js → GuiPluginWindow-Cpg2HYWe.js} +1 -1
  34. package/dist/assets/{Icon-DlTEfBVi.js → Icon-C1rjS64C.js} +1 -1
  35. package/dist/assets/{ImageLoadingPlaceholder-ashKHrbc.js → ImageLoadingPlaceholder-2hMqBtYh.js} +1 -1
  36. package/dist/assets/{LoadingImage-3JaK3zim.js → LoadingImage-Bs-621ZL.js} +1 -1
  37. package/dist/assets/MarkdownRenderer-BZl_T1ng.js +2 -0
  38. package/dist/assets/{MarkdownRendererImpl-B1l_DAn4.js → MarkdownRendererImpl-DiCCNjDr.js} +3 -3
  39. package/dist/assets/{MarkstreamRendererImpl-D6ZF2eue.js → MarkstreamRendererImpl-Bzz3OZlX.js} +2 -2
  40. package/dist/assets/{MobileAssistantSettingsPage-Dm4f6DKQ.js → MobileAssistantSettingsPage-pBhJR2t6.js} +1 -1
  41. package/dist/assets/{MobileAssistantTab-CmMbLmB9.js → MobileAssistantTab-Ceo442NF.js} +1 -1
  42. package/dist/assets/{MobileBtwPage-CNj2pFrK.js → MobileBtwPage-DPPmDMA6.js} +1 -1
  43. package/dist/assets/{MobileChangesSurface-CLD7Fujk.js → MobileChangesSurface-DfDoSkTS.js} +1 -1
  44. package/dist/assets/{MobileChatScreen-a7vpuIM7.js → MobileChatScreen-DHTbrnAr.js} +1 -1
  45. package/dist/assets/{MobileDetailNavigation-BPj5iEVr.js → MobileDetailNavigation-e1u1y59T.js} +1 -1
  46. package/dist/assets/{MobileFilesSurface-Ct7W0756.js → MobileFilesSurface-CJoqR3By.js} +2 -2
  47. package/dist/assets/{MobileHtmlNetworkBoundary-BcAbBib9.js → MobileHtmlNetworkBoundary-GBhYVYvu.js} +2 -2
  48. package/dist/assets/{MobileOverlayPanel-Dn4b7Mdh.js → MobileOverlayPanel-DzKTKeZX.js} +1 -1
  49. package/dist/assets/{MobileResizableSheet-BMSiXFxQ.js → MobileResizableSheet-CkA7qhco.js} +1 -1
  50. package/dist/assets/{MobileSettingsTab-b_XK7f7k.js → MobileSettingsTab-Bv0HsXFH.js} +1 -1
  51. package/dist/assets/{MobileShareBridge-BCHk5fz-.js → MobileShareBridge-B-co2UPE.js} +1 -1
  52. package/dist/assets/{MobileSurface-CXbG9hIC.js → MobileSurface-D63k27t5.js} +1 -1
  53. package/dist/assets/{MobileTabPageHeader-CipRIWUc.js → MobileTabPageHeader-FmtbGhwq.js} +1 -1
  54. package/dist/assets/{ModelLogo-Bbgp7ClJ.js → ModelLogo-CMnp5fyy.js} +1 -1
  55. package/dist/assets/{ModelSelector-BkrO8Ru2.js → ModelSelector-BF4wYwaz.js} +1 -1
  56. package/dist/assets/{MultiRunWindow-rDqLANIK.js → MultiRunWindow-D0OU63re.js} +1 -1
  57. package/dist/assets/{OnboardingScreen-DOcb9Wbw.js → OnboardingScreen-CDHtDQ0k.js} +1 -1
  58. package/dist/assets/{OverlayScrollbar-qJOPKg_1.js → OverlayScrollbar-m1EAqRES.js} +1 -1
  59. package/dist/assets/{PierreDiffViewer-DkAFZ6Oy.js → PierreDiffViewer-CZk1tZ3K.js} +1 -1
  60. package/dist/assets/{ProviderLogo-xLMKk9bq.js → ProviderLogo-BqQTME35.js} +1 -1
  61. package/dist/assets/{RemoteAssistantSessionCard-iPGtzThJ.js → RemoteAssistantSessionCard-CrbCVhqD.js} +1 -1
  62. package/dist/assets/{RemoteDesktopPanel-Da5Cb1yO.js → RemoteDesktopPanel-BzLmzmjb.js} +1 -1
  63. package/dist/assets/ScheduledTasksDialog-DmtcDZHc.js +3 -0
  64. package/dist/assets/{ScrollableOverlay-X1R_GNYm.js → ScrollableOverlay-CEglrXfm.js} +1 -1
  65. package/dist/assets/{SettingsGroup-DYxliYJo.js → SettingsGroup-Bm-l3IIs.js} +1 -1
  66. package/dist/assets/{SettingsView-Dfvs9-aB.js → SettingsView-CYEjDYWC.js} +15 -15
  67. package/dist/assets/{SettingsWindow-CCACaIcI.js → SettingsWindow-CvJsxUyu.js} +1 -1
  68. package/dist/assets/{SetupTourDialog-CTzVvWuI.js → SetupTourDialog-DWaVtkY0.js} +1 -1
  69. package/dist/assets/{SyncActions-BKhytR-H.js → SyncActions-C0gph0P8.js} +1 -1
  70. package/dist/assets/TerminalView-Cm8Ts51w.js +9 -0
  71. package/dist/assets/{TextSelectionMenu-C--W3Vxw.js → TextSelectionMenu-Dcv_PdES.js} +2 -2
  72. package/dist/assets/{ToolOutputDialog-4QosyyR-.js → ToolOutputDialog-QJpQjmqK.js} +2 -2
  73. package/dist/assets/{YuriLogo-YAE_6MsI.js → YuriLogo-BbS_Wj4g.js} +1 -1
  74. package/dist/assets/{YuriWordmark-BFHeVOwW.js → YuriWordmark-CqkcfAJl.js} +1 -1
  75. package/dist/assets/{assistant-attachment-cache-B8Bvp93X.js → assistant-attachment-cache-CIij0OGm.js} +1 -1
  76. package/dist/assets/{assistantMessagePreview-Dnt4nt3K.js → assistantMessagePreview-wmP-d_oa.js} +1 -1
  77. package/dist/assets/{assistantQueries-CV8A3Du5.js → assistantQueries-Dpxq78yP.js} +1 -1
  78. package/dist/assets/{auto-read-context-DWZsSvww.js → auto-read-context-aRn5yhDb.js} +1 -1
  79. package/dist/assets/{capgoAdapter-Dlf0ZlyX.js → capgoAdapter-BSnmtwX8.js} +1 -1
  80. package/dist/assets/{card-5xUgzwRy.js → card-aoveY4I3.js} +1 -1
  81. package/dist/assets/{chatUpwardIntent-ExbNZtoR.js → chatUpwardIntent-WxxmOppY.js} +1 -1
  82. package/dist/assets/{checkbox-BFuJ7w49.js → checkbox-CljLXON1.js} +1 -1
  83. package/dist/assets/{client-Brr-ja1l.js → client-CmtAKi5B.js} +1 -1
  84. package/dist/assets/{collapsible-DVLlg0W-.js → collapsible-DkeWKEAb.js} +1 -1
  85. package/dist/assets/{connection-hint-BARMaHbM.js → connection-hint-DsKyICgn.js} +1 -1
  86. package/dist/assets/{context-menu-CUqRZr1z.js → context-menu-XuMa5TsA.js} +1 -1
  87. package/dist/assets/{desktopHosts-BBCo4tyU.js → desktopHosts-COI-czjF.js} +1 -1
  88. package/dist/assets/{desktopRelayRestore-Cm2ITP98.js → desktopRelayRestore-BEPNc7qb.js} +1 -1
  89. package/dist/assets/device-TCHW5U2y.js +2 -0
  90. package/dist/assets/{diagram-BazwKH8x.js → diagram-DFv7Lh0h.js} +1 -1
  91. package/dist/assets/dialog-B6B8FIrL.css +1 -0
  92. package/dist/assets/{dialog-C_SxVFAo.js → dialog-Cx20I73q.js} +1 -1
  93. package/dist/assets/{dropdown-menu-CtAMJkEu.js → dropdown-menu-XdfySbu2.js} +1 -1
  94. package/dist/assets/es-CLAEdHpc.js +15 -0
  95. package/dist/assets/{fileMentionTouchSelection-DTWPCfYk.js → fileMentionTouchSelection-pXNTKHAc.js} +1 -1
  96. package/dist/assets/{fileReferenceActions-ez7SW3IW.js → fileReferenceActions-wN7mWY3w.js} +1 -1
  97. package/dist/assets/fr-BOB0gfdQ.js +13 -0
  98. package/dist/assets/{gitApi-SW-vcLxI.js → gitApi-LXGRaDt8.js} +1 -1
  99. package/dist/assets/{gitApiHttp-fl5lB9Lu.js → gitApiHttp-ZjM4HkSo.js} +2 -2
  100. package/dist/assets/{githubAuthQueries-2oyz-OKR.js → githubAuthQueries-3AJp5LD5.js} +1 -1
  101. package/dist/assets/{historyImportQueries-CTTVEQfk.js → historyImportQueries-B_mfphxe.js} +1 -1
  102. package/dist/assets/host-fTclNJST.js +1 -0
  103. package/dist/assets/{i18n-CzwXzoAE.js → i18n-iu4pzqPi.js} +1 -1
  104. package/dist/assets/{icons-B9kwDPqG.js → icons-BWijARKS.js} +1 -1
  105. package/dist/assets/{imageSource-5oLkHxn4.js → imageSource-qzgDdfT4.js} +1 -1
  106. package/dist/assets/{input-JTEWOZSR.js → input-BMYgp87Q.js} +1 -1
  107. package/dist/assets/{input-store-olhHHDxh.js → input-store-CzG_3qFv.js} +1 -1
  108. package/dist/assets/insertionBoundaries-bmxIeFzH.js +1 -0
  109. package/dist/assets/ja-CfM9jZ6u.js +15 -0
  110. package/dist/assets/{kbd-2UM_iptD.js → kbd-6RW-BxuR.js} +1 -1
  111. package/dist/assets/ko-DZOSVPHB.js +15 -0
  112. package/dist/assets/main-B-Wdp6An.js +169 -0
  113. package/dist/assets/main-BLBAaohb.js +2 -0
  114. package/dist/assets/{markdownHeightCache-CYOg5vHN.js → markdownHeightCache-ojT5txMS.js} +1 -1
  115. package/dist/assets/{mcpQueries-BBdJw27k.js → mcpQueries-BRuytwhB.js} +1 -1
  116. package/dist/assets/miniChat-BsrHy2rU.js +2 -0
  117. package/dist/assets/mobile-B8SHiXyq.js +2 -0
  118. package/dist/assets/{mobileBackNavigation-BMKb1AFe.js → mobileBackNavigation-CVrR_jtn.js} +1 -1
  119. package/dist/assets/{mobileConnections-B3sO6LHd.js → mobileConnections-iSUwFNqu.js} +2 -2
  120. package/dist/assets/{multirun-CIo87Y8M.js → multirun-Y3K5yS-8.js} +1 -1
  121. package/dist/assets/{native-config-B9rt7FGl.js → native-config-tvqKHwCC.js} +1 -1
  122. package/dist/assets/{nativeComposerCover-692JM3W7.js → nativeComposerCover-5rYz1E3W.js} +1 -1
  123. package/dist/assets/{navigation-DZmwc567.js → navigation-DFmCAq2g.js} +2 -2
  124. package/dist/assets/openRemoteProjectSession-CeSahDtQ.js +1 -0
  125. package/dist/assets/openSessionFromDeepLink-DsZnNy4W.js +2 -0
  126. package/dist/assets/pl-CaT81Sz8.js +15 -0
  127. package/dist/assets/platform-B2ylz14u.js +1 -0
  128. package/dist/assets/{pluginPresentation-mP_3zj0n.js → pluginPresentation-rls1AMJN.js} +2 -2
  129. package/dist/assets/{project-preview-D6gRDnY0.js → project-preview-yQerlKs2.js} +1 -1
  130. package/dist/assets/{projectActions-BhKknl2F.js → projectActions-B11KAI3f.js} +1 -1
  131. package/dist/assets/{prompt-attachment-upload-DmbZaK4Q.js → prompt-attachment-upload-BzYqZdzd.js} +1 -1
  132. package/dist/assets/pt-BR-9p1IKCEF.js +15 -0
  133. package/dist/assets/pwa-BrLPfcLk.js +2 -0
  134. package/dist/assets/{queue-abort-optimistic-DEP8n-eH.js → queue-abort-optimistic-CXKdQu_T.js} +1 -1
  135. package/dist/assets/{quota-noApkDjp.js → quota-BhdKv_Wc.js} +1 -1
  136. package/dist/assets/{reference-history-YQuuHaEQ.js → reference-history-Bzn-aPYg.js} +1 -1
  137. package/dist/assets/{remote-input-store-BuAuKvuo.js → remote-input-store-DPw_n0MZ.js} +1 -1
  138. package/dist/assets/{remoteProjectQueries-DtoxpM86.js → remoteProjectQueries-BQzoY_Y9.js} +1 -1
  139. package/dist/assets/{remoteSessionReference-Dh6CWWHy.js → remoteSessionReference-DORvqUYQ.js} +1 -1
  140. package/dist/assets/{renderElectronMiniChatApp-BXmpVc6d.js → renderElectronMiniChatApp-DXKgwBat.js} +2 -2
  141. package/dist/assets/renderMobileApp-CKN6rWxR.js +17 -0
  142. package/dist/assets/{runtime-file-download-CljroGkE.js → runtime-file-download-CaeLqIEY.js} +1 -1
  143. package/dist/assets/{runtime-file-resource-BlS-Ew1z.js → runtime-file-resource-BGZ4tGr5.js} +1 -1
  144. package/dist/assets/{runtimeConfig-CuW_HzK3.js → runtimeConfig-BqUZF6Wt.js} +1 -1
  145. package/dist/assets/runtimeEndpointReset-Bu02gAs3.js +4 -0
  146. package/dist/assets/{scheduledTaskNavigation-B1lpSDXk.js → scheduledTaskNavigation-r3g3DfXq.js} +1 -1
  147. package/dist/assets/{select-CDQXclVD.js → select-BPIsJWhM.js} +1 -1
  148. package/dist/assets/{sessionLookup-CQ0NWnCZ.js → sessionLookup-DZhrkKRI.js} +1 -1
  149. package/dist/assets/sessionOwnership-LoUNVeuJ.js +2 -0
  150. package/dist/assets/{shortcuts-DstiGEO9.js → shortcuts-DMupfl7l.js} +1 -1
  151. package/dist/assets/{sortable-tabs-strip-DyQNBvm3.js → sortable-tabs-strip-1bKw81VO.js} +1 -1
  152. package/dist/assets/{speechSettingsQueries-BkOKGdjP.js → speechSettingsQueries-C3JgzCqy.js} +1 -1
  153. package/dist/assets/src-BacdFOCS.css +2 -0
  154. package/dist/assets/{store-BRt8bo0A.js → store-BgsgBTwJ.js} +5 -5
  155. package/dist/assets/{switch-zJbRtv_r.js → switch-B4-v9kvg.js} +1 -1
  156. package/dist/assets/{terminalApi-FD8v3NAb.js → terminalApi-wdwb9MVG.js} +1 -1
  157. package/dist/assets/{textarea-DTZqFbDz.js → textarea-DExmj0ZR.js} +1 -1
  158. package/dist/assets/{timeFormat-Cfigwcpm.js → timeFormat-BlSO2-ws.js} +1 -1
  159. package/dist/assets/{tooltip-dWH5QFxu.js → tooltip-Di-WRJUZ.js} +1 -1
  160. package/dist/assets/{truncated-path-CXZAFwlh.js → truncated-path-nKzykV5p.js} +1 -1
  161. package/dist/assets/types-4xeqxklF.js +2 -0
  162. package/dist/assets/ui-BCYkB585.js +13 -0
  163. package/dist/assets/uk-BUSl_Y_1.js +15 -0
  164. package/dist/assets/useAppFontEffects-BCJPQstm.js +7 -0
  165. package/dist/assets/{useAssistantUIStore-90j09IZB.js → useAssistantUIStore-BUWPTwNV.js} +1 -1
  166. package/dist/assets/{useDesktopWindowControlsLayout-DGB6_pWm.js → useDesktopWindowControlsLayout-BtpyMlOS.js} +1 -1
  167. package/dist/assets/{useDictation-hf70zk6P.js → useDictation-4HBMkISY.js} +1 -1
  168. package/dist/assets/{useEffectiveDirectory-CcSfY1lN.js → useEffectiveDirectory-BYswRwIv.js} +1 -1
  169. package/dist/assets/useFontPreferences-C4dQT72k.js +1 -0
  170. package/dist/assets/{useGitStore-IAG82rgx.js → useGitStore-DqBPgmf-.js} +1 -1
  171. package/dist/assets/{useInlineCommentDraftStore-DAq3lz0A.js → useInlineCommentDraftStore-CGJ6dM8d.js} +1 -1
  172. package/dist/assets/useMcpConfigStore-DEcxFuzW.js +1 -0
  173. package/dist/assets/{useMobileSwipeActions-5-ZcwhfI.js → useMobileSwipeActions-DqlR4X-T.js} +1 -1
  174. package/dist/assets/useMobileTranscriptSyncHint-BDKcqtq_.js +10 -0
  175. package/dist/assets/{useModelLists-D8s2D-yz.js → useModelLists-DsFTBlMr.js} +1 -1
  176. package/dist/assets/{useOpenCodeReadiness-BIyAApPB.js → useOpenCodeReadiness-CHybAoBh.js} +1 -1
  177. package/dist/assets/usePluginsStore-BIBHPK4A.js +1 -0
  178. package/dist/assets/{useProjectGitActions-DPqScNnn.js → useProjectGitActions-DeFcqi_O.js} +1 -1
  179. package/dist/assets/{useProjectGitStore-BOiooCle.js → useProjectGitStore-JGZk-NCk.js} +1 -1
  180. package/dist/assets/{useProjectRuntimeAPIs-DQaT_Ok_.js → useProjectRuntimeAPIs-BMBBtJB-.js} +1 -1
  181. package/dist/assets/{useQuotaStore-C3FDA_wk.js → useQuotaStore-C3qJTiD7.js} +1 -1
  182. package/dist/assets/{useSessionBtwStore-eNT3w9Un.js → useSessionBtwStore-D7P-pknd.js} +1 -1
  183. package/dist/assets/{useStreamingTextThrottle-D8r8Ox9l.js → useStreamingTextThrottle-CjWAE0oQ.js} +1 -1
  184. package/dist/assets/useTerminalStore-C_QzSEgP.js +1 -0
  185. package/dist/assets/{useUIStore-BkYqSmAD.js → useUIStore-68ZPpgYA.js} +1 -1
  186. package/dist/assets/worktreeManager-pRvX5dQT.js +1 -0
  187. package/dist/assets/{worktreeSourceBranchPreference-B9rTzT2t.js → worktreeSourceBranchPreference-B7d3RYcc.js} +1 -1
  188. package/dist/assets/zh-CN-BGKgQtWd.js +15 -0
  189. package/dist/assets/zh-TW-jM5lIKfe.js +15 -0
  190. package/dist/index.html +16 -16
  191. package/dist/mini-chat.html +16 -16
  192. package/dist/mobile.html +2 -2
  193. package/package.json +2 -1
  194. package/server/index.js +22 -10
  195. package/server/lib/assistants/DOCUMENTATION.md +11 -6
  196. package/server/lib/assistants/builtin-skills.js +19 -3
  197. package/server/lib/assistants/builtin-skills.test.js +17 -0
  198. package/server/lib/assistants/contact-tools.js +47 -3
  199. package/server/lib/assistants/contact-tools.test.js +59 -0
  200. package/server/lib/assistants/harness.js +5 -2
  201. package/server/lib/assistants/harness.test.js +1 -1
  202. package/server/lib/assistants/routes.js +1 -0
  203. package/server/lib/assistants/service.js +7 -2
  204. package/server/lib/assistants/yuri-tools.js +1 -1
  205. package/server/lib/assistants/yuri-tools.test.js +1 -1
  206. package/server/lib/gui-customization/DOCUMENTATION.md +32 -7
  207. package/server/lib/gui-customization/projects-client.mjs +1 -1
  208. package/server/lib/gui-customization/projects.js +6 -6
  209. package/server/lib/gui-customization/projects.test.js +13 -2
  210. package/server/lib/gui-customization/remote-connections-client.mjs +1 -1
  211. package/server/lib/gui-customization/remote-connections.js +7 -6
  212. package/server/lib/gui-customization/remote-connections.test.js +17 -0
  213. package/server/lib/gui-customization/session-skill.js +16 -4
  214. package/server/lib/gui-customization/session-skill.test.js +16 -0
  215. package/server/lib/gui-customization/skill/SKILL.md +2 -2
  216. package/server/lib/gui-customization/skill/references/deep-links.md +15 -11
  217. package/server/lib/gui-customization/skill/references/gui-api.md +50 -1
  218. package/server/lib/gui-customization/skill/references/projects.md +19 -0
  219. package/server/lib/gui-customization/skill/references/remote-connections.md +3 -0
  220. package/server/lib/gui-customization/skill-caller.js +18 -0
  221. package/server/lib/host-update/DOCUMENTATION.md +5 -0
  222. package/server/lib/host-update/cli.js +5 -2
  223. package/server/lib/host-update/cli.test.js +15 -2
  224. package/server/lib/opencode/DOCUMENTATION.md +2 -1
  225. package/server/lib/opencode/custom-provider.test.js +41 -0
  226. package/server/lib/opencode/feature-routes-runtime.js +20 -3
  227. package/server/lib/opencode/settings-helpers.js +5 -0
  228. package/server/lib/opencode/settings-helpers.test.js +10 -0
  229. package/server/lib/package-manager.js +14 -0
  230. package/server/lib/package-manager.test.js +7 -0
  231. package/server/lib/portable-installation.js +34 -0
  232. package/server/lib/portable-installation.test.js +38 -0
  233. package/server/lib/session-index/DOCUMENTATION.md +8 -0
  234. package/server/lib/session-index/adopt-unindexed-session.js +46 -0
  235. package/server/lib/session-index/adopt-unindexed-session.test.js +77 -0
  236. package/server/lib/session-index/event-ingest.js +14 -1
  237. package/server/lib/session-index/event-ingest.test.js +18 -0
  238. package/dist/assets/ArchivedSessionsDialog-8KudFtdU.js +0 -1
  239. package/dist/assets/BinaryFileFallback-DhRqRBKp.js +0 -1
  240. package/dist/assets/BusyDots-BRm9osT-.js +0 -4
  241. package/dist/assets/ChatView-CZyfJPJI.js +0 -3
  242. package/dist/assets/MarkdownRenderer-MCdcFkrB.js +0 -2
  243. package/dist/assets/ScheduledTasksDialog-CBVwmP3I.js +0 -3
  244. package/dist/assets/TerminalView-BE88iCut.js +0 -8
  245. package/dist/assets/device-DaBjLp2g.js +0 -2
  246. package/dist/assets/dialog-D9CkSNCA.css +0 -1
  247. package/dist/assets/es-BuXtFKUW.js +0 -15
  248. package/dist/assets/fr-BaZeffY9.js +0 -13
  249. package/dist/assets/host-DkOpLMtd.js +0 -1
  250. package/dist/assets/insertionBoundaries-CmHoHHu4.js +0 -1
  251. package/dist/assets/ja-CGVx5A8U.js +0 -15
  252. package/dist/assets/ko-C663nzbf.js +0 -15
  253. package/dist/assets/main-2WZS1sUa.js +0 -2
  254. package/dist/assets/main-BoaXbSk_.js +0 -169
  255. package/dist/assets/miniChat-sY4pEF3a.js +0 -2
  256. package/dist/assets/mobile-oVfsL7ax.js +0 -2
  257. package/dist/assets/openRemoteProjectSession-CU45azVB.js +0 -1
  258. package/dist/assets/openSessionFromDeepLink-BoGMvzx0.js +0 -2
  259. package/dist/assets/pl-CeBOMwg9.js +0 -15
  260. package/dist/assets/platform-B_vXw3WJ.js +0 -1
  261. package/dist/assets/pt-BR-r8268Pk6.js +0 -15
  262. package/dist/assets/pwa-Cni1iHtS.js +0 -2
  263. package/dist/assets/renderMobileApp-B7v2goOK.js +0 -17
  264. package/dist/assets/runtimeEndpointReset-rGqYbpcd.js +0 -4
  265. package/dist/assets/sessionOwnership-DHLgtM_g.js +0 -2
  266. package/dist/assets/src-DYCPWwUH.css +0 -2
  267. package/dist/assets/types-CXWh93pl.js +0 -2
  268. package/dist/assets/ui-DiWlcrZU.js +0 -13
  269. package/dist/assets/uk-CeQ1XJ99.js +0 -15
  270. package/dist/assets/useAppFontEffects-DvftNvNI.js +0 -7
  271. package/dist/assets/useFontPreferences-BPtsS6hr.js +0 -1
  272. package/dist/assets/useMcpConfigStore-C6bGnrzx.js +0 -1
  273. package/dist/assets/useMobileTranscriptSyncHint-DwKbHgxp.js +0 -10
  274. package/dist/assets/usePluginsStore-DF6jfADo.js +0 -1
  275. package/dist/assets/worktreeManager-Dm96jF0K.js +0 -1
  276. package/dist/assets/zh-CN-Bv854olO.js +0 -15
  277. package/dist/assets/zh-TW-gx8cO-Cx.js +0 -15
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/vendor-aparajita-capacitor-secure-storage-xol_6BsB.js","assets/rolldown-runtime-hePW80VL.js"])))=>i.map(i=>d[i]);
2
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{c as t,i as n,n as r}from"./runtime-switch-DEPKHgdL.js";import{n as i}from"./runtime-fetch-V-iMWR8t.js";import{I as a,L as o,M as s,N as c,P as l,R as u,Y as d,h as f,n as p,p as m,t as h,z as g}from"./platform-B_vXw3WJ.js";import{t as _}from"./runtimeAPIRegistry-C2VogTny.js";import{a as v,i as y,r as b}from"./vendor-zustand-CTekDqaS.js";import{ot as x,st as S}from"./vendor-base-ui-wXsskyKm.js";import{Ft as C,St as w}from"./gitApiHttp-fl5lB9Lu.js";import{i as T,t as E}from"./safeStorage-DTOhKN0V.js";import{n as D}from"./client-Brr-ja1l.js";import{n as O}from"./pathNormalization-ewtPqJWn.js";import{n as k}from"./vendor-react-BkccXcWz.js";import{n as A,s as j,u as M}from"./vendor-tanstack-react-query-DIb_ItL-.js";import{G as N,W as P}from"./runtime-file-resource-BlS-Ew1z.js";import{r as F}from"./vendor-reactuses-core-DjKFMfz7.js";import{o as I}from"./vendor-aparajita-capacitor-secure-storage-xol_6BsB.js";import{r as L}from"./useUIStore-BkYqSmAD.js";import{o as ee}from"./useMobileHtmlPreviewStore-BYunNOBo.js";import{a as R,t as te}from"./types-CXWh93pl.js";import{Yn as ne,no as z,t as re,to as ie}from"./ui-DiWlcrZU.js";import{n as B}from"./Icon-DlTEfBVi.js";import{n as ae,t as oe}from"./i18n-CzwXzoAE.js";import{t as se}from"./ScrollableOverlay-X1R_GNYm.js";import{n as ce,o as le,r as ue,t as de}from"./dialog-C_SxVFAo.js";import{t as fe}from"./device-DaBjLp2g.js";import{a as pe,c as me,g as he,n as ge,r as _e,u as ve}from"./gitApi-SW-vcLxI.js";import{n as ye}from"./MarkdownRenderer-MCdcFkrB.js";import{t as be}from"./checkbox-BFuJ7w49.js";import{i as xe,n as Se,r as Ce}from"./githubAuthQueries-2oyz-OKR.js";import{c as V,i as we,o as Te}from"./mcpQueries-BBdJw27k.js";import{c as Ee,s as De}from"./usePluginsStore-DF6jfADo.js";var Oe=k(),H=x();function ke(e){let t=(0,Oe.c)(4),n,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,H.jsx)(`path`,{d:`M15.688 2.343a2.588 2.588 0 00-3.61 0l-9.626 9.44a.863.863 0 01-1.203 0 .823.823 0 010-1.18l9.626-9.44a4.313 4.313 0 016.016 0 4.116 4.116 0 011.204 3.54 4.3 4.3 0 013.609 1.18l.05.05a4.115 4.115 0 010 5.9l-8.706 8.537a.274.274 0 000 .393l1.788 1.754a.823.823 0 010 1.18.863.863 0 01-1.203 0l-1.788-1.753a1.92 1.92 0 010-2.754l8.706-8.538a2.47 2.47 0 000-3.54l-.05-.049a2.588 2.588 0 00-3.607-.003l-7.172 7.034-.002.002-.098.097a.863.863 0 01-1.204 0 .823.823 0 010-1.18l7.273-7.133a2.47 2.47 0 00-.003-3.537z`}),r=(0,H.jsx)(`path`,{d:`M14.485 4.703a.823.823 0 000-1.18.863.863 0 00-1.204 0l-7.119 6.982a4.115 4.115 0 000 5.9 4.314 4.314 0 006.016 0l7.12-6.982a.823.823 0 000-1.18.863.863 0 00-1.204 0l-7.119 6.982a2.588 2.588 0 01-3.61 0 2.47 2.47 0 010-3.54l7.12-6.982z`}),t[0]=n,t[1]=r):(n=t[0],r=t[1]);let i;return t[2]===e?i=t[3]:(i=(0,H.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`1em`,height:`1em`,fill:`currentColor`,stroke:`currentColor`,strokeWidth:`0.5`,fillRule:`evenodd`,viewBox:`-0.5 -0.5 25 25`,...e,children:[n,r]}),t[2]=e,t[3]=i),i}var Ae={},U=(e,t=n())=>JSON.stringify([t,we(e)]),je=(e,t,n)=>{if(!e[t]?.[n])return e;let r={...e[t]};return delete r[n],{...e,[t]:r}},W=e=>{let t=we(e);return t?D.getScopedApiClient(t):D.getApiClient()},G=e=>e?{location:{directory:e}}:void 0,K=new Map,q=(e,t)=>JSON.stringify([r(),U(t),e]),Me=async(e,t,n)=>{let r=(await e.mcp.list(G(n))).data.find(e=>e.name===t)?.integrationID;if(!r)throw Error(`MCP server "${t}" has no authentication integration`);return(await e.integration.get({integrationID:r,...G(n)})).data},J=e=>we(e===void 0?w.getState().currentDirectory:e),Ne=v()(b((e,t)=>({diagnosticsByDirectory:{},getDiagnosticForDirectory:e=>{let n=U(J(e));return t().diagnosticsByDirectory[n]??Ae},clearDiagnostic:(t,n,r)=>{let i=U(J(n),r);e(e=>({diagnosticsByDirectory:je(e.diagnosticsByDirectory,i,t)}))},connect:async(t,r)=>{let i=J(r),a=n(),o=U(i,a),s=W(i);try{await s.mcp.connect({server:t,...G(i)})}catch(n){let r=n instanceof Error?n.message:`Connection failed`;throw e(e=>({diagnosticsByDirectory:{...e.diagnosticsByDirectory,[o]:{...e.diagnosticsByDirectory[o]??{},[t]:{status:`failed`,error:r}}}})),n}await V(P,i,a),e(e=>({diagnosticsByDirectory:je(e.diagnosticsByDirectory,o,t)}))},disconnect:async(t,r)=>{let i=J(r),a=n(),o=U(i,a);await W(i).mcp.disconnect({server:t,...G(i)}),await V(P,i,a),e(e=>({diagnosticsByDirectory:je(e.diagnosticsByDirectory,o,t)}))},startAuth:async(e,t)=>{let n=J(t),r=q(e,n),i=W(n),a=await Me(i,e,n),o=a.methods.find(e=>e.type===`oauth`);if(!o)throw Error(`MCP server "${e}" has no OAuth method`);if(r!==q(e,n))throw Error(`MCP authorization runtime changed`);let s=K.get(r);if(s&&(await i.integration.oauth.cancel({integrationID:s.integrationID,attemptID:s.attempt.attemptID,...G(n)}),K.delete(r)),r!==q(e,n))throw Error(`MCP authorization runtime changed`);let{data:c}=await i.integration.oauth.connect({integrationID:a.id,methodID:o.id,...G(n)});if(r!==q(e,n))throw Error(`MCP authorization runtime changed`);for(let[e,t]of K)t.attempt.time.expires<=Date.now()&&K.delete(e);return K.set(r,{integrationID:a.id,attempt:c}),c},authStatus:async(e,t)=>{let n=J(t),r=q(e,n),i=K.get(r);if(!i)throw Error(`MCP authorization attempt not found`);let{data:a}=await W(n).integration.oauth.status({integrationID:i.integrationID,attemptID:i.attempt.attemptID,...G(n)});if(r!==q(e,n))throw Error(`MCP authorization runtime changed`);return a.status!==`pending`&&K.get(r)===i&&K.delete(r),a},completeAuth:async(e,t,r)=>{let i=J(r),a=n(),o=q(e,i),s=K.get(o);if(!s||s.attempt.mode!==`code`)throw Error(`MCP authorization requires the browser callback`);if(!t.trim())throw Error(`MCP authorization code is empty`);if(await W(i).integration.oauth.complete({integrationID:s.integrationID,attemptID:s.attempt.attemptID,code:t.trim(),...G(i)}),K.get(o)===s&&K.delete(o),o!==q(e,i))throw Error(`MCP authorization runtime changed`);await V(P,i,a)},clearAuth:async(e,t)=>{let r=J(t),i=n(),a=q(e,r),o=W(r),s=await Me(o,e,r);if(a!==q(e,r))throw Error(`MCP authorization runtime changed`);let c=K.get(a);c&&(await o.integration.oauth.cancel({integrationID:c.integrationID,attemptID:c.attempt.attemptID,...G(r)}),K.delete(a));let l=new Set(s.connections.flatMap(e=>e.type===`credential`?[e.id]:[]));for(let t of l){if(a!==q(e,r))throw Error(`MCP authorization runtime changed`);await o.credential.remove({credentialID:t})}if(a!==q(e,r))throw Error(`MCP authorization runtime changed`);await V(P,r,i)},testConnection:async(t,r)=>{let i=J(r),a=n(),o=U(i,a),s=W(i),c=Te(P,i,a)[t]?.status===`connected`,l,u;try{await s.mcp.connect({server:t,...G(i)})}catch(n){l=n instanceof Error?n.message:`Connection failed`,e(e=>({diagnosticsByDirectory:{...e.diagnosticsByDirectory,[o]:{...e.diagnosticsByDirectory[o]??{},[t]:{status:`failed`,error:l??`Connection failed`}}}}))}let d=(await V(P,i,a))[t],f=d;if(!c&&d?.status===`connected`){try{await s.mcp.disconnect({server:t,...G(i)})}catch(e){u=`Connection test succeeded, but cleanup disconnect failed: ${e instanceof Error?e.message:`Disconnect failed`}`}await V(P,i,a)}return l||e(e=>({diagnosticsByDirectory:je(e.diagnosticsByDirectory,o,t)})),{status:f??Te(P,i,a)[t],error:l,warning:u}}}))),Y=e(S(),1),Pe=`https://yuri-updates.xiaobe.top/v1/update/check`,Fe=`https://yuri-origin.xiaobe.top/v1/update/check`,Ie=`https://github.com/yee94/yuri/releases/latest`,Le=`https://github.com/yee94/yuri/releases`,Re=`https://testflight.apple.com/join/pN5SSHeg`,ze=1e4;function Be(e){let t=String(e||``).replace(/^v/,``).split(`+`)[0]??``,n=t.indexOf(`-`);return{parts:(n>=0?t.slice(0,n):t).split(`.`).map(e=>{let t=Number.parseInt(e||`0`,10);return Number.isFinite(t)?t:0}),prerelease:n>=0}}function Ve(e,t){let n=Be(e),r=Be(t),i=Math.max(n.parts.length,r.parts.length);for(let e=0;e<i;e+=1){let t=(n.parts[e]||0)-(r.parts[e]||0);if(t!==0)return t}return n.prerelease===r.prerelease?0:n.prerelease?-1:1}function He(){return[Pe,Fe]}function Ue(e,t,n=Date.now){let r=e-n();return r<=0||t<=0?null:Math.max(1,Math.ceil(r/t))}function We(e){return{appType:`mobile-capacitor`,deviceClass:e.deviceClass||`mobile`,platform:e.platform===`ios`||e.platform===`android`?e.platform:`android`,arch:e.arch||`unknown`,channel:`stable`,currentVersion:e.currentVersion,instanceMode:`remote`,reportUsage:e.reportUsage===!0}}async function Ge(e,t,n,r){try{if(p())try{let{CapacitorHttp:r}=await I(async()=>{let{CapacitorHttp:e}=await import(`./vendor-aparajita-capacitor-secure-storage-xol_6BsB.js`).then(e=>e.i);return{CapacitorHttp:e}},__vite__mapDeps([0,1])),i=Object.fromEntries(new Headers(t.headers).entries()),a;if(typeof t.body==`string`)try{a=JSON.parse(t.body)}catch{a=t.body}let o=await Promise.race([r.request({url:e,method:t.method||`GET`,headers:i,data:a,connectTimeout:n,readTimeout:n}),new Promise(e=>{window.setTimeout(()=>e(null),n)})]);return o?{ok:o.status>=200&&o.status<300,status:o.status,url:typeof o.url==`string`?o.url:e,json:async()=>{if(typeof o.data==`string`)try{return JSON.parse(o.data)}catch{return o.data}return o.data}}:null}catch{}let i=await r(e,{...t,signal:AbortSignal.timeout(n)});return{ok:i.ok,status:i.status,url:i.url,json:()=>i.json()}}catch{return null}}function Ke(e,t){return e===`ios`?Re:`${Le}/download/v${t}/app-release.apk`}function qe(e,t,n){if(typeof e.latestVersion!=`string`||e.latestVersion.trim().length===0)return null;let r=e.latestVersion.trim(),i=Ve(r,t);if(i<0)return null;let a=typeof e.releaseNotesUrl==`string`&&e.releaseNotesUrl.trim().length>0?e.releaseNotesUrl.trim():`${Le}/tag/v${r}`,o=typeof e.downloadUrl==`string`&&e.downloadUrl.trim().length>0?e.downloadUrl.trim():typeof e.download?.url==`string`&&e.download.url.trim().length>0?e.download.url.trim():Ke(n,r);return{available:!!e.updateAvailable&&i>0,version:r,currentVersion:t,body:typeof e.releaseNotes==`string`?e.releaseNotes:void 0,releaseUrl:a,downloadUrl:o,nextSuggestedCheckInSec:typeof e.nextSuggestedCheckInSec==`number`&&Number.isFinite(e.nextSuggestedCheckInSec)?e.nextSuggestedCheckInSec:void 0}}async function Je(e,t,n,r){let i=await Ge(e,{method:`POST`,headers:{Accept:`application/json`,"Content-Type":`application/json`},body:JSON.stringify(We(t))},n,r);if(!i?.ok)return null;let a;try{a=await i.json()}catch{return null}return qe(a,t.currentVersion,t.platform)}async function Ye(e,t,n,r){let i=await Ge(Ie,{method:`GET`,headers:{Accept:`text/html`},redirect:`follow`},n,r);if(!i?.ok)return null;let a=typeof i.url==`string`&&i.url.length>0?i.url:Ie,o=null;try{o=new URL(a).pathname.match(/\/releases\/tag\/v(\d+\.\d+\.\d+(?:-[\w.]+)?)/)}catch{return null}if(!o?.[1])return null;let s=o[1],c=Ve(s,e),l=`${Le}/tag/v${s}`;return{available:c>0,version:s,currentVersion:e,releaseUrl:l,downloadUrl:Ke(t,s)}}async function Xe(e){let t=e.currentVersion?.trim()||`unknown`;if(t===`unknown`)return{available:!1,currentVersion:t,error:`Unable to check for mobile updates`};let n=e.fetchImpl??fetch,r=e.now??Date.now,i=He(),a=r()+ze;for(let[t,o]of i.entries()){let s=Ue(a,i.length-t+1,r);if(s===null)break;let c=await Je(o,e,s,n);if(c)return c}let o=Ue(a,1,r);if(o!==null){let r=await Ye(t,e.platform,o,n);if(r)return r}return{available:!1,currentVersion:t,error:`Unable to check for mobile updates`}}function Ze(){if(typeof window>`u`)return`unknown`;try{let{deviceType:e}=fe();return e}catch{return`unknown`}}function Qe(){let e=typeof window<`u`?window.__VSCODE_CONFIG__?.arch?.toLowerCase?.():void 0;if(e===`arm64`||e===`aarch64`)return`arm64`;if(e===`x64`||e===`amd64`||e===`x86_64`)return`x64`;let t=(typeof navigator<`u`?navigator.userAgentData:void 0)?.architecture?.toLowerCase?.();if(t===`arm`||t===`arm64`||t===`aarch64`)return`arm64`;if(t===`x86`||t===`x64`||t===`amd64`)return`x64`;let n=typeof navigator<`u`?navigator.userAgent.toLowerCase():``;return n.includes(`aarch64`)||n.includes(`arm64`)||n.includes(`armv`)?`arm64`:n.includes(`x86_64`)||n.includes(`x64`)||n.includes(`amd64`)||n.includes(`win64`)?`x64`:`unknown`}function $e(){let e=h();if(e===`android`||e===`ios`)return e;if(typeof navigator>`u`)return`web`;let t=(navigator.platform||``).toLowerCase();return t.includes(`mac`)?`macos`:t.includes(`win`)?`windows`:t.includes(`linux`)?`linux`:`web`}function et(e){let t=L.getState().reportUsage,n=new URLSearchParams({reportUsage:t?`true`:`false`});return n.set(`deviceClass`,Ze()),n.set(`arch`,Qe()),n.set(`platform`,$e()),e===`desktop`?(n.set(`appType`,`desktop-electron`),n.set(`instanceMode`,s()?`local`:`remote`),n):e===`vscode`?(n.set(`appType`,`vscode`),n.set(`instanceMode`,`local`),n):e===`mobile`?(n.set(`appType`,`mobile-capacitor`),n.set(`instanceMode`,`remote`),n):(n.set(`appType`,`web`),n.set(`instanceMode`,`unknown`),n)}async function tt(e,t){let n=t??`unknown`;try{let r=et(e),a=typeof window<`u`?window.__VSCODE_CONFIG__?.extensionVersion:void 0;t?r.set(`currentVersion`,t):e===`vscode`&&a&&r.set(`currentVersion`,a);let o=await i(`/api/yuri/update-check?${r.toString()}`,{method:`GET`,headers:{Accept:`application/json`}}),s=null;try{s=await o.json()}catch{s=null}if(!o.ok)return{available:!1,currentVersion:n,error:typeof s?.error==`string`&&s.error.trim().length>0?s.error.trim():`Server responded with ${o.status}`};if(!s)return{available:!1,currentVersion:n,error:`Update check returned an invalid response`};let c=typeof s.error==`string`&&s.error.trim().length>0?s.error.trim():void 0;return{available:s.available===!0,version:typeof s.version==`string`?s.version:void 0,currentVersion:typeof s.currentVersion==`string`?s.currentVersion:n,body:typeof s.body==`string`?s.body:void 0,releaseUrl:typeof s.releaseUrl==`string`?s.releaseUrl:void 0,downloadUrl:typeof s.downloadUrl==`string`?s.downloadUrl:void 0,nextSuggestedCheckInSec:typeof s.nextSuggestedCheckInSec==`number`&&Number.isFinite(s.nextSuggestedCheckInSec)?s.nextSuggestedCheckInSec:void 0,packageManager:typeof s.packageManager==`string`?s.packageManager:void 0,updateCommand:typeof s.updateCommand==`string`?s.updateCommand:void 0,error:c}}catch(e){return console.warn(`Failed to check for updates:`,e),{available:!1,currentVersion:n,error:e instanceof Error?e.message:`Failed to check for updates`}}}function nt(){return p()?`mobile`:l()?`desktop`:a()?`vscode`:o()?`web`:null}var rt={checking:!1,available:!1,downloading:!1,downloaded:!1,info:null,progress:null,error:null,downloadError:null,downloadVersion:null,downloadChannel:null,runtimeType:null,lastChecked:null,nextCheckInSec:null,otaDecision:null,otaPhase:`idle`,otaDownloadSkipped:!1,lastOtaChannelOverride:null},it=`yuri-client-update-download`,at=e=>typeof e==`string`&&/^\d+\.\d+\.\d+(?:[-+][\w.-]+)?$/.test(e);function ot(){try{let e=JSON.parse(T().getItem(it)??`null`);return!e||e.runtimeType!==nt()||![`desktop`,`mobile`].includes(e.runtimeType)||!at(e.version)||![null,`stable`,`beta`].includes(e.channel)?{}:{runtimeType:e.runtimeType,downloadVersion:e.version,downloadChannel:e.channel,downloadError:`update_interrupted`}}catch{return{}}}function st(e,t){let n=e.isChannelRollback===!0?{isChannelRollback:!0}:{};if(e.primaryAction===`apply_ota`&&e.ota.bundle)return e.ota.bundle.releaseVersion===t?{available:!1,otaPhase:`idle`,info:{available:!1,currentVersion:t,nextSuggestedCheckInSec:e.nextCheckInSec,...n}}:{available:!0,otaPhase:`available`,info:{available:!0,version:e.ota.bundle.releaseVersion,currentVersion:t,downloadUrl:e.ota.bundle.url,nextSuggestedCheckInSec:e.nextCheckInSec,inAppApply:!0,...e.releaseNotes?{body:e.releaseNotes}:{},...n}};if(e.primaryAction===`install_native_required`){if(!e.native.version?.trim()||!e.native.installUrl?.trim())throw Error(`Native update required, but the update service supplied no complete installation target`);return{available:e.native.state===`required`||e.native.state===`available`,otaPhase:`idle`,info:{available:e.native.state===`required`||e.native.state===`available`,version:e.native.version,currentVersion:t,downloadUrl:e.native.installUrl,nextSuggestedCheckInSec:e.nextCheckInSec,manualUpdate:!0,...e.releaseNotes?{body:e.releaseNotes}:{},...n}}}return{available:!1,otaPhase:`idle`,info:{available:!1,currentVersion:t,nextSuggestedCheckInSec:e.nextCheckInSec,...n}}}var ct=0,lt=v()((e,t)=>({...rt,...ot(),checkForUpdates:async()=>{let n=nt();if(!n)return null;let r=++ct;e({checking:!0,error:null,runtimeType:n});try{let i=null,a=null;if(n===`desktop`){let n=L.getState().otaChannelOverride;t().lastOtaChannelOverride!==n&&e({downloaded:!1,downloading:!1,available:!1,info:null,otaDecision:null,progress:null,otaPhase:`checking`});let i=await m(n);if(r!==ct||L.getState().otaChannelOverride!==n)return null;let a=i?.downloaded===!0,o=!a&&i?.downloading===!0;return e({checking:!1,available:i?.available??!1,downloaded:a,...a?{downloading:!1,progress:null,downloadError:null}:o?{downloading:!0,progress:i?.progress??null}:{},info:i,error:null,lastChecked:Date.now(),nextCheckInSec:i?.nextSuggestedCheckInSec??null,otaDecision:i?.otaDecision??null,otaPhase:a?`pending_restart`:o?`downloading`:i?.inAppApply?`available`:`idle`,lastOtaChannelOverride:n}),i?.nextSuggestedCheckInSec??null}if(n===`web`)i=await tt(`web`),a=i?.nextSuggestedCheckInSec??null;else if(n===`vscode`)a=(await tt(`vscode`))?.nextSuggestedCheckInSec??null;else if(n===`mobile`){let n=await R()??`unknown`,r=p()?_()?.mobileUpdates:void 0,o=L.getState().otaChannelOverride;if(r)try{let i=t().lastOtaChannelOverride!==o;e(i?{otaDecision:null,otaPhase:`checking`,downloaded:!1,otaDownloadSkipped:!1,progress:null,available:!1,info:null}:{otaPhase:`checking`});let a=await r.checkForOtaUpdate(o===`beta`||o===`stable`?{channelOverride:o}:void 0),s=st(a,n),c=(i?void 0:t().otaDecision?.ota.bundle?.bundleId)!==a.ota.bundle?.bundleId,l=!i&&t().downloaded&&!c;return e({checking:!1,available:s.available,info:s.info,error:s.info.error??null,lastChecked:Date.now(),nextCheckInSec:a.nextCheckInSec,otaDecision:a,otaPhase:l?`pending_restart`:s.otaPhase,lastOtaChannelOverride:o,...c||i?{downloaded:!1,otaDownloadSkipped:!1,progress:null}:{}}),a.nextCheckInSec}catch(t){if(!(t instanceof te)){let r=t instanceof Error?t.message:`Mobile OTA check failed`;return e({checking:!1,available:!1,info:{available:!1,currentVersion:n},error:r,lastChecked:Date.now(),otaDecision:null,otaPhase:`error`,lastOtaChannelOverride:o}),null}}return i=await Xe({currentVersion:n,platform:$e()===`ios`?`ios`:`android`,deviceClass:Ze(),arch:Qe(),reportUsage:L.getState().reportUsage}),a=i?.nextSuggestedCheckInSec??null,e({checking:!1,available:i?.available??!1,info:i,error:i?.error??null,lastChecked:Date.now(),nextCheckInSec:a,otaDecision:null,otaPhase:`idle`}),a}return e({checking:!1,available:n===`vscode`?!1:i?.available??!1,info:n===`vscode`?null:i,error:n===`vscode`?null:i?.error??null,lastChecked:Date.now(),nextCheckInSec:a}),a}catch(i){return r===ct&&e({checking:!1,error:i instanceof Error?i.message:`Failed to check for updates`,...n===`desktop`&&!t().downloaded?{otaPhase:`error`}:{}}),null}},downloadUpdate:async n=>{n?.resume===!0&&!t().info&&await t().checkForUpdates();let{available:r,runtimeType:i,otaDecision:a,downloading:o,downloaded:s}=t();if(o||s)return;let c=L.getState().otaChannelOverride,l=n?.resume===!0,u=l?t().downloadVersion:t().info?.version;if(l&&(t().downloadChannel!==c||u!==t().info?.version)){e({downloadError:`update_plan_changed`,error:`update_plan_changed`});return}if(i===`mobile`&&a?.primaryAction===`apply_ota`&&a.ota.bundle){if(o||s)return;let t=_()?.mobileUpdates;if(!t){e({error:`Mobile OTA updates are unavailable in this runtime`,downloadError:`Mobile OTA updates are unavailable in this runtime`,otaPhase:`error`});return}e({downloading:!0,error:null,downloadError:null,downloadVersion:u??null,downloadChannel:c,progress:null,otaPhase:`downloading`,otaDownloadSkipped:!1});try{let{skipped:n}=await t.downloadOtaUpdate(a.ota.bundle);await t.queueOtaUpdateForNextLaunch(),e({downloading:!1,downloaded:!0,downloadError:null,progress:null,otaPhase:`pending_restart`,otaDownloadSkipped:n})}catch(t){e({downloading:!1,error:t instanceof Error?t.message:`Failed to download update`,downloadError:t instanceof Error?t.message:`Failed to download update`,otaPhase:`error`})}return}if(!(i!==`desktop`||!r)){e({downloading:!0,error:null,downloadError:null,downloadVersion:u??null,downloadChannel:c,progress:null});try{let n=L.getState().otaChannelOverride,r=await m(n);if(n!==L.getState().otaChannelOverride)throw Error(`OTA channel changed`);if(u&&r?.version!==u)throw Error(`update_plan_changed`);if(!r?.available||r.manualUpdate)throw Error(`Update detected, but desktop package is not ready yet. Retry in a moment.`);if(e(e=>({info:e.info?{...e.info,...r,body:r.body||e.info.body,available:e.info.available}:r})),r.downloaded||t().downloaded){e({downloading:!1,downloaded:!0,progress:null});return}if(r.downloading&&e({downloading:!0,progress:r.progress??{downloaded:0}}),!await f(t=>{e({progress:t})}))throw Error(`Failed to download update`);e({downloading:!1,downloaded:!0,progress:null,otaPhase:`pending_restart`})}catch(t){e({downloading:!1,error:t instanceof Error?t.message:`Failed to download update`,downloadError:t instanceof Error?t.message:`Failed to download update`})}}},subscribeDesktopUpdateEvents:async()=>{if(!l())return()=>{};let n=[],r=await u(n=>{let r=n.event,i=n.data??null;if(r===`Started`){if(!t().downloading)return;e({error:null,progress:{downloaded:0,total:typeof i?.contentLength==`number`?i.contentLength:void 0}});return}if(r===`Progress`){if(!t().downloading)return;e({progress:{downloaded:typeof i?.downloaded==`number`?i.downloaded:0,total:typeof i?.total==`number`?i.total:void 0}});return}r===`Finished`&&e({downloading:!1,downloaded:!0,progress:null,downloadError:null})});r&&n.push(r);let i=await g(t=>{t.downloaded&&e({downloading:!1,downloaded:!0,available:!0,progress:null,downloadError:null})});return i&&n.push(i),async()=>{for(let e of n)try{let t=e();t instanceof Promise&&await t}catch{}}},restartToUpdate:async()=>{let{downloaded:n,runtimeType:r,otaDecision:i}=t();if(r===`mobile`&&i?.primaryAction===`apply_ota`){if(!n)return;let t=_()?.mobileUpdates;if(!t){e({error:`Mobile OTA updates are unavailable in this runtime`,otaPhase:`error`});return}try{await t.applyOtaUpdateNow()}catch(t){e({error:t instanceof Error?t.message:`Failed to restart`,otaPhase:`error`})}return}if(!(r!==`desktop`||!n))try{if(!await d())throw Error(`Failed to restart`)}catch(t){e({error:t instanceof Error?t.message:`Failed to restart`})}},setOtaPhase:(t,n=null)=>{e({otaPhase:t,...n===void 0?{}:{error:n}})},setOtaDownloadPercent:n=>{if(!Number.isFinite(n)||n<0||n>100)return;let r=t();if(!r.downloading)return;let i=Math.round(n);if((r.progress?.total?Math.round(r.progress.downloaded/r.progress.total*100):null)===i)return;let a=r.otaDecision?.ota.bundle?.size;if(typeof a==`number`&&Number.isFinite(a)&&a>0){e({progress:{downloaded:Math.round(a*n/100),total:a}});return}e({progress:{downloaded:n,total:100}})},setOtaDownloadFailed:t=>{e({downloading:!1,downloaded:!1,error:t??`Failed to download update`,downloadError:t??`Failed to download update`,otaPhase:`error`})},dismiss:()=>{let n=t();n.otaPhase===`pending_restart`||n.downloading||n.downloadError||e({available:!1,downloaded:!1,info:null,otaDecision:null,otaPhase:`idle`,otaDownloadSkipped:!1})},reset:()=>{e(rt)}}));lt.subscribe((e,t)=>{if(e.downloading===t.downloading&&e.downloaded===t.downloaded&&e.downloadError===t.downloadError&&e.downloadVersion===t.downloadVersion&&e.downloadChannel===t.downloadChannel)return;let n=T();(e.downloading||e.downloadError)&&!e.downloaded&&at(e.downloadVersion)?n.setItem(it,JSON.stringify({version:e.downloadVersion,channel:e.downloadChannel,runtimeType:e.runtimeType})):n.removeItem(it)});var ut=8e3,X=e=>!!(e&&![`succeeded`,`failed`].includes(e.status));function Z(e,t){if(e!==n()||t!==r())throw Error(`Stale update runtime`)}var Q=(e=n(),t=r(),a)=>({queryKey:[e,`host-update`,t,a??`current`],queryFn:async({signal:n})=>{Z(e,t);let r=new AbortController,o=()=>r.abort();n.addEventListener(`abort`,o,{once:!0});let s;try{return await Promise.race([(async()=>{let n=await i(`/api/system/update${a?`?channel=${a}`:``}`,{headers:{Accept:`application/json`},signal:r.signal});if([404,501].includes(n.status))throw Error(`host_update_unsupported`);let o=await n.json();if(Z(e,t),!n.ok&&n.status!==502||typeof o.serverId!=`string`||typeof o.supported!=`boolean`||![`cli`,`electron`].includes(o.host))throw Error(`Host update check failed`);return o})(),new Promise((e,t)=>{s=setTimeout(()=>{r.abort(),t(Error(`host_update_timeout`))},ut)})])}finally{s!==void 0&&clearTimeout(s),n.removeEventListener(`abort`,o)}},staleTime:6e4,retry:!1}),dt=(e=n(),t=r(),i)=>P.getQueryData(Q(e,t,i).queryKey),ft=(e=n(),t=r(),i)=>{let a=dt(e,t,i);return P.fetchQuery({...Q(e,t,i),staleTime:a?.checkError||X(a?.operation)?0:6e4})},pt=(e=n(),t=r(),i)=>P.fetchQuery({...Q(e,t,i),staleTime:0}),mt=(e,t,n)=>{let r=(0,Oe.c)(6),i;r[0]!==n||r[1]!==t||r[2]!==e?(i=Q(e,t,n),r[0]=n,r[1]=t,r[2]=e,r[3]=i):i=r[3];let a;return r[4]===i?a=r[5]:(a={...i,refetchInterval:_t,refetchIntervalInBackground:!1},r[4]=i,r[5]=a),j(a)};async function ht(e,t,n){if(Z(t,n),!e.update)throw Error(`No update plan`);let r=await i(`/api/system/update`,{method:`POST`,headers:{"Content-Type":`application/json`,Accept:`application/json`},body:JSON.stringify({version:e.update.version,channel:e.channel,planId:e.update.planId,allowDowngrade:e.update.rollback===!0})});if(Z(t,n),!r.ok)throw Error(`Host update was not accepted`);let a=await r.json();if(typeof a.operation?.id!=`string`)throw Error(`Invalid update operation`);return a.operation}async function gt(e,t,n){Z(t,n);let r=await pt(t,n,e.channel);Z(t,n);let i=r.operation;if(i?.id===e.id&&i.version===e.version&&i.channel===e.channel&&i.kind===e.kind&&(X(i)||i.status===`succeeded`&&r.currentVersion===e.version))return P.setQueryData(Q(t,n).queryKey,r),i;if(r.checkError||r.update?.version!==e.version||r.update.kind!==e.kind)throw Error(`update_plan_changed`);let a=await ht(r,t,n);return Z(t,n),P.setQueryData(Q(t,n).queryKey,e=>({...e??r,operation:a})),a}function _t(e){return X(e.state.data?.operation)?2e3:e.state.error?.message===`host_update_unsupported`?!1:e.state.error?15e3:3e5}function vt(e){let t=new Date(`${e}T00:00:00`);return Number.isNaN(t.getTime())?e:new Intl.DateTimeFormat(ae(),{year:`numeric`,month:`short`,day:`numeric`}).format(t)}function yt(e){return e.replace(/^## \[[^\]]+\] - \d{4}-\d{2}-\d{2}\s*\n?/,``).trim()}function bt(e){return e.replace(/(^|[^a-zA-Z0-9])@([a-zA-Z0-9-]+)/g,`$1[@$2](https://github.com/$2)`)}function xt(e,t){let n=e.split(`.`).map(e=>Number.parseInt(e,10)),r=t.split(`.`).map(e=>Number.parseInt(e,10));for(let e=0;e<3;e+=1){let t=Number.isFinite(n[e])?n[e]:0,i=Number.isFinite(r[e])?r[e]:0;if(t!==i)return i-t}return 0}function St(e){let t=/^## \[(\d+\.\d+\.\d+)\] - (\d{4}-\d{2}-\d{2})\s*$/gm,n=[],r;for(;(r=t.exec(e))!==null;)n.push({version:r[1]??``,date:r[2]??``,start:r.index});return n.map((t,r)=>{let i=n[r+1]?.start??e.length;return{version:t.version,date:t.date,start:t.start,end:i,raw:e.slice(t.start,i).trim()}})}function Ct(e){let t=(0,Oe.c)(70),{open:n,onOpenChange:r,model:i,onAction:a}=e,{t:o}=oe(),[s,c]=(0,Y.useState)(!1),l=F(Tt),u;t[0]===l?u=t[1]:(u=e=>{let t=e.target.closest(`a`);t?.href&&(e.preventDefault(),e.stopPropagation(),l(t.href))},t[0]=l,t[1]=u);let d=F(u),f;t[2]===i.fallbackCommand?f=t[3]:(f=async()=>{i.fallbackCommand&&(await ie(i.fallbackCommand)).ok&&(c(!0),setTimeout(()=>c(!1),2e3))},t[2]=i.fallbackCommand,t[3]=f);let p=F(f),m;if(t[4]!==i.body||t[5]!==o){bb0:{let e=i.body?.trim();if(!e){m=null;break bb0}let n=St(e);if(!n.length){m={kind:`raw`,title:o(`updateDialog.changelog.title`),content:bt(e)};break bb0}let r;t[7]===o?r=t[8]:(r=o(`updateDialog.changelog.title`),t[7]=o,t[8]=r),m={kind:`sections`,title:r,sections:[...n].sort(wt).map(t=>({version:t.version,dateLabel:vt(t.date),content:bt(yt(t.raw)||e)}))}}t[4]=i.body,t[5]=o,t[6]=m}else m=t[6];let h=m,g=i.dismissible===!1?void 0:r,_=i.stableLayout&&`h-[min(38rem,calc(100dvh-2rem))] overflow-hidden transition-[opacity,transform,filter]`,v;t[9]===_?v=t[10]:(v=z(`max-w-4xl gap-0 p-4 sm:p-5 bg-background border-[var(--interactive-border)]`,_),t[9]=_,t[10]=v);let y;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,H.jsx)(B,{name:`download-cloud`,className:`h-5 w-5 text-[var(--primary-base)]`}),t[11]=y):y=t[11];let b;t[12]===i.title?b=t[13]:(b=(0,H.jsxs)(le,{className:`flex items-center gap-2`,children:[y,(0,H.jsx)(`span`,{className:`font-semibold text-foreground`,children:i.title})]}),t[12]=i.title,t[13]=b);let x;t[14]!==i.currentVersion||t[15]!==i.methodLabel||t[16]!==i.version?(x=(i.currentVersion||i.version)&&(0,H.jsxs)(`div`,{className:`mt-1.5 flex flex-wrap items-center gap-1.5 pl-7 font-mono text-[11px] leading-4 tracking-[-0.01em] tabular-nums sm:text-xs`,children:[i.currentVersion&&(0,H.jsx)(`span`,{className:`text-muted-foreground/75`,children:i.currentVersion}),i.currentVersion&&i.version&&(0,H.jsx)(`span`,{className:`text-muted-foreground/40`,children:`→`}),i.version&&(0,H.jsx)(`span`,{className:`font-medium text-[var(--primary-base)]`,children:i.version}),i.methodLabel&&(0,H.jsxs)(`span`,{className:`text-muted-foreground`,children:[`· `,i.methodLabel]})]}),t[14]=i.currentVersion,t[15]=i.methodLabel,t[16]=i.version,t[17]=x):x=t[17];let S;t[18]===i.description?S=t[19]:(S=i.description&&(0,H.jsx)(ue,{className:`mt-2`,children:i.description}),t[18]=i.description,t[19]=S);let C;t[20]!==S||t[21]!==b||t[22]!==x?(C=(0,H.jsxs)(`div`,{className:`mb-3 shrink-0 pr-8 sm:mb-4`,children:[b,x,S]}),t[20]=S,t[21]=b,t[22]=x,t[23]=C):C=t[23];let w=i.stableLayout?`flex min-h-0 flex-1 flex-col gap-4 overflow-y-auto`:`space-y-3 sm:space-y-4`,T;t[24]===i.message?T=t[25]:(T=i.message&&(0,H.jsx)(`p`,{role:`status`,className:`typography-ui-label text-muted-foreground`,children:i.message}),t[24]=i.message,t[25]=T);let E;t[26]===i.warning?E=t[27]:(E=i.warning&&(0,H.jsx)(`p`,{className:`typography-meta text-[var(--status-warning)]`,children:i.warning}),t[26]=i.warning,t[27]=E);let D;t[28]!==h||t[29]!==d||t[30]!==i.hideChangelog||t[31]!==i.stableLayout?(D=h&&!i.hideChangelog&&(0,H.jsxs)(`section`,{className:z(`overflow-hidden rounded-xl border border-[var(--surface-subtle)] bg-[var(--surface-elevated)]/20`,i.stableLayout&&`flex min-h-0 flex-1 flex-col`),children:[(0,H.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 border-b border-[var(--surface-subtle)] px-3.5 py-2.5 sm:px-4 sm:py-3`,children:[(0,H.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full bg-[var(--primary-base)]`,"aria-hidden":`true`}),(0,H.jsx)(`h3`,{className:`typography-ui-caption font-medium text-muted-foreground`,children:h.title})]}),(0,H.jsx)(se,{className:i.stableLayout?`p-0`:`max-h-[min(42dvh,22rem)] p-0 sm:max-h-[400px]`,outerClassName:i.stableLayout?`flex-1`:void 0,fillContainer:!!i.stableLayout,children:h.kind===`raw`?(0,H.jsx)(`div`,{className:`break-words px-3.5 py-2 text-[13px] leading-[1.65] text-foreground sm:px-4 sm:text-sm [&_.markdown-content]:leading-[1.65] [&_.markdown-content>:first-child]:!mt-0 [&_.markdown-content>:first-child>:first-child]:!mt-0 [&_.markdown-content>:last-child]:!mb-0 [&_a]:!text-[var(--primary-base)] [&_a]:!no-underline [&_a:hover]:!underline`,onClickCapture:d,children:(0,H.jsx)(ye,{content:h.content,disableLinkSafety:!0,enableFileReferences:!1})}):(0,H.jsx)(`div`,{className:`divide-y divide-[var(--surface-subtle)]`,children:h.sections.map(e=>(0,H.jsxs)(`div`,{className:`px-3.5 py-2 sm:px-4`,children:[(0,H.jsxs)(`div`,{className:`mb-2.5 flex flex-wrap items-center gap-x-2 gap-y-1 sm:mb-3`,children:[(0,H.jsxs)(`span`,{className:`rounded-md bg-[var(--primary-base)]/10 px-1.5 py-0.5 font-mono text-[11px] font-medium leading-4 text-[var(--primary-base)] tabular-nums sm:text-xs`,children:[`v`,e.version]}),(0,H.jsx)(`span`,{className:`text-[11px] leading-4 text-muted-foreground/75 sm:text-xs`,children:e.dateLabel})]}),(0,H.jsx)(`div`,{className:`break-words text-[13px] leading-[1.65] text-foreground sm:text-sm [&_.markdown-content]:leading-[1.65] [&_a]:!text-[var(--primary-base)] [&_a]:!no-underline [&_a:hover]:!underline`,onClickCapture:d,children:(0,H.jsx)(ye,{content:e.content,disableLinkSafety:!0,enableFileReferences:!1})})]},e.version))})})]}),t[28]=h,t[29]=d,t[30]=i.hideChangelog,t[31]=i.stableLayout,t[32]=D):D=t[32];let O;t[33]!==s||t[34]!==p||t[35]!==i.fallbackCommand||t[36]!==o?(O=i.fallbackCommand&&(0,H.jsxs)(`div`,{className:`space-y-2 mt-4`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2 typography-meta text-muted-foreground`,children:[(0,H.jsx)(B,{name:`terminal`,className:`h-4 w-4`}),(0,H.jsx)(`span`,{children:o(`updateDialog.fallback.updateViaTerminal`)})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-2 p-1 pl-3 bg-[var(--surface-elevated)]/50 rounded-md border border-[var(--surface-subtle)]`,children:[(0,H.jsx)(`code`,{className:`flex-1 font-mono text-sm text-foreground overflow-x-auto whitespace-nowrap`,children:i.fallbackCommand}),(0,H.jsx)(`button`,{onClick:p,className:z(`flex items-center justify-center p-2 rounded`,`text-muted-foreground hover:text-foreground hover:bg-[var(--interactive-hover)]`,`transition-colors`,s&&`text-[var(--status-success)]`),title:o(s?`updateDialog.actions.copied`:`updateDialog.actions.copyCommand`),children:(0,H.jsx)(B,{name:s?`check`:`clipboard`,className:`h-4 w-4`})})]})]}),t[33]=s,t[34]=p,t[35]=i.fallbackCommand,t[36]=o,t[37]=O):O=t[37];let k;t[38]!==i.stableLayout||t[39]!==i.status?(k=i.status&&(0,H.jsxs)(`div`,{role:`status`,className:z(`space-y-2`,i.stableLayout&&`min-h-9 shrink-0`),children:[(0,H.jsxs)(`div`,{className:`flex h-5 items-center justify-between gap-3`,children:[(0,H.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2 text-xs font-medium text-muted-foreground sm:text-[13px]`,children:[i.status.kind===`activity`&&(0,H.jsx)(B,{name:`loader`,className:`h-3.5 w-3.5 shrink-0 animate-spin text-[var(--primary-base)]`}),(0,H.jsx)(`span`,{className:`truncate`,title:i.status.label,children:i.status.label})]}),i.status.progress!=null&&(0,H.jsxs)(`span`,{className:`shrink-0 font-mono text-[11px] leading-4 text-foreground tabular-nums sm:text-xs`,children:[Math.round(i.status.progress),`%`]})]}),(0,H.jsx)(`div`,{className:`h-1 overflow-hidden rounded-full bg-[var(--surface-subtle)] sm:h-1.5`,children:i.status.progress==null?(0,H.jsx)(`div`,{className:`h-full w-1/3 animate-pulse rounded-full bg-[var(--primary-base)]/60`}):(0,H.jsx)(`div`,{className:`h-full rounded-full bg-[var(--primary-base)] transition-[width] duration-500`,style:{width:`${i.status.progress}%`}})}),i.status.detail&&(0,H.jsx)(`p`,{className:`text-xs leading-4 text-muted-foreground`,children:i.status.detail})]}),t[38]=i.stableLayout,t[39]=i.status,t[40]=k):k=t[40];let A;t[41]===i.error?A=t[42]:(A=i.error&&(0,H.jsx)(`div`,{role:`alert`,className:`p-3 mt-4 bg-[var(--status-error-background)] border border-[var(--status-error-border)] rounded-lg`,children:(0,H.jsx)(`p`,{className:`text-sm text-[var(--status-error)]`,children:i.error})}),t[41]=i.error,t[42]=A);let j;t[43]!==w||t[44]!==T||t[45]!==E||t[46]!==D||t[47]!==O||t[48]!==k||t[49]!==A?(j=(0,H.jsxs)(`div`,{className:w,children:[T,E,D,O,k,A]}),t[43]=w,t[44]=T,t[45]=E,t[46]=D,t[47]=O,t[48]=k,t[49]=A,t[50]=j):j=t[50];let M;t[51]===i.option?M=t[52]:(M=i.option&&(0,H.jsxs)(`div`,{className:z(`mt-4 flex shrink-0 items-start gap-2.5`,i.option.disabled&&`opacity-60`),children:[(0,H.jsx)(be,{checked:i.option.checked,onChange:i.option.onChange,disabled:i.option.disabled,ariaLabel:i.option.label,className:`mt-0.5 self-start`}),(0,H.jsxs)(`span`,{className:z(`min-w-0 space-y-0.5`,i.option.disabled?`cursor-not-allowed`:`cursor-pointer`),onClick:i.option.disabled?void 0:()=>i.option?.onChange(!i.option.checked),children:[(0,H.jsx)(`span`,{className:`block typography-ui-label text-foreground`,children:i.option.label}),i.option.hint&&(0,H.jsx)(`span`,{className:`block typography-meta text-muted-foreground`,children:i.option.hint})]})]}),t[51]=i.option,t[52]=M);let N;t[53]===i.notice?N=t[54]:(N=i.notice&&(0,H.jsxs)(`div`,{className:`mt-4 flex items-center gap-2 rounded-lg border border-[var(--status-success-border)] bg-[var(--status-success-background)] px-3 py-2.5 text-sm text-[var(--status-success)]`,children:[(0,H.jsx)(B,{name:`check`,className:`h-4 w-4 shrink-0`}),(0,H.jsx)(`span`,{children:i.notice})]}),t[53]=i.notice,t[54]=N);let P;t[55]!==i.actions||t[56]!==i.releaseLink||t[57]!==a?(P=(i.releaseLink||i.actions.length>0)&&(0,H.jsxs)(`div`,{className:`mt-4 flex shrink-0 items-center justify-between gap-4`,children:[i.releaseLink&&(0,H.jsxs)(`a`,{href:i.releaseLink.url,target:`_blank`,rel:`noopener noreferrer`,className:`flex items-center gap-1.5 typography-ui-label text-muted-foreground hover:text-foreground transition-colors shrink-0`,children:[(0,H.jsx)(B,{name:`external-link`,className:`h-4 w-4`}),i.releaseLink.label]}),(0,H.jsx)(`div`,{className:`flex min-w-0 flex-1 flex-nowrap items-center justify-end gap-2`,children:i.actions.map(e=>(0,H.jsxs)(ne,{onClick:()=>a(e.id),disabled:e.disabled,variant:e.variant??`default`,size:`default`,className:`min-w-0 shrink`,title:e.label,children:[e.icon&&(0,H.jsx)(B,{name:e.icon,className:z(`h-4 w-4`,e.loading&&`animate-spin`)}),(0,H.jsx)(`span`,{className:`truncate`,children:e.label})]},e.id))})]}),t[55]=i.actions,t[56]=i.releaseLink,t[57]=a,t[58]=P):P=t[58];let I;t[59]!==C||t[60]!==j||t[61]!==M||t[62]!==N||t[63]!==P||t[64]!==v?(I=(0,H.jsxs)(ce,{className:v,showCloseButton:!0,children:[C,j,M,N,P]}),t[59]=C,t[60]=j,t[61]=M,t[62]=N,t[63]=P,t[64]=v,t[65]=I):I=t[65];let L;return t[66]!==n||t[67]!==I||t[68]!==g?(L=(0,H.jsx)(de,{open:n,onOpenChange:g,children:I}),t[66]=n,t[67]=I,t[68]=g,t[69]=L):L=t[69],L}function wt(e,t){return xt(e.version,t.version)}function Tt(e){ee(e)}var Et=`https://github.com/yee94/yuri/releases`,Dt=2e3,Ot=6e5,$=e=>e.transport===n()&&e.generation===r();async function kt(e,t){try{if(!$(t))return{success:!1};let n=await ft(t.transport,t.generation);return!$(t)||!e||!n.supported||n.update?.version!==e||n.update.rollback?{success:!1}:(await ht(n,t.transport,t.generation),{success:!0,autoRestart:!0})}catch(e){return{success:!1,error:e instanceof Error?e.message:void 0}}}async function At(e,t){let n;try{n=await ft(t.transport,t.generation)}catch(e){if(e instanceof Error&&e.message===`host_update_unsupported`)return!1;throw e}if(!$(t))throw Error(`Stale update runtime`);return!e||!n.supported||!n.update||n.update.rollback||n.update.version!==e?!1:(await ht(n,t.transport,t.generation),!0)}async function jt(e,t,n=Math.ceil(Ot/Dt),r=Dt){for(let i=0;i<n;i++){if(!$(t))return!1;try{let n=await pt(t.transport,t.generation);if(n.operation?.status===`failed`)return!1;if(n.currentVersion===e&&n.operation?.status===`succeeded`&&$(t))return!0}catch{}await new Promise(e=>setTimeout(e,r))}return!1}var Mt=({open:e,onOpenChange:t,info:i,downloading:a,downloaded:o,progress:l,error:u,onDownload:d,onRestart:f,runtimeType:p=`desktop`})=>{let{t:m}=oe(),[h,g]=(0,Y.useState)(`idle`),[_,v]=(0,Y.useState)(null),[y,b]=(0,Y.useState)(!0),x=lt(e=>e.otaDownloadSkipped),S=i?.releaseUrl||(i?.version?`${Et}/tag/v${i.version}`:Et),C=i?.downloadUrl,w=p===`web`,T=p===`mobile`,E=T&&i?.manualUpdate===!0&&!!C,D=T&&i?.inAppApply===!0,O=p===`desktop`&&i?.manualUpdate===!0,k=h!==`idle`&&h!==`error`,A=p===`desktop`&&!O&&c()&&!s(),j=A&&k,M=T?C:S,N=F(e=>{!e&&D&&o&&lt.getState().dismiss(),t(e)});(0,Y.useEffect)(()=>{e||(g(`idle`),v(null))},[e]);let P=F(async()=>{let e={transport:n(),generation:r()};g(`updating`),v(null);let t=await kt(i?.version,e);if(!$(e))return;if(!t.success){g(`error`),v(t.error||m(`updateDialog.error.updateFailed`));return}t.autoRestart&&(g(`restarting`),await new Promise(e=>setTimeout(e,2e3))),g(`reconnecting`);let a=await jt(i?.version,e);$(e)&&(a?window.location.reload():(g(`error`),v(m(`updateDialog.error.takingLonger`))))}),I=F(async()=>{if(!A||!y){f();return}let e={transport:n(),generation:r()};g(`updating`),v(null);try{if(await At(i?.version,e)){if(!$(e))return;if(g(`reconnecting`),!await jt(i?.version,e)){$(e)&&(g(`error`),v(m(`updateDialog.error.remoteUpdateFailed`)));return}}}catch{$(e)&&(g(`error`),v(m(`updateDialog.error.remoteUpdateFailed`)));return}$(e)&&(g(`idle`),f())}),L=F(e=>{switch(e){case`download`:d();break;case`restart`:I();break;case`later`:lt.getState().dismiss(),t(!1);break;case`open-external`:{let e=T?C:S;e&&ee(e);break}case`web-update`:P()}}),R=[];!w&&(!T||D)&&(!O&&!o&&!a&&R.push({id:`download`,icon:`download`,label:m(D?`updateDialog.actions.applyOtaNow`:`updateDialog.actions.downloadUpdate`)}),O&&!o&&!a&&R.push({id:`open-external`,icon:`external-link`,label:m(`updateDialog.actions.openMobileUpdate`)}),a&&R.push({id:`downloading`,icon:`loader`,loading:!0,disabled:!0,label:m(`updateDialog.status.downloading`)}),o&&(D&&R.push({id:`later`,variant:`ghost`,label:m(`updateDialog.actions.later`)}),R.push(j?{id:`updating`,icon:`loader`,loading:!0,disabled:!0,label:m(`updateDialog.status.updating`)}:{id:`restart`,icon:`restart`,label:m(`updateDialog.actions.restartToUpdate`)}))),T&&!D&&E&&R.push({id:`open-external`,icon:`external-link`,label:m(`updateDialog.actions.openMobileUpdate`)}),w&&R.push(k?{id:`updating`,icon:`loader`,loading:!0,disabled:!0,label:m(`updateDialog.status.updating`)}:{id:`web-update`,icon:`download`,label:m(`updateDialog.actions.updateNow`)});let te={title:m(h===`restarting`||h===`reconnecting`?`updateDialog.header.updating`:`updateDialog.header.updateAvailable`),currentVersion:i?.currentVersion,version:i?.version,body:i?.body,hideChangelog:k,dismissible:!k,option:A&&o?{label:m(`updateDialog.remote.syncLabel`),hint:m(`updateDialog.remote.syncHint`),checked:y,disabled:j,onChange:b}:void 0,error:u||_,fallbackCommand:w&&h===`error`?i?.updateCommand||`yuri update`:void 0,notice:D&&o&&x?m(`updateDialog.status.otaBundleReused`):void 0,releaseLink:(!T||E)&&M?{url:M,label:`GitHub`}:void 0,actions:R};return w&&k&&(te.status={kind:`activity`,label:m(h===`updating`?`updateDialog.status.installingUpdate`:h===`restarting`?`updateDialog.status.serverRestarting`:`updateDialog.status.waitingForServer`),detail:m(`updateDialog.status.autoReloadHint`)}),j&&(te.status={kind:`activity`,label:m(`updateDialog.status.updatingRemote`)}),!w&&(!T||D)&&a&&(te.status={kind:`download`,label:m(`updateDialog.status.downloadingPayload`),progress:l?.total?Math.round(l.downloaded/l.total*100):0}),(0,H.jsx)(Ct,{open:e,onOpenChange:N,model:te,onAction:L})};function Nt(e,t){return e===`checking`?5:e===`downloading`?5+Math.min(Math.max(t??0,0),100)*.75:e===`installing`?85:e===`restarting`?95:100}function Pt(e,t,n){let r=e?.operation,i=e?.update,a=i??(r&&t.updateDetails&&r.planId===t.updateDetails.planId&&r.version===t.updateDetails.version?t.updateDetails:void 0),o=X(r),s=e?.supported===!1||t.failure===`unsupported`,c={title:n(`settings.yuri.about.hostUpdate.title`),stableLayout:!0,description:n(`settings.yuri.about.hostUpdate.description`),currentVersion:e?.currentVersion??t.versionFallback,version:i?.version??r?.version,body:a||r?a?.releaseNotes||n(`settings.yuri.about.hostUpdate.noNotes`):void 0,warning:!o&&i?.rollback?n(`settings.yuri.about.hostUpdate.downgrade`):void 0,actions:o||t.submitting||t.completed||!i?[]:[{id:`confirm`,icon:`download`,label:n(`settings.yuri.about.hostUpdate.confirm`),disabled:!e?.supported||!!t.failure||!!t.checking}]};return o&&r?c.status={kind:r.status===`downloading`?`download`:`activity`,label:n(t.failure===`disconnected`?`settings.yuri.about.hostUpdate.reconnecting`:`settings.yuri.about.hostUpdate.status.${r.status}`),progress:Nt(r.status,r.progress)}:t.completed&&!i?c.status={kind:`download`,label:n(`settings.yuri.about.hostUpdate.status.succeeded`),progress:100}:t.submitting?c.status={kind:`activity`,label:n(`settings.yuri.about.state.checking`),progress:0}:t.checking===`initial`?c.status={kind:`activity`,label:n(`settings.yuri.about.state.checking`)}:s?c.message=n(`settings.yuri.about.hostUpdate.unsupported`):t.failure?c.error=n(t.failure===`disconnected`?`settings.yuri.about.hostUpdate.reconnecting`:`settings.yuri.about.toast.checkFailed`):!i&&e?.supported&&(c.message=r?.status===`succeeded`?n(`settings.yuri.about.hostUpdate.status.succeeded`):n(`settings.yuri.about.toast.latestVersion`)),r?.status===`failed`&&(c.error=n(`settings.yuri.about.hostUpdate.status.failed`)),c}function Ft(){let e=(0,Oe.c)(7),{t:i}=oe(),a=Y.useSyncExternalStore(t,n,n),o=Y.useSyncExternalStore(t,r,r),s=`${a}:${o}`,c;e[0]===i?c=e[1]:(c=i(`settings.yuri.about.state.unknown`),e[0]=i,e[1]=c);let l;return e[2]!==o||e[3]!==s||e[4]!==c||e[5]!==a?(l=(0,H.jsx)(It,{transport:a,generation:o,version:c},s),e[2]=o,e[3]=s,e[4]=c,e[5]=a,e[6]=l):l=e[6],l}function It({version:e,transport:t,generation:i,itemId:a,channel:o}){let{t:s}=oe(),c=M(),[l,u]=Y.useState(!1),d=L(e=>e.otaChannelOverride),f=o??d??void 0,p=mt(t,i,f),m=p.data,h=m?.operation,g=X(h),_=JSON.stringify([t,i,f??`current`]),[v,y]=Y.useState(null);m?.update&&(v?.scope!==_||v.update!==m.update)&&y({scope:_,update:m.update});let b=A({mutationFn:({plan:e})=>ht(e,t,i),onSuccess:(e,a)=>{t===n()&&i===r()&&c.setQueryData(Q(t,i,a.channel).queryKey,t=>t&&{...t,operation:e})},onSettled:(e,a,o)=>{t===n()&&i===r()&&c.invalidateQueries({queryKey:Q(t,i,o.channel).queryKey,exact:!0})}}),[x,S]=Y.useState(null);l&&g&&h&&h.id!==x&&S(h.id);let C=h?.status===`succeeded`&&h.id===x,w=s(`settings.yuri.about.hostUpdate.status.succeeded`);Y.useEffect(()=>{!C||p.isError||t!==n()||i!==r()||(S(null),u(!1),re.success(w,{id:`host-update:${t}:${i}:${x}`}))},[C,p.isError,t,i,x,w]);let T=Y.useRef(null),E=F(()=>_),D=F(async()=>{if(g){u(!0),p.refetch({cancelRefetch:!1});return}if(T.current===_)return;let e=_;T.current=e;try{let a=await p.refetch({cancelRefetch:!1});if(e!==E()||t!==n()||i!==r())return;if(a.isError||!a.data||a.data.checkError){a.error?.message===`host_update_unsupported`?re.info(s(`settings.yuri.about.hostUpdate.unsupported`)):re.error(s(`settings.yuri.about.toast.checkFailed`));return}X(a.data.operation)?u(!0):a.data.supported?a.data.update?u(!0):(u(!1),re.success(s(`settings.yuri.about.toast.latestVersion`))):re.info(s(`settings.yuri.about.hostUpdate.unsupported`))}finally{T.current===e&&(T.current=null)}}),O=m?.supported===!1||!g&&p.error?.message===`host_update_unsupported`,k=p.isError||!!m?.checkError,j=b.isError&&b.variables?.channel===f,N=Pt(m,{versionFallback:e,checking:p.isPending?`initial`:p.isFetching?`refresh`:!1,submitting:b.isPending,failure:O?`unsupported`:p.isError&&(g||j)?`disconnected`:k||j?`check`:null,completed:C,updateDetails:v?.scope===_?v.update:void 0},s),P=F(e=>{e===`confirm`&&m?.update&&b.mutate({plan:m,channel:f})});return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,"data-settings-item":a,children:[(0,H.jsxs)(`span`,{className:`relative typography-ui-label font-mono text-foreground text-right`,children:[m?.currentVersion??e,m?.update&&!g&&(0,H.jsx)(`span`,{"aria-label":s(`settings.yuri.about.hostUpdate.available`),className:`absolute -right-1.5 -top-0.5 size-1.5 rounded-full bg-[var(--status-error)]`})]}),(0,H.jsx)(ne,{type:`button`,size:`icon`,variant:`ghost`,onClick:D,disabled:p.isFetching&&!g,"aria-label":s(`settings.yuri.about.hostUpdate.title`),title:s(`settings.yuri.about.hostUpdate.title`),children:(0,H.jsx)(B,{name:g||p.isFetching?`loader`:m?.update?`download`:`refresh`,className:g||p.isFetching?`size-4 animate-spin`:`size-4`})})]}),(0,H.jsx)(Ct,{open:l,onOpenChange:u,model:N,onAction:P})]})}var Lt=e=>e.startsWith(`/`)||/^[A-Za-z]:[\\/]/.test(e),Rt=e=>{let t=e.replace(/\\/g,`/`),n=[],[r,...i]=t.split(`/`);for(let e of i)if(e!==``&&e!==`.`){if(e===`..`){n.pop();continue}n.push(e)}return`${/^[A-Za-z]:$/.test(r)?`${r.toUpperCase()}/`:`/`}${n.join(`/`)}`},zt=e=>Rt(`${e.replace(/\\/g,`/`)}/..`),Bt=e=>{try{let t=decodeURIComponent(new URL(e).pathname);return/^\/[A-Za-z]:\//.test(t)?t.slice(1):t}catch{return null}};function Vt(e,t){if(e.startsWith(`file://`)){let t=Bt(e);return t?{kind:`local`,path:Rt(t)}:null}return e.startsWith(`./`)||e.startsWith(`../`)?t?{kind:`local`,path:Rt(`${zt(t)}/${e}`)}:null:Lt(e)?{kind:`local`,path:Rt(e)}:{kind:`package`,target:e}}function Ht(e){return e?{kind:`local`,path:Rt(e)}:null}var Ut=(e,t)=>{if(e.kind===`package`)return t.source.kind===`package`&&t.source.target===e.target;if(t.source.kind!==`local`)return!1;let n=Rt(t.source.path);return n===e.path||n.startsWith(`${e.path}/`)};function Wt(e,t){return t.filter(t=>Ut(e,t))}function Gt(e){for(let t of e)if(t.state.kind===`active`&&t.source.kind===`package`&&t.source.version?.trim())return t.source.version.trim();return null}function Kt(e){let t=e.find(e=>e.state.kind===`failed`);if(t&&t.state.kind===`failed`)return{kind:`failed`,error:t.state.error,ref:t.state.ref};let n=e[0];return n?{kind:`active`,version:n.source.kind===`package`?n.source.version:null}:{kind:`notReported`}}function qt(e){let t=e.flatMap(e=>e.source.kind===`package`?[e.source]:[]);return t.some(e=>e.updating)?`updating`:t.some(e=>e.outdated)?`available`:`none`}function Jt(){let e=(0,Oe.c)(5),t=Ee(),n=De(),r=t.data?.entries,i=t.data?.files,a=n.data,o;bb0:{if(!a){let t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=[],e[0]=t):t=e[0],o=t;break bb0}let t;if(e[1]!==r||e[2]!==i||e[3]!==a){t=[];let n=(e,n,r)=>{if(!r)return;let i=Kt(Wt(r,a));i.kind===`failed`&&t.push({id:e,label:n,error:i.error})};for(let e of r??[])n(e.id,e.spec,Vt(e.spec,e.sourcePath));for(let e of i??[])n(e.id,e.fileName,Ht(e.absolutePath));e[1]=r,e[2]=i,e[3]=a,e[4]=t}else t=e[4];o=t}return o}var Yt=e=>e instanceof Error&&e.name===`CancelledError`,Xt=v(()=>({setStatus:e=>xe(P,e),refreshStatus:async(e,t)=>{let r=n();t?.force&&await P.cancelQueries({queryKey:N.github.auth(r),exact:!0});try{return await Ce(P,e,r)}catch(e){if(Yt(e))return Se(P,r);throw e}}})),Zt=v()(b(y((e,t)=>({selectedProfileId:null,defaultGitIdentityId:null,profiles:[],globalIdentity:null,discoveredCredentials:[],isLoading:!1,setSelectedProfile:t=>{e({selectedProfileId:t})},loadProfiles:async()=>{e({isLoading:!0});let n=t().profiles;try{return e({profiles:await me(),isLoading:!1}),!0}catch(t){return console.error(`Failed to load git identity profiles:`,t),e({profiles:n,isLoading:!1}),!1}},loadGlobalIdentity:async()=>{try{let t=await ve();return t&&t.userName&&t.userEmail?e({globalIdentity:{id:`global`,name:`Global Identity`,userName:t.userName,userEmail:t.userEmail,authType:t.sshCommand?`ssh`:void 0,sshKey:t.sshCommand?t.sshCommand.replace(`ssh -i `,``):null,color:`info`,icon:`house`}}):e({globalIdentity:null}),!0}catch(t){return console.error(`Failed to load global git identity:`,t),e({globalIdentity:null}),!1}},loadDiscoveredCredentials:async()=>{try{return e({discoveredCredentials:await pe()}),!0}catch(t){return console.error(`Failed to discover git credentials:`,t),e({discoveredCredentials:[]}),!1}},loadDefaultGitIdentityId:async()=>{let t=e=>{if(typeof e!=`string`)return null;let t=e.trim();return t.length>0?t:null};try{let n=null;if(n===null){let e=_()?.settings;if(e)try{n=t(((await e.load())?.settings||{}).defaultGitIdentityId)}catch{}}if(n===null)try{let e=await i(`/api/config/settings`,{method:`GET`,headers:{Accept:`application/json`}});e.ok&&(n=t((await e.json().catch(()=>null))?.defaultGitIdentityId))}catch{}return e({defaultGitIdentityId:n}),!0}catch(e){return console.error(`Failed to load default git identity setting:`,e),!1}},setDefaultGitIdentityId:async t=>{try{let n=typeof t==`string`?t.trim():``,r=n.length>0?n:``;return await C({defaultGitIdentityId:r}),e({defaultGitIdentityId:r.length>0?r:null}),!0}catch(e){return console.error(`Failed to save default git identity setting:`,e),!1}},createProfile:async e=>{try{let n={...e,id:e.id||`profile-${Date.now()}-${Math.random().toString(36).substring(2,9)}`,color:e.color||`keyword`,icon:e.icon||`branch`};return await ge(n),await t().loadProfiles(),!0}catch(e){return console.error(`Failed to create git identity profile:`,e),!1}},updateProfile:async(e,n)=>{try{let r=t().profiles.find(t=>t.id===e);if(!r)throw Error(`Profile not found`);let i={...r,...n};return await he(e,i),await t().loadProfiles(),!0}catch(e){return console.error(`Failed to update git identity profile:`,e),!1}},deleteProfile:async n=>{try{return await _e(n),t().selectedProfileId===n&&e({selectedProfileId:null}),await t().loadProfiles(),!0}catch(e){return console.error(`Failed to delete git identity profile:`,e),!1}},getProfileById:e=>{let{profiles:n,globalIdentity:r}=t();return e===`global`?r||void 0:n.find(t=>t.id===e)},getUnimportedCredentials:()=>{let{profiles:e,discoveredCredentials:n}=t();return n.filter(t=>!e.some(e=>e.authType===`token`&&e.host===t.host))}}),{name:`git-identities-store`,storage:E(),partialize:e=>({selectedProfileId:e.selectedProfileId})}),{name:`git-identities-store`}));typeof window<`u`&&(window.__zustand_git_identities_store__=Zt);var Qt=(e,t)=>e?t.kind===e.kind?t.projectRoot.length===e.projectRoot.length?t.projectId.localeCompare(e.projectId)<0:t.projectRoot.length>e.projectRoot.length:t.kind===`project`:!0,$t=(e,t,n)=>{Qt(e.get(t),n)&&e.set(t,n)},en=e=>{let t=e;return O(t.directory)??O(t.project?.worktree)},tn=e=>{if(e===`/`||/^[A-Z]:$/.test(e))return null;let t=e.lastIndexOf(`/`);return t<0?null:t===0?`/`:t===2&&/^[A-Z]:\//.test(e)?e.slice(0,2):e.slice(0,t)},nn=(e,t,n,r,i=[])=>{let a=new Map,o=new Map;for(let e of t){let t=O(e.normalizedPath);if(!t)continue;let n=o.get(t);(!n||e.id.localeCompare(n.id)<0)&&o.set(t,e),$t(a,t,{projectId:e.id,projectRoot:t,scopeDirectory:t,kind:`project`})}if(!r)for(let[e,t]of n){let n=O(e),r=n?o.get(n):void 0;if(!(!r||!n))for(let e of t){let t=O(e.path);t&&$t(a,t,{projectId:r.id,projectRoot:n,scopeDirectory:t,kind:`worktree`})}}let s=new Map,c=new Map,l=new Map,u=new Map,d=new Map,f=e=>{if(!e)return null;if(s.has(e))return s.get(e)??null;if(r){let t=a.get(e)??null;return s.set(e,t),t}let t=[],n=e,i=null;for(;n;){if(s.has(n)){i=s.get(n)??null;break}if(t.push(n),i=a.get(n)??null,i)break;n=tn(n)}for(let e of t)s.set(e,i);return i},p=(e,t,n)=>{for(let r of e){let e=f(en(r));if(!e)continue;c.set(r.id,e);let i=t.get(e.projectId);if(i?i.push(r):t.set(e.projectId,[r]),!n)continue;let a=n.get(e.scopeDirectory);a?a.add(r.id):n.set(e.scopeDirectory,new Set([r.id]))}};return p(e,l,d),p(i,u),{bySessionId:c,sessionsByProject:l,archivedSessionsByProject:u,sessionsByScope:d,directoryResolutions:s.size}};export{lt as _,Vt as a,Gt as c,Ft as d,It as f,gt as g,X as h,Jt as i,Kt as l,Q as m,Zt as n,Wt as o,Mt as p,Xt as r,Ht as s,nn as t,qt as u,Ne as v,ke as y};