@yuriai/web 0.3.3 → 0.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. package/dist/assets/{AgentSelector-DpOQ7dyw.js → AgentSelector-uBoLtut8.js} +1 -1
  2. package/dist/assets/{ArchivedSessionsDialog-nqnWb-Vc.js → ArchivedSessionsDialog-DZcicxVO.js} +1 -1
  3. package/dist/assets/{AssistantConversationSurface-CKXgty02.js → AssistantConversationSurface-36aP0hRf.js} +3 -3
  4. package/dist/assets/{AssistantSessionCard-C2-2fJul.js → AssistantSessionCard-CZ-1oJiE.js} +2 -2
  5. package/dist/assets/{AssistantView-BR8hsjOv.js → AssistantView-8fyAae7J.js} +1 -1
  6. package/dist/assets/{AssistantsSettingsPage-Bwid1xE0.js → AssistantsSettingsPage-DD6spbXz.js} +1 -1
  7. package/dist/assets/{BinaryFileFallback-Cb3uP7y1.js → BinaryFileFallback-DgYaMG9f.js} +1 -1
  8. package/dist/assets/{BtwPanel-9VAdk_qa.js → BtwPanel-BkobGcf3.js} +1 -1
  9. package/dist/assets/{BusyDots-DeDkh4Ke.js → BusyDots-COTTwItx.js} +1 -1
  10. package/dist/assets/{ChatContainer-wP6o_O4K.js → ChatContainer-BfQ7RXwY.js} +8 -8
  11. package/dist/assets/{ChatView-DU_2-cfD.js → ChatView-ByMRjY1h.js} +1 -1
  12. package/dist/assets/{DiagramView-CaefmjA4.js → DiagramView-DGnmjS2b.js} +1 -1
  13. package/dist/assets/{DiffView-BaqthIvq.js → DiffView-Bbit6OZ8.js} +1 -1
  14. package/dist/assets/{ErrorBoundary-_5B1xjgZ.js → ErrorBoundary-D7QcwhmL.js} +1 -1
  15. package/dist/assets/{FadeInOnReveal-BYHr1gqj.js → FadeInOnReveal-B3uT04YJ.js} +1 -1
  16. package/dist/assets/{GuiPluginMount-Btp3mJT2.js → GuiPluginMount-TC5FELtQ.js} +1 -1
  17. package/dist/assets/{GuiPluginPage-DM_RLx6u.js → GuiPluginPage-BPjU8N49.js} +1 -1
  18. package/dist/assets/{GuiPluginSurface-KiyqqEKU.js → GuiPluginSurface-CYPH6XzX.js} +1 -1
  19. package/dist/assets/{MarkdownRenderer-D7p9Iflj.js → MarkdownRenderer-VvziwyJB.js} +2 -2
  20. package/dist/assets/{MarkdownRendererImpl-BZc_jUrV.js → MarkdownRendererImpl-D8q0FMnr.js} +1 -1
  21. package/dist/assets/{MarkstreamRendererImpl-BUk_c3g1.js → MarkstreamRendererImpl-U_m_ZKG7.js} +1 -1
  22. package/dist/assets/{MobileAssistantSettingsPage-BBIiFN2g.js → MobileAssistantSettingsPage-Dgq5FMho.js} +1 -1
  23. package/dist/assets/{MobileBtwPage-DVZm5hrZ.js → MobileBtwPage-DQUkSO6N.js} +1 -1
  24. package/dist/assets/{MobileChangesSurface-CiqsGZsg.js → MobileChangesSurface-DsYNmAuM.js} +1 -1
  25. package/dist/assets/{MobileChatScreen-DDenVTX8.js → MobileChatScreen-p356_BCN.js} +1 -1
  26. package/dist/assets/{MobileFilesSurface-DIVH9aPV.js → MobileFilesSurface-CF3EW_SK.js} +2 -2
  27. package/dist/assets/{MobileHtmlNetworkBoundary-TBxrF4jJ.js → MobileHtmlNetworkBoundary-DlPF4iPS.js} +2 -2
  28. package/dist/assets/{MobileSettingsTab-MmDnxG47.js → MobileSettingsTab-DaTtRHo1.js} +1 -1
  29. package/dist/assets/{MobileShareBridge-DAlGSXoj.js → MobileShareBridge-CZpFYmiy.js} +1 -1
  30. package/dist/assets/{ModelSelector-HJmXcB3j.js → ModelSelector-EmtltPnd.js} +1 -1
  31. package/dist/assets/{MultiRunWindow-BmxVnblA.js → MultiRunWindow-CeSxAB8w.js} +1 -1
  32. package/dist/assets/{OnboardingScreen-DnEtIaxG.js → OnboardingScreen-BubjTNcy.js} +1 -1
  33. package/dist/assets/{PierreDiffViewer-B1e1H6br.js → PierreDiffViewer-DVKsdwJR.js} +1 -1
  34. package/dist/assets/{RemoteAssistantSessionCard-BgL7oxAK.js → RemoteAssistantSessionCard-DAoFvZht.js} +1 -1
  35. package/dist/assets/{RemoteDesktopPanel-DBrEQwpr.js → RemoteDesktopPanel-f3vRj4ZP.js} +1 -1
  36. package/dist/assets/{ScheduledTasksDialog-BVh0yaZR.js → ScheduledTasksDialog-D_hBP47Y.js} +1 -1
  37. package/dist/assets/{SettingsView-CLE6ra3s.js → SettingsView-DEU94-h1.js} +1 -1
  38. package/dist/assets/{SettingsWindow-DpzeOekS.js → SettingsWindow-DMVAV_el.js} +1 -1
  39. package/dist/assets/{SetupTourDialog-CY_CU5qU.js → SetupTourDialog-BlR7FJvd.js} +1 -1
  40. package/dist/assets/{TerminalView-mO5f0Axl.js → TerminalView-Xcwp3SG1.js} +1 -1
  41. package/dist/assets/{TextSelectionMenu-VsKriqtT.js → TextSelectionMenu-h8iUeNzE.js} +1 -1
  42. package/dist/assets/{ToolOutputDialog-DqCCsC-N.js → ToolOutputDialog-DpaaQ1uZ.js} +1 -1
  43. package/dist/assets/{auto-read-context-DVGIDEr6.js → auto-read-context-ClBUErN2.js} +1 -1
  44. package/dist/assets/{capgoAdapter-94K243Zv.js → capgoAdapter-pfQJmvW2.js} +1 -1
  45. package/dist/assets/{chatUpwardIntent-tvLWGs9Q.js → chatUpwardIntent-B2NrGMm-.js} +1 -1
  46. package/dist/assets/{gitApi-BWsBS_2N.js → gitApi-CoVwjIDy.js} +1 -1
  47. package/dist/assets/{insertionBoundaries-BSDUOMHN.js → insertionBoundaries-Btqgsu1M.js} +1 -1
  48. package/dist/assets/{main-DAbyAg5_.js → main-CXH2hObl.js} +4 -4
  49. package/dist/assets/{main-CHO9s_kb.js → main-ClH7cLKr.js} +2 -2
  50. package/dist/assets/{mcpQueries-1WNtiFYh.js → mcpQueries-Rmp1BKeo.js} +1 -1
  51. package/dist/assets/{miniChat-BZMkNMht.js → miniChat-B_Bw6udu.js} +2 -2
  52. package/dist/assets/{mobile-C9XDDOHq.js → mobile-BR73yoNi.js} +2 -2
  53. package/dist/assets/{mobileBackNavigation-DF_uhF-i.js → mobileBackNavigation-C94n2eLT.js} +1 -1
  54. package/dist/assets/{mobileConnections-DjT1L-_m.js → mobileConnections-x07fHO_5.js} +2 -2
  55. package/dist/assets/{multirun-D34EMeEj.js → multirun-CKQymP08.js} +1 -1
  56. package/dist/assets/{native-config-DSpTDz3F.js → native-config-DVg8_Zx1.js} +1 -1
  57. package/dist/assets/{nativeComposerCover-DXFy97OQ.js → nativeComposerCover-Bhv1EKPT.js} +1 -1
  58. package/dist/assets/{navigation-jU0HUH9s.js → navigation-D1klsD7k.js} +1 -1
  59. package/dist/assets/{openRemoteProjectSession-Bm_nafYw.js → openRemoteProjectSession-DNr74gHD.js} +1 -1
  60. package/dist/assets/{pluginPresentation-DexqrdQ0.js → pluginPresentation-DtyC8NF2.js} +1 -1
  61. package/dist/assets/{pwa-BaWpUiOR.js → pwa-CtDladgB.js} +1 -1
  62. package/dist/assets/{queue-abort-optimistic-UwpgXn4g.js → queue-abort-optimistic-DFbWDRKT.js} +1 -1
  63. package/dist/assets/{reference-history-DBxnA_fF.js → reference-history-IEuzG8KC.js} +1 -1
  64. package/dist/assets/{remoteSessionReference-Cug8RfIG.js → remoteSessionReference-ex07CtrZ.js} +1 -1
  65. package/dist/assets/{renderElectronMiniChatApp-CqrlQAsJ.js → renderElectronMiniChatApp-DM9y9qXo.js} +2 -2
  66. package/dist/assets/{renderMobileApp-CwcwGOox.js → renderMobileApp-DqpPYtZI.js} +4 -4
  67. package/dist/assets/{runtimeConfig-zzeYHX6k.js → runtimeConfig-CyvlrO58.js} +1 -1
  68. package/dist/assets/{runtimeEndpointReset-DUD-TCLY.js → runtimeEndpointReset-C0zNrsI9.js} +3 -3
  69. package/dist/assets/{sessionLookup-4zOaVAuF.js → sessionLookup-DQOiycHr.js} +1 -1
  70. package/dist/assets/{sessionOwnership-CEkPFbS4.js → sessionOwnership-BjhXe6pi.js} +1 -1
  71. package/dist/assets/{speechSettingsQueries-DQnPLEf3.js → speechSettingsQueries-BmkXNn4w.js} +1 -1
  72. package/dist/assets/{types-s_oc_LRs.js → types-DpcA-uDW.js} +1 -1
  73. package/dist/assets/{ui-DrAJTWV6.js → ui-ee2iN869.js} +12 -12
  74. package/dist/assets/{useAppFontEffects-nvkTSYHB.js → useAppFontEffects-rbTKcF0f.js} +2 -2
  75. package/dist/assets/{useDesktopWindowControlsLayout-i6qqpMbd.js → useDesktopWindowControlsLayout-BOkRz-p9.js} +1 -1
  76. package/dist/assets/{useEffectiveDirectory-BxolHzt4.js → useEffectiveDirectory-DiJBIfai.js} +1 -1
  77. package/dist/assets/{useGitStore-B641o_o0.js → useGitStore-Bv8xmXDa.js} +1 -1
  78. package/dist/assets/{useMcpConfigStore-BUSvv0Bl.js → useMcpConfigStore-DKTl0PvE.js} +1 -1
  79. package/dist/assets/{useMobileTranscriptSyncHint-86i3xO8J.js → useMobileTranscriptSyncHint-DM8WG7kz.js} +1 -1
  80. package/dist/assets/{useModelLists-Ca085-di.js → useModelLists-Bf60FIJu.js} +1 -1
  81. package/dist/assets/{useOpenCodeReadiness-CsNcdsCJ.js → useOpenCodeReadiness-Dm6BjA1T.js} +1 -1
  82. package/dist/assets/{usePluginsStore-ZHQOW-R5.js → usePluginsStore-Du4WlceO.js} +1 -1
  83. package/dist/assets/{useProjectGitActions-1QRsD7Rb.js → useProjectGitActions-D3B9ma9z.js} +1 -1
  84. package/dist/assets/{useProjectGitStore-C1K6WpCe.js → useProjectGitStore-DzU2pvrH.js} +1 -1
  85. package/dist/assets/{useProjectRuntimeAPIs-BItoD9Bt.js → useProjectRuntimeAPIs-tjGuODhu.js} +1 -1
  86. package/dist/assets/{useSessionBtwStore-BCHq3UOB.js → useSessionBtwStore-CwvlMabN.js} +1 -1
  87. package/dist/assets/{useStreamingTextThrottle-DGAjmaMZ.js → useStreamingTextThrottle-C9SaKeil.js} +1 -1
  88. package/dist/assets/{worktreeManager-QmahFqHc.js → worktreeManager-DGu8M01Z.js} +1 -1
  89. package/dist/assets/{worktreeSourceBranchPreference-B5Fldnhm.js → worktreeSourceBranchPreference-CuLKwxkx.js} +1 -1
  90. package/dist/index.html +5 -5
  91. package/dist/mini-chat.html +5 -5
  92. package/dist/mobile.html +1 -1
  93. package/package.json +1 -1
@@ -1,11 +1,11 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/vendor-capacitor-app-B5H_XtmE.js","assets/rolldown-runtime-hePW80VL.js","assets/vendor-aparajita-capacitor-secure-storage-xol_6BsB.js","assets/AssistantView-BR8hsjOv.js","assets/runtime-switch-DEPKHgdL.js","assets/runtime-auth-DA-qfGHk.js","assets/vendor-base-ui-wXsskyKm.js","assets/vendor-react-BkccXcWz.js","assets/vendor-reactuses-core-DjKFMfz7.js","assets/vendor-lodash-es-BS45jPoZ.js","assets/vendor-js-cookie-hSOiFTtX.js","assets/useUIStore-C3ewjGgP.js","assets/reasoning-projection-client-BEhVknv9.js","assets/platform-CiUKDeXd.js","assets/runtimeAPIRegistry-C2VogTny.js","assets/vendor-pathe-vBmvQE8f.js","assets/vendor-zustand-CTekDqaS.js","assets/brand-storage-bootstrap-D4BW3w-M.js","assets/brand-storage-migration-Bhz6UOBJ.js","assets/safeStorage-DTOhKN0V.js","assets/useMobileHtmlPreviewStore-BYunNOBo.js","assets/session-startup-barrier-DT-hIBRf.js","assets/vendor-class-variance-authority-BLUaYARZ.js","assets/vendor-tailwind-merge-BicNWLTg.js","assets/Icon-DmykXZL1.js","assets/i18n-DXc6czdR.js","assets/runtime-ead7P81A.js","assets/bootstrap-eLlfzqAI.js","assets/store-C1ifDY0C.js","assets/tour-CMXP3Kif.js","assets/useAssistantUIStore-CpJZ4Rqs.js","assets/mobileAppContext-BQgdTp5T.js","assets/device-EIfSfSWk.js","assets/assistantQueries-NdPqu6rx.js","assets/runtime-fetch-V-iMWR8t.js","assets/vendor-tanstack-react-query-DIb_ItL-.js","assets/vendor-tanstack-query-core-BSjXNgF_.js","assets/yuriEvents-BFrD5fMU.js","assets/assistantPresentation-DRbsH1Ej.js","assets/MobileDetailNavigation-ldTzGo19.js","assets/AssistantConversationSurface-CKXgty02.js","assets/gitApiHttp-Dd-FwgCq.js","assets/client-B_907PBv.js","assets/vendor-opencode-client-BM2r1f0o.js","assets/vendor-effect-X1Hqc7ba.js","assets/prompt-attachment-upload-B5DHrw6U.js","assets/runtime-file-resource-Bc_ss-sW.js","assets/path-utils-jGozTg9d.js","assets/runtime-file-store-BVRgEtI-.js","assets/uuid-D-SDZijH.js","assets/ui-DrAJTWV6.js","assets/vendor-sonner-DX3nfJx4.js","assets/remoteProjectQueries-C8382jM8.js","assets/vendor-zod-DZzbCm1s.js","assets/vendor-opencode-schema-DWT45VBX.js","assets/input-store-BSJBQTMi.js","assets/toolHelpers-iEHVHQ9p.js","assets/ScrollableOverlay-stxT7gLf.js","assets/OverlayScrollbar-D6vmoMkQ.js","assets/vendor-framer-motion-D5NyyC73.js","assets/ImageLoadingPlaceholder-DgM_EFHn.js","assets/image-loading-DA9JEHD8.css","assets/LoadingImage-Df22Rkor.js","assets/MarkdownRenderer-D7p9Iflj.js","assets/useEffectiveDirectory-BxolHzt4.js","assets/markdownHeightCache-CHGGNhWI.js","assets/dualLimitLru-D8Sphgua.js","assets/imageSource-BR4C9TuS.js","assets/MobileShareBridge-DAlGSXoj.js","assets/dialog-BeFBA6ja.js","assets/dialog-D9CkSNCA.css","assets/rasterizePng-056Poix7.js","assets/mobileConnections-DjT1L-_m.js","assets/AgentAvatar-CHCjMxCF.js","assets/useThemeSystem-BIXghnHj.js","assets/agentColors-DWSbQXy2.js","assets/vendor-dicebear-core-CV95S5Pg.js","assets/vendor-dicebear-styles-C4OfoX7R.js","assets/chatUpwardIntent-tvLWGs9Q.js","assets/MobileResizableSheet-CqphcaKq.js","assets/MobileWindowStack-DGLdgoGr.js","assets/textarea-ZiXxEOHK.js","assets/fileMentionTouchSelection-BQEUty_A.js","assets/vendor-fuzzysort-ukaRp9PC.js","assets/fileMentionAutocompleteState-B9411b4o.js","assets/spacedFileMention-Ds4GtgiF.js","assets/vendor-fuse.js-DB5wDJbI.js","assets/reference-history-DBxnA_fF.js","assets/themes-BgDJcxRc.js","assets/useDictation-CZzAlsW0.js","assets/audio-session-BFWjrDbp.js","assets/reference-history-8C8nv-EP.css","assets/vendor-motion-vLNN8EMu.js","assets/assistant-attachment-cache-bRIIESGe.js","assets/AssistantWorkingAvatar-CoxhuMvM.js","assets/AssistantSessionCard-C2-2fJul.js","assets/sessionLookup-4zOaVAuF.js","assets/scheduledTaskNavigation-VVTOq9n2.js","assets/router-DXUi1sBd.js","assets/contextPanelEmbeddedChat-Dm5R_b5X.js","assets/AssistantConversationSurface-B59k-lXE.css","assets/AssistantUnreadBadge-p9mkpbMC.js","assets/sortAssistantContacts-CcEdm3mS.js","assets/assistantMessagePreview-DLBvPQtq.js","assets/context-menu-CKlB6wxo.js","assets/dropdown-menu.styles-BDla58Rm.js","assets/MobileAssistantTab-CMIQansR.js","assets/select-assistant-mmsKjj2O.js","assets/MobileSurface-cmaGf3hZ.js","assets/MobileTabPageHeader-D6P4K98S.js","assets/useMobileSwipeActions-XoxrtaUo.js","assets/MobileAssistantSettingsPage-BBIiFN2g.js","assets/ErrorBoundary-_5B1xjgZ.js","assets/card-DmysoUAV.js","assets/AssistantsSettingsPage-Bwid1xE0.js","assets/dropdown-menu-BblI9sN2.js","assets/input-Cf16qJ6g.js","assets/select-vZCgcnYG.js","assets/SettingsGroup-CvaPYznp.js","assets/ModelSelector-HJmXcB3j.js","assets/ModelLogo-BkbD514M.js","assets/zhipuai-coding-plan-CcFj8zKy.js","assets/useModelLists-Ca085-di.js","assets/vendor-tanstack-react-virtual-qsd3nvZb.js","assets/tooltip-CpTbxEOE.js","assets/vendor-dnd-kit-core-qy5stxu5.js","assets/vendor-dnd-kit-accessibility-u0XSXxKq.js","assets/vendor-dnd-kit-sortable-CiTIuX4o.js","assets/ProviderLogo-DA98yu7M.js","assets/useOpenCodeReadiness-CsNcdsCJ.js","assets/vendor-qrcode-D7jBCyl-.js","assets/vendor-dijkstrajs-BAzPDGZM.js","assets/MobileBtwPage-DVZm5hrZ.js","assets/mobileBackNavigation-DF_uhF-i.js","assets/BtwPanel-9VAdk_qa.js","assets/SessionSurfaceContext-BP4NCKp6.js","assets/useSessionBtwStore-BCHq3UOB.js","assets/nativeComposerCover-DXFy97OQ.js","assets/inlineMessageLinks-DC78iKO5.js","assets/auto-read-context-DVGIDEr6.js","assets/browserVoiceService-x5Pci8L3.js","assets/vendor-marked-S3gCOYp1.js","assets/timeFormat-dCsf2MQv.js","assets/MobileSettingsTab-MmDnxG47.js","assets/SettingsView-CLE6ra3s.js","assets/desktopHosts-BsTrBVja.js","assets/desktopRelayRestore-BxbRKak_.js","assets/vendor-codemirror-autocomplete-C0FrlFqZ.js","assets/react-CPBNl-S9.js","assets/collapsible-Z0IjDAMO.js","assets/appThemeRegistry-BdjrGBQ4.js","assets/vendor-pierre-diffs-B0OmIhMO.js","assets/vendor-hast-util-to-html-Bw_SgZ1t.js","assets/vendor-character-entities-legacy-Wut6vMuj.js","assets/vendor-character-entities-html4-DlN_yAFd.js","assets/vendor-ccount-CyGsA0u7.js","assets/vendor-comma-separated-tokens-B9ouxNNS.js","assets/vendor-oniguruma-to-es-CrHzjjSU.js","assets/vendor-oniguruma-parser-D2DIvhSP.js","assets/vendor-diff-Dq7CZNim.js","assets/vendor-lru_map-BMOrLc9L.js","assets/gitApi-BWsBS_2N.js","assets/GuiPluginMount-Btp3mJT2.js","assets/MobileHtmlNetworkBoundary-TBxrF4jJ.js","assets/shortcuts-WkN3Gh8v.js","assets/pwa-BaWpUiOR.js","assets/vendor-simplewebauthn-browser-Dwhcdg_5.js","assets/githubAuthQueries-DqregESf.js","assets/projectMeta-vIaGFaQr.js","assets/sortable-tabs-strip-DmtfYPz0.js","assets/permission-rules-DoQUXKll.js","assets/useQuotaStore-CSn2pk3T.js","assets/quota-CqWNkFzw.js","assets/sessionOwnership-CEkPFbS4.js","assets/types-s_oc_LRs.js","assets/mcpQueries-1WNtiFYh.js","assets/usePluginsStore-ZHQOW-R5.js","assets/switch-CNmsFYfY.js","assets/useMcpConfigStore-BUSvv0Bl.js","assets/native-config-DSpTDz3F.js","assets/YuriLogo-Cp6vWDWp.js","assets/GuiPluginWindow-BkAFJyFd.js","assets/pluginPresentation-DexqrdQ0.js","assets/speechSettingsQueries-DQnPLEf3.js","assets/pluginPresentation-C0HSdVvS.css","assets/AgentSelector-DpOQ7dyw.js","assets/ArchivedSessionsDialog-nqnWb-Vc.js","assets/vendor-codemirror-lang-angular-Cm7vBE3E.js","assets/vendor-codemirror-lang-json-DowyFczU.js","assets/vendor-codemirror-lang-markdown-npWBZIoE.js","assets/vendor-codemirror-lang-python-OPRdU26g.js","assets/vendor-codemirror-legacy-modes-DwltVFbT.js","assets/MobileOverlayPanel-C36VWWmN.js","assets/worktreeManager-QmahFqHc.js","assets/markdown-worker-oBGEB9Eg.js","assets/vendor-codemirror-commands-5saeUOVY.js","assets/vendor-codemirror-search-hZY-L2l8.js","assets/vendor-replit-codemirror-vim-BmQmU1lR.js","assets/vendor-codemirror-language-data-B3pLWvv-.js","assets/vendor-yaml-C9KlJAlj.js","assets/vendor-capacitor-push-notifications-D5cqJIPw.js","assets/ChatView-DU_2-cfD.js","assets/useProjectRuntimeAPIs-BItoD9Bt.js","assets/terminalApi-DXvEquBF.js","assets/useProjectGitStore-C1K6WpCe.js","assets/useGitStore-B641o_o0.js","assets/ChatContainer-wP6o_O4K.js","assets/useInlineCommentDraftStore-B2mkmAZd.js","assets/truncated-path-CcmWjgCQ.js","assets/kbd-CamdaxHJ.js","assets/TextSelectionMenu-VsKriqtT.js","assets/useDebouncedValue-BHlMPqY8.js","assets/checkbox-BMN5hAVm.js","assets/connection-hint-B-kOWome.js","assets/insertionBoundaries-BSDUOMHN.js","assets/BusyDots-DeDkh4Ke.js","assets/worktreeSourceBranchPreference-B5Fldnhm.js","assets/remote-input-store-C6UIEZxp.js","assets/vendor-cmdk-BDWoZLve.js","assets/vendor-aria-hidden-BbL3cEyI.js","assets/queue-abort-optimistic-UwpgXn4g.js","assets/ToolOutputDialog-DqCCsC-N.js","assets/runtime-file-download-BWeoSXRb.js","assets/tap-LkQum5bB.js","assets/markdownTheme-D84XyNiT.js","assets/DiffViewToggle-BwJ6MYB7.js","assets/touch-gestures-DOoBxhz5.js","assets/FadeInOnReveal-BYHr1gqj.js","assets/useStreamingTextThrottle-DGAjmaMZ.js","assets/ChatContainer-K31q-1OV.css","assets/DiffView-BaqthIvq.js","assets/PierreDiffViewer-B1e1H6br.js","assets/DiffWorkerProvider-VFPkag9y.js","assets/MobileChangesSurface-CiqsGZsg.js","assets/useProjectGitActions-1QRsD7Rb.js","assets/SyncActions-CrOoREWF.js","assets/MobileFilesSurface-DIVH9aPV.js","assets/BinaryFileFallback-Cb3uP7y1.js","assets/relay-preview-frame-src-BPyz3nXA.js","assets/BinaryFileFallback-CKNAgvHj.css","assets/MobileChatScreen-DDenVTX8.js","assets/useMobileTranscriptSyncHint-86i3xO8J.js","assets/icons-Bd-INsoy.js","assets/GuiPluginTitlebarItems-DxFINwbr.js","assets/RemoteDesktopPanel-DBrEQwpr.js","assets/ScheduledTasksDialog-BVh0yaZR.js","assets/vendor-cron-parser-BmO80h0C.js","assets/vendor-capacitor-status-bar-D9bcMr9Q.js","assets/vendor-capacitor-keyboard-BRVcFyc9.js"])))=>i.map(i=>d[i]);
2
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{S as t,_ as n,p as r,r as i,t as a,v as o}from"./runtime-auth-DA-qfGHk.js";import{c as s,f as c,i as l,l as u,n as d,r as f,t as p}from"./runtime-switch-DEPKHgdL.js";import{n as m}from"./runtime-fetch-V-iMWR8t.js";import{f as h,n as g,r as _,s as v,t as y}from"./platform-CiUKDeXd.js";import{n as b,t as x}from"./runtimeAPIRegistry-C2VogTny.js";import{a as S}from"./vendor-zustand-CTekDqaS.js";import{ot as C,st as w}from"./vendor-base-ui-wXsskyKm.js";import{Mt as T,Pt as E,St as D}from"./gitApiHttp-Dd-FwgCq.js";import"./brand-storage-bootstrap-D4BW3w-M.js";import{n as O}from"./safeStorage-DTOhKN0V.js";import{n as k}from"./client-B_907PBv.js";import{n as A,t as j}from"./vendor-react-BkccXcWz.js";import{s as M}from"./vendor-tanstack-react-query-DIb_ItL-.js";import{E as N,R as P,k as F}from"./runtime-file-resource-Bc_ss-sW.js";import{i as I,l as L,r as R}from"./vendor-reactuses-core-DjKFMfz7.js";import{a as ee,n as z,o as B}from"./vendor-aparajita-capacitor-secure-storage-xol_6BsB.js";import{r as te}from"./useUIStore-C3ewjGgP.js";import{a as ne,o as re,s as ie,t as ae}from"./useMobileHtmlPreviewStore-BYunNOBo.js";import{t as oe}from"./capgoAdapter-94K243Zv.js";/* empty css */import{r as V}from"./vendor-sonner-DX3nfJx4.js";import{c as se,i as H,o as U}from"./session-startup-barrier-DT-hIBRf.js";import{n as W}from"./Icon-DmykXZL1.js";import{At as G,Bi as ce,Di as le,Gr as ue,Hi as de,Ia as K,Ja as fe,Ji as pe,K as me,L as he,Lr as q,Mi as ge,Na as J,Ni as _e,Nr as Y,Oi as ve,Qn as ye,Qt as be,R as xe,Si as Se,Ti as Ce,V as we,Vr as Te,Vt as Ee,Wr as De,a as Oe,bi as ke,et as Ae,f as je,fn as Me,hi as Ne,i as Pe,ir as Fe,jn as Ie,k as Le,kt as Re,lt as ze,n as Be,nr as Ve,o as He,pr as Ue,q as We,r as Ge,rr as Ke,rt as qe,t as X,ut as Je,wt as Ye,zr as Xe}from"./ui-DrAJTWV6.js";import{d as Ze,h as Qe,i as $e,m as et,p as tt}from"./remoteProjectQueries-C8382jM8.js";import{r as nt,t as rt}from"./i18n-DXc6czdR.js";import{i as it,n as at}from"./store-C1ifDY0C.js";import{n as ot}from"./useAssistantUIStore-CpJZ4Rqs.js";import{n as st,t as ct}from"./ScrollableOverlay-stxT7gLf.js";import{d as lt,r as ut,t as dt,u as ft,v as pt}from"./MobileResizableSheet-CqphcaKq.js";import{t as mt}from"./mobileAppContext-BQgdTp5T.js";import{a as ht,i as gt,n as _t,o as vt,r as yt,t as bt}from"./dialog-BeFBA6ja.js";import{r as xt}from"./tooltip-CpTbxEOE.js";import{i as St,o as Ct,t as wt}from"./device-EIfSfSWk.js";import{c as Tt,n as Et,r as Dt,t as Ot}from"./dropdown-menu-BblI9sN2.js";import{t as kt}from"./DiffWorkerProvider-VFPkag9y.js";import{a as At,c as jt,o as Mt,s as Nt}from"./useGitStore-B641o_o0.js";import{A as Pt,E as Ft,a as It,j as Lt,n as Rt,p as zt,r as Bt,t as Vt}from"./mobileBackNavigation-DF_uhF-i.js";import{i as Ht,t as Ut}from"./MobileHtmlNetworkBoundary-TBxrF4jJ.js";import{t as Wt}from"./relay-preview-frame-src-BPyz3nXA.js";/* empty css */import{t as Gt}from"./input-Cf16qJ6g.js";import{o as Kt}from"./MarkdownRenderer-D7p9Iflj.js";import{o as qt}from"./useSessionBtwStore-BCHq3UOB.js";import{a as Jt,i as Yt,o as Xt,t as Zt}from"./nativeComposerCover-DXFy97OQ.js";import{a as Qt,i as $t,l as en,o as tn,r as nn,s as rn,t as an,u as on}from"./mobileConnections-DjT1L-_m.js";import{m as sn,v as cn,x as ln,y as un}from"./assistantQueries-NdPqu6rx.js";import{a as dn,t as fn}from"./MobileShareBridge-DAlGSXoj.js";import{t as pn}from"./MobileDetailNavigation-ldTzGo19.js";import{A as mn,C as hn,D as gn,E as _n,M as vn,N as yn,O as bn,R as xn,S as Sn,T as Cn,i as wn,j as Tn,k as En,r as Dn,t as On,w as kn,x as An,z as jn}from"./useAppFontEffects-nvkTSYHB.js";import{S as Mn}from"./pwa-BaWpUiOR.js";import{t as Nn}from"./YuriLogo-Cp6vWDWp.js";import{t as Pn}from"./ErrorBoundary-_5B1xjgZ.js";import{L as Fn,R as In,T as Ln,X as Rn,i as zn,t as Bn}from"./BusyDots-DeDkh4Ke.js";import{r as Vn}from"./queue-abort-optimistic-UwpgXn4g.js";import{t as Hn}from"./MobileOverlayPanel-C36VWWmN.js";import{n as Un,t as Wn}from"./ProviderLogo-DA98yu7M.js";import{n as Gn,s as Kn}from"./worktreeManager-QmahFqHc.js";import{a as qn,i as Jn,n as Yn}from"./projectMeta-vIaGFaQr.js";import{i as Xn,n as Zn,t as Qn}from"./auto-read-context-DVGIDEr6.js";import{a as $n,n as er,r as tr,u as nr}from"./useQuotaStore-CSn2pk3T.js";import{a as rr,i as ir,s as ar}from"./quota-CqWNkFzw.js";import{t as or}from"./openRemoteProjectSession-Bm_nafYw.js";import{i as sr}from"./router-DXUi1sBd.js";import{t as cr}from"./useFontPreferences-BiRBKhti.js";import{C as lr,Ct as ur,Dt as dr,Et as fr,F as pr,It as mr,J as hr,L as gr,Lt as _r,Mt as vr,Nt as yr,Ot as br,P as xr,Pt as Sr,Q as Cr,Rt as wr,S as Tr,St as Er,T as Dr,Tt as Or,X as kr,Y as Ar,Z as jr,_t as Mr,a as Nr,at as Pr,b as Fr,c as Ir,ct as Lr,d as Rr,dt as zr,et as Br,f as Vr,ft as Hr,g as Ur,gt as Wr,h as Gr,ht as Kr,i as qr,it as Jr,kt as Yr,l as Xr,lt as Zr,m as Qr,mt as $r,n as ei,nt as ti,o as ni,ot as ri,p as ii,pt as ai,q as oi,r as si,rt as ci,s as li,st as ui,t as di,tt as fi,u as pi,ut as mi,vt as hi,wt as gi,z as _i}from"./runtimeEndpointReset-DUD-TCLY.js";import{t as vi}from"./YuriWordmark-CLGHwobA.js";import{_ as yi,p as bi,r as xi,y as Si}from"./sessionOwnership-CEkPFbS4.js";import{r as Ci,t as wi}from"./mcpQueries-1WNtiFYh.js";import{n as Ti}from"./SettingsGroup-CvaPYznp.js";import{a as Ei,n as Di,o as Oi}from"./useMcpConfigStore-BUSvv0Bl.js";import{n as ki}from"./project-preview-BCtFY4Rg.js";import{i as Ai,r as ji}from"./icons-Bd-INsoy.js";import{a as Mi,i as Ni,o as Pi,r as Fi,s as Ii,t as Li}from"./useMobileTranscriptSyncHint-86i3xO8J.js";import{n as Ri,r as zi,t as Bi}from"./select-assistant-mmsKjj2O.js";import{i as Vi,n as Hi,t as Ui}from"./MobileSurface-cmaGf3hZ.js";import{t as Wi}from"./AssistantUnreadBadge-p9mkpbMC.js";var Z=e(w(),1),Gi=j(),Ki=null,qi=!1,Ji=new Promise(e=>{Ki=e});function Yi(){qi||(qi=!0,Ki?.())}var Xi=6,Zi=e=>e.parentID??null,Qi=e=>{let t=e.replace(/\/+$/,``);return t.slice(t.lastIndexOf(`/`)+1)||t},$i=e=>e.replace(/\\/g,`/`).replace(/\/+$/,``),ea=(e,t)=>{if(!e)return``;let n=null,r=-1;for(let i of t){let t=$i(i.path);(e===t||e.startsWith(`${t}/`))&&t.length>r&&(n=i,r=t.length)}return Qi(n?n.path:e)},ta=()=>{let e=ve.getState().activeSessions,t=q.getState().index.session.unseenCount,n=J.getState().projects,r=0,i=[];for(let a of e){let e=Zi(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:ea(Ce(a),n)})}i.sort((e,t)=>t.updated-e.updated);let a=i.slice(0,Xi).map(({id:e,title:t,unread:n,project:r})=>({id:e,title:t,unread:n,project:r}));return{attentionCount:r,recentSessions:a}},na=`__YURI_WIDGET_SNAPSHOT__`,ra=()=>{typeof window>`u`||(window[na]=()=>{try{return JSON.stringify(ta())}catch{return null}})},Q=A(),ia=ee(`YuriScreenAwake`),aa=Promise.resolve(),oa=0;function sa(e){let t=aa.then(()=>ia.setEnabled({enabled:e}));return aa=t.catch(()=>void 0),t}async function ca(){if(z.isNativePlatform()&&z.isPluginAvailable(`YuriScreenAwake`)){oa+=1;try{await sa(!0)}catch(e){throw--oa,e}let e=!1;return async()=>{e||(e=!0,--oa,oa===0&&await sa(!1))}}if(!navigator.wakeLock)throw Error(`Screen wake lock unavailable`);let e=await navigator.wakeLock.request(`screen`);return async()=>{e.released||await e.release()}}var $=C();function la(e){let t=(0,Q.c)(3),n=Fe(),r=e.remoteState??n??void 0,i;return t[0]!==e||t[1]!==r?(i=(0,$.jsx)(fa,{...e,remoteState:r}),t[0]=e,t[1]=r,t[2]=i):i=t[2],i}function ua(e){let t=(0,Q.c)(6),{identity:n,onSource:r}=e,i=ze(e.sessionId,e.directory),a=Je(e.sessionId,e.directory),o,s;return t[0]!==n||t[1]!==i||t[2]!==r||t[3]!==a?(o=()=>r({identity:n,resolved:a,getMessages:()=>i}),s=[n,r,i,a],t[0]=n,t[1]=i,t[2]=r,t[3]=a,t[4]=o,t[5]=s):(o=t[4],s=t[5]),(0,Z.useLayoutEffect)(o,s),null}function da(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=R(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 fa(e){let{sessionId:t,directory:n,active:r,children:i,remoteState:a}=e,{t:o}=rt(),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=R(e=>{l.current=e,d(t=>t?.identity===e.identity&&t.resolved===e.resolved?t:{identity:e.identity,resolved:e.resolved})}),[p,m]=L(`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=Xn({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=R(()=>{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=R(()=>{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(),V.error(o(`mobile.menu.autoReadFailed`));return}k()}},{target:t.target})}),A=R(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=R((e,n)=>{T.current.enabled&&D&&e===t&&T.current.observed.add(n)}),M=R(()=>{if(h){m(!1),O();return}D&&(m(!0),w.unlock().catch(()=>{V.error(o(`mobile.menu.autoReadFailed`))}))}),N=R(()=>{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=R(()=>{m(!1),O()});I(`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),I(`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 ca().then(n=>{e?n().catch(()=>void 0):t=n}).catch(()=>{e||V.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]),ee=(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)(Qn.Provider,{value:F,children:(0,$.jsxs)(Zn.Provider,{value:ee,children:[a?(0,$.jsx)(da,{...e,identity:c,onSource:f,remoteState:a}):e.remote?null:(0,$.jsx)(ua,{...e,identity:c,onSource:f}),i]})})}function pa(e){let t=(0,Q.c)(3),{children:n}=e,r=(0,Z.useContext)(Qn);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 ma={getPlatform:()=>z.getPlatform(),isPluginAvailable:e=>z.isPluginAvailable(e),openInSystemBrowser:e=>ie.open(e),openExternal:re},ha=async(e,t=ma)=>{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)},ga=`mobile-app-update-available`,_a=`mobile-app-update-toast-dismissed-version`,va=()=>{let e=(0,Q.c)(9),{t}=rt(),n=yi(ya),r=yi(ba),i=yi(xa),a=yi(Sa),o=yi(Ca),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){X.dismiss(ga);return}O().getItem(_a)!==i&&(c.current.has(i)||(c.current.add(i),X.info(t(`mobileUpdate.toast.available.title`),{id:ga,description:t(`mobileUpdate.toast.available.description`,{version:i}),duration:1/0,icon:(0,$.jsx)(W,{name:`download`,className:`h-4 w-4 text-muted-foreground`}),action:{label:t(`mobileUpdate.toast.actions.download`),onClick:()=>{ha(a)}},cancel:{label:t(`mobileUpdate.toast.actions.dismiss`),onClick:()=>{O().setItem(_a,i),X.dismiss(ga)}}})))},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 ya(e){return e.available}function ba(e){return e.runtimeType}function xa(e){return e.info?.version}function Sa(e){return e.info?.downloadUrl}function Ca(e){return e.info?.inAppApply===!0}var wa=e=>!(!e.enabled||e.runtimeType!==`mobile`||!e.available||!e.inAppApply||!e.version||e.seenVersions.has(e.version)||e.dismissedVersion!==null&&e.dismissedVersion===e.version),Ta=e=>e.enabled&&!e.alreadyChecked,Ea=`mobile-ota-update-available`,Da=`mobile-ota-update-toast-dismissed-version`,Oa=()=>{let e=(0,Q.c)(24),{t}=rt(),[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=yi(ka),u=yi(Aa),d=yi(ja),f=yi(Ma),p=yi(Na),m=yi(Pa),h=yi(Fa),_=yi(Ia),v=yi(La),y=d?.version,b=d?.inAppApply===!0,x,S;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(x=()=>{Ta({enabled:c,alreadyChecked:i.current})&&(i.current=!0,yi.getState().checkForUpdates().catch(Ra))},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=R(C),T=R(za),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(!wa({enabled:c,runtimeType:u,available:l,inAppApply:b,version:y??``,dismissedVersion:O().getItem(Da),seenVersions:o.current})||!y){(!l||!b||u!==`mobile`)&&X.dismiss(Ea);return}o.current.add(y),X.info(t(`mobileUpdate.ota.toast.available.title`),{id:Ea,description:t(`mobileUpdate.ota.toast.available.description`,{version:y}),duration:1/0,icon:(0,$.jsx)(W,{name:`refresh`,className:`h-4 w-4 text-muted-foreground`}),action:{label:t(`mobileUpdate.ota.toast.actions.update`),onClick:w},cancel:{label:t(`mobileUpdate.ota.toast.actions.dismiss`),onClick:()=>{T(y)}}})},D=[l,b,c,w,T,u,t,y],e[5]=l,e[6]=T,e[7]=b,e[8]=w,e[9]=u,e[10]=t,e[11]=y,e[12]=E,e[13]=D):(E=e[12],D=e[13]),Z.useEffect(E,D),!c)return null;let k;return e[14]!==n||e[15]!==_||e[16]!==p||e[17]!==f||e[18]!==h||e[19]!==d||e[20]!==m||e[21]!==v||e[22]!==u?(k=(0,$.jsx)(bi,{open:n,onOpenChange:r,info:d,downloading:f,downloaded:p,progress:m,error:h,onDownload:_,onRestart:v,runtimeType:u}),e[14]=n,e[15]=_,e[16]=p,e[17]=f,e[18]=h,e[19]=d,e[20]=m,e[21]=v,e[22]=u,e[23]=k):k=e[23],k};function ka(e){return e.available}function Aa(e){return e.runtimeType}function ja(e){return e.info}function Ma(e){return e.downloading}function Na(e){return e.downloaded}function Pa(e){return e.progress}function Fa(e){return e.error}function Ia(e){return e.downloadUpdate}function La(e){return e.restartToUpdate}function Ra(){}function za(e){O().setItem(Da,e),X.dismiss(Ea)}var Ba=ee(`BarcodeScanner`),Va=`yuri-barcode-scanner-active`,Ha=()=>ro()?Ba:null,Ua=()=>window.Capacitor?.getPlatform?.()===`android`,Wa=e=>typeof e==`object`&&e&&`message`in e?String(e.message??``):String(e??``),Ga=e=>/^\s*scan canceled\.?\s*$/i.test(Wa(e)),Ka=e=>/denied access to camera/i.test(Wa(e)),qa=e=>!Ga(e)&&!Ka(e),Ja=e=>{let t=Wa(e);return/module/i.test(t)&&/not\s*available|unavailable/i.test(t)},Ya=e=>{e.installGoogleBarcodeScannerModule?.().catch(()=>void 0)},Xa=e=>{let t=e.trim();if(!t)return null;if(/^yuri:\/\//i.test(t)){let e=Ei(t);return e?{pairing:e}:null}return/^https?:\/\//i.test(t)?{url:t}:null},Za=e=>{let t=Xa(e);return t?`pairing`in t?{status:`pairing`,...t}:{status:`ok`,...t}:{status:`invalid`}},Qa=e=>{typeof document>`u`||document.documentElement.classList.toggle(Va,e)},$a=e=>{try{e()}catch{}},eo=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))}},to=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))};Qa(!0);let c=eo(()=>s({status:`cancelled`}));try{let{App:e}=await B(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(Za(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=>{Ka(e)?s({status:`permission-denied`}):s({status:`failed`})}),await o}finally{Qa(!1),$a(c),$a(()=>r?.()),await Promise.allSettled([Promise.resolve(t?.remove()),Promise.resolve(n?.remove()),e.stopScan()])}},no=e=>e.isNativePlatform&&e.isPluginAvailable,ro=()=>no({isNativePlatform:z.isNativePlatform(),isPluginAvailable:z.isPluginAvailable(`BarcodeScanner`)}),io=async()=>{let e=Ha();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?Za(n):{status:`cancelled`}}catch(t){return Ga(t)?{status:`cancelled`}:Ka(t)?{status:`permission-denied`}:Ua()&&qa(t)&&e.startScan?(Ja(t)&&Ya(e),to(e)):{status:`failed`}}return Ua()&&e.startScan?to(e):{status:`unsupported`}}catch{return{status:`failed`}}},ao={autoComplete:`off`,autoCorrect:`off`,spellCheck:!1},oo=({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}=rt(),[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=R(async()=>{if(!(e||t||_)){v(!0);try{let e=await navigator.clipboard.readText();x(e);let t=Xa(e);e.trim()&&(!t||!(`pairing`in t))&&d()}catch{g(f(`mobile.connect.link.pasteFallback`))}finally{v(!1)}}}),C=R(n=>{if(n.preventDefault(),e||t||_)return;let r=Xa(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)(Gt,{...ao,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)(H,{variant:`outline`,size:`icon`,onClick:()=>void S(),disabled:e||t||_,"aria-label":f(`mobile.connect.link.paste`),children:(0,$.jsx)(W,{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)(H,{type:`submit`,variant:i,size:`lg`,className:a,disabled:e||t||_||!y.trim(),children:f(t?`mobile.connect.connecting`:`mobile.connect.connectButton`)})]})};function so({connection:e}){let{t}=rt(),{connections:n,isBusy:r,error:i,pendingConnection:a}=e,o=Z.useMemo(()=>ro(),[]),[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=R(()=>{O||(a?(e.cancelPassword(),C(``)):A(null))}),N=R(async t=>{O||(_(t.id),C(``),await e.connect({id:t.id,candidates:t.candidates,label:t.label}))}),P=R(async()=>{if(!O){_(null),m(!0),e.setError(null);try{let n=await io();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=R(()=>d?(f(null),!0):k?(M(),!0):l?(u(!1),!0):!1);Z.useEffect(()=>{if(!g())return;let e=!1,t;return B(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)(H,{size:`lg`,variant:e?`default`:`ghost`,className:e?`yuri-welcome-primary w-full`:`w-full`,disabled:O,onClick:()=>void P(),children:[(0,$.jsx)(W,{name:p?`loader-4`:`scan-2`,className:p?`size-5 animate-spin motion-reduce:animate-none`:`size-5`}),t(`mobile.connect.scanQr`)]}),ee=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)(vi,{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)(Nn,{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)(H,{variant:`outline`,className:`yuri-welcome-device`,disabled:O,onClick:j,children:[(0,$.jsx)(W,{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)(W,{name:`arrow-right-s`,className:`size-5 text-muted-foreground`})]}),(0,$.jsx)(H,{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)(H,{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)(H,{variant:`ghost`,size:`lg`,disabled:O,className:`mx-auto text-muted-foreground`,onClick:()=>A(`more`),children:t(`mobile.connect.welcome.moreOptions`)})]})]})]}),(0,$.jsxs)(ut,{id:`welcome-history`,open:l,onOpenChange:u,presentation:`page`,edge:`right`,dismissGesture:!0,ariaLabel:t(`mobile.connect.history.title`),children:[(0,$.jsx)(pn,{title:t(`mobile.connect.history.title`),backAriaLabel:t(`header.actions.backAria`),onBack:()=>u(!1)}),(0,$.jsxs)(ct,{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)(H,{variant:`ghost`,className:`yuri-welcome-history-row min-w-0 flex-1`,disabled:O,onClick:()=>void N(e),children:[(0,$.jsx)(W,{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)(H,{variant:`ghost`,size:`icon`,disabled:O,"aria-label":t(`desktopHostSwitcher.actions.retry`),onClick:()=>void N(e),children:(0,$.jsx)(W,{name:`error-warning-fill`,className:`size-5 text-[var(--status-error)]`})}):null,(0,$.jsxs)(Ot,{open:d===e.id,onOpenChange:t=>f(t?e.id:null),children:[(0,$.jsx)(Tt,{asChild:!0,children:(0,$.jsx)(H,{variant:`ghost`,size:`icon`,disabled:O,"aria-label":t(`mobile.connect.history.actions`,{name:e.label}),children:(0,$.jsx)(W,{name:`more`,className:`size-5`})})}),(0,$.jsxs)(Et,{align:`end`,children:[(0,$.jsxs)(Dt,{onSelect:()=>{y(e.id),x(e.label),A(`rename`)},children:[(0,$.jsx)(W,{name:`edit`,className:`size-4`}),t(`mobile.connect.history.rename`)]}),(0,$.jsxs)(Dt,{onSelect:()=>{y(e.id),A(`remove`)},className:`text-[var(--status-error)]`,children:[(0,$.jsx)(W,{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)(Nn,{width:36,height:36,className:`mx-auto mb-5 opacity-40`}),o?L(!1):null,(0,$.jsx)(H,{variant:`ghost`,size:`lg`,className:`w-full`,disabled:O,onClick:()=>A(`more`),children:t(`mobile.connect.link.useLink`)})]})]}),(0,$.jsx)(dt,{id:`welcome-options`,open:k,onOpenChange:e=>{e||M()},fitContent:!0,title:(0,$.jsx)(`h2`,{className:`truncate typography-ui-label font-semibold`,children:ee}),ariaLabel:ee,closeAriaLabel:t(`mobile.surface.closeAria`),resizeAriaLabel:t(`mobile.connect.options.resize`),children:(0,$.jsx)(ct,{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)(W,{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)(H,{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)(W,{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)(H,{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)(Gt,{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)(H,{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)(H,{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)(Gt,{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)(H,{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)(H,{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)(H,{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)(oo,{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)(H,{variant:`outline`,className:`yuri-welcome-history-row`,disabled:O,onClick:j,children:[(0,$.jsx)(W,{name:`history`,className:`size-6`}),(0,$.jsx)(`span`,{className:`flex-1 text-left`,children:t(`mobile.connect.history.title`)}),(0,$.jsx)(W,{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 co(e){let t=(0,Q.c)(17),{children:n}=e,r=te(fo),i=te(uo),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],Rt(c);let l,u;t[5]===r?(l=t[6],u=t[7]):(l=()=>{if(!r)return;let e=document.activeElement,t=Jt(`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)(Yr,{presentation:`page`,onBack:lo})}):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 lo(){Vt.requestAnimatedBack(`root`)}function uo(e){return e.setCommandPaletteOpen}function fo(e){return e.isCommandPaletteOpen}async function po(e,t,n,i){if(i){let r=await ki(i,e,n);if(!ne(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(!ne(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)||!Wt(`${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 mo({url:e,hostOrigin:t,entry:n}){let{t:r}=rt(),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 po(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=ne(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 I(`message`,t=>{if(!f?.src||!ne(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`&&ae.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)(Ht,{message:r(`contextPanel.preview.proxyError`)}),(0,$.jsx)(H,{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 ho(e){let t=(0,Q.c)(10),{location:n,url:r,hostOrigin:i}=e,{t:a}=rt(),o=et(!0);if(!o.registry||o.registry.hubId!==n.hubId){let e;return t[0]!==o.error||t[1]!==a?(e=o.error?(0,$.jsx)(Ht,{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)(mo,{url:r,hostOrigin:i,entry:s}),t[6]=i,t[7]=s,t[8]=r,t[9]=c):c=t[9],c}function go(){let e=(0,Q.c)(17),{t}=rt(),n=ae(vo),r=N(),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)(Ut,{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)(mo,{url:a.url,hostOrigin:e?.hostOrigin,entry:r.entry}):(0,$.jsx)(ho,{location:a.location,url:a.url,hostOrigin:e?.hostOrigin}):(0,$.jsx)(mo,{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)(dt,{id:`mobile-html-preview`,open:o,ariaLabel:c,closeAriaLabel:l,resizeAriaLabel:u,initiallyExpanded:!0,title:f,onOpenChange:_o,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 _o(e){e||ae.getState().close()}function vo(e){return e.target}function yo(){let e=J(e=>e.projects.find(t=>t.id===e.activeProjectId)),t=K(e=>e.remoteSession),n=!!e?.hostId,r=Ze(),i=et(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?$e(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=Ke(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=tt(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:R(t=>{if(!e?.hostId||!p)throw Error(`Remote Host scope unavailable`);K.getState().openRemoteSession(e,p,t)}),refresh:R(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 bo=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=U(`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=U(`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 xo(e){let t=(0,Q.c)(17),{scope:n,children:r}=e,{t:i}=rt();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)(Ve.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)(F,{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 So(e){let t=(0,Q.c)(58),{scope:n,onOpenSessions:r,menuOpen:i,onToggleMenu:a,surfaceShortcuts:o}=e,{t:s}=rt(),[c,l]=Z.useState(!1),u;t[0]===r?u=t[1]:(u=()=>{l(!1),r()},t[0]=r,t[1]=u);let d=R(u),f;t[2]===a?f=t[3]:(f=()=>{l(!1),a()},t[2]=a,t[3]=f);let p=R(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=R(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)(W,{name:`folders`,className:`size-5`}),t[17]=x):x=t[17];let S;t[18]!==d||t[19]!==b?(S=(0,$.jsx)(H,{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)(W,{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)(Fi,{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)(H,{variant:`ghost`,size:`icon`,"aria-label":s(`mobile.menu.files`),"aria-pressed":o.activePanel===`files`,onClick:o.onToggleFiles,children:(0,$.jsx)(W,{name:`file-text`,className:`size-5`})}),(0,$.jsxs)(H,{variant:`ghost`,size:`icon`,className:`relative`,"aria-label":s(`mobile.menu.changes`),"aria-pressed":o.activePanel===`changes`,onClick:o.onToggleChanges,children:[(0,$.jsx)(W,{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)(W,{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)(H,{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)(bo,{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)(xo,{scope:n,children:I}),t[55]=n,t[56]=I,t[57]=L):L=t[57],L}var Co=`yuri:assistant-share-welcome:v1`,wo=[{image:Ri,titleKey:`assistants.shareWelcome.example.chat.title`,descriptionKey:`assistants.shareWelcome.example.chat.description`},{image:zi,titleKey:`assistants.shareWelcome.example.article.title`,descriptionKey:`assistants.shareWelcome.example.article.description`},{image:Bi,titleKey:`assistants.shareWelcome.example.note.title`,descriptionKey:`assistants.shareWelcome.example.note.description`}],To=e=>{let t=(0,Q.c)(40),{enabled:n,open:r,onOpenChange:i}=e,a=n!==void 0&&n,{t:o}=rt(),[s,c]=L(Co,!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=R(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)(W,{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)(vt,{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)(yt,{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)(ht,{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=wo.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)(W,{name:`arrow-right-s`,className:`size-4`}),t[28]=w):w=t[28];let T;t[29]!==f||t[30]!==C?(T=(0,$.jsx)(gt,{className:`border-t border-border px-5 py-4 sm:px-8 sm:py-5`,children:(0,$.jsxs)(H,{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)(_t,{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)(bt,{open:u,onOpenChange:p,children:E}),t[36]=u,t[37]=E,t[38]=p,t[39]=D):D=t[39],D},Eo=ee(`YuriNativeHeader`),Do=`header.yuri-mobile-detail-navigation, header.yuri-mobile-header`,Oo=`yuri-native-header-source`,ko=`yuri-native-header-ready`,Ao=new Set([ko,`yuri-keyboard-open`,`yuri-kb-animating`,`yuri-kb-hide`,`yuri-kb-caret-hold`]),jo=`--yuri-native-viewport-top`,Mo=`.fixed, [role="dialog"]`,No=new Set([`style`,`data-yuri-header-collapse-phase`,`data-yuri-header-collapse-rest`]),Po=()=>parseFloat(document.documentElement.style.getPropertyValue(`--yuri-native-viewport-top`))||0,Fo=`[data-avatar-motion]`,Io=new Set([`class`,`style`,`inert`,`aria-hidden`,`hidden`]),Lo=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-Po();return e.dataset.yuriCollapsibleHeader===`true`||Math.abs(n)<=1},Ro=(e,t)=>{let n=[...document.querySelectorAll(Do)].filter(Lo);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},zo=()=>{let e=[];for(let t of document.styleSheets)try{for(let n of t.cssRules)e.push(n.cssText)}catch{}return e.join(`
3
- `)},Bo=()=>{let e=0;for(let t of document.styleSheets)try{e+=t.cssRules.length}catch{}return`${document.styleSheets.length}:${e}`},Vo=Eo,Ho=()=>new Promise(e=>{requestAnimationFrame(()=>requestAnimationFrame(()=>e(1)))});function Uo(){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(ko),u&&(u=!1,o=``,Eo.update({seq:++r,visible:!1}).catch(()=>void 0))},h=()=>{if(i=0,n)return;let t=Ro(a,d);if(t!==a){if(a?.classList.remove(Oo),m(),a=t,l=``,!t)return;t.classList.add(Oo),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(Mo)===null?Math.ceil(Math.max(h,g)*f):_,y=(h+2*(parseFloat(getComputedStyle(e).fontSize)||16))*f,b=t.cloneNode(!0);b.classList.remove(Oo),b.style.removeProperty(zn),delete b.dataset.yuriHeaderCollapsePhase,delete b.dataset.yuriHeaderCollapseRest;for(let e of b.querySelectorAll(Mo))e.style.display=`none`;let x=b.outerHTML,S=[...e.classList].filter(e=>!Ao.has(e)).join(` `),C=(e.getAttribute(`style`)??``).replace(RegExp(`${jo}\\s*:[^;]*;?`,`g`),``),w=document.body.className,T=`${x}|${S}|${C}|${w}|${v}|${y}`,E=Bo(),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=zo()),D!==c&&(c=D,O.sprite=D),u=!0,Eo.update(O).catch(()=>void 0)},g=()=>{!i&&!n&&(i=requestAnimationFrame(h))};f.push(Eo.addListener(`shown`,t=>{d&&t.seq===r&&a&&e.classList.add(ko)})),f.push(Eo.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`&&No.has(n.attributeName??``)){p();continue}let e=n.target instanceof Element?n.target:n.target.parentElement;if(!(e?.closest(Fo)&&a.contains(e))){if(a.contains(n.target)||n.type===`attributes`&&n.target.contains(a))t=!0;else if(n.type===`attributes`&&Io.has(n.attributeName??``)&&n.target instanceof Element&&n.target.querySelector(Do))t=!0;else if(n.type===`childList`)for(let e of n.addedNodes)e instanceof Element&&(e.matches(Do)||e.querySelector(Do))&&(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(jo,`${Math.max(0,t)}px`),Ho());let b=window;return b.__yuriNativeHeader=t=>(d=t,e.classList.toggle(ko,t&&a!==null),Ho()),()=>{n=!0,delete b.__yuriNativeHeader,i&&cancelAnimationFrame(i),_.disconnect(),v.disconnect(),y.disconnect(),window.removeEventListener(`resize`,g),delete t.__yuriImeOffset,e.classList.remove(ko),a?.classList.remove(Oo),a=null;for(let e of f)e.then(e=>e.remove()).catch(()=>void 0);Eo.update({seq:++r,visible:!1}).catch(()=>void 0)}}var Wo=`.yuri-mobile-composer`,Go=`[data-btw-composer]`;function Ko(e,t){if(!e)return!1;let n=t;return!n||typeof n.closest!=`function`||!n.closest(Go)}function qo(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.closest==`function`&&!!t.closest(Wo)}function Jo(e){return qo(e??null)}var Yo=S(e=>({expandedParents:{},toggleParent:t=>e(e=>{let n={...e.expandedParents};return n[t]?delete n[t]:n[t]=!0,{expandedParents:n}})})),Xo=36,Zo=18,Qo=e=>e.parentID??null,$o=e=>(e||``).replace(/\\/g,`/`).replace(/\/+$/g,``),es=e=>{let t=e;return $o(t.directory??t.project?.worktree??null)},ts=e=>{let t=$o(e);if(!t)return``;let n=t.split(`/`).filter(Boolean);return n[n.length-1]||t},ns=e=>{let t=e.time?.updated??e.time?.created,n=typeof t==`number`?t:Number(t);return Number.isFinite(n)&&n>0?n:0},rs=(e,t)=>e.size===t.size&&[...e].every(e=>t.has(e)),is=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))},as=(e,t)=>{let n=$o(e),r=$o(t);return!!(n&&r&&(n===r||n.startsWith(`${r}/`)))},os=(e,t)=>e.worktrees.find(e=>$o(e.path)===t)??null,ss=(e,t)=>t===e.path||!!os(e,t),cs=(e,t)=>{let n=$o(t);return n?e.find(e=>ss(e,n))??null:null},ls=(e,t,n)=>!n||`${e.title??``} ${e.id} ${es(e)} ${t}`.toLowerCase().includes(n),us=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?Jn[n.icon]:null,c=n.color?Yn[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)(W,{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=U(`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)(qn,{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},ds=e=>{let t=(0,Q.c)(5),{expanded:n}=e,r=n?`rotate-0`:`-rotate-90`,i;t[0]===r?i=t[1]:(i=U(`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)(W,{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},fs=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},ps=e=>{let t=(0,Q.c)(12),{onClick:n,className:r}=e,{t:i}=rt(),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=U(`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)(W,{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},ms=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)(W,{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)(H,{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},hs=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}=rt(),x;t[0]===n?x=t[1]:(x=is(ns(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=U(`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)(W,{name:`arrow-down-s`,className:U(`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=U(`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=U(`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=U(`block min-w-0 flex-1 truncate typography-ui-label`,f),t[54]=f,t[55]=F),I=g?Mn(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 te;t[59]===S?te=t[60]:(te=S?(0,$.jsx)(`span`,{className:`shrink-0 typography-micro text-muted-foreground tabular-nums`,children:S}):null,t[59]=S,t[60]=te);let ne;t[61]!==B||t[62]!==te||t[63]!==L||t[64]!==R?(ne=(0,$.jsxs)(`span`,{className:L,children:[R,B,te]}),t[61]=B,t[62]=te,t[63]=L,t[64]=R,t[65]=ne):ne=t[65];let re;t[66]!==a||t[67]!==g?(re=a?(0,$.jsx)(`span`,{className:`block truncate typography-micro text-muted-foreground pl-4`,children:g?Mn(a,g):a}):null,t[66]=a,t[67]=g,t[68]=re):re=t[68];let ie;t[69]!==ne||t[70]!==re||t[71]!==ee?(ie=(0,$.jsxs)(`span`,{className:ee,children:[ne,re]}),t[69]=ne,t[70]=re,t[71]=ee,t[72]=ie):ie=t[72];let ae;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]!==ie?(ae=(0,$.jsx)(`button`,{type:C,className:w,style:T,onClick:E,onPointerDown:D,onPointerMove:O,onPointerUp:k,onPointerCancel:A,onContextMenu:j,disabled:M,children:ie}),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]=ie,t[84]=ae):ae=t[84];let oe;t[85]!==p||t[86]!==m?(oe=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)(hi,{})}):null,t[85]=p,t[86]=m,t[87]=oe):oe=t[87];let V;t[88]===b?V=t[89]:(V=b(`sessions.sidebar.session.menu.label`),t[88]=b,t[89]=V);let se;t[90]===Symbol.for(`react.memo_cache_sentinel`)?(se=(0,$.jsx)(W,{name:`more-2`,className:`size-4`}),t[90]=se):se=t[90];let G;t[91]!==h.onOpenActions||t[92]!==V?(G=(0,$.jsx)(H,{variant:`ghost`,size:`icon`,"data-session-drag-ignore":!0,"aria-label":V,onClick:h.onOpenActions,children:se}),t[91]=h.onOpenActions,t[92]=V,t[93]=G):G=t[93];let ce;t[94]!==_||t[95]!==f||t[96]!==d||t[97]!==b||t[98]!==z?(ce=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)(W,{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)(W,{name:`close`,className:`size-4`}):(0,$.jsx)(W,{name:`archive`,className:`size-4`})})]}):null,t[94]=_,t[95]=f,t[96]=d,t[97]=b,t[98]=z,t[99]=ce):ce=t[99];let le;return t[100]!==N||t[101]!==P||t[102]!==ae||t[103]!==oe||t[104]!==G||t[105]!==ce?(le=(0,$.jsxs)(`div`,{className:N,children:[P,ae,oe,G,ce]}),t[100]=N,t[101]=P,t[102]=ae,t[103]=oe,t[104]=G,t[105]=ce,t[106]=le):le=t[106],le},gs=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}=rt();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)(W,{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:U(`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)(W,{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},_s=({open:e,onOpenChange:t,variant:n=`sheet`})=>{let{t:r}=rt(),{git:i}=P(),a=Me(),o=he(),s=ve(e=>e.activeSessions),c=ve(e=>e.activePaginationByDirectory),l=J(e=>e.projects),u=Z.useMemo(()=>l.filter(e=>!e.hostId),[l]),d=l.some(e=>!!e.hostId),f=et(e&&d),p=f.catalog?.projects??[],m=J(e=>e.activeProjectId),h=D(e=>e.currentDirectory),g=je(e=>e.currentSessionId),_=je(e=>e.availableWorktreesByProject),v=je(e=>e.setCurrentSession),y=je(e=>e.archiveSession),b=je(e=>e.archiveSessions),x=je(e=>e.updateSessionTitle),S=je(e=>e.requestSessionSmartTitle),C=je(e=>e.shareSession),w=je(e=>e.unshareSession),T=je(e=>e.openNewSessionDraft),E=J(e=>e.setActiveProject),O=J(e=>e.setActiveProjectIdOnly),k=J(e=>e.removeProject),A=ge();jr();let j=Ne(e=>e.sessionOrderByScope),M=Ne(e=>e.sessionOrderActivityByScope),N=_e(),F=hr(e=>e.projectExpanded),I=hr(e=>e.worktreeExpanded),L=hr(e=>e.setProjectExpanded),ee=hr(e=>e.setWorktreeExpanded),z=Te(e=>e.orderByProject),B=Yo(e=>e.expandedParents),te=Yo(e=>e.toggleParent),[ne,re]=Z.useState(``),[ie,ae]=Z.useState(null),[oe,V]=Z.useState(null),[se,G]=Z.useState(0),[ue,de]=Z.useState(!1),[K,pe]=Z.useState(!1),[me,q]=Z.useState(null),[Y,ye]=Z.useState(null),be=Y?.kind===`session`?Y.session:null,{unread:xe,onToggleRead:Ce}=Pr(be,be?es(be):void 0),[we,De]=Z.useState(null),[Oe,Ae]=Z.useState(null),[Pe,Fe]=Z.useState(null),[Ie,Le]=Z.useState(``),[Re,ze]=Z.useState(!1),[Be,Ve]=Z.useState(null),He=Z.useRef(null);He.current||=Kr({onPressedKeyChange:Ae});let[Ue,We]=Z.useState(new Set),[Ge,Ke]=Z.useState(new Map),[qe,Je]=Z.useState(new Map),Ye=fr(),Ze=Or(),Qe=R(e=>{Vn(e),Ee(e)}),$e=R(e=>{Promise.all(e.map(e=>(Vn(e),Ee(e))))});Z.useEffect(()=>{if(!e){re(``),Je(new Map),ae(null),V(null),ye(null),Fe(null),Ve(null),He.current?.reset();return}},[e]),Z.useEffect(()=>()=>{He.current?.reset()},[]),Z.useEffect(()=>{if(!e)return;if(u.length===0){je.setState(e=>{let t=Hr(e.availableWorktreesByProject,new Set,[]);return t===e.availableWorktreesByProject?{}:{availableWorktreesByProject:t,availableWorktrees:[]}}),We(e=>e.size===0?e:new Set),Ke(e=>e.size===0?e:new Map);return}let t=!1;return(async()=>{let e=await Promise.all(u.map(async e=>{let n=$o(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([Gn({id:e.id,path:n},{isCurrent:()=>!t}),Kn(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=>$o(e.path)).filter(Boolean)),r=e.flatMap(e=>e?.worktreeStatus?[{path:e.path,status:e.worktreeStatus,worktrees:e.worktrees}]:[]);je.setState(e=>{let t=Hr(e.availableWorktreesByProject,n,r);return t===e.availableWorktreesByProject?{}:{availableWorktreesByProject:t,availableWorktrees:Array.from(t.values()).flat()}}),We(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 rs(r,t)?t:r}),Ke(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,se]);let tt=Z.useMemo(()=>u.map(e=>({id:e.id,label:ts(e.path),path:$o(e.path),icon:e.icon,color:e.color,iconImage:e.iconImage,iconBackground:e.iconBackground,isGitRepo:Ue.has($o(e.path)),worktrees:Xe(z[e.id],_.get($o(e.path))??[])})),[Ue,u,z,_]),nt=Z.useMemo(()=>{let e=new Map(o.map(e=>[e.id,e])),t=s.map(t=>{let n=e.get(t.id);return n?Se(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]),it=ne.trim().toLowerCase(),at=Z.useMemo(()=>{let e=tt.map(e=>({project:e,buckets:[],totalSessions:0,isActive:e.id===m})),t=(e,t,n)=>{let r=$o(t)||e.project.path,i=r||`__root__`,a=e.buckets.find(e=>e.key===i);return a||(a={key:i,label:n?.branch||ts(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 nt){let r=es(n);if(!r)continue;let i=$o(r),a=e.find(e=>ss(e.project,i));if(!a)continue;let o=os(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=$o(e.path),r=gi(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)Qo(n)||(t.totalSessions+=1)}return e},[m,tt,nt,j,M,A]),ot=$o(h),ct=e=>e.isActive?ot===e.project.path?e.project.path:e.project.worktrees.find(e=>as(ot,e.path))?.path??e.project.path:null,lt=e=>F[e.project.id]??!0,ut=(e,t)=>I[`${e.project.id}::${t.key}`]??!1,ft=e=>{Je(t=>{if(!t.has(e))return t;let n=new Map(t);return n.delete(e),n})},mt=()=>{ye(null),He.current?.reset()},ht=e=>({onOpenActions:()=>ye(e),pressed:Oe===e.key||Y?.key===e.key,onPointerDown:t=>{e.kind!==`session`&&(t.pointerType!==`touch`&&t.pointerType!==`pen`||t.button!==0||He.current?.start({pointerId:t.pointerId,key:e.key,clientX:t.clientX,clientY:t.clientY,onTrigger:()=>ye(e)}))},onPointerMove:e=>{He.current?.move(e.pointerId,e.clientX,e.clientY)},onPointerUp:e=>{He.current?.end(e.pointerId)},onPointerCancel:e=>{He.current?.cancel(e.pointerId)},onContextMenu:t=>{t.preventDefault(),t.stopPropagation(),e.kind!==`session`&&He.current?.openFromContextMenu(e.key,()=>ye(e))}}),gt=(e,t)=>{He.current?.consumeClick(e)||t()},_t=(e,t,n,r)=>{let i=mi(),a=zr();if(Je(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=$o(t);if(!o)return;let s=ve.getState().activePaginationByDirectory.get(o);s?.hasMore&&!s.loadingMore&&ke(o)},vt=(e,t,n)=>{let i=`${e.project.id}::${t.key}`,a=mi(),o=new Set(t.sessions.map(e=>e.id)),s=new Map;for(let e of t.sessions){let t=Qo(e);if(t&&o.has(t)){let n=s.get(t)??[];n.push(e),s.set(t,n)}}let l=t.sessions.filter(e=>!Qo(e)),u=qe.get(i)??a,d=Er(l,u,Ze),f=l.length-d.length,p=c.get($o(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=!!B[e.id],o=Ye.has(e.id),c=i&&!a?n.filter(e=>Ye.has(e.id)).map(e=>e.id):[],l=c.length>0,u=o?[e.id,...c]:c,d=e.title?.trim()||r(`mobile.sessions.untitled`),f=`session:${e.id}`;return(0,$.jsxs)(Z.Fragment,{children:[(0,$.jsx)(hs,{session:e,active:g===e.id,indent:t,hasChildren:i,expanded:a,onToggleChildren:i?()=>te(e.id):void 0,confirmingArchive:oe===e.id,onSelect:()=>gt(f,()=>xt(e)),onRequestArchive:()=>St(e.id),onConfirmArchive:()=>void Ct(e),onStop:o||l?()=>$e(u):void 0,stopAriaLabel:r(l?`mobile.sessions.stopSubsessionsAria`:`mobile.sessions.stopSessionAria`,{title:d}),longPressHandlers:ht({key:f,kind:`session`,session:e})}),i&&a?n.map(e=>v(e,t+Zo)):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)(kr,{scopeKey:oe?null:$o(t.path),sessionIds:d.map(e=>e.id),folderIdBySessionId:new Map(d.map(e=>[e.id,Ne.getState().getSessionFolderId($o(t.path),e.id)])),onSessionDroppedOnFolder:()=>{},onSessionsReordered:(e,n)=>{Ne.getState().reorderSessions($o(t.path),d.map(e=>e.id),e,n,ur(t.sessions)).catch(()=>X.error(r(`sessions.order.saveFailed`)))},children:d.map(e=>oe?v(e,n):(0,$.jsx)(Ar,{sessionId:e.id,sessionDirectory:t.path,sessionTitle:e.title??``,children:v(e,n)},e.id))}),(0,$.jsx)(gs,{indent:n,showMore:f>0||m,showFewer:_,loadingMore:h,onShowMore:()=>_t(i,t.path,u,l.length),onShowFewer:()=>ft(i)})]})},yt=(e,t)=>{L(e,!t)},bt=(e,t,n)=>{ee(`${e}::${t}`,!n)},xt=e=>{pt();let n=es(e)||null,r=cs(tt,n??``);r&&O(r.id),v(e.id,n),t(!1)},St=e=>{V(t=>t===e?null:e)},Ct=async e=>{V(null),await y(e.id)?Mr({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`)}):X.error(r(`sessions.sidebar.session.archive.error`))},wt=()=>{T(),t(!1)},Tt=e=>{q(e),O(e),pe(!0)},Et=e=>{let t=new Map;for(let e of nt){let n=Qo(e);if(!n)continue;let r=t.get(n)??[];r.push(e.id),t.set(n,r)}let n=[],r=new Set,i=e=>{if(!r.has(e)){r.add(e),n.push(e);for(let n of t.get(e)??[])i(n)}};return i(e),n},Dt=async e=>{let t=Et(e.id),{archivedIds:n,failedIds:i}=await b(t);n.length>0&&Mr({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&&X.error(i.length===1?r(`sessions.sidebar.bulkActions.failedArchiveSingle`,{count:i.length}):r(`sessions.sidebar.bulkActions.failedArchivePlural`,{count:i.length}))},Ot=e=>{let t=Et(e.id);Wr({sessionIds:t,message:t.length===1?r(`sessions.sidebar.session.delete.success`):r(`sessions.sidebar.bulkActions.deletedPlural`,{count:t.length}),undoLabel:r(`sessions.sidebar.undo`),commitFailedMessage:r(`sessions.sidebar.session.delete.error`)})},kt=async e=>{try{if(!(await C(e.id))?.share?.url){X.error(r(`sessions.sidebar.session.share.error`));return}X.success(r(`sessions.sidebar.session.share.successTitle`),{description:r(`sessions.sidebar.session.share.successDescription`)})}catch{X.error(r(`sessions.sidebar.session.share.error`))}},At=async e=>{if((await fe(e)).ok){X.success(r(`sessions.sidebar.session.menu.copied`));return}X.error(r(`sessions.sidebar.session.share.copyUrlError`))},jt=async e=>{try{if(await w(e)){X.success(r(`sessions.sidebar.session.unshare.success`));return}X.error(r(`sessions.sidebar.session.unshare.error`))}catch{X.error(r(`sessions.sidebar.session.unshare.error`))}},Mt=async()=>{if(!Pe)return;let e=Ie.trim();if(e)try{await x(Pe.id,e),Fe(null),Le(``)}catch{X.error(r(`sessions.sidebar.session.menu.rename`),{description:r(`sessions.sidebar.dialogs.deleteResult.tryAgain`)})}},Nt=async()=>{if(!Pe||Re)return;let e=Pe.id;Fe(null),Le(``),ze(!0);try{await S(e)}catch{X.error(r(`sessions.sidebar.session.rename.smartTitle`),{description:r(`sessions.sidebar.dialogs.deleteResult.tryAgain`)})}finally{ze(!1)}},Pt=(e,n)=>{O(e.id),T({selectedProjectId:e.id,directoryOverride:n,preserveDirectoryOverride:!0}),t(!1)},Ft=e=>{(async()=>{try{await Gn({id:e.id,path:e.path})}catch(e){console.warn(`[MobileSessions] Worktree refresh before session sync failed:`,e)}let t=je.getState().availableWorktreesByProject.get(e.path)??e.worktrees,n=[e.path,...t.map(e=>e.path)];await le(n,nt)})()},It=e=>{let t=es(e),n=cs(tt,t);if(!n)return ts(t)||t;let r=os(n,$o(t));return r?.branch?`${n.label} · ${r.branch}`:n.label},Lt=e=>{E(e.id),t(!1)},Rt=Z.useMemo(()=>it?at.filter(e=>`${e.project.label} ${e.project.path}`.toLowerCase().includes(it)?!0:e.buckets.some(t=>t.sessions.some(t=>ls(t,e.project.label,it)))):at,[it,at]),zt=Z.useMemo(()=>it?nt.filter(e=>{let t=es(e);return ls(e,cs(tt,t)?.label??``,it)}).sort((e,t)=>ce(t)-ce(e)):[],[it,tt,nt]),Bt=Z.useMemo(()=>it?tt.filter(e=>`${e.label} ${e.path}`.toLowerCase().includes(it)).map(e=>({...e,sessionCount:nt.filter(t=>!Qo(t)&&ss(e,$o(es(t)))).length})):[],[it,tt,nt]),Vt=it&&zt.length===0&&Bt.length===0,Ht=tt.length>0?(0,$.jsxs)(H,{type:`button`,variant:`default`,size:`sm`,"aria-label":r(`mobile.sessions.newChat`),onClick:wt,style:{touchAction:`manipulation`},children:[(0,$.jsx)(W,{name:`add`,className:`size-4`}),r(`mobile.sessions.newChat`)]}):null,Ut=tt.find(e=>e.id===m)??null,Wt=Ut?.isGitRepo?(0,$.jsx)(H,{type:`button`,variant:`chip`,size:`sm`,"aria-label":r(`sessions.sidebar.project.actions.newWorktree`),title:r(`sessions.sidebar.project.actions.newWorktree`),onClick:()=>Tt(Ut.id),style:{touchAction:`manipulation`},children:(0,$.jsx)(W,{name:`node-tree`,className:`size-4`})}):null,Kt=(0,$.jsx)(H,{type:`button`,variant:`chip`,size:`sm`,"aria-label":r(`sessions.sidebar.header.actions.addProject`),title:r(`sessions.sidebar.header.actions.addProject`),onClick:()=>de(!0),style:{touchAction:`manipulation`},children:(0,$.jsx)(W,{name:`folder-add`,className:`size-4`})}),qt=Ht||Kt?(0,$.jsxs)($.Fragment,{children:[Ht,Wt,Kt]}):null,Jt=Y?.kind===`project`?Y.project.label:Y?.kind===`worktree`?Y.worktree.branch||Y.worktree.label||Y.worktree.path:Y?.kind===`session`?Y.session.title?.trim()||r(`mobile.sessions.untitled`):``,Yt=Z.useMemo(()=>{if(!Y)return[];if(Y.kind===`project`){let e=Y.project;return ri({gitRepository:e.isGitRepo,onNewSession:()=>{mt(),Pt(e,e.path)},onNewWorktree:()=>{mt(),Tt(e.id)},onSyncSessions:()=>{mt(),Ft(e)},onEditProject:()=>{mt(),ae(e.id)},onCloseProject:()=>{mt(),De(e)}})}if(Y.kind===`worktree`){let{project:e,worktree:t}=Y;return Lr({onNewSession:()=>{mt(),Pt(e,t.path)},onDeleteWorktree:()=>{mt(),Ve({project:e,worktree:t})}})}let e=Y.session,t=!!e.share?.url;return ui({pinned:A.has(e.id),shared:t,unread:xe,onToggleRead:Ce?()=>{mt(),Ce()}:void 0,onRename:()=>{mt(),Le(e.title?.trim()||r(`mobile.sessions.untitled`)),Fe(e)},onTogglePin:()=>{mt(),N(e.id)},onShare:!a||t?void 0:()=>{mt(),kt(e)},onCopyLink:a&&t?()=>{let t=e.share?.url;mt(),t&&At(t)}:void 0,onUnshare:a&&t?()=>{mt(),jt(e.id)}:void 0,onArchive:()=>{mt(),Dt(e)},onDelete:()=>{mt(),Ot(e)}})},[Y,xe,mt,Dt,At,Ot,Tt,kt,jt,Ce,A,Pt,Ft,r,N]),Xt=Yt.length>0?(0,$.jsx)(`div`,{className:`flex flex-col gap-1`,children:Yt.map(e=>{let t=(0,$.jsx)(ms,{icon:e.icon,label:Zr(e,r),destructive:e.destructive,onClick:e.onClick},e.id);return e.separated?(0,$.jsx)(`div`,{className:Y?.kind===`project`?`border-t border-[var(--yuri-popup-divider)]`:`mt-3 border-t border-[var(--surface-subtle)] pt-3`,children:t},e.id):t})}):null,Zt=(0,$.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,$.jsx)(`div`,{className:`shrink-0 px-4 pb-2 pt-1`,children:(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(W,{name:`search`,className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-muted-foreground`}),(0,$.jsx)(Gt,{value:ne,onChange:e=>re(e.target.value),placeholder:r(`mobile.sessions.search.placeholder`),className:U(`h-11 pl-9`,ne&&`pr-10`)}),ne?(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:()=>re(``),style:{touchAction:`manipulation`},children:(0,$.jsx)(W,{name:`close`,className:`size-4`})}):null]})}),(0,$.jsxs)(st,{className:`overlay-scrollbar-container min-h-0 flex-1 overflow-y-auto pb-4`,children:[d&&f.registry&&p.map(e=>(0,$.jsx)(ni,{project:e,registry:f.registry,search:ne,mobile:!0,reorderEnabled:!1},e.id)),tt.length===0&&!d?(0,$.jsx)(vs,{title:r(`mobile.sessions.empty.noProjectsTitle`),description:r(`mobile.sessions.empty.noProjectsDescription`),action:(0,$.jsxs)(H,{type:`button`,size:`lg`,onClick:()=>de(!0),children:[(0,$.jsx)(W,{name:`folder-add`,className:`size-4`}),r(`sessions.sidebar.header.actions.addProject`)]})}):Vt&&!d?(0,$.jsx)(vs,{title:r(`mobile.sessions.empty.searchTitle`),description:r(`mobile.sessions.empty.searchDescription`)}):it?(0,$.jsxs)(`div`,{className:`flex flex-col gap-3 px-3 pt-2`,children:[zt.length>0?(0,$.jsxs)(`section`,{children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between px-1 pb-1.5`,children:[(0,$.jsx)(`span`,{className:`typography-micro font-semibold uppercase tracking-wider text-muted-foreground`,children:r(`mobile.sessions.search.section.sessions`)}),(0,$.jsx)(`span`,{className:`typography-micro text-muted-foreground tabular-nums`,children:zt.length})]}),(0,$.jsx)(`div`,{className:`overflow-hidden rounded-2xl border border-border/40 bg-[var(--surface-elevated)]`,children:zt.map((e,t)=>{let n=Ye.has(e.id),i=e.title?.trim()||r(`mobile.sessions.untitled`);return(0,$.jsx)(`div`,{className:U(t>0&&`border-t border-border/30`),children:(0,$.jsx)(hs,{session:e,active:g===e.id,indent:12,contextLabel:It(e),highlightQuery:it,onSelect:()=>gt(`session:${e.id}`,()=>xt(e)),longPressHandlers:ht({key:`session:${e.id}`,kind:`session`,session:e}),onStop:n?()=>Qe(e.id):void 0,stopAriaLabel:r(`mobile.sessions.stopSessionAria`,{title:i})})},e.id)})})]}):null,Bt.length>0?(0,$.jsxs)(`section`,{children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between px-1 pb-1.5`,children:[(0,$.jsx)(`span`,{className:`typography-micro font-semibold uppercase tracking-wider text-muted-foreground`,children:r(`mobile.sessions.search.section.projects`)}),(0,$.jsx)(`span`,{className:`typography-micro text-muted-foreground tabular-nums`,children:Bt.length})]}),(0,$.jsx)(`div`,{className:`overflow-hidden rounded-2xl border border-border/40 bg-[var(--surface-elevated)]`,children:Bt.map((e,t)=>{let n=`project:${e.id}`,r=ht({key:n,kind:`project`,project:e});return(0,$.jsxs)(`div`,{className:U(`flex items-center`,t>0&&`border-t border-border/30`),children:[(0,$.jsxs)(`button`,{type:`button`,className:U(`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:()=>gt(n,()=>Lt(e)),onPointerDown:r.onPointerDown,onPointerMove:r.onPointerMove,onPointerUp:r.onPointerUp,onPointerCancel:r.onPointerCancel,onContextMenu:r.onContextMenu,style:{touchAction:`manipulation`},children:[(0,$.jsx)(us,{project:e}),(0,$.jsx)(`span`,{className:`block min-w-0 flex-1 truncate typography-ui-label text-foreground`,children:Mn(e.label,it)}),(0,$.jsx)(`span`,{className:`shrink-0 typography-micro text-muted-foreground tabular-nums`,children:e.sessionCount})]}),e.isGitRepo?(0,$.jsx)(ps,{className:`mr-2`,onClick:()=>Tt(e.id)}):null]},e.id)})})]}):null]}):(0,$.jsx)(`div`,{className:`flex flex-col`,children:Rt.map((e,t)=>{let n=lt(e),i=`project:${e.project.id}`,a=ht({key:i,kind:`project`,project:e.project}),o=it?e.buckets.filter(t=>t.sessions.some(t=>ls(t,e.project.label,it))):e.buckets,s=ct(e);return(0,$.jsxs)(`section`,{className:U(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:U(`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:()=>gt(i,()=>yt(e.project.id,n)),onPointerDown:a.onPointerDown,onPointerMove:a.onPointerMove,onPointerUp:a.onPointerUp,onPointerCancel:a.onPointerCancel,onContextMenu:a.onContextMenu,"aria-expanded":n,"aria-label":r(n?`sessions.sidebar.group.collapseAria`:`sessions.sidebar.group.expandAria`,{label:e.project.label}),style:{touchAction:`manipulation`},children:[(0,$.jsx)(us,{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}),Ge.get(e.project.id)?(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1 typography-micro text-muted-foreground`,children:[(0,$.jsx)(W,{name:`git-branch`,className:`size-3 shrink-0`}),(0,$.jsx)(`span`,{className:`truncate`,children:Ge.get(e.project.id)})]}):null]}),e.isActive?(0,$.jsx)(fs,{ariaLabel:r(`mobile.sessions.activeProjectAria`)}):null,(0,$.jsx)(`span`,{className:`shrink-0 typography-micro text-muted-foreground tabular-nums`,children:e.totalSessions})]}),(()=>{let t=n?[]:[...new Set(e.buckets.flatMap(e=>e.sessions.filter(e=>Ye.has(e.id)).map(e=>e.id)))];return t.length>0?(0,$.jsx)(`button`,{type:`button`,className:`flex size-9 shrink-0 items-center justify-center rounded-full text-[var(--surface-mutedForeground)] transition-colors hover:bg-[var(--interactive-hover)] hover:text-[var(--surface-foreground)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--interactive-focus-ring)] mr-1`,"aria-label":r(`mobile.sessions.stopGroupAria`,{label:e.project.label}),onClick:e=>{e.stopPropagation(),$e(t)},style:{touchAction:`manipulation`},children:(0,$.jsx)(hi,{})}):null})(),e.project.isGitRepo?(0,$.jsx)(ps,{className:`mr-2`,onClick:()=>Tt(e.project.id)}):null]}),n?(0,$.jsx)(`div`,{className:`pb-2`,children:(()=>{let t=o.find(e=>e.worktree===null),n=o.filter(e=>e.worktree!==null);return(0,$.jsxs)($.Fragment,{children:[t&&(t.sessions.length>0||n.length===0)?vt(e,t,Xo):null,n.map(t=>{let n=ut(e,t),i=s===t.path,a=`worktree:${e.project.id}:${t.key}`,o=ht({key:a,kind:`worktree`,project:e.project,worktree:t.worktree});return(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`button`,{type:`button`,className:U(`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:()=>gt(a,()=>bt(e.project.id,t.key,n)),onPointerDown:o.onPointerDown,onPointerMove:o.onPointerMove,onPointerUp:o.onPointerUp,onPointerCancel:o.onPointerCancel,onContextMenu:o.onContextMenu,"aria-expanded":n,"aria-label":r(n?`sessions.sidebar.group.collapseAria`:`sessions.sidebar.group.expandAria`,{label:t.label}),style:{touchAction:`manipulation`},children:[(0,$.jsx)(ds,{expanded:n}),(0,$.jsx)(W,{name:`node-tree`,className:U(`size-4 shrink-0`,i?`text-primary`:`text-muted-foreground`)}),(0,$.jsx)(`span`,{className:U(`block min-w-0 flex-1 truncate typography-ui-label font-semibold`,i?`text-foreground`:`text-foreground/90`),children:t.label}),i?(0,$.jsx)(fs,{ariaLabel:r(`mobile.sessions.activeWorktreeAria`)}):null,(()=>{let e=n?[]:t.sessions.filter(e=>Ye.has(e.id)).map(e=>e.id);return e.length>0?(0,$.jsx)(`button`,{type:`button`,className:`flex size-9 shrink-0 items-center justify-center rounded-full text-[var(--surface-mutedForeground)] transition-colors hover:bg-[var(--interactive-hover)] hover:text-[var(--surface-foreground)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--interactive-focus-ring)]`,"aria-label":r(`mobile.sessions.stopGroupAria`,{label:t.label}),onClick:t=>{t.stopPropagation(),$e(e)},style:{touchAction:`manipulation`},children:(0,$.jsx)(hi,{})}):null})(),(0,$.jsx)(`span`,{className:`shrink-0 typography-micro text-muted-foreground tabular-nums`,children:t.sessions.length})]}),n?vt(e,t,Xo):null]},t.key)})]})})()}):null]},e.project.id)})})]}),(0,$.jsx)(Cr,{open:ue,onOpenChange:de,forceMobile:!0}),(0,$.jsx)(Ln,{open:K,projectId:me,onOpenChange:e=>{pe(e),e||q(null)},onWorktreeCreated:(e,n)=>{n?.sessionId?v(n.sessionId,e):T({selectedProjectId:me,directoryOverride:e,preserveDirectoryOverride:!0}),t(!1)}}),(0,$.jsx)(Hn,{open:!!Y,title:Jt,onClose:mt,contentMaxHeightClassName:`max-h-[min(68dvh,560px)]`,children:Xt}),(0,$.jsx)(Hn,{open:!!we,title:r(`sessions.sidebar.project.actions.closeProject`),onClose:()=>De(null),closeAriaLabel:r(`mobile.surface.closeAria`),footer:(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[(0,$.jsx)(H,{type:`button`,variant:`ghost`,className:`flex-1`,onClick:()=>De(null),children:r(`sessions.sidebar.dialogs.cancel`)}),(0,$.jsx)(H,{type:`button`,variant:`destructive`,className:`flex-1`,onClick:()=>{if(!we)return;let e=we;De(null),k(e.id),X.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:we?.label??``})})}),(0,$.jsx)(Hn,{open:!!Pe,title:r(`sessions.sidebar.session.menu.rename`),onClose:()=>{Re||(Fe(null),Le(``))},footer:(0,$.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,$.jsx)(H,{type:`button`,variant:`default`,className:`flex-1`,disabled:Re,onClick:()=>{Fe(null),Le(``)},children:r(`sessions.sidebar.dialogs.cancel`)}),(0,$.jsx)(H,{type:`button`,variant:`default`,className:`flex-1`,disabled:!Ie.trim()||Re,onClick:()=>void Mt(),children:r(`sessions.sidebar.session.rename.save`)})]}),children:(0,$.jsxs)(`form`,{className:`flex flex-col gap-3 px-1 py-1`,onSubmit:e=>{e.preventDefault(),Mt()},children:[(0,$.jsx)(Gt,{value:Ie,onChange:e=>Le(e.target.value),autoFocus:!0,className:`h-12`,disabled:Re}),(0,$.jsxs)(H,{type:`button`,variant:`outline`,className:`w-full gap-2`,disabled:Re,onClick:()=>void Nt(),children:[Re?(0,$.jsx)(W,{name:`loader-4`,className:`size-4 animate-spin`}):(0,$.jsx)(W,{name:`ai-generate-2`,className:`size-4`}),r(`sessions.sidebar.session.rename.smartTitle`)]})]})}),Be?(0,$.jsx)($r,{open:!0,project:{id:Be.project.id,path:Be.project.path},worktree:Be.worktree,onClose:()=>Ve(null),onDeleted:()=>G(e=>e+1)}):null,(0,$.jsx)(ai,{open:ie!==null,project:tt.find(e=>e.id===ie)??null,onClose:()=>ae(null),onWorktreesChanged:()=>G(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:qt?(0,$.jsx)(`div`,{className:`flex shrink-0 items-center gap-2`,children:qt}):null}),Zt]}):null:(0,$.jsx)(dt,{id:`mobile-sessions-sheet`,open:e,onOpenChange:t,trailing:qt,ariaLabel:r(`mobile.sessions.sheet.title`),closeAriaLabel:r(`mobile.surface.closeAria`),resizeAriaLabel:r(`mobile.sessions.sheet.resizeAria`),initiallyExpanded:!0,children:Zt})},vs=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},ys=[{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 bs(e){let t=(0,Q.c)(23),{activeTab:n,onTabChange:r,className:i,tabMarks:a,homeView:o}=e,s=o===void 0?`projects`:o,{t:c}=rt(),l=cn(),u;t[0]===c?u=t[1]:(u=c(`mobile.tabs.activity.loading`),t[0]=c,t[1]=u);let d=u,f;t[2]===r?f=t[3]:(f=e=>{r(e.currentTarget.dataset.tab)},t[2]=r,t[3]=f);let p=R(f),m;t[4]!==n||t[5]!==r?(m=e=>{if(![`ArrowLeft`,`ArrowRight`,`Home`,`End`].includes(e.key))return;e.preventDefault();let t=ys.findIndex(e=>e.id===n),i=ys[e.key===`Home`?0:e.key===`End`?ys.length-1:(t+(e.key===`ArrowRight`?1:-1)+ys.length)%ys.length];r(i.id),document.getElementById(`mobile-tab-${i.id}`)?.focus()},t[4]=n,t[5]=r,t[6]=m):m=t[6];let h=R(m),g;t[7]===c?g=t[8]:(g=c(`mobile.nav.aria`),t[7]=c,t[8]=g);let _;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(_={role:`tablist`},t[9]=_):_=t[9];let v;t[10]!==n||t[11]!==l||t[12]!==p||t[13]!==h||t[14]!==s||t[15]!==d||t[16]!==c||t[17]!==a?(v=ys.map(e=>{let t=e.id===n,r=c(e.labelKey),i=e.id===`assistant`&&l>0,o=!i&&a?.[e.id]===`loading`,u=i?`mobile-tab-assistant-unread`:o?`mobile-tab-${e.id}-activity`:void 0;return(0,$.jsxs)(H,{id:`mobile-tab-${e.id}`,"data-tab":e.id,type:`button`,role:`tab`,variant:`ghost`,size:`sm`,"aria-controls":`mobile-tabpanel-${e.id}`,"aria-label":r,"aria-describedby":u,"aria-selected":t,tabIndex:t?0:-1,title:r,onClick:p,onKeyDown:h,className:U(`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)(Nr,{size:23,className:`size-[23px] shrink-0 items-center justify-center [&[data-assistant-navigation-avatar]]:scale-105`}):(0,$.jsx)(W,{name:e.id===`projects`?s===`tasks`?`list-check-2`:`folder-tree`:e.icon,weight:`medium`,className:`size-[23px] shrink-0`}),u?(0,$.jsx)(`span`,{id:u,role:o?`status`:void 0,"aria-label":o?d:void 0,"data-mobile-tab-activity":o?`loading`:void 0,className:`pointer-events-none absolute left-full -top-1 ml-0.5 inline-flex z-10`,children:i?(0,$.jsx)(Wi,{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)(W,{name:`loader-4`,className:`size-3 animate-spin`})})}):null]}),(0,$.jsx)(`span`,{className:`yuri-mobile-tab-label block max-w-full overflow-hidden text-ellipsis whitespace-nowrap`,children:r})]},e.id)}),t[10]=n,t[11]=l,t[12]=p,t[13]=h,t[14]=s,t[15]=d,t[16]=c,t[17]=a,t[18]=v):v=t[18];let y;return t[19]!==i||t[20]!==g||t[21]!==v?(y=(0,$.jsx)(Ui,{as:`nav`,"aria-label":g,variant:`navigation`,surfaceProps:_,className:i,children:v}),t[19]=i,t[20]=g,t[21]=v,t[22]=y):y=t[22],y}function xs(e){return e.unreadCount>0?`unread`:e.working?`loading`:null}var Ss=`yuri-native-ios-tab-bar`,Cs=`YuriTabBar`,ws=[`projects`,`assistant`,`scheduled`,`settings`],Ts=ee(Cs),Es=e=>e.isCapacitor&&e.platform===`ios`&&e.pluginAvailable&&e.nativeUiEnabled!==!1;function Ds(){return typeof window>`u`?!1:Es({isCapacitor:g(),platform:y(),pluginAvailable:z.isPluginAvailable(Cs),nativeUiEnabled:Pt()})}var Os=e=>e.classList.contains(`dark`)?`dark`:`light`,ks=()=>Ft(`--primary`),As=e=>typeof e==`string`&&ws.includes(e),js=e=>typeof e==`string`&&As(e)?e:null,Ms=(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)),Ns=(e,t)=>{e.classList.toggle(Ss,t)},Ps=(e,t)=>e&&!t,Fs=e=>e.visible?e.overlayHidden?{action:`present`}:e.lastState&&Ms(e.lastState,e.nextState)?{action:`skip`}:{action:`present`}:e.overlayHidden?{action:`skip`}:{action:`hide`},Is=()=>Ts,Ls=`mobile-overlay-root`;function Rs(e){let t=(0,Q.c)(31),n=Lt(),r;t[0]===n?r=t[1]:(r=n&&Ds(),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=R(e.onTabChange),h;t[2]===e.tabs?h=t[3]:(h=JSON.stringify(e.tabs.map(Bs)),t[2]=e.tabs,t[3]=h);let g=h,_;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(_=typeof document>`u`?`dark`:Os(document.documentElement),t[4]=_):_=t[4];let v=_,y;t[5]===i?y=t[6]:(y=!i||typeof document>`u`?``:ks(),t[5]=i,t[6]=y);let b=y,x,S;t[7]===i?(x=t[8],S=t[9]):(x=()=>{if(!i||typeof document>`u`)return;let e=document.getElementById(Ls);e||(e=document.createElement(`div`),e.id=Ls,document.body.appendChild(e));let t=()=>u(In(e.children));t();let n=new MutationObserver(t);return n.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[Fn]}),()=>n.disconnect()},S=[i],t[7]=i,t[8]=x,t[9]=S),(0,Z.useEffect)(x,S);let C;t[10]!==i||t[11]!==m?(C=()=>{if(!i)return;let e=!1,t=Is(),n=[];return t.addListener(`tabSelected`,e=>{let t=js(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`&&Ns(document.documentElement,!1)}},t[10]=i,t[11]=m,t[12]=C):C=t[12];let w;t[13]===i?w=t[14]:(w=[i],t[13]=i,t[14]=w),(0,Z.useEffect)(C,w);let T;t[15]!==b||t[16]!==e.activeTab||t[17]!==e.ariaLabel||t[18]!==e.tabs||t[19]!==e.visible||t[20]!==i||t[21]!==l?(T=()=>{if(!i||p.current)return;let t=!1,n=Is(),r={tabs:e.tabs.map(zs),selectedTab:e.activeTab,appearance:v,accentColor:b,ariaLabel:e.ariaLabel},a=Fs({visible:Ps(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`&&Ns(document.documentElement,!1);return}f.current=!1,d.current=r,o(!0),typeof document<`u`&&Ns(document.documentElement,!0)}})().catch(()=>{t||(p.current=!0,c(!0),o(!1),typeof document<`u`&&Ns(document.documentElement,!1))}),()=>{t=!0}},t[15]=b,t[16]=e.activeTab,t[17]=e.ariaLabel,t[18]=e.tabs,t[19]=e.visible,t[20]=i,t[21]=l,t[22]=T):T=t[22];let E;return t[23]!==b||t[24]!==e.activeTab||t[25]!==e.ariaLabel||t[26]!==e.visible||t[27]!==i||t[28]!==l||t[29]!==g?(E=[i,e.visible,l,e.activeTab,e.ariaLabel,v,b,g],t[23]=b,t[24]=e.activeTab,t[25]=e.ariaLabel,t[26]=e.visible,t[27]=i,t[28]=l,t[29]=g,t[30]=E):E=t[30],(0,Z.useLayoutEffect)(T,E),!i||s?`web`:a?`native`:`pending`}function zs(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 Bs(e){return[e.id,e.label,e.badge??null,e.activity===!0,e.activity===!0?e.activityLabel??null:null]}function Vs(e){let t=(0,Q.c)(52),{homeView:n,tabs:r,navigation:i,onTabChange:a,secondaryPages:o,showTabBar:s,tabBarCovered:c,className:l}=e,u=n===void 0?`projects`:n,d=o===void 0?[]:o,f=s===void 0||s,p=c!==void 0&&c,{t:m}=rt(),h=i.activeTab,g=d.slice(-2),_=g.at(-1)??null,v=_?.key??null,y=_?.depth,b=g.length>1?g[g.length-2].key:null,x;t[0]===h?x=t[1]:(x=()=>new Set([h]),t[0]=h,t[1]=x);let[S,C]=Z.useState(x);S.has(h)||C(e=>{if(e.has(h))return e;let t=new Set(e);return t.add(h),t});let w=Z.useRef(null),T=Z.useRef(null),E=Z.useRef(null),D=Z.useRef(new Map),O=Z.useRef(null),k=Z.useRef(!1),A=Z.useRef(``),j=R(()=>_?.onBack());Rt({id:_?`mobile-secondary:${_.key}`:`mobile-secondary:inactive`,active:!!_,onBack:j,surfaceRef:w,underlayRef:T}),Z.useLayoutEffect(()=>{let e=v===null?null:D.current.get(v)??null,t=b===null?E.current:D.current.get(b)??null;w.current=e,T.current=t},[v,y,b]);let M;t[2]===_?M=t[3]:(M=[_],t[2]=_,t[3]=M),Z.useLayoutEffect(()=>{if(_){if(!k.current){let e=document.activeElement;O.current=e instanceof HTMLElement?e:null,k.current=!0}A.current!==_.key&&(A.current=_.key,w.current?.focus());return}if(k.current){k.current=!1,A.current=``;let e=O.current;O.current=null,e&&e.isConnected&&e.focus()}},M);let N;t[4]===a?N=t[5]:(N=e=>{a(e)},t[4]=a,t[5]=N);let P=R(N),F=cn(),I=un(),L=ln(),ee;t[6]===m?ee=t[7]:(ee=m(`mobile.tabs.activity.loading`),t[6]=m,t[7]=ee);let z=ee,B;t[8]!==F||t[9]!==I?(B=xs({unreadCount:F,working:I}),t[8]=F,t[9]=I,t[10]=B):B=t[10];let te=B,ne;t[11]===L?ne=t[12]:(ne=xs({unreadCount:0,working:L}),t[11]=L,t[12]=ne);let re=ne,ie;t[13]!==te||t[14]!==F||t[15]!==z||t[16]!==re||t[17]!==m?(ie=ys.map(e=>{let t=e.id===`assistant`&&te===`loading`||e.id===`scheduled`&&re===`loading`;return{id:e.id,label:m(e.labelKey),badge:e.id===`assistant`&&te===`unread`?F>99?`99+`:String(F):null,activity:t,activityLabel:t?z:null}}),t[13]=te,t[14]=F,t[15]=z,t[16]=re,t[17]=m,t[18]=ie):ie=t[18];let ae=ie,oe=f&&!p&&!_,V;t[19]===m?V=t[20]:(V=m(`mobile.nav.aria`),t[19]=m,t[20]=V);let se;t[21]!==P||t[22]!==oe||t[23]!==ae||t[24]!==h||t[25]!==V?(se={visible:oe,activeTab:h,tabs:ae,ariaLabel:V,onTabChange:P},t[21]=P,t[22]=oe,t[23]=ae,t[24]=h,t[25]=V,t[26]=se):se=t[26];let H=Rs(se),W=H===`native`,G=f&&H===`web`,ce=Lt(),le,ue;t[27]!==ce||t[28]!==W?(le=()=>{if(!ce){It.shutdown();return}W&&zt(!0)&&It.warm()},ue=[ce,W],t[27]=ce,t[28]=W,t[29]=le,t[30]=ue):(le=t[29],ue=t[30]),Z.useEffect(le,ue);let de=h===`assistant`&&`yuri-assistant-wallpaper`,K;t[31]!==l||t[32]!==de?(K=U(`yuri-mobile-floating-shell relative isolate flex h-full min-h-0 flex-col overflow-hidden text-foreground`,`bg-[var(--yuri-mobile-page-background)]`,de,l),t[31]=l,t[32]=de,t[33]=K):K=t[33];let fe=_?!0:void 0,pe=_?!0:void 0,me=_?`true`:void 0,he;t[34]!==h||t[35]!==f||t[36]!==G||t[37]!==m||t[38]!==r||t[39]!==S?(he=ys.map(e=>{let t=S.has(e.id);return(0,$.jsx)(`section`,{id:`mobile-tabpanel-${e.id}`,role:`tabpanel`,"aria-labelledby":G?`mobile-tab-${e.id}`:void 0,"aria-label":G?void 0:m(e.labelKey),hidden:h!==e.id,tabIndex:0,className:U(`scrollbar-none h-full min-h-0 flex-1 overflow-y-auto overflow-x-hidden overscroll-contain px-[var(--yuri-mobile-page-inline-inset)] pt-[calc(var(--safe-area-inset-top,env(safe-area-inset-top,0px))+1rem)] outline-none`,f?`pb-[calc(var(--yuri-mobile-dock-height)+2.5rem+var(--safe-area-inset-bottom,env(safe-area-inset-bottom,0px)))]`:`pb-0`),children:t?(0,$.jsx)(Z.Suspense,{fallback:null,children:r?.[e.id]??(0,$.jsx)(Hs,{tab:e.id,icon:e.icon})}):null},e.id)}),t[34]=h,t[35]=f,t[36]=G,t[37]=m,t[38]=r,t[39]=S,t[40]=he):he=t[40];let q=f?(0,$.jsx)(`div`,{"data-mobile-navigation-dock-underlay":`true`,"aria-hidden":_||W?!0:void 0,inert:_||W?!0:void 0,children:G?(0,$.jsx)(bs,{activeTab:h,homeView:u,onTabChange:P,tabMarks:{assistant:te===`loading`?`loading`:null,scheduled:re===`loading`?`loading`:null}}):null}):null,ge;t[41]!==E||t[42]!==fe||t[43]!==pe||t[44]!==me||t[45]!==he||t[46]!==q?(ge=(0,$.jsxs)(`div`,{ref:E,"data-mobile-navigation-underlay":`true`,"aria-hidden":fe,inert:pe,"data-mobile-navigation-parked":me,className:`flex h-full min-h-0 flex-1 flex-col`,children:[he,q]}),t[41]=E,t[42]=fe,t[43]=pe,t[44]=me,t[45]=he,t[46]=q,t[47]=ge):ge=t[47];let J=g.map((e,t)=>{let n=t===g.length-1;return(0,$.jsx)(`div`,{ref:t=>{t?D.current.set(e.key,t):D.current.delete(e.key)},"data-mobile-secondary-page":`true`,"data-mobile-secondary-active":n?`true`:`false`,role:n?`dialog`:void 0,"aria-modal":n?!0:void 0,"aria-label":n?e.ariaLabel??m(`mobile.nav.secondaryPageAria`):void 0,"aria-hidden":!n||void 0,inert:!n||void 0,tabIndex:n?-1:void 0,className:U(`absolute inset-0 flex h-full min-h-0 flex-col overflow-hidden bg-background outline-none`,n?`z-50`:`z-40`),children:(0,$.jsx)(Z.Suspense,{fallback:null,children:e.content})},e.key)}),_e;return t[48]!==K||t[49]!==ge||t[50]!==J?(_e=(0,$.jsxs)(`div`,{className:K,children:[ge,J]}),t[48]=K,t[49]=ge,t[50]=J,t[51]=_e):_e=t[51],_e}function Hs(e){let t=(0,Q.c)(17),{tab:n,icon:r,className:i}=e,{t:a}=rt(),o,s,c,l;if(t[0]!==i||t[1]!==r||t[2]!==a||t[3]!==n){let e=ys.find(e=>e.id===n)??ys[0];t[8]===i?c=t[9]:(c=U(`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)(W,{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 Us=(e,t)=>e.id===t.id&&e.title===t.title&&e.directory===t.directory&&e.projectLabel===t.projectLabel&&e.project===t.project&&e.branch===t.branch&&e.branchState===t.branchState&&e.pathLabel===t.pathLabel&&e.activityLabel===t.activityLabel&&e.unread===t.unread&&e.pinned===t.pinned&&e.active===t.active,Ws=[],Gs=(e,t,n)=>{let r=(e??t)?.trim();return r&&r!==`HEAD`&&r!==n?r:void 0};function Ks(e,t){let{enabled:n,status:r,settledLimit:i}=t,{t:a}=rt(),o=ge(),s=qr(),c=fr({enabled:n}),l=qe(),u=q(e=>e.index.session.unseenCount),d=Ne(e=>e.sessionOrderByScope[xr]),f=J(e=>e.projects),p=je(e=>e.currentSessionId),m=D(e=>e.homeDirectory),h=Fr(c,n),g=Z.useRef(new Map),{git:_}=P(),v=Nt(e=>e.ensureStatus),y=Z.useMemo(()=>n?[...e.projectMetaById.values()].map(e=>e.path):Ws,[n,e.projectMetaById]),b=At(y);return Z.useEffect(()=>{if(!(!n||!_))for(let e of y)v(e,_)},[n,v,_,y]),Z.useMemo(()=>{if(!n)return null;let t=Tr({sessions:e.allSessions,pinnedSessionIds:o,settledSessionIds:s,runningSessionIds:c,pendingRequestSessionIds:l,unseenBySession:u}),_=pr(e.allSessions,o,d).filter(lr),v=new Map(f.map(e=>[e.id,e.color??void 0])),y=a(`mobile.sessions.untitled`),x=a(`sessions.sidebar.task.unassigned`),S=g.current,C=new Map,w=(t,n)=>{let r=e.ownership.bySessionId.get(t.id),i=r?e.projectMetaById.get(r.projectId):void 0,a=i&&r?.kind===`worktree`?li(i,r.scopeDirectory):null,o=i?b.get(i.path):void 0,s=Gs(a?.branch,o?.branch,i?.label),c=s?null:!i||o?.isGitRepo===!1?`no-git`:`loading`,l={id:t.id,title:t.title?.trim()||y,directory:pi(t),projectLabel:i?.label||x,project:i?{id:i.id,icon:i.icon??void 0,color:v.get(i.id),iconImage:i.iconImage??void 0}:null,branch:s,branchState:c,pathLabel:c===`no-git`&&i?se(i.path,m):void 0,activityLabel:Ir(Rr(t))||void 0,unread:(u[t.id]??0)>0,pinned:n,active:p===t.id},d=S.get(t.id),f=d&&Us(d,l)&&d.project?.iconImage===l.project?.iconImage?d:l;return C.set(t.id,f),f},T=e=>(u[e.id]??0)>0,E=[..._,...t.active],D=r===`archived`?t.settled:E,O=r===`unread`?D.filter(T):D,k={items:(r===`archived`?O.slice(0,i):O).map(e=>w(e,o.has(e.id))),total:O.length,runStartTimes:h};return g.current=C,k},[p,n,b,m,e.allSessions,e.ownership,e.projectMetaById,l,d,o,f,h,c,s,i,r,a,u])}var qs=(e,t,n)=>e?.kind===`project`&&e.project.id===t?{...e,isGitRepository:n}:e;function Js({homeView:e,onHomeViewChange:t,onOpenChat:n,onAddProject:r,onNewSession:i,onScanQr:a,onSwitchInstance:o,onRemoteDesktop:s,instanceOptions:c,className:l}){let{t:u}=rt(),{git:d}=P(),f=Me(),p=Qr(),[m,g]=Z.useState(()=>new Map),_=R((e,t)=>{g(n=>{if(!t.length&&!n.has(e))return n;let r=new Map(n);return t.length?r.set(e,t):r.delete(e),r})}),v=R((e,t,n,r)=>{let i=Ne.getState(),a=e===`__pinned__`?e:h(e);if(!a||a!==`__pinned__`&&i.getSessionFolderId(a,n)!==i.getSessionFolderId(a,r))return;let o=a===`__pinned__`?{}:ur(p.allSessions.filter(e=>pi(e)===a));i.reorderSessions(a,t,n,r,o).catch(()=>X.error(u(`sessions.order.saveFailed`)))}),y=hr(e=>e.setProjectExpanded),b=hr(e=>e.setWorktreeExpanded),x=_e(),S=si(),[C,w]=Z.useState(`active`),[T,E]=Z.useState(30),D=Ks(p,{enabled:e===`tasks`,status:C,settledLimit:T}),O=R(e=>{w(e),E(30)}),k=R(()=>E(e=>e+30)),A=R(e=>{S(e,!1)}),j=ge(),M=je(e=>e.archiveSessions),N=je(e=>e.updateSessionTitle),F=je(e=>e.requestSessionSmartTitle),I=je(e=>e.shareSession),L=je(e=>e.unshareSession),ee=je(e=>e.openNewSessionDraft),z=G(e=>e.openDraft),B=G(e=>e.openSession),te=J(e=>e.projects),ne=Y(e=>e.projectSortOrder),re=oi(),ie=Z.useMemo(()=>te.filter(e=>e.hostId).map(Qe),[te]),ae=Z.useMemo(()=>ie.flatMap(e=>m.get(e.id)??[]).map(e=>({pinned:!!e.pinned,time:ce(e.node.session),session:{id:e.identity,title:e.node.session.title||``,content:e.content}})),[ie,m]),oe=Ne(e=>e.sessionOrderByScope[xr]),V=Z.useMemo(()=>gr([...p.pinnedSessions,...ae.filter(e=>e.pinned).map(e=>e.session)],e=>e.id,oe),[p.pinnedSessions,ae,oe]),se=Z.useMemo(()=>[...p.inProgressSessions.map(e=>({session:e,time:p.sessionById.get(e.id)?ce(p.sessionById.get(e.id)):0})),...ae.filter(e=>!e.pinned)].sort((e,t)=>t.time-e.time).map(e=>e.session),[p.inProgressSessions,p.sessionById,ae]),U=J(e=>e.setActiveProjectIdOnly),ue=J(e=>e.removeProject),de=Rn(),[K,pe]=Z.useState(null),[he,q]=Z.useState(!1),[ve,ye]=Z.useState(null),[xe,Se]=Z.useState(null),[Ce,we]=Z.useState(null),[Te,Ee]=Z.useState(``),[De,Oe]=Z.useState(!1),[ke,Ae]=Z.useState(!1),[Pe,Fe]=Z.useState(null),[Ie,Le]=Z.useState(null),[Re,ze]=Z.useState(null),Be=K?.kind===`session`?K.session.id:``,Ve=me(Be),He=Ve?.type===`busy`||Ve?.type===`retry`,Ue=K?.kind===`session`?pi(K.session):``,{unread:We,onToggleRead:Ge}=Pr(K?.kind===`session`?K.session:null,Ue),Ke=!!Be&&Re===Be,qe=!Ue||Ke||He,Je=R(e=>{let t=new Map;for(let e of p.allSessions){let n=Xr(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}),Ye=R(()=>{q(!1),pe(null)}),Xe=R(e=>{if(Vr(e.id)){let t=ii(e.id);if(!t)return;t.kind===`more`?p.showMoreBucketSessions(t.projectId,t.bucketKey):p.resetBucketVisibleCount(t.projectId,t.bucketKey);return}let t=p.sessionById.get(e.id),r=t&&pi(t)||null;n({sessionId:e.id,directory:r})}),Ze=Z.useRef(null),$e=R(()=>{Ze.current!==null&&(window.clearTimeout(Ze.current),Ze.current=null)}),et=R(e=>{if($e(),e.pointerType!==`touch`&&e.pointerType!==`pen`)return;let t=(e.target?.closest(`[data-mobile-session-id]`))?.dataset.mobileSessionId,n=t?p.sessionById.get(t):void 0;if(!t||!n||Vr(t))return;let r=pi(n)||null;Ze.current=window.setTimeout(()=>{Ze.current=null,be(t,r)},60)});Z.useEffect(()=>$e,[$e]);let tt=R(e=>{Xe({id:e,title:``})}),nt=R(e=>{Vr(e.id)||x(e.id)}),it=R(async t=>{if(Vr(t.id))return;if(e===`tasks`){let e=j.has(t.id);e&&x(t.id),S(t.id,!0),X.success(u(`sessions.sidebar.session.archive.success`),{action:{label:u(`sessions.sidebar.undo`),onClick:()=>{S(t.id,!1),e&&x(t.id)}}});return}let n=Je(t.id),{archivedIds:r,failedIds:i}=await M(n);r.length>0&&Mr({sessionIds:r,message:r.length===1?u(`sessions.sidebar.session.archive.success`):u(`sessions.sidebar.bulkActions.archivedPlural`,{count:r.length}),undoLabel:u(`sessions.sidebar.undo`),settingsLabel:u(`settings.yuri.archivedSessions.actions.view`),undoFailedMessage:r.length===1?u(`sessions.sidebar.session.archive.undoFailed`):u(`sessions.sidebar.bulkActions.archiveUndoFailed`,{count:r.length})}),i.length>0&&X.error(i.length===1?u(`sessions.sidebar.bulkActions.failedArchiveSingle`,{count:i.length}):u(`sessions.sidebar.bulkActions.failedArchivePlural`,{count:i.length}))}),at=R(()=>{if(!K||K.kind!==`session`)return;let e=K.session,t=pi(e),n=Ve?.type??`idle`;!t||Re===e.id||n===`busy`||n===`retry`||(ze(e.id),(async()=>{try{await de.refreshSessionTranscript(e.id,{directory:t}),X.success(u(`sessions.sidebar.session.menu.refreshTranscriptSuccess`))}catch{X.error(u(`sessions.sidebar.session.menu.refreshTranscriptFailed`))}finally{ze(t=>t===e.id?null:t)}})())}),ot=R(e=>{if(Vr(e.id))return;let t=p.sessionById.get(e.id);t&&(pe({kind:`session`,session:t}),q(!0))}),st=R(e=>{ot({id:e,title:``})}),ct=R(e=>{y(e.id,!e.expanded)}),lt=R((e,t)=>{b(`${e.id}::${t.id}`,!t.expanded)}),ut=R((e,t)=>{U(e.id),z({selectedProjectId:e.id,directoryOverride:t,preserveDirectoryOverride:!0})}),dt=R(()=>{let e=J.getState().getActiveProject();if(e?.hostId){or(Qe(e),!0).catch(e=>X.error(e instanceof Error?e.message:String(e)));return}if(i){i();return}ee()}),ft=R(e=>{let t=p.projectMetaById.get(e.id);t&&(pe({kind:`project`,project:t,isGitRepository:!1}),q(!0),d.checkIsGitRepository(t.path).then(e=>{pe(n=>qs(n,t.id,e))}).catch(()=>{pe(e=>qs(e,t.id,!1))}))}),pt=R((e,t)=>{let n=h(t);return n?e.worktrees.find(e=>h(e.path)===n)||((je.getState().availableWorktreesByProject.get(e.path)??[]).find(e=>h(e.path)===n)??null):null}),mt=R((e,t)=>{let n=p.projectMetaById.get(e.id);n&&ut(n,t.path)}),ht=R((e,t)=>{let n=p.projectMetaById.get(e.id);n&&(pe({kind:`worktree`,project:n,worktreePath:t.path,worktreeName:t.name}),q(!0))}),gt=R((e,t)=>{let n=p.projectMetaById.get(e.id);if(!n)return;let r=pt(n,t.path);if(!r){X.error(u(`sessions.sidebar.sessionDialogs.worktree.errorRemoveTitle`),{description:u(`sessions.sidebar.dialogs.deleteResult.tryAgain`)});return}Le({project:n,worktree:r})}),_t=R(e=>{Fe(e),U(e),Ae(!0)}),vt=R(e=>{(async()=>{let t=e.worktrees;try{t=(await Gn({id:e.id,path:e.path})).worktrees}catch(n){console.warn(`[MobileProjectsHome] Worktree refresh before session sync failed:`,n),t=je.getState().availableWorktreesByProject.get(e.path)??e.worktrees}await le([e.path,...t.map(e=>e.path)],p.allSessions)})()}),yt=R((e,t)=>{let n=Pe;if(Ae(!1),Fe(null),t?.sessionId){B({sessionId:t.sessionId,directory:e});return}z({selectedProjectId:n,directoryOverride:e,preserveDirectoryOverride:!0})}),bt=R(async e=>{try{if(!(await I(e.id))?.share?.url){X.error(u(`sessions.sidebar.session.share.error`));return}X.success(u(`sessions.sidebar.session.share.successTitle`),{description:u(`sessions.sidebar.session.share.successDescription`)})}catch{X.error(u(`sessions.sidebar.session.share.error`))}}),xt=R(async e=>{if((await fe(e)).ok){X.success(u(`sessions.sidebar.session.menu.copied`));return}X.error(u(`sessions.sidebar.session.share.copyUrlError`))}),St=R(async e=>{try{if(await L(e)){X.success(u(`sessions.sidebar.session.unshare.success`));return}X.error(u(`sessions.sidebar.session.unshare.error`))}catch{X.error(u(`sessions.sidebar.session.unshare.error`))}}),Ct=R(e=>{let t=Je(e.id);Wr({sessionIds:t,message:t.length===1?u(`sessions.sidebar.session.delete.success`):u(`sessions.sidebar.bulkActions.deletedPlural`,{count:t.length}),undoLabel:u(`sessions.sidebar.undo`),commitFailedMessage:u(`sessions.sidebar.session.delete.error`)})}),wt=R(async()=>{if(!Ce)return;let e=Te.trim();if(e)try{await N(Ce.id,e),we(null),Ee(``)}catch{X.error(u(`sessions.sidebar.session.menu.rename`),{description:u(`sessions.sidebar.dialogs.deleteResult.tryAgain`)})}}),Tt=R(async()=>{if(!Ce||De)return;let e=Ce.id;we(null),Ee(``),Oe(!0);try{await F(e)}catch{X.error(u(`sessions.sidebar.session.rename.smartTitle`),{description:u(`sessions.sidebar.dialogs.deleteResult.tryAgain`)})}finally{Oe(!1)}}),Et=Z.useMemo(()=>K?K.kind===`session`?{kind:`session`,title:K.session.title?.trim()||u(`mobile.sessions.untitled`),pinned:j.has(K.session.id),shared:!!K.session.share?.url,unread:We}:K.kind===`project`?{kind:`project`,title:K.project.label,gitRepository:K.isGitRepository}:{kind:`worktree`,title:K.worktreeName}:null,[K,We,j,u]),Dt=Z.useMemo(()=>{if(!K)return{};if(K.kind===`session`){let e=K.session;return{onRename:()=>{Ee(e.title?.trim()||u(`mobile.sessions.untitled`)),we(e)},onTogglePin:()=>x(e.id),onToggleRead:Ge,onShare:f&&!e.share?.url?()=>{bt(e)}:void 0,onCopyLink:f&&e.share?.url?()=>{xt(e.share.url)}:void 0,onUnshare:f&&e.share?.url?()=>{St(e.id)}:void 0,onRefreshTranscript:at,onArchive:()=>{it({id:e.id,title:e.title?.trim()||u(`mobile.sessions.untitled`)})},onDelete:()=>Ct(e)}}if(K.kind===`project`){let e=K.project;return{onNewSession:()=>ut(e,e.path),onNewWorktree:()=>_t(e.id),onSyncSessions:()=>vt(e),onEditProject:()=>ye(e.id),onCloseProject:()=>Se(e)}}let{project:e,worktreePath:t}=K;return{onNewSession:()=>ut(e,t),onDeleteWorktree:()=>{let n=pt(e,t);if(!n){X.error(u(`sessions.sidebar.sessionDialogs.worktree.errorRemoveTitle`),{description:u(`sessions.sidebar.dialogs.deleteResult.tryAgain`)});return}Le({project:e,worktree:n})}}},[K,it,xt,Ct,at,_t,vt,bt,St,Ge,pt,f,ut,u,x]),Ot=Z.useMemo(()=>{if(!ve)return null;let e=te.find(e=>e.id===ve),t=p.projectMetaById.get(ve);if(!e||!t)return null;let n=K?.kind===`project`&&K.project.id===ve?K.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}},[K,ve,p.projectMetaById,te]);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`contents`,onPointerDownCapture:et,onPointerMoveCapture:$e,onPointerCancelCapture:$e,children:(0,$.jsx)(Ur,{remoteProjects:ie,hostRegistry:re.registry,projectOrderIds:Gr(te,ne).map(e=>e.id),renderRemoteProject:re.registry?e=>(0,$.jsx)(ni,{project:e,registry:re.registry,mobile:!0,reorderEnabled:!1,onActivityItems:_}):void 0,remoteError:re.catalog.error?.message,className:l,projects:p.projects,pinnedSessions:V,inProgressSessions:se,onAddProject:r,onNewSession:dt,onScanQr:a,onSwitchInstance:o,instanceOptions:c,onRemoteDesktop:s,onToggleProject:ct,onOpenProjectActions:ft,onToggleWorktree:lt,onNewWorktreeSession:mt,onOpenWorktreeActions:ht,onDeleteWorktree:gt,onSelectSession:Xe,onPinSession:nt,onArchiveSession:e=>{it(e)},onOpenSessionActions:ot,onReorderSessions:v,task:{view:e,onViewChange:t,model:D,status:C,onStatusChange:O,onShowMoreSettled:k,onSelectTask:tt,onOpenTaskActions:st,onRestoreTask:A}})}),(0,$.jsx)(_i,{open:he,target:Et,actions:Dt,refreshTranscriptDisabled:qe,refreshTranscriptSpinning:Ke,onOpenChange:e=>{e?q(!0):Ye()}}),(0,$.jsx)(Ln,{open:ke,projectId:Pe,onOpenChange:e=>{Ae(e),e||Fe(null)},onWorktreeCreated:yt}),Ie?(0,$.jsx)($r,{open:!0,project:{id:Ie.project.id,path:Ie.project.path},worktree:Ie.worktree,onClose:()=>Le(null)}):null,(0,$.jsx)(Hn,{open:!!xe,title:u(`sessions.sidebar.project.actions.closeProject`),onClose:()=>Se(null),closeAriaLabel:u(`mobile.surface.closeAria`),footer:(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[(0,$.jsx)(H,{type:`button`,variant:`ghost`,className:`flex-1`,onClick:()=>Se(null),children:u(`sessions.sidebar.dialogs.cancel`)}),(0,$.jsx)(H,{type:`button`,variant:`destructive`,className:`flex-1`,onClick:()=>{if(!xe)return;let e=xe;Se(null),ue(e.id),X.success(u(`mobile.sessions.toast.projectRemoved`,{label:e.label}))},children:u(`mobile.sessions.confirmRemoveProject`)})]}),children:(0,$.jsx)(`p`,{className:`px-1 py-1 typography-ui-body text-foreground`,children:u(`mobile.projects.closeConfirmMessage`,{title:xe?.label??``})})}),(0,$.jsx)(Hn,{open:!!Ce,title:u(`sessions.sidebar.session.menu.rename`),onClose:()=>{De||(we(null),Ee(``))},closeAriaLabel:u(`mobile.surface.closeAria`),footer:(0,$.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,$.jsx)(H,{type:`button`,variant:`default`,className:`flex-1`,disabled:De,onClick:()=>{we(null),Ee(``)},children:u(`sessions.sidebar.dialogs.cancel`)}),(0,$.jsx)(H,{type:`button`,variant:`default`,className:`flex-1`,disabled:!Te.trim()||De,onClick:()=>void wt(),children:u(`sessions.sidebar.session.rename.save`)})]}),children:(0,$.jsxs)(`form`,{className:`flex flex-col gap-3 px-1 py-1`,onSubmit:e=>{e.preventDefault(),wt()},children:[(0,$.jsx)(Gt,{value:Te,onChange:e=>Ee(e.target.value),autoFocus:!0,className:`h-12`,disabled:De}),(0,$.jsxs)(H,{type:`button`,variant:`outline`,className:`w-full gap-2`,disabled:De,onClick:()=>void Tt(),children:[De?(0,$.jsx)(W,{name:`loader-4`,className:`size-4 animate-spin`}):(0,$.jsx)(W,{name:`ai-generate-2`,className:`size-4`}),u(`sessions.sidebar.session.rename.smartTitle`)]})]})}),(0,$.jsx)(ai,{open:ve!==null,project:Ot,onClose:()=>ye(null)})]})}function Ys(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}=rt(),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=U(`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)(Vi,{title:l,className:i,surface:!1,scrollsWithPage:!0,showHeader:s,surfaceClassName:u,children:d}),t[4]=i,t[5]=s,t[6]=l,t[7]=u,t[8]=d,t[9]=f):f=t[9],f}var Xs=Kt(()=>B(()=>import(`./AssistantView-BR8hsjOv.js`).then(e=>({default:e.AssistantView})),__vite__mapDeps([3,1,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,2,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105]))),Zs=Kt(()=>B(()=>import(`./MobileAssistantTab-CMIQansR.js`).then(e=>({default:e.MobileAssistantTab})),__vite__mapDeps([106,1,6,7,8,9,10,21,13,5,4,14,15,22,23,24,25,26,17,18,27,28,16,2,29,30,19,11,12,20,31,33,34,35,36,37,38,94,73,59,74,75,66,76,77,107,108,109,110,101,102,103,51,69,70,104,105]))),Qs=Kt(()=>B(()=>import(`./MobileAssistantSettingsPage-BBIiFN2g.js`).then(e=>({default:e.MobileAssistantSettingsPage})),__vite__mapDeps([111,1,6,7,25,13,5,4,14,15,26,17,18,27,28,16,2,29,39,21,22,23,24,112,50,12,34,41,19,42,43,44,45,46,35,36,37,47,8,9,10,48,11,20,49,51,52,53,54,55,56,30,113,108,109,114,57,58,69,70,115,105,81,116,33,68,71,72,38,73,59,74,75,66,76,77,117,79,80,32,97,98,99,118,119,120,121,122,123,124,125,126,127,128,129,130,131]))),$s=Kt(()=>B(()=>import(`./MobileBtwPage-DVZm5hrZ.js`).then(e=>({default:e.MobileBtwPage})),__vite__mapDeps([132,6,1,7,25,13,5,4,14,15,26,17,18,27,28,16,2,29,133,8,9,10,50,12,34,41,19,42,43,44,45,46,35,36,37,47,48,11,20,49,51,21,22,23,52,53,54,55,56,30,75,71,39,24,134,85,86,79,59,80,124,32,115,105,64,63,65,66,135,136,137,78,81,57,58,62,60,61,120,121,138,92,139,90,140,141,142]))),ec=Kt(()=>B(()=>import(`./MobileSettingsTab-MmDnxG47.js`).then(e=>({default:e.MobileSettingsTab})),__vite__mapDeps([143,6,1,7,25,13,5,4,14,15,26,17,18,27,28,16,2,29,98,99,108,21,22,23,109,8,9,10,144,34,12,145,146,41,19,42,43,44,45,46,35,36,37,47,48,11,20,49,147,51,24,50,52,53,54,55,56,30,57,58,69,70,124,74,148,32,115,105,104,149,81,150,151,152,153,154,155,156,157,158,159,160,161,133,75,71,162,163,116,63,64,65,66,164,33,39,165,166,112,113,128,121,117,79,59,80,167,168,169,125,126,127,142,170,171,172,173,174,175,176,177,118,178,179,180,181,182,120,89,90,140,183,184,119,122,123,129,185,73,76,77,114,68,72,38,97,130,131,186,187,188,189,190,191,192,193,194,195,196,197,198,199])));function tc(e){let t=(0,Q.c)(2),n;return t[0]===e?n=t[1]:(n=(0,$.jsx)(Xs,{...e}),t[0]=e,t[1]=n),n}function nc(e){let t=(0,Q.c)(2),n;return t[0]===e?n=t[1]:(n=(0,$.jsx)(Zs,{...e}),t[0]=e,t[1]=n),n}function rc(e){let t=(0,Q.c)(2),n;return t[0]===e?n=t[1]:(n=(0,$.jsx)(Qs,{...e}),t[0]=e,t[1]=n),n}function ic(e){let t=(0,Q.c)(2),n;return t[0]===e?n=t[1]:(n=(0,$.jsx)($s,{...e}),t[0]=e,t[1]=n),n}function ac(e){let t=(0,Q.c)(2),n;return t[0]===e?n=t[1]:(n=(0,$.jsx)(ec,{...e}),t[0]=e,t[1]=n),n}var oc=`yuri.mobile.homeView`;function sc(e){let t=(0,Q.c)(119),{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}=rt(),[b,x]=Z.useState(Oc),S;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(S=e=>{x(e);try{O().setItem(oc,e)}catch{}},t[0]=S):S=t[0];let C=R(S),w=te(Dc),T=G(),E=G(Ec),D=G(Tc),k=G(wc),A=G(Cc),j=G(Sc),M=G(xc),N=G(bc),P=G(yc),F=G(vc),I=G(_c),L=G(gc),ee=G(hc),z;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(z=[],t[1]=z):z=t[1],Z.useEffect(mc,z);let B=T.secondary?.kind===`chat`?T.secondary.btw??null:null,ne=Z.useRef(null),re,ie;t[2]===B?(re=t[3],ie=t[4]):(re=()=>{let e=ne.current;ne.current=B,e&&e!==B&&qt.getState().clear({sessionId:e.sessionId,directory:e.directory}),B?Yt(Zt):Xt(Zt)},ie=[B],t[2]=B,t[3]=re,t[4]=ie),Z.useEffect(re,ie);let ae;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(ae=[],t[5]=ae):ae=t[5],Z.useEffect(fc,ae);let oe;t[6]===E?oe=t[7]:(oe=e=>{e===`settings`&&te.getState().setSettingsPage(`home`),E(e)},t[6]=E,t[7]=oe);let V=R(oe),se;t[8]===D?se=t[9]:(se=e=>{D(e)},t[8]=D,t[9]=se);let H=R(se),U;t[10]===N?U=t[11]:(U=()=>{N()},t[10]=N,t[11]=U);let W=R(U),ce;t[12]===k?ce=t[13]:(ce=()=>{k()},t[12]=k,t[13]=ce);let le=R(ce),ue;t[14]===A?ue=t[15]:(ue=e=>{A(e)},t[14]=A,t[15]=ue);let de=R(ue),fe=Z.useRef(null),[pe,me]=Z.useState(!1),he;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(he=e=>{fe.current=e},t[16]=he):he=t[16];let q=R(he),ge;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(ge=e=>{me(e)},t[17]=ge):ge=t[17];let J=R(ge),_e;t[18]!==W||t[19]!==v||t[20]!==M||t[21]!==ee||t[22]!==P?(_e=()=>{if(fe.current?.())return!0;let e=G.getState().secondary;return e?.kind===`chat`&&e.btw?(ee(),!0):e?.kind===`assistant`&&e.settingsAssistantID?(M(),!0):(e?.kind===`draft`||e?.kind===`chat`)&&v?.onSelect?(v.onSelect(),!0):e?.kind===`chat`&&e.routes.length>1?(P(),!0):e?(W(),!0):!1},t[18]=W,t[19]=v,t[20]=M,t[21]=ee,t[22]=P,t[23]=_e):_e=t[23];let Y=R(_e),ve=T.secondary!==null,ye;t[24]!==Y||t[25]!==f?(ye=()=>{if(f)return f(()=>Y()),()=>f(null)},t[24]=Y,t[25]=f,t[26]=ye):ye=t[26];let be;t[27]!==Y||t[28]!==f||t[29]!==ve?(be=[f,ve,Y],t[27]=Y,t[28]=f,t[29]=ve,t[30]=be):be=t[30],Z.useEffect(ye,be);let xe=je(dc),Se=K(uc),Ce;t[31]===xe?Ce=t[32]:(Ce=e=>xe?e.getDirectoryForSession(xe):null,t[31]=xe,t[32]=Ce);let we=je(Ce),Te,Ee;t[33]!==we||t[34]!==xe||t[35]!==I||t[36]!==Se||t[37]!==L?(Te=()=>{let e=G.getState().secondary;if(Se)return;if(e?.kind===`draft`&&xe){I({sessionId:xe,directory:we});return}if(e?.kind!==`chat`||!xe||Ye({sessionId:xe,directory:we})===`internal`)return;let t=e.routes.at(-1);(t?.sessionId!==xe||h(t.directory)!==h(we))&&L({sessionId:xe,directory:we})},Ee=[we,xe,I,L,Se],t[33]=we,t[34]=xe,t[35]=I,t[36]=Se,t[37]=L,t[38]=Te,t[39]=Ee):(Te=t[38],Ee=t[39]),Z.useEffect(Te,Ee);let De,Oe;t[40]!==xe||t[41]!==v||t[42]!==F||t[43]!==Se?(De=()=>{let e=G.getState().secondary;if(e?.kind!==`chat`||!v||v.onSelect||Se)return;let t=e.routes.at(-1);!t||t.sessionId!==xe||F({sessionId:v.id,directory:v.directory})},Oe=[xe,v,F,Se],t[40]=xe,t[41]=v,t[42]=F,t[43]=Se,t[44]=De,t[45]=Oe):(De=t[44],Oe=t[45]),Z.useEffect(De,Oe);let ke;t[46]!==J||t[47]!==q||t[48]!==p?(ke=typeof p==`function`?p(q,J):p,t[46]=J,t[47]=q,t[48]=p,t[49]=ke):ke=t[49];let Ae=ke,Me;t[50]!==C||t[51]!==le||t[52]!==b||t[53]!==s||t[54]!==n||t[55]!==a||t[56]!==r||t[57]!==i||t[58]!==H?(Me=(0,$.jsx)(Js,{homeView:b,onHomeViewChange:C,onOpenChat:H,onAddProject:n,onNewSession:le,onScanQr:r,onSwitchInstance:i,onRemoteDesktop:a,instanceOptions:s}),t[50]=C,t[51]=le,t[52]=b,t[53]=s,t[54]=n,t[55]=a,t[56]=r,t[57]=i,t[58]=H,t[59]=Me):Me=t[59];let Ne;t[60]!==c||t[61]!==de?(Ne=(0,$.jsx)(nc,{onEnable:c,onOpenAssistant:de}),t[60]=c,t[61]=de,t[62]=Ne):Ne=t[62];let Pe;t[63]===Ae?Pe=t[64]:(Pe=(0,$.jsx)(Ys,{showHeader:!1,children:Ae}),t[63]=Ae,t[64]=Pe);let Fe;t[65]===l?Fe=t[66]:(Fe=(0,$.jsx)(ac,{instancesPage:l}),t[65]=l,t[66]=Fe);let Ie;t[67]!==Me||t[68]!==Ne||t[69]!==Pe||t[70]!==Fe?(Ie={projects:Me,assistant:Ne,scheduled:Pe,settings:Fe},t[67]=Me,t[68]=Ne,t[69]=Pe,t[70]=Fe,t[71]=Ie):Ie=t[71];let Le=Ie,Re=T.secondary?.kind??null,ze;bb0:{if(!Re){ze=null;break bb0}let e;t[72]!==Y||t[73]!==j||t[74]!==y?(e=e=>({key:`assistant-secondary`,depth:1,ariaLabel:y(`assistants.title`),onBack:Y,content:(0,$.jsx)(tc,{activeOverride:e,onMobileBack:lc,onMobileOpenSettings:j})}),t[72]=Y,t[73]=j,t[74]=y,t[75]=e):e=t[75];let n=e;if(Re===`assistant`){let e=T.secondary?.kind===`assistant`?T.secondary.settingsAssistantID:void 0,r=!e,i;t[76]!==n||t[77]!==r?(i=n(r),t[76]=n,t[77]=r,t[78]=i):i=t[78];let a;t[79]!==Y||t[80]!==e||t[81]!==y?(a=e?[{key:`assistant-settings:${e}`,depth:2,ariaLabel:y(`assistants.conversation.openSettings`),onBack:Y,content:(0,$.jsx)(rc,{assistantID:e,onBack:cc})}]:[],t[79]=Y,t[80]=e,t[81]=y,t[82]=a):a=t[82];let o;t[83]!==i||t[84]!==a?(o=[i,...a],t[83]=i,t[84]=a,t[85]=o):o=t[85],ze=o;break bb0}if(Re===`instances`){let e;t[86]===y?e=t[87]:(e=y(`mobile.settings.switchInstance`),t[86]=y,t[87]=e);let n;t[88]!==Y||t[89]!==u||t[90]!==e?(n=[{key:`instances-secondary`,depth:1,ariaLabel:e,onBack:Y,content:u}],t[88]=Y,t[89]=u,t[90]=e,t[91]=n):n=t[91],ze=n;break bb0}if(T.secondary?.kind===`draft`){let e;t[92]===y?e=t[93]:(e=y(`mobile.nav.secondaryPageAria`),t[92]=y,t[93]=e);let n;t[94]===m?n=t[95]:(n=m({sessionId:``,directory:null,viewKey:`chat-primary`,active:!0}),t[94]=m,t[95]=n);let r;t[96]!==Y||t[97]!==e||t[98]!==n?(r=[{key:`chat-primary`,depth:1,ariaLabel:e,onBack:Y,content:n}],t[96]=Y,t[97]=e,t[98]=n,t[99]=r):r=t[99],ze=r;break bb0}if(T.secondary?.kind!==`chat`){let e;t[100]===Symbol.for(`react.memo_cache_sentinel`)?(e=[],t[100]=e):e=t[100],ze=e;break bb0}let r=T.secondary.routes,i;if(t[101]!==n||t[102]!==Y||t[103]!==T.secondary.btw||t[104]!==T.secondary.returnTo||t[105]!==m||t[106]!==r||t[107]!==y){let e=T.secondary.returnTo?[n(!1)]:[],a=T.secondary.btw,o=r.slice(a?-1:-2),s=r.length-o.length+1+e.length,c=o.map((e,t)=>{let n=!a&&t===o.length-1;return{key:e.key,depth:s+t,ariaLabel:y(`mobile.nav.secondaryPageAria`),onBack:Y,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:Y,content:(0,$.jsx)(ic,{route:a})}]:[...e,...c],t[101]=n,t[102]=Y,t[103]=T.secondary.btw,t[104]=T.secondary.returnTo,t[105]=m,t[106]=r,t[107]=y,t[108]=i}else i=t[108];ze=i}let Be=ze,Ve;t[109]===Be?Ve=t[110]:(Ve=Be??[],t[109]=Be,t[110]=Ve);let He=pe||w||_,Ue;return t[111]!==g||t[112]!==b||t[113]!==T||t[114]!==V||t[115]!==Ve||t[116]!==He||t[117]!==Le?(Ue=(0,$.jsx)(Vs,{homeView:b,className:g,navigation:T,onTabChange:V,tabs:Le,secondaryPages:Ve,tabBarCovered:He}),t[111]=g,t[112]=b,t[113]=T,t[114]=V,t[115]=Ve,t[116]=He,t[117]=Le,t[118]=Ue):Ue=t[118],Ue}function cc(){Vt.requestAnimatedBack(`root`)}function lc(){return Vt.requestAnimatedBack(`root`)}function uc(e){return e.remoteSession}function dc(e){return e.currentSessionId}function fc(){return pc}function pc(){return Xt(Zt)}function mc(){return Re()}function hc(e){return e.popBtw}function gc(e){return e.replaceChatSession}function _c(e){return e.materializeDraftSession}function vc(e){return e.reconcileChatPredecessor}function yc(e){return e.popChatSession}function bc(e){return e.closeSecondary}function xc(e){return e.popAssistantSettings}function Sc(e){return e.pushAssistantSettings}function Cc(e){return e.openAssistant}function wc(e){return e.openDraft}function Tc(e){return e.openSession}function Ec(e){return e.setActiveTab}function Dc(e){return e.isCommandPaletteOpen}function Oc(){return Dr(O().getItem(oc))}function kc(e){let t=(0,Q.c)(7),n=e===void 0?2500:e,{uiFont:r}=cr(),[i,a]=Z.useState(!1),o,s;t[0]===i?(o=t[1],s=t[2]):(o=()=>{if(!i)return;let e=document.getElementById(`initial-loading`);if(!e)return;e.classList.add(`fade-out`);let t=window.setTimeout(()=>e.remove(),300);return()=>window.clearTimeout(t)},s=[i],t[0]=i,t[1]=o,t[2]=s),Z.useEffect(o,s);let c,l;return t[3]!==n||t[4]!==r?(c=()=>{let e=!1,t=()=>{e||a(!0)},i=()=>{requestAnimationFrame(()=>requestAnimationFrame(t))},o=Promise.all([Dn(r).catch(Pc),document.fonts?.ready?.then(Nc).catch(Mc)??Promise.resolve(),Ji.catch(jc)]).then(Ac),s=new Promise(e=>{window.setTimeout(e,n)});return Promise.race([o,s]).then(i),()=>{e=!0}},l=[r,n],t[3]=n,t[4]=r,t[5]=c,t[6]=l):(c=t[5],l=t[6]),Z.useEffect(c,l),i}function Ac(){}function jc(){}function Mc(){}function Nc(){}function Pc(){}var Fc=e=>e.replace(/^\/+|\/+$/g,``),Ic=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},Lc=e=>{let t=Fc(e.pathname).split(`/`).filter(Boolean);return e.host?[e.host,...t]:t};function Rc(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=Lc(t),r=(n[0]??``).toLowerCase(),i=n.slice(1),a=t.searchParams;switch(r){case`connect`:{let t=Ei(e);return t?{type:`connect`,pairing:t}:null}case`session`:{let e=i[0]||a.get(`id`)||``;return e?{type:`session`,sessionId:e,directory:Ic(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:Ic(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=Ic(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 zc={},Bc=null,Vc=!1,Hc=null,Uc=e=>{switch(e.type){case`connect`:return Bc?(Bc(e.pairing),!0):!1;case`session`:return _()?(je.getState().setCurrentSession(e.sessionId,e.directory??null),!0):(G.getState().openSession({sessionId:e.sessionId,directory:e.directory??null}),!0);case`assistant`:if(!_()){let t=G.getState();return t.setActiveTab(`assistant`),t.openAssistant(e.assistantId),!0}return ot(e.assistantId),!0;case`new-session`:return _()?(je.getState().openNewSessionDraft({directoryOverride:e.directory??null,selectedProjectId:e.projectId??null,preserveDirectoryOverride:!!e.directory,ensureProjectForDirectory:!!e.directory,initialPrompt:e.prompt}),!0):(G.getState().openDraft({directoryOverride:e.directory??null,selectedProjectId:e.projectId??null,preserveDirectoryOverride:!!e.directory,ensureProjectForDirectory:!!e.directory,initialPrompt:e.prompt}),!0);case`open-project`:return _()?(je.getState().openNewSessionDraft({directoryOverride:e.directory,preserveDirectoryOverride:!0}),!0):(G.getState().openDraft({directoryOverride:e.directory,preserveDirectoryOverride:!0}),!0);case`sessions`:return zc.openSessions?(zc.openSessions(e.filter),!0):!1;case`status`:return zc.openSessions?(zc.openSessions(),!0):(te.getState().setMobileSessionPanelOpen(!0),!0);case`view`:return zc.openView?(zc.openView(e.target),!0):!1;case`changes`:return zc.openChanges?(zc.openChanges({path:e.path,staged:e.staged}),!0):!1;case`settings`:return zc.openSettings?(zc.openSettings(e.section),!0):!1}return!1},Wc=()=>{if(!Hc||!Vc&&Hc.type!==`connect`)return;let e=Hc;Hc=null,Uc(e)||(Hc=e)},Gc=e=>{Hc=e,Wc()},Kc=e=>{let t=Rc(e);t&&Gc(t)},qc=e=>{Vc=e,Wc()},Jc=e=>{let t=(0,Q.c)(3),n,r;t[0]===e?(n=t[1],r=t[2]):(n=()=>(zc=e,Wc(),()=>{zc===e&&(zc={})}),r=[e],t[0]=e,t[1]=n,t[2]=r),Z.useEffect(n,r)},Yc=e=>{let t=(0,Q.c)(3),n,r;t[0]===e?(n=t[1],r=t[2]):(n=()=>(Bc=e,Wc(),()=>{Bc===e&&(Bc=null)}),r=[e],t[0]=e,t[1]=n,t[2]=r),Z.useEffect(n,r)},Xc=e=>{let{ready:t}=e,[n,r]=Z.useState(()=>g()?`pending`:`none`);return Z.useEffect(()=>{qc(t)},[t]),Z.useEffect(()=>{if(!g())return;let e=!1,t=[];return B(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=>{Kc(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=Rc(a?.url);r(o?.type===`connect`?`connect`:o?`other`:`none`),o&&Gc(o)}).catch(()=>{e||r(`none`)}),B(async()=>{let{PushNotifications:e}=await import(`./vendor-capacitor-push-notifications-D5cqJIPw.js`).then(e=>e.t);return{PushNotifications:e}},__vite__mapDeps([200,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){Kc(n);return}let r=typeof t?.assistantID==`string`?t.assistantID.trim():``;if(r){Gc({type:`assistant`,assistantId:r});return}let i=typeof t?.sessionId==`string`?t.sessionId:void 0;i&&Gc({type:`session`,sessionId:i})});if(e){r.remove();return}t.push(()=>void r.remove())}).catch(()=>void 0),()=>{e=!0,t.forEach(e=>e())}},[]),n},Zc=.85,Qc=8,$c=.35,el=.22,tl=e=>({segmentStart:e,lastTouch:e,open:!1}),nl=e=>e*$c,rl=e=>e*el,il=(e,t)=>Math.max(0,e-t),al=(e,t)=>Math.max(0,t-e),ol=(e,t)=>{let n=Math.abs(e);return n<Qc||Math.abs(t)<=n*Zc},sl=(e,t,n)=>{let r=t.clientX-e.segmentStart.clientX,i=t.clientY-e.segmentStart.clientY,a=il(e.segmentStart.clientX,t.clientX),o=nl(n),s=rl(n),c=e.open;return c=a<=0?!1:e.open?a>=s:a>=o&&ol(r,i),{segmentStart:e.segmentStart,lastTouch:t,open:c}},cl=e=>{if(e.disabled||e.startedOnExcludedTarget)return{open:!1,back:!1};let t=e.endX-e.startX,n=e.endY-e.startY,r=il(e.startX,e.endX),i=al(e.startX,e.endX),a=nl(e.viewportWidth),o=ol(t,n);return{open:r>=a&&o,back:i>=a&&o}},ll=(e,t,n)=>Math.min(il(e,t)/Math.max(1,nl(n)),1),ul=(e,t,n)=>Math.min(al(e,t)/Math.max(1,nl(n)),1),dl=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},fl=e=>{let t=document.elementFromPoint(e.clientX,e.clientY);return!!t?.closest(`.yuri-mobile-composer`)||dl(t)},pl=1,ml=(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===pl?n:n.parentElement;return!!(r&&t.contains(r))},hl=e=>ml(window.getSelection(),e),gl=(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=nl(g),n=Be({thresholdReached:p,distance:e,enterDistance:t,cancelDistance:rl(g),available:!0});p=n.thresholdReached,n.event===`enter`&&(m=Ge(`medium`,{bypassCadence:!0})),n.event===`cancel`&&(Ge(`light`,{bypassCadence:!0}),m=!1)},y=e=>{o.current?.(null),p&&!e&&Ge(`light`,{bypassCadence:!0}),p=!1,m=!1,e?r.current():f&&a.current?.(),f=!1},b=e=>{c.current?.(null),p&&!e&&Ge(`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=fl(r)||hl(t),d=null,f=!1,p=!1,m=!1,h=0,_=tl(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];_=sl(_,r,g);let a=r.clientX-_.segmentStart.clientX,l=r.clientY-_.segmentStart.clientY;if(d===null){if(hl(t))return;let e=Math.abs(a);if(e<Qc||Math.abs(l)>e*Zc)return;if(a<0)d=`sessions`,f=!0,i.current?.();else if(s.current)d=`back`;else return}e.preventDefault(),h=d===`sessions`?il(_.segmentStart.clientX,r.clientX):al(_.segmentStart.clientX,r.clientX),v(h),d===`sessions`?o.current?.(ll(_.segmentStart.clientX,r.clientX,g)):c.current?.(ul(_.segmentStart.clientX,r.clientX,g))},C=e=>{if(!n||!_)return;if(n=!1,!d){_=null;return}let t=e.changedTouches[0];t&&(_=sl(_,t,g),h=d===`sessions`?il(_.segmentStart.clientX,t.clientX):al(_.segmentStart.clientX,t.clientX),v(h));let r=d===`sessions`?_.open:cl({startX:_.segmentStart.clientX,startY:_.segmentStart.clientY,endX:_.lastTouch.clientX,endY:_.lastTouch.clientY,viewportWidth:g,disabled:!1,startedOnExcludedTarget:!1}).back;_=null,e.preventDefault(),r&&!m&&Ge(`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])},_l=ee(`YuriNotifications`),vl=()=>z.getPlatform()===`android`&&z.isPluginAvailable(`YuriNotifications`);async function yl(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 tn()).find(e=>rn(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 bl(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 xl=()=>{if(vl()||typeof window>`u`)return!1;let e=window.Capacitor?.getPlatform?.();return e===`ios`||e===`android`},Sl=(e,t)=>{x()?.push?.registerApnsToken?.({token:e,platform:y(),locale:t})},Cl=e=>{let{enabled:t}=e,n=te(e=>e.nativeNotificationsEnabled),r=it(e=>e.locale),i=Z.useRef(null),a=Z.useRef(r);a.current=r,Z.useEffect(()=>{if(!t||!n||!xl())return;let e=!1,r=[];return B(async()=>{let{PushNotifications:e}=await import(`./vendor-capacitor-push-notifications-D5cqJIPw.js`).then(e=>e.t);return{PushNotifications:e}},__vite__mapDeps([200,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,Sl(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||!xl())return;let e=i.current;e&&Sl(e,r)},[t,n,r]),Z.useEffect(()=>{if(n)return;let e=i.current;e&&(i.current=null,x()?.push?.unregisterApnsToken?.({token:e}))},[n])},wl=`YuriLiveActivity`,Tl=5e3,El=3600,Dl=`live`,Ol=ee(wl),kl=e=>e.isCapacitor&&e.platform===`ios`&&e.pluginAvailable;function Al(){return typeof window>`u`?!1:kl({isCapacitor:g(),platform:y(),pluginAvailable:z.isPluginAvailable(wl)})}var jl=()=>Ol,Ml=new Set([`permission`,`input`,`retry`]),Nl=()=>({trackedSessionId:null,started:!1,startedAt:null,busySince:null,lastStatus:null,eventVersion:0,items:[]}),Pl=(e,t)=>Math.max(Math.floor(e),t+1),Fl=e=>e.failedEpoch===e.currentEpoch?e.previous:e.current,Il=e=>e.failedEpoch===e.currentEpoch&&e.retryCount<1,Ll=e=>e.hasSessionError?`error`:e.hasPendingPermissions?`permission`:e.hasPendingQuestions?`input`:e.statusType===`retry`?`retry`:e.statusType===`busy`?`working`:e.statusType===`idle`?`complete`:null,Rl=e=>{let t=e.trim();return t.length<=80?t:`${t.slice(0,79)}…`},zl=e=>typeof e.parentID==`string`&&e.parentID.length>0?e.parentID:null,Bl=e=>{if(e.runningIds.size===0)return[];let t=[];for(let n of e.sessions)!e.runningIds.has(n.id)||zl(n)||t.push({sessionId:n.id,title:Rl(n.title??``),statusType:e.statuses[n.id]?.type??`busy`});return t},Vl=e=>e!==`complete`&&e!==`error`,Hl=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`,Ul=e=>{if(e.length<=4)return e;let t=e.filter(e=>Vl(e.status)),n=e.filter(e=>!Vl(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)},Wl=(e,t,n,r)=>{if(n&&n.length>0)return n;let i=r?.[e];return i&&i.length>0?i:t},Gl=(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=Ll({statusType:e.statusType,hasPendingPermissions:e.hasPendingPermissions===!0,hasPendingQuestions:e.hasPendingQuestions===!0,hasSessionError:e.hasSessionError===!0})??`working`;o.push({sessionId:t.sessionId,title:Wl(t.sessionId,t.title,e.title,r),status:i,startedAt:t.startedAt,busySince:i===`working`?t.busySince??n:null})}else if(Vl(t.status))o.push({...t,title:Wl(t.sessionId,t.title,void 0,r),status:`complete`,endedAt:n,busySince:null});else{let e=Wl(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=Ll({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 Ul(o)},Kl=e=>e.map(e=>`${e.sessionId}\0${e.title}\0${e.status}\0${e.endedAt??``}`).join(`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/vendor-capacitor-app-B5H_XtmE.js","assets/rolldown-runtime-hePW80VL.js","assets/vendor-aparajita-capacitor-secure-storage-xol_6BsB.js","assets/AssistantView-8fyAae7J.js","assets/runtime-switch-DEPKHgdL.js","assets/runtime-auth-DA-qfGHk.js","assets/vendor-base-ui-wXsskyKm.js","assets/vendor-react-BkccXcWz.js","assets/vendor-reactuses-core-DjKFMfz7.js","assets/vendor-lodash-es-BS45jPoZ.js","assets/vendor-js-cookie-hSOiFTtX.js","assets/useUIStore-C3ewjGgP.js","assets/reasoning-projection-client-BEhVknv9.js","assets/platform-CiUKDeXd.js","assets/runtimeAPIRegistry-C2VogTny.js","assets/vendor-pathe-vBmvQE8f.js","assets/vendor-zustand-CTekDqaS.js","assets/brand-storage-bootstrap-D4BW3w-M.js","assets/brand-storage-migration-Bhz6UOBJ.js","assets/safeStorage-DTOhKN0V.js","assets/useMobileHtmlPreviewStore-BYunNOBo.js","assets/session-startup-barrier-DT-hIBRf.js","assets/vendor-class-variance-authority-BLUaYARZ.js","assets/vendor-tailwind-merge-BicNWLTg.js","assets/Icon-DmykXZL1.js","assets/i18n-DXc6czdR.js","assets/runtime-ead7P81A.js","assets/bootstrap-eLlfzqAI.js","assets/store-C1ifDY0C.js","assets/tour-CMXP3Kif.js","assets/useAssistantUIStore-CpJZ4Rqs.js","assets/mobileAppContext-BQgdTp5T.js","assets/device-EIfSfSWk.js","assets/assistantQueries-NdPqu6rx.js","assets/runtime-fetch-V-iMWR8t.js","assets/vendor-tanstack-react-query-DIb_ItL-.js","assets/vendor-tanstack-query-core-BSjXNgF_.js","assets/yuriEvents-BFrD5fMU.js","assets/assistantPresentation-DRbsH1Ej.js","assets/MobileDetailNavigation-ldTzGo19.js","assets/AssistantConversationSurface-36aP0hRf.js","assets/gitApiHttp-Dd-FwgCq.js","assets/client-B_907PBv.js","assets/vendor-opencode-client-BM2r1f0o.js","assets/vendor-effect-X1Hqc7ba.js","assets/prompt-attachment-upload-B5DHrw6U.js","assets/runtime-file-resource-Bc_ss-sW.js","assets/path-utils-jGozTg9d.js","assets/runtime-file-store-BVRgEtI-.js","assets/uuid-D-SDZijH.js","assets/ui-ee2iN869.js","assets/vendor-sonner-DX3nfJx4.js","assets/remoteProjectQueries-C8382jM8.js","assets/vendor-zod-DZzbCm1s.js","assets/vendor-opencode-schema-DWT45VBX.js","assets/input-store-BSJBQTMi.js","assets/toolHelpers-iEHVHQ9p.js","assets/ScrollableOverlay-stxT7gLf.js","assets/OverlayScrollbar-D6vmoMkQ.js","assets/vendor-framer-motion-D5NyyC73.js","assets/ImageLoadingPlaceholder-DgM_EFHn.js","assets/image-loading-DA9JEHD8.css","assets/LoadingImage-Df22Rkor.js","assets/MarkdownRenderer-VvziwyJB.js","assets/useEffectiveDirectory-DiJBIfai.js","assets/markdownHeightCache-CHGGNhWI.js","assets/dualLimitLru-D8Sphgua.js","assets/imageSource-BR4C9TuS.js","assets/MobileShareBridge-CZpFYmiy.js","assets/dialog-BeFBA6ja.js","assets/dialog-D9CkSNCA.css","assets/rasterizePng-056Poix7.js","assets/mobileConnections-x07fHO_5.js","assets/AgentAvatar-CHCjMxCF.js","assets/useThemeSystem-BIXghnHj.js","assets/agentColors-DWSbQXy2.js","assets/vendor-dicebear-core-CV95S5Pg.js","assets/vendor-dicebear-styles-C4OfoX7R.js","assets/chatUpwardIntent-B2NrGMm-.js","assets/MobileResizableSheet-CqphcaKq.js","assets/MobileWindowStack-DGLdgoGr.js","assets/textarea-ZiXxEOHK.js","assets/fileMentionTouchSelection-BQEUty_A.js","assets/vendor-fuzzysort-ukaRp9PC.js","assets/fileMentionAutocompleteState-B9411b4o.js","assets/spacedFileMention-Ds4GtgiF.js","assets/vendor-fuse.js-DB5wDJbI.js","assets/reference-history-IEuzG8KC.js","assets/themes-BgDJcxRc.js","assets/useDictation-CZzAlsW0.js","assets/audio-session-BFWjrDbp.js","assets/reference-history-8C8nv-EP.css","assets/vendor-motion-vLNN8EMu.js","assets/assistant-attachment-cache-bRIIESGe.js","assets/AssistantWorkingAvatar-CoxhuMvM.js","assets/AssistantSessionCard-CZ-1oJiE.js","assets/sessionLookup-DQOiycHr.js","assets/scheduledTaskNavigation-VVTOq9n2.js","assets/router-DXUi1sBd.js","assets/contextPanelEmbeddedChat-Dm5R_b5X.js","assets/AssistantConversationSurface-B59k-lXE.css","assets/AssistantUnreadBadge-p9mkpbMC.js","assets/sortAssistantContacts-CcEdm3mS.js","assets/assistantMessagePreview-DLBvPQtq.js","assets/context-menu-CKlB6wxo.js","assets/dropdown-menu.styles-BDla58Rm.js","assets/MobileAssistantTab-CMIQansR.js","assets/select-assistant-mmsKjj2O.js","assets/MobileSurface-cmaGf3hZ.js","assets/MobileTabPageHeader-D6P4K98S.js","assets/useMobileSwipeActions-XoxrtaUo.js","assets/MobileAssistantSettingsPage-Dgq5FMho.js","assets/ErrorBoundary-D7QcwhmL.js","assets/card-DmysoUAV.js","assets/AssistantsSettingsPage-DD6spbXz.js","assets/dropdown-menu-BblI9sN2.js","assets/input-Cf16qJ6g.js","assets/select-vZCgcnYG.js","assets/SettingsGroup-CvaPYznp.js","assets/ModelSelector-EmtltPnd.js","assets/ModelLogo-BkbD514M.js","assets/zhipuai-coding-plan-CcFj8zKy.js","assets/useModelLists-Bf60FIJu.js","assets/vendor-tanstack-react-virtual-qsd3nvZb.js","assets/tooltip-CpTbxEOE.js","assets/vendor-dnd-kit-core-qy5stxu5.js","assets/vendor-dnd-kit-accessibility-u0XSXxKq.js","assets/vendor-dnd-kit-sortable-CiTIuX4o.js","assets/ProviderLogo-DA98yu7M.js","assets/useOpenCodeReadiness-Dm6BjA1T.js","assets/vendor-qrcode-D7jBCyl-.js","assets/vendor-dijkstrajs-BAzPDGZM.js","assets/MobileBtwPage-DQUkSO6N.js","assets/mobileBackNavigation-C94n2eLT.js","assets/BtwPanel-BkobGcf3.js","assets/SessionSurfaceContext-BP4NCKp6.js","assets/useSessionBtwStore-CwvlMabN.js","assets/nativeComposerCover-Bhv1EKPT.js","assets/inlineMessageLinks-DC78iKO5.js","assets/auto-read-context-ClBUErN2.js","assets/browserVoiceService-x5Pci8L3.js","assets/vendor-marked-S3gCOYp1.js","assets/timeFormat-dCsf2MQv.js","assets/MobileSettingsTab-DaTtRHo1.js","assets/SettingsView-DEU94-h1.js","assets/desktopHosts-BsTrBVja.js","assets/desktopRelayRestore-BxbRKak_.js","assets/vendor-codemirror-autocomplete-C0FrlFqZ.js","assets/react-CPBNl-S9.js","assets/collapsible-Z0IjDAMO.js","assets/appThemeRegistry-BdjrGBQ4.js","assets/vendor-pierre-diffs-B0OmIhMO.js","assets/vendor-hast-util-to-html-Bw_SgZ1t.js","assets/vendor-character-entities-legacy-Wut6vMuj.js","assets/vendor-character-entities-html4-DlN_yAFd.js","assets/vendor-ccount-CyGsA0u7.js","assets/vendor-comma-separated-tokens-B9ouxNNS.js","assets/vendor-oniguruma-to-es-CrHzjjSU.js","assets/vendor-oniguruma-parser-D2DIvhSP.js","assets/vendor-diff-Dq7CZNim.js","assets/vendor-lru_map-BMOrLc9L.js","assets/gitApi-CoVwjIDy.js","assets/GuiPluginMount-TC5FELtQ.js","assets/MobileHtmlNetworkBoundary-DlPF4iPS.js","assets/shortcuts-WkN3Gh8v.js","assets/pwa-CtDladgB.js","assets/vendor-simplewebauthn-browser-Dwhcdg_5.js","assets/githubAuthQueries-DqregESf.js","assets/projectMeta-vIaGFaQr.js","assets/sortable-tabs-strip-DmtfYPz0.js","assets/permission-rules-DoQUXKll.js","assets/useQuotaStore-CSn2pk3T.js","assets/quota-CqWNkFzw.js","assets/sessionOwnership-BjhXe6pi.js","assets/types-DpcA-uDW.js","assets/mcpQueries-Rmp1BKeo.js","assets/usePluginsStore-Du4WlceO.js","assets/switch-CNmsFYfY.js","assets/useMcpConfigStore-DKTl0PvE.js","assets/native-config-DVg8_Zx1.js","assets/YuriLogo-Cp6vWDWp.js","assets/GuiPluginWindow-BkAFJyFd.js","assets/pluginPresentation-DtyC8NF2.js","assets/speechSettingsQueries-BmkXNn4w.js","assets/pluginPresentation-C0HSdVvS.css","assets/AgentSelector-uBoLtut8.js","assets/ArchivedSessionsDialog-DZcicxVO.js","assets/vendor-codemirror-lang-angular-Cm7vBE3E.js","assets/vendor-codemirror-lang-json-DowyFczU.js","assets/vendor-codemirror-lang-markdown-npWBZIoE.js","assets/vendor-codemirror-lang-python-OPRdU26g.js","assets/vendor-codemirror-legacy-modes-DwltVFbT.js","assets/MobileOverlayPanel-C36VWWmN.js","assets/worktreeManager-DGu8M01Z.js","assets/markdown-worker-oBGEB9Eg.js","assets/vendor-codemirror-commands-5saeUOVY.js","assets/vendor-codemirror-search-hZY-L2l8.js","assets/vendor-replit-codemirror-vim-BmQmU1lR.js","assets/vendor-codemirror-language-data-B3pLWvv-.js","assets/vendor-yaml-C9KlJAlj.js","assets/vendor-capacitor-push-notifications-D5cqJIPw.js","assets/ChatView-ByMRjY1h.js","assets/useProjectRuntimeAPIs-tjGuODhu.js","assets/terminalApi-DXvEquBF.js","assets/useProjectGitStore-DzU2pvrH.js","assets/useGitStore-Bv8xmXDa.js","assets/ChatContainer-BfQ7RXwY.js","assets/useInlineCommentDraftStore-B2mkmAZd.js","assets/truncated-path-CcmWjgCQ.js","assets/kbd-CamdaxHJ.js","assets/TextSelectionMenu-h8iUeNzE.js","assets/useDebouncedValue-BHlMPqY8.js","assets/checkbox-BMN5hAVm.js","assets/connection-hint-B-kOWome.js","assets/insertionBoundaries-Btqgsu1M.js","assets/BusyDots-COTTwItx.js","assets/worktreeSourceBranchPreference-CuLKwxkx.js","assets/remote-input-store-C6UIEZxp.js","assets/vendor-cmdk-BDWoZLve.js","assets/vendor-aria-hidden-BbL3cEyI.js","assets/queue-abort-optimistic-DFbWDRKT.js","assets/ToolOutputDialog-DpaaQ1uZ.js","assets/runtime-file-download-BWeoSXRb.js","assets/tap-LkQum5bB.js","assets/markdownTheme-D84XyNiT.js","assets/DiffViewToggle-BwJ6MYB7.js","assets/touch-gestures-DOoBxhz5.js","assets/FadeInOnReveal-B3uT04YJ.js","assets/useStreamingTextThrottle-C9SaKeil.js","assets/ChatContainer-K31q-1OV.css","assets/DiffView-Bbit6OZ8.js","assets/PierreDiffViewer-DVKsdwJR.js","assets/DiffWorkerProvider-VFPkag9y.js","assets/MobileChangesSurface-DsYNmAuM.js","assets/useProjectGitActions-D3B9ma9z.js","assets/SyncActions-CrOoREWF.js","assets/MobileFilesSurface-CF3EW_SK.js","assets/BinaryFileFallback-DgYaMG9f.js","assets/relay-preview-frame-src-BPyz3nXA.js","assets/BinaryFileFallback-CKNAgvHj.css","assets/MobileChatScreen-p356_BCN.js","assets/useMobileTranscriptSyncHint-DM8WG7kz.js","assets/icons-Bd-INsoy.js","assets/GuiPluginTitlebarItems-DxFINwbr.js","assets/RemoteDesktopPanel-f3vRj4ZP.js","assets/ScheduledTasksDialog-D_hBP47Y.js","assets/vendor-cron-parser-BmO80h0C.js","assets/vendor-capacitor-status-bar-D9bcMr9Q.js","assets/vendor-capacitor-keyboard-BRVcFyc9.js"])))=>i.map(i=>d[i]);
2
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{S as t,_ as n,p as r,r as i,t as a,v as o}from"./runtime-auth-DA-qfGHk.js";import{c as s,f as c,i as l,l as u,n as d,r as f,t as p}from"./runtime-switch-DEPKHgdL.js";import{n as m}from"./runtime-fetch-V-iMWR8t.js";import{f as h,n as g,r as _,s as v,t as y}from"./platform-CiUKDeXd.js";import{n as b,t as x}from"./runtimeAPIRegistry-C2VogTny.js";import{a as S}from"./vendor-zustand-CTekDqaS.js";import{ot as C,st as w}from"./vendor-base-ui-wXsskyKm.js";import{Mt as T,Pt as E,St as D}from"./gitApiHttp-Dd-FwgCq.js";import"./brand-storage-bootstrap-D4BW3w-M.js";import{n as O}from"./safeStorage-DTOhKN0V.js";import{n as k}from"./client-B_907PBv.js";import{n as A,t as j}from"./vendor-react-BkccXcWz.js";import{s as M}from"./vendor-tanstack-react-query-DIb_ItL-.js";import{E as N,R as P,k as F}from"./runtime-file-resource-Bc_ss-sW.js";import{i as I,l as L,r as R}from"./vendor-reactuses-core-DjKFMfz7.js";import{a as ee,n as z,o as B}from"./vendor-aparajita-capacitor-secure-storage-xol_6BsB.js";import{r as te}from"./useUIStore-C3ewjGgP.js";import{a as ne,o as re,s as ie,t as ae}from"./useMobileHtmlPreviewStore-BYunNOBo.js";import{t as oe}from"./capgoAdapter-pfQJmvW2.js";/* empty css */import{r as V}from"./vendor-sonner-DX3nfJx4.js";import{c as se,i as H,o as U}from"./session-startup-barrier-DT-hIBRf.js";import{n as W}from"./Icon-DmykXZL1.js";import{At as G,Bi as ce,Di as le,Gr as ue,Hi as de,Ia as K,Ja as fe,Ji as pe,K as me,L as he,Lr as q,Mi as ge,Na as J,Ni as _e,Nr as Y,Oi as ve,Qn as ye,Qt as be,R as xe,Si as Se,Ti as Ce,V as we,Vr as Te,Vt as Ee,Wr as De,a as Oe,bi as ke,et as Ae,f as je,fn as Me,hi as Ne,i as Pe,ir as Fe,jn as Ie,k as Le,kt as Re,lt as ze,n as Be,nr as Ve,o as He,pr as Ue,q as We,r as Ge,rr as Ke,rt as qe,t as X,ut as Je,wt as Ye,zr as Xe}from"./ui-ee2iN869.js";import{d as Ze,h as Qe,i as $e,m as et,p as tt}from"./remoteProjectQueries-C8382jM8.js";import{r as nt,t as rt}from"./i18n-DXc6czdR.js";import{i as it,n as at}from"./store-C1ifDY0C.js";import{n as ot}from"./useAssistantUIStore-CpJZ4Rqs.js";import{n as st,t as ct}from"./ScrollableOverlay-stxT7gLf.js";import{d as lt,r as ut,t as dt,u as ft,v as pt}from"./MobileResizableSheet-CqphcaKq.js";import{t as mt}from"./mobileAppContext-BQgdTp5T.js";import{a as ht,i as gt,n as _t,o as vt,r as yt,t as bt}from"./dialog-BeFBA6ja.js";import{r as xt}from"./tooltip-CpTbxEOE.js";import{i as St,o as Ct,t as wt}from"./device-EIfSfSWk.js";import{c as Tt,n as Et,r as Dt,t as Ot}from"./dropdown-menu-BblI9sN2.js";import{t as kt}from"./DiffWorkerProvider-VFPkag9y.js";import{a as At,c as jt,o as Mt,s as Nt}from"./useGitStore-Bv8xmXDa.js";import{A as Pt,E as Ft,a as It,j as Lt,n as Rt,p as zt,r as Bt,t as Vt}from"./mobileBackNavigation-C94n2eLT.js";import{i as Ht,t as Ut}from"./MobileHtmlNetworkBoundary-DlPF4iPS.js";import{t as Wt}from"./relay-preview-frame-src-BPyz3nXA.js";/* empty css */import{t as Gt}from"./input-Cf16qJ6g.js";import{o as Kt}from"./MarkdownRenderer-VvziwyJB.js";import{o as qt}from"./useSessionBtwStore-CwvlMabN.js";import{a as Jt,i as Yt,o as Xt,t as Zt}from"./nativeComposerCover-Bhv1EKPT.js";import{a as Qt,i as $t,l as en,o as tn,r as nn,s as rn,t as an,u as on}from"./mobileConnections-x07fHO_5.js";import{m as sn,v as cn,x as ln,y as un}from"./assistantQueries-NdPqu6rx.js";import{a as dn,t as fn}from"./MobileShareBridge-CZpFYmiy.js";import{t as pn}from"./MobileDetailNavigation-ldTzGo19.js";import{A as mn,C as hn,D as gn,E as _n,M as vn,N as yn,O as bn,R as xn,S as Sn,T as Cn,i as wn,j as Tn,k as En,r as Dn,t as On,w as kn,x as An,z as jn}from"./useAppFontEffects-rbTKcF0f.js";import{S as Mn}from"./pwa-CtDladgB.js";import{t as Nn}from"./YuriLogo-Cp6vWDWp.js";import{t as Pn}from"./ErrorBoundary-D7QcwhmL.js";import{L as Fn,R as In,T as Ln,X as Rn,i as zn,t as Bn}from"./BusyDots-COTTwItx.js";import{r as Vn}from"./queue-abort-optimistic-DFbWDRKT.js";import{t as Hn}from"./MobileOverlayPanel-C36VWWmN.js";import{n as Un,t as Wn}from"./ProviderLogo-DA98yu7M.js";import{n as Gn,s as Kn}from"./worktreeManager-DGu8M01Z.js";import{a as qn,i as Jn,n as Yn}from"./projectMeta-vIaGFaQr.js";import{i as Xn,n as Zn,t as Qn}from"./auto-read-context-ClBUErN2.js";import{a as $n,n as er,r as tr,u as nr}from"./useQuotaStore-CSn2pk3T.js";import{a as rr,i as ir,s as ar}from"./quota-CqWNkFzw.js";import{t as or}from"./openRemoteProjectSession-DNr74gHD.js";import{i as sr}from"./router-DXUi1sBd.js";import{t as cr}from"./useFontPreferences-BiRBKhti.js";import{C as lr,Ct as ur,Dt as dr,Et as fr,F as pr,It as mr,J as hr,L as gr,Lt as _r,Mt as vr,Nt as yr,Ot as br,P as xr,Pt as Sr,Q as Cr,Rt as wr,S as Tr,St as Er,T as Dr,Tt as Or,X as kr,Y as Ar,Z as jr,_t as Mr,a as Nr,at as Pr,b as Fr,c as Ir,ct as Lr,d as Rr,dt as zr,et as Br,f as Vr,ft as Hr,g as Ur,gt as Wr,h as Gr,ht as Kr,i as qr,it as Jr,kt as Yr,l as Xr,lt as Zr,m as Qr,mt as $r,n as ei,nt as ti,o as ni,ot as ri,p as ii,pt as ai,q as oi,r as si,rt as ci,s as li,st as ui,t as di,tt as fi,u as pi,ut as mi,vt as hi,wt as gi,z as _i}from"./runtimeEndpointReset-C0zNrsI9.js";import{t as vi}from"./YuriWordmark-CLGHwobA.js";import{_ as yi,p as bi,r as xi,y as Si}from"./sessionOwnership-BjhXe6pi.js";import{r as Ci,t as wi}from"./mcpQueries-Rmp1BKeo.js";import{n as Ti}from"./SettingsGroup-CvaPYznp.js";import{a as Ei,n as Di,o as Oi}from"./useMcpConfigStore-DKTl0PvE.js";import{n as ki}from"./project-preview-BCtFY4Rg.js";import{i as Ai,r as ji}from"./icons-Bd-INsoy.js";import{a as Mi,i as Ni,o as Pi,r as Fi,s as Ii,t as Li}from"./useMobileTranscriptSyncHint-DM8WG7kz.js";import{n as Ri,r as zi,t as Bi}from"./select-assistant-mmsKjj2O.js";import{i as Vi,n as Hi,t as Ui}from"./MobileSurface-cmaGf3hZ.js";import{t as Wi}from"./AssistantUnreadBadge-p9mkpbMC.js";var Z=e(w(),1),Gi=j(),Ki=null,qi=!1,Ji=new Promise(e=>{Ki=e});function Yi(){qi||(qi=!0,Ki?.())}var Xi=6,Zi=e=>e.parentID??null,Qi=e=>{let t=e.replace(/\/+$/,``);return t.slice(t.lastIndexOf(`/`)+1)||t},$i=e=>e.replace(/\\/g,`/`).replace(/\/+$/,``),ea=(e,t)=>{if(!e)return``;let n=null,r=-1;for(let i of t){let t=$i(i.path);(e===t||e.startsWith(`${t}/`))&&t.length>r&&(n=i,r=t.length)}return Qi(n?n.path:e)},ta=()=>{let e=ve.getState().activeSessions,t=q.getState().index.session.unseenCount,n=J.getState().projects,r=0,i=[];for(let a of e){let e=Zi(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:ea(Ce(a),n)})}i.sort((e,t)=>t.updated-e.updated);let a=i.slice(0,Xi).map(({id:e,title:t,unread:n,project:r})=>({id:e,title:t,unread:n,project:r}));return{attentionCount:r,recentSessions:a}},na=`__YURI_WIDGET_SNAPSHOT__`,ra=()=>{typeof window>`u`||(window[na]=()=>{try{return JSON.stringify(ta())}catch{return null}})},Q=A(),ia=ee(`YuriScreenAwake`),aa=Promise.resolve(),oa=0;function sa(e){let t=aa.then(()=>ia.setEnabled({enabled:e}));return aa=t.catch(()=>void 0),t}async function ca(){if(z.isNativePlatform()&&z.isPluginAvailable(`YuriScreenAwake`)){oa+=1;try{await sa(!0)}catch(e){throw--oa,e}let e=!1;return async()=>{e||(e=!0,--oa,oa===0&&await sa(!1))}}if(!navigator.wakeLock)throw Error(`Screen wake lock unavailable`);let e=await navigator.wakeLock.request(`screen`);return async()=>{e.released||await e.release()}}var $=C();function la(e){let t=(0,Q.c)(3),n=Fe(),r=e.remoteState??n??void 0,i;return t[0]!==e||t[1]!==r?(i=(0,$.jsx)(fa,{...e,remoteState:r}),t[0]=e,t[1]=r,t[2]=i):i=t[2],i}function ua(e){let t=(0,Q.c)(6),{identity:n,onSource:r}=e,i=ze(e.sessionId,e.directory),a=Je(e.sessionId,e.directory),o,s;return t[0]!==n||t[1]!==i||t[2]!==r||t[3]!==a?(o=()=>r({identity:n,resolved:a,getMessages:()=>i}),s=[n,r,i,a],t[0]=n,t[1]=i,t[2]=r,t[3]=a,t[4]=o,t[5]=s):(o=t[4],s=t[5]),(0,Z.useLayoutEffect)(o,s),null}function da(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=R(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 fa(e){let{sessionId:t,directory:n,active:r,children:i,remoteState:a}=e,{t:o}=rt(),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=R(e=>{l.current=e,d(t=>t?.identity===e.identity&&t.resolved===e.resolved?t:{identity:e.identity,resolved:e.resolved})}),[p,m]=L(`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=Xn({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=R(()=>{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=R(()=>{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(),V.error(o(`mobile.menu.autoReadFailed`));return}k()}},{target:t.target})}),A=R(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=R((e,n)=>{T.current.enabled&&D&&e===t&&T.current.observed.add(n)}),M=R(()=>{if(h){m(!1),O();return}D&&(m(!0),w.unlock().catch(()=>{V.error(o(`mobile.menu.autoReadFailed`))}))}),N=R(()=>{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=R(()=>{m(!1),O()});I(`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),I(`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 ca().then(n=>{e?n().catch(()=>void 0):t=n}).catch(()=>{e||V.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]),ee=(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)(Qn.Provider,{value:F,children:(0,$.jsxs)(Zn.Provider,{value:ee,children:[a?(0,$.jsx)(da,{...e,identity:c,onSource:f,remoteState:a}):e.remote?null:(0,$.jsx)(ua,{...e,identity:c,onSource:f}),i]})})}function pa(e){let t=(0,Q.c)(3),{children:n}=e,r=(0,Z.useContext)(Qn);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 ma={getPlatform:()=>z.getPlatform(),isPluginAvailable:e=>z.isPluginAvailable(e),openInSystemBrowser:e=>ie.open(e),openExternal:re},ha=async(e,t=ma)=>{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)},ga=`mobile-app-update-available`,_a=`mobile-app-update-toast-dismissed-version`,va=()=>{let e=(0,Q.c)(9),{t}=rt(),n=yi(ya),r=yi(ba),i=yi(xa),a=yi(Sa),o=yi(Ca),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){X.dismiss(ga);return}O().getItem(_a)!==i&&(c.current.has(i)||(c.current.add(i),X.info(t(`mobileUpdate.toast.available.title`),{id:ga,description:t(`mobileUpdate.toast.available.description`,{version:i}),duration:1/0,icon:(0,$.jsx)(W,{name:`download`,className:`h-4 w-4 text-muted-foreground`}),action:{label:t(`mobileUpdate.toast.actions.download`),onClick:()=>{ha(a)}},cancel:{label:t(`mobileUpdate.toast.actions.dismiss`),onClick:()=>{O().setItem(_a,i),X.dismiss(ga)}}})))},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 ya(e){return e.available}function ba(e){return e.runtimeType}function xa(e){return e.info?.version}function Sa(e){return e.info?.downloadUrl}function Ca(e){return e.info?.inAppApply===!0}var wa=e=>!(!e.enabled||e.runtimeType!==`mobile`||!e.available||!e.inAppApply||!e.version||e.seenVersions.has(e.version)||e.dismissedVersion!==null&&e.dismissedVersion===e.version),Ta=e=>e.enabled&&!e.alreadyChecked,Ea=`mobile-ota-update-available`,Da=`mobile-ota-update-toast-dismissed-version`,Oa=()=>{let e=(0,Q.c)(24),{t}=rt(),[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=yi(ka),u=yi(Aa),d=yi(ja),f=yi(Ma),p=yi(Na),m=yi(Pa),h=yi(Fa),_=yi(Ia),v=yi(La),y=d?.version,b=d?.inAppApply===!0,x,S;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(x=()=>{Ta({enabled:c,alreadyChecked:i.current})&&(i.current=!0,yi.getState().checkForUpdates().catch(Ra))},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=R(C),T=R(za),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(!wa({enabled:c,runtimeType:u,available:l,inAppApply:b,version:y??``,dismissedVersion:O().getItem(Da),seenVersions:o.current})||!y){(!l||!b||u!==`mobile`)&&X.dismiss(Ea);return}o.current.add(y),X.info(t(`mobileUpdate.ota.toast.available.title`),{id:Ea,description:t(`mobileUpdate.ota.toast.available.description`,{version:y}),duration:1/0,icon:(0,$.jsx)(W,{name:`refresh`,className:`h-4 w-4 text-muted-foreground`}),action:{label:t(`mobileUpdate.ota.toast.actions.update`),onClick:w},cancel:{label:t(`mobileUpdate.ota.toast.actions.dismiss`),onClick:()=>{T(y)}}})},D=[l,b,c,w,T,u,t,y],e[5]=l,e[6]=T,e[7]=b,e[8]=w,e[9]=u,e[10]=t,e[11]=y,e[12]=E,e[13]=D):(E=e[12],D=e[13]),Z.useEffect(E,D),!c)return null;let k;return e[14]!==n||e[15]!==_||e[16]!==p||e[17]!==f||e[18]!==h||e[19]!==d||e[20]!==m||e[21]!==v||e[22]!==u?(k=(0,$.jsx)(bi,{open:n,onOpenChange:r,info:d,downloading:f,downloaded:p,progress:m,error:h,onDownload:_,onRestart:v,runtimeType:u}),e[14]=n,e[15]=_,e[16]=p,e[17]=f,e[18]=h,e[19]=d,e[20]=m,e[21]=v,e[22]=u,e[23]=k):k=e[23],k};function ka(e){return e.available}function Aa(e){return e.runtimeType}function ja(e){return e.info}function Ma(e){return e.downloading}function Na(e){return e.downloaded}function Pa(e){return e.progress}function Fa(e){return e.error}function Ia(e){return e.downloadUpdate}function La(e){return e.restartToUpdate}function Ra(){}function za(e){O().setItem(Da,e),X.dismiss(Ea)}var Ba=ee(`BarcodeScanner`),Va=`yuri-barcode-scanner-active`,Ha=()=>ro()?Ba:null,Ua=()=>window.Capacitor?.getPlatform?.()===`android`,Wa=e=>typeof e==`object`&&e&&`message`in e?String(e.message??``):String(e??``),Ga=e=>/^\s*scan canceled\.?\s*$/i.test(Wa(e)),Ka=e=>/denied access to camera/i.test(Wa(e)),qa=e=>!Ga(e)&&!Ka(e),Ja=e=>{let t=Wa(e);return/module/i.test(t)&&/not\s*available|unavailable/i.test(t)},Ya=e=>{e.installGoogleBarcodeScannerModule?.().catch(()=>void 0)},Xa=e=>{let t=e.trim();if(!t)return null;if(/^yuri:\/\//i.test(t)){let e=Ei(t);return e?{pairing:e}:null}return/^https?:\/\//i.test(t)?{url:t}:null},Za=e=>{let t=Xa(e);return t?`pairing`in t?{status:`pairing`,...t}:{status:`ok`,...t}:{status:`invalid`}},Qa=e=>{typeof document>`u`||document.documentElement.classList.toggle(Va,e)},$a=e=>{try{e()}catch{}},eo=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))}},to=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))};Qa(!0);let c=eo(()=>s({status:`cancelled`}));try{let{App:e}=await B(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(Za(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=>{Ka(e)?s({status:`permission-denied`}):s({status:`failed`})}),await o}finally{Qa(!1),$a(c),$a(()=>r?.()),await Promise.allSettled([Promise.resolve(t?.remove()),Promise.resolve(n?.remove()),e.stopScan()])}},no=e=>e.isNativePlatform&&e.isPluginAvailable,ro=()=>no({isNativePlatform:z.isNativePlatform(),isPluginAvailable:z.isPluginAvailable(`BarcodeScanner`)}),io=async()=>{let e=Ha();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?Za(n):{status:`cancelled`}}catch(t){return Ga(t)?{status:`cancelled`}:Ka(t)?{status:`permission-denied`}:Ua()&&qa(t)&&e.startScan?(Ja(t)&&Ya(e),to(e)):{status:`failed`}}return Ua()&&e.startScan?to(e):{status:`unsupported`}}catch{return{status:`failed`}}},ao={autoComplete:`off`,autoCorrect:`off`,spellCheck:!1},oo=({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}=rt(),[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=R(async()=>{if(!(e||t||_)){v(!0);try{let e=await navigator.clipboard.readText();x(e);let t=Xa(e);e.trim()&&(!t||!(`pairing`in t))&&d()}catch{g(f(`mobile.connect.link.pasteFallback`))}finally{v(!1)}}}),C=R(n=>{if(n.preventDefault(),e||t||_)return;let r=Xa(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)(Gt,{...ao,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)(H,{variant:`outline`,size:`icon`,onClick:()=>void S(),disabled:e||t||_,"aria-label":f(`mobile.connect.link.paste`),children:(0,$.jsx)(W,{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)(H,{type:`submit`,variant:i,size:`lg`,className:a,disabled:e||t||_||!y.trim(),children:f(t?`mobile.connect.connecting`:`mobile.connect.connectButton`)})]})};function so({connection:e}){let{t}=rt(),{connections:n,isBusy:r,error:i,pendingConnection:a}=e,o=Z.useMemo(()=>ro(),[]),[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=R(()=>{O||(a?(e.cancelPassword(),C(``)):A(null))}),N=R(async t=>{O||(_(t.id),C(``),await e.connect({id:t.id,candidates:t.candidates,label:t.label}))}),P=R(async()=>{if(!O){_(null),m(!0),e.setError(null);try{let n=await io();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=R(()=>d?(f(null),!0):k?(M(),!0):l?(u(!1),!0):!1);Z.useEffect(()=>{if(!g())return;let e=!1,t;return B(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)(H,{size:`lg`,variant:e?`default`:`ghost`,className:e?`yuri-welcome-primary w-full`:`w-full`,disabled:O,onClick:()=>void P(),children:[(0,$.jsx)(W,{name:p?`loader-4`:`scan-2`,className:p?`size-5 animate-spin motion-reduce:animate-none`:`size-5`}),t(`mobile.connect.scanQr`)]}),ee=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)(vi,{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)(Nn,{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)(H,{variant:`outline`,className:`yuri-welcome-device`,disabled:O,onClick:j,children:[(0,$.jsx)(W,{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)(W,{name:`arrow-right-s`,className:`size-5 text-muted-foreground`})]}),(0,$.jsx)(H,{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)(H,{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)(H,{variant:`ghost`,size:`lg`,disabled:O,className:`mx-auto text-muted-foreground`,onClick:()=>A(`more`),children:t(`mobile.connect.welcome.moreOptions`)})]})]})]}),(0,$.jsxs)(ut,{id:`welcome-history`,open:l,onOpenChange:u,presentation:`page`,edge:`right`,dismissGesture:!0,ariaLabel:t(`mobile.connect.history.title`),children:[(0,$.jsx)(pn,{title:t(`mobile.connect.history.title`),backAriaLabel:t(`header.actions.backAria`),onBack:()=>u(!1)}),(0,$.jsxs)(ct,{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)(H,{variant:`ghost`,className:`yuri-welcome-history-row min-w-0 flex-1`,disabled:O,onClick:()=>void N(e),children:[(0,$.jsx)(W,{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)(H,{variant:`ghost`,size:`icon`,disabled:O,"aria-label":t(`desktopHostSwitcher.actions.retry`),onClick:()=>void N(e),children:(0,$.jsx)(W,{name:`error-warning-fill`,className:`size-5 text-[var(--status-error)]`})}):null,(0,$.jsxs)(Ot,{open:d===e.id,onOpenChange:t=>f(t?e.id:null),children:[(0,$.jsx)(Tt,{asChild:!0,children:(0,$.jsx)(H,{variant:`ghost`,size:`icon`,disabled:O,"aria-label":t(`mobile.connect.history.actions`,{name:e.label}),children:(0,$.jsx)(W,{name:`more`,className:`size-5`})})}),(0,$.jsxs)(Et,{align:`end`,children:[(0,$.jsxs)(Dt,{onSelect:()=>{y(e.id),x(e.label),A(`rename`)},children:[(0,$.jsx)(W,{name:`edit`,className:`size-4`}),t(`mobile.connect.history.rename`)]}),(0,$.jsxs)(Dt,{onSelect:()=>{y(e.id),A(`remove`)},className:`text-[var(--status-error)]`,children:[(0,$.jsx)(W,{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)(Nn,{width:36,height:36,className:`mx-auto mb-5 opacity-40`}),o?L(!1):null,(0,$.jsx)(H,{variant:`ghost`,size:`lg`,className:`w-full`,disabled:O,onClick:()=>A(`more`),children:t(`mobile.connect.link.useLink`)})]})]}),(0,$.jsx)(dt,{id:`welcome-options`,open:k,onOpenChange:e=>{e||M()},fitContent:!0,title:(0,$.jsx)(`h2`,{className:`truncate typography-ui-label font-semibold`,children:ee}),ariaLabel:ee,closeAriaLabel:t(`mobile.surface.closeAria`),resizeAriaLabel:t(`mobile.connect.options.resize`),children:(0,$.jsx)(ct,{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)(W,{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)(H,{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)(W,{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)(H,{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)(Gt,{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)(H,{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)(H,{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)(Gt,{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)(H,{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)(H,{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)(H,{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)(oo,{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)(H,{variant:`outline`,className:`yuri-welcome-history-row`,disabled:O,onClick:j,children:[(0,$.jsx)(W,{name:`history`,className:`size-6`}),(0,$.jsx)(`span`,{className:`flex-1 text-left`,children:t(`mobile.connect.history.title`)}),(0,$.jsx)(W,{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 co(e){let t=(0,Q.c)(17),{children:n}=e,r=te(fo),i=te(uo),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],Rt(c);let l,u;t[5]===r?(l=t[6],u=t[7]):(l=()=>{if(!r)return;let e=document.activeElement,t=Jt(`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)(Yr,{presentation:`page`,onBack:lo})}):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 lo(){Vt.requestAnimatedBack(`root`)}function uo(e){return e.setCommandPaletteOpen}function fo(e){return e.isCommandPaletteOpen}async function po(e,t,n,i){if(i){let r=await ki(i,e,n);if(!ne(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(!ne(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)||!Wt(`${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 mo({url:e,hostOrigin:t,entry:n}){let{t:r}=rt(),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 po(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=ne(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 I(`message`,t=>{if(!f?.src||!ne(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`&&ae.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)(Ht,{message:r(`contextPanel.preview.proxyError`)}),(0,$.jsx)(H,{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 ho(e){let t=(0,Q.c)(10),{location:n,url:r,hostOrigin:i}=e,{t:a}=rt(),o=et(!0);if(!o.registry||o.registry.hubId!==n.hubId){let e;return t[0]!==o.error||t[1]!==a?(e=o.error?(0,$.jsx)(Ht,{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)(mo,{url:r,hostOrigin:i,entry:s}),t[6]=i,t[7]=s,t[8]=r,t[9]=c):c=t[9],c}function go(){let e=(0,Q.c)(17),{t}=rt(),n=ae(vo),r=N(),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)(Ut,{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)(mo,{url:a.url,hostOrigin:e?.hostOrigin,entry:r.entry}):(0,$.jsx)(ho,{location:a.location,url:a.url,hostOrigin:e?.hostOrigin}):(0,$.jsx)(mo,{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)(dt,{id:`mobile-html-preview`,open:o,ariaLabel:c,closeAriaLabel:l,resizeAriaLabel:u,initiallyExpanded:!0,title:f,onOpenChange:_o,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 _o(e){e||ae.getState().close()}function vo(e){return e.target}function yo(){let e=J(e=>e.projects.find(t=>t.id===e.activeProjectId)),t=K(e=>e.remoteSession),n=!!e?.hostId,r=Ze(),i=et(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?$e(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=Ke(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=tt(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:R(t=>{if(!e?.hostId||!p)throw Error(`Remote Host scope unavailable`);K.getState().openRemoteSession(e,p,t)}),refresh:R(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 bo=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=U(`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=U(`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 xo(e){let t=(0,Q.c)(17),{scope:n,children:r}=e,{t:i}=rt();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)(Ve.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)(F,{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 So(e){let t=(0,Q.c)(58),{scope:n,onOpenSessions:r,menuOpen:i,onToggleMenu:a,surfaceShortcuts:o}=e,{t:s}=rt(),[c,l]=Z.useState(!1),u;t[0]===r?u=t[1]:(u=()=>{l(!1),r()},t[0]=r,t[1]=u);let d=R(u),f;t[2]===a?f=t[3]:(f=()=>{l(!1),a()},t[2]=a,t[3]=f);let p=R(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=R(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)(W,{name:`folders`,className:`size-5`}),t[17]=x):x=t[17];let S;t[18]!==d||t[19]!==b?(S=(0,$.jsx)(H,{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)(W,{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)(Fi,{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)(H,{variant:`ghost`,size:`icon`,"aria-label":s(`mobile.menu.files`),"aria-pressed":o.activePanel===`files`,onClick:o.onToggleFiles,children:(0,$.jsx)(W,{name:`file-text`,className:`size-5`})}),(0,$.jsxs)(H,{variant:`ghost`,size:`icon`,className:`relative`,"aria-label":s(`mobile.menu.changes`),"aria-pressed":o.activePanel===`changes`,onClick:o.onToggleChanges,children:[(0,$.jsx)(W,{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)(W,{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)(H,{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)(bo,{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)(xo,{scope:n,children:I}),t[55]=n,t[56]=I,t[57]=L):L=t[57],L}var Co=`yuri:assistant-share-welcome:v1`,wo=[{image:Ri,titleKey:`assistants.shareWelcome.example.chat.title`,descriptionKey:`assistants.shareWelcome.example.chat.description`},{image:zi,titleKey:`assistants.shareWelcome.example.article.title`,descriptionKey:`assistants.shareWelcome.example.article.description`},{image:Bi,titleKey:`assistants.shareWelcome.example.note.title`,descriptionKey:`assistants.shareWelcome.example.note.description`}],To=e=>{let t=(0,Q.c)(40),{enabled:n,open:r,onOpenChange:i}=e,a=n!==void 0&&n,{t:o}=rt(),[s,c]=L(Co,!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=R(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)(W,{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)(vt,{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)(yt,{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)(ht,{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=wo.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)(W,{name:`arrow-right-s`,className:`size-4`}),t[28]=w):w=t[28];let T;t[29]!==f||t[30]!==C?(T=(0,$.jsx)(gt,{className:`border-t border-border px-5 py-4 sm:px-8 sm:py-5`,children:(0,$.jsxs)(H,{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)(_t,{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)(bt,{open:u,onOpenChange:p,children:E}),t[36]=u,t[37]=E,t[38]=p,t[39]=D):D=t[39],D},Eo=ee(`YuriNativeHeader`),Do=`header.yuri-mobile-detail-navigation, header.yuri-mobile-header`,Oo=`yuri-native-header-source`,ko=`yuri-native-header-ready`,Ao=new Set([ko,`yuri-keyboard-open`,`yuri-kb-animating`,`yuri-kb-hide`,`yuri-kb-caret-hold`]),jo=`--yuri-native-viewport-top`,Mo=`.fixed, [role="dialog"]`,No=new Set([`style`,`data-yuri-header-collapse-phase`,`data-yuri-header-collapse-rest`]),Po=()=>parseFloat(document.documentElement.style.getPropertyValue(`--yuri-native-viewport-top`))||0,Fo=`[data-avatar-motion]`,Io=new Set([`class`,`style`,`inert`,`aria-hidden`,`hidden`]),Lo=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-Po();return e.dataset.yuriCollapsibleHeader===`true`||Math.abs(n)<=1},Ro=(e,t)=>{let n=[...document.querySelectorAll(Do)].filter(Lo);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},zo=()=>{let e=[];for(let t of document.styleSheets)try{for(let n of t.cssRules)e.push(n.cssText)}catch{}return e.join(`
3
+ `)},Bo=()=>{let e=0;for(let t of document.styleSheets)try{e+=t.cssRules.length}catch{}return`${document.styleSheets.length}:${e}`},Vo=Eo,Ho=()=>new Promise(e=>{requestAnimationFrame(()=>requestAnimationFrame(()=>e(1)))});function Uo(){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(ko),u&&(u=!1,o=``,Eo.update({seq:++r,visible:!1}).catch(()=>void 0))},h=()=>{if(i=0,n)return;let t=Ro(a,d);if(t!==a){if(a?.classList.remove(Oo),m(),a=t,l=``,!t)return;t.classList.add(Oo),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(Mo)===null?Math.ceil(Math.max(h,g)*f):_,y=(h+2*(parseFloat(getComputedStyle(e).fontSize)||16))*f,b=t.cloneNode(!0);b.classList.remove(Oo),b.style.removeProperty(zn),delete b.dataset.yuriHeaderCollapsePhase,delete b.dataset.yuriHeaderCollapseRest;for(let e of b.querySelectorAll(Mo))e.style.display=`none`;let x=b.outerHTML,S=[...e.classList].filter(e=>!Ao.has(e)).join(` `),C=(e.getAttribute(`style`)??``).replace(RegExp(`${jo}\\s*:[^;]*;?`,`g`),``),w=document.body.className,T=`${x}|${S}|${C}|${w}|${v}|${y}`,E=Bo(),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=zo()),D!==c&&(c=D,O.sprite=D),u=!0,Eo.update(O).catch(()=>void 0)},g=()=>{!i&&!n&&(i=requestAnimationFrame(h))};f.push(Eo.addListener(`shown`,t=>{d&&t.seq===r&&a&&e.classList.add(ko)})),f.push(Eo.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`&&No.has(n.attributeName??``)){p();continue}let e=n.target instanceof Element?n.target:n.target.parentElement;if(!(e?.closest(Fo)&&a.contains(e))){if(a.contains(n.target)||n.type===`attributes`&&n.target.contains(a))t=!0;else if(n.type===`attributes`&&Io.has(n.attributeName??``)&&n.target instanceof Element&&n.target.querySelector(Do))t=!0;else if(n.type===`childList`)for(let e of n.addedNodes)e instanceof Element&&(e.matches(Do)||e.querySelector(Do))&&(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(jo,`${Math.max(0,t)}px`),Ho());let b=window;return b.__yuriNativeHeader=t=>(d=t,e.classList.toggle(ko,t&&a!==null),Ho()),()=>{n=!0,delete b.__yuriNativeHeader,i&&cancelAnimationFrame(i),_.disconnect(),v.disconnect(),y.disconnect(),window.removeEventListener(`resize`,g),delete t.__yuriImeOffset,e.classList.remove(ko),a?.classList.remove(Oo),a=null;for(let e of f)e.then(e=>e.remove()).catch(()=>void 0);Eo.update({seq:++r,visible:!1}).catch(()=>void 0)}}var Wo=`.yuri-mobile-composer`,Go=`[data-btw-composer]`;function Ko(e,t){if(!e)return!1;let n=t;return!n||typeof n.closest!=`function`||!n.closest(Go)}function qo(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.closest==`function`&&!!t.closest(Wo)}function Jo(e){return qo(e??null)}var Yo=S(e=>({expandedParents:{},toggleParent:t=>e(e=>{let n={...e.expandedParents};return n[t]?delete n[t]:n[t]=!0,{expandedParents:n}})})),Xo=36,Zo=18,Qo=e=>e.parentID??null,$o=e=>(e||``).replace(/\\/g,`/`).replace(/\/+$/g,``),es=e=>{let t=e;return $o(t.directory??t.project?.worktree??null)},ts=e=>{let t=$o(e);if(!t)return``;let n=t.split(`/`).filter(Boolean);return n[n.length-1]||t},ns=e=>{let t=e.time?.updated??e.time?.created,n=typeof t==`number`?t:Number(t);return Number.isFinite(n)&&n>0?n:0},rs=(e,t)=>e.size===t.size&&[...e].every(e=>t.has(e)),is=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))},as=(e,t)=>{let n=$o(e),r=$o(t);return!!(n&&r&&(n===r||n.startsWith(`${r}/`)))},os=(e,t)=>e.worktrees.find(e=>$o(e.path)===t)??null,ss=(e,t)=>t===e.path||!!os(e,t),cs=(e,t)=>{let n=$o(t);return n?e.find(e=>ss(e,n))??null:null},ls=(e,t,n)=>!n||`${e.title??``} ${e.id} ${es(e)} ${t}`.toLowerCase().includes(n),us=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?Jn[n.icon]:null,c=n.color?Yn[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)(W,{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=U(`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)(qn,{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},ds=e=>{let t=(0,Q.c)(5),{expanded:n}=e,r=n?`rotate-0`:`-rotate-90`,i;t[0]===r?i=t[1]:(i=U(`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)(W,{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},fs=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},ps=e=>{let t=(0,Q.c)(12),{onClick:n,className:r}=e,{t:i}=rt(),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=U(`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)(W,{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},ms=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)(W,{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)(H,{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},hs=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}=rt(),x;t[0]===n?x=t[1]:(x=is(ns(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=U(`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)(W,{name:`arrow-down-s`,className:U(`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=U(`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=U(`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=U(`block min-w-0 flex-1 truncate typography-ui-label`,f),t[54]=f,t[55]=F),I=g?Mn(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 te;t[59]===S?te=t[60]:(te=S?(0,$.jsx)(`span`,{className:`shrink-0 typography-micro text-muted-foreground tabular-nums`,children:S}):null,t[59]=S,t[60]=te);let ne;t[61]!==B||t[62]!==te||t[63]!==L||t[64]!==R?(ne=(0,$.jsxs)(`span`,{className:L,children:[R,B,te]}),t[61]=B,t[62]=te,t[63]=L,t[64]=R,t[65]=ne):ne=t[65];let re;t[66]!==a||t[67]!==g?(re=a?(0,$.jsx)(`span`,{className:`block truncate typography-micro text-muted-foreground pl-4`,children:g?Mn(a,g):a}):null,t[66]=a,t[67]=g,t[68]=re):re=t[68];let ie;t[69]!==ne||t[70]!==re||t[71]!==ee?(ie=(0,$.jsxs)(`span`,{className:ee,children:[ne,re]}),t[69]=ne,t[70]=re,t[71]=ee,t[72]=ie):ie=t[72];let ae;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]!==ie?(ae=(0,$.jsx)(`button`,{type:C,className:w,style:T,onClick:E,onPointerDown:D,onPointerMove:O,onPointerUp:k,onPointerCancel:A,onContextMenu:j,disabled:M,children:ie}),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]=ie,t[84]=ae):ae=t[84];let oe;t[85]!==p||t[86]!==m?(oe=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)(hi,{})}):null,t[85]=p,t[86]=m,t[87]=oe):oe=t[87];let V;t[88]===b?V=t[89]:(V=b(`sessions.sidebar.session.menu.label`),t[88]=b,t[89]=V);let se;t[90]===Symbol.for(`react.memo_cache_sentinel`)?(se=(0,$.jsx)(W,{name:`more-2`,className:`size-4`}),t[90]=se):se=t[90];let G;t[91]!==h.onOpenActions||t[92]!==V?(G=(0,$.jsx)(H,{variant:`ghost`,size:`icon`,"data-session-drag-ignore":!0,"aria-label":V,onClick:h.onOpenActions,children:se}),t[91]=h.onOpenActions,t[92]=V,t[93]=G):G=t[93];let ce;t[94]!==_||t[95]!==f||t[96]!==d||t[97]!==b||t[98]!==z?(ce=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)(W,{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)(W,{name:`close`,className:`size-4`}):(0,$.jsx)(W,{name:`archive`,className:`size-4`})})]}):null,t[94]=_,t[95]=f,t[96]=d,t[97]=b,t[98]=z,t[99]=ce):ce=t[99];let le;return t[100]!==N||t[101]!==P||t[102]!==ae||t[103]!==oe||t[104]!==G||t[105]!==ce?(le=(0,$.jsxs)(`div`,{className:N,children:[P,ae,oe,G,ce]}),t[100]=N,t[101]=P,t[102]=ae,t[103]=oe,t[104]=G,t[105]=ce,t[106]=le):le=t[106],le},gs=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}=rt();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)(W,{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:U(`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)(W,{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},_s=({open:e,onOpenChange:t,variant:n=`sheet`})=>{let{t:r}=rt(),{git:i}=P(),a=Me(),o=he(),s=ve(e=>e.activeSessions),c=ve(e=>e.activePaginationByDirectory),l=J(e=>e.projects),u=Z.useMemo(()=>l.filter(e=>!e.hostId),[l]),d=l.some(e=>!!e.hostId),f=et(e&&d),p=f.catalog?.projects??[],m=J(e=>e.activeProjectId),h=D(e=>e.currentDirectory),g=je(e=>e.currentSessionId),_=je(e=>e.availableWorktreesByProject),v=je(e=>e.setCurrentSession),y=je(e=>e.archiveSession),b=je(e=>e.archiveSessions),x=je(e=>e.updateSessionTitle),S=je(e=>e.requestSessionSmartTitle),C=je(e=>e.shareSession),w=je(e=>e.unshareSession),T=je(e=>e.openNewSessionDraft),E=J(e=>e.setActiveProject),O=J(e=>e.setActiveProjectIdOnly),k=J(e=>e.removeProject),A=ge();jr();let j=Ne(e=>e.sessionOrderByScope),M=Ne(e=>e.sessionOrderActivityByScope),N=_e(),F=hr(e=>e.projectExpanded),I=hr(e=>e.worktreeExpanded),L=hr(e=>e.setProjectExpanded),ee=hr(e=>e.setWorktreeExpanded),z=Te(e=>e.orderByProject),B=Yo(e=>e.expandedParents),te=Yo(e=>e.toggleParent),[ne,re]=Z.useState(``),[ie,ae]=Z.useState(null),[oe,V]=Z.useState(null),[se,G]=Z.useState(0),[ue,de]=Z.useState(!1),[K,pe]=Z.useState(!1),[me,q]=Z.useState(null),[Y,ye]=Z.useState(null),be=Y?.kind===`session`?Y.session:null,{unread:xe,onToggleRead:Ce}=Pr(be,be?es(be):void 0),[we,De]=Z.useState(null),[Oe,Ae]=Z.useState(null),[Pe,Fe]=Z.useState(null),[Ie,Le]=Z.useState(``),[Re,ze]=Z.useState(!1),[Be,Ve]=Z.useState(null),He=Z.useRef(null);He.current||=Kr({onPressedKeyChange:Ae});let[Ue,We]=Z.useState(new Set),[Ge,Ke]=Z.useState(new Map),[qe,Je]=Z.useState(new Map),Ye=fr(),Ze=Or(),Qe=R(e=>{Vn(e),Ee(e)}),$e=R(e=>{Promise.all(e.map(e=>(Vn(e),Ee(e))))});Z.useEffect(()=>{if(!e){re(``),Je(new Map),ae(null),V(null),ye(null),Fe(null),Ve(null),He.current?.reset();return}},[e]),Z.useEffect(()=>()=>{He.current?.reset()},[]),Z.useEffect(()=>{if(!e)return;if(u.length===0){je.setState(e=>{let t=Hr(e.availableWorktreesByProject,new Set,[]);return t===e.availableWorktreesByProject?{}:{availableWorktreesByProject:t,availableWorktrees:[]}}),We(e=>e.size===0?e:new Set),Ke(e=>e.size===0?e:new Map);return}let t=!1;return(async()=>{let e=await Promise.all(u.map(async e=>{let n=$o(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([Gn({id:e.id,path:n},{isCurrent:()=>!t}),Kn(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=>$o(e.path)).filter(Boolean)),r=e.flatMap(e=>e?.worktreeStatus?[{path:e.path,status:e.worktreeStatus,worktrees:e.worktrees}]:[]);je.setState(e=>{let t=Hr(e.availableWorktreesByProject,n,r);return t===e.availableWorktreesByProject?{}:{availableWorktreesByProject:t,availableWorktrees:Array.from(t.values()).flat()}}),We(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 rs(r,t)?t:r}),Ke(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,se]);let tt=Z.useMemo(()=>u.map(e=>({id:e.id,label:ts(e.path),path:$o(e.path),icon:e.icon,color:e.color,iconImage:e.iconImage,iconBackground:e.iconBackground,isGitRepo:Ue.has($o(e.path)),worktrees:Xe(z[e.id],_.get($o(e.path))??[])})),[Ue,u,z,_]),nt=Z.useMemo(()=>{let e=new Map(o.map(e=>[e.id,e])),t=s.map(t=>{let n=e.get(t.id);return n?Se(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]),it=ne.trim().toLowerCase(),at=Z.useMemo(()=>{let e=tt.map(e=>({project:e,buckets:[],totalSessions:0,isActive:e.id===m})),t=(e,t,n)=>{let r=$o(t)||e.project.path,i=r||`__root__`,a=e.buckets.find(e=>e.key===i);return a||(a={key:i,label:n?.branch||ts(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 nt){let r=es(n);if(!r)continue;let i=$o(r),a=e.find(e=>ss(e.project,i));if(!a)continue;let o=os(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=$o(e.path),r=gi(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)Qo(n)||(t.totalSessions+=1)}return e},[m,tt,nt,j,M,A]),ot=$o(h),ct=e=>e.isActive?ot===e.project.path?e.project.path:e.project.worktrees.find(e=>as(ot,e.path))?.path??e.project.path:null,lt=e=>F[e.project.id]??!0,ut=(e,t)=>I[`${e.project.id}::${t.key}`]??!1,ft=e=>{Je(t=>{if(!t.has(e))return t;let n=new Map(t);return n.delete(e),n})},mt=()=>{ye(null),He.current?.reset()},ht=e=>({onOpenActions:()=>ye(e),pressed:Oe===e.key||Y?.key===e.key,onPointerDown:t=>{e.kind!==`session`&&(t.pointerType!==`touch`&&t.pointerType!==`pen`||t.button!==0||He.current?.start({pointerId:t.pointerId,key:e.key,clientX:t.clientX,clientY:t.clientY,onTrigger:()=>ye(e)}))},onPointerMove:e=>{He.current?.move(e.pointerId,e.clientX,e.clientY)},onPointerUp:e=>{He.current?.end(e.pointerId)},onPointerCancel:e=>{He.current?.cancel(e.pointerId)},onContextMenu:t=>{t.preventDefault(),t.stopPropagation(),e.kind!==`session`&&He.current?.openFromContextMenu(e.key,()=>ye(e))}}),gt=(e,t)=>{He.current?.consumeClick(e)||t()},_t=(e,t,n,r)=>{let i=mi(),a=zr();if(Je(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=$o(t);if(!o)return;let s=ve.getState().activePaginationByDirectory.get(o);s?.hasMore&&!s.loadingMore&&ke(o)},vt=(e,t,n)=>{let i=`${e.project.id}::${t.key}`,a=mi(),o=new Set(t.sessions.map(e=>e.id)),s=new Map;for(let e of t.sessions){let t=Qo(e);if(t&&o.has(t)){let n=s.get(t)??[];n.push(e),s.set(t,n)}}let l=t.sessions.filter(e=>!Qo(e)),u=qe.get(i)??a,d=Er(l,u,Ze),f=l.length-d.length,p=c.get($o(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=!!B[e.id],o=Ye.has(e.id),c=i&&!a?n.filter(e=>Ye.has(e.id)).map(e=>e.id):[],l=c.length>0,u=o?[e.id,...c]:c,d=e.title?.trim()||r(`mobile.sessions.untitled`),f=`session:${e.id}`;return(0,$.jsxs)(Z.Fragment,{children:[(0,$.jsx)(hs,{session:e,active:g===e.id,indent:t,hasChildren:i,expanded:a,onToggleChildren:i?()=>te(e.id):void 0,confirmingArchive:oe===e.id,onSelect:()=>gt(f,()=>xt(e)),onRequestArchive:()=>St(e.id),onConfirmArchive:()=>void Ct(e),onStop:o||l?()=>$e(u):void 0,stopAriaLabel:r(l?`mobile.sessions.stopSubsessionsAria`:`mobile.sessions.stopSessionAria`,{title:d}),longPressHandlers:ht({key:f,kind:`session`,session:e})}),i&&a?n.map(e=>v(e,t+Zo)):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)(kr,{scopeKey:oe?null:$o(t.path),sessionIds:d.map(e=>e.id),folderIdBySessionId:new Map(d.map(e=>[e.id,Ne.getState().getSessionFolderId($o(t.path),e.id)])),onSessionDroppedOnFolder:()=>{},onSessionsReordered:(e,n)=>{Ne.getState().reorderSessions($o(t.path),d.map(e=>e.id),e,n,ur(t.sessions)).catch(()=>X.error(r(`sessions.order.saveFailed`)))},children:d.map(e=>oe?v(e,n):(0,$.jsx)(Ar,{sessionId:e.id,sessionDirectory:t.path,sessionTitle:e.title??``,children:v(e,n)},e.id))}),(0,$.jsx)(gs,{indent:n,showMore:f>0||m,showFewer:_,loadingMore:h,onShowMore:()=>_t(i,t.path,u,l.length),onShowFewer:()=>ft(i)})]})},yt=(e,t)=>{L(e,!t)},bt=(e,t,n)=>{ee(`${e}::${t}`,!n)},xt=e=>{pt();let n=es(e)||null,r=cs(tt,n??``);r&&O(r.id),v(e.id,n),t(!1)},St=e=>{V(t=>t===e?null:e)},Ct=async e=>{V(null),await y(e.id)?Mr({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`)}):X.error(r(`sessions.sidebar.session.archive.error`))},wt=()=>{T(),t(!1)},Tt=e=>{q(e),O(e),pe(!0)},Et=e=>{let t=new Map;for(let e of nt){let n=Qo(e);if(!n)continue;let r=t.get(n)??[];r.push(e.id),t.set(n,r)}let n=[],r=new Set,i=e=>{if(!r.has(e)){r.add(e),n.push(e);for(let n of t.get(e)??[])i(n)}};return i(e),n},Dt=async e=>{let t=Et(e.id),{archivedIds:n,failedIds:i}=await b(t);n.length>0&&Mr({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&&X.error(i.length===1?r(`sessions.sidebar.bulkActions.failedArchiveSingle`,{count:i.length}):r(`sessions.sidebar.bulkActions.failedArchivePlural`,{count:i.length}))},Ot=e=>{let t=Et(e.id);Wr({sessionIds:t,message:t.length===1?r(`sessions.sidebar.session.delete.success`):r(`sessions.sidebar.bulkActions.deletedPlural`,{count:t.length}),undoLabel:r(`sessions.sidebar.undo`),commitFailedMessage:r(`sessions.sidebar.session.delete.error`)})},kt=async e=>{try{if(!(await C(e.id))?.share?.url){X.error(r(`sessions.sidebar.session.share.error`));return}X.success(r(`sessions.sidebar.session.share.successTitle`),{description:r(`sessions.sidebar.session.share.successDescription`)})}catch{X.error(r(`sessions.sidebar.session.share.error`))}},At=async e=>{if((await fe(e)).ok){X.success(r(`sessions.sidebar.session.menu.copied`));return}X.error(r(`sessions.sidebar.session.share.copyUrlError`))},jt=async e=>{try{if(await w(e)){X.success(r(`sessions.sidebar.session.unshare.success`));return}X.error(r(`sessions.sidebar.session.unshare.error`))}catch{X.error(r(`sessions.sidebar.session.unshare.error`))}},Mt=async()=>{if(!Pe)return;let e=Ie.trim();if(e)try{await x(Pe.id,e),Fe(null),Le(``)}catch{X.error(r(`sessions.sidebar.session.menu.rename`),{description:r(`sessions.sidebar.dialogs.deleteResult.tryAgain`)})}},Nt=async()=>{if(!Pe||Re)return;let e=Pe.id;Fe(null),Le(``),ze(!0);try{await S(e)}catch{X.error(r(`sessions.sidebar.session.rename.smartTitle`),{description:r(`sessions.sidebar.dialogs.deleteResult.tryAgain`)})}finally{ze(!1)}},Pt=(e,n)=>{O(e.id),T({selectedProjectId:e.id,directoryOverride:n,preserveDirectoryOverride:!0}),t(!1)},Ft=e=>{(async()=>{try{await Gn({id:e.id,path:e.path})}catch(e){console.warn(`[MobileSessions] Worktree refresh before session sync failed:`,e)}let t=je.getState().availableWorktreesByProject.get(e.path)??e.worktrees,n=[e.path,...t.map(e=>e.path)];await le(n,nt)})()},It=e=>{let t=es(e),n=cs(tt,t);if(!n)return ts(t)||t;let r=os(n,$o(t));return r?.branch?`${n.label} · ${r.branch}`:n.label},Lt=e=>{E(e.id),t(!1)},Rt=Z.useMemo(()=>it?at.filter(e=>`${e.project.label} ${e.project.path}`.toLowerCase().includes(it)?!0:e.buckets.some(t=>t.sessions.some(t=>ls(t,e.project.label,it)))):at,[it,at]),zt=Z.useMemo(()=>it?nt.filter(e=>{let t=es(e);return ls(e,cs(tt,t)?.label??``,it)}).sort((e,t)=>ce(t)-ce(e)):[],[it,tt,nt]),Bt=Z.useMemo(()=>it?tt.filter(e=>`${e.label} ${e.path}`.toLowerCase().includes(it)).map(e=>({...e,sessionCount:nt.filter(t=>!Qo(t)&&ss(e,$o(es(t)))).length})):[],[it,tt,nt]),Vt=it&&zt.length===0&&Bt.length===0,Ht=tt.length>0?(0,$.jsxs)(H,{type:`button`,variant:`default`,size:`sm`,"aria-label":r(`mobile.sessions.newChat`),onClick:wt,style:{touchAction:`manipulation`},children:[(0,$.jsx)(W,{name:`add`,className:`size-4`}),r(`mobile.sessions.newChat`)]}):null,Ut=tt.find(e=>e.id===m)??null,Wt=Ut?.isGitRepo?(0,$.jsx)(H,{type:`button`,variant:`chip`,size:`sm`,"aria-label":r(`sessions.sidebar.project.actions.newWorktree`),title:r(`sessions.sidebar.project.actions.newWorktree`),onClick:()=>Tt(Ut.id),style:{touchAction:`manipulation`},children:(0,$.jsx)(W,{name:`node-tree`,className:`size-4`})}):null,Kt=(0,$.jsx)(H,{type:`button`,variant:`chip`,size:`sm`,"aria-label":r(`sessions.sidebar.header.actions.addProject`),title:r(`sessions.sidebar.header.actions.addProject`),onClick:()=>de(!0),style:{touchAction:`manipulation`},children:(0,$.jsx)(W,{name:`folder-add`,className:`size-4`})}),qt=Ht||Kt?(0,$.jsxs)($.Fragment,{children:[Ht,Wt,Kt]}):null,Jt=Y?.kind===`project`?Y.project.label:Y?.kind===`worktree`?Y.worktree.branch||Y.worktree.label||Y.worktree.path:Y?.kind===`session`?Y.session.title?.trim()||r(`mobile.sessions.untitled`):``,Yt=Z.useMemo(()=>{if(!Y)return[];if(Y.kind===`project`){let e=Y.project;return ri({gitRepository:e.isGitRepo,onNewSession:()=>{mt(),Pt(e,e.path)},onNewWorktree:()=>{mt(),Tt(e.id)},onSyncSessions:()=>{mt(),Ft(e)},onEditProject:()=>{mt(),ae(e.id)},onCloseProject:()=>{mt(),De(e)}})}if(Y.kind===`worktree`){let{project:e,worktree:t}=Y;return Lr({onNewSession:()=>{mt(),Pt(e,t.path)},onDeleteWorktree:()=>{mt(),Ve({project:e,worktree:t})}})}let e=Y.session,t=!!e.share?.url;return ui({pinned:A.has(e.id),shared:t,unread:xe,onToggleRead:Ce?()=>{mt(),Ce()}:void 0,onRename:()=>{mt(),Le(e.title?.trim()||r(`mobile.sessions.untitled`)),Fe(e)},onTogglePin:()=>{mt(),N(e.id)},onShare:!a||t?void 0:()=>{mt(),kt(e)},onCopyLink:a&&t?()=>{let t=e.share?.url;mt(),t&&At(t)}:void 0,onUnshare:a&&t?()=>{mt(),jt(e.id)}:void 0,onArchive:()=>{mt(),Dt(e)},onDelete:()=>{mt(),Ot(e)}})},[Y,xe,mt,Dt,At,Ot,Tt,kt,jt,Ce,A,Pt,Ft,r,N]),Xt=Yt.length>0?(0,$.jsx)(`div`,{className:`flex flex-col gap-1`,children:Yt.map(e=>{let t=(0,$.jsx)(ms,{icon:e.icon,label:Zr(e,r),destructive:e.destructive,onClick:e.onClick},e.id);return e.separated?(0,$.jsx)(`div`,{className:Y?.kind===`project`?`border-t border-[var(--yuri-popup-divider)]`:`mt-3 border-t border-[var(--surface-subtle)] pt-3`,children:t},e.id):t})}):null,Zt=(0,$.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,$.jsx)(`div`,{className:`shrink-0 px-4 pb-2 pt-1`,children:(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(W,{name:`search`,className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-muted-foreground`}),(0,$.jsx)(Gt,{value:ne,onChange:e=>re(e.target.value),placeholder:r(`mobile.sessions.search.placeholder`),className:U(`h-11 pl-9`,ne&&`pr-10`)}),ne?(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:()=>re(``),style:{touchAction:`manipulation`},children:(0,$.jsx)(W,{name:`close`,className:`size-4`})}):null]})}),(0,$.jsxs)(st,{className:`overlay-scrollbar-container min-h-0 flex-1 overflow-y-auto pb-4`,children:[d&&f.registry&&p.map(e=>(0,$.jsx)(ni,{project:e,registry:f.registry,search:ne,mobile:!0,reorderEnabled:!1},e.id)),tt.length===0&&!d?(0,$.jsx)(vs,{title:r(`mobile.sessions.empty.noProjectsTitle`),description:r(`mobile.sessions.empty.noProjectsDescription`),action:(0,$.jsxs)(H,{type:`button`,size:`lg`,onClick:()=>de(!0),children:[(0,$.jsx)(W,{name:`folder-add`,className:`size-4`}),r(`sessions.sidebar.header.actions.addProject`)]})}):Vt&&!d?(0,$.jsx)(vs,{title:r(`mobile.sessions.empty.searchTitle`),description:r(`mobile.sessions.empty.searchDescription`)}):it?(0,$.jsxs)(`div`,{className:`flex flex-col gap-3 px-3 pt-2`,children:[zt.length>0?(0,$.jsxs)(`section`,{children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between px-1 pb-1.5`,children:[(0,$.jsx)(`span`,{className:`typography-micro font-semibold uppercase tracking-wider text-muted-foreground`,children:r(`mobile.sessions.search.section.sessions`)}),(0,$.jsx)(`span`,{className:`typography-micro text-muted-foreground tabular-nums`,children:zt.length})]}),(0,$.jsx)(`div`,{className:`overflow-hidden rounded-2xl border border-border/40 bg-[var(--surface-elevated)]`,children:zt.map((e,t)=>{let n=Ye.has(e.id),i=e.title?.trim()||r(`mobile.sessions.untitled`);return(0,$.jsx)(`div`,{className:U(t>0&&`border-t border-border/30`),children:(0,$.jsx)(hs,{session:e,active:g===e.id,indent:12,contextLabel:It(e),highlightQuery:it,onSelect:()=>gt(`session:${e.id}`,()=>xt(e)),longPressHandlers:ht({key:`session:${e.id}`,kind:`session`,session:e}),onStop:n?()=>Qe(e.id):void 0,stopAriaLabel:r(`mobile.sessions.stopSessionAria`,{title:i})})},e.id)})})]}):null,Bt.length>0?(0,$.jsxs)(`section`,{children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between px-1 pb-1.5`,children:[(0,$.jsx)(`span`,{className:`typography-micro font-semibold uppercase tracking-wider text-muted-foreground`,children:r(`mobile.sessions.search.section.projects`)}),(0,$.jsx)(`span`,{className:`typography-micro text-muted-foreground tabular-nums`,children:Bt.length})]}),(0,$.jsx)(`div`,{className:`overflow-hidden rounded-2xl border border-border/40 bg-[var(--surface-elevated)]`,children:Bt.map((e,t)=>{let n=`project:${e.id}`,r=ht({key:n,kind:`project`,project:e});return(0,$.jsxs)(`div`,{className:U(`flex items-center`,t>0&&`border-t border-border/30`),children:[(0,$.jsxs)(`button`,{type:`button`,className:U(`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:()=>gt(n,()=>Lt(e)),onPointerDown:r.onPointerDown,onPointerMove:r.onPointerMove,onPointerUp:r.onPointerUp,onPointerCancel:r.onPointerCancel,onContextMenu:r.onContextMenu,style:{touchAction:`manipulation`},children:[(0,$.jsx)(us,{project:e}),(0,$.jsx)(`span`,{className:`block min-w-0 flex-1 truncate typography-ui-label text-foreground`,children:Mn(e.label,it)}),(0,$.jsx)(`span`,{className:`shrink-0 typography-micro text-muted-foreground tabular-nums`,children:e.sessionCount})]}),e.isGitRepo?(0,$.jsx)(ps,{className:`mr-2`,onClick:()=>Tt(e.id)}):null]},e.id)})})]}):null]}):(0,$.jsx)(`div`,{className:`flex flex-col`,children:Rt.map((e,t)=>{let n=lt(e),i=`project:${e.project.id}`,a=ht({key:i,kind:`project`,project:e.project}),o=it?e.buckets.filter(t=>t.sessions.some(t=>ls(t,e.project.label,it))):e.buckets,s=ct(e);return(0,$.jsxs)(`section`,{className:U(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:U(`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:()=>gt(i,()=>yt(e.project.id,n)),onPointerDown:a.onPointerDown,onPointerMove:a.onPointerMove,onPointerUp:a.onPointerUp,onPointerCancel:a.onPointerCancel,onContextMenu:a.onContextMenu,"aria-expanded":n,"aria-label":r(n?`sessions.sidebar.group.collapseAria`:`sessions.sidebar.group.expandAria`,{label:e.project.label}),style:{touchAction:`manipulation`},children:[(0,$.jsx)(us,{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}),Ge.get(e.project.id)?(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1 typography-micro text-muted-foreground`,children:[(0,$.jsx)(W,{name:`git-branch`,className:`size-3 shrink-0`}),(0,$.jsx)(`span`,{className:`truncate`,children:Ge.get(e.project.id)})]}):null]}),e.isActive?(0,$.jsx)(fs,{ariaLabel:r(`mobile.sessions.activeProjectAria`)}):null,(0,$.jsx)(`span`,{className:`shrink-0 typography-micro text-muted-foreground tabular-nums`,children:e.totalSessions})]}),(()=>{let t=n?[]:[...new Set(e.buckets.flatMap(e=>e.sessions.filter(e=>Ye.has(e.id)).map(e=>e.id)))];return t.length>0?(0,$.jsx)(`button`,{type:`button`,className:`flex size-9 shrink-0 items-center justify-center rounded-full text-[var(--surface-mutedForeground)] transition-colors hover:bg-[var(--interactive-hover)] hover:text-[var(--surface-foreground)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--interactive-focus-ring)] mr-1`,"aria-label":r(`mobile.sessions.stopGroupAria`,{label:e.project.label}),onClick:e=>{e.stopPropagation(),$e(t)},style:{touchAction:`manipulation`},children:(0,$.jsx)(hi,{})}):null})(),e.project.isGitRepo?(0,$.jsx)(ps,{className:`mr-2`,onClick:()=>Tt(e.project.id)}):null]}),n?(0,$.jsx)(`div`,{className:`pb-2`,children:(()=>{let t=o.find(e=>e.worktree===null),n=o.filter(e=>e.worktree!==null);return(0,$.jsxs)($.Fragment,{children:[t&&(t.sessions.length>0||n.length===0)?vt(e,t,Xo):null,n.map(t=>{let n=ut(e,t),i=s===t.path,a=`worktree:${e.project.id}:${t.key}`,o=ht({key:a,kind:`worktree`,project:e.project,worktree:t.worktree});return(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`button`,{type:`button`,className:U(`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:()=>gt(a,()=>bt(e.project.id,t.key,n)),onPointerDown:o.onPointerDown,onPointerMove:o.onPointerMove,onPointerUp:o.onPointerUp,onPointerCancel:o.onPointerCancel,onContextMenu:o.onContextMenu,"aria-expanded":n,"aria-label":r(n?`sessions.sidebar.group.collapseAria`:`sessions.sidebar.group.expandAria`,{label:t.label}),style:{touchAction:`manipulation`},children:[(0,$.jsx)(ds,{expanded:n}),(0,$.jsx)(W,{name:`node-tree`,className:U(`size-4 shrink-0`,i?`text-primary`:`text-muted-foreground`)}),(0,$.jsx)(`span`,{className:U(`block min-w-0 flex-1 truncate typography-ui-label font-semibold`,i?`text-foreground`:`text-foreground/90`),children:t.label}),i?(0,$.jsx)(fs,{ariaLabel:r(`mobile.sessions.activeWorktreeAria`)}):null,(()=>{let e=n?[]:t.sessions.filter(e=>Ye.has(e.id)).map(e=>e.id);return e.length>0?(0,$.jsx)(`button`,{type:`button`,className:`flex size-9 shrink-0 items-center justify-center rounded-full text-[var(--surface-mutedForeground)] transition-colors hover:bg-[var(--interactive-hover)] hover:text-[var(--surface-foreground)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--interactive-focus-ring)]`,"aria-label":r(`mobile.sessions.stopGroupAria`,{label:t.label}),onClick:t=>{t.stopPropagation(),$e(e)},style:{touchAction:`manipulation`},children:(0,$.jsx)(hi,{})}):null})(),(0,$.jsx)(`span`,{className:`shrink-0 typography-micro text-muted-foreground tabular-nums`,children:t.sessions.length})]}),n?vt(e,t,Xo):null]},t.key)})]})})()}):null]},e.project.id)})})]}),(0,$.jsx)(Cr,{open:ue,onOpenChange:de,forceMobile:!0}),(0,$.jsx)(Ln,{open:K,projectId:me,onOpenChange:e=>{pe(e),e||q(null)},onWorktreeCreated:(e,n)=>{n?.sessionId?v(n.sessionId,e):T({selectedProjectId:me,directoryOverride:e,preserveDirectoryOverride:!0}),t(!1)}}),(0,$.jsx)(Hn,{open:!!Y,title:Jt,onClose:mt,contentMaxHeightClassName:`max-h-[min(68dvh,560px)]`,children:Xt}),(0,$.jsx)(Hn,{open:!!we,title:r(`sessions.sidebar.project.actions.closeProject`),onClose:()=>De(null),closeAriaLabel:r(`mobile.surface.closeAria`),footer:(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[(0,$.jsx)(H,{type:`button`,variant:`ghost`,className:`flex-1`,onClick:()=>De(null),children:r(`sessions.sidebar.dialogs.cancel`)}),(0,$.jsx)(H,{type:`button`,variant:`destructive`,className:`flex-1`,onClick:()=>{if(!we)return;let e=we;De(null),k(e.id),X.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:we?.label??``})})}),(0,$.jsx)(Hn,{open:!!Pe,title:r(`sessions.sidebar.session.menu.rename`),onClose:()=>{Re||(Fe(null),Le(``))},footer:(0,$.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,$.jsx)(H,{type:`button`,variant:`default`,className:`flex-1`,disabled:Re,onClick:()=>{Fe(null),Le(``)},children:r(`sessions.sidebar.dialogs.cancel`)}),(0,$.jsx)(H,{type:`button`,variant:`default`,className:`flex-1`,disabled:!Ie.trim()||Re,onClick:()=>void Mt(),children:r(`sessions.sidebar.session.rename.save`)})]}),children:(0,$.jsxs)(`form`,{className:`flex flex-col gap-3 px-1 py-1`,onSubmit:e=>{e.preventDefault(),Mt()},children:[(0,$.jsx)(Gt,{value:Ie,onChange:e=>Le(e.target.value),autoFocus:!0,className:`h-12`,disabled:Re}),(0,$.jsxs)(H,{type:`button`,variant:`outline`,className:`w-full gap-2`,disabled:Re,onClick:()=>void Nt(),children:[Re?(0,$.jsx)(W,{name:`loader-4`,className:`size-4 animate-spin`}):(0,$.jsx)(W,{name:`ai-generate-2`,className:`size-4`}),r(`sessions.sidebar.session.rename.smartTitle`)]})]})}),Be?(0,$.jsx)($r,{open:!0,project:{id:Be.project.id,path:Be.project.path},worktree:Be.worktree,onClose:()=>Ve(null),onDeleted:()=>G(e=>e+1)}):null,(0,$.jsx)(ai,{open:ie!==null,project:tt.find(e=>e.id===ie)??null,onClose:()=>ae(null),onWorktreesChanged:()=>G(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:qt?(0,$.jsx)(`div`,{className:`flex shrink-0 items-center gap-2`,children:qt}):null}),Zt]}):null:(0,$.jsx)(dt,{id:`mobile-sessions-sheet`,open:e,onOpenChange:t,trailing:qt,ariaLabel:r(`mobile.sessions.sheet.title`),closeAriaLabel:r(`mobile.surface.closeAria`),resizeAriaLabel:r(`mobile.sessions.sheet.resizeAria`),initiallyExpanded:!0,children:Zt})},vs=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},ys=[{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 bs(e){let t=(0,Q.c)(23),{activeTab:n,onTabChange:r,className:i,tabMarks:a,homeView:o}=e,s=o===void 0?`projects`:o,{t:c}=rt(),l=cn(),u;t[0]===c?u=t[1]:(u=c(`mobile.tabs.activity.loading`),t[0]=c,t[1]=u);let d=u,f;t[2]===r?f=t[3]:(f=e=>{r(e.currentTarget.dataset.tab)},t[2]=r,t[3]=f);let p=R(f),m;t[4]!==n||t[5]!==r?(m=e=>{if(![`ArrowLeft`,`ArrowRight`,`Home`,`End`].includes(e.key))return;e.preventDefault();let t=ys.findIndex(e=>e.id===n),i=ys[e.key===`Home`?0:e.key===`End`?ys.length-1:(t+(e.key===`ArrowRight`?1:-1)+ys.length)%ys.length];r(i.id),document.getElementById(`mobile-tab-${i.id}`)?.focus()},t[4]=n,t[5]=r,t[6]=m):m=t[6];let h=R(m),g;t[7]===c?g=t[8]:(g=c(`mobile.nav.aria`),t[7]=c,t[8]=g);let _;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(_={role:`tablist`},t[9]=_):_=t[9];let v;t[10]!==n||t[11]!==l||t[12]!==p||t[13]!==h||t[14]!==s||t[15]!==d||t[16]!==c||t[17]!==a?(v=ys.map(e=>{let t=e.id===n,r=c(e.labelKey),i=e.id===`assistant`&&l>0,o=!i&&a?.[e.id]===`loading`,u=i?`mobile-tab-assistant-unread`:o?`mobile-tab-${e.id}-activity`:void 0;return(0,$.jsxs)(H,{id:`mobile-tab-${e.id}`,"data-tab":e.id,type:`button`,role:`tab`,variant:`ghost`,size:`sm`,"aria-controls":`mobile-tabpanel-${e.id}`,"aria-label":r,"aria-describedby":u,"aria-selected":t,tabIndex:t?0:-1,title:r,onClick:p,onKeyDown:h,className:U(`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)(Nr,{size:23,className:`size-[23px] shrink-0 items-center justify-center [&[data-assistant-navigation-avatar]]:scale-105`}):(0,$.jsx)(W,{name:e.id===`projects`?s===`tasks`?`list-check-2`:`folder-tree`:e.icon,weight:`medium`,className:`size-[23px] shrink-0`}),u?(0,$.jsx)(`span`,{id:u,role:o?`status`:void 0,"aria-label":o?d:void 0,"data-mobile-tab-activity":o?`loading`:void 0,className:`pointer-events-none absolute left-full -top-1 ml-0.5 inline-flex z-10`,children:i?(0,$.jsx)(Wi,{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)(W,{name:`loader-4`,className:`size-3 animate-spin`})})}):null]}),(0,$.jsx)(`span`,{className:`yuri-mobile-tab-label block max-w-full overflow-hidden text-ellipsis whitespace-nowrap`,children:r})]},e.id)}),t[10]=n,t[11]=l,t[12]=p,t[13]=h,t[14]=s,t[15]=d,t[16]=c,t[17]=a,t[18]=v):v=t[18];let y;return t[19]!==i||t[20]!==g||t[21]!==v?(y=(0,$.jsx)(Ui,{as:`nav`,"aria-label":g,variant:`navigation`,surfaceProps:_,className:i,children:v}),t[19]=i,t[20]=g,t[21]=v,t[22]=y):y=t[22],y}function xs(e){return e.unreadCount>0?`unread`:e.working?`loading`:null}var Ss=`yuri-native-ios-tab-bar`,Cs=`YuriTabBar`,ws=[`projects`,`assistant`,`scheduled`,`settings`],Ts=ee(Cs),Es=e=>e.isCapacitor&&e.platform===`ios`&&e.pluginAvailable&&e.nativeUiEnabled!==!1;function Ds(){return typeof window>`u`?!1:Es({isCapacitor:g(),platform:y(),pluginAvailable:z.isPluginAvailable(Cs),nativeUiEnabled:Pt()})}var Os=e=>e.classList.contains(`dark`)?`dark`:`light`,ks=()=>Ft(`--primary`),As=e=>typeof e==`string`&&ws.includes(e),js=e=>typeof e==`string`&&As(e)?e:null,Ms=(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)),Ns=(e,t)=>{e.classList.toggle(Ss,t)},Ps=(e,t)=>e&&!t,Fs=e=>e.visible?e.overlayHidden?{action:`present`}:e.lastState&&Ms(e.lastState,e.nextState)?{action:`skip`}:{action:`present`}:e.overlayHidden?{action:`skip`}:{action:`hide`},Is=()=>Ts,Ls=`mobile-overlay-root`;function Rs(e){let t=(0,Q.c)(31),n=Lt(),r;t[0]===n?r=t[1]:(r=n&&Ds(),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=R(e.onTabChange),h;t[2]===e.tabs?h=t[3]:(h=JSON.stringify(e.tabs.map(Bs)),t[2]=e.tabs,t[3]=h);let g=h,_;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(_=typeof document>`u`?`dark`:Os(document.documentElement),t[4]=_):_=t[4];let v=_,y;t[5]===i?y=t[6]:(y=!i||typeof document>`u`?``:ks(),t[5]=i,t[6]=y);let b=y,x,S;t[7]===i?(x=t[8],S=t[9]):(x=()=>{if(!i||typeof document>`u`)return;let e=document.getElementById(Ls);e||(e=document.createElement(`div`),e.id=Ls,document.body.appendChild(e));let t=()=>u(In(e.children));t();let n=new MutationObserver(t);return n.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[Fn]}),()=>n.disconnect()},S=[i],t[7]=i,t[8]=x,t[9]=S),(0,Z.useEffect)(x,S);let C;t[10]!==i||t[11]!==m?(C=()=>{if(!i)return;let e=!1,t=Is(),n=[];return t.addListener(`tabSelected`,e=>{let t=js(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`&&Ns(document.documentElement,!1)}},t[10]=i,t[11]=m,t[12]=C):C=t[12];let w;t[13]===i?w=t[14]:(w=[i],t[13]=i,t[14]=w),(0,Z.useEffect)(C,w);let T;t[15]!==b||t[16]!==e.activeTab||t[17]!==e.ariaLabel||t[18]!==e.tabs||t[19]!==e.visible||t[20]!==i||t[21]!==l?(T=()=>{if(!i||p.current)return;let t=!1,n=Is(),r={tabs:e.tabs.map(zs),selectedTab:e.activeTab,appearance:v,accentColor:b,ariaLabel:e.ariaLabel},a=Fs({visible:Ps(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`&&Ns(document.documentElement,!1);return}f.current=!1,d.current=r,o(!0),typeof document<`u`&&Ns(document.documentElement,!0)}})().catch(()=>{t||(p.current=!0,c(!0),o(!1),typeof document<`u`&&Ns(document.documentElement,!1))}),()=>{t=!0}},t[15]=b,t[16]=e.activeTab,t[17]=e.ariaLabel,t[18]=e.tabs,t[19]=e.visible,t[20]=i,t[21]=l,t[22]=T):T=t[22];let E;return t[23]!==b||t[24]!==e.activeTab||t[25]!==e.ariaLabel||t[26]!==e.visible||t[27]!==i||t[28]!==l||t[29]!==g?(E=[i,e.visible,l,e.activeTab,e.ariaLabel,v,b,g],t[23]=b,t[24]=e.activeTab,t[25]=e.ariaLabel,t[26]=e.visible,t[27]=i,t[28]=l,t[29]=g,t[30]=E):E=t[30],(0,Z.useLayoutEffect)(T,E),!i||s?`web`:a?`native`:`pending`}function zs(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 Bs(e){return[e.id,e.label,e.badge??null,e.activity===!0,e.activity===!0?e.activityLabel??null:null]}function Vs(e){let t=(0,Q.c)(52),{homeView:n,tabs:r,navigation:i,onTabChange:a,secondaryPages:o,showTabBar:s,tabBarCovered:c,className:l}=e,u=n===void 0?`projects`:n,d=o===void 0?[]:o,f=s===void 0||s,p=c!==void 0&&c,{t:m}=rt(),h=i.activeTab,g=d.slice(-2),_=g.at(-1)??null,v=_?.key??null,y=_?.depth,b=g.length>1?g[g.length-2].key:null,x;t[0]===h?x=t[1]:(x=()=>new Set([h]),t[0]=h,t[1]=x);let[S,C]=Z.useState(x);S.has(h)||C(e=>{if(e.has(h))return e;let t=new Set(e);return t.add(h),t});let w=Z.useRef(null),T=Z.useRef(null),E=Z.useRef(null),D=Z.useRef(new Map),O=Z.useRef(null),k=Z.useRef(!1),A=Z.useRef(``),j=R(()=>_?.onBack());Rt({id:_?`mobile-secondary:${_.key}`:`mobile-secondary:inactive`,active:!!_,onBack:j,surfaceRef:w,underlayRef:T}),Z.useLayoutEffect(()=>{let e=v===null?null:D.current.get(v)??null,t=b===null?E.current:D.current.get(b)??null;w.current=e,T.current=t},[v,y,b]);let M;t[2]===_?M=t[3]:(M=[_],t[2]=_,t[3]=M),Z.useLayoutEffect(()=>{if(_){if(!k.current){let e=document.activeElement;O.current=e instanceof HTMLElement?e:null,k.current=!0}A.current!==_.key&&(A.current=_.key,w.current?.focus());return}if(k.current){k.current=!1,A.current=``;let e=O.current;O.current=null,e&&e.isConnected&&e.focus()}},M);let N;t[4]===a?N=t[5]:(N=e=>{a(e)},t[4]=a,t[5]=N);let P=R(N),F=cn(),I=un(),L=ln(),ee;t[6]===m?ee=t[7]:(ee=m(`mobile.tabs.activity.loading`),t[6]=m,t[7]=ee);let z=ee,B;t[8]!==F||t[9]!==I?(B=xs({unreadCount:F,working:I}),t[8]=F,t[9]=I,t[10]=B):B=t[10];let te=B,ne;t[11]===L?ne=t[12]:(ne=xs({unreadCount:0,working:L}),t[11]=L,t[12]=ne);let re=ne,ie;t[13]!==te||t[14]!==F||t[15]!==z||t[16]!==re||t[17]!==m?(ie=ys.map(e=>{let t=e.id===`assistant`&&te===`loading`||e.id===`scheduled`&&re===`loading`;return{id:e.id,label:m(e.labelKey),badge:e.id===`assistant`&&te===`unread`?F>99?`99+`:String(F):null,activity:t,activityLabel:t?z:null}}),t[13]=te,t[14]=F,t[15]=z,t[16]=re,t[17]=m,t[18]=ie):ie=t[18];let ae=ie,oe=f&&!p&&!_,V;t[19]===m?V=t[20]:(V=m(`mobile.nav.aria`),t[19]=m,t[20]=V);let se;t[21]!==P||t[22]!==oe||t[23]!==ae||t[24]!==h||t[25]!==V?(se={visible:oe,activeTab:h,tabs:ae,ariaLabel:V,onTabChange:P},t[21]=P,t[22]=oe,t[23]=ae,t[24]=h,t[25]=V,t[26]=se):se=t[26];let H=Rs(se),W=H===`native`,G=f&&H===`web`,ce=Lt(),le,ue;t[27]!==ce||t[28]!==W?(le=()=>{if(!ce){It.shutdown();return}W&&zt(!0)&&It.warm()},ue=[ce,W],t[27]=ce,t[28]=W,t[29]=le,t[30]=ue):(le=t[29],ue=t[30]),Z.useEffect(le,ue);let de=h===`assistant`&&`yuri-assistant-wallpaper`,K;t[31]!==l||t[32]!==de?(K=U(`yuri-mobile-floating-shell relative isolate flex h-full min-h-0 flex-col overflow-hidden text-foreground`,`bg-[var(--yuri-mobile-page-background)]`,de,l),t[31]=l,t[32]=de,t[33]=K):K=t[33];let fe=_?!0:void 0,pe=_?!0:void 0,me=_?`true`:void 0,he;t[34]!==h||t[35]!==f||t[36]!==G||t[37]!==m||t[38]!==r||t[39]!==S?(he=ys.map(e=>{let t=S.has(e.id);return(0,$.jsx)(`section`,{id:`mobile-tabpanel-${e.id}`,role:`tabpanel`,"aria-labelledby":G?`mobile-tab-${e.id}`:void 0,"aria-label":G?void 0:m(e.labelKey),hidden:h!==e.id,tabIndex:0,className:U(`scrollbar-none h-full min-h-0 flex-1 overflow-y-auto overflow-x-hidden overscroll-contain px-[var(--yuri-mobile-page-inline-inset)] pt-[calc(var(--safe-area-inset-top,env(safe-area-inset-top,0px))+1rem)] outline-none`,f?`pb-[calc(var(--yuri-mobile-dock-height)+2.5rem+var(--safe-area-inset-bottom,env(safe-area-inset-bottom,0px)))]`:`pb-0`),children:t?(0,$.jsx)(Z.Suspense,{fallback:null,children:r?.[e.id]??(0,$.jsx)(Hs,{tab:e.id,icon:e.icon})}):null},e.id)}),t[34]=h,t[35]=f,t[36]=G,t[37]=m,t[38]=r,t[39]=S,t[40]=he):he=t[40];let q=f?(0,$.jsx)(`div`,{"data-mobile-navigation-dock-underlay":`true`,"aria-hidden":_||W?!0:void 0,inert:_||W?!0:void 0,children:G?(0,$.jsx)(bs,{activeTab:h,homeView:u,onTabChange:P,tabMarks:{assistant:te===`loading`?`loading`:null,scheduled:re===`loading`?`loading`:null}}):null}):null,ge;t[41]!==E||t[42]!==fe||t[43]!==pe||t[44]!==me||t[45]!==he||t[46]!==q?(ge=(0,$.jsxs)(`div`,{ref:E,"data-mobile-navigation-underlay":`true`,"aria-hidden":fe,inert:pe,"data-mobile-navigation-parked":me,className:`flex h-full min-h-0 flex-1 flex-col`,children:[he,q]}),t[41]=E,t[42]=fe,t[43]=pe,t[44]=me,t[45]=he,t[46]=q,t[47]=ge):ge=t[47];let J=g.map((e,t)=>{let n=t===g.length-1;return(0,$.jsx)(`div`,{ref:t=>{t?D.current.set(e.key,t):D.current.delete(e.key)},"data-mobile-secondary-page":`true`,"data-mobile-secondary-active":n?`true`:`false`,role:n?`dialog`:void 0,"aria-modal":n?!0:void 0,"aria-label":n?e.ariaLabel??m(`mobile.nav.secondaryPageAria`):void 0,"aria-hidden":!n||void 0,inert:!n||void 0,tabIndex:n?-1:void 0,className:U(`absolute inset-0 flex h-full min-h-0 flex-col overflow-hidden bg-background outline-none`,n?`z-50`:`z-40`),children:(0,$.jsx)(Z.Suspense,{fallback:null,children:e.content})},e.key)}),_e;return t[48]!==K||t[49]!==ge||t[50]!==J?(_e=(0,$.jsxs)(`div`,{className:K,children:[ge,J]}),t[48]=K,t[49]=ge,t[50]=J,t[51]=_e):_e=t[51],_e}function Hs(e){let t=(0,Q.c)(17),{tab:n,icon:r,className:i}=e,{t:a}=rt(),o,s,c,l;if(t[0]!==i||t[1]!==r||t[2]!==a||t[3]!==n){let e=ys.find(e=>e.id===n)??ys[0];t[8]===i?c=t[9]:(c=U(`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)(W,{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 Us=(e,t)=>e.id===t.id&&e.title===t.title&&e.directory===t.directory&&e.projectLabel===t.projectLabel&&e.project===t.project&&e.branch===t.branch&&e.branchState===t.branchState&&e.pathLabel===t.pathLabel&&e.activityLabel===t.activityLabel&&e.unread===t.unread&&e.pinned===t.pinned&&e.active===t.active,Ws=[],Gs=(e,t,n)=>{let r=(e??t)?.trim();return r&&r!==`HEAD`&&r!==n?r:void 0};function Ks(e,t){let{enabled:n,status:r,settledLimit:i}=t,{t:a}=rt(),o=ge(),s=qr(),c=fr({enabled:n}),l=qe(),u=q(e=>e.index.session.unseenCount),d=Ne(e=>e.sessionOrderByScope[xr]),f=J(e=>e.projects),p=je(e=>e.currentSessionId),m=D(e=>e.homeDirectory),h=Fr(c,n),g=Z.useRef(new Map),{git:_}=P(),v=Nt(e=>e.ensureStatus),y=Z.useMemo(()=>n?[...e.projectMetaById.values()].map(e=>e.path):Ws,[n,e.projectMetaById]),b=At(y);return Z.useEffect(()=>{if(!(!n||!_))for(let e of y)v(e,_)},[n,v,_,y]),Z.useMemo(()=>{if(!n)return null;let t=Tr({sessions:e.allSessions,pinnedSessionIds:o,settledSessionIds:s,runningSessionIds:c,pendingRequestSessionIds:l,unseenBySession:u}),_=pr(e.allSessions,o,d).filter(lr),v=new Map(f.map(e=>[e.id,e.color??void 0])),y=a(`mobile.sessions.untitled`),x=a(`sessions.sidebar.task.unassigned`),S=g.current,C=new Map,w=(t,n)=>{let r=e.ownership.bySessionId.get(t.id),i=r?e.projectMetaById.get(r.projectId):void 0,a=i&&r?.kind===`worktree`?li(i,r.scopeDirectory):null,o=i?b.get(i.path):void 0,s=Gs(a?.branch,o?.branch,i?.label),c=s?null:!i||o?.isGitRepo===!1?`no-git`:`loading`,l={id:t.id,title:t.title?.trim()||y,directory:pi(t),projectLabel:i?.label||x,project:i?{id:i.id,icon:i.icon??void 0,color:v.get(i.id),iconImage:i.iconImage??void 0}:null,branch:s,branchState:c,pathLabel:c===`no-git`&&i?se(i.path,m):void 0,activityLabel:Ir(Rr(t))||void 0,unread:(u[t.id]??0)>0,pinned:n,active:p===t.id},d=S.get(t.id),f=d&&Us(d,l)&&d.project?.iconImage===l.project?.iconImage?d:l;return C.set(t.id,f),f},T=e=>(u[e.id]??0)>0,E=[..._,...t.active],D=r===`archived`?t.settled:E,O=r===`unread`?D.filter(T):D,k={items:(r===`archived`?O.slice(0,i):O).map(e=>w(e,o.has(e.id))),total:O.length,runStartTimes:h};return g.current=C,k},[p,n,b,m,e.allSessions,e.ownership,e.projectMetaById,l,d,o,f,h,c,s,i,r,a,u])}var qs=(e,t,n)=>e?.kind===`project`&&e.project.id===t?{...e,isGitRepository:n}:e;function Js({homeView:e,onHomeViewChange:t,onOpenChat:n,onAddProject:r,onNewSession:i,onScanQr:a,onSwitchInstance:o,onRemoteDesktop:s,instanceOptions:c,className:l}){let{t:u}=rt(),{git:d}=P(),f=Me(),p=Qr(),[m,g]=Z.useState(()=>new Map),_=R((e,t)=>{g(n=>{if(!t.length&&!n.has(e))return n;let r=new Map(n);return t.length?r.set(e,t):r.delete(e),r})}),v=R((e,t,n,r)=>{let i=Ne.getState(),a=e===`__pinned__`?e:h(e);if(!a||a!==`__pinned__`&&i.getSessionFolderId(a,n)!==i.getSessionFolderId(a,r))return;let o=a===`__pinned__`?{}:ur(p.allSessions.filter(e=>pi(e)===a));i.reorderSessions(a,t,n,r,o).catch(()=>X.error(u(`sessions.order.saveFailed`)))}),y=hr(e=>e.setProjectExpanded),b=hr(e=>e.setWorktreeExpanded),x=_e(),S=si(),[C,w]=Z.useState(`active`),[T,E]=Z.useState(30),D=Ks(p,{enabled:e===`tasks`,status:C,settledLimit:T}),O=R(e=>{w(e),E(30)}),k=R(()=>E(e=>e+30)),A=R(e=>{S(e,!1)}),j=ge(),M=je(e=>e.archiveSessions),N=je(e=>e.updateSessionTitle),F=je(e=>e.requestSessionSmartTitle),I=je(e=>e.shareSession),L=je(e=>e.unshareSession),ee=je(e=>e.openNewSessionDraft),z=G(e=>e.openDraft),B=G(e=>e.openSession),te=J(e=>e.projects),ne=Y(e=>e.projectSortOrder),re=oi(),ie=Z.useMemo(()=>te.filter(e=>e.hostId).map(Qe),[te]),ae=Z.useMemo(()=>ie.flatMap(e=>m.get(e.id)??[]).map(e=>({pinned:!!e.pinned,time:ce(e.node.session),session:{id:e.identity,title:e.node.session.title||``,content:e.content}})),[ie,m]),oe=Ne(e=>e.sessionOrderByScope[xr]),V=Z.useMemo(()=>gr([...p.pinnedSessions,...ae.filter(e=>e.pinned).map(e=>e.session)],e=>e.id,oe),[p.pinnedSessions,ae,oe]),se=Z.useMemo(()=>[...p.inProgressSessions.map(e=>({session:e,time:p.sessionById.get(e.id)?ce(p.sessionById.get(e.id)):0})),...ae.filter(e=>!e.pinned)].sort((e,t)=>t.time-e.time).map(e=>e.session),[p.inProgressSessions,p.sessionById,ae]),U=J(e=>e.setActiveProjectIdOnly),ue=J(e=>e.removeProject),de=Rn(),[K,pe]=Z.useState(null),[he,q]=Z.useState(!1),[ve,ye]=Z.useState(null),[xe,Se]=Z.useState(null),[Ce,we]=Z.useState(null),[Te,Ee]=Z.useState(``),[De,Oe]=Z.useState(!1),[ke,Ae]=Z.useState(!1),[Pe,Fe]=Z.useState(null),[Ie,Le]=Z.useState(null),[Re,ze]=Z.useState(null),Be=K?.kind===`session`?K.session.id:``,Ve=me(Be),He=Ve?.type===`busy`||Ve?.type===`retry`,Ue=K?.kind===`session`?pi(K.session):``,{unread:We,onToggleRead:Ge}=Pr(K?.kind===`session`?K.session:null,Ue),Ke=!!Be&&Re===Be,qe=!Ue||Ke||He,Je=R(e=>{let t=new Map;for(let e of p.allSessions){let n=Xr(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}),Ye=R(()=>{q(!1),pe(null)}),Xe=R(e=>{if(Vr(e.id)){let t=ii(e.id);if(!t)return;t.kind===`more`?p.showMoreBucketSessions(t.projectId,t.bucketKey):p.resetBucketVisibleCount(t.projectId,t.bucketKey);return}let t=p.sessionById.get(e.id),r=t&&pi(t)||null;n({sessionId:e.id,directory:r})}),Ze=Z.useRef(null),$e=R(()=>{Ze.current!==null&&(window.clearTimeout(Ze.current),Ze.current=null)}),et=R(e=>{if($e(),e.pointerType!==`touch`&&e.pointerType!==`pen`)return;let t=(e.target?.closest(`[data-mobile-session-id]`))?.dataset.mobileSessionId,n=t?p.sessionById.get(t):void 0;if(!t||!n||Vr(t))return;let r=pi(n)||null;Ze.current=window.setTimeout(()=>{Ze.current=null,be(t,r)},60)});Z.useEffect(()=>$e,[$e]);let tt=R(e=>{Xe({id:e,title:``})}),nt=R(e=>{Vr(e.id)||x(e.id)}),it=R(async t=>{if(Vr(t.id))return;if(e===`tasks`){let e=j.has(t.id);e&&x(t.id),S(t.id,!0),X.success(u(`sessions.sidebar.session.archive.success`),{action:{label:u(`sessions.sidebar.undo`),onClick:()=>{S(t.id,!1),e&&x(t.id)}}});return}let n=Je(t.id),{archivedIds:r,failedIds:i}=await M(n);r.length>0&&Mr({sessionIds:r,message:r.length===1?u(`sessions.sidebar.session.archive.success`):u(`sessions.sidebar.bulkActions.archivedPlural`,{count:r.length}),undoLabel:u(`sessions.sidebar.undo`),settingsLabel:u(`settings.yuri.archivedSessions.actions.view`),undoFailedMessage:r.length===1?u(`sessions.sidebar.session.archive.undoFailed`):u(`sessions.sidebar.bulkActions.archiveUndoFailed`,{count:r.length})}),i.length>0&&X.error(i.length===1?u(`sessions.sidebar.bulkActions.failedArchiveSingle`,{count:i.length}):u(`sessions.sidebar.bulkActions.failedArchivePlural`,{count:i.length}))}),at=R(()=>{if(!K||K.kind!==`session`)return;let e=K.session,t=pi(e),n=Ve?.type??`idle`;!t||Re===e.id||n===`busy`||n===`retry`||(ze(e.id),(async()=>{try{await de.refreshSessionTranscript(e.id,{directory:t}),X.success(u(`sessions.sidebar.session.menu.refreshTranscriptSuccess`))}catch{X.error(u(`sessions.sidebar.session.menu.refreshTranscriptFailed`))}finally{ze(t=>t===e.id?null:t)}})())}),ot=R(e=>{if(Vr(e.id))return;let t=p.sessionById.get(e.id);t&&(pe({kind:`session`,session:t}),q(!0))}),st=R(e=>{ot({id:e,title:``})}),ct=R(e=>{y(e.id,!e.expanded)}),lt=R((e,t)=>{b(`${e.id}::${t.id}`,!t.expanded)}),ut=R((e,t)=>{U(e.id),z({selectedProjectId:e.id,directoryOverride:t,preserveDirectoryOverride:!0})}),dt=R(()=>{let e=J.getState().getActiveProject();if(e?.hostId){or(Qe(e),!0).catch(e=>X.error(e instanceof Error?e.message:String(e)));return}if(i){i();return}ee()}),ft=R(e=>{let t=p.projectMetaById.get(e.id);t&&(pe({kind:`project`,project:t,isGitRepository:!1}),q(!0),d.checkIsGitRepository(t.path).then(e=>{pe(n=>qs(n,t.id,e))}).catch(()=>{pe(e=>qs(e,t.id,!1))}))}),pt=R((e,t)=>{let n=h(t);return n?e.worktrees.find(e=>h(e.path)===n)||((je.getState().availableWorktreesByProject.get(e.path)??[]).find(e=>h(e.path)===n)??null):null}),mt=R((e,t)=>{let n=p.projectMetaById.get(e.id);n&&ut(n,t.path)}),ht=R((e,t)=>{let n=p.projectMetaById.get(e.id);n&&(pe({kind:`worktree`,project:n,worktreePath:t.path,worktreeName:t.name}),q(!0))}),gt=R((e,t)=>{let n=p.projectMetaById.get(e.id);if(!n)return;let r=pt(n,t.path);if(!r){X.error(u(`sessions.sidebar.sessionDialogs.worktree.errorRemoveTitle`),{description:u(`sessions.sidebar.dialogs.deleteResult.tryAgain`)});return}Le({project:n,worktree:r})}),_t=R(e=>{Fe(e),U(e),Ae(!0)}),vt=R(e=>{(async()=>{let t=e.worktrees;try{t=(await Gn({id:e.id,path:e.path})).worktrees}catch(n){console.warn(`[MobileProjectsHome] Worktree refresh before session sync failed:`,n),t=je.getState().availableWorktreesByProject.get(e.path)??e.worktrees}await le([e.path,...t.map(e=>e.path)],p.allSessions)})()}),yt=R((e,t)=>{let n=Pe;if(Ae(!1),Fe(null),t?.sessionId){B({sessionId:t.sessionId,directory:e});return}z({selectedProjectId:n,directoryOverride:e,preserveDirectoryOverride:!0})}),bt=R(async e=>{try{if(!(await I(e.id))?.share?.url){X.error(u(`sessions.sidebar.session.share.error`));return}X.success(u(`sessions.sidebar.session.share.successTitle`),{description:u(`sessions.sidebar.session.share.successDescription`)})}catch{X.error(u(`sessions.sidebar.session.share.error`))}}),xt=R(async e=>{if((await fe(e)).ok){X.success(u(`sessions.sidebar.session.menu.copied`));return}X.error(u(`sessions.sidebar.session.share.copyUrlError`))}),St=R(async e=>{try{if(await L(e)){X.success(u(`sessions.sidebar.session.unshare.success`));return}X.error(u(`sessions.sidebar.session.unshare.error`))}catch{X.error(u(`sessions.sidebar.session.unshare.error`))}}),Ct=R(e=>{let t=Je(e.id);Wr({sessionIds:t,message:t.length===1?u(`sessions.sidebar.session.delete.success`):u(`sessions.sidebar.bulkActions.deletedPlural`,{count:t.length}),undoLabel:u(`sessions.sidebar.undo`),commitFailedMessage:u(`sessions.sidebar.session.delete.error`)})}),wt=R(async()=>{if(!Ce)return;let e=Te.trim();if(e)try{await N(Ce.id,e),we(null),Ee(``)}catch{X.error(u(`sessions.sidebar.session.menu.rename`),{description:u(`sessions.sidebar.dialogs.deleteResult.tryAgain`)})}}),Tt=R(async()=>{if(!Ce||De)return;let e=Ce.id;we(null),Ee(``),Oe(!0);try{await F(e)}catch{X.error(u(`sessions.sidebar.session.rename.smartTitle`),{description:u(`sessions.sidebar.dialogs.deleteResult.tryAgain`)})}finally{Oe(!1)}}),Et=Z.useMemo(()=>K?K.kind===`session`?{kind:`session`,title:K.session.title?.trim()||u(`mobile.sessions.untitled`),pinned:j.has(K.session.id),shared:!!K.session.share?.url,unread:We}:K.kind===`project`?{kind:`project`,title:K.project.label,gitRepository:K.isGitRepository}:{kind:`worktree`,title:K.worktreeName}:null,[K,We,j,u]),Dt=Z.useMemo(()=>{if(!K)return{};if(K.kind===`session`){let e=K.session;return{onRename:()=>{Ee(e.title?.trim()||u(`mobile.sessions.untitled`)),we(e)},onTogglePin:()=>x(e.id),onToggleRead:Ge,onShare:f&&!e.share?.url?()=>{bt(e)}:void 0,onCopyLink:f&&e.share?.url?()=>{xt(e.share.url)}:void 0,onUnshare:f&&e.share?.url?()=>{St(e.id)}:void 0,onRefreshTranscript:at,onArchive:()=>{it({id:e.id,title:e.title?.trim()||u(`mobile.sessions.untitled`)})},onDelete:()=>Ct(e)}}if(K.kind===`project`){let e=K.project;return{onNewSession:()=>ut(e,e.path),onNewWorktree:()=>_t(e.id),onSyncSessions:()=>vt(e),onEditProject:()=>ye(e.id),onCloseProject:()=>Se(e)}}let{project:e,worktreePath:t}=K;return{onNewSession:()=>ut(e,t),onDeleteWorktree:()=>{let n=pt(e,t);if(!n){X.error(u(`sessions.sidebar.sessionDialogs.worktree.errorRemoveTitle`),{description:u(`sessions.sidebar.dialogs.deleteResult.tryAgain`)});return}Le({project:e,worktree:n})}}},[K,it,xt,Ct,at,_t,vt,bt,St,Ge,pt,f,ut,u,x]),Ot=Z.useMemo(()=>{if(!ve)return null;let e=te.find(e=>e.id===ve),t=p.projectMetaById.get(ve);if(!e||!t)return null;let n=K?.kind===`project`&&K.project.id===ve?K.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}},[K,ve,p.projectMetaById,te]);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`contents`,onPointerDownCapture:et,onPointerMoveCapture:$e,onPointerCancelCapture:$e,children:(0,$.jsx)(Ur,{remoteProjects:ie,hostRegistry:re.registry,projectOrderIds:Gr(te,ne).map(e=>e.id),renderRemoteProject:re.registry?e=>(0,$.jsx)(ni,{project:e,registry:re.registry,mobile:!0,reorderEnabled:!1,onActivityItems:_}):void 0,remoteError:re.catalog.error?.message,className:l,projects:p.projects,pinnedSessions:V,inProgressSessions:se,onAddProject:r,onNewSession:dt,onScanQr:a,onSwitchInstance:o,instanceOptions:c,onRemoteDesktop:s,onToggleProject:ct,onOpenProjectActions:ft,onToggleWorktree:lt,onNewWorktreeSession:mt,onOpenWorktreeActions:ht,onDeleteWorktree:gt,onSelectSession:Xe,onPinSession:nt,onArchiveSession:e=>{it(e)},onOpenSessionActions:ot,onReorderSessions:v,task:{view:e,onViewChange:t,model:D,status:C,onStatusChange:O,onShowMoreSettled:k,onSelectTask:tt,onOpenTaskActions:st,onRestoreTask:A}})}),(0,$.jsx)(_i,{open:he,target:Et,actions:Dt,refreshTranscriptDisabled:qe,refreshTranscriptSpinning:Ke,onOpenChange:e=>{e?q(!0):Ye()}}),(0,$.jsx)(Ln,{open:ke,projectId:Pe,onOpenChange:e=>{Ae(e),e||Fe(null)},onWorktreeCreated:yt}),Ie?(0,$.jsx)($r,{open:!0,project:{id:Ie.project.id,path:Ie.project.path},worktree:Ie.worktree,onClose:()=>Le(null)}):null,(0,$.jsx)(Hn,{open:!!xe,title:u(`sessions.sidebar.project.actions.closeProject`),onClose:()=>Se(null),closeAriaLabel:u(`mobile.surface.closeAria`),footer:(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[(0,$.jsx)(H,{type:`button`,variant:`ghost`,className:`flex-1`,onClick:()=>Se(null),children:u(`sessions.sidebar.dialogs.cancel`)}),(0,$.jsx)(H,{type:`button`,variant:`destructive`,className:`flex-1`,onClick:()=>{if(!xe)return;let e=xe;Se(null),ue(e.id),X.success(u(`mobile.sessions.toast.projectRemoved`,{label:e.label}))},children:u(`mobile.sessions.confirmRemoveProject`)})]}),children:(0,$.jsx)(`p`,{className:`px-1 py-1 typography-ui-body text-foreground`,children:u(`mobile.projects.closeConfirmMessage`,{title:xe?.label??``})})}),(0,$.jsx)(Hn,{open:!!Ce,title:u(`sessions.sidebar.session.menu.rename`),onClose:()=>{De||(we(null),Ee(``))},closeAriaLabel:u(`mobile.surface.closeAria`),footer:(0,$.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,$.jsx)(H,{type:`button`,variant:`default`,className:`flex-1`,disabled:De,onClick:()=>{we(null),Ee(``)},children:u(`sessions.sidebar.dialogs.cancel`)}),(0,$.jsx)(H,{type:`button`,variant:`default`,className:`flex-1`,disabled:!Te.trim()||De,onClick:()=>void wt(),children:u(`sessions.sidebar.session.rename.save`)})]}),children:(0,$.jsxs)(`form`,{className:`flex flex-col gap-3 px-1 py-1`,onSubmit:e=>{e.preventDefault(),wt()},children:[(0,$.jsx)(Gt,{value:Te,onChange:e=>Ee(e.target.value),autoFocus:!0,className:`h-12`,disabled:De}),(0,$.jsxs)(H,{type:`button`,variant:`outline`,className:`w-full gap-2`,disabled:De,onClick:()=>void Tt(),children:[De?(0,$.jsx)(W,{name:`loader-4`,className:`size-4 animate-spin`}):(0,$.jsx)(W,{name:`ai-generate-2`,className:`size-4`}),u(`sessions.sidebar.session.rename.smartTitle`)]})]})}),(0,$.jsx)(ai,{open:ve!==null,project:Ot,onClose:()=>ye(null)})]})}function Ys(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}=rt(),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=U(`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)(Vi,{title:l,className:i,surface:!1,scrollsWithPage:!0,showHeader:s,surfaceClassName:u,children:d}),t[4]=i,t[5]=s,t[6]=l,t[7]=u,t[8]=d,t[9]=f):f=t[9],f}var Xs=Kt(()=>B(()=>import(`./AssistantView-8fyAae7J.js`).then(e=>({default:e.AssistantView})),__vite__mapDeps([3,1,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,2,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105]))),Zs=Kt(()=>B(()=>import(`./MobileAssistantTab-CMIQansR.js`).then(e=>({default:e.MobileAssistantTab})),__vite__mapDeps([106,1,6,7,8,9,10,21,13,5,4,14,15,22,23,24,25,26,17,18,27,28,16,2,29,30,19,11,12,20,31,33,34,35,36,37,38,94,73,59,74,75,66,76,77,107,108,109,110,101,102,103,51,69,70,104,105]))),Qs=Kt(()=>B(()=>import(`./MobileAssistantSettingsPage-Dgq5FMho.js`).then(e=>({default:e.MobileAssistantSettingsPage})),__vite__mapDeps([111,1,6,7,25,13,5,4,14,15,26,17,18,27,28,16,2,29,39,21,22,23,24,112,50,12,34,41,19,42,43,44,45,46,35,36,37,47,8,9,10,48,11,20,49,51,52,53,54,55,56,30,113,108,109,114,57,58,69,70,115,105,81,116,33,68,71,72,38,73,59,74,75,66,76,77,117,79,80,32,97,98,99,118,119,120,121,122,123,124,125,126,127,128,129,130,131]))),$s=Kt(()=>B(()=>import(`./MobileBtwPage-DQUkSO6N.js`).then(e=>({default:e.MobileBtwPage})),__vite__mapDeps([132,6,1,7,25,13,5,4,14,15,26,17,18,27,28,16,2,29,133,8,9,10,50,12,34,41,19,42,43,44,45,46,35,36,37,47,48,11,20,49,51,21,22,23,52,53,54,55,56,30,75,71,39,24,134,85,86,79,59,80,124,32,115,105,64,63,65,66,135,136,137,78,81,57,58,62,60,61,120,121,138,92,139,90,140,141,142]))),ec=Kt(()=>B(()=>import(`./MobileSettingsTab-DaTtRHo1.js`).then(e=>({default:e.MobileSettingsTab})),__vite__mapDeps([143,6,1,7,25,13,5,4,14,15,26,17,18,27,28,16,2,29,98,99,108,21,22,23,109,8,9,10,144,34,12,145,146,41,19,42,43,44,45,46,35,36,37,47,48,11,20,49,147,51,24,50,52,53,54,55,56,30,57,58,69,70,124,74,148,32,115,105,104,149,81,150,151,152,153,154,155,156,157,158,159,160,161,133,75,71,162,163,116,63,64,65,66,164,33,39,165,166,112,113,128,121,117,79,59,80,167,168,169,125,126,127,142,170,171,172,173,174,175,176,177,118,178,179,180,181,182,120,89,90,140,183,184,119,122,123,129,185,73,76,77,114,68,72,38,97,130,131,186,187,188,189,190,191,192,193,194,195,196,197,198,199])));function tc(e){let t=(0,Q.c)(2),n;return t[0]===e?n=t[1]:(n=(0,$.jsx)(Xs,{...e}),t[0]=e,t[1]=n),n}function nc(e){let t=(0,Q.c)(2),n;return t[0]===e?n=t[1]:(n=(0,$.jsx)(Zs,{...e}),t[0]=e,t[1]=n),n}function rc(e){let t=(0,Q.c)(2),n;return t[0]===e?n=t[1]:(n=(0,$.jsx)(Qs,{...e}),t[0]=e,t[1]=n),n}function ic(e){let t=(0,Q.c)(2),n;return t[0]===e?n=t[1]:(n=(0,$.jsx)($s,{...e}),t[0]=e,t[1]=n),n}function ac(e){let t=(0,Q.c)(2),n;return t[0]===e?n=t[1]:(n=(0,$.jsx)(ec,{...e}),t[0]=e,t[1]=n),n}var oc=`yuri.mobile.homeView`;function sc(e){let t=(0,Q.c)(121),{onAddProject:n,onScanQr:r,onSwitchInstance:i,onRemoteDesktop:a,remoteDesktopActive:o,instanceOptions:s,onEnableAssistants:c,instancesPage:l,instancesSecondaryPage:u,parentSessionTarget:d,registerSecondaryBackHandler:f,scheduledContent:p,renderChat:m,className:g}=e,_=o!==void 0&&o,v=d===void 0?null:d,{t:y}=rt(),[b,x]=Z.useState(Oc),S;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(S=e=>{x(e);try{O().setItem(oc,e)}catch{}},t[0]=S):S=t[0];let C=R(S),w=te(Dc),T=G(),E=G(Ec),D=G(Tc),k=G(wc),A=G(Cc),j=G(Sc),M=G(xc),N=G(bc),P=G(yc),F=G(vc),I=G(_c),L=G(gc),ee=G(hc),z;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(z=[],t[1]=z):z=t[1],Z.useEffect(mc,z);let B=T.secondary?.kind===`chat`?T.secondary.btw??null:null,ne=Z.useRef(null),re,ie;t[2]===B?(re=t[3],ie=t[4]):(re=()=>{let e=ne.current;ne.current=B,e&&e!==B&&qt.getState().clear({sessionId:e.sessionId,directory:e.directory}),B?Yt(Zt):Xt(Zt)},ie=[B],t[2]=B,t[3]=re,t[4]=ie),Z.useEffect(re,ie);let ae;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(ae=[],t[5]=ae):ae=t[5],Z.useEffect(fc,ae);let oe;t[6]===E?oe=t[7]:(oe=e=>{e===`settings`&&te.getState().setSettingsPage(`home`),E(e)},t[6]=E,t[7]=oe);let V=R(oe),se;t[8]===D?se=t[9]:(se=e=>{D(e)},t[8]=D,t[9]=se);let H=R(se),U;t[10]===N?U=t[11]:(U=()=>{N()},t[10]=N,t[11]=U);let W=R(U),ce;t[12]===k?ce=t[13]:(ce=()=>{k()},t[12]=k,t[13]=ce);let le=R(ce),ue;t[14]===A?ue=t[15]:(ue=e=>{A(e)},t[14]=A,t[15]=ue);let de=R(ue),fe=Z.useRef(null),[pe,me]=Z.useState(!1),he;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(he=e=>{fe.current=e},t[16]=he):he=t[16];let q=R(he),ge;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(ge=e=>{me(e)},t[17]=ge):ge=t[17];let J=R(ge),_e;t[18]!==W||t[19]!==v||t[20]!==M||t[21]!==ee||t[22]!==P?(_e=()=>{if(fe.current?.())return!0;let e=G.getState().secondary;return e?.kind===`chat`&&e.btw?(ee(),!0):e?.kind===`assistant`&&e.settingsAssistantID?(M(),!0):(e?.kind===`draft`||e?.kind===`chat`)&&v?.onSelect?(v.onSelect(),!0):e?.kind===`chat`&&e.routes.length>1?(P(),!0):e?(W(),!0):!1},t[18]=W,t[19]=v,t[20]=M,t[21]=ee,t[22]=P,t[23]=_e):_e=t[23];let Y=R(_e),ve=T.secondary!==null,ye;t[24]!==Y||t[25]!==f?(ye=()=>{if(f)return f(()=>Y()),()=>f(null)},t[24]=Y,t[25]=f,t[26]=ye):ye=t[26];let be;t[27]!==Y||t[28]!==f||t[29]!==ve?(be=[f,ve,Y],t[27]=Y,t[28]=f,t[29]=ve,t[30]=be):be=t[30],Z.useEffect(ye,be);let xe=je(dc),Se=K(uc),Ce;t[31]===xe?Ce=t[32]:(Ce=e=>xe?e.getDirectoryForSession(xe):null,t[31]=xe,t[32]=Ce);let we=je(Ce),Te,Ee;t[33]!==we||t[34]!==xe||t[35]!==I||t[36]!==Se||t[37]!==L?(Te=()=>{let e=G.getState().secondary;if(Se)return;if(e?.kind===`draft`&&xe){I({sessionId:xe,directory:we});return}if(e?.kind!==`chat`||!xe||Ye({sessionId:xe,directory:we})===`internal`)return;let t=e.routes.at(-1);(t?.sessionId!==xe||h(t.directory)!==h(we))&&L({sessionId:xe,directory:we})},Ee=[we,xe,I,L,Se],t[33]=we,t[34]=xe,t[35]=I,t[36]=Se,t[37]=L,t[38]=Te,t[39]=Ee):(Te=t[38],Ee=t[39]),Z.useEffect(Te,Ee);let De,Oe;t[40]!==xe||t[41]!==v||t[42]!==F||t[43]!==Se?(De=()=>{let e=G.getState().secondary;if(e?.kind!==`chat`||!v||v.onSelect||Se)return;let t=e.routes.at(-1);!t||t.sessionId!==xe||F({sessionId:v.id,directory:v.directory})},Oe=[xe,v,F,Se],t[40]=xe,t[41]=v,t[42]=F,t[43]=Se,t[44]=De,t[45]=Oe):(De=t[44],Oe=t[45]),Z.useEffect(De,Oe);let ke;t[46]!==J||t[47]!==q||t[48]!==p?(ke=typeof p==`function`?p(q,J):p,t[46]=J,t[47]=q,t[48]=p,t[49]=ke):ke=t[49];let Ae=ke,Me;t[50]!==C||t[51]!==le||t[52]!==b||t[53]!==s||t[54]!==n||t[55]!==a||t[56]!==r||t[57]!==i||t[58]!==H?(Me=(0,$.jsx)(Js,{homeView:b,onHomeViewChange:C,onOpenChat:H,onAddProject:n,onNewSession:le,onScanQr:r,onSwitchInstance:i,onRemoteDesktop:a,instanceOptions:s}),t[50]=C,t[51]=le,t[52]=b,t[53]=s,t[54]=n,t[55]=a,t[56]=r,t[57]=i,t[58]=H,t[59]=Me):Me=t[59];let Ne;t[60]!==c||t[61]!==de?(Ne=(0,$.jsx)(nc,{onEnable:c,onOpenAssistant:de}),t[60]=c,t[61]=de,t[62]=Ne):Ne=t[62];let Pe;t[63]===Ae?Pe=t[64]:(Pe=(0,$.jsx)(Ys,{showHeader:!1,children:Ae}),t[63]=Ae,t[64]=Pe);let Fe;t[65]===l?Fe=t[66]:(Fe=(0,$.jsx)(ac,{instancesPage:l}),t[65]=l,t[66]=Fe);let Ie;t[67]!==Me||t[68]!==Ne||t[69]!==Pe||t[70]!==Fe?(Ie={projects:Me,assistant:Ne,scheduled:Pe,settings:Fe},t[67]=Me,t[68]=Ne,t[69]=Pe,t[70]=Fe,t[71]=Ie):Ie=t[71];let Le=Ie,Re=T.secondary?.kind??null,ze;bb0:{if(!Re){ze=null;break bb0}let e;t[72]!==Y||t[73]!==j||t[74]!==y?(e=e=>({key:`assistant-secondary`,depth:1,ariaLabel:y(`assistants.title`),onBack:Y,content:(0,$.jsx)(tc,{activeOverride:e,onMobileBack:lc,onMobileOpenSettings:j})}),t[72]=Y,t[73]=j,t[74]=y,t[75]=e):e=t[75];let n=e;if(Re===`assistant`){let e=T.secondary?.kind===`assistant`?T.secondary.settingsAssistantID:void 0,r=!e,i;t[76]!==n||t[77]!==r?(i=n(r),t[76]=n,t[77]=r,t[78]=i):i=t[78];let a;t[79]!==Y||t[80]!==e||t[81]!==y?(a=e?[{key:`assistant-settings:${e}`,depth:2,ariaLabel:y(`assistants.conversation.openSettings`),onBack:Y,content:(0,$.jsx)(rc,{assistantID:e,onBack:cc})}]:[],t[79]=Y,t[80]=e,t[81]=y,t[82]=a):a=t[82];let o;t[83]!==i||t[84]!==a?(o=[i,...a],t[83]=i,t[84]=a,t[85]=o):o=t[85],ze=o;break bb0}if(Re===`instances`){let e;t[86]===y?e=t[87]:(e=y(`mobile.settings.switchInstance`),t[86]=y,t[87]=e);let n;t[88]!==Y||t[89]!==u||t[90]!==e?(n=[{key:`instances-secondary`,depth:1,ariaLabel:e,onBack:Y,content:u}],t[88]=Y,t[89]=u,t[90]=e,t[91]=n):n=t[91],ze=n;break bb0}if(T.secondary?.kind===`draft`){let e;t[92]===y?e=t[93]:(e=y(`mobile.nav.secondaryPageAria`),t[92]=y,t[93]=e);let n=Se?``:xe??``,r=Se?null:we,i;t[94]!==m||t[95]!==n||t[96]!==r?(i=m({sessionId:n,directory:r,viewKey:`chat-primary`,active:!0}),t[94]=m,t[95]=n,t[96]=r,t[97]=i):i=t[97];let a;t[98]!==Y||t[99]!==e||t[100]!==i?(a=[{key:`chat-primary`,depth:1,ariaLabel:e,onBack:Y,content:i}],t[98]=Y,t[99]=e,t[100]=i,t[101]=a):a=t[101],ze=a;break bb0}if(T.secondary?.kind!==`chat`){let e;t[102]===Symbol.for(`react.memo_cache_sentinel`)?(e=[],t[102]=e):e=t[102],ze=e;break bb0}let r=T.secondary.routes,i;if(t[103]!==n||t[104]!==Y||t[105]!==T.secondary.btw||t[106]!==T.secondary.returnTo||t[107]!==m||t[108]!==r||t[109]!==y){let e=T.secondary.returnTo?[n(!1)]:[],a=T.secondary.btw,o=r.slice(a?-1:-2),s=r.length-o.length+1+e.length,c=o.map((e,t)=>{let n=!a&&t===o.length-1;return{key:e.key,depth:s+t,ariaLabel:y(`mobile.nav.secondaryPageAria`),onBack:Y,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:Y,content:(0,$.jsx)(ic,{route:a})}]:[...e,...c],t[103]=n,t[104]=Y,t[105]=T.secondary.btw,t[106]=T.secondary.returnTo,t[107]=m,t[108]=r,t[109]=y,t[110]=i}else i=t[110];ze=i}let Be=ze,Ve;t[111]===Be?Ve=t[112]:(Ve=Be??[],t[111]=Be,t[112]=Ve);let He=pe||w||_,Ue;return t[113]!==g||t[114]!==b||t[115]!==T||t[116]!==V||t[117]!==Ve||t[118]!==He||t[119]!==Le?(Ue=(0,$.jsx)(Vs,{homeView:b,className:g,navigation:T,onTabChange:V,tabs:Le,secondaryPages:Ve,tabBarCovered:He}),t[113]=g,t[114]=b,t[115]=T,t[116]=V,t[117]=Ve,t[118]=He,t[119]=Le,t[120]=Ue):Ue=t[120],Ue}function cc(){Vt.requestAnimatedBack(`root`)}function lc(){return Vt.requestAnimatedBack(`root`)}function uc(e){return e.remoteSession}function dc(e){return e.currentSessionId}function fc(){return pc}function pc(){return Xt(Zt)}function mc(){return Re()}function hc(e){return e.popBtw}function gc(e){return e.replaceChatSession}function _c(e){return e.materializeDraftSession}function vc(e){return e.reconcileChatPredecessor}function yc(e){return e.popChatSession}function bc(e){return e.closeSecondary}function xc(e){return e.popAssistantSettings}function Sc(e){return e.pushAssistantSettings}function Cc(e){return e.openAssistant}function wc(e){return e.openDraft}function Tc(e){return e.openSession}function Ec(e){return e.setActiveTab}function Dc(e){return e.isCommandPaletteOpen}function Oc(){return Dr(O().getItem(oc))}function kc(e){let t=(0,Q.c)(7),n=e===void 0?2500:e,{uiFont:r}=cr(),[i,a]=Z.useState(!1),o,s;t[0]===i?(o=t[1],s=t[2]):(o=()=>{if(!i)return;let e=document.getElementById(`initial-loading`);if(!e)return;e.classList.add(`fade-out`);let t=window.setTimeout(()=>e.remove(),300);return()=>window.clearTimeout(t)},s=[i],t[0]=i,t[1]=o,t[2]=s),Z.useEffect(o,s);let c,l;return t[3]!==n||t[4]!==r?(c=()=>{let e=!1,t=()=>{e||a(!0)},i=()=>{requestAnimationFrame(()=>requestAnimationFrame(t))},o=Promise.all([Dn(r).catch(Pc),document.fonts?.ready?.then(Nc).catch(Mc)??Promise.resolve(),Ji.catch(jc)]).then(Ac),s=new Promise(e=>{window.setTimeout(e,n)});return Promise.race([o,s]).then(i),()=>{e=!0}},l=[r,n],t[3]=n,t[4]=r,t[5]=c,t[6]=l):(c=t[5],l=t[6]),Z.useEffect(c,l),i}function Ac(){}function jc(){}function Mc(){}function Nc(){}function Pc(){}var Fc=e=>e.replace(/^\/+|\/+$/g,``),Ic=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},Lc=e=>{let t=Fc(e.pathname).split(`/`).filter(Boolean);return e.host?[e.host,...t]:t};function Rc(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=Lc(t),r=(n[0]??``).toLowerCase(),i=n.slice(1),a=t.searchParams;switch(r){case`connect`:{let t=Ei(e);return t?{type:`connect`,pairing:t}:null}case`session`:{let e=i[0]||a.get(`id`)||``;return e?{type:`session`,sessionId:e,directory:Ic(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:Ic(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=Ic(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 zc={},Bc=null,Vc=!1,Hc=null,Uc=e=>{switch(e.type){case`connect`:return Bc?(Bc(e.pairing),!0):!1;case`session`:return _()?(je.getState().setCurrentSession(e.sessionId,e.directory??null),!0):(G.getState().openSession({sessionId:e.sessionId,directory:e.directory??null}),!0);case`assistant`:if(!_()){let t=G.getState();return t.setActiveTab(`assistant`),t.openAssistant(e.assistantId),!0}return ot(e.assistantId),!0;case`new-session`:return _()?(je.getState().openNewSessionDraft({directoryOverride:e.directory??null,selectedProjectId:e.projectId??null,preserveDirectoryOverride:!!e.directory,ensureProjectForDirectory:!!e.directory,initialPrompt:e.prompt}),!0):(G.getState().openDraft({directoryOverride:e.directory??null,selectedProjectId:e.projectId??null,preserveDirectoryOverride:!!e.directory,ensureProjectForDirectory:!!e.directory,initialPrompt:e.prompt}),!0);case`open-project`:return _()?(je.getState().openNewSessionDraft({directoryOverride:e.directory,preserveDirectoryOverride:!0}),!0):(G.getState().openDraft({directoryOverride:e.directory,preserveDirectoryOverride:!0}),!0);case`sessions`:return zc.openSessions?(zc.openSessions(e.filter),!0):!1;case`status`:return zc.openSessions?(zc.openSessions(),!0):(te.getState().setMobileSessionPanelOpen(!0),!0);case`view`:return zc.openView?(zc.openView(e.target),!0):!1;case`changes`:return zc.openChanges?(zc.openChanges({path:e.path,staged:e.staged}),!0):!1;case`settings`:return zc.openSettings?(zc.openSettings(e.section),!0):!1}return!1},Wc=()=>{if(!Hc||!Vc&&Hc.type!==`connect`)return;let e=Hc;Hc=null,Uc(e)||(Hc=e)},Gc=e=>{Hc=e,Wc()},Kc=e=>{let t=Rc(e);t&&Gc(t)},qc=e=>{Vc=e,Wc()},Jc=e=>{let t=(0,Q.c)(3),n,r;t[0]===e?(n=t[1],r=t[2]):(n=()=>(zc=e,Wc(),()=>{zc===e&&(zc={})}),r=[e],t[0]=e,t[1]=n,t[2]=r),Z.useEffect(n,r)},Yc=e=>{let t=(0,Q.c)(3),n,r;t[0]===e?(n=t[1],r=t[2]):(n=()=>(Bc=e,Wc(),()=>{Bc===e&&(Bc=null)}),r=[e],t[0]=e,t[1]=n,t[2]=r),Z.useEffect(n,r)},Xc=e=>{let{ready:t}=e,[n,r]=Z.useState(()=>g()?`pending`:`none`);return Z.useEffect(()=>{qc(t)},[t]),Z.useEffect(()=>{if(!g())return;let e=!1,t=[];return B(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=>{Kc(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=Rc(a?.url);r(o?.type===`connect`?`connect`:o?`other`:`none`),o&&Gc(o)}).catch(()=>{e||r(`none`)}),B(async()=>{let{PushNotifications:e}=await import(`./vendor-capacitor-push-notifications-D5cqJIPw.js`).then(e=>e.t);return{PushNotifications:e}},__vite__mapDeps([200,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){Kc(n);return}let r=typeof t?.assistantID==`string`?t.assistantID.trim():``;if(r){Gc({type:`assistant`,assistantId:r});return}let i=typeof t?.sessionId==`string`?t.sessionId:void 0;i&&Gc({type:`session`,sessionId:i})});if(e){r.remove();return}t.push(()=>void r.remove())}).catch(()=>void 0),()=>{e=!0,t.forEach(e=>e())}},[]),n},Zc=.85,Qc=8,$c=.35,el=.22,tl=e=>({segmentStart:e,lastTouch:e,open:!1}),nl=e=>e*$c,rl=e=>e*el,il=(e,t)=>Math.max(0,e-t),al=(e,t)=>Math.max(0,t-e),ol=(e,t)=>{let n=Math.abs(e);return n<Qc||Math.abs(t)<=n*Zc},sl=(e,t,n)=>{let r=t.clientX-e.segmentStart.clientX,i=t.clientY-e.segmentStart.clientY,a=il(e.segmentStart.clientX,t.clientX),o=nl(n),s=rl(n),c=e.open;return c=a<=0?!1:e.open?a>=s:a>=o&&ol(r,i),{segmentStart:e.segmentStart,lastTouch:t,open:c}},cl=e=>{if(e.disabled||e.startedOnExcludedTarget)return{open:!1,back:!1};let t=e.endX-e.startX,n=e.endY-e.startY,r=il(e.startX,e.endX),i=al(e.startX,e.endX),a=nl(e.viewportWidth),o=ol(t,n);return{open:r>=a&&o,back:i>=a&&o}},ll=(e,t,n)=>Math.min(il(e,t)/Math.max(1,nl(n)),1),ul=(e,t,n)=>Math.min(al(e,t)/Math.max(1,nl(n)),1),dl=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},fl=e=>{let t=document.elementFromPoint(e.clientX,e.clientY);return!!t?.closest(`.yuri-mobile-composer`)||dl(t)},pl=1,ml=(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===pl?n:n.parentElement;return!!(r&&t.contains(r))},hl=e=>ml(window.getSelection(),e),gl=(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=nl(g),n=Be({thresholdReached:p,distance:e,enterDistance:t,cancelDistance:rl(g),available:!0});p=n.thresholdReached,n.event===`enter`&&(m=Ge(`medium`,{bypassCadence:!0})),n.event===`cancel`&&(Ge(`light`,{bypassCadence:!0}),m=!1)},y=e=>{o.current?.(null),p&&!e&&Ge(`light`,{bypassCadence:!0}),p=!1,m=!1,e?r.current():f&&a.current?.(),f=!1},b=e=>{c.current?.(null),p&&!e&&Ge(`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=fl(r)||hl(t),d=null,f=!1,p=!1,m=!1,h=0,_=tl(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];_=sl(_,r,g);let a=r.clientX-_.segmentStart.clientX,l=r.clientY-_.segmentStart.clientY;if(d===null){if(hl(t))return;let e=Math.abs(a);if(e<Qc||Math.abs(l)>e*Zc)return;if(a<0)d=`sessions`,f=!0,i.current?.();else if(s.current)d=`back`;else return}e.preventDefault(),h=d===`sessions`?il(_.segmentStart.clientX,r.clientX):al(_.segmentStart.clientX,r.clientX),v(h),d===`sessions`?o.current?.(ll(_.segmentStart.clientX,r.clientX,g)):c.current?.(ul(_.segmentStart.clientX,r.clientX,g))},C=e=>{if(!n||!_)return;if(n=!1,!d){_=null;return}let t=e.changedTouches[0];t&&(_=sl(_,t,g),h=d===`sessions`?il(_.segmentStart.clientX,t.clientX):al(_.segmentStart.clientX,t.clientX),v(h));let r=d===`sessions`?_.open:cl({startX:_.segmentStart.clientX,startY:_.segmentStart.clientY,endX:_.lastTouch.clientX,endY:_.lastTouch.clientY,viewportWidth:g,disabled:!1,startedOnExcludedTarget:!1}).back;_=null,e.preventDefault(),r&&!m&&Ge(`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])},_l=ee(`YuriNotifications`),vl=()=>z.getPlatform()===`android`&&z.isPluginAvailable(`YuriNotifications`);async function yl(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 tn()).find(e=>rn(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 bl(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 xl=()=>{if(vl()||typeof window>`u`)return!1;let e=window.Capacitor?.getPlatform?.();return e===`ios`||e===`android`},Sl=(e,t)=>{x()?.push?.registerApnsToken?.({token:e,platform:y(),locale:t})},Cl=e=>{let{enabled:t}=e,n=te(e=>e.nativeNotificationsEnabled),r=it(e=>e.locale),i=Z.useRef(null),a=Z.useRef(r);a.current=r,Z.useEffect(()=>{if(!t||!n||!xl())return;let e=!1,r=[];return B(async()=>{let{PushNotifications:e}=await import(`./vendor-capacitor-push-notifications-D5cqJIPw.js`).then(e=>e.t);return{PushNotifications:e}},__vite__mapDeps([200,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,Sl(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||!xl())return;let e=i.current;e&&Sl(e,r)},[t,n,r]),Z.useEffect(()=>{if(n)return;let e=i.current;e&&(i.current=null,x()?.push?.unregisterApnsToken?.({token:e}))},[n])},wl=`YuriLiveActivity`,Tl=5e3,El=3600,Dl=`live`,Ol=ee(wl),kl=e=>e.isCapacitor&&e.platform===`ios`&&e.pluginAvailable;function Al(){return typeof window>`u`?!1:kl({isCapacitor:g(),platform:y(),pluginAvailable:z.isPluginAvailable(wl)})}var jl=()=>Ol,Ml=new Set([`permission`,`input`,`retry`]),Nl=()=>({trackedSessionId:null,started:!1,startedAt:null,busySince:null,lastStatus:null,eventVersion:0,items:[]}),Pl=(e,t)=>Math.max(Math.floor(e),t+1),Fl=e=>e.failedEpoch===e.currentEpoch?e.previous:e.current,Il=e=>e.failedEpoch===e.currentEpoch&&e.retryCount<1,Ll=e=>e.hasSessionError?`error`:e.hasPendingPermissions?`permission`:e.hasPendingQuestions?`input`:e.statusType===`retry`?`retry`:e.statusType===`busy`?`working`:e.statusType===`idle`?`complete`:null,Rl=e=>{let t=e.trim();return t.length<=80?t:`${t.slice(0,79)}…`},zl=e=>typeof e.parentID==`string`&&e.parentID.length>0?e.parentID:null,Bl=e=>{if(e.runningIds.size===0)return[];let t=[];for(let n of e.sessions)!e.runningIds.has(n.id)||zl(n)||t.push({sessionId:n.id,title:Rl(n.title??``),statusType:e.statuses[n.id]?.type??`busy`});return t},Vl=e=>e!==`complete`&&e!==`error`,Hl=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`,Ul=e=>{if(e.length<=4)return e;let t=e.filter(e=>Vl(e.status)),n=e.filter(e=>!Vl(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)},Wl=(e,t,n,r)=>{if(n&&n.length>0)return n;let i=r?.[e];return i&&i.length>0?i:t},Gl=(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=Ll({statusType:e.statusType,hasPendingPermissions:e.hasPendingPermissions===!0,hasPendingQuestions:e.hasPendingQuestions===!0,hasSessionError:e.hasSessionError===!0})??`working`;o.push({sessionId:t.sessionId,title:Wl(t.sessionId,t.title,e.title,r),status:i,startedAt:t.startedAt,busySince:i===`working`?t.busySince??n:null})}else if(Vl(t.status))o.push({...t,title:Wl(t.sessionId,t.title,void 0,r),status:`complete`,endedAt:n,busySince:null});else{let e=Wl(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=Ll({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 Ul(o)},Kl=e=>e.map(e=>`${e.sessionId}\0${e.title}\0${e.status}\0${e.endedAt??``}`).join(`
4
4
  `),ql=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}),Jl=(e,t,n,r,i)=>{let a=e.filter(e=>Vl(e.status)),o=a[0]??e[0],s={sessionId:Dl,startedAt:o?.startedAt??r,status:t,eventVersion:n,updatedAt:r,title:o?.title,workingCount:a.length,items:ql(e)};return i?.endedAt!==void 0&&(s.endedAt=i.endedAt),i?.dismissalSeconds!==void 0&&(s.dismissalSeconds=i.dismissalSeconds),s},Yl=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},Xl=(e,t,n,r)=>{let i=e.trackedSessionId;if(!i||!e.started)return{state:Nl(),commands:[]};let a=Pl(t,e.eventVersion);return{state:Nl(),commands:[{type:`end`,payload:Yl({sessionId:i,startedAt:e.startedAt??t,status:n,eventVersion:a,updatedAt:t,endedAt:t,dismissalSeconds:r})}]}},Zl=(e,t,n,r,i)=>{let a=Pl(r,i);return{state:{trackedSessionId:e,started:!0,startedAt:n,busySince:null,lastStatus:t,eventVersion:a,items:[]},commands:[{type:`start`,payload:Yl({sessionId:e,startedAt:n,status:t,eventVersion:a,updatedAt:r})}]}},Ql=(e,t,n)=>{let r=Ll(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=Tl-(t.now-(i??t.now));if(r>0)return{state:{...e,trackedSessionId:n,busySince:i},commands:[{type:`wait`,delayMs:r}]}}else if(!r||!Ml.has(r))return{state:{...Nl(),trackedSessionId:n},commands:[]};return Zl(n,r,i??t.now,t.now,e.eventVersion)}if(r===`complete`)return Xl({...e,busySince:i},t.now,`complete`,900);if(r===`error`)return Xl({...e,busySince:i},t.now,`error`,El);if(!r||r===e.lastStatus)return{state:{...e,trackedSessionId:n,busySince:i},commands:[]};let a=Pl(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:Yl({sessionId:n,startedAt:e.startedAt??t.now,status:r,eventVersion:a,updatedAt:t.now})}]}},$l=(e,t,n)=>{let r=e.trackedSessionId;if(!r||!e.started)return{state:e,commands:[]};let i=Pl(n,e.eventVersion);return{state:{...e,busySince:null,lastStatus:t,eventVersion:i},commands:[{type:`update`,payload:Yl({sessionId:r,startedAt:e.startedAt??n,status:t,eventVersion:i,updatedAt:n})}]}},eu=(e,t,n)=>{let r=Gl(e.items,n,t.now,t.sessionTitles,t.rootSessionIds),i=r.filter(e=>Vl(e.status)),a=Hl(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=Pl(t.now,n.eventVersion),a=r.map(e=>Vl(e.status)?{...e,status:`stale`}:e);return{state:{...n,items:a,lastStatus:`stale`,eventVersion:i,busySince:null},commands:[{type:`update`,payload:Yl(Jl(a,`stale`,i,t.now))}]}}if(!e.started){if(i.length===0)return{state:Nl(),commands:[]};if(!i.some(e=>Ml.has(e.status))){let n=Tl-(t.now-(o??t.now));if(n>0)return{state:{...e,trackedSessionId:Dl,items:r,busySince:o},commands:[{type:`wait`,delayMs:n}]}}let n=o??t.now,s=r.map(e=>Vl(e.status)?{...e,startedAt:e.busySince??n}:e),c=Pl(t.now,e.eventVersion);return{state:{trackedSessionId:Dl,started:!0,startedAt:n,busySince:null,lastStatus:a,eventVersion:c,items:s},commands:[{type:`start`,payload:Yl(Jl(s,a,c,t.now))}]}}if(i.length===0){let n=r.some(e=>e.status===`error`)?`error`:`complete`,i=Pl(t.now,e.eventVersion);return{state:Nl(),commands:[{type:`end`,payload:Yl(Jl(r,n,i,t.now,{endedAt:t.now,dismissalSeconds:n===`error`?El:900}))}]}}if(Kl(e.items)===Kl(r)&&e.lastStatus===a)return{state:{...e,trackedSessionId:Dl,items:r,busySince:null},commands:[]};let s=Pl(t.now,e.eventVersion);return{state:{trackedSessionId:Dl,started:!0,startedAt:e.startedAt??o??t.now,busySince:null,lastStatus:a,eventVersion:s,items:r},commands:[{type:`update`,payload:Yl(Jl(r,a,s,t.now))}]}},tu=(e,t)=>{if(t.catalog)return eu(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:[]}:$l(n,`stale`,t.now)}let n=[],r=e;if(r.trackedSessionId&&r.trackedSessionId!==t.sessionId)if(r.started){let e=Xl(r,t.now,r.lastStatus??`complete`,0);n.push(...e.commands),r=e.state}else r=Nl();if(!t.sessionId){if(r.started){let e=Xl(r,t.now,`complete`,900);return{state:e.state,commands:[...n,...e.commands]}}return{state:Nl(),commands:n}}let i=Ql(r,t,t.sessionId);return{state:i.state,commands:[...n,...i.commands]}},nu=e=>e/1e3,ru=e=>{let t={sessionId:e.sessionId,title:e.title,status:e.status,startedAt:nu(e.startedAt)};return e.endedAt!==void 0&&(t.endedAt=nu(e.endedAt)),t},iu=e=>{let t={sessionId:e.sessionId,startedAt:nu(e.startedAt),status:e.status,eventVersion:e.eventVersion,updatedAt:nu(e.updatedAt)};return e.endedAt!==void 0&&(t.endedAt=nu(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(ru)),t},au=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},ou=(e,t,n)=>{if(!e||n.type===`wait`)return Promise.resolve();let r=iu(n.payload),i=au(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})},su=e=>e.getCurrentEpoch()===e.epoch?!e.getCurrentSessionId||e.getCurrentSessionId()===e.observation.sessionId:!1,cu=async e=>{let t=e.state;if(!su(e))return{state:t,delayMs:null,retry:!1,superseded:!0};let n=tu(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 su(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(!su(e)||(await ou(e.available,e.plugin,i),!su(e)))return{state:t,delayMs:null,retry:!1,superseded:!0};let s=r===a.length-1;o=i.type===`end`&&!s?Nl():n.state}return{state:n.state,delayMs:i,retry:!1,superseded:!1}}catch{if(!su(e))return{state:t,delayMs:null,retry:!1,superseded:!0};let r=Fl({failedEpoch:e.epoch,currentEpoch:e.getCurrentEpoch(),previous:o,current:n.state}),i=Il({failedEpoch:e.epoch,currentEpoch:e.getCurrentEpoch(),retryCount:e.retryCount});return{state:r,delayMs:i?250:null,retry:i,superseded:!1}}},lu=()=>({desired:null,registered:null}),uu=e=>{if(typeof e!=`string`)return null;let t=e.trim();return t.length>0?t:null},du=e=>{if(!e||typeof e!=`object`)return null;let t=e,n=uu(t.activityId),r=uu(t.sessionId),i=uu(t.token);return!n||!r||!i?null:{activityId:n,sessionId:r,token:i}},fu=(e,t)=>e.activityId===t.activityId&&e.token===t.token,pu=(e,t)=>{let n=e.registered?.runtimeIdentity===t?e.registered:null;return e.desired===null&&n===e.registered?e:{desired:null,registered:n}},mu=(e,t)=>{if(!t.connected)return[];if(e.desired&&t.enabled&&t.selectedSessionId&&e.desired.sessionId===t.selectedSessionId){let n=e.registered;return n&&fu(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}]:[]},hu=(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=pu(e,t.runtimeIdentity):e.registered&&e.registered.runtimeIdentity!==t.runtimeIdentity&&!e.desired&&(r={...e,registered:null});return{state:r,commands:mu(r,t)}},gu=async e=>{try{return await e}catch{return null}},_u=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 gu(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 gu(e.unregister({token:r.token}))}continue}if(n.runtimeIdentity!==e.getRuntimeIdentity()){t.registered?.runtimeIdentity===n.runtimeIdentity&&(t={...t,registered:null});continue}(await gu(e.unregister(n.payload)))?.ok===!0&&t.registered?.token===n.payload.token&&(t={...t,registered:null})}return t},vu=new Map,yu=[];function bu(){let e=Al(),t=de(e=>e.isConnected),n=xe({enabled:e}),r=Ue(t=>e?t.statusById:vu),i=ve(t=>e?t.activeSessions:yu),a=(0,Z.useMemo)(()=>e?Ie(n,r):new Set,[e,r,n]),o=(0,Z.useMemo)(()=>e?Bl({runningIds:a,statuses:n,sessions:i}):[],[e,n,a,i]),c=(0,Z.useMemo)(()=>{if(!e)return{};let t={};for(let e of i){let n=e.parentID;if(typeof n==`string`&&n.length>0)continue;let r=typeof e.title==`string`?e.title.trim():``;r&&(t[e.id]=r.length<=80?r:`${r.slice(0,79)}…`)}return t},[e,i]),u=(0,Z.useMemo)(()=>{if(!e)return new Set;let t=new Set;for(let e of i){let n=e.parentID;typeof n==`string`&&n.length>0||t.add(e.id)}return t},[e,i]),d=(0,Z.useMemo)(()=>[o.map(e=>`${e.sessionId}\0${e.title}\0${e.statusType??``}`).join(`
5
5
  `),Object.entries(c).map(([e,t])=>`${e}\0${t}`).join(`
6
6
  `)].join(`
7
7
  ---
8
- `),[o,c]),f=(0,Z.useRef)(Nl()),p=(0,Z.useRef)(lu()),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=R(()=>({sessionId:Dl,statusType:void 0,hasPendingPermissions:!1,hasPendingQuestions:!1,hasSessionError:!1,now:Date.now(),connected:t,catalog:o,sessionTitles:c,rootSessionIds:u})),b=R(n=>{_.current=_.current.then(async()=>{let r=hu(p.current,{selectedSessionId:Dl,runtimeIdentity:l(),connected:t,enabled:e},n);p.current=r.state,r.commands.length!==0&&(p.current=await _u({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:nu(e.startedAt)};return e.endedAt===void 0?t:{...t,endedAt:nu(e.endedAt)}})})??Promise.resolve(null),unregister:e=>x()?.push?.unregisterLiveActivityToken?.(e)??Promise.resolve(null)}))}).catch(()=>void 0)}),S=R(e=>{let t=du(e);t&&b({type:`pushToken`,...t,sessionId:Dl})});(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=jl(),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 cu({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:Dl,token:e.token,items:c.state.items.map(e=>{let t={sessionId:e.sessionId,title:e.title,status:e.status,startedAt:nu(e.startedAt)};return e.endedAt===void 0?t:{...t,endedAt:nu(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 xu(){let e=(0,Q.c)(49),t=te(Cu),{t:r,locale:i}=rt(),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(!vl())return;if(!t){_l.stop().catch(Su);return}let e=!1,r=t=>{e||(e=!0,X.error(t))},a=bl({plugin:_l,resolveConfig:()=>yl({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 Su(){console.warn(`[Native notifications] stop failed`)}function Cu(e){return e.nativeNotificationsEnabled}var wu=Kt(()=>B(()=>import(`./ChatView-DU_2-cfD.js`).then(e=>e.n).then(e=>({default:e.ChatView})),__vite__mapDeps([201,1,13,5,4,14,15,16,6,42,34,12,43,44,17,18,19,45,46,7,35,36,37,47,8,9,10,2,48,11,20,51,21,22,23,24,50,41,49,52,25,26,27,28,29,53,54,55,56,30,148,64,202,203,204,205,73,59,74,75,66,76,77,113,206,151,152,153,154,155,156,157,158,159,160,85,86,57,58,79,80,31,123,69,70,124,207,208,32,115,105,209,150,88,161,133,71,60,61,62,116,63,65,67,164,135,210,136,137,211,212,180,99,213,78,81,82,83,84,214,120,121,89,90,134,138,92,139,140,141,142,87,91,215,192,167,193,216,217,218,219,169,125,126,127,220,122,128,129,221,222,223,224,194,225,226,117,168,170,227,228,229]))),Tu=Kt(()=>B(()=>import(`./AssistantView-BR8hsjOv.js`).then(e=>({default:e.AssistantView})),__vite__mapDeps([3,1,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,2,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105]))),Eu=Kt(()=>B(()=>import(`./DiffView-BaqthIvq.js`).then(e=>e.n).then(e=>({default:e.DiffView})),__vite__mapDeps([230,1,4,5,34,12,6,42,13,14,15,16,43,44,17,18,19,45,46,7,35,36,37,47,8,9,10,2,48,11,20,151,152,153,154,155,156,157,158,159,160,21,22,23,24,50,41,49,51,52,25,26,27,28,29,53,54,55,56,30,57,58,79,59,80,31,124,207,74,148,208,32,115,105,231,104,149,81,209,232,150,88,202,203,64,204,205,62,60,61,225]))),Du=Kt(()=>B(()=>import(`./SettingsView-CLE6ra3s.js`).then(e=>({default:e.SettingsView})),__vite__mapDeps([144,1,5,4,34,12,13,14,15,145,146,16,6,41,17,18,19,42,43,44,45,46,7,35,36,37,47,8,9,10,2,48,11,20,49,147,51,21,22,23,24,50,52,25,26,27,28,29,53,54,55,56,30,57,58,69,70,124,74,148,32,115,105,104,149,81,150,151,152,153,154,155,156,157,158,159,160,161,133,75,71,162,163,116,63,64,65,66,164,33,39,165,166,112,113,128,121,117,79,59,80,167,168,169,125,126,127,142,170,171,172,98,99,173,174,175,176,177,118,178,179,180,109,108,181,182,120,89,90,140,183,184,119,122,123,129,185,73,76,77,114,68,72,38,97,130,131,186,187,188,189,190,191,192,193,194,195,196,197,198,199]))),Ou=Kt(()=>B(()=>import(`./MobileChangesSurface-CiqsGZsg.js`).then(e=>({default:e.MobileChangesSurface})),__vite__mapDeps([233,1,6,7,47,8,9,10,21,13,5,4,14,15,22,23,24,50,12,34,16,41,17,18,19,42,43,44,45,46,35,36,37,2,48,11,20,49,51,52,25,26,27,28,29,53,54,55,56,30,57,58,79,59,80,31,234,123,69,70,124,207,74,148,208,32,202,203,64,161,235,231,151,152,153,154,155,156,157,158,159,160,115,105,104,149,81,209,232,150,88,204,205,133,75,71]))),ku=Kt(()=>B(()=>import(`./MobileFilesSurface-DIVH9aPV.js`).then(e=>({default:e.MobileFilesSurface})),__vite__mapDeps([236,1,6,7,46,5,4,34,12,13,14,15,35,36,37,47,8,9,10,2,48,18,11,16,17,19,20,151,152,153,154,155,156,157,158,159,160,21,22,23,24,50,41,42,43,44,45,49,51,52,25,26,27,28,29,53,54,55,56,30,57,58,79,59,80,207,74,148,231,32,115,105,104,149,81,209,232,150,88,202,203,64,133,75,71,163,237,238,162,239,60,61,62,116,63,65,66,67,210,164,135,136,137,211]))),Au=Kt(()=>B(()=>import(`./MobileChatScreen-DDenVTX8.js`).then(e=>({default:e.MobileChatScreen})),__vite__mapDeps([240,1,6,7,36,35,37,4,5,34,12,46,13,14,15,47,8,9,10,2,48,18,21,22,23,50,16,41,17,19,42,43,44,45,11,20,49,51,52,25,26,27,28,29,53,54,55,56,30,39,24,213,124,241,205,128,121,171,172,142,242,243,148]))),ju=Kt(()=>B(()=>import(`./RemoteDesktopPanel-DBrEQwpr.js`).then(e=>({default:e.RemoteDesktopPanel})),__vite__mapDeps([244,1,5,4,34,12,6,41,13,14,15,16,17,18,19,42,43,44,45,46,7,35,36,37,47,8,9,10,2,48,11,20,49,21,22,23,24,25,26,27,28,29,223,133,50,51,52,53,54,55,56,30,75,71,116,137,226]))),Mu=Kt(()=>B(()=>import(`./ScheduledTasksDialog-BVh0yaZR.js`).then(e=>e.t).then(e=>({default:e.ScheduledTasksWorkspace})),__vite__mapDeps([245,1,13,5,4,14,15,6,7,35,36,37,34,12,8,9,10,11,16,17,18,19,20,2,21,22,23,24,50,41,42,43,44,45,46,47,48,49,51,52,25,26,27,28,29,53,54,55,56,30,57,58,79,59,80,69,70,115,105,104,81,133,75,71,116,33,73,74,66,76,77,39,212,214,85,86,211,82,83,84,192,92,117,32,168,98,99,97,177,109,102,119,120,121,122,123,124,125,126,127,128,129,185,246])));function Nu(e){let t=(0,Q.c)(2),n;return t[0]===e?n=t[1]:(n=(0,$.jsx)(br,{children:(0,$.jsx)(Z.Suspense,{fallback:null,children:(0,$.jsx)(Au,{...e})})}),t[0]=e,t[1]=n),n}function Pu(e){let t=(0,Q.c)(2),n;return t[0]===e?n=t[1]:(n=(0,$.jsx)(br,{children:(0,$.jsx)(Z.Suspense,{fallback:null,children:(0,$.jsx)(wu,{...e})})}),t[0]=e,t[1]=n),n}function Fu(e){let t=(0,Q.c)(2),n;return t[0]===e?n=t[1]:(n=(0,$.jsx)(br,{children:(0,$.jsx)(Z.Suspense,{fallback:null,children:(0,$.jsx)(Eu,{...e})})}),t[0]=e,t[1]=n),n}function Iu(e){let t=(0,Q.c)(2),n;return t[0]===e?n=t[1]:(n=(0,$.jsx)(br,{children:(0,$.jsx)(Z.Suspense,{fallback:null,children:(0,$.jsx)(ku,{...e})})}),t[0]=e,t[1]=n),n}function Lu(e){let t=(0,Q.c)(2),n;return t[0]===e?n=t[1]:(n=(0,$.jsx)(br,{children:(0,$.jsx)(Z.Suspense,{fallback:null,children:(0,$.jsx)(Ou,{...e})})}),t[0]=e,t[1]=n),n}function Ru(){let e=(0,Q.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(br,{children:(0,$.jsx)(go,{})}),e[0]=t):t=e[0],t}var zu=`mobile-direct-diff`,Bu=`mobile-turn-diff`,Vu=`mobile-direct-file`,Hu=`mobile-files`,Uu=`mobile-changes`,Wu=`mobile-mcp`,Gu=`mobile-settings`,Ku=`mobile-update`,qu=`mobile-overflow-menu`,Ju=320,Yu=380,Xu=280,Zu=560,Qu=380,$u=e=>Math.min(Zu,Math.max(Xu,Math.round(e))),ed=(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 td(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(Zu,Math.max(Xu,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=R(m),g;r[5]===e?g=r[6]:(g=t=>{if(p.current!==t.pointerId)return;let n=t.clientX-u.current,r=$u(d.current+(e===`left`?n:-n));f.current!==r&&(f.current=r,ed(i,r))},r[5]=e,r[6]=g);let _=R(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=$u(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=R(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 nd=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=U(`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=U(`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},rd=()=>typeof window>`u`?!1:window.Capacitor?.isNativePlatform?.()===!0||window.location.protocol===`capacitor:`,id=()=>{Z.useEffect(()=>{if(!rd())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 B(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([247,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 B(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&&qo(e)&&e.blur()}});if(e){c.remove();return}t.push(()=>void c.remove())}).catch(()=>void 0),B(async()=>{let{Keyboard:e}=await import(`./vendor-capacitor-keyboard-BRVcFyc9.js`).then(e=>e.t);return{Keyboard:e}},__vite__mapDeps([248,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&&Ko(n.classList.contains(`yuri-native-ios-composer`),e))&&(y(e)?qo(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),Vo.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=qo(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(Uo()),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`),Vo.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()||Ko(n.classList.contains(`yuri-native-ios-composer`),document.activeElement)||e.detail?.open!==!0||d||y(document.activeElement)&&!qo(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()||Ko(n.classList.contains(`yuri-native-ios-composer`),document.activeElement))return;h(),u=e.keyboardHeight,k(u);let t=qo(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(),qo(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(Jo(e.relatedTarget)){m(`--yuri-kb-scroll-inset`,0);return}window.setTimeout(()=>{if(p&&!qo(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`)}},[])},ad=e=>{let t=Z.useRef(!1);Z.useEffect(()=>{if(!rd())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)),B(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])},od=e=>{Z.useEffect(()=>{if(!rd())return;let t=!1,n=null;return B(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])},sd=e=>(e||``).replace(/\\/g,`/`).replace(/\/+$/g,``),cd={autoComplete:`off`,autoCorrect:`off`,spellCheck:!1},ld=1e3,ud=e=>{let t=sd(e);if(!t)return``;let n=t.split(`/`).filter(Boolean);return n[n.length-1]||t},dd=(e,t)=>ud(e?e.path:t),fd=({connection:e,onActiveConnectionDeleted:t,onConnect:n})=>{let{t:r}=rt(),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(()=>ro(),[]),[F,I]=Z.useState(null),[L,ee]=Z.useState(null),z=R(()=>{D(!1),T(``),n()});Z.useEffect(()=>h(z),[z,h]);let B=R(()=>{v(null),C(``),ee(null),g(null),D(!1)}),te=R(()=>{o||M||(D(!1),g(null))}),ne=R(()=>{o||M||B()}),re=R(e=>{e.preventDefault(),!(!_||!S.trim())&&p(_,S).then(e=>{e&&B()})}),ie=R(e=>{i.redeemPairingConnection(e)}),ae=R(()=>{g(r(`mobile.connect.link.invalid`))}),oe=R(async()=>{if(!M){g(null),ee(null),N(!0);try{let e=await io();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)}}}),V=R(e=>{e.preventDefault(),d(A)}),se=R(()=>{j(``),f()}),G=R(e=>{x(t=>t===e?null:e)}),ce=R(e=>{x(null),_===e&&B();let n=a.length===1;m(e).then(e=>{e&&(n||Qt(e))&&t()})});if(l)return l.reason===`pairing`?(0,$.jsx)(`div`,{className:`yuri-settings-page-content`,children:(0,$.jsx)(Ti,{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)(W,{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)(H,{variant:`ghost`,size:`icon`,disabled:o||M,"aria-label":r(`mobile.instances.deleteAria`,{label:l.label}),onClick:()=>{x(l.id),se()},children:(0,$.jsx)(W,{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)(H,{size:`lg`,disabled:o||M,onClick:()=>void oe(),children:[(0,$.jsx)(W,{name:`scan-2`,className:`size-5`}),r(`mobile.connect.scanQr`)]}):null,(0,$.jsx)(H,{variant:P?`ghost`:`default`,size:`lg`,disabled:o||M,onClick:()=>{se(),D(!0)},children:r(`mobile.connect.link.useLink`)})]})})}):(0,$.jsx)(`div`,{className:`yuri-settings-page-content`,children:(0,$.jsx)(Ti,{label:r(`mobile.connect.password.label`),itemId:`instances.manage`,children:(0,$.jsxs)(`form`,{className:`yuri-settings-group-row flex flex-col gap-3`,onSubmit:V,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)(W,{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`)?nn(l):r(`mobile.connect.relay.badge`)})]})]}),(0,$.jsx)(`input`,{...cd,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)(H,{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)(H,{type:`button`,variant:`ghost`,size:`sm`,className:`w-full`,onClick:se,children:r(`mobile.connect.cancelPassword`)})]})})});let le=(0,$.jsxs)(`form`,{className:`flex flex-col gap-3`,onSubmit:re,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)(Gt,{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)(H,{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)(Ti,{label:r(`mobile.connect.saved.title`),itemId:`instances.manage`,children:a.length>0?a.map(e=>{let t=b===e.id,n=Qt(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:U(`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),ee(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)(W,{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:U(`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:()=>ce(e.id),style:{touchAction:`manipulation`},children:[(0,$.jsx)(W,{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)(W,{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),ee(null),g(null)},style:{touchAction:`manipulation`},children:(0,$.jsx)(W,{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:()=>G(e.id),style:{touchAction:`manipulation`},children:(0,$.jsx)(W,{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)(Ti,{label:r(`mobile.instances.addTitle`),children:(0,$.jsxs)(`div`,{className:`yuri-settings-group-row flex flex-col gap-3`,children:[P?(0,$.jsxs)(H,{type:`button`,size:`lg`,className:`w-full`,onClick:()=>void oe(),disabled:o||M,children:[(0,$.jsx)(W,{name:`scan-2`,className:U(`size-[18px]`,M&&`animate-pulse`)}),r(`mobile.connect.scanQr`)]}):null,(0,$.jsx)(H,{type:`button`,variant:P?`ghost`:`default`,size:`lg`,className:`w-full`,disabled:o||M,onClick:()=>{ee(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)(dt,{id:`mobile-instance-edit-${k}`,open:y!==null,onOpenChange:e=>{e||ne()},fitContent:!0,ariaLabel:r(`mobile.instances.editTitle`),closeAriaLabel:r(`mobile.surface.closeAria`),resizeAriaLabel:r(`mobile.connect.options.resize`),children:(0,$.jsx)(ct,{className:`px-5 pb-5 pt-1`,disableHorizontal:!0,fillContainer:!1,children:le})}),(0,$.jsx)(dt,{id:`mobile-instance-add-${O}`,open:E,onOpenChange:e=>{e||te()},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)(ct,{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)(oo,{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:ie,onInvalid:ae})]})})})]})},pd=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`},md=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)(W,{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},hd=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}=rt(),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-Qu-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=U(`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(${Qu}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)(md,{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)(md,{iconNode:(0,$.jsx)(Ii,{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:U(`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 te;t[38]!==l||t[39]!==u||t[40]!==c||t[41]!==s?(te=(0,$.jsx)(gd,{groups:s,displayMode:c,isLoading:l,timeFormatPreference:u}),t[38]=l,t[39]=u,t[40]=c,t[41]=s,t[42]=te):te=t[42];let ne;t[43]!==z||t[44]!==B||t[45]!==te?(ne=(0,$.jsxs)(`div`,{className:`space-y-1`,children:[z,B,te]}),t[43]=z,t[44]=B,t[45]=te,t[46]=ne):ne=t[46];let re;t[47]!==M||t[48]!==F||t[49]!==R||t[50]!==ne?(re=(0,$.jsx)(`div`,{ref:f,role:`dialog`,"aria-label":M,className:F,style:R,children:ne}),t[47]=M,t[48]=F,t[49]=R,t[50]=ne,t[51]=re):re=t[51];let ie;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(ie=(0,$.jsx)(`style`,{children:`
8
+ `),[o,c]),f=(0,Z.useRef)(Nl()),p=(0,Z.useRef)(lu()),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=R(()=>({sessionId:Dl,statusType:void 0,hasPendingPermissions:!1,hasPendingQuestions:!1,hasSessionError:!1,now:Date.now(),connected:t,catalog:o,sessionTitles:c,rootSessionIds:u})),b=R(n=>{_.current=_.current.then(async()=>{let r=hu(p.current,{selectedSessionId:Dl,runtimeIdentity:l(),connected:t,enabled:e},n);p.current=r.state,r.commands.length!==0&&(p.current=await _u({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:nu(e.startedAt)};return e.endedAt===void 0?t:{...t,endedAt:nu(e.endedAt)}})})??Promise.resolve(null),unregister:e=>x()?.push?.unregisterLiveActivityToken?.(e)??Promise.resolve(null)}))}).catch(()=>void 0)}),S=R(e=>{let t=du(e);t&&b({type:`pushToken`,...t,sessionId:Dl})});(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=jl(),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 cu({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:Dl,token:e.token,items:c.state.items.map(e=>{let t={sessionId:e.sessionId,title:e.title,status:e.status,startedAt:nu(e.startedAt)};return e.endedAt===void 0?t:{...t,endedAt:nu(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 xu(){let e=(0,Q.c)(49),t=te(Cu),{t:r,locale:i}=rt(),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(!vl())return;if(!t){_l.stop().catch(Su);return}let e=!1,r=t=>{e||(e=!0,X.error(t))},a=bl({plugin:_l,resolveConfig:()=>yl({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 Su(){console.warn(`[Native notifications] stop failed`)}function Cu(e){return e.nativeNotificationsEnabled}var wu=Kt(()=>B(()=>import(`./ChatView-ByMRjY1h.js`).then(e=>e.n).then(e=>({default:e.ChatView})),__vite__mapDeps([201,1,13,5,4,14,15,16,6,42,34,12,43,44,17,18,19,45,46,7,35,36,37,47,8,9,10,2,48,11,20,51,21,22,23,24,50,41,49,52,25,26,27,28,29,53,54,55,56,30,148,64,202,203,204,205,73,59,74,75,66,76,77,113,206,151,152,153,154,155,156,157,158,159,160,85,86,57,58,79,80,31,123,69,70,124,207,208,32,115,105,209,150,88,161,133,71,60,61,62,116,63,65,67,164,135,210,136,137,211,212,180,99,213,78,81,82,83,84,214,120,121,89,90,134,138,92,139,140,141,142,87,91,215,192,167,193,216,217,218,219,169,125,126,127,220,122,128,129,221,222,223,224,194,225,226,117,168,170,227,228,229]))),Tu=Kt(()=>B(()=>import(`./AssistantView-8fyAae7J.js`).then(e=>({default:e.AssistantView})),__vite__mapDeps([3,1,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,2,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105]))),Eu=Kt(()=>B(()=>import(`./DiffView-Bbit6OZ8.js`).then(e=>e.n).then(e=>({default:e.DiffView})),__vite__mapDeps([230,1,4,5,34,12,6,42,13,14,15,16,43,44,17,18,19,45,46,7,35,36,37,47,8,9,10,2,48,11,20,151,152,153,154,155,156,157,158,159,160,21,22,23,24,50,41,49,51,52,25,26,27,28,29,53,54,55,56,30,57,58,79,59,80,31,124,207,74,148,208,32,115,105,231,104,149,81,209,232,150,88,202,203,64,204,205,62,60,61,225]))),Du=Kt(()=>B(()=>import(`./SettingsView-DEU94-h1.js`).then(e=>({default:e.SettingsView})),__vite__mapDeps([144,1,5,4,34,12,13,14,15,145,146,16,6,41,17,18,19,42,43,44,45,46,7,35,36,37,47,8,9,10,2,48,11,20,49,147,51,21,22,23,24,50,52,25,26,27,28,29,53,54,55,56,30,57,58,69,70,124,74,148,32,115,105,104,149,81,150,151,152,153,154,155,156,157,158,159,160,161,133,75,71,162,163,116,63,64,65,66,164,33,39,165,166,112,113,128,121,117,79,59,80,167,168,169,125,126,127,142,170,171,172,98,99,173,174,175,176,177,118,178,179,180,109,108,181,182,120,89,90,140,183,184,119,122,123,129,185,73,76,77,114,68,72,38,97,130,131,186,187,188,189,190,191,192,193,194,195,196,197,198,199]))),Ou=Kt(()=>B(()=>import(`./MobileChangesSurface-DsYNmAuM.js`).then(e=>({default:e.MobileChangesSurface})),__vite__mapDeps([233,1,6,7,47,8,9,10,21,13,5,4,14,15,22,23,24,50,12,34,16,41,17,18,19,42,43,44,45,46,35,36,37,2,48,11,20,49,51,52,25,26,27,28,29,53,54,55,56,30,57,58,79,59,80,31,234,123,69,70,124,207,74,148,208,32,202,203,64,161,235,231,151,152,153,154,155,156,157,158,159,160,115,105,104,149,81,209,232,150,88,204,205,133,75,71]))),ku=Kt(()=>B(()=>import(`./MobileFilesSurface-CF3EW_SK.js`).then(e=>({default:e.MobileFilesSurface})),__vite__mapDeps([236,1,6,7,46,5,4,34,12,13,14,15,35,36,37,47,8,9,10,2,48,18,11,16,17,19,20,151,152,153,154,155,156,157,158,159,160,21,22,23,24,50,41,42,43,44,45,49,51,52,25,26,27,28,29,53,54,55,56,30,57,58,79,59,80,207,74,148,231,32,115,105,104,149,81,209,232,150,88,202,203,64,133,75,71,163,237,238,162,239,60,61,62,116,63,65,66,67,210,164,135,136,137,211]))),Au=Kt(()=>B(()=>import(`./MobileChatScreen-p356_BCN.js`).then(e=>({default:e.MobileChatScreen})),__vite__mapDeps([240,1,6,7,36,35,37,4,5,34,12,46,13,14,15,47,8,9,10,2,48,18,21,22,23,50,16,41,17,19,42,43,44,45,11,20,49,51,52,25,26,27,28,29,53,54,55,56,30,39,24,213,124,241,205,128,121,171,172,142,242,243,148]))),ju=Kt(()=>B(()=>import(`./RemoteDesktopPanel-f3vRj4ZP.js`).then(e=>({default:e.RemoteDesktopPanel})),__vite__mapDeps([244,1,5,4,34,12,6,41,13,14,15,16,17,18,19,42,43,44,45,46,7,35,36,37,47,8,9,10,2,48,11,20,49,21,22,23,24,25,26,27,28,29,223,133,50,51,52,53,54,55,56,30,75,71,116,137,226]))),Mu=Kt(()=>B(()=>import(`./ScheduledTasksDialog-D_hBP47Y.js`).then(e=>e.t).then(e=>({default:e.ScheduledTasksWorkspace})),__vite__mapDeps([245,1,13,5,4,14,15,6,7,35,36,37,34,12,8,9,10,11,16,17,18,19,20,2,21,22,23,24,50,41,42,43,44,45,46,47,48,49,51,52,25,26,27,28,29,53,54,55,56,30,57,58,79,59,80,69,70,115,105,104,81,133,75,71,116,33,73,74,66,76,77,39,212,214,85,86,211,82,83,84,192,92,117,32,168,98,99,97,177,109,102,119,120,121,122,123,124,125,126,127,128,129,185,246])));function Nu(e){let t=(0,Q.c)(2),n;return t[0]===e?n=t[1]:(n=(0,$.jsx)(br,{children:(0,$.jsx)(Z.Suspense,{fallback:null,children:(0,$.jsx)(Au,{...e})})}),t[0]=e,t[1]=n),n}function Pu(e){let t=(0,Q.c)(2),n;return t[0]===e?n=t[1]:(n=(0,$.jsx)(br,{children:(0,$.jsx)(Z.Suspense,{fallback:null,children:(0,$.jsx)(wu,{...e})})}),t[0]=e,t[1]=n),n}function Fu(e){let t=(0,Q.c)(2),n;return t[0]===e?n=t[1]:(n=(0,$.jsx)(br,{children:(0,$.jsx)(Z.Suspense,{fallback:null,children:(0,$.jsx)(Eu,{...e})})}),t[0]=e,t[1]=n),n}function Iu(e){let t=(0,Q.c)(2),n;return t[0]===e?n=t[1]:(n=(0,$.jsx)(br,{children:(0,$.jsx)(Z.Suspense,{fallback:null,children:(0,$.jsx)(ku,{...e})})}),t[0]=e,t[1]=n),n}function Lu(e){let t=(0,Q.c)(2),n;return t[0]===e?n=t[1]:(n=(0,$.jsx)(br,{children:(0,$.jsx)(Z.Suspense,{fallback:null,children:(0,$.jsx)(Ou,{...e})})}),t[0]=e,t[1]=n),n}function Ru(){let e=(0,Q.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(br,{children:(0,$.jsx)(go,{})}),e[0]=t):t=e[0],t}var zu=`mobile-direct-diff`,Bu=`mobile-turn-diff`,Vu=`mobile-direct-file`,Hu=`mobile-files`,Uu=`mobile-changes`,Wu=`mobile-mcp`,Gu=`mobile-settings`,Ku=`mobile-update`,qu=`mobile-overflow-menu`,Ju=320,Yu=380,Xu=280,Zu=560,Qu=380,$u=e=>Math.min(Zu,Math.max(Xu,Math.round(e))),ed=(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 td(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(Zu,Math.max(Xu,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=R(m),g;r[5]===e?g=r[6]:(g=t=>{if(p.current!==t.pointerId)return;let n=t.clientX-u.current,r=$u(d.current+(e===`left`?n:-n));f.current!==r&&(f.current=r,ed(i,r))},r[5]=e,r[6]=g);let _=R(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=$u(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=R(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 nd=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=U(`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=U(`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},rd=()=>typeof window>`u`?!1:window.Capacitor?.isNativePlatform?.()===!0||window.location.protocol===`capacitor:`,id=()=>{Z.useEffect(()=>{if(!rd())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 B(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([247,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 B(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&&qo(e)&&e.blur()}});if(e){c.remove();return}t.push(()=>void c.remove())}).catch(()=>void 0),B(async()=>{let{Keyboard:e}=await import(`./vendor-capacitor-keyboard-BRVcFyc9.js`).then(e=>e.t);return{Keyboard:e}},__vite__mapDeps([248,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&&Ko(n.classList.contains(`yuri-native-ios-composer`),e))&&(y(e)?qo(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),Vo.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=qo(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(Uo()),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`),Vo.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()||Ko(n.classList.contains(`yuri-native-ios-composer`),document.activeElement)||e.detail?.open!==!0||d||y(document.activeElement)&&!qo(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()||Ko(n.classList.contains(`yuri-native-ios-composer`),document.activeElement))return;h(),u=e.keyboardHeight,k(u);let t=qo(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(),qo(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(Jo(e.relatedTarget)){m(`--yuri-kb-scroll-inset`,0);return}window.setTimeout(()=>{if(p&&!qo(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`)}},[])},ad=e=>{let t=Z.useRef(!1);Z.useEffect(()=>{if(!rd())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)),B(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])},od=e=>{Z.useEffect(()=>{if(!rd())return;let t=!1,n=null;return B(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])},sd=e=>(e||``).replace(/\\/g,`/`).replace(/\/+$/g,``),cd={autoComplete:`off`,autoCorrect:`off`,spellCheck:!1},ld=1e3,ud=e=>{let t=sd(e);if(!t)return``;let n=t.split(`/`).filter(Boolean);return n[n.length-1]||t},dd=(e,t)=>ud(e?e.path:t),fd=({connection:e,onActiveConnectionDeleted:t,onConnect:n})=>{let{t:r}=rt(),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(()=>ro(),[]),[F,I]=Z.useState(null),[L,ee]=Z.useState(null),z=R(()=>{D(!1),T(``),n()});Z.useEffect(()=>h(z),[z,h]);let B=R(()=>{v(null),C(``),ee(null),g(null),D(!1)}),te=R(()=>{o||M||(D(!1),g(null))}),ne=R(()=>{o||M||B()}),re=R(e=>{e.preventDefault(),!(!_||!S.trim())&&p(_,S).then(e=>{e&&B()})}),ie=R(e=>{i.redeemPairingConnection(e)}),ae=R(()=>{g(r(`mobile.connect.link.invalid`))}),oe=R(async()=>{if(!M){g(null),ee(null),N(!0);try{let e=await io();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)}}}),V=R(e=>{e.preventDefault(),d(A)}),se=R(()=>{j(``),f()}),G=R(e=>{x(t=>t===e?null:e)}),ce=R(e=>{x(null),_===e&&B();let n=a.length===1;m(e).then(e=>{e&&(n||Qt(e))&&t()})});if(l)return l.reason===`pairing`?(0,$.jsx)(`div`,{className:`yuri-settings-page-content`,children:(0,$.jsx)(Ti,{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)(W,{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)(H,{variant:`ghost`,size:`icon`,disabled:o||M,"aria-label":r(`mobile.instances.deleteAria`,{label:l.label}),onClick:()=>{x(l.id),se()},children:(0,$.jsx)(W,{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)(H,{size:`lg`,disabled:o||M,onClick:()=>void oe(),children:[(0,$.jsx)(W,{name:`scan-2`,className:`size-5`}),r(`mobile.connect.scanQr`)]}):null,(0,$.jsx)(H,{variant:P?`ghost`:`default`,size:`lg`,disabled:o||M,onClick:()=>{se(),D(!0)},children:r(`mobile.connect.link.useLink`)})]})})}):(0,$.jsx)(`div`,{className:`yuri-settings-page-content`,children:(0,$.jsx)(Ti,{label:r(`mobile.connect.password.label`),itemId:`instances.manage`,children:(0,$.jsxs)(`form`,{className:`yuri-settings-group-row flex flex-col gap-3`,onSubmit:V,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)(W,{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`)?nn(l):r(`mobile.connect.relay.badge`)})]})]}),(0,$.jsx)(`input`,{...cd,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)(H,{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)(H,{type:`button`,variant:`ghost`,size:`sm`,className:`w-full`,onClick:se,children:r(`mobile.connect.cancelPassword`)})]})})});let le=(0,$.jsxs)(`form`,{className:`flex flex-col gap-3`,onSubmit:re,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)(Gt,{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)(H,{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)(Ti,{label:r(`mobile.connect.saved.title`),itemId:`instances.manage`,children:a.length>0?a.map(e=>{let t=b===e.id,n=Qt(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:U(`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),ee(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)(W,{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:U(`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:()=>ce(e.id),style:{touchAction:`manipulation`},children:[(0,$.jsx)(W,{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)(W,{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),ee(null),g(null)},style:{touchAction:`manipulation`},children:(0,$.jsx)(W,{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:()=>G(e.id),style:{touchAction:`manipulation`},children:(0,$.jsx)(W,{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)(Ti,{label:r(`mobile.instances.addTitle`),children:(0,$.jsxs)(`div`,{className:`yuri-settings-group-row flex flex-col gap-3`,children:[P?(0,$.jsxs)(H,{type:`button`,size:`lg`,className:`w-full`,onClick:()=>void oe(),disabled:o||M,children:[(0,$.jsx)(W,{name:`scan-2`,className:U(`size-[18px]`,M&&`animate-pulse`)}),r(`mobile.connect.scanQr`)]}):null,(0,$.jsx)(H,{type:`button`,variant:P?`ghost`:`default`,size:`lg`,className:`w-full`,disabled:o||M,onClick:()=>{ee(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)(dt,{id:`mobile-instance-edit-${k}`,open:y!==null,onOpenChange:e=>{e||ne()},fitContent:!0,ariaLabel:r(`mobile.instances.editTitle`),closeAriaLabel:r(`mobile.surface.closeAria`),resizeAriaLabel:r(`mobile.connect.options.resize`),children:(0,$.jsx)(ct,{className:`px-5 pb-5 pt-1`,disableHorizontal:!0,fillContainer:!1,children:le})}),(0,$.jsx)(dt,{id:`mobile-instance-add-${O}`,open:E,onOpenChange:e=>{e||te()},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)(ct,{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)(oo,{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:ie,onInvalid:ae})]})})})]})},pd=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`},md=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)(W,{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},hd=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}=rt(),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-Qu-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=U(`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(${Qu}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)(md,{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)(md,{iconNode:(0,$.jsx)(Ii,{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:U(`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 te;t[38]!==l||t[39]!==u||t[40]!==c||t[41]!==s?(te=(0,$.jsx)(gd,{groups:s,displayMode:c,isLoading:l,timeFormatPreference:u}),t[38]=l,t[39]=u,t[40]=c,t[41]=s,t[42]=te):te=t[42];let ne;t[43]!==z||t[44]!==B||t[45]!==te?(ne=(0,$.jsxs)(`div`,{className:`space-y-1`,children:[z,B,te]}),t[43]=z,t[44]=B,t[45]=te,t[46]=ne):ne=t[46];let re;t[47]!==M||t[48]!==F||t[49]!==R||t[50]!==ne?(re=(0,$.jsx)(`div`,{ref:f,role:`dialog`,"aria-label":M,className:F,style:R,children:ne}),t[47]=M,t[48]=F,t[49]=R,t[50]=ne,t[51]=re):re=t[51];let ie;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(ie=(0,$.jsx)(`style`,{children:`
9
9
  @keyframes session-metadata-in {
10
10
  from { opacity: 0; transform: translateY(-8px) scale(0.985); }
11
11
  to { opacity: 1; transform: translateY(0) scale(1); }