@yuriai/web 0.3.3-beta.6 → 0.3.3

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 (300) hide show
  1. package/dist/assets/AgentAvatar-CHCjMxCF.js +1 -0
  2. package/dist/assets/AgentSelector-DpOQ7dyw.js +1 -0
  3. package/dist/assets/ArchivedSessionsDialog-nqnWb-Vc.js +1 -0
  4. package/dist/assets/AssistantConversationSurface-CKXgty02.js +3 -0
  5. package/dist/assets/AssistantSessionCard-C2-2fJul.js +2 -0
  6. package/dist/assets/AssistantUnreadBadge-p9mkpbMC.js +1 -0
  7. package/dist/assets/AssistantView-BR8hsjOv.js +1 -0
  8. package/dist/assets/AssistantWorkingAvatar-CoxhuMvM.js +1 -0
  9. package/dist/assets/AssistantsSettingsPage-Bwid1xE0.js +1 -0
  10. package/dist/assets/BinaryFileFallback-CKNAgvHj.css +1 -0
  11. package/dist/assets/BinaryFileFallback-Cb3uP7y1.js +1 -0
  12. package/dist/assets/BtwPanel-9VAdk_qa.js +6 -0
  13. package/dist/assets/BusyDots-DeDkh4Ke.js +4 -0
  14. package/dist/assets/ChatContainer-wP6o_O4K.js +65 -0
  15. package/dist/assets/ChatView-DU_2-cfD.js +3 -0
  16. package/dist/assets/{DiagramView-Bx4MHn6w.js → DiagramView-CaefmjA4.js} +1 -1
  17. package/dist/assets/DiffView-BaqthIvq.js +6 -0
  18. package/dist/assets/DiffViewToggle-BwJ6MYB7.js +1 -0
  19. package/dist/assets/DiffWorkerProvider-VFPkag9y.js +1 -0
  20. package/dist/assets/ErrorBoundary-_5B1xjgZ.js +1 -0
  21. package/dist/assets/FadeInOnReveal-BYHr1gqj.js +1 -0
  22. package/dist/assets/GuiPluginMount-Btp3mJT2.js +1 -0
  23. package/dist/assets/GuiPluginPage-DM_RLx6u.js +1 -0
  24. package/dist/assets/GuiPluginSurface-KiyqqEKU.js +1 -0
  25. package/dist/assets/GuiPluginTitlebarItems-DxFINwbr.js +1 -0
  26. package/dist/assets/GuiPluginWindow-BkAFJyFd.js +1 -0
  27. package/dist/assets/Icon-DmykXZL1.js +1 -0
  28. package/dist/assets/ImageLoadingPlaceholder-DgM_EFHn.js +1 -0
  29. package/dist/assets/{LoadingImage-C4cAJD72.js → LoadingImage-Df22Rkor.js} +1 -1
  30. package/dist/assets/MarkdownRenderer-D7p9Iflj.js +2 -0
  31. package/dist/assets/MarkdownRendererImpl-BZc_jUrV.js +10 -0
  32. package/dist/assets/MarkstreamRendererImpl-BUk_c3g1.js +3 -0
  33. package/dist/assets/MobileAssistantSettingsPage-BBIiFN2g.js +1 -0
  34. package/dist/assets/MobileAssistantTab-CMIQansR.js +1 -0
  35. package/dist/assets/MobileBtwPage-DVZm5hrZ.js +1 -0
  36. package/dist/assets/MobileChangesSurface-CiqsGZsg.js +4 -0
  37. package/dist/assets/MobileChatScreen-DDenVTX8.js +1 -0
  38. package/dist/assets/MobileDetailNavigation-ldTzGo19.js +1 -0
  39. package/dist/assets/MobileFilesSurface-DIVH9aPV.js +2 -0
  40. package/dist/assets/MobileHtmlNetworkBoundary-TBxrF4jJ.js +2 -0
  41. package/dist/assets/MobileOverlayPanel-C36VWWmN.js +1 -0
  42. package/dist/assets/MobileResizableSheet-CqphcaKq.js +1 -0
  43. package/dist/assets/MobileSettingsTab-MmDnxG47.js +1 -0
  44. package/dist/assets/MobileShareBridge-DAlGSXoj.js +3 -0
  45. package/dist/assets/MobileSurface-cmaGf3hZ.js +1 -0
  46. package/dist/assets/MobileTabPageHeader-D6P4K98S.js +1 -0
  47. package/dist/assets/ModelLogo-BkbD514M.js +1 -0
  48. package/dist/assets/ModelSelector-HJmXcB3j.js +1 -0
  49. package/dist/assets/MultiRunWindow-BmxVnblA.js +1 -0
  50. package/dist/assets/OnboardingScreen-DnEtIaxG.js +1 -0
  51. package/dist/assets/OverlayScrollbar-D6vmoMkQ.js +1 -0
  52. package/dist/assets/PierreDiffViewer-B1e1H6br.js +139 -0
  53. package/dist/assets/ProviderLogo-DA98yu7M.js +1 -0
  54. package/dist/assets/RemoteAssistantSessionCard-BgL7oxAK.js +1 -0
  55. package/dist/assets/RemoteDesktopPanel-DBrEQwpr.js +1 -0
  56. package/dist/assets/ScheduledTasksDialog-BVh0yaZR.js +3 -0
  57. package/dist/assets/ScrollableOverlay-stxT7gLf.js +1 -0
  58. package/dist/assets/SessionSurfaceContext-BP4NCKp6.js +10 -0
  59. package/dist/assets/SettingsGroup-CvaPYznp.js +1 -0
  60. package/dist/assets/SettingsView-CLE6ra3s.js +29 -0
  61. package/dist/assets/SettingsWindow-DpzeOekS.js +1 -0
  62. package/dist/assets/SetupTourDialog-CY_CU5qU.js +1 -0
  63. package/dist/assets/SyncActions-CrOoREWF.js +1 -0
  64. package/dist/assets/TerminalView-mO5f0Axl.js +8 -0
  65. package/dist/assets/TextSelectionMenu-VsKriqtT.js +11 -0
  66. package/dist/assets/ToolOutputDialog-DqCCsC-N.js +16 -0
  67. package/dist/assets/{YuriLogo-BJ6Ao0du.js → YuriLogo-Cp6vWDWp.js} +1 -1
  68. package/dist/assets/{YuriWordmark-D2e-o9nW.js → YuriWordmark-CLGHwobA.js} +1 -1
  69. package/dist/assets/appThemeRegistry-BdjrGBQ4.js +1 -0
  70. package/dist/assets/{assistant-attachment-cache-BYvIyn1x.js → assistant-attachment-cache-bRIIESGe.js} +1 -1
  71. package/dist/assets/assistantMessagePreview-DLBvPQtq.js +1 -0
  72. package/dist/assets/assistantPresentation-DRbsH1Ej.js +1 -0
  73. package/dist/assets/assistantQueries-NdPqu6rx.js +1 -0
  74. package/dist/assets/audio-session-BFWjrDbp.js +1 -0
  75. package/dist/assets/auto-read-context-DVGIDEr6.js +5 -0
  76. package/dist/assets/{speechSettingsQueries-BiYS8kXM.js → browserVoiceService-x5Pci8L3.js} +3 -3
  77. package/dist/assets/{capgoAdapter-BR9RFIfy.js → capgoAdapter-94K243Zv.js} +1 -1
  78. package/dist/assets/card-DmysoUAV.js +1 -0
  79. package/dist/assets/chatUpwardIntent-tvLWGs9Q.js +1 -0
  80. package/dist/assets/checkbox-BMN5hAVm.js +1 -0
  81. package/dist/assets/{client-CzjApAA4.js → client-B_907PBv.js} +1 -1
  82. package/dist/assets/collapsible-Z0IjDAMO.js +1 -0
  83. package/dist/assets/connection-hint-B-kOWome.js +2 -0
  84. package/dist/assets/context-menu-CKlB6wxo.js +1 -0
  85. package/dist/assets/contextPanelEmbeddedChat-Dm5R_b5X.js +1 -0
  86. package/dist/assets/{device-BlmHHWT1.js → device-EIfSfSWk.js} +1 -1
  87. package/dist/assets/diagram-CzY6n_4N.js +1 -0
  88. package/dist/assets/dialog-BeFBA6ja.js +1 -0
  89. package/dist/assets/dropdown-menu-BblI9sN2.js +1 -0
  90. package/dist/assets/{es-DeIqmCOk.js → es-DqYZgeC6.js} +1 -1
  91. package/dist/assets/fileMentionAutocompleteState-B9411b4o.js +2 -0
  92. package/dist/assets/{fileMentionTouchSelection-CFrWx6JK.js → fileMentionTouchSelection-BQEUty_A.js} +2 -2
  93. package/dist/assets/{fileReferenceActions-I56JyL1L.js → fileReferenceActions-TmbrIHBI.js} +1 -1
  94. package/dist/assets/{fr-6zgvS9k_.js → fr-BHaun7Zq.js} +1 -1
  95. package/dist/assets/{gitApi-Cxw-b-S_.js → gitApi-BWsBS_2N.js} +1 -1
  96. package/dist/assets/gitApiHttp-Dd-FwgCq.js +3 -0
  97. package/dist/assets/githubAuthQueries-DqregESf.js +1 -0
  98. package/dist/assets/historyImportQueries-D00KjUT2.js +1 -0
  99. package/dist/assets/{host-BBp7NPZz.js → host-ChBHl_Vl.js} +1 -1
  100. package/dist/assets/{i18n-Bfzj0WR9.js → i18n-DXc6czdR.js} +1 -1
  101. package/dist/assets/icons-Bd-INsoy.js +1 -0
  102. package/dist/assets/{image-loading-Dlh4FIPJ.js → imageSource-BR4C9TuS.js} +1 -1
  103. package/dist/assets/inlineMessageLinks-DC78iKO5.js +1 -0
  104. package/dist/assets/input-Cf16qJ6g.js +1 -0
  105. package/dist/assets/{input-store-wWToFdzi.js → input-store-BSJBQTMi.js} +1 -1
  106. package/dist/assets/insertionBoundaries-BSDUOMHN.js +1 -0
  107. package/dist/assets/{ja-DQM9NnCu.js → ja-BGNugvrx.js} +1 -1
  108. package/dist/assets/kbd-CamdaxHJ.js +1 -0
  109. package/dist/assets/{ko-BSB5UaTU.js → ko-CGbNBfDe.js} +1 -1
  110. package/dist/assets/main-CHO9s_kb.js +2 -0
  111. package/dist/assets/main-DAbyAg5_.js +169 -0
  112. package/dist/assets/{markdownHeightCache-BPOYloX8.js → markdownHeightCache-CHGGNhWI.js} +1 -1
  113. package/dist/assets/{markdownTheme-C2LJ3cJo.js → markdownTheme-D84XyNiT.js} +1 -1
  114. package/dist/assets/mcpQueries-1WNtiFYh.js +1 -0
  115. package/dist/assets/miniChat-BZMkNMht.js +2 -0
  116. package/dist/assets/mobile-C9XDDOHq.js +2 -0
  117. package/dist/assets/mobileAppContext-BQgdTp5T.js +1 -0
  118. package/dist/assets/mobileBackNavigation-DF_uhF-i.js +1 -0
  119. package/dist/assets/mobileConnections-DjT1L-_m.js +2 -0
  120. package/dist/assets/multirun-D34EMeEj.js +3 -0
  121. package/dist/assets/{native-config-DsW9-ijz.js → native-config-DSpTDz3F.js} +1 -1
  122. package/dist/assets/nativeComposerCover-DXFy97OQ.js +1 -0
  123. package/dist/assets/navigation-jU0HUH9s.js +2 -0
  124. package/dist/assets/openRemoteProjectSession-Bm_nafYw.js +1 -0
  125. package/dist/assets/permission-rules-DoQUXKll.js +1 -0
  126. package/dist/assets/{pl-CLtzYvN2.js → pl-k8-4URiE.js} +1 -1
  127. package/dist/assets/pluginPresentation-DexqrdQ0.js +2 -0
  128. package/dist/assets/{project-preview-BjTq299L.js → project-preview-BCtFY4Rg.js} +1 -1
  129. package/dist/assets/projectMeta-vIaGFaQr.js +1 -0
  130. package/dist/assets/{prompt-attachment-upload-Bem87nmm.js → prompt-attachment-upload-B5DHrw6U.js} +1 -1
  131. package/dist/assets/{pt-BR-DHHBbOs_.js → pt-BR-DdwCzXBH.js} +1 -1
  132. package/dist/assets/pwa-BaWpUiOR.js +2 -0
  133. package/dist/assets/queue-abort-optimistic-UwpgXn4g.js +1 -0
  134. package/dist/assets/quota-CqWNkFzw.js +1 -0
  135. package/dist/assets/react-CPBNl-S9.js +1 -0
  136. package/dist/assets/reference-history-DBxnA_fF.js +1 -0
  137. package/dist/assets/{remote-input-store-BvlOGMu_.js → remote-input-store-C6UIEZxp.js} +1 -1
  138. package/dist/assets/remoteProjectQueries-C8382jM8.js +1 -0
  139. package/dist/assets/remoteSessionReference-Cug8RfIG.js +1 -0
  140. package/dist/assets/renderElectronMiniChatApp-CqrlQAsJ.js +2 -0
  141. package/dist/assets/renderMobileApp-CwcwGOox.js +17 -0
  142. package/dist/assets/router-DXUi1sBd.js +1 -0
  143. package/dist/assets/{runtime-file-download-DxL4XbME.js → runtime-file-download-BWeoSXRb.js} +1 -1
  144. package/dist/assets/runtime-file-resource-Bc_ss-sW.js +2 -0
  145. package/dist/assets/{runtimeConfig-BL7RTChM.js → runtimeConfig-zzeYHX6k.js} +1 -1
  146. package/dist/assets/runtimeEndpointReset-DUD-TCLY.js +4 -0
  147. package/dist/assets/{runtimeEndpointReset-BIrMtGn5.css → runtimeEndpointReset-DuvtZAyx.css} +1 -1
  148. package/dist/assets/scheduledTaskNavigation-VVTOq9n2.js +1 -0
  149. package/dist/assets/select-assistant-mmsKjj2O.js +1 -0
  150. package/dist/assets/select-vZCgcnYG.js +1 -0
  151. package/dist/assets/session-startup-barrier-DT-hIBRf.js +1 -0
  152. package/dist/assets/sessionLookup-4zOaVAuF.js +1 -0
  153. package/dist/assets/sessionOwnership-CEkPFbS4.js +2 -0
  154. package/dist/assets/shortcuts-WkN3Gh8v.js +1 -0
  155. package/dist/assets/sortAssistantContacts-CcEdm3mS.js +1 -0
  156. package/dist/assets/sortable-tabs-strip-DmtfYPz0.js +1 -0
  157. package/dist/assets/spacedFileMention-Ds4GtgiF.js +1 -0
  158. package/dist/assets/speechSettingsQueries-DQnPLEf3.js +1 -0
  159. package/dist/assets/src-QTj33Z0x.css +2 -0
  160. package/dist/assets/{store-DHAsbqgT.js → store-C1ifDY0C.js} +4 -4
  161. package/dist/assets/switch-CNmsFYfY.js +1 -0
  162. package/dist/assets/{terminalApi-G5w9aIzr.js → terminalApi-DXvEquBF.js} +1 -1
  163. package/dist/assets/textarea-ZiXxEOHK.js +1 -0
  164. package/dist/assets/timeFormat-dCsf2MQv.js +1 -0
  165. package/dist/assets/tooltip-CpTbxEOE.js +1 -0
  166. package/dist/assets/touch-gestures-DOoBxhz5.js +1 -0
  167. package/dist/assets/truncated-path-CcmWjgCQ.js +1 -0
  168. package/dist/assets/types-s_oc_LRs.js +2 -0
  169. package/dist/assets/ui-DrAJTWV6.js +13 -0
  170. package/dist/assets/{uk-CyIloyBp.js → uk-DU-7fAP4.js} +1 -1
  171. package/dist/assets/useAppFontEffects-nvkTSYHB.js +7 -0
  172. package/dist/assets/{useAssistantUIStore-MY4QWnVQ.js → useAssistantUIStore-CpJZ4Rqs.js} +1 -1
  173. package/dist/assets/useDebouncedValue-BHlMPqY8.js +1 -0
  174. package/dist/assets/useDesktopWindowControlsLayout-i6qqpMbd.js +1 -0
  175. package/dist/assets/useDictation-CZzAlsW0.js +1 -0
  176. package/dist/assets/useEffectiveDirectory-BxolHzt4.js +1 -0
  177. package/dist/assets/{useFontPreferences-BqPDrGZM.js → useFontPreferences-BiRBKhti.js} +1 -1
  178. package/dist/assets/useGitStore-B641o_o0.js +1 -0
  179. package/dist/assets/useInlineCommentDraftStore-B2mkmAZd.js +6510 -0
  180. package/dist/assets/useMcpConfigStore-BUSvv0Bl.js +1 -0
  181. package/dist/assets/{useMobileHtmlPreviewStore-DzzgY1eS.js → useMobileHtmlPreviewStore-BYunNOBo.js} +1 -1
  182. package/dist/assets/useMobileSwipeActions-XoxrtaUo.js +1 -0
  183. package/dist/assets/useMobileTranscriptSyncHint-86i3xO8J.js +10 -0
  184. package/dist/assets/useModelLists-Ca085-di.js +1 -0
  185. package/dist/assets/useOpenCodeReadiness-CsNcdsCJ.js +1 -0
  186. package/dist/assets/usePluginsStore-ZHQOW-R5.js +1 -0
  187. package/dist/assets/useProjectGitActions-1QRsD7Rb.js +1 -0
  188. package/dist/assets/useProjectGitStore-C1K6WpCe.js +1 -0
  189. package/dist/assets/useProjectRuntimeAPIs-BItoD9Bt.js +1 -0
  190. package/dist/assets/useQuotaStore-CSn2pk3T.js +1 -0
  191. package/dist/assets/useSessionBtwStore-BCHq3UOB.js +11 -0
  192. package/dist/assets/{useStreamingTextThrottle-DrOvDNCU.js → useStreamingTextThrottle-DGAjmaMZ.js} +1 -1
  193. package/dist/assets/{useThemeSystem-D2YBbLma.js → useThemeSystem-BIXghnHj.js} +1 -1
  194. package/dist/assets/{useUIStore-mVT8ipsT.js → useUIStore-C3ewjGgP.js} +1 -1
  195. package/dist/assets/{vendor-base-ui-fom6orB6.js → vendor-base-ui-wXsskyKm.js} +1 -1
  196. package/dist/assets/{vendor-cmdk-BKc6RGpL.js → vendor-cmdk-BDWoZLve.js} +1 -1
  197. package/dist/assets/{vendor-dnd-kit-accessibility-Cf9EEJvm.js → vendor-dnd-kit-accessibility-u0XSXxKq.js} +1 -1
  198. package/dist/assets/{vendor-dnd-kit-core-DRyd7I0I.js → vendor-dnd-kit-core-qy5stxu5.js} +1 -1
  199. package/dist/assets/{vendor-dnd-kit-sortable-C8S8cyRO.js → vendor-dnd-kit-sortable-CiTIuX4o.js} +1 -1
  200. package/dist/assets/{vendor-framer-motion-DiGWHm7K.js → vendor-framer-motion-D5NyyC73.js} +1 -1
  201. package/dist/assets/{vendor-markstream-react-Cwc-VXWM.js → vendor-markstream-react-BqCCtUAV.js} +3 -3
  202. package/dist/assets/vendor-motion-vLNN8EMu.js +1 -0
  203. package/dist/assets/{vendor-pierre-diffs-HJfPTtu2.js → vendor-pierre-diffs-B0OmIhMO.js} +22 -22
  204. package/dist/assets/{vendor-react-D5BntRmA.js → vendor-react-BkccXcWz.js} +1 -1
  205. package/dist/assets/{vendor-react-drawio-DXADKcSU.js → vendor-react-drawio-C9rszQEJ.js} +1 -1
  206. package/dist/assets/{vendor-reactuses-core-B8s-Rcd-.js → vendor-reactuses-core-DjKFMfz7.js} +1 -1
  207. package/dist/assets/{vendor-sonner-Y-KPX915.js → vendor-sonner-DX3nfJx4.js} +1 -1
  208. package/dist/assets/{vendor-stream-diffs-BMT21f-n.js → vendor-stream-diffs-CI1nlTpw.js} +2 -2
  209. package/dist/assets/{vendor-tanstack-react-query-ChSd65dm.js → vendor-tanstack-react-query-DIb_ItL-.js} +1 -1
  210. package/dist/assets/{vendor-tanstack-react-virtual-WY42p6U6.js → vendor-tanstack-react-virtual-qsd3nvZb.js} +1 -1
  211. package/dist/assets/{vendor-zustand-CNn3HHhT.js → vendor-zustand-CTekDqaS.js} +1 -1
  212. package/dist/assets/worktreeManager-QmahFqHc.js +1 -0
  213. package/dist/assets/worktreeSourceBranchPreference-B5Fldnhm.js +1 -0
  214. package/dist/assets/yuriEvents-BFrD5fMU.js +5 -0
  215. package/dist/assets/{zh-CN-BTolbntg.js → zh-CN-DOHH7nht.js} +1 -1
  216. package/dist/assets/{zh-TW-D00IKXY1.js → zh-TW-t1qlXGOg.js} +1 -1
  217. package/dist/assets/zhipuai-coding-plan-CcFj8zKy.js +1 -0
  218. package/dist/index.html +20 -19
  219. package/dist/mini-chat.html +20 -19
  220. package/dist/mobile.html +2 -2
  221. package/package.json +1 -1
  222. package/dist/assets/AgentAvatar-CrUv9gTt.js +0 -1
  223. package/dist/assets/AssistantConversationSurface-Cc6aVDu6.js +0 -3
  224. package/dist/assets/AssistantSessionCard-BmhD5W6i.js +0 -2
  225. package/dist/assets/AssistantUnreadBadge-ChMjxJpd.js +0 -1
  226. package/dist/assets/AssistantView-DvvRhVy5.js +0 -1
  227. package/dist/assets/FadeInOnReveal-CCYD6XoW.js +0 -1
  228. package/dist/assets/GuiPluginPage-Dk98X93G.js +0 -1
  229. package/dist/assets/GuiPluginSurface-D7HG0akj.js +0 -1
  230. package/dist/assets/GuiPluginWindow-GczL--5K.js +0 -1
  231. package/dist/assets/Icon-Di_QdcPG.js +0 -1
  232. package/dist/assets/ImageLoadingPlaceholder-Bl9JFPan.js +0 -1
  233. package/dist/assets/MarkdownRenderer-B5s2OsEB.js +0 -2
  234. package/dist/assets/MarkdownRendererImpl-D-UkyQuG.js +0 -10
  235. package/dist/assets/MarkstreamRendererImpl-C6aiJnjl.css +0 -1
  236. package/dist/assets/MarkstreamRendererImpl-CR66WFFY.js +0 -3
  237. package/dist/assets/MobileDetailNavigation-BBD0XNgQ.js +0 -1
  238. package/dist/assets/MobileResizableSheet-BnyO-EeM.js +0 -1
  239. package/dist/assets/MobileShareBridge-B9_01pMV.js +0 -3
  240. package/dist/assets/MobileSurface-D80bMoDS.js +0 -2
  241. package/dist/assets/MultiRunWindow-CHNKLgpu.js +0 -1
  242. package/dist/assets/OnboardingScreen-IW7mgTbp.js +0 -1
  243. package/dist/assets/OverlayScrollbar-Y8emBCvD.js +0 -1
  244. package/dist/assets/RemoteAssistantSessionCard-CsS0IEzX.js +0 -1
  245. package/dist/assets/SettingsView-DsdNryfB.js +0 -29
  246. package/dist/assets/SettingsWindow-Duoh0yJA.js +0 -1
  247. package/dist/assets/SetupTourDialog-CorV2qZg.js +0 -1
  248. package/dist/assets/TerminalView-Dkk1cVgf.js +0 -8
  249. package/dist/assets/ToolOutputDialog-BnOil_Y-.js +0 -16
  250. package/dist/assets/VoiceSettings-ciGa8WKn.js +0 -2
  251. package/dist/assets/checkbox-Dytz3_ID.js +0 -1
  252. package/dist/assets/collapsible-BBQwZmAQ.js +0 -1
  253. package/dist/assets/context-menu-xDEMpuCk.js +0 -1
  254. package/dist/assets/diagram-DSwu2yKQ.js +0 -1
  255. package/dist/assets/dialog-Dzn-bQVo.js +0 -1
  256. package/dist/assets/fileMentionAutocompleteState-BZJqfgae.js +0 -2
  257. package/dist/assets/gitApiHttp-CODO8JTV.js +0 -3
  258. package/dist/assets/historyImportQueries-DiGQ8duS.js +0 -1
  259. package/dist/assets/input-D7D-3e9R.js +0 -1
  260. package/dist/assets/insertionBoundaries-JO44Mllr.js +0 -1
  261. package/dist/assets/main-BVNVtnJ2.js +0 -169
  262. package/dist/assets/main-ezlqSGuw.js +0 -2
  263. package/dist/assets/mcpQueries-D1Y8jS59.js +0 -1
  264. package/dist/assets/miniChat-DjyhdG-q.js +0 -2
  265. package/dist/assets/mobile-jNSOJK8S.js +0 -2
  266. package/dist/assets/mobileBackNavigation-CDjFrmY0.js +0 -1
  267. package/dist/assets/mobileConnections-CAWX3Kcj.js +0 -2
  268. package/dist/assets/multirun-Cm02Mr2G.js +0 -3
  269. package/dist/assets/navigation-DPATOY-c.js +0 -2
  270. package/dist/assets/openRemoteProjectSession-DyFX_iVc.js +0 -1
  271. package/dist/assets/projectMeta-CfR3wyL_.js +0 -1
  272. package/dist/assets/pwa-NS2m1emq.js +0 -2
  273. package/dist/assets/queue-abort-optimistic-b6yciGim.js +0 -1
  274. package/dist/assets/react-Tx7JylRi.js +0 -1
  275. package/dist/assets/readiness-DSoWdMsS.js +0 -2
  276. package/dist/assets/reference-history-C-uAk3vA.js +0 -1
  277. package/dist/assets/remoteProjectQueries-yX3kOkR6.js +0 -1
  278. package/dist/assets/remoteSessionReference-Dt-1LC6L.js +0 -1
  279. package/dist/assets/renderElectronMiniChatApp-P2AchMs8.js +0 -2
  280. package/dist/assets/renderMobileApp-MngDLpRV.js +0 -29
  281. package/dist/assets/runtime-file-resource-CKQQEwNv.js +0 -6
  282. package/dist/assets/runtimeEndpointReset-DtqLL5aK.js +0 -151
  283. package/dist/assets/scheduledTaskNavigation-DkvuAc9T.js +0 -1
  284. package/dist/assets/select-CFaRXt8t.js +0 -1
  285. package/dist/assets/sessionLookup-5sf3gI5Y.js +0 -1
  286. package/dist/assets/sortable-tabs-strip-CbBdtUqa.js +0 -1
  287. package/dist/assets/src-AdfuQoIg.css +0 -2
  288. package/dist/assets/textarea-BmnYSVu_.js +0 -1
  289. package/dist/assets/tooltip-R2z0xQFW.js +0 -1
  290. package/dist/assets/types-e0zJKRUL.js +0 -2
  291. package/dist/assets/useAppFontEffects-oL2HGfzG.js +0 -6620
  292. package/dist/assets/useDesktopWindowControlsLayout-BuN9KNjx.js +0 -1
  293. package/dist/assets/useDictation-BNEvKslr.js +0 -1
  294. package/dist/assets/useEffectiveDirectory-gMI2T7Pz.js +0 -1
  295. package/dist/assets/useMobileNavigationStore-DRQ4Efws.js +0 -13
  296. package/dist/assets/usePluginsStore-Bj97xU5Y.js +0 -1
  297. package/dist/assets/useProjectRuntimeAPIs-BfWU7Tyh.js +0 -1
  298. package/dist/assets/vendor-motion-DtmZZeEm.js +0 -1
  299. /package/dist/assets/{useAppFontEffects-K31q-1OV.css → ChatContainer-K31q-1OV.css} +0 -0
  300. /package/dist/assets/{VoiceSettings-C0HSdVvS.css → pluginPresentation-C0HSdVvS.css} +0 -0
@@ -1,29 +0,0 @@
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/ToolOutputDialog-BnOil_Y-.js","assets/runtime-auth-DA-qfGHk.js","assets/runtime-switch-DEPKHgdL.js","assets/runtime-fetch-V-iMWR8t.js","assets/reasoning-projection-client-BEhVknv9.js","assets/platform-CiUKDeXd.js","assets/runtimeAPIRegistry-C2VogTny.js","assets/vendor-pathe-vBmvQE8f.js","assets/vendor-base-ui-fom6orB6.js","assets/vendor-react-D5BntRmA.js","assets/vendor-tanstack-react-query-ChSd65dm.js","assets/vendor-tanstack-query-core-BSjXNgF_.js","assets/runtime-file-resource-CKQQEwNv.js","assets/path-utils-jGozTg9d.js","assets/vendor-reactuses-core-B8s-Rcd-.js","assets/vendor-lodash-es-BS45jPoZ.js","assets/vendor-js-cookie-hSOiFTtX.js","assets/runtime-file-store-BVRgEtI-.js","assets/brand-storage-migration-Bhz6UOBJ.js","assets/useUIStore-mVT8ipsT.js","assets/vendor-zustand-CNn3HHhT.js","assets/brand-storage-bootstrap-D4BW3w-M.js","assets/safeStorage-DTOhKN0V.js","assets/useMobileHtmlPreviewStore-DzzgY1eS.js","assets/runtime-file-download-DxL4XbME.js","assets/vendor-pierre-diffs-HJfPTtu2.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/i18n-Bfzj0WR9.js","assets/runtime-ead7P81A.js","assets/bootstrap-eLlfzqAI.js","assets/store-DHAsbqgT.js","assets/tour-CMXP3Kif.js","assets/useMobileNavigationStore-DRQ4Efws.js","assets/gitApiHttp-CODO8JTV.js","assets/client-CzjApAA4.js","assets/vendor-opencode-client-BM2r1f0o.js","assets/vendor-effect-X1Hqc7ba.js","assets/prompt-attachment-upload-Bem87nmm.js","assets/uuid-D-SDZijH.js","assets/vendor-sonner-Y-KPX915.js","assets/useAssistantUIStore-MY4QWnVQ.js","assets/input-store-wWToFdzi.js","assets/remoteProjectQueries-yX3kOkR6.js","assets/vendor-zod-DZzbCm1s.js","assets/vendor-opencode-schema-DWT45VBX.js","assets/vendor-class-variance-authority-BLUaYARZ.js","assets/vendor-tailwind-merge-BicNWLTg.js","assets/toolHelpers-iEHVHQ9p.js","assets/useThemeSystem-D2YBbLma.js","assets/vendor-framer-motion-DiGWHm7K.js","assets/Icon-Di_QdcPG.js","assets/dialog-Dzn-bQVo.js","assets/dialog-D9CkSNCA.css","assets/tap-LkQum5bB.js","assets/themes-BgDJcxRc.js","assets/MarkdownRenderer-B5s2OsEB.js","assets/useEffectiveDirectory-gMI2T7Pz.js","assets/markdownHeightCache-BPOYloX8.js","assets/dualLimitLru-D8Sphgua.js","assets/MobileWindowStack-DGLdgoGr.js","assets/mobileBackNavigation-CDjFrmY0.js","assets/agentColors-DWSbQXy2.js","assets/rasterizePng-056Poix7.js","assets/image-loading-Dlh4FIPJ.js","assets/image-loading-DA9JEHD8.css","assets/ImageLoadingPlaceholder-Bl9JFPan.js","assets/vendor-tanstack-react-virtual-WY42p6U6.js","assets/markdownTheme-C2LJ3cJo.js","assets/markdown-worker-oBGEB9Eg.js","assets/vendor-capacitor-push-notifications-D5cqJIPw.js","assets/vendor-capacitor-status-bar-D9bcMr9Q.js","assets/vendor-capacitor-keyboard-BRVcFyc9.js","assets/gitApi-Cxw-b-S_.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-CNn3HHhT.js";import{it as C,ot as w,st as T}from"./vendor-base-ui-fom6orB6.js";import{Mt as E,Pt as D,St as O,xt as k}from"./gitApiHttp-CODO8JTV.js";import"./brand-storage-bootstrap-D4BW3w-M.js";import{n as A}from"./safeStorage-DTOhKN0V.js";import{Rt as j,Xt as M,Zt as N,an as P,ln as F,n as I,on as L,un as R,zt as ee}from"./client-CzjApAA4.js";import{n as z,t as B}from"./vendor-react-D5BntRmA.js";import{f as V}from"./vendor-tanstack-query-core-BSjXNgF_.js";import{c as te,o as ne,s as re}from"./vendor-tanstack-react-query-ChSd65dm.js";import{C as H,D as ie,E as U,G as ae,S as oe,T as se,V as ce,k as le,q as W,w as ue,z as G}from"./runtime-file-resource-CKQQEwNv.js";import{o as de}from"./path-utils-jGozTg9d.js";import{i as K,l as fe,m as pe,r as q}from"./vendor-reactuses-core-B8s-Rcd-.js";import{a as me,n as J,o as he}from"./vendor-aparajita-capacitor-secure-storage-xol_6BsB.js";import{r as ge}from"./useUIStore-mVT8ipsT.js";import{a as _e,o as ve,s as ye,t as be}from"./useMobileHtmlPreviewStore-DzzgY1eS.js";import{t as xe}from"./capgoAdapter-BR9RFIfy.js";/* empty css */import{a as Se}from"./vendor-pierre-diffs-HJfPTtu2.js";import{r as Ce}from"./vendor-sonner-Y-KPX915.js";import{r as we,t as Te}from"./i18n-Bfzj0WR9.js";import{i as Ee,n as De}from"./store-DHAsbqgT.js";import{a as Oe,i as ke,l as Ae,o as je,r as Me,s as Ne,t as Pe,u as Fe}from"./mobileConnections-CAWX3Kcj.js";import{S as Ie,b as Le,h as Re,t as ze,v as Be,y as Ve}from"./MobileDetailNavigation-BBD0XNgQ.js";import{A as He,Ai as Ue,Ba as We,Di as Ge,Ei as Ke,Ft as qe,H as Je,Ir as Ye,J as Xe,Ln as Y,Lr as Ze,Nr as Qe,Oi as $e,R as et,Ti as tt,Tr as nt,Xa as rt,_i as it,_r as at,an as ot,ar as st,bi as ct,ca as lt,ct as ut,dt,ea as ft,fi as pt,gr as mt,it as ht,ji as gt,jr as _t,ki as vt,kr as yt,mi as bt,na as xt,o as St,or as Ct,ot as wt,p as Tt,q as Et,qa as Dt,qi as Ot,s as kt,si as At,sr as jt,t as Mt,tr as Nt,tt as Pt,ut as Ft,vr as It,wi as Lt,wn as Rt,yi as zt,z as Bt,zn as Vt}from"./useMobileNavigationStore-DRQ4Efws.js";import{i as Ht,n as Ut,r as Wt}from"./useAssistantUIStore-MY4QWnVQ.js";import{a as Gt,o as Kt,t as qt}from"./MobileShareBridge-B9_01pMV.js";import{d as Jt,h as Yt,i as Xt,m as Zt,p as Qt}from"./remoteProjectQueries-yX3kOkR6.js";import{a as $t,c as en,i as tn,s as nn}from"./toolHelpers-iEHVHQ9p.js";import{n as rn}from"./useThemeSystem-D2YBbLma.js";import{n as X}from"./Icon-Di_QdcPG.js";import{a as an,i as on,n as sn,o as cn,r as ln,t as un}from"./dialog-Dzn-bQVo.js";import{At as dn,Bt as fn,D as pn,Et as mn,G as hn,Gt as gn,Ht as _n,It as vn,K as yn,Kt as bn,Lt as xn,Mt as Sn,Nt as Cn,Q as wn,Qt as Tn,R as En,Rt as Dn,S as On,St as kn,T as An,Tt as jn,U as Mn,Ut as Nn,Vt as Pn,W as Fn,Wt as In,X as Ln,Z as Rn,dt as zn,ft as Bn,ht as Vn,i as Hn,nt as Un,q as Wn,r as Gn,t as Kn,tt as qn,wt as Jn,x as Yn,zt as Xn}from"./useAppFontEffects-oL2HGfzG.js";import{t as Zn}from"./input-D7D-3e9R.js";import{t as Qn}from"./tap-LkQum5bB.js";import{r as $n}from"./tooltip-R2z0xQFW.js";import{A as er,D as tr,E as nr,G as rr,K as ir,M as ar,O as or,Q as sr,S as cr,W as lr,q as ur}from"./pwa-NS2m1emq.js";import{t as dr}from"./YuriLogo-BJ6Ao0du.js";import{o as fr}from"./react-Tx7JylRi.js";import{i as pr,o as mr,t as hr}from"./device-BlmHHWT1.js";import{r as gr}from"./themes-BgDJcxRc.js";import{o as _r}from"./scheduledTaskNavigation-DkvuAc9T.js";import{a as vr,n as yr,o as br}from"./MarkdownRenderer-B5s2OsEB.js";import{C as xr,d as Sr,n as Cr,r as wr,t as Tr,u as Er}from"./MobileResizableSheet-BnyO-EeM.js";import{_ as Dr,g as Or,h as kr,v as Ar,w as jr}from"./insertionBoundaries-JO44Mllr.js";import{l as Mr,u as Nr}from"./select-CFaRXt8t.js";import{M as Pr,N as Fr,O as Ir,h as Lr,i as Rr,n as zr,r as Br,s as Vr,t as Hr}from"./mobileBackNavigation-CDjFrmY0.js";import{r as Ur}from"./queue-abort-optimistic-b6yciGim.js";import{o as Wr}from"./image-loading-Dlh4FIPJ.js";import{t as Gr}from"./ImageLoadingPlaceholder-Bl9JFPan.js";import{t as Kr}from"./LoadingImage-C4cAJD72.js";import{n as qr,r as Jr}from"./textarea-BmnYSVu_.js";import{a as Yr,f as Xr,i as Zr,n as Qr,s as $r}from"./projectMeta-CfR3wyL_.js";import{r as ei}from"./ToolOutputDialog-BnOil_Y-.js";import{c as ti,s as ni}from"./sessionLookup-5sf3gI5Y.js";import{n as ri,t as ii}from"./useProjectRuntimeAPIs-BfWU7Tyh.js";import{$ as ai,A as oi,G as si,M as ci,Q as li,Y as ui,d as di,et as fi,i as pi,k as mi,n as hi,r as gi,t as _i}from"./MobileSurface-D80bMoDS.js";import{t as vi}from"./openRemoteProjectSession-DyFX_iVc.js";import{i as yi,r as bi}from"./AssistantConversationSurface-Cc6aVDu6.js";import{t as xi}from"./useFontPreferences-BqPDrGZM.js";import{$ as Si,$t as Ci,At as wi,B as Ti,Bt as Ei,C as Di,Ct as Oi,Dt as ki,Et as Ai,F as ji,Ht as Mi,It as Ni,Jt as Pi,L as Fi,Lt as Ii,Mt as Li,Ot as Ri,P as zi,Q as Bi,Qt as Vi,Rt as Hi,S as Ui,St as Wi,T as Gi,Tt as Ki,Ut as qi,V as Ji,Vt as Yi,X as Xi,Xt as Zi,Y as Qi,Z as $i,Zt as ea,_ as ta,_t as na,a as ra,an as ia,at as aa,b as oa,bt as sa,c as ca,cn as la,ct as ua,d as da,dt as fa,en as pa,et as ma,f as ha,fn as ga,ft as _a,g as va,gt as ya,h as ba,ht as xa,i as Sa,in as Ca,jt as wa,kt as Ta,l as Ea,ln as Da,lt as Oa,m as ka,n as Aa,nt as ja,o as Ma,ot as Na,p as Pa,pt as Fa,r as Ia,rn as La,s as Ra,sn as za,st as Ba,t as Va,tt as Ha,u as Ua,ut as Wa,vt as Ga,wt as Ka,xt as qa,yt as Ja,z as Ya,zt as Xa}from"./runtimeEndpointReset-DtqLL5aK.js";import{t as Za}from"./YuriWordmark-D2e-o9nW.js";import{r as Qa,t as $a}from"./mcpQueries-D1Y8jS59.js";import{f as eo}from"./usePluginsStore-Bj97xU5Y.js";import{a as to,i as no,o as ro,r as io,t as ao}from"./SettingsView-DsdNryfB.js";import{i as oo,s as so}from"./readiness-DSoWdMsS.js";import{t as co}from"./relay-preview-frame-src-BPyz3nXA.js";import{n as lo}from"./project-preview-BjTq299L.js";import{n as uo,r as fo,t as po}from"./AssistantUnreadBadge-ChMjxJpd.js";import{a as mo,c as ho,i as go,o as _o,r as vo,s as yo,t as bo}from"./AssistantView-DvvRhVy5.js";var Z=e(T(),1),xo=B(),So=null,Co=!1,wo=new Promise(e=>{So=e});function To(){Co||(Co=!0,So?.())}var Eo=6,Do=e=>e.parentID??null,Oo=e=>{let t=e.replace(/\/+$/,``);return t.slice(t.lastIndexOf(`/`)+1)||t},ko=e=>e.replace(/\\/g,`/`).replace(/\/+$/,``),Ao=(e,t)=>{if(!e)return``;let n=null,r=-1;for(let i of t){let t=ko(i.path);(e===t||e.startsWith(`${t}/`))&&t.length>r&&(n=i,r=t.length)}return Oo(n?n.path:e)},jo=()=>{let e=ct.getState().activeSessions,t=yt.getState().index.session.unseenCount,n=Dt.getState().projects,r=0,i=[];for(let a of e){let e=Do(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:Ao(it(a),n)})}i.sort((e,t)=>t.updated-e.updated);let a=i.slice(0,Eo).map(({id:e,title:t,unread:n,project:r})=>({id:e,title:t,unread:n,project:r}));return{attentionCount:r,recentSessions:a}},Mo=`__YURI_WIDGET_SNAPSHOT__`,No=()=>{typeof window>`u`||(window[Mo]=()=>{try{return JSON.stringify(jo())}catch{return null}})},Q=z(),Po=me(`YuriScreenAwake`),Fo=Promise.resolve(),Io=0;function Lo(e){let t=Fo.then(()=>Po.setEnabled({enabled:e}));return Fo=t.catch(()=>void 0),t}async function Ro(){if(J.isNativePlatform()&&J.isPluginAvailable(`YuriScreenAwake`)){Io+=1;try{await Lo(!0)}catch(e){throw--Io,e}let e=!1;return async()=>{e||(e=!0,--Io,Io===0&&await Lo(!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 $=w();function zo(e){let t=(0,Q.c)(3),n=jt(),r=e.remoteState??n??void 0,i;return t[0]!==e||t[1]!==r?(i=(0,$.jsx)(Ho,{...e,remoteState:r}),t[0]=e,t[1]=r,t[2]=i):i=t[2],i}function Bo(e){let t=(0,Q.c)(6),{identity:n,onSource:r}=e,i=Ft(e.sessionId,e.directory),a=dt(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 Vo(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=q(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 Ho(e){let{sessionId:t,directory:n,active:r,children:i,remoteState:a}=e,{t:o}=Te(),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=q(e=>{l.current=e,d(t=>t?.identity===e.identity&&t.resolved===e.resolved?t:{identity:e.identity,resolved:e.resolved})}),[p,m]=fe(`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=wn({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=q(()=>{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=q(()=>{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(),Ce.error(o(`mobile.menu.autoReadFailed`));return}k()}},{target:t.target})}),A=q(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=q((e,n)=>{T.current.enabled&&D&&e===t&&T.current.observed.add(n)}),M=q(()=>{if(h){m(!1),O();return}D&&(m(!0),w.unlock().catch(()=>{Ce.error(o(`mobile.menu.autoReadFailed`))}))}),N=q(()=>{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=q(()=>{m(!1),O()});K(`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),K(`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 Ro().then(n=>{e?n().catch(()=>void 0):t=n}).catch(()=>{e||Ce.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)(Ln.Provider,{value:F,children:(0,$.jsxs)(Rn.Provider,{value:I,children:[a?(0,$.jsx)(Vo,{...e,identity:c,onSource:f,remoteState:a}):e.remote?null:(0,$.jsx)(Bo,{...e,identity:c,onSource:f}),i]})})}function Uo(e){let t=(0,Q.c)(3),{children:n}=e,r=(0,Z.useContext)(Ln);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 Wo={getPlatform:()=>J.getPlatform(),isPluginAvailable:e=>J.isPluginAvailable(e),openInSystemBrowser:e=>ye.open(e),openExternal:ve},Go=async(e,t=Wo)=>{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)},Ko=`mobile-app-update-available`,qo=`mobile-app-update-toast-dismissed-version`,Jo=()=>{let e=(0,Q.c)(9),{t}=Te(),n=ui(Yo),r=ui(Xo),i=ui(Zo),a=ui(Qo),o=ui($o),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){Ke.dismiss(Ko);return}A().getItem(qo)!==i&&(c.current.has(i)||(c.current.add(i),Ke.info(t(`mobileUpdate.toast.available.title`),{id:Ko,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:()=>{Go(a)}},cancel:{label:t(`mobileUpdate.toast.actions.dismiss`),onClick:()=>{A().setItem(qo,i),Ke.dismiss(Ko)}}})))},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 Yo(e){return e.available}function Xo(e){return e.runtimeType}function Zo(e){return e.info?.version}function Qo(e){return e.info?.downloadUrl}function $o(e){return e.info?.inAppApply===!0}var es=e=>!(!e.enabled||e.runtimeType!==`mobile`||!e.available||!e.inAppApply||!e.version||e.seenVersions.has(e.version)||e.dismissedVersion!==null&&e.dismissedVersion===e.version),ts=e=>e.enabled&&!e.alreadyChecked,ns=`mobile-ota-update-available`,rs=`mobile-ota-update-toast-dismissed-version`,is=()=>{let e=(0,Q.c)(24),{t}=Te(),[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=ui(as),u=ui(os),d=ui(ss),f=ui(cs),p=ui(ls),m=ui(us),h=ui(ds),_=ui(fs),v=ui(ps),y=d?.version,b=d?.inAppApply===!0,x,S;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(x=()=>{ts({enabled:c,alreadyChecked:i.current})&&(i.current=!0,ui.getState().checkForUpdates().catch(ms))},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=q(C),T=q(hs),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(!es({enabled:c,runtimeType:u,available:l,inAppApply:b,version:y??``,dismissedVersion:A().getItem(rs),seenVersions:o.current})||!y){(!l||!b||u!==`mobile`)&&Ke.dismiss(ns);return}o.current.add(y),Ke.info(t(`mobileUpdate.ota.toast.available.title`),{id:ns,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 O;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?(O=(0,$.jsx)(si,{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]=O):O=e[23],O};function as(e){return e.available}function os(e){return e.runtimeType}function ss(e){return e.info}function cs(e){return e.downloading}function ls(e){return e.downloaded}function us(e){return e.progress}function ds(e){return e.error}function fs(e){return e.downloadUpdate}function ps(e){return e.restartToUpdate}function ms(){}function hs(e){A().setItem(rs,e),Ke.dismiss(ns)}var gs=me(`BarcodeScanner`),_s=`yuri-barcode-scanner-active`,vs=()=>Ns()?gs:null,ys=()=>window.Capacitor?.getPlatform?.()===`android`,bs=e=>typeof e==`object`&&e&&`message`in e?String(e.message??``):String(e??``),xs=e=>/^\s*scan canceled\.?\s*$/i.test(bs(e)),Ss=e=>/denied access to camera/i.test(bs(e)),Cs=e=>!xs(e)&&!Ss(e),ws=e=>{let t=bs(e);return/module/i.test(t)&&/not\s*available|unavailable/i.test(t)},Ts=e=>{e.installGoogleBarcodeScannerModule?.().catch(()=>void 0)},Es=e=>{let t=e.trim();if(!t)return null;if(/^yuri:\/\//i.test(t)){let e=to(t);return e?{pairing:e}:null}return/^https?:\/\//i.test(t)?{url:t}:null},Ds=e=>{let t=Es(e);return t?`pairing`in t?{status:`pairing`,...t}:{status:`ok`,...t}:{status:`invalid`}},Os=e=>{typeof document>`u`||document.documentElement.classList.toggle(_s,e)},ks=e=>{try{e()}catch{}},As=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))}},js=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))};Os(!0);let c=As(()=>s({status:`cancelled`}));try{let{App:e}=await he(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(Ds(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=>{Ss(e)?s({status:`permission-denied`}):s({status:`failed`})}),await o}finally{Os(!1),ks(c),ks(()=>r?.()),await Promise.allSettled([Promise.resolve(t?.remove()),Promise.resolve(n?.remove()),e.stopScan()])}},Ms=e=>e.isNativePlatform&&e.isPluginAvailable,Ns=()=>Ms({isNativePlatform:J.isNativePlatform(),isPluginAvailable:J.isPluginAvailable(`BarcodeScanner`)}),Ps=async()=>{let e=vs();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?Ds(n):{status:`cancelled`}}catch(t){return xs(t)?{status:`cancelled`}:Ss(t)?{status:`permission-denied`}:ys()&&Cs(t)&&e.startScan?(ws(t)&&Ts(e),js(e)):{status:`failed`}}return ys()&&e.startScan?js(e):{status:`unsupported`}}catch{return{status:`failed`}}},Fs={autoComplete:`off`,autoCorrect:`off`,spellCheck:!1},Is=({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}=Te(),[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=q(async()=>{if(!(e||t||_)){v(!0);try{let e=await navigator.clipboard.readText();x(e);let t=Es(e);e.trim()&&(!t||!(`pairing`in t))&&d()}catch{g(f(`mobile.connect.link.pasteFallback`))}finally{v(!1)}}}),C=q(n=>{if(n.preventDefault(),e||t||_)return;let r=Es(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)(Zn,{...Fs,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)(Y,{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)(Y,{type:`submit`,variant:i,size:`lg`,className:a,disabled:e||t||_||!y.trim(),children:f(t?`mobile.connect.connecting`:`mobile.connect.connectButton`)})]})};function Ls({connection:e}){let{t}=Te(),{connections:n,isBusy:r,error:i,pendingConnection:a}=e,o=Z.useMemo(()=>Ns(),[]),[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=q(()=>{O||(a?(e.cancelPassword(),C(``)):A(null))}),N=q(async t=>{O||(_(t.id),C(``),await e.connect({id:t.id,candidates:t.candidates,label:t.label}))}),P=q(async()=>{if(!O){_(null),m(!0),e.setError(null);try{let n=await Ps();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=q(()=>d?(f(null),!0):k?(M(),!0):l?(u(!1),!0):!1);Z.useEffect(()=>{if(!g())return;let e=!1,t;return he(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)(Y,{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)(Za,{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)(dr,{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)(Y,{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)(Y,{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)(Y,{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)(Y,{variant:`ghost`,size:`lg`,disabled:O,className:`mx-auto text-muted-foreground`,onClick:()=>A(`more`),children:t(`mobile.connect.welcome.moreOptions`)})]})]})]}),(0,$.jsxs)(wr,{id:`welcome-history`,open:l,onOpenChange:u,presentation:`page`,edge:`right`,dismissGesture:!0,ariaLabel:t(`mobile.connect.history.title`),children:[(0,$.jsx)(ze,{title:t(`mobile.connect.history.title`),backAriaLabel:t(`header.actions.backAria`),onBack:()=>u(!1)}),(0,$.jsxs)(qr,{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)(Y,{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)(Y,{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)(rr,{open:d===e.id,onOpenChange:t=>f(t?e.id:null),children:[(0,$.jsx)(sr,{asChild:!0,children:(0,$.jsx)(Y,{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)(ir,{align:`end`,children:[(0,$.jsxs)(ur,{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)(ur,{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)(dr,{width:36,height:36,className:`mx-auto mb-5 opacity-40`}),o?L(!1):null,(0,$.jsx)(Y,{variant:`ghost`,size:`lg`,className:`w-full`,disabled:O,onClick:()=>A(`more`),children:t(`mobile.connect.link.useLink`)})]})]}),(0,$.jsx)(Tr,{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)(qr,{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)(Y,{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)(Y,{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)(Zn,{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)(Y,{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)(Y,{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)(Zn,{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)(Y,{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)(Y,{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)(Y,{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)(Is,{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)(Y,{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 Rs(e){let t=(0,Q.c)(17),{children:n}=e,r=ge(Vs),i=ge(Bs),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],zr(c);let l,u;t[5]===r?(l=t[6],u=t[7]):(l=()=>{if(!r)return;let e=document.activeElement,t=yn(`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)(pa,{presentation:`page`,onBack:zs})}):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 zs(){Hr.requestAnimatedBack(`root`)}function Bs(e){return e.setCommandPaletteOpen}function Vs(e){return e.isCommandPaletteOpen}async function Hs(e,t,n,i){if(i){let r=await lo(i,e,n);if(!_e(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(!_e(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)||!co(`${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 Us({url:e,hostOrigin:t,entry:n}){let{t:r}=Te(),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 Hs(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=_e(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 K(`message`,t=>{if(!f?.src||!_e(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`&&be.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)(so,{message:r(`contextPanel.preview.proxyError`)}),(0,$.jsx)(Y,{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 Ws(e){let t=(0,Q.c)(10),{location:n,url:r,hostOrigin:i}=e,{t:a}=Te(),o=Zt(!0);if(!o.registry||o.registry.hubId!==n.hubId){let e;return t[0]!==o.error||t[1]!==a?(e=o.error?(0,$.jsx)(so,{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)(Us,{url:r,hostOrigin:i,entry:s}),t[6]=i,t[7]=s,t[8]=r,t[9]=c):c=t[9],c}function Gs(){let e=(0,Q.c)(17),{t}=Te(),n=be(qs),r=U(),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)(oo,{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)(Us,{url:a.url,hostOrigin:e?.hostOrigin,entry:r.entry}):(0,$.jsx)(Ws,{location:a.location,url:a.url,hostOrigin:e?.hostOrigin}):(0,$.jsx)(Us,{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)(Tr,{id:`mobile-html-preview`,open:o,ariaLabel:c,closeAriaLabel:l,resizeAriaLabel:u,initiallyExpanded:!0,title:f,onOpenChange:Ks,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 Ks(e){e||be.getState().close()}function qs(e){return e.target}function Js(){let e=Dt(e=>e.projects.find(t=>t.id===e.activeProjectId)),t=rt(e=>e.remoteSession),n=!!e?.hostId,r=Jt(),i=Zt(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?Xt(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=Ct(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=Qt(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:q(t=>{if(!e?.hostId||!p)throw Error(`Remote Host scope unavailable`);rt.getState().openRemoteSession(e,p,t)}),refresh:q(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 Ys=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=Vt(`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=Vt(`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 Xs(e){let t=(0,Q.c)(30),{percentage:n,pending:r}=e,i=r!==void 0&&r,{t:a}=Te(),o,s,c,l,u,d,f,p,m;if(t[0]!==i||t[1]!==n||t[2]!==a){c=i?0:nr(n)??0;let e=ar(n);s=i?`var(--surface-muted-foreground)`:e===`critical`?`var(--status-error)`:e===`warn`?`var(--status-warning)`:`var(--status-success)`,o=2*Math.PI*7.5,l=`0 0 18 18`,u=`size-[18px] -rotate-90`,d=`progressbar`,t[12]===a?f=t[13]:(f=a(`contextUsage.aria.label`),t[12]=a,t[13]=f),t[14]!==i||t[15]!==a?(p=i?a(`contextUsage.pending`):void 0,t[14]=i,t[15]=a,t[16]=p):p=t[16],m=i?void 0:Math.round(c),t[0]=i,t[1]=n,t[2]=a,t[3]=o,t[4]=s,t[5]=c,t[6]=l,t[7]=u,t[8]=d,t[9]=f,t[10]=p,t[11]=m}else o=t[3],s=t[4],c=t[5],l=t[6],u=t[7],d=t[8],f=t[9],p=t[10],m=t[11];let h;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,$.jsx)(`circle`,{cx:9,cy:9,r:7.5,fill:`none`,stroke:`var(--interactive-border)`,strokeWidth:3}),t[17]=h):h=t[17];let g=o*(1-c/100),_;t[18]!==o||t[19]!==s||t[20]!==g?(_=(0,$.jsx)(`circle`,{cx:9,cy:9,r:7.5,fill:`none`,stroke:s,strokeWidth:3,strokeLinecap:`round`,strokeDasharray:o,strokeDashoffset:g,className:`transition-[stroke-dashoffset,stroke] duration-300`}),t[18]=o,t[19]=s,t[20]=g,t[21]=_):_=t[21];let v;return t[22]!==_||t[23]!==l||t[24]!==u||t[25]!==d||t[26]!==f||t[27]!==p||t[28]!==m?(v=(0,$.jsxs)(`svg`,{viewBox:l,className:u,role:d,"aria-label":f,"aria-valuetext":p,"aria-valuenow":m,"aria-valuemin":0,"aria-valuemax":100,children:[h,_]}),t[22]=_,t[23]=l,t[24]=u,t[25]=d,t[26]=f,t[27]=p,t[28]=m,t[29]=v):v=t[29],v}var Zs=(e,t,n)=>ne({queryKey:[...e.queryScope,`mobile-session-metadata`,t],staleTime:3e4,gcTime:1/0,retry:!1,queryFn:({signal:e})=>n(e)});function Qs(e){let t=G(e);return Zs(e,`git`,async n=>{let r={signal:n,query:{directory:e.location.directory},headers:{"x-opencode-directory":e.location.directory}};return(await t.json(`/api/git/check`,r)).isGitRepository?{isGitRepository:!0,current:(await t.json(`/api/git/status`,{...r,query:{...r.query,mode:`light`}})).current}:{isGitRepository:!1,current:null}})}function $s(e){let t=G(e);return Zs(e,`quota-settings`,async e=>{let n=await t.json(`/api/config/settings`,{signal:e}),r=ai.map(e=>e.id),i=Array.isArray(n.usageDropdownProviders)?n.usageDropdownProviders.filter(e=>typeof e==`string`&&(e.startsWith(`magpie:`)||r.includes(e))):r,a={};if(n.usageSelectedModels&&typeof n.usageSelectedModels==`object`)for(let[e,t]of Object.entries(n.usageSelectedModels))Array.isArray(t)&&(a[e]=t.filter(e=>typeof e==`string`));return{providerIds:i,selectedModels:a,displayMode:n.usageDisplayMode===`remaining`?`remaining`:`usage`,autoRefresh:n.usageAutoRefresh===!0,refreshIntervalMs:typeof n.usageRefreshIntervalMs==`number`&&Number.isFinite(n.usageRefreshIntervalMs)?Math.max(3e4,Math.min(3e5,Math.round(n.usageRefreshIntervalMs))):6e4}})}function ec(e,t){let n=G(e);return Zs(e,`quota:${t}`,async e=>{let r=await n.json(`/api/quota/${encodeURIComponent(t)}`,{signal:e});if(!ae(r)||r.providerId!==t)throw Error(`Invalid quota response`);return r})}function tc(e){let t=G(e);return Zs(e,`magpie`,async n=>{let r=await t.json(`/api/quota/magpie`,{signal:n,query:{directory:e.location.directory}});if(!Array.isArray(r.sources)||!r.sources.every(e=>e&&typeof e.id==`string`&&Array.isArray(e.results)&&e.results.every(t=>ae(t)&&t.source===`magpie`&&t.sourceId===e.id&&t.providerId.startsWith(`magpie:${e.id}:`))))throw Error(`Invalid Magpie quota response`);return r.sources.flatMap(e=>e.results)})}var nc=(e,t)=>{if(!e||typeof e!=`object`)return;let n=e[t];return typeof n==`number`&&Number.isFinite(n)?n:void 0},rc=e=>e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e),ic=e=>e>=90?`text-[var(--status-error)]`:e>=75?`text-[var(--status-warning)]`:`text-[var(--status-success)]`,ac=e=>{let{totalTokens:t,contextLimit:n,isDraft:r}=e;if(!r&&t===null)return{pending:!0,percentage:0,tokens:`—`,colorClass:`text-muted-foreground`};if(t===null||r||t<=0||n<=0)return null;let i=Math.min(t/n*100,999);return{percentage:i,tokens:`${rc(t)}/${rc(n)}`,colorClass:ic(i)}},oc=e=>{for(let t=e.length-1;t>=0;--t){let n=e[t];if(n.role!==`user`)continue;let r=typeof n.model?.providerID==`string`&&n.model.providerID.trim().length>0?n.model.providerID:void 0,i=typeof n.model?.modelID==`string`&&n.model.modelID.trim().length>0?n.model.modelID:void 0;if(r&&i)return{providerID:r,modelID:i}}return null},sc=e=>(e||``).replace(/\\/g,`/`).replace(/\/+$/g,``);function cc(e,t,n){let r=(0,Q.c)(7),{t:i}=Te(),a;if(r[0]!==t||r[1]!==e||r[2]!==n||r[3]!==i){let o=new Map(e.map(lc)),s;r[5]===t?s=r[6]:(s=e=>t.includes(e.id),r[5]=t,r[6]=s),a=fi(e).filter(s).filter(e=>o.get(e.id)?.configured===!0).map(e=>{let t=o.get(e.id),r=[];for(let[e,n]of ea(Object.entries(t?.usage?.windows??{}),t?.usage?.accounts))r.push({key:`window-${e}`,label:er(n.label??e),window:n});let a=Object.entries(t?.usage?.models??{}),s=n[e.id]??[];for(let[e,t]of s.length>0?a.filter(e=>{let[t]=e;return s.includes(t)}):a){let n=Object.entries(t.windows??{});if(n.length===0)continue;let[i,a]=n[0];r.push({key:`model-${e}-${i}`,label:er(a.label??i),subtitle:ci(e),window:a})}return{providerId:e.id,providerName:e.name,rows:r,status:!t.ok&&t.error?t.error:r.length===0?i(`header.services.noRateLimitsReported`):null}}),r[0]=t,r[1]=e,r[2]=n,r[3]=i,r[4]=a}else a=r[4];return a}function lc(e){return[e?.providerId,e]}var uc=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`},dc=e=>{let t=(0,Q.c)(13),{iconNode:n,iconName:r,label:i,children:a}=e,o;t[0]!==r||t[1]!==n?(o=n??(r?(0,$.jsx)(X,{name:r,className:`size-[18px]`}):null),t[0]=r,t[1]=n,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},fc=e=>{let t=(0,Q.c)(30),{groups:n,displayMode:r,isLoading:i,timeFormatPreference:a}=e,{t:o}=Te(),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)(Mr,{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=Zi(e.rows.map(Lc),n),o=r===`remaining`?t.window.remainingPercent:t.window.usedPercent,s=or(t.window.valueLabel,o),c=tr(t.window.resetAt,t.window.resetAfterFormatted??t.window.resetAtFormatted,a);return(0,$.jsxs)(Z.Fragment,{children:[i?(0,$.jsx)(`div`,{className:Vt(`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:Vt(`min-w-0 max-w-[60%] shrink-0 truncate typography-ui-label font-semibold tabular-nums`,uc(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},pc=e=>{let t=(0,Q.c)(52),{open:n,onClose:r,contextDisplay:i,branchLabel:a,usageGroups:o,usageDisplayMode:s,isUsageLoading:c,timeFormatPreference:l,error:u,onRetry:d}=e,{t:f}=Te(),p=Z.useRef(null),[m,h]=Z.useState(n),[g,_]=Z.useState(!1),v,y;t[0]!==n||t[1]!==m?(v=()=>{if(n){h(!0),_(!1);return}if(!m)return;_(!0);let e=window.setTimeout(()=>{h(!1),_(!1)},140);return()=>window.clearTimeout(e)},y=[n,m],t[0]=n,t[1]=m,t[2]=v,t[3]=y):(v=t[2],y=t[3]),Z.useEffect(v,y);let b,x;if(t[4]!==r||t[5]!==n?(b=()=>{if(!n)return;let e=e=>{e.key===`Escape`&&r()};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},x=[r,n],t[4]=r,t[5]=n,t[6]=b,t[7]=x):(b=t[6],x=t[7]),Z.useEffect(b,x),!m)return null;let S;t[8]===f?S=t[9]:(S=f(`mobile.surface.closeAria`),t[8]=f,t[9]=S);let C;t[10]===r?C=t[11]:(C=e=>{e.preventDefault(),r()},t[10]=r,t[11]=C);let w;t[12]!==S||t[13]!==C?(w=(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":S,onPointerDown:C}),t[12]=S,t[13]=C,t[14]=w):w=t[14];let T;t[15]===f?T=t[16]:(T=f(`mobile.header.openMetadataAria`),t[15]=f,t[16]=T);let E=g&&`pointer-events-none`,D;t[17]===E?D=t[18]:(D=Vt(`pointer-events-auto absolute inset-x-3 top-[calc(var(--yuri-safe-area-top,0px)+var(--yuri-mobile-detail-navigation-height,3.5rem)+0.5rem)] overflow-x-hidden overflow-y-auto overscroll-contain rounded-[20px] yuri-mobile-overlay-surface yuri-mobile-overlay-surface--translucent p-2 will-change-transform`,E),t[17]=E,t[18]=D);let O=`${g?`session-metadata-out`:`session-metadata-in`} ${g?140:170}ms cubic-bezier(0.32, 0.72, 0, 1) forwards`,k;t[19]===O?k=t[20]:(k={animation:O,maxHeight:`min(72dvh, calc(100dvh - var(--yuri-safe-area-top, 0px) - var(--yuri-mobile-detail-navigation-height, 3.5rem) - 1rem))`},t[19]=O,t[20]=k);let A;t[21]===f?A=t[22]:(A=f(`mobile.header.metadata.branch`),t[21]=f,t[22]=A);let j;t[23]!==a||t[24]!==A?(j=(0,$.jsx)(dc,{iconName:`git-branch`,label:A,children:a}),t[23]=a,t[24]=A,t[25]=j):j=t[25];let M;t[26]!==i||t[27]!==f?(M=i?(0,$.jsx)(dc,{iconNode:(0,$.jsx)(Xs,{percentage:i.percentage,pending:i.pending}),label:f(`mobile.header.metadata.context`),children:(0,$.jsxs)(`span`,{className:`inline-flex items-baseline gap-1.5 tabular-nums`,children:[(0,$.jsx)(`span`,{className:Vt(`font-semibold`,i.colorClass),children:i.pending?f(`contextUsage.pending`):`${i.percentage.toFixed(1)}%`}),(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:i.tokens})]})}):null,t[26]=i,t[27]=f,t[28]=M):M=t[28];let N;t[29]!==c||t[30]!==l||t[31]!==s||t[32]!==o?(N=(0,$.jsx)(fc,{groups:o,displayMode:s,isLoading:c,timeFormatPreference:l}),t[29]=c,t[30]=l,t[31]=s,t[32]=o,t[33]=N):N=t[33];let P;t[34]!==u||t[35]!==d||t[36]!==f?(P=u?(0,$.jsxs)(`div`,{role:`alert`,className:`px-2.5 py-2 typography-ui-label text-[var(--status-error)]`,children:[u,(0,$.jsx)(Y,{variant:`ghost`,size:`sm`,onClick:d,children:f(`contextPanel.preview.actions.retry`)})]}):null,t[34]=u,t[35]=d,t[36]=f,t[37]=P):P=t[37];let F;t[38]!==j||t[39]!==M||t[40]!==N||t[41]!==P?(F=(0,$.jsxs)(`div`,{className:`space-y-1`,children:[j,M,N,P]}),t[38]=j,t[39]=M,t[40]=N,t[41]=P,t[42]=F):F=t[42];let I;t[43]!==D||t[44]!==k||t[45]!==F||t[46]!==T?(I=(0,$.jsx)(`div`,{ref:p,role:`dialog`,"aria-label":T,className:D,style:k,onPointerDown:Rc,children:F}),t[43]=D,t[44]=k,t[45]=F,t[46]=T,t[47]=I):I=t[47];let L;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,$.jsx)(`style`,{children:`
3
- @keyframes session-metadata-in {
4
- from { opacity: 0; transform: translateY(-8px) scale(0.985); }
5
- to { opacity: 1; transform: translateY(0) scale(1); }
6
- }
7
- @keyframes session-metadata-out {
8
- from { opacity: 1; transform: translateY(0) scale(1); }
9
- to { opacity: 0; transform: translateY(-6px) scale(0.985); }
10
- }
11
- `}),t[48]=L):L=t[48];let R;return t[49]!==I||t[50]!==w?(R=(0,$.jsxs)(`div`,{className:`fixed inset-0 z-40 pointer-events-none`,children:[w,I,L]}),t[49]=I,t[50]=w,t[51]=R):R=t[51],R};function mc(e){let t=(0,Q.c)(9),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r=U(),i=rt(hc);if(r?.entry.location.hostId){let e=i?.location.hubId===r.entry.location.hubId&&i.location.hostId===r.entry.location.hostId&&i.location.directory===r.entry.location.directory?i.sessionId:null,a=`${r.entry.key}:${e??``}`,o=e??``,s;return t[2]!==r.entry||t[3]!==n||t[4]!==a||t[5]!==o?(s=(0,$.jsx)(Ic,{...n,sessionId:o,entry:r.entry},a),t[2]=r.entry,t[3]=n,t[4]=a,t[5]=o,t[6]=s):s=t[6],s}let a;return t[7]===n?a=t[8]:(a=(0,$.jsx)(gc,{...n}),t[7]=n,t[8]=a),a}function hc(e){return e.remoteSession}function gc(e){let t=(0,Q.c)(86),{sessionId:n,open:r,onOpenChange:i}=e,{t:a}=Te(),{git:o}=ce(),[s,c]=Z.useState(!1),l=r!==void 0,u=l?r:s,d=n.length===0,f;t[0]!==l||t[1]!==i||t[2]!==u?(f=e=>{let t=typeof e==`function`?e(u):e;l||c(t),i?.(t)},t[0]=l,t[1]=i,t[2]=u,t[3]=f):f=t[3];let p=q(f),m=O(Mc),h;t[4]===n?h=t[5]:(h=e=>n?e.getDirectoryForSession(n):null,t[4]=n,t[5]=h);let g=Tt(h)||m,_;t[6]===g?_=t[7]:(_=sc(g)||null,t[6]=g,t[7]=_);let v=_,y=Ft(n,g||void 0),b=Ar(v),x=Or(v),S=Dr(jc),C=Dr(Ac),w=xt(kc),T=xt(Oc),E=xt(Dc),D=xt(Ec),k;t[8]===n?k=t[9]:(k=e=>n?e.sessionModelSelections.get(n)??null:null,t[8]=n,t[9]=k);let A=lt(k),j=oi(Tc),M=oi(wc),N=oi(Cc),P=oi(Sc),F=oi(xc),I=oi(bc),L=ge(yc);mi();let R;t[10]===p?R=t[11]:(R=()=>{p(!1)},t[10]=p,t[11]=R);let ee;t[12]!==g||t[13]!==n?(ee=[n,g],t[12]=g,t[13]=n,t[14]=ee):ee=t[14],Z.useEffect(R,ee);let z,B;t[15]!==S||t[16]!==o||t[17]!==v?(z=()=>{v&&S(v,o)},B=[S,o,v],t[15]=S,t[16]=o,t[17]=v,t[18]=z,t[19]=B):(z=t[18],B=t[19]),Z.useEffect(z,B);let V,te;t[20]!==C||t[21]!==o||t[22]!==v?(te=()=>{if(v)return Nt.onGitRefreshHint(e=>{sc(e.directory)===v&&C(v,o)})},V=[C,o,v],t[20]=C,t[21]=o,t[22]=v,t[23]=V,t[24]=te):(V=t[23],te=t[24]),Z.useEffect(te,V);let ne,re;t[25]===M?(ne=t[26],re=t[27]):(ne=()=>{M()},re=[M],t[25]=M,t[26]=ne,t[27]=re),Z.useEffect(ne,re);let H,ie;t[28]===F?(H=t[29],ie=t[30]):(H=()=>{Nr(F)},ie=[F],t[28]=F,t[29]=H,t[30]=ie),Z.useEffect(H,ie);let U,ae;t[31]===u?(U=t[32],ae=t[33]):(U=()=>{!u||oi.getState().isLoading||oi.getState().fetchAllQuotas()},ae=[u],t[31]=u,t[32]=U,t[33]=ae),Z.useEffect(U,ae);let oe;t[34]===y?oe=t[35]:(oe=oc(y),t[34]=y,t[35]=oe);let se=oe,le;t[36]!==E||t[37]!==T||t[38]!==se||t[39]!==A?(le=se??(A?{providerID:A.providerId,modelID:A.modelId}:null)??(T&&E?{providerID:T,modelID:E}:null),t[36]=E,t[37]=T,t[38]=se,t[39]=A,t[40]=le):le=t[40];let W=le,ue;if(t[41]!==D||t[42]!==W||t[43]!==w){let e=(W?w.find(e=>e.id===W.providerID):void 0)?.models.find(e=>e.id===W?.modelID),n;t[45]!==D||t[46]!==W?(n=W?D(W.providerID,W.modelID):void 0,t[45]=D,t[46]=W,t[47]=n):n=t[47];let r=n;ue=nc(e?.limit,`context`)??r?.limit?.context??0,t[41]=D,t[42]=W,t[43]=w,t[44]=ue}else ue=t[44];let G=ue,de=Pt(n,G,0,g||void 0),K=de?.pending?null:de?.totalTokens??0,fe;t[48]!==G||t[49]!==d||t[50]!==K?(fe=ac({totalTokens:K,contextLimit:G,isDraft:d}),t[48]=G,t[49]=d,t[50]=K,t[51]=fe):fe=t[51];let pe=fe,me;t[52]!==x?.current||t[53]!==b||t[54]!==a?(me=b===!0?x?.current?.trim()||a(`gitView.branch.detachedHead`):a(`common.unavailable`),t[52]=x?.current,t[53]=b,t[54]=a,t[55]=me):me=t[55];let J=me,he=cc(j,F,I),_e,ve;t[56]!==u||t[57]!==he?(_e=()=>{!u||he.length===0||Nr(he.map(vc))},ve=[u,he],t[56]=u,t[57]=he,t[58]=_e,t[59]=ve):(_e=t[58],ve=t[59]),Z.useEffect(_e,ve);let ye;t[60]===p?ye=t[61]:(ye=()=>{p(_c)},t[60]=p,t[61]=ye);let be=q(ye),xe;t[62]===p?xe=t[63]:(xe=()=>{p(!1)},t[62]=p,t[63]=xe);let Se=q(xe),Ce;t[64]===a?Ce=t[65]:(Ce=a(`mobile.header.openMetadataAria`),t[64]=a,t[65]=Ce);let we=pe?.percentage??0,Ee=pe?.pending,De;t[66]!==we||t[67]!==Ee?(De=(0,$.jsx)(Xs,{percentage:we,pending:Ee}),t[66]=we,t[67]=Ee,t[68]=De):De=t[68];let Oe;t[69]!==be||t[70]!==u||t[71]!==Ce||t[72]!==De?(Oe=(0,$.jsx)(`span`,{className:`inline-flex`,children:(0,$.jsx)(Y,{type:`button`,variant:`mobileGlass`,size:`mobileIcon`,"aria-label":Ce,"aria-expanded":u,onClick:be,children:De})}),t[69]=be,t[70]=u,t[71]=Ce,t[72]=De,t[73]=Oe):Oe=t[73];let ke;t[74]!==J||t[75]!==pe||t[76]!==Se||t[77]!==N||t[78]!==u||t[79]!==P||t[80]!==L||t[81]!==he?(ke=(0,$.jsx)(pc,{open:u,onClose:Se,contextDisplay:pe,branchLabel:J,usageGroups:he,usageDisplayMode:P,isUsageLoading:N,timeFormatPreference:L}),t[74]=J,t[75]=pe,t[76]=Se,t[77]=N,t[78]=u,t[79]=P,t[80]=L,t[81]=he,t[82]=ke):ke=t[82];let Ae;return t[83]!==Oe||t[84]!==ke?(Ae=(0,$.jsxs)($.Fragment,{children:[Oe,ke]}),t[83]=Oe,t[84]=ke,t[85]=Ae):Ae=t[85],Ae}function _c(e){return!e}function vc(e){return e.providerId}function yc(e){return e.timeFormatPreference}function bc(e){return e.selectedModels}function xc(e){return e.dropdownProviderIds}function Sc(e){return e.displayMode}function Cc(e){return e.isLoading}function wc(e){return e.loadSettings}function Tc(e){return e.results}function Ec(e){return e.getModelMetadata}function Dc(e){return e.currentModelId}function Oc(e){return e.currentProviderId}function kc(e){return e.providers}function Ac(e){return e.fetchStatus}function jc(e){return e.ensureStatus}function Mc(e){return e.currentDirectory}var Nc=[],Pc={},Fc=[],Ic=Z.memo(function(e){let t=(0,Q.c)(113),{entry:n,sessionId:r,open:i,onOpenChange:a}=e,{t:o}=Te(),[s,c]=Z.useState(!1),u=i??s,d;t[0]!==i||t[1]!==a?(d=e=>{i===void 0&&c(e),a?.(e)},t[0]=i,t[1]=a,t[2]=d):d=t[2];let f=q(d),p=ge(zc),m=Z.useSyncExternalStore(P,N,N),h;t[3]===n.location?h=t[4]:(h=M(n.location),t[3]=n.location,t[4]=h);let g=h,_;t[5]!==n.location||t[6]!==g||t[7]!==r?(_=g&&r?L(n.location,r):null,t[5]=n.location,t[6]=g,t[7]=r,t[8]=_):_=t[8];let v;t[9]!==m||t[10]!==_?(v={revision:m,scope:_},t[9]=m,t[10]=_,t[11]=v):v=t[11];let y=v.scope,b;t[12]!==g||t[13]!==y?(b=e=>g&&y?g.subscribe(y,e):Bc,t[12]=g,t[13]=y,t[14]=b):b=t[14];let x=b,S;t[15]!==g||t[16]!==y?(S=()=>g&&y?g.getTranscript(y):null,t[15]=g,t[16]=y,t[17]=S):S=t[17];let C=S,w=Z.useSyncExternalStore(x,C,C),T;t[18]!==n.location||t[19]!==r?(T=e=>e.getSessionModelSelection(r||`remote-new-session`,n.location),t[18]=n.location,t[19]=r,t[20]=T):T=t[20];let E=lt(T),D;t[21]===n?D=t[22]:(D=We(n.location.directory,l(),n),t[21]=n,t[22]=D);let O;t[23]!==u||t[24]!==D?(O={...D,enabled:u,gcTime:1/0},t[23]=u,t[24]=D,t[25]=O):O=t[25];let k=re(O,W),A;t[26]===n?A=t[27]:(A=Qs(n),t[26]=n,t[27]=A);let F;t[28]!==u||t[29]!==A?(F={...A,enabled:u},t[28]=u,t[29]=A,t[30]=F):F=t[30];let I=re(F,W),R;t[31]===n?R=t[32]:(R=$s(n),t[31]=n,t[32]=R);let z;t[33]!==u||t[34]!==R?(z={...R,enabled:u},t[33]=u,t[34]=R,t[35]=z):z=t[35];let B=re(z,W),V=u&&B.data?.autoRefresh?B.data.refreshIntervalMs:!1;B.data?.providerIds;let ne;t[36]!==n||t[37]!==u||t[38]!==V||t[39]!==B.data?.providerIds?(ne=u?(B.data?.providerIds??Fc).filter(Vc).map(e=>({...ec(n,e),refetchInterval:V})):[],t[36]=n,t[37]=u,t[38]=V,t[39]=B.data?.providerIds,t[40]=ne):ne=t[40];let H=ne,ie;t[41]===H?ie=t[42]:(ie={queries:H},t[41]=H,t[42]=ie);let U=te(ie,W),ae;t[43]===n?ae=t[44]:(ae=tc(n),t[43]=n,t[44]=ae);let oe;t[45]!==u||t[46]!==B.data?.providerIds?(oe=u&&!!B.data?.providerIds.some(Hc),t[45]=u,t[46]=B.data?.providerIds,t[47]=oe):oe=t[47];let se;t[48]!==V||t[49]!==ae||t[50]!==oe?(se={...ae,enabled:oe,refetchInterval:V},t[48]=V,t[49]=ae,t[50]=oe,t[51]=se):se=t[51];let ce=re(se,W),le;t[52]!==ce.data||t[53]!==u||t[54]!==U?(le=u?[...U.flatMap(Uc),...ce.data??Nc]:Nc,t[52]=ce.data,t[53]=u,t[54]=U,t[55]=le):le=t[55];let ue=le,G=u?B.data?.providerIds??Fc:Fc,de=cc(ue,G,B.data?.selectedModels??Pc),K;bb0:{if(!w){K=null;break bb0}for(let e=w.messageOrder.length-1;e>=0;e--){let t=w.messagesByID[w.messageOrder[e]];if(!t)continue;let n=ee([t],e=>w.partsByMessageID[e]);if(n){K=n;break bb0}}K=null}let fe=K,pe=fe&&`messageId`in fe&&w?w.messagesByID[fe.messageId]:void 0,me;if(t[56]!==fe||t[57]!==pe?.modelID||t[58]!==pe?.providerID||t[59]!==k.data?.providers||t[60]!==E?.modelId||t[61]!==E?.providerId||t[62]!==r){let e=k.data?.providers.find(e=>e.id===(E?.providerId??pe?.providerID))?.models[E?.modelId??pe?.modelID??``],n=j(fe,e?.limit?.context??0,e?.limit?.output??0);me=ac({totalTokens:!n||n.pending?null:n.totalTokens,contextLimit:n?.contextLimit??0,isDraft:!r}),t[56]=fe,t[57]=pe?.modelID,t[58]=pe?.providerID,t[59]=k.data?.providers,t[60]=E?.modelId,t[61]=E?.providerId,t[62]=r,t[63]=me}else me=t[63];let J=me,he;t[64]!==I.error||t[65]!==ce||t[66]!==k.error||t[67]!==U||t[68]!==B.error?(he=I.error??B.error??k.error??ce.error??U.find(Wc)?.error,t[64]=I.error,t[65]=ce,t[66]=k.error,t[67]=U,t[68]=B.error,t[69]=he):he=t[69];let _e=he,ve;t[70]===f?ve=t[71]:(ve=()=>f(!1),t[70]=f,t[71]=ve);let ye=q(ve),be;t[72]!==u||t[73]!==f?(be=()=>f(!u),t[72]=u,t[73]=f,t[74]=be):be=t[74];let xe=q(be),Se;t[75]!==I||t[76]!==ce||t[77]!==k||t[78]!==U||t[79]!==B||t[80]!==G?(Se=()=>{I.refetch(),B.refetch(),k.refetch(),G.some(Gc)&&ce.refetch();for(let e of U)e.refetch()},t[75]=I,t[76]=ce,t[77]=k,t[78]=U,t[79]=B,t[80]=G,t[81]=Se):Se=t[81];let Ce=q(Se),we;t[82]===o?we=t[83]:(we=o(`mobile.header.openMetadataAria`),t[82]=o,t[83]=we);let Ee=J?.percentage??0,De=J?.pending,Oe;t[84]!==Ee||t[85]!==De?(Oe=(0,$.jsx)(Xs,{percentage:Ee,pending:De}),t[84]=Ee,t[85]=De,t[86]=Oe):Oe=t[86];let ke;t[87]!==u||t[88]!==we||t[89]!==Oe||t[90]!==xe?(ke=(0,$.jsx)(`span`,{className:`inline-flex`,children:(0,$.jsx)(Y,{type:`button`,variant:`mobileGlass`,size:`mobileIcon`,"aria-label":we,"aria-expanded":u,onClick:xe,children:Oe})}),t[87]=u,t[88]=we,t[89]=Oe,t[90]=xe,t[91]=ke):ke=t[91];let Ae;t[92]!==I.data||t[93]!==o?(Ae=I.data?.isGitRepository?I.data.current?.trim()||o(`gitView.branch.detachedHead`):o(`common.unavailable`),t[92]=I.data,t[93]=o,t[94]=Ae):Ae=t[94];let je=B.data?.displayMode??`usage`,Me;t[95]!==ce||t[96]!==U||t[97]!==B.isFetching?(Me=B.isFetching||ce.isFetching||U.some(Kc),t[95]=ce,t[96]=U,t[97]=B.isFetching,t[98]=Me):Me=t[98];let Ne=_e?.message,Pe;t[99]!==ye||t[100]!==J||t[101]!==de||t[102]!==u||t[103]!==Ce||t[104]!==Ae||t[105]!==je||t[106]!==Me||t[107]!==Ne||t[108]!==p?(Pe=(0,$.jsx)(pc,{open:u,onClose:ye,contextDisplay:J,branchLabel:Ae,usageGroups:de,usageDisplayMode:je,isUsageLoading:Me,timeFormatPreference:p,error:Ne,onRetry:Ce}),t[99]=ye,t[100]=J,t[101]=de,t[102]=u,t[103]=Ce,t[104]=Ae,t[105]=je,t[106]=Me,t[107]=Ne,t[108]=p,t[109]=Pe):Pe=t[109];let Fe;return t[110]!==ke||t[111]!==Pe?(Fe=(0,$.jsxs)($.Fragment,{children:[ke,Pe]}),t[110]=ke,t[111]=Pe,t[112]=Fe):Fe=t[112],Fe});function Lc(e){return e.window}function Rc(e){e.stopPropagation()}function zc(e){return e.timeFormatPreference}function Bc(){}function Vc(e){return!e.startsWith(`magpie:`)}function Hc(e){return e.startsWith(`magpie:`)}function Uc(e){return e.data?[e.data]:Nc}function Wc(e){return e.error}function Gc(e){return e.startsWith(`magpie:`)}function Kc(e){return e.isFetching}function qc(e){let t=(0,Q.c)(17),{scope:n,children:r}=e,{t:i}=Te();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)(st.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)(le,{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 Jc(e){let t=(0,Q.c)(58),{scope:n,onOpenSessions:r,menuOpen:i,onToggleMenu:a,surfaceShortcuts:o}=e,{t:s}=Te(),[c,l]=Z.useState(!1),u;t[0]===r?u=t[1]:(u=()=>{l(!1),r()},t[0]=r,t[1]=u);let d=q(u),f;t[2]===a?f=t[3]:(f=()=>{l(!1),a()},t[2]=a,t[3]=f);let p=q(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=q(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)(Y,{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)(mc,{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)(Y,{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)(Y,{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)(Y,{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)(Ys,{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)(qc,{scope:n,children:I}),t[55]=n,t[56]=I,t[57]=L):L=t[57],L}var Yc=`/assets/android-direct-share-1a0lp154.jpg`,Xc=`/assets/ios-share-sheet-B3Dlufnc.jpg`,Zc=`/assets/select-assistant-C89IRspC.jpg`,Qc=`yuri:assistant-share-welcome:v1`,$c=[{image:Xc,titleKey:`assistants.shareWelcome.example.chat.title`,descriptionKey:`assistants.shareWelcome.example.chat.description`},{image:Yc,titleKey:`assistants.shareWelcome.example.article.title`,descriptionKey:`assistants.shareWelcome.example.article.description`},{image:Zc,titleKey:`assistants.shareWelcome.example.note.title`,descriptionKey:`assistants.shareWelcome.example.note.description`}],el=e=>{let t=(0,Q.c)(40),{enabled:n,open:r,onOpenChange:i}=e,a=n!==void 0&&n,{t:o}=Te(),[s,c]=fe(Qc,!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=q(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)(cn,{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)(ln,{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)(an,{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=$c.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)(on,{className:`border-t border-border px-5 py-4 sm:px-8 sm:py-5`,children:(0,$.jsxs)(Y,{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)(sn,{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)(un,{open:u,onOpenChange:p,children:E}),t[36]=u,t[37]=E,t[38]=p,t[39]=D):D=t[39],D},tl=me(`YuriNativeHeader`),nl=`header.yuri-mobile-detail-navigation, header.yuri-mobile-header`,rl=`yuri-native-header-source`,il=`yuri-native-header-ready`,al=new Set([il,`yuri-keyboard-open`,`yuri-kb-animating`,`yuri-kb-hide`,`yuri-kb-caret-hold`]),ol=`--yuri-native-viewport-top`,sl=`.fixed, [role="dialog"]`,cl=new Set([`style`,`data-yuri-header-collapse-phase`,`data-yuri-header-collapse-rest`]),ll=()=>parseFloat(document.documentElement.style.getPropertyValue(`--yuri-native-viewport-top`))||0,ul=`[data-avatar-motion]`,dl=new Set([`class`,`style`,`inert`,`aria-hidden`,`hidden`]),fl=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-ll();return e.dataset.yuriCollapsibleHeader===`true`||Math.abs(n)<=1},pl=(e,t)=>{let n=[...document.querySelectorAll(nl)].filter(fl);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},ml=()=>{let e=[];for(let t of document.styleSheets)try{for(let n of t.cssRules)e.push(n.cssText)}catch{}return e.join(`
12
- `)},hl=()=>{let e=0;for(let t of document.styleSheets)try{e+=t.cssRules.length}catch{}return`${document.styleSheets.length}:${e}`},gl=tl,_l=()=>new Promise(e=>{requestAnimationFrame(()=>requestAnimationFrame(()=>e(1)))});function vl(){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(il),u&&(u=!1,o=``,tl.update({seq:++r,visible:!1}).catch(()=>void 0))},h=()=>{if(i=0,n)return;let t=pl(a,d);if(t!==a){if(a?.classList.remove(rl),m(),a=t,l=``,!t)return;t.classList.add(rl),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(sl)===null?Math.ceil(Math.max(h,g)*f):_,y=(h+2*(parseFloat(getComputedStyle(e).fontSize)||16))*f,b=t.cloneNode(!0);b.classList.remove(rl),b.style.removeProperty(pn),delete b.dataset.yuriHeaderCollapsePhase,delete b.dataset.yuriHeaderCollapseRest;for(let e of b.querySelectorAll(sl))e.style.display=`none`;let x=b.outerHTML,S=[...e.classList].filter(e=>!al.has(e)).join(` `),C=(e.getAttribute(`style`)??``).replace(RegExp(`${ol}\\s*:[^;]*;?`,`g`),``),w=document.body.className,T=`${x}|${S}|${C}|${w}|${v}|${y}`,E=hl(),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=ml()),D!==c&&(c=D,O.sprite=D),u=!0,tl.update(O).catch(()=>void 0)},g=()=>{!i&&!n&&(i=requestAnimationFrame(h))};f.push(tl.addListener(`shown`,t=>{d&&t.seq===r&&a&&e.classList.add(il)})),f.push(tl.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`&&cl.has(n.attributeName??``)){p();continue}let e=n.target instanceof Element?n.target:n.target.parentElement;if(!(e?.closest(ul)&&a.contains(e))){if(a.contains(n.target)||n.type===`attributes`&&n.target.contains(a))t=!0;else if(n.type===`attributes`&&dl.has(n.attributeName??``)&&n.target instanceof Element&&n.target.querySelector(nl))t=!0;else if(n.type===`childList`)for(let e of n.addedNodes)e instanceof Element&&(e.matches(nl)||e.querySelector(nl))&&(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(ol,`${Math.max(0,t)}px`),_l());let b=window;return b.__yuriNativeHeader=t=>(d=t,e.classList.toggle(il,t&&a!==null),_l()),()=>{n=!0,delete b.__yuriNativeHeader,i&&cancelAnimationFrame(i),_.disconnect(),v.disconnect(),y.disconnect(),window.removeEventListener(`resize`,g),delete t.__yuriImeOffset,e.classList.remove(il),a?.classList.remove(rl),a=null;for(let e of f)e.then(e=>e.remove()).catch(()=>void 0);tl.update({seq:++r,visible:!1}).catch(()=>void 0)}}var yl=`.yuri-mobile-composer`,bl=`[data-btw-composer]`;function xl(e,t){if(!e)return!1;let n=t;return!n||typeof n.closest!=`function`||!n.closest(bl)}function Sl(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.closest==`function`&&!!t.closest(yl)}function Cl(e){return Sl(e??null)}var wl=e=>(e||``).replace(/\\/g,`/`).replace(/\/+$/g,``),Tl=e=>{let t=e.index?.trim();return!!(t&&t!==`?`)},El=e=>{let t=e.working_dir?.trim(),n=e.index?.trim();return!!(t||n===`?`)},Dl=(e,t)=>t?`${e}\u0000staged`:e,Ol=({onClose:e,initialDiffPath:t,initialDiffStaged:n=!1,initialDiffTargetLine:r=null,hideDiffHeader:i=!1})=>{let{t:a}=Te(),{git:o,projectScope:s}=ri(),{generateCommitMessage:c,stageGitFile:l,stageGitFiles:u,unstageGitFile:d,unstageGitFiles:f}=aa(),p=ii(),m=s?p??null:wl(p??null),h=Jn(m||null),g=mn(m||null),_=kn(m||null),v=jn(e=>e.setActiveDirectory),y=jn(e=>e.ensureAll),b=jn(e=>e.fetchStatus),x=jn(e=>e.fetchBranches),S=jn(e=>e.prefetchDiffs),C=jn(e=>e.getDiff),w=jn(e=>e.setDiff),[T,E]=Z.useState(()=>t?{type:`diff`,path:t,staged:n,targetLine:r}:{type:`list`}),D=Z.useRef(null);Z.useEffect(()=>{t&&E(e=>e.type===`diff`&&e.path===t&&e.staged===n&&e.targetLine===r?e:{type:`diff`,path:t,staged:n,targetLine:r})},[t,n,r]);let[O,k]=Z.useState(null),[A,j]=Z.useState(null),[M,N]=Z.useState(``),[P,F]=Z.useState(new Set),[I,L]=Z.useState(!1),[R,ee]=Z.useState(!1),[z,B]=Z.useState([]),[V,te]=Z.useState([]),[ne,re]=Z.useState([]),[H,ie]=Z.useState(null),[U,ae]=Z.useState({key:null,loading:!1,error:null,resolved:!1}),[oe,se]=Z.useState(0),ce=Z.useRef({key:null,generation:0}),[le,W]=Z.useState(!1),ue=Ba(h)&&!le,G=Z.useMemo(()=>{let e=h?.files??[];if(ue)return[];let t=new Map;for(let n of e)t.set(n.path,n);return Array.from(t.values()).sort((e,t)=>e.path.localeCompare(t.path))},[h?.files,ue]),de=Z.useMemo(()=>G.filter(Tl),[G]),K=Z.useMemo(()=>G.filter(El),[G]),{deferredStagedCount:fe,deferredUnstagedCount:pe}=Z.useMemo(()=>{if(!ue||!h)return{deferredStagedCount:0,deferredUnstagedCount:0};let e=0,t=0;for(let n of h.files??[])Tl(n)&&(e+=1),El(n)&&(t+=1);return{deferredStagedCount:e,deferredUnstagedCount:t}},[ue,h]),me=Z.useMemo(()=>{if(ne.length>0)return ne;let e=h?.tracking?.includes(`/`)?h.tracking.split(`/`)[0]:null;return e||H?[{name:e||`origin`,fetchUrl:H??``,pushUrl:H??``}]:[]},[H,ne,h?.tracking]),J=Z.useMemo(()=>e=>!m||T.type!==`diff`?null:e.directories.get(m)?.diffCache.get(Dl(T.path,T.staged))??null,[m,T]),he=jn(J),ge=Z.useMemo(()=>T.type===`diff`?G.find(e=>e.path===T.path)??null:null,[G,T]),_e=T.type===`diff`&&m?`${m}\u0000${Dl(T.path,T.staged)}`:null,ve=U.key===_e,ye=!!(_e&&!he&&(!ve||U.loading)),be=ve?U.error:null,xe=!!(ge||ve&&U.resolved),Se=q(async(e,t=!0)=>{try{await Promise.all([b(e,o),x(e,o)])}catch(e){t&&Ke.error(e instanceof Error?e.message:a(`gitView.toast.refreshRepositoryFailed`))}}),Ce=q(async(e,t,n)=>{let r=()=>ce.current.key===t&&ce.current.generation===n;try{let[t,n]=await Promise.all([o.getRemotes(e).catch(()=>[]),o.getRemoteUrl?o.getRemoteUrl(e).catch(()=>null):Promise.resolve(null)]);if(!r())return;re(t),ie(n)}catch{if(!r())return;re([]),ie(null)}}),we=q(e=>{if(e!==m)return{requestGeneration:null,promise:Promise.resolve()};let t=ce.current.generation+1;return ce.current={key:e,generation:t},{requestGeneration:t,promise:Ce(e,e,t)}});Z.useEffect(()=>{m&&(v(m),y(m,o))},[m,y,o,v]),Z.useEffect(()=>{if(!m){ce.current={key:null,generation:ce.current.generation+1},re([]),ie(null);return}let{requestGeneration:e,promise:t}=we(m);return()=>{e!==null&&ce.current.key===m&&ce.current.generation===e&&(ce.current={key:m,generation:e+1})}},[m,o,we]),Z.useEffect(()=>{if(!m||G.length===0)return;let e=Array.from(new Set([...de.map(e=>e.path),...V,...G.slice(0,20).map(e=>e.path)])).filter(Boolean);if(e.length===0)return;let t=window.setTimeout(()=>{S(m,o,e,{maxFiles:40})},120);return()=>window.clearTimeout(t)},[G,m,o,S,de,V]),Z.useEffect(()=>{if(T.type!==`diff`){ae({key:null,loading:!1,error:null,resolved:!1});return}let e=Dl(T.path,T.staged);if(!m||!_e){ae({key:null,loading:!1,error:null,resolved:!1});return}if(C(m,e)){ae(e=>({key:_e,loading:!1,error:null,resolved:e.key===_e&&e.resolved||!!ge}));return}let t=!1;return ae({key:_e,loading:!0,error:null,resolved:!1}),o.getGitFileDiff(m,{path:T.path,staged:T.staged||void 0}).then(n=>{t||(w(m,e,{original:n.original??``,modified:n.modified??``,isBinary:n.isBinary}),ae(e=>e.key===_e?{...e,loading:!1,error:null,resolved:!0}:e))}).catch(e=>{t||ae(t=>t.key===_e?{...t,loading:!1,error:e instanceof Error?e.message:String(e),resolved:!1}:t)}),()=>{t=!0}},[_e,m,oe,C,o,T,ge,w]);let Ee=async(e,t)=>{if(!m)return;let n=m;k(e);try{let r=e=>{let t=`${e.name}/`,n=h?.tracking?.startsWith(t)?h.tracking.slice(t.length):void 0;return{remote:e.name,branch:n,rebase:!0}};if(e===`fetch`){if(!t)throw Error(a(`mobile.changes.noRemote`));await o.gitFetch(n,{remote:t.name}),Ke.success(a(`gitView.toast.fetchedFromRemote`,{name:t.name}))}else if(e===`sync`){if(!t)throw Error(a(`mobile.changes.noRemote`));await o.gitFetch(n,{remote:t.name});let e=await o.getGitStatus(n);if((e.behind??0)>0){if((e.files?.length??0)>0){Ke.error(a(`gitView.toast.commitOrStashBeforeSync`));return}await o.gitPull(n,r(t))}((await o.getGitStatus(n)).ahead??0)>0&&await o.gitPush(n),Ke.success(a(`gitView.toast.alreadyUpToDate`))}await Se(n,!1),await we(n).promise}catch(e){Ke.error(e instanceof Error?e.message:a(`gitView.toast.syncActionFailed`,{action:a(`gitView.sync.syncChanges`)}))}finally{k(null)}},De=q(async(e,t)=>{if(!m||e.length===0)return;let n=m;try{t===`stage`?e.length>1?await u(n,e):await l(n,e[0]):e.length>1?await f(n,e):await d(n,e[0]),await Se(n,!1)}catch(e){Ke.error(e instanceof Error?e.message:a(t===`stage`?`gitView.toast.stageFileFailed`:`gitView.toast.unstageFileFailed`))}}),Oe=q((e,t=!1)=>{E({type:`diff`,path:e,staged:t,targetLine:null})}),ke=q(()=>T.type===`diff`&&(E({type:`list`}),!0));zr({id:`mobile-changes-diff`,active:T.type===`diff`&&!i,layer:`overlay`,onBack:ke,surfaceRef:D});let Ae=q(async e=>{if(!m)return;let t=m;F(t=>new Set(t).add(e));try{await o.revertGitFile(t,e),Ke.success(a(`gitView.toast.revertedFile`,{path:e})),await Se(t,!1)}catch(e){Ke.error(e instanceof Error?e.message:a(`gitView.toast.revertFailed`))}finally{F(t=>{let n=new Set(t);return n.delete(e),n})}}),je=q(async e=>{if(!m||e.length===0||I)return;let t=m,n=Array.from(new Set(e));L(!0),F(new Set(n));try{await Promise.all(n.map(e=>o.revertGitFile(t,e))),await Se(t,!1),Ke.success(n.length===1?a(`gitView.toast.revertedFilesSingle`,{count:n.length}):a(`gitView.toast.revertedFilesPlural`,{count:n.length}))}catch(e){Ke.error(e instanceof Error?e.message:a(`gitView.toast.revertFailed`))}finally{F(new Set),L(!1)}}),Me=q(e=>{let t=e.map(e=>e.trim()).filter(Boolean);if(t.length===0){B([]);return}N(e=>`${e.trim()}${e.trim()?`
13
-
14
- `:``}${t.join(`
15
- `)}`.trim()),B([])}),Ne=q(async()=>{if(!m)return;let e=m,t=de.map(e=>e.path).sort();if(t.length===0){Ke.error(a(`gitView.toast.selectFileToDescribe`));return}ee(!0);try{let{message:n}=await c(e,t);N(n.subject?.trim()??``),B(Array.isArray(n.highlights)?n.highlights:[])}catch(e){Ke.error(e instanceof Error?e.message:a(`gitView.toast.generateCommitMessageFailed`))}finally{ee(!1)}}),Pe=async(e={})=>{if(!m)return;let t=m;if(!M.trim()){Ke.error(a(`gitView.toast.enterCommitMessage`));return}let n=de.map(e=>e.path).sort();if(n.length===0){Ke.error(a(`gitView.toast.selectFileToCommit`));return}j(e.pushAfter?`commitAndPush`:`commit`);try{if(await o.createGitCommit(t,M.trim(),{files:n}),Ke.success(a(`gitView.toast.commitCreated`)),N(``),B([]),e.pushAfter){let e=h?.tracking?.split(`/`)[0],n=me.find(t=>t.name===e)??me[0];if(!n)throw Error(a(`mobile.changes.noRemote`));k(`sync`);let r=`${n.name}/`,i=h?.tracking?.startsWith(r)?h.tracking.slice(r.length):void 0;await o.gitFetch(t,{remote:n.name}),((await o.getGitStatus(t)).behind??0)>0&&await o.gitPull(t,{remote:n.name,branch:i,rebase:!0}),((await o.getGitStatus(t)).ahead??0)>0&&await o.gitPush(t),await Se(t,!1),await we(t).promise}else await Se(t,!1)}catch(e){Ke.error(e instanceof Error?e.message:a(`gitView.toast.createCommitFailed`))}finally{j(null),e.pushAfter&&k(null)}},Fe=Z.useMemo(()=>{let e=[];return de.length>0&&e.push({id:`staged`,title:a(`gitView.changes.stagedTitle`),entries:de,actionSymbol:`-`,actionAllLabel:a(`gitView.changes.unstageAllAria`),getActionLabel:e=>a(`gitView.changes.unstageFileAria`,{path:e}),onActionFile:e=>void De([e],`unstage`),onActionAll:e=>void De(e,`unstage`),onViewDiff:e=>Oe(e,!0),onRevertFile:Ae,showRevertActions:!1,accent:!0}),K.length>0&&e.push({id:`unstaged`,title:a(`gitView.changes.title`),entries:K,actionSymbol:`+`,actionAllLabel:a(`gitView.changes.stageAllAria`),getActionLabel:e=>a(`gitView.changes.stageFileAria`,{path:e}),onActionFile:e=>void De([e],`stage`),onActionAll:e=>void De(e,`stage`),onViewDiff:e=>Oe(e,!1),onRevertFile:Ae}),e},[Ae,Oe,De,de,a,K]),Ie=t=>(0,$.jsxs)(`div`,{className:`flex h-full flex-col overflow-hidden bg-background text-foreground`,children:[i?null:(0,$.jsxs)(`header`,{className:`flex h-[var(--yuri-header-height,56px)] shrink-0 items-center gap-2 px-3 text-foreground`,children:[e?(0,$.jsx)(`button`,{type:`button`,className:`-ml-1 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":a(`mobile.surface.closeAria`),onClick:e,style:{touchAction:`manipulation`},children:(0,$.jsx)(X,{name:`close`,className:`size-5`})}):null,(0,$.jsxs)(`div`,{className:`min-w-0 flex-1 px-1`,children:[(0,$.jsx)(`h2`,{className:`typography-ui-label text-foreground`,children:a(`mobile.nav.changes`)}),(0,$.jsx)(`p`,{className:`truncate typography-micro text-muted-foreground`,children:h?.current||m||``})]})]}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1`,children:t})]});return m?_&&g===null?Ie((0,$.jsx)(kl,{loading:!0,message:a(`gitView.loading.checkingRepository`)})):g===!1?Ie((0,$.jsx)(kl,{icon:!0,message:a(`gitView.empty.notGitRepository`),description:a(`gitView.empty.notGitRepositoryDescription`)})):T.type===`diff`?(0,$.jsx)(`div`,{ref:D,className:`h-full min-h-0`,children:(0,$.jsx)(Al,{path:T.path,directory:m,diff:he,fileExists:xe,error:be,loading:ye,targetLine:T.targetLine,onBack:ke,onRetry:()=>se(e=>e+1),hideHeader:i})}):(0,$.jsxs)(`div`,{className:`flex h-full 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 px-3 text-foreground`,children:[e?(0,$.jsx)(`button`,{type:`button`,className:`-ml-1 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":a(`mobile.surface.closeAria`),onClick:e,style:{touchAction:`manipulation`},children:(0,$.jsx)(X,{name:`close`,className:`size-5`})}):null,(0,$.jsxs)(`div`,{className:`min-w-0 flex-1 px-1`,children:[(0,$.jsx)(`h2`,{className:`typography-ui-label text-foreground`,children:a(`mobile.nav.changes`)}),(0,$.jsx)(`p`,{className:`truncate typography-micro text-muted-foreground`,children:h?.current||m})]}),(0,$.jsx)(Fa,{syncAction:O,remotes:me,onSync:e=>void Ee(`sync`,e),disabled:A!==null||_,aheadCount:h?.ahead??0,behindCount:h?.behind??0,trackingRemoteName:h?.tracking?.split(`/`)[0],hasUncommittedChanges:(h?.files?.length??0)>0})]}),ue?(0,$.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,$.jsx)(ua,{stagedCount:fe,unstagedCount:pe,onLoad:()=>W(!0)})}):G.length>0?(0,$.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden px-4 pt-4`,children:(0,$.jsx)(Oa,{groups:Fe,diffStats:h?.diffStats,revertingPaths:P,onRevertAll:je,isRevertingAll:I,headerBackgroundClassName:`bg-transparent`,onVisiblePathsChange:te})}),(0,$.jsx)(`div`,{className:`shrink-0 border-t border-border/50 px-4 pb-4 pt-3`,children:(0,$.jsx)(Na,{stagedCount:de.length,commitMessage:M,onCommitMessageChange:N,generatedHighlights:z,onInsertHighlights:Me,onGenerateMessage:Ne,isGeneratingMessage:R,onCommit:()=>void Pe({pushAfter:!1}),onCommitAndPush:()=>void Pe({pushAfter:!0}),commitAction:A,gitmojiEnabled:!1,onOpenGitmojiPicker:()=>{}})})]}):(0,$.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,$.jsx)(kl,{icon:!0,message:a(`gitView.empty.cleanTitle`),description:a(`mobile.changes.cleanDescription`)})})]}):Ie((0,$.jsx)(kl,{message:a(`gitView.empty.selectSessionOrDirectory`)}))},kl=e=>{let t=(0,Q.c)(13),{message:n,description:r,loading:i,icon:a}=e,o=i!==void 0&&i,s=a!==void 0&&a,c;t[0]===o?c=t[1]:(c=o?(0,$.jsx)(X,{name:`loader-4`,className:`size-5 animate-spin text-muted-foreground`}):null,t[0]=o,t[1]=c);let l;t[2]===s?l=t[3]:(l=s?(0,$.jsx)(X,{name:`git-branch`,className:`size-6 text-muted-foreground`}):null,t[2]=s,t[3]=l);let u;t[4]===n?u=t[5]:(u=(0,$.jsx)(`p`,{className:`typography-ui-label font-semibold text-foreground`,children:n}),t[4]=n,t[5]=u);let d;t[6]===r?d=t[7]:(d=r?(0,$.jsx)(`p`,{className:`typography-meta text-muted-foreground`,children:r}):null,t[6]=r,t[7]=d);let f;return t[8]!==c||t[9]!==l||t[10]!==u||t[11]!==d?(f=(0,$.jsx)(`div`,{className:`flex h-full items-center justify-center px-6 text-center`,children:(0,$.jsxs)(`div`,{className:`flex max-w-sm flex-col items-center gap-2`,children:[c,l,u,d]})}),t[8]=c,t[9]=l,t[10]=u,t[11]=d,t[12]=f):f=t[12],f},Al=e=>{let t=(0,Q.c)(26),{path:n,directory:r,diff:i,fileExists:a,error:o,loading:s,targetLine:c,onBack:l,onRetry:u,hideHeader:d}=e,f=d!==void 0&&d,{t:p}=Te(),m=ti(),h;t[0]===n?h=t[1]:(h=$t(n)||`text`,t[0]=n,t[1]=h);let g=h,_;t[2]!==r||t[3]!==m||t[4]!==n||t[5]!==p?(_=m?(0,$.jsx)(Y,{variant:`ghost`,size:`icon`,title:p(`diffView.actions.openFilePreview`),"aria-label":p(`diffView.actions.openFilePreview`),onClick:()=>m.openFile({path:de(r,n)}),children:(0,$.jsx)(X,{name:`eye`,className:`size-4`})}):null,t[2]=r,t[3]=m,t[4]=n,t[5]=p,t[6]=_):_=t[6];let v=_,y;t[7]!==f||t[8]!==l||t[9]!==n||t[10]!==v||t[11]!==p?(y=f?(0,$.jsx)(Cr,{children:v}):(0,$.jsxs)(`header`,{className:`flex h-[var(--yuri-header-height,56px)] shrink-0 items-center gap-3 border-b border-border/50 px-3 text-foreground`,children:[(0,$.jsx)(`button`,{type:`button`,className:`flex size-9 shrink-0 items-center justify-center rounded-lg text-muted-foreground hover:bg-interactive-hover hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary`,"aria-label":p(`header.actions.backAria`),onClick:l,children:(0,$.jsx)(X,{name:`arrow-left`,className:`size-5`})}),(0,$.jsx)(`div`,{className:`min-w-0 flex-1 px-2`,children:(0,$.jsx)(`h2`,{className:`truncate typography-ui-header text-foreground`,children:n})}),v]}),t[7]=f,t[8]=l,t[9]=n,t[10]=v,t[11]=p,t[12]=y):y=t[12];let b;t[13]!==i||t[14]!==o||t[15]!==a||t[16]!==g||t[17]!==s||t[18]!==u||t[19]!==n||t[20]!==p||t[21]!==c?(b=(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:o?(0,$.jsx)(`div`,{className:`flex h-full items-center justify-center px-6 text-center`,children:(0,$.jsxs)(`div`,{className:`flex max-w-sm flex-col items-center gap-3`,children:[(0,$.jsx)(`p`,{className:`typography-ui-label font-semibold text-foreground`,children:p(`mobile.changes.diffDetail.loadFailed`)}),(0,$.jsx)(`p`,{className:`typography-meta text-muted-foreground`,children:o}),(0,$.jsx)(Y,{type:`button`,size:`sm`,variant:`outline`,onClick:u,children:p(`diffView.actions.retry`)})]})}):s?(0,$.jsx)(kl,{loading:!0,message:p(`diffView.state.loadingDiff`)}):a?i?i.isBinary?(0,$.jsx)(kl,{icon:!0,message:p(`diffView.binary.unavailable`)}):en(n)?(0,$.jsx)(kl,{icon:!0,message:p(`mobile.changes.diffDetail.imageUnavailable`)}):(0,$.jsx)(Jr,{className:`h-full overflow-y-auto overflow-x-hidden p-3 pwa-overlay-scroll`,"data-diff-virtual-root":!0,"data-diff-virtual-content":!0,children:(0,$.jsx)(qi,{original:i.original,modified:i.modified,language:g,fileName:n,renderSideBySide:!1,wrapLines:!0,focusLine:c,layout:`inline`})}):(0,$.jsx)(kl,{loading:!0,message:p(`diffView.state.loadingDiff`)}):(0,$.jsx)(kl,{icon:!0,message:p(`mobile.changes.diffDetail.missingTitle`),description:p(`mobile.changes.diffDetail.missingDescription`)})}),t[13]=i,t[14]=o,t[15]=a,t[16]=g,t[17]=s,t[18]=u,t[19]=n,t[20]=p,t[21]=c,t[22]=b):b=t[22];let x;return t[23]!==y||t[24]!==b?(x=(0,$.jsxs)(`div`,{className:`flex h-full flex-col overflow-hidden bg-background text-foreground`,children:[y,b]}),t[23]=y,t[24]=b,t[25]=x):x=t[25],x},jl=e(C(),1),Ml=vr(()=>he(()=>import(`./ToolOutputDialog-BnOil_Y-.js`).then(e=>e.n),__vite__mapDeps([3,1,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,2,20,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]))),Nl=25e4,Pl=e=>(e||``).replace(/\\/g,`/`).replace(/\/+$/g,``),Fl=e=>{let t=Pl(e);return!t||t===`/`?t||`/`:t.split(`/`).filter(Boolean).at(-1)??t},Il=e=>{let t=Pl(e);if(!t||t===`/`)return null;let n=t.lastIndexOf(`/`);return n<=0?t.startsWith(`/`)?`/`:null:t.slice(0,n)},Ll=(e,t)=>{let n=Pl(e),r=Pl(t);return!r||n===r?Fl(n):n.startsWith(`${r}/`)?n.slice(r.length+1):n},Rl=e=>{if(typeof e!=`number`||!Number.isFinite(e)||e<0)return``;if(e<1024)return`${e} B`;let t=[`KB`,`MB`,`GB`],n=e/1024;for(let e of t){if(n<1024||e===t[t.length-1])return`${n.toFixed(n>=10?0:1)} ${e}`;n/=1024}return``},zl=e=>/\.(md|mdx|markdown)$/i.test(e),Bl=e=>{let t=(0,Q.c)(156),{onClose:n,initialFilePath:r,directFilePreview:i,hideFileHeader:a}=e,o=r===void 0?null:r,s=i!==void 0&&i,c=a!==void 0&&a,{t:l}=Te(),{files:u}=ri(),d=ii()??null,f;t[0]===d?f=t[1]:(f=Pl(d),t[0]=d,t[1]=f);let p=f,m;t[2]!==o||t[3]!==p?(m=()=>{let e=Pl(o);return e?{type:`file`,path:e,returnDirectory:Il(e)??p}:{type:`browser`,directory:p}},t[2]=o,t[3]=p,t[4]=m):m=t[4];let[h,g]=Z.useState(m),_=Z.useRef(null),[v,y]=Z.useState(``),b=ge(Jl),x=ge(Yl),S,C;t[5]===p?(S=t[6],C=t[7]):(S=()=>{p&&g(e=>e.type===`file`?e.returnDirectory?e:{...e,returnDirectory:Il(e.path)??p}:e.type===`browser`&&e.directory?e:{type:`browser`,directory:p})},C=[p],t[5]=p,t[6]=S,t[7]=C),Z.useEffect(S,C);let w,T;t[8]!==b||t[9]!==p||t[10]!==x?(T=()=>{if(!b||!p)return;let e=Pl(b);if(!e){x(null);return}y(``),g({type:`file`,path:e,returnDirectory:Il(e)??p}),x(null)},w=[b,p,x],t[8]=b,t[9]=p,t[10]=x,t[11]=w,t[12]=T):(w=t[11],T=t[12]),Z.useEffect(T,w);let E=h.type===`browser`?h.directory:h.returnDirectory,D=h.type===`browser`?h.directory:``,O=h.type===`file`?h.path:``,[k,A]=Z.useState(`preview`),j;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(j=()=>{A(`preview`)},t[13]=j):j=t[13];let M;t[14]===O?M=t[15]:(M=[O],t[14]=O,t[15]=M),Z.useEffect(j,M);let N=jr(v,250),P;t[16]===v?P=t[17]:(P=v.trim(),t[16]=v,t[17]=P);let F=P,I;t[18]===N?I=t[19]:(I=N.trim(),t[18]=N,t[19]=I);let L=I,R;t[20]!==D||t[21]!==p?(R={scopeDirectory:p,directory:D},t[20]=D,t[21]=p,t[22]=R):R=t[22];let ee=!!D,z;t[23]===ee?z=t[24]:(z={enabled:ee,refetchOnMount:`always`},t[23]=ee,t[24]=z);let B=H(R,z),V;t[25]!==D||t[26]!==L?(V={directory:D,query:L,maxResults:40},t[25]=D,t[26]=L,t[27]=V):V=t[27];let te=!!(D&&L),ne;t[28]===te?ne=t[29]:(ne={enabled:te},t[28]=te,t[29]=ne);let re=ue(V,ne),ie;t[30]===O?ie=t[31]:(ie=O&&(!en(O)||O.toLowerCase().endsWith(`.svg`)),t[30]=O,t[31]=ie);let U=!!ie,ae;t[32]!==O||t[33]!==p?(ae={scopeDirectory:p,path:O},t[32]=O,t[33]=p,t[34]=ae):ae=t[34];let ce;t[35]===U?ce=t[36]:(ce={enabled:U},t[35]=U,t[36]=ce);let le=se(ae,ce),W=U&&le.data?.isBinary===!0,G;t[37]!==O||t[38]!==le.data||t[39]!==le.error||t[40]!==le.isFetchedAfterMount||t[41]!==u||t[42]!==k||t[43]!==W?(G=O&&u.readFile&&le.data&&le.isFetchedAfterMount&&!le.error&&!W&&(!nn(O)||k===`source`)&&(!en(O)||O.toLowerCase().endsWith(`.svg`)),t[37]=O,t[38]=le.data,t[39]=le.error,t[40]=le.isFetchedAfterMount,t[41]=u,t[42]=k,t[43]=W,t[44]=G):G=t[44];let de=!!G,K;t[45]!==O||t[46]!==p?(K={scopeDirectory:p,path:O},t[45]=O,t[46]=p,t[47]=K):K=t[47];let fe;t[48]===de?fe=t[49]:(fe={enabled:de},t[48]=de,t[49]=fe);let pe=oe(K,fe),me=B.data?.entries.slice().sort(Xl)??[],J;t[50]!==B.error||t[51]!==l?(J=B.error?B.error instanceof Error?B.error.message:l(`mobile.files.error.listFailed`):null,t[50]=B.error,t[51]=l,t[52]=J):J=t[52];let he=J,_e=B.isFetching,ve;t[53]===re.data?ve=t[54]:(ve=re.data??[],t[53]=re.data,t[54]=ve);let ye=ve,be=!!(F&&L&&v===N&&re.isFetching),xe;t[55]!==pe.data||t[56]!==l?(xe=pe.data&&pe.data.length>Nl?`${pe.data.slice(0,Nl)}\n\n${l(`mobile.files.file.truncated`)}`:pe.data??``,t[55]=pe.data,t[56]=l,t[57]=xe):xe=t[57];let Se=xe,Ce=le.error??pe.error,we;t[58]!==u||t[59]!==W||t[60]!==U||t[61]!==Ce||t[62]!==l?(we=U&&(!u.statFile||!W&&!u.readFile)?l(`mobile.files.error.readUnavailable`):Ce?Ce instanceof Error?Ce.message:l(`filesView.error.readFileFailed`):null,t[58]=u,t[59]=W,t[60]=U,t[61]=Ce,t[62]=l,t[63]=we):we=t[63];let Ee=we,De=!Ee&&(U&&(!le.data||!le.isFetchedAfterMount)||de&&pe.isFetching&&pe.data===void 0),Oe;t[64]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=e=>{y(``),g({type:`browser`,directory:e})},t[64]=Oe):Oe=t[64];let ke=Oe,Ae;t[65]!==E||t[66]!==p?(Ae=e=>{g({type:`file`,path:e,returnDirectory:E||p})},t[65]=E,t[66]=p,t[67]=Ae):Ae=t[67];let je=Ae,Me;t[68]!==s||t[69]!==n||t[70]!==h.returnDirectory||t[71]!==h.type?(Me=()=>h.type===`file`?s?(n?.(),!0):(g({type:`browser`,directory:h.returnDirectory}),!0):!1,t[68]=s,t[69]=n,t[70]=h.returnDirectory,t[71]=h.type,t[72]=Me):Me=t[72];let Ne=q(Me),Pe=h.type===`file`,Fe;t[73]!==Ne||t[74]!==Pe?(Fe={id:`mobile-files-detail`,active:Pe,layer:`overlay`,onBack:Ne,surfaceRef:_},t[73]=Ne,t[74]=Pe,t[75]=Fe):Fe=t[75],zr(Fe);let Ie;t[76]===l?Ie=t[77]:(Ie=async e=>{(await Ot(e)).ok||Ke.error(l(`mobile.files.toast.copyFailed`))},t[76]=l,t[77]=Ie);let Le=Ie,Re;t[78]!==Se||t[79]!==l?(Re=async()=>{(await Ot(Se)).ok?Ke.success(l(`mobile.files.toast.contentCopied`)):Ke.error(l(`mobile.files.toast.copyFailed`))},t[78]=Se,t[79]=l,t[80]=Re):Re=t[80];let ze=Re;if(!p){let e;t[81]===l?e=t[82]:(e=l(`mobile.files.empty.noDirectory`),t[81]=l,t[82]=e);let n;return t[83]===e?n=t[84]:(n=(0,$.jsx)(ql,{message:e}),t[83]=e,t[84]=n),n}if(h.type===`file`){let e;t[85]!==Le||t[86]!==h.path?(e=()=>void Le(h.path),t[85]=Le,t[86]=h.path,t[87]=e):e=t[87];let n;t[88]===ze?n=t[89]:(n=()=>void ze(),t[88]=ze,t[89]=n);let r;return t[90]!==Ne||t[91]!==Se||t[92]!==Ee||t[93]!==c||t[94]!==k||t[95]!==W||t[96]!==De||t[97]!==h.path||t[98]!==e||t[99]!==n?(r=(0,$.jsx)(`div`,{ref:_,className:`flex h-full min-h-0 flex-col`,children:(0,$.jsx)(Wl,{path:h.path,content:Se,error:Ee,isLoading:De,isBinary:W,hideHeader:c,htmlViewMode:k,onHtmlViewModeChange:A,onBack:Ne,onCopyPath:e,onCopyContent:n})}),t[90]=Ne,t[91]=Se,t[92]=Ee,t[93]=c,t[94]=k,t[95]=W,t[96]=De,t[97]=h.path,t[98]=e,t[99]=n,t[100]=r):r=t[100],r}let Be;t[101]!==p||t[102]!==h.directory||t[103]!==l?(Be=h.directory===p?l(`mobile.files.rootDirectory`):Fl(h.directory),t[101]=p,t[102]=h.directory,t[103]=l,t[104]=Be):Be=t[104];let Ve=Be,He;t[105]!==v||t[106]!==ye?(He=v.trim()?ye:[],t[105]=v,t[106]=ye,t[107]=He):He=t[107];let Ue=He,We,Ge,qe,Je;if(t[108]!==n||t[109]!==v||t[110]!==p||t[111]!==h.directory||t[112]!==l){let e=Il(h.directory),r=h.directory!==p&&e!==null&&(e===p||e.startsWith(`${p}/`)),i=r&&!v.trim(),a=r?e:null;Je=`flex h-full flex-col overflow-hidden bg-background text-foreground`,We=`flex h-[var(--yuri-header-height,56px)] shrink-0 items-center gap-2 px-3 text-foreground`,t[117]!==n||t[118]!==l?(Ge=n?(0,$.jsx)(`button`,{type:`button`,className:`-ml-1 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":l(`mobile.surface.closeAria`),onClick:n,style:{touchAction:`manipulation`},children:(0,$.jsx)(X,{name:`close`,className:`size-5`})}):null,t[117]=n,t[118]=l,t[119]=Ge):Ge=t[119],qe=i&&a?(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":l(`mobile.files.backToParentAria`,{name:Fl(a)}),onClick:()=>ke(a),style:{touchAction:`manipulation`},children:(0,$.jsx)(X,{name:`arrow-left`,className:`size-5`})}):null,t[108]=n,t[109]=v,t[110]=p,t[111]=h.directory,t[112]=l,t[113]=We,t[114]=Ge,t[115]=qe,t[116]=Je}else We=t[113],Ge=t[114],qe=t[115],Je=t[116];let Ye;t[120]===Ve?Ye=t[121]:(Ye=(0,$.jsx)(`div`,{className:`min-w-0 flex-1 px-1`,children:(0,$.jsx)(`h2`,{className:`truncate typography-ui-label text-foreground`,children:Ve})}),t[120]=Ve,t[121]=Ye);let Xe;t[122]===l?Xe=t[123]:(Xe=l(`mobile.files.refreshAria`),t[122]=l,t[123]=Xe);let Y;t[124]===B?Y=t[125]:(Y=()=>void B.refetch(),t[124]=B,t[125]=Y);let Ze;t[126]===Symbol.for(`react.memo_cache_sentinel`)?(Ze={touchAction:`manipulation`},t[126]=Ze):Ze=t[126];let Qe=_e&&`animate-spin`,$e;t[127]===Qe?$e=t[128]:($e=Vt(`size-5`,Qe),t[127]=Qe,t[128]=$e);let et;t[129]===$e?et=t[130]:(et=(0,$.jsx)(X,{name:`refresh`,className:$e}),t[129]=$e,t[130]=et);let tt;t[131]!==Xe||t[132]!==Y||t[133]!==et?(tt=(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":Xe,onClick:Y,style:Ze,children:et}),t[131]=Xe,t[132]=Y,t[133]=et,t[134]=tt):tt=t[134];let nt;t[135]!==We||t[136]!==Ge||t[137]!==qe||t[138]!==Ye||t[139]!==tt?(nt=(0,$.jsxs)(`header`,{className:We,children:[Ge,qe,Ye,tt]}),t[135]=We,t[136]=Ge,t[137]=qe,t[138]=Ye,t[139]=tt,t[140]=nt):nt=t[140];let rt;t[141]===Symbol.for(`react.memo_cache_sentinel`)?(rt=(0,$.jsx)(X,{name:`search`,className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-muted-foreground`}),t[141]=rt):rt=t[141];let it;t[142]===Symbol.for(`react.memo_cache_sentinel`)?(it=e=>y(e.target.value),t[142]=it):it=t[142];let at;t[143]===l?at=t[144]:(at=l(`mobile.files.search.placeholder`),t[143]=l,t[144]=at);let ot;t[145]!==v||t[146]!==at?(ot=(0,$.jsx)(`div`,{className:`shrink-0 px-4 pb-2 pt-1`,"data-mobile-sheet-no-dismiss":``,children:(0,$.jsxs)(`div`,{className:`relative`,children:[rt,(0,$.jsx)(Zn,{type:`text`,inputMode:`search`,value:v,onChange:it,placeholder:at,className:`h-11 pl-9`})]})}),t[145]=v,t[146]=at,t[147]=ot):ot=t[147];let st=Jr,ct=he?(0,$.jsx)(ql,{message:he}):v.trim()?(0,$.jsx)(Hl,{results:Ue,isSearching:be,onOpenFile:je}):(0,$.jsxs)(`div`,{className:`overflow-hidden rounded-2xl border border-border/40 bg-[var(--surface-elevated)]`,children:[me.length===0&&!_e?(0,$.jsx)(`div`,{className:`px-4 py-8 text-center typography-body text-muted-foreground`,children:l(`mobile.files.empty.directory`)}):null,me.map(e=>(0,$.jsx)(Vl,{name:e.name,path:e.path,directory:e.isDirectory,meta:e.isDirectory?void 0:Rl(e.size),onClick:()=>e.isDirectory?ke(e.path):je(e.path)},e.path))]}),lt;t[148]!==st||t[149]!==ct?(lt=(0,$.jsx)(st,{className:`overlay-scrollbar-container min-h-0 flex-1 overflow-y-auto px-4 pb-3`,children:ct}),t[148]=st,t[149]=ct,t[150]=lt):lt=t[150];let ut;return t[151]!==Je||t[152]!==nt||t[153]!==ot||t[154]!==lt?(ut=(0,$.jsxs)(`div`,{className:Je,children:[nt,ot,lt]}),t[151]=Je,t[152]=nt,t[153]=ot,t[154]=lt,t[155]=ut):ut=t[155],ut},Vl=e=>{let t=(0,Q.c)(16),{name:n,path:r,directory:i,meta:a,onClick:o}=e,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s={touchAction:`manipulation`},t[0]=s):s=t[0];let c;t[1]!==i||t[2]!==r?(c=i?(0,$.jsx)(X,{name:`folder-3-fill`,className:`size-5 shrink-0 text-muted-foreground`}):(0,$.jsx)(dn,{filePath:r,className:`size-5 shrink-0`}),t[1]=i,t[2]=r,t[3]=c):c=t[3];let l;t[4]===n?l=t[5]:(l=(0,$.jsx)(`span`,{className:`block min-w-0 flex-1 truncate typography-ui-label text-foreground`,children:n}),t[4]=n,t[5]=l);let u;t[6]===a?u=t[7]:(u=a?(0,$.jsx)(`span`,{className:`shrink-0 typography-micro text-muted-foreground`,children:a}):null,t[6]=a,t[7]=u);let d;t[8]===i?d=t[9]:(d=i?(0,$.jsx)(X,{name:`arrow-right-s`,className:`size-4 shrink-0 text-muted-foreground/60`}):null,t[8]=i,t[9]=d);let f;return t[10]!==o||t[11]!==c||t[12]!==l||t[13]!==u||t[14]!==d?(f=(0,$.jsxs)(`button`,{type:`button`,className:`flex min-h-14 w-full items-center gap-3 border-b border-border/30 px-3 py-2.5 text-left transition-colors last:border-b-0 hover:bg-interactive-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-inset`,onClick:o,style:s,children:[c,l,u,d]}),t[10]=o,t[11]=c,t[12]=l,t[13]=u,t[14]=d,t[15]=f):f=t[15],f},Hl=e=>{let t=(0,Q.c)(10),{results:n,isSearching:r,onOpenFile:i}=e,{t:a}=Te(),o=Pl(ii()??null);if(r){let e;t[0]===a?e=t[1]:(e=a(`common.loading`),t[0]=a,t[1]=e);let n;return t[2]===e?n=t[3]:(n=(0,$.jsx)(ql,{loading:!0,message:e}),t[2]=e,t[3]=n),n}if(n.length===0){let e;t[4]===a?e=t[5]:(e=a(`mobile.files.search.empty`),t[4]=a,t[5]=e);let n;return t[6]===e?n=t[7]:(n=(0,$.jsx)(ql,{message:e}),t[6]=e,t[7]=n),n}let s=n.map(e=>(0,$.jsx)(Vl,{name:Fl(e.path),path:e.path,directory:!1,meta:Ll(e.path,o),onClick:()=>i(e.path)},e.path)),c;return t[8]===s?c=t[9]:(c=(0,$.jsx)(`div`,{className:`overflow-hidden rounded-2xl border border-border/40 bg-[var(--surface-elevated)]`,children:s}),t[8]=s,t[9]=c),c},Ul=e=>{let t=(0,Q.c)(26),{path:n,canUseText:r,htmlViewMode:i,htmlFullscreen:a,onToggleHtmlViewMode:o,onEnterHtmlFullscreen:s,onCopyPath:c,onCopyContent:l}=e,{t:u}=Te(),d;t[0]===n?d=t[1]:(d=nn(n),t[0]=n,t[1]=d);let f=d,p;t[2]!==r||t[3]!==f||t[4]!==a||t[5]!==i||t[6]!==s||t[7]!==o||t[8]!==u?(p=f&&r?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Y,{type:`button`,variant:`ghost`,size:`icon`,onClick:o,"aria-label":u(i===`preview`?`mobile.files.html.viewSourceAria`:`mobile.files.html.viewPreviewAria`),children:(0,$.jsx)(X,{name:i===`preview`?`file-code`:`eye`,className:`size-4`})}),a?null:(0,$.jsx)(Y,{type:`button`,variant:`ghost`,size:`icon`,onClick:s,"aria-label":u(`mobile.files.html.fullscreenAria`),children:(0,$.jsx)(X,{name:`fullscreen`,className:`size-4`})})]}):null,t[2]=r,t[3]=f,t[4]=a,t[5]=i,t[6]=s,t[7]=o,t[8]=u,t[9]=p):p=t[9];let m;t[10]!==r||t[11]!==f||t[12]!==l||t[13]!==n||t[14]!==u?(m=r&&!en(n)&&!f?(0,$.jsx)(Y,{type:`button`,variant:`ghost`,size:`icon`,onClick:l,"aria-label":u(`mobile.files.copyContentAria`),children:(0,$.jsx)(X,{name:`file-copy`,className:`size-4`})}):null,t[10]=r,t[11]=f,t[12]=l,t[13]=n,t[14]=u,t[15]=m):m=t[15];let h;t[16]!==r||t[17]!==f||t[18]!==c||t[19]!==n||t[20]!==u?(h=!r||en(n)||f?(0,$.jsx)(Y,{type:`button`,variant:`ghost`,size:`icon`,onClick:c,"aria-label":u(`mobile.files.copyPathAria`),children:(0,$.jsx)(X,{name:`clipboard`,className:`size-4`})}):null,t[16]=r,t[17]=f,t[18]=c,t[19]=n,t[20]=u,t[21]=h):h=t[21];let g;return t[22]!==p||t[23]!==m||t[24]!==h?(g=(0,$.jsxs)($.Fragment,{children:[p,m,h]}),t[22]=p,t[23]=m,t[24]=h,t[25]=g):g=t[25],g},Wl=e=>{let t=(0,Q.c)(90),{path:n,content:r,error:i,isLoading:a,isBinary:o,hideHeader:s,htmlViewMode:c,onHtmlViewModeChange:l,onBack:u,onCopyPath:d,onCopyContent:f}=e,p=s!==void 0&&s,{t:m}=Te(),h=Z.useRef(null),g=ii(),_=en(n)&&!n.toLowerCase().endsWith(`.svg`)?n:``,v;t[0]===n?v=t[1]:(v=Il(n)??``,t[0]=n,t[1]=v);let y=Wr(_,v,`preview`),[b,x]=Z.useState(``),S;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(S={open:!1,title:``,content:``},t[2]=S):S=t[2];let[C,w]=Z.useState(S),T=y.source,E;t[3]===n?E=t[4]:(E=Fl(n),t[3]=n,t[4]=E);let D=E,O;t[5]!==r||t[6]!==n?(O=en(n)?`data:${tn(n)};utf8,${encodeURIComponent(r)}`:``,t[5]=r,t[6]=n,t[7]=O):O=t[7];let k=O,A;t[8]!==r||t[9]!==k||t[10]!==T||t[11]!==n?(A=T||(en(n)&&r?k:``),t[8]=r,t[9]=k,t[10]=T,t[11]=n,t[12]=A):A=t[12];let j=A,M;t[13]!==i||t[14]!==b||t[15]!==y.error||t[16]!==j||t[17]!==m?(M=i??y.error??(j&&b===j?m(`filesView.error.readFileFailed`):null),t[13]=i,t[14]=b,t[15]=y.error,t[16]=j,t[17]=m,t[18]=M):M=t[18];let N=M,P;t[19]===j?P=t[20]:(P=()=>x(j),t[19]=j,t[20]=P);let F=q(P),I;t[21]!==D||t[22]!==_||t[23]!==n||t[24]!==j?(I=e=>{let t=_||j;t&&w({open:!0,title:D,content:``,previewSource:e.currentTarget.querySelector(`img`)??void 0,metadata:{tool:`image-preview`,filename:D,mime:tn(n)},image:{url:t,mimeType:tn(n),filename:D}})},t[21]=D,t[22]=_,t[23]=n,t[24]=j,t[25]=I):I=t[25];let L=q(I),R;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(R=e=>{w(t=>t.open===e?t:{...t,open:e})},t[26]=R):R=t[26];let ee=q(R),z;t[27]===n?z=t[28]:(z=nn(n),t[27]=n,t[28]=z);let B=z,[V,te]=Z.useState(!1),ne=Z.useRef(null),re;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(re=()=>{te(!1)},t[29]=re):re=t[29];let H;t[30]===n?H=t[31]:(H=[n],t[30]=n,t[31]=H),Z.useEffect(re,H);let ie;t[32]!==c||t[33]!==l?(ie=()=>{l(c===`preview`?`source`:`preview`)},t[32]=c,t[33]=l,t[34]=ie):ie=t[34];let U=q(ie),ae;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(ae=()=>{te(!0)},t[35]=ae):ae=t[35];let oe=q(ae),se;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(se=()=>(te(!1),!0),t[36]=se):se=t[36];let ce=q(se),le=B&&V,W;t[37]!==ce||t[38]!==le?(W={id:`mobile-html-fullscreen`,active:le,layer:`overlay`,onBack:ce,surfaceRef:ne},t[37]=ce,t[38]=le,t[39]=W):W=t[39],zr(W);let ue=!o&&!a&&!i,G;t[40]!==oe||t[41]!==V||t[42]!==c||t[43]!==f||t[44]!==d||t[45]!==n||t[46]!==ue||t[47]!==U?(G=(0,$.jsx)(Ul,{path:n,canUseText:ue,htmlViewMode:c,htmlFullscreen:V,onToggleHtmlViewMode:U,onEnterHtmlFullscreen:oe,onCopyPath:d,onCopyContent:f}),t[40]=oe,t[41]=V,t[42]=c,t[43]=f,t[44]=d,t[45]=n,t[46]=ue,t[47]=U,t[48]=G):G=t[48];let de=G,K;t[49]!==r||t[50]!==i||t[51]!==c||t[52]!==a||t[53]!==n||t[54]!==m?(K=c===`source`?a?(0,$.jsx)(ql,{loading:!0,message:m(`filesView.state.loading`)}):i?(0,$.jsx)(so,{message:i}):(0,$.jsx)(Kl,{path:n,content:r}):(0,$.jsx)(Gl,{path:n}),t[49]=r,t[50]=i,t[51]=c,t[52]=a,t[53]=n,t[54]=m,t[55]=K):K=t[55];let fe=K,pe;t[56]!==ce||t[57]!==B||t[58]!==fe||t[59]!==V||t[60]!==c||t[61]!==D||t[62]!==m||t[63]!==U?(pe=B?(0,$.jsxs)(`div`,{ref:ne,"data-mobile-html-preview":c===`preview`&&!V?`true`:void 0,"data-mobile-html-fullscreen":c===`preview`&&V?`true`:void 0,className:V?`fixed inset-0 z-[80] flex flex-col bg-background text-foreground`:`flex min-h-0 flex-1 flex-col overflow-hidden bg-background`,children:[V?(0,$.jsxs)(`header`,{className:`flex shrink-0 items-center gap-2 border-b border-border/50 px-3 pb-2 pt-[max(0.5rem,env(safe-area-inset-top))]`,children:[(0,$.jsx)(Y,{type:`button`,variant:`ghost`,size:`icon`,onClick:ce,"aria-label":m(`mobile.files.html.exitFullscreenAria`),className:`shrink-0 text-muted-foreground`,children:(0,$.jsx)(X,{name:`arrow-left`,className:`size-5`})}),(0,$.jsx)(`h2`,{className:`min-w-0 flex-1 truncate typography-ui-header text-foreground`,children:D}),(0,$.jsx)(Y,{type:`button`,variant:`ghost`,size:`icon`,onClick:U,"aria-label":m(c===`preview`?`mobile.files.html.viewSourceAria`:`mobile.files.html.viewPreviewAria`),children:(0,$.jsx)(X,{name:c===`preview`?`file-code`:`eye`,className:`size-4`})})]}):null,(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden bg-background`,children:fe})]}):null,t[56]=ce,t[57]=B,t[58]=fe,t[59]=V,t[60]=c,t[61]=D,t[62]=m,t[63]=U,t[64]=pe):pe=t[64];let me=pe,J=g??void 0,he;t[65]!==r||t[66]!==i||t[67]!==de||t[68]!==F||t[69]!==ee||t[70]!==p||t[71]!==B||t[72]!==V||t[73]!==me||t[74]!==N||t[75]!==D||t[76]!==C||t[77]!==y.loading||t[78]!==o||t[79]!==a||t[80]!==u||t[81]!==L||t[82]!==n||t[83]!==j||t[84]!==m?(he=e=>{let{preview:t,controls:s}=e;return(0,$.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col overflow-hidden bg-background text-foreground`,"data-mobile-edge-to-edge-preview":`true`,children:[p?(0,$.jsxs)(Cr,{children:[s,de]}):(0,$.jsxs)(`header`,{className:`flex h-[var(--yuri-header-height,56px)] shrink-0 items-center gap-3 border-b border-border/50 px-3 text-foreground`,children:[(0,$.jsx)(`button`,{type:`button`,className:`flex size-9 shrink-0 items-center justify-center rounded-lg text-muted-foreground hover:bg-interactive-hover hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary`,"aria-label":m(`header.actions.backAria`),onClick:u,children:(0,$.jsx)(X,{name:`arrow-left`,className:`size-5`})}),(0,$.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,$.jsx)(`h2`,{className:`truncate typography-ui-header text-foreground`,children:D})}),s,de]}),(0,$.jsx)(`div`,{ref:h,className:`flex min-h-0 flex-1 flex-col overflow-hidden bg-background`,children:t??(o&&!a&&!i?(0,$.jsx)(ma,{path:n},n):B&&!a&&!i?V&&typeof document<`u`?(0,jl.createPortal)(me,document.body):me:a||y.loading?en(n)?(0,$.jsx)(`div`,{className:`flex flex-1 items-center justify-center p-4`,children:(0,$.jsx)(Gr,{className:`aspect-square w-64 max-w-full rounded-lg`})}):(0,$.jsx)(ql,{loading:!0,message:m(`filesView.state.loading`)}):N?(0,$.jsx)(so,{message:N}):en(n)&&j?(0,$.jsx)(Jr,{className:`h-full overflow-auto p-4`,children:(0,$.jsx)(`button`,{type:`button`,className:`mx-auto block w-full cursor-zoom-in rounded-lg border-0 bg-transparent p-0 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary [&>.yuri-image-frame]:w-full`,onClick:L,"aria-label":D,children:(0,$.jsx)(Kr,{src:j,alt:D,className:`h-auto w-full rounded-lg object-contain`,draggable:!1,onError:F})})}):(0,$.jsx)(Kl,{path:n,content:r}))}),(0,$.jsx)(En,{containerRef:h}),C.open?(0,$.jsx)(Z.Suspense,{fallback:null,children:(0,$.jsx)(Ml,{popup:C,onOpenChange:ee,isMobile:!0})}):null]})},t[65]=r,t[66]=i,t[67]=de,t[68]=F,t[69]=ee,t[70]=p,t[71]=B,t[72]=V,t[73]=me,t[74]=N,t[75]=D,t[76]=C,t[77]=y.loading,t[78]=o,t[79]=a,t[80]=u,t[81]=L,t[82]=n,t[83]=j,t[84]=m,t[85]=he):he=t[85];let ge;return t[86]!==n||t[87]!==J||t[88]!==he?(ge=(0,$.jsx)(Ha,{path:n,base:J,children:he}),t[86]=n,t[87]=J,t[88]=he,t[89]=ge):ge=t[89],ge},Gl=e=>{let t=(0,Q.c)(5),{path:n}=e,{projectScope:r}=ri(),i=ii(),a=r?.location.directory??i??``,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o={backgroundColor:`var(--surface-background)`},t[0]=o):o=t[0];let s;return t[1]!==n||t[2]!==r||t[3]!==a?(s=(0,$.jsx)(ja,{path:n,directory:a,entry:r,className:`flex h-full min-h-0 flex-1 flex-col overflow-hidden bg-background`,iframeClassName:`h-full min-h-0 w-full flex-1 border-none bg-background`,iframeStyle:o}),t[1]=n,t[2]=r,t[3]=a,t[4]=s):s=t[4],s},Kl=e=>{let t=(0,Q.c)(30),{path:n,content:r}=e,{currentTheme:i,availableThemes:a,lightThemeId:o,darkThemeId:s}=rn(),c;t[0]!==a||t[1]!==o?(c=a.find(e=>e.metadata.id===o)??gr(!1),t[0]=a,t[1]=o,t[2]=c):c=t[2];let l=c,u;t[3]!==a||t[4]!==s?(u=a.find(e=>e.metadata.id===s)??gr(!0),t[3]=a,t[4]=s,t[5]=u):u=t[5];let d=u,f,p;t[6]!==d||t[7]!==l?(f=()=>{Rr(l),Rr(d)},p=[d,l],t[6]=d,t[7]=l,t[8]=f,t[9]=p):(f=t[8],p=t[9]),Z.useEffect(f,p);let m;t[10]!==d.metadata.id||t[11]!==l.metadata.id?(m={light:l.metadata.id,dark:d.metadata.id},t[10]=d.metadata.id,t[11]=l.metadata.id,t[12]=m):m=t[12];let h=m;if(zl(n)){let e;return t[13]===r?e=t[14]:(e=(0,$.jsx)(Jr,{className:`h-full overflow-y-auto px-4 py-4`,children:(0,$.jsx)(yr,{content:r,enableFileReferences:!1})}),t[13]=r,t[14]=e),e}let g;t[15]===n?g=t[16]:(g=Fl(n),t[15]=n,t[16]=g);let _;t[17]===n?_=t[18]:(_=$t(n)||void 0,t[17]=n,t[18]=_);let v;t[19]!==r||t[20]!==g||t[21]!==_?(v={name:g,contents:r,lang:_},t[19]=r,t[20]=g,t[21]=_,t[22]=v):v=t[22];let y=i.metadata.variant===`dark`?`dark`:`light`,b;t[23]!==h||t[24]!==y?(b={disableFileHeader:!0,overflow:`wrap`,theme:h,themeType:y,unsafeCSS:Mi},t[23]=h,t[24]=y,t[25]=b):b=t[25];let x;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(x={minHeight:`100%`},t[26]=x):x=t[26];let S;return t[27]!==b||t[28]!==v?(S=(0,$.jsx)(`div`,{className:`flex h-full flex-col overflow-hidden`,children:(0,$.jsx)(Jr,{className:`min-h-0 flex-1 overflow-auto bg-[var(--syntax-base-background)]`,children:(0,$.jsx)(Se,{file:v,options:b,className:`block min-h-full w-full`,style:x})})}),t[27]=b,t[28]=v,t[29]=S):S=t[29],S},ql=e=>{let t=(0,Q.c)(7),{message:n,loading:r}=e,i=r!==void 0&&r,a;t[0]===i?a=t[1]:(a=i?(0,$.jsx)(X,{name:`loader-4`,className:`size-5 animate-spin text-muted-foreground`}):(0,$.jsx)(X,{name:`folder-open-fill`,className:`size-6 text-muted-foreground`}),t[0]=i,t[1]=a);let o;t[2]===n?o=t[3]:(o=(0,$.jsx)(`p`,{className:`typography-ui-label font-semibold text-foreground`,children:n}),t[2]=n,t[3]=o);let s;return t[4]!==a||t[5]!==o?(s=(0,$.jsx)(`div`,{className:`flex h-full items-center justify-center px-6 text-center`,children:(0,$.jsxs)(`div`,{className:`flex max-w-sm flex-col items-center gap-2`,children:[a,o]})}),t[4]=a,t[5]=o,t[6]=s):s=t[6],s};function Jl(e){return e.pendingFileFocusPath}function Yl(e){return e.setPendingFileFocusPath}function Xl(e,t){return e.isDirectory===t.isDirectory?e.name.localeCompare(t.name):e.isDirectory?-1:1}var Zl=S(e=>({expandedParents:{},toggleParent:t=>e(e=>{let n={...e.expandedParents};return n[t]?delete n[t]:n[t]=!0,{expandedParents:n}})})),Ql=36,$l=18,eu=e=>e.parentID??null,tu=e=>(e||``).replace(/\\/g,`/`).replace(/\/+$/g,``),nu=e=>{let t=e;return tu(t.directory??t.project?.worktree??null)},ru=e=>{let t=tu(e);if(!t)return``;let n=t.split(`/`).filter(Boolean);return n[n.length-1]||t},iu=e=>{let t=e.time?.updated??e.time?.created,n=typeof t==`number`?t:Number(t);return Number.isFinite(n)&&n>0?n:0},au=(e,t)=>e.size===t.size&&[...e].every(e=>t.has(e)),ou=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))},su=(e,t)=>{let n=tu(e),r=tu(t);return!!(n&&r&&(n===r||n.startsWith(`${r}/`)))},cu=(e,t)=>e.worktrees.find(e=>tu(e.path)===t)??null,lu=(e,t)=>t===e.path||!!cu(e,t),uu=(e,t)=>{let n=tu(t);return n?e.find(e=>lu(e,n))??null:null},du=(e,t,n)=>!n||`${e.title??``} ${e.id} ${nu(e)} ${t}`.toLowerCase().includes(n),fu=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?Zr[n.icon]:null,c=n.color?Qr[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=Vt(`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)(Yr,{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},pu=e=>{let t=(0,Q.c)(5),{expanded:n}=e,r=n?`rotate-0`:`-rotate-90`,i;t[0]===r?i=t[1]:(i=Vt(`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},mu=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},hu=e=>{let t=(0,Q.c)(12),{onClick:n,className:r}=e,{t:i}=Te(),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=Vt(`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},gu=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)(Y,{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},_u=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}=Te(),x;t[0]===n?x=t[1]:(x=ou(iu(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,ee,z;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){z=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=Vt(`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:Vt(`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=Vt(`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=_,ee=`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=Vt(`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=Vt(`block min-w-0 flex-1 truncate typography-ui-label`,f),t[54]=f,t[55]=F),I=g?cr(z,g):z,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]=ee,t[35]=z}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],ee=t[34],z=t[35];let B;t[56]!==F||t[57]!==I?(B=(0,$.jsx)(`span`,{className:F,children:I}),t[56]=F,t[57]=I,t[58]=B):B=t[58];let V;t[59]===S?V=t[60]:(V=S?(0,$.jsx)(`span`,{className:`shrink-0 typography-micro text-muted-foreground tabular-nums`,children:S}):null,t[59]=S,t[60]=V);let te;t[61]!==B||t[62]!==V||t[63]!==L||t[64]!==R?(te=(0,$.jsxs)(`span`,{className:L,children:[R,B,V]}),t[61]=B,t[62]=V,t[63]=L,t[64]=R,t[65]=te):te=t[65];let ne;t[66]!==a||t[67]!==g?(ne=a?(0,$.jsx)(`span`,{className:`block truncate typography-micro text-muted-foreground pl-4`,children:g?cr(a,g):a}):null,t[66]=a,t[67]=g,t[68]=ne):ne=t[68];let re;t[69]!==te||t[70]!==ne||t[71]!==ee?(re=(0,$.jsxs)(`span`,{className:ee,children:[te,ne]}),t[69]=te,t[70]=ne,t[71]=ee,t[72]=re):re=t[72];let H;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]!==re?(H=(0,$.jsx)(`button`,{type:C,className:w,style:T,onClick:E,onPointerDown:D,onPointerMove:O,onPointerUp:k,onPointerCancel:A,onContextMenu:j,disabled:M,children:re}),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]=re,t[84]=H):H=t[84];let ie;t[85]!==p||t[86]!==m?(ie=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)(Li,{})}):null,t[85]=p,t[86]=m,t[87]=ie):ie=t[87];let U;t[88]===b?U=t[89]:(U=b(`sessions.sidebar.session.menu.label`),t[88]=b,t[89]=U);let ae;t[90]===Symbol.for(`react.memo_cache_sentinel`)?(ae=(0,$.jsx)(X,{name:`more-2`,className:`size-4`}),t[90]=ae):ae=t[90];let oe;t[91]!==h.onOpenActions||t[92]!==U?(oe=(0,$.jsx)(Y,{variant:`ghost`,size:`icon`,"data-session-drag-ignore":!0,"aria-label":U,onClick:h.onOpenActions,children:ae}),t[91]=h.onOpenActions,t[92]=U,t[93]=oe):oe=t[93];let se;t[94]!==_||t[95]!==f||t[96]!==d||t[97]!==b||t[98]!==z?(se=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:z}),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:z}),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]=z,t[99]=se):se=t[99];let ce;return t[100]!==N||t[101]!==P||t[102]!==H||t[103]!==ie||t[104]!==oe||t[105]!==se?(ce=(0,$.jsxs)(`div`,{className:N,children:[P,H,ie,oe,se]}),t[100]=N,t[101]=P,t[102]=H,t[103]=ie,t[104]=oe,t[105]=se,t[106]=ce):ce=t[106],ce},vu=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}=Te();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:Vt(`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},yu=({open:e,onOpenChange:t,variant:n=`sheet`})=>{let{t:r}=Te(),{git:i}=ce(),a=ot(),o=et(),s=ct(e=>e.activeSessions),c=ct(e=>e.activePaginationByDirectory),l=Dt(e=>e.projects),u=Z.useMemo(()=>l.filter(e=>!e.hostId),[l]),d=l.some(e=>!!e.hostId),f=Zt(e&&d),p=f.catalog?.projects??[],m=Dt(e=>e.activeProjectId),h=O(e=>e.currentDirectory),g=Tt(e=>e.currentSessionId),_=Tt(e=>e.availableWorktreesByProject),v=Tt(e=>e.setCurrentSession),y=Tt(e=>e.archiveSession),b=Tt(e=>e.archiveSessions),x=Tt(e=>e.updateSessionTitle),S=Tt(e=>e.requestSessionSmartTitle),C=Tt(e=>e.shareSession),w=Tt(e=>e.unshareSession),T=Tt(e=>e.openNewSessionDraft),E=Dt(e=>e.setActiveProject),D=Dt(e=>e.setActiveProjectIdOnly),k=Dt(e=>e.removeProject),A=Lt();Si();let j=At(e=>e.sessionOrderByScope),M=At(e=>e.sessionOrderActivityByScope),N=tt(),P=Xi(e=>e.projectExpanded),F=Xi(e=>e.worktreeExpanded),I=Xi(e=>e.setProjectExpanded),L=Xi(e=>e.setWorktreeExpanded),R=Qe(e=>e.orderByProject),ee=Zl(e=>e.expandedParents),z=Zl(e=>e.toggleParent),[B,V]=Z.useState(``),[te,ne]=Z.useState(null),[re,H]=Z.useState(null),[ie,U]=Z.useState(0),[ae,oe]=Z.useState(!1),[se,le]=Z.useState(!1),[W,ue]=Z.useState(null),[G,de]=Z.useState(null),K=G?.kind===`session`?G.session:null,{unread:fe,onToggleRead:pe}=Ja(K,K?nu(K):void 0),[me,J]=Z.useState(null),[he,ge]=Z.useState(null),[_e,ve]=Z.useState(null),[ye,be]=Z.useState(``),[xe,Se]=Z.useState(!1),[Ce,we]=Z.useState(null),Ee=Z.useRef(null);Ee.current||=Ta({onPressedKeyChange:ge});let[De,Oe]=Z.useState(new Set),[ke,Ae]=Z.useState(new Map),[je,Me]=Z.useState(new Map),Ne=Ei(),Pe=Xa(),Fe=q(e=>{Ur(e),qe(e)}),Ie=q(e=>{Promise.all(e.map(e=>(Ur(e),qe(e))))});Z.useEffect(()=>{if(!e){V(``),Me(new Map),ne(null),H(null),de(null),ve(null),we(null),Ee.current?.reset();return}},[e]),Z.useEffect(()=>()=>{Ee.current?.reset()},[]),Z.useEffect(()=>{if(!e)return;if(u.length===0){Tt.setState(e=>{let t=Ai(e.availableWorktreesByProject,new Set,[]);return t===e.availableWorktreesByProject?{}:{availableWorktreesByProject:t,availableWorktrees:[]}}),Oe(e=>e.size===0?e:new Set),Ae(e=>e.size===0?e:new Map);return}let t=!1;return(async()=>{let e=await Promise.all(u.map(async e=>{let n=tu(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([$r({id:e.id,path:n},{isCurrent:()=>!t}),Xr(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=>tu(e.path)).filter(Boolean)),r=e.flatMap(e=>e?.worktreeStatus?[{path:e.path,status:e.worktreeStatus,worktrees:e.worktrees}]:[]);Tt.setState(e=>{let t=Ai(e.availableWorktreesByProject,n,r);return t===e.availableWorktreesByProject?{}:{availableWorktreesByProject:t,availableWorktrees:Array.from(t.values()).flat()}}),Oe(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 au(r,t)?t:r}),Ae(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 Le=Z.useMemo(()=>u.map(e=>({id:e.id,label:ru(e.path),path:tu(e.path),icon:e.icon,color:e.color,iconImage:e.iconImage,iconBackground:e.iconBackground,isGitRepo:De.has(tu(e.path)),worktrees:_t(R[e.id],_.get(tu(e.path))??[])})),[De,u,R,_]),Re=Z.useMemo(()=>{let e=new Map(o.map(e=>[e.id,e])),t=s.map(t=>{let n=e.get(t.id);return n?bt(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]),ze=B.trim().toLowerCase(),Be=Z.useMemo(()=>{let e=Le.map(e=>({project:e,buckets:[],totalSessions:0,isActive:e.id===m})),t=(e,t,n)=>{let r=tu(t)||e.project.path,i=r||`__root__`,a=e.buckets.find(e=>e.key===i);return a||(a={key:i,label:n?.branch||ru(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 Re){let r=nu(n);if(!r)continue;let i=tu(r),a=e.find(e=>lu(e.project,i));if(!a)continue;let o=cu(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=tu(e.path),r=Hi(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)eu(n)||(t.totalSessions+=1)}return e},[m,Le,Re,j,M,A]),Ve=tu(h),He=e=>e.isActive?Ve===e.project.path?e.project.path:e.project.worktrees.find(e=>su(Ve,e.path))?.path??e.project.path:null,Ue=e=>P[e.project.id]??!0,We=(e,t)=>F[`${e.project.id}::${t.key}`]??!1,Ge=e=>{Me(t=>{if(!t.has(e))return t;let n=new Map(t);return n.delete(e),n})},Je=()=>{de(null),Ee.current?.reset()},Ye=e=>({onOpenActions:()=>de(e),pressed:he===e.key||G?.key===e.key,onPointerDown:t=>{e.kind!==`session`&&(t.pointerType!==`touch`&&t.pointerType!==`pen`||t.button!==0||Ee.current?.start({pointerId:t.pointerId,key:e.key,clientX:t.clientX,clientY:t.clientY,onTrigger:()=>de(e)}))},onPointerMove:e=>{Ee.current?.move(e.pointerId,e.clientX,e.clientY)},onPointerUp:e=>{Ee.current?.end(e.pointerId)},onPointerCancel:e=>{Ee.current?.cancel(e.pointerId)},onContextMenu:t=>{t.preventDefault(),t.stopPropagation(),e.kind!==`session`&&Ee.current?.openFromContextMenu(e.key,()=>de(e))}}),Xe=(e,t)=>{Ee.current?.consumeClick(e)||t()},Ze=(e,t,n,r)=>{let i=Ka(),a=Ki();if(Me(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=tu(t);if(!o)return;let s=ct.getState().activePaginationByDirectory.get(o);s?.hasMore&&!s.loadingMore&&pt(o)},$e=(e,t,n)=>{let i=`${e.project.id}::${t.key}`,a=Ka(),o=new Set(t.sessions.map(e=>e.id)),s=new Map;for(let e of t.sessions){let t=eu(e);if(t&&o.has(t)){let n=s.get(t)??[];n.push(e),s.set(t,n)}}let l=t.sessions.filter(e=>!eu(e)),u=je.get(i)??a,d=Ni(l,u,Pe),f=l.length-d.length,p=c.get(tu(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=!!ee[e.id],o=Ne.has(e.id),c=i&&!a?n.filter(e=>Ne.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)(_u,{session:e,active:g===e.id,indent:t,hasChildren:i,expanded:a,onToggleChildren:i?()=>z(e.id):void 0,confirmingArchive:re===e.id,onSelect:()=>Xe(f,()=>it(e)),onRequestArchive:()=>at(e.id),onConfirmArchive:()=>void st(e),onStop:o||l?()=>Ie(u):void 0,stopAriaLabel:r(l?`mobile.sessions.stopSubsessionsAria`:`mobile.sessions.stopSessionAria`,{title:d}),longPressHandlers:Ye({key:f,kind:`session`,session:e})}),i&&a?n.map(e=>v(e,t+$l)):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)(Bi,{scopeKey:re?null:tu(t.path),sessionIds:d.map(e=>e.id),folderIdBySessionId:new Map(d.map(e=>[e.id,At.getState().getSessionFolderId(tu(t.path),e.id)])),onSessionDroppedOnFolder:()=>{},onSessionsReordered:(e,n)=>{At.getState().reorderSessions(tu(t.path),d.map(e=>e.id),e,n,Ii(t.sessions)).catch(()=>Ke.error(r(`sessions.order.saveFailed`)))},children:d.map(e=>re?v(e,n):(0,$.jsx)($i,{sessionId:e.id,sessionDirectory:t.path,sessionTitle:e.title??``,children:v(e,n)},e.id))}),(0,$.jsx)(vu,{indent:n,showMore:f>0||m,showFewer:_,loadingMore:h,onShowMore:()=>Ze(i,t.path,u,l.length),onShowFewer:()=>Ge(i)})]})},nt=(e,t)=>{I(e,!t)},rt=(e,t,n)=>{L(`${e}::${t}`,!n)},it=e=>{xr();let n=nu(e)||null,r=uu(Le,n??``);r&&D(r.id),v(e.id,n),t(!1)},at=e=>{H(t=>t===e?null:e)},st=async e=>{H(null),await y(e.id)?wa({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`)}):Ke.error(r(`sessions.sidebar.session.archive.error`))},lt=()=>{T(),t(!1)},ut=e=>{ue(e),D(e),le(!0)},dt=e=>{let t=new Map;for(let e of Re){let n=eu(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},mt=async e=>{let t=dt(e.id),{archivedIds:n,failedIds:i}=await b(t);n.length>0&&wa({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&&Ke.error(i.length===1?r(`sessions.sidebar.bulkActions.failedArchiveSingle`,{count:i.length}):r(`sessions.sidebar.bulkActions.failedArchivePlural`,{count:i.length}))},ht=e=>{let t=dt(e.id);wi({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`)})},gt=async e=>{try{if(!(await C(e.id))?.share?.url){Ke.error(r(`sessions.sidebar.session.share.error`));return}Ke.success(r(`sessions.sidebar.session.share.successTitle`),{description:r(`sessions.sidebar.session.share.successDescription`)})}catch{Ke.error(r(`sessions.sidebar.session.share.error`))}},vt=async e=>{if((await Ot(e)).ok){Ke.success(r(`sessions.sidebar.session.menu.copied`));return}Ke.error(r(`sessions.sidebar.session.share.copyUrlError`))},yt=async e=>{try{if(await w(e)){Ke.success(r(`sessions.sidebar.session.unshare.success`));return}Ke.error(r(`sessions.sidebar.session.unshare.error`))}catch{Ke.error(r(`sessions.sidebar.session.unshare.error`))}},xt=async()=>{if(!_e)return;let e=ye.trim();if(e)try{await x(_e.id,e),ve(null),be(``)}catch{Ke.error(r(`sessions.sidebar.session.menu.rename`),{description:r(`sessions.sidebar.dialogs.deleteResult.tryAgain`)})}},St=async()=>{if(!_e||xe)return;let e=_e.id;ve(null),be(``),Se(!0);try{await S(e)}catch{Ke.error(r(`sessions.sidebar.session.rename.smartTitle`),{description:r(`sessions.sidebar.dialogs.deleteResult.tryAgain`)})}finally{Se(!1)}},Ct=(e,n)=>{D(e.id),T({selectedProjectId:e.id,directoryOverride:n,preserveDirectoryOverride:!0}),t(!1)},wt=e=>{(async()=>{try{await $r({id:e.id,path:e.path})}catch(e){console.warn(`[MobileSessions] Worktree refresh before session sync failed:`,e)}let t=Tt.getState().availableWorktreesByProject.get(e.path)??e.worktrees,n=[e.path,...t.map(e=>e.path)];await zt(n,Re)})()},Et=e=>{let t=nu(e),n=uu(Le,t);if(!n)return ru(t)||t;let r=cu(n,tu(t));return r?.branch?`${n.label} · ${r.branch}`:n.label},kt=e=>{E(e.id),t(!1)},jt=Z.useMemo(()=>ze?Be.filter(e=>`${e.project.label} ${e.project.path}`.toLowerCase().includes(ze)?!0:e.buckets.some(t=>t.sessions.some(t=>du(t,e.project.label,ze)))):Be,[ze,Be]),Mt=Z.useMemo(()=>ze?Re.filter(e=>{let t=nu(e);return du(e,uu(Le,t)?.label??``,ze)}).sort((e,t)=>ft(t)-ft(e)):[],[ze,Le,Re]),Nt=Z.useMemo(()=>ze?Le.filter(e=>`${e.label} ${e.path}`.toLowerCase().includes(ze)).map(e=>({...e,sessionCount:Re.filter(t=>!eu(t)&&lu(e,tu(nu(t)))).length})):[],[ze,Le,Re]),Pt=ze&&Mt.length===0&&Nt.length===0,Ft=Le.length>0?(0,$.jsxs)(Y,{type:`button`,variant:`default`,size:`sm`,"aria-label":r(`mobile.sessions.newChat`),onClick:lt,style:{touchAction:`manipulation`},children:[(0,$.jsx)(X,{name:`add`,className:`size-4`}),r(`mobile.sessions.newChat`)]}):null,It=Le.find(e=>e.id===m)??null,Rt=It?.isGitRepo?(0,$.jsx)(Y,{type:`button`,variant:`chip`,size:`sm`,"aria-label":r(`sessions.sidebar.project.actions.newWorktree`),title:r(`sessions.sidebar.project.actions.newWorktree`),onClick:()=>ut(It.id),style:{touchAction:`manipulation`},children:(0,$.jsx)(X,{name:`node-tree`,className:`size-4`})}):null,Bt=(0,$.jsx)(Y,{type:`button`,variant:`chip`,size:`sm`,"aria-label":r(`sessions.sidebar.header.actions.addProject`),title:r(`sessions.sidebar.header.actions.addProject`),onClick:()=>oe(!0),style:{touchAction:`manipulation`},children:(0,$.jsx)(X,{name:`folder-add`,className:`size-4`})}),Ht=Ft||Bt?(0,$.jsxs)($.Fragment,{children:[Ft,Rt,Bt]}):null,Ut=G?.kind===`project`?G.project.label:G?.kind===`worktree`?G.worktree.branch||G.worktree.label||G.worktree.path:G?.kind===`session`?G.session.title?.trim()||r(`mobile.sessions.untitled`):``,Wt=Z.useMemo(()=>{if(!G)return[];if(G.kind===`project`){let e=G.project;return sa({gitRepository:e.isGitRepo,onNewSession:()=>{Je(),Ct(e,e.path)},onNewWorktree:()=>{Je(),ut(e.id)},onSyncSessions:()=>{Je(),wt(e)},onEditProject:()=>{Je(),ne(e.id)},onCloseProject:()=>{Je(),J(e)}})}if(G.kind===`worktree`){let{project:e,worktree:t}=G;return Wi({onNewSession:()=>{Je(),Ct(e,t.path)},onDeleteWorktree:()=>{Je(),we({project:e,worktree:t})}})}let e=G.session,t=!!e.share?.url;return qa({pinned:A.has(e.id),shared:t,unread:fe,onToggleRead:pe?()=>{Je(),pe()}:void 0,onRename:()=>{Je(),be(e.title?.trim()||r(`mobile.sessions.untitled`)),ve(e)},onTogglePin:()=>{Je(),N(e.id)},onShare:!a||t?void 0:()=>{Je(),gt(e)},onCopyLink:a&&t?()=>{let t=e.share?.url;Je(),t&&vt(t)}:void 0,onUnshare:a&&t?()=>{Je(),yt(e.id)}:void 0,onArchive:()=>{Je(),mt(e)},onDelete:()=>{Je(),ht(e)}})},[G,fe,Je,mt,vt,ht,ut,gt,yt,pe,A,Ct,wt,r,N]),Gt=Wt.length>0?(0,$.jsx)(`div`,{className:`flex flex-col gap-1`,children:Wt.map(e=>{let t=(0,$.jsx)(gu,{icon:e.icon,label:Oi(e,r),destructive:e.destructive,onClick:e.onClick},e.id);return e.separated?(0,$.jsx)(`div`,{className:G?.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,Kt=(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)(Zn,{value:B,onChange:e=>V(e.target.value),placeholder:r(`mobile.sessions.search.placeholder`),className:Vt(`h-11 pl-9`,B&&`pr-10`)}),B?(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:()=>V(``),style:{touchAction:`manipulation`},children:(0,$.jsx)(X,{name:`close`,className:`size-4`})}):null]})}),(0,$.jsxs)(Jr,{className:`overlay-scrollbar-container min-h-0 flex-1 overflow-y-auto pb-4`,children:[d&&f.registry&&p.map(e=>(0,$.jsx)(Ra,{project:e,registry:f.registry,search:B,mobile:!0,reorderEnabled:!1},e.id)),Le.length===0&&!d?(0,$.jsx)(bu,{title:r(`mobile.sessions.empty.noProjectsTitle`),description:r(`mobile.sessions.empty.noProjectsDescription`),action:(0,$.jsxs)(Y,{type:`button`,size:`lg`,onClick:()=>oe(!0),children:[(0,$.jsx)(X,{name:`folder-add`,className:`size-4`}),r(`sessions.sidebar.header.actions.addProject`)]})}):Pt&&!d?(0,$.jsx)(bu,{title:r(`mobile.sessions.empty.searchTitle`),description:r(`mobile.sessions.empty.searchDescription`)}):ze?(0,$.jsxs)(`div`,{className:`flex flex-col gap-3 px-3 pt-2`,children:[Mt.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:Mt.length})]}),(0,$.jsx)(`div`,{className:`overflow-hidden rounded-2xl border border-border/40 bg-[var(--surface-elevated)]`,children:Mt.map((e,t)=>{let n=Ne.has(e.id),i=e.title?.trim()||r(`mobile.sessions.untitled`);return(0,$.jsx)(`div`,{className:Vt(t>0&&`border-t border-border/30`),children:(0,$.jsx)(_u,{session:e,active:g===e.id,indent:12,contextLabel:Et(e),highlightQuery:ze,onSelect:()=>Xe(`session:${e.id}`,()=>it(e)),longPressHandlers:Ye({key:`session:${e.id}`,kind:`session`,session:e}),onStop:n?()=>Fe(e.id):void 0,stopAriaLabel:r(`mobile.sessions.stopSessionAria`,{title:i})})},e.id)})})]}):null,Nt.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:Nt.length})]}),(0,$.jsx)(`div`,{className:`overflow-hidden rounded-2xl border border-border/40 bg-[var(--surface-elevated)]`,children:Nt.map((e,t)=>{let n=`project:${e.id}`,r=Ye({key:n,kind:`project`,project:e});return(0,$.jsxs)(`div`,{className:Vt(`flex items-center`,t>0&&`border-t border-border/30`),children:[(0,$.jsxs)(`button`,{type:`button`,className:Vt(`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:()=>Xe(n,()=>kt(e)),onPointerDown:r.onPointerDown,onPointerMove:r.onPointerMove,onPointerUp:r.onPointerUp,onPointerCancel:r.onPointerCancel,onContextMenu:r.onContextMenu,style:{touchAction:`manipulation`},children:[(0,$.jsx)(fu,{project:e}),(0,$.jsx)(`span`,{className:`block min-w-0 flex-1 truncate typography-ui-label text-foreground`,children:cr(e.label,ze)}),(0,$.jsx)(`span`,{className:`shrink-0 typography-micro text-muted-foreground tabular-nums`,children:e.sessionCount})]}),e.isGitRepo?(0,$.jsx)(hu,{className:`mr-2`,onClick:()=>ut(e.id)}):null]},e.id)})})]}):null]}):(0,$.jsx)(`div`,{className:`flex flex-col`,children:jt.map((e,t)=>{let n=Ue(e),i=`project:${e.project.id}`,a=Ye({key:i,kind:`project`,project:e.project}),o=ze?e.buckets.filter(t=>t.sessions.some(t=>du(t,e.project.label,ze))):e.buckets,s=He(e);return(0,$.jsxs)(`section`,{className:Vt(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:Vt(`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:()=>Xe(i,()=>nt(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)(fu,{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}),ke.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:ke.get(e.project.id)})]}):null]}),e.isActive?(0,$.jsx)(mu,{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=>Ne.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(),Ie(t)},style:{touchAction:`manipulation`},children:(0,$.jsx)(Li,{})}):null})(),e.project.isGitRepo?(0,$.jsx)(hu,{className:`mr-2`,onClick:()=>ut(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)?$e(e,t,Ql):null,n.map(t=>{let n=We(e,t),i=s===t.path,a=`worktree:${e.project.id}:${t.key}`,o=Ye({key:a,kind:`worktree`,project:e.project,worktree:t.worktree});return(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`button`,{type:`button`,className:Vt(`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:()=>Xe(a,()=>rt(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)(pu,{expanded:n}),(0,$.jsx)(X,{name:`node-tree`,className:Vt(`size-4 shrink-0`,i?`text-primary`:`text-muted-foreground`)}),(0,$.jsx)(`span`,{className:Vt(`block min-w-0 flex-1 truncate typography-ui-label font-semibold`,i?`text-foreground`:`text-foreground/90`),children:t.label}),i?(0,$.jsx)(mu,{ariaLabel:r(`mobile.sessions.activeWorktreeAria`)}):null,(()=>{let e=n?[]:t.sessions.filter(e=>Ne.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(),Ie(e)},style:{touchAction:`manipulation`},children:(0,$.jsx)(Li,{})}):null})(),(0,$.jsx)(`span`,{className:`shrink-0 typography-micro text-muted-foreground tabular-nums`,children:t.sessions.length})]}),n?$e(e,t,Ql):null]},t.key)})]})})()}):null]},e.project.id)})})]}),(0,$.jsx)(_a,{open:ae,onOpenChange:oe,forceMobile:!0}),(0,$.jsx)(Un,{open:se,projectId:W,onOpenChange:e=>{le(e),e||ue(null)},onWorktreeCreated:(e,n)=>{n?.sessionId?v(n.sessionId,e):T({selectedProjectId:W,directoryOverride:e,preserveDirectoryOverride:!0}),t(!1)}}),(0,$.jsx)(lr,{open:!!G,title:Ut,onClose:Je,contentMaxHeightClassName:`max-h-[min(68dvh,560px)]`,children:Gt}),(0,$.jsx)(lr,{open:!!me,title:r(`sessions.sidebar.project.actions.closeProject`),onClose:()=>J(null),closeAriaLabel:r(`mobile.surface.closeAria`),footer:(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[(0,$.jsx)(Y,{type:`button`,variant:`ghost`,className:`flex-1`,onClick:()=>J(null),children:r(`sessions.sidebar.dialogs.cancel`)}),(0,$.jsx)(Y,{type:`button`,variant:`destructive`,className:`flex-1`,onClick:()=>{if(!me)return;let e=me;J(null),k(e.id),Ke.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:me?.label??``})})}),(0,$.jsx)(lr,{open:!!_e,title:r(`sessions.sidebar.session.menu.rename`),onClose:()=>{xe||(ve(null),be(``))},footer:(0,$.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,$.jsx)(Y,{type:`button`,variant:`default`,className:`flex-1`,disabled:xe,onClick:()=>{ve(null),be(``)},children:r(`sessions.sidebar.dialogs.cancel`)}),(0,$.jsx)(Y,{type:`button`,variant:`default`,className:`flex-1`,disabled:!ye.trim()||xe,onClick:()=>void xt(),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(),xt()},children:[(0,$.jsx)(Zn,{value:ye,onChange:e=>be(e.target.value),autoFocus:!0,className:`h-12`,disabled:xe}),(0,$.jsxs)(Y,{type:`button`,variant:`outline`,className:`w-full gap-2`,disabled:xe,onClick:()=>void St(),children:[xe?(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`)]})]})}),Ce?(0,$.jsx)(Ri,{open:!0,project:{id:Ce.project.id,path:Ce.project.path},worktree:Ce.worktree,onClose:()=>we(null),onDeleted:()=>U(e=>e+1)}):null,(0,$.jsx)(ki,{open:te!==null,project:Le.find(e=>e.id===te)??null,onClose:()=>ne(null),onWorktreesChanged:()=>U(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:Ht?(0,$.jsx)(`div`,{className:`flex shrink-0 items-center gap-2`,children:Ht}):null}),Kt]}):null:(0,$.jsx)(Tr,{id:`mobile-sessions-sheet`,open:e,onOpenChange:t,trailing:Ht,ariaLabel:r(`mobile.sessions.sheet.title`),closeAriaLabel:r(`mobile.surface.closeAria`),resizeAriaLabel:r(`mobile.sessions.sheet.resizeAria`),initiallyExpanded:!0,children:Kt})},bu=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},xu=`/assets/assistant-guide-hero-wide-DiFIThB0.jpg`,Su=[{image:Xc,titleKey:`assistants.guide.share.ios.title`,descriptionKey:`assistants.guide.share.ios.description`},{image:Yc,titleKey:`assistants.guide.share.android.title`,descriptionKey:`assistants.guide.share.android.description`},{image:Zc,titleKey:`assistants.guide.share.pick.title`,descriptionKey:`assistants.guide.share.pick.description`}];function Cu(){let e=(0,Q.c)(8),{t}=Te(),n;e[0]===t?n=e[1]:(n=t(`common.loading`),e[0]=t,e[1]=n);let r,i,a,o;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,$.jsx)(`div`,{className:`h-10 w-10 animate-pulse rounded-xl bg-[var(--surface-muted)] motion-reduce:animate-none`}),i=(0,$.jsx)(`div`,{className:`mt-2 h-4 w-2/3 animate-pulse rounded-md bg-[var(--surface-muted)] motion-reduce:animate-none`}),a=(0,$.jsx)(`div`,{className:`h-3.5 w-full animate-pulse rounded-md bg-[var(--surface-muted)] motion-reduce:animate-none`}),o=(0,$.jsx)(`div`,{className:`h-3.5 w-4/5 animate-pulse rounded-md bg-[var(--surface-muted)] motion-reduce:animate-none`}),e[2]=r,e[3]=i,e[4]=a,e[5]=o):(r=e[2],i=e[3],a=e[4],o=e[5]);let s;return e[6]===n?s=e[7]:(s=(0,$.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col gap-3 p-5`,"aria-busy":`true`,"aria-label":n,children:[r,i,a,o]}),e[6]=n,e[7]=s),s}function wu(e){let t=(0,Q.c)(35),{onEnable:n}=e,{t:r}=Te(),i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,$.jsx)(`div`,{className:`yuri-mobile-assistant-guide-hero`,"aria-hidden":`true`,children:(0,$.jsx)(`img`,{src:xu,alt:``})}),t[0]=i):i=t[0];let a;t[1]===r?a=t[2]:(a=r(`assistants.guide.disabledTitle`),t[1]=r,t[2]=a);let o;t[3]===a?o=t[4]:(o=(0,$.jsx)(`h2`,{className:`yuri-mobile-assistant-guide-title`,children:a}),t[3]=a,t[4]=o);let s;t[5]===r?s=t[6]:(s=r(`assistants.guide.disabledDescription`),t[5]=r,t[6]=s);let c;t[7]===s?c=t[8]:(c=(0,$.jsx)(`p`,{className:`yuri-mobile-assistant-guide-description`,children:s}),t[7]=s,t[8]=c);let l;t[9]===r?l=t[10]:(l=r(`assistants.guide.enableAction`),t[9]=r,t[10]=l);let u;t[11]!==n||t[12]!==l?(u=(0,$.jsx)(Y,{type:`button`,size:`lg`,onClick:n,children:l}),t[11]=n,t[12]=l,t[13]=u):u=t[13];let d;t[14]!==o||t[15]!==c||t[16]!==u?(d=(0,$.jsxs)(`div`,{className:`yuri-mobile-assistant-guide-body`,children:[o,c,u]}),t[14]=o,t[15]=c,t[16]=u,t[17]=d):d=t[17];let f;t[18]===r?f=t[19]:(f=r(`assistants.guide.shareTitle`),t[18]=r,t[19]=f);let p;t[20]===f?p=t[21]:(p=(0,$.jsx)(`h3`,{className:`yuri-mobile-assistant-guide-share-title`,children:f}),t[20]=f,t[21]=p);let m;t[22]===r?m=t[23]:(m=r(`assistants.guide.shareAria`),t[22]=r,t[23]=m);let h;t[24]===r?h=t[25]:(h=Su.map(e=>(0,$.jsxs)(`article`,{className:`yuri-mobile-assistant-guide-step`,children:[(0,$.jsx)(`div`,{className:`yuri-mobile-assistant-guide-step-image`,children:(0,$.jsx)(`img`,{src:e.image,alt:``})}),(0,$.jsxs)(`div`,{className:`yuri-mobile-assistant-guide-step-copy`,children:[(0,$.jsx)(`h4`,{children:r(e.titleKey)}),(0,$.jsx)(`p`,{children:r(e.descriptionKey)})]})]},e.titleKey)),t[24]=r,t[25]=h);let g;t[26]!==m||t[27]!==h?(g=(0,$.jsx)(`div`,{className:`yuri-mobile-assistant-guide-steps`,"aria-label":m,children:h}),t[26]=m,t[27]=h,t[28]=g):g=t[28];let _;t[29]!==p||t[30]!==g?(_=(0,$.jsxs)(`section`,{className:`yuri-mobile-assistant-guide-share`,children:[p,g]}),t[29]=p,t[30]=g,t[31]=_):_=t[31];let v;return t[32]!==_||t[33]!==d?(v=(0,$.jsxs)(`article`,{className:`yuri-mobile-assistant-guide`,children:[i,d,_]}),t[32]=_,t[33]=d,t[34]=v):v=t[34],v}function Tu(e){let t=(0,Q.c)(51),{assistant:n,avatarSeed:r,unreadCount:i,assistantID:a,displayName:o,summary:s,editLabel:c,deleteLabel:l,onOpen:u,onEdit:d,onDelete:f,serverWorking:p}=e,m=yi(a,p!==void 0&&p),h=Ti(`assistant:${a}`,u),g=Z.useRef(null),_;t[0]!==c||t[1]!==d?(_={label:c,icon:`edit`,onClick:d},t[0]=c,t[1]=d,t[2]=_):_=t[2];let v;t[3]!==l||t[4]!==f?(v={label:l,icon:`delete-bin`,destructive:!0,onClick:f},t[3]=l,t[4]=f,t[5]=v):v=t[5];let y;t[6]!==_||t[7]!==v?(y=[_,v],t[6]=_,t[7]=v,t[8]=y):y=t[8];let b;t[9]!==h||t[10]!==y?(b=(0,$.jsx)(Ji,{swipe:h,actions:y}),t[9]=h,t[10]=y,t[11]=b):b=t[11];let x=h.dragging?`transition-none`:`transition-transform duration-150 ease-out`,S;t[12]===x?S=t[13]:(S=Vt(`yuri-mobile-assistant-card relative z-10 motion-reduce:transition-none`,x),t[12]=x,t[13]=S);let C=h.handleSelect,w=h.handlePointerDown,T=h.handlePointerMove,E=h.finishGesture,D=h.handlePointerCancel,O=`translate3d(${h.offset}px, 0, 0)`,k=h.offset===0?void 0:`transform`,A;t[14]!==O||t[15]!==k?(A={touchAction:`pan-y`,transform:O,willChange:k},t[14]=O,t[15]=k,t[16]=A):A=t[16];let j;t[17]!==a||t[18]!==r||t[19]!==o||t[20]!==m?(j=(0,$.jsx)(`span`,{className:`yuri-mobile-assistant-avatar`,children:(0,$.jsx)(bi,{name:a,avatarSeed:r,size:44,label:o,working:m,hoverTarget:g})}),t[17]=a,t[18]=r,t[19]=o,t[20]=m,t[21]=j):j=t[21];let M;t[22]===o?M=t[23]:(M=(0,$.jsx)(`span`,{className:`yuri-mobile-entity-title yuri-mobile-assistant-name block min-w-0 truncate font-semibold text-foreground`,children:o}),t[22]=o,t[23]=M);let N;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(N=Vt(`yuri-mobile-assistant-summary`,vo),t[24]=N):N=t[24];let P;t[25]===s?P=t[26]:(P=(0,$.jsx)(`span`,{className:N,children:s}),t[25]=s,t[26]=P);let F;t[27]!==M||t[28]!==P?(F=(0,$.jsxs)(`span`,{className:`yuri-mobile-assistant-card-content min-w-0 flex-1`,children:[M,P]}),t[27]=M,t[28]=P,t[29]=F):F=t[29];let I;t[30]===i?I=t[31]:(I=(0,$.jsx)(uo,{count:i}),t[30]=i,t[31]=I);let L;t[32]!==h.finishGesture||t[33]!==h.handlePointerCancel||t[34]!==h.handlePointerDown||t[35]!==h.handlePointerMove||t[36]!==h.handleSelect||t[37]!==A||t[38]!==j||t[39]!==F||t[40]!==I||t[41]!==S?(L=(0,$.jsxs)(`button`,{ref:g,type:`button`,role:`option`,"aria-selected":`false`,"data-mobile-press-feedback":`soft`,className:S,onClick:C,onPointerDown:w,onPointerMove:T,onPointerUp:E,onPointerCancel:D,style:A,children:[j,F,I]}),t[32]=h.finishGesture,t[33]=h.handlePointerCancel,t[34]=h.handlePointerDown,t[35]=h.handlePointerMove,t[36]=h.handleSelect,t[37]=A,t[38]=j,t[39]=F,t[40]=I,t[41]=S,t[42]=L):L=t[42];let R;t[43]!==n||t[44]!==f||t[45]!==d||t[46]!==L?(R=(0,$.jsx)(ho,{assistant:n,onEdit:d,onDelete:f,trigger:L}),t[43]=n,t[44]=f,t[45]=d,t[46]=L,t[47]=R):R=t[47];let ee;return t[48]!==R||t[49]!==b?(ee=(0,$.jsxs)(hi,{className:`yuri-mobile-assistant-card-shell relative isolate overflow-clip`,children:[b,R]}),t[48]=R,t[49]=b,t[50]=ee):ee=t[50],ee}function Eu(e){let t=(0,Q.c)(128),{onEnable:n,onOpenAssistant:r,className:i}=e,{t:a}=Te(),o=ti(),s=Re(),c=Be();c.data?.assistants;let l;t[0]===c.data?.assistants?l=t[1]:(l=c.data?.assistants??[],t[0]=c.data?.assistants,t[1]=l);let u;t[2]===l?u=t[3]:(u=fo(l),t[2]=l,t[3]=u);let d=u,f=Ht(Du),[p,m]=Z.useState(null),h;t[4]===n?h=t[5]:(h=()=>n(),t[4]=n,t[5]=h);let g=q(h),_;t[6]!==o||t[7]!==f?(_=()=>{f(),o?.openSettings(`assistants`)},t[6]=o,t[7]=f,t[8]=_):_=t[8];let v=q(_),y;t[9]===r?y=t[10]:(y=e=>r(e),t[9]=r,t[10]=y);let b=q(y),x;t[11]===o?x=t[12]:(x=e=>{Wt(e,o?{openMobileSettings:o.openSettings}:void 0)},t[11]=o,t[12]=x);let S=q(x),C;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(C=e=>{m(e)},t[13]=C):C=t[13];let w=q(C),T;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(T=e=>{e||m(null)},t[14]=T):T=t[14];let E=q(T),D;t[15]===a?D=t[16]:(D=a(`assistants.title`),t[15]=a,t[16]=D);let O=D,k;t[17]===a?k=t[18]:(k=a(`assistants.menu.edit`),t[17]=a,t[18]=k);let A=k,j;t[19]===a?j=t[20]:(j=a(`assistants.settings.delete`),t[19]=a,t[20]=j);let M=j,N;t[21]===i?N=t[22]:(N=Vt(`yuri-assistant-mobile-catalog-page`,i),t[21]=i,t[22]=N);let P=N;if(s.isPending||s.data?.supported&&s.data.enabled&&c.isPending){let e;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(hi,{className:`yuri-mobile-assistant-loading`,children:(0,$.jsx)(Cu,{})}),t[23]=e):e=t[23];let n;return t[24]!==P||t[25]!==O?(n=(0,$.jsx)(pi,{title:O,className:P,surface:!1,children:e}),t[24]=P,t[25]=O,t[26]=n):n=t[26],n}if(s.data?.supported&&s.data.enabled&&c.data?.enabled&&c.data.assistants.length>0){let e;t[27]===c.data?e=t[28]:(e=(0,$.jsx)(_o,{snapshot:c.data,compact:!0,mobile:!0}),t[27]=c.data,t[28]=e);let n;t[29]===a?n=t[30]:(n=a(`assistants.settings.create`),t[29]=a,t[30]=n);let r;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,$.jsx)(X,{name:`add`,className:`size-5`}),t[31]=r):r=t[31];let i;t[32]!==v||t[33]!==n?(i=(0,$.jsx)(Y,{type:`button`,variant:`mobileGlass`,size:`mobileIcon`,className:`yuri-mobile-inverse-action`,"aria-label":n,onClick:v,children:r}),t[32]=v,t[33]=n,t[34]=i):i=t[34];let o;t[35]!==e||t[36]!==i?(o=(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e,i]}),t[35]=e,t[36]=i,t[37]=o):o=t[37];let s;t[38]===a?s=t[39]:(s=a(`assistants.listAria`),t[38]=a,t[39]=s);let l;t[40]!==d.pinned||t[41]!==S||t[42]!==b||t[43]!==w?(l=(0,$.jsx)(yo,{contacts:d.pinned,onSelect:b,onEdit:S,onDelete:w}),t[40]=d.pinned,t[41]=S,t[42]=b,t[43]=w,t[44]=l):l=t[44];let u;if(t[45]!==d.unpinned||t[46]!==M||t[47]!==A||t[48]!==S||t[49]!==b||t[50]!==w||t[51]!==a){let e;t[53]!==M||t[54]!==A||t[55]!==S||t[56]!==b||t[57]!==w||t[58]!==a?(e=e=>{let t=Gt(e.name).displayName||e.name,n=go(e.latestMessagePreview,a);return(0,$.jsx)(Tu,{assistant:e,assistantID:e.id,avatarSeed:e.avatarSeed,unreadCount:e.unreadCount??0,displayName:t,summary:n,editLabel:A,deleteLabel:M,assignedSessionIDs:e.assignedSessionIDs,serverWorking:e.working,onOpen:()=>b(e.id),onEdit:()=>S(e.id),onDelete:()=>w(e)},e.id)},t[53]=M,t[54]=A,t[55]=S,t[56]=b,t[57]=w,t[58]=a,t[59]=e):e=t[59],u=d.unpinned.map(e),t[45]=d.unpinned,t[46]=M,t[47]=A,t[48]=S,t[49]=b,t[50]=w,t[51]=a,t[52]=u}else u=t[52];let f;t[60]!==s||t[61]!==l||t[62]!==u?(f=(0,$.jsxs)(`div`,{className:`yuri-mobile-assistant-catalog`,role:`listbox`,"aria-label":s,children:[l,u]}),t[60]=s,t[61]=l,t[62]=u,t[63]=f):f=t[63];let m=p!==null,h;t[64]!==p||t[65]!==E||t[66]!==m?(h=(0,$.jsx)(mo,{assistant:p,open:m,onOpenChange:E}),t[64]=p,t[65]=E,t[66]=m,t[67]=h):h=t[67];let g;return t[68]!==P||t[69]!==O||t[70]!==o||t[71]!==f||t[72]!==h?(g=(0,$.jsxs)(pi,{title:O,className:P,surface:!1,scrollsWithPage:!0,trailing:o,children:[f,h]}),t[68]=P,t[69]=O,t[70]=o,t[71]=f,t[72]=h,t[73]=g):g=t[73],g}if(s.data?.supported&&s.data.enabled&&c.data?.enabled&&c.data.assistants.length===0){let e;t[74]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(`span`,{className:`yuri-mobile-assistant-onboarding-icon`,children:(0,$.jsx)(X,{name:`ai-agent`,className:`size-5`})}),t[74]=e):e=t[74];let n;t[75]===a?n=t[76]:(n=a(`assistants.onboarding.title`),t[75]=a,t[76]=n);let r;t[77]===n?r=t[78]:(r=(0,$.jsx)(`h2`,{children:n}),t[77]=n,t[78]=r);let i;t[79]===a?i=t[80]:(i=a(`assistants.onboarding.description`),t[79]=a,t[80]=i);let o;t[81]===i?o=t[82]:(o=(0,$.jsx)(`p`,{children:i}),t[81]=i,t[82]=o);let s;t[83]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,$.jsx)(X,{name:`add`,className:`size-[18px]`}),t[83]=s):s=t[83];let c;t[84]===a?c=t[85]:(c=a(`assistants.onboarding.action`),t[84]=a,t[85]=c);let l;t[86]!==v||t[87]!==c?(l=(0,$.jsxs)(Y,{type:`button`,size:`lg`,className:`mt-6 w-full`,onClick:v,children:[s,c]}),t[86]=v,t[87]=c,t[88]=l):l=t[88];let u;t[89]!==r||t[90]!==o||t[91]!==l?(u=(0,$.jsxs)(hi,{className:`yuri-mobile-assistant-onboarding`,children:[e,r,o,l]}),t[89]=r,t[90]=o,t[91]=l,t[92]=u):u=t[92];let d;return t[93]!==P||t[94]!==O||t[95]!==u?(d=(0,$.jsx)(pi,{title:O,className:P,surface:!1,surfaceClassName:`yuri-mobile-assistant-state`,children:u}),t[93]=P,t[94]=O,t[95]=u,t[96]=d):d=t[96],d}let F=s.isSuccess&&s.data.supported===!1,I=s.isError||s.data?.supported===!0&&s.data.enabled&&c.isError,L=s.data?.supported===!0&&(s.data.enabled===!1||c.data?.enabled===!1),R;t[97]!==a||t[98]!==I||t[99]!==F?(R=a(I?`assistants.state.unavailable`:F?`assistants.state.unsupportedTitle`:`assistants.state.instanceDisabled`),t[97]=a,t[98]=I,t[99]=F,t[100]=R):R=t[100];let ee=R;if(L&&!I){let e;t[101]===g?e=t[102]:(e=(0,$.jsx)(wu,{onEnable:g}),t[101]=g,t[102]=e);let n;return t[103]!==P||t[104]!==O||t[105]!==e?(n=(0,$.jsx)(pi,{title:O,className:P,surface:!1,surfaceClassName:`yuri-mobile-assistant-guide-host`,children:e}),t[103]=P,t[104]=O,t[105]=e,t[106]=n):n=t[106],n}let z;t[107]===O?z=t[108]:(z=(0,$.jsx)(`span`,{className:`yuri-mobile-page-section-label`,children:O}),t[107]=O,t[108]=z);let B=F?`cloud-off`:`sparkling`,V;t[109]===B?V=t[110]:(V=(0,$.jsx)(`div`,{className:`flex size-12 items-center justify-center rounded-xl bg-interactive-selection text-interactive-selection-foreground`,children:(0,$.jsx)(X,{name:B,weight:`medium`,className:`size-5`})}),t[109]=B,t[110]=V);let te;t[111]===ee?te=t[112]:(te=(0,$.jsx)(`h2`,{className:`mt-5 max-w-xs text-lg font-semibold leading-snug tracking-[-0.02em] text-foreground`,children:ee}),t[111]=ee,t[112]=te);let ne;t[113]!==a||t[114]!==I||t[115]!==F?(ne=I?null:(0,$.jsx)(`p`,{className:`mt-2 max-w-sm typography-small leading-relaxed text-muted-foreground`,children:a(F?`assistants.state.unsupportedDescription`:`assistants.state.instanceDisabledDescription`)}),t[113]=a,t[114]=I,t[115]=F,t[116]=ne):ne=t[116];let re;t[117]!==V||t[118]!==te||t[119]!==ne?(re=(0,$.jsxs)(`section`,{className:`w-full max-w-md py-2`,children:[V,te,ne]}),t[117]=V,t[118]=te,t[119]=ne,t[120]=re):re=t[120];let H;t[121]!==z||t[122]!==re?(H=(0,$.jsx)(gi,{label:z,cardClassName:`yuri-mobile-assistant-state-card`,children:re}),t[121]=z,t[122]=re,t[123]=H):H=t[123];let ie;return t[124]!==P||t[125]!==O||t[126]!==H?(ie=(0,$.jsx)(pi,{title:O,className:P,surface:!1,surfaceClassName:`yuri-mobile-assistant-state`,children:H}),t[124]=P,t[125]=O,t[126]=H,t[127]=ie):ie=t[127],ie}function Du(e){return e.requestCreate}function Ou(e){let t=(0,Q.c)(16),{assistantID:n,onBack:r}=e,{t:i}=Te(),[a,o]=(0,Z.useState)(null),s;t[0]===i?s=t[1]:(s=i(`assistants.title`),t[0]=i,t[1]=s);let c;t[2]===i?c=t[3]:(c=i(`settings.view.actions.back`),t[2]=i,t[3]=c);let l;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,$.jsx)(`div`,{ref:o}),t[4]=l):l=t[4];let u;t[5]!==r||t[6]!==s||t[7]!==c?(u=(0,$.jsx)(ze,{title:s,backAriaLabel:c,onBack:r,trailing:l}),t[5]=r,t[6]=s,t[7]=c,t[8]=u):u=t[8];let d;t[9]!==n||t[10]!==r||t[11]!==a?(d=(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden px-[var(--yuri-mobile-page-inline-inset)] pb-[var(--yuri-safe-area-bottom,env(safe-area-inset-bottom,0px))]`,children:(0,$.jsx)(hi,{className:`yuri-mobile-settings-detail-card h-full`,children:(0,$.jsx)(fr,{children:(0,$.jsx)(io,{assistantID:n,onItemDeleted:r,onSaved:r,saveActionContainer:a},n)})})}),t[9]=n,t[10]=r,t[11]=a,t[12]=d):d=t[12];let f;return t[13]!==u||t[14]!==d?(f=(0,$.jsxs)(`div`,{"data-settings-view":`true`,"data-mobile-settings-stage":`page-content`,className:`yuri-settings-workspace yuri-settings-workspace-mobile flex h-full min-h-0 flex-col overflow-hidden bg-background`,children:[u,d]}),t[13]=u,t[14]=d,t[15]=f):f=t[15],f}function ku(e){let t=(0,Q.c)(13),{route:n}=e,{t:r}=Te(),i;t[0]===r?i=t[1]:(i=r(`chat.btw.title`),t[0]=r,t[1]=i);let a;t[2]===r?a=t[3]:(a=r(`header.actions.backAria`),t[2]=r,t[3]=a);let o;t[4]!==i||t[5]!==a?(o=(0,$.jsx)(ze,{title:i,backAriaLabel:a,onBack:Au}),t[4]=i,t[5]=a,t[6]=o):o=t[6];let s;t[7]!==n.directory||t[8]!==n.sessionId?(s=(0,$.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,$.jsx)(Mn,{scope:{sessionId:n.sessionId,directory:n.directory},foot:`page`})}),t[7]=n.directory,t[8]=n.sessionId,t[9]=s):s=t[9];let c;return t[10]!==o||t[11]!==s?(c=(0,$.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col bg-background`,children:[o,s]}),t[10]=o,t[11]=s,t[12]=c):c=t[12],c}function Au(){Hr.requestAnimatedBack(`root`)}var ju=[{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 Mu(e){let t=(0,Q.c)(22),{activeTab:n,onTabChange:r,className:i,tabMarks:a}=e,{t:o}=Te(),s=Ve(),c;t[0]===o?c=t[1]:(c=o(`mobile.tabs.activity.loading`),t[0]=o,t[1]=c);let l=c,u;t[2]===r?u=t[3]:(u=e=>{r(e.currentTarget.dataset.tab)},t[2]=r,t[3]=u);let d=q(u),f;t[4]!==n||t[5]!==r?(f=e=>{if(![`ArrowLeft`,`ArrowRight`,`Home`,`End`].includes(e.key))return;e.preventDefault();let t=ju.findIndex(e=>e.id===n),i=ju[e.key===`Home`?0:e.key===`End`?ju.length-1:(t+(e.key===`ArrowRight`?1:-1)+ju.length)%ju.length];r(i.id),document.getElementById(`mobile-tab-${i.id}`)?.focus()},t[4]=n,t[5]=r,t[6]=f):f=t[6];let p=q(f),m;t[7]===o?m=t[8]:(m=o(`mobile.nav.aria`),t[7]=o,t[8]=m);let h;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(h={role:`tablist`},t[9]=h):h=t[9];let g;t[10]!==n||t[11]!==s||t[12]!==d||t[13]!==p||t[14]!==l||t[15]!==o||t[16]!==a?(g=ju.map(e=>{let t=e.id===n,r=o(e.labelKey),i=e.id===`assistant`&&s>0,c=!i&&a?.[e.id]===`loading`,u=i?`mobile-tab-assistant-unread`:c?`mobile-tab-${e.id}-activity`:void 0;return(0,$.jsxs)(Y,{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:d,onKeyDown:p,className:Vt(`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)(Ma,{size:23,className:`size-[23px] shrink-0 items-center justify-center [&[data-assistant-navigation-avatar]]:scale-105`}):(0,$.jsx)(X,{name:e.icon,weight:`medium`,className:`size-[23px] shrink-0`}),u?(0,$.jsx)(`span`,{id:u,role:c?`status`:void 0,"aria-label":c?l:void 0,"data-mobile-tab-activity":c?`loading`:void 0,className:`pointer-events-none absolute left-full -top-1 ml-0.5 inline-flex z-10`,children:i?(0,$.jsx)(po,{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]=s,t[12]=d,t[13]=p,t[14]=l,t[15]=o,t[16]=a,t[17]=g):g=t[17];let _;return t[18]!==i||t[19]!==m||t[20]!==g?(_=(0,$.jsx)(_i,{as:`nav`,"aria-label":m,variant:`navigation`,surfaceProps:h,className:i,children:g}),t[18]=i,t[19]=m,t[20]=g,t[21]=_):_=t[21],_}function Nu(e){return e.unreadCount>0?`unread`:e.working?`loading`:null}var Pu=`yuri-native-ios-tab-bar`,Fu=`YuriTabBar`,Iu=[`projects`,`assistant`,`scheduled`,`settings`],Lu=me(Fu),Ru=e=>e.isCapacitor&&e.platform===`ios`&&e.pluginAvailable&&e.nativeUiEnabled!==!1;function zu(){return typeof window>`u`?!1:Ru({isCapacitor:g(),platform:y(),pluginAvailable:J.isPluginAvailable(Fu),nativeUiEnabled:Pr()})}var Bu=e=>e.classList.contains(`dark`)?`dark`:`light`,Vu=()=>Ir(`--primary`),Hu=e=>typeof e==`string`&&Iu.includes(e),Uu=e=>typeof e==`string`&&Hu(e)?e:null,Wu=(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)),Gu=(e,t)=>{e.classList.toggle(Pu,t)},Ku=(e,t)=>e&&!t,qu=e=>e.visible?e.overlayHidden?{action:`present`}:e.lastState&&Wu(e.lastState,e.nextState)?{action:`skip`}:{action:`present`}:e.overlayHidden?{action:`skip`}:{action:`hide`},Ju=()=>Lu,Yu=`mobile-overlay-root`;function Xu(e){let t=(0,Q.c)(28),n=Fr(),r;t[0]===n?r=t[1]:(r=n&&zu(),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=q(e.onTabChange),h;t[2]===e.tabs?h=t[3]:(h=JSON.stringify(e.tabs.map(Qu)),t[2]=e.tabs,t[3]=h);let g=h,_;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(_=typeof document>`u`?`dark`:Bu(document.documentElement),t[4]=_):_=t[4];let v=_,y;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(y=typeof document>`u`?``:Vu(),t[5]=y):y=t[5];let b=y,x,S;t[6]===i?(x=t[7],S=t[8]):(x=()=>{if(!i||typeof document>`u`)return;let e=document.getElementById(Yu);e||(e=document.createElement(`div`),e.id=Yu,document.body.appendChild(e));let t=()=>u(Bn(e.children));t();let n=new MutationObserver(t);return n.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[zn]}),()=>n.disconnect()},S=[i],t[6]=i,t[7]=x,t[8]=S),(0,Z.useEffect)(x,S);let C;t[9]!==i||t[10]!==m?(C=()=>{if(!i)return;let e=!1,t=Ju(),n=[];return t.addListener(`tabSelected`,e=>{let t=Uu(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`&&Gu(document.documentElement,!1)}},t[9]=i,t[10]=m,t[11]=C):C=t[11];let w;t[12]===i?w=t[13]:(w=[i],t[12]=i,t[13]=w),(0,Z.useEffect)(C,w);let T;t[14]!==e.activeTab||t[15]!==e.ariaLabel||t[16]!==e.tabs||t[17]!==e.visible||t[18]!==i||t[19]!==l?(T=()=>{if(!i||p.current)return;let t=!1,n=Ju(),r={tabs:e.tabs.map(Zu),selectedTab:e.activeTab,appearance:v,accentColor:b,ariaLabel:e.ariaLabel},a=qu({visible:Ku(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`&&Gu(document.documentElement,!1);return}f.current=!1,d.current=r,o(!0),typeof document<`u`&&Gu(document.documentElement,!0)}})().catch(()=>{t||(p.current=!0,c(!0),o(!1),typeof document<`u`&&Gu(document.documentElement,!1))}),()=>{t=!0}},t[14]=e.activeTab,t[15]=e.ariaLabel,t[16]=e.tabs,t[17]=e.visible,t[18]=i,t[19]=l,t[20]=T):T=t[20];let E;return t[21]!==e.activeTab||t[22]!==e.ariaLabel||t[23]!==e.visible||t[24]!==i||t[25]!==l||t[26]!==g?(E=[i,e.visible,l,e.activeTab,e.ariaLabel,v,b,g],t[21]=e.activeTab,t[22]=e.ariaLabel,t[23]=e.visible,t[24]=i,t[25]=l,t[26]=g,t[27]=E):E=t[27],(0,Z.useLayoutEffect)(T,E),!i||s?`web`:a?`native`:`pending`}function Zu(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 Qu(e){return[e.id,e.label,e.badge??null,e.activity===!0,e.activity===!0?e.activityLabel??null:null]}function $u(e){let t=(0,Q.c)(52),{tabs:n,navigation:r,onTabChange:i,secondaryPages:a,showTabBar:o,tabBarCovered:s,className:c}=e,l=a===void 0?[]:a,u=o===void 0||o,d=s!==void 0&&s,{t:f}=Te(),p=r.activeTab,m=l.slice(-2),h=m.at(-1)??null,g=h?.key??null,_=h?.depth,v=m.length>1?m[m.length-2].key:null,y;t[0]===p?y=t[1]:(y=()=>new Set([p]),t[0]=p,t[1]=y);let[b,x]=Z.useState(y);b.has(p)||x(e=>{if(e.has(p))return e;let t=new Set(e);return t.add(p),t});let S=Z.useRef(null),C=Z.useRef(null),w=Z.useRef(null),T=Z.useRef(new Map),E=Z.useRef(null),D=Z.useRef(!1),O=Z.useRef(``),k=q(()=>h?.onBack());zr({id:h?`mobile-secondary:${h.key}`:`mobile-secondary:inactive`,active:!!h,onBack:k,surfaceRef:S,underlayRef:C}),Z.useLayoutEffect(()=>{let e=g===null?null:T.current.get(g)??null,t=v===null?w.current:T.current.get(v)??null;S.current=e,C.current=t},[g,_,v]);let A;t[2]===h?A=t[3]:(A=[h],t[2]=h,t[3]=A),Z.useLayoutEffect(()=>{if(h){if(!D.current){let e=document.activeElement;E.current=e instanceof HTMLElement?e:null,D.current=!0}O.current!==h.key&&(O.current=h.key,S.current?.focus());return}if(D.current){D.current=!1,O.current=``;let e=E.current;E.current=null,e&&e.isConnected&&e.focus()}},A);let j;t[4]===i?j=t[5]:(j=e=>{i(e)},t[4]=i,t[5]=j);let M=q(j),N=Ve(),P=Le(),F=Ie(),I;t[6]===f?I=t[7]:(I=f(`mobile.tabs.activity.loading`),t[6]=f,t[7]=I);let L=I,R;t[8]!==N||t[9]!==P?(R=Nu({unreadCount:N,working:P}),t[8]=N,t[9]=P,t[10]=R):R=t[10];let ee=R,z;t[11]===F?z=t[12]:(z=Nu({unreadCount:0,working:F}),t[11]=F,t[12]=z);let B=z,V;t[13]!==ee||t[14]!==N||t[15]!==L||t[16]!==B||t[17]!==f?(V=ju.map(e=>{let t=e.id===`assistant`&&ee===`loading`||e.id===`scheduled`&&B===`loading`;return{id:e.id,label:f(e.labelKey),badge:e.id===`assistant`&&ee===`unread`?N>99?`99+`:String(N):null,activity:t,activityLabel:t?L:null}}),t[13]=ee,t[14]=N,t[15]=L,t[16]=B,t[17]=f,t[18]=V):V=t[18];let te=V,ne=u&&!d&&!h,re;t[19]===f?re=t[20]:(re=f(`mobile.nav.aria`),t[19]=f,t[20]=re);let H;t[21]!==M||t[22]!==ne||t[23]!==te||t[24]!==p||t[25]!==re?(H={visible:ne,activeTab:p,tabs:te,ariaLabel:re,onTabChange:M},t[21]=M,t[22]=ne,t[23]=te,t[24]=p,t[25]=re,t[26]=H):H=t[26];let ie=Xu(H),U=ie===`native`,ae=u&&ie===`web`,oe=Fr(),se,ce;t[27]!==oe||t[28]!==U?(se=()=>{if(!oe){Vr.shutdown();return}U&&Lr(!0)&&Vr.warm()},ce=[oe,U],t[27]=oe,t[28]=U,t[29]=se,t[30]=ce):(se=t[29],ce=t[30]),Z.useEffect(se,ce);let le=p===`assistant`&&`yuri-assistant-wallpaper`,W;t[31]!==c||t[32]!==le?(W=Vt(`yuri-mobile-floating-shell relative isolate flex h-full min-h-0 flex-col overflow-hidden text-foreground`,`bg-[var(--yuri-mobile-page-background)]`,le,c),t[31]=c,t[32]=le,t[33]=W):W=t[33];let ue=h?!0:void 0,G=h?!0:void 0,de=h?`true`:void 0,K;t[34]!==p||t[35]!==u||t[36]!==ae||t[37]!==f||t[38]!==n||t[39]!==b?(K=ju.map(e=>{let t=b.has(e.id);return(0,$.jsx)(`section`,{id:`mobile-tabpanel-${e.id}`,role:`tabpanel`,"aria-labelledby":ae?`mobile-tab-${e.id}`:void 0,"aria-label":ae?void 0:f(e.labelKey),hidden:p!==e.id,tabIndex:0,className:Vt(`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`,u?`pb-[calc(var(--yuri-mobile-dock-height)+2.5rem+var(--safe-area-inset-bottom,env(safe-area-inset-bottom,0px)))]`:`pb-0`),children:t?n?.[e.id]??(0,$.jsx)(ed,{tab:e.id,icon:e.icon}):null},e.id)}),t[34]=p,t[35]=u,t[36]=ae,t[37]=f,t[38]=n,t[39]=b,t[40]=K):K=t[40];let fe=u?(0,$.jsx)(`div`,{"data-mobile-navigation-dock-underlay":`true`,"aria-hidden":h||U?!0:void 0,inert:h||U?!0:void 0,children:ae?(0,$.jsx)(Mu,{activeTab:p,onTabChange:M,tabMarks:{assistant:ee===`loading`?`loading`:null,scheduled:B===`loading`?`loading`:null}}):null}):null,pe;t[41]!==w||t[42]!==ue||t[43]!==G||t[44]!==de||t[45]!==K||t[46]!==fe?(pe=(0,$.jsxs)(`div`,{ref:w,"data-mobile-navigation-underlay":`true`,"aria-hidden":ue,inert:G,"data-mobile-navigation-parked":de,className:`flex h-full min-h-0 flex-1 flex-col`,children:[K,fe]}),t[41]=w,t[42]=ue,t[43]=G,t[44]=de,t[45]=K,t[46]=fe,t[47]=pe):pe=t[47];let me=m.map((e,t)=>{let n=t===m.length-1;return(0,$.jsx)(`div`,{ref:t=>{t?T.current.set(e.key,t):T.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??f(`mobile.nav.secondaryPageAria`):void 0,"aria-hidden":!n||void 0,inert:!n||void 0,tabIndex:n?-1:void 0,className:Vt(`absolute inset-0 flex h-full min-h-0 flex-col overflow-hidden bg-background outline-none`,n?`z-50`:`z-40`),children:e.content},e.key)}),J;return t[48]!==W||t[49]!==pe||t[50]!==me?(J=(0,$.jsxs)(`div`,{className:W,children:[pe,me]}),t[48]=W,t[49]=pe,t[50]=me,t[51]=J):J=t[51],J}function ed(e){let t=(0,Q.c)(17),{tab:n,icon:r,className:i}=e,{t:a}=Te(),o,s,c,l;if(t[0]!==i||t[1]!==r||t[2]!==a||t[3]!==n){let e=ju.find(e=>e.id===n)??ju[0];t[8]===i?c=t[9]:(c=Vt(`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 td=(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.activityLabel===t.activityLabel&&e.unread===t.unread&&e.pinned===t.pinned&&e.active===t.active,nd=[],rd=(e,t,n)=>{let r=(e??t)?.trim();return r&&r!==`HEAD`&&r!==n?r:void 0};function id(e,t){let{enabled:n,settledLimit:r}=t,{t:i}=Te(),a=Lt(),o=ra(),s=Ei({enabled:n}),c=ht(),l=yt(e=>e.index.session.unseenCount),u=At(e=>e.sessionOrderByScope[zi]),d=Dt(e=>e.projects),f=Tt(e=>e.currentSessionId),p=oa(s,n),m=Z.useRef(new Map),{git:h}=ce(),g=Dr(e=>e.ensureStatus),_=Z.useMemo(()=>n?[...e.projectMetaById.values()].map(e=>e.path):nd,[n,e.projectMetaById]),v=kr(_);return Z.useEffect(()=>{if(!(!n||!h))for(let e of _)g(e,h)},[n,g,h,_]),Z.useMemo(()=>{if(!n)return null;let t=Ui({sessions:e.allSessions,pinnedSessionIds:a,settledSessionIds:o,runningSessionIds:s,pendingRequestSessionIds:c,unseenBySession:l}),h=ji(e.allSessions,a,u).filter(Di),g=new Map(d.map(e=>[e.id,e.color??void 0])),_=i(`mobile.sessions.untitled`),y=i(`sessions.sidebar.task.unassigned`),b=m.current,x=new Map,S=(t,n)=>{let r=e.ownership.bySessionId.get(t.id),i=r?e.projectMetaById.get(r.projectId):void 0,a=i&&r?.kind===`worktree`?ca(i,r.scopeDirectory):null,o={id:t.id,title:t.title?.trim()||_,directory:da(t),projectLabel:i?.label||y,project:i?{id:i.id,icon:i.icon??void 0,color:g.get(i.id),iconImage:i.iconImage??void 0}:null,branch:rd(a?.branch,i?v.get(i.path)?.branch:null,i?.label),activityLabel:Ea(ha(t))||void 0,unread:(l[t.id]??0)>0,pinned:n,active:f===t.id},s=b.get(t.id),c=s&&td(s,o)&&s.project?.iconImage===o.project?.iconImage?s:o;return x.set(t.id,c),c},C={pinned:h.map(e=>S(e,!0)),active:t.active.map(e=>S(e,!1)),settled:t.settled.slice(0,r).map(e=>S(e,!1)),settledTotal:t.settled.length,settledIds:o,runStartTimes:p};return m.current=x,C},[f,n,v,e.allSessions,e.ownership,e.projectMetaById,c,u,a,d,p,s,o,r,i,l])}var ad=(e,t,n)=>e?.kind===`project`&&e.project.id===t?{...e,isGitRepository:n}:e,od=`yuri.mobile.homeView`;function sd({onOpenChat:e,onAddProject:t,onNewSession:n,onScanQr:r,onSwitchInstance:i,onRemoteDesktop:a,instanceOptions:o,className:s}){let{t:c}=Te(),{git:l}=ce(),u=ot(),d=ba(),[f,p]=Z.useState(()=>new Map),m=q((e,t)=>{p(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})}),g=q((e,t,n,r)=>{let i=At.getState(),a=e===`__pinned__`?e:h(e);if(!a||a!==`__pinned__`&&i.getSessionFolderId(a,n)!==i.getSessionFolderId(a,r))return;let o=a===`__pinned__`?{}:Ii(d.allSessions.filter(e=>da(e)===a));i.reorderSessions(a,t,n,r,o).catch(()=>Ke.error(c(`sessions.order.saveFailed`)))}),_=Xi(e=>e.setProjectExpanded),v=Xi(e=>e.setWorktreeExpanded),y=tt(),b=Sa(),[x,S]=Z.useState(()=>Gi(A().getItem(od)??`projects`)),[C,w]=Z.useState(!1),[T,E]=Z.useState(30),D=id(d,{enabled:x===`tasks`,settledLimit:T}),O=q(e=>{S(e);try{A().setItem(od,e)}catch{}}),k=q(e=>{w(e),e||E(30)}),j=q(()=>E(e=>e+30)),M=q(e=>{b(e,!1)}),N=Lt(),P=Tt(e=>e.archiveSessions),F=Tt(e=>e.updateSessionTitle),I=Tt(e=>e.requestSessionSmartTitle),L=Tt(e=>e.shareSession),R=Tt(e=>e.unshareSession),ee=Tt(e=>e.openNewSessionDraft),z=kt(e=>e.openDraft),B=kt(e=>e.openSession),V=Dt(e=>e.projects),te=nt(e=>e.projectSortOrder),ne=Qi(),re=Z.useMemo(()=>V.filter(e=>e.hostId).map(Yt),[V]),H=Z.useMemo(()=>re.flatMap(e=>f.get(e.id)??[]).map(e=>({pinned:!!e.pinned,time:ft(e.node.session),session:{id:e.identity,title:e.node.session.title||``,content:e.content}})),[re,f]),ie=At(e=>e.sessionOrderByScope[zi]),U=Z.useMemo(()=>Fi([...d.pinnedSessions,...H.filter(e=>e.pinned).map(e=>e.session)],e=>e.id,ie),[d.pinnedSessions,H,ie]),ae=Z.useMemo(()=>[...d.inProgressSessions.map(e=>({session:e,time:d.sessionById.get(e.id)?ft(d.sessionById.get(e.id)):0})),...H.filter(e=>!e.pinned)].sort((e,t)=>t.time-e.time).map(e=>e.session),[d.inProgressSessions,d.sessionById,H]),oe=Dt(e=>e.setActiveProjectIdOnly),se=Dt(e=>e.removeProject),le=Sn(),[W,ue]=Z.useState(null),[G,de]=Z.useState(!1),[K,fe]=Z.useState(null),[pe,me]=Z.useState(null),[J,he]=Z.useState(null),[ge,_e]=Z.useState(``),[ve,ye]=Z.useState(!1),[be,xe]=Z.useState(!1),[Se,Ce]=Z.useState(null),[we,Ee]=Z.useState(null),[De,Oe]=Z.useState(null),ke=W?.kind===`session`?W.session.id:``,Ae=Et(ke),je=Ae?.type===`busy`||Ae?.type===`retry`,Me=W?.kind===`session`?da(W.session):``,{unread:Ne,onToggleRead:Pe}=Ja(W?.kind===`session`?W.session:null,Me),Fe=!!ke&&De===ke,Ie=!Me||Fe||je,Le=q(e=>{let t=new Map;for(let e of d.allSessions){let n=Ua(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}),Re=q(()=>{de(!1),ue(null)}),ze=q(t=>{if(Pa(t.id)){let e=ka(t.id);if(!e)return;e.kind===`more`?d.showMoreBucketSessions(e.projectId,e.bucketKey):d.resetBucketVisibleCount(e.projectId,e.bucketKey);return}let n=d.sessionById.get(t.id),r=n&&da(n)||null;e({sessionId:t.id,directory:r})}),Be=q(e=>{ze({id:e,title:``})}),Ve=q(e=>{Pa(e.id)||y(e.id)}),He=q(async e=>{if(Pa(e.id))return;if(x===`tasks`){b(e.id,!0),Ke.success(c(`sessions.sidebar.session.archive.success`),{action:{label:c(`sessions.sidebar.undo`),onClick:()=>b(e.id,!1)}});return}let t=Le(e.id),{archivedIds:n,failedIds:r}=await P(t);n.length>0&&wa({sessionIds:n,message:n.length===1?c(`sessions.sidebar.session.archive.success`):c(`sessions.sidebar.bulkActions.archivedPlural`,{count:n.length}),undoLabel:c(`sessions.sidebar.undo`),settingsLabel:c(`settings.yuri.archivedSessions.actions.view`),undoFailedMessage:n.length===1?c(`sessions.sidebar.session.archive.undoFailed`):c(`sessions.sidebar.bulkActions.archiveUndoFailed`,{count:n.length})}),r.length>0&&Ke.error(r.length===1?c(`sessions.sidebar.bulkActions.failedArchiveSingle`,{count:r.length}):c(`sessions.sidebar.bulkActions.failedArchivePlural`,{count:r.length}))}),Ue=q(()=>{if(!W||W.kind!==`session`)return;let e=W.session,t=da(e),n=Ae?.type??`idle`;!t||De===e.id||n===`busy`||n===`retry`||(Oe(e.id),(async()=>{try{await le.refreshSessionTranscript(e.id,{directory:t}),Ke.success(c(`sessions.sidebar.session.menu.refreshTranscriptSuccess`))}catch{Ke.error(c(`sessions.sidebar.session.menu.refreshTranscriptFailed`))}finally{Oe(t=>t===e.id?null:t)}})())}),We=q(e=>{if(Pa(e.id))return;let t=d.sessionById.get(e.id);t&&(ue({kind:`session`,session:t}),de(!0))}),Ge=q(e=>{We({id:e,title:``})}),qe=q(e=>{_(e.id,!e.expanded)}),Je=q((e,t)=>{v(`${e.id}::${t.id}`,!t.expanded)}),Ye=q((e,t)=>{oe(e.id),z({selectedProjectId:e.id,directoryOverride:t,preserveDirectoryOverride:!0})}),Xe=q(()=>{let e=Dt.getState().getActiveProject();if(e?.hostId){vi(Yt(e),!0).catch(e=>Ke.error(e instanceof Error?e.message:String(e)));return}if(n){n();return}ee()}),Ze=q(e=>{let t=d.projectMetaById.get(e.id);t&&(ue({kind:`project`,project:t,isGitRepository:!1}),de(!0),l.checkIsGitRepository(t.path).then(e=>{ue(n=>ad(n,t.id,e))}).catch(()=>{ue(e=>ad(e,t.id,!1))}))}),Qe=q((e,t)=>{let n=h(t);return n?e.worktrees.find(e=>h(e.path)===n)||((Tt.getState().availableWorktreesByProject.get(e.path)??[]).find(e=>h(e.path)===n)??null):null}),$e=q((e,t)=>{let n=d.projectMetaById.get(e.id);n&&Ye(n,t.path)}),et=q((e,t)=>{let n=d.projectMetaById.get(e.id);n&&(ue({kind:`worktree`,project:n,worktreePath:t.path,worktreeName:t.name}),de(!0))}),rt=q((e,t)=>{let n=d.projectMetaById.get(e.id);if(!n)return;let r=Qe(n,t.path);if(!r){Ke.error(c(`sessions.sidebar.sessionDialogs.worktree.errorRemoveTitle`),{description:c(`sessions.sidebar.dialogs.deleteResult.tryAgain`)});return}Ee({project:n,worktree:r})}),it=q(e=>{Ce(e),oe(e),xe(!0)}),at=q(e=>{(async()=>{let t=e.worktrees;try{t=(await $r({id:e.id,path:e.path})).worktrees}catch(n){console.warn(`[MobileProjectsHome] Worktree refresh before session sync failed:`,n),t=Tt.getState().availableWorktreesByProject.get(e.path)??e.worktrees}await zt([e.path,...t.map(e=>e.path)],d.allSessions)})()}),st=q((e,t)=>{let n=Se;if(xe(!1),Ce(null),t?.sessionId){B({sessionId:t.sessionId,directory:e});return}z({selectedProjectId:n,directoryOverride:e,preserveDirectoryOverride:!0})}),ct=q(async e=>{try{if(!(await L(e.id))?.share?.url){Ke.error(c(`sessions.sidebar.session.share.error`));return}Ke.success(c(`sessions.sidebar.session.share.successTitle`),{description:c(`sessions.sidebar.session.share.successDescription`)})}catch{Ke.error(c(`sessions.sidebar.session.share.error`))}}),lt=q(async e=>{if((await Ot(e)).ok){Ke.success(c(`sessions.sidebar.session.menu.copied`));return}Ke.error(c(`sessions.sidebar.session.share.copyUrlError`))}),ut=q(async e=>{try{if(await R(e)){Ke.success(c(`sessions.sidebar.session.unshare.success`));return}Ke.error(c(`sessions.sidebar.session.unshare.error`))}catch{Ke.error(c(`sessions.sidebar.session.unshare.error`))}}),dt=q(e=>{let t=Le(e.id);wi({sessionIds:t,message:t.length===1?c(`sessions.sidebar.session.delete.success`):c(`sessions.sidebar.bulkActions.deletedPlural`,{count:t.length}),undoLabel:c(`sessions.sidebar.undo`),commitFailedMessage:c(`sessions.sidebar.session.delete.error`)})}),pt=q(async()=>{if(!J)return;let e=ge.trim();if(e)try{await F(J.id,e),he(null),_e(``)}catch{Ke.error(c(`sessions.sidebar.session.menu.rename`),{description:c(`sessions.sidebar.dialogs.deleteResult.tryAgain`)})}}),mt=q(async()=>{if(!J||ve)return;let e=J.id;he(null),_e(``),ye(!0);try{await I(e)}catch{Ke.error(c(`sessions.sidebar.session.rename.smartTitle`),{description:c(`sessions.sidebar.dialogs.deleteResult.tryAgain`)})}finally{ye(!1)}}),ht=Z.useMemo(()=>W?W.kind===`session`?{kind:`session`,title:W.session.title?.trim()||c(`mobile.sessions.untitled`),pinned:N.has(W.session.id),shared:!!W.session.share?.url,unread:Ne}:W.kind===`project`?{kind:`project`,title:W.project.label,gitRepository:W.isGitRepository}:{kind:`worktree`,title:W.worktreeName}:null,[W,Ne,N,c]),gt=Z.useMemo(()=>{if(!W)return{};if(W.kind===`session`){let e=W.session;return{onRename:()=>{_e(e.title?.trim()||c(`mobile.sessions.untitled`)),he(e)},onTogglePin:()=>y(e.id),onToggleRead:Pe,onShare:u&&!e.share?.url?()=>{ct(e)}:void 0,onCopyLink:u&&e.share?.url?()=>{lt(e.share.url)}:void 0,onUnshare:u&&e.share?.url?()=>{ut(e.id)}:void 0,onRefreshTranscript:Ue,onArchive:()=>{He({id:e.id,title:e.title?.trim()||c(`mobile.sessions.untitled`)})},onDelete:()=>dt(e)}}if(W.kind===`project`){let e=W.project;return{onNewSession:()=>Ye(e,e.path),onNewWorktree:()=>it(e.id),onSyncSessions:()=>at(e),onEditProject:()=>fe(e.id),onCloseProject:()=>me(e)}}let{project:e,worktreePath:t}=W;return{onNewSession:()=>Ye(e,t),onDeleteWorktree:()=>{let n=Qe(e,t);if(!n){Ke.error(c(`sessions.sidebar.sessionDialogs.worktree.errorRemoveTitle`),{description:c(`sessions.sidebar.dialogs.deleteResult.tryAgain`)});return}Ee({project:e,worktree:n})}}},[W,He,lt,dt,Ue,it,at,ct,ut,Pe,Qe,u,Ye,c,y]),_t=Z.useMemo(()=>{if(!K)return null;let e=V.find(e=>e.id===K),t=d.projectMetaById.get(K);if(!e||!t)return null;let n=W?.kind===`project`&&W.project.id===K?W.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}},[W,K,d.projectMetaById,V]);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(ta,{remoteProjects:re,hostRegistry:ne.registry,projectOrderIds:va(V,te).map(e=>e.id),renderRemoteProject:ne.registry?e=>(0,$.jsx)(Ra,{project:e,registry:ne.registry,mobile:!0,reorderEnabled:!1,onActivityItems:m}):void 0,remoteError:ne.catalog.error?.message,className:s,projects:d.projects,pinnedSessions:U,inProgressSessions:ae,onAddProject:t,onNewSession:Xe,onScanQr:r,onSwitchInstance:i,instanceOptions:o,onRemoteDesktop:a,onToggleProject:qe,onOpenProjectActions:Ze,onToggleWorktree:Je,onNewWorktreeSession:$e,onOpenWorktreeActions:et,onDeleteWorktree:rt,onSelectSession:ze,onPinSession:Ve,onArchiveSession:e=>{He(e)},onOpenSessionActions:We,onReorderSessions:g,task:{view:x,onViewChange:O,model:D,settledOpen:C,onSettledOpenChange:k,onShowMoreSettled:j,onSelectTask:Be,onOpenTaskActions:Ge,onRestoreTask:M}}),(0,$.jsx)(Ya,{open:G,target:ht,actions:gt,refreshTranscriptDisabled:Ie,refreshTranscriptSpinning:Fe,onOpenChange:e=>{e?de(!0):Re()}}),(0,$.jsx)(Un,{open:be,projectId:Se,onOpenChange:e=>{xe(e),e||Ce(null)},onWorktreeCreated:st}),we?(0,$.jsx)(Ri,{open:!0,project:{id:we.project.id,path:we.project.path},worktree:we.worktree,onClose:()=>Ee(null)}):null,(0,$.jsx)(lr,{open:!!pe,title:c(`sessions.sidebar.project.actions.closeProject`),onClose:()=>me(null),closeAriaLabel:c(`mobile.surface.closeAria`),footer:(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[(0,$.jsx)(Y,{type:`button`,variant:`ghost`,className:`flex-1`,onClick:()=>me(null),children:c(`sessions.sidebar.dialogs.cancel`)}),(0,$.jsx)(Y,{type:`button`,variant:`destructive`,className:`flex-1`,onClick:()=>{if(!pe)return;let e=pe;me(null),se(e.id),Ke.success(c(`mobile.sessions.toast.projectRemoved`,{label:e.label}))},children:c(`mobile.sessions.confirmRemoveProject`)})]}),children:(0,$.jsx)(`p`,{className:`px-1 py-1 typography-ui-body text-foreground`,children:c(`mobile.projects.closeConfirmMessage`,{title:pe?.label??``})})}),(0,$.jsx)(lr,{open:!!J,title:c(`sessions.sidebar.session.menu.rename`),onClose:()=>{ve||(he(null),_e(``))},closeAriaLabel:c(`mobile.surface.closeAria`),footer:(0,$.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,$.jsx)(Y,{type:`button`,variant:`default`,className:`flex-1`,disabled:ve,onClick:()=>{he(null),_e(``)},children:c(`sessions.sidebar.dialogs.cancel`)}),(0,$.jsx)(Y,{type:`button`,variant:`default`,className:`flex-1`,disabled:!ge.trim()||ve,onClick:()=>void pt(),children:c(`sessions.sidebar.session.rename.save`)})]}),children:(0,$.jsxs)(`form`,{className:`flex flex-col gap-3 px-1 py-1`,onSubmit:e=>{e.preventDefault(),pt()},children:[(0,$.jsx)(Zn,{value:ge,onChange:e=>_e(e.target.value),autoFocus:!0,className:`h-12`,disabled:ve}),(0,$.jsxs)(Y,{type:`button`,variant:`outline`,className:`w-full gap-2`,disabled:ve,onClick:()=>void mt(),children:[ve?(0,$.jsx)(X,{name:`loader-4`,className:`size-4 animate-spin`}):(0,$.jsx)(X,{name:`ai-generate-2`,className:`size-4`}),c(`sessions.sidebar.session.rename.smartTitle`)]})]})}),(0,$.jsx)(ki,{open:K!==null,project:_t,onClose:()=>fe(null)})]})}function cd(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}=Te(),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=Vt(`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)(pi,{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}function ld(e){let t=(0,Q.c)(10),{className:n,contentClassName:r,instancesPage:i}=e,{t:a}=Te(),o;t[0]===a?o=t[1]:(o=a(`mobile.settings.placeholder.title`),t[0]=a,t[1]=o);let s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=[..._r],t[2]=s):s=t[2];let c;t[3]===i?c=t[4]:(c=(0,$.jsx)(ao,{forceMobile:!0,isWindowed:!0,hideMobileHeader:!0,flowMobile:!0,autoOpenMobilePage:!0,visiblePageSlugs:s,mobileInstancesPage:i}),t[3]=i,t[4]=c);let l;return t[5]!==n||t[6]!==r||t[7]!==o||t[8]!==c?(l=(0,$.jsx)(pi,{title:o,className:n,surface:!1,scrollsWithPage:!0,showHeader:!1,surfaceClassName:r,children:c}),t[5]=n,t[6]=r,t[7]=o,t[8]=c,t[9]=l):l=t[9],l}function ud(e){let t=(0,Q.c)(115),{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}=Te(),b=ge(Ad),x=kt(),S=kt(kd),C=kt(Od),w=kt(Dd),T=kt(Ed),E=kt(Td),D=kt(wd),O=kt(Cd),k=kt(Sd),A=kt(xd),j=kt(bd),M=kt(yd),N=kt(vd),P;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(P=[],t[0]=P):P=t[0],Z.useEffect(_d,P);let F=x.secondary?.kind===`chat`?x.secondary.btw??null:null,I=Z.useRef(null),L,R;t[1]===F?(L=t[2],R=t[3]):(L=()=>{let e=I.current;I.current=F,e&&e!==F&&qn.getState().clear({sessionId:e.sessionId,directory:e.directory}),F?hn(Fn):Wn(Fn)},R=[F],t[1]=F,t[2]=L,t[3]=R),Z.useEffect(L,R);let ee;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(ee=[],t[4]=ee):ee=t[4],Z.useEffect(hd,ee);let z;t[5]===S?z=t[6]:(z=e=>{e===`settings`&&ge.getState().setSettingsPage(`home`),S(e)},t[5]=S,t[6]=z);let B=q(z),V;t[7]===C?V=t[8]:(V=e=>{C(e)},t[7]=C,t[8]=V);let te=q(V),ne;t[9]===O?ne=t[10]:(ne=()=>{O()},t[9]=O,t[10]=ne);let re=q(ne),H;t[11]===w?H=t[12]:(H=()=>{w()},t[11]=w,t[12]=H);let ie=q(H),U;t[13]===T?U=t[14]:(U=e=>{T(e)},t[13]=T,t[14]=U);let ae=q(U),oe=Z.useRef(null),[se,ce]=Z.useState(!1),le;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(le=e=>{oe.current=e},t[15]=le):le=t[15];let W=q(le),ue;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(ue=e=>{ce(e)},t[16]=ue):ue=t[16];let G=q(ue),de;t[17]!==re||t[18]!==v||t[19]!==D||t[20]!==N||t[21]!==k?(de=()=>{if(oe.current?.())return!0;let e=kt.getState().secondary;return e?.kind===`chat`&&e.btw?(N(),!0):e?.kind===`assistant`&&e.settingsAssistantID?(D(),!0):(e?.kind===`draft`||e?.kind===`chat`)&&v?.onSelect?(v.onSelect(),!0):e?.kind===`chat`&&e.routes.length>1?(k(),!0):e?(re(),!0):!1},t[17]=re,t[18]=v,t[19]=D,t[20]=N,t[21]=k,t[22]=de):de=t[22];let K=q(de),fe=x.secondary!==null,pe;t[23]!==K||t[24]!==f?(pe=()=>{if(f)return f(()=>K()),()=>f(null)},t[23]=K,t[24]=f,t[25]=pe):pe=t[25];let me;t[26]!==K||t[27]!==f||t[28]!==fe?(me=[f,fe,K],t[26]=K,t[27]=f,t[28]=fe,t[29]=me):me=t[29],Z.useEffect(pe,me);let J=Tt(md),he=rt(pd),_e;t[30]===J?_e=t[31]:(_e=e=>J?e.getDirectoryForSession(J):null,t[30]=J,t[31]=_e);let ve=Tt(_e),ye,be;t[32]!==ve||t[33]!==J||t[34]!==j||t[35]!==he||t[36]!==M?(ye=()=>{let e=kt.getState().secondary;if(he)return;if(e?.kind===`draft`&&J){j({sessionId:J,directory:ve});return}if(e?.kind!==`chat`||!J||Mt({sessionId:J,directory:ve})===`internal`)return;let t=e.routes.at(-1);(t?.sessionId!==J||h(t.directory)!==h(ve))&&M({sessionId:J,directory:ve})},be=[ve,J,j,M,he],t[32]=ve,t[33]=J,t[34]=j,t[35]=he,t[36]=M,t[37]=ye,t[38]=be):(ye=t[37],be=t[38]),Z.useEffect(ye,be);let xe,Se;t[39]!==J||t[40]!==v||t[41]!==A||t[42]!==he?(xe=()=>{let e=kt.getState().secondary;if(e?.kind!==`chat`||!v||v.onSelect||he)return;let t=e.routes.at(-1);!t||t.sessionId!==J||A({sessionId:v.id,directory:v.directory})},Se=[J,v,A,he],t[39]=J,t[40]=v,t[41]=A,t[42]=he,t[43]=xe,t[44]=Se):(xe=t[43],Se=t[44]),Z.useEffect(xe,Se);let Ce;t[45]!==G||t[46]!==W||t[47]!==p?(Ce=typeof p==`function`?p(W,G):p,t[45]=G,t[46]=W,t[47]=p,t[48]=Ce):Ce=t[48];let we=Ce,Ee;t[49]!==ie||t[50]!==s||t[51]!==n||t[52]!==a||t[53]!==r||t[54]!==i||t[55]!==te?(Ee=(0,$.jsx)(sd,{onOpenChat:te,onAddProject:n,onNewSession:ie,onScanQr:r,onSwitchInstance:i,onRemoteDesktop:a,instanceOptions:s}),t[49]=ie,t[50]=s,t[51]=n,t[52]=a,t[53]=r,t[54]=i,t[55]=te,t[56]=Ee):Ee=t[56];let De;t[57]!==c||t[58]!==ae?(De=(0,$.jsx)(Eu,{onEnable:c,onOpenAssistant:ae}),t[57]=c,t[58]=ae,t[59]=De):De=t[59];let Oe;t[60]===we?Oe=t[61]:(Oe=(0,$.jsx)(cd,{showHeader:!1,children:we}),t[60]=we,t[61]=Oe);let ke;t[62]===l?ke=t[63]:(ke=(0,$.jsx)(ld,{instancesPage:l}),t[62]=l,t[63]=ke);let Ae;t[64]!==Ee||t[65]!==De||t[66]!==Oe||t[67]!==ke?(Ae={projects:Ee,assistant:De,scheduled:Oe,settings:ke},t[64]=Ee,t[65]=De,t[66]=Oe,t[67]=ke,t[68]=Ae):Ae=t[68];let je=Ae,Me=x.secondary?.kind??null,Ne;bb0:{if(!Me){Ne=null;break bb0}let e;t[69]!==K||t[70]!==E||t[71]!==y?(e=e=>({key:`assistant-secondary`,depth:1,ariaLabel:y(`assistants.title`),onBack:K,content:(0,$.jsx)(bo,{activeOverride:e,onMobileBack:fd,onMobileOpenSettings:E})}),t[69]=K,t[70]=E,t[71]=y,t[72]=e):e=t[72];let n=e;if(Me===`assistant`){let e=x.secondary?.kind===`assistant`?x.secondary.settingsAssistantID:void 0,r=!e,i;t[73]!==n||t[74]!==r?(i=n(r),t[73]=n,t[74]=r,t[75]=i):i=t[75];let a;t[76]!==K||t[77]!==e||t[78]!==y?(a=e?[{key:`assistant-settings:${e}`,depth:2,ariaLabel:y(`assistants.conversation.openSettings`),onBack:K,content:(0,$.jsx)(Ou,{assistantID:e,onBack:dd})}]:[],t[76]=K,t[77]=e,t[78]=y,t[79]=a):a=t[79];let o;t[80]!==i||t[81]!==a?(o=[i,...a],t[80]=i,t[81]=a,t[82]=o):o=t[82],Ne=o;break bb0}if(Me===`instances`){let e;t[83]===y?e=t[84]:(e=y(`mobile.settings.switchInstance`),t[83]=y,t[84]=e);let n;t[85]!==K||t[86]!==u||t[87]!==e?(n=[{key:`instances-secondary`,depth:1,ariaLabel:e,onBack:K,content:u}],t[85]=K,t[86]=u,t[87]=e,t[88]=n):n=t[88],Ne=n;break bb0}if(x.secondary?.kind===`draft`){let e;t[89]===y?e=t[90]:(e=y(`mobile.nav.secondaryPageAria`),t[89]=y,t[90]=e);let n;t[91]===m?n=t[92]:(n=m({sessionId:``,directory:null,viewKey:`chat-primary`,active:!0}),t[91]=m,t[92]=n);let r;t[93]!==K||t[94]!==e||t[95]!==n?(r=[{key:`chat-primary`,depth:1,ariaLabel:e,onBack:K,content:n}],t[93]=K,t[94]=e,t[95]=n,t[96]=r):r=t[96],Ne=r;break bb0}if(x.secondary?.kind!==`chat`){let e;t[97]===Symbol.for(`react.memo_cache_sentinel`)?(e=[],t[97]=e):e=t[97],Ne=e;break bb0}let r=x.secondary.routes,i;if(t[98]!==n||t[99]!==K||t[100]!==x.secondary.btw||t[101]!==x.secondary.returnTo||t[102]!==m||t[103]!==r||t[104]!==y){let e=x.secondary.returnTo?[n(!1)]:[],a=x.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:K,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:K,content:(0,$.jsx)(ku,{route:a})}]:[...e,...c],t[98]=n,t[99]=K,t[100]=x.secondary.btw,t[101]=x.secondary.returnTo,t[102]=m,t[103]=r,t[104]=y,t[105]=i}else i=t[105];Ne=i}let Pe=Ne,Fe;t[106]===Pe?Fe=t[107]:(Fe=Pe??[],t[106]=Pe,t[107]=Fe);let Ie=se||b||_,Le;return t[108]!==g||t[109]!==x||t[110]!==B||t[111]!==Fe||t[112]!==Ie||t[113]!==je?(Le=(0,$.jsx)($u,{className:g,navigation:x,onTabChange:B,tabs:je,secondaryPages:Fe,tabBarCovered:Ie}),t[108]=g,t[109]=x,t[110]=B,t[111]=Fe,t[112]=Ie,t[113]=je,t[114]=Le):Le=t[114],Le}function dd(){Hr.requestAnimatedBack(`root`)}function fd(){return Hr.requestAnimatedBack(`root`)}function pd(e){return e.remoteSession}function md(e){return e.currentSessionId}function hd(){return gd}function gd(){return Wn(Fn)}function _d(){return St()}function vd(e){return e.popBtw}function yd(e){return e.replaceChatSession}function bd(e){return e.materializeDraftSession}function xd(e){return e.reconcileChatPredecessor}function Sd(e){return e.popChatSession}function Cd(e){return e.closeSecondary}function wd(e){return e.popAssistantSettings}function Td(e){return e.pushAssistantSettings}function Ed(e){return e.openAssistant}function Dd(e){return e.openDraft}function Od(e){return e.openSession}function kd(e){return e.setActiveTab}function Ad(e){return e.isCommandPaletteOpen}function jd(e){let t=!1,n=0,r=0,i=!1,a,o,c,u=()=>e.transport===l()&&e.generation===d(),f=()=>document.visibilityState===`hidden`,p=()=>{r++;let e=a;a=void 0,clearTimeout(o),o=void 0,e?.close()},m=n=>{t||(t=!0,p(),x(),window.removeEventListener(`online`,_),window.removeEventListener(`pageshow`,y),window.removeEventListener(`yuri:system-resume`,v),document.removeEventListener(`visibilitychange`,b),e.onState(`closed`,n))},h=()=>{if(t||f())return;let e=navigator.onLine===!1||c===`permission_required`?6e4:Math.min(1e3*2**Math.min(n++,5),3e4);o=setTimeout(()=>{o=void 0,g()},e)},g=()=>{if(t||a||f())return;if(!u()){m(`runtime_changed`);return}if(clearTimeout(o),o=void 0,navigator.onLine===!1){h();return}let s=++r;a=Md({...e,onState:(i,o)=>{if(!(t||s!==r)){if(i===`closed`){if(a=void 0,c=o,!o||[`runtime_changed`,`disabled`,`unsupported`,`helper_unavailable`,`authentication_required`,`permission_denied`].includes(o)){m(o);return}e.onState(i,o),h();return}(i===`webrtc`||i===`tunnel`)&&(n=0,c=void 0),e.onState(i,o)}}}),a.setZoomed(i)},_=()=>{!t&&!f()&&!a&&g()},v=()=>{t||(p(),_())},y=e=>{e.persisted&&v()},b=()=>{f()?(p(),e.onState(`connecting`,void 0)):_()},x=s(()=>m(`runtime_changed`));return window.addEventListener(`online`,_),window.addEventListener(`pageshow`,y),window.addEventListener(`yuri:system-resume`,v),document.addEventListener(`visibilitychange`,b),g(),{send:e=>{!t&&u()&&a?.send(e)},close:()=>m(),setZoomed:e=>{i=e,a?.setZoomed(e)}}}function Md(e){let t=!1,n,i,a=!1,o,s,u=setTimeout(()=>E(`connection_failed`),6e4),f,p=Date.now(),m,h,g=!1,_=!1,v=!1,y=(t,n)=>{(m!==t||h!==n)&&(m=t,h=n,e.onState(t,n))},b=Promise.resolve(),x=0,S=[],C=()=>!t&&e.transport===l()&&e.generation===d(),w=e=>{if(!(!C()||n?.readyState!==1))try{n.send(JSON.stringify(e))}catch{E(`connection_failed`)}},T=()=>{!g||_===v||!C()||n?.readyState!==1||(w({type:`view`,zoomed:_}),v=_)},E=r=>{if(t)return;let a=C()&&n?.readyState===1;if(t=!0,a)try{n.send(JSON.stringify({type:`release`}))}catch{}clearInterval(s),clearTimeout(u),clearTimeout(f),n&&(n.onopen=null,n.onmessage=null,n.onerror=null,n.onclose=null,n.close()),i?.close();let c=e.video.srcObject;c instanceof MediaStream&&c.getTracks().forEach(e=>e.stop()),e.video.srcObject=null,e.video.onloadeddata=null,e.image.onload=null,e.image.onerror=null,e.image.removeAttribute(`src`),o&&URL.revokeObjectURL(o),y(`closed`,r)},D=()=>{!C()||a||(a=!0,i?.close(),clearTimeout(f),f=setTimeout(()=>E(`connection_failed`),15e3),w({type:`fallback`}))},O=async t=>{if(!C())return;if(p=Date.now(),t instanceof ArrayBuffer){if(t.byteLength>524288){E(`connection_failed`);return}o&&URL.revokeObjectURL(o),o=URL.createObjectURL(new Blob([t],{type:`image/jpeg`})),e.image.onload=()=>{C()&&(clearTimeout(u),clearTimeout(f),e.onSize(e.image.naturalWidth,e.image.naturalHeight),y(`tunnel`),w({type:`ack`}))},e.image.onerror=()=>E(`connection_failed`),e.image.src=o;return}let n=JSON.parse(t);if(n.type===`error`){E(typeof n.code==`string`?n.code:`connection_failed`);return}if(n.type===`ready`)g=n.zoomQuality===!0,T(),Number.isFinite(n.width)&&Number.isFinite(n.height)&&e.onSize(n.width,n.height);else if(n.type===`offer`&&!a){if(i||typeof n.sdp!=`string`||n.sdp.length>65536)throw Error(`invalid_offer`);if(typeof RTCPeerConnection>`u`){D();return}i=new RTCPeerConnection({iceServers:Array.isArray(n.iceServers)?n.iceServers:[]}),i.onicecandidate=e=>{e.candidate&&w({type:`ice`,candidate:e.candidate.toJSON()})},i.onconnectionstatechange=()=>{(i?.connectionState===`failed`||i?.connectionState===`disconnected`)&&D()},i.ontrack=t=>{C()&&(e.video.srcObject=new MediaStream([t.track]),e.video.onloadeddata=()=>{!C()||a||(clearTimeout(u),clearTimeout(f),e.onSize(e.video.videoWidth,e.video.videoHeight),y(`webrtc`))},e.video.play().catch(D))},await i.setRemoteDescription({type:`offer`,sdp:n.sdp});for(let e of S.splice(0))await i.addIceCandidate(e);if(await i.setLocalDescription(await i.createAnswer()),!C()||a)return;f=setTimeout(D,7e3),w({type:`answer`,sdp:i.localDescription?.sdp})}else n.type===`ice`&&n.candidate&&!a?i?.remoteDescription?await i.addIceCandidate(n.candidate):S.length<128&&S.push(n.candidate):n.type===`rtc-failed`&&D()};return y(`connecting`),(async()=>{try{if(await r(),!C())return;n=k(c().websocket(`/api/remote-desktop/ws`)),n.binaryType=`arraybuffer`,n.onopen=()=>{C()&&(p=Date.now(),s=setInterval(()=>{if(!C()){E(`runtime_changed`);return}if(Date.now()-p>3e4){E(`connection_failed`);return}w({type:`ping`})},5e3))},n.onmessage=e=>{if(C()){if(++x>128){E(`connection_failed`);return}b=b.then(()=>O(e.data)).catch(D).finally(()=>{x--})}},n.onerror=()=>E(`connection_failed`),n.onclose=e=>E(e.code===4001?`authentication_required`:`connection_failed`)}catch{E(`connection_failed`)}})(),{send:e=>w(e),close:E,setZoomed:e=>{_=e,T()}}}var Nd={scale:1,x:0,y:0};function Pd(e){let t=Math.min(e.width/e.remoteWidth,e.height/e.remoteHeight),n=e.remoteWidth*t,r=e.remoteHeight*t;return{width:n,height:r,x:(e.width-n)/2,y:(e.height-r)/2}}function Fd(e,t,n){if(t.width<=0||t.height<=0||t.remoteWidth<=0||t.remoteHeight<=0)return null;let r=Pd(t),i=((e.x-n.x)/n.scale-r.x)/r.width,a=((e.y-n.y)/n.scale-r.y)/r.height;return i>=0&&i<=1&&a>=0&&a<=1?{x:i,y:a}:null}function Id(e,t,n=1){let r=Math.max(n,Math.min(5,e.scale)),i=Pd(t),a=(e,t,n,i)=>n*r<=i?(i-n*r)/2-t*r:Math.max(i-(t+n)*r,Math.min(-t*r,e));return{scale:r,x:a(e.x,i.x,i.width,t.width),y:a(e.y,i.y,i.height,t.height)}}function Ld(e){let t=new Map,n={...Nd},r=null,i=null,a=!1,o=!1,s=!1,c=!1,l,u=null,d=0,f=null,p=()=>{a&&e.send({type:`release`}),a=!1},m=()=>{(n.scale!==1||n.x!==0||n.y!==0)&&(n={...Nd},e.apply(n,!0))},h=()=>{clearTimeout(l),p(),t.clear(),f=null,r=i=null,s=!1,u=null,n.scale<=1&&m()},g=()=>{let[e,n]=[...t.values()];return{midpoint:{x:(e.x+n.x)/2,y:(e.y+n.y)/2},distance:Math.max(1,Math.hypot(e.x-n.x,e.y-n.y))}},_={down(a,m){t.size>=2||(t.set(a,m),t.size===1&&(r=i=m,o=!1,s=!1,c=!1,d=Date.now(),e.mode()===`cursor`&&(l=setTimeout(()=>{let t=Fd(m,e.viewport(),n);t&&!o&&!s&&(e.send({type:`pointer`,action:`right`,...t}),c=!0)},550))),t.size===2&&(clearTimeout(l),s=!0,u=null,p(),f={...g(),transform:{...n}}))},move(d,p){if(t.has(d)){if(t.set(d,p),t.size===2&&f){let{midpoint:t,distance:r}=g(),i=Math.max(.5,Math.min(5,f.transform.scale*r/f.distance)),a=i/f.transform.scale;n=Id({scale:i,x:t.x-(f.midpoint.x-f.transform.x)*a,y:t.y-(f.midpoint.y-f.transform.y)*a},e.viewport(),.5),e.apply(n);return}if(!(s||c||!r||!i)&&(Math.hypot(p.x-r.x,p.y-r.y)>6&&(o=!0,u=null,clearTimeout(l)),o)){if(e.mode()===`drag`)n={...n,x:n.x+p.x-i.x,y:n.y+p.y-i.y},e.apply(n);else{let t=Fd(p,e.viewport(),n);if(t){let i=Fd(r,e.viewport(),n);!a&&i&&(e.send({type:`pointer`,action:`down`,...i}),a=!0),a&&e.send({type:`pointer`,action:`move`,...t})}}i=p}}},moveMany(e){let n;for(let[r,i]of e)t.has(r)&&(t.set(r,i),n=[r,i]);n&&_.move(...n)},up(a,h,g=!1){if(t.has(a)){if(clearTimeout(l),t.delete(a),e.mode()===`cursor`&&!g&&!s&&!o&&!c){let t=Fd(h,e.viewport(),n);t&&e.send({type:`pointer`,action:`click`,...t})}if(e.mode()===`drag`&&!g&&!s&&!o&&Date.now()-d<450){let t=Date.now(),r={x:h.x,y:h.y,time:t};if(Qn(u,r)){if(n.scale>1)n={...Nd};else{let t=2.5,r=t/n.scale;n=Id({scale:t,x:h.x-(h.x-n.x)*r,y:h.y-(h.y-n.y)*r},e.viewport())}e.apply(n,!0),u=null}else u=r}else u=null;p(),t.size||(f=null,r=i=null,s=!1,n.scale<=1&&m())}},cancel:h,refit(){if(n.scale<=1){m();return}n=Id(n,e.viewport()),e.apply(n)},reset(){h(),n={...Nd},e.apply(n)}};return _}function Rd(e,t,n){return n===90?{x:e.y-t.top,y:t.right-e.x}:n===-90?{x:t.bottom-e.y,y:e.x-t.left}:{x:e.x-t.left,y:e.y-t.top}}var zd=me(`YuriOrientation`);function Bd(){return J.isNativePlatform()&&J.isPluginAvailable(`YuriOrientation`)}function Vd(e){return zd.lock({orientation:e})}function Hd(e){let t=(0,Q.c)(14),[n,r]=(0,Z.useState)(Jd),[i]=(0,Z.useState)(qd),[a,o]=(0,Z.useState)(i),[s]=(0,Z.useState)(Bd),c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=e=>{let[t]=e;if(!t)return;let{width:n,height:i}=t.contentRect;n>0&&i>0&&r(e=>e.width===n&&e.height===i?e:{width:n,height:i})},t[0]=c):c=t[0],pe(e,c);let l,u;t[1]!==s||t[2]!==a?(l=()=>{s&&Vd(a).catch(Kd)},u=[s,a],t[1]=s,t[2]=a,t[3]=l,t[4]=u):(l=t[3],u=t[4]),(0,Z.useEffect)(l,u);let d,f;t[5]===s?(d=t[6],f=t[7]):(d=()=>{if(s)return Wd},f=[s],t[5]=s,t[6]=d,t[7]=f),(0,Z.useEffect)(d,f);let p=!s&&a!==i,m=p?90:0,h=p?n.height:n.width,g=p?n.width:n.height,_;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(_=()=>o(Ud),t[8]=_):_=t[8];let v;return t[9]!==a||t[10]!==m||t[11]!==h||t[12]!==g?(v={orientation:a,rotation:m,width:h,height:g,toggle:_},t[9]=a,t[10]=m,t[11]=h,t[12]=g,t[13]=v):v=t[13],v}function Ud(e){return e===`portrait`?`landscape`:`portrait`}function Wd(){Vd(`portrait`).catch(Gd)}function Gd(){}function Kd(){}function qd(){return window.innerWidth>window.innerHeight?`landscape`:`portrait`}function Jd(){return{width:window.innerWidth,height:window.innerHeight}}var Yd=(e,t)=>({queryKey:[e,`remote-desktop`,t],queryFn:async({signal:n})=>{let r=()=>{if(e!==l()||t!==d())throw Error(`runtime_changed`)};r();let i=new AbortController,a=()=>i.abort();n.addEventListener(`abort`,a,{once:!0}),n.aborted&&a();let o;try{return await Promise.race([(async()=>{let e=await m(`/api/remote-desktop`,{signal:i.signal,headers:{Accept:`application/json`}});if(r(),[401,403].includes(e.status))throw Error(`authentication_required`);if([404,501].includes(e.status))throw Error(`unsupported`);if(!e.ok)throw Error(`connection_failed`);if(!e.headers.get(`content-type`)?.includes(`application/json`))throw Error(`unsupported`);let t=await e.json();if(r(),!t||typeof t!=`object`||!(`supported`in t)||typeof t.supported!=`boolean`)throw Error(`unsupported`);return{supported:t.supported,enabled:`enabled`in t&&t.enabled===!0}})(),new Promise((e,t)=>{o=setTimeout(()=>{a(),t(Error(`connection_failed`))},1e4)})])}finally{clearTimeout(o),n.removeEventListener(`abort`,a)}},staleTime:3e4,retry:!1,refetchInterval:e=>{let t=e.state.error;return!t||[`unsupported`,`runtime_changed`,`authentication_required`].includes(t.message)?!1:Math.min(1e3*2**Math.min(Math.max(0,e.state.errorUpdateCount-1),5),3e4)},refetchIntervalInBackground:!1}),Xd=(e,t)=>{let n=(0,Q.c)(3),r;return n[0]!==t||n[1]!==e?(r=Yd(e,t),n[0]=t,n[1]=e,n[2]=r):r=n[2],re(r)},Zd=[{key:`Escape`,icon:`corner-up-left`},{key:`Tab`,icon:`arrow-right-to-line`},{key:`Backspace`,icon:`delete-back`},{key:`Enter`,icon:`corner-down-left`},{key:`ArrowLeft`,icon:`arrow-left`},{key:`ArrowUp`,icon:`arrow-up`},{key:`ArrowDown`,icon:`arrow-down`},{key:`ArrowRight`,icon:`arrow-right`}];function Qd({onClose:e,instanceName:t}){let{t:n}=Te(),[r]=Z.useState(()=>({transport:l(),generation:d()})),i=Xd(r.transport,r.generation),[a,o]=Z.useState(0),[s,c]=Z.useState(`connecting`),[u,f]=Z.useState(),[p,m]=Z.useState(`drag`),[h,g]=Z.useState(!1),[_,v]=Z.useState(``),y=Z.useRef(null),b=Z.useRef(null),x=Hd(b),S=Z.useRef(null),C=Z.useRef(null),w=Z.useRef(null),T=Z.useRef({width:1,height:1,remoteWidth:1920,remoteHeight:1080}),E=Z.useRef(null),D=Z.useRef(null),O=Z.useRef(new Map),k=Z.useRef(new Set),A=Z.useRef(!1),j=q(e=>{E.current?.send(e)}),M=q(()=>p),[N]=Z.useState(()=>Ld({viewport:()=>T.current,send:j,mode:M,apply:(e,t)=>{let n=e.scale>(A.current?1.01:1.05);n!==A.current&&(A.current=n,E.current?.setZoomed(n)),S.current&&(S.current.style.transition=t&&!window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches?`transform 180ms ease-out`:`none`,S.current.style.transform=`translate(${e.x}px, ${e.y}px) scale(${e.scale})`)}})),P=q(()=>{if(D.current!==null&&cancelAnimationFrame(D.current),D.current=null,O.current.size&&y.current){let e=y.current.getBoundingClientRect(),t=new Map([...O.current].map(([t,n])=>[t,Rd(n,e,x.rotation)]));N.moveMany(t)}O.current.clear()}),F=q(()=>{P(),N.reset(),E.current?.close(),E.current=null}),I=q(()=>{F(),e()});zr({id:`remote-desktop-page`,active:!0,layer:`root`,onBack:I,surfaceRef:b}),Z.useEffect(()=>yn(`remote-desktop-page`),[]),Z.useLayoutEffect(()=>{let e=document.activeElement;return b.current?.focus({preventScroll:!0}),()=>{e instanceof HTMLElement&&e.isConnected&&e.focus({preventScroll:!0})}},[]),K(`keydown`,e=>{e.key===`Escape`&&(e.preventDefault(),Hr.requestBrowserBack())},()=>document);let L=q((e,t)=>{(e===`closed`||e===`connecting`)&&(O.current.clear(),k.current.clear(),N.cancel()),c(e),f(t)}),R=q((e,t)=>{if(e<=0||t<=0||T.current.remoteWidth===e&&T.current.remoteHeight===t)return;let n=T.current;T.current={...n,remoteWidth:e,remoteHeight:t},!(Math.abs(n.remoteWidth/n.remoteHeight-e/t)<.01)&&!k.current.size&&N.reset()});pe(y,([e])=>{if(!e)return;let{width:t,height:n}=e.contentRect,r=Math.abs(T.current.width-t)>=1||Math.abs(T.current.height-n)>=1;T.current={...T.current,width:t,height:n},r&&!k.current.size&&N.refit()}),ei(y),Z.useEffect(()=>{if(!i.data?.supported||!i.data.enabled||!C.current||!w.current)return;let e=jd({...r,video:C.current,image:w.current,onSize:R,onState:L});return E.current=e,e.setZoomed(A.current),()=>{e.close(),E.current=null}},[i.data?.supported,i.data?.enabled,r,a,R,L]),Z.useEffect(()=>()=>{P(),N.reset()},[P,N]);let ee=e=>{let t=y.current.getBoundingClientRect();return Rd({x:e.clientX,y:e.clientY},t,x.rotation)},z=s===`webrtc`||s===`tunnel`,B=i.data?.supported===!1||i.error?.message===`unsupported`,V=i.data?.supported===!0&&i.data.enabled!==!0,te=B||u===`helper_unavailable`?n(`remoteDesktop.unsupported`):V||u===`disabled`?n(`settings.remoteDesktop.disabled`):u===`permission_required`?n(`remoteDesktop.permissions`):u===`permission_denied`?n(`remoteDesktop.denied`):u===`runtime_changed`||i.error?.message===`runtime_changed`?n(`remoteDesktop.runtimeChanged`):u||i.error||s===`closed`?n(`remoteDesktop.failed`):n(`remoteDesktop.connecting`);return(0,jl.createPortal)((0,$.jsx)(`div`,{ref:b,tabIndex:-1,"data-remote-desktop-page":!0,className:`yuri-keyboard-inset-surface yuri-keyboard-inset-snap fixed inset-0 z-[150] overflow-clip bg-background text-foreground outline-none`,children:(0,$.jsxs)(`main`,{"aria-label":t?`${n(`remoteDesktop.title`)} · ${t}`:n(`remoteDesktop.title`),className:`absolute left-0 top-0 flex flex-col overflow-clip bg-background`,style:{width:x.width,height:x.height,transformOrigin:`top left`,"--desktop-safe-top":`env(safe-area-inset-${x.rotation===90?`right`:x.rotation===-90?`left`:`top`}, 0px)`,"--desktop-safe-right":`env(safe-area-inset-${x.rotation===90?`bottom`:x.rotation===-90?`top`:`right`}, 0px)`,"--desktop-safe-bottom":`env(safe-area-inset-${x.rotation===90?`left`:x.rotation===-90?`right`:`bottom`}, 0px)`,"--desktop-safe-left":`env(safe-area-inset-${x.rotation===90?`top`:x.rotation===-90?`bottom`:`left`}, 0px)`,transform:x.rotation===90?`translateX(${x.height}px) rotate(90deg)`:x.rotation===-90?`translateY(${x.width}px) rotate(-90deg)`:void 0},children:[(0,$.jsxs)(`div`,{"data-remote-desktop-stage-region":!0,className:`relative min-h-0 flex-1 overflow-clip`,children:[(0,$.jsxs)(`div`,{ref:y,className:`absolute inset-0 touch-none overflow-clip bg-background`,"aria-label":n(`remoteDesktop.screen`),onPointerDown:e=>{z&&(e.preventDefault(),e.currentTarget.setPointerCapture(e.pointerId),k.current.add(e.pointerId),P(),N.down(e.pointerId,ee(e)))},onPointerMove:e=>{!z||!k.current.has(e.pointerId)||(e.preventDefault(),O.current.set(e.pointerId,{x:e.clientX,y:e.clientY}),D.current===null&&(D.current=requestAnimationFrame(P)))},onPointerUp:e=>{P(),N.up(e.pointerId,ee(e)),k.current.delete(e.pointerId),e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId)},onPointerCancel:e=>{P(),N.up(e.pointerId,ee(e),!0),k.current.delete(e.pointerId)},onContextMenu:e=>e.preventDefault(),children:[(0,$.jsxs)(`div`,{ref:S,className:`absolute inset-0 origin-top-left will-change-transform`,children:[(0,$.jsx)(`video`,{ref:C,autoPlay:!0,muted:!0,playsInline:!0,className:`pointer-events-none absolute inset-0 size-full object-contain`,style:{visibility:s===`webrtc`?`visible`:`hidden`}}),(0,$.jsx)(`img`,{ref:w,alt:n(`remoteDesktop.screen`),draggable:!1,className:`pointer-events-none absolute inset-0 size-full object-contain`,style:{visibility:s===`tunnel`?`visible`:`hidden`}})]}),!z&&(0,$.jsxs)(`div`,{className:`absolute inset-0 flex flex-col items-center justify-center gap-4 p-6 text-center text-sm text-muted-foreground`,role:`status`,children:[s===`connecting`&&!u&&!i.error&&!B&&!V&&(0,$.jsx)(X,{name:`loader-4`,className:`size-5 animate-spin`}),(0,$.jsx)(`p`,{children:te}),(s===`closed`||i.error||V)&&!B&&u!==`runtime_changed`&&i.error?.message!==`runtime_changed`&&(0,$.jsx)(Y,{onClick:()=>{F(),f(void 0),c(`connecting`),i.error||V?i.refetch():o(e=>e+1)},children:n(`remoteDesktop.retry`)})]})]}),(0,$.jsxs)(`div`,{className:`pointer-events-none absolute left-[max(0.75rem,var(--desktop-safe-left))] right-[max(0.75rem,var(--desktop-safe-right))] top-[max(0.75rem,var(--desktop-safe-top))] flex items-start justify-between gap-3`,children:[(0,$.jsx)(Y,{size:`mobileIcon`,variant:`mobileGlass`,className:`pointer-events-auto`,"aria-label":n(`header.actions.backAria`),onClick:()=>Hr.requestBrowserBack(),children:(0,$.jsx)(X,{name:`arrow-left`,className:`size-5`})}),(0,$.jsx)(Y,{size:`mobileIcon`,variant:`mobileGlass`,className:`pointer-events-auto`,"aria-label":n(`remoteDesktop.rotate`),title:n(`remoteDesktop.rotate`),onClick:()=>{P(),N.reset(),g(!1),x.toggle()},children:(0,$.jsx)(X,{name:`smartphone`,className:`size-5 rotate-45`})})]}),(0,$.jsx)(`p`,{className:`sr-only`,children:n(`remoteDesktop.hint`)}),(0,$.jsx)(`div`,{className:`pointer-events-none absolute left-[max(0.75rem,var(--desktop-safe-left))] right-[max(0.75rem,var(--desktop-safe-right))] bottom-[max(0.75rem,var(--desktop-safe-bottom))] top-[calc(4rem+var(--desktop-safe-top))] flex flex-col items-end justify-end gap-3`,children:(0,$.jsxs)(`div`,{className:`flex w-full shrink-0 items-end justify-between gap-3`,children:[(0,$.jsxs)(`div`,{className:`pointer-events-auto flex gap-3`,children:[(0,$.jsx)(Y,{size:`mobileIcon`,variant:`mobileGlass`,className:p===`drag`?`yuri-mobile-inverse-action`:void 0,"aria-label":n(`remoteDesktop.drag`),title:n(`remoteDesktop.drag`),"aria-pressed":p===`drag`,disabled:!z,onClick:()=>{P(),N.cancel(),m(`drag`)},children:(0,$.jsx)(X,{name:`hand`,className:`size-5`})}),(0,$.jsx)(Y,{size:`mobileIcon`,variant:`mobileGlass`,className:p===`cursor`?`yuri-mobile-inverse-action`:void 0,"aria-label":n(`remoteDesktop.cursor`),title:n(`remoteDesktop.cursor`),"aria-pressed":p===`cursor`,disabled:!z,onClick:()=>{P(),N.cancel(),m(`cursor`)},children:(0,$.jsx)(X,{name:`cursor`,className:`size-5`})})]}),(0,$.jsx)(Y,{size:`mobileIcon`,variant:`mobileGlass`,className:`pointer-events-auto${h?` yuri-mobile-inverse-action`:``}`,disabled:!z,"aria-label":n(`remoteDesktop.text`),title:n(`remoteDesktop.text`),"aria-pressed":h,"aria-expanded":h,onClick:()=>g(e=>!e),children:(0,$.jsx)(X,{name:`keyboard`,className:`size-5`})})]})})]}),h&&(0,$.jsxs)(`footer`,{"data-remote-desktop-keyboard":!0,className:`max-h-[50%] w-full shrink-0 overflow-y-auto overscroll-contain border-t border-border bg-[var(--surface-elevated)] pt-3 pl-[max(0.75rem,var(--desktop-safe-left))] pr-[max(0.75rem,var(--desktop-safe-right))] pb-[max(0.75rem,var(--desktop-safe-bottom))]`,children:[(0,$.jsxs)(`form`,{className:`flex gap-2`,onSubmit:e=>{e.preventDefault(),_&&z&&(j({type:`text`,text:_}),v(``))},children:[(0,$.jsx)(Zn,{className:`min-w-0 flex-1`,value:_,maxLength:1024,onChange:e=>v(e.target.value),placeholder:n(`remoteDesktop.text`),"aria-label":n(`remoteDesktop.text`),disabled:!z,autoComplete:`off`}),(0,$.jsx)(Y,{type:`submit`,size:`icon`,disabled:!z||!_,"aria-label":n(`remoteDesktop.send`),children:(0,$.jsx)(X,{name:`send-plane-2`,className:`size-4`})})]}),(0,$.jsx)(`div`,{className:`mt-2 grid grid-cols-4 gap-1 min-[360px]:grid-cols-8`,children:Zd.map(({key:e,icon:t})=>(0,$.jsx)(Y,{size:`icon`,variant:`ghost`,className:`w-full`,disabled:!z,onClick:()=>j({type:`key`,key:e}),"aria-label":n(`remoteDesktop.pressKey`,{key:e}),title:n(`remoteDesktop.pressKey`,{key:e}),children:(0,$.jsx)(X,{name:t,className:`size-4`})},e))})]})]})}),document.body)}var $d=Z.memo(Qd);function ef(e){let t=(0,Q.c)(25),{title:n,subtitle:r,onBack:i,onOpenMenu:a,menuOpen:o,elevated:s,trailing:c}=e,l=o!==void 0&&o,u=s!==void 0&&s,{t:d}=Te(),f=U(),p=q(i),m=q(a),h;t[0]!==f||t[1]!==n?(h=f?.entry.location.hostId?(0,$.jsx)(tf,{host:f}):n,t[0]=f,t[1]=n,t[2]=h):h=t[2];let g;t[3]!==f||t[4]!==r?(g=r||(f?.entry.location.hostId?(0,$.jsx)(Cn,{registry:f.registry,hostId:f.entry.location.hostId,showName:!0}):null),t[3]=f,t[4]=r,t[5]=g):g=t[5];let _;t[6]===d?_=t[7]:(_=d(`header.actions.backAria`),t[6]=d,t[7]=_);let v=u||l,y;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,$.jsx)(Ia,{mobile:!0}),t[8]=y):y=t[8];let b;t[9]===c?b=t[10]:(b=(0,$.jsxs)($.Fragment,{children:[y,c]}),t[9]=c,t[10]=b);let x;t[11]===d?x=t[12]:(x=d(`mobile.menu.titleAria`),t[11]=d,t[12]=x);let S;t[13]!==m||t[14]!==l||t[15]!==x?(S=[{icon:`more-2`,ariaLabel:x,onClick:m,pressed:l}],t[13]=m,t[14]=l,t[15]=x,t[16]=S):S=t[16];let C;return t[17]!==p||t[18]!==S||t[19]!==h||t[20]!==g||t[21]!==_||t[22]!==v||t[23]!==b?(C=(0,$.jsx)(ze,{title:h,subtitle:g,backAriaLabel:_,onBack:p,overlay:!0,collapsible:!0,elevated:v,trailing:b,actions:S}),t[17]=p,t[18]=S,t[19]=h,t[20]=g,t[21]=_,t[22]=v,t[23]=b,t[24]=C):C=t[24],C}function tf(e){let t=(0,Q.c)(16),{host:n}=e,{t:r}=Te(),{location:i}=n.entry,a;t[0]!==i.directory||t[1]!==i.hostId||t[2]!==i.hubId?(a=e=>e.remoteSession?.location.hubId===i.hubId&&e.remoteSession.location.hostId===i.hostId&&e.remoteSession.location.directory===i.directory?e.remoteSession:null,t[0]=i.directory,t[1]=i.hostId,t[2]=i.hubId,t[3]=a):a=t[3];let o=rt(a),s=o?.sessionId,c=Qt(n.registry,i.hostId),l;t[4]!==i.directory||t[5]!==s||t[6]!==c.data?.directories?(l=c.data?.directories.find(e=>e.directory===i.directory)?.sessions.find(e=>e.id===s),t[4]=i.directory,t[5]=s,t[6]=c.data?.directories,t[7]=l):l=t[7];let u=l,d;t[8]!==n.entry||t[9]!==o?.draft?.title||t[10]!==s||t[11]!==u?.title||t[12]!==r?(d=s?(0,$.jsx)(nf,{entry:n.entry,sessionId:s,fallback:u?.title||r(`mobile.sessions.untitled`)}):o?.draft?.title||r(`mobile.menu.newSession`),t[8]=n.entry,t[9]=o?.draft?.title,t[10]=s,t[11]=u?.title,t[12]=r,t[13]=d):d=t[13];let f;return t[14]===d?f=t[15]:(f=(0,$.jsx)($.Fragment,{children:d}),t[14]=d,t[15]=f),f}var nf=(0,Z.memo)(function(e){let t=(0,Q.c)(10),{entry:n,sessionId:r,fallback:i}=e,a;t[0]!==n.queryScope||t[1]!==r?(a=[...n.queryScope,`chat`,r,`session`],t[0]=n.queryScope,t[1]=r,t[2]=a):a=t[2];let o;t[3]===r?o=t[4]:(o=e=>e.id===r&&e.title?.trim()||null,t[3]=r,t[4]=o);let s;t[5]!==a||t[6]!==o?(s={queryKey:a,queryFn:V,enabled:!1,staleTime:1/0,gcTime:1/0,select:o},t[5]=a,t[6]=o,t[7]=s):s=t[7];let c=re(s,W).data??i,l;return t[8]===c?l=t[9]:(l=(0,$.jsx)($.Fragment,{children:c}),t[8]=c,t[9]=l),l});function rf(e){return e.sessionId?e.userRefreshInFlight||e.backgroundResyncInFlight?`syncing`:e.hasRenderableTranscript?null:!e.isConnected&&e.connectionPhase===`reconnecting`||e.loadStatus!==`error`?`syncing`:null:null}function af(e,t){let n=t?.showDelayMs??250,r=t?.hideGraceMs??1e3,i=!1,a=!1,o=null,s=()=>{o=null,a!==i&&(a=i,e(a))};return{setRaw(e){i=e,o&&clearTimeout(o),o=setTimeout(s,i?n:r)},cancel(){i=!1,o&&=(clearTimeout(o),null)}}}function of(e,t){let n=(0,Q.c)(10),r;n[0]===t?r=n[1]:(r={key:t},n[0]=t,n[1]=r);let i=r,a;n[2]===i?a=n[3]:(a={scope:i,visible:!1},n[2]=i,n[3]=a);let[o,s]=(0,Z.useState)(a),c;n[4]===i?c=n[5]:(c=af(e=>s({scope:i,visible:e})),n[4]=i,n[5]=c);let l=c,u,d;return n[6]!==e||n[7]!==l?(u=()=>(l.setRaw(e),()=>l.cancel()),d=[e,l],n[6]=e,n[7]=l,n[8]=u,n[9]=d):(u=n[8],d=n[9]),(0,Z.useEffect)(u,d),o.scope===i&&o.visible}function sf(e,t){let n=(0,Q.c)(20),{t:r}=Te(),i=ut(e,t),{renderable:a}=wt(e,t),o=xt(df),s=xt(uf),c;n[0]!==t||n[1]!==e?(c=()=>F(e,t),n[0]=t,n[1]=e,n[2]=c):c=n[2];let l=(0,Z.useSyncExternalStore)(R,c,lf),u;n[3]!==t||n[4]!==e?(u=()=>at(e,t),n[3]=t,n[4]=e,n[5]=u):u=n[5];let d=(0,Z.useSyncExternalStore)(It,u,cf),f=i?.status,p;n[6]!==d||n[7]!==s||n[8]!==a||n[9]!==o||n[10]!==e||n[11]!==f||n[12]!==l?(p=rf({sessionId:e,hasRenderableTranscript:a,loadStatus:f,userRefreshInFlight:l,backgroundResyncInFlight:d,isConnected:o,connectionPhase:s}),n[6]=d,n[7]=s,n[8]=a,n[9]=o,n[10]=e,n[11]=f,n[12]=l,n[13]=p):p=n[13];let m=p,h;n[14]!==t||n[15]!==e?(h=JSON.stringify([t,e]),n[14]=t,n[15]=e,n[16]=h):h=n[16];let g=of(m===`syncing`,h),_;return n[17]!==r||n[18]!==g?(_=g?r(`mobile.chat.syncingMessages`):null,n[17]=r,n[18]=g,n[19]=_):_=n[19],_}function cf(){return!1}function lf(){return!1}function uf(e){return e.connectionPhase}function df(e){return e.isConnected}function ff(e,t){let n=(0,Q.c)(41),{t:r}=Te(),i=ie(e.registry,e.entry.location.hostId),a=(0,Z.useSyncExternalStore)(P,N,N),o;n[0]===e.entry.location?o=n[1]:(o=M(e.entry.location),n[0]=e.entry.location,n[1]=o);let s=o,c;n[2]!==e.entry.location||n[3]!==s||n[4]!==t?(c=s&&t?L(e.entry.location,t):null,n[2]=e.entry.location,n[3]=s,n[4]=t,n[5]=c):c=n[5];let l;n[6]!==a||n[7]!==c?(l={revision:a,scope:c},n[6]=a,n[7]=c,n[8]=l):l=n[8];let u=l.scope,d;n[9]!==s||n[10]!==u?(d=e=>s&&u?s.subscribe(u,e):hf,n[9]=s,n[10]=u,n[11]=d):d=n[11];let f=d,p;n[12]!==s||n[13]!==u||n[14]!==t?(p=()=>!s||!u?t?`loading`:`idle`:s.getHydrationState?.(u).p0Satisfied?`renderable`:s.getRequestState?.(u).status??`loading`,n[12]=s,n[13]=u,n[14]=t,n[15]=p):p=n[15];let m=p,h=(0,Z.useSyncExternalStore)(f,m,m),g;n[16]===e.entry.location?g=n[17]:(g=v(e.entry.location),n[16]=e.entry.location,n[17]=g);let _=g,y;n[18]!==_||n[19]!==t?(y=()=>F(t,_),n[18]=_,n[19]=t,n[20]=y):y=n[20];let b=(0,Z.useSyncExternalStore)(R,y,mf),x;n[21]!==_||n[22]!==t?(x=()=>at(t,_),n[21]=_,n[22]=t,n[23]=x):x=n[23];let S=(0,Z.useSyncExternalStore)(It,x,pf),C=h===`renderable`,w=h===`error`?`error`:h===`ready`?`ready`:`loading`,T=i?.state===`connected`,E=i?.state===`connected`?`connected`:i?.state===`connecting`?`connecting`:`reconnecting`,D;n[24]!==S||n[25]!==t||n[26]!==T||n[27]!==E||n[28]!==C||n[29]!==w||n[30]!==b?(D=rf({sessionId:t,hasRenderableTranscript:C,loadStatus:w,userRefreshInFlight:b,backgroundResyncInFlight:S,isConnected:T,connectionPhase:E}),n[24]=S,n[25]=t,n[26]=T,n[27]=E,n[28]=C,n[29]=w,n[30]=b,n[31]=D):D=n[31];let O=D,k;n[32]!==_||n[33]!==t?(k=JSON.stringify([_,t]),n[32]=_,n[33]=t,n[34]=k):k=n[34];let A=of(O===`syncing`,k),j;if(n[35]!==i||n[36]!==r){j=Symbol.for(`react.early_return_sentinel`);bb0:{let e=Vn(i);if(e){j=r(e.key);break bb0}}n[35]=i,n[36]=r,n[37]=j}else j=n[37];if(j!==Symbol.for(`react.early_return_sentinel`))return j;let I;return n[38]!==r||n[39]!==A?(I=A?r(`mobile.chat.syncingMessages`):null,n[38]=r,n[39]=A,n[40]=I):I=n[40],I}function pf(){return!1}function mf(){return!1}function hf(){}function gf(e){let t=(0,Q.c)(3),n=U(),r;return t[0]!==n||t[1]!==e?(r=n?.entry.location.hostId?(0,$.jsx)(vf,{...e,host:n}):(0,$.jsx)(_f,{...e}),t[0]=n,t[1]=e,t[2]=r):r=t[2],r}function _f(e){let t=(0,Q.c)(15),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({sessionId:i,directory:n,title:a,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let{t:o}=Te(),s=i.length===0,c=Je(s?null:i),l;t[5]!==s||t[6]!==c?.title||t[7]!==o||t[8]!==a?(l=s?a?.trim()||o(`mobile.menu.newSession`):a?.trim()||c?.title?.trim()||o(`mobile.sessions.untitled`),t[5]=s,t[6]=c?.title,t[7]=o,t[8]=a,t[9]=l):l=t[9];let u=l,d=sf(s?``:i,n||void 0),f;return t[10]!==r||t[11]!==u||t[12]!==i||t[13]!==d?(f=(0,$.jsx)(yf,{...r,sessionId:i,title:u,syncHint:d}),t[10]=r,t[11]=u,t[12]=i,t[13]=d,t[14]=f):f=t[14],f}function vf(e){let t=(0,Q.c)(14),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({host:n,sessionId:i,title:a,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o;t[5]!==n.entry.location.directory||t[6]!==n.entry.location.hostId||t[7]!==n.entry.location.hubId?(o=e=>{let t=e.remoteSession;return t?.location.hubId===n.entry.location.hubId&&t.location.hostId===n.entry.location.hostId&&t.location.directory===n.entry.location.directory?t.sessionId:null},t[5]=n.entry.location.directory,t[6]=n.entry.location.hostId,t[7]=n.entry.location.hubId,t[8]=o):o=t[8];let s=rt(o),c=i||s||``,l=ff(n,c),u;return t[9]!==c||t[10]!==r||t[11]!==l||t[12]!==a?(u=(0,$.jsx)(yf,{...r,sessionId:c,title:a,syncHint:l}),t[9]=c,t[10]=r,t[11]=l,t[12]=a,t[13]=u):u=t[13],u}function yf(e){let t=(0,Q.c)(31),{sessionId:n,title:r,onBack:i,onOpenMenu:a,onCloseMenu:o,menuOpen:s,children:c,className:l,syncHint:u}=e,d=s!==void 0&&s,{t:f}=Te(),[p,m]=Z.useState(!1),h;t[0]!==d||t[1]!==o?(h=e=>{e&&d&&o?.(),m(e)},t[0]=d,t[1]=o,t[2]=h):h=t[2];let g=q(h),_;t[3]!==p||t[4]!==a?(_=()=>{p&&m(!1),a()},t[3]=p,t[4]=a,t[5]=_):_=t[5];let v=q(_),y=d||p,b;t[6]===l?b=t[7]:(b=Vt(`mobile-chat-screen relative isolate flex h-full min-h-0 w-full flex-col overflow-hidden bg-background text-foreground`,l),t[6]=l,t[7]=b);let x;t[8]!==n||t[9]!==f||t[10]!==r?(x=r||f(n?`mobile.sessions.untitled`:`mobile.menu.newSession`),t[8]=n,t[9]=f,t[10]=r,t[11]=x):x=t[11];let S;t[12]!==p||t[13]!==g||t[14]!==n?(S=(0,$.jsx)(mc,{sessionId:n,open:p,onOpenChange:g}),t[12]=p,t[13]=g,t[14]=n,t[15]=S):S=t[15];let C;t[16]!==v||t[17]!==y||t[18]!==d||t[19]!==i||t[20]!==u||t[21]!==x||t[22]!==S?(C=(0,$.jsx)(ef,{title:x,subtitle:u,onBack:i,onOpenMenu:v,menuOpen:d,elevated:y,trailing:S}),t[16]=v,t[17]=y,t[18]=d,t[19]=i,t[20]=u,t[21]=x,t[22]=S,t[23]=C):C=t[23];let w;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(w=Vt(`mobile-chat-screen__content relative h-full min-h-0 flex-1`,`[&_[data-scrollbar=chat]>.yuri-chat-scroll-content]:pt-[calc(max(0.625rem,var(--yuri-safe-area-top,0px))+var(--yuri-mobile-detail-navigation-height)+1.25rem)]`),t[24]=w):w=t[24];let T;t[25]===c?T=t[26]:(T=(0,$.jsx)(`div`,{className:w,children:c}),t[25]=c,t[26]=T);let E;return t[27]!==b||t[28]!==C||t[29]!==T?(E=(0,$.jsxs)(`main`,{className:b,children:[C,T]}),t[27]=b,t[28]=C,t[29]=T,t[30]=E):E=t[30],E}function bf(e){let t=(0,Q.c)(4),n=e===void 0?2500:e,{uiFont:r}=xi(),[i,a]=Z.useState(!1),o,s;return t[0]!==n||t[1]!==r?(o=()=>{let e=!1,t=()=>{e||a(!0)},i=()=>{requestAnimationFrame(()=>requestAnimationFrame(t))},o=Promise.all([Gn(r).catch(Tf),document.fonts?.ready?.then(wf).catch(Cf)??Promise.resolve(),wo.catch(Sf)]).then(xf),s=new Promise(e=>{window.setTimeout(e,n)});return Promise.race([o,s]).then(i),()=>{e=!0}},s=[r,n],t[0]=n,t[1]=r,t[2]=o,t[3]=s):(o=t[2],s=t[3]),Z.useEffect(o,s),i}function xf(){}function Sf(){}function Cf(){}function wf(){}function Tf(){}var Ef=e=>e.replace(/^\/+|\/+$/g,``),Df=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},Of=e=>{let t=Ef(e.pathname).split(`/`).filter(Boolean);return e.host?[e.host,...t]:t};function kf(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=Of(t),r=(n[0]??``).toLowerCase(),i=n.slice(1),a=t.searchParams;switch(r){case`connect`:{let t=to(e);return t?{type:`connect`,pairing:t}:null}case`session`:{let e=i[0]||a.get(`id`)||``;return e?{type:`session`,sessionId:e,directory:Df(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:Df(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=Df(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 Af={},jf=null,Mf=!1,Nf=null,Pf=e=>{switch(e.type){case`connect`:return jf?(jf(e.pairing),!0):!1;case`session`:return _()?(Tt.getState().setCurrentSession(e.sessionId,e.directory??null),!0):(kt.getState().openSession({sessionId:e.sessionId,directory:e.directory??null}),!0);case`assistant`:if(!_()){let t=kt.getState();return t.setActiveTab(`assistant`),t.openAssistant(e.assistantId),!0}return Ut(e.assistantId),!0;case`new-session`:return _()?(Tt.getState().openNewSessionDraft({directoryOverride:e.directory??null,selectedProjectId:e.projectId??null,preserveDirectoryOverride:!!e.directory,ensureProjectForDirectory:!!e.directory,initialPrompt:e.prompt}),!0):(kt.getState().openDraft({directoryOverride:e.directory??null,selectedProjectId:e.projectId??null,preserveDirectoryOverride:!!e.directory,ensureProjectForDirectory:!!e.directory,initialPrompt:e.prompt}),!0);case`open-project`:return _()?(Tt.getState().openNewSessionDraft({directoryOverride:e.directory,preserveDirectoryOverride:!0}),!0):(kt.getState().openDraft({directoryOverride:e.directory,preserveDirectoryOverride:!0}),!0);case`sessions`:return Af.openSessions?(Af.openSessions(e.filter),!0):!1;case`status`:return Af.openSessions?(Af.openSessions(),!0):(ge.getState().setMobileSessionPanelOpen(!0),!0);case`view`:return Af.openView?(Af.openView(e.target),!0):!1;case`changes`:return Af.openChanges?(Af.openChanges({path:e.path,staged:e.staged}),!0):!1;case`settings`:return Af.openSettings?(Af.openSettings(e.section),!0):!1}return!1},Ff=()=>{if(!Nf||!Mf&&Nf.type!==`connect`)return;let e=Nf;Nf=null,Pf(e)||(Nf=e)},If=e=>{Nf=e,Ff()},Lf=e=>{let t=kf(e);t&&If(t)},Rf=e=>{Mf=e,Ff()},zf=e=>{let t=(0,Q.c)(3),n,r;t[0]===e?(n=t[1],r=t[2]):(n=()=>(Af=e,Ff(),()=>{Af===e&&(Af={})}),r=[e],t[0]=e,t[1]=n,t[2]=r),Z.useEffect(n,r)},Bf=e=>{let t=(0,Q.c)(3),n,r;t[0]===e?(n=t[1],r=t[2]):(n=()=>(jf=e,Ff(),()=>{jf===e&&(jf=null)}),r=[e],t[0]=e,t[1]=n,t[2]=r),Z.useEffect(n,r)},Vf=e=>{let{ready:t}=e,[n,r]=Z.useState(()=>g()?`pending`:`none`);return Z.useEffect(()=>{Rf(t)},[t]),Z.useEffect(()=>{if(!g())return;let e=!1,t=[];return he(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=>{Lf(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=kf(a?.url);r(o?.type===`connect`?`connect`:o?`other`:`none`),o&&If(o)}).catch(()=>{e||r(`none`)}),he(async()=>{let{PushNotifications:e}=await import(`./vendor-capacitor-push-notifications-D5cqJIPw.js`).then(e=>e.t);return{PushNotifications:e}},__vite__mapDeps([80,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){Lf(n);return}let r=typeof t?.assistantID==`string`?t.assistantID.trim():``;if(r){If({type:`assistant`,assistantId:r});return}let i=typeof t?.sessionId==`string`?t.sessionId:void 0;i&&If({type:`session`,sessionId:i})});if(e){r.remove();return}t.push(()=>void r.remove())}).catch(()=>void 0),()=>{e=!0,t.forEach(e=>e())}},[]),n},Hf=.85,Uf=8,Wf=.35,Gf=.22,Kf=e=>({segmentStart:e,lastTouch:e,open:!1}),qf=e=>e*Wf,Jf=e=>e*Gf,Yf=(e,t)=>Math.max(0,e-t),Xf=(e,t)=>Math.max(0,t-e),Zf=(e,t)=>{let n=Math.abs(e);return n<Uf||Math.abs(t)<=n*Hf},Qf=(e,t,n)=>{let r=t.clientX-e.segmentStart.clientX,i=t.clientY-e.segmentStart.clientY,a=Yf(e.segmentStart.clientX,t.clientX),o=qf(n),s=Jf(n),c=e.open;return c=a<=0?!1:e.open?a>=s:a>=o&&Zf(r,i),{segmentStart:e.segmentStart,lastTouch:t,open:c}},$f=e=>{if(e.disabled||e.startedOnExcludedTarget)return{open:!1,back:!1};let t=e.endX-e.startX,n=e.endY-e.startY,r=Yf(e.startX,e.endX),i=Xf(e.startX,e.endX),a=qf(e.viewportWidth),o=Zf(t,n);return{open:r>=a&&o,back:i>=a&&o}},ep=(e,t,n)=>Math.min(Yf(e,t)/Math.max(1,qf(n)),1),tp=(e,t,n)=>Math.min(Xf(e,t)/Math.max(1,qf(n)),1),np=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},rp=e=>{let t=document.elementFromPoint(e.clientX,e.clientY);return!!t?.closest(`.yuri-mobile-composer`)||np(t)},ip=1,ap=(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===ip?n:n.parentElement;return!!(r&&t.contains(r))},op=e=>ap(window.getSelection(),e),sp=(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=qf(g),n=Ge({thresholdReached:p,distance:e,enterDistance:t,cancelDistance:Jf(g),available:!0});p=n.thresholdReached,n.event===`enter`&&(m=$e(`medium`,{bypassCadence:!0})),n.event===`cancel`&&($e(`light`,{bypassCadence:!0}),m=!1)},y=e=>{o.current?.(null),p&&!e&&$e(`light`,{bypassCadence:!0}),p=!1,m=!1,e?r.current():f&&a.current?.(),f=!1},b=e=>{c.current?.(null),p&&!e&&$e(`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=rp(r)||op(t),d=null,f=!1,p=!1,m=!1,h=0,_=Kf(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];_=Qf(_,r,g);let a=r.clientX-_.segmentStart.clientX,l=r.clientY-_.segmentStart.clientY;if(d===null){if(op(t))return;let e=Math.abs(a);if(e<Uf||Math.abs(l)>e*Hf)return;if(a<0)d=`sessions`,f=!0,i.current?.();else if(s.current)d=`back`;else return}e.preventDefault(),h=d===`sessions`?Yf(_.segmentStart.clientX,r.clientX):Xf(_.segmentStart.clientX,r.clientX),v(h),d===`sessions`?o.current?.(ep(_.segmentStart.clientX,r.clientX,g)):c.current?.(tp(_.segmentStart.clientX,r.clientX,g))},C=e=>{if(!n||!_)return;if(n=!1,!d){_=null;return}let t=e.changedTouches[0];t&&(_=Qf(_,t,g),h=d===`sessions`?Yf(_.segmentStart.clientX,t.clientX):Xf(_.segmentStart.clientX,t.clientX),v(h));let r=d===`sessions`?_.open:$f({startX:_.segmentStart.clientX,startY:_.segmentStart.clientY,endX:_.lastTouch.clientX,endY:_.lastTouch.clientY,viewportWidth:g,disabled:!1,startedOnExcludedTarget:!1}).back;_=null,e.preventDefault(),r&&!m&&$e(`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])},cp=me(`YuriNotifications`),lp=()=>J.getPlatform()===`android`&&J.isPluginAvailable(`YuriNotifications`);async function up(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 je()).find(e=>Ne(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 dp(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 fp=()=>{if(lp()||typeof window>`u`)return!1;let e=window.Capacitor?.getPlatform?.();return e===`ios`||e===`android`},pp=(e,t)=>{x()?.push?.registerApnsToken?.({token:e,platform:y(),locale:t})},mp=e=>{let{enabled:t}=e,n=ge(e=>e.nativeNotificationsEnabled),r=Ee(e=>e.locale),i=Z.useRef(null),a=Z.useRef(r);a.current=r,Z.useEffect(()=>{if(!t||!n||!fp())return;let e=!1,r=[];return he(async()=>{let{PushNotifications:e}=await import(`./vendor-capacitor-push-notifications-D5cqJIPw.js`).then(e=>e.t);return{PushNotifications:e}},__vite__mapDeps([80,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,pp(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||!fp())return;let e=i.current;e&&pp(e,r)},[t,n,r]),Z.useEffect(()=>{if(n)return;let e=i.current;e&&(i.current=null,x()?.push?.unregisterApnsToken?.({token:e}))},[n])},hp=`YuriLiveActivity`,gp=5e3,_p=3600,vp=`live`,yp=me(hp),bp=e=>e.isCapacitor&&e.platform===`ios`&&e.pluginAvailable;function xp(){return typeof window>`u`?!1:bp({isCapacitor:g(),platform:y(),pluginAvailable:J.isPluginAvailable(hp)})}var Sp=()=>yp,Cp=new Set([`permission`,`input`,`retry`]),wp=()=>({trackedSessionId:null,started:!1,startedAt:null,busySince:null,lastStatus:null,eventVersion:0,items:[]}),Tp=(e,t)=>Math.max(Math.floor(e),t+1),Ep=e=>e.failedEpoch===e.currentEpoch?e.previous:e.current,Dp=e=>e.failedEpoch===e.currentEpoch&&e.retryCount<1,Op=e=>e.hasSessionError?`error`:e.hasPendingPermissions?`permission`:e.hasPendingQuestions?`input`:e.statusType===`retry`?`retry`:e.statusType===`busy`?`working`:e.statusType===`idle`?`complete`:null,kp=e=>{let t=e.trim();return t.length<=80?t:`${t.slice(0,79)}…`},Ap=e=>typeof e.parentID==`string`&&e.parentID.length>0?e.parentID:null,jp=e=>{if(e.runningIds.size===0)return[];let t=[];for(let n of e.sessions)!e.runningIds.has(n.id)||Ap(n)||t.push({sessionId:n.id,title:kp(n.title??``),statusType:e.statuses[n.id]?.type??`busy`});return t},Mp=e=>e!==`complete`&&e!==`error`,Np=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`,Pp=e=>{if(e.length<=4)return e;let t=e.filter(e=>Mp(e.status)),n=e.filter(e=>!Mp(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)},Fp=(e,t,n,r)=>{if(n&&n.length>0)return n;let i=r?.[e];return i&&i.length>0?i:t},Ip=(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=Op({statusType:e.statusType,hasPendingPermissions:e.hasPendingPermissions===!0,hasPendingQuestions:e.hasPendingQuestions===!0,hasSessionError:e.hasSessionError===!0})??`working`;o.push({sessionId:t.sessionId,title:Fp(t.sessionId,t.title,e.title,r),status:i,startedAt:t.startedAt,busySince:i===`working`?t.busySince??n:null})}else if(Mp(t.status))o.push({...t,title:Fp(t.sessionId,t.title,void 0,r),status:`complete`,endedAt:n,busySince:null});else{let e=Fp(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=Op({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 Pp(o)},Lp=e=>e.map(e=>`${e.sessionId}\0${e.title}\0${e.status}\0${e.endedAt??``}`).join(`
16
- `),Rp=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}),zp=(e,t,n,r,i)=>{let a=e.filter(e=>Mp(e.status)),o=a[0]??e[0],s={sessionId:vp,startedAt:o?.startedAt??r,status:t,eventVersion:n,updatedAt:r,title:o?.title,workingCount:a.length,items:Rp(e)};return i?.endedAt!==void 0&&(s.endedAt=i.endedAt),i?.dismissalSeconds!==void 0&&(s.dismissalSeconds=i.dismissalSeconds),s},Bp=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},Vp=(e,t,n,r)=>{let i=e.trackedSessionId;if(!i||!e.started)return{state:wp(),commands:[]};let a=Tp(t,e.eventVersion);return{state:wp(),commands:[{type:`end`,payload:Bp({sessionId:i,startedAt:e.startedAt??t,status:n,eventVersion:a,updatedAt:t,endedAt:t,dismissalSeconds:r})}]}},Hp=(e,t,n,r,i)=>{let a=Tp(r,i);return{state:{trackedSessionId:e,started:!0,startedAt:n,busySince:null,lastStatus:t,eventVersion:a,items:[]},commands:[{type:`start`,payload:Bp({sessionId:e,startedAt:n,status:t,eventVersion:a,updatedAt:r})}]}},Up=(e,t,n)=>{let r=Op(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=gp-(t.now-(i??t.now));if(r>0)return{state:{...e,trackedSessionId:n,busySince:i},commands:[{type:`wait`,delayMs:r}]}}else if(!r||!Cp.has(r))return{state:{...wp(),trackedSessionId:n},commands:[]};return Hp(n,r,i??t.now,t.now,e.eventVersion)}if(r===`complete`)return Vp({...e,busySince:i},t.now,`complete`,900);if(r===`error`)return Vp({...e,busySince:i},t.now,`error`,_p);if(!r||r===e.lastStatus)return{state:{...e,trackedSessionId:n,busySince:i},commands:[]};let a=Tp(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:Bp({sessionId:n,startedAt:e.startedAt??t.now,status:r,eventVersion:a,updatedAt:t.now})}]}},Wp=(e,t,n)=>{let r=e.trackedSessionId;if(!r||!e.started)return{state:e,commands:[]};let i=Tp(n,e.eventVersion);return{state:{...e,busySince:null,lastStatus:t,eventVersion:i},commands:[{type:`update`,payload:Bp({sessionId:r,startedAt:e.startedAt??n,status:t,eventVersion:i,updatedAt:n})}]}},Gp=(e,t,n)=>{let r=Ip(e.items,n,t.now,t.sessionTitles,t.rootSessionIds),i=r.filter(e=>Mp(e.status)),a=Np(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=Tp(t.now,n.eventVersion),a=r.map(e=>Mp(e.status)?{...e,status:`stale`}:e);return{state:{...n,items:a,lastStatus:`stale`,eventVersion:i,busySince:null},commands:[{type:`update`,payload:Bp(zp(a,`stale`,i,t.now))}]}}if(!e.started){if(i.length===0)return{state:wp(),commands:[]};if(!i.some(e=>Cp.has(e.status))){let n=gp-(t.now-(o??t.now));if(n>0)return{state:{...e,trackedSessionId:vp,items:r,busySince:o},commands:[{type:`wait`,delayMs:n}]}}let n=o??t.now,s=r.map(e=>Mp(e.status)?{...e,startedAt:e.busySince??n}:e),c=Tp(t.now,e.eventVersion);return{state:{trackedSessionId:vp,started:!0,startedAt:n,busySince:null,lastStatus:a,eventVersion:c,items:s},commands:[{type:`start`,payload:Bp(zp(s,a,c,t.now))}]}}if(i.length===0){let n=r.some(e=>e.status===`error`)?`error`:`complete`,i=Tp(t.now,e.eventVersion);return{state:wp(),commands:[{type:`end`,payload:Bp(zp(r,n,i,t.now,{endedAt:t.now,dismissalSeconds:n===`error`?_p:900}))}]}}if(Lp(e.items)===Lp(r)&&e.lastStatus===a)return{state:{...e,trackedSessionId:vp,items:r,busySince:null},commands:[]};let s=Tp(t.now,e.eventVersion);return{state:{trackedSessionId:vp,started:!0,startedAt:e.startedAt??o??t.now,busySince:null,lastStatus:a,eventVersion:s,items:r},commands:[{type:`update`,payload:Bp(zp(r,a,s,t.now))}]}},Kp=(e,t)=>{if(t.catalog)return Gp(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:[]}:Wp(n,`stale`,t.now)}let n=[],r=e;if(r.trackedSessionId&&r.trackedSessionId!==t.sessionId)if(r.started){let e=Vp(r,t.now,r.lastStatus??`complete`,0);n.push(...e.commands),r=e.state}else r=wp();if(!t.sessionId){if(r.started){let e=Vp(r,t.now,`complete`,900);return{state:e.state,commands:[...n,...e.commands]}}return{state:wp(),commands:n}}let i=Up(r,t,t.sessionId);return{state:i.state,commands:[...n,...i.commands]}},qp=e=>e/1e3,Jp=e=>{let t={sessionId:e.sessionId,title:e.title,status:e.status,startedAt:qp(e.startedAt)};return e.endedAt!==void 0&&(t.endedAt=qp(e.endedAt)),t},Yp=e=>{let t={sessionId:e.sessionId,startedAt:qp(e.startedAt),status:e.status,eventVersion:e.eventVersion,updatedAt:qp(e.updatedAt)};return e.endedAt!==void 0&&(t.endedAt=qp(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(Jp)),t},Xp=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},Zp=(e,t,n)=>{if(!e||n.type===`wait`)return Promise.resolve();let r=Yp(n.payload),i=Xp(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})},Qp=e=>e.getCurrentEpoch()===e.epoch?!e.getCurrentSessionId||e.getCurrentSessionId()===e.observation.sessionId:!1,$p=async e=>{let t=e.state;if(!Qp(e))return{state:t,delayMs:null,retry:!1,superseded:!0};let n=Kp(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 Qp(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(!Qp(e)||(await Zp(e.available,e.plugin,i),!Qp(e)))return{state:t,delayMs:null,retry:!1,superseded:!0};let s=r===a.length-1;o=i.type===`end`&&!s?wp():n.state}return{state:n.state,delayMs:i,retry:!1,superseded:!1}}catch{if(!Qp(e))return{state:t,delayMs:null,retry:!1,superseded:!0};let r=Ep({failedEpoch:e.epoch,currentEpoch:e.getCurrentEpoch(),previous:o,current:n.state}),i=Dp({failedEpoch:e.epoch,currentEpoch:e.getCurrentEpoch(),retryCount:e.retryCount});return{state:r,delayMs:i?250:null,retry:i,superseded:!1}}},em=()=>({desired:null,registered:null}),tm=e=>{if(typeof e!=`string`)return null;let t=e.trim();return t.length>0?t:null},nm=e=>{if(!e||typeof e!=`object`)return null;let t=e,n=tm(t.activityId),r=tm(t.sessionId),i=tm(t.token);return!n||!r||!i?null:{activityId:n,sessionId:r,token:i}},rm=(e,t)=>e.activityId===t.activityId&&e.token===t.token,im=(e,t)=>{let n=e.registered?.runtimeIdentity===t?e.registered:null;return e.desired===null&&n===e.registered?e:{desired:null,registered:n}},am=(e,t)=>{if(!t.connected)return[];if(e.desired&&t.enabled&&t.selectedSessionId&&e.desired.sessionId===t.selectedSessionId){let n=e.registered;return n&&rm(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}]:[]},om=(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=im(e,t.runtimeIdentity):e.registered&&e.registered.runtimeIdentity!==t.runtimeIdentity&&!e.desired&&(r={...e,registered:null});return{state:r,commands:am(r,t)}},sm=async e=>{try{return await e}catch{return null}},cm=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 sm(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 sm(e.unregister({token:r.token}))}continue}if(n.runtimeIdentity!==e.getRuntimeIdentity()){t.registered?.runtimeIdentity===n.runtimeIdentity&&(t={...t,registered:null});continue}(await sm(e.unregister(n.payload)))?.ok===!0&&t.registered?.token===n.payload.token&&(t={...t,registered:null})}return t},lm=new Map,um=[];function dm(){let e=xp(),t=xt(e=>e.isConnected),n=Bt({enabled:e}),r=mt(t=>e?t.statusById:lm),i=ct(t=>e?t.activeSessions:um),a=(0,Z.useMemo)(()=>e?Rt(n,r):new Set,[e,r,n]),o=(0,Z.useMemo)(()=>e?jp({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(`
17
- `),Object.entries(c).map(([e,t])=>`${e}\0${t}`).join(`
18
- `)].join(`
19
- ---
20
- `),[o,c]),f=(0,Z.useRef)(wp()),p=(0,Z.useRef)(em()),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=q(()=>({sessionId:vp,statusType:void 0,hasPendingPermissions:!1,hasPendingQuestions:!1,hasSessionError:!1,now:Date.now(),connected:t,catalog:o,sessionTitles:c,rootSessionIds:u})),b=q(n=>{_.current=_.current.then(async()=>{let r=om(p.current,{selectedSessionId:vp,runtimeIdentity:l(),connected:t,enabled:e},n);p.current=r.state,r.commands.length!==0&&(p.current=await cm({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:qp(e.startedAt)};return e.endedAt===void 0?t:{...t,endedAt:qp(e.endedAt)}})})??Promise.resolve(null),unregister:e=>x()?.push?.unregisterLiveActivityToken?.(e)??Promise.resolve(null)}))}).catch(()=>void 0)}),S=q(e=>{let t=nm(e);t&&b({type:`pushToken`,...t,sessionId:vp})});(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=Sp(),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 $p({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:vp,token:e.token,items:c.state.items.map(e=>{let t={sessionId:e.sessionId,title:e.title,status:e.status,startedAt:qp(e.startedAt)};return e.endedAt===void 0?t:{...t,endedAt:qp(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 fm(){let e=(0,Q.c)(49),t=ge(mm),{t:r,locale:i}=Te(),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(!lp())return;if(!t){cp.stop().catch(pm);return}let e=!1,r=t=>{e||(e=!0,Ke.error(t))},a=dp({plugin:cp,resolveConfig:()=>up({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 pm(){console.warn(`[Native notifications] stop failed`)}function mm(e){return e.nativeNotificationsEnabled}function hm(e){let t=(0,Q.c)(2),n;return t[0]===e?n=t[1]:(n=(0,$.jsx)(Ci,{children:(0,$.jsx)(gf,{...e})}),t[0]=e,t[1]=n),n}function gm(e){let t=(0,Q.c)(2),n;return t[0]===e?n=t[1]:(n=(0,$.jsx)(Ci,{children:(0,$.jsx)(Pi,{...e})}),t[0]=e,t[1]=n),n}function _m(e){let t=(0,Q.c)(2),n;return t[0]===e?n=t[1]:(n=(0,$.jsx)(Ci,{children:(0,$.jsx)(Yi,{...e})}),t[0]=e,t[1]=n),n}function vm(e){let t=(0,Q.c)(2),n;return t[0]===e?n=t[1]:(n=(0,$.jsx)(Ci,{children:(0,$.jsx)(Bl,{...e})}),t[0]=e,t[1]=n),n}function ym(e){let t=(0,Q.c)(2),n;return t[0]===e?n=t[1]:(n=(0,$.jsx)(Ci,{children:(0,$.jsx)(Ol,{...e})}),t[0]=e,t[1]=n),n}function bm(){let e=(0,Q.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(Ci,{children:(0,$.jsx)(Gs,{})}),e[0]=t):t=e[0],t}var xm=`mobile-direct-diff`,Sm=`mobile-turn-diff`,Cm=`mobile-direct-file`,wm=`mobile-files`,Tm=`mobile-changes`,Em=`mobile-mcp`,Dm=`mobile-settings`,Om=`mobile-update`,km=`mobile-overflow-menu`,Am=320,jm=380,Mm=280,Nm=560,Pm=380,Fm=e=>Math.min(Nm,Math.max(Mm,Math.round(e))),Im=(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 Lm(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(Nm,Math.max(Mm,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=q(m),g;r[5]===e?g=r[6]:(g=t=>{if(p.current!==t.pointerId)return;let n=t.clientX-u.current,r=Fm(d.current+(e===`left`?n:-n));f.current!==r&&(f.current=r,Im(i,r))},r[5]=e,r[6]=g);let _=q(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=Fm(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=q(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 Rm=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=Vt(`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=Vt(`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},zm=()=>typeof window>`u`?!1:window.Capacitor?.isNativePlatform?.()===!0||window.location.protocol===`capacitor:`,Bm=()=>{Z.useEffect(()=>{if(!zm())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 he(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([81,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 he(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&&Sl(e)&&e.blur()}});if(e){c.remove();return}t.push(()=>void c.remove())}).catch(()=>void 0),he(async()=>{let{Keyboard:e}=await import(`./vendor-capacitor-keyboard-BRVcFyc9.js`).then(e=>e.t);return{Keyboard:e}},__vite__mapDeps([82,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&&xl(n.classList.contains(`yuri-native-ios-composer`),e))&&(y(e)?Sl(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),gl.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=Sl(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(vl()),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`),gl.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()||xl(n.classList.contains(`yuri-native-ios-composer`),document.activeElement)||e.detail?.open!==!0||d||y(document.activeElement)&&!Sl(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()||xl(n.classList.contains(`yuri-native-ios-composer`),document.activeElement))return;h(),u=e.keyboardHeight,k(u);let t=Sl(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(),Sl(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(Cl(e.relatedTarget)){m(`--yuri-kb-scroll-inset`,0);return}window.setTimeout(()=>{if(p&&!Sl(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`)}},[])},Vm=e=>{let t=Z.useRef(!1);Z.useEffect(()=>{if(!zm())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)),he(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])},Hm=e=>{Z.useEffect(()=>{if(!zm())return;let t=!1,n=null;return he(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])},Um=e=>(e||``).replace(/\\/g,`/`).replace(/\/+$/g,``),Wm={autoComplete:`off`,autoCorrect:`off`,spellCheck:!1},Gm=1e3,Km=e=>{let t=Um(e);if(!t)return``;let n=t.split(`/`).filter(Boolean);return n[n.length-1]||t},qm=(e,t)=>Km(e?e.path:t),Jm=({connection:e,onActiveConnectionDeleted:t,onConnect:n})=>{let{t:r}=Te(),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(()=>Ns(),[]),[F,I]=Z.useState(null),[L,R]=Z.useState(null),ee=q(()=>{D(!1),T(``),n()});Z.useEffect(()=>h(ee),[ee,h]);let z=q(()=>{v(null),C(``),R(null),g(null),D(!1)}),B=q(()=>{o||M||(D(!1),g(null))}),V=q(()=>{o||M||z()}),te=q(e=>{e.preventDefault(),!(!_||!S.trim())&&p(_,S).then(e=>{e&&z()})}),ne=q(e=>{i.redeemPairingConnection(e)}),re=q(()=>{g(r(`mobile.connect.link.invalid`))}),H=q(async()=>{if(!M){g(null),R(null),N(!0);try{let e=await Ps();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)}}}),ie=q(e=>{e.preventDefault(),d(A)}),U=q(()=>{j(``),f()}),ae=q(e=>{x(t=>t===e?null:e)}),oe=q(e=>{x(null),_===e&&z();let n=a.length===1;m(e).then(e=>{e&&(n||Oe(e))&&t()})});if(l)return l.reason===`pairing`?(0,$.jsx)(`div`,{className:`yuri-settings-page-content`,children:(0,$.jsx)(eo,{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)(Y,{variant:`ghost`,size:`icon`,disabled:o||M,"aria-label":r(`mobile.instances.deleteAria`,{label:l.label}),onClick:()=>{x(l.id),U()},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)(Y,{size:`lg`,disabled:o||M,onClick:()=>void H(),children:[(0,$.jsx)(X,{name:`scan-2`,className:`size-5`}),r(`mobile.connect.scanQr`)]}):null,(0,$.jsx)(Y,{variant:P?`ghost`:`default`,size:`lg`,disabled:o||M,onClick:()=>{U(),D(!0)},children:r(`mobile.connect.link.useLink`)})]})})}):(0,$.jsx)(`div`,{className:`yuri-settings-page-content`,children:(0,$.jsx)(eo,{label:r(`mobile.connect.password.label`),itemId:`instances.manage`,children:(0,$.jsxs)(`form`,{className:`yuri-settings-group-row flex flex-col gap-3`,onSubmit:ie,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`)?Me(l):r(`mobile.connect.relay.badge`)})]})]}),(0,$.jsx)(`input`,{...Wm,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)(Y,{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)(Y,{type:`button`,variant:`ghost`,size:`sm`,className:`w-full`,onClick:U,children:r(`mobile.connect.cancelPassword`)})]})})});let se=(0,$.jsxs)(`form`,{className:`flex flex-col gap-3`,onSubmit:te,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)(Zn,{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)(Y,{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)(eo,{label:r(`mobile.connect.saved.title`),itemId:`instances.manage`,children:a.length>0?a.map(e=>{let t=b===e.id,n=Oe(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:Vt(`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:Vt(`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)(eo,{label:r(`mobile.instances.addTitle`),children:(0,$.jsxs)(`div`,{className:`yuri-settings-group-row flex flex-col gap-3`,children:[P?(0,$.jsxs)(Y,{type:`button`,size:`lg`,className:`w-full`,onClick:()=>void H(),disabled:o||M,children:[(0,$.jsx)(X,{name:`scan-2`,className:Vt(`size-[18px]`,M&&`animate-pulse`)}),r(`mobile.connect.scanQr`)]}):null,(0,$.jsx)(Y,{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)(Tr,{id:`mobile-instance-edit-${k}`,open:y!==null,onOpenChange:e=>{e||V()},fitContent:!0,ariaLabel:r(`mobile.instances.editTitle`),closeAriaLabel:r(`mobile.surface.closeAria`),resizeAriaLabel:r(`mobile.connect.options.resize`),children:(0,$.jsx)(qr,{className:`px-5 pb-5 pt-1`,disableHorizontal:!0,fillContainer:!1,children:se})}),(0,$.jsx)(Tr,{id:`mobile-instance-add-${O}`,open:E,onOpenChange:e=>{e||B()},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)(qr,{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)(Is,{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:ne,onInvalid:re})]})})})]})},Ym=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`},Xm=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},Zm=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}=Te(),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-Pm-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=Vt(`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(${Pm}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 ee;t[30]===d?ee=t[31]:(ee=d(`mobile.header.metadata.branch`),t[30]=d,t[31]=ee);let z;t[32]!==o||t[33]!==ee?(z=(0,$.jsx)(Xm,{icon:`git-branch`,label:ee,children:o}),t[32]=o,t[33]=ee,t[34]=z):z=t[34];let B;t[35]!==a||t[36]!==d?(B=a?(0,$.jsx)(Xm,{iconNode:(0,$.jsx)(Xs,{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:Vt(`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]=B):B=t[37];let V;t[38]!==l||t[39]!==u||t[40]!==c||t[41]!==s?(V=(0,$.jsx)(Qm,{groups:s,displayMode:c,isLoading:l,timeFormatPreference:u}),t[38]=l,t[39]=u,t[40]=c,t[41]=s,t[42]=V):V=t[42];let te;t[43]!==z||t[44]!==B||t[45]!==V?(te=(0,$.jsxs)(`div`,{className:`space-y-1`,children:[z,B,V]}),t[43]=z,t[44]=B,t[45]=V,t[46]=te):te=t[46];let ne;t[47]!==M||t[48]!==F||t[49]!==R||t[50]!==te?(ne=(0,$.jsx)(`div`,{ref:f,role:`dialog`,"aria-label":M,className:F,style:R,children:te}),t[47]=M,t[48]=F,t[49]=R,t[50]=te,t[51]=ne):ne=t[51];let re;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,$.jsx)(`style`,{children:`
21
- @keyframes session-metadata-in {
22
- from { opacity: 0; transform: translateY(-8px) scale(0.985); }
23
- to { opacity: 1; transform: translateY(0) scale(1); }
24
- }
25
- @keyframes session-metadata-out {
26
- from { opacity: 1; transform: translateY(0) scale(1); }
27
- to { opacity: 0; transform: translateY(-6px) scale(0.985); }
28
- }
29
- `}),t[52]=re):re=t[52];let H;return t[53]===ne?H=t[54]:(H=(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:[ne,re]}),t[53]=ne,t[54]=H),H},Qm=e=>{let t=(0,Q.c)(30),{groups:n,displayMode:r,isLoading:i,timeFormatPreference:a}=e,{t:o}=Te(),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)(Mr,{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=Zi(e.rows.map(ah),n),o=r===`remaining`?t.window.remainingPercent:t.window.usedPercent,s=or(t.window.valueLabel,o),c=tr(t.window.resetAt,t.window.resetAfterFormatted??t.window.resetAtFormatted,a);return(0,$.jsxs)(Z.Fragment,{children:[i?(0,$.jsx)(`div`,{className:Vt(`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:Vt(`min-w-0 max-w-[60%] shrink-0 truncate typography-ui-label font-semibold tabular-nums`,Ym(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},$m=e=>{let t=(0,Q.c)(35),{open:n,onClose:r,items:i,rightOffset:a}=e,o=a===void 0?0:a,{t:s}=Te(),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:Vt(`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:Vt(`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)(Uo,{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:km,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:oh,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},eh=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}=Te(),{git:d}=ce(),f=sf(i??``,a||void 0),p=f??l,m=Z.useRef(null),h=Ft(i??``,a||void 0),g=Ar(o),_=Or(o),v=Dr(sh),y=Dr(ch),b=xt(lh),x=xt(uh),S=xt(dh),C=xt(fh),w;t[0]===i?w=t[1]:(w=e=>i?e.sessionModelSelections.get(i)??null:null,t[0]=i,t[1]=w);let T=lt(w),E=oi(ph),D=oi(mh),O=oi(hh),k=oi(gh),A=oi(_h),j=oi(vh),M=ge(yh);mi();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 F,I;t[7]!==y||t[8]!==d||t[9]!==o?(F=()=>{if(o)return Nt.onGitRefreshHint(e=>{Um(e.directory)===o&&y(o,d)})},I=[y,d,o],t[7]=y,t[8]=d,t[9]=o,t[10]=F,t[11]=I):(F=t[10],I=t[11]),Z.useEffect(F,I);let L,R;t[12]===D?(L=t[13],R=t[14]):(L=()=>{D()},R=[D],t[12]=D,t[13]=L,t[14]=R),Z.useEffect(L,R);let ee,z;t[15]===A?(ee=t[16],z=t[17]):(ee=()=>{Nr(A)},z=[A],t[15]=A,t[16]=ee,t[17]=z),Z.useEffect(ee,z);let B,V;t[18]===n?(B=t[19],V=t[20]):(B=()=>{!n||oi.getState().isLoading||oi.getState().fetchAllQuotas()},V=[n],t[18]=n,t[19]=B,t[20]=V),Z.useEffect(B,V);let te;t[21]===h?te=t[22]:(te=oc(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 H=re,ie;if(t[28]!==C||t[29]!==H||t[30]!==b){let e=(H?b.find(e=>e.id===H.providerID):void 0)?.models.find(e=>e.id===H?.modelID),n;t[32]!==C||t[33]!==H?(n=H?C(H.providerID,H.modelID):void 0,t[32]=C,t[33]=H,t[34]=n):n=t[34];let r=n;ie=nc(e?.limit,`context`)??r?.limit?.context??0,t[28]=C,t[29]=H,t[30]=b,t[31]=ie}else ie=t[31];let U=ie,ae=Pt(i??``,U,0,a||void 0),oe=ae?.pending?null:ae?.totalTokens??0,se;t[35]!==U||t[36]!==s||t[37]!==oe?(se=ac({totalTokens:oe,contextLimit:U,isDraft:s}),t[35]=U,t[36]=s,t[37]=oe,t[38]=se):se=t[38];let le=se,W;t[39]!==_?.current||t[40]!==g||t[41]!==u?(W=g===!0?_?.current?.trim()||u(`gitView.branch.detachedHead`):u(`common.unavailable`),t[39]=_?.current,t[40]=g,t[41]=u,t[42]=W):W=t[42];let ue=W,G;if(t[43]!==A||t[44]!==E||t[45]!==j||t[46]!==u){let e=new Map(E.map(bh)),n;t[48]===A?n=t[49]:(n=e=>A.includes(e.id),t[48]=A,t[49]=n),G=fi(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 ea(Object.entries(n?.usage?.windows??{}),n?.usage?.accounts))r.push({key:`window-${e}`,label:er(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:er(a.label??i),subtitle:ci(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 de=G,K,fe;t[50]!==n||t[51]!==de?(K=()=>{!n||de.length===0||Nr(de.map(xh))},fe=[n,de],t[50]=n,t[51]=de,t[52]=K,t[53]=fe):(K=t[52],fe=t[53]),Z.useEffect(K,fe);let pe;t[54]===c?pe=t[55]:(pe=(0,$.jsx)(`span`,{className:`block truncate typography-ui-label text-foreground`,children:c}),t[54]=c,t[55]=pe);let q;t[56]!==p||t[57]!==f?(q=p?(0,$.jsx)(`span`,{className:Vt(`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]=q):q=t[58];let me;t[59]!==pe||t[60]!==q?(me=(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:[pe,q]})}),t[59]=pe,t[60]=q,t[61]=me):me=t[61];let J;t[62]===u?J=t[63]:(J=u(`mobile.header.openMetadataAria`),t[62]=u,t[63]=J);let he;t[64]===r?he=t[65]:(he=()=>r(Sh),t[64]=r,t[65]=he);let _e;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(_e={touchAction:`manipulation`},t[66]=_e):_e=t[66];let ve=le?.percentage??0,ye=le?.pending,be;t[67]!==ve||t[68]!==ye?(be=(0,$.jsx)(Xs,{percentage:ve,pending:ye}),t[67]=ve,t[68]=ye,t[69]=be):be=t[69];let xe;t[70]!==n||t[71]!==J||t[72]!==he||t[73]!==be?(xe=(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":J,"aria-expanded":n,onClick:he,style:_e,children:be}),t[70]=n,t[71]=J,t[72]=he,t[73]=be,t[74]=xe):xe=t[74];let Se;t[75]===r?Se=t[76]:(Se=()=>r(!1),t[75]=r,t[76]=Se);let Ce;t[77]!==ue||t[78]!==le||t[79]!==O||t[80]!==n||t[81]!==k||t[82]!==Se||t[83]!==M||t[84]!==de?(Ce=(0,$.jsx)(Zm,{open:n,onClose:Se,anchorRef:m,contextDisplay:le,branchLabel:ue,usageGroups:de,usageDisplayMode:k,isUsageLoading:O,timeFormatPreference:M}),t[77]=ue,t[78]=le,t[79]=O,t[80]=n,t[81]=k,t[82]=Se,t[83]=M,t[84]=de,t[85]=Ce):Ce=t[85];let we;return t[86]!==me||t[87]!==xe||t[88]!==Ce?(we=(0,$.jsxs)($.Fragment,{children:[me,xe,Ce]}),t[86]=me,t[87]=xe,t[88]=Ce,t[89]=we):we=t[89],we}),th=({onOpenSessions:e,menuOpen:t,onToggleMenu:n,surfaceShortcuts:r})=>{let{t:i}=Te(),[a,o]=Z.useState(!1),s=O(e=>e.currentDirectory),c=Tt(e=>e.currentSessionId),l=Z.useMemo(()=>e=>c?e.getDirectoryForSession(c):null,[c]),u=Tt(l)||s,d=Um(u)||null,f=Dt(e=>e.projects),p=Tt(e=>e.availableWorktreesByProject),m=Z.useMemo(()=>e=>c?e.worktreeMetadata.get(c)??null:null,[c]),h=Tt(m),g=Je(c),_=Tt(e=>!!e.newSessionDraft?.open),v=Z.useMemo(()=>{let e=Um(u);return e&&qm((h?.projectDirectory?Ye(f,h.projectDirectory):null)??Ze(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=q(()=>{o(!1),e()}),S=q(()=>{o(!1),n()});return(0,$.jsx)($.Fragment,{children:(0,$.jsxs)(Ys,{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)(eh,{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:Vt(`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:Vt(`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":km,"aria-expanded":t,"aria-haspopup":`menu`,onClick:S,style:{touchAction:`manipulation`},children:(0,$.jsx)(X,{name:`more-2`,className:`size-5`})})]})})},nh=e=>{let t=(0,Q.c)(5),n=Js();if(!n.enabled){let n;return t[0]===e?n=t[1]:(n=(0,$.jsx)(th,{...e}),t[0]=e,t[1]=n),n}let r;return t[2]!==e||t[3]!==n?(r=(0,$.jsx)(Jc,{...e,scope:n}),t[2]=e,t[3]=n,t[4]=r):r=t[4],r},rh=({connection:e,onActiveConnectionDeleted:t})=>{let{t:n}=Te(),r=Sn();Ue(),vt();let i=ge(e=>e.mobileSessionPanelOpen),a=ge(e=>e.setMobileSessionPanelOpen),o=ge(e=>e.isScheduledTasksDialogOpen),s=ge(e=>e.activeMainTab),c=Re(),l=ge(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),[D,k]=Z.useState(0),[A,j]=Z.useState(!1),[M,N]=Z.useState(!1),[P,F]=Z.useState(!1),[I,L]=Z.useState(!1),[R,ee]=Z.useState(!1),[z,B]=Z.useState(!1),[V,te]=Z.useState(`nav`),[ne,H]=Z.useState(!1),[ie,U]=Z.useState(!1),ae=q(()=>{H(!1),U(!0)}),oe=q(()=>{if(H(!1),K.enabled){Ce.info(n(`remoteProjects.nativeCapabilityUnavailable`,{capability:n(`remoteDesktop.title`)}));return}ae()}),se=q(()=>U(!1)),[ce,le]=Z.useState(!1),W=q(()=>H(e=>!e)),ue=q(()=>H(!1)),[G,de]=Z.useState(null),K=Js(),fe=A&&!K.enabled,pe=O(e=>e.currentDirectory),me=ge(e=>e.setSettingsPage),J=ui(e=>e.available),he=ui(e=>e.runtimeType),_e=Z.useMemo(()=>zm(),[]),ve=Z.useMemo(()=>Ns(),[]),ye=pe??null,{data:be=[],refetch:xe}=re({...$a(ye),enabled:fe}),{refetch:Se}=re({...Qa(ye),enabled:fe}),we=no(e=>e.setMcpDraft),Ee=no(e=>e.setSelectedMcp),De=Or(K.enabled?K.entry?.key??null:Um(pe)||null)?.files?.length??0;Z.useEffect(()=>Nt.onDirectoryRequest(()=>ee(!0)),[]);let ke=Z.useMemo(()=>_(),[]),Ae=kt(e=>e.secondary?.kind??null),je=Tt(e=>K.enabled?null:e.currentSessionId),Me=K.enabled?K.sessionId:je,Ne=Tt(e=>e.setCurrentSession),Pe=Z.useMemo(()=>e=>!K.enabled&&Me?e.getDirectoryForSession(Me):null,[Me,K.enabled]),Fe=Tt(Pe),Ie=K.enabled?K.entry?.location.directory:Fe,Le=pr()===`portrait`,[Be,Ve]=Z.useState(ke&&!Le),[He,We]=Z.useState(null),Ge=q(e=>{if(e&&me(e),ke){te(e?`page-content`:`nav`),F(!0);return}let t=kt.getState();if(e){t.openSettingsFromCurrent();return}me(`home`),t.setActiveTab(`settings`)}),Ke=q(()=>{Ge(`instances`)}),qe=q(()=>{kt.getState().openInstances()}),Je=q(async t=>{if(!t){qe();return}let n=e.connections.find(e=>e.id===t);!n||e.isBusy||Oe(n)||(await e.connect({id:n.id,candidates:n.candidates,clientToken:n.clientToken,label:n.label}),Oe(n)||qe())}),Ye=q(()=>{kt.getState().closeSecondary()}),Ze=q(async()=>{if(!z){B(!0);try{let t=await Ps();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`:Ce.error(n(`mobile.connect.scan.permissionDenied`));break;case`invalid`:Ce.error(n(`mobile.connect.scan.invalid`));break;case`unsupported`:Ce.error(n(`mobile.connect.scan.unsupported`));break;case`failed`:Ce.error(n(`mobile.connect.scan.failed`))}}finally{B(!1)}}});Br({enabled:!ke,rootRoutesBlocked:i||u||f||g||y||o||fe||P||I||R||ne});let Qe=q(()=>{let e=!Be;e&&Le&&We(null),Ve(e)}),$e=q(()=>{if(b(!1),S(null),w(null),p(!1),h(null),ke){de(null),We(`files`),Le&&Ve(!1);return}d(!0)}),et=q(()=>{p(!1),h(null)}),tt=q(e=>{let t=e.path.trim();if(t){if(b(!1),S(null),w(null),de(null),v(!1),ke){ge.getState().setPendingFileFocusPath(t),We(`files`),Le&&Ve(!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)}}),nt=ge(e=>e.pendingFileFocusPath);Z.useEffect(()=>{if(nt){if(ke){$e();return}tt({path:nt}),ge.getState().setPendingFileFocusPath(null)}},[nt,ke,$e,tt]);let rt=q((e=null)=>{if(b(!1),S(null),w(null),E(null),p(!1),h(null),de(e),ke){We(`changes`),Le&&Ve(!1);return}v(!0)}),it=q((e,t,n)=>{de(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),ke){We(`turn-diff`),Le&&Ve(!1);return}b(!0)}),at=q(()=>{We(null),de(null),E(null)}),ot=q(e=>{if(He===e){at();return}e===`files`?$e():rt()}),st=Z.useRef(`changes`);He&&(st.current=He);let[ct,lt]=Z.useState(!1);Z.useEffect(()=>{if(!ke)return;if(He){lt(!0);return}let e=window.setTimeout(()=>lt(!1),240);return()=>window.clearTimeout(e)},[He,ke]);let ut=He??st.current,dt=Lm(`left`,`yuri.ipad.leftSidebarWidth`,Am),ft=Lm(`right`,`yuri.ipad.rightSidebarWidth`,jm),pt=Z.useMemo(()=>({openChanges:({diffPath:e,staged:t,targetLine:n}={})=>{rt(e?{path:e,staged:t===!0,targetLine:n}:null)},openToolDiff:({diffPath:e,patches:t,targetLine:n})=>{rt({path:e,staged:!1,targetLine:n,toolPatches:t})},openTurnDiff:it,openFile:({path:e,targetLine:t})=>{tt({path:e,targetLine:t})},openFiles:()=>$e(),openSettings:e=>{Ge(e)}}),[rt,tt,$e,Ge,it]),mt=q(()=>{v(!1),de(null)}),ht=q(()=>{b(!1),E(null)});zf(Z.useMemo(()=>({openSessions:()=>{if(ke){Ve(!0);return}kt.getState().setActiveTab(`projects`)},openView:e=>{e===`files`?$e():e===`mcp`?j(!0):e===`instances`?Ke():e===`update`&&L(!0)},openChanges:({path:e,staged:t}={})=>{rt(e?{path:e,staged:t===!0}:null)},openSettings:e=>{Ge(e)}}),[ke,rt,$e,Ke,Ge]));let gt=Z.useRef(null),_t=Z.useRef(null),yt=Xe(K.enabled?null:Me,K.enabled?void 0:Ie||pe||void 0),bt=K.session?.parentID,xt=K.enabled?bt?{id:bt,directory:Ie}:null:yt,St=q(()=>{xt&&(K.enabled?K.openSession(xt.id):Ne(xt.id,xt.directory))});dm();let Ct=Z.useRef(0);Z.useEffect(()=>(Ct.current+=1,le(!1),()=>{Ct.current+=1}),[Me,K.key,K.entry]);let wt=q(()=>{let e=Me;if(!e||ce)return;let t=Ie||pe||void 0,i=++Ct.current;le(!0),(async()=>{try{K.enabled?await K.refresh():await r.refreshSessionTranscript(e,{directory:t}),i===Ct.current&&Ce.success(n(`sessions.sidebar.session.menu.refreshTranscriptSuccess`))}catch{i===Ct.current&&Ce.error(n(`sessions.sidebar.session.menu.refreshTranscriptFailed`))}finally{i===Ct.current&&le(!1)}})()}),Et=!ke&&(Ae===`chat`||Ae===`draft`);Z.useEffect(()=>{!ke&&!Et&&H(!1)},[ke,Et]),Z.useEffect(()=>{H(!1)},[Me,K.key]);let Dt=ke&&s===`assistant`||!ke&&!Et||i||u||f||g||y||o||fe||P||I||R||ne||ie;sp(_t,{onOpen:q(()=>{Sr(Er)?.finish(`commit`)}),onPreviewStart:q(()=>{Sr(Er)?.begin(`present`)}),onPreviewCancel:q(()=>{Sr(Er)?.finish(`cancel`)}),onProgress:q(e=>{e!==null&&Sr(Er)?.update(e)}),disabled:Dt},ke||Et);let Ot=q(e=>{gt.current=e});Hm(q(()=>ie?(se(),!0):ne?(H(!1),!0):R?(ee(!1),!0):o?(window.dispatchEvent(new Event(`yuri:scheduled-tasks-close-request`)),!0):i?(a(!1),!0):Hr.backImmediately(`overlay`)?!0:f?(et(),!0):u?(d(!1),!0):y?(ht(),!0):g?(mt(),!0):fe?(j(!1),!0):P?(F(!1),!0):I?(L(!1),!0):Hr.requestAnimatedBack(`root`)||gt.current?.()?!0:s===`assistant`?(l(`chat`),!0):xt?(St(),!0):!1));let At=J&&(he===`desktop`||he===`web`),jt=q(()=>{if(K.enabled){Ce.info(n(`remoteProjects.configurationReadOnly`));return}let e=`new-mcp-server`,t=e,r=1;for(;be.some(e=>e.name===t);)t=`${e}-${r}`,r+=1;we({name:t,scope:`user`,type:`local`,command:[],url:``,environment:[],headers:[],oauthEnabled:!0,oauthClientId:``,oauthClientSecret:``,oauthScope:``,oauthRedirectUri:``,timeout:``,enabled:!0}),Ee(t),j(!1),Ge(`mcp`)}),Mt=q(()=>{if(M)return;if(K.enabled&&!K.entry){Ce.error(n(`remoteProjects.host-unavailable`));return}N(!0);let e=new Promise(e=>window.setTimeout(e,500));Promise.all([Se(),xe(),e]).finally(()=>N(!1))}),Pt=Tt(e=>e.openNewSessionDraft),Ft=Z.useMemo(()=>{let e=[{key:`new-session`,icon:`chat-new`,label:n(`mobile.menu.newSession`),onSelect:()=>{if(K.enabled){if(!K.entry){Ce.error(n(`remoteProjects.host-unavailable`));return}K.openSession(null),ke?l(`chat`):kt.getState().openRemoteProject();return}if(ke){l(`chat`),Pt();return}kt.getState().openDraft()}}];return ke||e.push({key:`files`,icon:`file-text`,label:n(`mobile.menu.files`),onSelect:()=>$e()},{key:`changes`,icon:`git-branch`,label:n(`mobile.menu.changes`),badge:De,onSelect:()=>rt()}),K.enabled||e.push({key:`mcp`,iconNode:(0,$.jsx)(li,{className:`size-5 shrink-0 text-muted-foreground`}),label:n(`mobile.menu.mcp`),onSelect:()=>j(!0)}),At&&e.push({key:`update`,icon:`download`,label:n(`mobile.menu.update`),onSelect:()=>L(!0)}),ke&&e.push({key:`settings`,icon:`settings-3`,label:n(`mobile.menu.settings`),onSelect:()=>Ge()}),Me&&e.push({key:`refresh-transcript`,icon:`refresh`,label:n(`sessions.sidebar.session.menu.refreshTranscript`),disabled:ce,spinning:ce,onSelect:wt}),e.push({key:`remote-desktop`,icon:`computer`,label:n(`remoteDesktop.title`),onSelect:oe}),e},[Me,De,ke,ce,rt,$e,Pt,oe,Ge,wt,K,l,At,n]);return(0,$.jsx)(zo,{remote:K.enabled,remoteState:K.owner?.state,sessionId:Me??``,directory:Ie||pe||void 0,active:ke?s!==`assistant`:Ae===`chat`||K.enabled&&Ae===`draft`,children:(0,$.jsx)(ni,{actions:pt,children:(0,$.jsxs)(Rs,{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:[ke?(0,$.jsxs)(`aside`,{ref:dt.asideRef,className:Vt(`relative flex h-full shrink-0 flex-col overflow-hidden border-r border-border/50 bg-sidebar will-change-[width] motion-reduce:transition-none`,!Be&&`border-r-0`),style:{width:Be?dt.width:0,minWidth:Be?dt.width:0,maxWidth:Be?dt.width:0,"--yuri-ipad-sidebar-width":`${dt.width}px`,overflowX:`clip`,paddingTop:`var(--yuri-safe-area-top, 0px)`,transitionProperty:dt.isResizing?`none`:`width, min-width, max-width`,transitionDuration:`200ms`,transitionTimingFunction:`cubic-bezier(0.22, 1, 0.36, 1)`},"aria-hidden":!Be,"data-page-scroll-lock":`true`,children:[Be?(0,$.jsx)(Rm,{side:`left`,isResizing:dt.isResizing,ariaLabel:n(`sidebar.resize.leftPanelAria`),handleProps:dt.handleProps}):null,(0,$.jsx)(`div`,{className:Vt(`flex h-full shrink-0 flex-col transition-opacity duration-200 ease-[cubic-bezier(0.22,1,0.36,1)] motion-reduce:transition-none`,dt.isResizing&&`pointer-events-none`,!Be&&`pointer-events-none select-none opacity-0`),style:{width:`var(--yuri-ipad-sidebar-width)`,overflowX:`hidden`},children:(0,$.jsx)(fr,{children:(0,$.jsx)(yu,{open:!0,variant:`sidebar`,onOpenChange:e=>{!e&&Le&&Ve(!1)}})})})]}):null,(0,$.jsx)(`div`,{className:`flex h-full min-w-0 flex-1 flex-col`,"data-page-scroll-lock":`true`,inert:ie||void 0,"aria-hidden":ie||void 0,children:ke?(0,$.jsxs)($.Fragment,{children:[s===`assistant`?null:(0,$.jsx)(`div`,{children:(0,$.jsx)(nh,{onOpenSessions:()=>Qe(),menuOpen:ne,onToggleMenu:W,surfaceShortcuts:{activePanel:He===`turn-diff`?`changes`:He,changesDirty:De>0,onToggleFiles:()=>ot(`files`),onToggleChanges:()=>ot(`changes`)}})}),(0,$.jsx)(`main`,{ref:_t,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)(fr,{children:s===`assistant`?(0,$.jsx)(bo,{}):(0,$.jsx)(gm,{})})})})]}):(0,$.jsx)(ud,{className:`min-h-0 flex-1`,onAddProject:()=>ee(!0),onScanQr:_e&&ve?()=>{Ze()}:void 0,onSwitchInstance:_e?Je:void 0,onRemoteDesktop:ae,remoteDesktopActive:ie,instanceOptions:_e?e.connections.map(t=>({id:t.id,label:t.label,active:Oe(t),disabled:e.isBusy})):void 0,onEnableAssistants:()=>{Ge(`assistants`)},instancesPage:_e?(0,$.jsx)(Jm,{connection:e,onConnect:()=>void 0,onActiveConnectionDeleted:t}):void 0,instancesSecondaryPage:_e?(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)(ze,{title:n(`mobile.settings.switchInstance`),backAriaLabel:n(`header.actions.backAria`),onBack:Ye}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-[var(--yuri-mobile-page-inline-inset)]`,children:(0,$.jsx)(hi,{className:`yuri-mobile-settings-detail-card`,children:(0,$.jsx)(Jm,{connection:e,onConnect:()=>void 0,onActiveConnectionDeleted:t})})})]}):void 0,parentSessionTarget:xt?{id:xt.id,directory:xt.directory??null,...K.enabled?{onSelect:St}:{}}:null,registerSecondaryBackHandler:Ot,scheduledContent:(e,t)=>(0,$.jsx)(fa,{presentation:`mobile-tab`,registerEditorBackHandler:e,onEditorActiveChange:t}),renderChat:e=>(0,$.jsx)(hm,{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:()=>{ue(),Hr.requestAnimatedBack(`root`)},onOpenMenu:W,onCloseMenu:ue,menuOpen:e.active&&ne,children:(0,$.jsx)(`main`,{ref:e.active?_t: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)(fr,{children:(0,$.jsx)(gm,{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}})})})})})})}),ke?(0,$.jsxs)(`aside`,{ref:ft.asideRef,className:Vt(`relative flex h-full shrink-0 flex-col overflow-hidden border-l border-border/50 bg-background will-change-[width] motion-reduce:transition-none`,!He&&`border-l-0`),style:{width:He?ft.width:0,minWidth:He?ft.width:0,maxWidth:He?ft.width:0,"--yuri-ipad-sidebar-width":`${ft.width}px`,overflowX:`clip`,paddingTop:`var(--yuri-safe-area-top, 0px)`,transitionProperty:ft.isResizing?`none`:`width, min-width, max-width`,transitionDuration:`200ms`,transitionTimingFunction:`cubic-bezier(0.22, 1, 0.36, 1)`},"aria-hidden":!He,"data-page-scroll-lock":`true`,children:[He?(0,$.jsx)(Rm,{side:`right`,isResizing:ft.isResizing,ariaLabel:n(`sidebar.resize.rightPanelAria`),handleProps:ft.handleProps}):null,(0,$.jsx)(`div`,{className:Vt(`flex h-full shrink-0 flex-col transition-opacity duration-200 ease-[cubic-bezier(0.22,1,0.36,1)] motion-reduce:transition-none`,ft.isResizing&&`pointer-events-none`,!He&&`pointer-events-none select-none opacity-0`),style:{width:`var(--yuri-ipad-sidebar-width)`,overflowX:`hidden`},children:ct?(0,$.jsx)(fr,{children:ut===`files`?(0,$.jsx)(vm,{onClose:at}):ut===`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)(Y,{type:`button`,variant:`ghost`,size:`icon`,onClick:at,"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)(_m,{hideStackedFileSidebar:!0,pinSelectedFileHeaderToTopOnNavigate:!0,diffScope:`turn`,turnMessageId:x,sessionId:C,targetFilePath:T,navigationRequestKey:D,flushContent:!0})})]}):G?.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:G.toolPatches.length>1?n(`mobile.nav.changes`):G.path}),(0,$.jsx)(Y,{type:`button`,variant:`ghost`,size:`icon`,onClick:at,"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)(_m,{hideStackedFileSidebar:!0,diffScope:`turn`,targetFilePath:G.path,targetLine:G.targetLine??null,toolPatches:G.toolPatches,singleFileView:G.toolPatches.length===1,flushContent:!0})})]}):(0,$.jsx)(ym,{onClose:at,initialDiffPath:G?.path??null,initialDiffStaged:G?.staged===!0,initialDiffTargetLine:G?.targetLine??null})}):null})]}):null,(0,$.jsx)(_a,{open:R,onOpenChange:ee,forceMobile:!0}),(0,$.jsx)($m,{open:ne,onClose:()=>H(!1),items:Ft,rightOffset:ke&&He?ft.width:0}),(0,$.jsx)(Wa,{}),ie&&(0,$.jsx)($d,{onClose:se,instanceName:e.connections.find(Oe)?.label}),u?(0,$.jsx)(Tr,{id:wm,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)(fr,{children:(0,$.jsx)(vm,{onClose:()=>d(!1)})})}):null,f&&m?(0,$.jsx)(Tr,{id:Cm,open:f,onOpenChange:e=>{e||et()},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)(fr,{children:(0,$.jsx)(vm,{onClose:et,initialFilePath:m.path,directFilePreview:!0,hideFileHeader:!0},m.path)})}):null,(0,$.jsx)(Tr,{id:Sm,open:y,onOpenChange:e=>{e||ht()},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)(fr,{children:(0,$.jsx)(_m,{hideStackedFileSidebar:!0,pinSelectedFileHeaderToTopOnNavigate:!0,toolbarInSheetHeader:!0,diffScope:`turn`,turnMessageId:x,sessionId:C,targetFilePath:T,navigationRequestKey:D,flushContent:!0})})}),g&&G?(0,$.jsx)(Tr,{id:xm,open:g,onOpenChange:e=>{e||mt()},title:(0,$.jsx)(`h2`,{className:`truncate typography-ui-label font-semibold text-foreground`,children:G.toolPatches&&G.toolPatches.length>1?n(`mobile.nav.changes`):G.path}),ariaLabel:n(`mobile.menu.changes`),closeAriaLabel:n(`mobile.surface.closeAria`),resizeAriaLabel:n(`mobile.changes.sheet.resizeAria`),initiallyExpanded:!0,children:(0,$.jsx)(fr,{children:G.toolPatches?.length?(0,$.jsx)(_m,{hideStackedFileSidebar:!0,toolbarInSheetHeader:!0,diffScope:`turn`,targetFilePath:G.path,targetLine:G.targetLine??null,toolPatches:G.toolPatches,singleFileView:G.toolPatches.length===1,flushContent:!0}):(0,$.jsx)(ym,{initialDiffPath:G.path,initialDiffStaged:G.staged,initialDiffTargetLine:G.targetLine??null,hideDiffHeader:!0})})}):g?(0,$.jsx)(Tr,{id:Tm,open:g,onOpenChange:e=>{e||mt()},ariaLabel:n(`mobile.menu.changes`),closeAriaLabel:n(`mobile.surface.closeAria`),resizeAriaLabel:n(`mobile.changes.sheet.resizeAria`),initiallyExpanded:!0,children:(0,$.jsx)(fr,{children:(0,$.jsx)(ym,{onClose:mt,initialDiffPath:G?.path??null,initialDiffStaged:G?.staged===!0,initialDiffTargetLine:G?.targetLine??null})})}):null,fe?(0,$.jsx)(Tr,{id:Em,open:fe,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)(Y,{type:`button`,variant:`ghost`,size:`icon`,onClick:jt,"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)(Y,{type:`button`,variant:`ghost`,size:`icon`,onClick:Mt,disabled:M,"aria-label":n(`mcpDropdown.actions.refreshAria`),title:n(`mcpDropdown.actions.refreshAria`),style:{touchAction:`manipulation`},children:(0,$.jsx)(X,{name:`refresh`,className:Vt(`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)(fr,{children:(0,$.jsx)(za,{active:!0,className:`h-full`,listClassName:`max-h-none`,hideHeader:!0,mobileListDensity:!0})})}):null,P&&ke?(0,$.jsx)(Tr,{id:Dm,open:P,onOpenChange:e=>{e||F(!1)},ariaLabel:n(`mobile.menu.settings`),closeAriaLabel:n(`mobile.surface.closeAria`),resizeAriaLabel:n(`mobile.sessions.sheet.resizeAria`),initiallyExpanded:!0,children:(0,$.jsx)(fr,{children:(0,$.jsx)(ao,{forceMobile:!0,isWindowed:!0,initialMobileStage:V,visiblePageSlugs:[..._r],onClose:()=>F(!1),mobileInstancesPage:_e?(0,$.jsx)(Jm,{connection:e,onConnect:()=>F(!1),onActiveConnectionDeleted:t}):void 0})})}):null,I?(0,$.jsx)(Tr,{id:Om,open:I,onOpenChange:e=>{e||L(!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)(fr,{children:(0,$.jsx)(`div`,{className:`h-full overflow-auto px-5 py-4`,children:(0,$.jsx)(ro,{initialUpdateDialogOpen:!0})})})}):null]}),(0,$.jsx)(el,{enabled:_e&&s===`assistant`&&c.data?.supported===!0&&c.data?.enabled===!0}),(0,$.jsx)(fr,{children:(0,$.jsx)(Ga,{})}),(0,$.jsx)(Ca,{})]})})})};function ih({apis:e}){Z.useEffect(()=>gt(),[]);let{t}=Te(),n=xt(e=>e.initializeApp),r=xt(e=>e.isInitialized),i=xt(e=>e.isConnected),a=xt(e=>e.connectionPhase),o=O(e=>e.currentDirectory),c=Tt(e=>e.currentSessionId),l=Tt(e=>!!e.newSessionDraft?.open),d=Tt(e=>e.error),f=Tt(e=>e.clearError),m=ge(e=>e.setIsMobile),h=di(e=>e.refreshStatus),g=Dt(e=>e.projects),[_,v]=Z.useState(0),[y,x]=Z.useState(0),[S,C]=Z.useState(!1),[w,T]=Z.useState(`pending`),E=Z.useMemo(()=>ke(),[]),[,D]=Z.useReducer(e=>e+1,0),k=Z.useMemo(()=>zm(),[]),A=Z.useRef(0),j=Z.useRef(0),M=Fe(()=>{T(`done`),v(e=>e+1)});Bf(q(e=>{M.redeemPairingConnection(e)}));let N=Vf({ready:k&&i&&r});Z.useEffect(()=>{!M.error||!p()||Ce.error(M.error)},[M.error]);let P=q(()=>{let t=p(),r=j.current+1;if(j.current=r,!t){Pe();return}let i=()=>{n(),h(e.github,{force:!0}),xt.getState().refreshMissingCatalogs({source:`mobileApp:nativeResume`})},a=()=>{u({apiBaseUrl:``,clientToken:null,runtimeKey:`mobile-disconnected`}),v(e=>e+1)};Ae().then(e=>{if(j.current===r){if(e===`no-connection`){a();return}if(e===`unreachable`){window.setTimeout(()=>{j.current===r&&Ae().then(e=>{if(j.current===r&&e!==`switched`&&e===`unchanged`){i();return}})},4e3);return}e!==`switched`&&i()}});let o=Date.now();o-A.current>=Gm&&(A.current=o,window.dispatchEvent(new Event(`yuri:system-resume`)))});Bm(),Vm(P),Z.useEffect(()=>{if(!k)return;let e,t=()=>{window.clearTimeout(e),e=window.setTimeout(()=>P(),1500)};return window.addEventListener(`online`,t),()=>{window.removeEventListener(`online`,t),window.clearTimeout(e)}},[k,P]),Z.useEffect(()=>(b(e),()=>b(null)),[e]),Z.useEffect(()=>{k&&xe().then(e=>{e&&e.notifyAppReady().catch(()=>void 0)})},[k]),Z.useEffect(()=>{if(!k)return;let e=!1,t=[];return xe().then(async n=>{if(!(!n||e))try{let r=await n.addListener(`download`,e=>{ui.getState().setOtaDownloadPercent(e.percent)}),i=await n.addListener(`downloadFailed`,()=>{ui.getState().setOtaDownloadFailed()}),a=await n.addListener(`downloadComplete`,()=>{ui.getState().setOtaPhase(`pending_restart`)}),o=await n.addListener(`appReloaded`,()=>{ui.getState().setOtaPhase(`pending_restart`)}),s=await n.addListener(`autoRevert`,()=>{console.warn(`[OTA] Capgo auto-reverted the last bundle`),ui.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()}},[k]),Z.useEffect(()=>s(e=>{if(e.runtimeKey&&e.runtimeKey===e.previousRuntimeKey){Va(),D();return}Aa(e),kt.getState().reset(),x(e=>e+1),v(e=>e+1)}),[]),Z.useEffect(()=>{if(N===`pending`)return;if(N===`connect`){T(`done`);return}if(!k||i||p()){T(`done`);return}let e=!1;return T(`attempting`),Kt().then(e=>e?!0:Pe()).catch(()=>!1).then(()=>{e||T(`done`)}),()=>{e=!0}},[N]),Z.useEffect(()=>{m(!0)},[m]),Z.useEffect(()=>{k&&!p()||n()},[_,n,k]),Dn({enabled:!k||!!p(),source:`mobileApp:recovery`}),Z.useEffect(()=>{i&&I.setDirectory(o)},[o,i]),Z.useEffect(()=>{i&&h(e.github,{force:!0})},[e.github,i,h]),Z.useEffect(()=>{if(!i||g.length===0)return;let e=!1;return(async()=>{await Promise.all(g.map(async t=>{if(t.hostId)return;let n=Um(t.path);if(n)try{if(!(Dr.getState().directories.get(n)?.isGitRepo??await he(()=>import(`./gitApi-Cxw-b-S_.js`).then(e=>e.f).then(e=>e.checkIsGitRepository(n)),__vite__mapDeps([83,1,5,4,6,7,9,44,8,10,23,11,24,21,25,45,46,47,48,15,12,14,13,16,17,18,19,2,20,22,26,49,43,50,38,39,40,41,42,51,52,53,54,55,56,57,58])))||e)return;await $r({id:t.id,path:n},{isCurrent:()=>!e})}catch{}}))})(),()=>{e=!0}},[i,g]),Z.useEffect(()=>{if(!d)return;let e=window.setTimeout(()=>f(),5e3);return()=>window.clearTimeout(e)},[f,d]),Z.useEffect(()=>{if(!(!i&&(!k||p()))){C(!1);return}let e=window.setTimeout(()=>C(!0),8e3);return()=>window.clearTimeout(e)},[i,k,_,y]),Kn(),On({enabled:!0}),Yn(),ya(),mp({enabled:k&&i}),fm();let F=bf(),L=!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)(dr,{width:120,height:120,isAnimated:!0})});let R=!!p();return k&&(!R||!i&&!L)?R?(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)(dr,{width:120,height:120,isAnimated:!S}),S?(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)(Y,{type:`button`,variant:`outline`,onClick:()=>{u({apiBaseUrl:``,clientToken:null,runtimeKey:`mobile-disconnected`}),v(e=>e+1)},children:t(`mobile.connect.cancelPassword`)})]}):null]})}):w===`done`?(0,$.jsx)(Ls,{connection:M}):(0,$.jsxs)(`main`,{className:`relative flex min-h-dvh items-center justify-center bg-background text-foreground`,children:[(0,$.jsx)(dr,{width:120,height:120,isAnimated:!0}),E?(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:[E,(0,$.jsx)(An,{})]})]}):null]}):!i&&!L?S?(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)(dr,{width:120,height:120,isAnimated:!0})}):(0,$.jsx)(fr,{children:(0,$.jsx)(He,{sdk:I.getSdkClient(),directory:o||``,bootstrapDirectory:!(l&&c===null),children:(0,$.jsxs)(xn,{apis:e,children:[(0,$.jsx)(Vi,{}),(0,$.jsx)(na,{ready:r,children:(0,$.jsx)($n,{delayDuration:300,skipDelayDuration:150,children:(0,$.jsxs)(`div`,{className:`h-full bg-background text-foreground`,children:[(0,$.jsx)(xa,{}),(0,$.jsx)(qt,{}),(0,$.jsx)(bm,{}),(0,$.jsx)(Hn,{embeddedBackgroundWorkEnabled:r}),(0,$.jsx)(ia,{}),(0,$.jsx)(Jo,{}),(0,$.jsx)(is,{}),(0,$.jsx)(rh,{connection:M,onActiveConnectionDeleted:()=>{u({apiBaseUrl:``,clientToken:null,runtimeKey:`mobile-disconnected`}),kt.getState().reset(),v(e=>e+1)}}),(0,$.jsx)(vn,{position:`top-center`,offset:`calc(var(--yuri-safe-area-top, 0px) + 16px)`}),r?(0,$.jsx)(La,{}):null,r?(0,$.jsx)(Da,{}):null,r?(0,$.jsx)(la,{autoStart:!1}):null]})})})]})},y)})}function ah(e){return e.window}function oh(e){e.currentTarget.style.transform=`none`}function sh(e){return e.ensureStatus}function ch(e){return e.fetchStatus}function lh(e){return e.providers}function uh(e){return e.currentProviderId}function dh(e){return e.currentModelId}function fh(e){return e.getModelMetadata}function ph(e){return e.results}function mh(e){return e.loadSettings}function hh(e){return e.isLoading}function gh(e){return e.displayMode}function _h(e){return e.dropdownProviderIds}function vh(e){return e.selectedModels}function yh(e){return e.timeFormatPreference}function bh(e){return[e?.providerId,e]}function xh(e){return e.providerId}function Sh(e){return!e}var Ch=()=>{De(),E().then(()=>{Promise.all([D(),Tn()]).catch(e=>{console.error(`[mobile-main] settings init failed:`,e)}),_n(),Pn(),fn()}).catch(e=>{console.error(`[mobile-main] appearance init failed:`,e)}).finally(()=>{To()})};function wh(e){br(),Ch(),ge.getState().setIsMobile(!0),No(),hr(),mr();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)(ih,{apis:r});(0,xo.createRoot)(t).render((0,$.jsx)(Z.StrictMode,{children:(0,$.jsx)(Xn,{children:(0,$.jsx)(we,{children:(0,$.jsx)(Nn,{children:(0,$.jsx)(In,{children:(0,$.jsx)(ga,{children:(0,$.jsx)(gn,{children:n?i:(0,$.jsx)(bn,{children:i})})})})})})})}))}export{wh as renderMobileApp};