@yuriai/web 0.3.4 → 0.3.6-beta.5

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 (293) hide show
  1. package/dist/assets/AgentAvatar-BaKbuiEG.js +1 -0
  2. package/dist/assets/AgentSelector-BXLvdwk0.js +1 -0
  3. package/dist/assets/ArchivedSessionsDialog-wIl8A7HL.js +1 -0
  4. package/dist/assets/AssistantConversationSurface-DRwJ4zWe.js +3 -0
  5. package/dist/assets/AssistantSessionCard-D1AZs8JQ.js +2 -0
  6. package/dist/assets/AssistantUnreadBadge-4aoNcXVG.js +1 -0
  7. package/dist/assets/AssistantView-CG0DnE1H.js +1 -0
  8. package/dist/assets/AssistantWorkingAvatar-uOBMRhP_.js +1 -0
  9. package/dist/assets/AssistantsSettingsPage-DIWJVEf8.js +1 -0
  10. package/dist/assets/BinaryFileFallback-BH_-EIjs.js +1 -0
  11. package/dist/assets/BtwPanel-DRdap4Qu.js +6 -0
  12. package/dist/assets/BusyDots-BGjLnIPh.js +4 -0
  13. package/dist/assets/ChatContainer-BtfbvM1R.js +65 -0
  14. package/dist/assets/ChatView-CUwLwCFl.js +3 -0
  15. package/dist/assets/{DiagramView-DGnmjS2b.js → DiagramView-CRZFpG4-.js} +1 -1
  16. package/dist/assets/{DiffView-Bbit6OZ8.js → DiffView-4Z0aCFfu.js} +2 -2
  17. package/dist/assets/DiffViewToggle-DYSI03aW.js +1 -0
  18. package/dist/assets/ErrorBoundary-CinEsvgD.js +1 -0
  19. package/dist/assets/FadeInOnReveal-P-c7VO7Q.js +1 -0
  20. package/dist/assets/{GuiPluginMount-TC5FELtQ.js → GuiPluginMount-DtJaOBdU.js} +1 -1
  21. package/dist/assets/GuiPluginPage-DSeGfoT6.js +1 -0
  22. package/dist/assets/GuiPluginSurface-357Sz83f.js +1 -0
  23. package/dist/assets/GuiPluginTitlebarItems-XIPpX6DU.js +1 -0
  24. package/dist/assets/{GuiPluginWindow-BkAFJyFd.js → GuiPluginWindow-ICodvkoO.js} +1 -1
  25. package/dist/assets/Icon-CeG6IExS.js +1 -0
  26. package/dist/assets/ImageLoadingPlaceholder-zzKCgcZz.js +1 -0
  27. package/dist/assets/{LoadingImage-Df22Rkor.js → LoadingImage-B4Icoej_.js} +1 -1
  28. package/dist/assets/MarkdownRenderer-Bjm6Wld2.js +2 -0
  29. package/dist/assets/{MarkdownRendererImpl-D8q0FMnr.js → MarkdownRendererImpl-BdOA-vAV.js} +1 -1
  30. package/dist/assets/MarkstreamRendererImpl-j30G11Dc.js +3 -0
  31. package/dist/assets/{MobileAssistantSettingsPage-Dgq5FMho.js → MobileAssistantSettingsPage-CGK1ceah.js} +1 -1
  32. package/dist/assets/MobileAssistantTab-ZugumKSY.js +1 -0
  33. package/dist/assets/{MobileBtwPage-DQUkSO6N.js → MobileBtwPage-afopNi2T.js} +1 -1
  34. package/dist/assets/{MobileChangesSurface-DsYNmAuM.js → MobileChangesSurface-C3mhr7en.js} +2 -2
  35. package/dist/assets/MobileChatScreen-ByOiuFAV.js +1 -0
  36. package/dist/assets/MobileDetailNavigation-IQDDP6TO.js +1 -0
  37. package/dist/assets/MobileFilesSurface-Bia8vPcg.js +2 -0
  38. package/dist/assets/MobileHtmlNetworkBoundary-DCiTI-t-.js +2 -0
  39. package/dist/assets/MobileOverlayPanel-D0W5tjrd.js +1 -0
  40. package/dist/assets/MobileResizableSheet-0fdiGkg0.js +1 -0
  41. package/dist/assets/{MobileSettingsTab-DaTtRHo1.js → MobileSettingsTab-iPLVIfcN.js} +1 -1
  42. package/dist/assets/{MobileShareBridge-CZpFYmiy.js → MobileShareBridge-DzcR4Knr.js} +1 -1
  43. package/dist/assets/MobileSurface-B1fG72a-.js +1 -0
  44. package/dist/assets/MobileTabPageHeader-BFKAUrAU.js +1 -0
  45. package/dist/assets/ModelLogo-CYR-ynHM.js +1 -0
  46. package/dist/assets/ModelSelector-B3h2Xy64.js +1 -0
  47. package/dist/assets/MultiRunWindow-C8S7H7Md.js +1 -0
  48. package/dist/assets/OnboardingScreen-D7fZQm8c.js +1 -0
  49. package/dist/assets/OverlayScrollbar-C5v7GRZi.js +1 -0
  50. package/dist/assets/{PierreDiffViewer-DVKsdwJR.js → PierreDiffViewer-CxRfGY_b.js} +3 -3
  51. package/dist/assets/ProviderLogo-zqjvjfIK.js +1 -0
  52. package/dist/assets/{RemoteAssistantSessionCard-DAoFvZht.js → RemoteAssistantSessionCard-B284CHHf.js} +1 -1
  53. package/dist/assets/RemoteDesktopPanel-CREalB4m.js +1 -0
  54. package/dist/assets/ScheduledTasksDialog-YAy5JZVs.js +3 -0
  55. package/dist/assets/ScrollableOverlay-BGOUZmbS.js +1 -0
  56. package/dist/assets/SettingsGroup-BoEy2EFq.js +1 -0
  57. package/dist/assets/{SettingsView-DEU94-h1.js → SettingsView-cLTUC0DF.js} +13 -13
  58. package/dist/assets/SettingsWindow-Kp2ClVgJ.js +1 -0
  59. package/dist/assets/SetupTourDialog-DNb6i2Z1.js +1 -0
  60. package/dist/assets/{SyncActions-CrOoREWF.js → SyncActions-D7uIFrJB.js} +1 -1
  61. package/dist/assets/TerminalView-viydTW0Q.js +8 -0
  62. package/dist/assets/TextSelectionMenu-B3RIGNm7.js +11 -0
  63. package/dist/assets/{ToolOutputDialog-DpaaQ1uZ.js → ToolOutputDialog-CoGamWCH.js} +1 -1
  64. package/dist/assets/{YuriLogo-Cp6vWDWp.js → YuriLogo-_1Inxw8P.js} +1 -1
  65. package/dist/assets/{YuriWordmark-CLGHwobA.js → YuriWordmark-CW53XKgV.js} +1 -1
  66. package/dist/assets/{assistant-attachment-cache-bRIIESGe.js → assistant-attachment-cache-eNT2QtmP.js} +1 -1
  67. package/dist/assets/assistantMessagePreview-CDdckvGJ.js +1 -0
  68. package/dist/assets/assistantQueries-DKqpPYqd.js +1 -0
  69. package/dist/assets/{auto-read-context-ClBUErN2.js → auto-read-context-G7T0GxFZ.js} +1 -1
  70. package/dist/assets/{capgoAdapter-pfQJmvW2.js → capgoAdapter-Cu4rw1AP.js} +1 -1
  71. package/dist/assets/card-BBxZ1WhJ.js +1 -0
  72. package/dist/assets/chatUpwardIntent-DmVhPEhT.js +1 -0
  73. package/dist/assets/checkbox-D9uVg1CM.js +1 -0
  74. package/dist/assets/{client-B_907PBv.js → client-ITylDDCS.js} +1 -1
  75. package/dist/assets/collapsible-_BAnUguY.js +1 -0
  76. package/dist/assets/{connection-hint-B-kOWome.js → connection-hint-BnhKxvRb.js} +1 -1
  77. package/dist/assets/context-menu-j9GOycjo.js +1 -0
  78. package/dist/assets/diagram-B4DOrQoy.js +1 -0
  79. package/dist/assets/dialog-CZlghHCF.js +1 -0
  80. package/dist/assets/dropdown-menu-C-MjrLjA.js +1 -0
  81. package/dist/assets/{es-DqYZgeC6.js → es-BxH-QWNw.js} +1 -1
  82. package/dist/assets/{fileMentionTouchSelection-BQEUty_A.js → fileMentionTouchSelection-Dv6PCS5x.js} +1 -1
  83. package/dist/assets/{fileReferenceActions-TmbrIHBI.js → fileReferenceActions-B2jCazPJ.js} +1 -1
  84. package/dist/assets/{fr-BHaun7Zq.js → fr-BuXhxsLA.js} +1 -1
  85. package/dist/assets/{gitApi-CoVwjIDy.js → gitApi-BnZcCLpz.js} +1 -1
  86. package/dist/assets/gitApiHttp-DF1ID314.js +3 -0
  87. package/dist/assets/githubAuthQueries-C5RxUNL2.js +1 -0
  88. package/dist/assets/historyImportQueries-CZsECryv.js +1 -0
  89. package/dist/assets/{host-ChBHl_Vl.js → host-C7jHgymK.js} +1 -1
  90. package/dist/assets/{i18n-DXc6czdR.js → i18n-BcqhT5IQ.js} +1 -1
  91. package/dist/assets/{icons-Bd-INsoy.js → icons-BjKhmiUB.js} +1 -1
  92. package/dist/assets/{imageSource-BR4C9TuS.js → imageSource-Cq_p4gAe.js} +1 -1
  93. package/dist/assets/input-CK6ESZJN.js +1 -0
  94. package/dist/assets/{input-store-BSJBQTMi.js → input-store-dLjM4aiu.js} +1 -1
  95. package/dist/assets/insertionBoundaries-CD1bfNQI.js +1 -0
  96. package/dist/assets/{ja-BGNugvrx.js → ja-qWngDHZr.js} +1 -1
  97. package/dist/assets/kbd-DqpD1Z1W.js +1 -0
  98. package/dist/assets/{ko-CGbNBfDe.js → ko-CSKPW13b.js} +1 -1
  99. package/dist/assets/main-buUrzK21.js +2 -0
  100. package/dist/assets/main-wnAp11Lg.js +169 -0
  101. package/dist/assets/{markdownHeightCache-CHGGNhWI.js → markdownHeightCache-B5NINUfB.js} +1 -1
  102. package/dist/assets/mcpQueries-CEyM57ph.js +1 -0
  103. package/dist/assets/miniChat-DDuanxyB.js +2 -0
  104. package/dist/assets/mobile-CL1PHr-g.js +2 -0
  105. package/dist/assets/{mobileBackNavigation-C94n2eLT.js → mobileBackNavigation-Cqz28R4e.js} +1 -1
  106. package/dist/assets/mobileConnections-DBVkkjN_.js +2 -0
  107. package/dist/assets/multirun-CG2iQzs1.js +3 -0
  108. package/dist/assets/{native-config-DVg8_Zx1.js → native-config-q8-2XVGB.js} +1 -1
  109. package/dist/assets/{nativeComposerCover-Bhv1EKPT.js → nativeComposerCover-X18Rxy9s.js} +1 -1
  110. package/dist/assets/{navigation-D1klsD7k.js → navigation-B17JP7Nc.js} +2 -2
  111. package/dist/assets/openRemoteProjectSession-B2oJdHC6.js +1 -0
  112. package/dist/assets/{pl-k8-4URiE.js → pl-ON0IoadC.js} +1 -1
  113. package/dist/assets/pluginPresentation-OcngX2e8.js +2 -0
  114. package/dist/assets/{project-preview-BCtFY4Rg.js → project-preview-BcLPKzwg.js} +1 -1
  115. package/dist/assets/{prompt-attachment-upload-B5DHrw6U.js → prompt-attachment-upload-BGppTOgV.js} +1 -1
  116. package/dist/assets/{pt-BR-DdwCzXBH.js → pt-BR-BAekLJyC.js} +1 -1
  117. package/dist/assets/pwa-dfKnHt2U.js +2 -0
  118. package/dist/assets/queue-abort-optimistic-CIugRVbT.js +1 -0
  119. package/dist/assets/{quota-CqWNkFzw.js → quota-BpQX7Pfg.js} +1 -1
  120. package/dist/assets/{reference-history-IEuzG8KC.js → reference-history-Dk7Uz1e9.js} +1 -1
  121. package/dist/assets/{remote-input-store-C6UIEZxp.js → remote-input-store-DdjKfpxS.js} +1 -1
  122. package/dist/assets/remoteProjectQueries-BXrXdLjN.js +1 -0
  123. package/dist/assets/{remoteSessionReference-ex07CtrZ.js → remoteSessionReference-DL-cFaU4.js} +1 -1
  124. package/dist/assets/renderElectronMiniChatApp-D-qMtvJ5.js +2 -0
  125. package/dist/assets/renderMobileApp-DE4dovZy.js +17 -0
  126. package/dist/assets/{runtime-file-download-BWeoSXRb.js → runtime-file-download-1s2Al1t3.js} +1 -1
  127. package/dist/assets/runtime-file-resource-C5kmYlLv.js +6 -0
  128. package/dist/assets/{runtimeConfig-CyvlrO58.js → runtimeConfig-Bto7mqiH.js} +1 -1
  129. package/dist/assets/runtimeEndpointReset-C41HR0MC.js +4 -0
  130. package/dist/assets/{scheduledTaskNavigation-VVTOq9n2.js → scheduledTaskNavigation-qCB0nuyR.js} +1 -1
  131. package/dist/assets/select-DsqFxij6.js +1 -0
  132. package/dist/assets/{sessionLookup-DQOiycHr.js → sessionLookup-BL43L4KX.js} +1 -1
  133. package/dist/assets/sessionOwnership-CoFyzErn.js +2 -0
  134. package/dist/assets/shortcuts-CS2j7q63.js +1 -0
  135. package/dist/assets/sortable-tabs-strip-DiIB2-kp.js +1 -0
  136. package/dist/assets/speechSettingsQueries-DXlNIuv5.js +1 -0
  137. package/dist/assets/src-DYCPWwUH.css +2 -0
  138. package/dist/assets/{store-C1ifDY0C.js → store-BHq6XijA.js} +3 -3
  139. package/dist/assets/switch-C-h9UNYt.js +1 -0
  140. package/dist/assets/{terminalApi-DXvEquBF.js → terminalApi-2TIqWX2z.js} +1 -1
  141. package/dist/assets/textarea-DjSTlLEk.js +1 -0
  142. package/dist/assets/{timeFormat-dCsf2MQv.js → timeFormat-CPklO4G4.js} +1 -1
  143. package/dist/assets/tooltip-mPnbOruE.js +1 -0
  144. package/dist/assets/truncated-path-DJ1GdoM1.js +1 -0
  145. package/dist/assets/types-DjjmI1B9.js +2 -0
  146. package/dist/assets/ui-Cd2-HQSa.js +13 -0
  147. package/dist/assets/{uk-DU-7fAP4.js → uk-CV7mskVO.js} +1 -1
  148. package/dist/assets/{useAppFontEffects-rbTKcF0f.js → useAppFontEffects-mOLMhLug.js} +5 -5
  149. package/dist/assets/{useAssistantUIStore-CpJZ4Rqs.js → useAssistantUIStore-AI2LkqlQ.js} +1 -1
  150. package/dist/assets/useDesktopWindowControlsLayout-BC62ly7f.js +1 -0
  151. package/dist/assets/{useDictation-CZzAlsW0.js → useDictation-D8v7PflM.js} +1 -1
  152. package/dist/assets/{useEffectiveDirectory-DiJBIfai.js → useEffectiveDirectory-CCVmwzs7.js} +1 -1
  153. package/dist/assets/{useFontPreferences-BiRBKhti.js → useFontPreferences-DB18Mtz6.js} +1 -1
  154. package/dist/assets/{useGitStore-Bv8xmXDa.js → useGitStore-Bab2zave.js} +1 -1
  155. package/dist/assets/{useInlineCommentDraftStore-B2mkmAZd.js → useInlineCommentDraftStore-DAYe4P_i.js} +1 -1
  156. package/dist/assets/useMcpConfigStore-BJm6513j.js +1 -0
  157. package/dist/assets/useMobileSwipeActions-D0WXnZEj.js +1 -0
  158. package/dist/assets/useMobileTranscriptSyncHint-CG4nKZAr.js +10 -0
  159. package/dist/assets/useModelLists-BimLCgIE.js +1 -0
  160. package/dist/assets/useOpenCodeReadiness-DXkY7-Jm.js +1 -0
  161. package/dist/assets/usePluginsStore-C69K4oDx.js +1 -0
  162. package/dist/assets/useProjectGitActions-DVpxGjd_.js +1 -0
  163. package/dist/assets/{useProjectGitStore-DzU2pvrH.js → useProjectGitStore-tqdyts8E.js} +1 -1
  164. package/dist/assets/{useProjectRuntimeAPIs-tjGuODhu.js → useProjectRuntimeAPIs-3ykZWBEc.js} +1 -1
  165. package/dist/assets/useQuotaStore-B3QxYEfM.js +1 -0
  166. package/dist/assets/{useSessionBtwStore-CwvlMabN.js → useSessionBtwStore-LV6b9oRF.js} +1 -1
  167. package/dist/assets/{useStreamingTextThrottle-C9SaKeil.js → useStreamingTextThrottle-ClWAbNdQ.js} +1 -1
  168. package/dist/assets/{useUIStore-C3ewjGgP.js → useUIStore-Dzf_W6hZ.js} +1 -1
  169. package/dist/assets/worktreeManager-CZpGApxy.js +1 -0
  170. package/dist/assets/{worktreeSourceBranchPreference-CuLKwxkx.js → worktreeSourceBranchPreference-CyrpQH5R.js} +1 -1
  171. package/dist/assets/{zh-CN-DOHH7nht.js → zh-CN-D9xdLrNm.js} +1 -1
  172. package/dist/assets/{zh-TW-t1qlXGOg.js → zh-TW-Dyiv4-Dr.js} +1 -1
  173. package/dist/index.html +13 -14
  174. package/dist/mini-chat.html +13 -14
  175. package/dist/mobile.html +2 -2
  176. package/package.json +1 -1
  177. package/server/index.js +1 -0
  178. package/server/lib/gui-customization/DOCUMENTATION.md +22 -1
  179. package/server/lib/gui-customization/projects-client.mjs +14 -3
  180. package/server/lib/gui-customization/projects-lifecycle.js +89 -0
  181. package/server/lib/gui-customization/projects-lifecycle.test.js +199 -0
  182. package/server/lib/gui-customization/projects.js +19 -3
  183. package/server/lib/gui-customization/projects.test.js +6 -0
  184. package/server/lib/gui-customization/session-skill.js +2 -2
  185. package/server/lib/gui-customization/session-skill.test.js +6 -0
  186. package/server/lib/gui-customization/skill/SKILL.md +3 -1
  187. package/server/lib/gui-customization/skill/references/projects.md +30 -0
  188. package/server/lib/opencode/feature-routes-runtime.js +5 -0
  189. package/server/lib/opencode/feature-routes-runtime.test.js +6 -0
  190. package/server/lib/opencode/settings-helpers.js +4 -0
  191. package/dist/assets/AgentAvatar-CHCjMxCF.js +0 -1
  192. package/dist/assets/AgentSelector-uBoLtut8.js +0 -1
  193. package/dist/assets/ArchivedSessionsDialog-DZcicxVO.js +0 -1
  194. package/dist/assets/AssistantConversationSurface-36aP0hRf.js +0 -3
  195. package/dist/assets/AssistantSessionCard-CZ-1oJiE.js +0 -2
  196. package/dist/assets/AssistantUnreadBadge-p9mkpbMC.js +0 -1
  197. package/dist/assets/AssistantView-8fyAae7J.js +0 -1
  198. package/dist/assets/AssistantWorkingAvatar-CoxhuMvM.js +0 -1
  199. package/dist/assets/AssistantsSettingsPage-DD6spbXz.js +0 -1
  200. package/dist/assets/BinaryFileFallback-DgYaMG9f.js +0 -1
  201. package/dist/assets/BtwPanel-BkobGcf3.js +0 -6
  202. package/dist/assets/BusyDots-COTTwItx.js +0 -4
  203. package/dist/assets/ChatContainer-BfQ7RXwY.js +0 -65
  204. package/dist/assets/ChatView-ByMRjY1h.js +0 -3
  205. package/dist/assets/DiffViewToggle-BwJ6MYB7.js +0 -1
  206. package/dist/assets/ErrorBoundary-D7QcwhmL.js +0 -1
  207. package/dist/assets/FadeInOnReveal-B3uT04YJ.js +0 -1
  208. package/dist/assets/GuiPluginPage-BPjU8N49.js +0 -1
  209. package/dist/assets/GuiPluginSurface-CYPH6XzX.js +0 -1
  210. package/dist/assets/GuiPluginTitlebarItems-DxFINwbr.js +0 -1
  211. package/dist/assets/Icon-DmykXZL1.js +0 -1
  212. package/dist/assets/ImageLoadingPlaceholder-DgM_EFHn.js +0 -1
  213. package/dist/assets/MarkdownRenderer-VvziwyJB.js +0 -2
  214. package/dist/assets/MarkstreamRendererImpl-U_m_ZKG7.js +0 -3
  215. package/dist/assets/MobileAssistantTab-CMIQansR.js +0 -1
  216. package/dist/assets/MobileChatScreen-p356_BCN.js +0 -1
  217. package/dist/assets/MobileDetailNavigation-ldTzGo19.js +0 -1
  218. package/dist/assets/MobileFilesSurface-CF3EW_SK.js +0 -2
  219. package/dist/assets/MobileHtmlNetworkBoundary-DlPF4iPS.js +0 -2
  220. package/dist/assets/MobileOverlayPanel-C36VWWmN.js +0 -1
  221. package/dist/assets/MobileResizableSheet-CqphcaKq.js +0 -1
  222. package/dist/assets/MobileSurface-cmaGf3hZ.js +0 -1
  223. package/dist/assets/MobileTabPageHeader-D6P4K98S.js +0 -1
  224. package/dist/assets/ModelLogo-BkbD514M.js +0 -1
  225. package/dist/assets/ModelSelector-EmtltPnd.js +0 -1
  226. package/dist/assets/MultiRunWindow-CeSxAB8w.js +0 -1
  227. package/dist/assets/OnboardingScreen-BubjTNcy.js +0 -1
  228. package/dist/assets/OverlayScrollbar-D6vmoMkQ.js +0 -1
  229. package/dist/assets/ProviderLogo-DA98yu7M.js +0 -1
  230. package/dist/assets/RemoteDesktopPanel-f3vRj4ZP.js +0 -1
  231. package/dist/assets/ScheduledTasksDialog-D_hBP47Y.js +0 -3
  232. package/dist/assets/ScrollableOverlay-stxT7gLf.js +0 -1
  233. package/dist/assets/SettingsGroup-CvaPYznp.js +0 -1
  234. package/dist/assets/SettingsWindow-DMVAV_el.js +0 -1
  235. package/dist/assets/SetupTourDialog-BlR7FJvd.js +0 -1
  236. package/dist/assets/TerminalView-Xcwp3SG1.js +0 -8
  237. package/dist/assets/TextSelectionMenu-h8iUeNzE.js +0 -11
  238. package/dist/assets/assistantMessagePreview-DLBvPQtq.js +0 -1
  239. package/dist/assets/assistantQueries-NdPqu6rx.js +0 -1
  240. package/dist/assets/card-DmysoUAV.js +0 -1
  241. package/dist/assets/chatUpwardIntent-B2NrGMm-.js +0 -1
  242. package/dist/assets/checkbox-BMN5hAVm.js +0 -1
  243. package/dist/assets/collapsible-Z0IjDAMO.js +0 -1
  244. package/dist/assets/context-menu-CKlB6wxo.js +0 -1
  245. package/dist/assets/diagram-CzY6n_4N.js +0 -1
  246. package/dist/assets/dialog-BeFBA6ja.js +0 -1
  247. package/dist/assets/dropdown-menu-BblI9sN2.js +0 -1
  248. package/dist/assets/gitApiHttp-Dd-FwgCq.js +0 -3
  249. package/dist/assets/githubAuthQueries-DqregESf.js +0 -1
  250. package/dist/assets/historyImportQueries-D00KjUT2.js +0 -1
  251. package/dist/assets/input-Cf16qJ6g.js +0 -1
  252. package/dist/assets/insertionBoundaries-Btqgsu1M.js +0 -1
  253. package/dist/assets/kbd-CamdaxHJ.js +0 -1
  254. package/dist/assets/main-CXH2hObl.js +0 -169
  255. package/dist/assets/main-ClH7cLKr.js +0 -2
  256. package/dist/assets/mcpQueries-Rmp1BKeo.js +0 -1
  257. package/dist/assets/miniChat-B_Bw6udu.js +0 -2
  258. package/dist/assets/mobile-BR73yoNi.js +0 -2
  259. package/dist/assets/mobileConnections-x07fHO_5.js +0 -2
  260. package/dist/assets/multirun-CKQymP08.js +0 -3
  261. package/dist/assets/openRemoteProjectSession-DNr74gHD.js +0 -1
  262. package/dist/assets/pluginPresentation-DtyC8NF2.js +0 -2
  263. package/dist/assets/pwa-CtDladgB.js +0 -2
  264. package/dist/assets/queue-abort-optimistic-DFbWDRKT.js +0 -1
  265. package/dist/assets/remoteProjectQueries-C8382jM8.js +0 -1
  266. package/dist/assets/renderElectronMiniChatApp-DM9y9qXo.js +0 -2
  267. package/dist/assets/renderMobileApp-DqpPYtZI.js +0 -17
  268. package/dist/assets/runtime-file-resource-Bc_ss-sW.js +0 -2
  269. package/dist/assets/runtimeEndpointReset-C0zNrsI9.js +0 -4
  270. package/dist/assets/select-vZCgcnYG.js +0 -1
  271. package/dist/assets/session-startup-barrier-DT-hIBRf.js +0 -1
  272. package/dist/assets/sessionOwnership-BjhXe6pi.js +0 -2
  273. package/dist/assets/shortcuts-WkN3Gh8v.js +0 -1
  274. package/dist/assets/sortable-tabs-strip-DmtfYPz0.js +0 -1
  275. package/dist/assets/speechSettingsQueries-BmkXNn4w.js +0 -1
  276. package/dist/assets/src-QTj33Z0x.css +0 -2
  277. package/dist/assets/switch-CNmsFYfY.js +0 -1
  278. package/dist/assets/textarea-ZiXxEOHK.js +0 -1
  279. package/dist/assets/tooltip-CpTbxEOE.js +0 -1
  280. package/dist/assets/truncated-path-CcmWjgCQ.js +0 -1
  281. package/dist/assets/types-DpcA-uDW.js +0 -2
  282. package/dist/assets/ui-ee2iN869.js +0 -13
  283. package/dist/assets/useDesktopWindowControlsLayout-BOkRz-p9.js +0 -1
  284. package/dist/assets/useMcpConfigStore-DKTl0PvE.js +0 -1
  285. package/dist/assets/useMobileSwipeActions-XoxrtaUo.js +0 -1
  286. package/dist/assets/useMobileTranscriptSyncHint-DM8WG7kz.js +0 -10
  287. package/dist/assets/useModelLists-Bf60FIJu.js +0 -1
  288. package/dist/assets/useOpenCodeReadiness-Dm6BjA1T.js +0 -1
  289. package/dist/assets/usePluginsStore-Du4WlceO.js +0 -1
  290. package/dist/assets/useProjectGitActions-D3B9ma9z.js +0 -1
  291. package/dist/assets/useQuotaStore-CSn2pk3T.js +0 -1
  292. package/dist/assets/worktreeManager-DGu8M01Z.js +0 -1
  293. package/dist/assets/yuriEvents-BFrD5fMU.js +0 -5
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,n}from"./runtime-switch-DEPKHgdL.js";import{n as r}from"./runtime-fetch-V-iMWR8t.js";import{st as i}from"./vendor-base-ui-wXsskyKm.js";import{n as a}from"./vendor-react-BkccXcWz.js";import{s as o}from"./vendor-tanstack-react-query-DIb_ItL-.js";import{c as s,r as c}from"./yuriEvents-BFrD5fMU.js";import{r as l}from"./session-startup-barrier-DT-hIBRf.js";import{i as u}from"./store-C1ifDY0C.js";var d=e(i(),1),f=a(),p=class extends Error{code;status;resource;constructor(e,t,n,r){super(typeof r==`string`&&r.trim()?r.trim():e),this.code=e,this.status=t,this.resource=n}},m=e=>{if(!e||typeof e!=`object`)return!1;let t=`name`in e?String(e.name):``;return t===`AbortError`||t===`TimeoutError`},h=class extends p{operation;constructor(e,t,n){super(e,t,`share_operation`),this.operation=n}},g=(e,t=200)=>{throw new p(`invalid_${e}_response`,t,e)},_=(e,t)=>e&&typeof e==`object`&&!Array.isArray(e)?e:g(t),v=(e,t)=>typeof e==`string`?e:g(t),y=(e,t)=>e===null||typeof e==`string`?e:g(t),b=(e,t)=>typeof e==`number`&&Number.isFinite(e)?e:g(t),x=(e,t)=>e===null?null:b(e,t),S=(e,t)=>typeof e==`boolean`?e:g(t),C=(e,t,n)=>t.includes(e)?e:g(n),w=e=>{let t=_(e,`capability`);return{supported:S(t.supported,`capability`),enabled:S(t.enabled,`capability`),revision:b(t.revision,`capability`),serverInstanceID:y(t.serverInstanceID,`capability`),sharingAvailable:t.sharingAvailable!==void 0&&S(t.sharingAvailable,`capability`)}},T=e=>{if(e==null)return null;let t=_(e,`assistant`);return{turnID:v(t.turnID,`assistant`),messageID:v(t.messageID,`assistant`),status:C(t.status,[`queued`,`running`],`assistant`),admittedAt:b(t.admittedAt,`assistant`)}},E=e=>{if(e==null)return null;let t=_(e,`assistant_preview`),n=b(t.ordinal,`assistant_preview`);return!Number.isSafeInteger(n)||n<0?g(`assistant_preview`):{...t.createdAt===void 0?{}:{createdAt:b(t.createdAt,`assistant_preview`)},messageID:v(t.messageID,`assistant_preview`),ordinal:n,role:C(t.role,[`user`,`assistant`],`assistant_preview`),text:v(t.text,`assistant_preview`),fallbackKind:t.fallbackKind===null?null:C(t.fallbackKind,[`image`,`file`,`session`,`assistant`,`schedule`],`assistant_preview`)}},D=e=>{let t=b(e,`assistant_read`);return Number.isSafeInteger(t)&&t>=0?t:g(`assistant_read`)},O=e=>{let t=_(e,`assistant_read`);return{generation:D(t.generation),ordinal:D(t.ordinal),messageID:v(t.messageID,`assistant_read`)}},ee=e=>({unreadCount:e.unreadCount===void 0?0:D(e.unreadCount),readWatermark:e.readWatermark==null?null:O(e.readWatermark),readTip:e.readTip==null?null:O(e.readTip)}),te=e=>{let t=_(e,`assistant_read`);return{assistantID:v(t.assistantID,`assistant_read`),changed:S(t.changed,`assistant_read`),unreadCount:D(t.unreadCount),readWatermark:O(t.readWatermark),readTip:O(t.readTip),revision:D(t.revision)}},k=e=>{let t=_(e,`assistant`),n=Array.isArray(t.historySessionIDs)?t.historySessionIDs.map(e=>v(e,`assistant`)):[],r=t.historySessionCount===void 0?n.length:b(t.historySessionCount,`assistant`);if(!Number.isSafeInteger(r)||r<n.length)return g(`assistant`);let i=Array.isArray(t.assignedSessionIDs)?t.assignedSessionIDs.map(e=>v(e,`assistant`)):[],a=t.activeContactTurn===void 0?null:T(t.activeContactTurn),o=t.working===void 0?a!=null:S(t.working,`assistant`);return{...ee(t),pinnedAt:t.pinnedAt===void 0?void 0:x(t.pinnedAt,`assistant`),latestMessagePreview:E(t.latestMessagePreview),id:v(t.id,`assistant`),avatarSeed:v(t.avatarSeed??t.id,`assistant`),revision:b(t.revision,`assistant`),enabled:S(t.enabled,`assistant`),name:v(t.name,`assistant`),defaultPrompt:v(t.defaultPrompt,`assistant`),workspacePath:y(t.workspacePath,`assistant`),effectiveWorkspacePath:v(t.effectiveWorkspacePath,`assistant`),managedWorkspacePath:y(t.managedWorkspacePath??null,`assistant`),providerID:v(t.providerID,`assistant`),modelID:v(t.modelID,`assistant`),agent:y(t.agent,`assistant`),variant:y(t.variant??null,`assistant`),mode:C(t.mode,[`continuous`,`stateless`],`assistant`),sessionID:y(t.sessionID,`assistant`),sessionGeneration:b(t.sessionGeneration,`assistant`),historySessionIDs:n,historySessionCount:r,assignedSessionIDs:i,working:o,activeContactTurn:a,createdAt:x(t.createdAt,`assistant`),updatedAt:b(t.updatedAt,`assistant`),tombstoneAt:x(t.tombstoneAt,`assistant`)}},ne=e=>{let t=_(e,`snapshot`);return{revision:b(t.revision,`snapshot`),enabled:S(t.enabled,`snapshot`),assistants:Array.isArray(t.assistants)?t.assistants.map(k):g(`snapshot`)}},re=e=>{let t=_(e,`binding`);return{sessionID:y(t.sessionID,`binding`),directory:v(t.directory,`binding`),sessionGeneration:b(t.sessionGeneration,`binding`)}},ie=e=>{let t=_(e,`message_admission`);if(t.admitted!==!0)return g(`message_admission`);let n=t.revision===void 0||t.revision===null?null:b(t.revision,`message_admission`);return{binding:re(t.binding),messageID:v(t.messageID,`message_admission`),admitted:!0,revision:n,...t.replayed===!0?{replayed:!0}:{}}},A=e=>{let t=_(e,`share_operation`);return{operationID:v(t.operationID,`share_operation`),assistantID:v(t.assistantID,`share_operation`),sessionID:y(t.sessionID,`share_operation`),messageID:y(t.messageID,`share_operation`),state:C(t.state,[`submitting`,`running`,`completed`,`failed`,`unresolved`],`share_operation`),phase:v(t.phase,`share_operation`),attempt:b(t.attempt,`share_operation`),leaseExpiresAt:x(t.leaseExpiresAt,`share_operation`),errorCode:y(t.errorCode,`share_operation`)}},ae=e=>{let t=_(e,`assistant_contact_part`);if(t.type===`text`)return{type:`text`,text:v(t.text,`assistant_contact_part`)};if(t.type===`file`){let e=t.filename===void 0||t.filename===null?void 0:v(t.filename,`assistant_contact_part`),n=v(t.mime,`assistant_contact_part`),r=t.url!==void 0&&t.url!==null,i=t.attachmentID!==void 0&&t.attachmentID!==null;if(r&&i)return g(`assistant_contact_part`);if(i){let r=b(t.size,`assistant_contact_part`);return!Number.isSafeInteger(r)||r<0?g(`assistant_contact_part`):{type:`file`,mime:n,attachmentID:v(t.attachmentID,`assistant_contact_part`),sha256:v(t.sha256,`assistant_contact_part`),size:r,...e?{filename:e}:{}}}return r?{type:`file`,mime:n,url:v(t.url,`assistant_contact_part`),...e?{filename:e}:{}}:g(`assistant_contact_part`)}if(t.type===`card`){let e=C(t.cardType,[`session`,`assistant`,`schedule`],`assistant_contact_part`);if(e===`session`){let e;if(t.target!==void 0){let n=_(t.target,`assistant_contact_part`),r=e=>{let t=v(n[e],`assistant_contact_part`);return!t||t!==t.trim()||t.length>512||Array.from(t).some(e=>e.charCodeAt(0)<32)?g(`assistant_contact_part`):t};e={hubId:r(`hubId`),hostId:r(`hostId`),instanceId:r(`instanceId`)}}return{type:`card`,cardType:`session`,sessionID:v(t.sessionID,`assistant_contact_part`),directory:v(t.directory,`assistant_contact_part`),title:y(t.title??null,`assistant_contact_part`),status:y(t.status??null,`assistant_contact_part`),branch:y(t.branch??null,`assistant_contact_part`),...e?{target:e}:{}}}return e===`assistant`?{type:`card`,cardType:`assistant`,assistantID:v(t.assistantID,`assistant_contact_part`),name:v(t.name,`assistant_contact_part`),providerID:v(t.providerID,`assistant_contact_part`),modelID:v(t.modelID,`assistant_contact_part`),mode:C(t.mode??`continuous`,[`continuous`,`stateless`],`assistant_contact_part`)}:{type:`card`,cardType:`schedule`,taskID:v(t.taskID,`assistant_contact_part`),projectID:v(t.projectID,`assistant_contact_part`),name:v(t.name,`assistant_contact_part`),kind:y(t.kind??null,`assistant_contact_part`),time:y(t.time??null,`assistant_contact_part`),timezone:y(t.timezone??null,`assistant_contact_part`),prompt:y(t.prompt??null,`assistant_contact_part`),...t.cron===void 0?{}:{cron:y(t.cron,`assistant_contact_part`)},...t.date===void 0?{}:{date:y(t.date,`assistant_contact_part`)},...t.times===void 0?{}:{times:t.times===null?null:Array.isArray(t.times)?t.times.map(e=>v(e,`assistant_contact_part`)):g(`assistant_contact_part`)},...t.weekdays===void 0?{}:{weekdays:t.weekdays===null?null:Array.isArray(t.weekdays)?t.weekdays.map(e=>{let t=b(e,`assistant_contact_part`);return Number.isInteger(t)&&t>=0&&t<=6?t:g(`assistant_contact_part`)}):g(`assistant_contact_part`)}}}return g(`assistant_contact_part`)},oe=e=>{let t=_(e,`assistant_contact`),n=y(t.nextCursor,`assistant_contact`),r=S(t.complete,`assistant_contact`);if(!r&&!n||r&&n||!Array.isArray(t.messages))return g(`assistant_contact`);let i=b(t.generation,`assistant_contact`),a=b(t.revision,`assistant_contact`);return!Number.isSafeInteger(i)||i<0||!Number.isSafeInteger(a)||a<0?g(`assistant_contact`):{messages:t.messages.map(e=>{let t=_(e,`assistant_contact_message`);if(!Array.isArray(t.parts))return g(`assistant_contact_message`);let n=t.parts.map(ae);return{messageID:v(t.messageID,`assistant_contact_message`),assistantID:v(t.assistantID,`assistant_contact_message`),role:C(t.role,[`user`,`assistant`,`peer`],`assistant_contact_message`),turnID:v(t.turnID,`assistant_contact_message`),bubbleIndex:b(t.bubbleIndex,`assistant_contact_message`),createdAt:b(t.createdAt,`assistant_contact_message`),ordinal:b(t.ordinal,`assistant_contact_message`),status:v(t.status,`assistant_contact_message`),fromAssistantID:y(t.fromAssistantID??null,`assistant_contact_message`),fromAssistantName:y(t.fromAssistantName??null,`assistant_contact_message`),parts:n,text:typeof t.text==`string`?t.text:n.filter(e=>e.type===`text`).map(e=>e.text).join(``),cards:n.filter(e=>e.type===`card`)}}),nextCursor:n,complete:r,generation:i,revision:a}},se=e=>{let t=_(e,`assistant_scheduled_tasks`);return Array.isArray(t.tasks)?{tasks:t.tasks.map(e=>{let t=_(e,`assistant_scheduled_task`),n=t.task===null||t.task===void 0?null:_(t.task,`assistant_scheduled_task_live`);return{assistantID:v(t.assistantID,`assistant_scheduled_task`),projectID:v(t.projectID,`assistant_scheduled_task`),taskID:v(t.taskID,`assistant_scheduled_task`),createdAt:b(t.createdAt,`assistant_scheduled_task`),projectPath:y(t.projectPath??null,`assistant_scheduled_task`),projectLabel:y(t.projectLabel??null,`assistant_scheduled_task`),task:n}})}:g(`assistant_scheduled_tasks`)},j=async(e,t)=>{try{let t=await e.json();if(t&&typeof t.error==`string`&&t.error.trim().length>0)return t.error}catch{return t}return t},M=e=>{let t=typeof e==`string`?e.trim():``;if(!t)throw Error(`projectId is required`);return t},N=e=>e===null||typeof e==`string`,ce=e=>e===null||typeof e==`number`&&Number.isFinite(e),le=e=>typeof e==`number`&&Number.isFinite(e)&&e>=0&&e<=864e13,ue=e=>e===null||le(e),de=e=>{if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;return typeof t.id==`string`&&t.id.length>0&&typeof t.projectId==`string`&&t.projectId.length>0&&typeof t.taskId==`string`&&t.taskId.length>0&&typeof t.taskName==`string`&&(t.trigger===`scheduled`||t.trigger===`manual`)&&(t.status===`running`||t.status===`success`||t.status===`error`)&&N(t.sessionId)&&N(t.directory)&&N(t.error)&&le(t.startedAt)&&ue(t.finishedAt)&&ce(t.durationMs)&&(t.durationMs===null||t.durationMs>=0)},fe=e=>{if(!e||typeof e!=`object`||Array.isArray(e))throw Error(`Malformed scheduled task runs response`);let t=e;if(!Array.isArray(t.runs)||!t.runs.every(de)||!N(t.nextCursor)||typeof t.complete!=`boolean`||t.complete!==(t.nextCursor===null)||t.nextCursor!==null&&t.nextCursor.length===0)throw Error(`Malformed scheduled task runs response`);return{runs:t.runs,nextCursor:t.nextCursor,complete:t.complete}},pe=async(e,t)=>{let n=new URLSearchParams;e.before&&n.set(`before`,e.before);let i=e.limit??20;if(!Number.isInteger(i)||i<1)throw Error(`limit must be a positive integer`);n.set(`limit`,String(i)),e.projectId&&n.set(`projectId`,e.projectId),e.taskId&&n.set(`taskId`,e.taskId);let a=await r(`/api/yuri/scheduled-task-runs?${n.toString()}`,{signal:t});if(!a.ok)throw Error(await j(a,`Failed to load scheduled task history`));return fe(await a.json().catch(()=>null))},me=async({signal:e}={})=>{let t=await r(`/api/yuri/scheduled-tasks`,{signal:e});if(!t.ok)throw Error(await j(t,`Failed to load schedules`));let n=await t.json().catch(()=>null);if(!n||!Array.isArray(n.tasks))throw Error(`Malformed schedules response`);return{tasks:Array.isArray(n?.tasks)?n.tasks:[],failedProjectIds:Array.isArray(n?.failedProjectIds)?n.failedProjectIds.filter(e=>typeof e==`string`):[]}},he=async(e,t)=>{let n=M(e),i=await r(`/api/projects/${encodeURIComponent(n)}/scheduled-tasks`,{method:`PUT`,headers:{"content-type":`application/json`,accept:`application/json`},body:JSON.stringify({task:t})});if(!i.ok)throw Error(await j(i,`Failed to save schedule`));let a=await i.json().catch(()=>null);return!a||!Array.isArray(a.tasks)?[]:a.tasks},ge=async(e,t)=>{let n=M(e),i=M(t),a=await r(`/api/projects/${encodeURIComponent(n)}/scheduled-tasks/${encodeURIComponent(i)}`,{method:`DELETE`,headers:{accept:`application/json`}});if(!a.ok)throw Error(await j(a,`Failed to delete schedule`));let o=await a.json().catch(()=>null);return!o||!Array.isArray(o.tasks)?[]:o.tasks},_e=async(e,t)=>{let n=M(e),i=M(t),a=await r(`/api/projects/${encodeURIComponent(n)}/scheduled-tasks/${encodeURIComponent(i)}/run`,{method:`POST`,headers:{accept:`application/json`}});if(!a.ok)throw Error(await j(a,`Failed to run schedule`));let o=await a.json().catch(()=>null);return{sessionId:typeof o?.sessionId==`string`&&o.sessionId.length>0?o.sessionId:void 0}},P=(e,t)=>e.ordinal===t.ordinal?e.messageID<t.messageID?-1:+(e.messageID>t.messageID):e.ordinal-t.ordinal,ve=e=>{if(e.type===`file`||e.type===`card`)return!0;if(e.type!==`text`)return!1;let t=typeof e.text==`string`?e.text.trim():``;return!!t&&!t.startsWith(`yuri.settle.`)&&!t.startsWith(`oc.settle.`)},ye=(e,t)=>{if(!t||!e.readTip||!((e.unreadCount??0)>0))return null;let n=e.readTip;if(t.generation!==n.generation)return null;let r;for(let n=t.messages.length-1;n>=0;--n){let i=t.messages[n];if(i.assistantID===e.id&&(i.status===`complete`||i.status===`error`)&&i.parts.some(ve)){r=i;break}}if(!r)return null;let i=e.readWatermark;return i&&(i.generation>t.generation||i.generation===t.generation&&P({ordinal:i.ordinal,messageID:i.messageID},{ordinal:r.ordinal,messageID:r.messageID})>=0)?null:{generation:t.generation,ordinal:r.ordinal,messageID:r.messageID}},be=()=>({messages:[],generation:-1,revision:0,olderCursor:null,olderComplete:!0,hasMessageGap:!1,gapCursor:null,gapRequestIDs:null,gapTargetIDs:null,liveWindowIDs:[]}),F=e=>!!(e&&e.generation>=0),I=(e,t)=>P({ordinal:e.ordinal,messageID:e.messageID},{ordinal:t.ordinal,messageID:t.messageID}),L=(e,t,n=`incoming`)=>{let r=new Map;for(let t of e)r.set(t.messageID,t);for(let e of t)(n===`incoming`||!r.has(e.messageID))&&r.set(e.messageID,e);return[...r.values()].sort(I)},xe=e=>{let t=1/0;for(let n of e)n.ordinal<t&&(t=n.ordinal);return Number.isFinite(t)?t:null},R=e=>e.map(e=>e.messageID),z=(e,t)=>{for(let n of e)if(t.has(n))return!0;return!1},B=e=>new Set(e),Se=(e,t)=>!e||!t||e.length!==t.length?!1:e.every((e,n)=>e===t[n]),Ce=e=>({...e,hasMessageGap:!1,gapCursor:null,gapRequestIDs:null,gapTargetIDs:null}),V=e=>({ordinal:e.ordinal,messageID:e.messageID}),we=(e,t,n)=>{if(n)return[...t];if(t.length===0)return[...e];let r=t[0];return[...e.filter(e=>P(V(e),V(r))<0),...t]},Te=(e,t)=>{let n=e??be(),r=F(n),i=[...t.messages].sort(I),a=R(i);if(r&&t.generation<n.generation)return n;if(r&&t.generation>n.generation)return{messages:i,generation:t.generation,revision:t.revision,olderCursor:t.nextCursor,olderComplete:t.complete,hasMessageGap:!1,gapCursor:null,gapRequestIDs:null,gapTargetIDs:null,liveWindowIDs:a};if(!r)return{messages:i,generation:t.generation,revision:t.revision,olderCursor:t.complete?null:t.nextCursor,olderComplete:t.complete,hasMessageGap:!1,gapCursor:null,gapRequestIDs:null,gapTargetIDs:null,liveWindowIDs:a};let o=Math.max(n.revision,t.revision),s=t.revision>=n.revision;if(i.length===0)return s&&t.complete?{messages:[],generation:t.generation,revision:o,olderCursor:null,olderComplete:!0,hasMessageGap:!1,gapCursor:null,gapRequestIDs:null,gapTargetIDs:null,liveWindowIDs:[]}:{...n,generation:t.generation,revision:o,olderCursor:n.olderCursor??t.nextCursor,olderComplete:n.olderComplete&&t.complete,liveWindowIDs:[],hasMessageGap:n.hasMessageGap,gapCursor:n.hasMessageGap?t.nextCursor??n.gapCursor:null,gapRequestIDs:n.hasMessageGap?n.gapRequestIDs:null,gapTargetIDs:n.hasMessageGap?n.gapTargetIDs:null};let c;if(s)c=we(n.messages,i,t.complete);else{let e=xe(i);c=L(n.messages.filter(t=>t.ordinal<e),L(n.messages.filter(t=>t.ordinal>=e),i,`existing`),`incoming`)}let l=n.liveWindowIDs,u=B(a),d=l.length>0&&z(l,u),f=n.hasMessageGap,p=n.gapCursor,m=n.gapRequestIDs,h=n.gapTargetIDs;if(!d&&l.length>0&&t.nextCursor){f=!0,p=t.nextCursor;let e=l.filter(e=>!u.has(e));m=e.length>0?e:[...l],h=n.hasMessageGap&&n.gapTargetIDs&&n.gapTargetIDs.length>0?n.gapTargetIDs:m}else n.hasMessageGap?(f=!0,p=n.gapCursor,m=n.gapRequestIDs,h=n.gapTargetIDs):(f=!1,p=null,m=null,h=null);return{messages:c,generation:t.generation,revision:o,olderCursor:n.liveWindowIDs.length===0&&n.messages.length===0?t.complete?null:t.nextCursor:n.olderCursor,olderComplete:!r||n.liveWindowIDs.length===0&&n.messages.length===0?t.complete:n.olderComplete,hasMessageGap:f,gapCursor:f?p:null,gapRequestIDs:f?m:null,gapTargetIDs:f?h:null,liveWindowIDs:a}},Ee=(e,t)=>{if(!F(e)||t.generation!==e.generation)return e;let n=t.revision>=e.revision?`incoming`:`existing`,r=L(e.messages,t.messages,n);return{...e,messages:r,revision:Math.max(e.revision,t.revision),olderCursor:t.complete?null:t.nextCursor,olderComplete:t.complete}},De=(e,t,n)=>{if(!F(e)||t.generation!==e.generation)return e;let r=t.revision>=e.revision?`incoming`:`existing`,i=L(e.messages,t.messages,r),a=Math.max(e.revision,t.revision),o=n?.requestIDs??e.gapRequestIDs;if(!(e.hasMessageGap&&o&&e.gapRequestIDs&&Se(o,e.gapRequestIDs)))return{...e,messages:i,revision:a};let s=R(t.messages),c=e.gapTargetIDs??[],l=B(c);return c.length>0&&z(s,l)||t.complete||!t.nextCursor?Ce({...e,messages:i,revision:a}):{...e,messages:i,revision:a,hasMessageGap:!0,gapCursor:t.nextCursor??e.gapCursor,gapRequestIDs:e.gapRequestIDs,gapTargetIDs:e.gapTargetIDs}},H={snapshot:(e=t())=>[e,`assistants`,`snapshot`],capability:(e=t())=>[e,`assistants`,`capability`],history:(e,r,i,a=t(),o=n())=>[a,o,`assistants`,`history`,e,r,i],contact:(e,r=t(),i=n())=>[r,i,`assistants`,`contact`,e],scheduledTasks:(e,r=t(),i=n())=>[r,i,`assistants`,`scheduled-tasks`,e],globalScheduledTasks:(e=t())=>[e,`scheduled-tasks`]},U=async(e,t={})=>{let n=await r(e,t),i=await n.json().catch(()=>null);if(!n.ok){let e=i&&typeof i==`object`&&`error`in i&&typeof i.error==`string`?i.error:`request_failed`,t=i&&typeof i==`object`&&`message`in i&&typeof i.message==`string`?i.message:void 0;throw new p(e,n.status,void 0,t)}return i},W=(e,t)=>({method:e,headers:{"Content-Type":`application/json`},body:t===void 0?void 0:JSON.stringify(t)}),G=(e,r)=>{if(t()!==e||n()!==r)throw new p(`runtime_stale`,409)},Oe=(e,t,r)=>{s.setQueryData(H.snapshot(r),n=>n&&{...n,assistants:n.assistants.map(n=>n.id!==e||n.sessionGeneration>t.sessionGeneration?n:{...n,sessionID:t.sessionID,sessionGeneration:t.sessionGeneration,effectiveWorkspacePath:t.directory})}),s.invalidateQueries({queryKey:H.snapshot(r)}),s.invalidateQueries({queryKey:[r,n(),`assistants`,`history`,e]})},ke=(e,t)=>{s.setQueryData(H.snapshot(t),t=>t&&{...t,assistants:t.assistants.some(t=>t.id===e.id)?t.assistants.map(t=>t.id===e.id?e:t):[...t.assistants,e]}),s.invalidateQueries({queryKey:H.snapshot(t)})},Ae=2500,je=15e3,Me=e=>!!e?.assistants.some(e=>e.working||e.activeContactTurn),Ne=(e,t={})=>{if(t.assistantID){let n=e?.assistants.find(e=>e.id===t.assistantID);return n?.working||n?.activeContactTurn?Ae:je}return Me(e)?Ae:je},K=(e=t())=>({queryKey:H.snapshot(e),queryFn:async({signal:e})=>ne(await U(`/api/yuri/assistants/snapshot`,{signal:e})),staleTime:0,retry:2,refetchInterval:e=>Ne(e.state.data),refetchIntervalInBackground:!1,refetchOnWindowFocus:!0,refetchOnReconnect:!0}),q=new Map,J=e=>{let r=q.get(e);if(r)r.count+=1;else{let r=n(),i=!1,a=!1,o=!1,l=()=>!i&&t()===e&&n()===r,u=async()=>{if(o=!0,!a){a=!0;try{do o=!1,s.getQueryCache().find({queryKey:H.snapshot(e),exact:!0})?.state.fetchStatus===`fetching`&&(o=!0),await s.invalidateQueries({queryKey:H.snapshot(e),exact:!0},{cancelRefetch:!1});while(o&&l())}finally{a=!1}}},d=c(t=>{if(!l())return;let n=s.getQueryData(H.snapshot(e));(t.type===`event-stream-ready`||t.type===`contact-turn-start`||t.type===`contact-turn-end`||t.type===`assistants-changed`&&(!n||t.revision>n.revision))&&u()});q.set(e,{count:1,dispose:()=>{i=!0,d()}})}return()=>{let t=q.get(e);t&&--t.count===0&&(t.dispose(),q.delete(e))}},Pe=e=>{let n=(0,f.c)(7),r,i,a;n[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=t(),i=o,r=K(a),n[0]=r,n[1]=i,n[2]=a):(r=n[0],i=n[1],a=n[2]);let s;n[3]===e?s=n[4]:(s={...r,select:e},n[3]=e,n[4]=s);let c=i(s),l,u;return n[5]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>J(a),u=[a],n[5]=l,n[6]=u):(l=n[5],u=n[6]),d.useEffect(l,u),c},Fe=e=>e.enabled?e.assistants.reduce((e,t)=>e+(t.unreadCount??0),0):0,Ie=()=>{let e=(0,f.c)(5),n,r,i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=t(),n=o,r={...K(i),select:Fe},e[0]=n,e[1]=r,e[2]=i):(n=e[0],r=e[1],i=e[2]);let a=n(r),s,c;return e[3]===Symbol.for(`react.memo_cache_sentinel`)?(s=()=>J(i),c=[i],e[3]=s,e[4]=c):(s=e[3],c=e[4]),d.useEffect(s,c),a.data??0},Le=e=>e.enabled&&Me(e),Re=()=>{let e=(0,f.c)(5),n,r,i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=t(),n=o,r={...K(i),select:Le},e[0]=n,e[1]=r,e[2]=i):(n=e[0],r=e[1],i=e[2]);let a=n(r),s,c;return e[3]===Symbol.for(`react.memo_cache_sentinel`)?(s=()=>J(i),c=[i],e[3]=s,e[4]=c):(s=e[3],c=e[4]),d.useEffect(s,c),a.data??!1},ze=(e,t={})=>{let n=new URLSearchParams;return n.set(`limit`,String(t.limit??20)),t.before&&n.set(`before`,t.before),t.messageID&&n.set(`messageID`,t.messageID),`/api/yuri/assistants/${encodeURIComponent(e)}/contact/messages?${n}`},Y=async(e,t,n)=>oe(await U(ze(e,t),n?{signal:n}:{})),Be=(e,t)=>e.generation===t.generation&&e.revision===t.revision&&e.olderCursor===t.olderCursor&&e.olderComplete===t.olderComplete&&e.hasMessageGap===t.hasMessageGap&&e.gapCursor===t.gapCursor&&e.messages===t.messages&&e.liveWindowIDs===t.liveWindowIDs&&e.gapRequestIDs===t.gapRequestIDs&&e.gapTargetIDs===t.gapTargetIDs,X=new Map,Z=new Map,Q=e=>e.join(``),Ve=async(e,t,n,r,i)=>{let a=Q(t),o=Z.get(a);if(o)return o;let c=(async()=>{let a=s.getQueryData(t)??n,o=0,c=!1,l=!1,u=a.gapRequestIDs?[...a.gapRequestIDs]:null,d=a.gapCursor;for(;a.hasMessageGap&&a.gapCursor&&o<5&&!i?.aborted;){G(r.transport,r.runtimeGeneration),o+=1;let n=a.gapCursor;try{let o=await Y(e,{limit:20,before:n},i);G(r.transport,r.runtimeGeneration);let l=s.getQueryData(t)??a;if(o.generation!==l.generation){a=l;break}let f=!u||!!(l.hasMessageGap&&l.gapRequestIDs&&l.gapRequestIDs.length===u.length&&l.gapRequestIDs.every((e,t)=>e===u[t]));if(a=De(l,o,u?{requestIDs:u,cursor:d}:void 0),s.setQueryData(t,a),!f)break;if(!a.hasMessageGap){c=!0;break}if(a.gapCursor&&a.gapCursor!==n)c=!0;else break}catch(e){if(i?.aborted||m(e))break;l=!0,a=s.getQueryData(t)??a;break}}return{view:s.getQueryData(t)??a,failed:l,progressed:c}})();Z.set(a,c);try{return await c}finally{Z.get(a)===c&&Z.delete(a)}},He=(e,r=t(),i=n(),a={})=>({queryKey:H.contact(e,r,i),queryFn:async({signal:t})=>{G(r,i),await l(),G(r,i);let n=H.contact(e,r,i),a=s.getQueryData(n),o=await Y(e,{limit:20},t);G(r,i);let c=Te(s.getQueryData(n)??a??null,o);s.setQueryData(n,c);let u=Q(n);if(c.hasMessageGap&&c.gapCursor){X.delete(u);let a=await Ve(e,n,c,{transport:r,runtimeGeneration:i},t);c=a.view,(a.failed||a.view.hasMessageGap&&!a.progressed)&&a.view.gapCursor&&X.set(u,a.view.gapCursor)}else X.delete(u);G(r,i);let d=s.getQueryData(n)??c;return a&&Be(a,d)?a:d},retry:2,staleTime:0,refetchInterval:()=>a.reconcileInForeground?Ne(s.getQueryData(H.snapshot(r)),{assistantID:e}):!1,refetchIntervalInBackground:!1,refetchOnWindowFocus:!0,refetchOnReconnect:!0,structuralSharing:!0}),Ue=(e,r=!0)=>{let i=t(),a=n(),[l,u]=d.useState(!1),[f,p]=d.useState(null),[h,g]=d.useState(!1),_=d.useRef(null),v=d.useRef(null),y=d.useRef(null),b=d.useRef(null),x=d.useRef({assistantID:e,transport:i,runtimeGeneration:a,enabled:r});x.current={assistantID:e,transport:i,runtimeGeneration:a,enabled:r};let S=o({...He(e,i,a,{reconcileInForeground:!0}),enabled:r&&!!e});d.useEffect(()=>{!r||!e||s.invalidateQueries({queryKey:H.snapshot(i),exact:!0},{cancelRefetch:!1})},[e,r,a,i]),d.useEffect(()=>c(n=>{t()===i&&(n.type===`assistants-changed`||n.type===`event-stream-ready`||n.type===`contact-turn-end`)&&(n.type===`contact-turn-end`&&`assistantID`in n&&n.assistantID!==e||s.invalidateQueries({queryKey:H.contact(e,i,a),exact:!0}))}),[e,a,i]),d.useEffect(()=>{let t=Q(H.contact(e,i,a));return()=>{y.current?.abort(),b.current?.abort(),y.current=null,b.current=null,_.current=null,v.current=null,X.delete(t)}},[e,i,a,r]);let C=S.data,w=H.contact(e,i,a),T=async()=>{if(!e||!r)return;if(_.current)return _.current;let t=s.getQueryData(w)??C;if(!t||t.olderComplete||!t.olderCursor)return;p(null),u(!0);let n=new AbortController;b.current?.abort(),b.current=n;let o={transport:i,runtimeGeneration:a,assistantID:e,cursor:t.olderCursor},c=(async()=>{try{G(o.transport,o.runtimeGeneration);let e=await Y(o.assistantID,{limit:20,before:o.cursor},n.signal);if(n.signal.aborted||(G(o.transport,o.runtimeGeneration),x.current.assistantID!==o.assistantID||x.current.transport!==o.transport||x.current.runtimeGeneration!==o.runtimeGeneration))return;let r=s.getQueryData(w)??t;if(e.generation!==r.generation)return;s.setQueryData(w,Ee(r,e))}catch(e){if(n.signal.aborted||m(e))return;let t=e instanceof Error?e:Error(String(e));throw p(t),t}finally{b.current===n&&(b.current=null),u(!1),_.current=null}})();return _.current=c,c},E=async(t=`explicit`)=>{if(!e||!r)return;if(v.current)return v.current;let n=s.getQueryData(w)??C;if(!n?.hasMessageGap||!n.gapCursor)return;let o=Q(w);if(t===`auto`&&X.get(o)===n.gapCursor)return;t===`explicit`&&X.delete(o),g(!0);let c=new AbortController;y.current?.abort(),y.current=c;let l={transport:i,runtimeGeneration:a,assistantID:e,cursor:n.gapCursor},u=(async()=>{try{G(l.transport,l.runtimeGeneration);let e=await Ve(l.assistantID,w,n,{transport:l.transport,runtimeGeneration:l.runtimeGeneration},c.signal);if(c.signal.aborted)return;if(G(l.transport,l.runtimeGeneration),e.failed||!e.progressed){e.view.gapCursor&&X.set(o,e.view.gapCursor);return}e.view.hasMessageGap||X.delete(o)}catch(e){if(c.signal.aborted||m(e))return;throw X.set(o,l.cursor),e}finally{y.current===c&&(y.current=null),g(!1),v.current=null}})();return v.current=u,u};return d.useEffect(()=>{if(!r||!e||!C?.hasMessageGap||!C.gapCursor||S.isFetching||h)return;let t=Q(w);X.get(t)!==C.gapCursor&&E(`auto`).catch(()=>void 0)},[r,e,C?.hasMessageGap,C?.gapCursor,S.isFetching,h,w]),{data:C?{messages:C.messages,generation:C.generation,revision:C.revision,nextCursor:C.olderCursor,complete:C.olderComplete}:void 0,status:S.status,fetchStatus:S.fetchStatus,isError:S.isError,isPending:S.isPending,isFetching:S.isFetching,isSuccess:S.isSuccess,error:S.error instanceof Error?S.error:S.error?Error(String(S.error)):null,refetch:()=>S.refetch(),fetchPreviousPage:T,hasPreviousPage:!!(C&&!C.olderComplete&&C.olderCursor),isFetchingPreviousPage:l,previousPageError:f,hasMessageGap:!!C?.hasMessageGap,isFillingMessageGap:h,retryMessageGap:()=>E(`explicit`)}},We=async(e,r)=>{let i=t(),a=n();await l(),G(i,a);let o=await Y(e,{messageID:r,limit:1});if(G(i,a),!o.messages.some(e=>e.messageID===r&&e.role===`user`))return null;s.invalidateQueries({queryKey:H.contact(e,i,a),exact:!0}),s.invalidateQueries({queryKey:H.snapshot(i),exact:!0});let c=s.getQueryData(H.snapshot(i));return{admitted:!0,messageID:r,revision:o.revision??c?.revision??null}},Ge=(e,r=t(),i=n())=>({queryKey:H.scheduledTasks(e,r,i),queryFn:async({signal:t})=>{G(r,i);let n=se(await U(`/api/yuri/assistants/${encodeURIComponent(e)}/scheduled-tasks`,{signal:t}));return G(r,i),n},refetchOnMount:`always`,retry:(e,t)=>!(t instanceof p&&t.status===404)&&e<2}),Ke=(e,r)=>{let i=(0,f.c)(6),a=r===void 0||r,s,c;if(i[0]!==e){let r=t(),a=n();c=o,s=Ge(e,r,a),i[0]=e,i[1]=s,i[2]=c}else s=i[1],c=i[2];let l=a&&!!e,u;return i[3]!==s||i[4]!==l?(u={...s,enabled:l},i[3]=s,i[4]=l,i[5]=u):u=i[5],c(u)},$=(e=t())=>({queryKey:H.globalScheduledTasks(e),queryFn:me,refetchOnMount:`always`}),qe=e=>{let t=(0,f.c)(3),n=e===void 0||e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=$(),t[0]=r):r=t[0];let i;return t[1]===n?i=t[2]:(i={...r,enabled:n},t[1]=n,t[2]=i),o(i)},Je=e=>e.tasks.some(({task:e})=>e.state.lastStatus===`running`),Ye=()=>{let e=(0,f.c)(5),n,r,i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=t(),n=o,r={...$(i),select:Je,staleTime:0,refetchInterval:mt,refetchIntervalInBackground:!1},e[0]=n,e[1]=r,e[2]=i):(n=e[0],r=e[1],i=e[2]);let a=n(r),l,u;return e[3]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>c(e=>{t()===i&&(e.type===`scheduled-task-ran`||e.type===`event-stream-ready`)&&s.invalidateQueries({queryKey:$(i).queryKey,exact:!0})}),u=[i],e[3]=l,e[4]=u):(l=e[3],u=e[4]),d.useEffect(l,u),a.data===!0},Xe=(e,r=t())=>{s.invalidateQueries({queryKey:[r,n(),`assistants`,`contact`,e]})},Ze=(e=t())=>({queryKey:H.capability(e),queryFn:()=>dt(),retry:!1}),Qe=()=>{let e=(0,f.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=Ze(),e[0]=t):t=e[0],o(t)},$e=(e=s,n=t())=>e.getQueryData(H.snapshot(n)),et=(e=s,n=t())=>e.fetchQuery(K(n)),tt=async(e=s)=>{let r=t(),i=n();await e.invalidateQueries({queryKey:H.snapshot(r),exact:!0}),G(r,i);let a=await e.fetchQuery(K(r));return G(r,i),a},nt=15e3,rt=e=>{throw e instanceof p?e:m(e)?new p(`admission_timeout`,408):e},it=async(e,r,i)=>{let a=t(),o=n(),s=typeof i==`string`?[{type:`text`,text:i}]:Array.isArray(i.parts)&&i.parts.length>0?i.parts:[{type:`text`,text:i.text??``}],c=AbortSignal.timeout(nt);try{let t=ie(await U(`/api/yuri/assistants/${encodeURIComponent(e)}/messages`,{...W(`POST`,{messageID:r,parts:s,language:u.getState().locale}),signal:c}));return G(a,o),Oe(e,t.binding,a),Xe(e,a),t}catch(e){return rt(e)}},at=async(e,r,i,a,o)=>{let s=t(),c=n(),l=A(await U(`/api/yuri/assistants/${encodeURIComponent(e)}/share`,W(`POST`,{operationID:r,payload:{messageID:i,parts:a,source:o}})));return G(s,c),l},ot=async(e,r=t(),i=n())=>{G(r,i);let a=A(await U(`/api/yuri/assistants/share-operations/${encodeURIComponent(e)}`));return G(r,i),a},st=async(e,r=t(),i=n())=>{let a=e;for(let e=0;e<60&&(a.state===`running`||a.state===`submitting`);e+=1)G(r,i),await new Promise(e=>setTimeout(e,750)),a=await ot(a.operationID,r,i);if(G(r,i),a.state===`completed`)return a;throw a.state===`failed`?new h(a.errorCode??`share_failed`,400,a):new h(`share_unresolved`,408,a)},ct=async e=>{let n=t(),r=k(await U(`/api/yuri/assistants`,W(`POST`,{...e,language:u.getState().locale})));return ke(r,n),r},lt=async(e,r)=>{let i=t(),a=n(),o=k(await U(`/api/yuri/assistants/${encodeURIComponent(e.id)}`,W(`PATCH`,{...r,expectedRevision:e.revision})));return G(i,a),r.pinned===void 0?ke(o,i):(await s.cancelQueries({queryKey:H.snapshot(i),exact:!0}),G(i,a),await s.fetchQuery(K(i)),G(i,a)),o},ut=async e=>{await U(`/api/yuri/assistants/${encodeURIComponent(e.id)}`,W(`DELETE`,{expectedRevision:e.revision})),await s.invalidateQueries({queryKey:H.snapshot(t())})},dt=async()=>w(await U(`/api/yuri/assistants/capability`)),ft=async(e,r)=>{let i=t(),a=n(),o=O(r);try{let t=te(await U(`/api/yuri/assistants/${encodeURIComponent(e)}/contact/read`,{...W(`POST`,o),signal:AbortSignal.timeout(15e3)}));if(G(i,a),t.assistantID!==e)throw new p(`invalid_assistant_read_response`,200);return t}finally{t()===i&&n()===a&&s.invalidateQueries({queryKey:H.snapshot(i),exact:!0})}},pt=async e=>{let r=e.assistants.filter(e=>(e.unreadCount??0)>0&&e.readTip).map(e=>({id:e.id,position:{...e.readTip}})),i=t(),a=n(),o=[];for(let e=0;e<r.length;e+=4)o.push(...await Promise.allSettled(r.slice(e,e+4).map(async e=>(G(i,a),ft(e.id,e.position)))));return{failed:o.filter(e=>e.status===`rejected`).length}};function mt(e){return e.state.data&&Je(e.state.data)?2500:15e3}export{p as A,ye as C,pe as D,me as E,m as M,_e as O,st as S,ge as T,Pe as _,et as a,qe as b,pt as c,it as d,at as f,Ke as g,Ue as h,ut as i,h as j,he as k,ft as l,Qe as m,We as n,dt as o,lt as p,ct as r,tt as s,He as t,$e as u,Ie as v,ve as w,Ye as x,Re as y};
@@ -1 +0,0 @@
1
- import"./rolldown-runtime-hePW80VL.js";import{ot as e,st as t}from"./vendor-base-ui-wXsskyKm.js";import{n}from"./vendor-react-BkccXcWz.js";import{o as r}from"./session-startup-barrier-DT-hIBRf.js";var i=n();t();var a=e();function o(e){let t=(0,i.c)(8),n,o;t[0]===e?(n=t[1],o=t[2]):({className:n,...o}=e,t[0]=e,t[1]=n,t[2]=o);let s;t[3]===n?s=t[4]:(s=r(`bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-none`,n),t[3]=n,t[4]=s);let c;return t[5]!==o||t[6]!==s?(c=(0,a.jsx)(`div`,{"data-slot":`card`,className:s,...o}),t[5]=o,t[6]=s,t[7]=c):c=t[7],c}function s(e){let t=(0,i.c)(8),n,o;t[0]===e?(n=t[1],o=t[2]):({className:n,...o}=e,t[0]=e,t[1]=n,t[2]=o);let s;t[3]===n?s=t[4]:(s=r(`@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6`,n),t[3]=n,t[4]=s);let c;return t[5]!==o||t[6]!==s?(c=(0,a.jsx)(`div`,{"data-slot":`card-header`,className:s,...o}),t[5]=o,t[6]=s,t[7]=c):c=t[7],c}function c(e){let t=(0,i.c)(8),n,o;t[0]===e?(n=t[1],o=t[2]):({className:n,...o}=e,t[0]=e,t[1]=n,t[2]=o);let s;t[3]===n?s=t[4]:(s=r(`leading-none font-semibold`,n),t[3]=n,t[4]=s);let c;return t[5]!==o||t[6]!==s?(c=(0,a.jsx)(`div`,{"data-slot":`card-title`,className:s,...o}),t[5]=o,t[6]=s,t[7]=c):c=t[7],c}function l(e){let t=(0,i.c)(8),n,o;t[0]===e?(n=t[1],o=t[2]):({className:n,...o}=e,t[0]=e,t[1]=n,t[2]=o);let s;t[3]===n?s=t[4]:(s=r(`px-6`,n),t[3]=n,t[4]=s);let c;return t[5]!==o||t[6]!==s?(c=(0,a.jsx)(`div`,{"data-slot":`card-content`,className:s,...o}),t[5]=o,t[6]=s,t[7]=c):c=t[7],c}export{c as i,l as n,s as r,o as t};
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{n as t,t as n}from"./platform-CiUKDeXd.js";import{ot as r,st as i}from"./vendor-base-ui-wXsskyKm.js";import{n as a}from"./vendor-react-BkccXcWz.js";import{m as o,r as s}from"./vendor-reactuses-core-DjKFMfz7.js";import{a as c,n as l}from"./vendor-aparajita-capacitor-secure-storage-xol_6BsB.js";import{i as u,o as d}from"./session-startup-barrier-DT-hIBRf.js";import{n as f}from"./Icon-DmykXZL1.js";import{t as p}from"./ui-ee2iN869.js";import{t as m}from"./i18n-DXc6czdR.js";import{t as h}from"./MobileResizableSheet-CqphcaKq.js";import{o as g,t as _}from"./vendor-framer-motion-D5NyyC73.js";import{t as v}from"./textarea-ZiXxEOHK.js";import{t as y}from"./LoadingImage-Df22Rkor.js";var b=e(i(),1),x=a(),S=c(`YuriMedia`);function C(e){return e.platform===`android`||/Android/i.test(e.userAgent)||e.userAgentDataPlatform===`Android`}function w(){if(typeof window>`u`)return!1;let e=navigator.userAgentData;return C({platform:n(),userAgent:navigator.userAgent||``,userAgentDataPlatform:e?.platform})}function T(){return t()&&l.getPlatform()===`android`&&l.isPluginAvailable(`YuriMedia`)}async function E(e){if(!T())return null;let t=await S.pickMedia({limit:e});if(t.cancelled)return[];let n=[];for(let e of t.files){let t=await fetch(l.convertFileSrc(e.path));if(!t.ok)throw Error(`Native media fetch failed (${t.status})`);let r=await t.blob();n.push(new File([r],e.name,{type:e.mimeType}))}return n}var D=r(),O=`h-auto min-h-12 w-full justify-start gap-3 rounded-none supports-[corner-shape:squircle]:rounded-none px-4 border-b border-[var(--surface-subtle)] last:border-b-0`,k=e=>{let t=(0,x.c)(38),{id:n,open:r,onOpenChange:i,onPickPhotos:a,onPickFiles:o}=e,{t:s}=m(),c;t[0]===s?c=t[1]:(c=s(`chat.chatInput.actions.addAttachment`),t[0]=s,t[1]=c);let l;t[2]===c?l=t[3]:(l=(0,D.jsx)(`h2`,{className:`truncate typography-ui-label font-semibold`,children:c}),t[2]=c,t[3]=l);let d;t[4]===s?d=t[5]:(d=s(`chat.chatInput.actions.addAttachment`),t[4]=s,t[5]=d);let p;t[6]===s?p=t[7]:(p=s(`mobile.surface.closeAria`),t[6]=s,t[7]=p);let g;t[8]===s?g=t[9]:(g=s(`mobile.sessions.sheet.resizeAria`),t[8]=s,t[9]=g);let _;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,D.jsx)(f,{name:`file-image`,className:`size-5 flex-shrink-0 text-muted-foreground`}),t[10]=_):_=t[10];let v;t[11]===s?v=t[12]:(v=s(`chat.chatInput.actions.attachPhotos`),t[11]=s,t[12]=v);let y;t[13]===v?y=t[14]:(y=(0,D.jsx)(`span`,{className:`truncate`,children:v}),t[13]=v,t[14]=y);let b;t[15]!==a||t[16]!==y?(b=(0,D.jsxs)(u,{type:`button`,variant:`ghost`,size:`lg`,className:O,"data-mobile-press-feedback":`none`,onClick:a,children:[_,y]}),t[15]=a,t[16]=y,t[17]=b):b=t[17];let S;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,D.jsx)(f,{name:`attachment-2`,className:`size-5 flex-shrink-0 text-muted-foreground`}),t[18]=S):S=t[18];let C;t[19]===s?C=t[20]:(C=s(`chat.chatInput.actions.attachFiles`),t[19]=s,t[20]=C);let w;t[21]===C?w=t[22]:(w=(0,D.jsx)(`span`,{className:`truncate`,children:C}),t[21]=C,t[22]=w);let T;t[23]!==o||t[24]!==w?(T=(0,D.jsxs)(u,{type:`button`,variant:`ghost`,size:`lg`,className:O,"data-mobile-press-feedback":`none`,onClick:o,children:[S,w]}),t[23]=o,t[24]=w,t[25]=T):T=t[25];let E;t[26]!==T||t[27]!==b?(E=(0,D.jsx)(`div`,{className:`flex min-h-0 flex-col overflow-y-auto overscroll-contain px-3 pb-3`,children:(0,D.jsxs)(`div`,{className:`overflow-hidden rounded-2xl bg-[var(--surface-muted)]`,"data-page-scroll-lock":`true`,children:[b,T]})}),t[26]=T,t[27]=b,t[28]=E):E=t[28];let k;return t[29]!==n||t[30]!==i||t[31]!==r||t[32]!==E||t[33]!==l||t[34]!==d||t[35]!==p||t[36]!==g?(k=(0,D.jsx)(h,{id:n,open:r,onOpenChange:i,title:l,ariaLabel:d,closeAriaLabel:p,resizeAriaLabel:g,fitContent:!0,children:E}),t[29]=n,t[30]=i,t[31]=r,t[32]=E,t[33]=l,t[34]=d,t[35]=p,t[36]=g,t[37]=k):k=t[37],k},ee=e=>e.nativeEvent.isComposing||e.nativeEvent.keyCode===229;function A(e){let t=(0,x.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:r,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===r?a=t[5]:(a=d(`inline-flex shrink-0 items-center justify-center rounded-full bg-foreground text-background`,r),t[4]=r,t[5]=a);let o;return t[6]!==n||t[7]!==i||t[8]!==a?(o=(0,D.jsx)(`span`,{className:a,...i,"aria-hidden":!0,children:n}),t[6]=n,t[7]=i,t[8]=a,t[9]=o):o=t[9],o}function j(e){let t=(0,x.c)(7),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,D.jsx)(`span`,{"data-stop-glyph":`true`,className:`block size-[38%] rounded-[20%] bg-current`}),t[3]=i):i=t[3];let a;return t[4]!==n||t[5]!==r?(a=(0,D.jsx)(A,{className:n,...r,children:i}),t[4]=n,t[5]=r,t[6]=a):a=t[6],a}function M(e){let t=(0,x.c)(13),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,spinning:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i!==void 0&&i,o=a?`loader-4`:`arrow-up`,s=a?`size-[50%] animate-spin`:`size-[56%]`,c;t[4]===s?c=t[5]:(c=d(s),t[4]=s,t[5]=c);let l;t[6]!==o||t[7]!==c?(l=(0,D.jsx)(f,{name:o,weight:`medium`,className:c}),t[6]=o,t[7]=c,t[8]=l):l=t[8];let u;return t[9]!==n||t[10]!==r||t[11]!==l?(u=(0,D.jsx)(A,{className:n,...r,children:l}),t[9]=n,t[10]=r,t[11]=l,t[12]=u):u=t[12],u}var N=`border border-[color-mix(in_srgb,var(--interactive-border)_50%,transparent)] dark:border-transparent bg-[var(--surface-background)] shadow-[0_2px_6px_-3px_color-mix(in_srgb,var(--surface-foreground)_4%,transparent),inset_0_1px_0_var(--yuri-mobile-glass-highlight)] transition-colors duration-150 motion-reduce:transition-none dark:bg-[color-mix(in_srgb,var(--surface-background),var(--surface-foreground)_8%)] dark:shadow-none`,te=b.memo(function(){let e=(0,x.c)(10),t=b.useRef(null),n=b.useRef(0),r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=[],e[0]=r):r=e[0];let i=b.useRef(r),a=_(),s;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(s=()=>t.current?.parentElement,e[1]=s):s=e[1];let c=s,l;e[2]===a?l=e[3]:(l=()=>{let e=t.current,r=e?.parentElement;if(!e||!r)return;let o=r.getBoundingClientRect().height,s=n.current;if(!o||Math.abs(o-s)<.5)return;n.current=o;let c=r.querySelector(`[data-composer-input-shell]`),l=new DOMMatrixReadOnly(window.getComputedStyle(e).transform).m22,u=c?new DOMMatrixReadOnly(window.getComputedStyle(c).transform).m42:0;if(i.current.forEach(re),i.current=[],!s||a){e.style.transform=``,c&&(c.style.transform=``);return}let d={duration:.2,ease:`easeOut`};i.current.push(g(e,{scaleY:[s*l/o,1]},d)),c&&i.current.push(g(c,{y:[o-s+u,0]},d))},e[2]=a,e[3]=l),o(typeof ResizeObserver<`u`?c:null,l);let u,f;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(u=()=>{let e=t.current,r=e?.parentElement;return n.current=r?.getBoundingClientRect().height??0,()=>{i.current.forEach(P),e&&(e.style.transform=``);let t=r?.querySelector(`[data-composer-input-shell]`);t&&(t.style.transform=``)}},f=[],e[4]=u,e[5]=f):(u=e[4],f=e[5]),b.useLayoutEffect(u,f);let p,m;e[6]===a?(p=e[7],m=e[8]):(p=()=>{if(!a)return;i.current.forEach(F),i.current=[],t.current&&(t.current.style.transform=``);let e=t.current?.parentElement?.querySelector(`[data-composer-input-shell]`);e&&(e.style.transform=``)},m=[a],e[6]=a,e[7]=p,e[8]=m),b.useLayoutEffect(p,m);let h;return e[9]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,D.jsx)(`div`,{ref:t,"aria-hidden":`true`,"data-composer-material":``,className:d(`pointer-events-none absolute -inset-px -z-10`,N,`dark:group-hover/composer:bg-[color-mix(in_srgb,var(--surface-background),var(--surface-foreground)_11%)] dark:group-focus-within/composer:bg-[color-mix(in_srgb,var(--surface-background),var(--surface-foreground)_11%)]`),style:{borderRadius:`inherit`,transformOrigin:`50% 100%`}}),e[9]=h):h=e[9],h}),ne=b.forwardRef((e,t)=>{let n=(0,x.c)(23),r,i,a,o,s,c;n[0]===e?(r=n[1],i=n[2],a=n[3],o=n[4],s=n[5],c=n[6]):({children:r,className:i,expanded:s,animateResize:c,style:o,...a}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a,n[4]=o,n[5]=s,n[6]=c);let l=s!==void 0&&s,u=c!==void 0&&c,f;n[7]!==u||n[8]!==i||n[9]!==l?(f=d(`relative flex flex-col overflow-visible`,u?`group/composer isolate border border-transparent`:d(N,`dark:hover:bg-[color-mix(in_srgb,var(--surface-background),var(--surface-foreground)_11%)] dark:focus-within:bg-[color-mix(in_srgb,var(--surface-background),var(--surface-foreground)_11%)]`),l&&`min-h-0 flex-1`,i),n[7]=u,n[8]=i,n[9]=l,n[10]=f):f=n[10];let p;n[11]===o?p=n[12]:(p={borderRadius:`var(--radius-xl)`,...o},n[11]=o,n[12]=p);let m=u||void 0,h;n[13]===u?h=n[14]:(h=u?(0,D.jsx)(te,{}):null,n[13]=u,n[14]=h);let g;return n[15]!==r||n[16]!==a||n[17]!==t||n[18]!==f||n[19]!==p||n[20]!==m||n[21]!==h?(g=(0,D.jsxs)(`div`,{ref:t,className:f,style:p,...a,"data-composer-animated-resize":m,children:[h,r]}),n[15]=r,n[16]=a,n[17]=t,n[18]=f,n[19]=p,n[20]=m,n[21]=h,n[22]=g):g=n[22],g});ne.displayName=`ChatComposerSurface`;function re(e){return e.stop()}function P(e){return e.stop()}function F(e){return e.stop()}var ie=b.forwardRef((e,t)=>{let n=(0,x.c)(3),r;return n[0]!==e||n[1]!==t?(r=(0,D.jsx)(v,{ref:t,...e}),n[0]=e,n[1]=t,n[2]=r):r=n[2],r});ie.displayName=`ChatPromptTextarea`;var ae=e=>{let t=(0,x.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:r,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===r?a=t[5]:(a=d(`flex shrink-0 items-center gap-2 bg-transparent px-2.5 py-1.5`,r),t[4]=r,t[5]=a);let o;return t[6]!==n||t[7]!==i||t[8]!==a?(o=(0,D.jsx)(`div`,{className:a,"data-chat-input-footer":`true`,...i,children:n}),t[6]=n,t[7]=i,t[8]=a,t[9]=o):o=t[9],o},oe=(e,t)=>{typeof e==`function`?e(t):e&&(e.current=t)},se=({value:e,attachments:t=[],disabled:n=!1,pending:r=!1,placeholder:i,isMobile:a=!1,onChange:c,onSubmit:l,onStop:u,onAddFiles:h,onRemoveAttachment:g,addFilesLabel:_,removeAttachmentLabel:v,fileAccept:x=`image/*`,sendLabel:S,stopLabel:C,hint:O,leftControls:A,rightControls:N,footerContent:te,inputHeader:re,attachmentContent:P,highlightedContent:F,highlightRef:se,inputRef:ce,textareaProps:I,textLayoutClassName:L,inputClassName:R,inputOuterClassName:le,inputStyle:ue,footerClassName:de,footerStyle:fe,contentClassName:pe,inputSectionClassName:me,autoResize:z=!0,disableInputWhilePending:B=!0,layout:he=`stacked`,children:ge,className:_e,expanded:V=!1,...ve})=>{let{t:ye}=m(),H=he===`inline`,[be,xe]=b.useState(!1),[Se,U]=b.useState(!1),W=w(),Ce=t.length>0||be,G=b.useRef(null),K=b.useRef(null),q=b.useRef(null),we=b.useId().replace(/:/g,``),J=s(()=>{if(!z||V||I?.fillContainer){H&&xe(!1);return}let e=G.current;if(!e)return;e.style.height=H?`0px`:`auto`;let t=window.getComputedStyle(e),n=Number.parseFloat(t.maxHeight),r=H?Math.max(Number.parseFloat(t.minHeight)||0,(Number.parseFloat(t.lineHeight)||0)+(Number.parseFloat(t.paddingTop)||0)+(Number.parseFloat(t.paddingBottom)||0)):0,i=H?Math.max(e.scrollHeight,r):e.scrollHeight,a=Number.isFinite(n)?Math.min(i,n):i;e.style.height=`${a}px`,e.style.overflowY=Number.isFinite(n)&&i>n?`auto`:`hidden`;let o=a>Math.ceil(r);H&&xe(e=>e===o?e:o)});b.useLayoutEffect(()=>{J()},[z,V,H,I?.fillContainer,e,J]),o(H&&z&&!V&&!I?.fillContainer?G:null,J);let Te=e=>{I?.onKeyDown?.(e),!(e.defaultPrevented||ee(e))&&e.key===`Enter`&&!e.shiftKey&&!a&&(e.preventDefault(),!n&&(!r||!B)&&l())},Ee=e=>{h?.(e.target.files),e.target.value=``},De=s(()=>{G.current?.blur(),U(!0)}),Oe=s(e=>{U(!1),requestAnimationFrame(()=>e?.click())}),ke=s(()=>{U(!1),requestAnimationFrame(()=>{(async()=>{if(!T()){q.current?.click();return}try{let e=await E(20);if(e===null){q.current?.click();return}e.length>0&&h?.(e)}catch(e){console.error(`Native photo pick failed`,e),p.error(ye(`chat.chatInput.toast.attachFileFailed`))}})()})}),Y=e.trim().length>0||t.length>0,Ae=t.filter(e=>e.mime.startsWith(`image/`)),X=t.filter(e=>!e.mime.startsWith(`image/`)),je=h?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`input`,{ref:K,type:`file`,accept:x,multiple:!0,className:`hidden`,onChange:Ee}),W?(0,D.jsx)(`input`,{ref:q,type:`file`,accept:`image/*`,multiple:!0,className:`hidden`,onChange:Ee}):null,(0,D.jsx)(`button`,{type:`button`,className:`flex size-8 shrink-0 items-center justify-center rounded-md text-foreground outline-none hover:bg-[var(--interactive-hover)] disabled:cursor-not-allowed disabled:opacity-40`,onClick:()=>W?De():K.current?.click(),onMouseDown:a?e=>e.preventDefault():void 0,onPointerDownCapture:a?e=>e.preventDefault():void 0,disabled:n||r,"aria-label":_,children:(0,D.jsx)(f,{name:`attachment-2`,className:`size-[18px]`})})]}):null,Z=!n&&!r&&Y,Q=a?`size-6`:`size-full`,Me=r&&u?(0,D.jsx)(`button`,{type:`button`,"data-composer-stop":`true`,className:`flex size-8 shrink-0 items-center justify-center rounded-full outline-none hover:opacity-80`,onClick:u,"aria-label":C,children:(0,D.jsx)(j,{className:Q})}):(0,D.jsx)(`button`,{type:`submit`,"data-composer-send":`true`,"data-composer-circle":Z?`true`:void 0,className:d(`flex size-8 shrink-0 items-center justify-center outline-none`,Z?`rounded-full hover:opacity-80`:`rounded-md text-primary hover:bg-[var(--interactive-hover)] disabled:cursor-not-allowed disabled:opacity-30`),disabled:n||r||!Y,"aria-label":S,children:Z?(0,D.jsx)(M,{className:Q}):(0,D.jsx)(f,{name:r?`loader-4`:`send-plane-2`,className:d(`size-4`,r&&`animate-spin`)})}),Ne=r&&u?(0,D.jsx)(`button`,{type:`button`,"data-composer-stop":`true`,className:`flex size-8 shrink-0 items-center justify-center rounded-full outline-none hover:opacity-80`,onClick:u,"aria-label":C,children:(0,D.jsx)(j,{className:Q})}):(0,D.jsx)(`button`,{type:`submit`,"data-composer-send":`true`,"data-composer-circle":`true`,className:d(`flex size-8 shrink-0 items-center justify-center rounded-full outline-none`,Z?`hover:opacity-80`:`cursor-not-allowed opacity-30`),disabled:n||r||!Y,"aria-busy":r||void 0,"aria-label":S,onClick:()=>G.current?.focus({preventScroll:!0}),onMouseDown:e=>e.preventDefault(),onPointerDownCapture:a?e=>e.preventDefault():void 0,children:(0,D.jsx)(M,{className:Q,spinning:r})}),Pe=H?Ne:Me,$=A===void 0?je:A;return(0,D.jsxs)(ne,{className:_e,expanded:V,...ve,children:[ge,(0,D.jsxs)(`div`,{"data-composer-content":`true`,"data-composer-layout":he,className:d(`relative flex min-h-0`,H?d(`min-h-12 flex-row`,Ce?`items-end`:`items-center`):`flex-col`,V&&`flex-1`,pe),children:[H&&$?(0,D.jsx)(`div`,{className:`flex h-12 shrink-0 items-center pl-1.5`,"data-composer-inline-attach":`true`,children:$}):null,(0,D.jsxs)(`div`,{className:d(`overflow-hidden`,H&&`min-w-0 flex-1`,V&&`flex min-h-0 flex-1 flex-col`,me),children:[re,P,Ae.length>0?(0,D.jsx)(`div`,{className:`flex gap-2 overflow-x-auto px-3 pt-3`,"data-chat-prompt-attachments":`true`,children:Ae.map(e=>(0,D.jsxs)(`div`,{className:`group relative shrink-0`,children:[(0,D.jsx)(`span`,{className:`block size-16`,children:(0,D.jsx)(y,{fill:!0,src:e.url,alt:e.name,className:`size-16 rounded-lg border border-border object-cover`})}),g?(0,D.jsx)(`button`,{type:`button`,className:`absolute -right-1 -top-1 flex size-6 items-center justify-center rounded-full border border-border bg-[var(--surface-elevated)] shadow-sm hover:bg-[var(--interactive-hover)]`,onClick:()=>g(e.id),"aria-label":v,children:(0,D.jsx)(f,{name:`close`,className:`size-3`})}):null]},e.id))}):null,X.length>0?(0,D.jsx)(`div`,{className:`flex flex-wrap gap-2 px-3 pt-3`,"data-chat-prompt-file-attachments":`true`,children:X.map(e=>(0,D.jsxs)(`div`,{className:`relative flex max-w-[12rem] items-center gap-1.5 rounded-lg border border-border bg-[var(--surface-elevated)] px-2 py-1`,children:[(0,D.jsx)(f,{name:`file-text`,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,D.jsx)(`span`,{className:`min-w-0 truncate typography-micro`,children:e.name}),g?(0,D.jsx)(`button`,{type:`button`,className:`flex size-5 shrink-0 items-center justify-center rounded-full text-muted-foreground hover:bg-[var(--interactive-hover)]`,onClick:()=>g(e.id),"aria-label":v,children:(0,D.jsx)(f,{name:`close`,className:`size-3`})}):null]},e.id))}):null,(0,D.jsxs)(`div`,{className:d(`relative overflow-hidden`,H&&d(`flex min-h-12`,be?`items-end`:`items-center`),V&&`flex min-h-0 flex-1 flex-col`),"data-composer-input-shell":`true`,children:[F?(0,D.jsx)(`div`,{ref:se,"aria-hidden":!0,"data-composer-highlight":`true`,className:d(`pointer-events-none absolute inset-0 z-0 rounded-b-none`,L,R),children:F}):null,(0,D.jsx)(ie,{...I,simple:!0,fillContainer:!H&&I?.fillContainer,ref:e=>{G.current=e,oe(ce,e)},"data-chat-input":`true`,value:e,onChange:e=>c(e.target.value,e),onKeyDown:Te,disabled:n||r&&B,placeholder:i,enterKeyHint:a?`enter`:I?.enterKeyHint,outerClassName:d(`ring-0 bg-transparent shadow-none hover:bg-transparent focus-within:ring-0`,H&&`flex-none`,V&&`min-h-0 flex-1`,le),className:d(`relative z-10 resize-none overflow-y-hidden appearance-none border-0 bg-transparent typography-markdown hover:border-transparent md:typography-ui-label`,H?`field-sizing-fixed min-h-12 max-h-32 px-3 py-3 leading-6`:`min-h-[52px] max-h-40 rounded-b-none px-3 pb-2 pt-4`,L,R,F&&`text-transparent caret-[var(--surface-foreground)]`),style:ue,rows:I?.rows??1})]})]}),H?(0,D.jsx)(`div`,{className:d(`flex h-12 shrink-0 items-center pr-1.5`,de),style:fe,"data-composer-inline-send":`true`,children:N??Pe}):(0,D.jsx)(ae,{className:de,style:fe,children:te??(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`div`,{className:`flex items-center gap-1.5`,children:A??je}),O?(0,D.jsx)(`div`,{className:`min-w-0 flex-1 truncate typography-micro text-muted-foreground`,children:O}):(0,D.jsx)(`div`,{className:`flex-1`}),(0,D.jsx)(`div`,{className:`flex items-center gap-1.5`,children:N??Pe})]})})]}),W&&h?(0,D.jsx)(k,{id:`mobile-attach-pick-${we}`,open:Se,onOpenChange:e=>{e||U(!1)},onPickPhotos:ke,onPickFiles:()=>Oe(K.current)}):null]})},ce=e=>{if(e.altKey||e.ctrlKey||e.metaKey)return!1;switch(e.key){case`ArrowUp`:case`PageUp`:case`Home`:return!0;default:return!1}},I=(e,t,n)=>{let r=t instanceof Element?t:t instanceof Node?t.parentElement:null;for(;r&&r!==e;){if(r instanceof HTMLElement){let e=r.scrollHeight-r.clientHeight;if(e>1&&(n===`up`?r.scrollTop>0:r.scrollTop<e-1))return!0}r=r.parentElement}return!1},L=(e,t)=>I(e,t,`up`),R=(e,t)=>I(e,t,`down`);export{M as a,k as c,w as d,se as i,T as l,R as n,j as o,L as r,ee as s,ce as t,E as u};
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{T as t,ot as n,st as r,w as i}from"./vendor-base-ui-wXsskyKm.js";import{n as a}from"./vendor-react-BkccXcWz.js";import{o}from"./session-startup-barrier-DT-hIBRf.js";import{n as s}from"./Icon-DmykXZL1.js";var c=a(),l=e(r(),1),u=n(),d=l.memo(function(e){let n=(0,c.c)(20),{checked:r,onChange:a,disabled:l,indeterminate:d,ariaLabel:f,className:p,iconClassName:m}=e,h=l!==void 0&&l,g=r||d,_;n[0]===a?_=n[1]:(_=e=>a(!!e),n[0]=a,n[1]=_);let v=g?`border-[color:color-mix(in_srgb,var(--primary-base)_65%,var(--interactive-border))] bg-transparent shadow-none hover:bg-[var(--interactive-hover)] hover:border-[color:color-mix(in_srgb,var(--primary-base)_75%,var(--interactive-border))]`:`border-[var(--interactive-border)] bg-transparent shadow-none hover:bg-[var(--interactive-hover)] hover:border-[var(--interactive-border)]`,y;n[2]!==p||n[3]!==v?(y=o(`group/checkbox relative flex shrink-0 self-center items-center justify-center rounded-[4px] border outline-none`,`h-[14px] w-[14px] min-h-[14px] min-w-[14px]`,`transition-[background-color,border-color,box-shadow] duration-200 ease-out`,v,`focus-visible:ring-2 focus-visible:ring-[var(--interactive-focus-ring)] focus-visible:ring-offset-1 focus-visible:ring-offset-transparent`,`disabled:cursor-not-allowed disabled:opacity-50`,p),n[2]=p,n[3]=v,n[4]=y):y=n[4];let b;n[5]===m?b=n[6]:(b=o(`flex items-center justify-center text-[var(--primary-base)]`,`data-[unchecked]:hidden`,m),n[5]=m,n[6]=b);let x;n[7]===d?x=n[8]:(x=d?(0,u.jsx)(s,{name:`subtract`,className:o(`h-[10px] w-[10px] min-h-[10px] min-w-[10px]`,`text-[var(--primary-base)]`)}):(0,u.jsx)(s,{name:`check`,className:o(`h-[10px] w-[10px] min-h-[10px] min-w-[10px]`,`text-[var(--primary-base)]`)}),n[7]=d,n[8]=x);let S;n[9]!==b||n[10]!==x?(S=(0,u.jsx)(i,{keepMounted:!0,className:b,children:x}),n[9]=b,n[10]=x,n[11]=S):S=n[11];let C;return n[12]!==f||n[13]!==r||n[14]!==h||n[15]!==d||n[16]!==_||n[17]!==y||n[18]!==S?(C=(0,u.jsx)(t,{checked:r,onCheckedChange:_,disabled:h,indeterminate:d,"aria-label":f,className:y,children:S}),n[12]=f,n[13]=r,n[14]=h,n[15]=d,n[16]=_,n[17]=y,n[18]=S,n[19]=C):C=n[19],C});export{d as t};
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{D as t,E as n,O as r,ot as i,st as a}from"./vendor-base-ui-wXsskyKm.js";import{n as o}from"./vendor-react-BkccXcWz.js";import{o as s}from"./session-startup-barrier-DT-hIBRf.js";var c=o(),l=e(a(),1),u=i(),d=r,f=e=>{let n=(0,c.c)(14),r,i,a,o;n[0]===e?(r=n[1],i=n[2],a=n[3],o=n[4]):({className:a,asChild:r,children:i,...o}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a,n[4]=o);let d;n[5]!==r||n[6]!==i?(d=r&&l.isValidElement(i)?{render:i}:{children:i},n[5]=r,n[6]=i,n[7]=d):d=n[7];let f=d,p;n[8]===a?p=n[9]:(p=s(`flex w-full items-center justify-between rounded-lg px-2 py-1.5 text-left text-foreground hover:bg-interactive-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary`,a),n[8]=a,n[9]=p);let m;return n[10]!==o||n[11]!==f||n[12]!==p?(m=(0,u.jsx)(t,{className:p,...o,...f}),n[10]=o,n[11]=f,n[12]=p,n[13]=m):m=n[13],m},p=e=>{let t=(0,c.c)(8),r,i;t[0]===e?(r=t[1],i=t[2]):({className:r,...i}=e,t[0]=e,t[1]=r,t[2]=i);let a;t[3]===r?a=t[4]:(a=s(`overflow-hidden data-[closed]:animate-collapsible-up data-[open]:animate-collapsible-down`,r),t[3]=r,t[4]=a);let o;return t[5]!==i||t[6]!==a?(o=(0,u.jsx)(n,{className:a,...i}),t[5]=i,t[6]=a,t[7]=o):o=t[7],o};export{p as n,f as r,d as t};
@@ -1 +0,0 @@
1
- import"./rolldown-runtime-hePW80VL.js";import{A as e,B as t,H as n,M as r,V as i,k as a,ot as o,st as s,z as c}from"./vendor-base-ui-wXsskyKm.js";import{n as l}from"./vendor-react-BkccXcWz.js";import{o as u}from"./session-startup-barrier-DT-hIBRf.js";import{n as d,r as f,t as p}from"./dropdown-menu.styles-BDla58Rm.js";var m=l();s();var h=o();function g(t){let n=(0,m.c)(4),r;n[0]===t?r=n[1]:({...r}=t,n[0]=t,n[1]=r);let i;return n[2]===r?i=n[3]:(i=(0,h.jsx)(e,{...r}),n[2]=r,n[3]=i),i}function _(e){let t=(0,m.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,h.jsx)(a,{...n}),t[2]=n,t[3]=r),r}function v(e){let n=(0,m.c)(20),r,a,o,s,l;n[0]===e?(r=n[1],a=n[2],o=n[3],s=n[4],l=n[5]):({className:a,positionerClassName:o,children:r,style:l,...s}=e,n[0]=e,n[1]=r,n[2]=a,n[3]=o,n[4]=s,n[5]=l);let f;n[6]===o?f=n[7]:(f=u(`app-region-no-drag z-50`,o),n[6]=o,n[7]=f);let p;n[8]===l?p=n[9]:(p={color:`var(--surface-elevated-foreground)`,...l},n[8]=l,n[9]=p);let g;n[10]===a?g=n[11]:(g=u(d,a),n[10]=a,n[11]=g);let _;n[12]!==r||n[13]!==s||n[14]!==p||n[15]!==g?(_=(0,h.jsx)(i,{"data-slot":`dropdown-menu-content`,style:p,className:g,...s,children:r}),n[12]=r,n[13]=s,n[14]=p,n[15]=g,n[16]=_):_=n[16];let v;return n[17]!==f||n[18]!==_?(v=(0,h.jsx)(t,{children:(0,h.jsx)(c,{className:f,children:_})}),n[17]=f,n[18]=_,n[19]=v):v=n[19],v}function y(e){let t=(0,m.c)(8),r,i;t[0]===e?(r=t[1],i=t[2]):({className:r,...i}=e,t[0]=e,t[1]=r,t[2]=i);let a;t[3]===r?a=t[4]:(a=u(p,r),t[3]=r,t[4]=a);let o;return t[5]!==i||t[6]!==a?(o=(0,h.jsx)(n,{className:a,...i}),t[5]=i,t[6]=a,t[7]=o):o=t[7],o}function b(e){let t=(0,m.c)(8),n,i;t[0]===e?(n=t[1],i=t[2]):({className:n,...i}=e,t[0]=e,t[1]=n,t[2]=i);let a;t[3]===n?a=t[4]:(a=u(f,n),t[3]=n,t[4]=a);let o;return t[5]!==i||t[6]!==a?(o=(0,h.jsx)(r,{className:a,...i}),t[5]=i,t[6]=a,t[7]=o):o=t[7],o}export{_ as a,b as i,v as n,y as r,g as t};
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{ot as t,st as n}from"./vendor-base-ui-wXsskyKm.js";import{o as r}from"./session-startup-barrier-DT-hIBRf.js";import{t as i}from"./vendor-react-drawio-C9rszQEJ.js";var a=e(n(),1),o=t(),s=`<mxfile><diagram id="new" name="Page-1"><mxGraphModel dx="0" dy="0" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0"><root><mxCell id="0"/><mxCell id="1" parent="0"/></root></mxGraphModel></diagram></mxfile>`;function c(){if(typeof document>`u`)return!1;let e=document.documentElement.getAttribute(`data-theme`);return e===`dark`||!e&&window.matchMedia(`(prefers-color-scheme: dark)`).matches}var l=a.forwardRef(function({xml:e,readOnly:t,className:n,onChange:l},u){let d=a.useRef(e),f=a.useRef(null),p=a.useRef(!1),[m,h]=a.useState(c),g=a.useRef(e),_=a.useRef(e);_.current!==e&&(_.current=e,g.current=e,d.current=e);let v=a.useRef(m);v.current!==m&&(v.current=m,g.current=d.current);let y=a.useRef(null);a.useEffect(()=>{let e=()=>h(c());e();let t=new MutationObserver(e);return t.observe(document.documentElement,{attributes:!0,attributeFilter:[`data-theme`]}),()=>t.disconnect()},[]),a.useEffect(()=>{let e=setTimeout(()=>{y.current?.querySelector(`.diagrams-iframe`)?.focus()},600);return()=>clearTimeout(e)},[]),a.useImperativeHandle(u,()=>({getXml:()=>d.current}));let b=a.useCallback(()=>{!e&&!p.current&&(p.current=!0,setTimeout(()=>{f.current?.template({})},500))},[e]),x=a.useCallback(e=>{d.current=e.xml,l?.(e.xml)},[l]);return(0,o.jsx)(`div`,{ref:y,className:r(`h-full w-full`,n),children:(0,o.jsx)(i,{ref:f,xml:g.current||s,autosave:!0,urlParameters:{ui:t?`simple`:m?`dark`:`kennedy`,spin:!0,libraries:!t,chrome:t,nav:t,layers:t,noSaveBtn:!0,noExitBtn:!0,saveAndExit:!1},onLoad:b,onAutoSave:x},m?`dark`:`light`)})});export{l as t};
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{$ as t,Q as n,X as r,Z as i,et as a,nt as o,ot as s,rt as c,st as l,tt as u}from"./vendor-base-ui-wXsskyKm.js";import{n as d}from"./vendor-react-BkccXcWz.js";import{o as f}from"./session-startup-barrier-DT-hIBRf.js";import{n as p}from"./Icon-DmykXZL1.js";import{t as m}from"./i18n-DXc6czdR.js";var h=e(l(),1),g=d(),_=s(),v=0;function y(e,t){return e&&h.isValidElement(t)?{render:t}:{children:t}}function b(e){let t=(0,g.c)(4),r;t[0]===e?r=t[1]:({...r}=e,t[0]=e,t[1]=r);let i;return t[2]===r?i=t[3]:(i=(0,_.jsx)(n,{...r}),t[2]=r,t[3]=i),i}function x(e){let t=(0,g.c)(10),n,i,a;t[0]===e?(n=t[1],i=t[2],a=t[3]):({asChild:n,children:i,...a}=e,t[0]=e,t[1]=n,t[2]=i,t[3]=a);let o;t[4]!==n||t[5]!==i?(o=y(n,i),t[4]=n,t[5]=i,t[6]=o):o=t[6];let s=o,c;return t[7]!==a||t[8]!==s?(c=(0,_.jsx)(r,{"data-slot":`dialog-trigger`,...a,...s}),t[7]=a,t[8]=s,t[9]=c):c=t[9],c}function S(e){let n=(0,g.c)(4),r;n[0]===e?r=n[1]:({...r}=e,n[0]=e,n[1]=r);let i;return n[2]===r?i=n[3]:(i=(0,_.jsx)(t,{...r}),n[2]=r,n[3]=i),i}var C=h.forwardRef((e,t)=>{let n=(0,g.c)(10),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===Symbol.for(`react.memo_cache_sentinel`)?(a=[],n[3]=a):a=n[3],h.useEffect(A,a);let o=t,s;n[4]===r?s=n[5]:(s=f(`app-region-no-drag fixed inset-0 z-50 bg-black/50 dark:bg-black/75`,`transition-opacity duration-150 ease-out`,`data-[starting-style]:opacity-0 data-[ending-style]:opacity-0`,r),n[4]=r,n[5]=s);let l;return n[6]!==i||n[7]!==o||n[8]!==s?(l=(0,_.jsx)(c,{ref:o,"data-slot":`dialog-overlay`,className:s,...i}),n[6]=i,n[7]=o,n[8]=s,n[9]=l):l=n[9],l});C.displayName=`DialogOverlay`;function w(e){let t=(0,g.c)(33),n,r,i,s,c,l,u;t[0]===e?(n=t[1],r=t[2],i=t[3],s=t[4],c=t[5],l=t[6],u=t[7]):({className:r,overlayClassName:s,containerClassName:i,children:n,showCloseButton:l,presentation:u,...c}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=s,t[5]=c,t[6]=l,t[7]=u);let d=u===void 0?`default`:u,{t:h}=m(),v=l??d!==`picker`,y=d===`picker`&&`yuri-picker-backdrop`,b;t[8]!==s||t[9]!==y?(b=f(`rounded-none`,y,s),t[8]=s,t[9]=y,t[10]=b):b=t[10];let x;t[11]===b?x=t[12]:(x=(0,_.jsx)(C,{className:b}),t[11]=b,t[12]=x);let w=i??(d===`picker`?`block p-0`:`items-center p-4`),T;t[13]===w?T=t[14]:(T=f(`fixed inset-0 z-50 flex justify-center pointer-events-none`,w),t[13]=w,t[14]=T);let E=d===`picker`&&`yuri-picker-dialog yuri-mobile-overlay-surface yuri-mobile-overlay-surface--translucent yuri-composer-autocomplete-surface fixed left-1/2 top-[10vh] w-[min(42rem,calc(100vw-3rem))] max-w-none -translate-x-1/2 translate-y-0 gap-0 overflow-hidden rounded-3xl border-0 p-0`,D;t[15]!==r||t[16]!==E?(D=f(`app-region-no-drag relative pointer-events-auto bg-background text-foreground flex flex-col w-full max-w-lg max-h-full gap-4 rounded-xl border p-6 shadow-none overflow-y-auto pwa-dialog-content origin-center`,`transition-all duration-150 ease-out`,`data-[starting-style]:opacity-0 data-[starting-style]:scale-[0.98]`,`data-[ending-style]:opacity-0 data-[ending-style]:scale-[0.98]`,`data-[nested-dialog-open]:brightness-[0.55] dark:data-[nested-dialog-open]:brightness-[0.4]`,E,r),t[15]=r,t[16]=E,t[17]=D):D=t[17];let O;t[18]!==v||t[19]!==h?(O=v&&(0,_.jsxs)(o,{"data-slot":`dialog-close`,className:`ring-offset-background focus:ring-ring data-[open]:bg-interactive-active data-[open]:text-foreground absolute top-2 right-2 rounded-lg opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none text-muted-foreground hover:text-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,children:[(0,_.jsx)(p,{name:`close`}),(0,_.jsx)(`span`,{className:`sr-only`,children:h(`dialog.common.actions.close`)})]}),t[18]=v,t[19]=h,t[20]=O):O=t[20];let k;t[21]!==n||t[22]!==d||t[23]!==c||t[24]!==D||t[25]!==O?(k=(0,_.jsxs)(a,{"data-slot":`dialog-content`,"data-state-slot":`dialog`,"data-presentation":d,className:D,...c,children:[n,O]}),t[21]=n,t[22]=d,t[23]=c,t[24]=D,t[25]=O,t[26]=k):k=t[26];let A;t[27]!==k||t[28]!==T?(A=(0,_.jsx)(`div`,{className:T,children:k}),t[27]=k,t[28]=T,t[29]=A):A=t[29];let j;return t[30]!==A||t[31]!==x?(j=(0,_.jsxs)(S,{children:[x,A]}),t[30]=A,t[31]=x,t[32]=j):j=t[32],j}function T(e){let t=(0,g.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=f(`flex flex-col gap-2 text-center sm:text-left`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,_.jsx)(`div`,{"data-slot":`dialog-header`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function E(e){let t=(0,g.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=f(`flex flex-col-reverse gap-2 bottom-safe-area sm:flex-row sm:justify-end`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,_.jsx)(`div`,{"data-slot":`dialog-footer`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function D(e){let t=(0,g.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let a;t[3]===n?a=t[4]:(a=f(`typography-markdown leading-none font-semibold text-foreground`,n),t[3]=n,t[4]=a);let o;return t[5]!==r||t[6]!==a?(o=(0,_.jsx)(i,{"data-slot":`dialog-title`,className:a,...r}),t[5]=r,t[6]=a,t[7]=o):o=t[7],o}function O(e){let t=(0,g.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=f(`text-muted-foreground typography-ui-label`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,_.jsx)(u,{"data-slot":`dialog-description`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function k(){v=Math.max(0,v-1),v===0&&document.documentElement.classList.remove(`yuri-dialog-open`)}function A(){return v+=1,document.documentElement.classList.add(`yuri-dialog-open`),k}export{T as a,E as i,w as n,D as o,O as r,x as s,b as t};
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{B as t,F as n,H as r,I as i,L as a,M as o,N as s,R as c,V as l,ot as u,st as d,z as f}from"./vendor-base-ui-wXsskyKm.js";import{n as p}from"./vendor-react-BkccXcWz.js";import{o as m}from"./session-startup-barrier-DT-hIBRf.js";import{n as h}from"./Icon-DmykXZL1.js";import{n as g,r as _,t as v}from"./dropdown-menu.styles-BDla58Rm.js";var y=p(),b=e(d(),1),x=u(),S=b.createContext(null),C=e=>e?e.closest(`[data-slot="dialog-content"], [role="dialog"]`):null;function w(e,t){return e&&b.isValidElement(t)?{render:t}:{children:t}}function T(e){let t=(0,y.c)(9),r;t[0]===e?r=t[1]:({...r}=e,t[0]=e,t[1]=r);let[i,a]=b.useState(null),o;t[2]===i?o=t[3]:(o={portalContainer:i,setPortalContainer:a},t[2]=i,t[3]=o);let s=o,c;t[4]===r?c=t[5]:(c=(0,x.jsx)(n,{...r}),t[4]=r,t[5]=c);let l;return t[6]!==s||t[7]!==c?(l=(0,x.jsx)(S.Provider,{value:s,children:c}),t[6]=s,t[7]=c,t[8]=l):l=t[8],l}function E(e){let t=(0,y.c)(22),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({asChild:n,children:r,onPointerDownCapture:a,onFocusCapture:i,...o}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let c=b.useContext(S),l;t[6]===c?l=t[7]:(l=e=>{if(!c)return;let t=e instanceof HTMLElement?e:null;c.setPortalContainer(C(t))},t[6]=c,t[7]=l);let u=l,d;t[8]!==n||t[9]!==r?(d=w(n,r),t[8]=n,t[9]=r,t[10]=d):d=t[10];let f=d,p;t[11]!==a||t[12]!==u?(p=e=>{u(e.currentTarget),a?.(e)},t[11]=a,t[12]=u,t[13]=p):p=t[13];let m;t[14]!==i||t[15]!==u?(m=e=>{u(e.currentTarget),i?.(e)},t[14]=i,t[15]=u,t[16]=m):m=t[16];let h;return t[17]!==o||t[18]!==f||t[19]!==p||t[20]!==m?(h=(0,x.jsx)(s,{"data-slot":`dropdown-menu-trigger`,onPointerDownCapture:p,onFocusCapture:m,...o,...f}),t[17]=o,t[18]=f,t[19]=p,t[20]=m,t[21]=h):h=t[21],h}function D(e){let n=(0,y.c)(40),r,i,a,o,s,c,u,d,p,h,_,v,C;if(n[0]!==e){let{className:t,sideOffset:l,align:f,side:m,alignOffset:g,anchor:y,portalToBody:b,positionerClassName:x,style:S,children:w,onCloseAutoFocus:T,collisionPadding:E,collisionAvoidance:D,...O}=e;s=t,h=l,r=f,d=m,i=g,a=y,_=b,c=x,p=S,o=w,v=E,C=D,u=O,n[0]=e,n[1]=r,n[2]=i,n[3]=a,n[4]=o,n[5]=s,n[6]=c,n[7]=u,n[8]=d,n[9]=p,n[10]=h,n[11]=_,n[12]=v,n[13]=C}else r=n[1],i=n[2],a=n[3],o=n[4],s=n[5],c=n[6],u=n[7],d=n[8],p=n[9],h=n[10],_=n[11],v=n[12],C=n[13];let w=h===void 0?4:h,T=_!==void 0&&_,E=v===void 0?8:v,D;n[14]===C?D=n[15]:(D=C===void 0?{side:`shift`,align:`shift`}:C,n[14]=C,n[15]=D);let O=D,k=b.useContext(S),A=T?void 0:k?.portalContainer||void 0,j;n[16]===c?j=n[17]:(j=m(`app-region-no-drag z-50`,c),n[16]=c,n[17]=j);let M;n[18]===p?M=n[19]:(M={color:`var(--surface-elevated-foreground)`,...p},n[18]=p,n[19]=M);let N;n[20]===s?N=n[21]:(N=m(g,s),n[20]=s,n[21]=N);let P;n[22]!==o||n[23]!==u||n[24]!==M||n[25]!==N?(P=(0,x.jsx)(l,{"data-slot":`dropdown-menu-content`,style:M,className:N,...u,children:o}),n[22]=o,n[23]=u,n[24]=M,n[25]=N,n[26]=P):P=n[26];let F;n[27]!==r||n[28]!==i||n[29]!==a||n[30]!==O||n[31]!==E||n[32]!==d||n[33]!==w||n[34]!==P||n[35]!==j?(F=(0,x.jsx)(f,{anchor:a,sideOffset:w,align:r,side:d,alignOffset:i,collisionPadding:E,collisionAvoidance:O,className:j,children:P}),n[27]=r,n[28]=i,n[29]=a,n[30]=O,n[31]=E,n[32]=d,n[33]=w,n[34]=P,n[35]=j,n[36]=F):F=n[36];let I;return n[37]!==F||n[38]!==A?(I=(0,x.jsx)(t,{container:A,children:F}),n[37]=F,n[38]=A,n[39]=I):I=n[39],I}function O(e){let t=(0,y.c)(24),n,i,a,o,s,c,l,u;t[0]===e?(n=t[1],i=t[2],a=t[3],o=t[4],s=t[5],c=t[6],l=t[7],u=t[8]):({className:a,inset:o,variant:u,asChild:n,children:i,onSelect:c,onClick:s,...l}=e,t[0]=e,t[1]=n,t[2]=i,t[3]=a,t[4]=o,t[5]=s,t[6]=c,t[7]=l,t[8]=u);let d=u===void 0?`default`:u,f;t[9]!==n||t[10]!==i?(f=w(n,i),t[9]=n,t[10]=i,t[11]=f):f=t[11];let p=f,h;t[12]!==s||t[13]!==c?(h=e=>{s?.(e),e.defaultPrevented||c?.(e)},t[12]=s,t[13]=c,t[14]=h):h=t[14];let g=h,_;t[15]===a?_=t[16]:(_=m(v,a),t[15]=a,t[16]=_);let b;return t[17]!==g||t[18]!==o||t[19]!==l||t[20]!==p||t[21]!==_||t[22]!==d?(b=(0,x.jsx)(r,{"data-slot":`dropdown-menu-item`,"data-inset":o,"data-variant":d,className:_,...l,onClick:g,...p}),t[17]=g,t[18]=o,t[19]=l,t[20]=p,t[21]=_,t[22]=d,t[23]=b):b=t[23],b}function k(e){let t=(0,y.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,x.jsx)(c,{"data-slot":`dropdown-menu-radio-group`,...n}),t[2]=n,t[3]=r),r}function A(e){let t=(0,y.c)(11),n,r,o;t[0]===e?(n=t[1],r=t[2],o=t[3]):({className:r,children:n,...o}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=o);let s;t[4]===r?s=t[5]:(s=m(`data-[highlighted]:bg-interactive-hover hover:bg-interactive-hover data-[checked]:bg-interactive-selection data-[checked]:text-interactive-selection-foreground relative flex cursor-pointer items-start gap-2 rounded-lg py-1 pl-2 pr-8 typography-ui-label outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-3.5`,r),t[4]=r,t[5]=s);let c;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,x.jsx)(`span`,{className:`pointer-events-none absolute right-2 flex size-3.5 items-center justify-center text-primary`,children:(0,x.jsx)(i,{children:(0,x.jsx)(h,{name:`check`,className:`size-3`})})}),t[6]=c):c=t[6];let l;return t[7]!==n||t[8]!==o||t[9]!==s?(l=(0,x.jsxs)(a,{"data-slot":`dropdown-menu-radio-item`,className:s,...o,children:[c,n]}),t[7]=n,t[8]=o,t[9]=s,t[10]=l):l=t[10],l}function j(e){let t=(0,y.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,inset:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===n?a=t[5]:(a=m(`px-2 py-1 typography-ui-label font-medium data-[inset]:pl-8`,n),t[4]=n,t[5]=a);let o;return t[6]!==r||t[7]!==i||t[8]!==a?(o=(0,x.jsx)(`div`,{"data-slot":`dropdown-menu-label`,"data-inset":r,className:a,...i}),t[6]=r,t[7]=i,t[8]=a,t[9]=o):o=t[9],o}function M(e){let t=(0,y.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=m(_,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,x.jsx)(o,{"data-slot":`dropdown-menu-separator`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}export{k as a,E as c,j as i,D as n,A as o,O as r,M as s,T as t};
@@ -1,3 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{C as t,D as n,k as r}from"./runtime-auth-DA-qfGHk.js";import{c as i,f as a,i as o,n as s,s as c}from"./runtime-switch-DEPKHgdL.js";import{n as l}from"./runtime-fetch-V-iMWR8t.js";import{F as u,P as d,R as f,S as p,d as m}from"./platform-CiUKDeXd.js";import{t as h}from"./runtimeAPIRegistry-C2VogTny.js";import{a as g,i as ee,r as te}from"./vendor-zustand-CTekDqaS.js";import{st as ne}from"./vendor-base-ui-wXsskyKm.js";import"./brand-storage-bootstrap-D4BW3w-M.js";import{i as re,n as _,t as ie}from"./safeStorage-DTOhKN0V.js";import{Cr as v,R as ae,Sr as oe,n as y,xr as b}from"./client-B_907PBv.js";import{A as se,F as ce,I as le,L as ue,M as de,N as fe,T as pe,V as me,f as he,g as ge,h as _e,j as ve,m as ye,p as be,x}from"./prompt-attachment-upload-B5DHrw6U.js";import{n as xe}from"./vendor-react-BkccXcWz.js";import{c as Se}from"./yuriEvents-BFrD5fMU.js";import{_ as Ce,c as we,l as Te,r as S,v as Ee}from"./useUIStore-C3ewjGgP.js";import{t as De}from"./uuid-D-SDZijH.js";var Oe=(e,t)=>e!==t;function ke(e){if(!e||typeof e!=`object`||Array.isArray(e))throw Error(`Invalid Hub project layout`);let t=e;if(typeof t.hubId!=`string`||!t.hubId.trim()||!Array.isArray(t.order)||t.order.some(e=>typeof e!=`string`||!e.trim())||!t.collapsed||typeof t.collapsed!=`object`||Array.isArray(t.collapsed)||Object.entries(t.collapsed).some(([e,t])=>!e.trim()||typeof t!=`boolean`))throw Error(`Invalid Hub project layout`);return{hubId:t.hubId,order:[...new Set(t.order)],collapsed:Object.fromEntries(Object.entries(t.collapsed))}}var Ae=e=>{let t=e.replace(/\\/g,`/`).replace(/\/+$/g,``).trim();if(!t)return``;let n=new TextEncoder().encode(t),r=``;for(let e of n)r+=String.fromCharCode(e);return`path_${typeof btoa==`function`?btoa(r).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/g,``):t.replace(/[^A-Za-z0-9._-]+/g,`_`)}`},C={...x,sessionIdLength:x.sessionIDLength,visibleTextLength:1e5,canonicalOutputLength:2e5},je=e=>typeof e==`string`&&de(e),Me=e=>e.replaceAll(`\\`,`/`).split(`/`).at(-1)?.replace(/\.md$/,``)??``,Ne=e=>({trigger:`@`,icon:`chat-thread`,label:e}),Pe=e=>({type:`session`,sessionId:e.sessionId,...e.directory===void 0?{}:{directory:e.directory},...e.target?{target:e.target}:{}}),Fe=e=>e.directory!==void 0||e.target?`@session:${JSON.stringify({sessionID:e.sessionId,...le(e)})}`:`@session:${e.sessionId}`,Ie=`"(?:[^"\\\\\\r\\n]|\\\\.)*"`,Le=RegExp(`@session:(\\{"sessionID":${Ie},"directory":${Ie}(?:,"target":\\{"hubId":${Ie},"hostId":${Ie},"instanceId":${Ie}\\})?\\}|[A-Za-z0-9_-]+)`,`g`),Re=e=>{if(je(e))return{sessionId:e};try{let t=JSON.parse(e);if(!je(t.sessionID))return;let n=le(t);return n?{sessionId:t.sessionID,...n}:void 0}catch{return}},ze=(e,t)=>({trigger:`/`,icon:t,label:e}),Be=(e,t)=>({trigger:t,icon:`book-open`,label:e}),Ve=(e,t)=>[`/`,`@`].some(n=>ge(e,Be(t,n))),He=(e,t)=>ge(e,Be(t,`@`))?Be(t,`@`):Be(t,`/`),Ue={session:{kind:`session`,validatePayload:e=>je(e.sessionId)&&le(e)!==void 0,contributeCanonical:e=>({text:Fe(e),semantic:Pe(e)}),contributeDirectSend:e=>{let t=Ne(be(e.display,`@`));return{text:ye(t),semantic:Pe(e)}},decorate:e=>{let t=Ne(be(e.display,`@`));return{style:`mentionSession`,visual:_e(t,e.display)}},payloadBudget:()=>void 0,canonical:{matcher:Le,resolveDisplay:(e,t)=>{let n=e.index===0?``:t.text[e.index-1],r=t.text[e.index+e[0].length]??``,i=Re(e[1]);return i&&(n===``||/[\s([{]/.test(n))&&(r===``||/[\s)\]},.!?;:]/.test(r))?he(Ne((i.target?void 0:t.sessionTitles.get(i.sessionId))||i.sessionId)):null},materialize:(e,t,n)=>{let r=Re(e[1]);return{id:`session:${r.sessionId}:${e.index}`,kind:`session`,...r,display:t,start:n,end:n+t.length}}}},paste:{kind:`paste`,validatePayload:e=>typeof e.text==`string`&&e.text.length<=C.pastePayloadLength&&typeof e.characterCount==`number`&&Number.isSafeInteger(e.characterCount)&&e.characterCount===me(e.text)&&typeof e.index==`number`&&Number.isSafeInteger(e.index)&&e.index>=1,contributeCanonical:e=>({text:e.text}),contributeDirectSend:e=>({text:e.text}),decorate:()=>({style:`mentionPaste`}),payloadBudget:e=>({category:`opaque-text`,length:e.text.length})},skill:{kind:`skill`,validatePayload:e=>fe(e.skillName)&&typeof e.display==`string`&&Ve(e.display,e.skillName),contributeCanonical:e=>({text:`[skill:${e.skillName}]`}),contributeDirectSend:e=>({text:`[skill:${e.skillName}]`}),decorate:e=>({style:`mentionCommand`,skillName:e.skillName,visual:_e(He(e.display,e.skillName),e.display)}),payloadBudget:()=>void 0,canonical:{matcher:pe(),resolveDisplay:e=>he(Be(e[1],`@`)),materialize:(e,t,n)=>({id:`skill:${n}`,kind:`skill`,skillName:e[1],display:t,start:n,end:n+t.length})}},command:{kind:`command`,validatePayload:e=>se(e.commandName)&&ve(e.reference)&&typeof e.display==`string`&&ge(e.display,ze(e.commandName,`command`)),contributeCanonical:e=>({text:`[command:${e.reference}]`}),contributeDirectSend:e=>({text:`[command:${e.reference}]`}),decorate:e=>({style:`mentionCommand`,visual:_e(ze(e.commandName,`command`),e.display)}),payloadBudget:()=>void 0,canonical:{matcher:/\[command:([^\]\r\n]+)\]/g,resolveDisplay:e=>{let t=Me(e[1]);return ve(e[1])&&se(t)?he(ze(t,`command`)):null},materialize:(e,t,n)=>({id:`command:${n}`,kind:`command`,commandName:Me(e[1]),reference:e[1],display:t,start:n,end:n+t.length})}}},w=e=>Ue[e],We=(e,t)=>w(e).validatePayload(t),Ge=e=>w(e.kind).contributeCanonical(e),Ke=e=>w(e.kind).contributeDirectSend(e),qe=e=>w(e.kind).decorate(e),Je=e=>w(e.kind).payloadBudget(e),Ye=e=>w(e.kind).describeResourceIdentity?.(e),Xe=Object.keys(Ue),Ze=e=>typeof e==`string`&&Xe.includes(e),Qe=()=>Xe.flatMap(e=>{let t=w(e).canonical;return t?[t]:[]}),$e=e=>{if(e.type===`attachment`)return`attachment:${e.attachmentRefID}`},et=e=>{let t=new Map;for(let n of e.references){let e=Ye(n);e&&t.set($e(e),e)}return[...t.values()]},tt=(e,t)=>{let n=new Map(e.map(e=>[$e(e),e])),r=new Map(t.map(e=>[$e(e),e]));return{previous:[...n.values()],next:[...r.values()],added:[...r].flatMap(([e,t])=>n.has(e)?[]:[t]),removed:[...n].flatMap(([e,t])=>r.has(e)?[]:[t])}},nt=(e,t)=>tt(et(e),et(t)),rt=(e,t=`queue-canonical`)=>{if(e.references.length>C.referenceCount)return{ok:!1,reason:`reference-budget-exceeded`};let n=[...e.references].sort((e,t)=>e.start-t.start),r=0,i=0;for(let t of n){if(t.start<r||t.start<0||t.end<=t.start||t.end>e.text.length||e.text.slice(t.start,t.end)!==t.display)return{ok:!1,reason:`invalid-references`};r=t.end;let n=Je(t);i+=n?.category===`opaque-text`?n.length:0}if(i>C.totalPastePayloadLength)return{ok:!1,reason:`reference-payload-budget-exceeded`};let a=[],o=[],s=0;for(let r of n){s<r.start&&a.push({provenance:`authored`,text:e.text.slice(s,r.start),start:s,end:r.start});let n=t===`direct-send-display`?Ke(r):Ge(r);n.semantic?(a.push({provenance:`generated-reference`,text:n.text,start:r.start,end:r.end,referenceId:r.id,semantic:n.semantic}),o.push(n.semantic)):a.push({provenance:`reference-payload`,text:n.text,start:r.start,end:r.end,referenceId:r.id}),s=r.end}s<e.text.length&&a.push({provenance:`authored`,text:e.text.slice(s),start:s,end:e.text.length});let c=a.map(e=>e.text).join(``);return c.length>C.canonicalOutputLength?{ok:!1,reason:`canonical-output-too-large`}:{ok:!0,plan:{chunks:a,semantics:o},text:c}},T=(e,t)=>Math.max(0,Math.min(e,t)),it=(e,t)=>typeof e==`string`&&e.length>0&&e.length<=t,at=e=>{if(typeof e!=`object`||!e)return!1;let t=e;return!it(t.id,C.displayLength)||!it(t.display,C.displayLength)||!Number.isSafeInteger(t.start)||!Number.isSafeInteger(t.end)||typeof t.kind!=`string`?!1:Ze(t.kind)&&We(t.kind,t)},E=(e,t)=>{let n=[],r=0,i=[],a=Math.min(t.length,C.referenceCount);for(let e=0;e<a;e+=1){let a=t[e];if(!at(a)){typeof a==`object`&&a&&typeof a.id==`string`&&n.push(a.id),r+=1;continue}i.push({reference:a,index:e})}i.sort((e,t)=>e.reference.start-t.reference.start||e.index-t.index);let o=[],s=new Set,c=0,l=0,u=!1;for(let{reference:t}of i){if(s.has(t.id)||t.start<c||t.start<0||t.end<=t.start||t.end>e.length||e.slice(t.start,t.end)!==t.display){n.push(t.id),r+=1;continue}s.add(t.id),c=t.end;let i=Je(t);if(l+=i?.category===`opaque-text`?i.length:0,l>x.totalPastePayloadLength){n.push(t.id),r+=1,s.delete(t.id),c=o.at(-1)?.end??0,u=!0,l-=i?.category===`opaque-text`?i.length:0;continue}o.push(t)}return r+=t.length-a,{document:{text:e,references:o},rejectedIds:n,rejectedCount:r,budgetExceeded:t.length>C.referenceCount,payloadBudgetExceeded:u}},D=e=>{let t=[...e.references].sort((e,t)=>e.start-t.start||e.end-t.end),n=[],r=new Set,i=0,a=0;for(let o of t){if(!it(o.id,C.idLength)||!it(o.display,C.displayLength)||!Ze(o.kind)||!Number.isSafeInteger(o.start)||!Number.isSafeInteger(o.end)||r.has(o.id)||o.start<i||o.start<0||o.end<=o.start||o.end>e.text.length||e.text.slice(o.start,o.end)!==o.display)continue;let t=Je(o),s=t?.category===`opaque-text`?t.length:0;a+s>x.totalPastePayloadLength||(r.add(o.id),i=o.end,a+=s,n.push(o))}return{text:e.text,references:n}},ot=(e,t)=>{if(t.length>x.pastePayloadLength)return!1;let n=E(e.text,e.references);return n.budgetExceeded||n.payloadBudgetExceeded?!1:n.document.references.reduce((e,t)=>{let n=Je(t);return e+(n?.category===`opaque-text`?n.length:0)},0)+t.length<=x.totalPastePayloadLength},st=(e,t,n)=>{let r=e.filter(e=>t===n?t>e.start&&t<e.end:e.start<n&&e.end>t);return r.length===0?{start:t,end:n}:{start:Math.min(t,...r.map(e=>e.start)),end:Math.max(n,...r.map(e=>e.end))}};function ct(e,t,n,r,i={}){let a=D(e);if(!We(r.kind,r))return{document:a,caret:T(n,a.text.length),edit:{oldStart:t,oldEnd:n,newEnd:n}};let o=T(t,a.text.length),s=Math.max(o,T(n,a.text.length)),c=st(a.references,o,s),l=a.text.slice(0,c.start),u=a.text.slice(c.end),d=!!i.padDocumentEdges&&i.padLeadingDocumentEdge!==!1,f=!!i.padDocumentEdges,p=i.inlineBoundaries&&(l.length>0||d)&&!/\s$/.test(l)?` `:``,m=i.inlineBoundaries&&(u.length>0||f)&&!/^\s/.test(u)?` `:``,h=`${l}${p}${r.display}${m}${u}`,g={...r,start:c.start+p.length,end:c.start+p.length+r.display.length},ee=p.length+r.display.length+m.length-(c.end-c.start);return{document:D({text:h,references:[...a.references.filter(e=>e.end<=c.start||e.start>=c.end).map(e=>e.start>=c.end?{...e,start:e.start+ee,end:e.end+ee}:e),g]}),caret:g.end,edit:{oldStart:c.start,oldEnd:c.end,newEnd:c.start+p.length+r.display.length+m.length}}}var lt=(e,t)=>e<=t.oldStart?e:e>=t.oldEnd?e+t.newEnd-t.oldEnd:t.newEnd,ut=(e,t,n=t.length,r=n)=>{let i=D(e),a=0,o=Math.min(i.text.length,t.length);for(;a<o&&i.text[a]===t[a];)a+=1;let s=0;for(;s<i.text.length-a&&s<t.length-a&&i.text[i.text.length-s-1]===t[t.length-s-1];)s+=1;let c={oldStart:a,oldEnd:i.text.length-s,newEnd:t.length-s},l=st(i.references,c.oldStart,c.oldEnd),u=l.start!==c.oldStart||l.end!==c.oldEnd,d=i.references.filter(e=>e.start<l.end&&e.end>l.start),f=t.slice(c.oldStart,c.newEnd),p=`${i.text.slice(0,l.start)}${f}${i.text.slice(l.end)}`,m={oldStart:l.start,oldEnd:l.end,newEnd:l.start+f.length},h=m.newEnd-m.oldEnd,g=i.references.filter(e=>e.end<=l.start||e.start>=l.end).map(e=>e.start>=l.end?{...e,start:e.start+h,end:e.end+h}:e),ee=(e,n)=>{let r=T(e,t.length),i=c.newEnd+l.end-c.oldEnd;return T(r<=l.start?r:r<c.oldStart||r===c.oldStart&&n===`start`?l.start:r<c.newEnd||r===c.newEnd&&n===`start`?l.start+r-c.oldStart:r<=i?m.newEnd:m.newEnd+r-i,p.length)},te=ee(n,`start`),ne=Math.max(te,ee(r,`end`)),re=D({text:p,references:g});return{document:re,edit:m,requiresTextCorrection:u,selectionStart:te,selectionEnd:ne,caret:ne,mapCaret:e=>T(lt(e,m),re.text.length),removedReferences:d}},dt=(e,t,n)=>{let r=st(n,e,t);return r.start===e&&r.end===t?null:r},ft=(e,t,n)=>{let r=n,i=n;if(t===`Backspace`){for(;r>0&&/\s/.test(e[r-1]);)--r;for(;r>0&&!/\s/.test(e[r-1]);)--r}else{for(;i<e.length&&/\s/.test(e[i]);)i+=1;for(;i<e.length&&!/\s/.test(e[i]);)i+=1}return{start:r,end:i}},pt=(e,t)=>{let n=D(e),r=T(t.selectionStart,n.text.length),i=Math.max(r,T(t.selectionEnd,n.text.length)),a=r===i?t.altKey?ft(n.text,t.key,r):t.key===`Backspace`?{start:Math.max(0,r-1),end:r}:{start:r,end:Math.min(n.text.length,r+1)}:{start:r,end:i},o=dt(a.start,a.end,n.references);if(!o)return null;let s=n.references.filter(e=>e.start<o.end&&e.end>o.start);return{document:D({text:`${n.text.slice(0,o.start)}${n.text.slice(o.end)}`,references:n.references.filter(e=>!s.includes(e)).map(e=>e.start>=o.end?{...e,start:e.start-(o.end-o.start),end:e.end-(o.end-o.start)}:e)}),caret:o.start,edit:{oldStart:o.start,oldEnd:o.end,newEnd:o.start},removedIds:s.map(e=>e.id),removedReferences:s}},mt=(e,t)=>{let n=t,r=t;for(;n>0&&/\s/.test(e[n-1]);)--n;for(;r<e.length&&/\s/.test(e[r]);)r+=1;let i=n>0&&r<e.length?` `:``;return{text:`${e.slice(0,n)}${i}${e.slice(r)}`,caret:n+i.length}},ht=(e,t=`queue-canonical`)=>{let n=E(e.text,e.references);if(n.budgetExceeded)return{ok:!1,reason:`reference-budget-exceeded`};if(n.payloadBudgetExceeded)return{ok:!1,reason:`reference-payload-budget-exceeded`};if(n.rejectedCount>0)return{ok:!1,reason:`invalid-references`};let r=rt(n.document,t);return r.ok?{ok:!0,text:r.text,chunks:r.plan.chunks,semantics:r.plan.semantics}:r},gt=(e,t)=>e.match.index-t.match.index||e.adapterOrder-t.adapterOrder||e.matchOrder-t.matchOrder,_t=e=>{if(e.length>C.canonicalOutputLength||e.length>C.visibleTextLength)return null;let t=[],n=0;for(let[r,i]of Qe().entries()){i.matcher.lastIndex=0;let a,o=0;for(;(a=i.matcher.exec(e))!==null;){if(n+=1,n>C.referenceCount)return null;let e={codec:i,match:a,adapterOrder:r,matchOrder:o};o+=1;let s=t.findIndex(t=>gt(e,t)<0);s===-1?t.push(e):t.splice(s,0,e)}}return t},vt=(e,t)=>{let n=E(e.text,e.references).document,r=_t(n.text);if(r===null)return n;let i={text:n.text,sessionTitles:t},a=[],o=``,s=0,c=0,l=new Set(n.references.map(e=>e.id)),u=[];for(let e of r){let{match:t,codec:r}=e,a=t.index,o=a+t[0].length;if(a<c||n.references.some(e=>e.start<o&&e.end>a))continue;let s=r.resolveDisplay(t,i);if(s===null||s.length>C.displayLength)continue;let d=r.materialize(t,s,a),f=d.id;for(;l.has(f);)f=`materialized:${f}`;l.add(f),u.push({start:a,end:o,display:s,reference:{...d,id:f}}),c=o}s=0;let d=0;for(let e of u){o+=`${n.text.slice(s,e.start)}${e.display}`;let t=e.start+d;a.push({...e.reference,start:t,end:t+e.display.length}),d+=e.display.length-(e.end-e.start),s=e.end}if(o+=n.text.slice(s),o.length>C.visibleTextLength)return n;let f=n.references.map(e=>{let t=u.filter(t=>t.end<=e.start).reduce((e,t)=>e+t.display.length-(t.end-t.start),0);return{...e,start:e.start+t,end:e.end+t}});return E(o,[...f,...a]).document},yt=(e,t)=>vt({text:e,references:[]},t),bt=(e,t)=>yt(e,t),xt=(e,t,n=`
2
-
3
- `)=>{let r=E(e.text,e.references).document,i=E(t.text,t.references).document;if(r.text===i.text&&JSON.stringify(r.references)===JSON.stringify(i.references))return i;let a=new Set(r.references.map(e=>e.id)),o=e=>{let t=e;for(;a.has(t);)t=`recovered:${t}`;return a.add(t),t},s=r.text.length+n.length;return E(`${r.text}${n}${i.text}`,[...r.references,...i.references.map(e=>({...e,id:o(e.id),start:e.start+s,end:e.end+s}))]).document},St=e=>({state:`unbound-legacy`,sessionID:e}),O=e=>e.state===`bound`?`bound:${JSON.stringify([e.transportIdentity,m(e.directory),e.sessionID,e.deliveryTarget??{kind:`primary`}])}`:`unbound-legacy:${JSON.stringify([e.sessionID])}`,Ct=(e,t)=>e.queuedMessages[O(t)]??wt,wt=[],Tt=3e4,Et=`queue`,Dt=e=>e===`steer`||e===`queue`,Ot=(e,t)=>e===`immediate`?`steer`:Dt(e)?e:t===!1?`steer`:`queue`,kt=[],At=(e,t)=>e.pendingAdmissions[O(t)]??kt,jt=e=>`${e}-${De()}`,Mt=e=>typeof e==`object`&&!!e&&Object.getPrototypeOf(e)===Object.prototype,Nt=(e,t,n=[])=>{if(!Mt(e)||!Object.keys(e).every(e=>e===`text`||e===`references`))return;let r=e;if(typeof r.text!=`string`)return;let i=ce(r.text,r.references),a=i&&ht(i,`queue-canonical`);if(!a||!a.ok||a.text!==t)return;let o=new Set(n.map(e=>e.id));return et(i).every(e=>o.has(e.attachmentRefID))?i:void 0},Pt=(e,t)=>{if(e===void 0)return[];if(!t)return;let n=ue(t.text,e);if(n)return n.some(e=>t.references.some(t=>e.range.start<t.end&&t.start<e.range.end))?void 0:n},Ft=(e,t)=>{let n=Mt(e)&&typeof e.content==`string`?e:t,r=Nt(n.composerDocument,n.content,Array.isArray(n.attachments)?n.attachments:[]),i=Pt(n.composerMentions,r);return{content:n.content,...r?{composerDocument:r}:{},...r&&i?.length?{composerMentions:i}:{},...Array.isArray(n.attachments)?{attachments:n.attachments}:{},...Mt(n.sendConfig)?{sendConfig:n.sendConfig}:{}}},It=e=>Ft(void 0,e),Lt=(e,t)=>e.queueItemID===t.queueItemID&&e.operationID===t.operationID&&(!t.messageID||e.messageID===t.messageID),k=e=>e.status===`sending`||e.status===`reconciling`,Rt=ie(),zt=()=>Rt?.flush()??!0,Bt=`quiescing`,Vt=new Set,Ht=new Set,Ut=e=>{if(Bt!==e){Bt=e;for(let e of Ht)e()}},Wt=e=>{if(!(!e||Vt.has(e))){Vt.add(e);for(let e of Ht)e()}},Gt=e=>e.state===`bound`&&Vt.has(e.transportIdentity),A=e=>Bt===`open`&&(!e||!Gt(e)),Kt=(e,t=Date.now())=>({reconciliationStartedAt:e.reconciliationStartedAt??t,reconciliationDeadlineAt:e.reconciliationDeadlineAt??(e.reconciliationStartedAt??t)+Tt,reconciliationChecks:Math.max(0,Math.floor(e.reconciliationChecks??0))}),qt=(e,t,n)=>{let r=t.queueItemID??(t.id||jt(`queued`)),i=!t.owner&&(t.status===`sending`||t.status===`reconciling`),a=i?`unresolved`:t.status===`sending`?`reconciling`:t.status===`retrying`||t.status===`reconciling`||t.status===`unresolved`||t.status===`failed`?t.status:`queued`,o=typeof t.messageID==`string`&&t.messageID.startsWith(`msg_`)?t.messageID:ae(`msg`),s=Nt(t.composerDocument,t.content,t.attachments),c=Pt(t.composerMentions,s);return{...t,...s?{composerDocument:s}:{composerDocument:void 0},...s&&c?.length?{composerMentions:c}:{composerMentions:void 0},id:r,queueItemID:r,operationID:t.operationID??jt(`operation`),messageID:o,owner:n,status:a,attemptCount:Math.max(0,Math.floor(t.attemptCount??0)),...t.status===`sending`||t.status===`reconciling`?Kt(t):{},...i||a===`reconciling`&&t.status===`sending`?{failure:{kind:`ambiguous-dispatch`,recovery:Ft(t.failure?.recovery,t)}}:{}}},Jt=e=>{let t=e??{},n={};for(let[e,r]of Object.entries(t.queuedMessages??{})){if(!Array.isArray(r))continue;let t;if(e.startsWith(`bound:`)||e.startsWith(`unbound-legacy:`)){let n=r[0],i=e.startsWith(`unbound-legacy:`)?(()=>{try{let t=JSON.parse(e.slice(15));return Array.isArray(t)&&typeof t[0]==`string`?t[0]:e}catch{return e}})():e;t=n?.owner?.state===`bound`?n.owner:St(n?.owner?.sessionID??i)}else t=St(e);for(let e of r){let r=e.owner?.state===`bound`?e.owner:t,i=O(r);(n[i]??=[]).push(qt(r.sessionID,e,r))}}return{queuedMessages:n,followUpBehavior:Ot(t.followUpBehavior,t.queueModeEnabled??null)}},j=(e,t,n,r)=>{if(Gt(t))return;let i=O(t);e(e=>{let t=e.queuedMessages[i],a=t?.findIndex(e=>O(e.owner)===i&&Lt(e,n))??-1;if(a<0||!t)return e;let o=r(t[a]);if(o===t[a])return e;let s=t.slice();return s[a]=o,{queuedMessages:{...e.queuedMessages,[i]:s}}})},Yt=g()(te(ee((e,t)=>({queuedMessages:{},followUpBehavior:Et,pendingAdmissions:{},addToQueue:(t,n)=>{if(!A(t))return{ok:!1,reason:`invalid-composer-document`};let r=Nt(n.composerDocument,n.content,n.attachments);if(n.composerDocument!==void 0&&!r)return{ok:!1,reason:`invalid-composer-document`};let i=Pt(n.composerMentions,r);if(n.composerMentions!==void 0&&!i)return{ok:!1,reason:`invalid-composer-mentions`};n={...n,...r?{composerDocument:r}:{},...i?.length?{composerMentions:i}:{}};let a={...n,id:jt(`queued`),queueItemID:``,operationID:jt(`operation`),messageID:ae(`msg`),createdAt:Date.now(),owner:t,status:`queued`,attemptCount:0};a.queueItemID=a.id;let o=O(t);return e(e=>({queuedMessages:{...e.queuedMessages,[o]:[...e.queuedMessages[o]??[],a]}})),{ok:!0,item:a}},removeFromQueue:(n,r,i)=>{if(!A(n)||!i)return!1;let a=O(n),o=t().queuedMessages[a];if(!o||o.length===0)return!0;let s=o.find(e=>(e.queueItemID===r||e.id===r)&&O(e.owner)===a);if(s&&s.operationID!==i)return!1;let c=o.find(e=>(e.queueItemID===r||e.id===r)&&e.operationID===i&&O(e.owner)===a);return!c||!k(c)&&(e(e=>{let t=e.queuedMessages[a];if(!t)return e;let n=t.filter(e=>e!==c);if(n.length===t.length)return e;if(n.length)return{queuedMessages:{...e.queuedMessages,[a]:n}};let{[a]:r,...i}=e.queuedMessages;return{queuedMessages:i}}),!Ct(t(),n).some(e=>e===c||(e.queueItemID===r||e.id===r)&&e.operationID===i))},reorderQueue:(t,n,r,i)=>{if(!A(t)||!i)return;let a=O(t);e(e=>{let t=e.queuedMessages[a],o=t?.findIndex(e=>(e.id===n||e.queueItemID===n)&&e.operationID===i&&O(e.owner)===a)??-1,s=t?.findIndex(e=>(e.id===r||e.queueItemID===r)&&O(e.owner)===a)??-1;if(!t||o<0||s<0||o===s||k(t[o])||k(t[s]))return e;let c=t.slice(),[l]=c.splice(o,1);return c.splice(s,0,l),{queuedMessages:{...e.queuedMessages,[a]:c}}})},popToInput:(e,n,r)=>{if(!A(e)||!r)return null;let i=Ct(t(),e).find(t=>(t.id===n||t.queueItemID===n)&&t.operationID===r&&O(t.owner)===O(e));return!i||k(i)||!t().removeFromQueue(e,i.queueItemID,i.operationID)?null:i},clearQueue:n=>{if(!A(n))return!1;let r=O(n),i=t().queuedMessages[r],a=(t().pendingAdmissions[r]??[]).length>0;return(!i||i.length===0)&&!a||!i?.some(k)&&(e(e=>{if(e.queuedMessages[r]?.some(k))return e;let t={...e.queuedMessages},n={...e.pendingAdmissions};return delete t[r],delete n[r],{queuedMessages:t,pendingAdmissions:n}}),(t().queuedMessages[r]??[]).length===0)},clearAllQueues:()=>{A()&&e(e=>{let t={},n=!1;for(let[r,i]of Object.entries(e.queuedMessages)){if(i[0]&&Gt(i[0].owner)){t[r]=i;continue}let e=i.filter(k);e.length&&(t[r]=e),e.length!==i.length&&(n=!0)}let r=Object.keys(e.pendingAdmissions).length>0;return n||r?{queuedMessages:t,pendingAdmissions:{}}:e})},setFollowUpBehavior:t=>{A()&&(e({followUpBehavior:t}),z({followUpBehavior:t}))},getQueueForScope:e=>Ct(t(),e),getPendingAdmissionsForScope:e=>At(t(),e),stageAdmission:(t,n)=>{if(!A(t)||!n.requestID||!n.queueItemID||!n.operationID||!n.messageID||typeof n.content!=`string`)return;let r=Nt(n.composerDocument,n.content);if(n.composerDocument!==void 0&&!r)return;let i=Pt(n.composerMentions,r);if(n.composerMentions!==void 0&&!i)return;let a=O(t),o={kind:`pending-admission`,requestID:n.requestID,queueItemID:n.queueItemID,operationID:n.operationID,messageID:n.messageID,content:n.content,createdAt:n.createdAt,phase:`admitting`,attachmentCount:Math.max(0,Math.floor(n.attachmentCount??0)),...r?{composerDocument:r}:{},...r&&i?.length?{composerMentions:i}:{}};e(e=>{let t=[...(e.pendingAdmissions[a]??[]).filter(e=>e.requestID!==o.requestID&&e.queueItemID!==o.queueItemID),o];return{pendingAdmissions:{...e.pendingAdmissions,[a]:t}}})},unstageAdmission:(t,n)=>{if(!n)return;let r=O(t);e(e=>{let t=e.pendingAdmissions[r];if(!t?.length)return e;let i=t.filter(e=>e.requestID!==n);if(i.length===t.length)return e;if(i.length)return{pendingAdmissions:{...e.pendingAdmissions,[r]:i}};let{[r]:a,...o}=e.pendingAdmissions;return{pendingAdmissions:o}})},confirmAdmission:(n,r)=>{if(!A(n)||!r.requestID||!r.sendConfig?.providerID||!r.sendConfig?.modelID)return{ok:!1,reason:`invalid-composer-document`};let i=O(n),a=(t().pendingAdmissions[i]??[]).find(e=>e.requestID===r.requestID);if(!a)return{ok:!1,reason:`invalid-composer-document`};let o=Nt(a.composerDocument,a.content,r.attachments);if(a.composerDocument!==void 0&&!o)return{ok:!1,reason:`invalid-composer-document`};let s=Pt(a.composerMentions,o);if(a.composerMentions!==void 0&&!s)return{ok:!1,reason:`invalid-composer-mentions`};let c={id:a.queueItemID,queueItemID:a.queueItemID,operationID:a.operationID,messageID:a.messageID,content:a.content,createdAt:a.createdAt,owner:n,status:`queued`,attemptCount:0,sendConfig:r.sendConfig,...o?{composerDocument:o}:{},...o&&s?.length?{composerMentions:s}:{},...r.attachments?.length?{attachments:r.attachments}:{}};return e(e=>{let t=(e.pendingAdmissions[i]??[]).filter(e=>e.requestID!==r.requestID);return{pendingAdmissions:t.length?{...e.pendingAdmissions,[i]:t}:(()=>{let{[i]:t,...n}=e.pendingAdmissions;return n})(),queuedMessages:{...e.queuedMessages,[i]:[...e.queuedMessages[i]??[],c]}}}),{ok:!0,item:c}},bindLegacyQueue:(t,n)=>{if(!A(t)||!A(n)||t.state!==`unbound-legacy`||n.state!==`bound`||t.sessionID!==n.sessionID)return[];let r=O(t),i=O(n),a=[];return e(e=>{let t=e.queuedMessages[r];if(!t||(a=t.filter(e=>!k(e)),a.length===0))return e;let o=t.filter(k),s={...e.queuedMessages,[i]:[...a.map(e=>({...e,owner:n})),...e.queuedMessages[i]??[]]};return o.length?s[r]=o:delete s[r],{queuedMessages:s}}),a.map(e=>({...e,owner:n}))},markQueueItemSendAttempt:(t,n)=>{A(t)&&j(e,t,n,e=>e.status===`queued`||e.status===`retrying`&&(e.nextAttemptAt??0)<=Date.now()?{...e,status:`sending`,attemptCount:e.attemptCount+1,nextAttemptAt:void 0,failure:void 0}:e)},markQueueItemPreDispatchRetry:(t,n,r,i)=>j(e,t,n,e=>e.status===`sending`?{...e,status:`retrying`,nextAttemptAt:r,failure:{kind:`pre-dispatch`,recovery:i?.recovery??It(e)}}:e),markQueueItemReconciling:(t,n,r)=>j(e,t,n,e=>e.status===`sending`?{...e,status:`reconciling`,nextAttemptAt:void 0,...Kt(e),reconciliationNextCheckAt:void 0,failure:{kind:`ambiguous-dispatch`,recovery:r?.recovery??It(e)}}:e),recordQueueItemReconciliationCheck:(t,n)=>j(e,t,n,e=>e.status===`reconciling`&&Lt(e,n)?{...e,reconciliationChecks:(e.reconciliationChecks??0)+1,reconciliationNextCheckAt:Date.now()+2e3}:e),resolveQueueItemReconciliation:(t,n)=>j(e,t,n,e=>e.status===`reconciling`&&Lt(e,n)?{...e,status:`unresolved`,nextAttemptAt:void 0}:e),markQueueItemDefinitiveFailure:(t,n,r)=>j(e,t,n,e=>e.status===`sending`?{...e,status:`failed`,nextAttemptAt:void 0,failure:{kind:`definitive`,recovery:r?.recovery??It(e)}}:e),resetQueueItemForDispatch:(t,n)=>{A(t)&&j(e,t,n,e=>e.status!==`failed`&&e.status!==`unresolved`&&e.status!==`retrying`?e:{...e,status:`queued`,nextAttemptAt:void 0,failure:void 0,reconciliationStartedAt:void 0,reconciliationDeadlineAt:void 0,reconciliationChecks:void 0,reconciliationNextCheckAt:void 0})},beginQueueItemDispatch:(t,n,r,i,a=Date.now())=>{if(!A(t)||!r.startsWith(`msg_`))return null;let o=O(t),s=null;return e(e=>{let t=e.queuedMessages[o],c=i?t?.findIndex(e=>O(e.owner)===o&&Lt(e,n))??-1:0,l=c>=0?t?.[c]:void 0,u=l?.status===`queued`||l?.status===`retrying`&&(i||(l.nextAttemptAt??0)<=a)||i&&(l?.status===`failed`||l?.status===`unresolved`);if(!l||O(l.owner)!==o||!Lt(l,n)||!u||t?.some(k))return e;s={...l,messageID:r,status:`sending`,attemptCount:l.attemptCount+1,nextAttemptAt:void 0,failure:void 0,reconciliationStartedAt:void 0,reconciliationDeadlineAt:void 0,reconciliationChecks:void 0,reconciliationNextCheckAt:void 0};let d=t.slice();return d.splice(c,1),d.unshift(s),{queuedMessages:{...e.queuedMessages,[o]:d}}}),s},confirmQueueItem:(t,n)=>{if(Gt(t))return;let r=O(t);e(e=>{let t=e.queuedMessages[r],i=t?.find(e=>{let t=!n.operationID||e.operationID===n.operationID,r=!n.messageID||e.messageID===n.messageID,i=!n.queueItemID||e.queueItemID===n.queueItemID;return t&&r&&i});if(!i||!n.operationID&&!n.messageID)return e;let a=t.filter(e=>e!==i);if(a.length)return{queuedMessages:{...e.queuedMessages,[r]:a}};let{[r]:o,...s}=e.queuedMessages;return{queuedMessages:s}})}}),{name:`message-queue-store`,version:4,storage:Rt,partialize:e=>({queuedMessages:e.queuedMessages,followUpBehavior:e.followUpBehavior}),migrate:Jt,merge:(e,t)=>({...t,...Jt(e),pendingAdmissions:t.pendingAdmissions})}),{name:`message-queue-store`})),Xt=(e,t)=>{let n=Yt.getState().queuedMessages,r=[],i=[];for(let[a,o]of Object.entries(n)){let n=o[0]?.owner;if(!n||n.state!==`unbound-legacy`)continue;let s=t(n.sessionID);if(!s){i.push(n.sessionID);continue}r.push({sourceKey:a,target:{state:`bound`,transportIdentity:e,directory:s,sessionID:n.sessionID},items:o})}return!e||i.length?{ok:!1,unresolvedSessionIDs:i}:r.length?(Yt.setState(e=>{let t={...e.queuedMessages};for(let e of r){let n=O(e.target);t[n]=[...e.items.map(t=>({...t,owner:e.target})),...t[n]??[]],delete t[e.sourceKey]}return{queuedMessages:t}}),{ok:!0,moved:r.reduce((e,t)=>e+t.items.length,0)}):{ok:!0,moved:0}},Zt=xe(),Qt=e(ne(),1),$t=`directoryTreeShowHidden`,en=`directory-show-hidden-change`,tn=()=>{if(typeof window>`u`)return!0;try{let e=_().getItem($t);return e===null||e===`true`}catch{return!0}},nn=()=>{typeof window>`u`||window.dispatchEvent(new Event(en))},rn=(e,t={})=>{if(!(typeof window>`u`)){try{_().setItem($t,e?`true`:`false`),nn()}catch{}t.persist!==!1&&z({directoryShowHidden:e})}},an=()=>{let e=(0,Zt.c)(2),[t,n]=Qt.useState(tn),r,i;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>{if(typeof window>`u`)return;let e=()=>{n(tn())};return window.addEventListener(`storage`,e),window.addEventListener(en,e),()=>{window.removeEventListener(`storage`,e),window.removeEventListener(en,e)}},i=[],e[0]=r,e[1]=i):(r=e[0],i=e[1]),Qt.useEffect(r,i),t},on=`filesViewShowGitignored`,sn=`files-view-show-gitignored-change`,cn=()=>{if(typeof window>`u`)return!1;try{return _().getItem(on)===`true`}catch{return!1}},ln=()=>{typeof window>`u`||window.dispatchEvent(new Event(sn))},un=(e,t={})=>{if(!(typeof window>`u`)){try{_().setItem(on,e?`true`:`false`),ln()}catch{}t.persist!==!1&&z({filesViewShowGitignored:e})}},dn=()=>{let e=(0,Zt.c)(2),[t,n]=Qt.useState(cn),r,i;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>{if(typeof window>`u`)return;let e=()=>{n(cn())};return window.addEventListener(`storage`,e),window.addEventListener(sn,e),()=>{window.removeEventListener(`storage`,e),window.removeEventListener(sn,e)}},i=[],e[0]=r,e[1]=i):(r=e[0],i=e[1]),Qt.useEffect(r,i),t},fn=e=>{if(!e||typeof e!=`object`)return null;let t={};return typeof e.showReasoningTraces==`boolean`&&(t.showReasoningTraces=e.showReasoningTraces),typeof e.collapsibleThinkingBlocks==`boolean`&&(t.collapsibleThinkingBlocks=e.collapsibleThinkingBlocks),Object.keys(t).length>0?t:null},pn=e=>{if(!e||typeof e!=`object`)return null;let t=e;return{showReasoningTraces:t.showReasoningTraces,collapsibleThinkingBlocks:t.collapsibleThinkingBlocks}},mn=e=>{let t=S.getState();typeof e.showReasoningTraces==`boolean`&&t.setShowReasoningTraces(e.showReasoningTraces),typeof e.collapsibleThinkingBlocks==`boolean`&&t.setCollapsibleThinkingBlocks(e.collapsibleThinkingBlocks)},hn=async()=>{if(typeof window>`u`)return null;let e=localStorage.getItem(`appearance-preferences`);if(!e)return null;try{return fn(pn(JSON.parse(e)))}catch(e){return console.warn(`Failed to parse stored appearance preferences:`,e),null}},gn=[{name:`explore`,icon:`compass-3`,labelKey:`chat.draftPresets.explore.label`,command:`/explore`},{name:`catch-up`,icon:`history`,labelKey:`chat.draftPresets.catchup.label`,command:`/catch-up`},{name:`weigh`,icon:`scales-3`,labelKey:`chat.draftPresets.weigh.label`,command:`/weigh`},{name:`craft-goal`,icon:`target`,labelKey:`chat.draftPresets.craftGoal.label`,command:`/craft-goal`},{name:`debug`,icon:`bug`,labelKey:`chat.draftPresets.debug.label`,command:`/debug`},{name:`review`,icon:`search-eye`,labelKey:`chat.draftPresets.review.label`,command:`/workspace-review`}],_n=new Map(gn.map(e=>[e.name,e])),vn=e=>_n.get(e),yn=[{type:`command`,name:`explore`},{type:`command`,name:`catch-up`},{type:`command`,name:`weigh`},{type:`command`,name:`debug`},{type:`command`,name:`review`}],bn=`terminal-box`,xn=`book-open`,Sn=e=>`${e.type}:${e.name}`,Cn=(e,t)=>e.type===t.type&&e.name===t.name,wn=e=>{let t=e.replace(/^\//,``).replace(/[-_]+/g,` `).replace(/\s+/g,` `).trim();return t?t.charAt(0).toUpperCase()+t.slice(1):e},Tn=e=>{if(!Array.isArray(e))return[];let t=[],n=new Set;for(let r of e){if(!r||typeof r!=`object`)continue;let e=r,i=e.type===`command`||e.type===`skill`?e.type:null,a=typeof e.name==`string`?e.name.trim():``;if(!i||!a)continue;let o=`${i}:${a}`;n.has(o)||(n.add(o),t.push({type:i,name:a}))}return t},En=`yuri.rt.`,Dn=e=>{try{return btoa(unescape(encodeURIComponent(e))).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/g,``)}catch{return encodeURIComponent(e)}},M=(e,t=o())=>`${En}${Dn(t.trim().length>0?t.trim():`default`)}.${e}`,On=(e,t,n=o())=>e?e===M(t,n):!1,kn=()=>{if(typeof window>`u`)return!0;if(u())return d();let e=window.__YURI_API_BASE_URL__,t=window.__YURI_LOCAL_ORIGIN__;if(typeof e==`string`&&e.trim()&&typeof t==`string`&&t.trim())try{return new URL(e).origin===new URL(t).origin}catch{return!1}try{if(d())return!0}catch{}if(typeof e==`string`&&e.trim())try{let t=new URL(e).hostname;if(t!==`localhost`&&t!==`127.0.0.1`&&t!==`::1`)return!1}catch{return!1}return!0},An=(e,t)=>{let n=t?.storage??(typeof localStorage<`u`?localStorage:{getItem:()=>null}),r=t?.transport??o(),i=n.getItem(M(e,r));return i===null?kn()?n.getItem(e):null:i},N=(e,t,n)=>{let r=n?.storage??(typeof localStorage<`u`?localStorage:{setItem:()=>void 0}),i=n?.transport??o();r.setItem(M(e,i),t)},jn=e=>{let t;try{t=re()}catch{return}let n=t=>t===null?null:JSON.parse(t,e?.reviver),r=e=>t.getItem(e);return{getItem:e=>{let t=M(e,o()),i=r(t);if(i instanceof Promise)return i.then(t=>{if(t!==null)return n(t);if(!kn())return null;let i=r(e);return i instanceof Promise?i.then(n):n(i)});if(i!==null)return n(i);if(!kn())return null;let a=r(e);return a instanceof Promise?a.then(n):n(a)},setItem:(n,r)=>{let i=M(n,o());t.setItem(i,JSON.stringify(r,e?.replacer))},removeItem:e=>{let n=M(e,o());t.removeItem(n)}}},Mn=512,Nn=4096,Pn=64,Fn=2e5,In=[`concise`,`detailed`,`mentor`,`pushback`,`noFiller`,`matchEnergy`,`warmPeer`,`custom`],Ln=[`defaultModel`,`defaultVariant`,`defaultAgent`,`autoCreateWorktree`,`gitmojiEnabled`,`defaultFileViewerPreview`,`zenModel`,`messageStreamTransport`,`sttProvider`,`sttServerUrl`,`sttModel`,`sttLocalModel`,`sttLanguage`,`responseStyleEnabled`,`responseStylePreset`,`responseStyleCustomInstructions`],Rn=e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&Object.getPrototypeOf(e)===Object.prototype,zn=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),Bn=(e,t)=>{if(typeof e!=`string`)return;let n=e.trim();return n.length<=t?n:void 0},Vn=e=>{let t=Bn(e,Nn);if(t!==void 0)try{let e=new URL(t);return(e.protocol===`http:`||e.protocol===`https:`)&&!e.username&&!e.password?t:void 0}catch{return}},Hn=(e,t)=>typeof e==`string`&&t.includes(e)?e:void 0,Un=e=>typeof e==`boolean`?e:void 0,Wn=(e,t)=>{let n=e[t];switch(t){case`autoCreateWorktree`:case`gitmojiEnabled`:case`defaultFileViewerPreview`:case`responseStyleEnabled`:return Un(n);case`messageStreamTransport`:return Hn(n,[`auto`,`ws`,`sse`]);case`sttProvider`:return Hn(n,[`local`,`openai-compatible`,`volcengine`]);case`sttServerUrl`:return Vn(n);case`sttLanguage`:return Bn(n,Pn);case`responseStyleCustomInstructions`:return Bn(n,Fn);case`responseStylePreset`:return Hn(n,In);default:return Bn(n,Mn)}},Gn=e=>{if(!Rn(e))throw Error(`Invalid settings bootstrap response`);if(!zn(e,`schemaVersion`)||e.schemaVersion!==1)throw Error(`Unsupported settings bootstrap schema version`);let t={schemaVersion:1};typeof e.hasRemoteProjects==`boolean`&&(t.hasRemoteProjects=e.hasRemoteProjects);for(let n of Ln){if(!zn(e,n))continue;let r=Wn(e,n);r!==void 0&&Object.assign(t,{[n]:r})}return t},Kn=e=>{if(!Rn(e))throw Error(`Invalid settings bootstrap patch`);for(let t of Object.keys(e))if(!Ln.includes(t))throw Error(`Invalid settings bootstrap patch`);let t=Gn({schemaVersion:1,...e}),n={};for(let r of Ln)if(zn(e,r)){if(!zn(t,r))throw Error(`Invalid settings bootstrap patch`);Object.assign(n,{[r]:t[r]})}return n},qn=e=>{if(!Rn(e))return{};let t={};for(let n of Ln){if(!zn(e,n))continue;let r=Wn(e,n);r!==void 0&&Object.assign(t,{[n]:r})}return t},Jn=async(e,t)=>{let n=new AbortController,r,i=new Promise((e,t)=>{r=t}),a=e=>{r(e),n.abort(e)},o=()=>a(e.reason??new DOMException(`Request aborted`,`AbortError`)),s=setTimeout(()=>a(new DOMException(`Configuration request timed out`,`TimeoutError`)),3e4);e.addEventListener(`abort`,o,{once:!0});try{return e.aborted?(o(),await i):await Promise.race([t(n.signal),i])}finally{clearTimeout(s),e.removeEventListener(`abort`,o)}},Yn=class extends Error{status;constructor(e){super(`Settings bootstrap request failed (${e})`),this.status=e,this.name=`SettingsBootstrapRequestError`}},Xn=(e=o())=>[e,`settings`,`bootstrap`],Zn=(e=o())=>({queryKey:Xn(e),queryFn:({signal:e})=>Jn(e,async e=>{let t=await l(`/api/config/settings/bootstrap`,{method:`GET`,headers:{Accept:`application/json`},signal:e});if(!t.ok)throw new Yn(t.status);return Gn(await t.json())}),retry:(e,t)=>!(t instanceof Yn&&(t.status===404||t.status===501))&&e<1,staleTime:1/0,gcTime:1/0}),Qn=(e=o())=>Se.fetchQuery(Zn(e)),$n=(e=o())=>Se.getQueryData(Xn(e)),er=(e,t=o())=>{let n=Kn(e),r=Xn(t),i=Gn({schemaVersion:1,...Se.getQueryData(r),...n});return Se.setQueryData(r,i),i},tr=e=>{if(!(typeof window>`u`)&&!(typeof window.__YURI_HOME__==`string`&&window.__YURI_HOME__.length>0))try{window.__YURI_HOME__=e}catch{}},nr=e=>{if(!(typeof window>`u`)){if(e.themeId&&N(`selectedThemeId`,e.themeId),e.themeVariant&&N(`selectedThemeVariant`,e.themeVariant),e.lightThemeId&&N(`lightThemeId`,e.lightThemeId),e.darkThemeId&&N(`darkThemeId`,e.darkThemeId),typeof e.useSystemTheme==`boolean`&&(N(`useSystemTheme`,String(e.useSystemTheme)),N(`themeMode`,e.useSystemTheme?`system`:e.themeVariant===`dark`||e.themeVariant===`light`?e.themeVariant:`system`)),e.lastDirectory&&v(`lastDirectory`,e.lastDirectory),e.homeDirectory&&(v(`homeDirectory`,e.homeDirectory),tr(e.homeDirectory)),Array.isArray(e.projects)&&e.projects.length>0?v(`projects`,JSON.stringify(e.projects)):oe(`projects`),e.activeProjectId?v(`activeProjectId`,e.activeProjectId):oe(`activeProjectId`),Array.isArray(e.pinnedDirectories)&&e.pinnedDirectories.length>0?v(`pinnedDirectories`,JSON.stringify(e.pinnedDirectories)):oe(`pinnedDirectories`),Array.isArray(e.projects)&&e.projects.length>0){let t=e.projects.filter(e=>e.sidebarCollapsed===!0).map(e=>e.id).filter(e=>typeof e==`string`&&e.length>0);t.length>0?v(`yuri.sessions.projectCollapse`,JSON.stringify(t)):oe(`yuri.sessions.projectCollapse`)}if(typeof e.gitmojiEnabled==`boolean`?localStorage.setItem(`gitmojiEnabled`,String(e.gitmojiEnabled)):localStorage.removeItem(`gitmojiEnabled`),typeof e.directoryShowHidden==`boolean`&&localStorage.setItem(`directoryTreeShowHidden`,e.directoryShowHidden?`true`:`false`),typeof e.filesViewShowGitignored==`boolean`&&localStorage.setItem(`filesViewShowGitignored`,e.filesViewShowGitignored?`true`:`false`),typeof e.openInAppId==`string`&&e.openInAppId.length>0&&localStorage.setItem(`openInAppId`,e.openInAppId),typeof e.pwaAppName==`string`){let t=e.pwaAppName.trim().replace(/\s+/g,` `).slice(0,64);t.length>0?localStorage.setItem(`yuri.pwaName`,t):localStorage.removeItem(`yuri.pwaName`)}if(typeof e.mobileKeyboardMode==`string`&&Te(e.mobileKeyboardMode),typeof e.openCodeUpdateToastDismissedVersion==`string`){let t=e.openCodeUpdateToastDismissedVersion.trim();t?localStorage.setItem(`opencode-update-toast-dismissed-version`,t):localStorage.removeItem(`opencode-update-toast-dismissed-version`)}}},rr=e=>{typeof window>`u`||window.dispatchEvent(new CustomEvent(`yuri:settings-synced`,{detail:e}))},ir=e=>{if(!Array.isArray(e))return;let t=[],n=new Set;for(let r of e){if(!r||typeof r!=`object`)continue;let e=r,i=typeof e.id==`string`?e.id.trim():``,a=typeof e.label==`string`?e.label.trim():``,o=typeof e.source==`string`?e.source.trim():``,s=typeof e.subpath==`string`?e.subpath.trim():``,c=typeof e.gitIdentityId==`string`?e.gitIdentityId.trim():``;!i||!a||!o||n.has(i)||(n.add(i),t.push({id:i,label:a,source:o,...s?{subpath:s}:{},...c?{gitIdentityId:c}:{}}))}return t},ar=e=>{if(!e||typeof e!=`object`||Array.isArray(e))return;let t={};for(let[n,r]of Object.entries(e)){let e=typeof n==`string`?n.trim():``,i=typeof r==`string`?r.trim():``;!e||!i||(t[e]=i)}return t},or=(e,t)=>{let n=Object.entries(e),r=Object.entries(t);return n.length===r.length&&n.every(([e,n])=>t[e]===n)},sr=(e,t)=>e.length===t.length&&e.every((e,n)=>e.providerID===t[n]?.providerID&&e.modelID===t[n]?.modelID&&e.variant===t[n]?.variant),cr=(e,t)=>{if(t.length===0)return t;let n=new Map;for(let t of e)typeof t.variant==`string`&&t.variant.length>0&&n.set(`${t.providerID}/${t.modelID}`,t.variant);return t.map(e=>{if(typeof e.variant==`string`&&e.variant.length>0)return e;let t=n.get(`${e.providerID}/${e.modelID}`);return t?{providerID:e.providerID,modelID:e.modelID,variant:t}:e})},lr=(e,t)=>e.length===t.length&&e.every((e,n)=>e===t[n]),ur=e=>{if(Array.isArray(e))return Array.from(new Set(e.filter(e=>typeof e==`string`&&e.length>0)))},dr=e=>{if(!e||typeof e!=`object`||Array.isArray(e))return;let t={};for(let[n,r]of Object.entries(e)){if(!n||!Array.isArray(r))continue;let e=ur(r);e&&e.length>0&&(t[n]=e.slice(0,5))}return Object.keys(t).length>0?t:void 0},fr=(e,t)=>{let n=Object.keys(e);return n.length===Object.keys(t).length&&n.every(n=>Array.isArray(t[n])&&lr(e[n],t[n]))},pr=/^#(?:[\da-fA-F]{3}|[\da-fA-F]{6})$/,mr=e=>{if(typeof e!=`string`)return null;let t=e.trim();return t&&pr.test(t)?t.toLowerCase():null},hr=e=>{if(!Array.isArray(e))return;let t=[],n=new Set,r=new Set;for(let i of e){if(!i||typeof i!=`object`)continue;let e=i,a=typeof e.path==`string`?e.path.trim():``;if(!a)continue;let o=a===`/`?a:a.replace(/\\/g,`/`).replace(/\/+$/,``);if(!o)continue;let s=Ae(o);if(!s||n.has(s)||r.has(o))continue;n.add(s),r.add(o);let c={id:s,path:o};if(typeof e.label==`string`&&e.label.trim().length>0&&(c.label=e.label.trim()),typeof e.icon==`string`&&e.icon.trim().length>0&&(c.icon=e.icon.trim()),e.iconImage===null)c.iconImage=null;else if(e.iconImage&&typeof e.iconImage==`object`){let t=e.iconImage,n=typeof t.mime==`string`?t.mime.trim():``,r=typeof t.updatedAt==`number`&&Number.isFinite(t.updatedAt)?Math.max(0,Math.round(t.updatedAt)):0,i=t.source===`custom`||t.source===`auto`?t.source:null;n&&r>0&&i&&(c.iconImage={mime:n,updatedAt:r,source:i})}if(typeof e.color==`string`&&e.color.trim().length>0&&(c.color=e.color.trim()),e.iconBackground===null)c.iconBackground=null;else{let t=mr(e.iconBackground);t&&(c.iconBackground=t)}typeof e.addedAt==`number`&&Number.isFinite(e.addedAt)&&e.addedAt>=0&&(c.addedAt=e.addedAt),typeof e.lastOpenedAt==`number`&&Number.isFinite(e.lastOpenedAt)&&e.lastOpenedAt>=0&&(c.lastOpenedAt=e.lastOpenedAt),typeof e.sidebarCollapsed==`boolean`&&(c.sidebarCollapsed=e.sidebarCollapsed),t.push(c)}return t.length>0?t:void 0},gr=(e,t,n)=>{if(!Array.isArray(e))return;let r=[],i=new Set,a=n?.preserveVariant===!0;for(let n of e){if(!n||typeof n!=`object`)continue;let e=n,o=typeof e.providerID==`string`?e.providerID.trim():``,s=typeof e.modelID==`string`?e.modelID.trim():``;if(!o||!s)continue;let c=`${o}/${s}`;if(!i.has(c)&&(i.add(c),a&&typeof e.variant==`string`&&e.variant.trim().length>0?r.push({providerID:o,modelID:s,variant:e.variant.trim()}):r.push({providerID:o,modelID:s}),r.length>=t))break}return r},_r=()=>{let e=S.persist;if(e&&typeof e==`object`)return e},vr=()=>h()?.settings??null,yr=(e,t,n)=>{let r={...qn(t),...qn(e)};if(Object.keys(r).length!==0)try{er(r,n)}catch(e){console.warn(`Failed to patch settings bootstrap cache:`,e)}},br=e=>{let t=S.getState(),n=typeof window<`u`?window.__zustand_config_store__?.getState?.()??null:null,r=Yt.getState();if(typeof e.showReasoningTraces==`boolean`&&e.showReasoningTraces!==t.showReasoningTraces&&t.setShowReasoningTraces(e.showReasoningTraces),typeof e.sessionTitleRefreshEnabled==`boolean`&&e.sessionTitleRefreshEnabled!==t.sessionTitleRefreshEnabled&&t.setSessionTitleRefreshEnabled(e.sessionTitleRefreshEnabled),typeof e.sessionGoalEnabled==`boolean`&&e.sessionGoalEnabled!==t.sessionGoalEnabled&&t.setSessionGoalEnabled(e.sessionGoalEnabled),typeof e.collapsibleThinkingBlocks==`boolean`&&e.collapsibleThinkingBlocks!==t.collapsibleThinkingBlocks&&t.setCollapsibleThinkingBlocks(e.collapsibleThinkingBlocks),typeof e.autoDeleteEnabled==`boolean`&&e.autoDeleteEnabled!==t.autoDeleteEnabled&&t.setAutoDeleteEnabled(e.autoDeleteEnabled),typeof e.autoDeleteAfterDays==`number`&&Number.isFinite(e.autoDeleteAfterDays)){let n=Math.max(1,Math.min(365,e.autoDeleteAfterDays));n!==t.autoDeleteAfterDays&&t.setAutoDeleteAfterDays(n)}(e.sessionRetentionAction===`archive`||e.sessionRetentionAction===`delete`)&&e.sessionRetentionAction!==t.sessionRetentionAction&&t.setSessionRetentionAction(e.sessionRetentionAction);let i=null;if(Dt(e.followUpBehavior)?i=e.followUpBehavior:typeof e.queueModeEnabled==`boolean`&&(i=Ot(void 0,e.queueModeEnabled)),i&&i!==r.followUpBehavior&&r.setFollowUpBehavior(i),typeof e.showDeletionDialog==`boolean`&&e.showDeletionDialog!==t.showDeletionDialog&&t.setShowDeletionDialog(e.showDeletionDialog),typeof e.nativeNotificationsEnabled==`boolean`&&e.nativeNotificationsEnabled!==t.nativeNotificationsEnabled&&t.setNativeNotificationsEnabled(e.nativeNotificationsEnabled),typeof e.notificationMode==`string`&&(e.notificationMode===`always`||e.notificationMode===`hidden-only`)&&e.notificationMode!==t.notificationMode&&t.setNotificationMode(e.notificationMode),typeof e.notifyOnSubtasks==`boolean`&&e.notifyOnSubtasks!==t.notifyOnSubtasks&&t.setNotifyOnSubtasks(e.notifyOnSubtasks),typeof e.notifyOnCompletion==`boolean`&&e.notifyOnCompletion!==t.notifyOnCompletion&&t.setNotifyOnCompletion(e.notifyOnCompletion),typeof e.notifyOnError==`boolean`&&e.notifyOnError!==t.notifyOnError&&t.setNotifyOnError(e.notifyOnError),typeof e.notifyOnQuestion==`boolean`&&e.notifyOnQuestion!==t.notifyOnQuestion&&t.setNotifyOnQuestion(e.notifyOnQuestion),typeof e.notifyOnPermission==`boolean`&&e.notifyOnPermission!==t.notifyOnPermission&&t.setNotifyOnPermission(e.notifyOnPermission),typeof e.notifyOnScheduledTasks==`boolean`&&e.notifyOnScheduledTasks!==t.notifyOnScheduledTasks&&t.setNotifyOnScheduledTasks(e.notifyOnScheduledTasks),typeof e.notifyOnAssistants==`boolean`&&e.notifyOnAssistants!==t.notifyOnAssistants&&t.setNotifyOnAssistants(e.notifyOnAssistants),typeof e.notifyOnGoals==`boolean`&&e.notifyOnGoals!==t.notifyOnGoals&&t.setNotifyOnGoals(e.notifyOnGoals),e.notificationTemplates&&typeof e.notificationTemplates==`object`&&t.setNotificationTemplates(e.notificationTemplates),typeof e.summarizeLastMessage==`boolean`&&e.summarizeLastMessage!==t.summarizeLastMessage&&t.setSummarizeLastMessage(e.summarizeLastMessage),typeof e.summaryThreshold==`number`&&Number.isFinite(e.summaryThreshold)&&t.setSummaryThreshold(e.summaryThreshold),typeof e.summaryLength==`number`&&Number.isFinite(e.summaryLength)&&t.setSummaryLength(e.summaryLength),typeof e.maxLastMessageLength==`number`&&Number.isFinite(e.maxLastMessageLength)&&t.setMaxLastMessageLength(e.maxLastMessageLength),typeof e.inputSpellcheckEnabled==`boolean`&&e.inputSpellcheckEnabled!==t.inputSpellcheckEnabled&&t.setInputSpellcheckEnabled(e.inputSpellcheckEnabled),typeof e.showOpenCodeUpdateNotifications==`boolean`&&e.showOpenCodeUpdateNotifications!==t.showOpenCodeUpdateNotifications&&t.setShowOpenCodeUpdateNotifications(e.showOpenCodeUpdateNotifications),typeof e.showToolFileIcons==`boolean`&&e.showToolFileIcons!==t.showToolFileIcons&&t.setShowToolFileIcons(e.showToolFileIcons),typeof e.showTurnChangedFiles==`boolean`&&e.showTurnChangedFiles!==t.showTurnChangedFiles&&t.setShowTurnChangedFiles(e.showTurnChangedFiles),typeof e.showExpandedBashTools==`boolean`&&e.showExpandedBashTools!==t.showExpandedBashTools&&t.setShowExpandedBashTools(e.showExpandedBashTools),typeof e.showSubagentTaskDetails==`boolean`&&e.showSubagentTaskDetails!==t.showSubagentTaskDetails&&t.setShowSubagentTaskDetails(e.showSubagentTaskDetails),typeof e.timeFormatPreference==`string`&&(e.timeFormatPreference===`auto`||e.timeFormatPreference===`12h`||e.timeFormatPreference===`24h`)&&e.timeFormatPreference!==t.timeFormatPreference&&t.setTimeFormatPreference(e.timeFormatPreference),typeof e.weekStartPreference==`string`&&(e.weekStartPreference===`auto`||e.weekStartPreference===`sunday`||e.weekStartPreference===`monday`)&&e.weekStartPreference!==t.weekStartPreference&&t.setWeekStartPreference(e.weekStartPreference),typeof e.desktopWindowControlsPosition==`string`&&(e.desktopWindowControlsPosition===`auto`||e.desktopWindowControlsPosition===`left`||e.desktopWindowControlsPosition===`right`)&&e.desktopWindowControlsPosition!==t.desktopWindowControlsPosition&&t.setDesktopWindowControlsPosition(e.desktopWindowControlsPosition),(e.sidebarView===`tasks`||e.sidebarView===`projects`)&&e.sidebarView!==t.sidebarView&&t.setSidebarView(e.sidebarView),typeof e.chatRenderMode==`string`&&(e.chatRenderMode===`sorted`||e.chatRenderMode===`live`)&&e.chatRenderMode!==t.chatRenderMode&&t.setChatRenderMode(e.chatRenderMode),typeof e.activityRenderMode==`string`&&(e.activityRenderMode===`collapsed`||e.activityRenderMode===`summary`)&&e.activityRenderMode!==t.activityRenderMode&&t.setActivityRenderMode(e.activityRenderMode),typeof e.collapsibleUserMessages==`boolean`&&e.collapsibleUserMessages!==t.collapsibleUserMessages&&t.setCollapsibleUserMessages(e.collapsibleUserMessages),typeof e.messageStreamTransport==`string`&&(e.messageStreamTransport===`auto`||e.messageStreamTransport===`ws`||e.messageStreamTransport===`sse`)&&n&&e.messageStreamTransport!==n.settingsMessageStreamTransport&&n.setSettingsMessageStreamTransport(e.messageStreamTransport),typeof e.promptNavigatorEnabled==`boolean`&&e.promptNavigatorEnabled!==t.promptNavigatorEnabled&&t.setPromptNavigatorEnabled(e.promptNavigatorEnabled),typeof e.showSplitAssistantMessageActions==`boolean`&&e.showSplitAssistantMessageActions!==t.showSplitAssistantMessageActions&&t.setShowSplitAssistantMessageActions(e.showSplitAssistantMessageActions),typeof e.showAssistantTps==`boolean`&&e.showAssistantTps!==t.showAssistantTps&&t.setShowAssistantTps(e.showAssistantTps),typeof e.reportUsage==`boolean`&&e.reportUsage!==t.reportUsage&&t.setReportUsage(e.reportUsage),typeof e.fontSize==`number`&&Number.isFinite(e.fontSize)&&e.fontSize!==t.fontSize&&t.setFontSize(e.fontSize),Array.isArray(e.draftStarters)){let n=Tn(e.draftStarters);JSON.stringify(t.globalDraftStarters)!==JSON.stringify(n)&&t.setGlobalDraftStarters(n)}if(typeof e.terminalFontSize==`number`&&Number.isFinite(e.terminalFontSize)&&e.terminalFontSize!==t.terminalFontSize&&t.setTerminalFontSize(e.terminalFontSize),typeof e.editorFontSize==`number`&&Number.isFinite(e.editorFontSize)&&e.editorFontSize!==t.editorFontSize&&t.setEditorFontSize(e.editorFontSize),Ee(e.uiFont)&&e.uiFont!==t.uiFont&&t.setUiFont(e.uiFont),Ce(e.monoFont)&&e.monoFont!==t.monoFont&&t.setMonoFont(e.monoFont),typeof e.padding==`number`&&Number.isFinite(e.padding)&&e.padding!==t.padding&&t.setPadding(e.padding),typeof e.cornerRadius==`number`&&Number.isFinite(e.cornerRadius)&&e.cornerRadius!==t.cornerRadius&&t.setCornerRadius(e.cornerRadius),typeof e.inputBarOffset==`number`&&Number.isFinite(e.inputBarOffset)&&e.inputBarOffset!==t.inputBarOffset&&t.setInputBarOffset(e.inputBarOffset),e.shortcutOverrides&&!or(e.shortcutOverrides,t.shortcutOverrides)&&S.setState({shortcutOverrides:e.shortcutOverrides}),typeof e.mobileKeyboardMode==`string`){let n=we(e.mobileKeyboardMode,t.mobileKeyboardMode);n!==t.mobileKeyboardMode&&t.setMobileKeyboardMode(n)}if(Array.isArray(e.favoriteModels)){let n=t.favoriteModels,r=cr(n,e.favoriteModels);sr(n,r)||S.setState({favoriteModels:r})}if(Array.isArray(e.hiddenModels)){let n=t.hiddenModels,r=e.hiddenModels;sr(n,r)||S.setState({hiddenModels:r})}if(Array.isArray(e.collapsedModelProviders)){let n=t.collapsedModelProviders,r=e.collapsedModelProviders;lr(n,r)||S.setState({collapsedModelProviders:r})}if(Array.isArray(e.recentModels)){let n=t.recentModels,r=cr(n,e.recentModels);sr(n,r)||S.setState({recentModels:r})}if(Array.isArray(e.recentAgents)){let n=t.recentAgents,r=e.recentAgents;lr(n,r)||S.setState({recentAgents:r})}if(e.recentEfforts&&typeof e.recentEfforts==`object`){let n=t.recentEfforts,r=e.recentEfforts;fr(n,r)||S.setState({recentEfforts:r})}typeof e.diffLayoutPreference==`string`&&(e.diffLayoutPreference===`dynamic`||e.diffLayoutPreference===`inline`||e.diffLayoutPreference===`side-by-side`)&&e.diffLayoutPreference!==t.diffLayoutPreference&&t.setDiffLayoutPreference(e.diffLayoutPreference),typeof e.gitChangesViewMode==`string`&&(e.gitChangesViewMode===`flat`||e.gitChangesViewMode===`tree`)&&e.gitChangesViewMode!==t.gitChangesViewMode&&t.setGitChangesViewMode(e.gitChangesViewMode),typeof e.directoryShowHidden==`boolean`&&rn(e.directoryShowHidden,{persist:!1}),typeof e.filesViewShowGitignored==`boolean`&&un(e.filesViewShowGitignored,{persist:!1})},xr=e=>{if(!e||typeof e!=`object`)return null;let t=e,n={};if(typeof t.hasRemoteProjects==`boolean`&&(n.hasRemoteProjects=t.hasRemoteProjects),t.hubProjectLayout!==void 0&&(n.hubProjectLayout=ke(t.hubProjectLayout)),typeof t.themeId==`string`&&t.themeId.length>0&&(n.themeId=t.themeId),(t.useSystemTheme===!0||t.useSystemTheme===!1)&&(n.useSystemTheme=t.useSystemTheme),typeof t.themeVariant==`string`&&(t.themeVariant===`light`||t.themeVariant===`dark`)&&(n.themeVariant=t.themeVariant),typeof t.lightThemeId==`string`&&t.lightThemeId.length>0&&(n.lightThemeId=t.lightThemeId),typeof t.darkThemeId==`string`&&t.darkThemeId.length>0&&(n.darkThemeId=t.darkThemeId),typeof t.lastDirectory==`string`&&t.lastDirectory.length>0&&(n.lastDirectory=t.lastDirectory),typeof t.homeDirectory==`string`&&t.homeDirectory.length>0&&(n.homeDirectory=t.homeDirectory),typeof t.opencodeBinary==`string`){let e=t.opencodeBinary.trim();n.opencodeBinary=e.length>0?e:void 0}typeof t.desktopLanAccessEnabled==`boolean`&&(n.desktopLanAccessEnabled=t.desktopLanAccessEnabled),typeof t.desktopKeepAwakeEnabled==`boolean`&&(n.desktopKeepAwakeEnabled=t.desktopKeepAwakeEnabled),typeof t.desktopMinimizeToTrayEnabled==`boolean`&&(n.desktopMinimizeToTrayEnabled=t.desktopMinimizeToTrayEnabled);let r=hr(t.projects);if([`manual`,`a-z`,`z-a`,`date-added`,`recent`].includes(t.projectSortOrder)&&(n.projectSortOrder=t.projectSortOrder),r&&(n.projects=r),typeof t.activeProjectId==`string`&&t.activeProjectId.length>0&&(n.activeProjectId=t.activeProjectId),Array.isArray(t.securityScopedBookmarks)&&(n.securityScopedBookmarks=t.securityScopedBookmarks.filter(e=>typeof e==`string`&&e.length>0)),Array.isArray(t.pinnedDirectories)&&(n.pinnedDirectories=Array.from(new Set(t.pinnedDirectories.filter(e=>typeof e==`string`&&e.length>0)))),Array.isArray(t.draftStarters)&&(n.draftStarters=Tn(t.draftStarters)),typeof t.draftStartersCraftGoalAdded==`boolean`&&(n.draftStartersCraftGoalAdded=t.draftStartersCraftGoalAdded),typeof t.showReasoningTraces==`boolean`&&(n.showReasoningTraces=t.showReasoningTraces),typeof t.sessionTitleRefreshEnabled==`boolean`&&(n.sessionTitleRefreshEnabled=t.sessionTitleRefreshEnabled),typeof t.sessionGoalEnabled==`boolean`&&(n.sessionGoalEnabled=t.sessionGoalEnabled),typeof t.collapsibleThinkingBlocks==`boolean`&&(n.collapsibleThinkingBlocks=t.collapsibleThinkingBlocks),typeof t.autoDeleteEnabled==`boolean`&&(n.autoDeleteEnabled=t.autoDeleteEnabled),typeof t.autoDeleteAfterDays==`number`&&Number.isFinite(t.autoDeleteAfterDays)&&(n.autoDeleteAfterDays=t.autoDeleteAfterDays),(t.sessionRetentionAction===`archive`||t.sessionRetentionAction===`delete`)&&(n.sessionRetentionAction=t.sessionRetentionAction),typeof t.defaultModel==`string`&&t.defaultModel.length>0&&(n.defaultModel=t.defaultModel),typeof t.defaultVariant==`string`&&t.defaultVariant.length>0&&(n.defaultVariant=t.defaultVariant),typeof t.defaultAgent==`string`&&t.defaultAgent.length>0&&(n.defaultAgent=t.defaultAgent),typeof t.smallModelUseDefault==`boolean`&&(n.smallModelUseDefault=t.smallModelUseDefault),typeof t.smallModelOverride==`string`&&t.smallModelOverride.length>0&&(n.smallModelOverride=t.smallModelOverride),(t.summaryModelMode===`provider`||t.summaryModelMode===`custom`)&&(n.summaryModelMode=t.summaryModelMode),typeof t.summaryProviderID==`string`&&t.summaryProviderID.length>0&&(n.summaryProviderID=t.summaryProviderID),typeof t.summaryModelID==`string`&&t.summaryModelID.length>0&&(n.summaryModelID=t.summaryModelID),typeof t.summaryCustomModelID==`string`&&t.summaryCustomModelID.length>0&&(n.summaryCustomModelID=t.summaryCustomModelID),typeof t.summaryCustomBaseURL==`string`&&(n.summaryCustomBaseURL=t.summaryCustomBaseURL),typeof t.hasSummaryCustomAPIToken==`boolean`&&(n.hasSummaryCustomAPIToken=t.hasSummaryCustomAPIToken),typeof t.summaryCommitPrompt==`string`&&(n.summaryCommitPrompt=t.summaryCommitPrompt),typeof t.summarySessionTitlePrompt==`string`&&(n.summarySessionTitlePrompt=t.summarySessionTitlePrompt),typeof t.autoCreateWorktree==`boolean`&&(n.autoCreateWorktree=t.autoCreateWorktree),typeof t.gitmojiEnabled==`boolean`&&(n.gitmojiEnabled=t.gitmojiEnabled),Dt(t.followUpBehavior)?n.followUpBehavior=t.followUpBehavior:typeof t.queueModeEnabled==`boolean`&&(n.followUpBehavior=Ot(void 0,t.queueModeEnabled)),typeof t.showDeletionDialog==`boolean`&&(n.showDeletionDialog=t.showDeletionDialog),typeof t.nativeNotificationsEnabled==`boolean`&&(n.nativeNotificationsEnabled=t.nativeNotificationsEnabled),typeof t.notificationMode==`string`&&(t.notificationMode===`always`||t.notificationMode===`hidden-only`)&&(n.notificationMode=t.notificationMode),typeof t.notifyOnSubtasks==`boolean`&&(n.notifyOnSubtasks=t.notifyOnSubtasks),typeof t.notifyOnCompletion==`boolean`&&(n.notifyOnCompletion=t.notifyOnCompletion),typeof t.notifyOnError==`boolean`&&(n.notifyOnError=t.notifyOnError),typeof t.notifyOnQuestion==`boolean`&&(n.notifyOnQuestion=t.notifyOnQuestion),typeof t.notifyOnPermission==`boolean`&&(n.notifyOnPermission=t.notifyOnPermission),typeof t.notifyOnScheduledTasks==`boolean`&&(n.notifyOnScheduledTasks=t.notifyOnScheduledTasks),typeof t.notifyOnAssistants==`boolean`&&(n.notifyOnAssistants=t.notifyOnAssistants),typeof t.notifyOnGoals==`boolean`&&(n.notifyOnGoals=t.notifyOnGoals),t.notificationTemplates&&typeof t.notificationTemplates==`object`){let e=t.notificationTemplates,r=t=>{let n=e[t];if(!n||typeof n!=`object`)return;let r=n;return{title:typeof r.title==`string`?r.title:``,message:typeof r.message==`string`?r.message:``}},i=r(`completion`),a=r(`error`),o=r(`question`),s=r(`subtask`);(i||a||o||s)&&(n.notificationTemplates={completion:i??{title:`Task Complete`,message:`Your task has finished.`},error:a??{title:`Error Occurred`,message:`An error occurred while processing your task.`},question:o??{title:`Input Needed`,message:`Please provide input to continue.`},subtask:s??{title:`Subtask Complete`,message:`A subtask has finished.`}})}if(typeof t.summarizeLastMessage==`boolean`&&(n.summarizeLastMessage=t.summarizeLastMessage),typeof t.summaryThreshold==`number`&&Number.isFinite(t.summaryThreshold)&&(n.summaryThreshold=Math.max(0,Math.round(t.summaryThreshold))),typeof t.summaryLength==`number`&&Number.isFinite(t.summaryLength)&&(n.summaryLength=Math.max(10,Math.round(t.summaryLength))),typeof t.maxLastMessageLength==`number`&&Number.isFinite(t.maxLastMessageLength)&&(n.maxLastMessageLength=Math.max(10,Math.round(t.maxLastMessageLength))),typeof t.usageAutoRefresh==`boolean`&&(n.usageAutoRefresh=t.usageAutoRefresh),typeof t.usageRefreshIntervalMs==`number`&&Number.isFinite(t.usageRefreshIntervalMs)&&(n.usageRefreshIntervalMs=t.usageRefreshIntervalMs),(t.usageDisplayMode===`usage`||t.usageDisplayMode===`remaining`)&&(n.usageDisplayMode=t.usageDisplayMode),typeof t.usageShowPredValues==`boolean`&&(n.usageShowPredValues=t.usageShowPredValues),Array.isArray(t.usageDropdownProviders)&&(n.usageDropdownProviders=t.usageDropdownProviders.filter(e=>typeof e==`string`&&e.length>0)),typeof t.magpieUsageUrl==`string`&&(n.magpieUsageUrl=t.magpieUsageUrl),Array.isArray(t.magpieHiddenProviders)&&(n.magpieHiddenProviders=t.magpieHiddenProviders.filter(e=>typeof e==`string`&&e.startsWith(`magpie:`))),t.usageSelectedModels&&typeof t.usageSelectedModels==`object`){let e={};for(let[n,r]of Object.entries(t.usageSelectedModels))Array.isArray(r)&&(e[n]=r.filter(e=>typeof e==`string`));Object.keys(e).length>0&&(n.usageSelectedModels=e)}if(t.usageCollapsedFamilies&&typeof t.usageCollapsedFamilies==`object`){let e={};for(let[n,r]of Object.entries(t.usageCollapsedFamilies))Array.isArray(r)&&(e[n]=r.filter(e=>typeof e==`string`));Object.keys(e).length>0&&(n.usageCollapsedFamilies=e)}if(t.usageExpandedFamilies&&typeof t.usageExpandedFamilies==`object`){let e={};for(let[n,r]of Object.entries(t.usageExpandedFamilies))Array.isArray(r)&&(e[n]=r.filter(e=>typeof e==`string`));Object.keys(e).length>0&&(n.usageExpandedFamilies=e)}if(t.usageModelGroups&&typeof t.usageModelGroups==`object`){let e={};for(let[n,r]of Object.entries(t.usageModelGroups))if(r&&typeof r==`object`){let t=r,i={};Array.isArray(t.customGroups)&&(i.customGroups=t.customGroups.filter(e=>e&&typeof e==`object`).map(e=>({id:String(e.id??``),label:String(e.label??``),models:Array.isArray(e.models)?e.models.filter(e=>typeof e==`string`):[],order:typeof e.order==`number`?e.order:0}))),t.modelAssignments&&typeof t.modelAssignments==`object`&&(i.modelAssignments=Object.fromEntries(Object.entries(t.modelAssignments).filter(([,e])=>typeof e==`string`).map(([e,t])=>[e,String(t)]))),t.renamedGroups&&typeof t.renamedGroups==`object`&&(i.renamedGroups=Object.fromEntries(Object.entries(t.renamedGroups).filter(([,e])=>typeof e==`string`).map(([e,t])=>[e,String(t)]))),Object.keys(i).length>0&&(e[n]=i)}Object.keys(e).length>0&&(n.usageModelGroups=e)}typeof t.inputSpellcheckEnabled==`boolean`&&(n.inputSpellcheckEnabled=t.inputSpellcheckEnabled),typeof t.showOpenCodeUpdateNotifications==`boolean`&&(n.showOpenCodeUpdateNotifications=t.showOpenCodeUpdateNotifications),typeof t.openCodeUpdateToastDismissedVersion==`string`&&(n.openCodeUpdateToastDismissedVersion=t.openCodeUpdateToastDismissedVersion.trim().slice(0,128)),typeof t.showToolFileIcons==`boolean`&&(n.showToolFileIcons=t.showToolFileIcons),typeof t.showTurnChangedFiles==`boolean`&&(n.showTurnChangedFiles=t.showTurnChangedFiles),typeof t.showExpandedBashTools==`boolean`&&(n.showExpandedBashTools=t.showExpandedBashTools),typeof t.showSubagentTaskDetails==`boolean`&&(n.showSubagentTaskDetails=t.showSubagentTaskDetails),typeof t.timeFormatPreference==`string`&&(t.timeFormatPreference===`auto`||t.timeFormatPreference===`12h`||t.timeFormatPreference===`24h`)&&(n.timeFormatPreference=t.timeFormatPreference),typeof t.weekStartPreference==`string`&&(t.weekStartPreference===`auto`||t.weekStartPreference===`sunday`||t.weekStartPreference===`monday`)&&(n.weekStartPreference=t.weekStartPreference),typeof t.desktopWindowControlsPosition==`string`&&(t.desktopWindowControlsPosition===`auto`||t.desktopWindowControlsPosition===`left`||t.desktopWindowControlsPosition===`right`)&&(n.desktopWindowControlsPosition=t.desktopWindowControlsPosition),(t.sidebarView===`tasks`||t.sidebarView===`projects`)&&(n.sidebarView=t.sidebarView),typeof t.chatRenderMode==`string`&&(t.chatRenderMode===`sorted`||t.chatRenderMode===`live`)&&(n.chatRenderMode=t.chatRenderMode),typeof t.messageStreamTransport==`string`&&(t.messageStreamTransport===`auto`||t.messageStreamTransport===`ws`||t.messageStreamTransport===`sse`)&&(n.messageStreamTransport=t.messageStreamTransport),typeof t.activityRenderMode==`string`&&(t.activityRenderMode===`collapsed`||t.activityRenderMode===`summary`)&&(n.activityRenderMode=t.activityRenderMode),typeof t.collapsibleUserMessages==`boolean`&&(n.collapsibleUserMessages=t.collapsibleUserMessages),typeof t.showSplitAssistantMessageActions==`boolean`&&(n.showSplitAssistantMessageActions=t.showSplitAssistantMessageActions),typeof t.showAssistantTps==`boolean`&&(n.showAssistantTps=t.showAssistantTps),typeof t.fontSize==`number`&&Number.isFinite(t.fontSize)&&(n.fontSize=t.fontSize),typeof t.terminalFontSize==`number`&&Number.isFinite(t.terminalFontSize)&&(n.terminalFontSize=t.terminalFontSize),typeof t.editorFontSize==`number`&&Number.isFinite(t.editorFontSize)&&(n.editorFontSize=t.editorFontSize),Ee(t.uiFont)&&(n.uiFont=t.uiFont),Ce(t.monoFont)&&(n.monoFont=t.monoFont),typeof t.padding==`number`&&Number.isFinite(t.padding)&&(n.padding=t.padding),typeof t.cornerRadius==`number`&&Number.isFinite(t.cornerRadius)&&(n.cornerRadius=t.cornerRadius),typeof t.inputBarOffset==`number`&&Number.isFinite(t.inputBarOffset)&&(n.inputBarOffset=t.inputBarOffset);let i=ar(t.shortcutOverrides);i&&(n.shortcutOverrides=i),typeof t.mobileKeyboardMode==`string`&&(t.mobileKeyboardMode===`native`||t.mobileKeyboardMode===`resize-content`)&&(n.mobileKeyboardMode=t.mobileKeyboardMode);let a=gr(t.favoriteModels,64,{preserveVariant:!0});a&&(n.favoriteModels=a);let o=gr(t.hiddenModels,1024);o&&(n.hiddenModels=o);let s=ur(t.collapsedModelProviders);s&&(n.collapsedModelProviders=s);let c=gr(t.recentModels,16,{preserveVariant:!0});c&&(n.recentModels=c);let l=ur(t.recentAgents);l&&(n.recentAgents=l);let u=dr(t.recentEfforts);if(u&&(n.recentEfforts=u),typeof t.diffLayoutPreference==`string`&&(t.diffLayoutPreference===`dynamic`||t.diffLayoutPreference===`inline`||t.diffLayoutPreference===`side-by-side`)&&(n.diffLayoutPreference=t.diffLayoutPreference),typeof t.gitChangesViewMode==`string`&&(t.gitChangesViewMode===`flat`||t.gitChangesViewMode===`tree`)&&(n.gitChangesViewMode=t.gitChangesViewMode),typeof t.directoryShowHidden==`boolean`&&(n.directoryShowHidden=t.directoryShowHidden),typeof t.filesViewShowGitignored==`boolean`&&(n.filesViewShowGitignored=t.filesViewShowGitignored),typeof t.openInAppId==`string`&&t.openInAppId.length>0&&(n.openInAppId=t.openInAppId),typeof t.pwaAppName==`string`){let e=t.pwaAppName.trim().replace(/\s+/g,` `).slice(0,64);n.pwaAppName=e.length>0?e:``}let d=ir(t.skillCatalogs);return d&&(n.skillCatalogs=d),typeof t.reportUsage==`boolean`&&(n.reportUsage=t.reportUsage),typeof t.globalBehaviorPrompt==`string`&&(n.globalBehaviorPrompt=t.globalBehaviorPrompt),typeof t.responseStyleEnabled==`boolean`&&(n.responseStyleEnabled=t.responseStyleEnabled),typeof t.responseStylePreset==`string`&&(t.responseStylePreset===`concise`||t.responseStylePreset===`detailed`||t.responseStylePreset===`mentor`||t.responseStylePreset===`pushback`||t.responseStylePreset===`noFiller`||t.responseStylePreset===`matchEnergy`||t.responseStylePreset===`warmPeer`||t.responseStylePreset===`custom`)&&(n.responseStylePreset=t.responseStylePreset),typeof t.responseStyleCustomInstructions==`string`&&(n.responseStyleCustomInstructions=t.responseStyleCustomInstructions),typeof t.dictationEnabled==`boolean`&&(n.dictationEnabled=t.dictationEnabled),t.sttProvider===`local`||t.sttProvider===`openai-compatible`||t.sttProvider===`volcengine`?n.sttProvider=t.sttProvider:t.sttProvider===`server`?n.sttProvider=`openai-compatible`:(t.sttProvider===`browser`||t.sttProvider===`wasm`)&&(n.sttProvider=`local`),typeof t.sttServerUrl==`string`&&(n.sttServerUrl=t.sttServerUrl.trim()),typeof t.sttModel==`string`&&(n.sttModel=t.sttModel.trim()),typeof t.sttLocalModel==`string`&&(n.sttLocalModel=t.sttLocalModel.trim()),typeof t.sttLanguage==`string`&&(n.sttLanguage=t.sttLanguage.trim()),n},P=new Map,Sr=new Map,Cr=2e3,wr=async e=>{let t=P.get(e);if(t&&Date.now()-t.at<Cr)return t.value;let n=Sr.get(e);if(n)return n;let r=(async()=>{if(o()!==e)return null;let t=vr();if(t)try{let n=xr((await t.load()).settings);return P.set(e,{value:n,at:Date.now()}),n}catch(e){console.warn(`Failed to load shared settings from runtime settings API:`,e)}if(o()!==e)return null;try{let t=await l(`/api/config/settings`,{method:`GET`,headers:{Accept:`application/json`}});if(!t.ok)return null;let n=xr(await t.json().catch(()=>null));return P.set(e,{value:n,at:Date.now()}),n}catch(e){return console.warn(`Failed to load shared settings from server:`,e),null}})();Sr.set(e,r);try{return await r}finally{Sr.get(e)===r&&Sr.delete(e)}},Tr=(e=o())=>{P.delete(e)},Er=async()=>{if(typeof window>`u`)return;let e=o(),t=_r(),n=()=>!t?.hasHydrated||t.hasHydrated()||!t.onFinishHydration?Promise.resolve():new Promise(e=>{let n=!1,r=()=>{n||(n=!0,e())},i=t.onFinishHydration(()=>{i?.(),r()});t.hasHydrated?.()&&r()}),r=async t=>{if(await n(),o()===e){try{nr(t)}catch(e){console.warn(`persistToLocalStorage failed:`,e)}try{br(t)}catch(e){console.warn(`applyDesktopUiPreferences failed:`,e)}rr(t)}};try{let t=await wr(e);t&&o()===e&&await r(t)}catch(e){console.warn(`Failed to synchronise settings:`,e)}},F=null,I=null,L=null,Dr=[],Or=200,R=new Map,kr=async e=>{for(;R.get(e)?.size;)await Promise.all([...R.get(e)])},Ar=async()=>{let e=F,t=I,n=Dr;if(F=null,I=null,L=null,Dr=[],!e||!t||Object.keys(e).length===0){n.forEach(e=>e());return}if(o()!==t){n.forEach(e=>e());return}let r=()=>o()===t,i=vr();if(i){try{let a=await i.save(e);yr(a,e,t),a&&r()&&(nr(a),br(a),rr(a),P.set(t,{value:xr(a),at:Date.now()})),n.forEach(e=>e());return}catch(e){console.warn(`Failed to update settings via runtime settings API:`,e)}if(!r()){n.forEach(e=>e());return}}try{let n=await l(`/api/config/settings`,{method:`PUT`,headers:{"Content-Type":`application/json`,Accept:`application/json`},body:JSON.stringify(e)});if(!n.ok){console.warn(`Failed to update shared settings via API:`,n.status,n.statusText);return}let i=await n.json().catch(()=>null);yr(i,e,t),i&&r()&&(nr(i),br(i),rr(i),P.set(t,{value:xr(i),at:Date.now()}))}catch(e){console.warn(`Failed to update shared settings via API:`,e)}finally{n.forEach(e=>e())}},z=async e=>{if(typeof window>`u`)return;let t=o();if(I&&I!==t){L&&=(clearTimeout(L),null),F=null,I=null;let e=Dr;Dr=[],e.forEach(e=>e())}let n={...F??{}},r=P.get(t)?.value;for(let[t,i]of Object.entries(e)){let e=r?.[t];Object.is(i,e)||i!==void 0&&e!==void 0&&JSON.stringify(i)===JSON.stringify(e)?delete n[t]:n[t]=i}if(F=n,I=t,Object.keys(n).length===0&&!L){F=null,I=null;return}L&&clearTimeout(L);let i=new Promise(e=>{Dr.push(e)}),a=R.get(t)??new Set;R.set(t,a),a.add(i),L=setTimeout(()=>void Ar(),Or);try{await i}finally{a.delete(i),a.size===0&&R.get(t)===a&&R.delete(t)}},jr=async()=>{if(typeof window>`u`)return;let e=_r();try{let t=await hn();if(!t)return;let n=()=>mn(t);if(e?.hasHydrated?.()){n();return}if(n(),e?.onFinishHydration){let t=e.onFinishHydration(()=>{t?.(),n()})}}catch(e){console.warn(`Failed to load appearance preferences:`,e)}},Mr=3e4,Nr=40,Pr=60,Fr=(e,t,n,r,i,a)=>{let o=e.trim(),s=t.trim().toLowerCase();return JSON.stringify([o,s,n,r,i,a])},Ir=(e,t)=>{try{let n=JSON.parse(e);return Array.isArray(n)&&n[0]===t}catch{return!1}},Lr=g()(te((e,t)=>({cache:{},cacheKeys:[],inFlight:{},async searchFiles(n,r,i=Pr,a){if(!n||n.trim().length===0)return[];let o=n.trim(),s=typeof r==`string`?r.trim():``,c=!!a?.includeHidden,l=a?.respectGitignore??!0,u=a?.type===`directory`?`directory`:`file`,d=Fr(o,s,i,c,l,u),f=Date.now(),p=t().cache[d];if(p&&f-p.timestamp<Mr)return p.files;let m=t().inFlight[d];if(m)return m;let h=y.searchFiles(s,{directory:o,limit:i,includeHidden:c,respectGitignore:l,dirs:u!==`file`,type:u}).then(t=>(e(e=>{if(e.inFlight[d]!==h)return e;let n={...e.cache,[d]:{files:t,timestamp:Date.now()}},r=e.cacheKeys.filter(e=>e!==d);for(r.push(d);r.length>Nr;){let e=r.shift();e&&delete n[e]}return{cache:n,cacheKeys:r}}),t)).finally(()=>{e(e=>{if(e.inFlight[d]!==h)return e;let t={...e.inFlight};return delete t[d],{inFlight:t}})});return e(e=>({inFlight:{...e.inFlight,[d]:h}})),h},invalidateDirectory(t){if(!t||t.trim().length===0){e({cache:{},cacheKeys:[],inFlight:{}});return}let n=t.trim();e(e=>{let t={...e.cache},r=e.cacheKeys.filter(e=>!Ir(e,n)||(delete t[e],!1)),i=Object.entries(e.inFlight).filter(([e])=>!Ir(e,n));return{cache:t,cacheKeys:r,inFlight:Object.fromEntries(i)}})}}),{name:`file-search-store`})),Rr=()=>{if(typeof window>`u`)return!1;try{return window.localStorage.getItem(`yuri_stream_debug`)===`1`}catch{return!1}},zr=`yuri_stream_perf`,Br=()=>{if(typeof window>`u`)return!1;try{return window.localStorage.getItem(zr)===`1`}catch{return!1}},Vr=()=>typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now(),Hr=()=>{if(!Br()||typeof window>`u`)return null;if(!window.__yuriStreamPerfState){let e=Date.now();window.__yuriStreamPerfState={counters:new Map,startedAt:e,lastUpdatedAt:e}}return window.__yuriStreamPerfState},Ur=e=>Array.from(e.entries()).map(([e,t])=>({metric:e,count:t.count,avg:t.count>0?Number((t.total/t.count).toFixed(3)):0,max:Number(t.max.toFixed(3)),total:Number(t.total.toFixed(3)),last:Number(t.last.toFixed(3))})).sort((e,t)=>t.total-e.total||t.count-e.count),Wr=(e,t)=>{let n=Hr();if(!n)return;let r=n.counters.get(e)??{count:0,total:0,max:0,last:0};r.count+=1,r.total+=t,r.max=Math.max(r.max,t),r.last=t,n.counters.set(e,r),n.lastUpdatedAt=Date.now()},Gr=e=>{if(!(typeof window>`u`))try{if(e){window.localStorage.setItem(zr,`1`),window.__yuriStreamPerfState={counters:new Map,startedAt:Date.now(),lastUpdatedAt:Date.now()};return}window.localStorage.removeItem(zr),delete window.__yuriStreamPerfState,delete window.__yuriVsCodeStreamPerfState}catch{}},Kr=()=>{typeof window>`u`||(Br()&&(window.__yuriStreamPerfState={counters:new Map,startedAt:Date.now(),lastUpdatedAt:Date.now()}),window.__yuriVsCodeStreamPerfState&&(window.__yuriVsCodeStreamPerfState={...window.__yuriVsCodeStreamPerfState,counters:new Map,startedAt:Date.now(),lastUpdatedAt:Date.now()}))},qr=()=>{if(typeof window>`u`)return{enabled:!1,startedAt:null,lastUpdatedAt:null,durationMs:0,entries:[]};let e=window.__yuriStreamPerfState;return!Br()||!e?{enabled:!1,startedAt:null,lastUpdatedAt:null,durationMs:0,entries:[]}:{enabled:!0,startedAt:e.startedAt,lastUpdatedAt:e.lastUpdatedAt,durationMs:Math.max(0,Date.now()-e.startedAt),entries:Ur(e.counters)}},Jr=()=>{if(typeof window>`u`)return{enabled:!1,startedAt:null,lastUpdatedAt:null,durationMs:0,entries:[]};let e=window.__yuriVsCodeStreamPerfState;if(!Br()||!e)return{enabled:!1,startedAt:null,lastUpdatedAt:null,durationMs:0,entries:[]};let t=typeof e.startedAt==`number`?e.startedAt:null;return{enabled:!0,startedAt:t,lastUpdatedAt:typeof e.lastUpdatedAt==`number`?e.lastUpdatedAt:null,durationMs:t?Math.max(0,Date.now()-t):0,entries:Ur(e.counters)}},Yr=(e,t=1)=>{Wr(e,t)},Xr=(e,t)=>{Wr(e,t)},Zr=(e,t)=>{if(!Br())return t();let n=Vr();try{return t()}finally{Wr(e,Vr()-n)}},B=null,Qr=0,V=_(),$r=b(`lastDirectory`,{storage:V}),ei=typeof $r==`string`&&$r.length>0,ti=e=>{try{Lr.getState().invalidateDirectory(e)}catch(e){console.warn(`Failed to invalidate file search cache:`,e)}},H=e=>{let t=e.trim();if(!t)return t;let n=t.replace(/\\/g,`/`).replace(/^([a-z]):/,(e,t)=>t.toUpperCase()+`:`);return n.length>1?n.replace(/\/+$/,``):n},ni=(e,t)=>{let n=e.trim();return n.startsWith(`~`)?n===`~`?t||n:(n.startsWith(`~/`)||n.startsWith(`~\\`))&&t?`${t}${n.slice(1)}`:n:n},ri=(e,t)=>H(ni(e,t)),ii=()=>{let e=b(`homeDirectory`,{storage:V});if(typeof e!=`string`||e.trim().length===0)return null;let t=H(e);return t.length>0?t:null},ai=()=>{let e=b(`lastDirectory`,{storage:V});if(typeof e!=`string`||e.trim().length===0)return null;let t=H(e);return t.length>0?t:null},oi=()=>{if(typeof process>`u`)return null;let e={},t=e?.HOME||e?.USERPROFILE||(e?.HOMEDRIVE&&e?.HOMEPATH?`${e.HOMEDRIVE}${e.HOMEPATH}`:void 0);if(typeof t==`string`&&t.trim().length>0){let e=H(t);return e.length>0?e:null}let n=process?.cwd?.();if(typeof n==`string`&&n.trim().length>0){let e=H(n);return e.length>0?e:null}return null},si=()=>{if(typeof window<`u`){if(B)return B;let e=typeof window.__YURI_HOME__==`string`&&window.__YURI_HOME__.length>0?window.__YURI_HOME__:null;if(e&&e.length>0)return B=e,v(`homeDirectory`,e,{storage:V}),e;let t=ii();if(t&&!f())return B=t,t}return oi()||`/`},ci=e=>{if(typeof e!=`string`)return null;let t=e.trim();if(!t)return null;let n=t.replace(/\\/g,`/`);if(n.length>1){let e=n.replace(/\/+$/,``);if(e&&e.length>0)return e===`/`?null:e}return n===`/`||n.length===0?null:n},li=e=>(B=e,typeof window<`u`&&v(`homeDirectory`,e,{storage:V}),z({homeDirectory:e}),e),ui=async()=>{let e=e=>{let t=ci(e);return t?li(t):null};try{let t=e(await y.getFilesystemHome());if(t)return t}catch(e){console.warn(`Failed to obtain filesystem home directory:`,e)}try{let t=e((await y.getSystemInfo())?.homeDirectory);if(t)return t}catch(e){console.warn(`Failed to get home directory from system info:`,e)}try{let t=e(await p());if(t)return t}catch(e){console.warn(`Failed to obtain desktop-integrated home directory:`,e)}let t=si();return e(t)||t},di=(()=>{if(!f())return null;let e=window.__VSCODE_CONFIG__?.workspaceFolder;if(typeof e!=`string`||e.trim().length===0)return null;let t=H(e);return t.length>0?t:null})()||si(),fi=(()=>{let e=ai();return e&&!f()?ri(e,di):di})();fi&&y.setDirectory(fi);var pi=!!(di&&di!==`/`),mi=g()(te((e,t)=>({currentDirectory:fi,directoryHistory:[fi],historyIndex:0,homeDirectory:di,hasPersistedDirectory:ei,isHomeReady:pi,isSwitchingDirectory:!1,setDirectory:(n,r)=>{let i=ri(n,B||t().homeDirectory||b(`homeDirectory`,{storage:V}));Rr(),Oe(t().currentDirectory,i)&&(y.setDirectory(i),ti(),e(e=>{let t=[...e.directoryHistory.slice(0,e.historyIndex+1),i];return v(`lastDirectory`,i,{storage:V}),z({lastDirectory:i}),{currentDirectory:i,directoryHistory:t,historyIndex:t.length-1,hasPersistedDirectory:!0,isHomeReady:!0,isSwitchingDirectory:!1}}))},goBack:()=>{let n=t();if(n.historyIndex>0){let t=n.historyIndex-1,r=n.directoryHistory[t];y.setDirectory(r),ti(),v(`lastDirectory`,r,{storage:V}),z({lastDirectory:r}),e({currentDirectory:r,historyIndex:t,hasPersistedDirectory:!0,isHomeReady:!0,isSwitchingDirectory:!1})}},goForward:()=>{let n=t();if(n.historyIndex<n.directoryHistory.length-1){let t=n.historyIndex+1,r=n.directoryHistory[t];y.setDirectory(r),ti(),v(`lastDirectory`,r,{storage:V}),z({lastDirectory:r}),e({currentDirectory:r,historyIndex:t,hasPersistedDirectory:!0,isHomeReady:!0,isSwitchingDirectory:!1})}},goToParent:()=>{let{currentDirectory:e,setDirectory:n}=t();if(e===(B||t().homeDirectory||si())||e===`/`)return;let r=e.endsWith(`/`)?e.slice(0,-1):e,i=r.lastIndexOf(`/`);n(i===-1?B||si():i===0?`/`:r.substring(0,i))},goHome:async()=>{let e=B||t().homeDirectory||await ui();t().setDirectory(e)},synchronizeHomeDirectory:n=>{let r=t(),i=n;B=i;let a=r.homeDirectory!==i,o=b(`lastDirectory`,{storage:V}),s=typeof o==`string`&&o.length>0,c=!s&&(r.currentDirectory===`/`||r.currentDirectory===r.homeDirectory||!r.currentDirectory);if(!a&&!c){r.isHomeReady||e({isHomeReady:!0});return}let l=typeof i==`string`&&i!==``&&i!==`/`,u=r.currentDirectory?ri(r.currentDirectory,i):r.currentDirectory,d=r.directoryHistory.map(e=>ri(e,i)),f=d.some((e,t)=>e!==r.directoryHistory[t]),p=!!(u&&u!==r.currentDirectory),m={homeDirectory:i,hasPersistedDirectory:s,isHomeReady:l};if(c?(m.currentDirectory=i,m.directoryHistory=[i],m.historyIndex=0,m.isSwitchingDirectory=!1):(p||f)&&(m.currentDirectory=u,m.directoryHistory=d,m.historyIndex=Math.min(r.historyIndex,d.length-1),m.isSwitchingDirectory=!1),e(()=>m),(c||p)&&l){let e=c?i:u;y.setDirectory(e),ti(),v(`lastDirectory`,e,{storage:V}),z({lastDirectory:e})}z({homeDirectory:i})}}),{name:`directory-store`}));typeof window<`u`&&(ui().then(e=>{mi.getState().synchronizeHomeDirectory(e)}),i(e=>{B=null;let t=++Qr;if(c(e)){let e=ii(),t=ai(),n=e||`/`,r=t||n;B=e,mi.setState({currentDirectory:r,directoryHistory:[r],historyIndex:0,homeDirectory:n,hasPersistedDirectory:!!t,isHomeReady:!!(e&&e!==`/`),isSwitchingDirectory:!1}),r&&(y.setDirectory(r),ti())}ui().then(e=>{t===Qr&&mi.getState().synchronizeHomeDirectory(e)})}));var hi=(e,i)=>{let a=t();return a?a.openWebSocket(r(e),i):n(i?new WebSocket(e,i):new WebSocket(e))},U=`/api/git`,gi=1200,_i=5e3,vi=2,yi=5e3,bi=`${U}/worktrees/queue-activation`,xi=`message_queue_activation_pending`,Si=`worktree_lifecycle_busy`,Ci=`worktree_activation_stale`,wi=5e3,Ti=3e4,Ei=[0,500,1e3,2e3,4e3,8e3,14e3],Di=new Map,W=new Map,Oi=new Map,ki=new Map,Ai=new Map,G=new Map,K=new Map,q=new Map,ji=new Map,Mi=new Map,J=new Map,Ni=new Map,Pi=new Set,Fi=0,Ii=[],Li=()=>Fi<vi?(Fi+=1,Promise.resolve()):new Promise(e=>{Ii.push(e)}),Ri=()=>{let e=Ii.shift();if(e){e();return}Fi=Math.max(0,Fi-1)},zi=async e=>{await Li();try{return await e()}finally{Ri()}},Bi=Symbol.for(`yuri.git.discoveryGated`),Vi=e=>(Object.defineProperty(e,Bi,{value:!0,configurable:!0}),e),Hi=e=>typeof e==`function`&&e[Bi]===!0,Y=e=>e.trim(),Ui=``,X=e=>{let t=`${s()}\u0000${o()}`;return t!==Ui&&(Ui=t,Ai.clear(),G.clear(),K.clear(),q.clear(),ji.clear(),Mi.clear(),J.clear(),Ni.clear()),`${t}\u0000${Y(e)}`},Wi=(e,t)=>t===`light`?`${Y(e)}::light`:Y(e),Gi=e=>Oi.get(Y(e))??0,Z=e=>{let t=Y(e);Oi.set(t,Gi(e)+1);for(let e of Array.from(ki.keys()))(e===t||e.startsWith(`${t}::`))&&ki.delete(e);for(let e of Array.from(Di.keys()))(e===t||e.startsWith(`${t}::`))&&Di.delete(e);for(let e of Array.from(W.keys()))(e===t||e.startsWith(`${t}::`))&&W.delete(e)},Ki=e=>Ni.get(X(e))??0,Q=e=>{let t=X(e);t&&(Ni.set(t,Ki(e)+1),Mi.delete(t),J.delete(t))};function $(e,t,n){let r={...n};return t&&(r.directory=t),a().api(e,r)}var qi=(e,t,n)=>{if(!Y(e))return;let r=X(e),i=Date.now()+yi;Ai.set(r,{value:t,expiresAt:i}),typeof n==`string`&&n?q.set(X(e),{value:{root:n},expiresAt:i}):q.delete(X(e))};async function Ji(e){let t=Array.from(new Set(e.map(e=>Y(e)).filter(Boolean))),n=new Map,r=s();if(t.length===0)return n;let i=Date.now(),o=[];for(let e of t){let t=X(e),r=Ai.get(t),a=q.get(t);if(r&&r.expiresAt>i&&(!r.value||a&&a.expiresAt>i)){n.set(e,{isGitRepository:r.value,primaryRoot:a?.value.root??null});continue}o.push(e)}if(o.length===0)return n;let c=e=>{for(let t of e){let e=typeof t.directory==`string`?Y(t.directory):``;if(!e)continue;let i=!!t.isGitRepository,a=typeof t.primaryRoot==`string`&&t.primaryRoot?t.primaryRoot:null;r===s()&&qi(e,i,a),n.set(e,{isGitRepository:i,primaryRoot:a})}},u=async e=>{await Promise.all(e.map(async e=>{try{let t=await Yi(e);if(r!==s())return;let i=t?(await Zi(e)).root:null;r===s()&&qi(e,t,t?i:null),n.set(e,{isGitRepository:t,primaryRoot:t?i:null})}catch{}}))},d=o.map(X),f=[...new Set(d.map(e=>K.get(e)).filter(e=>e!==void 0))];if(f.length>0)return await Promise.allSettled(f),r===s()?Ji(t):n;let p=zi(async()=>{if(r!==s())return;let e=new URLSearchParams;for(let t of o)e.append(`directories`,t);let t=a().api(`${U}/discover`),n=e.toString(),i=n?t.includes(`?`)?`${t}&${n}`:`${t}?${n}`:t,u=await l(i);if(u.status===501||!u.ok)throw Error(`Batch git discover unavailable: ${u.status} ${u.statusText}`);let d=await u.json().catch(()=>null),f=Array.isArray(d)?d:[];if(f.length===0&&o.length>0)throw Error(`Batch git discover returned empty payload`);c(f)});for(let e of d)K.set(e,p);try{await p}catch{}finally{for(let e of d)K.get(e)===p&&K.delete(e)}if(r!==s())return n;let m=o.filter(e=>!n.has(e));return m.length>0&&await u(m),n}async function Yi(e){let t=X(e),n=s(),r=K.get(t);if(r&&await r.catch(()=>void 0),n!==s())throw new DOMException(`Git discovery runtime changed`,`AbortError`);let i=Date.now(),a=Ai.get(t);if(a&&a.expiresAt>i)return a.value;let o=G.get(t);if(o)return o;let c=zi(async()=>{if(n!==s())throw new DOMException(`Git discovery runtime changed`,`AbortError`);let r=await l($(`${U}/check`,e));if(!r.ok)throw Error(`Failed to check git repository: ${r.statusText}`);let i=!!(await r.json()).isGitRepository;return n===s()&&Ai.set(t,{value:i,expiresAt:Date.now()+_i}),i});G.set(t,c);try{return await c}finally{G.get(t)===c&&G.delete(t)}}async function Xi(e,t){let n=t?.mode,r=Wi(e,n),i=Date.now(),a=Di.get(r);if(a&&a.expiresAt>i)return a.value;let s=W.get(r);if(s)return s;let c=(async()=>{let t=Gi(e),i=o(),a=ki.get(r),s=a&&a.transport===i&&a.cacheVersion===t?a:null,c=await l($(`${U}/status`,e,{...n?{mode:n}:{},...s?{since:s.revision}:{}}));if(!c.ok)throw Error(`Failed to get git status: ${c.statusText}`);let u=await c.json(),d;if(`unchanged`in u&&u.unchanged===!0){if(!s||u.revision!==s.revision)throw Error(`Failed to get git status: unexpected unchanged response`);d=s.value}else{let{revision:n,...a}=u;d=a,typeof n==`string`&&Gi(e)===t&&ki.set(r,{revision:n,value:d,transport:i,cacheVersion:t})}return Gi(e)===t&&Di.set(r,{value:d,expiresAt:Date.now()+gi}),d})();W.set(r,c);try{return await c}finally{W.get(r)===c&&W.delete(r)}}async function Zi(e){let t=X(e),n=s(),r=K.get(t);if(r&&await r.catch(()=>void 0),n!==s())throw new DOMException(`Git discovery runtime changed`,`AbortError`);let i=Date.now(),a=q.get(t);if(a&&a.expiresAt>i)return a.value;let o=ji.get(t);if(o)return o;let c=zi(async()=>{if(n!==s())throw new DOMException(`Git discovery runtime changed`,`AbortError`);let r=await l($(`${U}/primary-root`,e));if(!r.ok)throw Error(`Failed to resolve git primary root: ${r.statusText}`);let i=await r.json().catch(()=>({}));if(typeof i.root!=`string`||!i.root.trim())throw Error(`Invalid git primary root response`);let a={root:i.root};return n===s()&&q.set(t,{value:a,expiresAt:Date.now()+yi}),a});ji.set(t,c);try{return await c}finally{ji.get(t)===c&&ji.delete(t)}}async function Qi(e){let t=await l($(`${U}/toplevel`,e));if(!t.ok)throw Error(`Failed to resolve git toplevel: ${t.statusText}`);let n=await t.json().catch(()=>({}));return{root:typeof n.root==`string`&&n.root?n.root:e}}async function $i(e,t){let n=await l($(`${U}/commit-summaries`,e),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({shas:t})});if(!n.ok)throw Error(`Failed to get git commit summaries: ${n.statusText}`);let r=await n.json().catch(()=>({}));return{commits:Array.isArray(r.commits)?r.commits.map(e=>({sha:typeof e.sha==`string`?e.sha:``,short:typeof e.short==`string`?e.short:``,subject:typeof e.subject==`string`?e.subject:``})).filter(e=>e.sha&&e.short):[]}}async function ea(e,t){let{path:n,staged:r,contextLines:i}=t;if(!n)throw Error(`path is required to fetch git diff`);let a=await l($(`${U}/diff`,e,{path:n,staged:r?`true`:void 0,context:i}));if(!a.ok)throw Error(`Failed to get git diff: ${a.statusText}`);return a.json()}async function ta(e,t){let{path:n,staged:r}=t;if(!n)throw Error(`path is required to fetch git file diff`);let i=await l($(`${U}/file-diff`,e,{path:n,staged:r?`true`:void 0}));if(!i.ok)throw Error(`Failed to get git file diff: ${i.statusText}`);return i.json()}async function na(e,t,n){if(!t)throw Error(`path is required to revert git changes`);let r=await l($(`${U}/revert`,e),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:t,scope:n?.scope})});if(!r.ok){let e=await r.json().catch(()=>({error:r.statusText}));throw Error(e.error||`Failed to revert git changes`)}Z(e)}async function ra(e,t){await ia(e,[t])}async function ia(e,t){let n=t.map(e=>e.trim()).filter(Boolean);if(n.length===0)throw Error(`path is required to stage git changes`);let r=await l($(`${U}/stage`,e),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({paths:n})});if(!r.ok){let e=await r.json().catch(()=>({error:r.statusText}));throw Error(e.error||`Failed to stage git changes`)}Z(e)}async function aa(e,t){await oa(e,[t])}async function oa(e,t){let n=t.map(e=>e.trim()).filter(Boolean);if(n.length===0)throw Error(`path is required to unstage git changes`);let r=await l($(`${U}/unstage`,e),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({paths:n})});if(!r.ok){let e=await r.json().catch(()=>({error:r.statusText}));throw Error(e.error||`Failed to unstage git changes`)}Z(e)}async function sa(e,t,n){await ua(e,t,n,`stage`)}async function ca(e,t,n){await ua(e,t,n,`unstage`)}async function la(e,t,n){await ua(e,t,n,`discard`)}async function ua(e,t,n,r){if(!t)throw Error(`path is required to apply a git hunk`);if(typeof n!=`string`||!n.trim())throw Error(`patch is required to apply a git hunk`);let i=await l($(`${U}/apply-hunk`,e),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:t,patch:n,action:r})});if(!i.ok){let e=await i.json().catch(()=>({error:i.statusText}));throw Error(e.error||`Failed to apply git hunk`)}Z(e)}async function da(e){if(!e)return!1;let t=await l($(`${U}/worktree-type`,e));if(!t.ok)throw Error(`Failed to detect worktree type: ${t.statusText}`);return!!(await t.json()).linked}async function fa(e,t){let n=await l($(`${U}/branches`,e),{signal:t?.signal});if(!n.ok)throw Error(`Failed to get branches: ${n.statusText}`);return n.json()}async function pa(e,t){if(!t?.branch)throw Error(`branch is required to delete a branch`);let n=await l($(`${U}/branches`,e),{method:`DELETE`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)});if(!n.ok){let e=await n.json().catch(()=>({error:n.statusText}));throw Error(e.error||`Failed to delete branch`)}return n.json()}async function ma(e,t){if(!t?.branch)throw Error(`branch is required to delete remote branch`);let n=await l($(`${U}/remote-branches`,e),{method:`DELETE`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)});if(!n.ok){let e=await n.json().catch(()=>({error:n.statusText}));throw Error(e.error||`Failed to delete remote branch`)}return n.json()}async function ha(e,t){let n=t?.remote?.trim();if(!n)throw Error(`remote is required to remove a remote`);let r=await l($(`${U}/remotes`,e),{method:`DELETE`,headers:{"Content-Type":`application/json`},body:JSON.stringify({remote:n})});if(!r.ok){let e=await r.json().catch(()=>({error:r.statusText}));throw Error(e.error||`Failed to remove remote`)}return r.json()}async function ga(e,t,n){if(!Array.isArray(t)||t.length===0)throw Error(`No files provided to generate commit message`);let r={files:t};n?.zenModel&&(r.zenModel=n.zenModel),n?.providerId&&(r.providerId=n.providerId),n?.modelId&&(r.modelId=n.modelId);let i=await l($(`${U}/commit-message`,e),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(r)});if(!i.ok){let e=await i.json().catch(()=>({error:i.statusText}));console.error(`[git-generation][browser] http error`,{status:i.status,statusText:i.statusText,error:e});let t=typeof e?.traceId==`string`&&e.traceId?` (traceId: ${e.traceId})`:``;throw Error(`${e.error||`Failed to generate commit message`}${t}`)}let a=await i.json();if(!a?.message||typeof a.message!=`object`)throw Error(`Malformed commit generation response`);return{message:{subject:typeof a.message.subject==`string`&&a.message.subject.trim().length>0?a.message.subject.trim():``,highlights:Array.isArray(a.message.highlights)?a.message.highlights.filter(e=>typeof e==`string`&&e.trim().length>0).map(e=>e.trim()):[]}}}async function _a(e,t){let{base:n,head:r,context:i,zenModel:a,providerId:o,modelId:s}=t;if(!n||!r)throw Error(`base and head are required`);let c={base:n,head:r};i?.trim()&&(c.context=i.trim()),a&&(c.zenModel=a),o&&(c.providerId=o),s&&(c.modelId=s);let u=await l($(`${U}/pr-description`,e),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(c)});if(!u.ok){let e=await u.json().catch(()=>({error:u.statusText}));throw Error(e.error||`Failed to generate PR description`)}let d=await u.json().catch(()=>null),f=typeof d?.title==`string`?d.title:``,p=typeof d?.body==`string`?d.body:``;if(!f&&!p)throw Error(`Malformed PR description response`);return{title:f,body:p}}async function va(e){let t=X(e),n=s(),r=Date.now(),i=Mi.get(t);if(i&&i.expiresAt>r)return i.value;let a=J.get(t);if(a)return a;let o=Ki(e),c=zi(async()=>{let r=await l($(`${U}/worktrees`,e));if(!r.ok){let e=await r.json().catch(()=>({error:r.statusText}));throw Error(e.error||`Failed to list worktrees`)}let i=await r.json();return n===s()&&o===Ki(e)&&Mi.set(t,{value:i,expiresAt:Date.now()+yi}),i});J.set(t,c);try{return await c}finally{J.get(t)===c&&J.delete(t)}}Vi(va);async function ya(e,t){let n=await l($(`${U}/worktrees/validate`,e),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t??{})});if(!n.ok){let e=await n.json().catch(()=>({error:n.statusText}));throw Error(e.error||`Failed to validate worktree`)}return n.json()}async function ba(e){let t=await l($(`${U}/worktrees/bootstrap-status`,e));if(!t.ok){let e=await t.json().catch(()=>({error:t.statusText}));throw Error(e.error||`Failed to get worktree bootstrap status`)}return t.json()}async function xa(e,t){let n=await l($(`${U}/worktrees/preview`,e),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t??{})});if(!n.ok){let e=await n.json().catch(()=>({error:n.statusText}));throw Error(e.error||`Failed to preview worktree`)}return n.json()}var Sa=e=>typeof e==`string`&&e.length>0,Ca=e=>{if(!e||typeof e!=`object`)return null;let t=e;if(!Sa(t.name)||!Sa(t.path))return null;let n={head:typeof t.head==`string`?t.head:``,name:t.name,branch:typeof t.branch==`string`?t.branch:``,path:t.path};return t.directoryCreated===!0&&(n.directoryCreated=!0),t.bootstrapStatus&&typeof t.bootstrapStatus==`object`&&(n.bootstrapStatus=t.bootstrapStatus),n},wa=(e,t,n)=>{if(e!==503||!t||typeof t!=`object`)return null;let r=t;if(r.code!==xi)return null;let i=Ca(r.worktree);if(!i)return null;let a=r.repair;if(!a||typeof a!=`object`)return null;let o=a;if(o.method!==`POST`||o.path!==bi)return null;let s=o.body;if(!s||typeof s!=`object`)return null;let c=s;return c.projectDirectory!==n||c.directory!==i.path?null:i},Ta=(e,t,n,r)=>`${e}\u0000${t}\u0000${n}\u0000${r}`,Ea=e=>new Promise(t=>{setTimeout(t,e)}),Da=async e=>{if(e.status===409){let t=await e.json().catch(()=>null);return t?.code===Si||t?.code===Ci}return e.status===503&&(await e.json().catch(()=>null))?.code===xi},Oa=e=>e===400||e===401||e===403||e===501,ka=(e,t)=>{let n=o(),r=s(),i=Ta(n,r,e,t);if(Pi.has(i))return;Pi.add(i);let a=()=>o()===n&&s()===r;(async()=>{let n=Date.now(),r=0;for(;Date.now()-n<Ti;){if(!a())return;let i=Ei[Math.min(r,Ei.length-1)]??0;if(i>0){let e=Ti-(Date.now()-n);if(e<=0||(await Ea(Math.min(i,e)),!a()))return}let o=new AbortController,s=setTimeout(()=>o.abort(),wi);try{let n=await l($(bi,void 0),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({projectDirectory:e,directory:t}),signal:o.signal});if(n.ok||Oa(n.status))return;if(await Da(n)){r+=1;continue}return}catch{r+=1}finally{clearTimeout(s)}}})().catch(()=>{}).finally(()=>{Pi.delete(i)})};async function Aa(e,t){let n=await l($(`${U}/worktrees`,e),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t??{})}),r=await n.json().catch(()=>null);if(n.ok){let t=Ca(r);if(t)return Q(e),t;if(r&&typeof r==`object`)return Q(e),r;throw Error(`Failed to create worktree`)}let i=wa(n.status,r,e);if(i)return Q(e),ka(e,i.path),i;let a=r&&typeof r==`object`?r:{error:n.statusText};throw Error(a.error||`Failed to create worktree`)}async function ja(e,t){let n=await l($(`${U}/worktrees`,e),{method:`DELETE`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t??{})});if(!n.ok){let e=await n.json().catch(()=>({error:n.statusText}));throw Error(e.error||`Failed to delete worktree`)}let r=await n.json();return Q(e),r}async function Ma(e,t,n={}){let r=await l($(`${U}/commit`,e),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({message:t,addAll:n.addAll??!1,files:n.files,stageFiles:n.stageFiles})});if(!r.ok){let e=await r.json().catch(()=>({error:r.statusText}));throw Error(e.error||`Failed to create commit`)}let i=await r.json();return Z(e),i}async function Na(e,t={}){let n=await l($(`${U}/push`,e),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)});if(!n.ok){let e=await n.json().catch(()=>({error:n.statusText}));throw Error(e.error||`Failed to push`)}let r=await n.json();return Z(e),r}async function Pa(e,t={}){let n=await l($(`${U}/pull`,e),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)});if(!n.ok){let e=await n.json().catch(()=>({error:n.statusText}));throw Error(e.error||`Failed to pull`)}let r=await n.json();return Z(e),r}async function Fa(e,t={}){let n=await l($(`${U}/fetch`,e),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)});if(!n.ok){let e=await n.json().catch(()=>({error:n.statusText}));throw Error(e.error||`Failed to fetch`)}let r=await n.json();return Z(e),r}async function Ia(e){let t=await l($(`${U}/stashes`,e));if(!t.ok){let e=await t.json().catch(()=>({error:t.statusText}));throw Error(e.error||`Failed to list stashes`)}return t.json()}async function La(e,t){let n=await l($(`${U}/stashes/file-counts`,e),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({refs:t})});if(!n.ok){let e=await n.json().catch(()=>({error:n.statusText}));throw Error(e.error||`Failed to count stash files`)}return n.json()}async function Ra(e,t={}){let n=await l($(`${U}/stash`,e),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)});if(!n.ok){let e=await n.json().catch(()=>({error:n.statusText}));throw Error(e.error||`Failed to stash changes`)}return n.json()}var za=async(e,t,n)=>{let r=await l($(`${U}/${t}`,e),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(n)});if(!r.ok){let e=await r.json().catch(()=>({error:r.statusText}));throw Error(e.error||`Failed to ${t}`)}return r.json()},Ba=(e,t)=>za(e,`stash/apply`,t),Va=(e,t)=>za(e,`stash/pop`,t),Ha=(e,t)=>za(e,`stash/drop`,t);async function Ua(e,t){let n=await l($(`${U}/checkout`,e),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({branch:t})});if(!n.ok){let e=await n.json().catch(()=>({error:n.statusText}));throw Error(e.error||`Failed to checkout branch`)}return n.json()}async function Wa(e,t,n){let r=await l($(`${U}/branches`,e),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({name:t,startPoint:n})});if(!r.ok){let e=await r.json().catch(()=>({error:r.statusText}));throw Error(e.error||`Failed to create branch`)}return r.json()}async function Ga(e,t,n){let r=await l($(`${U}/branches/rename`,e),{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({oldName:t,newName:n})});if(!r.ok){let e=await r.json().catch(()=>({error:r.statusText}));throw Error(e.error||`Failed to rename branch`)}return r.json()}async function Ka(e,t={}){let n=await l($(`${U}/log`,e,{maxCount:t.maxCount,from:t.from,to:t.to,file:t.file,all:t.all?`true`:void 0}));if(!n.ok){let e=await n.json().catch(()=>({error:n.statusText}));throw Error(`Failed to get git log: ${e.error||n.statusText}`)}return n.json()}async function qa(e,t){let n=await l($(`${U}/commit-files`,e,{hash:t}));if(!n.ok)throw Error(`Failed to get commit files: ${n.statusText}`);return n.json()}async function Ja(e,t,n,r){let i=await l($(`${U}/commit-file-diff`,e,{hash:t,path:n,binary:r?`true`:void 0}));if(!i.ok)throw Error(`Failed to get commit file diff: ${i.statusText}`);return i.json()}async function Ya(){let e=await l($(`${U}/identities`,void 0));if(!e.ok)throw Error(`Failed to get git identities: ${e.statusText}`);return e.json()}async function Xa(e){let t=await l($(`${U}/identities`,void 0),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok){let e=await t.json().catch(()=>({error:t.statusText}));throw Error(e.error||`Failed to create git identity`)}return t.json()}async function Za(e,t){let n=await l($(`${U}/identities/${e}`,void 0),{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)});if(!n.ok){let e=await n.json().catch(()=>({error:n.statusText}));throw Error(e.error||`Failed to update git identity`)}return n.json()}async function Qa(e){let t=await l($(`${U}/identities/${e}`,void 0),{method:`DELETE`});if(!t.ok){let e=await t.json().catch(()=>({error:t.statusText}));throw Error(e.error||`Failed to delete git identity`)}}async function $a(e){if(!e)return null;let t=await l($(`${U}/current-identity`,e));if(!t.ok)throw Error(`Failed to get current git identity: ${t.statusText}`);let n=await t.json();return n?{userName:n.userName??null,userEmail:n.userEmail??null,sshCommand:n.sshCommand??null}:null}async function eo(e){if(!e)return!1;let t=await l($(`${U}/has-local-identity`,e));if(!t.ok)throw Error(`Failed to check local identity: ${t.statusText}`);return(await t.json().catch(()=>null))?.hasLocalIdentity===!0}async function to(){let e=await l($(`${U}/global-identity`,void 0));if(!e.ok)throw Error(`Failed to get global git identity: ${e.statusText}`);let t=await e.json();return!t||!t.userName&&!t.userEmail?null:{userName:t.userName??null,userEmail:t.userEmail??null,sshCommand:t.sshCommand??null}}async function no(e,t){let n=await l($(`${U}/set-identity`,e),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({profileId:t})});if(!n.ok){let e=await n.json().catch(()=>({error:n.statusText}));throw Error(e.error||`Failed to set git identity`)}return n.json()}async function ro(){let e=await l($(`${U}/discover-credentials`,void 0));if(!e.ok)throw Error(`Failed to discover git credentials: ${e.statusText}`);return e.json()}async function io(e,t){if(!e)return null;let n=await l($(`${U}/remote-url`,e,{remote:t}));return n.ok?(await n.json()).url??null:null}async function ao(e,t){let n=await l($(`${U}/remotes`,e),{signal:t?.signal});if(!n.ok)throw Error(`Failed to get remotes: ${n.statusText}`);return n.json()}async function oo(e,t){let n=await l($(`${U}/rebase`,e),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)});if(!n.ok){let e=await n.json().catch(()=>({error:n.statusText}));throw Error(e.error||`Failed to rebase`)}return n.json()}async function so(e){let t=await l($(`${U}/rebase/abort`,e),{method:`POST`});if(!t.ok){let e=await t.json().catch(()=>({error:t.statusText}));throw Error(e.error||`Failed to abort rebase`)}return t.json()}async function co(e,t){let n=await l($(`${U}/merge`,e),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)});if(!n.ok){let e=await n.json().catch(()=>({error:n.statusText}));throw Error(e.error||`Failed to merge`)}return n.json()}async function lo(e,t){let n=await l($(`${U}/checkout-commit`,e),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({hash:t})});if(!n.ok){let e=await n.json().catch(()=>({error:n.statusText}));throw Error(e.error||`Failed to checkout commit`)}return n.json()}async function uo(e,t){let n=await l($(`${U}/cherry-pick`,e),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({hash:t})});if(!n.ok){let e=await n.json().catch(()=>({error:n.statusText}));throw Error(e.error||`Failed to cherry-pick`)}return n.json()}async function fo(e,t){let n=await l($(`${U}/revert-commit`,e),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({hash:t})});if(!n.ok){let e=await n.json().catch(()=>({error:n.statusText}));throw Error(e.error||`Failed to revert commit`)}return n.json()}async function po(e,t,n,r){let i=await l($(`${U}/reset-to-commit`,e),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({hash:t,mode:n,force:r})});if(!i.ok){let e=await i.json().catch(()=>({error:i.statusText}));throw Error(e.error||`Failed to reset`)}return i.json()}async function mo(e){let t=await l($(`${U}/merge/abort`,e),{method:`POST`});if(!t.ok){let e=await t.json().catch(()=>({error:t.statusText}));throw Error(e.error||`Failed to abort merge`)}return t.json()}async function ho(e){let t=await l($(`${U}/rebase/continue`,e),{method:`POST`});if(!t.ok){let e=await t.json().catch(()=>({error:t.statusText}));throw Error(e.error||`Failed to continue rebase`)}return t.json()}async function go(e){let t=await l($(`${U}/merge/continue`,e),{method:`POST`});if(!t.ok){let e=await t.json().catch(()=>({error:t.statusText}));throw Error(e.error||`Failed to continue merge`)}return t.json()}async function _o(e,t){return await Ra(e,{message:t?.message}),{success:!0}}async function vo(e){return await Va(e,{ref:`stash@{0}`}),{success:!0}}async function yo(e){let t=await l($(`${U}/conflict-details`,e));if(!t.ok)throw Error(`Failed to get conflict details: ${t.statusText}`);return t.json()}async function bo(e,t){let n=await l(`${U}/validate-directory`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({directory:e,worktreeRoot:t})});if(!n.ok)throw Error(`Failed to validate worktree directory: ${n.statusText}`);return n.json()}async function xo(e){let t=await l(`${U}/canonicalize-worktree-state`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({directory:e})});if(!t.ok)throw Error(`Failed to canonicalize worktree state: ${t.statusText}`);return t.json()}export{ha as $,vn as $t,$i as A,nt as An,Xr as At,Fa as B,Zn as Bt,ga as C,mt as Cn,qr as Ct,yo as D,E as Dn,Rr as Dt,qa as E,ht as En,Gr as Et,Xi as F,z as Ft,Hi as G,kn as Gt,Na as H,qn as Ht,ba as I,kr as It,va as J,N as Jt,da as K,An as Kt,to as L,Qn as Lt,ta as M,ke as Mn,jr as Mt,Ya as N,Tr as Nt,$a as O,qe as On,Yr as Ot,Ka as P,Er as Pt,oo as Q,xn as Qt,io as R,er as Rt,Ha as S,xt as Sn,mi as St,Ja as T,pt as Tn,Kr as Tt,eo as U,jn as Ut,Pa as V,Jn as Vt,Q as W,On as Wt,Va as X,bn as Xt,co as Y,gn as Yt,xa as Z,yn as Zt,Qa as _,dt as _n,Za as _t,Yi as a,dn as an,na as at,ro as b,yt as bn,zi as bt,uo as c,At as cn,ra as ct,La as d,Wt as dn,_o as dt,wn as en,Ga as et,Wa as f,Xt as fn,Ra as ft,pa as g,ot as gn,ca as gt,Aa as h,Yt as hn,oa as ht,xo as i,un as in,fo as it,ea as j,Ae as jn,Lr as jt,fa as k,et as kn,Zr as kt,go as l,Ct as ln,ia as lt,Xa as m,Ut as mn,aa as mt,so as n,Tn as nn,Zi as nt,Ua as o,an as on,la as ot,Ma as p,O as pn,vo as pt,Ia as q,M as qt,Ba as r,Sn as rn,Qi as rt,lo as s,zt as sn,no as st,mo as t,Cn as tn,po as tt,ho as u,St as un,sa as ut,ja as v,ct as vn,ya as vt,_a as w,ut as wn,Jr as wt,Ji as x,bt as xn,hi as xt,ma as y,vt as yn,bo as yt,ao as z,$n as zt};
@@ -1 +0,0 @@
1
- import{i as e}from"./runtime-switch-DEPKHgdL.js";import{n as t}from"./runtime-fetch-V-iMWR8t.js";import{t as n}from"./runtimeAPIRegistry-C2VogTny.js";import{n as r}from"./vendor-react-BkccXcWz.js";import{s as i}from"./vendor-tanstack-react-query-DIb_ItL-.js";import{c as a,l as o}from"./yuriEvents-BFrD5fMU.js";var s=r(),c=e=>e??n()?.github,l=(t=e())=>o.github.auth(t),u=async(e,n)=>{if(e)return e.authStatus();let r=await t(`/api/github/auth/status`,{method:`GET`,headers:{Accept:`application/json`},signal:n}),i=await r.json().catch(()=>null);if(!r.ok||!i)throw Error(i?.error||r.statusText||`Failed to load GitHub status`);return i},d=(t,n=e())=>{let r=c(t);return{queryKey:l(n),queryFn:async({signal:e})=>u(r,e),retry:2}},f=e=>!!e&&typeof e==`object`&&`authStatus`in e,p=e=>{let t=(0,s.c)(5),n=f(e)?e:void 0,r=f(e)?void 0:e?.enabled,a;t[0]===n?a=t[1]:(a=d(n),t[0]=n,t[1]=a);let o;return t[2]!==r||t[3]!==a?(o={...a,enabled:r},t[2]=r,t[3]=a,t[4]=o):o=t[4],i(o)},m=(t=a,n=e())=>t.getQueryData(l(n))??null,h=async(t,n,r)=>e()===r?t.fetchQuery({...d(n,r),staleTime:0}):t.getQueryData(l(r))??null,g=(t=a,n,r=e())=>{t.setQueryData(l(r),n)};export{p as a,g as i,m as n,h as r,d as t};
@@ -1 +0,0 @@
1
- import{i as e,n as t}from"./runtime-switch-DEPKHgdL.js";import{n}from"./runtime-fetch-V-iMWR8t.js";import{n as r}from"./vendor-react-BkccXcWz.js";import{s as i}from"./vendor-tanstack-react-query-DIb_ItL-.js";import{c as a}from"./yuriEvents-BFrD5fMU.js";var o=r(),s=[{id:`claude`,name:`Claude Code`},{id:`codex`,name:`Codex`},{id:`cursor`,name:`Cursor`},{id:`dsh`,name:`DeepSeek Harness`},{id:`opencode`,name:`OpenCode`}],c=e=>e.progress??{phase:`importing`,completed:e.completed,total:e.total},l=e=>e?.state===`completed`||e?.state===`partial`,u=async(r,i,a,o)=>{let s=t();if(o!==e())throw Error(`runtime_changed`);let c=await n(`/api/yuri/history-import/${r}`,{...i===void 0?{}:{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(i)},signal:a});if(!c.ok){let e=await c.json().catch(()=>({}));throw Error(c.status===404||c.status===501?`history_import_unsupported`:e.code??`import_failed`)}let l=await c.json();if(o!==e()||s!==t())throw Error(`runtime_changed`);return l},d=(t=e())=>({queryKey:[t,`history-import`,`job`],queryFn:({signal:e})=>u(`job`,void 0,e,t),staleTime:0,retry:1,refetchInterval:e=>e.state.data?.state===`running`&&1e3}),f=e=>{let t=(0,o.c)(3),n=e===void 0||e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=d(),t[0]=r):r=t[0];let a;return t[1]===n?a=t[2]:(a={...r,enabled:n},t[1]=n,t[2]=a),i(a)},p=(t=e())=>({queryKey:[t,`history-import`,`jobs`],queryFn:({signal:e})=>u(`jobs`,void 0,e,t),staleTime:0,retry:!1});function m(e,t){a.setQueryData(d(t).queryKey,e),a.setQueryData(p(t).queryKey,t=>l(e)?t?.filter(t=>t.id!==e.id):t?.some(t=>t.id===e.id)?t.map(t=>t.id===e.id?e:t):[...t??[],e])}var h=(e,t,n)=>u(`scan`,e,t,n),g=(t=e())=>({queryKey:[t,`history-import`,`sources`,`sample`,5,`counts`],queryFn:({signal:e})=>h({sources:s.map(e=>e.id),limitPerSource:5,includeCounts:!0},e,t),staleTime:6e4,gcTime:3e5,retry:!1,refetchOnWindowFocus:!1}),_=e=>{let t=(0,o.c)(3),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=g(),t[0]=n):n=t[0];let r;return t[1]===e?r=t[2]:(r={...n,enabled:e},t[1]=e,t[2]=r),i(r)},v=(t,n,r,i=e())=>({queryKey:[i,`history-import`,`imported`,t,n,r],queryFn:({signal:e})=>u(`imported`,{scanID:t,directory:n},e,i),staleTime:6e4,gcTime:3e5,retry:!1,refetchOnWindowFocus:!1}),y=(e,t,n,r)=>{let a=(0,o.c)(7),s;a[0]!==t||a[1]!==n||a[2]!==e?(s=v(e,t,n),a[0]=t,a[1]=n,a[2]=e,a[3]=s):s=a[3];let c=!!e&&r,l;return a[4]!==s||a[5]!==c?(l={...s,enabled:c},a[4]=s,a[5]=c,a[6]=l):l=a[6],i(l)};async function b(e,n,r,i,a){if(a!==t())throw Error(`runtime_changed`);let o=await u(`start`,{sources:e,directory:n,confirm:!0},r,i);if(a!==t())throw Error(`runtime_changed`);return m(o,i),o}var x=(e,t,n)=>u(`cancel`,{id:e},t,n);async function S(e,n,r){if(r!==t())throw Error(`runtime_changed`);let i=await u(`resume`,{id:e,confirm:!0},new AbortController().signal,n);if(r!==t())throw Error(`runtime_changed`);return m(i,n),i}async function C(e,n,r){if(r!==t())throw Error(`runtime_changed`);let i=await u(`dismiss`,{id:e},new AbortController().signal,n);if(await Promise.all([a.cancelQueries({queryKey:p(n).queryKey,exact:!0}),a.cancelQueries({queryKey:d(n).queryKey,exact:!0})]),r!==t())throw Error(`runtime_changed`);return a.setQueryData(p(n).queryKey,e=>e?.filter(e=>e.id!==i.id)),a.setQueryData(d(n).queryKey,e=>e?.id===i.id?null:e),i}export{b as a,y as c,l as d,S as i,s as l,C as n,f as o,p as r,_ as s,x as t,c as u};
@@ -1 +0,0 @@
1
- import"./rolldown-runtime-hePW80VL.js";import{ot as e,st as t}from"./vendor-base-ui-wXsskyKm.js";import{n}from"./vendor-react-BkccXcWz.js";import{o as r}from"./session-startup-barrier-DT-hIBRf.js";var i=n();t();var a=e();function o(e){let t=(0,i.c)(23),n,o,s,c,l,u;t[0]===e?(n=t[1],o=t[2],s=t[3],c=t[4],l=t[5],u=t[6]):({className:o,type:u,bordered:n,placeholder:c,endAdornment:s,...l}=e,t[0]=e,t[1]=n,t[2]=o,t[3]=s,t[4]=c,t[5]=l,t[6]=u);let d=c||` `,f=n!==void 0&&`border border-transparent ring-0 focus:ring-0 aria-invalid:ring-1 aria-invalid:focus:ring-1`,p=n&&`border-[var(--form-surface-border)]`,m=s&&`pe-11`,h;t[7]!==o||t[8]!==f||t[9]!==p||t[10]!==m?(h=r(`text-foreground file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground bg-[var(--surface-elevated)] appearance-none flex h-9 w-full min-w-0 rounded-lg px-3 py-1 typography-markdown outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:typography-ui-label file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:typography-ui-label`,`ring-1 ring-inset ring-border/60 transition duration-200 ease-out`,`hover:[&:not(:focus)]:bg-[var(--surface-subtle)] hover:[&:not(:focus)]:ring-transparent`,`focus:ring-2 focus:ring-[var(--interactive-focus-ring)] focus-visible:outline-none`,`aria-invalid:ring-[var(--status-error)] aria-invalid:focus:ring-[var(--status-error)]`,f,p,o,m),t[7]=o,t[8]=f,t[9]=p,t[10]=m,t[11]=h):h=t[11];let g;t[12]!==n||t[13]!==l||t[14]!==d||t[15]!==h||t[16]!==u?(g=(0,a.jsx)(`input`,{type:u,"data-slot":`input`,"data-bordered":n,placeholder:d,className:h,spellCheck:!1,autoComplete:`off`,autoCorrect:`off`,autoCapitalize:`off`,...l}),t[12]=n,t[13]=l,t[14]=d,t[15]=h,t[16]=u,t[17]=g):g=t[17];let _=g;if(!s)return _;let v;t[18]===s?v=t[19]:(v=(0,a.jsx)(`div`,{"data-slot":`input-end-adornment`,className:`absolute inset-y-0 end-0 flex items-center`,children:s}),t[18]=s,t[19]=v);let y;return t[20]!==_||t[21]!==v?(y=(0,a.jsxs)(`div`,{"data-slot":`input-wrapper`,className:`relative min-w-0 w-full flex-1`,children:[_,v]}),t[20]=_,t[21]=v,t[22]=y):y=t[22],y}export{o as t};
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{R as t,l as n,u as r}from"./platform-CiUKDeXd.js";import{a as i,i as a,r as o}from"./vendor-zustand-CTekDqaS.js";import{ot as s,st as c}from"./vendor-base-ui-wXsskyKm.js";import{St as l,an as u,jt as d,on as f}from"./gitApiHttp-Dd-FwgCq.js";import{t as p}from"./safeStorage-DTOhKN0V.js";import{i as m,t as h}from"./vendor-pathe-vBmvQE8f.js";import{n as g}from"./vendor-react-BkccXcWz.js";import{s as _,u as v}from"./vendor-tanstack-react-query-DIb_ItL-.js";import{E as y}from"./runtime-file-resource-Bc_ss-sW.js";import{o as b}from"./path-utils-jGozTg9d.js";import{r as x}from"./vendor-reactuses-core-DjKFMfz7.js";import{r as S}from"./useUIStore-C3ewjGgP.js";import{o as C,s as w}from"./spacedFileMention-Ds4GtgiF.js";import{o as T,p as E}from"./session-startup-barrier-DT-hIBRf.js";import{n as D}from"./Icon-DmykXZL1.js";import{Da as O,Hi as k,L as A,Ma as ee,Na as j,Oi as M,_ as N,b as P,f as F,lt as I,ma as te,ra as ne,xi as L,yt as R}from"./ui-ee2iN869.js";import{s as re}from"./remoteProjectQueries-C8382jM8.js";import{t as ie}from"./i18n-DXc6czdR.js";import{t as ae}from"./ScrollableOverlay-stxT7gLf.js";import{t as oe}from"./useDebouncedValue-BHlMPqY8.js";import{t as se}from"./AgentAvatar-CHCjMxCF.js";import{c as ce,d as le,l as ue,n as de,r as fe,t as pe}from"./fileMentionTouchSelection-BQEUty_A.js";import{a as me,o as he,s as ge}from"./fileMentionAutocompleteState-B9411b4o.js";var _e=(e,t)=>{let n=t.trim();if(!n)return[...e].sort((e,t)=>e.isBuiltIn===t.isBuiltIn?e.name.localeCompare(t.name):e.isBuiltIn?-1:1);let r=w([...e],n,e=>[e.name,e.description??``]);return r.sort((e,t)=>e.score===t.score?e.item.isBuiltIn===t.item.isBuiltIn?e.item.name.localeCompare(t.item.name):e.item.isBuiltIn?-1:1:e.score-t.score),r.map(e=>e.item)},ve=(e,t)=>e===t||e.length===t.length&&e.every((e,n)=>{let r=t[n];return r!=null&&e.id===r.id&&e.title===r.title&&(e.subtitle??``)===(r.subtitle??``)&&(e.badge??``)===(r.badge??``)&&e.iconName===r.iconName&&e.agentName===r.agentName}),ye=(e,t)=>e.highlightedIndex===t.highlightedIndex&&ve(e.rows,t.rows),be=(e,t)=>ve(e,t)?e:t.slice(),xe=(e,t,n)=>{e&&(t.current&&ye(t.current,n)||(t.current=n,e(n)))},Se=(e,t)=>{t.current=null,e?.({rows:[],highlightedIndex:0})},z=e(c(),1),B=g(),Ce=e=>e.directories.flatMap(e=>e.sessions),V=(e,t)=>({...re(e,t.location.hostId),select:Ce}),we=async(e,t,n)=>{n.sdk();let r=await e.fetchQuery(V(t,n));return n.sdk(),Ce(r)},H=(e,t,n,r)=>{n.sdk();let i=e.getQueryData(V(t,n).queryKey);for(let e of i?.directories??[]){let t=e.sessions.find(e=>e.id===r);if(t)return t.title||r}return r},U=(e,t,n,r={})=>({queryKey:[...e.queryScope,`composer-files`,t,n,r],staleTime:3e4,gcTime:3e4,queryFn:async({signal:i})=>{let a=await e.sdk().file.find({query:t,location:{directory:e.location.directory},limit:n,type:r.type},{signal:i});if(e.sdk(),i.throwIfAborted(),!Array.isArray(a.data))throw Error(`File search returned no data`);return a.data.map(t=>{let n=m(t.path),r=h(n);return{name:r,path:b(e.location.directory,n),relativePath:n,extension:r.includes(`.`)?r.split(`.`).pop()?.toLowerCase():void 0,isDirectory:t.type===`directory`}})}}),W=e=>{if(!e)return``;let t=e.replace(/\\/g,`/`),n=t.startsWith(`//`),r=t.replace(/\/+/g,`/`);n&&!r.startsWith(`//`)&&(r=`/${r}`);let i=r===`/`,a=/^[A-Za-z]:\/$/.test(r);return!i&&!a&&(r=r.replace(/\/+$/,``)),r},G=e=>/^[A-Za-z]:\//.test(e)?e.toLowerCase():e,K=e=>e.startsWith(`yuri-remote-location:`)?n(e):W(e),q=(e,t)=>{let n=W(r(t,`local`).directory),i=W(e);if(!n||!i)return!1;let a=G(n),o=G(i);return o===a||o.startsWith(a.endsWith(`/`)?a:`${a}/`)},J=e=>{if(!e||typeof e!=`object`)return{};let t=e,n={};for(let[e,r]of Object.entries(t)){let t;try{t=K(e)}catch{continue}if(!t||!r||typeof r!=`object`)continue;let i=r,a=Array.isArray(i.openPaths)?Array.from(new Set(i.openPaths.filter(e=>typeof e==`string`).map(e=>W(e)).filter(e=>q(e,t)))):[],o=Array.isArray(i.expandedPaths)?Array.from(new Set(i.expandedPaths.filter(e=>typeof e==`string`).map(e=>W(e)).filter(e=>q(e,t)))):[],s=typeof i.selectedPath==`string`?W(i.selectedPath):null,c=s&&q(s,t)?s:a[0]??null,l=typeof i.touchedAt==`number`&&Number.isFinite(i.touchedAt)?i.touchedAt:Date.now(),u=n[t];if(u){let e=Array.from(new Set([...u.openPaths,...a])),r=Array.from(new Set([...u.expandedPaths,...o])),i=u.selectedPath??c??e[0]??null;n[t]={openPaths:e,selectedPath:i,expandedPaths:r,touchedAt:Math.max(u.touchedAt,l)};continue}n[t]={openPaths:a,selectedPath:c,expandedPaths:o,touchedAt:l}}return n},Y=(e,t)=>{let n=Object.entries(e);if(n.length<=t)return e;n.sort((e,t)=>(t[1]?.touchedAt??0)-(e[1]?.touchedAt??0));let r={};for(let[e,i]of n.slice(0,t))r[e]=i;return r},X=e=>e?{...e,touchedAt:Date.now()}:{openPaths:[],selectedPath:null,expandedPaths:[],touchedAt:Date.now()},Z=i()(o(a((e,t)=>({byRoot:{},addOpenPath:(t,n,r)=>{let i=K((t||``).trim()),a=W((n||``).trim());!i||!a||!r?.allowOutsideRoot&&!q(a,i)||e(e=>{let t=e.byRoot[i],n=X(t),r=n.openPaths.includes(a),o=r?n.openPaths:[...n.openPaths,a],s=n.selectedPath??a;return t&&r&&t.selectedPath===s?e:{byRoot:Y({...e.byRoot,[i]:{...n,openPaths:o,selectedPath:s}},20)}})},removeOpenPath:(t,n)=>{let r=K((t||``).trim()),i=W((n||``).trim());!r||!i||e(e=>{let t=e.byRoot[r];if(!t)return e;let n=G(i),a=e=>G(e)===n,o=t.selectedPath?a(t.selectedPath):!1;if(!t.openPaths.some(a)&&!o)return e;let s=t.openPaths.filter(e=>!a(e)),c=o?s[0]??null:t.selectedPath;return{byRoot:Y({...e.byRoot,[r]:{...t,openPaths:s,selectedPath:c,touchedAt:Date.now()}},20)}})},removeOpenPathsByPrefix:(t,n)=>{let r=K((t||``).trim()),i=W((n||``).trim());!r||!i||e(e=>{let t=e.byRoot[r];if(!t)return e;let n=G(i),a=n.endsWith(`/`)?n:`${n}/`,o=e=>{let t=G(e);return t===n||t.startsWith(a)},s=t.openPaths.filter(e=>!o(e));if(s.length===t.openPaths.length)return e;let c=t.selectedPath&&o(t.selectedPath)?s[0]??null:t.selectedPath;return{byRoot:Y({...e.byRoot,[r]:{...t,openPaths:s,selectedPath:c,touchedAt:Date.now()}},20)}})},removeExpandedPathsByPrefix:(t,n)=>{let r=K((t||``).trim()),i=W((n||``).trim());!r||!i||e(e=>{let t=e.byRoot[r];if(!t)return e;let n=G(i),a=n.endsWith(`/`)?n:`${n}/`,o=t.expandedPaths.filter(e=>{let t=G(e);return t!==n&&!t.startsWith(a)});return o.length===t.expandedPaths.length?e:{byRoot:Y({...e.byRoot,[r]:{...t,expandedPaths:o,touchedAt:Date.now()}},20)}})},setSelectedPath:(t,n,r)=>{let i=K((t||``).trim()),a=n?W(n.trim()):null;!i||a&&!r?.allowOutsideRoot&&!q(a,i)||e(e=>{let t=e.byRoot[i],n=X(t),r=a&&!n.openPaths.includes(a)?[...n.openPaths,a]:n.openPaths;return t&&t.selectedPath===a&&r===t.openPaths?e:{byRoot:Y({...e.byRoot,[i]:{...n,openPaths:r,selectedPath:a}},20)}})},ensureSelectedPath:e=>{let n=K((e||``).trim());if(!n)return;let r=t().byRoot[n];if(!r||r.selectedPath)return;let i=r.openPaths[0]??null;i&&t().setSelectedPath(n,i)},toggleExpandedPath:(t,n)=>{let r=K((t||``).trim()),i=W((n||``).trim());!r||!i||!q(i,r)||e(e=>{let t=e.byRoot[r],n=X(t),a=n.expandedPaths.includes(i)?n.expandedPaths.filter(e=>e!==i):[...n.expandedPaths,i];return t&&t.expandedPaths===a&&t.selectedPath===n.selectedPath&&t.openPaths===n.openPaths?e:{byRoot:Y({...e.byRoot,[r]:{...n,expandedPaths:a}},20)}})},expandPath:(t,n)=>{let r=K((t||``).trim()),i=W((n||``).trim());!r||!i||!q(i,r)||e(e=>{let t=e.byRoot[r],n=X(t);return n.expandedPaths.includes(i)&&t?e:{byRoot:Y({...e.byRoot,[r]:{...n,expandedPaths:[...n.expandedPaths,i]}},20)}})},expandPaths:(t,n)=>{let r=K((t||``).trim());if(!r||!n||n.length===0)return;let i=n.map(e=>W((e||``).trim())).filter(e=>e&&q(e,r));i.length!==0&&e(e=>{let t=e.byRoot[r],n=X(t),a=new Set(n.expandedPaths),o=i.filter(e=>!a.has(e));return o.length===0?e:{byRoot:Y({...e.byRoot,[r]:{...n,expandedPaths:[...n.expandedPaths,...o]}},20)}})}}),{name:`files-view-tabs-store`,version:2,storage:p(),migrate:e=>{if(!e||typeof e!=`object`)return{byRoot:{}};let t=e.byRoot;return{byRoot:J(t)}},merge:(e,t)=>({...t,byRoot:J(e&&typeof e==`object`?e.byRoot:void 0)}),partialize:e=>({byRoot:J(e.byRoot)})}),{name:`files-view-tabs-store`})),Q=()=>{let e=(0,B.c)(17),t=F(Te),n=R(),r;e[0]===t?r=e[1]:(r=e=>t?e.getAttachment(t):void 0,e[0]=t,e[1]=r);let i=P(r),a=F(Ee),o=F(De),s=j(Oe),c=j(ke),u=l(Ae);if(t){let r;e[2]===i?r=e[3]:(r=N(i),e[2]=i,e[3]=r);let o=r;if(o)return o;let s;e[4]!==t||e[5]!==a?(s=a.get(t),e[4]=t,e[5]=a,e[6]=s):s=e[6];let c=s;if(c?.path)return c.path;let l;if(e[7]!==t||e[8]!==n){let r;e[10]===t?r=e[11]:(r=e=>e.id===t,e[10]=t,e[11]=r),l=n.find(r),e[7]=t,e[8]=n,e[9]=l}else l=e[9];let u=l;if(u?.directory)return u.directory}if(o?.open&&(o.bootstrapPendingDirectory||o.directoryOverride))return(o.bootstrapPendingDirectory||o.directoryOverride)??void 0;if(s){let t;if(e[12]!==s||e[13]!==c){let n;e[15]===s?n=e[16]:(n=e=>e.id===s,e[15]=s,e[16]=n),t=c.find(n),e[12]=s,e[13]=c,e[14]=t}else t=e[14];let n=t;if(n?.path)return n.path}return u??void 0};function Te(e){return e.currentSessionId}function Ee(e){return e.worktreeMetadata}function De(e){return e.newSessionDraft}function Oe(e){return e.activeProjectId}function ke(e){return e.projects}function Ae(e){return e.currentDirectory}var $=s(),je=`bg-transparent font-[inherit] text-[var(--primary-base)]`,Me=(e,t)=>{let n=t.trim().toLowerCase();if(!n)return e;let r=e.toLowerCase();if(!r.includes(n))return e;let i=[],a=0,o=r.indexOf(n);for(;o!==-1;)o>a&&i.push(e.slice(a,o)),i.push((0,$.jsx)(`mark`,{className:je,children:e.slice(o,o+n.length)},`${o}-${n}`)),a=o+n.length,o=r.indexOf(n,a);return a<e.length&&i.push(e.slice(a)),i},Ne=z.forwardRef((e,t)=>{let n=(0,B.c)(4),r=y(),i;return n[0]!==r||n[1]!==e||n[2]!==t?(i=r?.entry.location.hostId?(0,$.jsx)(Le,{...e,ref:t,entry:r.entry,registry:r.registry},JSON.stringify(r.entry.queryScope)):(0,$.jsx)(Pe,{...e,ref:t}),n[0]=r,n[1]=e,n[2]=t,n[3]=i):i=n[3],i}),Pe=z.forwardRef((e,t)=>{let n=(0,B.c)(22),r=Q()??``,i=F(ze),a=M(Be),o=!!e.onSessionSelect,s;n[0]===o?s=n[1]:(s={enabled:o},n[0]=o,n[1]=s);let c=A(s),l=j(Ve),u=j(He),f;if(n[2]!==l||n[3]!==r||n[4]!==u){let e=u.find(e=>e.id===l)?.path||r;f=e?e.replace(/\\/g,`/`).replace(/\/+$/,``):null,n[2]=l,n[3]=r,n[4]=u,n[5]=f}else f=n[5];let p=f,m;n[6]===p?m=n[7]:(m=e=>p?e.byRoot[p]:void 0,n[6]=p,n[7]=m);let h=Z(m),g=k(Ue),_=d(We),v;n[8]!==a||n[9]!==c||n[10]!==e.onSessionSelect?(v=e.onSessionSelect?L(a,c):[],n[8]=a,n[9]=c,n[10]=e.onSessionSelect,n[11]=v):v=n[11];let y=v,b=e.currentSessionId??i,x;return n[12]!==g||n[13]!==r||n[14]!==p||n[15]!==h||n[16]!==e||n[17]!==t||n[18]!==_||n[19]!==y||n[20]!==b?(x=(0,$.jsx)(Re,{...e,ref:t,currentDirectory:r,currentSessionId:b,projectRoot:p,projectTabs:h,agentCatalog:g,sessions:y,searchFiles:_}),n[12]=g,n[13]=r,n[14]=p,n[15]=h,n[16]=e,n[17]=t,n[18]=_,n[19]=y,n[20]=b,n[21]=x):x=n[21],x}),Fe=[],Ie=[],Le=z.forwardRef((e,t)=>{let n=(0,B.c)(32),{entry:r,registry:i}=e,a=v(),o;n[0]===r?o=n[1]:(o=O(r.location.directory,void 0,r),n[0]=r,n[1]=o);let s=!!e.onAgentSelect,c;n[2]!==o||n[3]!==s?(c={...o,enabled:s},n[2]=o,n[3]=s,n[4]=c):c=n[4];let l=_(c),u;n[5]!==r||n[6]!==i?(u=V(i,r),n[5]=r,n[6]=i,n[7]=u):u=n[7];let d=!!e.onSessionSelect,f;n[8]!==u||n[9]!==d?(f={...u,enabled:d},n[8]=u,n[9]=d,n[10]=f):f=n[10];let p=_(f),m;n[11]===r.key?m=n[12]:(m=e=>e.byRoot[r.key],n[11]=r.key,n[12]=m);let h=Z(m),g;n[13]!==a||n[14]!==r?(g=(e,t,n,i)=>{let o=n===void 0?60:n;return a.fetchQuery(U(r,t,o,i))},n[13]=a,n[14]=r,n[15]=g):g=n[15];let y=x(g),b=r.location.directory,S;if(n[16]!==r.location.directory){let e;n[18]===Symbol.for(`react.memo_cache_sentinel`)?(e=/\/+$/,n[18]=e):e=n[18],S=r.location.directory.replace(/\\/g,`/`).replace(e,``),n[16]=r.location.directory,n[17]=S}else S=n[17];let C=l.data??Ie,w=p.data??Fe,T=l.error??p.error,E;n[19]===r?E=n[20]:(E=()=>{r.sdk()},n[19]=r,n[20]=E);let D;return n[21]!==r.location.directory||n[22]!==h||n[23]!==e||n[24]!==t||n[25]!==y||n[26]!==C||n[27]!==w||n[28]!==T||n[29]!==E||n[30]!==S?(D=(0,$.jsx)(Re,{...e,ref:t,currentDirectory:b,projectRoot:S,projectTabs:h,agentCatalog:C,sessions:w,searchFiles:y,catalogError:T,assertCurrent:E}),n[21]=r.location.directory,n[22]=h,n[23]=e,n[24]=t,n[25]=y,n[26]=C,n[27]=w,n[28]=T,n[29]=E,n[30]=S,n[31]=D):D=n[31],D}),Re=z.forwardRef(({searchQuery:e,onFileSelect:t,onAgentSelect:n,onSkillSelect:r,onSessionSelect:i,onClose:a,style:o,onRowsChange:s,currentDirectory:c,currentSessionId:l,projectRoot:d,projectTabs:p,agentCatalog:m,sessions:h,searchFiles:g,catalogError:_,assertCurrent:v},y)=>{let{t:b}=ie(),w=oe(e,180),O=f(),k=u(),[A,ee]=z.useState([]),[j,M]=z.useState(!1),[N,P]=z.useState(null),[F,I]=z.useState(0),L=z.useRef(0),R=z.useRef({query:e,directory:c,ids:[]}),[re,le]=z.useState(360),[ue,_e]=z.useState({}),[ve,ye]=z.useState({}),be=z.useRef([]),B=z.useRef([]),Ce=z.useRef([]),V=z.useRef(null),we=z.useRef(null),H=z.useRef(null);H.current||=pe();let U=S(e=>e.isMobile),W=(e??``).trim(),G=te({directory:c||null}),K=z.useMemo(()=>r?G.data??[]:[],[r,G.data]),q=z.useMemo(()=>{if(!d||!p)return[];let e=[p.selectedPath,...p.openPaths.slice().reverse()].filter(e=>typeof e==`string`&&e.length>0),t=new Set,n=[];for(let r of e){if(t.has(r))continue;t.add(r);let e=r.replace(/\\/g,`/`),i=e.split(`/`).filter(Boolean).pop()||e,a=e.startsWith(`${d}/`)?e.slice(d.length+1):e;n.push({name:i,path:e,relativePath:a,extension:i.includes(`.`)?i.split(`.`).pop()?.toLowerCase():void 0})}return ge(n,W,{limit:6})},[W,d,p]),J=z.useMemo(()=>n?ne(m).filter(e=>e.mode!==`primary`):[],[m,n]),Y=z.useMemo(()=>i?me({sessions:h,currentSessionId:l??null,searchQuery:W}):[],[h,l,W,i]),X=q,Z=A,Q=z.useMemo(()=>ce({skills:K,agents:J,sessions:Y,recentFiles:X,pathHits:Z,searchQuery:W,untitledSession:b(`chat.fileMentionAutocomplete.untitledSession`),sessionBadge:b(`chat.fileMentionAutocomplete.sessionType`),skillBadge:b(`chat.commandAutocomplete.badge.skill`)}),[K,J,Y,X,Z,W,b]);z.useEffect(()=>{let e=e=>{let t=e.target;!t||!V.current||V.current.contains(t)||a()};return document.addEventListener(`pointerdown`,e,!0),()=>{document.removeEventListener(`pointerdown`,e,!0)}},[a]),z.useEffect(()=>{if(!c){ee([]),M(!1),P(null);return}let e=(w??``).trim(),t=C(e);if(!t){ee([]),M(!1),P(null);return}let n=!1;M(!0),P(null);let r={includeHidden:O,respectGitignore:!k};return Promise.all([g(c,t,80,{...r,type:`file`}),g(c,t,40,{...r,type:`directory`})]).then(([t,r])=>{if(n)return;let i=new Set(q.map(e=>e.path));ee(he({files:t,directories:r,query:e,excludePaths:i,limit:20}))}).catch(e=>{n||P(e instanceof Error?e:Error(String(e)))}).finally(()=>{n||M(!1)}),()=>{n=!0}},[c,w,q,g,O,k]),z.useLayoutEffect(()=>{let t=R.current,n=t.ids[L.current],r=t.query===e&&t.directory===c?Math.max(0,Q.findIndex(e=>e.id===n)):0;R.current={query:e,directory:c,ids:Q.map(e=>e.id)},L.current=r,I(r)},[Q,e,c]),z.useEffect(()=>{_e({}),ye({})},[Q]),z.useEffect(()=>{be.current[F]?.scrollIntoView({block:`nearest`})},[F]),z.useEffect(()=>{let e=null,t=()=>{e!==null&&cancelAnimationFrame(e),e=requestAnimationFrame(()=>{let e={},t={};B.current.forEach((n,r)=>{if(!n)return;let i=Ce.current[r]?.offsetWidth??n.scrollWidth,a=Math.max(0,i-n.clientWidth),o=a>8;if(e[r]=o,o){let e=Math.max(.6,a/110);t[r]=e}}),_e(e),ye(t)})};return t(),window.addEventListener(`resize`,t),()=>{e!==null&&cancelAnimationFrame(e),window.removeEventListener(`resize`,t)}},[Q]),z.useEffect(()=>{let e=B.current[F];if(!e)return;let t=()=>{let t=e.clientWidth;t>0&&le(t)};if(t(),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(t);return n.observe(e),()=>{n.disconnect()}},[F]);let Te=x(e=>{t(e)}),Ee=x(e=>{n?.(e)}),De=x(e=>{i?.(e)}),Oe=x(e=>{r?.(e)}),ke=(e,t)=>({onMouseDown:e=>e.preventDefault(),onPointerDown:e=>{e.pointerType===`touch`&&H.current?.pointerDown(e.clientX,e.clientY)},onPointerMove:e=>{e.pointerType===`touch`&&H.current?.pointerMove(e.clientX,e.clientY)},onPointerUp:e=>{e.pointerType===`touch`&&(H.current?.pointerUp(t)??!1)&&(e.preventDefault(),e.stopPropagation())},onPointerCancel:()=>H.current?.pointerCancel(),onClick:()=>{H.current?.click(t)},onMouseMove:()=>{L.current=e,I(e)}}),Ae=e=>{try{v?.()}catch(e){P(e instanceof Error?e:Error(String(e)));return}let t=Q.length;if(t===0)return;let n=(e%t+t)%t,r=Q[n];if(r.agentName!==void 0){Ee(r.agentName);return}if(r.id.startsWith(`skill:`)){let e=K.find(e=>r.id===`skill:${e.name}-${e.scope}`);e&&Oe(e);return}if(r.id.startsWith(`session:`)){let e=Y.find(e=>r.id===`session:${e.id}`);e&&De(e);return}let i=r.id.startsWith(`recent:`)?X.find(e=>r.id===`recent:${e.path}`):Z.find(e=>r.id===`file:${e.path}`);i&&Te(i)};z.useEffect(()=>{xe(s,we,{rows:Q,highlightedIndex:F})},[s,F,Q]);let je=z.useRef(s);return je.current=s,z.useEffect(()=>()=>{Se(je.current,we)},[]),z.useImperativeHandle(y,()=>({acceptIndex:e=>{Ae(e)},handleKeyDown:e=>{if(e===`Escape`){a();return}let t=Q.length;if(t!==0){if(e===`ArrowDown`){L.current=(L.current+1)%t,I(L.current);return}if(e===`ArrowUp`){L.current=(L.current-1+t)%t,I(L.current);return}(e===`Enter`||e===`Tab`)&&Ae(L.current)}}})),(0,$.jsxs)(de,{ref:V,isMobile:U,className:`max-w-[640px] max-h-64`,style:o,children:[(0,$.jsx)(ae,{preventOverscroll:!0,outerClassName:`flex-1 min-h-0`,className:`px-0`,children:(0,$.jsxs)(`div`,{className:`py-1`,children:[_||G.error||N?(0,$.jsx)(`div`,{role:`alert`,className:`px-3 py-2 typography-ui-label text-muted-foreground`,children:(_??G.error??N)?.message}):null,Q.map((e,t)=>{let n=e.id.startsWith(`file:`)||e.id.startsWith(`recent:`),r=n?E(e.title,{maxLength:60}):e.title,i=F===t,a=ue[t]??!1,o=ve[t]??2.6;return(0,$.jsxs)(`div`,{"data-mention-id":e.id,ref:e=>{be.current[t]=e},className:T(`flex items-center gap-2 px-3 py-1.5 cursor-pointer typography-ui-label rounded-lg`,U&&`min-h-11`,fe(U,i),!U&&i&&`text-interactive-selection-foreground`),...ke(t,()=>Ae(t)),children:[(0,$.jsx)(`span`,{className:`flex size-5 shrink-0 items-center justify-center`,children:e.agentName===void 0?(0,$.jsx)(D,{name:e.iconName,className:`size-3.5 text-current`}):(0,$.jsx)(se,{name:e.agentName,size:20})}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-baseline gap-2`,children:[(0,$.jsxs)(`span`,{ref:e=>{B.current[t]=e},className:T(`relative block min-w-0 overflow-hidden`,n&&a&&i&&`file-mention-marquee-container`),style:i?{"--file-mention-marquee-width":`${re}px`,"--file-mention-marquee-duration":`${o}s`}:void 0,title:e.title,children:[(0,$.jsx)(`span`,{ref:e=>{Ce.current[t]=e},className:`absolute invisible whitespace-nowrap pointer-events-none`,"aria-hidden":!0,children:e.title}),n&&a&&i?(0,$.jsx)(`span`,{className:`inline-block whitespace-nowrap file-mention-marquee`,children:Me(e.title,W)}):(0,$.jsx)(`span`,{className:`block truncate`,children:Me(r,W)})]}),e.trailingLabel?(0,$.jsx)(`span`,{className:T(`max-w-[40%] shrink-0 truncate text-muted-foreground`,U?`typography-micro`:`typography-meta`),children:e.trailingLabel}):null]}),e.subtitle?(0,$.jsx)(`div`,{className:T(`truncate text-muted-foreground`,U?`typography-micro`:`typography-meta`),children:Me(e.subtitle,W)}):null]})]},e.id)}),j&&Z.length===0?(0,$.jsx)(`div`,{className:`flex items-center justify-center py-3`,children:(0,$.jsx)(D,{name:`refresh`,className:`h-4 w-4 animate-spin text-muted-foreground`})}):null,!j&&Q.length===0&&(0,$.jsx)(`div`,{className:`px-3 py-2 typography-ui-label text-muted-foreground`,children:b(`chat.fileMentionAutocomplete.empty`)})]})}),!U&&(0,$.jsx)(`div`,{className:`px-3 pt-1 pb-1.5 border-t typography-meta text-muted-foreground`,children:b(`chat.autocomplete.keyboardHint`)})]})});function ze(e){return e.currentSessionId}function Be(e){return e.activeSessions}function Ve(e){return e.activeProjectId}function He(e){return e.projects}function Ue(e){return e.agents}function We(e){return e.searchFiles}var Ge=new Set([`new`,`fork`,`compact`,`reload`,`undo`,`redo`,`model`,`btw`]),Ke=(e,t)=>{if(!t||e.isSkill)return!1;let n=e.name?.trim().toLowerCase();return!!(n&&Ge.has(n))},qe=(e,t)=>!e||t({name:e}),Je=` `,Ye=(e,t)=>{let n=Math.max(0,Math.min(t,e.length)),r=n;for(;r>0&&!/\s/.test(e[r-1]);)--r;return r>=2&&e[r-1]===Je&&e[r-2]===`/`&&(r-=2),e[r]===`/`?{start:r,end:n}:null},Xe=`text-[10px] leading-none uppercase font-bold tracking-tight px-1.5 py-1 rounded border flex-shrink-0`,Ze=T(Xe,`bg-[color-mix(in_srgb,var(--primary-base)_12%,transparent)] text-[color-mix(in_srgb,var(--primary-base)_70%,transparent)] border-[color-mix(in_srgb,var(--primary-base)_24%,transparent)]`),Qe=T(Xe,`bg-[color-mix(in_srgb,var(--status-success)_12%,transparent)] text-[color-mix(in_srgb,var(--status-success)_70%,transparent)] border-[color-mix(in_srgb,var(--status-success)_24%,transparent)]`),$e=T(Xe,`bg-[color-mix(in_srgb,var(--status-info)_12%,transparent)] text-[color-mix(in_srgb,var(--status-info)_70%,transparent)] border-[color-mix(in_srgb,var(--status-info)_24%,transparent)]`),et=T(Xe,`bg-[var(--surface-muted)] text-muted-foreground border-[var(--interactive-border)]/60`),tt=(e,t)=>e.length===t.length&&e.every((e,n)=>e.id===t[n]?.id&&e.description===t[n]?.description),nt=e=>{let t=!!e.sessionID;return{hasSession:t,canStartSessionCommand:t||e.hasNewDraft}},rt=z.forwardRef(({searchQuery:e,onCommandSelect:n,onClose:r,directory:i,style:a,commandPolicy:o,commandContext:s,onRowsChange:c},l)=>{let{t:u}=ie(),d=S(e=>e.isMobile),f=F(e=>e.currentSessionId),p=F(e=>!!e.newSessionDraft?.open),m=F(z.useCallback(e=>f?e.getDirectoryForSession(f):void 0,[f])),h=I(f??``,m??void 0),g=z.useMemo(()=>s??{sessionID:f??null,hasMessages:h.length>0,hasNewDraft:p},[s,f,h.length,p]),{hasSession:_,canStartSessionCommand:v}=z.useMemo(()=>nt(g),[g]),y=g.hasMessages,[b,x]=z.useState([]),[C,w]=z.useState(!1),E=ee({directory:i}),O=z.useMemo(()=>E.data??[],[E.data]),k=E.isFetching,[A,j]=z.useState(0),M=z.useRef(0),N=z.useRef(!1),P=z.useRef([]),te=z.useRef(null),ne=z.useRef(!1),L=z.useRef(null),R=z.useRef(!1),re=z.useRef(null);z.useEffect(()=>{let e=e=>{let t=e.target;!t||!te.current||te.current.contains(t)||r()};return document.addEventListener(`pointerdown`,e,!0),()=>{document.removeEventListener(`pointerdown`,e,!0)}},[r]),z.useEffect(()=>{(async()=>{w(k);try{let n=O.flatMap((e,t)=>e.source===`skill`?[]:[{id:`opencode:${e.scope??`global`}:${e.name}:${e.agent??``}:${e.model??``}:${t}`,name:e.name,source:`opencode`,description:e.description,agent:e.agent??void 0,model:e.model??void 0,isBuiltIn:e.isBuiltIn,scope:e.scope,reference:e.reference}]),r=[{id:`yuri:new`,name:`new`,source:`yuri`,description:u(`chat.commandAutocomplete.command.newDescription`),isBuiltIn:!0},..._&&!y?[{id:`yuri:init`,name:`init`,source:`yuri`,description:u(`chat.commandAutocomplete.command.initDescription`),isBuiltIn:!0}]:[],..._?[{id:`yuri:btw`,name:`btw`,source:`yuri`,description:u(`chat.btw.description`),isBuiltIn:!0},{id:`yuri:undo`,name:`undo`,source:`yuri`,description:u(`chat.commandAutocomplete.command.undoDescription`),isBuiltIn:!0},{id:`yuri:redo`,name:`redo`,source:`yuri`,description:u(`chat.commandAutocomplete.command.redoDescription`),isBuiltIn:!0},{id:`yuri:fork`,name:`fork`,source:`yuri`,description:u(`chat.commandAutocomplete.command.forkDescription`),isBuiltIn:!0},{id:`yuri:timeline`,name:`timeline`,source:`yuri`,description:u(`chat.commandAutocomplete.command.timelineDescription`),isBuiltIn:!0}]:[],{id:`yuri:model`,name:`model`,source:`yuri`,description:u(`chat.commandAutocomplete.command.modelDescription`),isBuiltIn:!0},{id:`yuri:compact`,name:`compact`,source:`yuri`,description:u(`chat.commandAutocomplete.command.compactDescription`),isBuiltIn:!0},...t()?[{id:`yuri:reload`,name:`reload`,source:`yuri`,description:u(`chat.commandAutocomplete.command.reloadDescription`),isBuiltIn:!0}]:[],..._?[{id:`yuri:summary`,name:`summary`,source:`yuri`,description:u(`chat.commandAutocomplete.command.summaryDescription`),isYuri:!0}]:[],...v?[{id:`yuri:workspace-review`,name:`workspace-review`,source:`yuri`,description:u(`chat.commandAutocomplete.command.workspaceReviewDescription`),isYuri:!0}]:[],...v?[{id:`yuri:craft-goal`,name:`craft-goal`,source:`yuri`,description:u(`chat.commandAutocomplete.command.craftGoalDescription`),isYuri:!0}]:[],...v?[{id:`yuri:catch-up`,name:`catch-up`,source:`yuri`,description:u(`chat.commandAutocomplete.command.catchUpDescription`),isYuri:!0}]:[],...v?[{id:`yuri:debug`,name:`debug`,source:`yuri`,description:u(`chat.commandAutocomplete.command.debugDescription`),isYuri:!0}]:[],...v?[{id:`yuri:weigh`,name:`weigh`,source:`yuri`,description:u(`chat.commandAutocomplete.command.weighDescription`),isYuri:!0}]:[],...v?[{id:`yuri:explore`,name:`explore`,source:`yuri`,description:u(`chat.commandAutocomplete.command.exploreDescription`),isYuri:!0}]:[],...n],i=!y,a=_e(r.filter(e=>(i||e.name!==`init`)&&(o?.(e)??!0)),e);x(e=>tt(e,a)?e:a)}catch{let n=!y,r=_e([{id:`yuri:new`,name:`new`,source:`yuri`,description:u(`chat.commandAutocomplete.command.newDescription`),isBuiltIn:!0},..._&&!y?[{id:`yuri:init`,name:`init`,source:`yuri`,description:u(`chat.commandAutocomplete.command.initDescription`),isBuiltIn:!0}]:[],..._?[{id:`yuri:btw`,name:`btw`,source:`yuri`,description:u(`chat.btw.description`),isBuiltIn:!0},{id:`yuri:undo`,name:`undo`,source:`yuri`,description:u(`chat.commandAutocomplete.command.undoDescription`),isBuiltIn:!0},{id:`yuri:redo`,name:`redo`,source:`yuri`,description:u(`chat.commandAutocomplete.command.redoDescription`),isBuiltIn:!0},{id:`yuri:fork`,name:`fork`,source:`yuri`,description:u(`chat.commandAutocomplete.command.forkDescription`),isBuiltIn:!0},{id:`yuri:timeline`,name:`timeline`,source:`yuri`,description:u(`chat.commandAutocomplete.command.timelineDescription`),isBuiltIn:!0}]:[],{id:`yuri:model`,name:`model`,source:`yuri`,description:u(`chat.commandAutocomplete.command.modelDescription`),isBuiltIn:!0},{id:`yuri:compact`,name:`compact`,source:`yuri`,description:u(`chat.commandAutocomplete.command.compactDescription`),isBuiltIn:!0},...t()?[{id:`yuri:reload`,name:`reload`,source:`yuri`,description:u(`chat.commandAutocomplete.command.reloadDescription`),isBuiltIn:!0}]:[],..._?[{id:`yuri:summary`,name:`summary`,source:`yuri`,description:u(`chat.commandAutocomplete.command.summaryDescription`),isYuri:!0}]:[],...v?[{id:`yuri:workspace-review`,name:`workspace-review`,source:`yuri`,description:u(`chat.commandAutocomplete.command.workspaceReviewDescription`),isYuri:!0}]:[],...v?[{id:`yuri:craft-goal`,name:`craft-goal`,source:`yuri`,description:u(`chat.commandAutocomplete.command.craftGoalDescription`),isYuri:!0}]:[],...v?[{id:`yuri:catch-up`,name:`catch-up`,source:`yuri`,description:u(`chat.commandAutocomplete.command.catchUpDescription`),isYuri:!0}]:[],...v?[{id:`yuri:debug`,name:`debug`,source:`yuri`,description:u(`chat.commandAutocomplete.command.debugDescription`),isYuri:!0}]:[],...v?[{id:`yuri:weigh`,name:`weigh`,source:`yuri`,description:u(`chat.commandAutocomplete.command.weighDescription`),isYuri:!0}]:[],...v?[{id:`yuri:explore`,name:`explore`,source:`yuri`,description:u(`chat.commandAutocomplete.command.exploreDescription`),isYuri:!0}]:[]].filter(e=>(n||e.name!==`init`)&&(o?.(e)??!0)),e);x(e=>tt(e,r)?e:r)}finally{w(!1)}})()},[e,y,_,v,O,k,u,o]),z.useEffect(()=>{j(0)},[b]),z.useEffect(()=>{M.current=A},[A]),z.useEffect(()=>{P.current[A]?.scrollIntoView({block:`nearest`})},[A]),z.useEffect(()=>{xe(c,re,{rows:ue(b,{skill:u(`chat.commandAutocomplete.badge.skill`),command:u(`chat.commandAutocomplete.badge.command`),system:u(`chat.commandAutocomplete.badge.system`)}),highlightedIndex:A})},[b,c,A,u]);let oe=z.useRef(c);oe.current=c,z.useEffect(()=>()=>{Se(oe.current,re)},[]),z.useImperativeHandle(l,()=>({acceptIndex:(e,t=!0)=>{let r=b[e];r&&n(r,Ke(r,t))},handleKeyDown:e=>{let t=b.length;if(e===`Escape`){r();return}if(t!==0){if(e===`ArrowDown`){N.current=!0,j(e=>(e+1)%t);return}if(e===`ArrowUp`){N.current=!0,j(e=>(e-1+t)%t);return}if(e===`Enter`||e===`Tab`){let r=(M.current%t+t)%t,i=b[r];i&&n(i,Ke(i,e===`Enter`))}}}}),[b,r,n]);let se=e=>{let t=le(e);switch(e.name){case`new`:return(0,$.jsx)(D,{name:t,className:`h-3.5 w-3.5`});case`init`:return(0,$.jsx)(D,{name:t,className:`h-3.5 w-3.5 text-green-500`});case`undo`:return(0,$.jsx)(D,{name:t,className:`h-3.5 w-3.5 text-orange-500`});case`redo`:return(0,$.jsx)(D,{name:t,className:`h-3.5 w-3.5 text-orange-500`});case`timeline`:case`reload`:return(0,$.jsx)(D,{name:t,className:`h-3.5 w-3.5`});case`compact`:return(0,$.jsx)(D,{name:t,className:`h-3.5 w-3.5 text-purple-500`});case`goal`:return(0,$.jsx)(D,{name:t,className:`h-3.5 w-3.5`});case`review`:return(0,$.jsx)(D,{name:t,className:`h-3.5 w-3.5 text-blue-500`});case`test`:case`build`:case`run`:return(0,$.jsx)(D,{name:t,className:`h-3.5 w-3.5 text-cyan-500`});default:return e.isBuiltIn?(0,$.jsx)(D,{name:t,className:`h-3.5 w-3.5 text-yellow-500`}):(0,$.jsx)(D,{name:t,className:`h-3.5 w-3.5 text-muted-foreground`})}};return(0,$.jsxs)(de,{ref:te,isMobile:d,className:`max-w-[450px] max-h-64`,style:a,children:[(0,$.jsx)(ae,{preventOverscroll:!0,outerClassName:`flex-1 min-h-0`,className:`px-0 py-1.5`,children:C?(0,$.jsx)(`div`,{className:`flex items-center justify-center py-4`,children:(0,$.jsx)(D,{name:`refresh`,className:`h-4 w-4 animate-spin text-muted-foreground`})}):(0,$.jsxs)(`div`,{children:[b.map((t,r)=>{let i=t.isBuiltIn,a=t.isYuri;return(0,$.jsxs)(`div`,{ref:e=>{P.current[r]=e},className:T(`flex gap-2 px-2 py-2 cursor-pointer rounded-lg`,d?`items-center`:`items-start`,fe(d,r===A),!d&&r===A&&`bg-interactive-selection/35`),onMouseDown:e=>e.preventDefault(),onPointerDown:e=>{e.pointerType===`touch`&&(L.current={x:e.clientX,y:e.clientY},R.current=!1)},onPointerMove:e=>{if(e.pointerType!==`touch`||!L.current)return;let t=e.clientX-L.current.x,n=e.clientY-L.current.y;Math.hypot(t,n)>6&&(R.current=!0)},onPointerUp:e=>{if(e.pointerType!==`touch`)return;let r=R.current;L.current=null,R.current=!1,!r&&(e.preventDefault(),e.stopPropagation(),ne.current=!0,n(t,Ke(t,d)))},onPointerCancel:()=>{L.current=null,R.current=!1},onClick:()=>{if(ne.current){ne.current=!1;return}n(t,Ke(t,d))},onMouseMove:()=>{N.current=!1,j(r)},children:[(0,$.jsx)(`div`,{className:T(!d&&`mt-0.5`),children:se(t)}),(0,$.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsxs)(`span`,{className:`typography-ui-label font-medium`,children:[`/`,Me(t.name,e)]}),t.isSkill?(0,$.jsx)(`span`,{className:Ze,children:u(`chat.commandAutocomplete.badge.skill`)}):(0,$.jsx)(`span`,{className:Ze,children:u(`chat.commandAutocomplete.badge.command`)}),a?(0,$.jsx)(`span`,{className:et,children:`Yuri`}):i?(0,$.jsx)(`span`,{className:et,children:u(`chat.commandAutocomplete.badge.system`)}):t.scope?(0,$.jsx)(`span`,{className:t.scope===`project`?$e:Qe,children:t.scope}):null,t.agent&&(0,$.jsx)(`span`,{className:et,children:t.agent})]}),t.description&&!d&&(0,$.jsx)(`div`,{className:`typography-meta text-muted-foreground mt-0.5 truncate`,children:Me(t.description,e)})]})]},t.id)}),b.length===0&&(0,$.jsx)(`div`,{className:`px-3 py-2 typography-ui-label text-muted-foreground`,children:u(`chat.commandAutocomplete.empty`)})]})}),!d&&(0,$.jsx)(`div`,{className:`px-3 pt-1 pb-1.5 border-t typography-meta text-muted-foreground`,children:u(`chat.autocomplete.keyboardHint`)})]})});rt.displayName=`CommandAutocomplete`;var it=(e,t,n)=>{if(!e)return e;let r=t.length>0&&!/\s$/.test(t)&&!/^\s/.test(e)&&!/[([{]$/.test(t),i=n.length>0&&!/\s$/.test(e)&&!/^\s/.test(n)&&!/^[\])}.,;:!?]/.test(n);return`${r?` `:``}${e}${i?` `:``}`},at=(e,t,n)=>{let r=it(e,t,n);return`${t.length===0&&!/^\s/.test(r)?` `:``}${r}${n.length===0&&!/\s$/.test(r)?` `:``}`},ot=(e,t,n,r)=>{let i=e.slice(0,t),a=e.slice(n),o=at(r,i,a),s=Math.max(0,o.indexOf(r)),c=i.length+s;return{text:`${i}${o}${a}`,caret:i.length+o.length,start:c,end:c+r.length}},st=(e,t)=>{let n=e=>`${e.kind}:${e.value}:${e.range.start}:${e.range.end}`;return new Set(e.map(n)).has(n(t))||e.some(e=>e.range.start<t.range.end&&t.range.start<e.range.end)?[...e]:[...e,t]},ct=(e,t)=>t<e.length&&e[t]===` `?t+1:t;export{rt as a,Ne as c,we as d,H as f,at as i,Q as l,st as n,Ye as o,be as p,ot as r,qe as s,ct as t,Z as u};
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{ot as t,st as n}from"./vendor-base-ui-wXsskyKm.js";import{n as r}from"./vendor-react-BkccXcWz.js";import{o as i}from"./session-startup-barrier-DT-hIBRf.js";import{n as a}from"./Icon-DmykXZL1.js";var o=r(),s=e(n(),1),c=t();function l(e){let t=(0,o.c)(11),n,r,a;t[0]===e?(n=t[1],r=t[2],a=t[3]):({className:n,variant:a,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=a);let s=a===void 0?`default`:a,l=s===`hint`&&`h-3.5 min-w-0 shrink-0 rounded-full border-0 bg-[color-mix(in_srgb,var(--surface-foreground)_6%,transparent)] px-1.5 font-sans text-[10px] font-medium tracking-tight text-muted-foreground/65 shadow-none dark:shadow-none`,u;t[4]!==n||t[5]!==l?(u=i(`pointer-events-none inline-flex h-5 min-w-5 shrink-0 select-none items-center justify-center`,`rounded-md border border-[var(--interactive-border)] bg-[var(--surface-muted)]`,`px-1.5 font-mono typography-micro font-medium leading-none normal-case`,`text-[var(--surface-muted-foreground)] whitespace-nowrap`,`shadow-[inset_0_-1px_0_0_rgba(0,0,0,0.12)]`,`dark:shadow-[inset_0_-1px_0_0_rgba(255,255,255,0.08)]`,l,n),t[4]=n,t[5]=l,t[6]=u):u=t[6];let d;return t[7]!==r||t[8]!==u||t[9]!==s?(d=(0,c.jsx)(`kbd`,{"data-slot":`kbd`,"data-variant":s,className:u,...r}),t[7]=r,t[8]=u,t[9]=s,t[10]=d):d=t[10],d}var u={"⌘":`command`,cmd:`command`,command:`command`,meta:`command`,"↵":`corner-down-left`,enter:`corner-down-left`,return:`corner-down-left`,"↑":`arrow-up`,arrowup:`arrow-up`,"↓":`arrow-down`,arrowdown:`arrow-down`,"←":`arrow-left`,arrowleft:`arrow-left`,"→":`arrow-right`,arrowright:`arrow-right`,"⇧":`arrow-up`,shift:`arrow-up`};function d(e){let t=(0,o.c)(17),{shortcut:n,className:r,tone:d,variant:p}=e,m=d===void 0?`default`:d,h=p===void 0?`default`:p,g,_,v,y;if(t[0]!==r||t[1]!==n||t[2]!==m||t[3]!==h){y=Symbol.for(`react.early_return_sentinel`);bb0:{let e=n.split(`+`).map(f).filter(Boolean);if(e.length===0){y=null;break bb0}g=`shortcut-kbd`,t[8]===r?_=t[9]:(_=i(`inline-flex items-center gap-1 whitespace-nowrap normal-case`,r),t[8]=r,t[9]=_);let o;t[10]!==m||t[11]!==h?(o=(e,t)=>(0,c.jsxs)(s.Fragment,{children:[t>0?(0,c.jsx)(`span`,{className:h===`hint`?`text-[10px] font-normal text-muted-foreground/65`:`typography-micro font-semibold text-[var(--surface-muted-foreground)]`,children:`+`}):null,(0,c.jsx)(l,{variant:h,"aria-label":e,className:i(m===`selection`&&`border-[var(--interactive-selection)] bg-[var(--interactive-selection)] text-[var(--interactive-selection-foreground)]`),children:h===`hint`&&u[e.toLowerCase()]?(0,c.jsx)(a,{name:u[e.toLowerCase()],className:`size-2.5`}):/^[a-z]$/i.test(e)?e.toUpperCase():e})]},`${e}-${t}`),t[10]=m,t[11]=h,t[12]=o):o=t[12],v=e.map(o)}t[0]=r,t[1]=n,t[2]=m,t[3]=h,t[4]=g,t[5]=_,t[6]=v,t[7]=y}else g=t[4],_=t[5],v=t[6],y=t[7];if(y!==Symbol.for(`react.early_return_sentinel`))return y;let b;return t[13]!==g||t[14]!==_||t[15]!==v?(b=(0,c.jsx)(`span`,{"data-slot":g,className:_,children:v}),t[13]=g,t[14]=_,t[15]=v,t[16]=b):b=t[16],b}function f(e){return e.trim()}export{d as n,l as t};