@yuriai/web 0.3.4 → 0.3.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 (276) hide show
  1. package/dist/assets/AgentAvatar-CNOu_vy0.js +1 -0
  2. package/dist/assets/AgentSelector-K5JSbXv3.js +1 -0
  3. package/dist/assets/ArchivedSessionsDialog-CU9RXl8K.js +1 -0
  4. package/dist/assets/AssistantConversationSurface-u3ndSmZP.js +3 -0
  5. package/dist/assets/AssistantSessionCard-MYBAni6A.js +2 -0
  6. package/dist/assets/AssistantUnreadBadge-opyLZlZd.js +1 -0
  7. package/dist/assets/AssistantView-CDPTtrUZ.js +1 -0
  8. package/dist/assets/AssistantWorkingAvatar-Vghb8xlt.js +1 -0
  9. package/dist/assets/AssistantsSettingsPage-Dt4OP3J-.js +1 -0
  10. package/dist/assets/BinaryFileFallback-CJqnlBzh.js +1 -0
  11. package/dist/assets/BtwPanel-DnMW6R43.js +6 -0
  12. package/dist/assets/BusyDots-FXSlMe2F.js +4 -0
  13. package/dist/assets/ChatContainer-Dg9uDBjk.js +65 -0
  14. package/dist/assets/ChatView-AFUNEBdD.js +3 -0
  15. package/dist/assets/{DiagramView-DGnmjS2b.js → DiagramView-j7aFp44v.js} +1 -1
  16. package/dist/assets/{DiffView-Bbit6OZ8.js → DiffView-DZ_gKyTO.js} +2 -2
  17. package/dist/assets/DiffViewToggle-DkxhEUhV.js +1 -0
  18. package/dist/assets/ErrorBoundary-CCH4LiRY.js +1 -0
  19. package/dist/assets/FadeInOnReveal-DO9PZrJL.js +1 -0
  20. package/dist/assets/{GuiPluginMount-TC5FELtQ.js → GuiPluginMount-BCqt2pmM.js} +1 -1
  21. package/dist/assets/GuiPluginPage-BSjWEmIu.js +1 -0
  22. package/dist/assets/GuiPluginSurface-B8QjacMd.js +1 -0
  23. package/dist/assets/GuiPluginTitlebarItems-DfHugxsx.js +1 -0
  24. package/dist/assets/{GuiPluginWindow-BkAFJyFd.js → GuiPluginWindow-CDycMqzT.js} +1 -1
  25. package/dist/assets/Icon-B-w2YKpn.js +1 -0
  26. package/dist/assets/ImageLoadingPlaceholder-DsgRtfYG.js +1 -0
  27. package/dist/assets/{LoadingImage-Df22Rkor.js → LoadingImage-B3IL7hnv.js} +1 -1
  28. package/dist/assets/MarkdownRenderer-CsEylQVj.js +2 -0
  29. package/dist/assets/{MarkdownRendererImpl-D8q0FMnr.js → MarkdownRendererImpl-CPgpkd9b.js} +1 -1
  30. package/dist/assets/MarkstreamRendererImpl-BzK1BO80.js +3 -0
  31. package/dist/assets/{MobileAssistantSettingsPage-Dgq5FMho.js → MobileAssistantSettingsPage-DVpE3b24.js} +1 -1
  32. package/dist/assets/MobileAssistantTab-BbccE67x.js +1 -0
  33. package/dist/assets/{MobileBtwPage-DQUkSO6N.js → MobileBtwPage-BRN1gAmR.js} +1 -1
  34. package/dist/assets/{MobileChangesSurface-DsYNmAuM.js → MobileChangesSurface-BwmSTxeh.js} +2 -2
  35. package/dist/assets/MobileChatScreen-Bf42GrQ8.js +1 -0
  36. package/dist/assets/MobileDetailNavigation-DKWnQoSh.js +1 -0
  37. package/dist/assets/MobileFilesSurface-qkfC06Oh.js +2 -0
  38. package/dist/assets/MobileHtmlNetworkBoundary-BKSYPR9N.js +2 -0
  39. package/dist/assets/MobileOverlayPanel-DcRWQlmf.js +1 -0
  40. package/dist/assets/MobileResizableSheet-CF3Pbot4.js +1 -0
  41. package/dist/assets/{MobileSettingsTab-DaTtRHo1.js → MobileSettingsTab-of6zpTsr.js} +1 -1
  42. package/dist/assets/{MobileShareBridge-CZpFYmiy.js → MobileShareBridge-CRq9F1rn.js} +1 -1
  43. package/dist/assets/MobileSurface-DGNomvlu.js +1 -0
  44. package/dist/assets/MobileTabPageHeader-0aJFe3_x.js +1 -0
  45. package/dist/assets/ModelLogo-D27dq-si.js +1 -0
  46. package/dist/assets/ModelSelector-Dg__8QLh.js +1 -0
  47. package/dist/assets/MultiRunWindow-COqSg1Nk.js +1 -0
  48. package/dist/assets/OnboardingScreen-DUNyDwc6.js +1 -0
  49. package/dist/assets/OverlayScrollbar-DS6XJ1HA.js +1 -0
  50. package/dist/assets/{PierreDiffViewer-DVKsdwJR.js → PierreDiffViewer-BHwj_6j8.js} +3 -3
  51. package/dist/assets/ProviderLogo-Cm9RNV_U.js +1 -0
  52. package/dist/assets/{RemoteAssistantSessionCard-DAoFvZht.js → RemoteAssistantSessionCard-DAjHRUrC.js} +1 -1
  53. package/dist/assets/RemoteDesktopPanel-Bays6pHh.js +1 -0
  54. package/dist/assets/ScheduledTasksDialog-DnwBC7cj.js +3 -0
  55. package/dist/assets/ScrollableOverlay-CkX-buJm.js +1 -0
  56. package/dist/assets/SettingsGroup-kZ_faXwL.js +1 -0
  57. package/dist/assets/{SettingsView-DEU94-h1.js → SettingsView-C62JngPE.js} +13 -13
  58. package/dist/assets/SettingsWindow-Cm8apHAR.js +1 -0
  59. package/dist/assets/SetupTourDialog-W_UeWH-i.js +1 -0
  60. package/dist/assets/{SyncActions-CrOoREWF.js → SyncActions-Blnq08ks.js} +1 -1
  61. package/dist/assets/TerminalView-CMugifkh.js +8 -0
  62. package/dist/assets/TextSelectionMenu-B2fIBlD3.js +11 -0
  63. package/dist/assets/{ToolOutputDialog-DpaaQ1uZ.js → ToolOutputDialog-DdSUE2kP.js} +1 -1
  64. package/dist/assets/{YuriLogo-Cp6vWDWp.js → YuriLogo-Ceon25sC.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-C7YAFen1.js +1 -0
  68. package/dist/assets/assistantQueries-DxvTFlpL.js +1 -0
  69. package/dist/assets/{auto-read-context-ClBUErN2.js → auto-read-context-Ce0o43YI.js} +1 -1
  70. package/dist/assets/{capgoAdapter-pfQJmvW2.js → capgoAdapter-DQwUA-Nt.js} +1 -1
  71. package/dist/assets/card-D44sTpdY.js +1 -0
  72. package/dist/assets/chatUpwardIntent-CnS7WWRL.js +1 -0
  73. package/dist/assets/checkbox-DaKe0Tlq.js +1 -0
  74. package/dist/assets/{client-B_907PBv.js → client-ITylDDCS.js} +1 -1
  75. package/dist/assets/collapsible-CL3SPnOf.js +1 -0
  76. package/dist/assets/{connection-hint-B-kOWome.js → connection-hint-SMNZFDAe.js} +1 -1
  77. package/dist/assets/context-menu-DZunhC8o.js +1 -0
  78. package/dist/assets/diagram-DFXqN638.js +1 -0
  79. package/dist/assets/dialog-CmjXOKMz.js +1 -0
  80. package/dist/assets/dropdown-menu-BT_66BFT.js +1 -0
  81. package/dist/assets/{fileMentionTouchSelection-BQEUty_A.js → fileMentionTouchSelection-B_62hIQI.js} +1 -1
  82. package/dist/assets/{gitApi-CoVwjIDy.js → gitApi-CBfYFgtd.js} +1 -1
  83. package/dist/assets/{gitApiHttp-Dd-FwgCq.js → gitApiHttp-Bswf6gnl.js} +1 -1
  84. package/dist/assets/githubAuthQueries-C5RxUNL2.js +1 -0
  85. package/dist/assets/historyImportQueries-CZsECryv.js +1 -0
  86. package/dist/assets/{host-ChBHl_Vl.js → host-C7jHgymK.js} +1 -1
  87. package/dist/assets/{i18n-DXc6czdR.js → i18n-Dojvs57M.js} +1 -1
  88. package/dist/assets/{icons-Bd-INsoy.js → icons-D_vRtitD.js} +1 -1
  89. package/dist/assets/{imageSource-BR4C9TuS.js → imageSource-Cq_p4gAe.js} +1 -1
  90. package/dist/assets/input-BllFKOjo.js +1 -0
  91. package/dist/assets/{input-store-BSJBQTMi.js → input-store-dLjM4aiu.js} +1 -1
  92. package/dist/assets/insertionBoundaries-Br0Bdl9R.js +1 -0
  93. package/dist/assets/kbd-CwkasrzN.js +1 -0
  94. package/dist/assets/main-B7wAfq9F.js +2 -0
  95. package/dist/assets/main-DVmi0I-y.js +169 -0
  96. package/dist/assets/{markdownHeightCache-CHGGNhWI.js → markdownHeightCache-RX04MAqu.js} +1 -1
  97. package/dist/assets/mcpQueries-qRW-HQMx.js +1 -0
  98. package/dist/assets/miniChat-D7-JQ1hw.js +2 -0
  99. package/dist/assets/mobile-BFQBDlo9.js +2 -0
  100. package/dist/assets/{mobileBackNavigation-C94n2eLT.js → mobileBackNavigation-DsDUTnFY.js} +1 -1
  101. package/dist/assets/mobileConnections-PVy2SsQ_.js +2 -0
  102. package/dist/assets/multirun-C2RRF2Q3.js +3 -0
  103. package/dist/assets/{native-config-DVg8_Zx1.js → native-config-Czc142JT.js} +1 -1
  104. package/dist/assets/{nativeComposerCover-Bhv1EKPT.js → nativeComposerCover-DzEGSyOO.js} +1 -1
  105. package/dist/assets/{navigation-D1klsD7k.js → navigation-C1v9hIAT.js} +2 -2
  106. package/dist/assets/openRemoteProjectSession-C5z2Juv7.js +1 -0
  107. package/dist/assets/pluginPresentation-p_0sXPMT.js +2 -0
  108. package/dist/assets/{project-preview-BCtFY4Rg.js → project-preview-BcLPKzwg.js} +1 -1
  109. package/dist/assets/{prompt-attachment-upload-B5DHrw6U.js → prompt-attachment-upload-BGppTOgV.js} +1 -1
  110. package/dist/assets/pwa-Br2HZksc.js +2 -0
  111. package/dist/assets/queue-abort-optimistic-DciJN9X1.js +1 -0
  112. package/dist/assets/{quota-CqWNkFzw.js → quota-2PwXAoIg.js} +1 -1
  113. package/dist/assets/{reference-history-IEuzG8KC.js → reference-history-BwtzPAmA.js} +1 -1
  114. package/dist/assets/{remote-input-store-C6UIEZxp.js → remote-input-store-DdjKfpxS.js} +1 -1
  115. package/dist/assets/remoteProjectQueries-BXrXdLjN.js +1 -0
  116. package/dist/assets/{remoteSessionReference-ex07CtrZ.js → remoteSessionReference-XfJOxItc.js} +1 -1
  117. package/dist/assets/renderElectronMiniChatApp-BekZAu-s.js +2 -0
  118. package/dist/assets/renderMobileApp-C5U2cyeq.js +17 -0
  119. package/dist/assets/{runtime-file-download-BWeoSXRb.js → runtime-file-download-1s2Al1t3.js} +1 -1
  120. package/dist/assets/runtime-file-resource-C5kmYlLv.js +6 -0
  121. package/dist/assets/{runtimeConfig-CyvlrO58.js → runtimeConfig-DzYIc49M.js} +1 -1
  122. package/dist/assets/runtimeEndpointReset-BKLVdNhJ.js +4 -0
  123. package/dist/assets/select-BOtGs1FV.js +1 -0
  124. package/dist/assets/{sessionLookup-DQOiycHr.js → sessionLookup-BTQ_AtWh.js} +1 -1
  125. package/dist/assets/sessionOwnership-BPfk1qCS.js +2 -0
  126. package/dist/assets/shortcuts-Cu4ioDvH.js +1 -0
  127. package/dist/assets/sortable-tabs-strip-DACGW9sB.js +1 -0
  128. package/dist/assets/speechSettingsQueries-BU-4Axb5.js +1 -0
  129. package/dist/assets/{src-QTj33Z0x.css → src-Dj147H4m.css} +1 -1
  130. package/dist/assets/{store-C1ifDY0C.js → store-DRUKTpV5.js} +1 -1
  131. package/dist/assets/switch-DaUn0G3u.js +1 -0
  132. package/dist/assets/{terminalApi-DXvEquBF.js → terminalApi-ClNhXBA8.js} +1 -1
  133. package/dist/assets/textarea-IhQHekYx.js +1 -0
  134. package/dist/assets/{timeFormat-dCsf2MQv.js → timeFormat-BsuUDWLs.js} +1 -1
  135. package/dist/assets/tooltip-Dw3DApa-.js +1 -0
  136. package/dist/assets/truncated-path-KHrfQ66P.js +1 -0
  137. package/dist/assets/{types-DpcA-uDW.js → types-BBBwzIOU.js} +1 -1
  138. package/dist/assets/ui-CHdferA1.js +13 -0
  139. package/dist/assets/{useAppFontEffects-rbTKcF0f.js → useAppFontEffects-Dw6o6XbA.js} +4 -4
  140. package/dist/assets/useDesktopWindowControlsLayout-DAkTdcAP.js +1 -0
  141. package/dist/assets/{useDictation-CZzAlsW0.js → useDictation-sdgDfATy.js} +1 -1
  142. package/dist/assets/{useEffectiveDirectory-DiJBIfai.js → useEffectiveDirectory-DZqC-2HE.js} +1 -1
  143. package/dist/assets/{useFontPreferences-BiRBKhti.js → useFontPreferences-Bb-bxdL8.js} +1 -1
  144. package/dist/assets/{useGitStore-Bv8xmXDa.js → useGitStore-Bbmai549.js} +1 -1
  145. package/dist/assets/{useInlineCommentDraftStore-B2mkmAZd.js → useInlineCommentDraftStore-DrC99u6A.js} +1 -1
  146. package/dist/assets/useMcpConfigStore-ZsZxSrCt.js +1 -0
  147. package/dist/assets/useMobileSwipeActions-fUp7Bkbn.js +1 -0
  148. package/dist/assets/useMobileTranscriptSyncHint-B4izCfqe.js +10 -0
  149. package/dist/assets/useModelLists-B0qSYDby.js +1 -0
  150. package/dist/assets/useOpenCodeReadiness-B9d-wLZB.js +1 -0
  151. package/dist/assets/usePluginsStore-BLncdNj-.js +1 -0
  152. package/dist/assets/useProjectGitActions-CHMe1ku4.js +1 -0
  153. package/dist/assets/{useProjectGitStore-DzU2pvrH.js → useProjectGitStore-Lz9AV32V.js} +1 -1
  154. package/dist/assets/{useProjectRuntimeAPIs-tjGuODhu.js → useProjectRuntimeAPIs-D51dVo-V.js} +1 -1
  155. package/dist/assets/useQuotaStore-mZs9LTwx.js +1 -0
  156. package/dist/assets/{useSessionBtwStore-CwvlMabN.js → useSessionBtwStore-CYaTDkvT.js} +1 -1
  157. package/dist/assets/{useStreamingTextThrottle-C9SaKeil.js → useStreamingTextThrottle-ul6e3dUd.js} +1 -1
  158. package/dist/assets/worktreeManager-V6hoSVxH.js +1 -0
  159. package/dist/assets/{worktreeSourceBranchPreference-CuLKwxkx.js → worktreeSourceBranchPreference-MQFPkOZy.js} +1 -1
  160. package/dist/index.html +12 -13
  161. package/dist/mini-chat.html +12 -13
  162. package/dist/mobile.html +2 -2
  163. package/package.json +1 -1
  164. package/server/index.js +1 -0
  165. package/server/lib/gui-customization/DOCUMENTATION.md +22 -1
  166. package/server/lib/gui-customization/projects-client.mjs +14 -3
  167. package/server/lib/gui-customization/projects-lifecycle.js +89 -0
  168. package/server/lib/gui-customization/projects-lifecycle.test.js +199 -0
  169. package/server/lib/gui-customization/projects.js +19 -3
  170. package/server/lib/gui-customization/projects.test.js +6 -0
  171. package/server/lib/gui-customization/session-skill.js +2 -2
  172. package/server/lib/gui-customization/session-skill.test.js +6 -0
  173. package/server/lib/gui-customization/skill/SKILL.md +3 -1
  174. package/server/lib/gui-customization/skill/references/projects.md +30 -0
  175. package/server/lib/opencode/feature-routes-runtime.js +5 -0
  176. package/server/lib/opencode/feature-routes-runtime.test.js +6 -0
  177. package/dist/assets/AgentAvatar-CHCjMxCF.js +0 -1
  178. package/dist/assets/AgentSelector-uBoLtut8.js +0 -1
  179. package/dist/assets/ArchivedSessionsDialog-DZcicxVO.js +0 -1
  180. package/dist/assets/AssistantConversationSurface-36aP0hRf.js +0 -3
  181. package/dist/assets/AssistantSessionCard-CZ-1oJiE.js +0 -2
  182. package/dist/assets/AssistantUnreadBadge-p9mkpbMC.js +0 -1
  183. package/dist/assets/AssistantView-8fyAae7J.js +0 -1
  184. package/dist/assets/AssistantWorkingAvatar-CoxhuMvM.js +0 -1
  185. package/dist/assets/AssistantsSettingsPage-DD6spbXz.js +0 -1
  186. package/dist/assets/BinaryFileFallback-DgYaMG9f.js +0 -1
  187. package/dist/assets/BtwPanel-BkobGcf3.js +0 -6
  188. package/dist/assets/BusyDots-COTTwItx.js +0 -4
  189. package/dist/assets/ChatContainer-BfQ7RXwY.js +0 -65
  190. package/dist/assets/ChatView-ByMRjY1h.js +0 -3
  191. package/dist/assets/DiffViewToggle-BwJ6MYB7.js +0 -1
  192. package/dist/assets/ErrorBoundary-D7QcwhmL.js +0 -1
  193. package/dist/assets/FadeInOnReveal-B3uT04YJ.js +0 -1
  194. package/dist/assets/GuiPluginPage-BPjU8N49.js +0 -1
  195. package/dist/assets/GuiPluginSurface-CYPH6XzX.js +0 -1
  196. package/dist/assets/GuiPluginTitlebarItems-DxFINwbr.js +0 -1
  197. package/dist/assets/Icon-DmykXZL1.js +0 -1
  198. package/dist/assets/ImageLoadingPlaceholder-DgM_EFHn.js +0 -1
  199. package/dist/assets/MarkdownRenderer-VvziwyJB.js +0 -2
  200. package/dist/assets/MarkstreamRendererImpl-U_m_ZKG7.js +0 -3
  201. package/dist/assets/MobileAssistantTab-CMIQansR.js +0 -1
  202. package/dist/assets/MobileChatScreen-p356_BCN.js +0 -1
  203. package/dist/assets/MobileDetailNavigation-ldTzGo19.js +0 -1
  204. package/dist/assets/MobileFilesSurface-CF3EW_SK.js +0 -2
  205. package/dist/assets/MobileHtmlNetworkBoundary-DlPF4iPS.js +0 -2
  206. package/dist/assets/MobileOverlayPanel-C36VWWmN.js +0 -1
  207. package/dist/assets/MobileResizableSheet-CqphcaKq.js +0 -1
  208. package/dist/assets/MobileSurface-cmaGf3hZ.js +0 -1
  209. package/dist/assets/MobileTabPageHeader-D6P4K98S.js +0 -1
  210. package/dist/assets/ModelLogo-BkbD514M.js +0 -1
  211. package/dist/assets/ModelSelector-EmtltPnd.js +0 -1
  212. package/dist/assets/MultiRunWindow-CeSxAB8w.js +0 -1
  213. package/dist/assets/OnboardingScreen-BubjTNcy.js +0 -1
  214. package/dist/assets/OverlayScrollbar-D6vmoMkQ.js +0 -1
  215. package/dist/assets/ProviderLogo-DA98yu7M.js +0 -1
  216. package/dist/assets/RemoteDesktopPanel-f3vRj4ZP.js +0 -1
  217. package/dist/assets/ScheduledTasksDialog-D_hBP47Y.js +0 -3
  218. package/dist/assets/ScrollableOverlay-stxT7gLf.js +0 -1
  219. package/dist/assets/SettingsGroup-CvaPYznp.js +0 -1
  220. package/dist/assets/SettingsWindow-DMVAV_el.js +0 -1
  221. package/dist/assets/SetupTourDialog-BlR7FJvd.js +0 -1
  222. package/dist/assets/TerminalView-Xcwp3SG1.js +0 -8
  223. package/dist/assets/TextSelectionMenu-h8iUeNzE.js +0 -11
  224. package/dist/assets/assistantMessagePreview-DLBvPQtq.js +0 -1
  225. package/dist/assets/assistantQueries-NdPqu6rx.js +0 -1
  226. package/dist/assets/card-DmysoUAV.js +0 -1
  227. package/dist/assets/chatUpwardIntent-B2NrGMm-.js +0 -1
  228. package/dist/assets/checkbox-BMN5hAVm.js +0 -1
  229. package/dist/assets/collapsible-Z0IjDAMO.js +0 -1
  230. package/dist/assets/context-menu-CKlB6wxo.js +0 -1
  231. package/dist/assets/diagram-CzY6n_4N.js +0 -1
  232. package/dist/assets/dialog-BeFBA6ja.js +0 -1
  233. package/dist/assets/dropdown-menu-BblI9sN2.js +0 -1
  234. package/dist/assets/githubAuthQueries-DqregESf.js +0 -1
  235. package/dist/assets/historyImportQueries-D00KjUT2.js +0 -1
  236. package/dist/assets/input-Cf16qJ6g.js +0 -1
  237. package/dist/assets/insertionBoundaries-Btqgsu1M.js +0 -1
  238. package/dist/assets/kbd-CamdaxHJ.js +0 -1
  239. package/dist/assets/main-CXH2hObl.js +0 -169
  240. package/dist/assets/main-ClH7cLKr.js +0 -2
  241. package/dist/assets/mcpQueries-Rmp1BKeo.js +0 -1
  242. package/dist/assets/miniChat-B_Bw6udu.js +0 -2
  243. package/dist/assets/mobile-BR73yoNi.js +0 -2
  244. package/dist/assets/mobileConnections-x07fHO_5.js +0 -2
  245. package/dist/assets/multirun-CKQymP08.js +0 -3
  246. package/dist/assets/openRemoteProjectSession-DNr74gHD.js +0 -1
  247. package/dist/assets/pluginPresentation-DtyC8NF2.js +0 -2
  248. package/dist/assets/pwa-CtDladgB.js +0 -2
  249. package/dist/assets/queue-abort-optimistic-DFbWDRKT.js +0 -1
  250. package/dist/assets/remoteProjectQueries-C8382jM8.js +0 -1
  251. package/dist/assets/renderElectronMiniChatApp-DM9y9qXo.js +0 -2
  252. package/dist/assets/renderMobileApp-DqpPYtZI.js +0 -17
  253. package/dist/assets/runtime-file-resource-Bc_ss-sW.js +0 -2
  254. package/dist/assets/runtimeEndpointReset-C0zNrsI9.js +0 -4
  255. package/dist/assets/select-vZCgcnYG.js +0 -1
  256. package/dist/assets/session-startup-barrier-DT-hIBRf.js +0 -1
  257. package/dist/assets/sessionOwnership-BjhXe6pi.js +0 -2
  258. package/dist/assets/shortcuts-WkN3Gh8v.js +0 -1
  259. package/dist/assets/sortable-tabs-strip-DmtfYPz0.js +0 -1
  260. package/dist/assets/speechSettingsQueries-BmkXNn4w.js +0 -1
  261. package/dist/assets/switch-CNmsFYfY.js +0 -1
  262. package/dist/assets/textarea-ZiXxEOHK.js +0 -1
  263. package/dist/assets/tooltip-CpTbxEOE.js +0 -1
  264. package/dist/assets/truncated-path-CcmWjgCQ.js +0 -1
  265. package/dist/assets/ui-ee2iN869.js +0 -13
  266. package/dist/assets/useDesktopWindowControlsLayout-BOkRz-p9.js +0 -1
  267. package/dist/assets/useMcpConfigStore-DKTl0PvE.js +0 -1
  268. package/dist/assets/useMobileSwipeActions-XoxrtaUo.js +0 -1
  269. package/dist/assets/useMobileTranscriptSyncHint-DM8WG7kz.js +0 -10
  270. package/dist/assets/useModelLists-Bf60FIJu.js +0 -1
  271. package/dist/assets/useOpenCodeReadiness-Dm6BjA1T.js +0 -1
  272. package/dist/assets/usePluginsStore-Du4WlceO.js +0 -1
  273. package/dist/assets/useProjectGitActions-D3B9ma9z.js +0 -1
  274. package/dist/assets/useQuotaStore-CSn2pk3T.js +0 -1
  275. package/dist/assets/worktreeManager-DGu8M01Z.js +0 -1
  276. package/dist/assets/yuriEvents-BFrD5fMU.js +0 -5
@@ -0,0 +1,17 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/vendor-capacitor-app-B5H_XtmE.js","assets/rolldown-runtime-hePW80VL.js","assets/vendor-aparajita-capacitor-secure-storage-xol_6BsB.js","assets/AssistantView-CDPTtrUZ.js","assets/runtime-switch-DEPKHgdL.js","assets/runtime-auth-DA-qfGHk.js","assets/vendor-base-ui-wXsskyKm.js","assets/vendor-react-BkccXcWz.js","assets/vendor-reactuses-core-DjKFMfz7.js","assets/vendor-lodash-es-BS45jPoZ.js","assets/vendor-js-cookie-hSOiFTtX.js","assets/useUIStore-C3ewjGgP.js","assets/reasoning-projection-client-BEhVknv9.js","assets/platform-CiUKDeXd.js","assets/runtimeAPIRegistry-C2VogTny.js","assets/vendor-pathe-vBmvQE8f.js","assets/vendor-zustand-CTekDqaS.js","assets/brand-storage-bootstrap-D4BW3w-M.js","assets/brand-storage-migration-Bhz6UOBJ.js","assets/safeStorage-DTOhKN0V.js","assets/useMobileHtmlPreviewStore-BYunNOBo.js","assets/ui-CHdferA1.js","assets/runtime-fetch-V-iMWR8t.js","assets/gitApiHttp-Bswf6gnl.js","assets/client-ITylDDCS.js","assets/vendor-opencode-client-BM2r1f0o.js","assets/vendor-effect-X1Hqc7ba.js","assets/prompt-attachment-upload-BGppTOgV.js","assets/runtime-file-resource-C5kmYlLv.js","assets/vendor-tanstack-query-core-BSjXNgF_.js","assets/vendor-tanstack-react-query-DIb_ItL-.js","assets/path-utils-jGozTg9d.js","assets/runtime-file-store-BVRgEtI-.js","assets/uuid-D-SDZijH.js","assets/vendor-sonner-DX3nfJx4.js","assets/vendor-class-variance-authority-BLUaYARZ.js","assets/vendor-tailwind-merge-BicNWLTg.js","assets/remoteProjectQueries-BXrXdLjN.js","assets/i18n-Dojvs57M.js","assets/runtime-ead7P81A.js","assets/bootstrap-eLlfzqAI.js","assets/store-DRUKTpV5.js","assets/tour-CMXP3Kif.js","assets/vendor-zod-DZzbCm1s.js","assets/vendor-opencode-schema-DWT45VBX.js","assets/input-store-dLjM4aiu.js","assets/toolHelpers-iEHVHQ9p.js","assets/useAssistantUIStore-CpJZ4Rqs.js","assets/Icon-B-w2YKpn.js","assets/mobileAppContext-BQgdTp5T.js","assets/device-EIfSfSWk.js","assets/assistantQueries-DxvTFlpL.js","assets/assistantPresentation-DRbsH1Ej.js","assets/MobileDetailNavigation-DKWnQoSh.js","assets/AssistantConversationSurface-u3ndSmZP.js","assets/ScrollableOverlay-CkX-buJm.js","assets/OverlayScrollbar-DS6XJ1HA.js","assets/vendor-framer-motion-D5NyyC73.js","assets/ImageLoadingPlaceholder-DsgRtfYG.js","assets/image-loading-DA9JEHD8.css","assets/LoadingImage-B3IL7hnv.js","assets/MarkdownRenderer-CsEylQVj.js","assets/useEffectiveDirectory-DZqC-2HE.js","assets/markdownHeightCache-RX04MAqu.js","assets/dualLimitLru-D8Sphgua.js","assets/imageSource-Cq_p4gAe.js","assets/MobileShareBridge-CRq9F1rn.js","assets/dialog-CmjXOKMz.js","assets/dialog-D9CkSNCA.css","assets/rasterizePng-056Poix7.js","assets/mobileConnections-PVy2SsQ_.js","assets/AgentAvatar-CNOu_vy0.js","assets/useThemeSystem-BIXghnHj.js","assets/agentColors-DWSbQXy2.js","assets/vendor-dicebear-core-CV95S5Pg.js","assets/vendor-dicebear-styles-C4OfoX7R.js","assets/chatUpwardIntent-CnS7WWRL.js","assets/MobileResizableSheet-CF3Pbot4.js","assets/MobileWindowStack-DGLdgoGr.js","assets/textarea-IhQHekYx.js","assets/fileMentionTouchSelection-B_62hIQI.js","assets/vendor-fuzzysort-ukaRp9PC.js","assets/fileMentionAutocompleteState-B9411b4o.js","assets/spacedFileMention-Ds4GtgiF.js","assets/vendor-fuse.js-DB5wDJbI.js","assets/reference-history-BwtzPAmA.js","assets/themes-BgDJcxRc.js","assets/useDictation-sdgDfATy.js","assets/audio-session-BFWjrDbp.js","assets/reference-history-8C8nv-EP.css","assets/vendor-motion-vLNN8EMu.js","assets/assistant-attachment-cache-eNT2QtmP.js","assets/AssistantWorkingAvatar-Vghb8xlt.js","assets/AssistantSessionCard-MYBAni6A.js","assets/sessionLookup-BTQ_AtWh.js","assets/scheduledTaskNavigation-VVTOq9n2.js","assets/router-DXUi1sBd.js","assets/contextPanelEmbeddedChat-Dm5R_b5X.js","assets/AssistantConversationSurface-B59k-lXE.css","assets/AssistantUnreadBadge-opyLZlZd.js","assets/sortAssistantContacts-CcEdm3mS.js","assets/assistantMessagePreview-C7YAFen1.js","assets/context-menu-DZunhC8o.js","assets/dropdown-menu.styles-BDla58Rm.js","assets/MobileAssistantTab-BbccE67x.js","assets/select-assistant-mmsKjj2O.js","assets/MobileSurface-DGNomvlu.js","assets/MobileTabPageHeader-0aJFe3_x.js","assets/useMobileSwipeActions-fUp7Bkbn.js","assets/MobileAssistantSettingsPage-DVpE3b24.js","assets/ErrorBoundary-CCH4LiRY.js","assets/card-D44sTpdY.js","assets/AssistantsSettingsPage-Dt4OP3J-.js","assets/dropdown-menu-BT_66BFT.js","assets/input-BllFKOjo.js","assets/select-BOtGs1FV.js","assets/SettingsGroup-kZ_faXwL.js","assets/ModelSelector-Dg__8QLh.js","assets/ModelLogo-D27dq-si.js","assets/zhipuai-coding-plan-CcFj8zKy.js","assets/useModelLists-B0qSYDby.js","assets/vendor-tanstack-react-virtual-qsd3nvZb.js","assets/tooltip-Dw3DApa-.js","assets/vendor-dnd-kit-core-qy5stxu5.js","assets/vendor-dnd-kit-accessibility-u0XSXxKq.js","assets/vendor-dnd-kit-sortable-CiTIuX4o.js","assets/ProviderLogo-Cm9RNV_U.js","assets/useOpenCodeReadiness-B9d-wLZB.js","assets/vendor-qrcode-D7jBCyl-.js","assets/vendor-dijkstrajs-BAzPDGZM.js","assets/MobileBtwPage-BRN1gAmR.js","assets/mobileBackNavigation-DsDUTnFY.js","assets/BtwPanel-DnMW6R43.js","assets/SessionSurfaceContext-BP4NCKp6.js","assets/useSessionBtwStore-CYaTDkvT.js","assets/nativeComposerCover-DzEGSyOO.js","assets/inlineMessageLinks-DC78iKO5.js","assets/auto-read-context-Ce0o43YI.js","assets/browserVoiceService-x5Pci8L3.js","assets/vendor-marked-S3gCOYp1.js","assets/timeFormat-BsuUDWLs.js","assets/MobileSettingsTab-of6zpTsr.js","assets/SettingsView-C62JngPE.js","assets/desktopHosts-BsTrBVja.js","assets/desktopRelayRestore-BxbRKak_.js","assets/vendor-codemirror-autocomplete-C0FrlFqZ.js","assets/react-CPBNl-S9.js","assets/collapsible-CL3SPnOf.js","assets/appThemeRegistry-BdjrGBQ4.js","assets/vendor-pierre-diffs-B0OmIhMO.js","assets/vendor-hast-util-to-html-Bw_SgZ1t.js","assets/vendor-character-entities-legacy-Wut6vMuj.js","assets/vendor-character-entities-html4-DlN_yAFd.js","assets/vendor-ccount-CyGsA0u7.js","assets/vendor-comma-separated-tokens-B9ouxNNS.js","assets/vendor-oniguruma-to-es-CrHzjjSU.js","assets/vendor-oniguruma-parser-D2DIvhSP.js","assets/vendor-diff-Dq7CZNim.js","assets/vendor-lru_map-BMOrLc9L.js","assets/gitApi-CBfYFgtd.js","assets/GuiPluginMount-BCqt2pmM.js","assets/MobileHtmlNetworkBoundary-BKSYPR9N.js","assets/shortcuts-Cu4ioDvH.js","assets/pwa-Br2HZksc.js","assets/vendor-simplewebauthn-browser-Dwhcdg_5.js","assets/githubAuthQueries-C5RxUNL2.js","assets/projectMeta-vIaGFaQr.js","assets/sortable-tabs-strip-DACGW9sB.js","assets/permission-rules-DoQUXKll.js","assets/useQuotaStore-mZs9LTwx.js","assets/quota-2PwXAoIg.js","assets/sessionOwnership-BPfk1qCS.js","assets/types-BBBwzIOU.js","assets/mcpQueries-qRW-HQMx.js","assets/usePluginsStore-BLncdNj-.js","assets/switch-DaUn0G3u.js","assets/useMcpConfigStore-ZsZxSrCt.js","assets/native-config-Czc142JT.js","assets/YuriLogo-Ceon25sC.js","assets/GuiPluginWindow-CDycMqzT.js","assets/pluginPresentation-p_0sXPMT.js","assets/speechSettingsQueries-BU-4Axb5.js","assets/pluginPresentation-C0HSdVvS.css","assets/AgentSelector-K5JSbXv3.js","assets/ArchivedSessionsDialog-CU9RXl8K.js","assets/vendor-codemirror-lang-angular-Cm7vBE3E.js","assets/vendor-codemirror-lang-json-DowyFczU.js","assets/vendor-codemirror-lang-markdown-npWBZIoE.js","assets/vendor-codemirror-lang-python-OPRdU26g.js","assets/vendor-codemirror-legacy-modes-DwltVFbT.js","assets/MobileOverlayPanel-DcRWQlmf.js","assets/worktreeManager-V6hoSVxH.js","assets/markdown-worker-oBGEB9Eg.js","assets/vendor-codemirror-commands-5saeUOVY.js","assets/vendor-codemirror-search-hZY-L2l8.js","assets/vendor-replit-codemirror-vim-BmQmU1lR.js","assets/vendor-codemirror-language-data-B3pLWvv-.js","assets/vendor-yaml-C9KlJAlj.js","assets/vendor-capacitor-push-notifications-D5cqJIPw.js","assets/ChatView-AFUNEBdD.js","assets/useProjectRuntimeAPIs-D51dVo-V.js","assets/terminalApi-ClNhXBA8.js","assets/useProjectGitStore-Lz9AV32V.js","assets/useGitStore-Bbmai549.js","assets/ChatContainer-Dg9uDBjk.js","assets/useInlineCommentDraftStore-DrC99u6A.js","assets/truncated-path-KHrfQ66P.js","assets/kbd-CwkasrzN.js","assets/TextSelectionMenu-B2fIBlD3.js","assets/useDebouncedValue-BHlMPqY8.js","assets/checkbox-DaKe0Tlq.js","assets/connection-hint-SMNZFDAe.js","assets/insertionBoundaries-Br0Bdl9R.js","assets/BusyDots-FXSlMe2F.js","assets/worktreeSourceBranchPreference-MQFPkOZy.js","assets/remote-input-store-DdjKfpxS.js","assets/vendor-cmdk-BDWoZLve.js","assets/vendor-aria-hidden-BbL3cEyI.js","assets/queue-abort-optimistic-DciJN9X1.js","assets/ToolOutputDialog-DdSUE2kP.js","assets/runtime-file-download-1s2Al1t3.js","assets/tap-LkQum5bB.js","assets/markdownTheme-D84XyNiT.js","assets/DiffViewToggle-DkxhEUhV.js","assets/touch-gestures-DOoBxhz5.js","assets/FadeInOnReveal-DO9PZrJL.js","assets/useStreamingTextThrottle-ul6e3dUd.js","assets/ChatContainer-K31q-1OV.css","assets/DiffView-DZ_gKyTO.js","assets/PierreDiffViewer-BHwj_6j8.js","assets/DiffWorkerProvider-VFPkag9y.js","assets/MobileChangesSurface-BwmSTxeh.js","assets/useProjectGitActions-CHMe1ku4.js","assets/SyncActions-Blnq08ks.js","assets/MobileFilesSurface-qkfC06Oh.js","assets/BinaryFileFallback-CJqnlBzh.js","assets/relay-preview-frame-src-BPyz3nXA.js","assets/BinaryFileFallback-CKNAgvHj.css","assets/MobileChatScreen-Bf42GrQ8.js","assets/useMobileTranscriptSyncHint-B4izCfqe.js","assets/icons-D_vRtitD.js","assets/GuiPluginTitlebarItems-DfHugxsx.js","assets/RemoteDesktopPanel-Bays6pHh.js","assets/ScheduledTasksDialog-DnwBC7cj.js","assets/vendor-cron-parser-BmO80h0C.js","assets/vendor-capacitor-status-bar-D9bcMr9Q.js","assets/vendor-capacitor-keyboard-BRVcFyc9.js"])))=>i.map(i=>d[i]);
2
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{S as t,_ as n,p as r,r as i,t as a,v as o}from"./runtime-auth-DA-qfGHk.js";import{c as s,f as c,i as l,l as u,n as d,r as f,t as p}from"./runtime-switch-DEPKHgdL.js";import{n as m}from"./runtime-fetch-V-iMWR8t.js";import{f as h,n as g,r as _,s as v,t as y}from"./platform-CiUKDeXd.js";import{n as b,t as x}from"./runtimeAPIRegistry-C2VogTny.js";import{a as S}from"./vendor-zustand-CTekDqaS.js";import{ot as C,st as w}from"./vendor-base-ui-wXsskyKm.js";import{Mt as T,Pt as E,St as D}from"./gitApiHttp-Bswf6gnl.js";import"./brand-storage-bootstrap-D4BW3w-M.js";import{n as O}from"./safeStorage-DTOhKN0V.js";import{ft as k,n as A}from"./client-ITylDDCS.js";import{n as j,t as M}from"./vendor-react-BkccXcWz.js";import{s as N}from"./vendor-tanstack-react-query-DIb_ItL-.js";import{E as P,V as F,k as I}from"./runtime-file-resource-C5kmYlLv.js";import{i as L,l as R,r as z}from"./vendor-reactuses-core-DjKFMfz7.js";import{a as B,n as V,o as H}from"./vendor-aparajita-capacitor-secure-storage-xol_6BsB.js";import{r as U}from"./useUIStore-C3ewjGgP.js";import{a as ee,o as te,s as ne,t as re}from"./useMobileHtmlPreviewStore-BYunNOBo.js";import{t as W}from"./capgoAdapter-DQwUA-Nt.js";/* empty css */import{r as ie}from"./vendor-sonner-DX3nfJx4.js";import{Ba as ae,Bi as oe,Br as se,Di as ce,Fi as le,Fn as ue,Gt as de,H as G,In as fe,J as pe,Jr as me,Kr as he,Mi as K,Nt as ge,Ot as _e,Pi as ve,Pt as ye,Qr as be,R as xe,Si as Se,Ua as Ce,Wr as we,Yi as Te,Yn as q,Zr as Ee,a as De,ar as Oe,br as ke,dr as Ae,dt as je,et as Me,f as Ne,gn as Pe,i as Fe,io as Ie,it as Le,k as Re,ki as ze,lr as Be,n as Ve,nn as He,no as J,o as Ue,q as We,qi as Ge,r as Ke,t as Y,ta as qe,to as Je,tt as Ye,ur as Xe,ut as Ze,z as Qe,zi as $e}from"./ui-CHdferA1.js";import{n as X}from"./Icon-B-w2YKpn.js";import{d as et,h as tt,i as nt,m as rt,p as it}from"./remoteProjectQueries-BXrXdLjN.js";import{r as at,t as ot}from"./i18n-Dojvs57M.js";import{i as st,n as ct}from"./store-DRUKTpV5.js";import{n as lt}from"./useAssistantUIStore-CpJZ4Rqs.js";import{n as ut,t as dt}from"./ScrollableOverlay-CkX-buJm.js";import{d as ft,r as pt,t as mt,u as ht,v as gt}from"./MobileResizableSheet-CF3Pbot4.js";import{t as _t}from"./mobileAppContext-BQgdTp5T.js";import{a as vt,i as yt,n as bt,o as xt,r as St,t as Ct}from"./dialog-CmjXOKMz.js";import{r as wt}from"./tooltip-Dw3DApa-.js";import{i as Tt,o as Et,t as Dt}from"./device-EIfSfSWk.js";import{c as Ot,n as kt,r as At,t as jt}from"./dropdown-menu-BT_66BFT.js";import{t as Mt}from"./DiffWorkerProvider-VFPkag9y.js";import{a as Nt,c as Pt,o as Ft,s as It}from"./useGitStore-Bbmai549.js";import{A as Lt,E as Rt,a as zt,j as Bt,n as Vt,p as Ht,r as Ut,t as Wt}from"./mobileBackNavigation-DsDUTnFY.js";import{i as Gt,t as Kt}from"./MobileHtmlNetworkBoundary-BKSYPR9N.js";import{t as qt}from"./relay-preview-frame-src-BPyz3nXA.js";/* empty css */import{t as Jt}from"./input-BllFKOjo.js";import{o as Yt}from"./MarkdownRenderer-CsEylQVj.js";import{o as Xt}from"./useSessionBtwStore-CYaTDkvT.js";import{a as Zt,i as Qt,o as $t,t as en}from"./nativeComposerCover-DzEGSyOO.js";import{a as tn,i as nn,l as rn,o as an,r as on,s as sn,t as cn,u as ln}from"./mobileConnections-PVy2SsQ_.js";import{m as un,v as dn,x as fn,y as pn}from"./assistantQueries-DxvTFlpL.js";import{a as mn,t as hn}from"./MobileShareBridge-CRq9F1rn.js";import{t as gn}from"./MobileDetailNavigation-DKWnQoSh.js";import{A as _n,C as vn,D as yn,E as bn,M as xn,N as Sn,O as Cn,R as wn,S as Tn,T as En,i as Dn,j as On,k as kn,r as An,t as jn,w as Mn,x as Nn,z as Pn}from"./useAppFontEffects-Dw6o6XbA.js";import{S as Fn}from"./pwa-Br2HZksc.js";import{t as In}from"./YuriLogo-Ceon25sC.js";import{t as Ln}from"./ErrorBoundary-CCH4LiRY.js";import{L as Rn,R as zn,T as Bn,X as Vn,i as Hn,t as Un}from"./BusyDots-FXSlMe2F.js";import{r as Wn}from"./queue-abort-optimistic-DciJN9X1.js";import{t as Gn}from"./MobileOverlayPanel-DcRWQlmf.js";import{n as Kn,t as qn}from"./ProviderLogo-Cm9RNV_U.js";import{n as Jn,s as Yn}from"./worktreeManager-V6hoSVxH.js";import{a as Xn,i as Zn,n as Qn}from"./projectMeta-vIaGFaQr.js";import{i as $n,n as er,t as tr}from"./auto-read-context-Ce0o43YI.js";import{a as nr,n as rr,r as ir,u as ar}from"./useQuotaStore-mZs9LTwx.js";import{a as or,i as sr,s as cr}from"./quota-2PwXAoIg.js";import{t as lr}from"./openRemoteProjectSession-C5z2Juv7.js";import{i as ur}from"./router-DXUi1sBd.js";import{t as dr}from"./useFontPreferences-Bb-bxdL8.js";import{$ as fr,At as pr,B as mr,C as hr,Ct as gr,Dt as _r,E as vr,Et as yr,F as br,Ft as xr,I as Sr,J as Cr,Lt as wr,Nt as Tr,Ot as Er,Pt as Dr,Q as Or,R as kr,Rt as Ar,Tt as jr,X as Mr,Y as Nr,Z as Pr,_ as Fr,_t as Ir,a as Lr,at as Rr,c as zr,ct as Br,d as Vr,dt as Hr,f as Ur,ft as Wr,g as Gr,gt as Kr,h as qr,ht as Jr,i as Yr,it as Xr,kt as Zr,l as Qr,lt as $r,m as ei,mt as ti,n as ni,nt as ri,o as ii,ot as ai,p as oi,pt as si,r as ci,rt as li,s as ui,st as di,t as fi,tt as pi,u as mi,ut as hi,vt as gi,w as _i,wt as vi,x as yi,yt as bi,zt as xi}from"./runtimeEndpointReset-BKLVdNhJ.js";import{t as Si}from"./YuriWordmark-CW53XKgV.js";import{_ as Ci,p as wi,r as Ti,y as Ei}from"./sessionOwnership-BPfk1qCS.js";import{r as Di,t as Oi}from"./mcpQueries-qRW-HQMx.js";import{n as ki}from"./SettingsGroup-kZ_faXwL.js";import{a as Ai,n as ji,o as Mi}from"./useMcpConfigStore-ZsZxSrCt.js";import{n as Ni}from"./project-preview-BcLPKzwg.js";import{i as Pi,r as Fi}from"./icons-D_vRtitD.js";import{a as Ii,i as Li,o as Ri,r as zi,s as Bi,t as Vi}from"./useMobileTranscriptSyncHint-B4izCfqe.js";import{n as Hi,r as Ui,t as Wi}from"./select-assistant-mmsKjj2O.js";import{i as Gi,n as Ki,t as qi}from"./MobileSurface-DGNomvlu.js";import{t as Ji}from"./AssistantUnreadBadge-opyLZlZd.js";var Z=e(w(),1),Yi=M(),Xi=null,Zi=!1,Qi=new Promise(e=>{Xi=e});function $i(){Zi||(Zi=!0,Xi?.())}var ea=6,ta=e=>e.parentID??null,na=e=>{let t=e.replace(/\/+$/,``);return t.slice(t.lastIndexOf(`/`)+1)||t},ra=e=>e.replace(/\\/g,`/`).replace(/\/+$/,``),ia=(e,t)=>{if(!e)return``;let n=null,r=-1;for(let i of t){let t=ra(i.path);(e===t||e.startsWith(`${t}/`))&&t.length>r&&(n=i,r=t.length)}return na(n?n.path:e)},aa=()=>{let e=le.getState().activeSessions,t=we.getState().index.session.unseenCount,n=ae.getState().projects,r=0,i=[];for(let a of e){let e=ta(a)!==null,o=(t[a.id]??0)>0&&!e;o&&(r+=1),e||i.push({id:a.id,title:a.title??``,updated:a.time?.updated??a.time?.created??0,unread:o,project:ia(K(a),n)})}i.sort((e,t)=>t.updated-e.updated);let a=i.slice(0,ea).map(({id:e,title:t,unread:n,project:r})=>({id:e,title:t,unread:n,project:r}));return{attentionCount:r,recentSessions:a}},oa=`__YURI_WIDGET_SNAPSHOT__`,sa=()=>{typeof window>`u`||(window[oa]=()=>{try{return JSON.stringify(aa())}catch{return null}})},Q=j(),ca=B(`YuriScreenAwake`),la=Promise.resolve(),ua=0;function da(e){let t=la.then(()=>ca.setEnabled({enabled:e}));return la=t.catch(()=>void 0),t}async function fa(){if(V.isNativePlatform()&&V.isPluginAvailable(`YuriScreenAwake`)){ua+=1;try{await da(!0)}catch(e){throw--ua,e}let e=!1;return async()=>{e||(e=!0,--ua,ua===0&&await da(!1))}}if(!navigator.wakeLock)throw Error(`Screen wake lock unavailable`);let e=await navigator.wakeLock.request(`screen`);return async()=>{e.released||await e.release()}}var $=C();function pa(e){let t=(0,Q.c)(3),n=Ae(),r=e.remoteState??n??void 0,i;return t[0]!==e||t[1]!==r?(i=(0,$.jsx)(ga,{...e,remoteState:r}),t[0]=e,t[1]=r,t[2]=i):i=t[2],i}function ma(e){let t=(0,Q.c)(6),{identity:n,onSource:r}=e,i=Ze(e.sessionId,e.directory),a=je(e.sessionId,e.directory),o,s;return t[0]!==n||t[1]!==i||t[2]!==r||t[3]!==a?(o=()=>r({identity:n,resolved:a,getMessages:()=>i}),s=[n,r,i,a],t[0]=n,t[1]=i,t[2]=r,t[3]=a,t[4]=o,t[5]=s):(o=t[4],s=t[5]),(0,Z.useLayoutEffect)(o,s),null}function ha(e){let{identity:t,onSource:n}=e,r=e.remoteState,i=(0,Z.useMemo)(()=>r.scope(e.sessionId),[r,e.sessionId]),a=(0,Z.useMemo)(()=>e=>r.repository.subscribe(i,e),[r,i]),o=(0,Z.useMemo)(()=>()=>r.repository.hasSession?.(i)||r.repository.getRequestState?.(i)?.status===`ready`||r.repository.getTranscript(i).messageOrder.length>0,[r,i]),s=(0,Z.useSyncExternalStore)(a,o,o),c=z(function*(){let e=r.repository.getTranscript(i);for(let t of e.messageOrder)yield e.messagesByID[t]});return(0,Z.useLayoutEffect)(()=>n({identity:t,resolved:s,getMessages:c}),[t,n,s,c]),null}function ga(e){let{sessionId:t,directory:n,active:r,children:i,remoteState:a}=e,{t:o}=ot(),c=JSON.stringify([a?.entry.key??(e.remote?`remote-pending`:`local`),a?.entry.connectionGeneration,t,n]),l=(0,Z.useRef)(null),[u,d]=(0,Z.useState)(null),f=z(e=>{l.current=e,d(t=>t?.identity===e.identity&&t.resolved===e.resolved?t:{identity:e.identity,resolved:e.resolved})}),[p,m]=R(`yuri.auto-read`,!1),h=p===!0,[g,_]=(0,Z.useState)(0),[v,y]=(0,Z.useState)(!1),[b,x]=(0,Z.useState)(null),[S,C]=(0,Z.useState)(document.visibilityState===`visible`),w=$n({enabled:v}),T=(0,Z.useRef)({enabled:!1,generation:0,floor:0,seen:new Set,observed:new Set,pending:[],playing:!1}),E=(0,Z.useRef)(!1),D=r&&!!t&&u?.identity===c&&u.resolved,O=z(()=>{let e=T.current;e.enabled=!1,e.generation+=1,e.pending=[],e.playing=!1,e.seen.clear(),e.observed.clear(),E.current=!1,w.stop(),x(null),y(!1)}),k=z(()=>{let e=T.current;if(!e.enabled||e.playing||!r||document.visibilityState!==`visible`)return;let t=e.pending.shift();if(!t)return;e.playing=!0,x(t);let n=e.generation;w.play(t.text,t=>{if(n===e.generation){if(e.playing=!1,x(null),t){O(),ie.error(o(`mobile.menu.autoReadFailed`));return}k()}},{target:t.target})}),A=z(e=>{let n=T.current;!n.enabled||!D||e.sessionId!==t||!e.text.trim()||e.created<n.floor&&!n.observed.has(e.messageId)||n.seen.has(e.messageId)||(n.seen.add(e.messageId),n.pending.push(e),k())}),j=z((e,n)=>{T.current.enabled&&D&&e===t&&T.current.observed.add(n)}),M=z(()=>{if(h){m(!1),O();return}D&&(m(!0),w.unlock().catch(()=>{ie.error(o(`mobile.menu.autoReadFailed`))}))}),N=z(()=>{let e=T.current;e.floor=0,e.seen=new Set;for(let t of l.current?.getMessages()??[])e.floor=Math.max(e.floor,t.time.created),(t.time.completed!=null||t.role!==`assistant`)&&e.seen.add(t.id);e.enabled=!0,y(!0)});(0,Z.useEffect)(()=>(O(),h&&D&&N(),O),[t,n,c,h,D,g,N,O]),(0,Z.useEffect)(()=>s(()=>{O(),_(e=>e+1)}),[O]);let P=z(()=>{m(!1),O()});L(`pointerdown`,()=>{if(!T.current.enabled||E.current)return;E.current=!0;let e=T.current.generation;w.unlock().catch(()=>{e===T.current.generation&&(E.current=!1)})},document),L(`visibilitychange`,()=>{C(document.visibilityState===`visible`),document.visibilityState===`visible`?k():(T.current.generation+=1,T.current.playing=!1,T.current.pending=[],w.stop(),x(null))},document),(0,Z.useEffect)(()=>{if(!v||!D||!S)return;let e=!1,t;return fa().then(n=>{e?n().catch(()=>void 0):t=n}).catch(()=>{e||ie.warning(o(`mobile.menu.autoReadAwakeFailed`))}),()=>{e=!0,t?.().catch(()=>void 0)}},[v,D,S,t,n,c,g,o]);let F=(0,Z.useMemo)(()=>({enabled:h,available:D,toggle:M,rendered:A,streaming:j}),[h,D,M,A,j]),I=(0,Z.useMemo)(()=>v&&r&&S&&w.isPlaying&&b?.sessionId===t?{sessionId:t,messageId:b.messageId,stop:P}:null,[v,r,S,w.isPlaying,b,t,P]);return(0,$.jsx)(tr.Provider,{value:F,children:(0,$.jsxs)(er.Provider,{value:I,children:[a?(0,$.jsx)(ha,{...e,identity:c,onSource:f,remoteState:a}):e.remote?null:(0,$.jsx)(ma,{...e,identity:c,onSource:f}),i]})})}function _a(e){let t=(0,Q.c)(3),{children:n}=e,r=(0,Z.useContext)(tr);if(!r)return null;let i;return t[0]!==n||t[1]!==r?(i=n(r),t[0]=n,t[1]=r,t[2]=i):i=t[2],i}var va={getPlatform:()=>V.getPlatform(),isPluginAvailable:e=>V.isPluginAvailable(e),openInSystemBrowser:e=>ne.open(e),openExternal:te},ya=async(e,t=va)=>{if(t.getPlatform()===`android`){if(!t.isPluginAvailable(`YuriExternalBrowser`))return!1;try{return await t.openInSystemBrowser({url:e}),!0}catch{return!1}}return t.openExternal(e)},ba=`mobile-app-update-available`,xa=`mobile-app-update-toast-dismissed-version`,Sa=()=>{let e=(0,Q.c)(9),{t}=ot(),n=Ci(Ca),r=Ci(wa),i=Ci(Ta),a=Ci(Ea),o=Ci(Da),s;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=new Set,e[0]=s):s=e[0];let c=Z.useRef(s),l,u;return e[1]!==n||e[2]!==a||e[3]!==o||e[4]!==r||e[5]!==t||e[6]!==i?(l=()=>{if(y()!==`android`||r!==`mobile`||!n||!i||!a||o){Y.dismiss(ba);return}O().getItem(xa)!==i&&(c.current.has(i)||(c.current.add(i),Y.info(t(`mobileUpdate.toast.available.title`),{id:ba,description:t(`mobileUpdate.toast.available.description`,{version:i}),duration:1/0,icon:(0,$.jsx)(X,{name:`download`,className:`h-4 w-4 text-muted-foreground`}),action:{label:t(`mobileUpdate.toast.actions.download`),onClick:()=>{ya(a)}},cancel:{label:t(`mobileUpdate.toast.actions.dismiss`),onClick:()=>{O().setItem(xa,i),Y.dismiss(ba)}}})))},u=[n,a,o,r,t,i],e[1]=n,e[2]=a,e[3]=o,e[4]=r,e[5]=t,e[6]=i,e[7]=l,e[8]=u):(l=e[7],u=e[8]),Z.useEffect(l,u),null};function Ca(e){return e.available}function wa(e){return e.runtimeType}function Ta(e){return e.info?.version}function Ea(e){return e.info?.downloadUrl}function Da(e){return e.info?.inAppApply===!0}var Oa=e=>!(!e.enabled||e.runtimeType!==`mobile`||!e.available||!e.inAppApply||!e.version||e.seenVersions.has(e.version)||e.dismissedVersion!==null&&e.dismissedVersion===e.version),ka=e=>e.enabled&&!e.alreadyChecked,Aa=`mobile-ota-update-available`,ja=`mobile-ota-update-toast-dismissed-version`,Ma=()=>{let e=(0,Q.c)(24),{t}=ot(),[n,r]=Z.useState(!1),i=Z.useRef(!1),a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=new Set,e[0]=a):a=e[0];let o=Z.useRef(a),s;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(s=g(),e[1]=s):s=e[1];let c=s,l=Ci(Na),u=Ci(Pa),d=Ci(Fa),f=Ci(Ia),p=Ci(La),m=Ci(Ra),h=Ci(za),_=Ci(Ba),v=Ci(Va),y=d?.version,b=d?.inAppApply===!0,x,S;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(x=()=>{ka({enabled:c,alreadyChecked:i.current})&&(i.current=!0,Ci.getState().checkForUpdates().catch(Ha))},S=[c],e[2]=x,e[3]=S):(x=e[2],S=e[3]),Z.useEffect(x,S);let C;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(C=()=>{r(!0)},e[4]=C):C=e[4];let w=z(C),T=z(Ua),E,D;if(e[5]!==l||e[6]!==T||e[7]!==b||e[8]!==w||e[9]!==u||e[10]!==t||e[11]!==y?(E=()=>{if(!Oa({enabled:c,runtimeType:u,available:l,inAppApply:b,version:y??``,dismissedVersion:O().getItem(ja),seenVersions:o.current})||!y){(!l||!b||u!==`mobile`)&&Y.dismiss(Aa);return}o.current.add(y),Y.info(t(`mobileUpdate.ota.toast.available.title`),{id:Aa,description:t(`mobileUpdate.ota.toast.available.description`,{version:y}),duration:1/0,icon:(0,$.jsx)(X,{name:`refresh`,className:`h-4 w-4 text-muted-foreground`}),action:{label:t(`mobileUpdate.ota.toast.actions.update`),onClick:w},cancel:{label:t(`mobileUpdate.ota.toast.actions.dismiss`),onClick:()=>{T(y)}}})},D=[l,b,c,w,T,u,t,y],e[5]=l,e[6]=T,e[7]=b,e[8]=w,e[9]=u,e[10]=t,e[11]=y,e[12]=E,e[13]=D):(E=e[12],D=e[13]),Z.useEffect(E,D),!c)return null;let k;return e[14]!==n||e[15]!==_||e[16]!==p||e[17]!==f||e[18]!==h||e[19]!==d||e[20]!==m||e[21]!==v||e[22]!==u?(k=(0,$.jsx)(wi,{open:n,onOpenChange:r,info:d,downloading:f,downloaded:p,progress:m,error:h,onDownload:_,onRestart:v,runtimeType:u}),e[14]=n,e[15]=_,e[16]=p,e[17]=f,e[18]=h,e[19]=d,e[20]=m,e[21]=v,e[22]=u,e[23]=k):k=e[23],k};function Na(e){return e.available}function Pa(e){return e.runtimeType}function Fa(e){return e.info}function Ia(e){return e.downloading}function La(e){return e.downloaded}function Ra(e){return e.progress}function za(e){return e.error}function Ba(e){return e.downloadUpdate}function Va(e){return e.restartToUpdate}function Ha(){}function Ua(e){O().setItem(ja,e),Y.dismiss(Aa)}var Wa=B(`BarcodeScanner`),Ga=`yuri-barcode-scanner-active`,Ka=()=>so()?Wa:null,qa=()=>window.Capacitor?.getPlatform?.()===`android`,Ja=e=>typeof e==`object`&&e&&`message`in e?String(e.message??``):String(e??``),Ya=e=>/^\s*scan canceled\.?\s*$/i.test(Ja(e)),Xa=e=>/denied access to camera/i.test(Ja(e)),Za=e=>!Ya(e)&&!Xa(e),Qa=e=>{let t=Ja(e);return/module/i.test(t)&&/not\s*available|unavailable/i.test(t)},$a=e=>{e.installGoogleBarcodeScannerModule?.().catch(()=>void 0)},eo=e=>{let t=e.trim();if(!t)return null;if(/^yuri:\/\//i.test(t)){let e=Ai(t);return e?{pairing:e}:null}return/^https?:\/\//i.test(t)?{url:t}:null},to=e=>{let t=eo(e);return t?`pairing`in t?{status:`pairing`,...t}:{status:`ok`,...t}:{status:`invalid`}},no=e=>{typeof document>`u`||document.documentElement.classList.toggle(Ga,e)},ro=e=>{try{e()}catch{}},io=e=>{if(typeof document>`u`)return()=>void 0;let t=document.body,n=document.createElement(`button`);n.type=`button`,n.className=`yuri-barcode-scanner-chrome`,n.setAttribute(`aria-label`,`Cancel`),n.textContent=`×`,n.addEventListener(`click`,e),t.appendChild(n);let r=!1;return()=>{r||(r=!0,n.removeEventListener(`click`,e),n.parentNode===t&&t.removeChild(n))}},ao=async e=>{if(!e.startScan||!e.stopScan||!e.addListener)return{status:`unsupported`};let t,n,r,i=!1,a=()=>void 0,o=new Promise(e=>{a=e}),s=e=>{i||(i=!0,a(e))};no(!0);let c=io(()=>s({status:`cancelled`}));try{let{App:e}=await H(async()=>{let{App:e}=await import(`./vendor-capacitor-app-B5H_XtmE.js`).then(e=>e.t);return{App:e}},__vite__mapDeps([0,1,2])),t=await e.addListener(`backButton`,()=>s({status:`cancelled`}));r=()=>void t.remove()}catch{r=void 0}try{return(await Promise.allSettled([Promise.resolve(e.addListener(`barcodesScanned`,({barcodes:e})=>{let t=e?.[0],n=(t?.rawValue??t?.displayValue??``).trim();n&&s(to(n))})).then(e=>{t=e}),Promise.resolve(e.addListener(`scanError`,()=>s({status:`failed`}))).then(e=>{n=e})])).some(({status:e})=>e===`rejected`)?s({status:`failed`}):i||e.startScan({formats:[`QR_CODE`]}).catch(e=>{Xa(e)?s({status:`permission-denied`}):s({status:`failed`})}),await o}finally{no(!1),ro(c),ro(()=>r?.()),await Promise.allSettled([Promise.resolve(t?.remove()),Promise.resolve(n?.remove()),e.stopScan()])}},oo=e=>e.isNativePlatform&&e.isPluginAvailable,so=()=>oo({isNativePlatform:V.isNativePlatform(),isPluginAvailable:V.isPluginAvailable(`BarcodeScanner`)}),co=async()=>{let e=Ka();if(!e)return{status:`unsupported`};try{if(e.requestPermissions){let t=(await e.requestPermissions())?.camera;if(t&&t!==`granted`&&t!==`limited`)return{status:`permission-denied`}}if(e.scan)try{let t=(await e.scan({formats:[`QR_CODE`]}))?.barcodes?.[0],n=(t?.rawValue??t?.displayValue??``).trim();return n?to(n):{status:`cancelled`}}catch(t){return Ya(t)?{status:`cancelled`}:Xa(t)?{status:`permission-denied`}:qa()&&Za(t)&&e.startScan?(Qa(t)&&$a(e),ao(e)):{status:`failed`}}return qa()&&e.startScan?ao(e):{status:`unsupported`}}catch{return{status:`failed`}}},lo={autoComplete:`off`,autoCorrect:`off`,spellCheck:!1},uo=({disabled:e=!1,isBusy:t=!1,tabIndex:n,inputClassName:r,buttonVariant:i=`outline`,buttonClassName:a=`h-12 w-full`,value:o,onValueChange:s,showPasteButton:c=!1,error:l,onRedeem:u,onInvalid:d})=>{let{t:f}=ot(),[p,m]=Z.useState(``),[h,g]=Z.useState(null),[_,v]=Z.useState(!1),y=o??p,b=Z.useId(),x=e=>{g(null),m(e),s?.(e)},S=z(async()=>{if(!(e||t||_)){v(!0);try{let e=await navigator.clipboard.readText();x(e);let t=eo(e);e.trim()&&(!t||!(`pairing`in t))&&d()}catch{g(f(`mobile.connect.link.pasteFallback`))}finally{v(!1)}}}),C=z(n=>{if(n.preventDefault(),e||t||_)return;let r=eo(y);if(!r||!(`pairing`in r)){d();return}u(r.pairing)});return(0,$.jsxs)(`form`,{className:`flex w-full flex-col gap-3`,onSubmit:C,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(Jt,{...lo,value:y,onChange:e=>x(e.target.value),placeholder:f(`mobile.connect.link.placeholder`),"aria-label":f(`mobile.connect.link.label`),inputMode:`url`,autoCapitalize:`none`,tabIndex:n,disabled:e||t||_,"aria-invalid":!!l,"aria-describedby":l||h?b:void 0,className:r}),c?(0,$.jsx)(q,{variant:`outline`,size:`icon`,onClick:()=>void S(),disabled:e||t||_,"aria-label":f(`mobile.connect.link.paste`),children:(0,$.jsx)(X,{name:`clipboard`,className:`size-5`})}):null]}),l||h?(0,$.jsx)(`p`,{id:b,role:`alert`,className:`typography-small text-[var(--status-error)]`,children:l||h}):null,(0,$.jsx)(q,{type:`submit`,variant:i,size:`lg`,className:a,disabled:e||t||_||!y.trim(),children:f(t?`mobile.connect.connecting`:`mobile.connect.connectButton`)})]})};function fo({connection:e}){let{t}=ot(),{connections:n,isBusy:r,error:i,pendingConnection:a}=e,o=Z.useMemo(()=>so(),[]),[s,c]=Z.useState(null),[l,u]=Z.useState(!1),[d,f]=Z.useState(null),[p,m]=Z.useState(!1),[h,_]=Z.useState(null),[v,y]=Z.useState(null),[b,x]=Z.useState(``),[S,C]=Z.useState(``),[w,T]=Z.useState(``),E=n[0],D=n.find(e=>e.id===v),O=r||p,k=s!==null||a!==null,A=t=>{e.setError(null),c(t)},j=()=>{e.setError(null),c(null),u(!0)},M=z(()=>{O||(a?(e.cancelPassword(),C(``)):A(null))}),N=z(async t=>{O||(_(t.id),C(``),await e.connect({id:t.id,candidates:t.candidates,label:t.label}))}),P=z(async()=>{if(!O){_(null),m(!0),e.setError(null);try{let n=await co();n.status===`ok`?await e.connect({url:n.url,label:n.label,clientToken:n.clientToken}):n.status===`pairing`?await e.redeemPairingConnection(n.pairing):n.status===`permission-denied`?e.setError(t(`mobile.connect.scan.permissionDenied`)):n.status===`invalid`?e.setError(t(`mobile.connect.scan.invalid`)):n.status===`unsupported`?e.setError(t(`mobile.connect.scan.unsupported`)):n.status===`failed`&&e.setError(t(`mobile.connect.scan.failed`))}catch{e.setError(t(`mobile.connect.scan.failed`))}finally{m(!1)}}}),F=z(()=>d?(f(null),!0):k?(M(),!0):l?(u(!1),!0):!1);Z.useEffect(()=>{if(!g())return;let e=!1,t;return H(async()=>{let{App:e}=await import(`./vendor-capacitor-app-B5H_XtmE.js`).then(e=>e.t);return{App:e}},__vite__mapDeps([0,1,2])).then(async({App:n})=>{let r=await n.addListener(`backButton`,()=>{F()||n.minimizeApp().catch(()=>void 0)});e?r.remove():t=()=>{r.remove()}}).catch(()=>void 0),()=>{e=!0,t?.()}},[F]);let I=e=>h===e.id&&r&&!a&&s!==`rename`&&s!==`remove`?t(`mobile.connect.connecting`):e.id===E?.id&&e.lastUsedAt>0?t(`mobile.connect.history.lastUsed`):t(`mobile.instances.status.saved`),L=e=>(0,$.jsxs)(q,{size:`lg`,variant:e?`default`:`ghost`,className:e?`yuri-welcome-primary w-full`:`w-full`,disabled:O,onClick:()=>void P(),children:[(0,$.jsx)(X,{name:p?`loader-4`:`scan-2`,className:p?`size-5 animate-spin motion-reduce:animate-none`:`size-5`}),t(`mobile.connect.scanQr`)]}),R=t(a?a.reason===`pairing`?`mobile.connect.pairing.expired`:`mobile.connect.password.label`:s===`rename`?`mobile.connect.history.rename`:s===`remove`?`mobile.connect.history.remove`:`mobile.connect.welcome.moreOptions`);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`main`,{className:`yuri-keyboard-fill-screen yuri-mobile-welcome`,inert:k||l,"aria-hidden":k||l||void 0,"data-welcome-paused":k||l||p?`true`:void 0,children:[(0,$.jsx)(`header`,{className:`yuri-welcome-brand`,children:(0,$.jsx)(Si,{className:`block`,width:88})}),(0,$.jsxs)(`div`,{className:`yuri-welcome-content`,children:[(0,$.jsxs)(`div`,{className:`yuri-welcome-intro`,children:[(0,$.jsxs)(`div`,{className:`yuri-welcome-art`,"aria-hidden":`true`,children:[(0,$.jsx)(`span`,{className:`yuri-image-loading yuri-welcome-dots`}),(0,$.jsx)(`div`,{className:`yuri-welcome-logo`,children:(0,$.jsx)(In,{width:144,height:144,className:`size-full`})})]}),(0,$.jsxs)(`div`,{className:`yuri-welcome-copy`,children:[(0,$.jsx)(`h1`,{children:t(E?`mobile.connect.history.welcomeBack`:`mobile.connect.welcome.heading`)}),(0,$.jsx)(`p`,{children:t(`mobile.connect.welcome.pairingHint`)})]})]}),(0,$.jsxs)(`div`,{className:`yuri-welcome-actions flex w-full flex-col gap-3`,children:[E?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(q,{variant:`outline`,className:`yuri-welcome-device`,disabled:O,onClick:j,children:[(0,$.jsx)(X,{name:`computer`,className:`size-7`}),(0,$.jsxs)(`span`,{className:`min-w-0 flex-1 text-left`,children:[(0,$.jsx)(`span`,{className:`block truncate typography-ui-label`,children:E.label}),(0,$.jsx)(`span`,{className:`block typography-small font-normal text-muted-foreground`,children:I(E)})]}),(0,$.jsx)(X,{name:`arrow-right-s`,className:`size-5 text-muted-foreground`})]}),(0,$.jsx)(q,{size:`lg`,className:`yuri-welcome-primary w-full`,disabled:O,onClick:()=>void N(E),children:r&&h===E.id?t(`mobile.connect.connecting`):i&&h===E.id?t(`desktopHostSwitcher.actions.retry`):t(`mobile.connect.history.continue`)})]}):null,o?L(!E):E?null:(0,$.jsx)(q,{size:`lg`,className:`yuri-welcome-primary w-full`,disabled:O,onClick:()=>A(`more`),children:t(`mobile.connect.link.useLink`)}),i&&!k&&!l?(0,$.jsx)(`p`,{role:`alert`,className:`typography-small text-[var(--status-error)]`,children:i}):null,(0,$.jsx)(q,{variant:`ghost`,size:`lg`,disabled:O,className:`mx-auto text-muted-foreground`,onClick:()=>A(`more`),children:t(`mobile.connect.welcome.moreOptions`)})]})]})]}),(0,$.jsxs)(pt,{id:`welcome-history`,open:l,onOpenChange:u,presentation:`page`,edge:`right`,dismissGesture:!0,ariaLabel:t(`mobile.connect.history.title`),children:[(0,$.jsx)(gn,{title:t(`mobile.connect.history.title`),backAriaLabel:t(`header.actions.backAria`),onBack:()=>u(!1)}),(0,$.jsxs)(dt,{outerClassName:`flex-1`,className:`px-6 py-6`,disableHorizontal:!0,children:[(0,$.jsx)(`h1`,{className:`typography-h1 mb-3`,children:t(`mobile.connect.history.title`)}),(0,$.jsx)(`p`,{className:`mb-6 typography-ui-label font-normal text-muted-foreground`,children:t(n.length?`mobile.connect.history.description`:`mobile.connect.saved.empty`)}),n.map(e=>(0,$.jsx)(`div`,{className:`border-b border-border/60 py-3`,children:(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsxs)(q,{variant:`ghost`,className:`yuri-welcome-history-row min-w-0 flex-1`,disabled:O,onClick:()=>void N(e),children:[(0,$.jsx)(X,{name:r&&h===e.id&&!k?`loader-4`:`computer`,className:r&&h===e.id&&!k?`size-7 animate-spin motion-reduce:animate-none`:`size-7`}),(0,$.jsxs)(`span`,{className:`min-w-0 flex-1 text-left`,children:[(0,$.jsx)(`span`,{className:`block truncate typography-ui-label`,children:e.label}),(0,$.jsx)(`span`,{className:`block typography-small font-normal text-muted-foreground`,children:I(e)})]})]}),i&&h===e.id&&!k&&!r?(0,$.jsx)(q,{variant:`ghost`,size:`icon`,disabled:O,"aria-label":t(`desktopHostSwitcher.actions.retry`),onClick:()=>void N(e),children:(0,$.jsx)(X,{name:`error-warning-fill`,className:`size-5 text-[var(--status-error)]`})}):null,(0,$.jsxs)(jt,{open:d===e.id,onOpenChange:t=>f(t?e.id:null),children:[(0,$.jsx)(Ot,{asChild:!0,children:(0,$.jsx)(q,{variant:`ghost`,size:`icon`,disabled:O,"aria-label":t(`mobile.connect.history.actions`,{name:e.label}),children:(0,$.jsx)(X,{name:`more`,className:`size-5`})})}),(0,$.jsxs)(kt,{align:`end`,children:[(0,$.jsxs)(At,{onSelect:()=>{y(e.id),x(e.label),A(`rename`)},children:[(0,$.jsx)(X,{name:`edit`,className:`size-4`}),t(`mobile.connect.history.rename`)]}),(0,$.jsxs)(At,{onSelect:()=>{y(e.id),A(`remove`)},className:`text-[var(--status-error)]`,children:[(0,$.jsx)(X,{name:`delete-bin`,className:`size-4 text-inherit`}),t(`mobile.connect.history.remove`)]})]})]})]})},e.id)),i&&!h&&!k?(0,$.jsx)(`p`,{role:`alert`,className:`typography-small text-[var(--status-error)]`,children:i}):null]}),(0,$.jsxs)(`div`,{className:`yuri-welcome-history-footer`,children:[(0,$.jsx)(In,{width:36,height:36,className:`mx-auto mb-5 opacity-40`}),o?L(!1):null,(0,$.jsx)(q,{variant:`ghost`,size:`lg`,className:`w-full`,disabled:O,onClick:()=>A(`more`),children:t(`mobile.connect.link.useLink`)})]})]}),(0,$.jsx)(mt,{id:`welcome-options`,open:k,onOpenChange:e=>{e||M()},fitContent:!0,title:(0,$.jsx)(`h2`,{className:`truncate typography-ui-label font-semibold`,children:R}),ariaLabel:R,closeAriaLabel:t(`mobile.surface.closeAria`),resizeAriaLabel:t(`mobile.connect.options.resize`),children:(0,$.jsx)(dt,{className:`px-5 py-5`,disableHorizontal:!0,fillContainer:!1,children:a?.reason===`pairing`?(0,$.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,$.jsx)(X,{name:`computer`,className:`size-6 shrink-0 text-muted-foreground`}),(0,$.jsx)(`p`,{className:`min-w-0 flex-1 truncate typography-ui-label`,children:a.label}),n.some(e=>e.id===a.id)?(0,$.jsx)(q,{variant:`ghost`,size:`icon`,disabled:O,"aria-label":t(`mobile.instances.deleteAria`,{label:a.label}),onClick:()=>{y(a.id),e.cancelPassword(),A(`remove`)},children:(0,$.jsx)(X,{name:`delete-bin`,className:`size-5`})}):null]}),(0,$.jsx)(`p`,{className:`typography-small text-muted-foreground`,children:t(`mobile.connect.pairing.reconnectHint`)}),i?(0,$.jsx)(`p`,{role:`alert`,className:`typography-small text-[var(--status-error)]`,children:i}):null,o?L(!0):null,(0,$.jsx)(q,{variant:o?`ghost`:`default`,size:`lg`,disabled:O,onClick:()=>{e.cancelPassword(),A(`more`)},children:t(`mobile.connect.link.useLink`)})]}):a?(0,$.jsxs)(`form`,{className:`flex flex-col gap-4`,onSubmit:t=>{t.preventDefault(),r||e.submitPassword(S)},children:[(0,$.jsx)(`p`,{className:`truncate typography-ui-label`,children:a.label}),(0,$.jsx)(Jt,{type:`password`,autoComplete:`current-password`,value:S,onChange:e=>C(e.target.value),"aria-label":t(`mobile.connect.password.label`),placeholder:t(`mobile.connect.password.placeholder`),disabled:r}),i?(0,$.jsx)(`p`,{role:`alert`,className:`typography-small text-[var(--status-error)]`,children:i}):null,(0,$.jsx)(q,{type:`submit`,size:`lg`,className:`yuri-welcome-primary w-full`,disabled:r||!S.trim(),children:t(r?`mobile.connect.connecting`:`mobile.connect.unlockButton`)}),(0,$.jsx)(q,{variant:`ghost`,disabled:r,onClick:M,children:t(`mobile.connect.cancelPassword`)})]}):s===`rename`&&D?(0,$.jsxs)(`form`,{className:`flex flex-col gap-4`,onSubmit:t=>{t.preventDefault(),e.renameConnection(D.id,b).then(e=>{e&&c(null)})},children:[(0,$.jsx)(Jt,{value:b,onChange:e=>x(e.target.value),disabled:r,"aria-label":t(`mobile.instances.label.label`),autoComplete:`off`,maxLength:120}),i?(0,$.jsx)(`p`,{role:`alert`,className:`typography-small text-[var(--status-error)]`,children:i}):null,(0,$.jsx)(q,{type:`submit`,size:`lg`,disabled:r||!b.trim(),children:t(`mobile.instances.saveEdit`)})]}):s===`remove`&&D?(0,$.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,$.jsx)(`p`,{className:`typography-ui-label font-normal`,children:t(`mobile.connect.history.removeHint`,{name:D.label})}),i?(0,$.jsx)(`p`,{role:`alert`,className:`typography-small text-[var(--status-error)]`,children:i}):null,(0,$.jsx)(q,{variant:`destructive`,size:`lg`,disabled:r,onClick:()=>{e.removeConnection(D.id).then(e=>{e&&(c(null),_(null))})},children:t(`mobile.connect.history.remove`)}),(0,$.jsx)(q,{variant:`ghost`,disabled:r,onClick:M,children:t(`mobile.instances.cancelEdit`)})]}):(0,$.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h3`,{className:`typography-ui-header mb-2`,children:t(`mobile.connect.link.useLink`)}),(0,$.jsx)(`p`,{className:`typography-small text-muted-foreground`,children:t(`mobile.connect.link.help`)})]}),(0,$.jsx)(uo,{value:w,onValueChange:t=>{T(t),e.setError(null)},showPasteButton:!0,inputClassName:`min-w-0 flex-1 text-[16px]`,buttonClassName:`yuri-welcome-primary w-full`,buttonVariant:`default`,disabled:O,isBusy:r,error:i,onInvalid:()=>e.setError(t(`mobile.connect.link.invalid`)),onRedeem:t=>{_(null),e.redeemPairingConnection(t)}}),(0,$.jsxs)(q,{variant:`outline`,className:`yuri-welcome-history-row`,disabled:O,onClick:j,children:[(0,$.jsx)(X,{name:`history`,className:`size-6`}),(0,$.jsx)(`span`,{className:`flex-1 text-left`,children:t(`mobile.connect.history.title`)}),(0,$.jsx)(X,{name:`arrow-right-s`,className:`size-5`})]}),(0,$.jsx)(`p`,{className:`typography-small leading-relaxed text-muted-foreground`,children:t(`mobile.connect.welcome.scanHint`)})]})})})]})}function po(e){let t=(0,Q.c)(17),{children:n}=e,r=U(go),i=U(ho),a=Z.useRef(null),o=Z.useRef(null),s;t[0]===i?s=t[1]:(s=()=>i(!1),t[0]=i,t[1]=s);let c;t[2]!==r||t[3]!==s?(c={id:`mobile-global-search`,active:r,onBack:s,surfaceRef:a,underlayRef:o},t[2]=r,t[3]=s,t[4]=c):c=t[4],Vt(c);let l,u;t[5]===r?(l=t[6],u=t[7]):(l=()=>{if(!r)return;let e=document.activeElement,t=Zt(`global-search-page`);return()=>{t(),e instanceof HTMLElement&&e.isConnected&&e.focus({preventScroll:!0})}},u=[r],t[5]=r,t[6]=l,t[7]=u),Z.useLayoutEffect(l,u);let d=r||void 0,f=r||void 0,p;t[8]!==n||t[9]!==d||t[10]!==f?(p=(0,$.jsx)(`div`,{ref:o,inert:d,"aria-hidden":f,className:`h-full min-h-0 w-full`,children:n}),t[8]=n,t[9]=d,t[10]=f,t[11]=p):p=t[11];let m;t[12]===r?m=t[13]:(m=r?(0,$.jsx)(`div`,{ref:a,"data-mobile-search-page":`true`,className:`absolute inset-0 z-50 flex min-h-0 flex-col overflow-hidden bg-background`,"data-page-scroll-lock":`true`,children:(0,$.jsx)(pr,{presentation:`page`,onBack:mo})}):null,t[12]=r,t[13]=m);let h;return t[14]!==p||t[15]!==m?(h=(0,$.jsxs)(`div`,{className:`relative isolate flex h-[100dvh] min-h-0 w-full flex-col overflow-hidden bg-background`,"data-page-scroll-lock":`true`,children:[p,m]}),t[14]=p,t[15]=m,t[16]=h):h=t[16],h}function mo(){Wt.requestAnimatedBack(`root`)}function ho(e){return e.setCommandPaletteOpen}function go(e){return e.isCommandPaletteOpen}async function _o(e,t,n,i){if(i){let r=await Ni(i,e,n);if(!ee(e))return r;if(!t)throw Error(`unsupported_host`);let a=new URL(r.src,`http://runtime.invalid`);return{...r,src:`${t}${a.pathname}${a.search}${a.hash}`}}let a=d(),o=()=>{if(n.aborted||a!==d())throw new DOMException(`Preview ended`,`AbortError`)};o();let s=new URL(e);if(![`http:`,`https:`].includes(s.protocol)||s.username||s.password)throw Error(`invalid_url`);if(!ee(e))return{src:s.href};if(!t)throw Error(`unsupported_host`);let l=await m(`/api/preview/targets`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({url:s.href}),signal:n});if(!l.ok)throw Error(`preview_unavailable`);let u=await l.json();if(o(),typeof u.proxyBasePath!=`string`||!/^\/api\/preview\/proxy\/[a-f0-9]{16,64}$/i.test(u.proxyBasePath)||!qt(`${u.proxyBasePath}${s.pathname}`)||typeof u.previewToken!=`string`||!u.previewToken||typeof u.expiresAt!=`number`||!Number.isFinite(u.expiresAt)||u.expiresAt<=Date.now())throw Error(`invalid_preview`);await r(),o();let f=new URLSearchParams(s.search);f.delete(`yuri_client_token`),f.delete(`yuri_url_token`),f.set(`yuri_preview_token`,u.previewToken);let p=`${u.proxyBasePath}${s.pathname}?${f}${s.hash}`,h=new URL(c().authenticatedAsset(p),`http://runtime.invalid`);return{src:`${t}${h.pathname}${h.search}${h.hash}`,expiresAt:u.expiresAt}}function vo({url:e,hostOrigin:t,entry:n}){let{t:r}=ot(),i=Z.useRef(null),[s,c]=Z.useReducer(e=>e+1,0),l=n?JSON.stringify(n.queryScope):`local`,[u,d]=Z.useState();Z.useEffect(()=>{let r=new AbortController,i,c=0,u=async()=>{let a=++c;clearTimeout(i);try{let o=await _o(e,t,r.signal,n);if(r.signal.aborted||a!==c)return;d({url:e,hostOrigin:t,scope:l,attempt:s,src:o.src}),o.expiresAt&&(i=setTimeout(()=>{u()},Math.max(1e3,o.expiresAt-Date.now()-1e4)))}catch{!r.signal.aborted&&a===c&&d({url:e,hostOrigin:t,scope:l,attempt:s,error:!0})}},f=ee(e),p=f?a():void 0,m=f?o(()=>{u()}):void 0;return u(),()=>{r.abort(),clearTimeout(i),m?.(),p?.()}},[e,t,s,n,l]);let f=u?.url===e&&u.hostOrigin===t&&u.scope===l&&u.attempt===s?u:void 0;return L(`message`,t=>{if(!f?.src||!ee(e)||t.source!==i.current?.contentWindow||t.origin!==new URL(f.src).origin)return;let r=t.data;r?.source===`yuri-preview-bridge`&&r.version===1&&r.type===`navigate-preview`&&typeof r.url==`string`&&re.getState().open(r.url,n?.location)}),f?.error?(0,$.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-3`,children:[(0,$.jsx)(Gt,{message:r(`contextPanel.preview.proxyError`)}),(0,$.jsx)(q,{size:`sm`,onClick:c,children:r(`contextPanel.preview.actions.retry`)})]}):f?.src?(0,$.jsx)(`iframe`,{ref:i,src:f.src,title:r(`contextPanel.preview.iframeTitle`),onError:()=>d({url:e,hostOrigin:t,scope:l,attempt:s,error:!0}),className:`h-full w-full border-0`,sandbox:`allow-scripts allow-same-origin allow-forms`}):(0,$.jsx)(`div`,{className:`flex h-full items-center justify-center text-muted-foreground`,children:r(`contextPanel.preview.loading`)})}function yo(e){let t=(0,Q.c)(10),{location:n,url:r,hostOrigin:i}=e,{t:a}=ot(),o=rt(!0);if(!o.registry||o.registry.hubId!==n.hubId){let e;return t[0]!==o.error||t[1]!==a?(e=o.error?(0,$.jsx)(Gt,{message:o.error.message}):(0,$.jsx)(`div`,{className:`text-muted-foreground`,children:a(`contextPanel.preview.loading`)}),t[0]=o.error,t[1]=a,t[2]=e):e=t[2],e}let s;t[3]!==n||t[4]!==o.registry?(s=o.registry.resolve(n),t[3]=n,t[4]=o.registry,t[5]=s):s=t[5];let c;return t[6]!==i||t[7]!==s||t[8]!==r?(c=(0,$.jsx)(vo,{url:r,hostOrigin:i,entry:s}),t[6]=i,t[7]=s,t[8]=r,t[9]=c):c=t[9],c}function bo(){let e=(0,Q.c)(17),{t}=ot(),n=re(So),r=P(),i=Z.useSyncExternalStore(s,d,d),a=n?.generation===i?n:null,o=!!a,c;e[0]===t?c=e[1]:(c=t(`contextPanel.preview.iframeTitle`),e[0]=t,e[1]=c);let l;e[2]===t?l=e[3]:(l=t(`guiPlugins.close`),e[2]=t,e[3]=l);let u;e[4]===t?u=e[5]:(u=t(`guiPlugins.resize`),e[4]=t,e[5]=u);let f=a?.url??``,p;e[6]!==a||e[7]!==i||e[8]!==r?(p=a?(0,$.jsx)(Kt,{children:e=>a.location?.hostId?r?.entry.location.hubId===a.location.hubId&&r.entry.location.hostId===a.location.hostId&&r.entry.location.directory===a.location.directory?(0,$.jsx)(vo,{url:a.url,hostOrigin:e?.hostOrigin,entry:r.entry}):(0,$.jsx)(yo,{location:a.location,url:a.url,hostOrigin:e?.hostOrigin}):(0,$.jsx)(vo,{url:a.url,hostOrigin:e?.hostOrigin})},i):null,e[6]=a,e[7]=i,e[8]=r,e[9]=p):p=e[9];let m;return e[10]!==o||e[11]!==c||e[12]!==l||e[13]!==u||e[14]!==f||e[15]!==p?(m=(0,$.jsx)(mt,{id:`mobile-html-preview`,open:o,ariaLabel:c,closeAriaLabel:l,resizeAriaLabel:u,initiallyExpanded:!0,title:f,onOpenChange:xo,children:p}),e[10]=o,e[11]=c,e[12]=l,e[13]=u,e[14]=f,e[15]=p,e[16]=m):m=e[16],m}function xo(e){e||re.getState().close()}function So(e){return e.target}function Co(){let e=ae(e=>e.projects.find(t=>t.id===e.activeProjectId)),t=Ce(e=>e.remoteSession),n=!!e?.hostId,r=et(),i=rt(n&&r),a=r&&i.catalog?.supported!==!1,o=Z.useMemo(()=>e?.hubId&&e.hostId?{supported:!0,hubId:e.hubId,projects:[],hosts:[{id:e.hostId,name:e.hostId,source:`direct`,state:`offline`}]}:void 0,[e?.hubId,e?.hostId]),s=n&&a?i.registry??(o?nt(o):void 0):void 0,c=e?.hostId,l=Z.useMemo(()=>e=>s&&c?s.subscribeHost(c,e):()=>{},[s,c]),u=Z.useMemo(()=>()=>s&&c?s.getHost(c):void 0,[s,c]),d=Z.useSyncExternalStore(l,u,u),f=t?.projectId===e?.id&&t?.location.hostId===c&&t?.location.hubId===(e?.hubId??s?.hubId),p=Z.useMemo(()=>s&&c&&e&&(!e.hubId||s.hubId===e.hubId)?{hubId:s.hubId,hostId:c,directory:f&&t?t.location.directory:e.path}:void 0,[s,c,e,f,t]),m=p&&s?s.resolve(p):void 0,[h,g]=Z.useState();Z.useEffect(()=>{if(!s||!m)return;let e=Xe(s,m),t=e.retain();return g({entry:m,owner:e}),t},[s,m]);let _=h?.entry===m?h?.owner:void 0,y=f?t?.sessionId??null:null,b=Z.useMemo(()=>e=>_?_.state.subscribeSnapshot(e):()=>{},[_]),x=Z.useMemo(()=>()=>_&&y?_.state.getSnapshot(y).session:void 0,[_,y]),S=Z.useSyncExternalStore(b,x,x),C=it(s,c,n&&a);return{enabled:n,supported:a,project:e,registry:s,entry:m,owner:_,sessionId:y,session:S??C.data?.directories.find(e=>e.directory===p?.directory)?.sessions.find(e=>e.id===y),host:d,openSession:z(t=>{if(!e?.hostId||!p)throw Error(`Remote Host scope unavailable`);Ce.getState().openRemoteSession(e,p,t)}),refresh:z(async()=>{if(!_||!y)throw Error(`Remote session unavailable`);await _.state.repository.refreshFromAuthority(_.state.scope(y))}),key:p?v(p):e?.id??``,error:i.error}}var wo=e=>{let t=(0,Q.c)(20),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({children:n,className:r,contentClassName:i,style:o,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s;t[6]===r?s=t[7]:(s=J(`yuri-mobile-header relative z-30 shrink-0 border-b border-border/30 bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/80`,r),t[6]=r,t[7]=s);let c;t[8]===o?c=t[9]:(c={paddingTop:`var(--yuri-safe-area-top, 0px)`,...o},t[8]=o,t[9]=c);let l;t[10]===i?l=t[11]:(l=J(`flex h-[var(--yuri-header-height,56px)] w-full items-center gap-1 px-2`,i),t[10]=i,t[11]=l);let u;t[12]!==n||t[13]!==l?(u=(0,$.jsx)(`div`,{className:l,children:n}),t[12]=n,t[13]=l,t[14]=u):u=t[14];let d;return t[15]!==a||t[16]!==s||t[17]!==c||t[18]!==u?(d=(0,$.jsx)(`header`,{className:s,style:c,...a,children:u}),t[15]=a,t[16]=s,t[17]=c,t[18]=u,t[19]=d):d=t[19],d};function To(e){let t=(0,Q.c)(17),{scope:n,children:r}=e,{t:i}=ot();if(!n.supported){let e;t[0]===i?e=t[1]:(e=i(`remoteProjects.unsupported`),t[0]=i,t[1]=e);let n;return t[2]===e?n=t[3]:(n=(0,$.jsx)(`div`,{role:`status`,children:e}),t[2]=e,t[3]=n),n}if(!n.registry||!n.entry||!n.owner){let e=n.error?`alert`:`status`,r;t[4]!==n.error?.message||t[5]!==i?(r=n.error?.message??i(`remoteProjects.state.connecting`),t[4]=n.error?.message,t[5]=i,t[6]=r):r=t[6];let a;return t[7]!==e||t[8]!==r?(a=(0,$.jsx)(`div`,{role:e,children:r}),t[7]=e,t[8]=r,t[9]=a):a=t[9],a}let a;t[10]!==r||t[11]!==n.owner.state?(a=(0,$.jsx)(Be.Provider,{value:n.owner.state,children:r}),t[10]=r,t[11]=n.owner.state,t[12]=a):a=t[12];let o;return t[13]!==n.entry.location||t[14]!==n.registry||t[15]!==a?(o=(0,$.jsx)(I,{registry:n.registry,location:n.entry.location,children:a}),t[13]=n.entry.location,t[14]=n.registry,t[15]=a,t[16]=o):o=t[16],o}function Eo(e){let t=(0,Q.c)(58),{scope:n,onOpenSessions:r,menuOpen:i,onToggleMenu:a,surfaceShortcuts:o}=e,{t:s}=ot(),[c,l]=Z.useState(!1),u;t[0]===r?u=t[1]:(u=()=>{l(!1),r()},t[0]=r,t[1]=u);let d=z(u),f;t[2]===a?f=t[3]:(f=()=>{l(!1),a()},t[2]=a,t[3]=f);let p=z(f),m;t[4]!==i||t[5]!==a?(m=e=>{e&&i&&a(),l(e)},t[4]=i,t[5]=a,t[6]=m):m=t[6];let h=z(m),g;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(g=()=>l(!1),t[7]=g):g=t[7];let _;t[8]!==n.key||t[9]!==n.sessionId?(_=[n.key,n.sessionId],t[8]=n.key,t[9]=n.sessionId,t[10]=_):_=t[10],Z.useEffect(g,_);let v;t[11]!==n.project?.label||t[12]!==n.project?.path||t[13]!==s?(v=n.project?.label?.trim()||n.project?.path.split(/[\\/]/).filter(Boolean).at(-1)||s(`mobile.header.noProject`),t[11]=n.project?.label,t[12]=n.project?.path,t[13]=s,t[14]=v):v=t[14];let y=v,b;t[15]===s?b=t[16]:(b=s(`mobile.sessions.openSheetAria`),t[15]=s,t[16]=b);let x;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,$.jsx)(X,{name:`folders`,className:`size-5`}),t[17]=x):x=t[17];let S;t[18]!==d||t[19]!==b?(S=(0,$.jsx)(q,{variant:`ghost`,size:`icon`,"aria-label":b,onClick:d,children:x}),t[18]=d,t[19]=b,t[20]=S):S=t[20];let C;t[21]!==y||t[22]!==n.session?.title||t[23]!==n.sessionId||t[24]!==s?(C=n.session?.title?.trim()||(n.sessionId?s(`mobile.sessions.untitled`):y),t[21]=y,t[22]=n.session?.title,t[23]=n.sessionId,t[24]=s,t[25]=C):C=t[25];let w;t[26]===C?w=t[27]:(w=(0,$.jsx)(`span`,{className:`truncate typography-ui-label text-foreground`,children:C}),t[26]=C,t[27]=w);let T;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,$.jsx)(X,{name:`computer`,className:`size-3 shrink-0`}),t[28]=T):T=t[28];let E=n.sessionId?`${y} · `:``,D=n.host?.name??n.entry?.location.hostId,O;t[29]!==E||t[30]!==D?(O=(0,$.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-1 typography-micro text-muted-foreground`,children:[T,(0,$.jsxs)(`span`,{className:`truncate`,children:[E,D]})]}),t[29]=E,t[30]=D,t[31]=O):O=t[31];let k;t[32]!==w||t[33]!==O?(k=(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col px-2 py-1.5 text-left leading-tight`,children:[w,O]}),t[32]=w,t[33]=O,t[34]=k):k=t[34];let A=n.sessionId??``,j;t[35]!==c||t[36]!==h||t[37]!==A?(j=(0,$.jsx)(zi,{sessionId:A,open:c,onOpenChange:h}),t[35]=c,t[36]=h,t[37]=A,t[38]=j):j=t[38];let M;t[39]!==o||t[40]!==s?(M=o?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(q,{variant:`ghost`,size:`icon`,"aria-label":s(`mobile.menu.files`),"aria-pressed":o.activePanel===`files`,onClick:o.onToggleFiles,children:(0,$.jsx)(X,{name:`file-text`,className:`size-5`})}),(0,$.jsxs)(q,{variant:`ghost`,size:`icon`,className:`relative`,"aria-label":s(`mobile.menu.changes`),"aria-pressed":o.activePanel===`changes`,onClick:o.onToggleChanges,children:[(0,$.jsx)(X,{name:`git-branch`,className:`size-5`}),o.changesDirty?(0,$.jsx)(`span`,{className:`absolute right-2 top-2 size-2 rounded-full bg-primary`,"aria-hidden":!0}):null]})]}):null,t[39]=o,t[40]=s,t[41]=M):M=t[41];let N;t[42]===s?N=t[43]:(N=s(`mobile.header.openMenuAria`),t[42]=s,t[43]=N);let P;t[44]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,$.jsx)(X,{name:`more-2`,className:`size-5`}),t[44]=P):P=t[44];let F;t[45]!==p||t[46]!==i||t[47]!==N?(F=(0,$.jsx)(q,{variant:`ghost`,size:`icon`,"aria-label":N,"aria-controls":`mobile-overflow-menu`,"aria-expanded":i,"aria-haspopup":`menu`,onClick:p,children:P}),t[45]=p,t[46]=i,t[47]=N,t[48]=F):F=t[48];let I;t[49]!==k||t[50]!==j||t[51]!==M||t[52]!==F||t[53]!==S?(I=(0,$.jsxs)(wo,{children:[S,k,j,M,F]}),t[49]=k,t[50]=j,t[51]=M,t[52]=F,t[53]=S,t[54]=I):I=t[54];let L;return t[55]!==n||t[56]!==I?(L=(0,$.jsx)(To,{scope:n,children:I}),t[55]=n,t[56]=I,t[57]=L):L=t[57],L}var Do=`yuri:assistant-share-welcome:v1`,Oo=[{image:Hi,titleKey:`assistants.shareWelcome.example.chat.title`,descriptionKey:`assistants.shareWelcome.example.chat.description`},{image:Ui,titleKey:`assistants.shareWelcome.example.article.title`,descriptionKey:`assistants.shareWelcome.example.article.description`},{image:Wi,titleKey:`assistants.shareWelcome.example.note.title`,descriptionKey:`assistants.shareWelcome.example.note.description`}],ko=e=>{let t=(0,Q.c)(40),{enabled:n,open:r,onOpenChange:i}=e,a=n!==void 0&&n,{t:o}=ot(),[s,c]=R(Do,!1),l=r!==void 0,u=l?r:a&&s!==!0,d;t[0]!==l||t[1]!==i||t[2]!==c?(d=()=>{l||c(!0),i?.(!1)},t[0]=l,t[1]=i,t[2]=c,t[3]=d):d=t[3];let f=z(d),p;t[4]!==f||t[5]!==i?(p=e=>{e?i?.(!0):f()},t[4]=f,t[5]=i,t[6]=p):p=t[6];let m;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,$.jsx)(`div`,{className:`flex size-10 shrink-0 items-center justify-center rounded-xl bg-interactive-selection text-interactive-selection-foreground sm:size-12`,children:(0,$.jsx)(X,{name:`share-2`,className:`size-5`})}),t[7]=m):m=t[7];let h;t[8]===o?h=t[9]:(h=o(`assistants.shareWelcome.title`),t[8]=o,t[9]=h);let g;t[10]===h?g=t[11]:(g=(0,$.jsx)(xt,{className:`typography-ui-header text-left sm:text-3xl`,children:h}),t[10]=h,t[11]=g);let _;t[12]===o?_=t[13]:(_=o(`assistants.shareWelcome.description`),t[12]=o,t[13]=_);let v;t[14]===_?v=t[15]:(v=(0,$.jsx)(St,{className:`typography-ui text-left leading-6 sm:max-w-3xl sm:text-base sm:leading-7`,children:_}),t[14]=_,t[15]=v);let y;t[16]!==g||t[17]!==v?(y=(0,$.jsxs)(vt,{className:`flex-row items-start gap-3 px-5 pb-5 pt-6 text-left sm:gap-4 sm:px-8 sm:pb-6 sm:pt-8`,children:[m,(0,$.jsxs)(`div`,{className:`min-w-0 space-y-1.5 sm:space-y-2`,children:[g,v]})]}),t[16]=g,t[17]=v,t[18]=y):y=t[18];let b;t[19]===o?b=t[20]:(b=o(`assistants.shareWelcome.examplesAria`),t[19]=o,t[20]=b);let x;t[21]===o?x=t[22]:(x=Oo.map((e,t)=>(0,$.jsxs)(`article`,{className:`w-[min(78vw,19rem)] shrink-0 snap-center overflow-hidden rounded-xl border border-border bg-background lg:w-auto lg:min-w-0`,children:[(0,$.jsxs)(`div`,{className:`relative overflow-hidden border-b border-border bg-muted`,children:[(0,$.jsx)(`img`,{src:e.image,alt:``,className:`h-72 w-full object-cover object-bottom lg:h-[min(38vh,23rem)]`}),(0,$.jsx)(`span`,{"aria-hidden":`true`,className:`absolute left-3 top-3 flex size-7 items-center justify-center rounded-full bg-[var(--surface-elevated)] typography-meta font-semibold text-foreground shadow-sm`,children:t+1})]}),(0,$.jsxs)(`div`,{className:`space-y-1 px-4 py-3.5 lg:min-h-25`,children:[(0,$.jsx)(`h2`,{className:`typography-ui-label font-semibold text-foreground`,children:o(e.titleKey)}),(0,$.jsx)(`p`,{className:`typography-meta leading-5 text-muted-foreground`,children:o(e.descriptionKey)})]})]},e.titleKey)),t[21]=o,t[22]=x);let S;t[23]!==b||t[24]!==x?(S=(0,$.jsx)(`div`,{className:`overflow-hidden px-5 pb-5 sm:px-8 sm:pb-7`,children:(0,$.jsx)(`div`,{className:`flex snap-x snap-mandatory gap-3 overflow-x-auto pb-2 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden lg:grid lg:grid-cols-3 lg:overflow-visible lg:pb-0`,"aria-label":b,children:x})}),t[23]=b,t[24]=x,t[25]=S):S=t[25];let C;t[26]===o?C=t[27]:(C=o(`assistants.shareWelcome.action`),t[26]=o,t[27]=C);let w;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,$.jsx)(X,{name:`arrow-right-s`,className:`size-4`}),t[28]=w):w=t[28];let T;t[29]!==f||t[30]!==C?(T=(0,$.jsx)(yt,{className:`border-t border-border px-5 py-4 sm:px-8 sm:py-5`,children:(0,$.jsxs)(q,{size:`lg`,className:`w-full lg:mx-auto lg:w-72`,onClick:f,children:[C,w]})}),t[29]=f,t[30]=C,t[31]=T):T=t[31];let E;t[32]!==S||t[33]!==T||t[34]!==y?(E=(0,$.jsxs)(bt,{showCloseButton:!1,className:`w-[min(100%,31rem)] max-w-none gap-0 overflow-hidden rounded-2xl border-border bg-[var(--surface-elevated)] p-0 sm:w-[min(calc(100%-3rem),44rem)] lg:w-[min(calc(100%-4rem),74rem)]`,containerClassName:`fixed inset-0 z-50 flex items-end justify-center px-0 pt-8 sm:items-center sm:p-6`,children:[y,S,T]}),t[32]=S,t[33]=T,t[34]=y,t[35]=E):E=t[35];let D;return t[36]!==u||t[37]!==E||t[38]!==p?(D=(0,$.jsx)(Ct,{open:u,onOpenChange:p,children:E}),t[36]=u,t[37]=E,t[38]=p,t[39]=D):D=t[39],D},Ao=B(`YuriNativeHeader`),jo=`header.yuri-mobile-detail-navigation, header.yuri-mobile-header`,Mo=`yuri-native-header-source`,No=`yuri-native-header-ready`,Po=new Set([No,`yuri-keyboard-open`,`yuri-kb-animating`,`yuri-kb-hide`,`yuri-kb-caret-hold`]),Fo=`--yuri-native-viewport-top`,Io=`.fixed, [role="dialog"]`,Lo=new Set([`style`,`data-yuri-header-collapse-phase`,`data-yuri-header-collapse-rest`]),Ro=()=>parseFloat(document.documentElement.style.getPropertyValue(`--yuri-native-viewport-top`))||0,zo=`[data-avatar-motion]`,Bo=new Set([`class`,`style`,`inert`,`aria-hidden`,`hidden`]),Vo=e=>{if(e.querySelector(`input, textarea, select, [contenteditable]:not([contenteditable="false"])`)||e.getClientRects().length===0||e.offsetHeight<=0||e.closest(`[inert],[aria-hidden="true"]`))return!1;let t=e.parentElement;if(!t||(typeof t.checkVisibility==`function`?!t.checkVisibility({visibilityProperty:!0,contentVisibilityAuto:!0,opacityProperty:!0}):getComputedStyle(t).visibility===`hidden`))return!1;let n=e.getBoundingClientRect().top-Ro();return e.dataset.yuriCollapsibleHeader===`true`||Math.abs(n)<=1},Ho=(e,t)=>{let n=[...document.querySelectorAll(jo)].filter(Vo);if(t&&e&&n.includes(e))return e;for(let e of n){let t=e.getBoundingClientRect(),n=document.elementFromPoint(t.left+t.width/2,t.bottom-4);if(n&&e.contains(n))return e}return n.at(-1)??null},Uo=()=>{let e=[];for(let t of document.styleSheets)try{for(let n of t.cssRules)e.push(n.cssText)}catch{}return e.join(`
3
+ `)},Wo=()=>{let e=0;for(let t of document.styleSheets)try{e+=t.cssRules.length}catch{}return`${document.styleSheets.length}:${e}`},Go=Ao,Ko=()=>new Promise(e=>{requestAnimationFrame(()=>requestAnimationFrame(()=>e(1)))});function qo(){let e=document.documentElement,t=window,n=!1,r=0,i=0,a=null,o=``,s=``,c=``,l=``,u=!1,d=!1,f=[],p=()=>{if(!a)return;let e=parseFloat(a.style.getPropertyValue(`--yuri-mobile-header-collapse`))||0,n=a.dataset.yuriHeaderCollapsePhase??`rest`,r=a.dataset.yuriHeaderCollapseRest??`expanded`,i=`${e}|${n}|${r}`;i!==l&&(l=i,t.YuriHeaderCollapse?t.YuriHeaderCollapse.set(e,n,r):t.webkit?.messageHandlers?.yuriHeaderCollapse?.postMessage({progress:e,phase:n,rest:r}))},m=()=>{e.classList.remove(No),u&&(u=!1,o=``,Ao.update({seq:++r,visible:!1}).catch(()=>void 0))},h=()=>{if(i=0,n)return;let t=Ho(a,d);if(t!==a){if(a?.classList.remove(Mo),m(),a=t,l=``,!t)return;t.classList.add(Mo),p()}if(!t)return;let f=window.devicePixelRatio||1,h=t.offsetHeight,g=parseFloat(getComputedStyle(t,`::after`).height)||0,_=Math.ceil(h*f),v=t.querySelector(Io)===null?Math.ceil(Math.max(h,g)*f):_,y=(h+2*(parseFloat(getComputedStyle(e).fontSize)||16))*f,b=t.cloneNode(!0);b.classList.remove(Mo),b.style.removeProperty(Hn),delete b.dataset.yuriHeaderCollapsePhase,delete b.dataset.yuriHeaderCollapseRest;for(let e of b.querySelectorAll(Io))e.style.display=`none`;let x=b.outerHTML,S=[...e.classList].filter(e=>!Po.has(e)).join(` `),C=(e.getAttribute(`style`)??``).replace(RegExp(`${Fo}\\s*:[^;]*;?`,`g`),``),w=document.body.className,T=`${x}|${S}|${C}|${w}|${v}|${y}`,E=Wo(),D=document.getElementById(`yuri-icon-sprite-v2`)?.outerHTML??``;if(T===o&&E===s&&D===c)return;o=T;let O={seq:++r,visible:!0,height:v,hitBottom:_,collapseDistance:y,html:x,rootClass:S,rootStyle:C,bodyClass:w};E!==s&&(s=E,O.css=Uo()),D!==c&&(c=D,O.sprite=D),u=!0,Ao.update(O).catch(()=>void 0)},g=()=>{!i&&!n&&(i=requestAnimationFrame(h))};f.push(Ao.addListener(`shown`,t=>{d&&t.seq===r&&a&&e.classList.add(No)})),f.push(Ao.addListener(`tap`,e=>{if(!a||!d)return;let t=a;try{for(let n of JSON.parse(e.path))t=t?.children[n]??null}catch{return}let n=t?.closest(`button, a, [role="button"]`);if(!n||!a.contains(n))return;let r={bubbles:!0,cancelable:!0,pointerType:`touch`,isPrimary:!0};n.dispatchEvent(new PointerEvent(`pointerdown`,r)),n.dispatchEvent(new PointerEvent(`pointerup`,r)),n.click()}));let _=new MutationObserver(e=>{if(!a||!a.isConnected){g();return}let t=!1;for(let n of e){if(n.target===a&&n.type===`attributes`&&Lo.has(n.attributeName??``)){p();continue}let e=n.target instanceof Element?n.target:n.target.parentElement;if(!(e?.closest(zo)&&a.contains(e))){if(a.contains(n.target)||n.type===`attributes`&&n.target.contains(a))t=!0;else if(n.type===`attributes`&&Bo.has(n.attributeName??``)&&n.target instanceof Element&&n.target.querySelector(jo))t=!0;else if(n.type===`childList`)for(let e of n.addedNodes)e instanceof Element&&(e.matches(jo)||e.querySelector(jo))&&(t=!0)}}t&&g()});_.observe(document.body,{subtree:!0,childList:!0,attributes:!0,characterData:!0});let v=new MutationObserver(g);v.observe(e,{attributes:!0,attributeFilter:[`class`,`style`]});let y=new MutationObserver(()=>{s=``,g()});y.observe(document.head,{childList:!0,subtree:!0,characterData:!0}),window.addEventListener(`resize`,g),g(),t.__yuriImeOffset=t=>(window.dispatchEvent(new Event(`yuri:keyboard-native-layout`)),e.style.setProperty(Fo,`${Math.max(0,t)}px`),Ko());let b=window;return b.__yuriNativeHeader=t=>(d=t,e.classList.toggle(No,t&&a!==null),Ko()),()=>{n=!0,delete b.__yuriNativeHeader,i&&cancelAnimationFrame(i),_.disconnect(),v.disconnect(),y.disconnect(),window.removeEventListener(`resize`,g),delete t.__yuriImeOffset,e.classList.remove(No),a?.classList.remove(Mo),a=null;for(let e of f)e.then(e=>e.remove()).catch(()=>void 0);Ao.update({seq:++r,visible:!1}).catch(()=>void 0)}}var Jo=`.yuri-mobile-composer`,Yo=`[data-btw-composer]`;function Xo(e,t){if(!e)return!1;let n=t;return!n||typeof n.closest!=`function`||!n.closest(Yo)}function Zo(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.closest==`function`&&!!t.closest(Jo)}function Qo(e){return Zo(e??null)}var $o=S(e=>({expandedParents:{},toggleParent:t=>e(e=>{let n={...e.expandedParents};return n[t]?delete n[t]:n[t]=!0,{expandedParents:n}})})),es=36,ts=18,ns=e=>e.parentID??null,rs=e=>(e||``).replace(/\\/g,`/`).replace(/\/+$/g,``),is=e=>{let t=e;return rs(t.directory??t.project?.worktree??null)},as=e=>{let t=rs(e);if(!t)return``;let n=t.split(`/`).filter(Boolean);return n[n.length-1]||t},os=e=>{let t=e.time?.updated??e.time?.created,n=typeof t==`number`?t:Number(t);return Number.isFinite(n)&&n>0?n:0},ss=(e,t)=>e.size===t.size&&[...e].every(e=>t.has(e)),cs=e=>{if(e<=0)return``;let t=Date.now()-e;if(t<6e4)return`now`;let n=Math.floor(t/6e4);if(n<60)return`${n}m`;let r=Math.floor(n/60);if(r<24)return`${r}h`;let i=Math.floor(r/24);return i<7?`${i}d`:new Intl.DateTimeFormat(void 0,{month:`short`,day:`numeric`}).format(new Date(e))},ls=(e,t)=>{let n=rs(e),r=rs(t);return!!(n&&r&&(n===r||n.startsWith(`${r}/`)))},us=(e,t)=>e.worktrees.find(e=>rs(e.path)===t)??null,ds=(e,t)=>t===e.path||!!us(e,t),fs=(e,t)=>{let n=rs(t);return n?e.find(e=>ds(e,n))??null:null},ps=(e,t,n)=>!n||`${e.title??``} ${e.id} ${is(e)} ${t}`.toLowerCase().includes(n),ms=e=>{let t=(0,Q.c)(14),{project:n,size:r}=e,i=r===void 0?`md`:r,a=i===`sm`?`size-6 rounded-md`:`size-8 rounded-lg`,o=i===`sm`?`size-3.5`:`size-4`,s=n.icon?Zn[n.icon]:null,c=n.color?Qn[n.color]:void 0,l=s??`folder-open`,u;t[0]===c?u=t[1]:(u=c?{color:c}:void 0,t[0]=c,t[1]=u);let d;t[2]!==o||t[3]!==l||t[4]!==u?(d=(0,$.jsx)(X,{name:l,className:o,style:u}),t[2]=o,t[3]=l,t[4]=u,t[5]=d):d=t[5];let f=d,p;t[6]===a?p=t[7]:(p=J(`flex shrink-0 items-center justify-center overflow-hidden text-muted-foreground`,a),t[6]=a,t[7]=p);let m;t[8]!==f||t[9]!==n?(m=n.iconImage?(0,$.jsx)(Xn,{project:n,className:`size-full object-contain`,fallback:f}):f,t[8]=f,t[9]=n,t[10]=m):m=t[10];let h;return t[11]!==p||t[12]!==m?(h=(0,$.jsx)(`span`,{className:p,children:m}),t[11]=p,t[12]=m,t[13]=h):h=t[13],h},hs=e=>{let t=(0,Q.c)(5),{expanded:n}=e,r=n?`rotate-0`:`-rotate-90`,i;t[0]===r?i=t[1]:(i=J(`flex size-5 shrink-0 items-center justify-center text-muted-foreground/70 transition-transform duration-150`,r),t[0]=r,t[1]=i);let a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,$.jsx)(X,{name:`arrow-down-s`,className:`size-4`}),t[2]=a):a=t[2];let o;return t[3]===i?o=t[4]:(o=(0,$.jsx)(`span`,{"aria-hidden":!0,className:i,children:a}),t[3]=i,t[4]=o),o},gs=e=>{let t=(0,Q.c)(2),{ariaLabel:n}=e,r;return t[0]===n?r=t[1]:(r=(0,$.jsx)(`span`,{className:`inline-block size-1.5 shrink-0 rounded-full bg-primary`,"aria-label":n}),t[0]=n,t[1]=r),r},_s=e=>{let t=(0,Q.c)(12),{onClick:n,className:r}=e,{t:i}=ot(),a;t[0]===i?a=t[1]:(a=i(`sessions.sidebar.project.actions.newWorktree`),t[0]=i,t[1]=a);let o=a,s;t[2]===r?s=t[3]:(s=J(`flex size-9 shrink-0 items-center justify-center rounded-full text-[var(--surface-mutedForeground)] transition-colors hover:bg-[var(--interactive-hover)] hover:text-[var(--surface-foreground)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--interactive-focus-ring)]`,r),t[2]=r,t[3]=s);let c;t[4]===n?c=t[5]:(c=e=>{e.stopPropagation(),n()},t[4]=n,t[5]=c);let l,u;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(l={touchAction:`manipulation`},u=(0,$.jsx)(X,{name:`node-tree`,className:`size-4`}),t[6]=l,t[7]=u):(l=t[6],u=t[7]);let d;return t[8]!==o||t[9]!==s||t[10]!==c?(d=(0,$.jsx)(`button`,{type:`button`,className:s,"aria-label":o,title:o,onClick:c,style:l,children:u}),t[8]=o,t[9]=s,t[10]=c,t[11]=d):d=t[11],d},vs=e=>{let t=(0,Q.c)(10),{icon:n,label:r,onClick:i,destructive:a}=e,o=a!==void 0&&a?`destructive`:`ghost`,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s={touchAction:`manipulation`},t[0]=s):s=t[0];let c;t[1]===n?c=t[2]:(c=(0,$.jsx)(X,{name:n,className:`size-5 shrink-0 text-inherit`}),t[1]=n,t[2]=c);let l;t[3]===r?l=t[4]:(l=(0,$.jsx)(`span`,{className:`truncate`,children:r}),t[3]=r,t[4]=l);let u;return t[5]!==i||t[6]!==o||t[7]!==c||t[8]!==l?(u=(0,$.jsxs)(q,{type:`button`,variant:o,size:`default`,className:`min-h-12 w-full justify-start gap-3 rounded-xl px-3 typography-ui-label`,onClick:i,style:s,children:[c,l]}),t[5]=i,t[6]=o,t[7]=c,t[8]=l,t[9]=u):u=t[9],u},ys=e=>{let t=(0,Q.c)(107),{session:n,active:r,indent:i,contextLabel:a,confirmingArchive:o,hasChildren:s,expanded:c,onToggleChildren:l,onSelect:u,onRequestArchive:d,onConfirmArchive:f,onStop:p,stopAriaLabel:m,longPressHandlers:h,highlightQuery:g}=e,_=o!==void 0&&o,v=s!==void 0&&s,y=c!==void 0&&c,{t:b}=ot(),x;t[0]===n?x=t[1]:(x=cs(os(n)),t[0]=n,t[1]=x);let S=x,C,w,T,E,D,O,k,A,j,M,N,P,F,I,L,R,z,B;if(t[2]!==r||t[3]!==_||t[4]!==y||t[5]!==v||t[6]!==g||t[7]!==i||t[8]!==h.onContextMenu||t[9]!==h.onPointerCancel||t[10]!==h.onPointerDown||t[11]!==h.onPointerMove||t[12]!==h.onPointerUp||t[13]!==h.pressed||t[14]!==u||t[15]!==l||t[16]!==n.title||t[17]!==b){B=n.title?.trim()||b(`mobile.sessions.untitled`);let e=r&&!_&&`bg-[color-mix(in_srgb,var(--primary)_10%,transparent)]`,a=_&&`bg-[color-mix(in_srgb,var(--destructive)_8%,transparent)]`;t[36]!==e||t[37]!==a?(N=J(`relative flex items-center gap-1 transition-colors`,e,a),t[36]=e,t[37]=a,t[38]=N):N=t[38],t[39]!==y||t[40]!==v||t[41]!==i||t[42]!==l||t[43]!==b?(P=v&&l?(0,$.jsx)(`button`,{type:`button`,className:`absolute z-10 flex w-6 items-center justify-center rounded-md text-muted-foreground/70 transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary`,style:{left:Math.max(i-32,2),top:0,bottom:0,touchAction:`manipulation`},"aria-label":b(y?`sessions.sidebar.session.subsessions.collapse`:`sessions.sidebar.session.subsessions.expand`),onClick:e=>{e.stopPropagation(),l()},children:(0,$.jsx)(X,{name:`arrow-down-s`,className:J(`size-[18px] transition-transform duration-150`,y?`rotate-0`:`-rotate-90`)})}):null,t[39]=y,t[40]=v,t[41]=i,t[42]=l,t[43]=b,t[44]=P):P=t[44],C=`button`;let o=_&&`opacity-50`,s=h.pressed&&`bg-interactive-active scale-[0.99]`;t[45]!==o||t[46]!==s?(w=J(`flex min-h-12 min-w-0 flex-1 items-center gap-2.5 py-2 pr-2 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-inset`,o,s),t[45]=o,t[46]=s,t[47]=w):w=t[47],t[48]===i?T=t[49]:(T={paddingLeft:i,touchAction:`manipulation`},t[48]=i,t[49]=T),E=u,D=h.onPointerDown,O=h.onPointerMove,k=h.onPointerUp,A=h.onPointerCancel,j=h.onContextMenu,M=_,z=`flex min-w-0 flex-1 flex-col`,L=`flex items-center gap-2.5`;let c=r?`bg-primary`:`bg-muted-foreground/30`,d;t[50]===c?d=t[51]:(d=J(`size-1.5 shrink-0 rounded-full`,c),t[50]=c,t[51]=d),t[52]===d?R=t[53]:(R=(0,$.jsx)(`span`,{className:d,"aria-hidden":!0}),t[52]=d,t[53]=R);let f=r?`text-primary`:`text-foreground`;t[54]===f?F=t[55]:(F=J(`block min-w-0 flex-1 truncate typography-ui-label`,f),t[54]=f,t[55]=F),I=g?Fn(B,g):B,t[2]=r,t[3]=_,t[4]=y,t[5]=v,t[6]=g,t[7]=i,t[8]=h.onContextMenu,t[9]=h.onPointerCancel,t[10]=h.onPointerDown,t[11]=h.onPointerMove,t[12]=h.onPointerUp,t[13]=h.pressed,t[14]=u,t[15]=l,t[16]=n.title,t[17]=b,t[18]=C,t[19]=w,t[20]=T,t[21]=E,t[22]=D,t[23]=O,t[24]=k,t[25]=A,t[26]=j,t[27]=M,t[28]=N,t[29]=P,t[30]=F,t[31]=I,t[32]=L,t[33]=R,t[34]=z,t[35]=B}else C=t[18],w=t[19],T=t[20],E=t[21],D=t[22],O=t[23],k=t[24],A=t[25],j=t[26],M=t[27],N=t[28],P=t[29],F=t[30],I=t[31],L=t[32],R=t[33],z=t[34],B=t[35];let V;t[56]!==F||t[57]!==I?(V=(0,$.jsx)(`span`,{className:F,children:I}),t[56]=F,t[57]=I,t[58]=V):V=t[58];let H;t[59]===S?H=t[60]:(H=S?(0,$.jsx)(`span`,{className:`shrink-0 typography-micro text-muted-foreground tabular-nums`,children:S}):null,t[59]=S,t[60]=H);let U;t[61]!==V||t[62]!==H||t[63]!==L||t[64]!==R?(U=(0,$.jsxs)(`span`,{className:L,children:[R,V,H]}),t[61]=V,t[62]=H,t[63]=L,t[64]=R,t[65]=U):U=t[65];let ee;t[66]!==a||t[67]!==g?(ee=a?(0,$.jsx)(`span`,{className:`block truncate typography-micro text-muted-foreground pl-4`,children:g?Fn(a,g):a}):null,t[66]=a,t[67]=g,t[68]=ee):ee=t[68];let te;t[69]!==U||t[70]!==ee||t[71]!==z?(te=(0,$.jsxs)(`span`,{className:z,children:[U,ee]}),t[69]=U,t[70]=ee,t[71]=z,t[72]=te):te=t[72];let ne;t[73]!==C||t[74]!==w||t[75]!==T||t[76]!==E||t[77]!==D||t[78]!==O||t[79]!==k||t[80]!==A||t[81]!==j||t[82]!==M||t[83]!==te?(ne=(0,$.jsx)(`button`,{type:C,className:w,style:T,onClick:E,onPointerDown:D,onPointerMove:O,onPointerUp:k,onPointerCancel:A,onContextMenu:j,disabled:M,children:te}),t[73]=C,t[74]=w,t[75]=T,t[76]=E,t[77]=D,t[78]=O,t[79]=k,t[80]=A,t[81]=j,t[82]=M,t[83]=te,t[84]=ne):ne=t[84];let re;t[85]!==p||t[86]!==m?(re=p?(0,$.jsx)(`button`,{type:`button`,className:`mr-0.5 flex size-9 shrink-0 items-center justify-center rounded-xl text-[var(--surface-mutedForeground)] transition-colors hover:bg-[var(--interactive-hover)] hover:text-[var(--surface-foreground)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--interactive-focus-ring)]`,"aria-label":m,onClick:e=>{e.stopPropagation(),p()},style:{touchAction:`manipulation`},children:(0,$.jsx)(bi,{})}):null,t[85]=p,t[86]=m,t[87]=re):re=t[87];let W;t[88]===b?W=t[89]:(W=b(`sessions.sidebar.session.menu.label`),t[88]=b,t[89]=W);let ie;t[90]===Symbol.for(`react.memo_cache_sentinel`)?(ie=(0,$.jsx)(X,{name:`more-2`,className:`size-4`}),t[90]=ie):ie=t[90];let ae;t[91]!==h.onOpenActions||t[92]!==W?(ae=(0,$.jsx)(q,{variant:`ghost`,size:`icon`,"data-session-drag-ignore":!0,"aria-label":W,onClick:h.onOpenActions,children:ie}),t[91]=h.onOpenActions,t[92]=W,t[93]=ae):ae=t[93];let oe;t[94]!==_||t[95]!==f||t[96]!==d||t[97]!==b||t[98]!==B?(oe=d?(0,$.jsxs)($.Fragment,{children:[_?(0,$.jsxs)(`button`,{type:`button`,className:`flex h-9 shrink-0 items-center gap-1.5 rounded-xl bg-destructive px-3 text-destructive-foreground transition-opacity hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-destructive`,"aria-label":b(`mobile.sessions.archiveSessionAria`,{title:B}),onClick:f,style:{touchAction:`manipulation`},children:[(0,$.jsx)(X,{name:`archive`,className:`size-4`}),(0,$.jsx)(`span`,{className:`typography-ui-label`,children:b(`sessions.sidebar.bulkActions.archive`)})]}):null,(0,$.jsx)(`button`,{type:`button`,className:`mr-1.5 flex size-9 shrink-0 items-center justify-center rounded-xl text-muted-foreground/70 transition-colors hover:bg-interactive-hover hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary`,"aria-label":b(_?`mobile.sessions.cancelArchiveAria`:`mobile.sessions.archiveSessionAria`,{title:B}),onClick:d,style:{touchAction:`manipulation`},children:_?(0,$.jsx)(X,{name:`close`,className:`size-4`}):(0,$.jsx)(X,{name:`archive`,className:`size-4`})})]}):null,t[94]=_,t[95]=f,t[96]=d,t[97]=b,t[98]=B,t[99]=oe):oe=t[99];let se;return t[100]!==N||t[101]!==P||t[102]!==ne||t[103]!==re||t[104]!==ae||t[105]!==oe?(se=(0,$.jsxs)(`div`,{className:N,children:[P,ne,re,ae,oe]}),t[100]=N,t[101]=P,t[102]=ne,t[103]=re,t[104]=ae,t[105]=oe,t[106]=se):se=t[106],se},bs=e=>{let t=(0,Q.c)(15),{indent:n,showMore:r,showFewer:i,loadingMore:a,onShowMore:o,onShowFewer:s}=e,c=a!==void 0&&a,{t:l}=ot();if(!r&&!i)return null;let u;t[0]===n?u=t[1]:(u={paddingLeft:n,touchAction:`manipulation`},t[0]=n,t[1]=u);let d;t[2]!==s||t[3]!==i||t[4]!==l?(d=i?(0,$.jsxs)(`button`,{type:`button`,className:`inline-flex items-center gap-1.5 text-left transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-inset`,onClick:s,children:[(0,$.jsx)(X,{name:`arrow-up-s`,className:`size-4`}),(0,$.jsx)(`span`,{className:`typography-micro`,children:l(`sessions.sidebar.group.showFewer`)})]}):null,t[2]=s,t[3]=i,t[4]=l,t[5]=d):d=t[5];let f;t[6]!==c||t[7]!==o||t[8]!==r||t[9]!==l?(f=r?(0,$.jsxs)(`button`,{type:`button`,className:J(`inline-flex items-center gap-1.5 text-left transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-inset disabled:pointer-events-none disabled:opacity-60`,c&&`animate-pulse`),onClick:o,disabled:c,children:[(0,$.jsx)(X,{name:`arrow-down-s`,className:`size-4`}),(0,$.jsx)(`span`,{className:`typography-micro`,children:l(`sessions.sidebar.group.showMore`)})]}):null,t[6]=c,t[7]=o,t[8]=r,t[9]=l,t[10]=f):f=t[10];let p;return t[11]!==u||t[12]!==d||t[13]!==f?(p=(0,$.jsxs)(`div`,{className:`flex min-h-10 w-full items-center gap-3 py-1.5 pr-3 text-muted-foreground`,style:u,children:[d,f]}),t[11]=u,t[12]=d,t[13]=f,t[14]=p):p=t[14],p},xs=({open:e,onOpenChange:t,variant:n=`sheet`})=>{let{t:r}=ot(),{git:i}=F(),a=Pe(),o=xe(),s=le(e=>e.activeSessions),c=le(e=>e.activePaginationByDirectory),l=ae(e=>e.projects),u=Z.useMemo(()=>l.filter(e=>!e.hostId),[l]),d=l.some(e=>!!e.hostId),f=rt(e&&d),p=f.catalog?.projects??[],m=ae(e=>e.activeProjectId),h=D(e=>e.currentDirectory),g=Ne(e=>e.currentSessionId),_=Ne(e=>e.availableWorktreesByProject),v=Ne(e=>e.setCurrentSession),y=Ne(e=>e.archiveSession),b=Ne(e=>e.archiveSessions),x=Ne(e=>e.updateSessionTitle),S=Ne(e=>e.requestSessionSmartTitle),C=Ne(e=>e.shareSession),w=Ne(e=>e.unshareSession),T=Ne(e=>e.openNewSessionDraft),E=ae(e=>e.setActiveProject),O=ae(e=>e.setActiveProjectIdOnly),k=ae(e=>e.removeProject),A=$e();Or();let j=Se(e=>e.sessionOrderByScope),M=Se(e=>e.sessionOrderActivityByScope),N=oe(),P=Nr(e=>e.projectExpanded),I=Nr(e=>e.worktreeExpanded),L=Nr(e=>e.setProjectExpanded),R=Nr(e=>e.setWorktreeExpanded),B=me(e=>e.orderByProject),V=$o(e=>e.expandedParents),H=$o(e=>e.toggleParent),[U,ee]=Z.useState(``),[te,ne]=Z.useState(null),[re,W]=Z.useState(null),[ie,se]=Z.useState(0),[ue,G]=Z.useState(!1),[fe,pe]=Z.useState(!1),[K,ge]=Z.useState(null),[_e,ye]=Z.useState(null),be=_e?.kind===`session`?_e.session:null,{unread:Ce,onToggleRead:we}=ai(be,be?is(be):void 0),[Te,Ee]=Z.useState(null),[De,Oe]=Z.useState(null),[ke,Ae]=Z.useState(null),[je,Me]=Z.useState(``),[Fe,Ie]=Z.useState(!1),[Le,Re]=Z.useState(null),Be=Z.useRef(null);Be.current||=Kr({onPressedKeyChange:Oe});let[Ve,He]=Z.useState(new Set),[Ue,We]=Z.useState(new Map),[Ke,qe]=Z.useState(new Map),Ye=_r(),Xe=yr(),Ze=z(e=>{Wn(e),de(e)}),Qe=z(e=>{Promise.all(e.map(e=>(Wn(e),de(e))))});Z.useEffect(()=>{if(!e){ee(``),qe(new Map),ne(null),W(null),ye(null),Ae(null),Re(null),Be.current?.reset();return}},[e]),Z.useEffect(()=>()=>{Be.current?.reset()},[]),Z.useEffect(()=>{if(!e)return;if(u.length===0){Ne.setState(e=>{let t=si(e.availableWorktreesByProject,new Set,[]);return t===e.availableWorktreesByProject?{}:{availableWorktreesByProject:t,availableWorktrees:[]}}),He(e=>e.size===0?e:new Set),We(e=>e.size===0?e:new Map);return}let t=!1;return(async()=>{let e=await Promise.all(u.map(async e=>{let n=rs(e.path);if(!n)return null;let r;try{r=await i.checkIsGitRepository(n)}catch{return{id:e.id,path:n,gitStatus:`failed`}}if(!r)return{id:e.id,path:n,gitStatus:`success`,isGitRepo:r,worktreeStatus:`success`,worktrees:[]};let[a,o]=await Promise.allSettled([Jn({id:e.id,path:n},{isCurrent:()=>!t}),Yn(n)]);return{id:e.id,path:n,gitStatus:`success`,isGitRepo:r,worktreeStatus:a.status===`fulfilled`?`success`:`failed`,worktrees:a.status===`fulfilled`?a.value.worktrees:void 0,rootBranchStatus:o.status===`fulfilled`?`success`:`failed`,rootBranch:o.status===`fulfilled`?o.value:void 0}}));if(t)return;let n=new Set(u.map(e=>rs(e.path)).filter(Boolean)),r=e.flatMap(e=>e?.worktreeStatus?[{path:e.path,status:e.worktreeStatus,worktrees:e.worktrees}]:[]);Ne.setState(e=>{let t=si(e.availableWorktreesByProject,n,r);return t===e.availableWorktreesByProject?{}:{availableWorktreesByProject:t,availableWorktrees:Array.from(t.values()).flat()}}),He(t=>{let r=new Set([...t].filter(e=>n.has(e)));for(let t of e)t?.gitStatus===`success`&&(t.isGitRepo?r.add(t.path):r.delete(t.path));return ss(r,t)?t:r}),We(t=>{let n=new Set(u.map(e=>e.id)),r=new Map([...t].filter(([e])=>n.has(e)));for(let t of e){if(!t||t.gitStatus!==`success`)continue;if(!t.isGitRepo){r.delete(t.id);continue}if(t.rootBranchStatus!==`success`)continue;let e=t.rootBranch?.trim();e&&e!==`HEAD`?r.set(t.id,e):r.delete(t.id)}return r.size===t.size&&[...r].every(([e,n])=>t.get(e)===n)?t:r})})(),()=>{t=!0}},[i,e,u,ie]);let et=Z.useMemo(()=>u.map(e=>({id:e.id,label:as(e.path),path:rs(e.path),icon:e.icon,color:e.color,iconImage:e.iconImage,iconBackground:e.iconBackground,isGitRepo:Ve.has(rs(e.path)),worktrees:he(B[e.id],_.get(rs(e.path))??[])})),[Ve,u,B,_]),tt=Z.useMemo(()=>{let e=new Map(o.map(e=>[e.id,e])),t=s.map(t=>{let n=e.get(t.id);return n?ze(n,t):t}),n=new Set(t.map(e=>e.id));for(let e of o)n.has(e.id)||t.push(e);return t},[s,o]),nt=U.trim().toLowerCase(),it=Z.useMemo(()=>{let e=et.map(e=>({project:e,buckets:[],totalSessions:0,isActive:e.id===m})),t=(e,t,n)=>{let r=rs(t)||e.project.path,i=r||`__root__`,a=e.buckets.find(e=>e.key===i);return a||(a={key:i,label:n?.branch||as(r),path:r,worktree:n,sessions:[]},e.buckets.push(a)),a};for(let n of e){t(n,n.project.path,null);for(let e of n.project.worktrees)t(n,e.path,e)}for(let n of tt){let r=is(n);if(!r)continue;let i=rs(r),a=e.find(e=>ds(e.project,i));if(!a)continue;let o=us(a.project,i);(o?t(a,o.path,o):t(a,a.project.path,null)).sessions.push(n)}for(let t of e)for(let e of t.buckets){let n=rs(e.path),r=jr(e.sessions.map(e=>({session:e})),j[n],M[n],A);e.sessions.sort((e,t)=>r({session:e},{session:t}));for(let n of e.sessions)ns(n)||(t.totalSessions+=1)}return e},[m,et,tt,j,M,A]),at=rs(h),st=e=>e.isActive?at===e.project.path?e.project.path:e.project.worktrees.find(e=>ls(at,e.path))?.path??e.project.path:null,ct=e=>P[e.project.id]??!0,lt=(e,t)=>I[`${e.project.id}::${t.key}`]??!1,dt=e=>{qe(t=>{if(!t.has(e))return t;let n=new Map(t);return n.delete(e),n})},ft=()=>{ye(null),Be.current?.reset()},pt=e=>({onOpenActions:()=>ye(e),pressed:De===e.key||_e?.key===e.key,onPointerDown:t=>{e.kind!==`session`&&(t.pointerType!==`touch`&&t.pointerType!==`pen`||t.button!==0||Be.current?.start({pointerId:t.pointerId,key:e.key,clientX:t.clientX,clientY:t.clientY,onTrigger:()=>ye(e)}))},onPointerMove:e=>{Be.current?.move(e.pointerId,e.clientX,e.clientY)},onPointerUp:e=>{Be.current?.end(e.pointerId)},onPointerCancel:e=>{Be.current?.cancel(e.pointerId)},onContextMenu:t=>{t.preventDefault(),t.stopPropagation(),e.kind!==`session`&&Be.current?.openFromContextMenu(e.key,()=>ye(e))}}),ht=(e,t)=>{Be.current?.consumeClick(e)||t()},_t=(e,t,n,r)=>{let i=Hr(),a=Wr();if(qe(t=>{let r=new Map(t),o=Math.max(i,t.get(e)??i,n);return r.set(e,o+a),r}),Math.max(i,n)+a<r)return;let o=rs(t);if(!o)return;let s=le.getState().activePaginationByDirectory.get(o);s?.hasMore&&!s.loadingMore&&ce(o)},vt=(e,t,n)=>{let i=`${e.project.id}::${t.key}`,a=Hr(),o=new Set(t.sessions.map(e=>e.id)),s=new Map;for(let e of t.sessions){let t=ns(e);if(t&&o.has(t)){let n=s.get(t)??[];n.push(e),s.set(t,n)}}let l=t.sessions.filter(e=>!ns(e)),u=Ke.get(i)??a,d=gr(l,u,Xe),f=l.length-d.length,p=c.get(rs(t.path)),m=p?.hasMore===!0,h=p?.loadingMore===!0,_=l.length>a&&u>a,v=(e,t)=>{let n=s.get(e.id)??[],i=n.length>0,a=!!V[e.id],o=Ye.has(e.id),c=i&&!a?n.filter(e=>Ye.has(e.id)).map(e=>e.id):[],l=c.length>0,u=o?[e.id,...c]:c,d=e.title?.trim()||r(`mobile.sessions.untitled`),f=`session:${e.id}`;return(0,$.jsxs)(Z.Fragment,{children:[(0,$.jsx)(ys,{session:e,active:g===e.id,indent:t,hasChildren:i,expanded:a,onToggleChildren:i?()=>H(e.id):void 0,confirmingArchive:re===e.id,onSelect:()=>ht(f,()=>xt(e)),onRequestArchive:()=>St(e.id),onConfirmArchive:()=>void Ct(e),onStop:o||l?()=>Qe(u):void 0,stopAriaLabel:r(l?`mobile.sessions.stopSubsessionsAria`:`mobile.sessions.stopSessionAria`,{title:d}),longPressHandlers:pt({key:f,kind:`session`,session:e})}),i&&a?n.map(e=>v(e,t+ts)):null]},e.id)};return(0,$.jsxs)(`div`,{children:[l.length===0&&!m&&!h?(0,$.jsx)(`div`,{className:`py-1.5 pr-3 typography-ui-label font-normal text-muted-foreground/80`,style:{paddingLeft:n},children:r(`sessions.sidebar.group.empty.noSessionsInWorkspace`)}):null,(0,$.jsx)(Pr,{scopeKey:re?null:rs(t.path),sessionIds:d.map(e=>e.id),folderIdBySessionId:new Map(d.map(e=>[e.id,Se.getState().getSessionFolderId(rs(t.path),e.id)])),onSessionDroppedOnFolder:()=>{},onSessionsReordered:(e,n)=>{Se.getState().reorderSessions(rs(t.path),d.map(e=>e.id),e,n,vi(t.sessions)).catch(()=>Y.error(r(`sessions.order.saveFailed`)))},children:d.map(e=>re?v(e,n):(0,$.jsx)(Mr,{sessionId:e.id,sessionDirectory:t.path,sessionTitle:e.title??``,children:v(e,n)},e.id))}),(0,$.jsx)(bs,{indent:n,showMore:f>0||m,showFewer:_,loadingMore:h,onShowMore:()=>_t(i,t.path,u,l.length),onShowFewer:()=>dt(i)})]})},yt=(e,t)=>{L(e,!t)},bt=(e,t,n)=>{R(`${e}::${t}`,!n)},xt=e=>{gt();let n=is(e)||null,r=fs(et,n??``);r&&O(r.id),v(e.id,n),t(!1)},St=e=>{W(t=>t===e?null:e)},Ct=async e=>{W(null),await y(e.id)?gi({sessionIds:[e.id],message:r(`sessions.sidebar.session.archive.success`),undoLabel:r(`sessions.sidebar.undo`),settingsLabel:r(`settings.yuri.archivedSessions.actions.view`),undoFailedMessage:r(`sessions.sidebar.session.archive.undoFailed`)}):Y.error(r(`sessions.sidebar.session.archive.error`))},wt=()=>{T(),t(!1)},Tt=e=>{ge(e),O(e),pe(!0)},Et=e=>{let t=new Map;for(let e of tt){let n=ns(e);if(!n)continue;let r=t.get(n)??[];r.push(e.id),t.set(n,r)}let n=[],r=new Set,i=e=>{if(!r.has(e)){r.add(e),n.push(e);for(let n of t.get(e)??[])i(n)}};return i(e),n},Dt=async e=>{let t=Et(e.id),{archivedIds:n,failedIds:i}=await b(t);n.length>0&&gi({sessionIds:n,message:n.length===1?r(`sessions.sidebar.session.archive.success`):r(`sessions.sidebar.bulkActions.archivedPlural`,{count:n.length}),undoLabel:r(`sessions.sidebar.undo`),settingsLabel:r(`settings.yuri.archivedSessions.actions.view`),undoFailedMessage:n.length===1?r(`sessions.sidebar.session.archive.undoFailed`):r(`sessions.sidebar.bulkActions.archiveUndoFailed`,{count:n.length})}),i.length>0&&Y.error(i.length===1?r(`sessions.sidebar.bulkActions.failedArchiveSingle`,{count:i.length}):r(`sessions.sidebar.bulkActions.failedArchivePlural`,{count:i.length}))},Ot=e=>{let t=Et(e.id);Ir({sessionIds:t,message:t.length===1?r(`sessions.sidebar.session.delete.success`):r(`sessions.sidebar.bulkActions.deletedPlural`,{count:t.length}),undoLabel:r(`sessions.sidebar.undo`),commitFailedMessage:r(`sessions.sidebar.session.delete.error`)})},kt=async e=>{try{if(!(await C(e.id))?.share?.url){Y.error(r(`sessions.sidebar.session.share.error`));return}Y.success(r(`sessions.sidebar.session.share.successTitle`),{description:r(`sessions.sidebar.session.share.successDescription`)})}catch{Y.error(r(`sessions.sidebar.session.share.error`))}},At=async e=>{if((await Je(e)).ok){Y.success(r(`sessions.sidebar.session.menu.copied`));return}Y.error(r(`sessions.sidebar.session.share.copyUrlError`))},jt=async e=>{try{if(await w(e)){Y.success(r(`sessions.sidebar.session.unshare.success`));return}Y.error(r(`sessions.sidebar.session.unshare.error`))}catch{Y.error(r(`sessions.sidebar.session.unshare.error`))}},Mt=async()=>{if(!ke)return;let e=je.trim();if(e)try{await x(ke.id,e),Ae(null),Me(``)}catch{Y.error(r(`sessions.sidebar.session.menu.rename`),{description:r(`sessions.sidebar.dialogs.deleteResult.tryAgain`)})}},Nt=async()=>{if(!ke||Fe)return;let e=ke.id;Ae(null),Me(``),Ie(!0);try{await S(e)}catch{Y.error(r(`sessions.sidebar.session.rename.smartTitle`),{description:r(`sessions.sidebar.dialogs.deleteResult.tryAgain`)})}finally{Ie(!1)}},Pt=(e,n)=>{O(e.id),T({selectedProjectId:e.id,directoryOverride:n,preserveDirectoryOverride:!0}),t(!1)},Ft=e=>{(async()=>{try{await Jn({id:e.id,path:e.path})}catch(e){console.warn(`[MobileSessions] Worktree refresh before session sync failed:`,e)}let t=Ne.getState().availableWorktreesByProject.get(e.path)??e.worktrees,n=[e.path,...t.map(e=>e.path)];await ve(n,tt)})()},It=e=>{let t=is(e),n=fs(et,t);if(!n)return as(t)||t;let r=us(n,rs(t));return r?.branch?`${n.label} · ${r.branch}`:n.label},Lt=e=>{E(e.id),t(!1)},Rt=Z.useMemo(()=>nt?it.filter(e=>`${e.project.label} ${e.project.path}`.toLowerCase().includes(nt)?!0:e.buckets.some(t=>t.sessions.some(t=>ps(t,e.project.label,nt)))):it,[nt,it]),zt=Z.useMemo(()=>nt?tt.filter(e=>{let t=is(e);return ps(e,fs(et,t)?.label??``,nt)}).sort((e,t)=>Ge(t)-Ge(e)):[],[nt,et,tt]),Bt=Z.useMemo(()=>nt?et.filter(e=>`${e.label} ${e.path}`.toLowerCase().includes(nt)).map(e=>({...e,sessionCount:tt.filter(t=>!ns(t)&&ds(e,rs(is(t)))).length})):[],[nt,et,tt]),Vt=nt&&zt.length===0&&Bt.length===0,Ht=et.length>0?(0,$.jsxs)(q,{type:`button`,variant:`default`,size:`sm`,"aria-label":r(`mobile.sessions.newChat`),onClick:wt,style:{touchAction:`manipulation`},children:[(0,$.jsx)(X,{name:`add`,className:`size-4`}),r(`mobile.sessions.newChat`)]}):null,Ut=et.find(e=>e.id===m)??null,Wt=Ut?.isGitRepo?(0,$.jsx)(q,{type:`button`,variant:`chip`,size:`sm`,"aria-label":r(`sessions.sidebar.project.actions.newWorktree`),title:r(`sessions.sidebar.project.actions.newWorktree`),onClick:()=>Tt(Ut.id),style:{touchAction:`manipulation`},children:(0,$.jsx)(X,{name:`node-tree`,className:`size-4`})}):null,Gt=(0,$.jsx)(q,{type:`button`,variant:`chip`,size:`sm`,"aria-label":r(`sessions.sidebar.header.actions.addProject`),title:r(`sessions.sidebar.header.actions.addProject`),onClick:()=>G(!0),style:{touchAction:`manipulation`},children:(0,$.jsx)(X,{name:`folder-add`,className:`size-4`})}),Kt=Ht||Gt?(0,$.jsxs)($.Fragment,{children:[Ht,Wt,Gt]}):null,qt=_e?.kind===`project`?_e.project.label:_e?.kind===`worktree`?_e.worktree.branch||_e.worktree.label||_e.worktree.path:_e?.kind===`session`?_e.session.title?.trim()||r(`mobile.sessions.untitled`):``,Yt=Z.useMemo(()=>{if(!_e)return[];if(_e.kind===`project`){let e=_e.project;return di({gitRepository:e.isGitRepo,onNewSession:()=>{ft(),Pt(e,e.path)},onNewWorktree:()=>{ft(),Tt(e.id)},onSyncSessions:()=>{ft(),Ft(e)},onEditProject:()=>{ft(),ne(e.id)},onCloseProject:()=>{ft(),Ee(e)}})}if(_e.kind===`worktree`){let{project:e,worktree:t}=_e;return $r({onNewSession:()=>{ft(),Pt(e,t.path)},onDeleteWorktree:()=>{ft(),Re({project:e,worktree:t})}})}let e=_e.session,t=!!e.share?.url;return Br({pinned:A.has(e.id),shared:t,unread:Ce,onToggleRead:we?()=>{ft(),we()}:void 0,onRename:()=>{ft(),Me(e.title?.trim()||r(`mobile.sessions.untitled`)),Ae(e)},onTogglePin:()=>{ft(),N(e.id)},onShare:!a||t?void 0:()=>{ft(),kt(e)},onCopyLink:a&&t?()=>{let t=e.share?.url;ft(),t&&At(t)}:void 0,onUnshare:a&&t?()=>{ft(),jt(e.id)}:void 0,onArchive:()=>{ft(),Dt(e)},onDelete:()=>{ft(),Ot(e)}})},[_e,Ce,ft,Dt,At,Ot,Tt,kt,jt,we,A,Pt,Ft,r,N]),Xt=Yt.length>0?(0,$.jsx)(`div`,{className:`flex flex-col gap-1`,children:Yt.map(e=>{let t=(0,$.jsx)(vs,{icon:e.icon,label:hi(e,r),destructive:e.destructive,onClick:e.onClick},e.id);return e.separated?(0,$.jsx)(`div`,{className:_e?.kind===`project`?`border-t border-[var(--yuri-popup-divider)]`:`mt-3 border-t border-[var(--surface-subtle)] pt-3`,children:t},e.id):t})}):null,Zt=(0,$.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,$.jsx)(`div`,{className:`shrink-0 px-4 pb-2 pt-1`,children:(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(X,{name:`search`,className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-muted-foreground`}),(0,$.jsx)(Jt,{value:U,onChange:e=>ee(e.target.value),placeholder:r(`mobile.sessions.search.placeholder`),className:J(`h-11 pl-9`,U&&`pr-10`)}),U?(0,$.jsx)(`button`,{type:`button`,className:`absolute right-1.5 top-1/2 flex size-8 -translate-y-1/2 items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-interactive-hover hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary`,"aria-label":r(`mobile.sessions.clearSearchAria`),onClick:()=>ee(``),style:{touchAction:`manipulation`},children:(0,$.jsx)(X,{name:`close`,className:`size-4`})}):null]})}),(0,$.jsxs)(ut,{className:`overlay-scrollbar-container min-h-0 flex-1 overflow-y-auto pb-4`,children:[d&&f.registry&&p.map(e=>(0,$.jsx)(ui,{project:e,registry:f.registry,search:U,mobile:!0,reorderEnabled:!1},e.id)),et.length===0&&!d?(0,$.jsx)(Ss,{title:r(`mobile.sessions.empty.noProjectsTitle`),description:r(`mobile.sessions.empty.noProjectsDescription`),action:(0,$.jsxs)(q,{type:`button`,size:`lg`,onClick:()=>G(!0),children:[(0,$.jsx)(X,{name:`folder-add`,className:`size-4`}),r(`sessions.sidebar.header.actions.addProject`)]})}):Vt&&!d?(0,$.jsx)(Ss,{title:r(`mobile.sessions.empty.searchTitle`),description:r(`mobile.sessions.empty.searchDescription`)}):nt?(0,$.jsxs)(`div`,{className:`flex flex-col gap-3 px-3 pt-2`,children:[zt.length>0?(0,$.jsxs)(`section`,{children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between px-1 pb-1.5`,children:[(0,$.jsx)(`span`,{className:`typography-micro font-semibold uppercase tracking-wider text-muted-foreground`,children:r(`mobile.sessions.search.section.sessions`)}),(0,$.jsx)(`span`,{className:`typography-micro text-muted-foreground tabular-nums`,children:zt.length})]}),(0,$.jsx)(`div`,{className:`overflow-hidden rounded-2xl border border-border/40 bg-[var(--surface-elevated)]`,children:zt.map((e,t)=>{let n=Ye.has(e.id),i=e.title?.trim()||r(`mobile.sessions.untitled`);return(0,$.jsx)(`div`,{className:J(t>0&&`border-t border-border/30`),children:(0,$.jsx)(ys,{session:e,active:g===e.id,indent:12,contextLabel:It(e),highlightQuery:nt,onSelect:()=>ht(`session:${e.id}`,()=>xt(e)),longPressHandlers:pt({key:`session:${e.id}`,kind:`session`,session:e}),onStop:n?()=>Ze(e.id):void 0,stopAriaLabel:r(`mobile.sessions.stopSessionAria`,{title:i})})},e.id)})})]}):null,Bt.length>0?(0,$.jsxs)(`section`,{children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between px-1 pb-1.5`,children:[(0,$.jsx)(`span`,{className:`typography-micro font-semibold uppercase tracking-wider text-muted-foreground`,children:r(`mobile.sessions.search.section.projects`)}),(0,$.jsx)(`span`,{className:`typography-micro text-muted-foreground tabular-nums`,children:Bt.length})]}),(0,$.jsx)(`div`,{className:`overflow-hidden rounded-2xl border border-border/40 bg-[var(--surface-elevated)]`,children:Bt.map((e,t)=>{let n=`project:${e.id}`,r=pt({key:n,kind:`project`,project:e});return(0,$.jsxs)(`div`,{className:J(`flex items-center`,t>0&&`border-t border-border/30`),children:[(0,$.jsxs)(`button`,{type:`button`,className:J(`flex min-h-14 min-w-0 flex-1 items-center gap-3 px-3 py-2 text-left transition-all hover:bg-interactive-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-inset`,r.pressed&&`bg-interactive-active scale-[0.99]`),onClick:()=>ht(n,()=>Lt(e)),onPointerDown:r.onPointerDown,onPointerMove:r.onPointerMove,onPointerUp:r.onPointerUp,onPointerCancel:r.onPointerCancel,onContextMenu:r.onContextMenu,style:{touchAction:`manipulation`},children:[(0,$.jsx)(ms,{project:e}),(0,$.jsx)(`span`,{className:`block min-w-0 flex-1 truncate typography-ui-label text-foreground`,children:Fn(e.label,nt)}),(0,$.jsx)(`span`,{className:`shrink-0 typography-micro text-muted-foreground tabular-nums`,children:e.sessionCount})]}),e.isGitRepo?(0,$.jsx)(_s,{className:`mr-2`,onClick:()=>Tt(e.id)}):null]},e.id)})})]}):null]}):(0,$.jsx)(`div`,{className:`flex flex-col`,children:Rt.map((e,t)=>{let n=ct(e),i=`project:${e.project.id}`,a=pt({key:i,kind:`project`,project:e.project}),o=nt?e.buckets.filter(t=>t.sessions.some(t=>ps(t,e.project.label,nt))):e.buckets,s=st(e);return(0,$.jsxs)(`section`,{className:J(t>0&&`border-t border-border/30`),children:[(0,$.jsxs)(`div`,{className:`flex min-h-14 w-full items-center`,children:[(0,$.jsxs)(`button`,{type:`button`,className:J(`flex min-h-14 min-w-0 flex-1 items-center gap-2 px-3 py-2 text-left transition-all hover:bg-interactive-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-inset`,a.pressed&&`bg-interactive-active scale-[0.99]`),onClick:()=>ht(i,()=>yt(e.project.id,n)),onPointerDown:a.onPointerDown,onPointerMove:a.onPointerMove,onPointerUp:a.onPointerUp,onPointerCancel:a.onPointerCancel,onContextMenu:a.onContextMenu,"aria-expanded":n,"aria-label":r(n?`sessions.sidebar.group.collapseAria`:`sessions.sidebar.group.expandAria`,{label:e.project.label}),style:{touchAction:`manipulation`},children:[(0,$.jsx)(ms,{project:e.project}),(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,$.jsx)(`span`,{className:`block truncate typography-ui-label font-semibold text-foreground`,children:e.project.label}),Ue.get(e.project.id)?(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1 typography-micro text-muted-foreground`,children:[(0,$.jsx)(X,{name:`git-branch`,className:`size-3 shrink-0`}),(0,$.jsx)(`span`,{className:`truncate`,children:Ue.get(e.project.id)})]}):null]}),e.isActive?(0,$.jsx)(gs,{ariaLabel:r(`mobile.sessions.activeProjectAria`)}):null,(0,$.jsx)(`span`,{className:`shrink-0 typography-micro text-muted-foreground tabular-nums`,children:e.totalSessions})]}),(()=>{let t=n?[]:[...new Set(e.buckets.flatMap(e=>e.sessions.filter(e=>Ye.has(e.id)).map(e=>e.id)))];return t.length>0?(0,$.jsx)(`button`,{type:`button`,className:`flex size-9 shrink-0 items-center justify-center rounded-full text-[var(--surface-mutedForeground)] transition-colors hover:bg-[var(--interactive-hover)] hover:text-[var(--surface-foreground)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--interactive-focus-ring)] mr-1`,"aria-label":r(`mobile.sessions.stopGroupAria`,{label:e.project.label}),onClick:e=>{e.stopPropagation(),Qe(t)},style:{touchAction:`manipulation`},children:(0,$.jsx)(bi,{})}):null})(),e.project.isGitRepo?(0,$.jsx)(_s,{className:`mr-2`,onClick:()=>Tt(e.project.id)}):null]}),n?(0,$.jsx)(`div`,{className:`pb-2`,children:(()=>{let t=o.find(e=>e.worktree===null),n=o.filter(e=>e.worktree!==null);return(0,$.jsxs)($.Fragment,{children:[t&&(t.sessions.length>0||n.length===0)?vt(e,t,es):null,n.map(t=>{let n=lt(e,t),i=s===t.path,a=`worktree:${e.project.id}:${t.key}`,o=pt({key:a,kind:`worktree`,project:e.project,worktree:t.worktree});return(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`button`,{type:`button`,className:J(`flex min-h-11 w-full items-center gap-2 py-1.5 pl-4 pr-3 text-left transition-all hover:bg-interactive-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-inset`,o.pressed&&`bg-interactive-active scale-[0.99]`),onClick:()=>ht(a,()=>bt(e.project.id,t.key,n)),onPointerDown:o.onPointerDown,onPointerMove:o.onPointerMove,onPointerUp:o.onPointerUp,onPointerCancel:o.onPointerCancel,onContextMenu:o.onContextMenu,"aria-expanded":n,"aria-label":r(n?`sessions.sidebar.group.collapseAria`:`sessions.sidebar.group.expandAria`,{label:t.label}),style:{touchAction:`manipulation`},children:[(0,$.jsx)(hs,{expanded:n}),(0,$.jsx)(X,{name:`node-tree`,className:J(`size-4 shrink-0`,i?`text-primary`:`text-muted-foreground`)}),(0,$.jsx)(`span`,{className:J(`block min-w-0 flex-1 truncate typography-ui-label font-semibold`,i?`text-foreground`:`text-foreground/90`),children:t.label}),i?(0,$.jsx)(gs,{ariaLabel:r(`mobile.sessions.activeWorktreeAria`)}):null,(()=>{let e=n?[]:t.sessions.filter(e=>Ye.has(e.id)).map(e=>e.id);return e.length>0?(0,$.jsx)(`button`,{type:`button`,className:`flex size-9 shrink-0 items-center justify-center rounded-full text-[var(--surface-mutedForeground)] transition-colors hover:bg-[var(--interactive-hover)] hover:text-[var(--surface-foreground)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--interactive-focus-ring)]`,"aria-label":r(`mobile.sessions.stopGroupAria`,{label:t.label}),onClick:t=>{t.stopPropagation(),Qe(e)},style:{touchAction:`manipulation`},children:(0,$.jsx)(bi,{})}):null})(),(0,$.jsx)(`span`,{className:`shrink-0 typography-micro text-muted-foreground tabular-nums`,children:t.sessions.length})]}),n?vt(e,t,es):null]},t.key)})]})})()}):null]},e.project.id)})})]}),(0,$.jsx)(fr,{open:ue,onOpenChange:G,forceMobile:!0}),(0,$.jsx)(Bn,{open:fe,projectId:K,onOpenChange:e=>{pe(e),e||ge(null)},onWorktreeCreated:(e,n)=>{n?.sessionId?v(n.sessionId,e):T({selectedProjectId:K,directoryOverride:e,preserveDirectoryOverride:!0}),t(!1)}}),(0,$.jsx)(Gn,{open:!!_e,title:qt,onClose:ft,contentMaxHeightClassName:`max-h-[min(68dvh,560px)]`,children:Xt}),(0,$.jsx)(Gn,{open:!!Te,title:r(`sessions.sidebar.project.actions.closeProject`),onClose:()=>Ee(null),closeAriaLabel:r(`mobile.surface.closeAria`),footer:(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[(0,$.jsx)(q,{type:`button`,variant:`ghost`,className:`flex-1`,onClick:()=>Ee(null),children:r(`sessions.sidebar.dialogs.cancel`)}),(0,$.jsx)(q,{type:`button`,variant:`destructive`,className:`flex-1`,onClick:()=>{if(!Te)return;let e=Te;Ee(null),k(e.id),Y.success(r(`mobile.sessions.toast.projectRemoved`,{label:e.label}))},children:r(`mobile.sessions.confirmRemoveProject`)})]}),children:(0,$.jsx)(`p`,{className:`px-1 py-1 typography-ui-body text-foreground`,children:r(`mobile.projects.closeConfirmMessage`,{title:Te?.label??``})})}),(0,$.jsx)(Gn,{open:!!ke,title:r(`sessions.sidebar.session.menu.rename`),onClose:()=>{Fe||(Ae(null),Me(``))},footer:(0,$.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,$.jsx)(q,{type:`button`,variant:`default`,className:`flex-1`,disabled:Fe,onClick:()=>{Ae(null),Me(``)},children:r(`sessions.sidebar.dialogs.cancel`)}),(0,$.jsx)(q,{type:`button`,variant:`default`,className:`flex-1`,disabled:!je.trim()||Fe,onClick:()=>void Mt(),children:r(`sessions.sidebar.session.rename.save`)})]}),children:(0,$.jsxs)(`form`,{className:`flex flex-col gap-3 px-1 py-1`,onSubmit:e=>{e.preventDefault(),Mt()},children:[(0,$.jsx)(Jt,{value:je,onChange:e=>Me(e.target.value),autoFocus:!0,className:`h-12`,disabled:Fe}),(0,$.jsxs)(q,{type:`button`,variant:`outline`,className:`w-full gap-2`,disabled:Fe,onClick:()=>void Nt(),children:[Fe?(0,$.jsx)(X,{name:`loader-4`,className:`size-4 animate-spin`}):(0,$.jsx)(X,{name:`ai-generate-2`,className:`size-4`}),r(`sessions.sidebar.session.rename.smartTitle`)]})]})}),Le?(0,$.jsx)(Jr,{open:!0,project:{id:Le.project.id,path:Le.project.path},worktree:Le.worktree,onClose:()=>Re(null),onDeleted:()=>se(e=>e+1)}):null,(0,$.jsx)(ti,{open:te!==null,project:et.find(e=>e.id===te)??null,onClose:()=>ne(null),onWorktreesChanged:()=>se(e=>e+1)})]});return n===`sidebar`?e?(0,$.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[(0,$.jsx)(`div`,{className:`flex h-[var(--yuri-header-height,56px)] shrink-0 items-center justify-end gap-2 px-4`,children:Kt?(0,$.jsx)(`div`,{className:`flex shrink-0 items-center gap-2`,children:Kt}):null}),Zt]}):null:(0,$.jsx)(mt,{id:`mobile-sessions-sheet`,open:e,onOpenChange:t,trailing:Kt,ariaLabel:r(`mobile.sessions.sheet.title`),closeAriaLabel:r(`mobile.surface.closeAria`),resizeAriaLabel:r(`mobile.sessions.sheet.resizeAria`),initiallyExpanded:!0,children:Zt})},Ss=e=>{let t=(0,Q.c)(10),{title:n,description:r,action:i}=e,a;t[0]===n?a=t[1]:(a=(0,$.jsx)(`p`,{className:`typography-ui-label text-foreground`,children:n}),t[0]=n,t[1]=a);let o;t[2]===r?o=t[3]:(o=r?(0,$.jsx)(`p`,{className:`typography-meta text-muted-foreground`,children:r}):null,t[2]=r,t[3]=o);let s;t[4]===i?s=t[5]:(s=i?(0,$.jsx)(`div`,{className:`pt-2`,children:i}):null,t[4]=i,t[5]=s);let c;return t[6]!==a||t[7]!==o||t[8]!==s?(c=(0,$.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-3 px-6 text-center`,children:[a,o,s]}),t[6]=a,t[7]=o,t[8]=s,t[9]=c):c=t[9],c},Cs=[{id:`projects`,icon:`folder-open`,labelKey:`mobile.tabs.projects`},{id:`assistant`,icon:`sparkling`,labelKey:`mobile.tabs.assistant`},{id:`scheduled`,icon:`calendar-schedule`,labelKey:`mobile.tabs.scheduled`},{id:`settings`,icon:`settings-3`,labelKey:`mobile.tabs.settings`}];function ws(e){let t=(0,Q.c)(23),{activeTab:n,onTabChange:r,className:i,tabMarks:a,homeView:o}=e,s=o===void 0?`projects`:o,{t:c}=ot(),l=dn(),u;t[0]===c?u=t[1]:(u=c(`mobile.tabs.activity.loading`),t[0]=c,t[1]=u);let d=u,f;t[2]===r?f=t[3]:(f=e=>{r(e.currentTarget.dataset.tab)},t[2]=r,t[3]=f);let p=z(f),m;t[4]!==n||t[5]!==r?(m=e=>{if(![`ArrowLeft`,`ArrowRight`,`Home`,`End`].includes(e.key))return;e.preventDefault();let t=Cs.findIndex(e=>e.id===n),i=Cs[e.key===`Home`?0:e.key===`End`?Cs.length-1:(t+(e.key===`ArrowRight`?1:-1)+Cs.length)%Cs.length];r(i.id),document.getElementById(`mobile-tab-${i.id}`)?.focus()},t[4]=n,t[5]=r,t[6]=m):m=t[6];let h=z(m),g;t[7]===c?g=t[8]:(g=c(`mobile.nav.aria`),t[7]=c,t[8]=g);let _;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(_={role:`tablist`},t[9]=_):_=t[9];let v;t[10]!==n||t[11]!==l||t[12]!==p||t[13]!==h||t[14]!==s||t[15]!==d||t[16]!==c||t[17]!==a?(v=Cs.map(e=>{let t=e.id===n,r=c(e.labelKey),i=e.id===`assistant`&&l>0,o=!i&&a?.[e.id]===`loading`,u=i?`mobile-tab-assistant-unread`:o?`mobile-tab-${e.id}-activity`:void 0;return(0,$.jsxs)(q,{id:`mobile-tab-${e.id}`,"data-tab":e.id,type:`button`,role:`tab`,variant:`ghost`,size:`sm`,"aria-controls":`mobile-tabpanel-${e.id}`,"aria-label":r,"aria-describedby":u,"aria-selected":t,tabIndex:t?0:-1,title:r,onClick:p,onKeyDown:h,className:J(`yuri-mobile-tab-button min-w-0 flex-1 flex-col overflow-visible`,`font-medium leading-none tracking-tight text-muted-foreground`,`transition-[background-color,color,box-shadow,transform] duration-100`,`hover:bg-transparent hover:text-foreground`,`active:bg-interactive-active`,`motion-reduce:transition-none`,t&&[`bg-interactive-selection/55 text-primary`,`hover:bg-interactive-selection/55 hover:text-primary`,`font-semibold`]),children:[(0,$.jsxs)(`span`,{className:`relative inline-flex size-[23px] shrink-0 items-center justify-center overflow-visible`,children:[e.id===`assistant`?(0,$.jsx)(ii,{size:23,className:`size-[23px] shrink-0 items-center justify-center [&[data-assistant-navigation-avatar]]:scale-105`}):(0,$.jsx)(X,{name:e.id===`projects`?s===`tasks`?`list-check-2`:`folder-tree`:e.icon,weight:`medium`,className:`size-[23px] shrink-0`}),u?(0,$.jsx)(`span`,{id:u,role:o?`status`:void 0,"aria-label":o?d:void 0,"data-mobile-tab-activity":o?`loading`:void 0,className:`pointer-events-none absolute left-full -top-1 ml-0.5 inline-flex z-10`,children:i?(0,$.jsx)(Ji,{className:`h-[18px] min-w-[18px] px-1 text-[11px] font-bold tracking-normal ring-2 ring-background`}):(0,$.jsx)(`span`,{className:`inline-flex size-[18px] items-center justify-center rounded-full bg-foreground text-background ring-2 ring-background`,children:(0,$.jsx)(X,{name:`loader-4`,className:`size-3 animate-spin`})})}):null]}),(0,$.jsx)(`span`,{className:`yuri-mobile-tab-label block max-w-full overflow-hidden text-ellipsis whitespace-nowrap`,children:r})]},e.id)}),t[10]=n,t[11]=l,t[12]=p,t[13]=h,t[14]=s,t[15]=d,t[16]=c,t[17]=a,t[18]=v):v=t[18];let y;return t[19]!==i||t[20]!==g||t[21]!==v?(y=(0,$.jsx)(qi,{as:`nav`,"aria-label":g,variant:`navigation`,surfaceProps:_,className:i,children:v}),t[19]=i,t[20]=g,t[21]=v,t[22]=y):y=t[22],y}function Ts(e){return e.unreadCount>0?`unread`:e.working?`loading`:null}var Es=`yuri-native-ios-tab-bar`,Ds=`YuriTabBar`,Os=[`projects`,`assistant`,`scheduled`,`settings`],ks=B(Ds),As=e=>e.isCapacitor&&e.platform===`ios`&&e.pluginAvailable&&e.nativeUiEnabled!==!1;function js(){return typeof window>`u`?!1:As({isCapacitor:g(),platform:y(),pluginAvailable:V.isPluginAvailable(Ds),nativeUiEnabled:Lt()})}var Ms=e=>e.classList.contains(`dark`)?`dark`:`light`,Ns=()=>Rt(`--primary`),Ps=e=>typeof e==`string`&&Os.includes(e),Fs=e=>typeof e==`string`&&Ps(e)?e:null,Is=(e,t)=>e.selectedTab===t.selectedTab&&e.appearance===t.appearance&&e.ariaLabel===t.ariaLabel&&e.accentColor===t.accentColor&&e.tabs.length===t.tabs.length&&e.tabs.every((e,n)=>e.id===t.tabs[n]?.id&&e.label===t.tabs[n]?.label&&e.badge===t.tabs[n]?.badge&&e.activity===!0==(t.tabs[n]?.activity===!0)&&(e.activity===!0?e.activityLabel??null:null)===(t.tabs[n]?.activity===!0?t.tabs[n]?.activityLabel??null:null)),Ls=(e,t)=>{e.classList.toggle(Es,t)},Rs=(e,t)=>e&&!t,zs=e=>e.visible?e.overlayHidden?{action:`present`}:e.lastState&&Is(e.lastState,e.nextState)?{action:`skip`}:{action:`present`}:e.overlayHidden?{action:`skip`}:{action:`hide`},Bs=()=>ks,Vs=`mobile-overlay-root`;function Hs(e){let t=(0,Q.c)(31),n=Bt(),r;t[0]===n?r=t[1]:(r=n&&js(),t[0]=n,t[1]=r);let i=r,[a,o]=(0,Z.useState)(!1),[s,c]=(0,Z.useState)(!1),[l,u]=(0,Z.useState)(!1),d=(0,Z.useRef)(null),f=(0,Z.useRef)(!1),p=(0,Z.useRef)(!1),m=z(e.onTabChange),h;t[2]===e.tabs?h=t[3]:(h=JSON.stringify(e.tabs.map(Ws)),t[2]=e.tabs,t[3]=h);let g=h,_;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(_=typeof document>`u`?`dark`:Ms(document.documentElement),t[4]=_):_=t[4];let v=_,y;t[5]===i?y=t[6]:(y=!i||typeof document>`u`?``:Ns(),t[5]=i,t[6]=y);let b=y,x,S;t[7]===i?(x=t[8],S=t[9]):(x=()=>{if(!i||typeof document>`u`)return;let e=document.getElementById(Vs);e||(e=document.createElement(`div`),e.id=Vs,document.body.appendChild(e));let t=()=>u(zn(e.children));t();let n=new MutationObserver(t);return n.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[Rn]}),()=>n.disconnect()},S=[i],t[7]=i,t[8]=x,t[9]=S),(0,Z.useEffect)(x,S);let C;t[10]!==i||t[11]!==m?(C=()=>{if(!i)return;let e=!1,t=Bs(),n=[];return t.addListener(`tabSelected`,e=>{let t=Fs(e.tab);t&&m(t)}).then(t=>{if(e){t.remove();return}n.push(t)}),()=>{e=!0,d.current=null,t.hide();for(let e of n)e.remove();typeof document<`u`&&Ls(document.documentElement,!1)}},t[10]=i,t[11]=m,t[12]=C):C=t[12];let w;t[13]===i?w=t[14]:(w=[i],t[13]=i,t[14]=w),(0,Z.useEffect)(C,w);let T;t[15]!==b||t[16]!==e.activeTab||t[17]!==e.ariaLabel||t[18]!==e.tabs||t[19]!==e.visible||t[20]!==i||t[21]!==l?(T=()=>{if(!i||p.current)return;let t=!1,n=Bs(),r={tabs:e.tabs.map(Us),selectedTab:e.activeTab,appearance:v,accentColor:b,ariaLabel:e.ariaLabel},a=zs({visible:Rs(e.visible,l),overlayHidden:f.current,lastState:d.current,nextState:r});return(async()=>{if(a.action===`skip`)return;if(a.action===`hide`){f.current=!0,n.hide();return}let e=await n.present(r);if(!t){if(e.adopted!==!0){p.current=!0,c(!0),o(!1),typeof document<`u`&&Ls(document.documentElement,!1);return}f.current=!1,d.current=r,o(!0),typeof document<`u`&&Ls(document.documentElement,!0)}})().catch(()=>{t||(p.current=!0,c(!0),o(!1),typeof document<`u`&&Ls(document.documentElement,!1))}),()=>{t=!0}},t[15]=b,t[16]=e.activeTab,t[17]=e.ariaLabel,t[18]=e.tabs,t[19]=e.visible,t[20]=i,t[21]=l,t[22]=T):T=t[22];let E;return t[23]!==b||t[24]!==e.activeTab||t[25]!==e.ariaLabel||t[26]!==e.visible||t[27]!==i||t[28]!==l||t[29]!==g?(E=[i,e.visible,l,e.activeTab,e.ariaLabel,v,b,g],t[23]=b,t[24]=e.activeTab,t[25]=e.ariaLabel,t[26]=e.visible,t[27]=i,t[28]=l,t[29]=g,t[30]=E):E=t[30],(0,Z.useLayoutEffect)(T,E),!i||s?`web`:a?`native`:`pending`}function Us(e){return{id:e.id,label:e.label,badge:e.badge??null,activity:e.activity===!0,activityLabel:e.activity===!0?e.activityLabel??null:null}}function Ws(e){return[e.id,e.label,e.badge??null,e.activity===!0,e.activity===!0?e.activityLabel??null:null]}function Gs(e){let t=(0,Q.c)(52),{homeView:n,tabs:r,navigation:i,onTabChange:a,secondaryPages:o,showTabBar:s,tabBarCovered:c,className:l}=e,u=n===void 0?`projects`:n,d=o===void 0?[]:o,f=s===void 0||s,p=c!==void 0&&c,{t:m}=ot(),h=i.activeTab,g=d.slice(-2),_=g.at(-1)??null,v=_?.key??null,y=_?.depth,b=g.length>1?g[g.length-2].key:null,x;t[0]===h?x=t[1]:(x=()=>new Set([h]),t[0]=h,t[1]=x);let[S,C]=Z.useState(x);S.has(h)||C(e=>{if(e.has(h))return e;let t=new Set(e);return t.add(h),t});let w=Z.useRef(null),T=Z.useRef(null),E=Z.useRef(null),D=Z.useRef(new Map),O=Z.useRef(null),k=Z.useRef(!1),A=Z.useRef(``),j=z(()=>_?.onBack());Vt({id:_?`mobile-secondary:${_.key}`:`mobile-secondary:inactive`,active:!!_,onBack:j,surfaceRef:w,underlayRef:T}),Z.useLayoutEffect(()=>{let e=v===null?null:D.current.get(v)??null,t=b===null?E.current:D.current.get(b)??null;w.current=e,T.current=t},[v,y,b]);let M;t[2]===_?M=t[3]:(M=[_],t[2]=_,t[3]=M),Z.useLayoutEffect(()=>{if(_){if(!k.current){let e=document.activeElement;O.current=e instanceof HTMLElement?e:null,k.current=!0}A.current!==_.key&&(A.current=_.key,w.current?.focus());return}if(k.current){k.current=!1,A.current=``;let e=O.current;O.current=null,e&&e.isConnected&&e.focus()}},M);let N;t[4]===a?N=t[5]:(N=e=>{a(e)},t[4]=a,t[5]=N);let P=z(N),F=dn(),I=pn(),L=fn(),R;t[6]===m?R=t[7]:(R=m(`mobile.tabs.activity.loading`),t[6]=m,t[7]=R);let B=R,V;t[8]!==F||t[9]!==I?(V=Ts({unreadCount:F,working:I}),t[8]=F,t[9]=I,t[10]=V):V=t[10];let H=V,U;t[11]===L?U=t[12]:(U=Ts({unreadCount:0,working:L}),t[11]=L,t[12]=U);let ee=U,te;t[13]!==H||t[14]!==F||t[15]!==B||t[16]!==ee||t[17]!==m?(te=Cs.map(e=>{let t=e.id===`assistant`&&H===`loading`||e.id===`scheduled`&&ee===`loading`;return{id:e.id,label:m(e.labelKey),badge:e.id===`assistant`&&H===`unread`?F>99?`99+`:String(F):null,activity:t,activityLabel:t?B:null}}),t[13]=H,t[14]=F,t[15]=B,t[16]=ee,t[17]=m,t[18]=te):te=t[18];let ne=te,re=f&&!p&&!_,W;t[19]===m?W=t[20]:(W=m(`mobile.nav.aria`),t[19]=m,t[20]=W);let ie;t[21]!==P||t[22]!==re||t[23]!==ne||t[24]!==h||t[25]!==W?(ie={visible:re,activeTab:h,tabs:ne,ariaLabel:W,onTabChange:P},t[21]=P,t[22]=re,t[23]=ne,t[24]=h,t[25]=W,t[26]=ie):ie=t[26];let ae=Hs(ie),oe=ae===`native`,se=f&&ae===`web`,ce=Bt(),le,ue;t[27]!==ce||t[28]!==oe?(le=()=>{if(!ce){zt.shutdown();return}oe&&Ht(!0)&&zt.warm()},ue=[ce,oe],t[27]=ce,t[28]=oe,t[29]=le,t[30]=ue):(le=t[29],ue=t[30]),Z.useEffect(le,ue);let de=h===`assistant`&&`yuri-assistant-wallpaper`,G;t[31]!==l||t[32]!==de?(G=J(`yuri-mobile-floating-shell relative isolate flex h-full min-h-0 flex-col overflow-hidden text-foreground`,`bg-[var(--yuri-mobile-page-background)]`,de,l),t[31]=l,t[32]=de,t[33]=G):G=t[33];let fe=_?!0:void 0,pe=_?!0:void 0,me=_?`true`:void 0,he;t[34]!==h||t[35]!==f||t[36]!==se||t[37]!==m||t[38]!==r||t[39]!==S?(he=Cs.map(e=>{let t=S.has(e.id);return(0,$.jsx)(`section`,{id:`mobile-tabpanel-${e.id}`,role:`tabpanel`,"aria-labelledby":se?`mobile-tab-${e.id}`:void 0,"aria-label":se?void 0:m(e.labelKey),hidden:h!==e.id,tabIndex:0,className:J(`scrollbar-none h-full min-h-0 flex-1 overflow-y-auto overflow-x-hidden overscroll-contain px-[var(--yuri-mobile-page-inline-inset)] pt-[calc(var(--safe-area-inset-top,env(safe-area-inset-top,0px))+1rem)] outline-none`,f?`pb-[calc(var(--yuri-mobile-dock-height)+2.5rem+var(--safe-area-inset-bottom,env(safe-area-inset-bottom,0px)))]`:`pb-0`),children:t?(0,$.jsx)(Z.Suspense,{fallback:null,children:r?.[e.id]??(0,$.jsx)(Ks,{tab:e.id,icon:e.icon})}):null},e.id)}),t[34]=h,t[35]=f,t[36]=se,t[37]=m,t[38]=r,t[39]=S,t[40]=he):he=t[40];let K=f?(0,$.jsx)(`div`,{"data-mobile-navigation-dock-underlay":`true`,"aria-hidden":_||oe?!0:void 0,inert:_||oe?!0:void 0,children:se?(0,$.jsx)(ws,{activeTab:h,homeView:u,onTabChange:P,tabMarks:{assistant:H===`loading`?`loading`:null,scheduled:ee===`loading`?`loading`:null}}):null}):null,ge;t[41]!==E||t[42]!==fe||t[43]!==pe||t[44]!==me||t[45]!==he||t[46]!==K?(ge=(0,$.jsxs)(`div`,{ref:E,"data-mobile-navigation-underlay":`true`,"aria-hidden":fe,inert:pe,"data-mobile-navigation-parked":me,className:`flex h-full min-h-0 flex-1 flex-col`,children:[he,K]}),t[41]=E,t[42]=fe,t[43]=pe,t[44]=me,t[45]=he,t[46]=K,t[47]=ge):ge=t[47];let _e=g.map((e,t)=>{let n=t===g.length-1;return(0,$.jsx)(`div`,{ref:t=>{t?D.current.set(e.key,t):D.current.delete(e.key)},"data-mobile-secondary-page":`true`,"data-mobile-secondary-active":n?`true`:`false`,role:n?`dialog`:void 0,"aria-modal":n?!0:void 0,"aria-label":n?e.ariaLabel??m(`mobile.nav.secondaryPageAria`):void 0,"aria-hidden":!n||void 0,inert:!n||void 0,tabIndex:n?-1:void 0,className:J(`absolute inset-0 flex h-full min-h-0 flex-col overflow-hidden bg-background outline-none`,n?`z-50`:`z-40`),children:(0,$.jsx)(Z.Suspense,{fallback:null,children:e.content})},e.key)}),ve;return t[48]!==G||t[49]!==ge||t[50]!==_e?(ve=(0,$.jsxs)(`div`,{className:G,children:[ge,_e]}),t[48]=G,t[49]=ge,t[50]=_e,t[51]=ve):ve=t[51],ve}function Ks(e){let t=(0,Q.c)(17),{tab:n,icon:r,className:i}=e,{t:a}=ot(),o,s,c,l;if(t[0]!==i||t[1]!==r||t[2]!==a||t[3]!==n){let e=Cs.find(e=>e.id===n)??Cs[0];t[8]===i?c=t[9]:(c=J(`flex min-h-[70dvh] flex-col items-center justify-center gap-3 text-center`,i),t[8]=i,t[9]=c),l=(0,$.jsx)(`span`,{className:`flex size-12 items-center justify-center rounded-2xl bg-[var(--surface-muted)] text-muted-foreground`,children:(0,$.jsx)(X,{name:r??e.icon,className:`size-6`})}),o=`typography-ui-label font-semibold tracking-[-0.01em] text-foreground`,s=a(e.labelKey),t[0]=i,t[1]=r,t[2]=a,t[3]=n,t[4]=o,t[5]=s,t[6]=c,t[7]=l}else o=t[4],s=t[5],c=t[6],l=t[7];let u;t[10]!==o||t[11]!==s?(u=(0,$.jsx)(`h1`,{className:o,children:s}),t[10]=o,t[11]=s,t[12]=u):u=t[12];let d;return t[13]!==c||t[14]!==l||t[15]!==u?(d=(0,$.jsxs)(`div`,{className:c,children:[l,u]}),t[13]=c,t[14]=l,t[15]=u,t[16]=d):d=t[16],d}var qs=(e,t)=>e.id===t.id&&e.title===t.title&&e.directory===t.directory&&e.projectLabel===t.projectLabel&&e.project===t.project&&e.branch===t.branch&&e.branchState===t.branchState&&e.pathLabel===t.pathLabel&&e.activityLabel===t.activityLabel&&e.unread===t.unread&&e.pinned===t.pinned&&e.active===t.active,Js=[],Ys=(e,t,n)=>{let r=(e??t)?.trim();return r&&r!==`HEAD`&&r!==n?r:void 0};function Xs(e,t){let{enabled:n,status:r,settledLimit:i}=t,{t:a}=ot(),o=$e(),s=Yr(),c=Lr(),l=_r({enabled:n}),u=Le(),d=we(e=>e.index.session.unseenCount),f=Se(e=>e.sessionOrderByScope[br]),p=ae(e=>e.projects),m=Ne(e=>e.currentSessionId),h=D(e=>e.homeDirectory),g=yi(l,n),_=Z.useRef(new Map),{git:v}=F(),y=It(e=>e.ensureStatus),b=Z.useMemo(()=>n?[...e.projectMetaById.values()].map(e=>e.path):Js,[n,e.projectMetaById]),x=Nt(b);return Z.useEffect(()=>{if(!(!n||!v))for(let e of b)y(e,v)},[n,y,v,b]),Z.useMemo(()=>{if(!n)return null;let t=hr({sessions:e.allSessions,pinnedSessionIds:o,settledSessionIds:s,indexedSessionIds:c?.indexedIds??null,settledAtBySessionId:c?.settledAtById,runningSessionIds:l,pendingRequestSessionIds:u,unseenBySession:d}),v=Sr(e.allSessions,o,f).filter(_i),y=new Map(p.map(e=>[e.id,e.color??void 0])),b=a(`mobile.sessions.untitled`),S=a(`sessions.sidebar.task.unassigned`),C=_.current,w=new Map,T=(t,n)=>{let r=e.ownership.bySessionId.get(t.id),i=r?e.projectMetaById.get(r.projectId):void 0,a=i&&r?.kind===`worktree`?zr(i,r.scopeDirectory):null,o=i?x.get(i.path):void 0,s=Ys(a?.branch,o?.branch,i?.label),c=s?null:!i||o?.isGitRepo===!1?`no-git`:`loading`,l={id:t.id,title:t.title?.trim()||b,directory:Vr(t),projectLabel:i?.label||S,project:i?{id:i.id,icon:i.icon??void 0,color:y.get(i.id),iconImage:i.iconImage??void 0}:null,branch:s,branchState:c,pathLabel:c===`no-git`&&i?Ie(i.path,h):void 0,activityLabel:Qr(Ur(t))||void 0,unread:(d[t.id]??0)>0,pinned:n,active:m===t.id},u=C.get(t.id),f=u&&qs(u,l)&&u.project?.iconImage===l.project?.iconImage?u:l;return w.set(t.id,f),f},E=e=>(d[e.id]??0)>0,D=[...v,...t.active],O=r===`archived`?t.settled:D,k=r===`unread`?O.filter(E):O,A={items:(r===`archived`?k.slice(0,i):k).map(e=>T(e,o.has(e.id))),total:k.length,runStartTimes:g};return _.current=w,A},[m,n,x,h,c,e.allSessions,e.ownership,e.projectMetaById,u,f,o,p,g,l,s,i,r,a,d])}var Zs=(e,t,n)=>e?.kind===`project`&&e.project.id===t?{...e,isGitRepository:n}:e;function Qs({homeView:e,onHomeViewChange:t,onOpenChat:n,onAddProject:r,onNewSession:i,onScanQr:a,onSwitchInstance:o,onRemoteDesktop:s,instanceOptions:c,className:l}){let{t:u}=ot(),{git:d}=F(),f=Pe(),p=qr(),[m,g]=Z.useState(()=>new Map),_=z((e,t)=>{g(n=>{if(!t.length&&!n.has(e))return n;let r=new Map(n);return t.length?r.set(e,t):r.delete(e),r})}),v=z((e,t,n,r)=>{let i=Se.getState(),a=e===`__pinned__`?e:h(e);if(!a||a!==`__pinned__`&&i.getSessionFolderId(a,n)!==i.getSessionFolderId(a,r))return;let o=a===`__pinned__`?{}:vi(p.allSessions.filter(e=>Vr(e)===a));i.reorderSessions(a,t,n,r,o).catch(()=>Y.error(u(`sessions.order.saveFailed`)))}),y=Nr(e=>e.setProjectExpanded),b=Nr(e=>e.setWorktreeExpanded),x=oe(),S=ci(),[C,w]=Z.useState(`active`),[T,E]=Z.useState(30),D=Xs(p,{enabled:e===`tasks`,status:C,settledLimit:T}),O=z(e=>{w(e),E(30)}),A=z(()=>E(e=>e+30)),j=z(e=>{S(e,!1)}),M=$e(),N=Ne(e=>e.archiveSessions),P=Ne(e=>e.updateSessionTitle),I=Ne(e=>e.requestSessionSmartTitle),L=Ne(e=>e.shareSession),R=Ne(e=>e.unshareSession),B=Ne(e=>e.openNewSessionDraft),V=ye(e=>e.openDraft),H=ye(e=>e.openSession),U=ae(e=>e.projects),ee=se(e=>e.projectSortOrder),te=Cr(),ne=Z.useMemo(()=>U.filter(e=>e.hostId).map(tt),[U]),re=Z.useMemo(()=>ne.flatMap(e=>m.get(e.id)??[]).map(e=>({pinned:!!e.pinned,time:Ge(e.node.session),session:{id:e.identity,title:e.node.session.title||``,content:e.content}})),[ne,m]),W=Se(e=>e.sessionOrderByScope[br]),ie=Z.useMemo(()=>kr([...p.pinnedSessions,...re.filter(e=>e.pinned).map(e=>e.session)],e=>e.id,W),[p.pinnedSessions,re,W]),ce=Z.useMemo(()=>[...p.inProgressSessions.map(e=>({session:e,time:p.sessionById.get(e.id)?Ge(p.sessionById.get(e.id)):0})),...re.filter(e=>!e.pinned)].sort((e,t)=>t.time-e.time).map(e=>e.session),[p.inProgressSessions,p.sessionById,re]),le=ae(e=>e.setActiveProjectIdOnly),ue=ae(e=>e.removeProject),de=Vn(),[G,pe]=Z.useState(null),[me,he]=Z.useState(!1),[K,ge]=Z.useState(null),[_e,be]=Z.useState(null),[xe,Ce]=Z.useState(null),[we,Te]=Z.useState(``),[Ee,De]=Z.useState(!1),[Oe,ke]=Z.useState(!1),[Ae,je]=Z.useState(null),[Fe,Ie]=Z.useState(null),[Le,Re]=Z.useState(null),ze=G?.kind===`session`?G.session.id:``,Be=We(ze),Ve=Be?.type===`busy`||Be?.type===`retry`,J=Me(ze),Ue=G?.kind===`session`?Vr(G.session):``,{unread:Ke,onToggleRead:qe}=ai(G?.kind===`session`?G.session:null,Ue,J),Ye=!!ze&&Le===ze,Xe=!Ue||Ye||Ve,Ze=z(e=>{let t=new Map;for(let e of p.allSessions){let n=mi(e);if(!n)continue;let r=t.get(n)??[];r.push(e.id),t.set(n,r)}let n=[],r=new Set,i=e=>{if(!r.has(e)){r.add(e),n.push(e);for(let n of t.get(e)??[])i(n)}};return i(e),n}),Qe=z(()=>{he(!1),pe(null)}),et=z(e=>{if(oi(e.id)){let t=ei(e.id);if(!t)return;t.kind===`more`?p.showMoreBucketSessions(t.projectId,t.bucketKey):p.resetBucketVisibleCount(t.projectId,t.bucketKey);return}let t=p.sessionById.get(e.id),r=t&&Vr(t)||null;n({sessionId:e.id,directory:r})}),nt=Z.useRef(null),rt=z(()=>{nt.current!==null&&(window.clearTimeout(nt.current),nt.current=null)}),it=z(e=>{if(rt(),e.pointerType!==`touch`&&e.pointerType!==`pen`)return;let t=(e.target?.closest(`[data-mobile-session-id]`))?.dataset.mobileSessionId,n=t?p.sessionById.get(t):void 0;if(!t||!n||oi(t))return;let r=Vr(n)||null;nt.current=window.setTimeout(()=>{nt.current=null,He(t,r)},60)});Z.useEffect(()=>rt,[rt]);let at=z(e=>{et({id:e,title:``})}),st=z(e=>{oi(e.id)||x(e.id)}),ct=z(async t=>{if(oi(t.id)||fe(k()).read().has(t.id))return;if(e===`tasks`){let e=M.has(t.id);e&&x(t.id),S(t.id,!0),Y.success(u(`sessions.sidebar.session.archive.success`),{action:{label:u(`sessions.sidebar.undo`),onClick:()=>{S(t.id,!1),e&&x(t.id)}}});return}let n=Ze(t.id),{archivedIds:r,failedIds:i}=await N(n);r.length>0&&gi({sessionIds:r,message:r.length===1?u(`sessions.sidebar.session.archive.success`):u(`sessions.sidebar.bulkActions.archivedPlural`,{count:r.length}),undoLabel:u(`sessions.sidebar.undo`),settingsLabel:u(`settings.yuri.archivedSessions.actions.view`),undoFailedMessage:r.length===1?u(`sessions.sidebar.session.archive.undoFailed`):u(`sessions.sidebar.bulkActions.archiveUndoFailed`,{count:r.length})}),i.length>0&&Y.error(i.length===1?u(`sessions.sidebar.bulkActions.failedArchiveSingle`,{count:i.length}):u(`sessions.sidebar.bulkActions.failedArchivePlural`,{count:i.length}))}),lt=z(()=>{if(!G||G.kind!==`session`)return;let e=G.session,t=Vr(e),n=Be?.type??`idle`;!t||Le===e.id||n===`busy`||n===`retry`||(Re(e.id),(async()=>{try{await de.refreshSessionTranscript(e.id,{directory:t}),Y.success(u(`sessions.sidebar.session.menu.refreshTranscriptSuccess`))}catch{Y.error(u(`sessions.sidebar.session.menu.refreshTranscriptFailed`))}finally{Re(t=>t===e.id?null:t)}})())}),ut=z(e=>{if(oi(e.id))return;let t=p.sessionById.get(e.id);t&&(pe({kind:`session`,session:t}),he(!0))}),dt=z(e=>{ut({id:e,title:``})}),ft=z(e=>{y(e.id,!e.expanded)}),pt=z((e,t)=>{b(`${e.id}::${t.id}`,!t.expanded)}),mt=z((e,t)=>{le(e.id),V({selectedProjectId:e.id,directoryOverride:t,preserveDirectoryOverride:!0})}),ht=z(()=>{let e=ae.getState().getActiveProject();if(e?.hostId){lr(tt(e),!0).catch(e=>Y.error(e instanceof Error?e.message:String(e)));return}if(i){i();return}B()}),gt=z(e=>{let t=p.projectMetaById.get(e.id);t&&(pe({kind:`project`,project:t,isGitRepository:!1}),he(!0),d.checkIsGitRepository(t.path).then(e=>{pe(n=>Zs(n,t.id,e))}).catch(()=>{pe(e=>Zs(e,t.id,!1))}))}),_t=z((e,t)=>{let n=h(t);return n?e.worktrees.find(e=>h(e.path)===n)||((Ne.getState().availableWorktreesByProject.get(e.path)??[]).find(e=>h(e.path)===n)??null):null}),vt=z((e,t)=>{let n=p.projectMetaById.get(e.id);n&&mt(n,t.path)}),yt=z((e,t)=>{let n=p.projectMetaById.get(e.id);n&&(pe({kind:`worktree`,project:n,worktreePath:t.path,worktreeName:t.name}),he(!0))}),bt=z((e,t)=>{let n=p.projectMetaById.get(e.id);if(!n)return;let r=_t(n,t.path);if(!r){Y.error(u(`sessions.sidebar.sessionDialogs.worktree.errorRemoveTitle`),{description:u(`sessions.sidebar.dialogs.deleteResult.tryAgain`)});return}Ie({project:n,worktree:r})}),xt=z(e=>{je(e),le(e),ke(!0)}),St=z(e=>{(async()=>{let t=e.worktrees;try{t=(await Jn({id:e.id,path:e.path})).worktrees}catch(n){console.warn(`[MobileProjectsHome] Worktree refresh before session sync failed:`,n),t=Ne.getState().availableWorktreesByProject.get(e.path)??e.worktrees}await ve([e.path,...t.map(e=>e.path)],p.allSessions)})()}),Ct=z((e,t)=>{let n=Ae;if(ke(!1),je(null),t?.sessionId){H({sessionId:t.sessionId,directory:e});return}V({selectedProjectId:n,directoryOverride:e,preserveDirectoryOverride:!0})}),wt=z(async e=>{try{if(!(await L(e.id))?.share?.url){Y.error(u(`sessions.sidebar.session.share.error`));return}Y.success(u(`sessions.sidebar.session.share.successTitle`),{description:u(`sessions.sidebar.session.share.successDescription`)})}catch{Y.error(u(`sessions.sidebar.session.share.error`))}}),Tt=z(async e=>{if((await Je(e)).ok){Y.success(u(`sessions.sidebar.session.menu.copied`));return}Y.error(u(`sessions.sidebar.session.share.copyUrlError`))}),Et=z(async e=>{try{if(await R(e)){Y.success(u(`sessions.sidebar.session.unshare.success`));return}Y.error(u(`sessions.sidebar.session.unshare.error`))}catch{Y.error(u(`sessions.sidebar.session.unshare.error`))}}),Dt=z(e=>{let t=Ze(e.id);Ir({sessionIds:t,message:t.length===1?u(`sessions.sidebar.session.delete.success`):u(`sessions.sidebar.bulkActions.deletedPlural`,{count:t.length}),undoLabel:u(`sessions.sidebar.undo`),commitFailedMessage:u(`sessions.sidebar.session.delete.error`)})}),Ot=z(async()=>{if(!xe)return;let e=we.trim();if(e)try{await P(xe.id,e),Ce(null),Te(``)}catch{Y.error(u(`sessions.sidebar.session.menu.rename`),{description:u(`sessions.sidebar.dialogs.deleteResult.tryAgain`)})}}),kt=z(async()=>{if(!xe||Ee)return;let e=xe.id;Ce(null),Te(``),De(!0);try{await I(e)}catch{Y.error(u(`sessions.sidebar.session.rename.smartTitle`),{description:u(`sessions.sidebar.dialogs.deleteResult.tryAgain`)})}finally{De(!1)}}),At=Z.useMemo(()=>G?G.kind===`session`?{kind:`session`,title:G.session.title?.trim()||u(`mobile.sessions.untitled`),pinned:M.has(G.session.id),shared:!!G.session.share?.url,unread:Ke}:G.kind===`project`?{kind:`project`,title:G.project.label,gitRepository:G.isGitRepository}:{kind:`worktree`,title:G.worktreeName}:null,[G,Ke,M,u]),jt=Z.useMemo(()=>{if(!G)return{};if(G.kind===`session`){let e=G.session;return{onRename:()=>{Te(e.title?.trim()||u(`mobile.sessions.untitled`)),Ce(e)},onTogglePin:()=>x(e.id),onToggleRead:qe,onShare:f&&!e.share?.url?()=>{wt(e)}:void 0,onCopyLink:f&&e.share?.url?()=>{Tt(e.share.url)}:void 0,onUnshare:f&&e.share?.url?()=>{Et(e.id)}:void 0,onRefreshTranscript:lt,onArchive:J?void 0:()=>{ct({id:e.id,title:e.title?.trim()||u(`mobile.sessions.untitled`)})},onDelete:()=>Dt(e)}}if(G.kind===`project`){let e=G.project;return{onNewSession:()=>mt(e,e.path),onNewWorktree:()=>xt(e.id),onSyncSessions:()=>St(e),onEditProject:()=>ge(e.id),onCloseProject:()=>be(e)}}let{project:e,worktreePath:t}=G;return{onNewSession:()=>mt(e,t),onDeleteWorktree:()=>{let n=_t(e,t);if(!n){Y.error(u(`sessions.sidebar.sessionDialogs.worktree.errorRemoveTitle`),{description:u(`sessions.sidebar.dialogs.deleteResult.tryAgain`)});return}Ie({project:e,worktree:n})}}},[G,ct,Tt,Dt,lt,xt,St,wt,Et,qe,J,_t,f,mt,u,x]),Mt=Z.useMemo(()=>{if(!K)return null;let e=U.find(e=>e.id===K),t=p.projectMetaById.get(K);if(!e||!t)return null;let n=G?.kind===`project`&&G.project.id===K?G.isGitRepository:t.worktrees.length>0;return{id:e.id,label:e.label?.trim()||t.label,path:h(e.path)||t.path,icon:e.icon,color:e.color,iconImage:e.iconImage,iconBackground:e.iconBackground,isGitRepo:n,worktrees:t.worktrees}},[G,K,p.projectMetaById,U]);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`contents`,onPointerDownCapture:it,onPointerMoveCapture:rt,onPointerCancelCapture:rt,children:(0,$.jsx)(Fr,{remoteProjects:ne,hostRegistry:te.registry,projectOrderIds:Gr(U,ee).map(e=>e.id),renderRemoteProject:te.registry?e=>(0,$.jsx)(ui,{project:e,registry:te.registry,mobile:!0,reorderEnabled:!1,onActivityItems:_}):void 0,remoteError:te.catalog.error?.message,className:l,projects:p.projects,pinnedSessions:ie,inProgressSessions:ce,onAddProject:r,onNewSession:ht,onScanQr:a,onSwitchInstance:o,instanceOptions:c,onRemoteDesktop:s,onToggleProject:ft,onOpenProjectActions:gt,onToggleWorktree:pt,onNewWorktreeSession:vt,onOpenWorktreeActions:yt,onDeleteWorktree:bt,onSelectSession:et,onPinSession:st,onArchiveSession:e=>{ct(e)},onOpenSessionActions:ut,onReorderSessions:v,task:{view:e,onViewChange:t,model:D,status:C,onStatusChange:O,onShowMoreSettled:A,onSelectTask:at,onOpenTaskActions:dt,onRestoreTask:j}})}),(0,$.jsx)(mr,{open:me,target:At,actions:jt,refreshTranscriptDisabled:Xe,refreshTranscriptSpinning:Ye,onOpenChange:e=>{e?he(!0):Qe()}}),(0,$.jsx)(Bn,{open:Oe,projectId:Ae,onOpenChange:e=>{ke(e),e||je(null)},onWorktreeCreated:Ct}),Fe?(0,$.jsx)(Jr,{open:!0,project:{id:Fe.project.id,path:Fe.project.path},worktree:Fe.worktree,onClose:()=>Ie(null)}):null,(0,$.jsx)(Gn,{open:!!_e,title:u(`sessions.sidebar.project.actions.closeProject`),onClose:()=>be(null),closeAriaLabel:u(`mobile.surface.closeAria`),footer:(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[(0,$.jsx)(q,{type:`button`,variant:`ghost`,className:`flex-1`,onClick:()=>be(null),children:u(`sessions.sidebar.dialogs.cancel`)}),(0,$.jsx)(q,{type:`button`,variant:`destructive`,className:`flex-1`,onClick:()=>{if(!_e)return;let e=_e;be(null),ue(e.id),Y.success(u(`mobile.sessions.toast.projectRemoved`,{label:e.label}))},children:u(`mobile.sessions.confirmRemoveProject`)})]}),children:(0,$.jsx)(`p`,{className:`px-1 py-1 typography-ui-body text-foreground`,children:u(`mobile.projects.closeConfirmMessage`,{title:_e?.label??``})})}),(0,$.jsx)(Gn,{open:!!xe,title:u(`sessions.sidebar.session.menu.rename`),onClose:()=>{Ee||(Ce(null),Te(``))},closeAriaLabel:u(`mobile.surface.closeAria`),footer:(0,$.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,$.jsx)(q,{type:`button`,variant:`default`,className:`flex-1`,disabled:Ee,onClick:()=>{Ce(null),Te(``)},children:u(`sessions.sidebar.dialogs.cancel`)}),(0,$.jsx)(q,{type:`button`,variant:`default`,className:`flex-1`,disabled:!we.trim()||Ee,onClick:()=>void Ot(),children:u(`sessions.sidebar.session.rename.save`)})]}),children:(0,$.jsxs)(`form`,{className:`flex flex-col gap-3 px-1 py-1`,onSubmit:e=>{e.preventDefault(),Ot()},children:[(0,$.jsx)(Jt,{value:we,onChange:e=>Te(e.target.value),autoFocus:!0,className:`h-12`,disabled:Ee}),(0,$.jsxs)(q,{type:`button`,variant:`outline`,className:`w-full gap-2`,disabled:Ee,onClick:()=>void kt(),children:[Ee?(0,$.jsx)(X,{name:`loader-4`,className:`size-4 animate-spin`}):(0,$.jsx)(X,{name:`ai-generate-2`,className:`size-4`}),u(`sessions.sidebar.session.rename.smartTitle`)]})]})}),(0,$.jsx)(ti,{open:K!==null,project:Mt,onClose:()=>ge(null)})]})}function $s(e){let t=(0,Q.c)(10),{children:n,content:r,className:i,contentClassName:a,showHeader:o}=e,s=o===void 0||o,{t:c}=ot(),l;t[0]===c?l=t[1]:(l=c(`sessions.scheduledTasks.dialog.title`),t[0]=c,t[1]=l);let u;t[2]===a?u=t[3]:(u=J(`yuri-mobile-scheduled-content`,a),t[2]=a,t[3]=u);let d=n??r,f;return t[4]!==i||t[5]!==s||t[6]!==l||t[7]!==u||t[8]!==d?(f=(0,$.jsx)(Gi,{title:l,className:i,surface:!1,scrollsWithPage:!0,showHeader:s,surfaceClassName:u,children:d}),t[4]=i,t[5]=s,t[6]=l,t[7]=u,t[8]=d,t[9]=f):f=t[9],f}var ec=Yt(()=>H(()=>import(`./AssistantView-CDPTtrUZ.js`).then(e=>({default:e.AssistantView})),__vite__mapDeps([3,1,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,2,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103]))),tc=Yt(()=>H(()=>import(`./MobileAssistantTab-BbccE67x.js`).then(e=>({default:e.MobileAssistantTab})),__vite__mapDeps([104,1,6,7,8,9,10,21,5,12,4,22,13,14,15,16,23,17,18,19,24,25,26,27,28,29,30,31,2,32,11,20,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,51,52,92,71,57,72,73,64,74,75,105,106,107,108,99,100,101,67,68,102,103]))),nc=Yt(()=>H(()=>import(`./MobileAssistantSettingsPage-DVpE3b24.js`).then(e=>({default:e.MobileAssistantSettingsPage})),__vite__mapDeps([109,1,6,7,38,13,5,4,14,15,39,17,18,40,41,16,2,42,53,21,12,22,23,19,24,25,26,27,28,29,30,31,8,9,10,32,11,20,33,34,35,36,37,43,44,45,46,47,48,110,111,106,107,112,55,56,67,68,113,103,79,114,51,66,69,70,52,71,57,72,73,64,74,75,115,77,78,50,95,96,97,116,117,118,119,120,121,122,123,124,125,126,127,128,129]))),rc=Yt(()=>H(()=>import(`./MobileBtwPage-BRN1gAmR.js`).then(e=>({default:e.MobileBtwPage})),__vite__mapDeps([130,6,1,7,38,13,5,4,14,15,39,17,18,40,41,16,2,42,131,8,9,10,21,12,22,23,19,24,25,26,27,28,29,30,31,32,11,20,33,34,35,36,37,43,44,45,46,47,73,69,53,48,132,83,84,77,57,78,122,50,113,103,62,61,63,64,133,134,135,76,79,55,56,60,58,59,118,119,136,90,137,88,138,139,140]))),ic=Yt(()=>H(()=>import(`./MobileSettingsTab-of6zpTsr.js`).then(e=>({default:e.MobileSettingsTab})),__vite__mapDeps([141,6,1,7,38,13,5,4,14,15,39,17,18,40,41,16,2,42,96,97,106,21,12,22,23,19,24,25,26,27,28,29,30,31,8,9,10,32,11,20,33,34,35,36,37,43,44,45,46,47,107,142,143,144,145,48,55,56,67,68,122,72,146,50,113,103,102,147,79,148,149,150,151,152,153,154,155,156,157,158,159,131,73,69,160,161,114,61,62,63,64,162,51,53,163,164,110,111,126,119,115,77,57,78,165,166,167,123,124,125,140,168,169,170,171,172,173,174,175,116,176,177,178,179,180,118,87,88,138,181,182,117,120,121,127,183,71,74,75,112,66,70,52,95,128,129,184,185,186,187,188,189,190,191,192,193,194,195,196,197])));function ac(e){let t=(0,Q.c)(2),n;return t[0]===e?n=t[1]:(n=(0,$.jsx)(ec,{...e}),t[0]=e,t[1]=n),n}function oc(e){let t=(0,Q.c)(2),n;return t[0]===e?n=t[1]:(n=(0,$.jsx)(tc,{...e}),t[0]=e,t[1]=n),n}function sc(e){let t=(0,Q.c)(2),n;return t[0]===e?n=t[1]:(n=(0,$.jsx)(nc,{...e}),t[0]=e,t[1]=n),n}function cc(e){let t=(0,Q.c)(2),n;return t[0]===e?n=t[1]:(n=(0,$.jsx)(rc,{...e}),t[0]=e,t[1]=n),n}function lc(e){let t=(0,Q.c)(2),n;return t[0]===e?n=t[1]:(n=(0,$.jsx)(ic,{...e}),t[0]=e,t[1]=n),n}var uc=`yuri.mobile.homeView`;function dc(e){let t=(0,Q.c)(121),{onAddProject:n,onScanQr:r,onSwitchInstance:i,onRemoteDesktop:a,remoteDesktopActive:o,instanceOptions:s,onEnableAssistants:c,instancesPage:l,instancesSecondaryPage:u,parentSessionTarget:d,registerSecondaryBackHandler:f,scheduledContent:p,renderChat:m,className:g}=e,_=o!==void 0&&o,v=d===void 0?null:d,{t:y}=ot(),[b,x]=Z.useState(Mc),S;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(S=e=>{x(e);try{O().setItem(uc,e)}catch{}},t[0]=S):S=t[0];let C=z(S),w=U(jc),T=ye(),E=ye(Ac),D=ye(kc),k=ye(Oc),A=ye(Dc),j=ye(Ec),M=ye(Tc),N=ye(wc),P=ye(Cc),F=ye(Sc),I=ye(xc),L=ye(bc),R=ye(yc),B;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(B=[],t[1]=B):B=t[1],Z.useEffect(vc,B);let V=T.secondary?.kind===`chat`?T.secondary.btw??null:null,H=Z.useRef(null),ee,te;t[2]===V?(ee=t[3],te=t[4]):(ee=()=>{let e=H.current;H.current=V,e&&e!==V&&Xt.getState().clear({sessionId:e.sessionId,directory:e.directory}),V?Qt(en):$t(en)},te=[V],t[2]=V,t[3]=ee,t[4]=te),Z.useEffect(ee,te);let ne;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(ne=[],t[5]=ne):ne=t[5],Z.useEffect(gc,ne);let re;t[6]===E?re=t[7]:(re=e=>{e===`settings`&&U.getState().setSettingsPage(`home`),E(e)},t[6]=E,t[7]=re);let W=z(re),ie;t[8]===D?ie=t[9]:(ie=e=>{D(e)},t[8]=D,t[9]=ie);let ae=z(ie),oe;t[10]===N?oe=t[11]:(oe=()=>{N()},t[10]=N,t[11]=oe);let se=z(oe),ce;t[12]===k?ce=t[13]:(ce=()=>{k()},t[12]=k,t[13]=ce);let le=z(ce),ue;t[14]===A?ue=t[15]:(ue=e=>{A(e)},t[14]=A,t[15]=ue);let de=z(ue),G=Z.useRef(null),[fe,pe]=Z.useState(!1),me;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(me=e=>{G.current=e},t[16]=me):me=t[16];let he=z(me),K;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(K=e=>{pe(e)},t[17]=K):K=t[17];let ge=z(K),ve;t[18]!==se||t[19]!==v||t[20]!==M||t[21]!==R||t[22]!==P?(ve=()=>{if(G.current?.())return!0;let e=ye.getState().secondary;return e?.kind===`chat`&&e.btw?(R(),!0):e?.kind===`assistant`&&e.settingsAssistantID?(M(),!0):(e?.kind===`draft`||e?.kind===`chat`)&&v?.onSelect?(v.onSelect(),!0):e?.kind===`chat`&&e.routes.length>1?(P(),!0):e?(se(),!0):!1},t[18]=se,t[19]=v,t[20]=M,t[21]=R,t[22]=P,t[23]=ve):ve=t[23];let be=z(ve),xe=T.secondary!==null,Se;t[24]!==be||t[25]!==f?(Se=()=>{if(f)return f(()=>be()),()=>f(null)},t[24]=be,t[25]=f,t[26]=Se):Se=t[26];let we;t[27]!==be||t[28]!==f||t[29]!==xe?(we=[f,xe,be],t[27]=be,t[28]=f,t[29]=xe,t[30]=we):we=t[30],Z.useEffect(Se,we);let Te=Ne(hc),q=Ce(mc),Ee;t[31]===Te?Ee=t[32]:(Ee=e=>Te?e.getDirectoryForSession(Te):null,t[31]=Te,t[32]=Ee);let De=Ne(Ee),Oe,ke;t[33]!==De||t[34]!==Te||t[35]!==I||t[36]!==q||t[37]!==L?(Oe=()=>{let e=ye.getState().secondary;if(q)return;if(e?.kind===`draft`&&Te){I({sessionId:Te,directory:De});return}if(e?.kind!==`chat`||!Te||_e({sessionId:Te,directory:De})===`internal`)return;let t=e.routes.at(-1);(t?.sessionId!==Te||h(t.directory)!==h(De))&&L({sessionId:Te,directory:De})},ke=[De,Te,I,L,q],t[33]=De,t[34]=Te,t[35]=I,t[36]=q,t[37]=L,t[38]=Oe,t[39]=ke):(Oe=t[38],ke=t[39]),Z.useEffect(Oe,ke);let Ae,je;t[40]!==Te||t[41]!==v||t[42]!==F||t[43]!==q?(Ae=()=>{let e=ye.getState().secondary;if(e?.kind!==`chat`||!v||v.onSelect||q)return;let t=e.routes.at(-1);!t||t.sessionId!==Te||F({sessionId:v.id,directory:v.directory})},je=[Te,v,F,q],t[40]=Te,t[41]=v,t[42]=F,t[43]=q,t[44]=Ae,t[45]=je):(Ae=t[44],je=t[45]),Z.useEffect(Ae,je);let Me;t[46]!==ge||t[47]!==he||t[48]!==p?(Me=typeof p==`function`?p(he,ge):p,t[46]=ge,t[47]=he,t[48]=p,t[49]=Me):Me=t[49];let Pe=Me,Fe;t[50]!==C||t[51]!==le||t[52]!==b||t[53]!==s||t[54]!==n||t[55]!==a||t[56]!==r||t[57]!==i||t[58]!==ae?(Fe=(0,$.jsx)(Qs,{homeView:b,onHomeViewChange:C,onOpenChat:ae,onAddProject:n,onNewSession:le,onScanQr:r,onSwitchInstance:i,onRemoteDesktop:a,instanceOptions:s}),t[50]=C,t[51]=le,t[52]=b,t[53]=s,t[54]=n,t[55]=a,t[56]=r,t[57]=i,t[58]=ae,t[59]=Fe):Fe=t[59];let Ie;t[60]!==c||t[61]!==de?(Ie=(0,$.jsx)(oc,{onEnable:c,onOpenAssistant:de}),t[60]=c,t[61]=de,t[62]=Ie):Ie=t[62];let Le;t[63]===Pe?Le=t[64]:(Le=(0,$.jsx)($s,{showHeader:!1,children:Pe}),t[63]=Pe,t[64]=Le);let Re;t[65]===l?Re=t[66]:(Re=(0,$.jsx)(lc,{instancesPage:l}),t[65]=l,t[66]=Re);let ze;t[67]!==Fe||t[68]!==Ie||t[69]!==Le||t[70]!==Re?(ze={projects:Fe,assistant:Ie,scheduled:Le,settings:Re},t[67]=Fe,t[68]=Ie,t[69]=Le,t[70]=Re,t[71]=ze):ze=t[71];let Be=ze,Ve=T.secondary?.kind??null,He;bb0:{if(!Ve){He=null;break bb0}let e;t[72]!==be||t[73]!==j||t[74]!==y?(e=e=>({key:`assistant-secondary`,depth:1,ariaLabel:y(`assistants.title`),onBack:be,content:(0,$.jsx)(ac,{activeOverride:e,onMobileBack:pc,onMobileOpenSettings:j})}),t[72]=be,t[73]=j,t[74]=y,t[75]=e):e=t[75];let n=e;if(Ve===`assistant`){let e=T.secondary?.kind===`assistant`?T.secondary.settingsAssistantID:void 0,r=!e,i;t[76]!==n||t[77]!==r?(i=n(r),t[76]=n,t[77]=r,t[78]=i):i=t[78];let a;t[79]!==be||t[80]!==e||t[81]!==y?(a=e?[{key:`assistant-settings:${e}`,depth:2,ariaLabel:y(`assistants.conversation.openSettings`),onBack:be,content:(0,$.jsx)(sc,{assistantID:e,onBack:fc})}]:[],t[79]=be,t[80]=e,t[81]=y,t[82]=a):a=t[82];let o;t[83]!==i||t[84]!==a?(o=[i,...a],t[83]=i,t[84]=a,t[85]=o):o=t[85],He=o;break bb0}if(Ve===`instances`){let e;t[86]===y?e=t[87]:(e=y(`mobile.settings.switchInstance`),t[86]=y,t[87]=e);let n;t[88]!==be||t[89]!==u||t[90]!==e?(n=[{key:`instances-secondary`,depth:1,ariaLabel:e,onBack:be,content:u}],t[88]=be,t[89]=u,t[90]=e,t[91]=n):n=t[91],He=n;break bb0}if(T.secondary?.kind===`draft`){let e;t[92]===y?e=t[93]:(e=y(`mobile.nav.secondaryPageAria`),t[92]=y,t[93]=e);let n=q?``:Te??``,r=q?null:De,i;t[94]!==m||t[95]!==n||t[96]!==r?(i=m({sessionId:n,directory:r,viewKey:`chat-primary`,active:!0}),t[94]=m,t[95]=n,t[96]=r,t[97]=i):i=t[97];let a;t[98]!==be||t[99]!==e||t[100]!==i?(a=[{key:`chat-primary`,depth:1,ariaLabel:e,onBack:be,content:i}],t[98]=be,t[99]=e,t[100]=i,t[101]=a):a=t[101],He=a;break bb0}if(T.secondary?.kind!==`chat`){let e;t[102]===Symbol.for(`react.memo_cache_sentinel`)?(e=[],t[102]=e):e=t[102],He=e;break bb0}let r=T.secondary.routes,i;if(t[103]!==n||t[104]!==be||t[105]!==T.secondary.btw||t[106]!==T.secondary.returnTo||t[107]!==m||t[108]!==r||t[109]!==y){let e=T.secondary.returnTo?[n(!1)]:[],a=T.secondary.btw,o=r.slice(a?-1:-2),s=r.length-o.length+1+e.length,c=o.map((e,t)=>{let n=!a&&t===o.length-1;return{key:e.key,depth:s+t,ariaLabel:y(`mobile.nav.secondaryPageAria`),onBack:be,content:m({sessionId:e.sessionId,directory:e.directory,viewKey:e.key,active:n})}});i=a?[...e,...c,{key:`chat-btw`,depth:r.length+1+e.length,ariaLabel:y(`chat.btw.title`),onBack:be,content:(0,$.jsx)(cc,{route:a})}]:[...e,...c],t[103]=n,t[104]=be,t[105]=T.secondary.btw,t[106]=T.secondary.returnTo,t[107]=m,t[108]=r,t[109]=y,t[110]=i}else i=t[110];He=i}let J=He,Ue;t[111]===J?Ue=t[112]:(Ue=J??[],t[111]=J,t[112]=Ue);let We=fe||w||_,Ge;return t[113]!==g||t[114]!==b||t[115]!==T||t[116]!==W||t[117]!==Ue||t[118]!==We||t[119]!==Be?(Ge=(0,$.jsx)(Gs,{homeView:b,className:g,navigation:T,onTabChange:W,tabs:Be,secondaryPages:Ue,tabBarCovered:We}),t[113]=g,t[114]=b,t[115]=T,t[116]=W,t[117]=Ue,t[118]=We,t[119]=Be,t[120]=Ge):Ge=t[120],Ge}function fc(){Wt.requestAnimatedBack(`root`)}function pc(){return Wt.requestAnimatedBack(`root`)}function mc(e){return e.remoteSession}function hc(e){return e.currentSessionId}function gc(){return _c}function _c(){return $t(en)}function vc(){return ge()}function yc(e){return e.popBtw}function bc(e){return e.replaceChatSession}function xc(e){return e.materializeDraftSession}function Sc(e){return e.reconcileChatPredecessor}function Cc(e){return e.popChatSession}function wc(e){return e.closeSecondary}function Tc(e){return e.popAssistantSettings}function Ec(e){return e.pushAssistantSettings}function Dc(e){return e.openAssistant}function Oc(e){return e.openDraft}function kc(e){return e.openSession}function Ac(e){return e.setActiveTab}function jc(e){return e.isCommandPaletteOpen}function Mc(){return vr(O().getItem(uc))}function Nc(e){let t=(0,Q.c)(7),n=e===void 0?2500:e,{uiFont:r}=dr(),[i,a]=Z.useState(!1),o,s;t[0]===i?(o=t[1],s=t[2]):(o=()=>{if(!i)return;let e=document.getElementById(`initial-loading`);if(!e)return;e.classList.add(`fade-out`);let t=window.setTimeout(()=>e.remove(),300);return()=>window.clearTimeout(t)},s=[i],t[0]=i,t[1]=o,t[2]=s),Z.useEffect(o,s);let c,l;return t[3]!==n||t[4]!==r?(c=()=>{let e=!1,t=()=>{e||a(!0)},i=()=>{requestAnimationFrame(()=>requestAnimationFrame(t))},o=Promise.all([An(r).catch(Rc),document.fonts?.ready?.then(Lc).catch(Ic)??Promise.resolve(),Qi.catch(Fc)]).then(Pc),s=new Promise(e=>{window.setTimeout(e,n)});return Promise.race([o,s]).then(i),()=>{e=!0}},l=[r,n],t[3]=n,t[4]=r,t[5]=c,t[6]=l):(c=t[5],l=t[6]),Z.useEffect(c,l),i}function Pc(){}function Fc(){}function Ic(){}function Lc(){}function Rc(){}var zc=e=>e.replace(/^\/+|\/+$/g,``),Bc=e=>{let t=e.get(`directory`)||e.get(`dir`)||e.get(`path`);if(typeof t!=`string`)return;let n=t.trim();return n.length>0?n:void 0},Vc=e=>{let t=zc(e.pathname).split(`/`).filter(Boolean);return e.host?[e.host,...t]:t};function Hc(e){if(typeof e!=`string`||e.length===0)return null;let t;try{t=new URL(e)}catch{return null}if(![`yuri:`,`openchamber:`,`openchambery:`].includes(t.protocol))return null;let n=Vc(t),r=(n[0]??``).toLowerCase(),i=n.slice(1),a=t.searchParams;switch(r){case`connect`:{let t=Ai(e);return t?{type:`connect`,pairing:t}:null}case`session`:{let e=i[0]||a.get(`id`)||``;return e?{type:`session`,sessionId:e,directory:Bc(a)}:null}case`assistant`:{let e=i[0]||a.get(`id`)||``;return e?{type:`assistant`,assistantId:e}:null}case`new`:case`new-session`:{let e=a.get(`prompt`)?.trim();return{type:`new-session`,directory:Bc(a),projectId:a.get(`project`)??void 0,agent:a.get(`agent`)??void 0,model:a.get(`model`)??void 0,prompt:e||void 0}}case`project`:case`open-project`:{let e;if(i.length>0)try{e=decodeURIComponent(i.join(`/`))}catch{e=i.join(`/`)}let t=Bc(a)||e;return t?{type:`open-project`,directory:t}:null}case`sessions`:{let e=a.get(`filter`);return{type:`sessions`,filter:e===`attention`||e===`recent`||e===`all`?e:void 0}}case`status`:return{type:`status`};case`settings`:return{type:`settings`,section:i[0]||a.get(`section`)||void 0};case`changes`:return{type:`changes`,path:i.join(`/`)||a.get(`path`)||void 0,staged:a.get(`staged`)===`true`};case`view`:{let e=(i[0]||``).toLowerCase();return e===`changes`?{type:`changes`}:e===`files`||e===`mcp`||e===`instances`||e===`update`?{type:`view`,target:e}:null}default:return null}}var Uc={},Wc=null,Gc=!1,Kc=null,qc=e=>{switch(e.type){case`connect`:return Wc?(Wc(e.pairing),!0):!1;case`session`:return _()?(Ne.getState().setCurrentSession(e.sessionId,e.directory??null),!0):(ye.getState().openSession({sessionId:e.sessionId,directory:e.directory??null}),!0);case`assistant`:if(!_()){let t=ye.getState();return t.setActiveTab(`assistant`),t.openAssistant(e.assistantId),!0}return lt(e.assistantId),!0;case`new-session`:return _()?(Ne.getState().openNewSessionDraft({directoryOverride:e.directory??null,selectedProjectId:e.projectId??null,preserveDirectoryOverride:!!e.directory,ensureProjectForDirectory:!!e.directory,initialPrompt:e.prompt}),!0):(ye.getState().openDraft({directoryOverride:e.directory??null,selectedProjectId:e.projectId??null,preserveDirectoryOverride:!!e.directory,ensureProjectForDirectory:!!e.directory,initialPrompt:e.prompt}),!0);case`open-project`:return _()?(Ne.getState().openNewSessionDraft({directoryOverride:e.directory,preserveDirectoryOverride:!0}),!0):(ye.getState().openDraft({directoryOverride:e.directory,preserveDirectoryOverride:!0}),!0);case`sessions`:return Uc.openSessions?(Uc.openSessions(e.filter),!0):!1;case`status`:return Uc.openSessions?(Uc.openSessions(),!0):(U.getState().setMobileSessionPanelOpen(!0),!0);case`view`:return Uc.openView?(Uc.openView(e.target),!0):!1;case`changes`:return Uc.openChanges?(Uc.openChanges({path:e.path,staged:e.staged}),!0):!1;case`settings`:return Uc.openSettings?(Uc.openSettings(e.section),!0):!1}return!1},Jc=()=>{if(!Kc||!Gc&&Kc.type!==`connect`)return;let e=Kc;Kc=null,qc(e)||(Kc=e)},Yc=e=>{Kc=e,Jc()},Xc=e=>{let t=Hc(e);t&&Yc(t)},Zc=e=>{Gc=e,Jc()},Qc=e=>{let t=(0,Q.c)(3),n,r;t[0]===e?(n=t[1],r=t[2]):(n=()=>(Uc=e,Jc(),()=>{Uc===e&&(Uc={})}),r=[e],t[0]=e,t[1]=n,t[2]=r),Z.useEffect(n,r)},$c=e=>{let t=(0,Q.c)(3),n,r;t[0]===e?(n=t[1],r=t[2]):(n=()=>(Wc=e,Jc(),()=>{Wc===e&&(Wc=null)}),r=[e],t[0]=e,t[1]=n,t[2]=r),Z.useEffect(n,r)},el=e=>{let{ready:t}=e,[n,r]=Z.useState(()=>g()?`pending`:`none`);return Z.useEffect(()=>{Zc(t)},[t]),Z.useEffect(()=>{if(!g())return;let e=!1,t=[];return H(async()=>{let{App:e}=await import(`./vendor-capacitor-app-B5H_XtmE.js`).then(e=>e.t);return{App:e}},__vite__mapDeps([0,1,2])).then(async({App:n})=>{if(e)return;let i=await n.addListener(`appUrlOpen`,e=>{Xc(e?.url)});if(e){i.remove();return}t.push(()=>void i.remove());let a=await n.getLaunchUrl().catch(()=>void 0);if(e)return;let o=Hc(a?.url);r(o?.type===`connect`?`connect`:o?`other`:`none`),o&&Yc(o)}).catch(()=>{e||r(`none`)}),H(async()=>{let{PushNotifications:e}=await import(`./vendor-capacitor-push-notifications-D5cqJIPw.js`).then(e=>e.t);return{PushNotifications:e}},__vite__mapDeps([198,1,2])).then(async({PushNotifications:n})=>{if(e)return;let r=await n.addListener(`pushNotificationActionPerformed`,e=>{let t=e?.notification?.data,n=typeof t?.url==`string`?t.url:typeof t?.deeplink==`string`?t.deeplink:void 0;if(n){Xc(n);return}let r=typeof t?.assistantID==`string`?t.assistantID.trim():``;if(r){Yc({type:`assistant`,assistantId:r});return}let i=typeof t?.sessionId==`string`?t.sessionId:void 0;i&&Yc({type:`session`,sessionId:i})});if(e){r.remove();return}t.push(()=>void r.remove())}).catch(()=>void 0),()=>{e=!0,t.forEach(e=>e())}},[]),n},tl=.85,nl=8,rl=.35,il=.22,al=e=>({segmentStart:e,lastTouch:e,open:!1}),ol=e=>e*rl,sl=e=>e*il,cl=(e,t)=>Math.max(0,e-t),ll=(e,t)=>Math.max(0,t-e),ul=(e,t)=>{let n=Math.abs(e);return n<nl||Math.abs(t)<=n*tl},dl=(e,t,n)=>{let r=t.clientX-e.segmentStart.clientX,i=t.clientY-e.segmentStart.clientY,a=cl(e.segmentStart.clientX,t.clientX),o=ol(n),s=sl(n),c=e.open;return c=a<=0?!1:e.open?a>=s:a>=o&&ul(r,i),{segmentStart:e.segmentStart,lastTouch:t,open:c}},fl=e=>{if(e.disabled||e.startedOnExcludedTarget)return{open:!1,back:!1};let t=e.endX-e.startX,n=e.endY-e.startY,r=cl(e.startX,e.endX),i=ll(e.startX,e.endX),a=ol(e.viewportWidth),o=ul(t,n);return{open:r>=a&&o,back:i>=a&&o}},pl=(e,t,n)=>Math.min(cl(e,t)/Math.max(1,ol(n)),1),ml=(e,t,n)=>Math.min(ll(e,t)/Math.max(1,ol(n)),1),hl=e=>{let t=e;for(;t&&t!==document.body&&t!==document.documentElement;){let e=window.getComputedStyle(t).overflowX;if((e===`auto`||e===`scroll`)&&t.scrollWidth>t.clientWidth)return!0;t=t.parentElement}return!1},gl=e=>{let t=document.elementFromPoint(e.clientX,e.clientY);return!!t?.closest(`.yuri-mobile-composer`)||hl(t)},_l=1,vl=(e,t)=>{if(!e||e.rangeCount===0||e.isCollapsed)return!1;if(!t)return!0;let n=e.anchorNode;if(!n)return!1;let r=n.nodeType===_l?n:n.parentElement;return!!(r&&t.contains(r))},yl=e=>vl(window.getSelection(),e),bl=(e,t,n)=>{let r=Z.useRef(t.onOpen);r.current=t.onOpen;let i=Z.useRef(t.onPreviewStart);i.current=t.onPreviewStart;let a=Z.useRef(t.onPreviewCancel);a.current=t.onPreviewCancel;let o=Z.useRef(t.onProgress);o.current=t.onProgress;let s=Z.useRef(t.onBack);s.current=t.onBack;let c=Z.useRef(t.onBackProgress);c.current=t.onBackProgress;let l=Z.useRef(t.disabled);l.current=t.disabled,Z.useEffect(()=>{let t=e.current;if(!t)return;let n=!1,u=!1,d=null,f=!1,p=!1,m=!1,h=0,g=0,_=null,v=e=>{let t=ol(g),n=Ve({thresholdReached:p,distance:e,enterDistance:t,cancelDistance:sl(g),available:!0});p=n.thresholdReached,n.event===`enter`&&(m=Ke(`medium`,{bypassCadence:!0})),n.event===`cancel`&&(Ke(`light`,{bypassCadence:!0}),m=!1)},y=e=>{o.current?.(null),p&&!e&&Ke(`light`,{bypassCadence:!0}),p=!1,m=!1,e?r.current():f&&a.current?.(),f=!1},b=e=>{c.current?.(null),p&&!e&&Ke(`light`,{bypassCadence:!0}),p=!1,m=!1,e&&s.current?.()},x=e=>{if(e.touches.length!==1){n=!1,_=null;return}if(l.current){n=!1,_=null;return}let r=e.touches[0];n=!0,g=window.innerWidth,u=gl(r)||yl(t),d=null,f=!1,p=!1,m=!1,h=0,_=al(r)},S=e=>{if(!n||u||!_)return;if(e.touches.length!==1){d===`sessions`&&y(!1),d===`back`&&b(!1),n=!1,_=null;return}let r=e.touches[0];_=dl(_,r,g);let a=r.clientX-_.segmentStart.clientX,l=r.clientY-_.segmentStart.clientY;if(d===null){if(yl(t))return;let e=Math.abs(a);if(e<nl||Math.abs(l)>e*tl)return;if(a<0)d=`sessions`,f=!0,i.current?.();else if(s.current)d=`back`;else return}e.preventDefault(),h=d===`sessions`?cl(_.segmentStart.clientX,r.clientX):ll(_.segmentStart.clientX,r.clientX),v(h),d===`sessions`?o.current?.(pl(_.segmentStart.clientX,r.clientX,g)):c.current?.(ml(_.segmentStart.clientX,r.clientX,g))},C=e=>{if(!n||!_)return;if(n=!1,!d){_=null;return}let t=e.changedTouches[0];t&&(_=dl(_,t,g),h=d===`sessions`?cl(_.segmentStart.clientX,t.clientX):ll(_.segmentStart.clientX,t.clientX),v(h));let r=d===`sessions`?_.open:fl({startX:_.segmentStart.clientX,startY:_.segmentStart.clientY,endX:_.lastTouch.clientX,endY:_.lastTouch.clientY,viewportWidth:g,disabled:!1,startedOnExcludedTarget:!1}).back;_=null,e.preventDefault(),r&&!m&&Ke(`medium`,{bypassCadence:!0}),d===`sessions`?y(r):b(r)},w=()=>{d===`sessions`&&y(!1),d===`back`&&b(!1),n=!1,_=null};return t.addEventListener(`touchstart`,x,{passive:!0,capture:!0}),t.addEventListener(`touchmove`,S,{passive:!1,capture:!0}),t.addEventListener(`touchend`,C,{passive:!1,capture:!0}),t.addEventListener(`touchcancel`,w,{passive:!0,capture:!0}),()=>{f&&y(!1),d===`back`&&b(!1),t.removeEventListener(`touchstart`,x,!0),t.removeEventListener(`touchmove`,S,!0),t.removeEventListener(`touchend`,C,!0),t.removeEventListener(`touchcancel`,w,!0)}},[e,n])},xl=B(`YuriNotifications`),Sl=()=>V.getPlatform()===`android`&&V.isPluginAvailable(`YuriNotifications`);async function Cl(e,n){let r=f(),a=t(),o=a?``:p();if(!a&&!/^https?:\/\//.test(o))return null;let s=await i();s.set(`Accept-Language`,n);let c=(await an()).find(e=>sn(e)===r)?.candidates.find(e=>e.kind===`relay`);return{runtimeKey:r,baseUrl:o,relay:a??(c?.kind===`relay`?c.relay:void 0),preferRelay:!!a,headers:Object.fromEntries(s.entries()),labels:e}}function wl(e){let t=0,n=!1;return{refresh:async()=>{let r=++t;try{if(await e.plugin.stop(),n||r!==t)return;let i=await e.resolveConfig();if(n||r!==t||!i)return;let a=await e.plugin.configure({config:i});!n&&r===t&&e.onState(a.state)}catch{!n&&r===t&&e.onError()}},stop:()=>{++t,e.plugin.stop().catch(e.onError)},dispose:()=>{n=!0,++t,e.plugin.stop().catch(e.onError)}}}var Tl=()=>{if(Sl()||typeof window>`u`)return!1;let e=window.Capacitor?.getPlatform?.();return e===`ios`||e===`android`},El=(e,t)=>{x()?.push?.registerApnsToken?.({token:e,platform:y(),locale:t})},Dl=e=>{let{enabled:t}=e,n=U(e=>e.nativeNotificationsEnabled),r=st(e=>e.locale),i=Z.useRef(null),a=Z.useRef(r);a.current=r,Z.useEffect(()=>{if(!t||!n||!Tl())return;let e=!1,r=[];return H(async()=>{let{PushNotifications:e}=await import(`./vendor-capacitor-push-notifications-D5cqJIPw.js`).then(e=>e.t);return{PushNotifications:e}},__vite__mapDeps([198,1,2])).then(async({PushNotifications:t})=>{if(e)return;let n=await t.checkPermissions().catch(()=>null);if(n?.receive!==`granted`&&(n=await t.requestPermissions().catch(()=>null)),n?.receive!==`granted`)return;let o=await t.addListener(`registration`,e=>{i.current=e.value,El(e.value,a.current)}),s=await t.addListener(`registrationError`,e=>{console.warn(`[Push] APNs registration error:`,e)});if(await t.register().catch(()=>void 0),e){o.remove(),s.remove();return}r.push(()=>void o.remove(),()=>void s.remove())}).catch(()=>void 0),()=>{e=!0,r.forEach(e=>e())}},[t,n]),Z.useEffect(()=>{if(!t||!n||!Tl())return;let e=i.current;e&&El(e,r)},[t,n,r]),Z.useEffect(()=>{if(n)return;let e=i.current;e&&(i.current=null,x()?.push?.unregisterApnsToken?.({token:e}))},[n])},Ol=`YuriLiveActivity`,kl=5e3,Al=3600,jl=`live`,Ml=B(Ol),Nl=e=>e.isCapacitor&&e.platform===`ios`&&e.pluginAvailable;function Pl(){return typeof window>`u`?!1:Nl({isCapacitor:g(),platform:y(),pluginAvailable:V.isPluginAvailable(Ol)})}var Fl=()=>Ml,Il=new Set([`permission`,`input`,`retry`]),Ll=()=>({trackedSessionId:null,started:!1,startedAt:null,busySince:null,lastStatus:null,eventVersion:0,items:[]}),Rl=(e,t)=>Math.max(Math.floor(e),t+1),zl=e=>e.failedEpoch===e.currentEpoch?e.previous:e.current,Bl=e=>e.failedEpoch===e.currentEpoch&&e.retryCount<1,Vl=e=>e.hasSessionError?`error`:e.hasPendingPermissions?`permission`:e.hasPendingQuestions?`input`:e.statusType===`retry`?`retry`:e.statusType===`busy`?`working`:e.statusType===`idle`?`complete`:null,Hl=e=>{let t=e.trim();return t.length<=80?t:`${t.slice(0,79)}…`},Ul=e=>typeof e.parentID==`string`&&e.parentID.length>0?e.parentID:null,Wl=e=>{if(e.runningIds.size===0)return[];let t=[];for(let n of e.sessions)!e.runningIds.has(n.id)||Ul(n)||t.push({sessionId:n.id,title:Hl(n.title??``),statusType:e.statuses[n.id]?.type??`busy`});return t},Gl=e=>e!==`complete`&&e!==`error`,Kl=e=>e.some(e=>e.status===`permission`)?`permission`:e.some(e=>e.status===`input`)?`input`:e.some(e=>e.status===`retry`)?`retry`:e.some(e=>e.status===`tool`)?`tool`:e.some(e=>e.status===`stale`)?`stale`:e.some(e=>e.status===`working`)?`working`:e.some(e=>e.status===`error`)?`error`:`complete`,ql=e=>{if(e.length<=4)return e;let t=e.filter(e=>Gl(e.status)),n=e.filter(e=>!Gl(e.status)).sort((e,t)=>(t.endedAt??0)-(e.endedAt??0)),r=[...t];for(let e of n){if(r.length>=4)break;r.push(e)}return r.slice(0,4)},Jl=(e,t,n,r)=>{if(n&&n.length>0)return n;let i=r?.[e];return i&&i.length>0?i:t},Yl=(e,t,n,r,i)=>{let a=new Map;for(let e of t)a.set(e.sessionId,e);let o=[],s=new Set;for(let t of e){if(i&&!i.has(t.sessionId))continue;let e=a.get(t.sessionId);if(e){let i=Vl({statusType:e.statusType,hasPendingPermissions:e.hasPendingPermissions===!0,hasPendingQuestions:e.hasPendingQuestions===!0,hasSessionError:e.hasSessionError===!0})??`working`;o.push({sessionId:t.sessionId,title:Jl(t.sessionId,t.title,e.title,r),status:i,startedAt:t.startedAt,busySince:i===`working`?t.busySince??n:null})}else if(Gl(t.status))o.push({...t,title:Jl(t.sessionId,t.title,void 0,r),status:`complete`,endedAt:n,busySince:null});else{let e=Jl(t.sessionId,t.title,void 0,r);o.push(e===t.title?t:{...t,title:e})}s.add(t.sessionId)}for(let e of t){if(s.has(e.sessionId))continue;let t=Vl({statusType:e.statusType,hasPendingPermissions:e.hasPendingPermissions===!0,hasPendingQuestions:e.hasPendingQuestions===!0,hasSessionError:e.hasSessionError===!0})??`working`;o.push({sessionId:e.sessionId,title:e.title,status:t,startedAt:n,busySince:t===`working`?n:null})}return ql(o)},Xl=e=>e.map(e=>`${e.sessionId}\0${e.title}\0${e.status}\0${e.endedAt??``}`).join(`
4
+ `),Zl=e=>e.map(e=>{let t={sessionId:e.sessionId,title:e.title,status:e.status,startedAt:e.startedAt};return e.endedAt!==void 0&&(t.endedAt=e.endedAt),t}),Ql=(e,t,n,r,i)=>{let a=e.filter(e=>Gl(e.status)),o=a[0]??e[0],s={sessionId:jl,startedAt:o?.startedAt??r,status:t,eventVersion:n,updatedAt:r,title:o?.title,workingCount:a.length,items:Zl(e)};return i?.endedAt!==void 0&&(s.endedAt=i.endedAt),i?.dismissalSeconds!==void 0&&(s.dismissalSeconds=i.dismissalSeconds),s},$l=e=>{let t={sessionId:e.sessionId,startedAt:e.startedAt,status:e.status,eventVersion:e.eventVersion,updatedAt:e.updatedAt};return e.endedAt!==void 0&&(t.endedAt=e.endedAt),e.dismissalSeconds!==void 0&&(t.dismissalSeconds=e.dismissalSeconds),e.title!==void 0&&(t.title=e.title),e.workingCount!==void 0&&(t.workingCount=e.workingCount),e.items!==void 0&&(t.items=e.items),t},eu=(e,t,n,r)=>{let i=e.trackedSessionId;if(!i||!e.started)return{state:Ll(),commands:[]};let a=Rl(t,e.eventVersion);return{state:Ll(),commands:[{type:`end`,payload:$l({sessionId:i,startedAt:e.startedAt??t,status:n,eventVersion:a,updatedAt:t,endedAt:t,dismissalSeconds:r})}]}},tu=(e,t,n,r,i)=>{let a=Rl(r,i);return{state:{trackedSessionId:e,started:!0,startedAt:n,busySince:null,lastStatus:t,eventVersion:a,items:[]},commands:[{type:`start`,payload:$l({sessionId:e,startedAt:n,status:t,eventVersion:a,updatedAt:r})}]}},nu=(e,t,n)=>{let r=Vl(t),i=e.busySince;if(r===`working`?i??=t.now:(!e.started&&!r||!e.started&&r===`complete`||!e.started&&r===`error`)&&(i=null),!e.started){if(r===`working`){let r=kl-(t.now-(i??t.now));if(r>0)return{state:{...e,trackedSessionId:n,busySince:i},commands:[{type:`wait`,delayMs:r}]}}else if(!r||!Il.has(r))return{state:{...Ll(),trackedSessionId:n},commands:[]};return tu(n,r,i??t.now,t.now,e.eventVersion)}if(r===`complete`)return eu({...e,busySince:i},t.now,`complete`,900);if(r===`error`)return eu({...e,busySince:i},t.now,`error`,Al);if(!r||r===e.lastStatus)return{state:{...e,trackedSessionId:n,busySince:i},commands:[]};let a=Rl(t.now,e.eventVersion);return{state:{trackedSessionId:n,started:!0,startedAt:e.startedAt??t.now,busySince:r===`working`?i:null,lastStatus:r,eventVersion:a,items:e.items},commands:[{type:`update`,payload:$l({sessionId:n,startedAt:e.startedAt??t.now,status:r,eventVersion:a,updatedAt:t.now})}]}},ru=(e,t,n)=>{let r=e.trackedSessionId;if(!r||!e.started)return{state:e,commands:[]};let i=Rl(n,e.eventVersion);return{state:{...e,busySince:null,lastStatus:t,eventVersion:i},commands:[{type:`update`,payload:$l({sessionId:r,startedAt:e.startedAt??n,status:t,eventVersion:i,updatedAt:n})}]}},iu=(e,t,n)=>{let r=Yl(e.items,n,t.now,t.sessionTitles,t.rootSessionIds),i=r.filter(e=>Gl(e.status)),a=Kl(r),o=i.reduce((e,t)=>{let n=t.busySince??t.startedAt;return e===null||n<e?n:e},null);if(!t.connected){let n=e.busySince===null?e:{...e,busySince:null};if(!n.started||n.lastStatus===`stale`)return{state:{...n,items:r},commands:[]};let i=Rl(t.now,n.eventVersion),a=r.map(e=>Gl(e.status)?{...e,status:`stale`}:e);return{state:{...n,items:a,lastStatus:`stale`,eventVersion:i,busySince:null},commands:[{type:`update`,payload:$l(Ql(a,`stale`,i,t.now))}]}}if(!e.started){if(i.length===0)return{state:Ll(),commands:[]};if(!i.some(e=>Il.has(e.status))){let n=kl-(t.now-(o??t.now));if(n>0)return{state:{...e,trackedSessionId:jl,items:r,busySince:o},commands:[{type:`wait`,delayMs:n}]}}let n=o??t.now,s=r.map(e=>Gl(e.status)?{...e,startedAt:e.busySince??n}:e),c=Rl(t.now,e.eventVersion);return{state:{trackedSessionId:jl,started:!0,startedAt:n,busySince:null,lastStatus:a,eventVersion:c,items:s},commands:[{type:`start`,payload:$l(Ql(s,a,c,t.now))}]}}if(i.length===0){let n=r.some(e=>e.status===`error`)?`error`:`complete`,i=Rl(t.now,e.eventVersion);return{state:Ll(),commands:[{type:`end`,payload:$l(Ql(r,n,i,t.now,{endedAt:t.now,dismissalSeconds:n===`error`?Al:900}))}]}}if(Xl(e.items)===Xl(r)&&e.lastStatus===a)return{state:{...e,trackedSessionId:jl,items:r,busySince:null},commands:[]};let s=Rl(t.now,e.eventVersion);return{state:{trackedSessionId:jl,started:!0,startedAt:e.startedAt??o??t.now,busySince:null,lastStatus:a,eventVersion:s,items:r},commands:[{type:`update`,payload:$l(Ql(r,a,s,t.now))}]}},au=(e,t)=>{if(t.catalog)return iu(e,t,t.catalog);if(!t.connected){let n=e.busySince===null?e:{...e,busySince:null};return!n.started||n.lastStatus===`stale`||!n.trackedSessionId?{state:n,commands:[]}:ru(n,`stale`,t.now)}let n=[],r=e;if(r.trackedSessionId&&r.trackedSessionId!==t.sessionId)if(r.started){let e=eu(r,t.now,r.lastStatus??`complete`,0);n.push(...e.commands),r=e.state}else r=Ll();if(!t.sessionId){if(r.started){let e=eu(r,t.now,`complete`,900);return{state:e.state,commands:[...n,...e.commands]}}return{state:Ll(),commands:n}}let i=nu(r,t,t.sessionId);return{state:i.state,commands:[...n,...i.commands]}},ou=e=>e/1e3,su=e=>{let t={sessionId:e.sessionId,title:e.title,status:e.status,startedAt:ou(e.startedAt)};return e.endedAt!==void 0&&(t.endedAt=ou(e.endedAt)),t},cu=e=>{let t={sessionId:e.sessionId,startedAt:ou(e.startedAt),status:e.status,eventVersion:e.eventVersion,updatedAt:ou(e.updatedAt)};return e.endedAt!==void 0&&(t.endedAt=ou(e.endedAt)),e.dismissalSeconds!==void 0&&(t.dismissalSeconds=e.dismissalSeconds),e.title!==void 0&&(t.title=e.title),e.workingCount!==void 0&&(t.workingCount=e.workingCount),e.items!==void 0&&(t.items=e.items.map(su)),t},lu=e=>{let t={};return e.title!==void 0&&(t.title=e.title),e.workingCount!==void 0&&(t.workingCount=e.workingCount),e.items!==void 0&&(t.items=e.items),t},uu=(e,t,n)=>{if(!e||n.type===`wait`)return Promise.resolve();let r=cu(n.payload),i=lu(r);return n.type===`start`?t.start({sessionId:r.sessionId,startedAt:r.startedAt,status:r.status,eventVersion:r.eventVersion,updatedAt:r.updatedAt,...i}):n.type===`update`?t.update({sessionId:r.sessionId,startedAt:r.startedAt,status:r.status,eventVersion:r.eventVersion,updatedAt:r.updatedAt,...i}):t.end({sessionId:r.sessionId,startedAt:r.startedAt,status:r.status,eventVersion:r.eventVersion,updatedAt:r.updatedAt,endedAt:r.endedAt,dismissalSeconds:r.dismissalSeconds,...i})},du=e=>e.getCurrentEpoch()===e.epoch?!e.getCurrentSessionId||e.getCurrentSessionId()===e.observation.sessionId:!1,fu=async e=>{let t=e.state;if(!du(e))return{state:t,delayMs:null,retry:!1,superseded:!0};let n=au(t,e.observation),r=n.commands.find(e=>e.type===`wait`),i=r?.type===`wait`?r.delayMs:null,a=n.commands.filter(e=>e.type!==`wait`);if(a.length===0)return du(e)?{state:n.state,delayMs:i,retry:!1,superseded:!1}:{state:t,delayMs:null,retry:!1,superseded:!0};let o=t;try{for(let[r,i]of a.entries()){if(!du(e)||(await uu(e.available,e.plugin,i),!du(e)))return{state:t,delayMs:null,retry:!1,superseded:!0};let s=r===a.length-1;o=i.type===`end`&&!s?Ll():n.state}return{state:n.state,delayMs:i,retry:!1,superseded:!1}}catch{if(!du(e))return{state:t,delayMs:null,retry:!1,superseded:!0};let r=zl({failedEpoch:e.epoch,currentEpoch:e.getCurrentEpoch(),previous:o,current:n.state}),i=Bl({failedEpoch:e.epoch,currentEpoch:e.getCurrentEpoch(),retryCount:e.retryCount});return{state:r,delayMs:i?250:null,retry:i,superseded:!1}}},pu=()=>({desired:null,registered:null}),mu=e=>{if(typeof e!=`string`)return null;let t=e.trim();return t.length>0?t:null},hu=e=>{if(!e||typeof e!=`object`)return null;let t=e,n=mu(t.activityId),r=mu(t.sessionId),i=mu(t.token);return!n||!r||!i?null:{activityId:n,sessionId:r,token:i}},gu=(e,t)=>e.activityId===t.activityId&&e.token===t.token,_u=(e,t)=>{let n=e.registered?.runtimeIdentity===t?e.registered:null;return e.desired===null&&n===e.registered?e:{desired:null,registered:n}},vu=(e,t)=>{if(!t.connected)return[];if(e.desired&&t.enabled&&t.selectedSessionId&&e.desired.sessionId===t.selectedSessionId){let n=e.registered;return n&&gu(n,e.desired)&&n.runtimeIdentity===t.runtimeIdentity?[]:[{type:`register`,payload:{activityId:e.desired.activityId,sessionId:e.desired.sessionId,token:e.desired.token},runtimeIdentity:t.runtimeIdentity}]}return e.registered&&e.registered.runtimeIdentity===t.runtimeIdentity?[{type:`unregister`,payload:{token:e.registered.token},runtimeIdentity:t.runtimeIdentity}]:[]},yu=(e,t,n)=>{let r=e;if(n.type===`pushToken`){if(!t.enabled||n.sessionId!==t.selectedSessionId)return{state:e,commands:[]};r={...e,desired:{activityId:n.activityId,sessionId:n.sessionId,token:n.token}}}else n.type===`localEndSucceeded`||n.type===`dispose`||!t.enabled||e.desired&&e.desired.sessionId!==t.selectedSessionId?r=_u(e,t.runtimeIdentity):e.registered&&e.registered.runtimeIdentity!==t.runtimeIdentity&&!e.desired&&(r={...e,registered:null});return{state:r,commands:vu(r,t)}},bu=async e=>{try{return await e}catch{return null}},xu=async e=>{let t=e.state;for(let n of e.commands){if(n.runtimeIdentity!==e.getRuntimeIdentity()){n.type===`unregister`&&t.registered?.runtimeIdentity===n.runtimeIdentity&&(t={...t,registered:null});continue}if(n.type===`register`){let r=t.registered;if(n.runtimeIdentity!==e.getRuntimeIdentity()||(await bu(e.register(n.payload)))?.ok!==!0||n.runtimeIdentity!==e.getRuntimeIdentity())continue;if(t={...t,registered:{...n.payload,runtimeIdentity:n.runtimeIdentity}},r&&r.runtimeIdentity===n.runtimeIdentity&&r.token!==n.payload.token){if(n.runtimeIdentity!==e.getRuntimeIdentity())continue;await bu(e.unregister({token:r.token}))}continue}if(n.runtimeIdentity!==e.getRuntimeIdentity()){t.registered?.runtimeIdentity===n.runtimeIdentity&&(t={...t,registered:null});continue}(await bu(e.unregister(n.payload)))?.ok===!0&&t.registered?.token===n.payload.token&&(t={...t,registered:null})}return t},Su=new Map,Cu=[];function wu(){let e=Pl(),t=Te(e=>e.isConnected),n=Qe({enabled:e}),r=ke(t=>e?t.statusById:Su),i=le(t=>e?t.activeSessions:Cu),a=(0,Z.useMemo)(()=>e?ue(n,r):new Set,[e,r,n]),o=(0,Z.useMemo)(()=>e?Wl({runningIds:a,statuses:n,sessions:i}):[],[e,n,a,i]),c=(0,Z.useMemo)(()=>{if(!e)return{};let t={};for(let e of i){let n=e.parentID;if(typeof n==`string`&&n.length>0)continue;let r=typeof e.title==`string`?e.title.trim():``;r&&(t[e.id]=r.length<=80?r:`${r.slice(0,79)}…`)}return t},[e,i]),u=(0,Z.useMemo)(()=>{if(!e)return new Set;let t=new Set;for(let e of i){let n=e.parentID;typeof n==`string`&&n.length>0||t.add(e.id)}return t},[e,i]),d=(0,Z.useMemo)(()=>[o.map(e=>`${e.sessionId}\0${e.title}\0${e.statusType??``}`).join(`
5
+ `),Object.entries(c).map(([e,t])=>`${e}\0${t}`).join(`
6
+ `)].join(`
7
+ ---
8
+ `),[o,c]),f=(0,Z.useRef)(Ll()),p=(0,Z.useRef)(pu()),m=(0,Z.useRef)(null),h=(0,Z.useRef)(0),g=(0,Z.useRef)(Promise.resolve()),_=(0,Z.useRef)(Promise.resolve()),v=(0,Z.useRef)(null),y=z(()=>({sessionId:jl,statusType:void 0,hasPendingPermissions:!1,hasPendingQuestions:!1,hasSessionError:!1,now:Date.now(),connected:t,catalog:o,sessionTitles:c,rootSessionIds:u})),b=z(n=>{_.current=_.current.then(async()=>{let r=yu(p.current,{selectedSessionId:jl,runtimeIdentity:l(),connected:t,enabled:e},n);p.current=r.state,r.commands.length!==0&&(p.current=await xu({state:p.current,commands:r.commands,getRuntimeIdentity:l,register:e=>x()?.push?.registerLiveActivityToken?.({...e,items:f.current.items.map(e=>{let t={sessionId:e.sessionId,title:e.title,status:e.status,startedAt:ou(e.startedAt)};return e.endedAt===void 0?t:{...t,endedAt:ou(e.endedAt)}})})??Promise.resolve(null),unregister:e=>x()?.push?.unregisterLiveActivityToken?.(e)??Promise.resolve(null)}))}).catch(()=>void 0)}),S=z(e=>{let t=hu(e);t&&b({type:`pushToken`,...t,sessionId:jl})});(0,Z.useEffect)(()=>{b({type:e?`sync`:`dispose`})},[e,t]),(0,Z.useEffect)(()=>s(()=>{b({type:`sync`})}),[]),(0,Z.useEffect)(()=>{if(!e){v.current?.remove(),v.current=null;return}let t=!1,n=null,r=0,i=Fl(),a=h.current+1;h.current=a;let o=()=>{g.current=g.current.then(async()=>{if(t||h.current!==a)return;if(m.current!==!0){if(m.current===!1)return;let e=await i.isSupported().catch(()=>({supported:!1}));if(t||h.current!==a||(m.current=e.supported===!0,!m.current))return}let e=y(),s=f.current.started,c=await fu({available:!0,plugin:i,state:f.current,observation:e,epoch:a,getCurrentEpoch:()=>h.current,retryCount:r});if(!(t||h.current!==a||c.superseded)){if(f.current=c.state,s&&!c.state.started)b({type:`localEndSucceeded`});else if(c.state.started){let e=p.current.desired;e&&x()?.push?.registerLiveActivityToken?.({activityId:e.activityId,sessionId:jl,token:e.token,items:c.state.items.map(e=>{let t={sessionId:e.sessionId,title:e.title,status:e.status,startedAt:ou(e.startedAt)};return e.endedAt===void 0?t:{...t,endedAt:ou(e.endedAt)}})})}c.retry?r+=1:r=0,c.delayMs!=null&&(n=setTimeout(()=>{o()},c.delayMs))}}).catch(()=>void 0)};return g.current=g.current.then(async()=>{if(!(t||h.current!==a)&&!v.current)try{let e=await i.addListener(`pushToken`,e=>{S(e)});if(t){await e.remove();return}v.current=e}catch{return}}).then(()=>{!t&&h.current===a&&o()}).catch(()=>void 0),()=>{t=!0,h.current===a&&(h.current+=1),n!==null&&clearTimeout(n)}},[e,t,d]),(0,Z.useEffect)(()=>()=>{v.current?.remove(),v.current=null,b({type:`dispose`})},[])}function Tu(){let e=(0,Q.c)(49),t=U(Du),{t:r,locale:i}=ot(),a;e[0]===r?a=e[1]:(a=r(`mobile.notifications.service`),e[0]=r,e[1]=a);let o=a,c;e[2]===r?c=e[3]:(c=r(`settings.page.notifications.title`),e[2]=r,e[3]=c);let l=c,u;e[4]===r?u=e[5]:(u=r(`mobile.connect.connecting`),e[4]=r,e[5]=u);let d=u,f;e[6]===r?f=e[7]:(f=r(`mobile.notifications.connected`),e[6]=r,e[7]=f);let p=f,m;e[8]===r?m=e[9]:(m=r(`layout.browserProvider.status.reconnecting`),e[8]=r,e[9]=m);let h=m,g;e[10]===r?g=e[11]:(g=r(`mobile.notifications.unavailable`),e[10]=r,e[11]=g);let _=g,v;e[12]===r?v=e[13]:(v=r(`mobile.notifications.gap`),e[12]=r,e[13]=v);let y=v,b;e[14]===r?b=e[15]:(b=r(`settings.notifications.page.toast.permissionDenied.title`),e[14]=r,e[15]=b);let x=b,S;e[16]===r?S=e[17]:(S=r(`settings.notifications.page.template.defaults.error.title`),e[16]=r,e[17]=S);let C=S,w;e[18]===r?w=e[19]:(w=r(`mobile.notifications.auth`),e[18]=r,e[19]=w);let T=w,E;e[20]===r?E=e[21]:(E=r(`mobile.notifications.endpoint`),e[20]=r,e[21]=E);let D=E,O;e[22]===r?O=e[23]:(O=r(`mobile.notifications.response`),e[22]=r,e[23]=O);let k=O,A;e[24]===r?A=e[25]:(A=r(`mobile.notifications.server`),e[24]=r,e[25]=A);let j=A,M;e[26]===r?M=e[27]:(M=r(`mobile.notifications.relay`),e[26]=r,e[27]=M);let N=M,P;e[28]===r?P=e[29]:(P=r(`mobile.notifications.identity`),e[28]=r,e[29]=P);let F=P,I,L;e[30]!==l||e[31]!==T||e[32]!==p||e[33]!==d||e[34]!==x||e[35]!==t||e[36]!==D||e[37]!==C||e[38]!==y||e[39]!==F||e[40]!==i||e[41]!==h||e[42]!==N||e[43]!==k||e[44]!==j||e[45]!==o||e[46]!==_?(I=()=>{if(!Sl())return;if(!t){xl.stop().catch(Eu);return}let e=!1,r=t=>{e||(e=!0,Y.error(t))},a=wl({plugin:xl,resolveConfig:()=>Cl({service:o,alerts:l,connecting:d,connected:p,reconnecting:h,unavailable:_,gap:y,error:C,auth:T,endpoint:D,response:k,server:j,relay:N,identity:F},i),onState:e=>{(e===`denied`||e===`unavailable`)&&r(e===`denied`?x:_)},onError:()=>r(_)}),c=s(()=>{a.refresh()}),u=n(e=>{let{reason:t}=e;t===`invalidate`?a.stop():t!==`endpoint-switch`&&a.refresh()});return a.refresh(),()=>{c(),u(),a.dispose()}},L=[t,i,o,l,d,p,h,_,y,x,C,T,D,k,j,N,F],e[30]=l,e[31]=T,e[32]=p,e[33]=d,e[34]=x,e[35]=t,e[36]=D,e[37]=C,e[38]=y,e[39]=F,e[40]=i,e[41]=h,e[42]=N,e[43]=k,e[44]=j,e[45]=o,e[46]=_,e[47]=I,e[48]=L):(I=e[47],L=e[48]),(0,Z.useEffect)(I,L)}function Eu(){console.warn(`[Native notifications] stop failed`)}function Du(e){return e.nativeNotificationsEnabled}var Ou=Yt(()=>H(()=>import(`./ChatView-AFUNEBdD.js`).then(e=>e.n).then(e=>({default:e.ChatView})),__vite__mapDeps([199,1,13,5,4,14,15,16,6,24,22,12,25,26,17,18,19,27,28,7,29,30,31,8,9,10,2,32,11,20,34,21,23,33,35,36,37,38,39,40,41,42,43,44,45,46,47,48,146,62,200,201,202,203,71,57,72,73,64,74,75,111,204,149,150,151,152,153,154,155,156,157,158,83,84,55,56,77,78,49,121,67,68,122,205,206,50,113,103,207,148,86,159,131,69,58,59,60,114,61,63,65,162,133,208,134,135,209,210,178,97,211,76,79,80,81,82,212,118,119,87,88,132,136,90,137,138,139,140,85,89,213,190,165,191,214,215,216,217,167,123,124,125,218,120,126,127,219,220,221,222,192,223,224,115,166,168,225,226,227]))),ku=Yt(()=>H(()=>import(`./AssistantView-CDPTtrUZ.js`).then(e=>({default:e.AssistantView})),__vite__mapDeps([3,1,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,2,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103]))),Au=Yt(()=>H(()=>import(`./DiffView-DZ_gKyTO.js`).then(e=>e.n).then(e=>({default:e.DiffView})),__vite__mapDeps([228,1,4,5,22,12,6,24,13,14,15,16,25,26,17,18,19,27,28,7,29,30,31,8,9,10,2,32,11,20,149,150,151,152,153,154,155,156,157,158,21,23,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,55,56,77,57,78,49,122,205,72,146,206,50,113,103,229,102,147,79,207,230,148,86,200,201,62,202,203,60,58,59,223]))),ju=Yt(()=>H(()=>import(`./SettingsView-C62JngPE.js`).then(e=>({default:e.SettingsView})),__vite__mapDeps([142,1,5,4,22,12,13,14,15,143,144,16,6,23,17,18,19,24,25,26,27,28,7,29,30,31,8,9,10,2,32,11,20,33,145,34,21,35,36,37,38,39,40,41,42,43,44,45,46,47,48,55,56,67,68,122,72,146,50,113,103,102,147,79,148,149,150,151,152,153,154,155,156,157,158,159,131,73,69,160,161,114,61,62,63,64,162,51,53,163,164,110,111,126,119,115,77,57,78,165,166,167,123,124,125,140,168,169,170,96,97,171,172,173,174,175,116,176,177,178,107,106,179,180,118,87,88,138,181,182,117,120,121,127,183,71,74,75,112,66,70,52,95,128,129,184,185,186,187,188,189,190,191,192,193,194,195,196,197]))),Mu=Yt(()=>H(()=>import(`./MobileChangesSurface-BwmSTxeh.js`).then(e=>({default:e.MobileChangesSurface})),__vite__mapDeps([231,1,6,7,31,8,9,10,21,5,12,4,22,13,14,15,16,23,17,18,19,24,25,26,27,28,29,30,2,32,11,20,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,55,56,77,57,78,49,232,121,67,68,122,205,72,146,206,50,200,201,62,159,233,229,149,150,151,152,153,154,155,156,157,158,113,103,102,147,79,207,230,148,86,202,203,131,73,69]))),Nu=Yt(()=>H(()=>import(`./MobileFilesSurface-qkfC06Oh.js`).then(e=>({default:e.MobileFilesSurface})),__vite__mapDeps([234,1,6,7,28,5,4,22,12,13,14,15,29,30,31,8,9,10,2,32,18,11,16,17,19,20,149,150,151,152,153,154,155,156,157,158,21,23,24,25,26,27,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,55,56,77,57,78,205,72,146,229,50,113,103,102,147,79,207,230,148,86,200,201,62,131,73,69,161,235,236,160,237,58,59,60,114,61,63,64,65,208,162,133,134,135,209]))),Pu=Yt(()=>H(()=>import(`./MobileChatScreen-Bf42GrQ8.js`).then(e=>({default:e.MobileChatScreen})),__vite__mapDeps([238,1,6,7,29,30,28,5,4,22,12,13,14,15,31,8,9,10,2,32,18,21,16,23,17,19,24,25,26,27,11,20,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,53,48,211,122,239,203,126,119,169,170,140,240,241,146]))),Fu=Yt(()=>H(()=>import(`./RemoteDesktopPanel-Bays6pHh.js`).then(e=>({default:e.RemoteDesktopPanel})),__vite__mapDeps([242,1,5,4,22,12,6,23,13,14,15,16,17,18,19,24,25,26,27,28,7,29,30,31,8,9,10,2,32,11,20,33,21,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,221,131,73,69,114,135,224]))),Iu=Yt(()=>H(()=>import(`./ScheduledTasksDialog-DnwBC7cj.js`).then(e=>e.t).then(e=>({default:e.ScheduledTasksWorkspace})),__vite__mapDeps([243,1,13,5,4,14,15,6,7,30,29,28,22,12,31,8,9,10,2,32,18,11,16,17,19,20,21,23,24,25,26,27,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,55,56,77,57,78,67,68,113,103,102,79,131,73,69,114,51,71,72,64,74,75,53,210,212,83,84,209,80,81,82,190,90,115,50,166,96,97,95,175,107,100,117,118,119,120,121,122,123,124,125,126,127,183,244])));function Lu(e){let t=(0,Q.c)(2),n;return t[0]===e?n=t[1]:(n=(0,$.jsx)(Zr,{children:(0,$.jsx)(Z.Suspense,{fallback:null,children:(0,$.jsx)(Pu,{...e})})}),t[0]=e,t[1]=n),n}function Ru(e){let t=(0,Q.c)(2),n;return t[0]===e?n=t[1]:(n=(0,$.jsx)(Zr,{children:(0,$.jsx)(Z.Suspense,{fallback:null,children:(0,$.jsx)(Ou,{...e})})}),t[0]=e,t[1]=n),n}function zu(e){let t=(0,Q.c)(2),n;return t[0]===e?n=t[1]:(n=(0,$.jsx)(Zr,{children:(0,$.jsx)(Z.Suspense,{fallback:null,children:(0,$.jsx)(Au,{...e})})}),t[0]=e,t[1]=n),n}function Bu(e){let t=(0,Q.c)(2),n;return t[0]===e?n=t[1]:(n=(0,$.jsx)(Zr,{children:(0,$.jsx)(Z.Suspense,{fallback:null,children:(0,$.jsx)(Nu,{...e})})}),t[0]=e,t[1]=n),n}function Vu(e){let t=(0,Q.c)(2),n;return t[0]===e?n=t[1]:(n=(0,$.jsx)(Zr,{children:(0,$.jsx)(Z.Suspense,{fallback:null,children:(0,$.jsx)(Mu,{...e})})}),t[0]=e,t[1]=n),n}function Hu(){let e=(0,Q.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(Zr,{children:(0,$.jsx)(bo,{})}),e[0]=t):t=e[0],t}var Uu=`mobile-direct-diff`,Wu=`mobile-turn-diff`,Gu=`mobile-direct-file`,Ku=`mobile-files`,qu=`mobile-changes`,Ju=`mobile-mcp`,Yu=`mobile-settings`,Xu=`mobile-update`,Zu=`mobile-overflow-menu`,Qu=320,$u=380,ed=280,td=560,nd=380,rd=e=>Math.min(td,Math.max(ed,Math.round(e))),id=(e,t)=>{let n=e.current;n&&(n.style.width=`${t}px`,n.style.minWidth=`${t}px`,n.style.maxWidth=`${t}px`,n.style.setProperty(`--yuri-ipad-sidebar-width`,`${t}px`))};function ad(e,t,n){let r=(0,Q.c)(17),i=Z.useRef(null),a;r[0]!==n||r[1]!==t?(a=()=>{if(typeof window>`u`)return n;let e=Number.parseInt(window.localStorage.getItem(t)??``,10);return Number.isFinite(e)?Math.min(td,Math.max(ed,e)):n},r[0]=n,r[1]=t,r[2]=a):a=r[2];let[o,s]=Z.useState(a),[c,l]=Z.useState(!1),u=Z.useRef(0),d=Z.useRef(o),f=Z.useRef(null),p=Z.useRef(null),m;r[3]===o?m=r[4]:(m=e=>{try{e.currentTarget.setPointerCapture(e.pointerId)}catch{}p.current=e.pointerId,u.current=e.clientX,d.current=o,f.current=o,l(!0),e.preventDefault()},r[3]=o,r[4]=m);let h=z(m),g;r[5]===e?g=r[6]:(g=t=>{if(p.current!==t.pointerId)return;let n=t.clientX-u.current,r=rd(d.current+(e===`left`?n:-n));f.current!==r&&(f.current=r,id(i,r))},r[5]=e,r[6]=g);let _=z(g),v;r[7]===t?v=r[8]:(v=e=>{if(p.current!==e.pointerId)return;try{e.currentTarget.releasePointerCapture(e.pointerId)}catch{}let n=rd(f.current??d.current);p.current=null,f.current=null,l(!1),s(n);try{window.localStorage.setItem(t,String(n))}catch{}},r[7]=t,r[8]=v);let y=z(v),b;r[9]!==h||r[10]!==y||r[11]!==_?(b={onPointerDown:h,onPointerMove:_,onPointerUp:y,onPointerCancel:y},r[9]=h,r[10]=y,r[11]=_,r[12]=b):b=r[12];let x=b,S;return r[13]!==x||r[14]!==c||r[15]!==o?(S={asideRef:i,width:o,isResizing:c,handleProps:x},r[13]=x,r[14]=c,r[15]=o,r[16]=S):S=r[16],S}var od=e=>{let t=(0,Q.c)(12),{side:n,isResizing:r,ariaLabel:i,handleProps:a}=e,o=n===`left`?`right-0`:`left-0`,s;t[0]===o?s=t[1]:(s=J(`absolute inset-y-0 z-30 w-6 cursor-col-resize touch-none`,o),t[0]=o,t[1]=s);let c=n===`left`?`right-0`:`left-0`,l=r&&`bg-[var(--interactive-border)]`,u;t[2]!==c||t[3]!==l?(u=J(`absolute inset-y-0 w-[3px] transition-colors`,c,l),t[2]=c,t[3]=l,t[4]=u):u=t[4];let d;t[5]===u?d=t[6]:(d=(0,$.jsx)(`div`,{className:u}),t[5]=u,t[6]=d);let f;return t[7]!==i||t[8]!==a||t[9]!==s||t[10]!==d?(f=(0,$.jsx)(`div`,{className:s,role:`separator`,"aria-orientation":`vertical`,"aria-label":i,...a,children:d}),t[7]=i,t[8]=a,t[9]=s,t[10]=d,t[11]=f):f=t[11],f},sd=()=>typeof window>`u`?!1:window.Capacitor?.isNativePlatform?.()===!0||window.location.protocol===`capacitor:`,cd=()=>{Z.useEffect(()=>{if(!sd())return;document.documentElement.classList.add(`yuri-native-app-active`);let e=!1,t=[],n=document.documentElement;n.classList.add(`yuri-capacitor-app`),window.Capacitor?.getPlatform?.()===`android`&&n.classList.add(`yuri-platform-android`);let r=e=>{n.style.setProperty(`--yuri-keyboard-inset`,`${Math.max(0,Math.round(e))}px`)};return H(async()=>{let{StatusBar:e,Style:t}=await import(`./vendor-capacitor-status-bar-D9bcMr9Q.js`).then(e=>e.t);return{StatusBar:e,Style:t}},__vite__mapDeps([245,1,2])).then(async({StatusBar:n,Style:r})=>{if(e)return;let i=window.Capacitor?.getPlatform?.(),a=async()=>{if(i===`android`){let e=document.documentElement.classList.contains(`dark`),t=(e?localStorage.getItem(`splashBgDark`):localStorage.getItem(`splashBgLight`))||(e?`#121212`:`#FFFFFF`);await n.setOverlaysWebView({overlay:!1}).catch(()=>void 0),await n.setBackgroundColor({color:t}).catch(()=>void 0),await n.setStyle({style:e?r.Dark:r.Light}).catch(()=>void 0),await n.show().catch(()=>void 0);return}await n.setStyle({style:r.Default}).catch(()=>void 0),await n.setOverlaysWebView({overlay:!0}).catch(()=>void 0),await n.show().catch(()=>void 0)};await a();let o=window.setTimeout(()=>void a(),400);t.push(()=>window.clearTimeout(o));let{App:s}=await H(async()=>{let{App:e}=await import(`./vendor-capacitor-app-B5H_XtmE.js`).then(e=>e.t);return{App:e}},__vite__mapDeps([0,1,2])),c=await s.addListener(`appStateChange`,({isActive:e})=>{if(e&&a(),!e&&i===`ios`){let e=document.activeElement;e instanceof HTMLElement&&Zo(e)&&e.blur()}});if(e){c.remove();return}t.push(()=>void c.remove())}).catch(()=>void 0),H(async()=>{let{Keyboard:e}=await import(`./vendor-capacitor-keyboard-BRVcFyc9.js`).then(e=>e.t);return{Keyboard:e}},__vite__mapDeps([246,1,2])).then(async({Keyboard:i})=>{if(e)return;let a=window.Capacitor?.getPlatform?.(),o=a===`android`;await i.setAccessoryBarVisible({isVisible:!1}).catch(()=>void 0);let s=`cubic-bezier(0.38, 0.7, 0.125, 1)`,c=null,l=null,u=0,d=!1,f=0,p=!1,m=(e,t)=>{n.style.setProperty(e,`${Math.max(0,Math.round(t))}px`)},h=()=>{c!==null&&(window.clearTimeout(c),c=null)},g=(e,t)=>{window.dispatchEvent(new CustomEvent(e,{detail:t}))},_=e=>e.getClientRects().length>0&&getComputedStyle(e).visibility!==`hidden`,v=e=>{for(let t of document.querySelectorAll(e))if(_(t))return t;return null},y=e=>e instanceof HTMLElement&&(e.tagName===`TEXTAREA`||e.tagName===`INPUT`||e.isContentEditable),b=()=>{for(let e of document.querySelectorAll(`.yuri-mobile-composer, .yuri-draft-center`))e.style.transition=``,e.style.transform=``},x=()=>{let e=document.querySelector(`.yuri-mobile-app-shell`);f=e&&parseFloat(getComputedStyle(e).paddingBottom)||0},S=!o&&a===`ios`,C=null,w=()=>{let e=document.activeElement,t=!(S&&Xo(n.classList.contains(`yuri-native-ios-composer`),e))&&(y(e)?Zo(e):C===!0);t!==C&&(C=t,r(t?0:u),m(`--yuri-kb-layout`,0),x(),m(`--yuri-kb-scroll-inset`,t?0:Math.max(0,u-f)),n.classList.remove(`yuri-keyboard-open`,`yuri-kb-animating`,`yuri-kb-caret-hold`,`yuri-kb-hide`),d=!1,p=!t&&u>0,n.classList.toggle(`yuri-native-ime`,t),Go.setImeSync({enabled:t}).catch(()=>void 0))};if(o||S){r(0),m(`--yuri-kb-layout`,0),m(`--yuri-kb-scroll-inset`,0);let i=e=>{let t=e;if(S&&!C)return;let i=t.detail??t;if(typeof i.open!=`boolean`)return;if(typeof i.height==`number`&&(u=i.open?i.height/(o&&window.devicePixelRatio||1):0),o&&!C){r(u),x(),m(`--yuri-kb-scroll-inset`,Math.max(0,u-f)),n.classList.remove(`yuri-keyboard-open`,`yuri-kb-animating`),g(`yuri:keyboard-settled`,{open:i.open,nativeResize:!1});return}let a=i.phase===`start`;if(n.classList.toggle(`yuri-keyboard-open`,i.open||a),n.classList.toggle(`yuri-kb-animating`,a),a){g(`yuri:keyboard-anim`,{phase:i.open?`show`:`hide`,durationMs:i.durationMs??0,nativeResize:!0});return}let s=Zo(document.activeElement);o&&!i.open&&y(document.activeElement)&&s&&document.activeElement.blur(),!i.open&&(o||!s)&&g(`yuri:keyboard-intent`,{open:!1}),g(`yuri:keyboard-settled`,{open:i.open,nativeResize:!0})};window.addEventListener(`yuri:ime-state`,i),t.push(()=>window.removeEventListener(`yuri:ime-state`,i)),e||t.push(qo()),w(),document.addEventListener(`focusin`,w,!0);let a=new MutationObserver(w);if(a.observe(n,{attributes:!0,attributeFilter:[`class`]}),t.push(()=>{a.disconnect(),document.removeEventListener(`focusin`,w,!0),n.classList.remove(`yuri-native-ime`),Go.setImeSync({enabled:!1}).catch(()=>void 0)}),o)return}let T=()=>!(S&&C),E=`yuri.iosImeHeightRatio.v1`,D=e=>Number.isFinite(e)?Math.min(.68,Math.max(.28,e)):.39,O=()=>{try{let e=D(Number.parseFloat(localStorage.getItem(E)??``));return Math.round(window.innerHeight*e)}catch{return Math.round(window.innerHeight*.39)}},k=e=>{if(!(e<=0||window.innerHeight<=0))try{localStorage.setItem(E,String(D(e/window.innerHeight)))}catch{}},A=e=>{x();let t=Math.max(0,e-f);r(e),m(`--yuri-kb-layout`,e),m(`--yuri-kb-scroll-inset`,0),d=!0,b(),window.scrollTo(0,0),document.body.scrollTop!==0&&(document.body.scrollTop=0);let n=document.activeElement instanceof Element?document.activeElement.closest(`.yuri-mobile-composer`):null;return(n&&_(n)?n:v(`.yuri-mobile-composer`))?.scrollIntoView({block:`end`,inline:`nearest`}),t},j=e=>{if(!T()||Xo(n.classList.contains(`yuri-native-ios-composer`),document.activeElement)||e.detail?.open!==!0||d||y(document.activeElement)&&!Zo(document.activeElement))return;p=!0,n.classList.remove(`yuri-kb-hide`),n.classList.add(`yuri-keyboard-open`);let t=u>0?u:O(),r=A(t);g(`yuri:keyboard-anim`,{phase:`show`,slide:r,durationMs:0,easing:s}),g(`yuri:keyboard-settled`,{open:!0})};window.addEventListener(`yuri:keyboard-intent`,j);let M=await i.addListener(`keyboardWillShow`,e=>{if(!T()||Xo(n.classList.contains(`yuri-native-ios-composer`),document.activeElement))return;h(),u=e.keyboardHeight,k(u);let t=Zo(document.activeElement)||n.classList.contains(`yuri-keyboard-open`)&&!y(document.activeElement);if(p=!0,n.classList.remove(`yuri-kb-hide`),l!==null&&(window.clearTimeout(l),l=null),!t){r(u),m(`--yuri-kb-layout`,0),x(),m(`--yuri-kb-scroll-inset`,Math.max(0,u-f)),n.classList.remove(`yuri-keyboard-open`,`yuri-kb-animating`,`yuri-kb-caret-hold`),b(),d=!1,g(`yuri:keyboard-settled`,{open:!0});return}n.classList.add(`yuri-keyboard-open`);let i=A(u);g(`yuri:keyboard-settled`,{open:!0}),g(`yuri:keyboard-anim`,{phase:`show`,slide:i,durationMs:0,easing:s})}),N=()=>{p||(window.scrollTo(0,0),document.body.scrollTop!==0&&(document.body.scrollTop=0))},P=()=>{p=!1,h(),l!==null&&(window.clearTimeout(l),l=null),n.classList.remove(`yuri-keyboard-open`,`yuri-kb-animating`,`yuri-kb-caret-hold`,`yuri-kb-hide`),r(0),m(`--yuri-kb-scroll-inset`,0),m(`--yuri-kb-layout`,0),d=!1,b(),N(),window.setTimeout(N,350)},F=()=>{if(!T())return;if(n.classList.contains(`yuri-native-ios-composer`)){P(),g(`yuri:keyboard-settled`,{open:!1});return}if(!p)return;p=!1,h(),Zo(document.activeElement)||g(`yuri:keyboard-intent`,{open:!1}),l!==null&&(window.clearTimeout(l),l=null),n.classList.remove(`yuri-kb-caret-hold`,`yuri-kb-animating`);let e=Math.max(0,u-f);n.classList.remove(`yuri-keyboard-open`),r(0),m(`--yuri-kb-scroll-inset`,0),m(`--yuri-kb-layout`,0),d=!1,b(),N(),window.setTimeout(N,350),g(`yuri:keyboard-anim`,{phase:`hide`,slide:e,durationMs:0,easing:s}),n.classList.add(`yuri-kb-animating`,`yuri-kb-hide`),c=window.setTimeout(()=>{c=null,n.classList.remove(`yuri-kb-animating`,`yuri-kb-hide`),g(`yuri:keyboard-settled`,{open:!1})},260)},I=await i.addListener(`keyboardWillHide`,F),L=e=>e instanceof HTMLElement&&(e.tagName===`TEXTAREA`||e.tagName===`INPUT`||e.isContentEditable),R=e=>{if(T()&&p&&L(e.target)){if(Qo(e.relatedTarget)){m(`--yuri-kb-scroll-inset`,0);return}window.setTimeout(()=>{if(p&&!Zo(document.activeElement)){if(L(document.activeElement)){h(),n.classList.remove(`yuri-keyboard-open`,`yuri-kb-animating`,`yuri-kb-caret-hold`,`yuri-kb-hide`),r(u),m(`--yuri-kb-layout`,0),x(),m(`--yuri-kb-scroll-inset`,Math.max(0,u-f)),d=!1,b(),g(`yuri:keyboard-intent`,{open:!1}),g(`yuri:keyboard-settled`,{open:!0});return}F()}},0)}};if(document.addEventListener(`focusout`,R,!0),e){h(),document.removeEventListener(`focusout`,R,!0),window.removeEventListener(`yuri:keyboard-intent`,j),M.remove(),I.remove();return}t.push(h,()=>{l!==null&&(window.clearTimeout(l),l=null)},()=>document.removeEventListener(`focusout`,R,!0),()=>window.removeEventListener(`yuri:keyboard-intent`,j),()=>void M.remove(),()=>void I.remove())}).catch(()=>void 0),()=>{e=!0,t.forEach(e=>e()),n.classList.remove(`yuri-capacitor-app`,`yuri-keyboard-open`,`yuri-kb-animating`,`yuri-kb-hide`,`yuri-kb-caret-hold`,`yuri-platform-android`),n.style.removeProperty(`--yuri-keyboard-inset`),n.style.removeProperty(`--yuri-kb-shift`),n.style.removeProperty(`--yuri-kb-layout`),n.style.removeProperty(`--yuri-kb-scroll-inset`)}},[])},ld=e=>{let t=Z.useRef(!1);Z.useEffect(()=>{if(!sd())return;let n=!1,r=[],i=()=>{t.current&&(t.current=!1,e())},a=()=>{if(document.visibilityState===`hidden`){t.current=!0;return}i()};return document.addEventListener(`visibilitychange`,a),r.push(()=>document.removeEventListener(`visibilitychange`,a)),H(async()=>{let{App:e}=await import(`./vendor-capacitor-app-B5H_XtmE.js`).then(e=>e.t);return{App:e}},__vite__mapDeps([0,1,2])).then(async({App:e})=>{if(n)return;let a=await e.getState().catch(()=>null);if(n)return;a&&document.documentElement.classList.toggle(`yuri-native-app-active`,a.isActive);let o=await e.addListener(`appStateChange`,({isActive:e})=>{if(document.documentElement.classList.toggle(`yuri-native-app-active`,e),!e){t.current=!0;return}i()}),s=await e.addListener(`resume`,i);if(n){o.remove(),s.remove();return}r.push(()=>void o.remove(),()=>void s.remove())}).catch(()=>void 0),()=>{n=!0,r.forEach(e=>e()),document.documentElement.classList.remove(`yuri-native-app-active`)}},[e])},ud=e=>{Z.useEffect(()=>{if(!sd())return;let t=!1,n=null;return H(async()=>{let{App:e}=await import(`./vendor-capacitor-app-B5H_XtmE.js`).then(e=>e.t);return{App:e}},__vite__mapDeps([0,1,2])).then(async({App:r})=>{if(t)return;let i=await r.addListener(`backButton`,()=>{e()||r.minimizeApp().catch(()=>void 0)});if(t){i.remove();return}n=()=>void i.remove()}).catch(()=>void 0),()=>{t=!0,n?.()}},[e])},dd=e=>(e||``).replace(/\\/g,`/`).replace(/\/+$/g,``),fd={autoComplete:`off`,autoCorrect:`off`,spellCheck:!1},pd=1e3,md=e=>{let t=dd(e);if(!t)return``;let n=t.split(`/`).filter(Boolean);return n[n.length-1]||t},hd=(e,t)=>md(e?e.path:t),gd=({connection:e,onActiveConnectionDeleted:t,onConnect:n})=>{let{t:r}=ot(),i=e,{connections:a,isBusy:o,isPasswordBusy:s,error:c,pendingConnection:l,connect:u,submitPassword:d,cancelPassword:f,renameConnection:p,removeConnection:m,subscribeConnected:h,setError:g}=i,[_,v]=Z.useState(null),y=_?a.find(e=>e.id===_)??null:null,[b,x]=Z.useState(null),[S,C]=Z.useState(``),[w,T]=Z.useState(``),[E,D]=Z.useState(!1),O=Z.useId(),k=Z.useId(),[A,j]=Z.useState(``),[M,N]=Z.useState(!1),P=Z.useMemo(()=>so(),[]),[F,I]=Z.useState(null),[L,R]=Z.useState(null),B=z(()=>{D(!1),T(``),n()});Z.useEffect(()=>h(B),[B,h]);let V=z(()=>{v(null),C(``),R(null),g(null),D(!1)}),H=z(()=>{o||M||(D(!1),g(null))}),U=z(()=>{o||M||V()}),ee=z(e=>{e.preventDefault(),!(!_||!S.trim())&&p(_,S).then(e=>{e&&V()})}),te=z(e=>{i.redeemPairingConnection(e)}),ne=z(()=>{g(r(`mobile.connect.link.invalid`))}),re=z(async()=>{if(!M){g(null),R(null),N(!0);try{let e=await co();switch(e.status){case`ok`:await u({url:e.url,label:e.label,clientToken:e.clientToken});break;case`pairing`:await i.redeemPairingConnection(e.pairing);break;case`permission-denied`:g(r(`mobile.connect.scan.permissionDenied`));break;case`invalid`:g(r(`mobile.connect.scan.invalid`));break;case`unsupported`:g(r(`mobile.connect.scan.unsupported`));break;case`failed`:g(r(`mobile.connect.scan.failed`))}}catch{g(r(`mobile.connect.scan.failed`))}finally{N(!1)}}}),W=z(e=>{e.preventDefault(),d(A)}),ie=z(()=>{j(``),f()}),ae=z(e=>{x(t=>t===e?null:e)}),oe=z(e=>{x(null),_===e&&V();let n=a.length===1;m(e).then(e=>{e&&(n||tn(e))&&t()})});if(l)return l.reason===`pairing`?(0,$.jsx)(`div`,{className:`yuri-settings-page-content`,children:(0,$.jsx)(ki,{label:r(`mobile.connect.pairing.expired`),itemId:`instances.manage`,children:(0,$.jsxs)(`div`,{className:`yuri-settings-group-row flex flex-col gap-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,$.jsx)(X,{name:`computer`,className:`size-6 shrink-0 text-muted-foreground`}),(0,$.jsx)(`p`,{className:`min-w-0 flex-1 truncate typography-ui-label`,children:l.label}),a.some(e=>e.id===l.id)?(0,$.jsx)(q,{variant:`ghost`,size:`icon`,disabled:o||M,"aria-label":r(`mobile.instances.deleteAria`,{label:l.label}),onClick:()=>{x(l.id),ie()},children:(0,$.jsx)(X,{name:`delete-bin`,className:`size-5`})}):null]}),(0,$.jsx)(`p`,{className:`typography-small text-muted-foreground`,children:r(`mobile.connect.pairing.reconnectHint`)}),c?(0,$.jsx)(`p`,{role:`alert`,className:`typography-small text-[var(--status-error)]`,children:c}):null,P?(0,$.jsxs)(q,{size:`lg`,disabled:o||M,onClick:()=>void re(),children:[(0,$.jsx)(X,{name:`scan-2`,className:`size-5`}),r(`mobile.connect.scanQr`)]}):null,(0,$.jsx)(q,{variant:P?`ghost`:`default`,size:`lg`,disabled:o||M,onClick:()=>{ie(),D(!0)},children:r(`mobile.connect.link.useLink`)})]})})}):(0,$.jsx)(`div`,{className:`yuri-settings-page-content`,children:(0,$.jsx)(ki,{label:r(`mobile.connect.password.label`),itemId:`instances.manage`,children:(0,$.jsxs)(`form`,{className:`yuri-settings-group-row flex flex-col gap-3`,onSubmit:W,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-3 rounded-[18px] border border-border/70 bg-surface-elevated px-3.5 py-3`,children:[(0,$.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-[12px] bg-interactive-hover text-foreground`,children:(0,$.jsx)(X,{name:`lock`,className:`size-[18px]`})}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`p`,{className:`truncate typography-ui-label text-foreground`,children:l.label}),(0,$.jsx)(`p`,{className:`truncate typography-small text-muted-foreground`,children:l.candidates.some(e=>e.kind===`direct`)?on(l):r(`mobile.connect.relay.badge`)})]})]}),(0,$.jsx)(`input`,{...fd,value:A,onChange:e=>j(e.target.value),placeholder:r(`mobile.connect.password.placeholder`),"aria-label":r(`mobile.connect.password.label`),type:`password`,autoFocus:!0,className:`h-12 w-full rounded-[16px] border border-border/70 bg-surface-elevated px-4 text-[16px] text-foreground outline-none transition-colors placeholder:text-muted-foreground focus:border-primary focus:ring-2 focus:ring-primary/20`}),c?(0,$.jsx)(`p`,{role:`alert`,className:`px-1 typography-small text-[var(--status-error)]`,children:c}):null,(0,$.jsx)(q,{type:`submit`,size:`lg`,className:`mt-1 h-12 w-full`,disabled:s||!A.trim(),children:r(s?`mobile.connect.connecting`:`mobile.connect.unlockButton`)}),(0,$.jsx)(q,{type:`button`,variant:`ghost`,size:`sm`,className:`w-full`,onClick:ie,children:r(`mobile.connect.cancelPassword`)})]})})});let se=(0,$.jsxs)(`form`,{className:`flex flex-col gap-3`,onSubmit:ee,children:[(0,$.jsxs)(`label`,{className:`block space-y-1.5`,children:[(0,$.jsx)(`span`,{className:`block typography-ui-label text-foreground`,children:r(`mobile.instances.label.label`)}),(0,$.jsx)(Jt,{value:S,onChange:e=>C(e.target.value),placeholder:r(`mobile.instances.label.placeholder`),autoComplete:`off`,autoCapitalize:`words`,autoCorrect:`off`,spellCheck:!1,maxLength:120,autoFocus:!0,disabled:o||M,className:`h-12 w-full text-[16px]`})]}),c?(0,$.jsx)(`p`,{role:`alert`,className:`typography-small text-[var(--status-error)]`,children:c}):null,(0,$.jsx)(q,{type:`submit`,size:`lg`,className:`w-full`,disabled:o||M||!S.trim(),children:r(`mobile.instances.saveEdit`)})]});return(0,$.jsxs)(`div`,{className:`yuri-settings-page-content`,children:[(0,$.jsx)(ki,{label:r(`mobile.connect.saved.title`),itemId:`instances.manage`,children:a.length>0?a.map(e=>{let t=b===e.id,n=tn(e),i=F===e.id,a=r(i?`mobile.connect.connecting`:n?`mobile.instances.status.connected`:`mobile.instances.status.saved`);return(0,$.jsxs)(Z.Fragment,{children:[(0,$.jsxs)(`div`,{className:J(`yuri-settings-group-row relative flex items-center`,t&&`bg-[color-mix(in_srgb,var(--destructive)_8%,transparent)]`),children:[(0,$.jsx)(`button`,{type:`button`,"aria-label":r(`desktopHostSwitcher.actions.switchToAria`,{instance:e.label}),"data-mobile-press-feedback":`none`,className:`absolute inset-0 z-0 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-primary disabled:pointer-events-none`,onClick:()=>{n||(g(null),R(e.id),I(e.id),u({id:e.id,candidates:e.candidates,clientToken:e.clientToken,label:e.label}).finally(()=>I(null)))},disabled:n||o&&!i||t,style:{touchAction:`manipulation`}}),(0,$.jsxs)(`div`,{className:`pointer-events-none relative z-[1] flex min-w-0 flex-1 items-center gap-3`,children:[(0,$.jsx)(`span`,{className:`relative flex size-9 shrink-0 items-center justify-center rounded-[12px] bg-interactive-hover text-foreground`,children:(0,$.jsx)(X,{name:`server`,className:`size-[18px]`})}),(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:(0,$.jsx)(`span`,{className:`block truncate typography-ui-label text-foreground`,children:e.label})}),(0,$.jsx)(`span`,{className:J(`block truncate typography-small`,n&&!i?`text-[var(--status-success)]`:`text-muted-foreground`),children:a})]})]}),(0,$.jsxs)(`div`,{className:`relative z-10 flex shrink-0 items-center gap-0.5 pr-2`,children:[t?(0,$.jsxs)(`button`,{type:`button`,"aria-label":r(`mobile.instances.confirmDeleteAria`,{label:e.label}),className:`flex h-9 shrink-0 items-center gap-1.5 rounded-full bg-destructive px-3 text-destructive-foreground transition-opacity active:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-destructive`,onClick:()=>oe(e.id),style:{touchAction:`manipulation`},children:[(0,$.jsx)(X,{name:`delete-bin`,className:`size-[18px]`}),(0,$.jsx)(`span`,{className:`typography-ui-label`,children:r(`mobile.instances.delete`)})]}):i?(0,$.jsx)(`span`,{className:`flex size-9 items-center justify-center text-muted-foreground`,"aria-hidden":!0,children:(0,$.jsx)(X,{name:`loader-4`,className:`size-[18px] animate-spin`})}):(0,$.jsx)(`button`,{type:`button`,"aria-label":r(`mobile.instances.edit`),className:`flex size-9 items-center justify-center rounded-full text-muted-foreground transition-colors active:bg-interactive-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary`,onClick:()=>{v(e.id),C(e.label),R(null),g(null)},style:{touchAction:`manipulation`},children:(0,$.jsx)(X,{name:`edit`,className:`size-[18px]`})}),(0,$.jsx)(`button`,{type:`button`,"aria-label":r(t?`mobile.instances.cancelDeleteAria`:`mobile.instances.deleteAria`,{label:e.label}),className:`flex size-9 items-center justify-center rounded-full text-muted-foreground transition-colors active:bg-interactive-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary`,onClick:()=>ae(e.id),style:{touchAction:`manipulation`},children:(0,$.jsx)(X,{name:t?`close`:`delete-bin`,className:`size-[18px]`})})]})]}),c&&L===e.id&&!t?(0,$.jsx)(`div`,{className:`yuri-settings-group-row`,role:`alert`,children:(0,$.jsx)(`p`,{className:`typography-small text-[var(--status-error)]`,children:c})}):null]},e.id)}):(0,$.jsx)(`div`,{className:`yuri-settings-group-row flex items-center justify-center text-center typography-small text-muted-foreground`,children:r(`mobile.connect.saved.empty`)})}),(0,$.jsx)(ki,{label:r(`mobile.instances.addTitle`),children:(0,$.jsxs)(`div`,{className:`yuri-settings-group-row flex flex-col gap-3`,children:[P?(0,$.jsxs)(q,{type:`button`,size:`lg`,className:`w-full`,onClick:()=>void re(),disabled:o||M,children:[(0,$.jsx)(X,{name:`scan-2`,className:J(`size-[18px]`,M&&`animate-pulse`)}),r(`mobile.connect.scanQr`)]}):null,(0,$.jsx)(q,{type:`button`,variant:P?`ghost`:`default`,size:`lg`,className:`w-full`,disabled:o||M,onClick:()=>{R(null),g(null),D(!0)},children:r(`mobile.connect.link.useLink`)}),c&&!E&&!y&&!L?(0,$.jsx)(`p`,{role:`alert`,className:`typography-small text-[var(--status-error)]`,children:c}):null]})}),(0,$.jsx)(mt,{id:`mobile-instance-edit-${k}`,open:y!==null,onOpenChange:e=>{e||U()},fitContent:!0,ariaLabel:r(`mobile.instances.editTitle`),closeAriaLabel:r(`mobile.surface.closeAria`),resizeAriaLabel:r(`mobile.connect.options.resize`),children:(0,$.jsx)(dt,{className:`px-5 pb-5 pt-1`,disableHorizontal:!0,fillContainer:!1,children:se})}),(0,$.jsx)(mt,{id:`mobile-instance-add-${O}`,open:E,onOpenChange:e=>{e||H()},fitContent:!0,title:(0,$.jsx)(`h2`,{className:`truncate typography-ui-label font-semibold`,children:r(`mobile.connect.link.useLink`)}),ariaLabel:r(`mobile.connect.link.useLink`),closeAriaLabel:r(`mobile.surface.closeAria`),resizeAriaLabel:r(`mobile.connect.options.resize`),children:(0,$.jsx)(dt,{className:`px-5 py-5`,disableHorizontal:!0,fillContainer:!1,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,$.jsx)(`p`,{className:`typography-small text-muted-foreground`,children:r(`mobile.connect.link.help`)}),(0,$.jsx)(uo,{value:w,onValueChange:e=>{T(e),g(null)},showPasteButton:!0,disabled:o||M,isBusy:o,inputClassName:`min-w-0 flex-1 text-[16px]`,buttonVariant:`default`,buttonClassName:`yuri-welcome-primary w-full`,error:c,onRedeem:te,onInvalid:ne})]})})})]})},_d=e=>{let t=e.usedPercent;return typeof t!=`number`||!Number.isFinite(t)?`text-foreground`:t>=80?`text-[var(--status-error)]`:t>=50?`text-[var(--status-warning)]`:`text-foreground`},vd=e=>{let t=(0,Q.c)(13),{icon:n,iconNode:r,label:i,children:a}=e,o;t[0]!==n||t[1]!==r?(o=r??(n?(0,$.jsx)(X,{name:n,className:`size-[18px]`}):null),t[0]=n,t[1]=r,t[2]=o):o=t[2];let s;t[3]===o?s=t[4]:(s=(0,$.jsx)(`span`,{className:`flex size-5 shrink-0 items-center justify-center text-muted-foreground`,children:o}),t[3]=o,t[4]=s);let c;t[5]===i?c=t[6]:(c=(0,$.jsx)(`span`,{className:`shrink-0 typography-ui-label text-muted-foreground`,children:i}),t[5]=i,t[6]=c);let l;t[7]===a?l=t[8]:(l=(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-right typography-ui-label font-medium text-foreground`,children:a}),t[7]=a,t[8]=l);let u;return t[9]!==s||t[10]!==c||t[11]!==l?(u=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3 rounded-xl px-2.5 py-2.5`,children:[s,c,l]}),t[9]=s,t[10]=c,t[11]=l,t[12]=u):u=t[12],u},yd=e=>{let t=(0,Q.c)(55),{open:n,onClose:r,anchorRef:i,contextDisplay:a,branchLabel:o,usageGroups:s,usageDisplayMode:c,isUsageLoading:l,timeFormatPreference:u}=e,{t:d}=ot(),f=Z.useRef(null),[p,m]=Z.useState(n),[h,g]=Z.useState(!1),v;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(v=_(),t[0]=v):v=t[0];let y=v,b=Z.useRef(null),[x,S]=Z.useState(null),C,w;t[1]!==i||t[2]!==n||t[3]!==p?(C=()=>{if(!n||!y||!p)return;let e=()=>{let e=i.current?.getBoundingClientRect(),t=b.current?.getBoundingClientRect();if(!e||!t){S(null);return}let n=e.left-t.left,r=Math.min(Math.max(n,8),Math.max(8,t.width-nd-8));S(r)};e();let t=b.current;if(typeof ResizeObserver>`u`||!t)return;let r=new ResizeObserver(e);return r.observe(t),()=>r.disconnect()},w=[i,y,n,p],t[1]=i,t[2]=n,t[3]=p,t[4]=C,t[5]=w):(C=t[4],w=t[5]),Z.useLayoutEffect(C,w);let T=y&&x!==null,E,D;t[6]!==n||t[7]!==p?(E=()=>{if(n){m(!0),g(!1);return}if(!p)return;g(!0);let e=window.setTimeout(()=>{m(!1),g(!1)},140);return()=>window.clearTimeout(e)},D=[n,p],t[6]=n,t[7]=p,t[8]=E,t[9]=D):(E=t[8],D=t[9]),Z.useEffect(E,D);let O,k;t[10]!==r||t[11]!==n?(O=()=>{if(!n)return;let e=e=>{e.key===`Escape`&&r()};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},k=[r,n],t[10]=r,t[11]=n,t[12]=O,t[13]=k):(O=t[12],k=t[13]),Z.useEffect(O,k);let A,j;if(t[14]!==i||t[15]!==r||t[16]!==n?(A=()=>{if(!n)return;let e=e=>{let t=e.target;if(!(t instanceof Node)){r();return}f.current?.contains(t)||i.current?.contains(t)||r()};return document.addEventListener(`pointerdown`,e,!0),document.addEventListener(`wheel`,e,!0),()=>{document.removeEventListener(`pointerdown`,e,!0),document.removeEventListener(`wheel`,e,!0)}},j=[i,r,n],t[14]=i,t[15]=r,t[16]=n,t[17]=A,t[18]=j):(A=t[17],j=t[18]),Z.useEffect(A,j),!p)return null;let M;t[19]===d?M=t[20]:(M=d(`mobile.header.openMetadataAria`),t[19]=d,t[20]=M);let N=T?`absolute origin-top-left`:`mx-3 mt-2`,P=h?`pointer-events-none`:`pointer-events-auto`,F;t[21]!==N||t[22]!==P?(F=J(`overflow-x-hidden overflow-y-auto overscroll-contain rounded-[20px] yuri-mobile-overlay-surface p-2 will-change-transform`,N,P),t[21]=N,t[22]=P,t[23]=F):F=t[23];let I=`${h?`session-metadata-out`:`session-metadata-in`} ${h?140:170}ms cubic-bezier(0.32, 0.72, 0, 1) forwards`,L;t[24]!==x||t[25]!==T?(L=T?{top:8,left:x??8,width:`min(${nd}px, calc(100% - 16px))`}:null,t[24]=x,t[25]=T,t[26]=L):L=t[26];let R;t[27]!==I||t[28]!==L?(R={animation:I,maxHeight:`min(72dvh, calc(100dvh - var(--yuri-safe-area-top, 0px) - var(--yuri-header-height, 56px) - 1rem))`,...L},t[27]=I,t[28]=L,t[29]=R):R=t[29];let z;t[30]===d?z=t[31]:(z=d(`mobile.header.metadata.branch`),t[30]=d,t[31]=z);let B;t[32]!==o||t[33]!==z?(B=(0,$.jsx)(vd,{icon:`git-branch`,label:z,children:o}),t[32]=o,t[33]=z,t[34]=B):B=t[34];let V;t[35]!==a||t[36]!==d?(V=a?(0,$.jsx)(vd,{iconNode:(0,$.jsx)(Bi,{percentage:a.percentage,pending:a.pending}),label:d(`mobile.header.metadata.context`),children:(0,$.jsxs)(`span`,{className:`inline-flex items-baseline gap-1.5 tabular-nums`,children:[(0,$.jsx)(`span`,{className:J(`font-semibold`,a.colorClass),children:a.pending?d(`contextUsage.pending`):`${a.percentage.toFixed(1)}%`}),(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:a.tokens})]})}):null,t[35]=a,t[36]=d,t[37]=V):V=t[37];let H;t[38]!==l||t[39]!==u||t[40]!==c||t[41]!==s?(H=(0,$.jsx)(bd,{groups:s,displayMode:c,isLoading:l,timeFormatPreference:u}),t[38]=l,t[39]=u,t[40]=c,t[41]=s,t[42]=H):H=t[42];let U;t[43]!==B||t[44]!==V||t[45]!==H?(U=(0,$.jsxs)(`div`,{className:`space-y-1`,children:[B,V,H]}),t[43]=B,t[44]=V,t[45]=H,t[46]=U):U=t[46];let ee;t[47]!==M||t[48]!==F||t[49]!==R||t[50]!==U?(ee=(0,$.jsx)(`div`,{ref:f,role:`dialog`,"aria-label":M,className:F,style:R,children:U}),t[47]=M,t[48]=F,t[49]=R,t[50]=U,t[51]=ee):ee=t[51];let te;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,$.jsx)(`style`,{children:`
9
+ @keyframes session-metadata-in {
10
+ from { opacity: 0; transform: translateY(-8px) scale(0.985); }
11
+ to { opacity: 1; transform: translateY(0) scale(1); }
12
+ }
13
+ @keyframes session-metadata-out {
14
+ from { opacity: 1; transform: translateY(0) scale(1); }
15
+ to { opacity: 0; transform: translateY(-6px) scale(0.985); }
16
+ }
17
+ `}),t[52]=te):te=t[52];let ne;return t[53]===ee?ne=t[54]:(ne=(0,$.jsxs)(`div`,{ref:b,className:`fixed inset-x-0 bottom-0 top-[calc(var(--yuri-safe-area-top,0px)+var(--yuri-header-height,56px))] z-20 pointer-events-none`,children:[ee,te]}),t[53]=ee,t[54]=ne),ne},bd=e=>{let t=(0,Q.c)(30),{groups:n,displayMode:r,isLoading:i,timeFormatPreference:a}=e,{t:o}=ot(),s;t[0]!==r||t[1]!==o?(s=o(r===`remaining`?`header.services.remaining`:`header.services.used`),t[0]=r,t[1]=o,t[2]=s):s=t[2];let c=s;if(n.length===0)return null;let l;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,$.jsx)(`span`,{className:`flex size-5 shrink-0 items-center justify-center text-muted-foreground`,children:(0,$.jsx)(X,{name:`timer`,className:`size-[18px]`})}),t[3]=l):l=t[3];let u;t[4]===o?u=t[5]:(u=o(`mobile.header.metadata.usage`),t[4]=o,t[5]=u);let d;t[6]===u?d=t[7]:(d=(0,$.jsx)(`span`,{className:`shrink-0 typography-ui-label text-muted-foreground`,children:u}),t[6]=u,t[7]=d);let f;t[8]===i?f=t[9]:(f=i?(0,$.jsx)(X,{name:`refresh`,className:`size-3.5 animate-spin`}):null,t[8]=i,t[9]=f);let p;t[10]===c?p=t[11]:(p=(0,$.jsx)(`span`,{className:`truncate`,children:c}),t[10]=c,t[11]=p);let m;t[12]!==f||t[13]!==p?(m=(0,$.jsxs)(`span`,{className:`inline-flex min-w-0 flex-1 items-center justify-end gap-1.5 typography-ui-label text-muted-foreground`,children:[f,p]}),t[12]=f,t[13]=p,t[14]=m):m=t[14];let h;t[15]!==d||t[16]!==m?(h=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3 px-2.5 pb-1.5`,children:[l,d,m]}),t[15]=d,t[16]=m,t[17]=h):h=t[17];let g;if(t[18]!==r||t[19]!==n||t[20]!==a){let e;t[22]!==r||t[23]!==a?(e=e=>(0,$.jsxs)(`div`,{className:`min-w-0 rounded-xl bg-[var(--surface-muted)] p-2.5`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,$.jsx)(qn,{providerId:e.providerId,className:`size-4 shrink-0`}),(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate typography-ui-label font-medium text-foreground`,children:e.providerName}),e.status&&e.rows.length===0?(0,$.jsx)(`span`,{className:`min-w-0 max-w-[60%] truncate typography-micro text-muted-foreground`,children:e.status}):null]}),e.rows.length>0?(0,$.jsx)(`div`,{className:`mt-1.5 space-y-1`,children:e.rows.map((t,n)=>{let i=Fi(e.rows.map(Dd),n),o=r===`remaining`?t.window.remainingPercent:t.window.usedPercent,s=or(t.window.valueLabel,o),c=sr(t.window.resetAt,t.window.resetAfterFormatted??t.window.resetAtFormatted,a);return(0,$.jsxs)(Z.Fragment,{children:[i?(0,$.jsx)(`div`,{className:J(`typography-micro font-medium uppercase tracking-wide text-muted-foreground`,n>0&&`mt-3 border-t border-[var(--surface-subtle)] pt-2`),children:i}):null,(0,$.jsxs)(`div`,{className:`flex min-w-0 items-baseline justify-between gap-3`,children:[(0,$.jsxs)(`span`,{className:`inline-flex min-w-0 flex-1 items-baseline gap-1.5`,children:[(0,$.jsx)(`span`,{className:`truncate typography-ui-label text-muted-foreground`,children:t.subtitle?`${t.subtitle} · ${t.label}`:t.label}),c?(0,$.jsx)(`span`,{className:`min-w-0 truncate typography-micro text-muted-foreground/70`,children:c}):null]}),(0,$.jsx)(`span`,{className:J(`min-w-0 max-w-[60%] shrink-0 truncate typography-ui-label font-semibold tabular-nums`,_d(t.window)),children:s===`-`?``:s})]})]},t.key)})}):null,e.status&&e.rows.length>0?(0,$.jsx)(`div`,{className:`mt-1.5 truncate typography-micro text-muted-foreground`,title:e.status,children:e.status}):null]},e.providerId),t[22]=r,t[23]=a,t[24]=e):e=t[24],g=n.map(e),t[18]=r,t[19]=n,t[20]=a,t[21]=g}else g=t[21];let _;t[25]===g?_=t[26]:(_=(0,$.jsx)(`div`,{className:`space-y-1.5`,children:g}),t[25]=g,t[26]=_);let v;return t[27]!==_||t[28]!==h?(v=(0,$.jsxs)(`div`,{className:`pt-2.5`,children:[h,_]}),t[27]=_,t[28]=h,t[29]=v):v=t[29],v},xd=e=>{let t=(0,Q.c)(35),{open:n,onClose:r,items:i,rightOffset:a}=e,o=a===void 0?0:a,{t:s}=ot(),c,l;if(t[0]!==r||t[1]!==n?(c=()=>{if(!n)return;let e=e=>{e.key===`Escape`&&r()};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},l=[r,n],t[0]=r,t[1]=n,t[2]=c,t[3]=l):(c=t[2],l=t[3]),Z.useEffect(c,l),!n)return null;let u;t[4]===r?u=t[5]:(u=(e,t,n)=>(0,$.jsxs)(`button`,{type:`button`,role:n===void 0?`menuitem`:`menuitemcheckbox`,"aria-checked":n,className:J(`flex w-full items-center gap-3 px-4 py-3 text-left transition-colors hover:bg-interactive-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-inset`,t>0&&`border-t border-border/30`,e.disabled&&`cursor-not-allowed opacity-60`),style:{touchAction:`manipulation`},disabled:e.disabled,onClick:()=>{e.onSelect(),r()},children:[e.iconNode??(e.icon?(0,$.jsx)(X,{name:e.icon,className:J(`size-5 shrink-0 text-muted-foreground`,e.spinning&&`animate-spin`,e.key===`auto-read`&&`translate-x-px`)}):null),(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate typography-ui-label text-foreground`,children:e.label}),e.badge&&e.badge>0?(0,$.jsx)(`span`,{className:`inline-flex size-2 shrink-0 rounded-full bg-primary`,"aria-hidden":!0}):null,n&&(0,$.jsx)(X,{name:`check`,className:`size-4 shrink-0 text-muted-foreground`})]},e.key),t[4]=r,t[5]=u);let d=u,f;t[6]===s?f=t[7]:(f=s(`mobile.menu.titleAria`),t[6]=s,t[7]=f);let p;t[8]===s?p=t[9]:(p=s(`mobile.surface.closeAria`),t[8]=s,t[9]=p);let m;t[10]===r?m=t[11]:(m=e=>{e.preventDefault(),r()},t[10]=r,t[11]=m);let h;t[12]!==p||t[13]!==m?(h=(0,$.jsx)(`button`,{type:`button`,className:`pointer-events-auto absolute inset-x-0 bottom-0 cursor-default top-[calc(var(--yuri-safe-area-top,0px)+var(--yuri-mobile-detail-navigation-height,3.5rem)+0.25rem)]`,"aria-label":p,onPointerDown:m}),t[12]=p,t[13]=m,t[14]=h):h=t[14];let g=`max(1rem, calc(8px + ${o}px + var(--yuri-safe-area-right, 0px)))`,_;t[15]===g?_=t[16]:(_={right:g,animation:`mobile-menu-in 160ms cubic-bezier(0.32, 0.72, 0, 1) forwards`},t[15]=g,t[16]=_);let v;if(t[17]!==i||t[18]!==d){let e;t[20]===d?e=t[21]:(e=(e,t)=>d(e,t),t[20]=d,t[21]=e),v=i.map(e),t[17]=i,t[18]=d,t[19]=v}else v=t[19];let y;t[22]!==i.length||t[23]!==d||t[24]!==s?(y=(0,$.jsx)(_a,{children:e=>{let{enabled:t,available:n,toggle:r}=e;return d({key:`auto-read`,icon:`volume-up`,label:s(`mobile.menu.autoRead`),disabled:!n,onSelect:r},i.length,t)}}),t[22]=i.length,t[23]=d,t[24]=s,t[25]=y):y=t[25];let b;t[26]!==_||t[27]!==v||t[28]!==y?(b=(0,$.jsxs)(`div`,{id:Zu,className:`pointer-events-auto absolute top-[calc(var(--yuri-safe-area-top,0px)+var(--yuri-mobile-detail-navigation-height,3.5rem)+0.25rem)] w-[min(220px,calc(100vw-1rem))] origin-top-right overflow-hidden rounded-2xl yuri-mobile-overlay-surface`,role:`menu`,style:_,onAnimationEnd:Od,children:[v,y]}),t[26]=_,t[27]=v,t[28]=y,t[29]=b):b=t[29];let x;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,$.jsx)(`style`,{children:`@keyframes mobile-menu-in { from { opacity: 0; transform: translateY(-6px) scale(0.96); } to { opacity: 1; transform: translateY(0) scale(1); } }`}),t[30]=x):x=t[30];let S;return t[31]!==b||t[32]!==f||t[33]!==h?(S=(0,$.jsxs)(`div`,{className:`pointer-events-none fixed inset-0 z-50`,role:`dialog`,"aria-modal":`true`,"aria-label":f,children:[h,b,x]}),t[31]=b,t[32]=f,t[33]=h,t[34]=S):S=t[34],S},Sd=Z.memo(function(e){let t=(0,Q.c)(90),{open:n,onOpenChange:r,currentSessionId:i,effectiveDirectory:a,gitDirectory:o,isNewSessionDraftOpen:s,primaryLabel:c,secondaryLabel:l}=e,{t:u}=ot(),{git:d}=F(),f=Vi(i??``,a||void 0),p=f??l,m=Z.useRef(null),h=Ze(i??``,a||void 0),g=Pt(o),_=Ft(o),v=It(kd),y=It(Ad),b=Te(jd),x=Te(Md),S=Te(Nd),C=Te(Pd),w;t[0]===i?w=t[1]:(w=e=>i?e.sessionModelSelections.get(i)??null:null,t[0]=i,t[1]=w);let T=qe(w),E=ir(Fd),D=ir(Id),O=ir(Ld),k=ir(Rd),A=ir(zd),j=ir(Bd),M=U(Vd);rr();let N,P;t[2]!==v||t[3]!==d||t[4]!==o?(N=()=>{o&&v(o,d)},P=[v,d,o],t[2]=v,t[3]=d,t[4]=o,t[5]=N,t[6]=P):(N=t[5],P=t[6]),Z.useEffect(N,P);let I,L;t[7]!==y||t[8]!==d||t[9]!==o?(I=()=>{if(o)return Oe.onGitRefreshHint(e=>{dd(e.directory)===o&&y(o,d)})},L=[y,d,o],t[7]=y,t[8]=d,t[9]=o,t[10]=I,t[11]=L):(I=t[10],L=t[11]),Z.useEffect(I,L);let R,z;t[12]===D?(R=t[13],z=t[14]):(R=()=>{D()},z=[D],t[12]=D,t[13]=R,t[14]=z),Z.useEffect(R,z);let B,V;t[15]===A?(B=t[16],V=t[17]):(B=()=>{Kn(A)},V=[A],t[15]=A,t[16]=B,t[17]=V),Z.useEffect(B,V);let H,ee;t[18]===n?(H=t[19],ee=t[20]):(H=()=>{!n||ir.getState().isLoading||ir.getState().fetchAllQuotas()},ee=[n],t[18]=n,t[19]=H,t[20]=ee),Z.useEffect(H,ee);let te;t[21]===h?te=t[22]:(te=Ii(h),t[21]=h,t[22]=te);let ne=te,re;t[23]!==S||t[24]!==x||t[25]!==ne||t[26]!==T?(re=ne??(T?{providerID:T.providerId,modelID:T.modelId}:null)??(x&&S?{providerID:x,modelID:S}:null),t[23]=S,t[24]=x,t[25]=ne,t[26]=T,t[27]=re):re=t[27];let W=re,ie;if(t[28]!==C||t[29]!==W||t[30]!==b){let e=(W?b.find(e=>e.id===W.providerID):void 0)?.models.find(e=>e.id===W?.modelID),n;t[32]!==C||t[33]!==W?(n=W?C(W.providerID,W.modelID):void 0,t[32]=C,t[33]=W,t[34]=n):n=t[34];let r=n;ie=Ri(e?.limit,`context`)??r?.limit?.context??0,t[28]=C,t[29]=W,t[30]=b,t[31]=ie}else ie=t[31];let ae=ie,oe=Ye(i??``,ae,0,a||void 0),se=oe?.pending?null:oe?.totalTokens??0,ce;t[35]!==ae||t[36]!==s||t[37]!==se?(ce=Li({totalTokens:se,contextLimit:ae,isDraft:s}),t[35]=ae,t[36]=s,t[37]=se,t[38]=ce):ce=t[38];let le=ce,ue;t[39]!==_?.current||t[40]!==g||t[41]!==u?(ue=g===!0?_?.current?.trim()||u(`gitView.branch.detachedHead`):u(`common.unavailable`),t[39]=_?.current,t[40]=g,t[41]=u,t[42]=ue):ue=t[42];let de=ue,G;if(t[43]!==A||t[44]!==E||t[45]!==j||t[46]!==u){let e=new Map(E.map(Hd)),n;t[48]===A?n=t[49]:(n=e=>A.includes(e.id),t[48]=A,t[49]=n),G=ar(E).filter(n).filter(t=>e.get(t.id)?.configured===!0).map(t=>{let n=e.get(t.id),r=[];for(let[e,t]of Pi(Object.entries(n?.usage?.windows??{}),n?.usage?.accounts))r.push({key:`window-${e}`,label:cr(t.label??e),window:t});let i=Object.entries(n?.usage?.models??{}),a=j[t.id]??[],o=a.length>0?i.filter(e=>{let[t]=e;return a.includes(t)}):i;for(let[e,t]of o){let n=Object.entries(t.windows??{});if(n.length===0)continue;let[i,a]=n[0];r.push({key:`model-${e}-${i}`,label:cr(a.label??i),subtitle:nr(e),window:a})}let s=!n.ok&&n.error?n.error:r.length===0?u(`header.services.noRateLimitsReported`):null;return{providerId:t.id,providerName:t.name,rows:r,status:s}}),t[43]=A,t[44]=E,t[45]=j,t[46]=u,t[47]=G}else G=t[47];let fe=G,pe,me;t[50]!==n||t[51]!==fe?(pe=()=>{!n||fe.length===0||Kn(fe.map(Ud))},me=[n,fe],t[50]=n,t[51]=fe,t[52]=pe,t[53]=me):(pe=t[52],me=t[53]),Z.useEffect(pe,me);let he;t[54]===c?he=t[55]:(he=(0,$.jsx)(`span`,{className:`block truncate typography-ui-label text-foreground`,children:c}),t[54]=c,t[55]=he);let K;t[56]!==p||t[57]!==f?(K=p?(0,$.jsx)(`span`,{className:J(`block truncate`,f?`yuri-mobile-detail-subtitle text-muted-foreground`:`typography-micro text-muted-foreground`),"aria-live":`polite`,children:p}):null,t[56]=p,t[57]=f,t[58]=K):K=t[58];let ge;t[59]!==he||t[60]!==K?(ge=(0,$.jsx)(`div`,{className:`flex min-w-0 flex-1 items-center px-2 py-1.5 text-left`,children:(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col leading-tight`,children:[he,K]})}),t[59]=he,t[60]=K,t[61]=ge):ge=t[61];let _e;t[62]===u?_e=t[63]:(_e=u(`mobile.header.openMetadataAria`),t[62]=u,t[63]=_e);let ve;t[64]===r?ve=t[65]:(ve=()=>r(Wd),t[64]=r,t[65]=ve);let ye;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(ye={touchAction:`manipulation`},t[66]=ye):ye=t[66];let be=le?.percentage??0,xe=le?.pending,Se;t[67]!==be||t[68]!==xe?(Se=(0,$.jsx)(Bi,{percentage:be,pending:xe}),t[67]=be,t[68]=xe,t[69]=Se):Se=t[69];let Ce;t[70]!==n||t[71]!==_e||t[72]!==ve||t[73]!==Se?(Ce=(0,$.jsx)(`button`,{ref:m,type:`button`,className:`flex size-10 shrink-0 items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-interactive-hover hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary`,"aria-label":_e,"aria-expanded":n,onClick:ve,style:ye,children:Se}),t[70]=n,t[71]=_e,t[72]=ve,t[73]=Se,t[74]=Ce):Ce=t[74];let we;t[75]===r?we=t[76]:(we=()=>r(!1),t[75]=r,t[76]=we);let q;t[77]!==de||t[78]!==le||t[79]!==O||t[80]!==n||t[81]!==k||t[82]!==we||t[83]!==M||t[84]!==fe?(q=(0,$.jsx)(yd,{open:n,onClose:we,anchorRef:m,contextDisplay:le,branchLabel:de,usageGroups:fe,usageDisplayMode:k,isUsageLoading:O,timeFormatPreference:M}),t[77]=de,t[78]=le,t[79]=O,t[80]=n,t[81]=k,t[82]=we,t[83]=M,t[84]=fe,t[85]=q):q=t[85];let Ee;return t[86]!==ge||t[87]!==Ce||t[88]!==q?(Ee=(0,$.jsxs)($.Fragment,{children:[ge,Ce,q]}),t[86]=ge,t[87]=Ce,t[88]=q,t[89]=Ee):Ee=t[89],Ee}),Cd=({onOpenSessions:e,menuOpen:t,onToggleMenu:n,surfaceShortcuts:r})=>{let{t:i}=ot(),[a,o]=Z.useState(!1),s=D(e=>e.currentDirectory),c=Ne(e=>e.currentSessionId),l=Z.useMemo(()=>e=>c?e.getDirectoryForSession(c):null,[c]),u=Ne(l)||s,d=dd(u)||null,f=ae(e=>e.projects),p=Ne(e=>e.availableWorktreesByProject),m=Z.useMemo(()=>e=>c?e.worktreeMetadata.get(c)??null:null,[c]),h=Ne(m),g=G(c),_=Ne(e=>!!e.newSessionDraft?.open),v=Z.useMemo(()=>{let e=dd(u);return e&&hd((h?.projectDirectory?Ee(f,h.projectDirectory):null)??be(f,p,e),e)||i(`mobile.header.noProject`)},[p,h?.projectDirectory,u,f,i]),y=g?.title?.trim()||(c?i(`mobile.sessions.untitled`):v),b=c?v:``;Z.useEffect(()=>{o(!1)},[c,u]);let x=z(()=>{o(!1),e()}),S=z(()=>{o(!1),n()});return(0,$.jsx)($.Fragment,{children:(0,$.jsxs)(wo,{children:[(0,$.jsx)(`button`,{type:`button`,className:`flex size-10 shrink-0 items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-interactive-hover hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary`,"aria-label":i(`mobile.sessions.openSheetAria`),onClick:x,style:{touchAction:`manipulation`},children:(0,$.jsx)(X,{name:`folders`,className:`size-5`})}),(0,$.jsx)(Sd,{open:a,onOpenChange:o,currentSessionId:c,effectiveDirectory:u,gitDirectory:d,isNewSessionDraftOpen:_,primaryLabel:y,secondaryLabel:b}),r?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`button`,{type:`button`,className:J(`flex size-10 shrink-0 items-center justify-center rounded-full transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary`,r.activePanel===`files`?`bg-[var(--interactive-selection)] text-[var(--interactive-selectionForeground)]`:`text-muted-foreground hover:bg-interactive-hover hover:text-foreground`),"aria-label":i(`mobile.menu.files`),"aria-pressed":r.activePanel===`files`,onClick:r.onToggleFiles,style:{touchAction:`manipulation`},children:(0,$.jsx)(X,{name:`file-text`,className:`size-5`})}),(0,$.jsxs)(`button`,{type:`button`,className:J(`relative flex size-10 shrink-0 items-center justify-center rounded-full transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary`,r.activePanel===`changes`?`bg-[var(--interactive-selection)] text-[var(--interactive-selectionForeground)]`:`text-muted-foreground hover:bg-interactive-hover hover:text-foreground`),"aria-label":i(`mobile.menu.changes`),"aria-pressed":r.activePanel===`changes`,onClick:r.onToggleChanges,style:{touchAction:`manipulation`},children:[(0,$.jsx)(X,{name:`git-branch`,className:`size-5`}),r.changesDirty?(0,$.jsx)(`span`,{className:`absolute right-2 top-2 inline-flex size-2 rounded-full bg-primary`,"aria-hidden":!0}):null]})]}):null,(0,$.jsx)(`button`,{type:`button`,className:`flex size-10 shrink-0 items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-interactive-hover hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary`,"aria-label":i(`mobile.header.openMenuAria`),"aria-controls":Zu,"aria-expanded":t,"aria-haspopup":`menu`,onClick:S,style:{touchAction:`manipulation`},children:(0,$.jsx)(X,{name:`more-2`,className:`size-5`})})]})})},wd=e=>{let t=(0,Q.c)(5),n=Co();if(!n.enabled){let n;return t[0]===e?n=t[1]:(n=(0,$.jsx)(Cd,{...e}),t[0]=e,t[1]=n),n}let r;return t[2]!==e||t[3]!==n?(r=(0,$.jsx)(Eo,{...e,scope:n}),t[2]=e,t[3]=n,t[4]=r):r=t[4],r},Td=({connection:e,onActiveConnectionDeleted:t})=>{let{t:n}=ot(),r=Vn();De(),Fe();let i=U(e=>e.mobileSessionPanelOpen),a=U(e=>e.setMobileSessionPanelOpen),o=U(e=>e.isScheduledTasksDialogOpen),s=U(e=>e.activeMainTab),c=un(),l=U(e=>e.setActiveMainTab),[u,d]=Z.useState(!1),[f,p]=Z.useState(!1),[m,h]=Z.useState(null),[g,v]=Z.useState(!1),[y,b]=Z.useState(!1),[x,S]=Z.useState(null),[C,w]=Z.useState(null),[T,E]=Z.useState(null),[O,k]=Z.useState(0),[A,j]=Z.useState(!1),[M,P]=Z.useState(!1),[F,I]=Z.useState(!1),[L,R]=Z.useState(!1),[B,V]=Z.useState(!1),[H,ee]=Z.useState(!1),[te,ne]=Z.useState(`nav`),[re,W]=Z.useState(!1),[ae,oe]=Z.useState(!1),se=z(()=>{W(!1),oe(!0)}),ce=z(()=>{if(W(!1),K.enabled){ie.info(n(`remoteProjects.nativeCapabilityUnavailable`,{capability:n(`remoteDesktop.title`)}));return}se()}),le=z(()=>oe(!1)),[ue,de]=Z.useState(!1),G=z(()=>W(e=>!e)),fe=z(()=>W(!1)),[me,he]=Z.useState(null),K=Co(),ge=A&&!K.enabled,_e=D(e=>e.currentDirectory),ve=U(e=>e.setSettingsPage),be=Ci(e=>e.available),xe=Ci(e=>e.runtimeType),Se=Z.useMemo(()=>sd(),[]),Ce=Z.useMemo(()=>so(),[]),we=_e??null,{data:Te=[],refetch:Ee}=N({...Oi(we),enabled:ge}),{refetch:ke}=N({...Di(we),enabled:ge}),Ae=ji(e=>e.setMcpDraft),je=ji(e=>e.setSelectedMcp),Me=Ft(K.enabled?K.entry?.key??null:dd(_e)||null)?.files?.length??0;Z.useEffect(()=>Oe.onDirectoryRequest(()=>V(!0)),[]);let Pe=Z.useMemo(()=>_(),[]),Ie=ye(e=>e.secondary?.kind??null),Le=Ne(e=>K.enabled?null:e.currentSessionId),Re=K.enabled?K.sessionId:Le,ze=Ne(e=>e.setCurrentSession),Be=Z.useMemo(()=>e=>!K.enabled&&Re?e.getDirectoryForSession(Re):null,[Re,K.enabled]),Ve=Ne(Be),He=K.enabled?K.entry?.location.directory:Ve,Ue=Tt()===`portrait`,[We,Ge]=Z.useState(Pe&&!Ue),[Ke,Y]=Z.useState(null),qe=z(e=>{if(e&&ve(e),Pe){ne(e?`page-content`:`nav`),I(!0);return}let t=ye.getState();if(e){t.openSettingsFromCurrent();return}ve(`home`),t.setActiveTab(`settings`)}),Je=z(()=>{qe(`instances`)}),Ye=z(()=>{ye.getState().openInstances()}),Xe=z(async t=>{if(!t){Ye();return}let n=e.connections.find(e=>e.id===t);!n||e.isBusy||tn(n)||(await e.connect({id:n.id,candidates:n.candidates,clientToken:n.clientToken,label:n.label}),tn(n)||Ye())}),Ze=z(()=>{ye.getState().closeSecondary()}),Qe=z(async()=>{if(!H){ee(!0);try{let t=await co();switch(t.status){case`ok`:await e.connect({url:t.url,clientToken:t.clientToken,label:t.label});break;case`pairing`:await e.redeemPairingConnection(t.pairing);break;case`permission-denied`:ie.error(n(`mobile.connect.scan.permissionDenied`));break;case`invalid`:ie.error(n(`mobile.connect.scan.invalid`));break;case`unsupported`:ie.error(n(`mobile.connect.scan.unsupported`));break;case`failed`:ie.error(n(`mobile.connect.scan.failed`))}}finally{ee(!1)}}});Ut({enabled:!Pe,rootRoutesBlocked:i||u||f||g||y||o||ge||F||L||B||re});let $e=z(()=>{let e=!We;e&&Ue&&Y(null),Ge(e)}),et=z(()=>{if(b(!1),S(null),w(null),p(!1),h(null),Pe){he(null),Y(`files`),Ue&&Ge(!1);return}d(!0)}),tt=z(()=>{p(!1),h(null)}),nt=z(e=>{let t=e.path.trim();if(t){if(b(!1),S(null),w(null),he(null),v(!1),Pe){U.getState().setPendingFileFocusPath(t),Y(`files`),Ue&&Ge(!1);return}d(!1),h({path:t,targetLine:typeof e.targetLine==`number`&&Number.isFinite(e.targetLine)?Math.max(1,Math.trunc(e.targetLine)):void 0}),p(!0)}}),rt=U(e=>e.pendingFileFocusPath);Z.useEffect(()=>{if(rt){if(Pe){et();return}nt({path:rt}),U.getState().setPendingFileFocusPath(null)}},[rt,Pe,et,nt]);let it=z((e=null)=>{if(b(!1),S(null),w(null),E(null),p(!1),h(null),he(e),Pe){Y(`changes`),Ue&&Ge(!1);return}v(!0)}),at=z((e,t,n)=>{he(null),v(!1),p(!1),h(null),S(e??null),w(typeof t==`string`&&t.trim()?t.trim():null);let r=typeof n==`string`&&n.trim()?n.trim():null;if(E(r),k(e=>e+1),Pe){Y(`turn-diff`),Ue&&Ge(!1);return}b(!0)}),st=z(()=>{Y(null),he(null),E(null)}),ct=z(e=>{if(Ke===e){st();return}e===`files`?et():it()}),lt=Z.useRef(`changes`);Ke&&(lt.current=Ke);let[ut,dt]=Z.useState(!1);Z.useEffect(()=>{if(!Pe)return;if(Ke){dt(!0);return}let e=window.setTimeout(()=>dt(!1),240);return()=>window.clearTimeout(e)},[Ke,Pe]);let pt=Ke??lt.current,gt=ad(`left`,`yuri.ipad.leftSidebarWidth`,Qu),vt=ad(`right`,`yuri.ipad.rightSidebarWidth`,$u),yt=Z.useMemo(()=>({openChanges:({diffPath:e,staged:t,targetLine:n}={})=>{it(e?{path:e,staged:t===!0,targetLine:n}:null)},openToolDiff:({diffPath:e,patches:t,targetLine:n})=>{it({path:e,staged:!1,targetLine:n,toolPatches:t})},openTurnDiff:at,openFile:({path:e,targetLine:t})=>{nt({path:e,targetLine:t})},openFiles:()=>et(),openSettings:e=>{qe(e)}}),[it,nt,et,qe,at]),bt=z(()=>{v(!1),he(null)}),xt=z(()=>{b(!1),E(null)});Qc(Z.useMemo(()=>({openSessions:()=>{if(Pe){Ge(!0);return}ye.getState().setActiveTab(`projects`)},openView:e=>{e===`files`?et():e===`mcp`?j(!0):e===`instances`?Je():e===`update`&&R(!0)},openChanges:({path:e,staged:t}={})=>{it(e?{path:e,staged:t===!0}:null)},openSettings:e=>{qe(e)}}),[Pe,it,et,Je,qe]));let St=Z.useRef(null),Ct=Z.useRef(null),wt=pe(K.enabled?null:Re,K.enabled?void 0:He||_e||void 0),Et=K.session?.parentID,Dt=K.enabled?Et?{id:Et,directory:He}:null:wt,Ot=z(()=>{Dt&&(K.enabled?K.openSession(Dt.id):ze(Dt.id,Dt.directory))});wu();let kt=Z.useRef(0);Z.useEffect(()=>(kt.current+=1,de(!1),()=>{kt.current+=1}),[Re,K.key,K.entry]);let At=z(()=>{let e=Re;if(!e||ue)return;let t=He||_e||void 0,i=++kt.current;de(!0),(async()=>{try{K.enabled?await K.refresh():await r.refreshSessionTranscript(e,{directory:t}),i===kt.current&&ie.success(n(`sessions.sidebar.session.menu.refreshTranscriptSuccess`))}catch{i===kt.current&&ie.error(n(`sessions.sidebar.session.menu.refreshTranscriptFailed`))}finally{i===kt.current&&de(!1)}})()}),jt=!Pe&&(Ie===`chat`||Ie===`draft`);Z.useEffect(()=>{!Pe&&!jt&&W(!1)},[Pe,jt]),Z.useEffect(()=>{W(!1)},[Re,K.key]);let Mt=Pe&&s===`assistant`||!Pe&&!jt||i||u||f||g||y||o||ge||F||L||B||re||ae;bl(Ct,{onOpen:z(()=>{ft(ht)?.finish(`commit`)}),onPreviewStart:z(()=>{ft(ht)?.begin(`present`)}),onPreviewCancel:z(()=>{ft(ht)?.finish(`cancel`)}),onProgress:z(e=>{e!==null&&ft(ht)?.update(e)}),disabled:Mt},Pe||jt);let Nt=z(e=>{St.current=e});ud(z(()=>ae?(le(),!0):re?(W(!1),!0):B?(V(!1),!0):o?(window.dispatchEvent(new Event(`yuri:scheduled-tasks-close-request`)),!0):i?(a(!1),!0):Wt.backImmediately(`overlay`)?!0:f?(tt(),!0):u?(d(!1),!0):y?(xt(),!0):g?(bt(),!0):ge?(j(!1),!0):F?(I(!1),!0):L?(R(!1),!0):Wt.requestAnimatedBack(`root`)||St.current?.()?!0:s===`assistant`?(l(`chat`),!0):Dt?(Ot(),!0):!1));let Pt=be&&(xe===`desktop`||xe===`web`),It=z(()=>{if(K.enabled){ie.info(n(`remoteProjects.configurationReadOnly`));return}let e=`new-mcp-server`,t=e,r=1;for(;Te.some(e=>e.name===t);)t=`${e}-${r}`,r+=1;Ae({name:t,scope:`user`,type:`local`,command:[],url:``,environment:[],headers:[],oauthEnabled:!0,oauthClientId:``,oauthClientSecret:``,oauthScope:``,oauthRedirectUri:``,timeout:``,enabled:!0}),je(t),j(!1),qe(`mcp`)}),Lt=z(()=>{if(M)return;if(K.enabled&&!K.entry){ie.error(n(`remoteProjects.host-unavailable`));return}P(!0);let e=new Promise(e=>window.setTimeout(e,500));Promise.all([ke(),Ee(),e]).finally(()=>P(!1))}),Rt=Ne(e=>e.openNewSessionDraft),zt=Z.useMemo(()=>{let e=[{key:`new-session`,icon:`chat-new`,label:n(`mobile.menu.newSession`),onSelect:()=>{if(K.enabled){if(!K.entry){ie.error(n(`remoteProjects.host-unavailable`));return}K.openSession(null),Pe?l(`chat`):ye.getState().openRemoteProject();return}if(Pe){l(`chat`),Rt();return}ye.getState().openDraft()}}];return Pe||e.push({key:`files`,icon:`file-text`,label:n(`mobile.menu.files`),onSelect:()=>et()},{key:`changes`,icon:`git-branch`,label:n(`mobile.menu.changes`),badge:Me,onSelect:()=>it()}),K.enabled||e.push({key:`mcp`,iconNode:(0,$.jsx)(Ei,{className:`size-5 shrink-0 text-muted-foreground`}),label:n(`mobile.menu.mcp`),onSelect:()=>j(!0)}),Pt&&e.push({key:`update`,icon:`download`,label:n(`mobile.menu.update`),onSelect:()=>R(!0)}),Pe&&e.push({key:`settings`,icon:`settings-3`,label:n(`mobile.menu.settings`),onSelect:()=>qe()}),Re&&e.push({key:`refresh-transcript`,icon:`refresh`,label:n(`sessions.sidebar.session.menu.refreshTranscript`),disabled:ue,spinning:ue,onSelect:At}),e.push({key:`remote-desktop`,icon:`computer`,label:n(`remoteDesktop.title`),onSelect:ce}),e},[Re,Me,Pe,ue,it,et,Rt,ce,qe,At,K,l,Pt,n]);return(0,$.jsx)(pa,{remote:K.enabled,remoteState:K.owner?.state,sessionId:Re??``,directory:He||_e||void 0,active:Pe?s!==`assistant`:Ie===`chat`||K.enabled&&Ie===`draft`,children:(0,$.jsx)(_t,{actions:yt,children:(0,$.jsxs)(po,{children:[(0,$.jsxs)(`div`,{className:`yuri-mobile-app-shell main-content-safe-area flex h-[100dvh] flex-row text-foreground`,"data-page-scroll-lock":`true`,children:[Pe?(0,$.jsxs)(`aside`,{ref:gt.asideRef,className:J(`relative flex h-full shrink-0 flex-col overflow-hidden border-r border-border/50 bg-sidebar will-change-[width] motion-reduce:transition-none`,!We&&`border-r-0`),style:{width:We?gt.width:0,minWidth:We?gt.width:0,maxWidth:We?gt.width:0,"--yuri-ipad-sidebar-width":`${gt.width}px`,overflowX:`clip`,paddingTop:`var(--yuri-safe-area-top, 0px)`,transitionProperty:gt.isResizing?`none`:`width, min-width, max-width`,transitionDuration:`200ms`,transitionTimingFunction:`cubic-bezier(0.22, 1, 0.36, 1)`},"aria-hidden":!We,"data-page-scroll-lock":`true`,children:[We?(0,$.jsx)(od,{side:`left`,isResizing:gt.isResizing,ariaLabel:n(`sidebar.resize.leftPanelAria`),handleProps:gt.handleProps}):null,(0,$.jsx)(`div`,{className:J(`flex h-full shrink-0 flex-col transition-opacity duration-200 ease-[cubic-bezier(0.22,1,0.36,1)] motion-reduce:transition-none`,gt.isResizing&&`pointer-events-none`,!We&&`pointer-events-none select-none opacity-0`),style:{width:`var(--yuri-ipad-sidebar-width)`,overflowX:`hidden`},children:(0,$.jsx)(Ln,{children:(0,$.jsx)(xs,{open:!0,variant:`sidebar`,onOpenChange:e=>{!e&&Ue&&Ge(!1)}})})})]}):null,(0,$.jsx)(`div`,{className:`flex h-full min-w-0 flex-1 flex-col`,"data-page-scroll-lock":`true`,inert:ae||void 0,"aria-hidden":ae||void 0,children:Pe?(0,$.jsxs)($.Fragment,{children:[s===`assistant`?null:(0,$.jsx)(`div`,{children:(0,$.jsx)(wd,{onOpenSessions:()=>$e(),menuOpen:re,onToggleMenu:G,surfaceShortcuts:{activePanel:Ke===`turn-diff`?`changes`:Ke,changesDirty:Me>0,onToggleFiles:()=>ct(`files`),onToggleChanges:()=>ct(`changes`)}})}),(0,$.jsx)(`main`,{ref:Ct,className:`relative min-h-0 flex-1 overflow-hidden`,"data-page-scroll-lock":`true`,children:(0,$.jsx)(`div`,{className:`relative h-full w-full bg-background`,children:(0,$.jsx)(Ln,{children:(0,$.jsx)(Z.Suspense,{fallback:null,children:s===`assistant`?(0,$.jsx)(ku,{}):(0,$.jsx)(Ru,{})})})})})]}):(0,$.jsx)(dc,{className:`min-h-0 flex-1`,onAddProject:()=>V(!0),onScanQr:Se&&Ce?()=>{Qe()}:void 0,onSwitchInstance:Se?Xe:void 0,onRemoteDesktop:se,remoteDesktopActive:ae,instanceOptions:Se?e.connections.map(t=>({id:t.id,label:t.label,active:tn(t),disabled:e.isBusy})):void 0,onEnableAssistants:()=>{qe(`assistants`)},instancesPage:Se?(0,$.jsx)(gd,{connection:e,onConnect:()=>void 0,onActiveConnectionDeleted:t}):void 0,instancesSecondaryPage:Se?(0,$.jsxs)(`div`,{className:`yuri-settings-workspace yuri-settings-workspace-mobile flex h-full min-h-0 flex-col bg-[var(--surface-background)]`,children:[(0,$.jsx)(gn,{title:n(`mobile.settings.switchInstance`),backAriaLabel:n(`header.actions.backAria`),onBack:Ze}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-[var(--yuri-mobile-page-inline-inset)]`,children:(0,$.jsx)(Ki,{className:`yuri-mobile-settings-detail-card`,children:(0,$.jsx)(gd,{connection:e,onConnect:()=>void 0,onActiveConnectionDeleted:t})})})]}):void 0,parentSessionTarget:Dt?{id:Dt.id,directory:Dt.directory??null,...K.enabled?{onSelect:Ot}:{}}:null,registerSecondaryBackHandler:Nt,scheduledContent:(e,t)=>(0,$.jsx)(Iu,{presentation:`mobile-tab`,registerEditorBackHandler:e,onEditorActiveChange:t}),renderChat:e=>(0,$.jsx)(Lu,{sessionId:K.enabled?K.sessionId??``:e.sessionId,directory:K.enabled?K.entry?.location.directory:e.directory,title:K.enabled?K.session?.title:void 0,onBack:()=>{fe(),Wt.requestAnimatedBack(`root`)},onOpenMenu:G,onCloseMenu:fe,menuOpen:e.active&&re,children:(0,$.jsx)(`main`,{ref:e.active?Ct:void 0,className:`relative h-full min-h-0 flex-1 overflow-hidden`,"data-page-scroll-lock":`true`,children:(0,$.jsx)(`div`,{className:`relative h-full w-full bg-background`,children:(0,$.jsx)(Ln,{children:(0,$.jsx)(Ru,{readOnly:!e.active,active:e.active,selectionOverride:{sessionId:K.enabled?K.sessionId:e.sessionId||null,directory:K.enabled?K.entry?.location.directory??null:e.directory,viewKey:K.enabled?`${K.key}:${K.sessionId??`draft`}`:e.viewKey}})})})})})})}),Pe?(0,$.jsxs)(`aside`,{ref:vt.asideRef,className:J(`relative flex h-full shrink-0 flex-col overflow-hidden border-l border-border/50 bg-background will-change-[width] motion-reduce:transition-none`,!Ke&&`border-l-0`),style:{width:Ke?vt.width:0,minWidth:Ke?vt.width:0,maxWidth:Ke?vt.width:0,"--yuri-ipad-sidebar-width":`${vt.width}px`,overflowX:`clip`,paddingTop:`var(--yuri-safe-area-top, 0px)`,transitionProperty:vt.isResizing?`none`:`width, min-width, max-width`,transitionDuration:`200ms`,transitionTimingFunction:`cubic-bezier(0.22, 1, 0.36, 1)`},"aria-hidden":!Ke,"data-page-scroll-lock":`true`,children:[Ke?(0,$.jsx)(od,{side:`right`,isResizing:vt.isResizing,ariaLabel:n(`sidebar.resize.rightPanelAria`),handleProps:vt.handleProps}):null,(0,$.jsx)(`div`,{className:J(`flex h-full shrink-0 flex-col transition-opacity duration-200 ease-[cubic-bezier(0.22,1,0.36,1)] motion-reduce:transition-none`,vt.isResizing&&`pointer-events-none`,!Ke&&`pointer-events-none select-none opacity-0`),style:{width:`var(--yuri-ipad-sidebar-width)`,overflowX:`hidden`},children:ut?(0,$.jsx)(Ln,{children:pt===`files`?(0,$.jsx)(Bu,{onClose:st}):pt===`turn-diff`?(0,$.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col overflow-hidden bg-background text-foreground`,children:[(0,$.jsxs)(`header`,{className:`flex h-[var(--yuri-header-height,56px)] shrink-0 items-center gap-2 border-b border-border/40 px-3`,children:[(0,$.jsx)(`h2`,{className:`min-w-0 flex-1 truncate typography-ui-label font-semibold text-foreground`,children:n(`mobile.nav.changes`)}),(0,$.jsx)(q,{type:`button`,variant:`ghost`,size:`icon`,onClick:st,"aria-label":n(`mobile.surface.closeAria`),className:`shrink-0 text-muted-foreground`,style:{touchAction:`manipulation`},children:(0,$.jsx)(X,{name:`close`,className:`size-5`})})]}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:(0,$.jsx)(zu,{hideStackedFileSidebar:!0,pinSelectedFileHeaderToTopOnNavigate:!0,diffScope:`turn`,turnMessageId:x,sessionId:C,targetFilePath:T,navigationRequestKey:O,flushContent:!0})})]}):me?.toolPatches?.length?(0,$.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col overflow-hidden bg-background text-foreground`,children:[(0,$.jsxs)(`header`,{className:`flex h-[var(--yuri-header-height,56px)] shrink-0 items-center gap-2 border-b border-border/40 px-3`,children:[(0,$.jsx)(`h2`,{className:`min-w-0 flex-1 truncate typography-ui-label font-semibold text-foreground`,children:me.toolPatches.length>1?n(`mobile.nav.changes`):me.path}),(0,$.jsx)(q,{type:`button`,variant:`ghost`,size:`icon`,onClick:st,"aria-label":n(`mobile.surface.closeAria`),className:`shrink-0 text-muted-foreground`,style:{touchAction:`manipulation`},children:(0,$.jsx)(X,{name:`close`,className:`size-5`})})]}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:(0,$.jsx)(zu,{hideStackedFileSidebar:!0,diffScope:`turn`,targetFilePath:me.path,targetLine:me.targetLine??null,toolPatches:me.toolPatches,singleFileView:me.toolPatches.length===1,flushContent:!0})})]}):(0,$.jsx)(Vu,{onClose:st,initialDiffPath:me?.path??null,initialDiffStaged:me?.staged===!0,initialDiffTargetLine:me?.targetLine??null})}):null})]}):null,(0,$.jsx)(fr,{open:B,onOpenChange:V,forceMobile:!0}),(0,$.jsx)(xd,{open:re,onClose:()=>W(!1),items:zt,rightOffset:Pe&&Ke?vt.width:0}),(0,$.jsx)(pi,{}),ae&&(0,$.jsx)(Z.Suspense,{fallback:null,children:(0,$.jsx)(Fu,{onClose:le,instanceName:e.connections.find(tn)?.label})}),u?(0,$.jsx)(mt,{id:Ku,open:u,onOpenChange:e=>{e||d(!1)},ariaLabel:n(`mobile.menu.files`),closeAriaLabel:n(`mobile.surface.closeAria`),resizeAriaLabel:n(`mobile.sessions.sheet.resizeAria`),initiallyExpanded:!0,children:(0,$.jsx)(Ln,{children:(0,$.jsx)(Bu,{onClose:()=>d(!1)})})}):null,f&&m?(0,$.jsx)(mt,{id:Gu,open:f,onOpenChange:e=>{e||tt()},title:(0,$.jsx)(`h2`,{className:`truncate typography-ui-label font-semibold text-foreground`,children:m.path.split(/[/\\]/).filter(Boolean).at(-1)??m.path}),ariaLabel:n(`mobile.menu.files`),closeAriaLabel:n(`mobile.surface.closeAria`),resizeAriaLabel:n(`mobile.changes.sheet.resizeAria`),initiallyExpanded:!0,children:(0,$.jsx)(Ln,{children:(0,$.jsx)(Bu,{onClose:tt,initialFilePath:m.path,directFilePreview:!0,hideFileHeader:!0},m.path)})}):null,(0,$.jsx)(mt,{id:Wu,open:y,onOpenChange:e=>{e||xt()},title:(0,$.jsx)(`h2`,{className:`truncate typography-ui-label font-semibold text-foreground`,children:n(`mobile.nav.changes`)}),ariaLabel:n(`mobile.nav.changes`),closeAriaLabel:n(`mobile.surface.closeAria`),resizeAriaLabel:n(`mobile.changes.sheet.resizeAria`),initiallyExpanded:!0,children:(0,$.jsx)(Ln,{children:(0,$.jsx)(zu,{hideStackedFileSidebar:!0,pinSelectedFileHeaderToTopOnNavigate:!0,toolbarInSheetHeader:!0,diffScope:`turn`,turnMessageId:x,sessionId:C,targetFilePath:T,navigationRequestKey:O,flushContent:!0})})}),g&&me?(0,$.jsx)(mt,{id:Uu,open:g,onOpenChange:e=>{e||bt()},title:(0,$.jsx)(`h2`,{className:`truncate typography-ui-label font-semibold text-foreground`,children:me.toolPatches&&me.toolPatches.length>1?n(`mobile.nav.changes`):me.path}),ariaLabel:n(`mobile.menu.changes`),closeAriaLabel:n(`mobile.surface.closeAria`),resizeAriaLabel:n(`mobile.changes.sheet.resizeAria`),initiallyExpanded:!0,children:(0,$.jsx)(Ln,{children:me.toolPatches?.length?(0,$.jsx)(zu,{hideStackedFileSidebar:!0,toolbarInSheetHeader:!0,diffScope:`turn`,targetFilePath:me.path,targetLine:me.targetLine??null,toolPatches:me.toolPatches,singleFileView:me.toolPatches.length===1,flushContent:!0}):(0,$.jsx)(Vu,{initialDiffPath:me.path,initialDiffStaged:me.staged,initialDiffTargetLine:me.targetLine??null,hideDiffHeader:!0})})}):g?(0,$.jsx)(mt,{id:qu,open:g,onOpenChange:e=>{e||bt()},ariaLabel:n(`mobile.menu.changes`),closeAriaLabel:n(`mobile.surface.closeAria`),resizeAriaLabel:n(`mobile.changes.sheet.resizeAria`),initiallyExpanded:!0,children:(0,$.jsx)(Ln,{children:(0,$.jsx)(Vu,{onClose:bt,initialDiffPath:me?.path??null,initialDiffStaged:me?.staged===!0,initialDiffTargetLine:me?.targetLine??null})})}):null,ge?(0,$.jsx)(mt,{id:Ju,open:ge,onOpenChange:e=>{e||j(!1)},title:(0,$.jsx)(`h2`,{className:`truncate typography-ui-label font-semibold text-foreground`,children:n(`mcpDropdown.title`)}),trailing:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(q,{type:`button`,variant:`ghost`,size:`icon`,onClick:It,"aria-label":n(`settings.mcp.sidebar.actions.addServerTitle`),title:n(`settings.mcp.sidebar.actions.addServerTitle`),style:{touchAction:`manipulation`},children:(0,$.jsx)(X,{name:`add`,className:`size-5`})}),(0,$.jsx)(q,{type:`button`,variant:`ghost`,size:`icon`,onClick:Lt,disabled:M,"aria-label":n(`mcpDropdown.actions.refreshAria`),title:n(`mcpDropdown.actions.refreshAria`),style:{touchAction:`manipulation`},children:(0,$.jsx)(X,{name:`refresh`,className:J(`size-5`,M&&`animate-spin`)})})]}),ariaLabel:n(`mcpDropdown.title`),closeAriaLabel:n(`mobile.surface.closeAria`),resizeAriaLabel:n(`mobile.sessions.sheet.resizeAria`),initiallyExpanded:!0,children:(0,$.jsx)(Ln,{children:(0,$.jsx)(wr,{active:!0,className:`h-full`,listClassName:`max-h-none`,hideHeader:!0,mobileListDensity:!0})})}):null,F&&Pe?(0,$.jsx)(mt,{id:Yu,open:F,onOpenChange:e=>{e||I(!1)},ariaLabel:n(`mobile.menu.settings`),closeAriaLabel:n(`mobile.surface.closeAria`),resizeAriaLabel:n(`mobile.sessions.sheet.resizeAria`),initiallyExpanded:!0,children:(0,$.jsx)(Ln,{children:(0,$.jsx)(Z.Suspense,{fallback:null,children:(0,$.jsx)(ju,{forceMobile:!0,isWindowed:!0,initialMobileStage:te,visiblePageSlugs:[...ur],onClose:()=>I(!1),mobileInstancesPage:Se?(0,$.jsx)(gd,{connection:e,onConnect:()=>I(!1),onActiveConnectionDeleted:t}):void 0})})})}):null,L?(0,$.jsx)(mt,{id:Xu,open:L,onOpenChange:e=>{e||R(!1)},title:(0,$.jsx)(`h2`,{className:`truncate typography-ui-label font-semibold text-foreground`,children:n(`mobile.menu.update`)}),ariaLabel:n(`mobile.menu.update`),closeAriaLabel:n(`mobile.surface.closeAria`),resizeAriaLabel:n(`mobile.sessions.sheet.resizeAria`),initiallyExpanded:!0,children:(0,$.jsx)(Ln,{children:(0,$.jsx)(`div`,{className:`h-full overflow-auto px-5 py-4`,children:(0,$.jsx)(Mi,{initialUpdateDialogOpen:!0})})})}):null]}),(0,$.jsx)(ko,{enabled:Se&&s===`assistant`&&c.data?.supported===!0&&c.data?.enabled===!0}),(0,$.jsx)(Ln,{children:(0,$.jsx)(Rr,{})}),(0,$.jsx)(Dr,{})]})})})};function Ed({apis:e}){Z.useEffect(()=>Ue(),[]);let{t}=ot(),n=Te(e=>e.initializeApp),r=Te(e=>e.isInitialized),i=Te(e=>e.isConnected),a=Te(e=>e.connectionPhase),o=D(e=>e.currentDirectory),c=Ne(e=>e.currentSessionId),l=Ne(e=>!!e.newSessionDraft?.open),d=Ne(e=>e.error),f=Ne(e=>e.clearError),m=U(e=>e.setIsMobile),h=Ti(e=>e.refreshStatus),[g,_]=Z.useState(0),[v,y]=Z.useState(0),[x,S]=Z.useState(!1),[C,w]=Z.useState(`pending`),T=Z.useMemo(()=>nn(),[]),[,E]=Z.useReducer(e=>e+1,0),O=Z.useMemo(()=>sd(),[]),k=Z.useRef(0),j=Z.useRef(0),M=ln(()=>{w(`done`),_(e=>e+1)});$c(z(e=>{M.redeemPairingConnection(e)}));let N=el({ready:O&&i&&r});Z.useEffect(()=>{!M.error||!p()||ie.error(M.error)},[M.error]);let P=z(()=>{let t=p(),r=j.current+1;if(j.current=r,!t){cn();return}let i=()=>{n(),h(e.github,{force:!0}),Te.getState().refreshMissingCatalogs({source:`mobileApp:nativeResume`})},a=()=>{u({apiBaseUrl:``,clientToken:null,runtimeKey:`mobile-disconnected`}),_(e=>e+1)};rn().then(e=>{if(j.current===r){if(e===`no-connection`){a();return}if(e===`unreachable`){window.setTimeout(()=>{j.current===r&&rn().then(e=>{if(j.current===r&&e!==`switched`&&e===`unchanged`){i();return}})},4e3);return}e!==`switched`&&i()}});let o=Date.now();o-k.current>=pd&&(k.current=o,window.dispatchEvent(new Event(`yuri:system-resume`)))});cd(),ld(P),Z.useEffect(()=>{if(!O)return;let e,t=()=>{window.clearTimeout(e),e=window.setTimeout(()=>P(),1500)};return window.addEventListener(`online`,t),()=>{window.removeEventListener(`online`,t),window.clearTimeout(e)}},[O,P]),Z.useEffect(()=>(b(e),()=>b(null)),[e]),Z.useEffect(()=>{O&&W().then(e=>{e&&e.notifyAppReady().catch(()=>void 0)})},[O]),Z.useEffect(()=>{if(!O)return;let e=!1,t=[];return W().then(async n=>{if(!(!n||e))try{let r=await n.addListener(`download`,e=>{Ci.getState().setOtaDownloadPercent(e.percent)}),i=await n.addListener(`downloadFailed`,()=>{Ci.getState().setOtaDownloadFailed()}),a=await n.addListener(`downloadComplete`,()=>{Ci.getState().setOtaPhase(`pending_restart`)}),o=await n.addListener(`appReloaded`,()=>{Ci.getState().setOtaPhase(`pending_restart`)}),s=await n.addListener(`autoRevert`,()=>{console.warn(`[OTA] Capgo auto-reverted the last bundle`),Ci.getState().setOtaPhase(`error`,`OTA update was reverted`)});if(e){r.remove(),i.remove(),a.remove(),o.remove(),s.remove();return}t.push(()=>void r.remove(),()=>void i.remove(),()=>void a.remove(),()=>void o.remove(),()=>void s.remove())}catch(e){console.warn(`[OTA] Failed to subscribe to Capgo updater events:`,e)}}),()=>{e=!0;for(let e of t)e()}},[O]),Z.useEffect(()=>s(e=>{if(e.runtimeKey&&e.runtimeKey===e.previousRuntimeKey){fi(),E();return}ni(e),ye.getState().reset(),y(e=>e+1),_(e=>e+1)}),[]),Z.useEffect(()=>{if(N===`pending`)return;if(N===`connect`){w(`done`);return}if(!O||i||p()){w(`done`);return}let e=!1;return w(`attempting`),mn().then(e=>e?!0:cn()).catch(()=>!1).then(()=>{e||w(`done`)}),()=>{e=!0}},[N]),Z.useEffect(()=>{m(!0)},[m]),Z.useEffect(()=>{O&&!p()||n()},[g,n,O]),En({enabled:!O||!!p(),source:`mobileApp:recovery`}),Z.useEffect(()=>{i&&A.setDirectory(o)},[o,i]),Z.useEffect(()=>{i&&h(e.github,{force:!0})},[e.github,i,h]),Z.useEffect(()=>{if(!d)return;let e=window.setTimeout(()=>f(),5e3);return()=>window.clearTimeout(e)},[f,d]),Z.useEffect(()=>{if(!(!i&&(!O||p()))){S(!1);return}let e=window.setTimeout(()=>S(!0),8e3);return()=>window.clearTimeout(e)},[i,O,g,v]),jn(),Tn({enabled:!0}),Nn(),li(),Dl({enabled:O&&i}),Tu();let F=Nc(),I=!i&&a===`reconnecting`;if(!F)return(0,$.jsx)(`main`,{className:`flex min-h-dvh items-center justify-center bg-background text-foreground`,children:(0,$.jsx)(In,{width:120,height:120,isAnimated:!0})});let L=!!p();return O&&(!L||!i&&!I)?L?(0,$.jsx)(`main`,{className:`flex min-h-dvh items-center justify-center bg-background px-6 text-center text-foreground`,children:(0,$.jsxs)(`div`,{className:`flex max-w-sm flex-col items-center gap-4`,children:[(0,$.jsx)(In,{width:120,height:120,isAnimated:!x}),x?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsx)(`h1`,{className:`typography-h3 text-foreground`,children:t(`sessionAuth.error.networkTitle`)}),(0,$.jsx)(`p`,{className:`typography-body text-muted-foreground`,children:t(`sessionAuth.error.networkDescription`)})]}),(0,$.jsx)(q,{type:`button`,variant:`outline`,onClick:()=>{u({apiBaseUrl:``,clientToken:null,runtimeKey:`mobile-disconnected`}),_(e=>e+1)},children:t(`mobile.connect.cancelPassword`)})]}):null]})}):C===`done`?(0,$.jsx)(fo,{connection:M}):(0,$.jsxs)(`main`,{className:`relative flex min-h-dvh items-center justify-center bg-background text-foreground`,children:[(0,$.jsx)(In,{width:120,height:120,isAnimated:!0}),T?(0,$.jsxs)(`div`,{className:`absolute inset-x-0 top-[calc(50%+84px)] flex flex-col items-center gap-0.5 px-6 text-center`,children:[(0,$.jsx)(`p`,{className:`typography-small text-muted-foreground`,children:t(`mobile.connect.splash.connectingTo`)}),(0,$.jsxs)(`p`,{className:`typography-small text-foreground`,children:[T,(0,$.jsx)(Un,{})]})]}):null]}):!i&&!I?x?(0,$.jsx)(`main`,{className:`flex min-h-dvh items-center justify-center bg-background px-6 text-center text-foreground`,children:(0,$.jsxs)(`div`,{className:`max-w-sm space-y-3`,children:[(0,$.jsx)(`h1`,{className:`typography-h3 text-foreground`,children:t(`sessionAuth.error.networkTitle`)}),(0,$.jsx)(`p`,{className:`typography-body text-muted-foreground`,children:t(`sessionAuth.error.networkDescription`)})]})}):(0,$.jsx)(`main`,{className:`flex min-h-dvh items-center justify-center bg-background text-foreground`,children:(0,$.jsx)(In,{width:120,height:120,isAnimated:!0})}):(0,$.jsx)(Ln,{children:(0,$.jsx)(Re,{sdk:A.getSdkClient(),directory:o||``,bootstrapDirectory:!(l&&c===null),children:(0,$.jsxs)(Mn,{apis:e,children:[(0,$.jsx)(Er,{}),(0,$.jsx)(Xr,{ready:r,children:(0,$.jsx)(wt,{delayDuration:300,skipDelayDuration:150,children:(0,$.jsxs)(`div`,{className:`h-full bg-background text-foreground`,children:[(0,$.jsx)(ri,{}),(0,$.jsx)(hn,{}),(0,$.jsx)(Hu,{}),(0,$.jsx)(Dn,{embeddedBackgroundWorkEnabled:r}),(0,$.jsx)(xr,{}),(0,$.jsx)(Sa,{}),(0,$.jsx)(Ma,{}),(0,$.jsx)(Td,{connection:M,onActiveConnectionDeleted:()=>{u({apiBaseUrl:``,clientToken:null,runtimeKey:`mobile-disconnected`}),ye.getState().reset(),_(e=>e+1)}}),(0,$.jsx)(vn,{position:`top-center`,offset:`calc(var(--yuri-safe-area-top, 0px) + 16px)`}),r?(0,$.jsx)(Tr,{}):null,r?(0,$.jsx)(xi,{}):null,r?(0,$.jsx)(Ar,{autoStart:!1}):null]})})})]})},v)})}function Dd(e){return e.window}function Od(e){e.currentTarget.style.transform=`none`}function kd(e){return e.ensureStatus}function Ad(e){return e.fetchStatus}function jd(e){return e.providers}function Md(e){return e.currentProviderId}function Nd(e){return e.currentModelId}function Pd(e){return e.getModelMetadata}function Fd(e){return e.results}function Id(e){return e.loadSettings}function Ld(e){return e.isLoading}function Rd(e){return e.displayMode}function zd(e){return e.dropdownProviderIds}function Bd(e){return e.selectedModels}function Vd(e){return e.timeFormatPreference}function Hd(e){return[e?.providerId,e]}function Ud(e){return e.providerId}function Wd(e){return!e}var Gd=()=>{ct(),wn({runtimeKey:f(),initializeAppearance:async()=>{try{await T()}finally{$i()}},syncSettings:E,applyDirectory:Pn,startWatchers:()=>{kn(),Cn(),yn()},onError:(e,t)=>{console.error(e===`appearance`?`[mobile-main] appearance init failed:`:`[mobile-main] settings init failed:`,t)}})};function Kd(e){Gd(),U.getState().setIsMobile(!0),sa(),Dt(),Et();let t=document.getElementById(`root`);if(!t)throw Error(`Root element not found`);let n=window.Capacitor?.isNativePlatform?.()===!0||window.location.protocol===`capacitor:`;n&&document.documentElement.classList.add(`yuri-native-app-active`);let r=n?{...e,notifications:{notifyAgentCompletion:async()=>!1,canNotify:()=>!1}}:e,i=(0,$.jsx)(Ed,{apis:r});(0,Yi.createRoot)(t).render((0,$.jsx)(Z.StrictMode,{children:(0,$.jsx)(bn,{children:(0,$.jsx)(at,{children:(0,$.jsx)(_n,{children:(0,$.jsx)(On,{children:(0,$.jsx)(Mt,{children:(0,$.jsx)(xn,{children:n?i:(0,$.jsx)(Sn,{children:i})})})})})})})}))}export{Kd as renderMobileApp};