@yuriai/web 0.3.6-beta.14 → 0.3.6-beta.16
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.
- package/dist/assets/{AgentAvatar-5tMBB3OP.js → AgentAvatar-Cz7vWoUM.js} +1 -1
- package/dist/assets/{AgentSelector-Cb7GNCSr.js → AgentSelector-tguIbO8e.js} +1 -1
- package/dist/assets/{ArchivedSessionsDialog-8gBAWGWJ.js → ArchivedSessionsDialog-C0Vf38jt.js} +1 -1
- package/dist/assets/{AssistantConversationSurface-DBgTUUEt.js → AssistantConversationSurface-TNj9TKag.js} +3 -3
- package/dist/assets/{AssistantSessionCard-_yFsx4WB.js → AssistantSessionCard-BX_ck4KS.js} +2 -2
- package/dist/assets/{AssistantUnreadBadge-a2u_bBfi.js → AssistantUnreadBadge-DSjJfYrh.js} +1 -1
- package/dist/assets/{AssistantView-BxqHaArC.js → AssistantView-eAuI94K6.js} +1 -1
- package/dist/assets/{AssistantWorkingAvatar-DHZVN5kD.js → AssistantWorkingAvatar-OhfpjL1t.js} +1 -1
- package/dist/assets/{AssistantsSettingsPage-CCG2-SGj.js → AssistantsSettingsPage-X19bTIju.js} +1 -1
- package/dist/assets/{BinaryFileFallback-DyOwcZlP.js → BinaryFileFallback-DDWawtzt.js} +1 -1
- package/dist/assets/{BtwPanel-BhJA_qnp.js → BtwPanel-Dhn1iVrH.js} +2 -2
- package/dist/assets/BusyDots-q2aVrHbQ.js +4 -0
- package/dist/assets/{ChatContainer-vX0hPadC.js → ChatContainer-CYq3DRwu.js} +21 -21
- package/dist/assets/ChatView-CD7B735C.js +3 -0
- package/dist/assets/{DiagramView-XjJTNa7h.js → DiagramView-D8qMjsAQ.js} +1 -1
- package/dist/assets/{DiffView-B6_7v5dX.js → DiffView-BRUUP_UF.js} +1 -1
- package/dist/assets/{DiffViewToggle-as2OeoZV.js → DiffViewToggle-Bn4WLr8E.js} +1 -1
- package/dist/assets/{ErrorBoundary-6AeJc3yJ.js → ErrorBoundary-UqQdMytG.js} +1 -1
- package/dist/assets/{FadeInOnReveal-BKAakuxD.js → FadeInOnReveal-BV_4xYNR.js} +1 -1
- package/dist/assets/{GuiPluginMount-DlrUvFjg.js → GuiPluginMount-CEXVtLmV.js} +1 -1
- package/dist/assets/{GuiPluginPage-DsBH_Y2M.js → GuiPluginPage-BziZa4M0.js} +1 -1
- package/dist/assets/{GuiPluginSurface-BisC0s24.js → GuiPluginSurface-gxhtskj7.js} +1 -1
- package/dist/assets/{GuiPluginTitlebarItems-CraVxzKU.js → GuiPluginTitlebarItems-mIMh81nb.js} +1 -1
- package/dist/assets/{GuiPluginWindow-DjrDed9m.js → GuiPluginWindow-DvVG8u7w.js} +1 -1
- package/dist/assets/{Icon-zB0u-x9G.js → Icon-C6Duv_oe.js} +1 -1
- package/dist/assets/{ImageLoadingPlaceholder-COr72scf.js → ImageLoadingPlaceholder-BIQ6Y6SP.js} +1 -1
- package/dist/assets/{LoadingImage-DCyqFHPY.js → LoadingImage-Dk4wxhnT.js} +1 -1
- package/dist/assets/{MarkdownRenderer-YxMjOHQg.js → MarkdownRenderer-BY310t1T.js} +2 -2
- package/dist/assets/{MarkdownRendererImpl-FJ3saBi-.js → MarkdownRendererImpl-nAHoW0Z9.js} +3 -3
- package/dist/assets/{MarkstreamRendererImpl-69EMw8mz.js → MarkstreamRendererImpl-shwGZ7Tl.js} +1 -1
- package/dist/assets/{MobileAssistantSettingsPage-BoH-3iPc.js → MobileAssistantSettingsPage-DOJwDh_T.js} +1 -1
- package/dist/assets/{MobileAssistantTab-59nMj5dF.js → MobileAssistantTab-BAkvh3MP.js} +1 -1
- package/dist/assets/{MobileBtwPage-EwMOy6Vg.js → MobileBtwPage-BdPAeG7v.js} +1 -1
- package/dist/assets/{MobileChangesSurface-BfMWp6TX.js → MobileChangesSurface-DmlszV_t.js} +1 -1
- package/dist/assets/{MobileChatScreen-CZDiNi7M.js → MobileChatScreen-CEbQNMgn.js} +1 -1
- package/dist/assets/{MobileDetailNavigation-DKv1HfQX.js → MobileDetailNavigation-BUMzEYEL.js} +1 -1
- package/dist/assets/{MobileFilesSurface-BiK7LCem.js → MobileFilesSurface-DCQsIn2I.js} +2 -2
- package/dist/assets/{MobileHtmlNetworkBoundary-BXh_BJ93.js → MobileHtmlNetworkBoundary-DiuzUkq3.js} +2 -2
- package/dist/assets/{MobileOverlayPanel-Pr-vLaIF.js → MobileOverlayPanel-DhGG1USg.js} +1 -1
- package/dist/assets/{MobileResizableSheet-O2gv2sCB.js → MobileResizableSheet-BN5lO8_k.js} +1 -1
- package/dist/assets/{MobileSettingsTab-DadXop75.js → MobileSettingsTab-B4wkSo7K.js} +1 -1
- package/dist/assets/{MobileShareBridge-CaiscA4w.js → MobileShareBridge-DUHyEHab.js} +1 -1
- package/dist/assets/{MobileSurface-B_2aVFm1.js → MobileSurface-CuAPWI6D.js} +1 -1
- package/dist/assets/{MobileTabPageHeader-T0zUz7Wl.js → MobileTabPageHeader-Bh1ILbqr.js} +1 -1
- package/dist/assets/{ModelLogo-C1Vv7gz6.js → ModelLogo-R0TXf5Pt.js} +1 -1
- package/dist/assets/{ModelSelector-BP_s_VhY.js → ModelSelector-D5pSGqN8.js} +1 -1
- package/dist/assets/{MultiRunWindow--tNVFKUJ.js → MultiRunWindow-DJb6RpVw.js} +1 -1
- package/dist/assets/{OnboardingScreen-DMdy73Dq.js → OnboardingScreen-CdHEr54c.js} +1 -1
- package/dist/assets/{OverlayScrollbar-n5T49w2e.js → OverlayScrollbar-CrwDy2Pt.js} +1 -1
- package/dist/assets/{PierreDiffViewer-i3OsvUKm.js → PierreDiffViewer-BYO9Wbwk.js} +1 -1
- package/dist/assets/{ProviderLogo-D-ldwq0G.js → ProviderLogo-C8aB3qlM.js} +1 -1
- package/dist/assets/{RemoteAssistantSessionCard-CNpcgVmv.js → RemoteAssistantSessionCard-C_hCy6FE.js} +1 -1
- package/dist/assets/{RemoteDesktopPanel-hTuLKJZb.js → RemoteDesktopPanel-Cj6G6AyD.js} +1 -1
- package/dist/assets/ScheduledTasksDialog-z2v4fwrE.js +3 -0
- package/dist/assets/{ScrollableOverlay-DAMUOn67.js → ScrollableOverlay-BrA__-l0.js} +1 -1
- package/dist/assets/{SettingsGroup-CwMJmhq2.js → SettingsGroup-DMAcPhM4.js} +1 -1
- package/dist/assets/{SettingsView-bYWNjHtA.js → SettingsView-BuGjKeb9.js} +10 -10
- package/dist/assets/{SettingsWindow-D0ZzAXW0.js → SettingsWindow-_sonrUby.js} +1 -1
- package/dist/assets/{SetupTourDialog-CgM5YonA.js → SetupTourDialog-Cf1Jm1Gl.js} +1 -1
- package/dist/assets/{SyncActions-Ct2yZTbg.js → SyncActions-BWHWdbi_.js} +1 -1
- package/dist/assets/{TerminalView-BU5w40RA.js → TerminalView-DN60v7to.js} +3 -3
- package/dist/assets/{TextSelectionMenu-a7yyDz5R.js → TextSelectionMenu-YlWMOZkS.js} +2 -2
- package/dist/assets/{ToolOutputDialog-CGYnrXVV.js → ToolOutputDialog-B388thfl.js} +2 -2
- package/dist/assets/{YuriLogo-Cexwa29m.js → YuriLogo-CdbCjzA8.js} +1 -1
- package/dist/assets/{YuriWordmark-Bn5KdqMC.js → YuriWordmark-rISEHjrd.js} +1 -1
- package/dist/assets/{assistant-attachment-cache-Y7yhlQcv.js → assistant-attachment-cache-BsIYVOYw.js} +1 -1
- package/dist/assets/{assistantMessagePreview-BXNdMDW-.js → assistantMessagePreview-DJVWTOKl.js} +1 -1
- package/dist/assets/{assistantQueries-DkAmjFg7.js → assistantQueries-C_SpnqtF.js} +1 -1
- package/dist/assets/{auto-read-context-DLilPZMl.js → auto-read-context-BO5tE9k_.js} +1 -1
- package/dist/assets/{capgoAdapter-DaIrgBjp.js → capgoAdapter-qaeQqHpT.js} +1 -1
- package/dist/assets/{card-CXE0ffyH.js → card-t-tgqQ79.js} +1 -1
- package/dist/assets/{chatUpwardIntent-DRFjEP4t.js → chatUpwardIntent-BEntur0S.js} +1 -1
- package/dist/assets/{checkbox-hYuewn9u.js → checkbox-D-OIaMB8.js} +1 -1
- package/dist/assets/{client-QcYZg8_d.js → client-BuCd-T7s.js} +1 -1
- package/dist/assets/{collapsible-C4a0ndbm.js → collapsible-CCc6anWP.js} +1 -1
- package/dist/assets/{connection-hint-Ci6c4iij.js → connection-hint-DAQZ45pI.js} +1 -1
- package/dist/assets/{context-menu-D73tnkiI.js → context-menu-BhnOdTDq.js} +1 -1
- package/dist/assets/{desktopHosts-DFa3lf0i.js → desktopHosts-COI-czjF.js} +1 -1
- package/dist/assets/{desktopRelayRestore-CGq-Ylgq.js → desktopRelayRestore-BEPNc7qb.js} +1 -1
- package/dist/assets/device-TCHW5U2y.js +2 -0
- package/dist/assets/{diagram-B2X1oieg.js → diagram-sCh-Ausk.js} +1 -1
- package/dist/assets/{dialog-B2Po85oU.js → dialog-C9DNMP08.js} +1 -1
- package/dist/assets/{dropdown-menu-vW7wfT5z.js → dropdown-menu-CcQq6JDI.js} +1 -1
- package/dist/assets/{fileMentionTouchSelection-B73h0W0P.js → fileMentionTouchSelection-HhfJS8d1.js} +1 -1
- package/dist/assets/{fileReferenceActions-DEUhs_7h.js → fileReferenceActions-wN7mWY3w.js} +1 -1
- package/dist/assets/{gitApi-DG2Gj6gC.js → gitApi-BNkkLnOi.js} +1 -1
- package/dist/assets/{gitApiHttp-C8AU1uiY.js → gitApiHttp-CrPYe9Oc.js} +2 -2
- package/dist/assets/{githubAuthQueries-IJPWBo0B.js → githubAuthQueries-CTTiXZ9q.js} +1 -1
- package/dist/assets/{historyImportQueries-B3QBdaKo.js → historyImportQueries-B4DVAuxZ.js} +1 -1
- package/dist/assets/{host-DchPrZpw.js → host-BjnskVUP.js} +1 -1
- package/dist/assets/{i18n-WsU03nwB.js → i18n-CYty_Jft.js} +1 -1
- package/dist/assets/{icons-6sA6AOaU.js → icons-DlTcJ36Q.js} +1 -1
- package/dist/assets/{imageSource-B39pFDdo.js → imageSource-BquIRnWW.js} +1 -1
- package/dist/assets/{input-BpDiYSsP.js → input-DVzjAzTw.js} +1 -1
- package/dist/assets/{input-store-PqhVEhUI.js → input-store-BtvRZZcg.js} +1 -1
- package/dist/assets/insertionBoundaries-WYUnaIac.js +1 -0
- package/dist/assets/{kbd-Dd1lM8OM.js → kbd-DA0IyUcd.js} +1 -1
- package/dist/assets/main-BfuLSPdJ.js +169 -0
- package/dist/assets/{main-BtqqLSTt.js → main-BpAkYb0H.js} +2 -2
- package/dist/assets/{markdownHeightCache-BzWUzccz.js → markdownHeightCache-CcgRs1ER.js} +1 -1
- package/dist/assets/{mcpQueries-8frBxd65.js → mcpQueries-CCvxTdrj.js} +1 -1
- package/dist/assets/miniChat-D2l_XXQe.js +2 -0
- package/dist/assets/mobile-mVNRvGd5.js +2 -0
- package/dist/assets/{mobileBackNavigation-Ch0aK3t9.js → mobileBackNavigation-B8wJO_pZ.js} +1 -1
- package/dist/assets/{mobileConnections-Bay_JNn0.js → mobileConnections-Ckzqn3Y9.js} +2 -2
- package/dist/assets/{multirun-CQ2v1-nW.js → multirun-B34hqzTY.js} +1 -1
- package/dist/assets/{native-config-B8eHFnvv.js → native-config-CD8pMBkt.js} +1 -1
- package/dist/assets/{nativeComposerCover--wSR2Iru.js → nativeComposerCover-CEyD3731.js} +1 -1
- package/dist/assets/{navigation-33oih6q2.js → navigation-atykJu0I.js} +2 -2
- package/dist/assets/openRemoteProjectSession-B63pkBaj.js +1 -0
- package/dist/assets/openSessionFromDeepLink-Bz07xQfv.js +2 -0
- package/dist/assets/platform-B2ylz14u.js +1 -0
- package/dist/assets/{pluginPresentation-BqcbcLYL.js → pluginPresentation-4xMNGtKI.js} +2 -2
- package/dist/assets/{project-preview-CIkGbBPZ.js → project-preview-Dq--046z.js} +1 -1
- package/dist/assets/{projectActions-D84EVh3q.js → projectActions-B11KAI3f.js} +1 -1
- package/dist/assets/{prompt-attachment-upload-D1c308Ba.js → prompt-attachment-upload-m0vbcftI.js} +1 -1
- package/dist/assets/{pwa-JM_Ia4Qo.js → pwa-uLk3vYDP.js} +2 -2
- package/dist/assets/{queue-abort-optimistic-BspQeOrZ.js → queue-abort-optimistic-C_L5pmK0.js} +1 -1
- package/dist/assets/{quota-C7uYEfoX.js → quota-CNmk_bQD.js} +1 -1
- package/dist/assets/{reference-history-DuOv6xPy.js → reference-history-CN8H7cQY.js} +1 -1
- package/dist/assets/{remote-input-store-CquhCIoR.js → remote-input-store-CE88ZLsw.js} +1 -1
- package/dist/assets/{remoteProjectQueries-BunVM5PM.js → remoteProjectQueries-zO4jYbru.js} +1 -1
- package/dist/assets/{remoteSessionReference-brIKt6ea.js → remoteSessionReference-BvbDndSv.js} +1 -1
- package/dist/assets/{renderElectronMiniChatApp-1iiZ6q0N.js → renderElectronMiniChatApp-BImqnwc-.js} +2 -2
- package/dist/assets/renderMobileApp-DjKpQ6id.js +17 -0
- package/dist/assets/{runtime-file-download-wMVtKk2v.js → runtime-file-download-CzZ_VAoB.js} +1 -1
- package/dist/assets/{runtime-file-resource-DKJJoOOc.js → runtime-file-resource-9kLrAtnQ.js} +1 -1
- package/dist/assets/{runtimeConfig-qjNoqcXT.js → runtimeConfig-Cs95Hj1_.js} +1 -1
- package/dist/assets/runtimeEndpointReset-BeO-ZC0f.js +4 -0
- package/dist/assets/{scheduledTaskNavigation-DpfZSGu8.js → scheduledTaskNavigation-r3g3DfXq.js} +1 -1
- package/dist/assets/{select-Ojd202kE.js → select-Cb6W8KRB.js} +1 -1
- package/dist/assets/sessionLookup-MXum2sR5.js +1 -0
- package/dist/assets/{sessionOwnership-Nqb7MQgW.js → sessionOwnership-CgeZg9fN.js} +1 -1
- package/dist/assets/{shortcuts-BOzfBNF8.js → shortcuts-5iHGo1f3.js} +1 -1
- package/dist/assets/{sortable-tabs-strip-DlQjS9bw.js → sortable-tabs-strip-D5MuRWnZ.js} +1 -1
- package/dist/assets/{speechSettingsQueries-DzDLUBnb.js → speechSettingsQueries-D2CugjM1.js} +1 -1
- package/dist/assets/{switch-BN9zvb0m.js → switch-DLlbkkU5.js} +1 -1
- package/dist/assets/{terminalApi-D2ECmoAo.js → terminalApi-CsTh04jY.js} +1 -1
- package/dist/assets/{textarea-ChLN9tnA.js → textarea-Cg3Yz3Oc.js} +1 -1
- package/dist/assets/{timeFormat-D1hdmWbu.js → timeFormat-fIpRkrOb.js} +1 -1
- package/dist/assets/{tooltip-Cdsa-YWG.js → tooltip-Chqxbwjz.js} +1 -1
- package/dist/assets/{truncated-path-DjN9DJvh.js → truncated-path-DWUl2HQC.js} +1 -1
- package/dist/assets/{types-DHO20zYy.js → types-DfbaAnUB.js} +1 -1
- package/dist/assets/ui-lbbchWJP.js +13 -0
- package/dist/assets/useAppFontEffects-BDoatEWZ.js +7 -0
- package/dist/assets/{useAssistantUIStore-DEiMjSqf.js → useAssistantUIStore-BUWPTwNV.js} +1 -1
- package/dist/assets/{useDesktopWindowControlsLayout-OdYH5vsn.js → useDesktopWindowControlsLayout-C_VGQBG3.js} +1 -1
- package/dist/assets/{useDictation-DUR68U4T.js → useDictation-C81KyPa6.js} +1 -1
- package/dist/assets/{useEffectiveDirectory-DNVTRp-B.js → useEffectiveDirectory-Dqdl58J7.js} +1 -1
- package/dist/assets/{useFontPreferences-BY0TXvWI.js → useFontPreferences-DyMUXTQC.js} +1 -1
- package/dist/assets/{useGitStore-DsxzluvZ.js → useGitStore-kco1LBfw.js} +1 -1
- package/dist/assets/{useInlineCommentDraftStore-DU-yffqD.js → useInlineCommentDraftStore-DFr7FLv-.js} +1 -1
- package/dist/assets/useMcpConfigStore-C9SxNeU1.js +1 -0
- package/dist/assets/{useMobileSwipeActions-rPGl_HNn.js → useMobileSwipeActions-vvnhP5zs.js} +1 -1
- package/dist/assets/useMobileTranscriptSyncHint-DVm8zIWR.js +10 -0
- package/dist/assets/{useModelLists-xVEEc-e7.js → useModelLists-CU3ffp2-.js} +1 -1
- package/dist/assets/{useOpenCodeReadiness-C5D4297L.js → useOpenCodeReadiness-KpQk8Bm7.js} +1 -1
- package/dist/assets/{usePluginsStore-DEctn121.js → usePluginsStore-BJNtJkXv.js} +1 -1
- package/dist/assets/{useProjectGitActions-D7yZSor5.js → useProjectGitActions-DuzvQm-w.js} +1 -1
- package/dist/assets/{useProjectGitStore-DFz9Eb6v.js → useProjectGitStore-U9tDVHik.js} +1 -1
- package/dist/assets/{useProjectRuntimeAPIs-TALa4FqO.js → useProjectRuntimeAPIs-DJubGUM_.js} +1 -1
- package/dist/assets/{useQuotaStore-BqPJ1nzk.js → useQuotaStore-B4FEz0gR.js} +1 -1
- package/dist/assets/{useSessionBtwStore-DAQVlbuf.js → useSessionBtwStore-D5bVhQ1l.js} +1 -1
- package/dist/assets/{useStreamingTextThrottle-BpC1BNz_.js → useStreamingTextThrottle-DlgF3Cnn.js} +1 -1
- package/dist/assets/{useUIStore-P32bzAJc.js → useUIStore-68ZPpgYA.js} +1 -1
- package/dist/assets/{worktreeManager-D56glCi_.js → worktreeManager-BJCsjptu.js} +1 -1
- package/dist/assets/{worktreeSourceBranchPreference-CNtT0ymW.js → worktreeSourceBranchPreference-qDpG1uyC.js} +1 -1
- package/dist/index.html +15 -15
- package/dist/mini-chat.html +15 -15
- package/dist/mobile.html +1 -1
- package/package.json +1 -1
- package/server/index.js +1 -0
- package/server/lib/assistants/DOCUMENTATION.md +7 -3
- package/server/lib/assistants/builtin-skills.js +19 -3
- package/server/lib/assistants/builtin-skills.test.js +16 -0
- package/server/lib/assistants/harness.js +2 -1
- package/server/lib/assistants/routes.js +1 -0
- package/server/lib/assistants/service.js +6 -2
- package/server/lib/gui-customization/DOCUMENTATION.md +19 -7
- package/server/lib/gui-customization/projects-client.mjs +1 -1
- package/server/lib/gui-customization/projects.js +6 -6
- package/server/lib/gui-customization/projects.test.js +13 -2
- package/server/lib/gui-customization/remote-connections-client.mjs +1 -1
- package/server/lib/gui-customization/remote-connections.js +6 -6
- package/server/lib/gui-customization/session-skill.js +15 -3
- package/server/lib/gui-customization/skill/references/deep-links.md +6 -6
- package/server/lib/gui-customization/skill-caller.js +18 -0
- package/server/lib/opencode/feature-routes-runtime.js +20 -3
- package/dist/assets/BusyDots-B9Zv4OUg.js +0 -4
- package/dist/assets/ChatView-OJAZBsfN.js +0 -3
- package/dist/assets/ScheduledTasksDialog-dgU5OpBK.js +0 -3
- package/dist/assets/device-CtdJ8KBJ.js +0 -2
- package/dist/assets/insertionBoundaries-Cu6Djn8S.js +0 -1
- package/dist/assets/main-CdUAbE7p.js +0 -169
- package/dist/assets/miniChat-C7JCQrXA.js +0 -2
- package/dist/assets/mobile-CcIasitd.js +0 -2
- package/dist/assets/openRemoteProjectSession-B94TYao_.js +0 -1
- package/dist/assets/openSessionFromDeepLink-C9jS-EIM.js +0 -2
- package/dist/assets/platform-CNdx57HN.js +0 -1
- package/dist/assets/renderMobileApp-CdTenU5H.js +0 -17
- package/dist/assets/runtimeEndpointReset-DKchBECK.js +0 -4
- package/dist/assets/sessionLookup-D299jmfx.js +0 -1
- package/dist/assets/ui-CU6n15y3.js +0 -13
- package/dist/assets/useAppFontEffects-Bqt4cv2k.js +0 -7
- package/dist/assets/useMcpConfigStore-al7LZT72.js +0 -1
- package/dist/assets/useMobileTranscriptSyncHint-BVvgdcp4.js +0 -10
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/remote-input-store-CquhCIoR.js","assets/rolldown-runtime-hePW80VL.js","assets/runtime-switch-DEPKHgdL.js","assets/runtime-auth-DA-qfGHk.js","assets/platform-CNdx57HN.js","assets/runtimeAPIRegistry-C2VogTny.js","assets/pathNormalization-ewtPqJWn.js","assets/vendor-pathe-vBmvQE8f.js","assets/vendor-zustand-CTekDqaS.js","assets/vendor-base-ui-wXsskyKm.js","assets/prompt-attachment-upload-D1c308Ba.js","assets/runtime-fetch-V-iMWR8t.js","assets/reasoning-projection-client-BEhVknv9.js","assets/runtime-file-resource-DKJJoOOc.js","assets/vendor-react-BkccXcWz.js","assets/vendor-tanstack-query-core-BSjXNgF_.js","assets/vendor-tanstack-react-query-DIb_ItL-.js","assets/path-utils-jGozTg9d.js","assets/vendor-reactuses-core-DjKFMfz7.js","assets/vendor-lodash-es-BS45jPoZ.js","assets/vendor-js-cookie-hSOiFTtX.js","assets/summaries-BQMyJaaw.js","assets/vendor-aparajita-capacitor-secure-storage-xol_6BsB.js","assets/runtime-file-store-BVRgEtI-.js","assets/brand-storage-migration-Bhz6UOBJ.js","assets/input-store-PqhVEhUI.js","assets/brand-storage-bootstrap-D4BW3w-M.js","assets/uuid-D-SDZijH.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,n}from"./runtime-switch-DEPKHgdL.js";import{a as r}from"./vendor-zustand-CTekDqaS.js";import{ot as i,st as a}from"./vendor-base-ui-wXsskyKm.js";import{St as o}from"./gitApiHttp-C8AU1uiY.js";import"./brand-storage-bootstrap-D4BW3w-M.js";import{Jt as s,R as c,Wt as l,Xt as u,at as d,dr as f,en as p,it as m,n as h,nr as g,on as _,rt as v,tn as y,tr as b}from"./client-QcYZg8_d.js";import{t as x}from"./pathNormalization-ewtPqJWn.js";import{n as S}from"./vendor-react-BkccXcWz.js";import{o as C,s as w}from"./vendor-tanstack-react-query-DIb_ItL-.js";import{A as T,E as ee,I as E,R as D,W as O,k}from"./runtime-file-resource-DKJJoOOc.js";import{r as te}from"./vendor-reactuses-core-DjKFMfz7.js";import{o as A}from"./vendor-aparajita-capacitor-secure-storage-xol_6BsB.js";import{r as j}from"./useUIStore-P32bzAJc.js";import{s as M}from"./spacedFileMention-Ds4GtgiF.js";import{An as N,Ba as P,Bn as F,Fa as ne,Gi as I,Ir as L,Ji as R,Ki as re,Lr as ie,Pr as ae,Rn as oe,Rr as z,Tt as se,U as B,Ua as V,V as ce,Vn as le,W as ue,Yi as de,Yn as H,Yt as fe,_i as pe,_t as me,dn as he,f as U,ft as ge,gi as _e,gt as ve,hi as ye,ht as be,ir as xe,j as Se,kn as Ce,mi as we,mn as W,mt as Te,ni as Ee,no as G,oi as De,pt as Oe,ri as ke,t as K,ta as Ae,ti as je,ur as Me,ut as Ne,vi as q,vr as J,xt as Pe,zn as Fe}from"./ui-CU6n15y3.js";import{n as Y}from"./Icon-zB0u-x9G.js";import{i as Ie,m as Le,n as Re}from"./remoteProjectQueries-BunVM5PM.js";import{t as ze}from"./i18n-WsU03nwB.js";import{t as Be}from"./toolHelpers-iEHVHQ9p.js";import{t as Ve}from"./ScrollableOverlay-DAMUOn67.js";import{t as He}from"./MobileResizableSheet-O2gv2sCB.js";import{a as Ue,i as We,n as Ge,o as Ke,t as qe}from"./dialog-B2Po85oU.js";import{i as Je,n as Ye,t as Xe}from"./tooltip-Cdsa-YWG.js";import{c as Ze,n as Qe,t as $e}from"./dropdown-menu-vW7wfT5z.js";import{n as et}from"./useProjectRuntimeAPIs-TALa4FqO.js";import{b as tt,p as nt,t as rt,v as it}from"./gitApi-DG2Gj6gC.js";import{o as at,t as ot}from"./useProjectGitStore-DFz9Eb6v.js";import{t as st}from"./input-BpDiYSsP.js";import{t as ct}from"./useDebouncedValue-BHlMPqY8.js";import{t as lt}from"./checkbox-hYuewn9u.js";import{t as ut}from"./MobileOverlayPanel-Pr-vLaIF.js";import{t as dt}from"./githubAuthQueries-IJPWBo0B.js";import{a as ft,i as pt,s as mt,t as ht}from"./worktreeManager-D56glCi_.js";import{a as gt,i as _t,n as vt,o as yt,r as bt,t as xt}from"./worktreeSourceBranchPreference-CNtT0ymW.js";import{s as St}from"./remote-input-store-CquhCIoR.js";import{t as Ct}from"./vendor-cmdk-BDWoZLve.js";import{t as wt}from"./sortable-tabs-strip-DlQjS9bw.js";import{f as Tt,m as Et}from"./auto-read-context-DLilPZMl.js";var Dt=2e3,Ot=r((e,t)=>({pending:!1,expiresAt:null,arm:(t=Dt)=>{let n=Date.now()+t;return e({pending:!0,expiresAt:n}),n},clear:()=>{!t().pending&&t().expiresAt===null||e({pending:!1,expiresAt:null})}})),X=e(a(),1),kt=new class{inFlightByScope=new WeakMap;generationByScope=new WeakMap;run(e){let t=this.inFlightByScope.get(e.scope);t||(t=new Map,this.inFlightByScope.set(e.scope,t));let n=t.get(e.key);if(n)return n;let r=this.generationByScope.get(e.scope);r||(r=new Map,this.generationByScope.set(e.scope,r));let i=(r.get(e.key)??0)+1;r.set(e.key,i);let a=e.request(()=>r?.get(e.key)!==i);return t.set(e.key,a),a.finally(()=>{t?.get(e.key)===a&&t.delete(e.key)}).catch(()=>{}),a}},At=e=>C({queryKey:[e.transport,`sessionChildren`,e.generation,x(e.directory),e.sessionID],queryFn:({signal:t})=>e.request(t),staleTime:0,gcTime:6e4,retry:!1}),jt=e=>O.fetchQuery(At(e)),Mt=(e,t)=>e.id<t.id?-1:+(e.id>t.id),Nt=(e,t,n)=>{let r=new Set(e.map(e=>e.id)),i=t.filter(e=>!e?.id||r.has(e.id)||e.parentID!==n?!1:(r.add(e.id),!0));return i.length===0?e:[...e,...i].sort(Mt)},Pt=30,Ft=new Map;function It(e,t=!1){return{limit:e.loadedTurns,cursor:e.kind===`has-more`?e.cursor:void 0,complete:e.kind===`exhausted`,loading:t}}function Lt(e,t){let n=u();if(!n)return!1;let r=n.getTranscript(_(e,t));return r.messageOrder.length!==0&&r.messageOrder.length>z()}function Rt(e){return!!e.force||!e.hasSession||e.shouldLoadMessages}function zt(e,t,n){let r=[...e.getState().session],i=le.search(r,t,e=>e.id);i.found?r[i.index]=n:r.splice(i.index,0,n),e.setState({session:r})}function Bt(){let e=Pe(),r=B(),i=ce(),a=(0,X.useCallback)((t,n=e)=>`${n}\n${t}`,[e]),o=(0,X.useCallback)((t,n=e)=>{let r=u();if(!r||!t)return It({kind:`unknown`,loadedTurns:0},!1);let i=_(n,t),a=r.getPagination(i),o=r.getRequestState?.(i);return It(a.boundary,o?.status===`loading`)},[e]),c=(0,X.useCallback)((e,t)=>{if(t.length===0)return;let n=i.getChild(e);if(!n)return;let r=n.getState(),a={session_status:{...r.session_status},session_status_observed_at:{...r.session_status_observed_at},session_error_at:{...r.session_error_at},session_diff:{...r.session_diff},todo:{...r.todo},permission:{...r.permission},question:{...r.question}};oe(a,t),Se(n,t),n.setState(a);for(let n of t)p(e,n)},[i]),d=(0,X.useCallback)((t=e)=>{let n=Ft.get(t);if(n)return Ft.delete(t),Ft.set(t,n),n;let r=new Set;for(Ft.set(t,r);Ft.size>Pt;){let e=Ft.keys().next().value;if(!e)break;let t=[...Ft.get(e)??[]];Ft.delete(e),c(e,t)}return r},[e,c]),m=(0,X.useCallback)((t,n=e)=>{let a=n===e?r:i.ensureChild(n,{bootstrap:!1}),o=d(n),s=Fe(a.getState()),l=L(),f=F({seen:o,keep:t,limit:l,preserve:s});if(c(n,f),ie()){let e=new Set([t,...o,...s]),r=(u()?.getCacheBudget?.().listCanonical({directory:n})??[]).map(e=>e.scope.sessionID),i=(r.length>0?r:Array.from(o)).filter(r=>r===t||e.has(r)?!1:Lt(n,r));if(i.length>0){for(let e of i)o.delete(e);c(n,i)}}},[i,e,d,c,r]),g=(0,X.useCallback)(async(t,n)=>{let a=n?.directory??e;if(!t||!a||a===`global`)return;let o=a===e?r:i.ensureChild(a,{bootstrap:!1}),c=o.getState(),l=c.session_status?.[t],d=c.session_status_observed_at?.[t];try{n?.purpose===`prepend`||n?.before?await s(a,t):await y(a,t,{background:!0})}catch{return}if(n?.isStale?.())return;let f=u()?.getTranscript(_(a,t));W({directory:a,sessionID:t,store:o,transcript:f,isStale:n?.isStale}),await J({directory:a,sessionID:t,store:o,statusBeforePull:l,statusObservedAtBeforePull:d,hasMessages:(f?.messageOrder.length??0)>0,isTailPage:!n?.before,isStale:n?.isStale})},[i,r,e]),v=(0,X.useCallback)(async(t,n)=>{await se();let r=typeof n==`boolean`?n:n?.force,o=typeof n==`object`?n.directory??e:e,s=i.ensureChild(o,{bootstrap:!1}),c=h.getScopedSdkClient(o);m(t,o);let l=a(t,o);return kt.run({scope:s,key:l,request:async e=>{let n=s.getState(),i=u(),a=_(o,t),l=i?.hasSession?.(a)??(i?.getTranscript(a).messageOrder.length??0)>0,d=i?.getPagination(a)?.boundary??{kind:`unknown`,loadedTurns:0},p=le.search(n.session,t,e=>e.id).found,m=i?.getRequestState?.(a);if(!r&&l&&d.kind!==`unknown`&&m?.status!==`error`&&p&&ae(o,t)){W({directory:o,sessionID:t,store:s,isStale:e});return}let h=!!(r||!l||p),v=Rt({hasSession:p,shouldLoadMessages:h,force:!!r});await Promise.all([v?(async()=>{try{let n=await re(async()=>c.session.get({sessionID:t}));if(n&&!e()){let r=I(f(n));e()||zt(s,t,r)}}catch(e){console.error(`[sync] failed to fetch session`,t,e)}})():Promise.resolve(),h?g(t,{isStale:e,directory:o}):Promise.resolve()])}})},[i,a,m,g,e]),b=te(async(r,a)=>{let o=a||e;if(!r||!o)return;let s=i.ensureChild(o,{bootstrap:!1}),c=h.getScopedSdkClient(o),l=n(),u=t(),d=()=>l!==n()||u!==t()||i.getChild(o)!==s,p=await jt({transport:u,generation:l,directory:o,sessionID:r,request:async e=>{let i=[],a=new Set,s;do{if(e.throwIfAborted(),l!==n()||u!==t())throw new DOMException(`Session children runtime changed`,`AbortError`);let d=await c.session.list(s?{cursor:s,limit:50}:{directory:o,parentID:r,limit:50},{signal:e});if(!Array.isArray(d?.data))throw Error(`session.list children returned no data`);if(i.push(...d.data.map(f)),d.data.length<50)break;if(s=d.cursor?.next??void 0,!s||a.has(s))throw Error(`session.list children pagination did not advance`);a.add(s)}while(s);return i}}).catch(e=>{if(d())return null;throw e});!p||d()||s.setState(e=>{let t=Nt(e.session,p,r);return t===e.session?e:{session:t,limit:Math.max(e.limit,t.length)}})}),x=(0,X.useCallback)((t,n)=>{let r=o(t,n?.directory??e);return!r.complete&&!!r.cursor},[e,o]),S=(0,X.useCallback)((t,n)=>o(t,n?.directory??e).loading,[e,o]),C=(0,X.useCallback)((t,n)=>o(t,n?.directory??e).complete,[e,o]),w=(0,X.useCallback)(t=>{let n=t.directory||e;l(_(n,t.sessionID),{type:`optimistic-add`,message:t.message,parts:t.parts})},[e]),T=(0,X.useCallback)(t=>{let n=t.directory||e;l(_(n,t.sessionID),{type:`optimistic-remove`,messageID:t.messageID})},[e]),ee=(0,X.useCallback)(t=>{let n=t.directory||e;l(_(n,t.sessionID),{type:`optimistic-confirm`,messageID:t.messageID})},[e]),E=te(async(r,a)=>{if(!r)return;await se();let o=a?.directory??e;if(!o||o===`global`)return;let s=i.ensureChild(o,{bootstrap:!1}),c=n(),l=t(),d=()=>c!==n()||l!==t()||i.ensureChild(o,{bootstrap:!1})!==s,f=s.getState();try{if(await y(o,r),d())return;W({directory:o,sessionID:r,store:s}),await J({directory:o,sessionID:r,store:s,statusBeforePull:f.session_status?.[r],statusObservedAtBeforePull:f.session_status_observed_at?.[r],hasMessages:(u()?.getTranscript(_(o,r)).messageOrder.length??0)>0,isStale:d})}catch{throw Error(`refresh transcript failed`)}});return(0,X.useMemo)(()=>({ensureSessionRenderable:v,syncSession:v,loadChildren:b,hasMore:x,isLoading:S,isComplete:C,refreshSessionTranscript:E,optimistic:{add:w,remove:T,confirm:ee}}),[v,b,x,S,C,E,w,T,ee])}var Z=S(),Q=i(),Vt=(e,t)=>{if(!e)return t;let n=e.ready&&!e.loading;return{modelsReady:!e.error&&(e.modelsReady??n),agentsReady:!e.error&&(e.agentsReady??n)}},Ht=e=>{let t=e?.variants;if(!t)return[];if(Array.isArray(t)){let e=[],n=new Set;for(let r of t){let t=typeof r==`string`?r:r&&typeof r==`object`&&!Array.isArray(r)&&typeof r.id==`string`?r.id:``;!t||n.has(t)||(n.add(t),e.push(t))}return e}return typeof t==`object`?Object.keys(t):[]},Ut=(e,t,n,r)=>{if(e.providerID!==n||e.modelID!==r||t?.variantsReady===!1)return[];if(t?.variants)return[...t.variants];let i=(t?.providers?.find(e=>e.id===n))?.models?.find(e=>e.id===r);return Ht(i)},Wt=()=>!0,Gt=(e,t)=>(e.commandPolicy??Wt)(t),Kt=X.createContext(null),qt=()=>X.useContext(Kt),Jt=e=>e,Yt=(e,t)=>t??e,Xt=e=>{if(e.kind!==`primary`&&(!e.sessionID||!e.directory||!e.draftKey||!e.transportIdentity||!Number.isSafeInteger(e.runtimeGeneration)||!e.resources||typeof e.resources.busy!=`boolean`||!e.activity||!e.commands||!e.shortcuts))throw Error(`chat-input-secondary-surface-incomplete`)},Zt=(e,t)=>e.kind===`secondary`?e.resources?.busy??!1:t,Qt=e=>!e.sessionID||!e.directory?null:{deliveryTarget:e.deliveryTarget,sessionID:e.queueSessionID??e.sessionID,directory:e.directory,transportIdentity:e.transportIdentity,runtimeGeneration:e.runtimeGeneration},$t=(e,t,n)=>{if(e.kind===`secondary`){if(!e.commands)throw Error(`chat-input-secondary-commands-incomplete`);return e.commands}return e.commands?e.commands:{sessionID:e.sessionID,hasMessages:t,hasNewDraft:n}},en={phase:`idle`,isWorking:!1,isBusy:!1,isCooldown:!1},tn=e=>e.hasPendingAssistant?e.messages.some(e=>e.role===`assistant`&&typeof e.time?.completed==`number`):!1;function nn(e,t){let n=(0,Z.c)(6),r=be(e??``,t),i=ve(e??``,t),a=Ne(e??``,t),o=Oe(e??``,t),s=Te(e??``,t),c=me(t),l;bb0:{if(!e){l=en;break bb0}if(o.length>0||s.length>0){l=en;break bb0}let t=r?.type??`idle`,u=a[a.length-1],d=!!(u&&u.role===`assistant`&&typeof u.time?.completed!=`number`),f=a,p;n[0]!==d||n[1]!==f?(p=tn({messages:f,hasPendingAssistant:d}),n[0]=d,n[1]=f,n[2]=p):p=n[2];let m=p,h=u?.time?.created,g=!!(m&&typeof c==`number`&&typeof h==`number`&&h<=c),_=r!==void 0,v=_&&t!==`idle`,y=v||m&&!g;if(_&&!v&&(!m||_&&!v&&typeof i==`number`&&typeof h==`number`&&h<=i)){l=en;break bb0}if(!y){l=en;break bb0}let b=v?t:`busy`,x=t===`busy`||!v&&m,S;n[3]!==b||n[4]!==x?(S={phase:b,isWorking:!0,isBusy:x,isCooldown:!1},n[3]=b,n[4]=x,n[5]=S):S=n[5],l=S}return l}var rn=`data-mobile-overlay-active`,an=e=>Array.from(e).some(e=>e.getAttribute(rn)!==`false`),on=`artful.bionic.cosmic.disco.focal.groovy.jammy.kinetic.lunar.noble.bold.brave.calm.eager.gentle.happy.keen.lively.merry.swift.warm.wise.bright.clever.daring.agile.crisp.fresh.lucid.quick.sharp.vivid.zealous`.split(`.`),sn=`aardvark.beaver.chipmunk.dolphin.falcon.gopher.hedgehog.jackal.koala.lemur.mongoose.narwhal.otter.pangolin.quokka.raccoon.salamander.toucan.walrus.yak.zebra.badger.condor.dingo.egret.ferret.gecko.heron.iguana`.split(`.`);function cn(){return`${on[Math.floor(Math.random()*on.length)]}-${sn[Math.floor(Math.random()*sn.length)]}`}function ln(e){let t=cn();return e&&e.trim()?`${e.trim().replace(/\/+$/,``)}/${t}`:t}async function un(e,t,n){if(!e.hostId||!e.hubId)throw Error(`Remote Project Host scope is unavailable`);let r=V.getState().remoteSession,i=E(),a=await Re();if(i.assertCurrent(),!a.supported||a.hubId!==e.hubId||!a.projects.some(t=>t.id===e.id&&t.hostId===e.hostId&&t.path===e.path))throw Error(`Remote Project is not referenced by the current Hub`);let o=Ie(a);await o.connectHost(e.hostId);let s=o.resolve({hubId:e.hubId,hostId:e.hostId,directory:e.path}),c=E(s),l=xe(s);if(!await l.checkIsGitRepository(e.path))throw Error(`Worktrees can only be created in Git repositories`);let u=await Ee(e,s),f=u.commands,p=Array.isArray(f)?f.filter(e=>typeof e==`string`&&!!e.trim()).map(t=>De(t.trim(),{rootWorktreePath:e.path})).join(` && `):void 0,h=await l.getGitStatus(e.path),g=await l.getGitBranches(e.path),_=await l.listGitWorktrees(e.path),y=x(e.path),b=_.map(e=>x(e.path)).filter(e=>y===e||y.startsWith(`${e}/`)).sort((e,t)=>t.length-e.length)[0],S=b?y.slice(b.length):``,C=(g.branches?.[h.current]?.tracking||h.tracking)?.replace(/^remotes\//,``).split(`/`)[0],w=t.branchName||t.existingBranch?.replace(/^remotes\//,``),T={...t,...p?{startCommand:p}:{},...C&&w?{setUpstream:t.setUpstream??!0,upstreamRemote:t.upstreamRemote||C,upstreamBranch:t.upstreamBranch||w}:{},returnAfterDirectoryCreated:!1},ee=await l.previewGitWorktree(e.path,T);if(!ee.path)throw Error(`Remote worktree preview missing path`);let D=ye();q(D).catch(()=>void 0);let O=S?`${ee.path.replace(/[\\/]+$/,``)}${S}`:ee.path,k={...s.location,directory:O},te={title:n.title,initialPrompt:n.initialPrompt,bootstrapWaitEnabled:u.wait,defaultModel:e.defaultModel??void 0,pendingWorktreeRequestId:D,bootstrapPendingDirectory:O,preserveDirectoryOverride:!0,bootstrapStatus:{status:`pending`,error:null,updatedAt:Date.now()}};try{n.initialPrompt&&await St(k,n.initialPrompt),c.assertCurrent()}catch(e){throw _e(D,e instanceof Error?e:Error(String(e))),e}n.isSelected()&&V.getState().remoteSession===r&&V.getState().openRemoteSession(e,k,null,te);let j=V.getState().remoteSession,M=j?.draft?.pendingWorktreeRequestId===D,N=()=>{if(!n.isSelected()||!M)return!1;let t=V.getState().remoteSession;return t?.sessionId===null&&t.projectId===e.id&&t.location.hubId===e.hubId&&t.location.hostId===e.hostId&&t.draft?.pendingWorktreeRequestId===D?(j=t,!0):t===j};try{let r=await l.createGitWorktree(e.path,T);if(!r.path||!r.name)throw Error(`Remote worktree create missing name/path`);let i=r.bootstrapStatus,a=Date.now()+12e4;for(;i?.status===`pending`&&u.wait;){if(Date.now()>=a)throw Error(`Remote worktree setup timed out; the existing draft was retained`);await new Promise(e=>setTimeout(e,500)),c.assertCurrent(),i=await l.getGitWorktreeBootstrapStatus(r.path)}if(i?.status===`failed`)throw Error(i.error||`Remote worktree setup failed`);c.assertCurrent();let f=S?`${r.path.replace(/[\\/]+$/,``)}${S}`:r.path,p={...s.location,directory:f},g={pendingWorktreeRequestId:null,bootstrapPendingDirectory:null,worktreeMetadata:{name:r.name,path:f,worktreeRoot:r.path,projectDirectory:e.path,relativePath:S.replace(/^\//,``)||void 0,branch:r.branch,label:r.branch||r.name,source:`sdk`,worktreeSource:`created-for-session`,headState:r.branch?`branch`:`unborn`,worktreeStatus:i?.status===`pending`?`pending`:`ready`,createdFromBranch:n.createdFromBranch||h.current||t.startRef,kind:n.kind??`standard`},bootstrapStatus:u.wait?i??{status:`ready`,error:null,updatedAt:Date.now()}:void 0};if(f!==O){let{getRemoteInputStore:e,remoteSessionDraftKey:t}=await A(async()=>{let{getRemoteInputStore:e,remoteSessionDraftKey:t}=await import(`./remote-input-store-CquhCIoR.js`).then(e=>e.a);return{getRemoteInputStore:e,remoteSessionDraftKey:t}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27])),n=e(p),r=t(k,null),i=n.getState().getDraft(r),a=await n.getState().moveDraftWithAttachments(r,t(p,null),i?.revision);if(i&&!a)throw Error(`Remote draft changed while the worktree target was being finalized; the original draft was retained`);c.assertCurrent()}!n.createSession&&N()&&j&&(V.getState().updateRemoteDraft(j,g,p),j=V.getState().remoteSession),n.createSession||pe(D,f);let _;if(n.createSession)try{let t=o.resolve(p).service(),r=N()?j?.draft?.title??n.title:n.title,i=await t.createSession({title:r},f);_=i.id,c.assertCurrent();let a=await t.getConfig(f).catch(()=>void 0);c.assertCurrent();let s=e.defaultModel||a?.model,l=typeof s==`string`?s:void 0,u=l?.indexOf(`/`)??-1,h=u>0?l.slice(0,u):m(i),g=u>0?l.slice(u+1):v(i),y=a?.default_agent||i.agent,b=typeof y==`string`?y:void 0,x=Ae.getState();h&&g&&x.saveSessionModelSelection(i.id,h,g,p),b&&x.saveSessionAgentSelection(i.id,b,p),b&&h&&g&&(x.saveAgentModelForSession(i.id,b,h,g,p),x.saveAgentModelVariantForSession(i.id,b,h,g,d(i),p))}catch(t){throw await l.deleteGitWorktree(e.path,{directory:r.path,deleteLocalBranch:!0}).catch(()=>void 0),t}return c.assertCurrent(),n.createSession&&N()&&V.getState().openRemoteSession(e,p,_??null,{...j?.draft,...g}),n.createSession&&pe(D,f),{path:f,branch:r.branch,..._?{id:_}:{}}}catch(e){let t=e instanceof Error?e:Error(String(e));throw N()&&j&&V.getState().updateRemoteDraft(j,{pendingWorktreeRequestId:null,bootstrapPendingDirectory:null,bootstrapStatus:{status:`failed`,error:t.message,updatedAt:Date.now()}}),_e(D,t),e}}var dn=e=>e.replace(/\\/g,`/`).replace(/\/+$/,``)||e,fn=e=>()=>{let t=P.getState().getActiveProject();return t?.id===e.id&&t?.hostId===e.hostId&&t?.hubId===e.hubId&&t?.path===e.path},pn=e=>({agentName:e.currentAgentName,providerId:e.currentProviderId,modelId:e.currentModelId,variant:e.currentVariant}),mn=(e,t,n)=>{let r=t.agentName?.trim()||void 0,i=t.providerId?.trim()||void 0,a=t.modelId?.trim()||void 0;!r||!i||!a||(n.saveSessionAgentSelection(e,r),n.saveSessionModelSelection(e,i,a),n.saveAgentModelForSession(e,r,i,a),n.saveAgentModelVariantForSession(e,r,i,a,t.variant))},hn=async(e,t)=>{await ke(e)&&await we(t)},gn=e=>{let t=dn(e),n=P.getState().projects;if(n.length===0)return null;let r=n.filter(e=>{if(e.hostId)return!1;let n=dn(e.path);return t===n||t.startsWith(`${n}/`)}).sort((e,t)=>dn(t.path).length-dn(e.path).length)[0];return r?{id:r.id,path:r.path}:null},_n=!1,vn=async(e,t)=>{try{let n=P.getState().projects.find(e=>e.id===t.id)??P.getState().projects.find(e=>dn(e.path)===dn(t.path)),r=R(t.path);await de.getState().activateDirectory(t.path,{source:`worktreeSessionCreator`});let i=de.getState();if(i.activeDirectoryKey!==r||i.providers.length===0||i.agents.length===0)return;i.applyDefaultModelAgentSelection({projectDefaultModel:n?.defaultModel??void 0}),mn(e,pn(de.getState()),Ae.getState())}catch{}},yn=async(e,t,n)=>{let r=U.getState(),i=de.getState();r.initializeNewYuriSession(e,i.agents),r.setSessionDirectory(e,t.path),r.setWorktreeMetadata(e,t),await vn(e,n),o.getState().setDirectory(t.path,{showOverlay:!1})},bn=e=>e.trim().replace(/^remotes\//,``).replace(/[^A-Za-z0-9._/-]+/g,`-`).replace(/\/+/g,`-`).replace(/-+/g,`-`).replace(/^-+|-+$/g,``)||`worktree`,xn=async e=>{if(_n)return null;let t=P.getState().getActiveProject();if(t?.hostId){_n=!0;let n=fn(t);try{let r=e?.existingBranch?.trim().replace(/^remotes\//,``),i=r?bn(r):ln();return(await un(t,{mode:r?`existing`:`new`,worktreeName:i,...r?{existingBranch:r}:{branchName:i}},{...e,isSelected:n})).path}catch(e){return K.error(`Failed to create worktree`,{description:e instanceof Error?e.message:String(e)}),null}finally{_n=!1}}let n=e?.projectDirectory?.trim()||t?.path;if(!n)return K.error(`No active project`,{description:`Please select a project first.`}),null;let r=gn(n)??(t?.path?{id:t.id,path:t.path}:null);if(!r)return K.error(`No active project`,{description:`Please select a project first.`}),null;let i=!1;try{i=await rt(r.path)}catch{}if(!i)return K.error(`Not a Git repository`,{description:`Worktrees can only be created in Git repositories.`}),null;_n=!0;try{let t=ye(),n=e?.existingBranch?.trim().replace(/^remotes\//,``)||``,i=n?bn(n):ln(),a=n?`existing`:`new`,s=U.getState();s.newSessionDraft?.open?s.overrideNewSessionDraftTarget({projectId:r.id,directoryOverride:s.newSessionDraft.directoryOverride??r.path,pendingWorktreeRequestId:t,preserveDirectoryOverride:!0,title:e?.title,initialPrompt:e?.initialPrompt}):s.openNewSessionDraft({selectedProjectId:r.id,directoryOverride:r.path,pendingWorktreeRequestId:t,preserveDirectoryOverride:!0,title:e?.title,initialPrompt:e?.initialPrompt});let c=await nt(r.path,{mode:a,...a===`new`?{branchName:i,worktreeName:i}:{existingBranch:n,worktreeName:i}}).catch(()=>null);c?.path&&(U.getState().overrideNewSessionDraftTarget({projectId:r.id,directoryOverride:c.path,pendingWorktreeRequestId:t,bootstrapPendingDirectory:c.path,preserveDirectoryOverride:!0,title:e?.title,initialPrompt:e?.initialPrompt}),o.getState().setDirectory(c.path,{showOverlay:!1}));let l=await je(r),u=await _t(r,{preferredName:i,mode:a,worktreeName:i,setupCommands:l,returnAfterDirectoryCreated:!0,...a===`new`?{branchName:i}:{existingBranch:n}});return pe(t,u.path),U.getState().overrideNewSessionDraftTarget({projectId:r.id,directoryOverride:u.path,pendingWorktreeRequestId:null,bootstrapPendingDirectory:u.path,preserveDirectoryOverride:!0,title:e?.title,initialPrompt:e?.initialPrompt}),o.getState().setDirectory(u.path,{showOverlay:!1}),u.path}catch(e){let t=e instanceof Error?e.message:`Failed to create worktree`,n=U.getState().newSessionDraft.pendingWorktreeRequestId;return n&&(_e(n,e instanceof Error?e:Error(t)),U.getState().resolvePendingDraftWorktreeTarget(n,null)),U.getState().setDraftBootstrapPendingDirectory(null),K.error(`Failed to create worktree`,{description:t}),null}finally{_n=!1}};async function Sn(){return xn()}async function Cn(e){let t=e.branch?.trim();return t?xn({existingBranch:t,projectDirectory:e.projectDirectory,initialPrompt:e.initialPrompt,title:e.title}):null}async function wn(e,t,n,r){if(_n)return null;_n=!0;try{let i=P.getState().getActiveProject();if(i?.hostId){let e=fn(i);try{if(!t.trim())throw Error(`Branch name is required`);let a=await un(i,{mode:`new`,branchName:t.trim(),worktreeName:r?.worktreeName||t.trim(),startRef:n?.trim()||`HEAD`,setUpstream:r?.setUpstream,upstreamRemote:r?.upstreamRemote,upstreamBranch:r?.upstreamBranch,ensureRemoteName:r?.ensureRemoteName,ensureRemoteUrl:r?.ensureRemoteUrl},{createSession:!0,isSelected:e,kind:r?.kind,createdFromBranch:r?.createdFromBranch});if(!a.id)throw Error(`Could not create a remote session for the worktree`);return{id:a.id,branch:a.branch,path:a.path}}catch(e){return K.error(`Failed to create worktree`,{description:e instanceof Error?e.message:String(e)}),null}}let a=n?.trim()||`HEAD`,o=t?.trim();if(!o)throw Error(`Branch name is required`);let s=r?.kind??`standard`,c=gn(e);if(!c)throw Error(`Project is not registered in Yuri`);let l=!1;try{l=await rt(c.path)}catch{}if(!l)return K.error(`Not a Git repository`,{description:`Worktrees can only be created in Git repositories.`}),null;let u=await je(c),d=await mt(c.path);try{let e=await _t(c,{preferredName:o,mode:`new`,branchName:o,worktreeName:r?.worktreeName||o,startRef:a,setUpstream:r?.setUpstream,upstreamRemote:r?.upstreamRemote,upstreamBranch:r?.upstreamBranch,ensureRemoteName:r?.ensureRemoteName,ensureRemoteUrl:r?.ensureRemoteUrl,setupCommands:u,returnAfterDirectoryCreated:r?.returnAfterDirectoryCreated}),t={...e,createdFromBranch:r?.createdFromBranch||d||a,kind:s};await hn(c,e.worktreeRoot??e.path);let n=await U.getState().createSession(void 0,e.path);if(!n)throw await pt(c,e,{deleteLocalBranch:!0}).catch(()=>void 0),Error(`Could not create a session for the worktree.`);return await yn(n.id,t,c),{id:n.id,branch:e.branch||o,path:e.path}}catch(e){let t=e instanceof Error?e.message:`Failed to create worktree session`;return K.error(`Failed to create worktree`,{description:t}),null}}finally{_n=!1}}function Tn(e){let t=(0,Z.c)(12),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,style:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===i?a=t[5]:(a={color:`var(--surface-elevated-foreground)`,...i},t[4]=i,t[5]=a);let o;t[6]===n?o=t[7]:(o=G(`flex h-full w-full flex-col overflow-hidden rounded-xl`,n),t[6]=n,t[7]=o);let s;return t[8]!==r||t[9]!==a||t[10]!==o?(s=(0,Q.jsx)(Ct,{"data-slot":`command`,style:a,className:o,...r}),t[8]=r,t[9]=a,t[10]=o,t[11]=s):s=t[11],s}var En=X.forwardRef((e,t)=>{let n=(0,Z.c)(16),r,i,a;n[0]===e?(r=n[1],i=n[2],a=n[3]):({className:r,variant:a,...i}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a);let o=(a===void 0?`default`:a)===`mobileGlass`?`yuri-mobile-glass-control rounded-full`:`bg-[var(--surface-elevated)] ring-1 ring-inset ring-border/60 transition duration-200 ease-out hover:[&:not(:focus-within)]:bg-[var(--surface-subtle)] hover:[&:not(:focus-within)]:ring-transparent focus-within:ring-2 focus-within:ring-[var(--interactive-focus-ring)]`,s;n[4]===o?s=n[5]:(s=G(`flex h-8 items-center gap-2 rounded-lg px-3`,o),n[4]=o,n[5]=s);let c;n[6]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Q.jsx)(Y,{name:`search`,className:`size-4 shrink-0 opacity-50`}),n[6]=c):c=n[6];let l;n[7]===r?l=n[8]:(l=G(`placeholder:text-muted-foreground flex h-8 w-full bg-transparent typography-meta outline-none focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50`,r),n[7]=r,n[8]=l);let u;n[9]!==i||n[10]!==t||n[11]!==l?(u=(0,Q.jsx)(Ct.Input,{ref:t,"data-slot":`command-input`,className:l,...i}),n[9]=i,n[10]=t,n[11]=l,n[12]=u):u=n[12];let d;return n[13]!==s||n[14]!==u?(d=(0,Q.jsx)(`div`,{"data-slot":`command-input-wrapper`,className:`p-1.5 pb-1`,children:(0,Q.jsxs)(`div`,{"data-slot":`command-input-field`,className:s,children:[c,u]})}),n[13]=s,n[14]=u,n[15]=d):d=n[15],d});En.displayName=`CommandInput`;function Dn(e){let t=(0,Z.c)(14),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({className:r,children:n,scrollbarClassName:o,disableHorizontal:i,...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=G(`scroll-py-1 overflow-x-hidden h-full min-h-0`,r),t[6]=r,t[7]=s);let c=o??`overlay-scrollbar--flush overlay-scrollbar--dense overlay-scrollbar--zero`,l=i??!0,u;return t[8]!==n||t[9]!==a||t[10]!==s||t[11]!==c||t[12]!==l?(u=(0,Q.jsx)(Ve,{as:Ct.List,"data-slot":`command-list`,outerClassName:`max-h-[min(600px,calc(100vh-10rem))] overflow-x-hidden p-0 w-full h-full min-h-0`,className:s,scrollbarClassName:c,disableHorizontal:l,...a,children:n}),t[8]=n,t[9]=a,t[10]=s,t[11]=c,t[12]=l,t[13]=u):u=t[13],u}function On(e){let t=(0,Z.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,Q.jsx)(Ct.Empty,{"data-slot":`command-empty`,className:`py-6 text-center typography-ui-label`,...n}),t[2]=n,t[3]=r),r}function kn(e){let t=(0,Z.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=G(`text-foreground [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:typography-meta [&_[cmdk-group-heading]]:font-medium`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Q.jsx)(Ct.Group,{"data-slot":`command-group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function An(e){let t=(0,Z.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=G(`bg-border -mx-1 h-px`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Q.jsx)(Ct.Separator,{"data-slot":`command-separator`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function jn(e){let t=(0,Z.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=G(`data-[selected=true]:bg-interactive-selection data-[selected=true]:text-interactive-selection-foreground data-[highlighted]:bg-interactive-hover hover:bg-interactive-hover [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-pointer items-center gap-2 rounded-lg px-2 py-1.5 typography-meta outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Q.jsx)(Ct.Item,{"data-slot":`command-item`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Mn(e){let t=(0,Z.c)(27),{branches:n,search:r,local:i,currentBranch:a,branchInfo:o,onCheckout:s}=e,{t:c}=ze(),l;if(t[0]!==n||t[1]!==r){let e=r.trim();l=e?M(n,e,Pn).map(Nn):n,t[0]=n,t[1]=r,t[2]=l}else l=t[2];let u=l,d=i?`gitView.branch.localBranches`:`gitView.branch.remoteBranches`,f;t[3]!==c||t[4]!==d?(f=c(d),t[3]=c,t[4]=d,t[5]=f):f=t[5];let p;if(t[6]!==o||t[7]!==a||t[8]!==u||t[9]!==i||t[10]!==s||t[11]!==c){let e;t[13]!==o||t[14]!==a||t[15]!==i||t[16]!==s||t[17]!==c?(e=e=>(0,Q.jsxs)(jn,{onSelect:()=>s(e),children:[i?(0,Q.jsxs)(`span`,{className:`flex flex-1 flex-col`,children:[(0,Q.jsx)(`span`,{className:`typography-ui-label text-foreground`,children:e}),(o?.[e]?.ahead||o?.[e]?.behind)&&(0,Q.jsxs)(`span`,{className:`typography-micro text-muted-foreground`,children:[o[e].ahead||0,` ahead ·`,` `,o[e].behind||0,` behind`]})]}):(0,Q.jsx)(`span`,{className:`typography-ui-label text-foreground`,children:e}),i&&a===e&&(0,Q.jsx)(`span`,{className:`typography-micro text-primary`,children:c(`gitView.branch.currentBadge`)})]},`${i?`local`:`remote`}-${e}`),t[13]=o,t[14]=a,t[15]=i,t[16]=s,t[17]=c,t[18]=e):e=t[18],p=u.map(e),t[6]=o,t[7]=a,t[8]=u,t[9]=i,t[10]=s,t[11]=c,t[12]=p}else p=t[12];let m;t[19]!==u.length||t[20]!==i||t[21]!==c?(m=u.length===0&&(0,Q.jsx)(jn,{disabled:!0,className:`justify-center`,children:(0,Q.jsx)(`span`,{className:`typography-meta text-muted-foreground`,children:c(i?`gitView.branch.noLocalBranches`:`gitView.branch.noRemoteBranches`)})}),t[19]=u.length,t[20]=i,t[21]=c,t[22]=m):m=t[22];let h;return t[23]!==f||t[24]!==p||t[25]!==m?(h=(0,Q.jsxs)(kn,{heading:f,children:[p,m]}),t[23]=f,t[24]=p,t[25]=m,t[26]=h):h=t[26],h}function Nn(e){return e.item}function Pn(e){return e}function Fn(e){let t=(0,Z.c)(9),{options:n,selectedDirectory:r,onSelect:i}=e,{t:a}=ze(),o;if(t[0]!==i||t[1]!==n||t[2]!==r||t[3]!==a){let e;t[5]!==i||t[6]!==r||t[7]!==a?(e=e=>(0,Q.jsxs)(jn,{onSelect:()=>i(e.value),children:[(0,Q.jsxs)(`span`,{className:`truncate typography-ui-label text-foreground`,children:[e.pending?`⏳ `:``,e.label]}),r===e.value?(0,Q.jsx)(`span`,{className:`typography-micro text-primary`,children:a(`gitView.branch.currentBadge`)}):null]},`worktree-${e.value}`),t[5]=i,t[6]=r,t[7]=a,t[8]=e):e=t[8],o=n.map(e),t[0]=i,t[1]=n,t[2]=r,t[3]=a,t[4]=o}else o=t[4];return o}var In=e=>e.trim().replace(/\s+/g,`-`).replace(/[^A-Za-z0-9._/-]/g,`-`).replace(/-+/g,`-`).replace(/\/{2,}/g,`/`).replace(/\/-+/g,`/`).replace(/-+\//g,`/`).replace(/^[-/]+/,``).replace(/[-/]+$/,``),Ln=({currentBranch:e,localBranches:t,remoteBranches:n,branchInfo:r,onCheckout:i,onCreate:a,remotes:o=[],disabled:s=!1,iconOnly:c=!1,trigger:l,triggerLabel:u,contentAlign:d,hideTooltip:f=!1,projectRootOption:p=null,worktreeOptions:m=[],selectedDirectory:h=null,onSelectDirectory:g,onCreateWorktree:_,worktreesLabel:v,worktreeNewLabel:y,projectRootLabel:b,onOpenChange:x,open:S,presentation:C=`dropdown`})=>{let{t:w}=ze(),[T,ee]=X.useState(!1),[E,D]=X.useState(``),[O,k]=X.useState(!1),[te,A]=X.useState(!1),[j,N]=X.useState(``),[P,F]=X.useState(!1),ne=X.useRef(null),I=X.useId(),L=S??T,R=e=>{S===void 0&&ee(e),x?.(e)},re=X.useCallback(e=>{e.stopPropagation()},[]),ie=o.length>1,ae=!!(g||_),oe=X.useMemo(()=>In(j),[j]),z=X.useMemo(()=>{let e=E.trim();return e?M(m,e,e=>e.label).map(e=>e.item):m},[E,m]),se=X.useMemo(()=>{if(!p)return!1;let e=E.trim();return!e||M([p],e,e=>[e.label,b??``]).length>0},[b,p,E]),B=t=>{if(t===e){R(!1);return}i(t),R(!1),D(``)},V=e=>{g?.(e),R(!1),D(``)},ce=()=>{k(!0),setTimeout(()=>ne.current?.focus(),50)},le=async()=>{if(!(!oe||P)){if(ie){A(!0);return}F(!0);try{await a(oe,o[0]),N(``),k(!1),R(!1)}finally{F(!1)}}},ue=async e=>{if(!(!oe||P)){F(!0);try{await a(oe,e),N(``),k(!1),A(!1),R(!1)}finally{F(!1)}}},de=()=>{A(!1)},fe=()=>{N(``),k(!1),A(!1)};X.useEffect(()=>{L||(D(``),k(!1),A(!1),N(``))},[L]);let pe=u||e||w(`gitView.branch.detachedHead`),me=d??(c?`end`:`start`),he=v??w(`chat.chatInput.worktrees`),U=y??w(`chat.chatInput.worktreeNew`),ge=b??w(`chat.chatInput.projectRoot`),_e=c?(0,Q.jsx)(`button`,{type:`button`,className:`flex size-6 items-center justify-center rounded text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--interactive-focus-ring)] disabled:cursor-not-allowed disabled:opacity-50`,disabled:s,"aria-label":pe,children:(0,Q.jsx)(Y,{name:`git-branch`,className:`size-3.5`})}):(0,Q.jsxs)(H,{variant:`ghost`,size:`xs`,className:`h-6 min-w-0 max-w-full justify-start gap-1 px-0 hover:bg-transparent`,disabled:s,"aria-label":pe,children:[(0,Q.jsx)(Y,{name:`git-branch`,className:`size-3.5 text-primary`}),(0,Q.jsx)(`span`,{className:`min-w-0 truncate typography-ui-label font-semibold text-left text-foreground`,children:pe}),(0,Q.jsx)(Y,{name:`arrow-down-s`,className:`size-3 shrink-0 text-muted-foreground`})]}),ve=(0,Q.jsx)(Ze,{asChild:!0,disabled:s,children:l??_e}),ye=(0,Q.jsxs)(Tn,{className:`h-full min-h-0`,children:[(0,Q.jsx)(`div`,{"data-mobile-sheet-no-dismiss":C===`mobile-sheet`?``:void 0,children:(0,Q.jsx)(En,{placeholder:w(`gitView.branch.searchPlaceholder`),value:E,onValueChange:D,onKeyDown:re})}),(0,Q.jsxs)(Dn,{scrollbarClassName:`overlay-scrollbar--flush overlay-scrollbar--dense overlay-scrollbar--zero`,disableHorizontal:!0,children:[(0,Q.jsx)(On,{children:w(`gitView.branch.empty`)}),(0,Q.jsx)(kn,{children:te?(0,Q.jsxs)(`div`,{className:`px-2 py-1.5`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 mb-2`,children:[(0,Q.jsx)(`button`,{type:`button`,onClick:de,disabled:P,className:`shrink-0 text-muted-foreground hover:text-foreground disabled:opacity-50`,children:(0,Q.jsx)(Y,{name:`arrow-left`,className:`size-4`})}),(0,Q.jsxs)(`span`,{className:`typography-meta text-muted-foreground`,children:[w(`gitView.branch.pushToPrefix`),` `,(0,Q.jsx)(`span`,{className:`text-foreground font-medium`,children:oe}),` `,w(`gitView.branch.pushToSuffix`)]})]}),(0,Q.jsx)(`div`,{className:`flex flex-col gap-1`,children:o.map(e=>(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>ue(e),disabled:P,className:`flex flex-col items-start gap-0.5 px-2 py-1.5 rounded-md text-left hover:bg-accent disabled:opacity-50`,children:[(0,Q.jsxs)(`span`,{className:`typography-ui-label text-foreground`,children:[P?(0,Q.jsx)(Y,{name:`loader-4`,className:`inline size-3 mr-1.5 animate-spin`}):null,e.name]}),(0,Q.jsx)(`span`,{className:`typography-micro text-muted-foreground truncate max-w-full`,children:e.pushUrl})]},e.name))})]}):O?(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 px-2 py-1.5 rounded-lg`,children:[(0,Q.jsx)(`input`,{ref:ne,placeholder:w(`gitView.branch.newBranchPlaceholder`),value:j,onChange:e=>N(e.target.value),onClick:e=>e.stopPropagation(),onKeyDown:e=>{re(e),e.key===`Enter`?(e.preventDefault(),le()):e.key===`Escape`&&(e.preventDefault(),fe())},className:`flex-1 min-w-0 bg-transparent typography-meta outline-none placeholder:text-muted-foreground`}),(0,Q.jsx)(`button`,{type:`button`,onClick:le,disabled:!oe||P,className:`shrink-0 text-muted-foreground hover:text-foreground disabled:opacity-50`,children:P?(0,Q.jsx)(Y,{name:`loader-4`,className:`size-4 animate-spin`}):(0,Q.jsx)(Y,{name:`add`,className:`size-4`})}),(0,Q.jsx)(`button`,{type:`button`,onClick:fe,disabled:P,className:`shrink-0 text-muted-foreground hover:text-foreground disabled:opacity-50`,children:(0,Q.jsx)(Y,{name:`close`,className:`size-4`})})]}):(0,Q.jsxs)(jn,{onSelect:ce,children:[(0,Q.jsx)(Y,{name:`add`,className:`size-4`}),(0,Q.jsx)(`span`,{children:w(`gitView.branch.create`)})]})}),(0,Q.jsx)(An,{}),(0,Q.jsx)(Mn,{branches:t,search:E,local:!0,currentBranch:e,branchInfo:r,onCheckout:B}),(0,Q.jsx)(An,{}),(0,Q.jsx)(Mn,{branches:n,search:E,onCheckout:B}),ae?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(An,{}),(0,Q.jsxs)(kn,{children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between px-2 py-1.5`,children:[(0,Q.jsx)(`span`,{className:`text-muted-foreground typography-meta`,children:he}),_?(0,Q.jsx)(`button`,{type:`button`,className:`cursor-pointer text-muted-foreground typography-meta hover:text-foreground`,onPointerDown:e=>{e.stopPropagation()},onClick:e=>{e.preventDefault(),e.stopPropagation(),R(!1),_()},children:U}):null]}),p&&se?(0,Q.jsxs)(jn,{onSelect:()=>V(p.value),children:[(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,Q.jsx)(`span`,{className:`typography-micro text-muted-foreground`,children:ge}),(0,Q.jsx)(`span`,{className:`truncate typography-ui-label text-foreground`,children:p.label})]}),h===p.value?(0,Q.jsx)(`span`,{className:`typography-micro text-primary`,children:w(`gitView.branch.currentBadge`)}):null]}):null,(0,Q.jsx)(Fn,{options:z,selectedDirectory:h,onSelect:V})]})]}):null]})]});if(C===`mobile-sheet`){let e=X.cloneElement(l??_e,{onClick:()=>R(!0),"data-popup-open":L?``:void 0});return(0,Q.jsxs)(Q.Fragment,{children:[e,(0,Q.jsx)(He,{id:`mobile-draft-branch-picker-sheet-${I}`,open:L,onOpenChange:R,ariaLabel:w(`gitView.branch.selectBranch`),closeAriaLabel:w(`mobile.surface.closeAria`),resizeAriaLabel:w(`mobile.sessions.sheet.resizeAria`),children:ye})]})}return(0,Q.jsxs)($e,{open:L,onOpenChange:R,children:[f||l?ve:(0,Q.jsxs)(Xe,{children:[(0,Q.jsx)(Je,{asChild:!0,children:ve}),(0,Q.jsx)(Ye,{sideOffset:8,children:c?pe:w(`gitView.branch.currentBranchTooltip`)})]}),(0,Q.jsx)(Qe,{align:me,className:`w-72 p-0 max-h-[60vh] flex flex-col`,children:ye})]})};function Rn(e){let{localBranches:t,remoteBranches:n,query:r}=e,i=r.trim();if(!i)return{matching:[],otherLocal:t,otherRemote:n};let a=M(t,i,e=>e),o=M(n,i,e=>e),s=new Set(a.map(e=>e.item)),c=new Set(o.map(e=>e.item));return{matching:[...a.map(e=>({label:e.item,value:e.item,source:`local`,score:e.score})),...o.map(e=>({label:e.item,value:`remotes/${e.item}`,source:`remote`,score:e.score}))].sort((e,t)=>e.score===t.score?e.source===t.source?e.label.length===t.label.length?e.label.localeCompare(t.label,void 0,{sensitivity:`accent`}):e.label.length-t.label.length:e.source===`local`?-1:1:e.score-t.score).map(({label:e,value:t,source:n})=>({label:e,value:t,source:n})),otherLocal:t.filter(e=>!s.has(e)),otherRemote:n.filter(e=>!c.has(e))}}function zn(e){let t=E(e),n=(e,n={})=>t.json(`/api/github/${e}`,{query:n}),r=e=>e?{owner:e.owner,repo:e.repo}:{};return{authStatus:()=>n(`auth/status`),issuesList:(e,t)=>n(`issues/list`,{directory:e,page:t?.page,query:t?.query}),prsList:(e,t)=>n(`pulls/list`,{directory:e,page:t?.page,query:t?.query}),issueGet:(e,t,i)=>n(`issues/get`,{directory:e,number:t,...r(i?.sourceRepo)}),issueComments:(e,t,i)=>n(`issues/comments`,{directory:e,number:t,...r(i?.sourceRepo)}),prContext:(e,t,i)=>n(`pulls/context`,{directory:e,number:t,...r(i?.sourceRepo),diff:i?.includeDiff?`1`:void 0,checkDetails:i?.includeCheckDetails?`1`:void 0})}}var Bn=e=>({queryKey:[...e.queryScope,`worktree-dialog`,`github-auth`],queryFn:({signal:t})=>E(e).json(`/api/github/auth/status`,{signal:t}),staleTime:3e4,gcTime:1/0});function Vn(e,t){let n=(0,Z.c)(12),r=D(),i=e?void 0:r.github,a;n[0]!==e||n[1]!==i?(a=e?zn(e):i,n[0]=e,n[1]=i,n[2]=a):a=n[2];let o=a,s;n[3]!==e||n[4]!==r?(s=e?Bn(e):dt(r.github),n[3]=e,n[4]=r,n[5]=s):s=n[5];let c;n[6]!==t||n[7]!==s?(c={...s,enabled:t},n[6]=t,n[7]=s,n[8]=c):c=n[8];let l=w(c,O),u;return n[9]!==l||n[10]!==o?(u={github:o,auth:l},n[9]=l,n[10]=o,n[11]=u):u=n[11],u}async function Hn(e,t,n={}){let r=await E(e).json(`/api/magic-prompts`);return(typeof r.overrides?.[t]==`string`?r.overrides[t]:it(t)).replace(/\{\{\s*([a-zA-Z0-9_]+)\s*\}\}/g,(e,t)=>Object.prototype.hasOwnProperty.call(n,t)?n[t]??``:``)}async function Un(e,t,n,r,i,a){let o=zn(t),s=i.issue,l=i.pr;if(!s&&!l)return;let u=s?`issue`:`pr`,d=s?.number??l.number,f=await Hn(t,`github.${u}.review.visible`,{[`${u}_number`]:String(d)}),p=await Hn(t,`github.${u}.review.instructions`),m;if(s){let e=await o.issueGet(t.location.directory,d,{sourceRepo:s.sourceRepo}),n=await o.issueComments(t.location.directory,d,{sourceRepo:s.sourceRepo});if(e.connected===!1||!e.issue||n.connected===!1)throw Error(a);m=`GitHub issue context (JSON)\n${JSON.stringify({repo:e.repo??null,issue:e.issue,comments:n.comments??[]},null,2)}`}else{let e=await o.prContext(t.location.directory,d,{sourceRepo:l.sourceRepo,includeDiff:i.includeDiff,includeCheckDetails:!1});if(e.connected===!1||!e.pr)throw Error(a);m=`GitHub pull request context (JSON)\n${JSON.stringify(e,null,2)}`}t.sdk();let h=e.resolve({...t.location,directory:n});await Me(e,h).state.send({sessionID:r,messageID:c(`msg`),text:[f,p,m].join(`
|
|
3
|
-
|
|
4
|
-
`)})}function Wn(e){let t=(0,Z.c)(41),{project:n,open:r,onClose:i,children:a}=e,o=ee(),s=n?.hostId&&o&&o.entry.location.hubId===n.hubId&&o.entry.location.hostId===n.hostId&&o.entry.location.directory===n.path,c=Le(!!(r&&n?.hostId&&!s)),{t:l}=ze();if(!n?.hostId){let e;return t[0]===a?e=t[1]:(e=(0,Q.jsx)(T.Provider,{value:null,children:a}),t[0]=a,t[1]=e),e}if(s)return a;if(!r)return null;if(!c.registry||c.registry.hubId!==n.hubId){let e;t[2]===i?e=t[3]:(e=e=>{e||i()},t[2]=i,t[3]=e);let n;t[4]===l?n=t[5]:(n=l(`session.newWorktree.title`),t[4]=l,t[5]=n);let r;t[6]===n?r=t[7]:(r=(0,Q.jsx)(Ue,{children:(0,Q.jsx)(Ke,{children:n})}),t[6]=n,t[7]=r);let a=c.isPending?`status`:`alert`,o;t[8]!==c.error?.message||t[9]!==c.isPending||t[10]!==l?(o=c.isPending?l(`remoteProjects.running`):c.error?.message||l(`remoteProjects.host-unavailable`),t[8]=c.error?.message,t[9]=c.isPending,t[10]=l,t[11]=o):o=t[11];let s;t[12]!==a||t[13]!==o?(s=(0,Q.jsx)(`p`,{role:a,children:o}),t[12]=a,t[13]=o,t[14]=s):s=t[14];let u;t[15]===l?u=t[16]:(u=l(`session.newWorktree.actions.cancel`),t[15]=l,t[16]=u);let d;t[17]!==i||t[18]!==u?(d=(0,Q.jsx)(H,{onClick:i,children:u}),t[17]=i,t[18]=u,t[19]=d):d=t[19];let f;t[20]!==c.isPending||t[21]!==l?(f=c.isPending?null:(0,Q.jsx)(H,{onClick:Gn,children:l(`remoteProjects.retry`)}),t[20]=c.isPending,t[21]=l,t[22]=f):f=t[22];let p;t[23]!==d||t[24]!==f?(p=(0,Q.jsxs)(We,{children:[d,f]}),t[23]=d,t[24]=f,t[25]=p):p=t[25];let m;t[26]!==p||t[27]!==r||t[28]!==s?(m=(0,Q.jsxs)(Ge,{children:[r,s,p]}),t[26]=p,t[27]=r,t[28]=s,t[29]=m):m=t[29];let h;return t[30]!==e||t[31]!==m?(h=(0,Q.jsx)(qe,{open:!0,onOpenChange:e,children:m}),t[30]=e,t[31]=m,t[32]=h):h=t[32],h}let u;t[33]!==n.hostId||t[34]!==n.hubId||t[35]!==n.path?(u={hubId:n.hubId,hostId:n.hostId,directory:n.path},t[33]=n.hostId,t[34]=n.hubId,t[35]=n.path,t[36]=u):u=t[36];let d;return t[37]!==a||t[38]!==c.registry||t[39]!==u?(d=(0,Q.jsx)(k,{registry:c.registry,location:u,children:a}),t[37]=a,t[38]=c.registry,t[39]=u,t[40]=d):d=t[40],d}function Gn(){Re().catch(Kn)}function Kn(){}var qn=(e,t,n)=>{let r=n??t;return r?e.find(e=>e.id===r)??null:null};function Jn(e,t){return`${e}\0${t}`}function Yn(e){let t=(0,Z.c)(12),n;t[0]===e.projectId?n=t[1]:(n=t=>qn(t.projects,t.activeProjectId,e.projectId),t[0]=e.projectId,t[1]=n);let r=P(n),i;t[2]===e?i=t[3]:(i=()=>e.onOpenChange(!1),t[2]=e,t[3]=i);let a=r?.id,o;t[4]!==e||t[5]!==a?(o=(0,Q.jsx)(Xn,{...e},a),t[4]=e,t[5]=a,t[6]=o):o=t[6];let s;return t[7]!==r||t[8]!==e.open||t[9]!==i||t[10]!==o?(s=(0,Q.jsx)(Wn,{project:r,open:e.open,onClose:i,children:o}),t[7]=r,t[8]=e.open,t[9]=i,t[10]=o,t[11]=s):s=t[11],s}function Xn({open:e,onOpenChange:t,onSelect:n,projectId:r}){let{t:i}=ze(),a=j(e=>e.isMobile),o=ee(),s=o?.entry.location.hostId?o.entry:void 0,{git:c}=et(),{github:l,auth:u}=Vn(s,e),d=u.data??null,f=u.isFetched,p=j(e=>e.setSettingsDialogOpen),m=j(e=>e.setSettingsPage),h=P(e=>qn(e.projects,e.activeProjectId,r)),g=h?.id??null,_=h?.path??null,v=X.useMemo(()=>_&&g?{id:g,path:_,hostId:h?.hostId,hubId:h?.hubId}:null,[g,_,h?.hostId,h?.hubId]),[y,b]=X.useState(`issues`),[x,S]=X.useState(``),[C,w]=X.useState([]),[T,E]=X.useState([]),[D,O]=X.useState(!1),[k,A]=X.useState(!1),[M,N]=X.useState(null),[F,ne]=X.useState(null),[I,L]=X.useState(null),[R,re]=X.useState(!1),[ie,ae]=X.useState(new Map),[oe,z]=X.useState(1),[se,B]=X.useState(!1),V=X.useRef(0),ce=ct(x,350),le=te(async e=>{if(!(!_||!l)&&!(f&&d?.connected===!1)){O(!0),N(null),z(1),B(!1);try{if(y===`issues`&&l.issuesList){let t=await l.issuesList(_,{page:1,query:e});t.connected===!1?(N(i(`session.githubIntegration.error.notConnected`)),w([])):(w(t.issues??[]),z(t.page??1),B(!!t.hasMore))}else if(y===`prs`&&l.prsList){let t=await l.prsList(_,{page:1,query:e});t.connected===!1?(N(i(`session.githubIntegration.error.notConnected`)),E([])):(E(t.prs??[]),z(t.page??1),B(!!t.hasMore))}}catch(e){N(e instanceof Error?e.message:i(`session.githubIntegration.error.loadDataFailed`))}finally{O(!1)}}});X.useEffect(()=>{if(!e||!_||f&&d?.connected===!1||!l)return;if(!ce.trim()){le();return}let t=new AbortController;O(!0),N(null),z(1),B(!1);let n=y===`issues`&&l.issuesList?l.issuesList(_,{page:1,query:ce.trim()}):y===`prs`&&l.prsList?l.prsList(_,{page:1,query:ce.trim()}):null;if(!n){O(!1);return}return n.then(e=>{t.signal.aborted||(`issues`in e?e.connected===!1?(N(i(`session.githubIntegration.error.notConnected`)),w([])):(w(e.issues??[]),z(e.page??1),B(!!e.hasMore)):`prs`in e&&(e.connected===!1?(N(i(`session.githubIntegration.error.notConnected`)),E([])):(E(e.prs??[]),z(e.page??1),B(!!e.hasMore))))}).catch(e=>{t.signal.aborted||N(e instanceof Error?e.message:i(`session.githubIntegration.error.loadDataFailed`))}).finally(()=>{t.signal.aborted||O(!1)}),()=>t.abort()},[e,_,l,f,d,y,ce,le,i]);let ue=te(async()=>{if(!(!_||!l)&&!(D||k)&&se){A(!0);try{let e=oe+1;if(y===`issues`&&l.issuesList){let t=ce.trim()?await l.issuesList(_,{page:e,query:ce.trim()}):await l.issuesList(_,{page:e});t.connected!==!1&&(w(e=>[...e,...t.issues??[]]),z(t.page??e),B(!!t.hasMore))}else if(y===`prs`&&l.prsList){let t=ce.trim()?await l.prsList(_,{page:e,query:ce.trim()}):await l.prsList(_,{page:e});t.connected!==!1&&(E(e=>[...e,...t.prs??[]]),z(t.page??e),B(!!t.hasMore))}}catch{}finally{A(!1)}}});X.useEffect(()=>{if(!e){b(`issues`),S(``),w([]),E([]),ne(null),L(null),re(!1),N(null),ae(new Map),z(1),B(!1);return}le()},[e,le]),X.useEffect(()=>{V.current+=1,ae(new Map)},[_,v]);let de=te(async e=>{if(!v||!e)return;let t=Jn(v.path,e);if(ie.has(t))return;let n=V.current;try{let r={mode:`new`,branchName:e,worktreeName:e},a=s?await c.validateGitWorktree(v.path,r):await ft(v,r);if(n!==V.current)return;let o=a.errors.find(e=>e.code===`branch_in_use`);ae(e=>new Map(e).set(t,{isValid:!o,error:o?i(o.code===`branch_exists`?`session.githubIntegration.validation.branchAlreadyExists`:`session.githubIntegration.validation.branchAlreadyCheckedOut`):null}))}catch{if(n!==V.current)return;ae(e=>new Map(e).set(t,{isValid:!1,error:i(`session.githubIntegration.validation.failed`)}))}});X.useEffect(()=>{!e||y!==`prs`||T.forEach(e=>{e.head&&de(e.head)})},[e,y,T,_,v,de]);let fe=f&&d?.connected===!0,pe=()=>{if(s){K.info(i(`remoteProjects.configurationReadOnly`));return}m(`github`),p(!0)},me=e=>{ne(e),L(null)},he=e=>{L(e),ne(null)},U=()=>{F?n({type:`issue`,item:F}):I&&n({type:`pr`,item:I,includeDiff:R}),t(!1)},ge=()=>{ne(null),L(null),re(!1)},_e=F||(I?.head&&_?ie.get(Jn(_,I.head))?.isValid!==!1:!1),ve=e=>!e.head||(_?ie.get(Jn(_,e.head)):void 0)?.isValid===!1,ye=(0,Q.jsxs)(Q.Fragment,{children:[s&&u.error?(0,Q.jsxs)(`div`,{role:`alert`,className:`typography-small text-destructive`,children:[u.error.message,(0,Q.jsx)(H,{variant:`ghost`,size:`xs`,onClick:()=>{u.refetch()},children:i(`remoteProjects.retry`)})]}):null,fe?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`yuri-picker-search relative mt-2`,children:[(0,Q.jsx)(Y,{name:`search`,className:`absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground`}),(0,Q.jsx)(st,{value:x,onChange:e=>S(e.target.value),placeholder:i(y===`issues`?`session.githubIntegration.search.issuesPlaceholder`:`session.githubIntegration.search.prsPlaceholder`),className:`h-8 pl-9`})]}),(0,Q.jsx)(`div`,{className:`yuri-picker-list mt-2 h-[300px] overflow-hidden`,children:(0,Q.jsxs)(`div`,{className:`h-full overflow-y-auto`,children:[D&&(0,Q.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,Q.jsx)(Y,{name:`loader-4`,className:`h-5 w-5 animate-spin text-muted-foreground`})}),M&&(0,Q.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 p-2 rounded-md bg-destructive/10 text-destructive`,children:[(0,Q.jsx)(Y,{name:`error-warning`,className:`h-4 w-4`}),(0,Q.jsx)(`span`,{className:`typography-small`,children:M})]})}),!D&&!M&&y===`issues`&&(0,Q.jsxs)(`div`,{className:`space-y-0.5 min-h-full`,children:[C.length>0?C.map(e=>(0,Q.jsx)(`button`,{onClick:()=>me(e),className:G(`yuri-picker-row w-full text-left px-2 py-1.5 rounded transition-colors`,F?.number===e.number?`bg-interactive-selection text-interactive-selection-foreground`:`hover:bg-interactive-hover`),children:(0,Q.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,Q.jsxs)(`span`,{className:`text-muted-foreground shrink-0 typography-micro`,children:[`#`,e.number]}),(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`span`,{className:`yuri-picker-label typography-small line-clamp-2`,children:e.title}),e.sourceRepo?.source===`upstream`?(0,Q.jsxs)(`span`,{className:`typography-micro px-1 py-0.5 rounded bg-status-info/10 text-status-info mt-0.5 inline-block`,children:[e.sourceRepo.owner,`/`,e.sourceRepo.repo]}):null]})]})},`${e.sourceRepo?.owner??``}-${e.sourceRepo?.repo??``}-${e.number}`)):(0,Q.jsx)(`div`,{className:`flex items-center justify-center h-[300px] text-center typography-small text-muted-foreground`,children:i(`session.githubIntegration.empty.noIssuesFound`)}),se&&!k&&(0,Q.jsx)(`div`,{className:`flex justify-center pt-2`,children:(0,Q.jsx)(H,{variant:`ghost`,size:`sm`,onClick:()=>void ue(),className:`h-7 text-xs`,children:i(`session.githubIntegration.actions.loadMore`)})}),k&&(0,Q.jsx)(`div`,{className:`flex items-center justify-center py-2`,children:(0,Q.jsx)(Y,{name:`loader-4`,className:`h-4 w-4 animate-spin text-muted-foreground`})})]}),!D&&!M&&y===`prs`&&(0,Q.jsxs)(`div`,{className:`space-y-0.5 min-h-full`,children:[T.length>0?T.map(e=>{let t=ve(e),n=e.head&&_?ie.get(Jn(_,e.head)):void 0;return(0,Q.jsx)(`button`,{onClick:()=>!t&&he(e),disabled:t,className:G(`yuri-picker-row w-full text-left px-2 py-1.5 rounded transition-colors`,I?.number===e.number?`bg-interactive-selection text-interactive-selection-foreground`:t?`opacity-50 cursor-not-allowed`:`hover:bg-interactive-hover`),children:(0,Q.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,Q.jsxs)(`span`,{className:`text-muted-foreground shrink-0 typography-micro`,children:[`#`,e.number]}),(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`span`,{className:`yuri-picker-label typography-small line-clamp-1`,children:e.title}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 mt-0.5`,children:[(0,Q.jsxs)(`span`,{className:`typography-micro text-muted-foreground`,children:[e.head,` → `,e.base]}),e.sourceRepo?.source===`upstream`?(0,Q.jsxs)(`span`,{className:`typography-micro px-1 py-0.5 rounded bg-status-info/10 text-status-info`,children:[e.sourceRepo.owner,`/`,e.sourceRepo.repo]}):null,t&&n?.error&&(0,Q.jsx)(`span`,{className:`typography-micro text-destructive`,children:n.error})]})]})]})},`${e.sourceRepo?.owner??``}-${e.sourceRepo?.repo??``}-${e.number}`)}):(0,Q.jsx)(`div`,{className:`flex items-center justify-center h-[300px] text-center typography-small text-muted-foreground`,children:i(`session.githubIntegration.empty.noPullRequestsFound`)}),se&&!k&&(0,Q.jsx)(`div`,{className:`flex justify-center pt-2`,children:(0,Q.jsx)(H,{variant:`ghost`,size:`sm`,onClick:()=>void ue(),className:`h-7 text-xs`,children:i(`session.githubIntegration.actions.loadMore`)})}),k&&(0,Q.jsx)(`div`,{className:`flex items-center justify-center py-2`,children:(0,Q.jsx)(Y,{name:`loader-4`,className:`h-4 w-4 animate-spin text-muted-foreground`})})]})]})})]}):(0,Q.jsxs)(`div`,{className:`flex-1 flex flex-col items-center justify-center p-8 gap-4`,children:[(0,Q.jsx)(Y,{name:`github`,className:`h-12 w-12 text-muted-foreground`}),(0,Q.jsxs)(`div`,{className:`text-center`,children:[(0,Q.jsx)(`p`,{className:`typography-ui-label text-foreground`,children:i(`session.githubIntegration.connect.title`)}),(0,Q.jsx)(`p`,{className:`typography-small text-muted-foreground mt-1`,children:i(`session.githubIntegration.connect.description`)})]}),(0,Q.jsx)(H,{onClick:pe,size:`sm`,children:i(`session.githubIntegration.connect.action`)})]})]}),be=(0,Q.jsxs)(`div`,{className:G(`w-full`,a?`flex flex-col gap-2`:`flex flex-row items-center`),children:[(0,Q.jsxs)(`div`,{className:G(`flex items-center gap-4`,a?`w-full justify-center order-1`:`flex-1`),children:[!a&&(F||I)&&(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Q.jsx)(Y,{name:`check`,className:`h-3.5 w-3.5 text-status-success shrink-0`}),(0,Q.jsx)(`span`,{className:`typography-small truncate max-w-[150px]`,children:F?i(`session.githubIntegration.selected.issueNumber`,{number:F.number}):i(`session.githubIntegration.selected.prNumber`,{number:I?.number??``})}),(0,Q.jsx)(`button`,{onClick:ge,className:`text-muted-foreground hover:text-foreground shrink-0 p-0.5 rounded hover:bg-muted transition-colors`,children:(0,Q.jsx)(Y,{name:`close`,className:`h-3.5 w-3.5`})})]}),y===`prs`&&I&&(0,Q.jsxs)(`label`,{className:`flex items-center gap-2 cursor-pointer h-8`,children:[(0,Q.jsx)(lt,{checked:R,onChange:e=>re(e),ariaLabel:i(`session.githubIntegration.includeDiffAria`)}),(0,Q.jsx)(`span`,{className:`typography-small text-foreground`,children:i(`session.githubIntegration.includeDiff`)})]})]}),(0,Q.jsxs)(`div`,{className:G(`flex gap-2`,a?`w-full order-2`:`justify-end`),children:[(0,Q.jsx)(H,{variant:`outline`,size:`sm`,onClick:()=>t(!1),className:G(a&&`flex-1`),children:i(`session.githubIntegration.actions.cancel`)}),(0,Q.jsx)(H,{size:`sm`,onClick:U,disabled:!_e,className:G(a&&`flex-1`),children:i(`session.githubIntegration.actions.select`)})]})]});return(0,Q.jsx)(Q.Fragment,{children:a?(0,Q.jsx)(ut,{open:e,title:i(`session.githubIntegration.title`),onClose:()=>t(!1),footer:fe?be:void 0,renderHeader:e=>(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2 px-3 py-2 border-b border-border/40`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Q.jsx)(`h2`,{className:`typography-ui-label font-semibold text-foreground`,children:i(`session.githubIntegration.title`)}),e]}),(0,Q.jsx)(`div`,{className:`w-full`,children:(0,Q.jsx)(wt,{items:[{id:`issues`,label:i(`session.githubIntegration.tabs.issues`),icon:(0,Q.jsx)(Y,{name:`git-branch`,className:`h-3.5 w-3.5`})},{id:`prs`,label:i(`session.githubIntegration.tabs.pullRequests`),icon:(0,Q.jsx)(Y,{name:`git-pull-request`,className:`h-3.5 w-3.5`})}],activeId:y,onSelect:e=>{b(e),S(``)},variant:`active-pill`,layoutMode:`fit`})}),(F||I)&&(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 px-2 py-1 rounded-md bg-muted/50 border border-border/50`,children:[(0,Q.jsx)(Y,{name:`check`,className:`h-3.5 w-3.5 text-status-success shrink-0`}),(0,Q.jsx)(`span`,{className:`typography-small truncate flex-1`,children:F?i(`session.githubIntegration.selected.issueNumber`,{number:F.number}):i(`session.githubIntegration.selected.prNumber`,{number:I?.number??``})}),(0,Q.jsx)(`button`,{onClick:ge,className:`text-muted-foreground hover:text-foreground shrink-0 p-0.5 rounded hover:bg-muted transition-colors`,children:(0,Q.jsx)(Y,{name:`close`,className:`h-3.5 w-3.5`})})]})]}),children:ye}):(0,Q.jsx)(qe,{open:e,onOpenChange:t,children:(0,Q.jsxs)(Ge,{presentation:`picker`,children:[(0,Q.jsx)(Ue,{className:`yuri-picker-header`,children:(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-3`,children:[(0,Q.jsx)(Ke,{className:`yuri-picker-title`,children:i(`session.githubIntegration.title`)}),(0,Q.jsx)(`div`,{className:`w-[220px]`,children:(0,Q.jsx)(wt,{items:[{id:`issues`,label:i(`session.githubIntegration.tabs.issues`),icon:(0,Q.jsx)(Y,{name:`git-branch`,className:`h-3.5 w-3.5`})},{id:`prs`,label:i(`session.githubIntegration.tabs.pullRequests`),icon:(0,Q.jsx)(Y,{name:`git-pull-request`,className:`h-3.5 w-3.5`})}],activeId:y,onSelect:e=>{b(e),S(``)},variant:`active-pill`,layoutMode:`fit`})})]})}),ye,(0,Q.jsx)(We,{className:`yuri-picker-footer`,children:be})]})})})}var Zn=e=>e.trim().replace(/^refs\/heads\//,``).replace(/^heads\//,``).replace(/\s+/g,`-`).replace(/^\/+|\/+$/g,``),$=e=>e.trim().replace(/^refs\/heads\//,``).replace(/^heads\//,``).replace(/\s+/g,`-`).replace(/^\/+|\/+$/g,``).split(`/`).join(`-`).replace(/[^A-Za-z0-9._-]+/g,`-`).replace(/-+/g,`-`).replace(/^-+|-+$/g,``).slice(0,80),Qn=e=>String(e||``).trim().toLowerCase().replace(/[^a-z0-9._-]+/g,`-`).replace(/-+/g,`-`).replace(/^-+|-+$/g,``)||`pr-head`,$n=(e,t,n)=>{let r=Zn(e.head||``);if(!r)throw Error(`PR head branch is missing`);if(t.includes(r))return{existingBranch:r,setUpstream:void 0,upstreamRemote:void 0,upstreamBranch:void 0,ensureRemoteName:void 0,ensureRemoteUrl:void 0,sourceLabel:r};let i=n.find(e=>{let t=e.indexOf(`/`);return t<=0||t>=e.length-1?!1:e.slice(t+1)===r});if(i){let e=i.indexOf(`/`),t=i.slice(0,e);return{existingBranch:`remotes/${i}`,setUpstream:!0,upstreamRemote:t,upstreamBranch:r,ensureRemoteName:void 0,ensureRemoteUrl:void 0,sourceLabel:`${t}/${r}`}}let a=String(e.headLabel||``).split(`:`)[0]?.trim(),o=`pr-${Qn(e.headRepo?.owner||a||`pr-head`)}`,s=e.headRepo?.sshUrl||e.headRepo?.cloneUrl||``;if(!s)throw Error(`PR head repository URL is unavailable`);return{existingBranch:`remotes/${o}/${r}`,setUpstream:!0,upstreamRemote:o,upstreamBranch:r,ensureRemoteName:o,ensureRemoteUrl:s,sourceLabel:`${o}/${r}`}},er=e=>{let t={repo:e.repo??null,issue:e.issue,comments:e.comments};return`GitHub issue context (JSON)\n${JSON.stringify(t,null,2)}`},tr=e=>`GitHub pull request context (JSON)\n${JSON.stringify(e,null,2)}`;function nr(e){let t=(0,Z.c)(12),n;t[0]===e.projectId?n=t[1]:(n=t=>qn(t.projects,t.activeProjectId,e.projectId),t[0]=e.projectId,t[1]=n);let r=P(n),i;t[2]===e?i=t[3]:(i=()=>e.onOpenChange(!1),t[2]=e,t[3]=i);let a=r?.id,o;t[4]!==e||t[5]!==a?(o=(0,Q.jsx)(rr,{...e},a),t[4]=e,t[5]=a,t[6]=o):o=t[6];let s;return t[7]!==r||t[8]!==e.open||t[9]!==i||t[10]!==o?(s=(0,Q.jsx)(Wn,{project:r,open:e.open,onClose:i,children:o}),t[7]=r,t[8]=e.open,t[9]=i,t[10]=o,t[11]=s):s=t[11],s}function rr({open:e,onOpenChange:t,onWorktreeCreated:n,projectId:r}){let{t:i}=ze(),{git:a}=et(),o=ee(),s=o?.entry.location.hostId?o.entry:void 0,{github:c,auth:l}=Vn(s,e),u=j(e=>e.isMobile),d=X.useId(),f=l.data??null,p=l.isFetched,m=P(e=>qn(e.projects,e.activeProjectId,r)),h=m?.path??null,g=X.useMemo(()=>h&&m?{id:m.id,path:h,hostId:m.hostId,hubId:m.hubId}:null,[m,h]),[_,v]=X.useState(`new-branch`),[y,b]=X.useState({branchName:``,worktreeName:``,isSyncingWorktreeName:!0,sourceBranch:``,linkedIssue:null,linkedPr:null,includePrDiff:!1}),[x,S]=X.useState({selectedBranch:``,worktreeName:``}),C=ot(h),T=at(e=>h?e.directories.get(h)?.isLoadingBranches??!1:!1),E=at(e=>e.fetchBranches),D=X.useMemo(()=>C?.all?C.all.filter(e=>!e.startsWith(`remotes/`)).sort():[],[C]),k=X.useMemo(()=>C?.all?C.all.filter(e=>e.startsWith(`remotes/`)).map(e=>e.replace(/^remotes\//,``)).sort():[],[C]),te=U(e=>e.availableWorktreesByProject),A=w({queryKey:[...s?.queryScope??[`local`],`worktree-dialog`,`worktrees`],enabled:!!(s&&e&&h),queryFn:()=>a.listGitWorktrees(h),staleTime:3e4,gcTime:1/0},O),M=X.useMemo(()=>{if(!h)return new Set;let e=s?A.data??[]:te.get(h)??[];return new Set(e.map(e=>e.name))},[te,h,s,A.data]),N=X.useCallback((e=10)=>{for(let t=0;t<e;t++){let e=cn();if(!M.has(e))return e}return`${cn()}-${Date.now().toString(36).slice(-4)}`},[M]),[F,I]=X.useState(!1),[L,R]=X.useState(!1),[re,ie]=X.useState(!1),[ae,oe]=X.useState(!1),[z,se]=X.useState(!1),[B,ce]=X.useState(``),[le,ue]=X.useState(``),pe=X.useRef(null),me=X.useRef(null),ge=X.useRef(null),_e=X.useRef(null),ve=X.useCallback(e=>{e.stopPropagation()},[]),ye=X.useCallback(e=>{let t=e;for(;t&&t!==document.body;){let{overflowY:e}=window.getComputedStyle(t);if((e===`auto`||e===`scroll`)&&t.scrollHeight>t.clientHeight)return t;t=t.parentElement}return null},[]),be=X.useCallback(e=>{e&&(e.scrollTop=0)},[]),xe=X.useCallback(e=>{let t=e.current?.querySelector(`[data-slot="command-list"]`)??null;be(t)},[be]),Se=X.useCallback(e=>{let t=ye(e.current);be(t)},[ye,be]),Ce=X.useMemo(()=>Rn({localBranches:D,remoteBranches:k,query:B}),[D,k,B]),W=X.useMemo(()=>Rn({localBranches:D,remoteBranches:k,query:le}),[D,k,le]),Te=B.trim().length>0,Ee=le.trim().length>0,De=Ce.matching.length>0,Oe=W.matching.length>0,Me=!!(h&&a),Ne=X.useCallback(()=>{!h||!a||E(h,a)},[h,a,E]);X.useEffect(()=>{!e||!h||!a||C?.all||E(h,a)},[e,h,a,C?.all,E]),X.useEffect(()=>{!L&&!ae&&ce(``)},[L,ae]),X.useEffect(()=>{!re&&!z&&ue(``)},[re,z]),X.useEffect(()=>{L&&xe(pe),ae&&Se(ge)},[L,ae,B,xe,Se]),X.useEffect(()=>{re&&xe(me),z&&Se(_e)},[re,z,le,xe,Se]);let[q,J]=X.useState({isValidating:!1,branchError:null,worktreeError:null,touched:!1}),[Pe,Fe]=X.useState(!1),[Ie,Le]=X.useState(null),Re=X.useCallback(()=>{let e=de.getState(),t=e.getVisibleAgents();if(e.settingsDefaultAgent){let n=t.find(t=>t.name===e.settingsDefaultAgent);if(n)return n.name}return t.find(e=>e.name===`build`)?.name||t[0]?.name},[]),Be=X.useCallback(()=>{let e=de.getState(),t=e.settingsDefaultModel??(e.currentModelId?void 0:e.opencodeDefaultModel);if(!t)return null;let n=ne(t);if(!n)return null;let{providerId:r,modelId:i}=n;return{providerID:r,modelID:i}},[]),Je=X.useCallback((e,t)=>{let n=de.getState(),r=ne(n.settingsDefaultModel??n.opencodeDefaultModel),i=r?.providerId===e&&r.modelId===t?r.variant??n.settingsDefaultVariant:void 0,a=n.currentProviderId===e&&n.currentModelId===t?n.currentVariant:void 0;return i??a},[]),Ye=X.useCallback(async e=>{if(!h||!c)return;let t=de.getState(),n=Ae.getState().lastUsedProvider,r=Be(),a=r?.providerID||t.currentProviderId||n?.providerID,o=r?.modelID||t.currentModelId||n?.modelID,s=Re()||t.currentAgentName||void 0;if(!a||!o){K.error(i(`session.newWorktree.error.noModelSelected`));return}let l=Je(a,o);if(e.issue){if(!c.issueGet||!c.issueComments)return;let t=await c.issueGet(h,e.issue.number,{sourceRepo:e.issue.sourceRepo??null});if(t.connected===!1||!t.repo||!t.issue)throw Error(`Failed to load issue context`);let n=await c.issueComments(h,e.issue.number,{sourceRepo:e.issue.sourceRepo??null});if(n.connected===!1)throw Error(`Failed to load issue comments`);let r=await tt(`github.issue.review.visible`,{issue_number:String(e.issue.number)}),u=await tt(`github.issue.review.instructions`),d=er({repo:t.repo,issue:t.issue,comments:n.comments??[]});await U.getState().sendMessage(r,a,o,s,void 0,void 0,[{text:u,synthetic:!0},{text:d,synthetic:!0}],l,void 0,{sessionId:e.sessionId}),K.success(i(`session.newWorktree.toast.sessionFromIssue`));return}if(e.pr){if(!c.prContext)return;let t=await c.prContext(h,e.pr.number,{sourceRepo:e.pr.sourceRepo??null,includeDiff:e.includeDiff,includeCheckDetails:!1});if(t.connected===!1||!t.repo||!t.pr)throw Error(`Failed to load PR context`);let n=await tt(`github.pr.review.visible`,{pr_number:String(e.pr.number)}),r=await tt(`github.pr.review.instructions`),u=tr(t);await U.getState().sendMessage(n,a,o,s,void 0,void 0,[{text:r,synthetic:!0},{text:u,synthetic:!0}],l,void 0,{sessionId:e.sessionId}),K.success(i(`session.newWorktree.toast.sessionFromPr`))}},[c,h,Re,Be,Je,i]),Xe=_===`new-branch`?y:x;X.useEffect(()=>{if(!e||!C?.all||!h||y.sourceBranch)return;let t=y.sourceBranch,n=!1;return(async()=>{try{let e=s?(await a.getGitStatus(h)).current:await mt(h).catch(()=>null);if(n)return;let r=localStorage.getItem(xt),{sourceBranch:i,shouldClearSavedSourceBranch:o}=vt({branches:C.all,savedSourceBranch:r,rootBranch:e});if(o&&localStorage.removeItem(xt),n||t)return;i&&b(e=>({...e,sourceBranch:i}))}catch{}})(),()=>{n=!0}},[e,C?.all,h,y.sourceBranch,s,a]),X.useLayoutEffect(()=>{if(!e)return;v(`new-branch`),S({selectedBranch:``,worktreeName:``}),R(!1),ie(!1),oe(!1),se(!1),ce(``),ue(``),J({isValidating:!1,branchError:null,worktreeError:null,touched:!1});let t=N();b({branchName:t,worktreeName:t,isSyncingWorktreeName:!0,sourceBranch:``,linkedIssue:null,linkedPr:null,includePrDiff:!1})},[e,N]),X.useEffect(()=>{if(_!==`new-branch`||!y.isSyncingWorktreeName)return;let e=$(Zn(y.branchName));b(t=>({...t,worktreeName:e}))},[_,y.branchName,y.isSyncingWorktreeName]);let nt=X.useCallback(async()=>{if(!g||!q.touched||Pe)return;Ie&&Ie.abort();let e=new AbortController;Le(e),J(e=>({...e,isValidating:!0}));try{let t=_===`new-branch`?y.branchName:x.selectedBranch,n=Xe.worktreeName,r=Zn(t),o=$(n),c=null,l=null;if(r||(c=i(`session.newWorktree.error.branchNameRequired`)),o||(l=i(`session.newWorktree.error.worktreeDirectoryRequired`)),r&&o){let t=_===`new-branch`?y.linkedPr:null,n=t?$n(t,D,k):null,i={mode:_===`existing-branch`||n?`existing`:`new`,branchName:r,worktreeName:o,existingBranch:n?.existingBranch??(_===`existing-branch`?r:void 0),...n?.ensureRemoteName?{ensureRemoteName:n.ensureRemoteName}:{},...n?.ensureRemoteUrl?{ensureRemoteUrl:n.ensureRemoteUrl}:{}},u=s?await a.validateGitWorktree(h,i):await ft(g,i);if(e.signal.aborted)return;u.ok||u.errors.forEach(e=>{if(e.code===`worktree_exists`){l??=e.message;return}e.code.startsWith(`branch_`)&&(c??=e.message)})}e.signal.aborted||J(e=>({...e,isValidating:!1,branchError:c,worktreeError:l}))}catch{e.signal.aborted||J(e=>({...e,isValidating:!1}))}},[s,a,h,g,_,y.branchName,y.linkedPr,x.selectedBranch,Xe.worktreeName,D,k,q.touched,Ie,Pe,i]),rt=_===`new-branch`?y.branchName:x.selectedBranch;X.useEffect(()=>{if(!e||!g||!q.touched||Pe)return;let t=setTimeout(()=>{nt()},300);return()=>clearTimeout(t)},[Xe.worktreeName,rt,e,g,nt,q.touched,Pe]);let it=async()=>{if(!g||!h){K.error(i(`session.newWorktree.error.noActiveProject`));return}J(e=>({...e,touched:!0}));let e=_===`new-branch`?y.branchName:x.selectedBranch,r=Xe.worktreeName,a=Zn(e),c=$(r);if(!a){K.error(i(`session.newWorktree.error.branchNameRequired`));return}if(!c){K.error(i(`session.newWorktree.error.worktreeDirectoryRequired`));return}Ie&&(Ie.abort(),Le(null)),J(e=>({...e,isValidating:!1,branchError:null,worktreeError:null})),Fe(!0);try{let e=_===`new-branch`?y.linkedPr:null,r=_===`new-branch`?y.linkedIssue:null,l=_===`new-branch`?y.linkedPr:null,u=_===`new-branch`&&y.includePrDiff,d=!!(r||l);if(s&&o&&m?.hostId){let l=m;P.getState().setActiveProjectIdOnly(l.id);let f=e?$n(e,D,k):null,p=r?`#${r.number} ${r.title}`.trim():e?`#${e.number} ${e.title}`.trim():void 0,h=await un(l,{mode:f||_===`existing-branch`?`existing`:`new`,worktreeName:c,branchName:_===`new-branch`?a:void 0,existingBranch:f?.existingBranch??(_===`existing-branch`?a:void 0),..._===`new-branch`&&!f&&y.sourceBranch?{startRef:y.sourceBranch}:{},...f?{setUpstream:f.setUpstream,upstreamRemote:f.upstreamRemote,upstreamBranch:f.upstreamBranch,...f.ensureRemoteName?{ensureRemoteName:f.ensureRemoteName}:{},...f.ensureRemoteUrl?{ensureRemoteUrl:f.ensureRemoteUrl}:{}}:{}},{title:p,createSession:d,kind:e?`pr`:`standard`,createdFromBranch:f?.sourceLabel??y.sourceBranch,isSelected:()=>P.getState().activeProjectId===l.id});s.sdk();let g=V.getState().remoteSession;g?.projectId===l.id&&g.location.hubId===s.location.hubId&&g.location.hostId===s.location.hostId&&g.location.directory===h.path&&g.sessionId===(h.id??null)&&n?.(h.path,{...h.id?{sessionId:h.id}:{},remote:!0}),t(!1),K.success(i(`session.newWorktree.toast.worktreeCreated`)),h.id&&d&&Un(o.registry,s,h.path,h.id,{issue:r,pr:e,includeDiff:u},i(`session.newWorktree.error.sendGitHubContextFailed`)).catch(e=>{K.error(i(`session.newWorktree.error.sendGitHubContextFailed`),{description:e instanceof Error?e.message:String(e)})});return}let[f,p]=await Promise.all([je(g),gt(h)]),v=y.sourceBranch,b=``,S=(()=>{if(e){let t=$n(e,D,k);return b=t.sourceLabel,{preferredName:a||c,mode:`existing`,branchName:a,worktreeName:c,existingBranch:t.existingBranch,setupCommands:f,setUpstream:t.setUpstream,upstreamRemote:t.upstreamRemote,upstreamBranch:t.upstreamBranch,returnAfterDirectoryCreated:!0,...t.ensureRemoteName?{ensureRemoteName:t.ensureRemoteName}:{},...t.ensureRemoteUrl?{ensureRemoteUrl:t.ensureRemoteUrl}:{}}}return b=_===`new-branch`?v:``,{preferredName:a||c,mode:_===`existing-branch`?`existing`:`new`,branchName:_===`existing-branch`?void 0:a,worktreeName:c,existingBranch:_===`existing-branch`?a:void 0,setupCommands:f,returnAfterDirectoryCreated:!0,...v&&_===`new-branch`?{startRef:v}:{}}})(),C=await yt(h,S,{resolvedRootTrackingRemote:p}),w=await ht(g,C),T=null;if(d){await ke(g)&&await we(w.worktreeRoot??w.path);let e=r?`#${r.number} ${r.title}`.trim():l?`#${l.number} ${l.title}`.trim():i(`session.newWorktree.newSessionTitle`),a=await fe(e,w.path,null);if(!a?.id)throw Error(`Failed to create session`);T=a.id,n?.(w.path,{sessionId:T}),t(!1),Fe(!1),he(a.id,e).catch(()=>void 0);try{U.getState().initializeNewYuriSession(a.id,de.getState().agents)}catch{}}else t(!1),Fe(!1);let ee=bt({mode:_,sourceBranch:y.sourceBranch,linkedPr:!!y.linkedPr,selectedBranch:x.selectedBranch});ee&&localStorage.setItem(xt,ee),K.success(i(`session.newWorktree.toast.worktreeCreated`),{description:i(`session.newWorktree.toast.worktreeCreatedDescription`,{target:`${w.branch||w.name}${b?` ${i(`session.newWorktree.fromSource`,{source:b})}`:``}`})}),T?Ye({sessionId:T,directory:w.path,issue:r,pr:l,includeDiff:u}).catch(e=>{let t=e instanceof Error?e.message:i(`session.newWorktree.error.sendGitHubContextFailed`);K.error(i(`session.newWorktree.error.sendGitHubContextFailed`),{description:t})}):n?.(w.path)}catch(e){let t=e instanceof Error?e.message:i(`session.newWorktree.error.createWorktreeFailed`);K.error(i(`session.newWorktree.error.createWorktreeFailed`),{description:t})}finally{Fe(!1)}},ct=e=>{v(e),J(e=>({...e,touched:!1,branchError:null,worktreeError:null}))},lt=e=>{if(!e){b(e=>({...e,linkedIssue:null,linkedPr:null,includePrDiff:!1,branchName:``}));return}if(e.type===`issue`){let t=e.item,n=`issue-${t.number}-${cn()}`;b(e=>({...e,linkedIssue:t,linkedPr:null,includePrDiff:!1,branchName:n,worktreeName:$(n),isSyncingWorktreeName:!0}))}else if(e.type===`pr`){let t=e.item;b(n=>({...n,linkedPr:t,linkedIssue:null,includePrDiff:e.includeDiff??!1,branchName:t.head,worktreeName:$(t.head),isSyncingWorktreeName:!0}))}},dt=p&&f?.connected===!0,pt=(_===`existing-branch`?!!x.selectedBranch&&!!x.worktreeName&&!q.branchError&&!q.worktreeError:!!Zn(y.branchName)&&!!y.worktreeName&&!q.branchError&&!q.worktreeError)&&!Pe,_t=()=>{b(e=>({...e,linkedIssue:null,linkedPr:null,branchName:``,includePrDiff:!1,isSyncingWorktreeName:!0}))},St=s&&(A.error||l.error)?(0,Q.jsxs)(`div`,{role:`alert`,className:`typography-micro text-destructive`,children:[(A.error||l.error)?.message,(0,Q.jsx)(H,{size:`xs`,variant:`ghost`,onClick:()=>{A.refetch(),l.refetch()},children:i(`remoteProjects.retry`)})]}):null,Ct=(0,Q.jsxs)(`div`,{className:G(`flex gap-2`,u?`flex-col w-full`:`flex-row items-center`),children:[St,(0,Q.jsx)(`div`,{className:G(`flex items-center gap-1.5 text-destructive`,u?`w-full justify-center order-first`:`mr-auto`),children:q.touched&&(q.branchError||q.worktreeError)&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Y,{name:`error-warning`,className:`h-3.5 w-3.5`}),(0,Q.jsx)(`span`,{className:`typography-micro`,children:q.branchError||q.worktreeError})]})}),(0,Q.jsxs)(`div`,{className:G(`flex gap-2`,u&&`w-full`),children:[(0,Q.jsx)(H,{variant:`outline`,size:`sm`,onClick:()=>t(!1),disabled:Pe,className:G(u&&`flex-1`),children:i(`session.newWorktree.actions.cancel`)}),(0,Q.jsxs)(H,{size:`sm`,onClick:it,disabled:!pt||Pe,className:G(`gap-1.5`,u&&`flex-1`),children:[Pe&&(0,Q.jsx)(Y,{name:`loader-4`,className:`h-3.5 w-3.5 animate-spin`}),i(Pe?`session.newWorktree.actions.creating`:`session.newWorktree.actions.createWorktree`)]})]})]});return(0,Q.jsxs)(Q.Fragment,{children:[u?(0,Q.jsx)(He,{id:`new-worktree-sheet-${d}`,open:e,onOpenChange:t,title:(0,Q.jsx)(`h2`,{className:`truncate typography-ui-label font-semibold text-foreground`,children:i(`session.newWorktree.title`)}),ariaLabel:i(`session.newWorktree.title`),closeAriaLabel:i(`mobile.surface.closeAria`),resizeAriaLabel:i(`mobile.sessions.sheet.resizeAria`),children:(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,Q.jsxs)(Ve,{useScrollShadow:!0,disableHorizontal:!0,preventOverscroll:!0,outerClassName:`min-h-0 flex-1`,className:`overscroll-contain px-4 pb-4 pt-2`,children:[(0,Q.jsx)(`div`,{className:`w-full mb-4`,children:(0,Q.jsx)(wt,{items:[{id:`new-branch`,label:i(`session.newWorktree.mode.newBranch`),icon:(0,Q.jsx)(Y,{name:`git-branch`,className:`h-3.5 w-3.5`})},{id:`existing-branch`,label:i(`session.newWorktree.mode.existingBranch`),icon:(0,Q.jsx)(Y,{name:`git-repository`,className:`h-3.5 w-3.5`})}],activeId:_,onSelect:e=>ct(e),variant:`active-pill`,layoutMode:`fit`,className:`w-full`})}),(0,Q.jsxs)(`div`,{className:`space-y-6`,children:[_===`existing-branch`?(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Q.jsx)(`label`,{className:`typography-ui-label text-foreground block font-semibold`,children:i(`session.newWorktree.selectBranch`)}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsxs)(H,{variant:`outline`,size:`sm`,onClick:()=>oe(!0),className:`flex-1 justify-between h-9`,children:[(0,Q.jsx)(`span`,{className:x.selectedBranch?`text-foreground`:`text-muted-foreground`,children:x.selectedBranch||i(`session.newWorktree.chooseBranch`)}),(0,Q.jsx)(Y,{name:`git-branch`,className:`h-4 w-4 text-muted-foreground`})]}),(0,Q.jsx)(H,{variant:`ghost`,size:`sm`,className:`h-8 w-8 px-0 shrink-0`,onClick:Ne,disabled:!Me||T,title:i(`session.newWorktree.fetchBranches`),children:T?(0,Q.jsx)(Y,{name:`loader-4`,className:`size-4 animate-spin`}):(0,Q.jsx)(Y,{name:`refresh`,className:`size-4`})})]}),(0,Q.jsx)(ut,{open:ae,title:i(`session.newWorktree.selectBranch`),onClose:()=>oe(!1),children:(0,Q.jsxs)(`div`,{className:`space-y-4`,ref:ge,children:[(0,Q.jsx)(st,{value:B,onChange:e=>ce(e.target.value),placeholder:i(`session.newWorktree.searchBranches`),className:`h-8`}),T?(0,Q.jsx)(`div`,{className:`px-2 py-8 text-center typography-small text-muted-foreground`,children:i(`session.newWorktree.loadingBranches`)}):D.length===0&&k.length===0?(0,Q.jsx)(`div`,{className:`px-2 py-8 text-center typography-small text-muted-foreground`,children:i(`session.newWorktree.noBranchesFound`)}):(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[Te&&De&&(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsx)(`div`,{className:`typography-small font-semibold text-foreground px-2`,children:i(`session.newWorktree.matchingBranches`)}),(0,Q.jsx)(`div`,{className:`space-y-1`,children:Ce.matching.map(e=>(0,Q.jsx)(`button`,{onClick:()=>{S(t=>({...t,selectedBranch:e.value,worktreeName:$(e.label)})),J(e=>({...e,touched:!0})),oe(!1)},className:G(`w-full text-left px-3 py-2.5 rounded-md transition-colors`,x.selectedBranch===e.value?`bg-interactive-selection text-interactive-selection-foreground`:`hover:bg-interactive-hover`),children:(0,Q.jsx)(`span`,{className:`typography-small break-all`,children:e.label})},`${e.source}-${e.value}`))})]}),Te&&!De&&(0,Q.jsx)(`div`,{className:`px-2 py-1 text-center typography-small text-muted-foreground`,children:i(`session.newWorktree.noMatchingBranches`)}),Ce.otherLocal.length>0&&(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsx)(`div`,{className:`typography-small font-semibold text-foreground px-2`,children:i(Te?`session.newWorktree.otherLocalBranches`:`session.newWorktree.localBranches`)}),(0,Q.jsx)(`div`,{className:`space-y-1`,children:Ce.otherLocal.map(e=>(0,Q.jsx)(`button`,{onClick:()=>{S(t=>({...t,selectedBranch:e,worktreeName:$(e)})),J(e=>({...e,touched:!0})),oe(!1)},className:G(`w-full text-left px-3 py-2.5 rounded-md transition-colors`,x.selectedBranch===e?`bg-interactive-selection text-interactive-selection-foreground`:`hover:bg-interactive-hover`),children:(0,Q.jsx)(`span`,{className:`typography-small break-all`,children:e})},e))})]}),Ce.otherRemote.length>0&&(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsx)(`div`,{className:`typography-small font-semibold text-foreground px-2`,children:i(Te?`session.newWorktree.otherRemoteBranches`:`session.newWorktree.remoteBranches`)}),(0,Q.jsx)(`div`,{className:`space-y-1`,children:Ce.otherRemote.map(e=>(0,Q.jsx)(`button`,{onClick:()=>{S(t=>({...t,selectedBranch:`remotes/${e}`,worktreeName:$(e)})),J(e=>({...e,touched:!0})),oe(!1)},className:G(`w-full text-left px-3 py-2.5 rounded-md transition-colors`,x.selectedBranch===`remotes/${e}`?`bg-interactive-selection text-interactive-selection-foreground`:`hover:bg-interactive-hover`),children:(0,Q.jsx)(`span`,{className:`typography-small break-all`,children:e})},`remotes/${e}`))})]})]})]})})]}):(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-col items-start gap-1.5`,children:[(0,Q.jsx)(`label`,{className:`typography-ui-label text-foreground block font-semibold`,children:i(`session.newWorktree.branchName`)}),_===`new-branch`&&dt&&(0,Q.jsxs)(H,{variant:`outline`,size:`sm`,onClick:()=>I(!0),className:`gap-1.5 h-7`,children:[(0,Q.jsx)(Y,{name:`github`,className:`size-4 text-status-success`}),y.linkedIssue||y.linkedPr?i(`session.newWorktree.actions.change`):i(`session.newWorktree.actions.startFromGitHubIssuePr`)]})]}),(0,Q.jsx)(st,{value:y.branchName,onChange:e=>{b(t=>({...t,branchName:e.target.value,isSyncingWorktreeName:!0,linkedIssue:null,linkedPr:null}))},onBlur:()=>J(e=>({...e,touched:!0})),placeholder:i(`session.newWorktree.branchNamePlaceholder`),disabled:!!y.linkedPr,className:G(`h-8`,q.touched&&q.branchError&&`border-destructive`,y.linkedPr&&`bg-muted text-muted-foreground`)}),y.linkedPr&&(0,Q.jsxs)(`div`,{className:`flex items-center gap-1.5 text-muted-foreground`,children:[(0,Q.jsx)(Y,{name:`check`,className:`h-3.5 w-3.5 text-status-success`}),(0,Q.jsx)(`span`,{className:`typography-micro`,children:i(`session.newWorktree.usingPrBranch`,{branch:y.linkedPr.head})})]}),y.linkedIssue&&!y.linkedPr&&(0,Q.jsxs)(`div`,{className:`flex items-center gap-1.5 text-muted-foreground`,children:[(0,Q.jsx)(Y,{name:`check`,className:`h-3.5 w-3.5 text-status-success`}),(0,Q.jsx)(`span`,{className:`typography-micro`,children:i(`session.newWorktree.fromIssue`,{number:y.linkedIssue.number,title:y.linkedIssue.title})})]})]}),(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Q.jsx)(`label`,{className:`typography-ui-label text-foreground font-semibold`,children:i(`session.newWorktree.worktreeDirectory`)}),_!==`existing-branch`&&(0,Q.jsxs)(`button`,{onClick:()=>{let e=$(_===`new-branch`?y.branchName:``);b(t=>({...t,worktreeName:e,isSyncingWorktreeName:!0}))},disabled:!y.branchName||y.worktreeName===$(y.branchName),className:G(`flex items-center gap-1 typography-micro transition-colors px-1.5 py-0.5 rounded`,y.worktreeName===$(y.branchName)||!y.branchName?`text-muted-foreground/40 cursor-not-allowed`:`text-muted-foreground hover:text-foreground hover:bg-muted`),title:i(`session.newWorktree.resetToMatchBranchName`),children:[(0,Q.jsx)(Y,{name:`refresh`,className:`h-3 w-3`}),(0,Q.jsx)(`span`,{children:i(`session.newWorktree.actions.reset`)})]})]}),(0,Q.jsx)(st,{value:Xe.worktreeName,onChange:e=>{_===`new-branch`?b(t=>({...t,worktreeName:e.target.value,isSyncingWorktreeName:!1})):S(t=>({...t,worktreeName:e.target.value}))},onBlur:()=>J(e=>({...e,touched:!0})),placeholder:i(`session.newWorktree.worktreeDirectoryPlaceholder`),className:G(`h-8`,q.touched&&q.worktreeError&&`border-destructive`)})]}),_===`new-branch`&&!y.linkedPr&&(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Q.jsx)(`label`,{className:`typography-ui-label text-foreground block font-semibold`,children:i(`session.newWorktree.sourceBranch`)}),(0,Q.jsxs)(H,{variant:`outline`,size:`sm`,onClick:()=>se(!0),className:`w-full justify-between h-9`,children:[(0,Q.jsx)(`span`,{className:y.sourceBranch?`text-foreground`:`text-muted-foreground`,children:y.sourceBranch||i(`session.newWorktree.selectSourceBranchPlaceholder`)}),(0,Q.jsx)(Y,{name:`git-branch`,className:`h-4 w-4 text-muted-foreground`})]}),y.sourceBranch&&(0,Q.jsx)(`div`,{className:`typography-micro text-muted-foreground`,children:i(`session.newWorktree.newBranchFromSource`,{source:y.sourceBranch})}),(0,Q.jsx)(ut,{open:z,title:i(`session.newWorktree.selectSourceBranch`),onClose:()=>se(!1),children:(0,Q.jsxs)(`div`,{className:`space-y-4`,ref:_e,children:[(0,Q.jsx)(st,{value:le,onChange:e=>ue(e.target.value),placeholder:i(`session.newWorktree.searchBranches`),className:`h-8`}),T?(0,Q.jsx)(`div`,{className:`px-2 py-8 text-center typography-small text-muted-foreground`,children:i(`session.newWorktree.loadingBranches`)}):D.length===0&&k.length===0?(0,Q.jsx)(`div`,{className:`px-2 py-8 text-center typography-small text-muted-foreground`,children:i(`session.newWorktree.noBranchesFound`)}):(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[Ee&&Oe&&(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsx)(`div`,{className:`typography-small font-semibold text-foreground px-2`,children:i(`session.newWorktree.matchingBranches`)}),(0,Q.jsx)(`div`,{className:`space-y-1`,children:W.matching.map(e=>(0,Q.jsx)(`button`,{onClick:()=>{b(t=>({...t,sourceBranch:e.value})),se(!1)},className:G(`w-full text-left px-3 py-2.5 rounded-md transition-colors`,y.sourceBranch===e.value?`bg-interactive-selection text-interactive-selection-foreground`:`hover:bg-interactive-hover`),children:(0,Q.jsx)(`span`,{className:`typography-small break-all`,children:e.label})},`${e.source}-${e.value}`))})]}),Ee&&!Oe&&(0,Q.jsx)(`div`,{className:`px-2 py-1 text-center typography-small text-muted-foreground`,children:i(`session.newWorktree.noMatchingBranches`)}),W.otherLocal.length>0&&(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsx)(`div`,{className:`typography-small font-semibold text-foreground px-2`,children:i(Ee?`session.newWorktree.otherLocalBranches`:`session.newWorktree.localBranches`)}),(0,Q.jsx)(`div`,{className:`space-y-1`,children:W.otherLocal.map(e=>(0,Q.jsx)(`button`,{onClick:()=>{b(t=>({...t,sourceBranch:e})),se(!1)},className:G(`w-full text-left px-3 py-2.5 rounded-md transition-colors`,y.sourceBranch===e?`bg-interactive-selection text-interactive-selection-foreground`:`hover:bg-interactive-hover`),children:(0,Q.jsx)(`span`,{className:`typography-small break-all`,children:e})},e))})]}),W.otherRemote.length>0&&(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsx)(`div`,{className:`typography-small font-semibold text-foreground px-2`,children:i(Ee?`session.newWorktree.otherRemoteBranches`:`session.newWorktree.remoteBranches`)}),(0,Q.jsx)(`div`,{className:`space-y-1`,children:W.otherRemote.map(e=>(0,Q.jsx)(`button`,{onClick:()=>{b(t=>({...t,sourceBranch:`remotes/${e}`})),se(!1)},className:G(`w-full text-left px-3 py-2.5 rounded-md transition-colors`,y.sourceBranch===`remotes/${e}`?`bg-interactive-selection text-interactive-selection-foreground`:`hover:bg-interactive-hover`),children:(0,Q.jsx)(`span`,{className:`typography-small break-all`,children:e})},`remotes/${e}`))})]})]})]})})]}),(y.linkedIssue||y.linkedPr)&&_===`new-branch`&&(0,Q.jsxs)(`div`,{className:`mt-2 px-2 py-1.5 rounded bg-muted/30`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(Y,{name:`github`,className:`h-3.5 w-3.5 text-status-success shrink-0`}),y.linkedIssue&&(0,Q.jsx)(`span`,{className:`typography-micro text-muted-foreground shrink-0`,children:i(`session.newWorktree.issueNumber`,{number:y.linkedIssue.number})}),y.linkedPr&&(0,Q.jsx)(`span`,{className:`typography-micro text-muted-foreground shrink-0`,children:i(`session.newWorktree.prNumber`,{number:y.linkedPr.number})}),(0,Q.jsx)(`span`,{className:`typography-micro text-foreground truncate flex-1`,children:y.linkedIssue?.title||y.linkedPr?.title}),(0,Q.jsx)(`a`,{href:y.linkedIssue?.url||y.linkedPr?.url,target:`_blank`,rel:`noopener noreferrer`,className:`text-muted-foreground hover:text-foreground shrink-0`,onClick:e=>e.stopPropagation(),children:(0,Q.jsx)(Y,{name:`external-link`,className:`h-3 w-3`})}),(0,Q.jsx)(`button`,{onClick:_t,className:`text-muted-foreground hover:text-foreground shrink-0 p-0.5 rounded hover:bg-muted transition-colors`,children:(0,Q.jsx)(Y,{name:`close`,className:`h-3.5 w-3.5`})})]}),y.linkedPr&&(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 mt-0.5 pl-5`,children:[(0,Q.jsxs)(`span`,{className:`typography-micro text-muted-foreground`,children:[y.linkedPr.head,` → `,y.linkedPr.base]}),y.includePrDiff&&(0,Q.jsx)(`span`,{className:`typography-micro px-1 py-0.5 rounded bg-status-success/10 text-status-success`,children:i(`session.newWorktree.includeDiffBadge`)})]})]})]})]}),(0,Q.jsx)(`div`,{className:`shrink-0 border-t border-border/50 px-4 pb-3 pt-2`,children:Ct})]})}):(0,Q.jsx)(qe,{open:e,onOpenChange:t,children:(0,Q.jsxs)(Ge,{className:`max-w-lg max-h-[80vh] flex flex-col`,children:[(0,Q.jsx)(Ue,{className:`flex flex-row items-center justify-between`,children:(0,Q.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Q.jsxs)(Ke,{className:`flex items-center gap-2 shrink-0`,children:[(0,Q.jsx)(Y,{name:`git-branch`,className:`h-5 w-5`}),i(`session.newWorktree.title`)]}),(0,Q.jsx)(`div`,{className:`w-[280px] shrink-0`,children:(0,Q.jsx)(wt,{items:[{id:`new-branch`,label:i(`session.newWorktree.mode.newBranch`),icon:(0,Q.jsx)(Y,{name:`git-branch`,className:`h-3.5 w-3.5`})},{id:`existing-branch`,label:i(`session.newWorktree.mode.existingBranch`),icon:(0,Q.jsx)(Y,{name:`git-repository`,className:`h-3.5 w-3.5`})}],activeId:_,onSelect:e=>ct(e),variant:`active-pill`,layoutMode:`fit`,className:`w-full`})})]})}),(0,Q.jsxs)(`div`,{className:`flex-1 overflow-y-auto mt-2 space-y-6`,children:[_===`existing-branch`?(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Q.jsx)(`label`,{className:`typography-ui-label text-foreground block font-semibold`,children:i(`session.newWorktree.selectBranch`)}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsxs)($e,{open:L,onOpenChange:R,children:[(0,Q.jsx)(Ze,{asChild:!0,children:(0,Q.jsxs)(H,{variant:`outline`,size:`sm`,className:`h-9 min-w-[220px] max-w-full justify-between gap-2`,children:[(0,Q.jsx)(`span`,{className:G(`truncate`,x.selectedBranch?`text-foreground`:`text-muted-foreground`),children:x.selectedBranch||i(`session.newWorktree.chooseBranch`)}),(0,Q.jsx)(Y,{name:`arrow-down-s`,className:`h-4 w-4 shrink-0 text-muted-foreground`})]})}),(0,Q.jsx)(Qe,{align:`start`,sideOffset:6,portalToBody:!0,className:`w-[min(42rem,calc(100vw-2rem))] p-0 max-h-[min(var(--available-height),24rem)] flex flex-col overflow-hidden`,ref:pe,children:(0,Q.jsxs)(Tn,{shouldFilter:!1,children:[(0,Q.jsx)(En,{placeholder:i(`session.newWorktree.searchBranches`),value:B,onValueChange:ce,onKeyDown:ve}),(0,Q.jsx)(Dn,{disableHorizontal:!0,children:T?(0,Q.jsx)(`div`,{className:`px-2 py-4 text-center typography-small text-muted-foreground`,children:i(`session.newWorktree.loadingBranches`)}):D.length===0&&k.length===0?(0,Q.jsx)(On,{children:i(`session.newWorktree.noBranchesFound`)}):(0,Q.jsxs)(Q.Fragment,{children:[Te&&De&&(0,Q.jsx)(kn,{heading:i(`session.newWorktree.matchingBranches`),children:Ce.matching.map(e=>(0,Q.jsx)(jn,{value:e.value,onSelect:()=>{S(t=>({...t,selectedBranch:e.value,worktreeName:$(e.label)})),J(e=>({...e,touched:!0})),R(!1)},children:(0,Q.jsx)(`span`,{className:`typography-small break-all`,children:e.label})},`${e.source}-${e.value}`))}),Te&&!De&&(0,Q.jsx)(`div`,{className:`px-2 py-1 text-center typography-small text-muted-foreground`,children:i(`session.newWorktree.noMatchingBranches`)}),Ce.otherLocal.length>0&&(0,Q.jsxs)(Q.Fragment,{children:[Te&&(0,Q.jsx)(An,{}),(0,Q.jsx)(kn,{heading:i(Te?`session.newWorktree.otherLocalBranches`:`session.newWorktree.localBranches`),children:Ce.otherLocal.map(e=>(0,Q.jsx)(jn,{value:e,onSelect:()=>{S(t=>({...t,selectedBranch:e,worktreeName:$(e)})),J(e=>({...e,touched:!0})),R(!1)},children:(0,Q.jsx)(`span`,{className:`typography-small break-all`,children:e})},`local-${e}`))})]}),Ce.otherRemote.length>0&&(0,Q.jsxs)(Q.Fragment,{children:[(Ce.otherLocal.length>0||Te)&&(0,Q.jsx)(An,{}),(0,Q.jsx)(kn,{heading:i(Te?`session.newWorktree.otherRemoteBranches`:`session.newWorktree.remoteBranches`),children:Ce.otherRemote.map(e=>(0,Q.jsx)(jn,{value:`remotes/${e}`,onSelect:()=>{S(t=>({...t,selectedBranch:`remotes/${e}`,worktreeName:$(e)})),J(e=>({...e,touched:!0})),R(!1)},children:(0,Q.jsx)(`span`,{className:`typography-small break-all`,children:e})},`remote-${e}`))})]})]})})]})})]}),(0,Q.jsx)(H,{variant:`ghost`,size:`sm`,className:`h-8 w-8 px-0 shrink-0`,onClick:Ne,disabled:!Me||T,title:i(`session.newWorktree.fetchBranches`),children:T?(0,Q.jsx)(Y,{name:`loader-4`,className:`size-4 animate-spin`}):(0,Q.jsx)(Y,{name:`refresh`,className:`size-4`})})]})]}):(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Q.jsx)(`label`,{className:`typography-ui-label text-foreground block font-semibold`,children:i(`session.newWorktree.branchName`)}),_===`new-branch`&&dt&&(0,Q.jsxs)(H,{variant:`outline`,size:`sm`,onClick:()=>I(!0),className:`gap-1.5 h-7`,children:[(0,Q.jsx)(Y,{name:`github`,className:`size-4 text-status-success`}),y.linkedIssue||y.linkedPr?i(`session.newWorktree.actions.change`):i(`session.newWorktree.actions.startFromGitHubIssuePr`)]})]}),(0,Q.jsx)(st,{value:y.branchName,onChange:e=>{b(t=>({...t,branchName:e.target.value,isSyncingWorktreeName:!0,linkedIssue:null,linkedPr:null}))},onBlur:()=>J(e=>({...e,touched:!0})),placeholder:i(`session.newWorktree.branchNamePlaceholder`),disabled:!!y.linkedPr,className:G(`h-8`,q.touched&&q.branchError&&`border-destructive`,y.linkedPr&&`bg-muted text-muted-foreground`)}),y.linkedPr&&(0,Q.jsxs)(`div`,{className:`flex items-center gap-1.5 text-muted-foreground`,children:[(0,Q.jsx)(Y,{name:`check`,className:`h-3.5 w-3.5 text-status-success`}),(0,Q.jsx)(`span`,{className:`typography-micro`,children:i(`session.newWorktree.usingPrBranch`,{branch:y.linkedPr.head})})]}),y.linkedIssue&&!y.linkedPr&&(0,Q.jsxs)(`div`,{className:`flex items-center gap-1.5 text-muted-foreground`,children:[(0,Q.jsx)(Y,{name:`check`,className:`h-3.5 w-3.5 text-status-success`}),(0,Q.jsx)(`span`,{className:`typography-micro`,children:i(`session.newWorktree.fromIssue`,{number:y.linkedIssue.number,title:y.linkedIssue.title})})]})]}),(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Q.jsx)(`label`,{className:`typography-ui-label text-foreground font-semibold`,children:i(`session.newWorktree.worktreeDirectory`)}),_!==`existing-branch`&&(0,Q.jsxs)(`button`,{onClick:()=>{let e=$(_===`new-branch`?y.branchName:``);b(t=>({...t,worktreeName:e,isSyncingWorktreeName:!0}))},disabled:!y.branchName||y.worktreeName===$(y.branchName),className:G(`flex items-center gap-1 typography-micro transition-colors px-1.5 py-0.5 rounded`,y.worktreeName===$(y.branchName)||!y.branchName?`text-muted-foreground/40 cursor-not-allowed`:`text-muted-foreground hover:text-foreground hover:bg-muted`),title:i(`session.newWorktree.resetToMatchBranchName`),children:[(0,Q.jsx)(Y,{name:`refresh`,className:`h-3 w-3`}),(0,Q.jsx)(`span`,{children:i(`session.newWorktree.actions.reset`)})]})]}),(0,Q.jsx)(st,{value:Xe.worktreeName,onChange:e=>{_===`new-branch`?b(t=>({...t,worktreeName:e.target.value,isSyncingWorktreeName:!1})):S(t=>({...t,worktreeName:e.target.value}))},onBlur:()=>J(e=>({...e,touched:!0})),placeholder:i(`session.newWorktree.worktreeDirectoryPlaceholder`),className:G(`h-8`,q.touched&&q.worktreeError&&`border-destructive`)})]}),_===`new-branch`&&!y.linkedPr&&(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Q.jsx)(`label`,{className:`typography-ui-label text-foreground block font-semibold`,children:i(`session.newWorktree.sourceBranch`)}),(0,Q.jsxs)($e,{open:re,onOpenChange:ie,children:[(0,Q.jsx)(Ze,{asChild:!0,children:(0,Q.jsxs)(H,{variant:`outline`,size:`sm`,className:`h-9 min-w-[220px] max-w-full justify-between gap-2`,children:[(0,Q.jsx)(`span`,{className:G(`truncate`,y.sourceBranch?`text-foreground`:`text-muted-foreground`),children:y.sourceBranch||i(`session.newWorktree.selectSourceBranchPlaceholder`)}),(0,Q.jsx)(Y,{name:`arrow-down-s`,className:`h-4 w-4 shrink-0 text-muted-foreground`})]})}),(0,Q.jsx)(Qe,{align:`start`,portalToBody:!0,className:`w-[min(42rem,calc(100vw-2rem))] p-0 max-h-[min(var(--available-height),24rem)] flex flex-col overflow-hidden`,ref:me,children:(0,Q.jsxs)(Tn,{shouldFilter:!1,children:[(0,Q.jsx)(En,{placeholder:i(`session.newWorktree.searchBranches`),value:le,onValueChange:ue,onKeyDown:ve}),(0,Q.jsx)(Dn,{disableHorizontal:!0,children:T?(0,Q.jsx)(`div`,{className:`px-2 py-4 text-center typography-small text-muted-foreground`,children:i(`session.newWorktree.loadingBranches`)}):D.length===0&&k.length===0?(0,Q.jsx)(On,{children:i(`session.newWorktree.noBranchesFound`)}):(0,Q.jsxs)(Q.Fragment,{children:[Ee&&Oe&&(0,Q.jsx)(kn,{heading:i(`session.newWorktree.matchingBranches`),children:W.matching.map(e=>(0,Q.jsx)(jn,{value:e.value,onSelect:()=>{b(t=>({...t,sourceBranch:e.value})),ie(!1)},children:(0,Q.jsx)(`span`,{className:`typography-small break-all`,children:e.label})},`${e.source}-${e.value}`))}),Ee&&!Oe&&(0,Q.jsx)(`div`,{className:`px-2 py-1 text-center typography-small text-muted-foreground`,children:i(`session.newWorktree.noMatchingBranches`)}),W.otherLocal.length>0&&(0,Q.jsxs)(Q.Fragment,{children:[Ee&&(0,Q.jsx)(An,{}),(0,Q.jsx)(kn,{heading:i(Ee?`session.newWorktree.otherLocalBranches`:`session.newWorktree.localBranches`),children:W.otherLocal.map(e=>(0,Q.jsx)(jn,{value:e,onSelect:()=>{b(t=>({...t,sourceBranch:e})),ie(!1)},children:(0,Q.jsx)(`span`,{className:`typography-small break-all`,children:e})},`local-${e}`))})]}),W.otherRemote.length>0&&(0,Q.jsxs)(Q.Fragment,{children:[(W.otherLocal.length>0||Ee)&&(0,Q.jsx)(An,{}),(0,Q.jsx)(kn,{heading:i(Ee?`session.newWorktree.otherRemoteBranches`:`session.newWorktree.remoteBranches`),children:W.otherRemote.map(e=>(0,Q.jsx)(jn,{value:`remotes/${e}`,onSelect:()=>{b(t=>({...t,sourceBranch:`remotes/${e}`})),ie(!1)},children:(0,Q.jsx)(`span`,{className:`typography-small break-all`,children:e})},`remote-${e}`))})]})]})})]})})]}),y.sourceBranch&&(0,Q.jsx)(`div`,{className:`typography-micro text-muted-foreground`,children:i(`session.newWorktree.newBranchFromSource`,{source:y.sourceBranch})})]}),(y.linkedIssue||y.linkedPr)&&_===`new-branch`&&(0,Q.jsxs)(`div`,{className:`mt-2 px-2 py-1.5 rounded bg-muted/30`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(Y,{name:`github`,className:`h-3.5 w-3.5 text-status-success shrink-0`}),y.linkedIssue&&(0,Q.jsx)(`span`,{className:`typography-micro text-muted-foreground shrink-0`,children:i(`session.newWorktree.issueNumber`,{number:y.linkedIssue.number})}),y.linkedPr&&(0,Q.jsx)(`span`,{className:`typography-micro text-muted-foreground shrink-0`,children:i(`session.newWorktree.prNumber`,{number:y.linkedPr.number})}),(0,Q.jsx)(`span`,{className:`typography-micro text-foreground truncate flex-1`,children:y.linkedIssue?.title||y.linkedPr?.title}),(0,Q.jsx)(`a`,{href:y.linkedIssue?.url||y.linkedPr?.url,target:`_blank`,rel:`noopener noreferrer`,className:`text-muted-foreground hover:text-foreground shrink-0`,onClick:e=>e.stopPropagation(),children:(0,Q.jsx)(Y,{name:`external-link`,className:`h-3 w-3`})}),(0,Q.jsx)(`button`,{onClick:_t,className:`text-muted-foreground hover:text-foreground shrink-0 p-0.5 rounded hover:bg-muted transition-colors`,children:(0,Q.jsx)(Y,{name:`close`,className:`h-3.5 w-3.5`})})]}),y.linkedPr&&(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 mt-0.5 pl-5`,children:[(0,Q.jsxs)(`span`,{className:`typography-micro text-muted-foreground`,children:[y.linkedPr.head,` → `,y.linkedPr.base]}),y.includePrDiff&&(0,Q.jsx)(`span`,{className:`typography-micro px-1 py-0.5 rounded bg-status-success/10 text-status-success`,children:i(`session.newWorktree.includeDiffBadge`)})]})]})]}),(0,Q.jsxs)(We,{className:`mt-1 flex items-center justify-between`,children:[St,(0,Q.jsx)(`div`,{className:`flex items-center gap-1.5 text-destructive`,children:q.touched&&(q.branchError||q.worktreeError)&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Y,{name:`error-warning`,className:`h-3.5 w-3.5`}),(0,Q.jsx)(`span`,{className:`typography-micro`,children:q.branchError||q.worktreeError})]})}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(H,{variant:`outline`,size:`sm`,onClick:()=>t(!1),disabled:Pe,children:i(`session.newWorktree.actions.cancel`)}),(0,Q.jsxs)(H,{size:`sm`,onClick:it,disabled:!pt||Pe,className:`gap-1.5`,children:[Pe&&(0,Q.jsx)(Y,{name:`loader-4`,className:`h-3.5 w-3.5 animate-spin`}),i(Pe?`session.newWorktree.actions.creating`:`session.newWorktree.actions.createWorktree`)]})]})]})]})}),(0,Q.jsx)(Yn,{projectId:m?.id,open:F,onOpenChange:I,onSelect:lt})]})}var ir=null,ar=new Set,or=()=>{for(let e of ar)e()},sr=e=>e===`chat`||e===`assistant`,cr=()=>ir,lr=e=>{ir!==e&&(ir=e,or())},ur=e=>{ir&&(e&&ir.surfaceID!==e||(ir=null,or()))},dr=(e,t)=>{if(e.transportIdentity!==t.transportIdentity||e.runtimeGeneration!==t.runtimeGeneration)throw Error(`chat-input-delivery-runtime-stale`)},fr=e=>{let t=e.options?.delivery===`steer`?`steer`:e.options?.delivery===`queue`?`queue`:void 0,n={...t?{delivery:t}:{},...e.options?.commitStagedMessageEdit===void 0?{}:{commitStagedMessageEdit:e.options.commitStagedMessageEdit},...e.options?.messageID?{messageID:e.options.messageID}:{},...e.options?.ticket?{ticket:e.options.ticket}:{}},r=e.options?.sessionId??e.sessionID??void 0;if(!r)return n;let i=e.options?.directoryHint===void 0?e.directory||null:e.options.directoryHint;return{...n,sessionId:r,directoryHint:i}},pr=(e,t,n={})=>({operation:t,surfaceID:e.surfaceID,transportIdentity:e.transportIdentity,runtimeGeneration:e.runtimeGeneration,sessionID:e.sessionID,directory:e.directory??``,draftKey:e.draftKey,deliveryTarget:e.deliveryTarget,...n}),mr=e=>{if(!e.active||!e.draftKey||!e.directory)return null;let t=e.activity?.phase??`idle`,n=e.activity?.canAbort??(t===`busy`||t===`retry`);return{send:async t=>{let n=pr(e,`send`,t);return await e.selection.flush(),e.kind===`secondary`&&await e.shortcuts.submit(),e.backend.send(n)},sendQueued:async(t,n={})=>{let{manual:r,...i}=n,a=pr(e,`send`,i),o=Qt(e);if(await e.selection.flush(),!o)throw Error(`chat-input-queue-scope-incomplete`);return e.backend.sendQueued({...a,queueItemID:t,manual:r,queueScope:o})},create:async()=>{let t=pr(e,`create`);return await e.selection.flush(),e.backend.create(t)},compact:async t=>{let n=pr(e,`compact`,t);return await e.selection.flush(),e.backend.compact(n)},abort:async()=>{let t=pr(e,`abort`);return await e.selection.flush(),e.backend.abort(t)},queueScope:Qt(e),canAbort:n,canQueue:t===`busy`||t===`retry`,allowsCommand:t=>Gt(e,{name:t,source:`yuri`}),shortcut:async(t,n=1)=>{if(e.kind===`secondary`){t===`cycle`?await e.shortcuts.cycle(n):t===`new`?await e.shortcuts.new():t===`abort`?await e.shortcuts.abort():await e.shortcuts.submit();return}if(t===`abort`){let t=pr(e,`abort`);await e.selection.flush(),await e.backend.abort(t);return}if(t===`new`){let t=pr(e,`create`);await e.selection.flush(),await e.backend.create(t);return}t!==`submit`&&await e.shortcuts?.cycle(n)},resources:e.resources??null}},hr=e=>e.type===`tool`&&e.metadata?.providerExecuted===!0,gr=e=>{if(e.type!==`tool`)return!1;let t=e.state;return t?.status===`error`&&t.metadata?.interrupted===!0},_r=e=>e.type!==`tool`||hr(e)?!1:!gr(e),vr=e=>{let t=0;for(let n of e)_r(n)&&(t+=1);return t},yr=(e,t)=>e===`stop`&&vr(t)===0,br=e=>{if(e.type!==`text`||e.synthetic===!0)return!1;let t=e.text;return typeof t==`string`&&Tt(t)},xr=e=>{if(vr(e)!==0)return-1;for(let t=e.length-1;t>=0;--t){let n=e[t];if(br(n))return t;if(n.type===`tool`||n.type===`reasoning`||n.type===`file`||n.type===`agent`||n.type===`subtask`)break}return-1},Sr=(e,t,n)=>{if(n||!yr(e,t))return!1;for(let e of t)if(br(e))return!0;return!1},Cr=e=>e===`streaming`||e===`cooldown`,wr=e=>e.parts.some(br),Tr=e=>Cr(e.streamPhase)?wr(e):!1,Er=e=>{let t=e;return typeof t.text==`string`?t.text:typeof t.content==`string`?t.content:``},Dr=e=>{let t=e?.type;return t===`compaction`?!g(e):t===`text`&&Er(e).trim()===`/compact`},Or=e=>e?e.some(e=>Dr(e)):!1,kr=e=>Or(e.parts),Ar=e=>e?Or(e.sourceParts)||Or(e.parts):!1,jr=e=>{if(!kr(e))return e;let t=!1,n=e.parts.map(e=>e?.type!==`compaction`||g(e)?e:(t=!0,{type:`text`,text:`/compact`})),r=e.info.clientRole!==`user`;return!t&&!r?e:{...e,info:r?{...e.info,clientRole:`user`}:e.info,parts:t?n:e.parts}},Mr=e=>{let t=Et(e.parts);return t.length===e.parts.length?e:{...e,parts:t}},Nr=new WeakMap,Pr=e=>{let t=Nr.get(e);if(t)return t;let n=jr(Mr(e)),r=n.parts,i=Ce(r),a=i===r?n:{...n,parts:i,sourceParts:r};return Nr.set(e,a),a},Fr={activity:`idle`,hasWorkingContext:!1,hasActiveTools:!1,isWorking:!1,isStreaming:!1,isCooldown:!1,lifecyclePhase:null,statusText:null,isGenericStatus:!0,isWaitingForPermission:!1,canAbort:!1,compactionDeadline:null,activePartType:void 0,activeToolName:void 0,wasAborted:!1,abortActive:!1,lastCompletionId:null,isComplete:!1,isTurnSettled:!1,retryInfo:null,turnStartedAt:void 0},Ir=[],Lr=`\0`,Rr=new Set([`edit`,`write`,`apply_patch`]),zr={read:`chat.assistantStatus.readingFile`,write:`chat.assistantStatus.writingFile`,edit:`chat.assistantStatus.editingFile`,apply_patch:`chat.assistantStatus.applyingPatch`,bash:`chat.assistantStatus.runningCommand`,grep:`chat.assistantStatus.searchingContent`,glob:`chat.assistantStatus.findingFiles`,list:`chat.assistantStatus.listingDirectory`,task:`chat.assistantStatus.delegatingTask`,webfetch:`chat.assistantStatus.fetchingUrl`,websearch:`chat.assistantStatus.searchingWeb`,codesearch:`chat.assistantStatus.webCodeSearch`,todowrite:`chat.assistantStatus.updatingTodos`,todoread:`chat.assistantStatus.readingTodos`,skill:`chat.assistantStatus.learningSkill`,question:`chat.assistantStatus.askingQuestion`,execute:`chat.assistantStatus.executing`,session_rename:`chat.assistantStatus.renamingSession`,session_move:`chat.assistantStatus.movingSession`,browser:`chat.assistantStatus.usingBrowser`},Br=[`chat.assistantStatus.working`,`chat.assistantStatus.processing`,`chat.assistantStatus.preparing`,`chat.assistantStatus.warmingUp`,`chat.assistantStatus.gearsTurning`,`chat.assistantStatus.computing`,`chat.assistantStatus.calculating`,`chat.assistantStatus.analyzing`,`chat.assistantStatus.wheelsSpinning`,`chat.assistantStatus.calibrating`,`chat.assistantStatus.synthesizing`,`chat.assistantStatus.connectingDots`,`chat.assistantStatus.inspectingLogic`,`chat.assistantStatus.weighingOptions`],Vr=(e,t)=>{let n=zr[Be(e)];return n?t(n):t(`chat.assistantStatus.usingTool`,{tool:e})},Hr=e=>{let t=0;for(let n=0;n<e.length;n+=1)t=(t<<5)-t+e.charCodeAt(n)|0;return Math.abs(t)},Ur=(e,t)=>t(Br[Hr(e)%Br.length]??`chat.assistantStatus.working`),Wr=(e,t,n)=>{let r,i;if(!N(e))for(let t=e.length-1;t>=0;--t){let n=e[t];if(n)switch(n.type){case`reasoning`:{let e=n.time??Xr(n);(!e||e.end===void 0)&&!r&&(r=`reasoning`);break}case`tool`:{let e=n.state?.status;if((e===`running`||e===`pending`)&&!r){let e=Be(Zr(n));Rr.has(e)?(r=`editing`,i=e):(r=`tool`,i=e)}break}case`text`:{let e=Yr(n)??``;if(typeof e==`string`&&e.trim().length>0){let e=Xr(n);(!e||e.end===void 0)&&!r&&(r=`text`)}break}}}let a=r===void 0,o=r===`editing`?n(`chat.assistantStatus.editingFile`):r===`tool`&&i?Vr(i,n):r===`reasoning`?n(`chat.assistantStatus.thinking`):r===`text`?n(`chat.assistantStatus.composing`):Ur(t,n);return{activePartType:r,activeToolName:i,statusText:o,isGenericStatus:a}},Gr=e=>[e.activePartType??``,e.activeToolName??``,e.statusText,e.isGenericStatus?`1`:`0`].join(Lr),Kr=e=>{let[t,n,r=`working`,i]=e.split(Lr);return{activePartType:t===`text`||t===`tool`||t===`reasoning`||t===`editing`?t:void 0,activeToolName:n||void 0,statusText:r,isGenericStatus:i===`1`}},qr=e=>e.type===`reasoning`,Jr=e=>e.type===`text`,Yr=e=>{if(Jr(e))return e.text;let t=e;if(typeof t.text==`string`)return t.text;if(typeof t.content==`string`)return t.content;if(typeof t.value==`string`)return t.value},Xr=e=>(Jr(e)||qr(e),e.time),Zr=e=>{if(e.tool)return e.tool;let t=e;return typeof t.name==`string`?t.name:`tool`};function Qr(e,t){let{t:n}=ze(),r=U(e=>e.currentSessionId),i=U(e=>e.currentSessionDirectory),a=e??r,o=t??i,s=ue(e=>!!(a&&e.session_execution_recovery[a]),o??void 0),c=X.useMemo(()=>e=>a?e.pendingSendMessageIDs.get(a)??null:null,[a]),l=U(c),u=Ne(a??``,o??void 0),d=X.useMemo(()=>{for(let e=u.length-1;e>=0;e--){let t=u[e];if(t.role===`assistant`)return{id:t.id,index:e,finish:t.finish,error:t.error,isCompaction:t.clientRole===`compaction`,startedAt:Number.isFinite(t.time.created)?t.time.created:void 0}}return{id:null,index:-1,finish:void 0,error:void 0,isCompaction:!1,startedAt:void 0}},[u]),f=d.id,p=X.useMemo(()=>{for(let e=u.length-1;e>=0;e--){let t=u[e];if(t.role===`user`&&!b(t))return{id:t.id,index:e,turnStartedAt:Number.isFinite(t.time.created)?t.time.created:void 0}}return{id:null,index:-1,turnStartedAt:void 0}},[u]),m=p.id,h=ge(f??``,o??void 0,a??void 0),g=ge(m??``,o??void 0,a??void 0),_=!!m&&Or(g),v=d.isCompaction&&d.index>p.index?h.find(e=>e.type===`compaction`):void 0,y=v?.reason===`manual`?d.startedAt:p.turnStartedAt,x=!!(f&&d.index>p.index&&(v?v.status===`failed`||v.reason===`manual`&&v.status===`completed`:Sr(d.finish,h,d.error))),S=X.useMemo(()=>{let e=`${a??``}:${f??``}`;return Gr(Wr(f&&!d.error&&d.index>p.index?h:Ir,e,n))},[a,f,d.error,d.index,p.index,h,n]),C=Oe(a??``,o??void 0),w=Te(a??``,o??void 0),T=X.useMemo(()=>e=>a?e.sessionAbortFlags?.get(a)??null:null,[a]),ee=U(T),{phase:E,isWorking:D}=nn(a,o??void 0),O=!!(d.error&&d.index>p.index),k=be(a??``,o??void 0),te=k?.type===`retry`?k.attempt:void 0,A=k?.type===`retry`?k.next:void 0,j=X.useMemo(()=>Kr(S),[S]),M=X.useMemo(()=>{let e=!!(ee&&!ee.acknowledged);return{wasAborted:e,abortActive:e}},[ee]),N=X.useMemo(()=>{if(s)return{...Fr,isRecovering:!0,canAbort:D};if(O&&E!==`retry`)return{...Fr,isTurnSettled:!0,canAbort:D};if(M.wasAborted)return{...Fr,wasAborted:!0,abortActive:M.abortActive,activity:`idle`,hasWorkingContext:!1,isWorking:!1,isStreaming:!1,isCooldown:!1,statusText:null,canAbort:!1,retryInfo:null};if(x)return{...Fr,isComplete:v?.status!==`failed`,isTurnSettled:!0,turnStartedAt:y};let e=D,t=E===`busy`,r=E===`retry`,i=e&&(_||v?.status===`running`),a=`idle`;e&&(a=!i&&(j.activePartType===`tool`||j.activePartType===`editing`)?`tooling`:`streaming`);let o=r?{attempt:te,next:A,message:k?.type===`retry`?k.message:void 0}:null;return{activity:a,hasWorkingContext:e,hasActiveTools:!i&&(j.activePartType===`tool`||j.activePartType===`editing`),isWorking:e,isStreaming:t,isCooldown:!1,lifecyclePhase:t?`streaming`:null,statusText:e?i?n(`chat.assistantStatus.compacting`):j.statusText:null,isGenericStatus:!e||!i&&j.isGenericStatus,isWaitingForPermission:!1,canAbort:e,compactionDeadline:null,activePartType:e&&!i?j.activePartType:void 0,activeToolName:e&&!i?j.activeToolName:void 0,wasAborted:!1,abortActive:!1,lastCompletionId:null,isComplete:!1,isTurnSettled:!1,retryInfo:o,turnStartedAt:y}},[s,O,E,D,x,_,v?.status,y,j,M,te,A,k,n]);return{forming:X.useMemo(()=>({isActive:!s&&!O&&D&&j.activePartType===`text`,characterCount:0}),[s,O,D,j.activePartType]),working:X.useMemo(()=>{if(s||N.wasAborted||N.abortActive)return N;if(l)return{...N,activity:`streaming`,hasWorkingContext:!0,isWorking:!0,isStreaming:!0,isCooldown:!1,lifecyclePhase:`streaming`,statusText:n(`chat.assistantStatus.sendingMessage`),isGenericStatus:!1,isWaitingForPermission:!1,canAbort:!0,activePartType:void 0,activeToolName:void 0,isComplete:!1,isTurnSettled:!1,retryInfo:null};let e=C.length>0,t=w.length>0;return!e&&!t?N:t?{...N,statusText:null,isWorking:!1,hasWorkingContext:!1,hasActiveTools:!1,canAbort:!1,activePartType:void 0,activeToolName:void 0,retryInfo:null}:{...N,statusText:n(`chat.assistantStatus.waitingForPermission`),isWaitingForPermission:!0,canAbort:!1,retryInfo:null}},[s,N,l,C,w,n])}}var $r=`--yuri-mobile-header-collapse`,ei=e=>e.closest(`.mobile-chat-screen`)?.querySelector(`:scope > [data-yuri-collapsible-header="true"]`)??null,ti=e=>{e.style.removeProperty($r),delete e.dataset.yuriHeaderCollapsePhase,delete e.dataset.yuriHeaderCollapseRest},ni=(e,t,n)=>{let r=String(t.progress),i=t.phase,a=t.rest===`compact`?`collapsed`:`expanded`;return n?.phase!==i&&(e.dataset.yuriHeaderCollapsePhase=i,i===`snapping`&&n&&n.phase!==`snapping`&&e.offsetWidth),n?.progress!==r&&e.style.setProperty($r,r),n?.rest!==a&&(e.dataset.yuriHeaderCollapseRest=a),{progress:r,phase:i,rest:a}},ri=e=>{let t=e.startsWith(`#`)?e.slice(1):e;if(!t)return null;let n=t.match(/^turn-(.+)$/);if(n?.[1])return{kind:`turn`,id:n[1]};let r=t.match(/^message-(.+)$/);return r?.[1]?{kind:`message`,id:r[1]}:null},ii=(e,t,n)=>{if(n===0||e.length===0)return{kind:`noop`};let r=t?e.indexOf(t):e.length-1,i=(r>=0?r:e.length-1)+n;if(i>=e.length)return{kind:`resume`};let a=e[Math.max(0,i)];return a?{kind:`turn`,turnId:a}:{kind:`noop`}},ai=e=>{if(typeof window>`u`)return;let t=e?`#${e}`:``,n=`${window.location.pathname}${window.location.search}${t}`;window.history.replaceState(window.history.state,``,n),e&&window.dispatchEvent(new HashChangeEvent(`hashchange`))},oi=e=>{e&&ai(`message-${e}`)},si=e=>{let t=(0,Z.c)(29),{sessionId:n,turnIds:r,activeTurnId:i,scrollToTurn:a,scrollToMessage:o,resumeToBottom:s}=e,c=X.useRef(r),l=X.useRef(i),u,d;t[0]===r?(u=t[1],d=t[2]):(u=()=>{c.current=r},d=[r],t[0]=r,t[1]=u,t[2]=d),X.useEffect(u,d);let f,p;t[3]===i?(f=t[4],p=t[5]):(f=()=>{l.current=i},p=[i],t[3]=i,t[4]=f,t[5]=p),X.useEffect(f,p);let m;t[6]===a?m=t[7]:(m=async(e,t)=>e?(t?.updateHash!==!1&&ai(`turn-${e}`),a(e,{behavior:t?.behavior})):!1,t[6]=a,t[7]=m);let h=m,g;t[8]===o?g=t[9]:(g=async(e,t)=>e?(t?.updateHash!==!1&&ai(`message-${e}`),o(e,{behavior:t?.behavior})):!1,t[8]=o,t[9]=g);let _=g,v;t[10]!==s||t[11]!==h?(v=async(e,t)=>{let n=c.current,r=ii(n,l.current,e);if(r.kind===`noop`)return e===0;if(r.kind===`resume`){if(t?.resumePastEnd===!1){let e=n[n.length-1];return e?h(e,{behavior:`auto`}):!1}return ai(null),s(),!0}return h(r.turnId,{behavior:`auto`})},t[10]=s,t[11]=h,t[12]=v):v=t[12];let y=v,b;t[13]===s?b=t[14]:(b=()=>{ai(null),s()},t[13]=s,t[14]=b);let x=b,S;t[15]!==_||t[16]!==h||t[17]!==n?(S=()=>{if(!n||typeof window>`u`)return;let e=()=>{let e=ri(window.location.hash);if(e){if(e.kind===`turn`){h(e.id,{behavior:`auto`,updateHash:!1});return}_(e.id,{behavior:`auto`,updateHash:!1})}};return e(),window.addEventListener(`hashchange`,e),()=>{window.removeEventListener(`hashchange`,e)}},t[15]=_,t[16]=h,t[17]=n,t[18]=S):S=t[18];let C;t[19]!==_||t[20]!==h||t[21]!==n||t[22]!==r.length?(C=[n,_,h,r.length],t[19]=_,t[20]=h,t[21]=n,t[22]=r.length,t[23]=C):C=t[23],X.useEffect(S,C);let w;return t[24]!==x||t[25]!==y||t[26]!==_||t[27]!==h?(w={scrollToTurnId:h,scrollToMessageId:_,scrollByTurnOffset:y,resumeToLatest:x},t[24]=x,t[25]=y,t[26]=_,t[27]=h,t[28]=w):w=t[28],w},ci=[0,200,400],li=e=>{let t=(0,Z.c)(5),{className:n}=e,r;t[0]===n?r=t[1]:(r=G(`inline-flex`,n),t[0]=n,t[1]=r);let i;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=ci.map(ui),t[2]=i):i=t[2];let a;return t[3]===r?a=t[4]:(a=(0,Q.jsxs)(Q.Fragment,{children:[`\xA0`,(0,Q.jsx)(`span`,{className:r,"aria-hidden":`true`,children:i})]}),t[3]=r,t[4]=a),a};function ui(e){return(0,Q.jsx)(`span`,{className:`animate-busy-pulse`,style:{animationDelay:`${e}ms`},children:`.`},e)}export{En as A,Xt as B,sr as C,Tn as D,Ln as E,wn as F,Ut as G,Vt as H,cn as I,qt as J,Yt as K,rn as L,Dn as M,Cn as N,On as O,Sn as P,Ot as Q,an as R,cr as S,nr as T,$t as U,Gt as V,Zt as W,Bt as X,Jt as Y,Dt as Z,Tr as _,ti as a,fr as b,Qr as c,wr as d,vr as f,br as g,yr as h,$r as i,jn as j,kn as k,Pr as l,Sr as m,oi as n,ni as o,xr as p,Ht as q,si as r,ei as s,li as t,Ar as u,dr as v,lr as w,ur as x,mr as y,nn as z};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{n as e,r as t}from"./rolldown-runtime-hePW80VL.js";import{R as n,s as r}from"./platform-CNdx57HN.js";import{o as i}from"./vendor-zustand-CTekDqaS.js";import{ot as a,st as o}from"./vendor-base-ui-wXsskyKm.js";import{Lt as s,n as c}from"./client-QcYZg8_d.js";import{n as l}from"./pathNormalization-ewtPqJWn.js";import{n as u}from"./vendor-react-BkccXcWz.js";import{o as d,s as f,u as p}from"./vendor-tanstack-react-query-DIb_ItL-.js";import{E as m,G as h,O as g}from"./runtime-file-resource-DKJJoOOc.js";import{h as _,r as v,u as y}from"./vendor-reactuses-core-DjKFMfz7.js";import{n as b,r as x,t as S}from"./useUIStore-P32bzAJc.js";import{r as C}from"./vendor-sonner-DX3nfJx4.js";import{Ba as w,Qr as T,U as E,Ua as D,W as O,Yn as k,at as A,f as j,hn as M,ir as N,no as ee,pn as te,pr as ne,to as P,ur as F}from"./ui-CU6n15y3.js";import{n as I}from"./Icon-zB0u-x9G.js";import{t as L}from"./i18n-WsU03nwB.js";import{n as R}from"./react-CPBNl-S9.js";import{n as z}from"./useEffectiveDirectory-DNVTRp-B.js";import{n as B}from"./useProjectRuntimeAPIs-TALa4FqO.js";import{a as re,o as ie,r as V,s as ae}from"./useProjectGitStore-DFz9Eb6v.js";import{t as oe}from"./AgentAvatar-5tMBB3OP.js";import{i as H,n as U,r as W,t as G}from"./card-CXE0ffyH.js";import{g as K,h as q,m as J,t as se,v as ce}from"./ChatContainer-vX0hPadC.js";import{f as le,g as ue,h as Y,m as X,p as de}from"./ToolOutputDialog-CGYnrXVV.js";var Z=u(),Q=t(o(),1),$=a(),fe=class extends Q.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,t){this.setState({error:e,errorInfo:t})}handleReset=()=>{this.setState({hasError:!1,error:void 0,errorInfo:void 0})};render(){return this.state.hasError?(0,$.jsx)(`div`,{className:`flex items-center justify-center min-h-screen p-4`,children:(0,$.jsxs)(G,{className:`w-full max-w-md`,children:[(0,$.jsx)(W,{className:`text-center`,children:(0,$.jsxs)(H,{className:`flex items-center justify-center gap-2 text-destructive`,children:[(0,$.jsx)(I,{name:`chat-3`,className:`h-5 w-5`}),this.props.texts.title]})}),(0,$.jsxs)(U,{className:`space-y-4`,children:[(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground text-center`,children:this.props.texts.description}),this.props.sessionId&&(0,$.jsxs)(`div`,{className:`text-xs text-muted-foreground text-center`,children:[this.props.texts.sessionLabel,`: `,this.props.sessionId]}),this.state.error&&(0,$.jsxs)(`details`,{className:`text-xs font-mono bg-muted p-3 rounded`,children:[(0,$.jsx)(`summary`,{className:`cursor-pointer hover:bg-interactive-hover/80`,children:this.props.texts.detailsSummary}),(0,$.jsx)(`pre`,{className:`mt-2 max-h-48 overflow-auto`,children:this.state.error.toString()})]}),(0,$.jsx)(`div`,{className:`flex gap-2`,children:(0,$.jsxs)(k,{onClick:this.handleReset,variant:`outline`,className:`flex-1`,children:[(0,$.jsx)(I,{name:`restart`,className:`h-4 w-4 mr-2`}),this.props.texts.resetAction]})}),(0,$.jsx)(`div`,{className:`text-xs text-muted-foreground text-center`,children:this.props.texts.persistentHint})]})]})}):this.props.children}};function pe(e){let t=(0,Z.c)(22),{t:n}=L(),r;t[0]===n?r=t[1]:(r=n(`chat.errorBoundary.title`),t[0]=n,t[1]=r);let i;t[2]===n?i=t[3]:(i=n(`chat.errorBoundary.description`),t[2]=n,t[3]=i);let a;t[4]===n?a=t[5]:(a=n(`chat.errorBoundary.sessionLabel`),t[4]=n,t[5]=a);let o;t[6]===n?o=t[7]:(o=n(`chat.errorBoundary.detailsSummary`),t[6]=n,t[7]=o);let s;t[8]===n?s=t[9]:(s=n(`chat.errorBoundary.resetAction`),t[8]=n,t[9]=s);let c;t[10]===n?c=t[11]:(c=n(`chat.errorBoundary.persistentHint`),t[10]=n,t[11]=c);let l;t[12]!==r||t[13]!==i||t[14]!==a||t[15]!==o||t[16]!==s||t[17]!==c?(l={title:r,description:i,sessionLabel:a,detailsSummary:o,resetAction:s,persistentHint:c},t[12]=r,t[13]=i,t[14]=a,t[15]=o,t[16]=s,t[17]=c,t[18]=l):l=t[18];let u;return t[19]!==e||t[20]!==l?(u=(0,$.jsx)(fe,{...e,texts:l}),t[19]=e,t[20]=l,t[21]=u):u=t[21],u}var me=1440,he=e=>{let t=(0,Z.c)(10),{isMobile:n,isVSCode:r,directory:i}=e,a=y(`(min-width: ${me}px)`),o;t[0]===i?o=t[1]:(o=i?b(i):``,t[0]=i,t[1]=o);let s=o,c;t[2]===s?c=t[3]:(c=e=>{let t=S(e,s);return t?.isOpen?(t.tabs.find(e=>e.id===t.activeTabId)??t.tabs[t.tabs.length-1]??null)?.mode!==`chat`:!1},t[2]=s,t[3]=c);let l=x(c),u=x(ge),d;t[4]===s?d=t[5]:(d=e=>e.isRightSidebarOpen&&!!S(e,s)?.isOpen,t[4]=s,t[5]=d);let f=x(d),p=!n&&!r&&!l&&!f,m=p&&a,h=u&&m,g;return t[6]!==m||t[7]!==p||t[8]!==h?(g={visible:h,fits:m,layoutAllows:p},t[6]=m,t[7]=p,t[8]=h,t[9]=g):g=t[9],g};function ge(e){return e.workStatusPanelEnabled}var _e=async({directory:e,sessionID:t,signal:n})=>{let r=await c.getScopedSdkClient(e).session.list({directory:e,parentID:t,limit:200},{signal:n});if(!Array.isArray(r?.data))throw Error(`session.list children returned no data`);return r.data.flatMap(e=>{if(!e?.id)return[];let t=typeof e.title==`string`?e.title:void 0;return[{id:e.id,title:t}]})},ve=(e,t,n={})=>{let r=n.entry,i=n.listChildren??(r?async({directory:e,sessionID:t,signal:n})=>{let i=await r.sdk().session.list({directory:e,parentID:t,limit:200},{signal:n});if(r.sdk(),!Array.isArray(i?.data))throw Error(`session.list children returned no data`);return i.data.map(e=>({id:e.id,title:e.title}))}:_e);return d({queryKey:[...h.workStatusChildren.list(e,t,n.transport),...r?.queryScope??[]],enabled:!!(e&&t),queryFn:({signal:n})=>i({directory:e,sessionID:t,signal:n}),staleTime:5e3,refetchInterval:1e4})},ye=[],be=(...e)=>{let t=K(...e);return t?t.charAt(0).toUpperCase()+t.slice(1):``},xe=(...e)=>{for(let t of e){if(!t||typeof t!=`object`)continue;let e=t.description;if(typeof e!=`string`)continue;let n=e.trim();if(n)return n}return``},Se=e=>e===`pending`||e===`running`,Ce=e=>{let t=[],n=new Set;for(let r of e.messageOrder){let i=e.partsByMessageID[r];if(i)for(let e of i){if(!e?.id||n.has(e.id))continue;if(e.type===`tool`&&J(e.tool)){n.add(e.id);let r=e.state;t.push({id:e.id,sessionID:q(e),label:be(r?.input,r?.metadata,e.metadata),description:xe(r?.input,e.metadata,r?.metadata),running:Se(r?.status)});continue}if(e.type!==`subtask`)continue;let r=e,i=typeof r.taskSessionID==`string`?r.taskSessionID.trim():``,a=typeof r.agent==`string`?r.agent.trim():``,o=typeof r.description==`string`?r.description.trim():``;n.add(e.id),t.push({id:e.id,sessionID:i||void 0,label:a?a.charAt(0).toUpperCase()+a.slice(1):``,description:o,running:Se(r.status)})}}return t.length===0?ye:t},we=(e,t)=>{if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1){let r=e[n],i=t[n];if(!r||!i||r.id!==i.id||r.sessionID!==i.sessionID||r.label!==i.label||r.description!==i.description||r.running!==i.running)return!1}return!0},Te=e=>e.childTitle||e.description||e.agent,Ee=e=>({key:e.key,sessionID:e.sessionID,seed:e.key,label:Te(e),phase:e.working?`working`:`done`}),De=(e,t,n)=>{let r=new Map(t.map(e=>[e.id,e])),i=new Set,a=[],o=new Map,s=e=>{let t=e.sessionID;if(!t){a.push(e);return}i.add(t);let n=o.get(t);if(n===void 0){o.set(t,a.length),a.push({...e,key:t,sessionID:t});return}let r=a[n];r&&(a[n]={...r,description:r.description||e.description,agent:r.agent||e.agent,childTitle:e.childTitle||r.childTitle,working:r.working||e.working})};for(let t of e){let e=t.sessionID?r.get(t.sessionID):void 0;s({key:t.id,sessionID:t.sessionID,description:t.description,agent:t.label,childTitle:e?.title?.trim()||``,working:t.running||!!e?.busy||!!(t.sessionID&&n?.has(t.sessionID))})}for(let e of t)i.has(e.id)||s({key:e.id,sessionID:e.id,description:``,agent:``,childTitle:e.title?.trim()||``,working:e.busy});let c=a.map(Ee),l=c.filter(e=>e.phase===`working`),u=c.filter(e=>e.phase===`done`);return l.length===0?u:u.length===0?l:[...l,...u]},Oe=new Set,ke=e=>{if(!e)return``;let t=[];for(let n of Object.keys(e)){let r=e[n]?.type;(r===`busy`||r===`retry`)&&t.push(n)}return t.sort(),t.join(`
|
|
2
|
-
`)},Ae=(e,t)=>{let n=(0,Z.c)(4),r;n[0]===t?r=n[1]:(r=e=>t?ke(e.session_status):``,n[0]=t,n[1]=r);let a=i(e,r),o;return n[2]===a?o=n[3]:(o=a?new Set(a.split(`
|
|
3
|
-
`)):Oe,n[2]=a,n[3]=o),o},je=(e,t)=>{let n=[];for(let r of e)!r.id||r.parentID!==t||n.push(`${r.id}\u0001${r.title??``}`);return n.join(``)},Me=e=>e?e.split(``).map(e=>{let t=e.indexOf(``);return{id:e.slice(0,t),title:e.slice(t+1)}}):[],Ne=(e,t,n)=>{let r=new Map;for(let t of e)t.id&&r.set(t.id,{id:t.id,title:t.title,busy:n.has(t.id)});for(let e of t??[]){if(!e.id)continue;let t=r.get(e.id),i=e.title?.trim()||t?.title;r.set(e.id,{id:e.id,title:i,busy:n.has(e.id)})}return[...r.values()]},Pe=(e,t)=>{let n=(0,Z.c)(18),r=!!(e&&t),a;n[0]===Symbol.for(`react.memo_cache_sentinel`)?(a={bootstrap:!1},n[0]=a):a=n[0];let o=E(t||void 0,a),c;n[1]!==r||n[2]!==e?(c=t=>r&&e?je(t.session,e):``,n[1]=r,n[2]=e,n[3]=c):c=n[3];let l=i(o,c),u=t??``,d=e??``,p;n[4]!==u||n[5]!==d?(p=ve(u,d),n[4]=u,n[5]=d,n[6]=p):p=n[6];let m;n[7]!==r||n[8]!==p?(m={...p,enabled:r},n[7]=r,n[8]=p,n[9]=m):m=n[9];let h=f(m),g;n[10]===r?g=n[11]:(g={enabled:r},n[10]=r,n[11]=g);let _=s(e??``,t??``,o,Ce,we,g),v=Ae(o,r),y;bb0:{if(!e){let e;n[12]===Symbol.for(`react.memo_cache_sentinel`)?(e=[],n[12]=e):e=n[12],y=e;break bb0}let t;n[13]!==v||n[14]!==l||n[15]!==h.data||n[16]!==_?(t=De(_,Ne(Me(l),h.data,v),v),n[13]=v,n[14]=l,n[15]=h.data,n[16]=_,n[17]=t):t=n[17],y=t}return y},Fe=[],Ie=e=>{let t=(0,Z.c)(11),{sessionId:n,directory:r}=e,i;t[0]===n?i=t[1]:(i=e=>(n?e.todo[n]:void 0)??Fe,t[0]=n,t[1]=i);let a=O(i,r??void 0),o;t[2]===n?o=t[3]:(o=e=>{let t=n?e.session_status?.[n]?.type:void 0;return t===`busy`||t===`retry`},t[2]=n,t[3]=o);let s=O(o,r??void 0),c;t[4]===n?c=t[5]:(c=e=>n?e.sessions[n]?.todos:void 0,t[4]=n,t[5]=c);let l=M(c),u=A(n??``,r??void 0)??(a.length>0?a:l??Fe),d;t[6]===u?d=t[7]:(d=u.filter(ze),t[6]=u,t[7]=d);let f=d,p;return t[8]!==s||t[9]!==f?(p=(0,$.jsx)(Re,{todos:f,isWorking:s}),t[8]=s,t[9]=f,t[10]=p):p=t[10],p},Le=e=>{let t=(0,Z.c)(6),n,r;t[0]===e?(n=t[1],r=t[2]):({remote:r,...n}=e,t[0]=e,t[1]=n,t[2]=r);let i;return t[3]!==n||t[4]!==r?(i=r?(0,$.jsx)(Re,{...r}):(0,$.jsx)(Ie,{...n}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i},Re=e=>{let t=(0,Z.c)(52),{todos:n,isWorking:r}=e,{t:i}=L(),a=Q.useId(),[o,s]=Q.useState(!0),[c,l]=Q.useState(!1),u,d;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=()=>{l(!0)},d=[],t[0]=u,t[1]=d):(u=t[0],d=t[1]),Q.useEffect(u,d);let f;t[2]===n?f=t[3]:(f=n.filter(Be),t[2]=n,t[3]=f);let p=f.length,m;t[4]===n?m=t[5]:(m=n.filter(ue),t[4]=n,t[5]=m);let h=m.length,g=Q.useRef(null),_=n.findIndex(Ve),v,y;if(t[6]===_?(v=t[7],y=t[8]):(v=()=>{_<0||g.current?.children[_]?.scrollIntoView?.({block:`nearest`})},y=[_],t[6]=_,t[7]=v,t[8]=y),Q.useEffect(v,y),n.length===0)return null;let b=h===n.length,x=r&&!b,S;t[9]===i?S=t[10]:(S=i(`chat.workStatus.todos.title`),t[9]=i,t[10]=S);let C;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(C=()=>s(He),t[11]=C):C=t[11];let w=b?`done`:`open`,T=c&&`yuri-todo-icon-pop`,E;t[12]===T?E=t[13]:(E=ee(`inline-flex shrink-0`,T),t[12]=T,t[13]=E);let D;t[14]!==b||t[15]!==p||t[16]!==x||t[17]!==n.length?(D=b?(0,$.jsx)(le,{}):(0,$.jsx)(Y,{done:p,total:n.length,spinning:x}),t[14]=b,t[15]=p,t[16]=x,t[17]=n.length,t[18]=D):D=t[18];let O;t[19]!==E||t[20]!==D||t[21]!==w?(O=(0,$.jsx)(`span`,{className:E,children:D},w),t[19]=E,t[20]=D,t[21]=w,t[22]=O):O=t[22];let A;t[23]===i?A=t[24]:(A=i(`chat.workStatus.todos.title`),t[23]=i,t[24]=A);let j;t[25]===A?j=t[26]:(j=(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-foreground`,children:A}),t[25]=A,t[26]=j);let M;t[27]!==p||t[28]!==n.length?(M=(0,$.jsx)(de,{done:p,total:n.length,className:`text-[0.92em]`}),t[27]=p,t[28]=n.length,t[29]=M):M=t[29];let N;t[30]!==o||t[31]!==a||t[32]!==O||t[33]!==j||t[34]!==M?(N=(0,$.jsxs)(k,{type:`button`,variant:`ghost`,size:`sm`,className:`yuri-work-status-action flex w-full min-w-0 items-center justify-start gap-2 px-2 text-left text-[1em] font-normal leading-5 tracking-normal text-muted-foreground [&_svg]:size-3.5`,"aria-expanded":o,"aria-controls":a,onClick:C,children:[O,j,M]}),t[30]=o,t[31]=a,t[32]=O,t[33]=j,t[34]=M,t[35]=N):N=t[35];let te=!o,ne=!o,P=o?`grid-rows-[1fr] opacity-100`:`grid-rows-[0fr] opacity-0`,F;t[36]===P?F=t[37]:(F=ee(`grid min-w-0 transition-[grid-template-rows,opacity] duration-200 ease-out motion-reduce:transition-none`,P),t[36]=P,t[37]=F);let I;t[38]!==r||t[39]!==c||t[40]!==n?(I=(0,$.jsx)(X,{id:void 0,todos:n,isWorking:r,animate:c,listRef:g,rowClassName:`px-2 gap-2 [&_svg]:size-3.5 [&>span:first-child]:w-3.5`,className:`max-h-[15em] min-h-0 overflow-y-auto pt-[0.125em]`}),t[38]=r,t[39]=c,t[40]=n,t[41]=I):I=t[41];let R;t[42]!==a||t[43]!==te||t[44]!==ne||t[45]!==F||t[46]!==I?(R=(0,$.jsx)(`div`,{id:a,"aria-hidden":te,inert:ne,className:F,children:I}),t[42]=a,t[43]=te,t[44]=ne,t[45]=F,t[46]=I,t[47]=R):R=t[47];let z;return t[48]!==N||t[49]!==R||t[50]!==S?(z=(0,$.jsxs)(`div`,{role:`group`,"aria-label":S,className:`mt-2 flex min-w-0 flex-col text-[13px]`,children:[N,R]}),t[48]=N,t[49]=R,t[50]=S,t[51]=z):z=t[51],z};function ze(e){return e.content.length>0}function Be(e){return e.status===`completed`}function Ve(e){return e.status===`in_progress`}function He(e){return!e}var Ue=Q.memo(function(e){let t=(0,Z.c)(19),{host:n,entry:r,input:i}=e,a=Q.useRef(null),o=Q.useRef(null),s;t[0]!==r||t[1]!==n||t[2]!==i?(s=e=>n.mountWorkStatus(r,e,i),t[0]=r,t[1]=n,t[2]=i,t[3]=s):s=t[3];let c=v(s),l;t[4]===c?l=t[5]:(l=()=>{if(!a.current)return;let e=c(a.current);return o.current=e,()=>{o.current=null,e.dispose()}},t[4]=c,t[5]=l);let u;t[6]!==r.generation||t[7]!==r.key||t[8]!==n||t[9]!==i.directory||t[10]!==i.scope||t[11]!==i.sessionId||t[12]!==c?(u=[n,r.key,r.generation,i.sessionId,i.directory,i.scope,c],t[6]=r.generation,t[7]=r.key,t[8]=n,t[9]=i.directory,t[10]=i.scope,t[11]=i.sessionId,t[12]=c,t[13]=u):u=t[13],Q.useLayoutEffect(l,u);let d,f;t[14]===i?(d=t[15],f=t[16]):(d=()=>{o.current?.update(i)},f=[i],t[14]=i,t[15]=d,t[16]=f),Q.useLayoutEffect(d,f);let p;return t[17]===r.key?p=t[18]:(p=(0,$.jsx)(`div`,{ref:a,"data-gui-plugin-mount":`work-status`,"data-gui-work-status":r.key,className:`min-w-0 empty:hidden`}),t[17]=r.key,t[18]=p),p}),We=Q.memo(function(e){let t=(0,Z.c)(9),{host:n,input:r}=e,i=Q.useSyncExternalStore(n.workStatus.subscribe,n.workStatus.getSnapshot,n.workStatus.getSnapshot),a;if(t[0]!==i||t[1]!==n||t[2]!==r){let e;t[4]!==n||t[5]!==r?(e=e=>(0,$.jsx)(Ue,{host:n,entry:e,input:r},e.key),t[4]=n,t[5]=r,t[6]=e):e=t[6],a=i.map(e),t[0]=i,t[1]=n,t[2]=r,t[3]=a}else a=t[3];let o;return t[7]===a?o=t[8]:(o=(0,$.jsx)($.Fragment,{children:a}),t[7]=a,t[8]=o),o}),Ge=Q.memo(function(e){let t=(0,Z.c)(3),{input:n}=e,r=Q.useContext(R),i;return t[0]!==r||t[1]!==n?(i=r?(0,$.jsx)(We,{host:r,input:n}):null,t[0]=r,t[1]=n,t[2]=i):i=t[2],i}),Ke=[],qe=(e,t)=>{let n=l(e),r=l(t);return!!(n&&r&&(n===r||n.startsWith(`${r}/`)))};function Je(e){let t=(0,Z.c)(103),n=m();if(!n?.entry.location.hostId)throw Error(`Remote work status requires Host scope`);let{entry:r,registry:i}=n,{directory:a,hubId:o}=r.location,s=r.location.hostId,c;t[0]!==r||t[1]!==i?(c=F(i,r),t[0]=r,t[1]=i,t[2]=c):c=t[2];let u=c,h,_;t[3]===u?(h=t[4],_=t[5]):(h=()=>u.retain(),_=[u],t[3]=u,t[4]=h,t[5]=_),Q.useEffect(h,_);let[v,y]=Q.useState(),b;t[6]!==u.state||t[7]!==e?(b=()=>e?u.state.observe(e,y):void 0,t[6]=u.state,t[7]=e,t[8]=b):b=t[8];let x;t[9]!==u||t[10]!==e?(x=[u,e],t[9]=u,t[10]=e,t[11]=x):x=t[11],Q.useEffect(b,x);let S;t[12]!==u.state||t[13]!==e?(S=t=>e?u.state.repository.subscribe(u.state.scope(e),t):et,t[12]=u.state,t[13]=e,t[14]=S):S=t[14];let C=S,T;t[15]!==u.state||t[16]!==e?(T=()=>e?u.state.repository.getTranscript(u.state.scope(e)):null,t[15]=u.state,t[16]=e,t[17]=T):T=t[17];let E=T,O=Q.useSyncExternalStore(C,E,E),k=u.state.subscribeSnapshot,A;t[18]!==u.state||t[19]!==e?(A=()=>u.state.getSnapshot(e??``),t[18]=u.state,t[19]=e,t[20]=A):A=t[20];let j=A,M=Q.useSyncExternalStore(k,j,j),ee=w($e),P=D(Qe),I;t[21]===r?I=t[22]:(I=N(r),t[21]=r,t[22]=I);let L=I,R=ie(Ze),z;if(t[23]!==a||t[24]!==r.queryScope||t[25]!==L){let e;t[27]!==a||t[28]!==L?(e=()=>L.listGitWorktrees(a),t[27]=a,t[28]=L,t[29]=e):e=t[29],z=d({queryKey:[...r.queryScope,`work-status`,`worktrees`],queryFn:e,staleTime:3e4}),t[23]=a,t[24]=r.queryScope,t[25]=L,t[26]=z}else z=t[26];let B=z,re;t[30]===r?re=t[31]:(re=ne(r),t[30]=r,t[31]=re);let V=re,ae=e??``,oe;t[32]!==a||t[33]!==r||t[34]!==ae?(oe=ve(a,ae,{entry:r}),t[32]=a,t[33]=r,t[34]=ae,t[35]=oe):oe=t[35];let H=oe,U=f(B),W=f(V),G=!!e,K;t[36]!==H||t[37]!==G?(K={...H,enabled:G},t[36]=H,t[37]=G,t[38]=K):K=t[38];let q=f(K),J=p(),se;t[39]!==H||t[40]!==J||t[41]!==a||t[42]!==R||t[43]!==L||t[44]!==V||t[45]!==B?(se=async()=>{await Promise.all([J.fetchQuery({...B,staleTime:0}),J.fetchQuery({...V,staleTime:0}),J.fetchQuery({...H,staleTime:0}),R(a,L,{silent:!0})]),y(void 0)},t[39]=H,t[40]=J,t[41]=a,t[42]=R,t[43]=L,t[44]=V,t[45]=B,t[46]=se):se=t[46],g(e,se,y);let ce,le;t[47]!==H.queryKey||t[48]!==J||t[49]!==a||t[50]!==R||t[51]!==L||t[52]!==s||t[53]!==i||t[54]!==V.queryKey||t[55]!==B.queryKey?(ce=()=>i.subscribeEvents(s,e=>{if(e.directory&&l(e.directory)!==l(a))return;let t=e.payload?.type??``;t.startsWith(`session.`)&&!t.startsWith(`session.message.`)&&!t.startsWith(`session.tool.`)&&(/status|execution|retry|idle/.test(t)&&J.invalidateQueries({queryKey:V.queryKey}),/created|updated|renamed|deleted/.test(t)&&J.invalidateQueries({queryKey:H.queryKey})),t.startsWith(`worktree.`)||t===`vcs.branch.updated`?(J.invalidateQueries({queryKey:B.queryKey}),R(a,L,{silent:!0})):/^session\.(execution\.(succeeded|failed|interrupted)|idle)$/.test(t)&&R(a,L,{silent:!0})}),le=[i,s,a,J,V.queryKey,H.queryKey,B.queryKey,R,L],t[47]=H.queryKey,t[48]=J,t[49]=a,t[50]=R,t[51]=L,t[52]=s,t[53]=i,t[54]=V.queryKey,t[55]=B.queryKey,t[56]=ce,t[57]=le):(ce=t[56],le=t[57]),Q.useEffect(ce,le);let ue;if(t[58]!==a||t[59]!==s||t[60]!==o||t[61]!==ee||t[62]!==P||t[63]!==U.data){bb0:{let e;t[65]!==s||t[66]!==o?(e=e=>e.hostId===s&&e.hubId===o,t[65]=s,t[66]=o,t[67]=e):e=t[67];let n=ee.filter(e),r=P&&P.location.hostId===s&&P.location.hubId===o?n.find(e=>e.id===P.projectId):void 0;if(r){ue=r;break bb0}let i;t[68]!==a||t[69]!==U.data?(i=e=>qe(a,e.path)||U.data?.some(t=>l(t.path)===l(e.path)),t[68]=a,t[69]=U.data,t[70]=i):i=t[70],ue=n.filter(i).sort(Xe)[0]}t[58]=a,t[59]=s,t[60]=o,t[61]=ee,t[62]=P,t[63]=U.data,t[64]=ue}else ue=t[64];let Y=ue,X;t[71]!==a||t[72]!==Y?.path||t[73]!==U.data?(X=()=>{let e=U.data?.filter(e=>qe(a,e.path)).sort(Ye)[0];if(e)return{...e,projectDirectory:Y?.path??a,label:e.name,worktreeStatus:`ready`}},t[71]=a,t[72]=Y?.path,t[73]=U.data,t[74]=X):X=t[74],Y?.path;let de;t[75]===X?de=t[76]:(de=X(),t[75]=X,t[76]=de);let $=de,fe;if(t[77]!==q.data||t[78]!==W.data||t[79]!==O){let e;t[81]===W.data?e=t[82]:(e=W.data??{},t[81]=W.data,t[82]=e);let n=new Set(Object.keys(e));fe=De(O?Ce(O):[],(q.data??[]).map(e=>({...e,busy:n.has(e.id)})),n),t[77]=q.data,t[78]=W.data,t[79]=O,t[80]=fe}else fe=t[80];let pe=fe,me;t[83]!==M.session?.revert?.messageID||t[84]!==M.status?.type||t[85]!==O?(me=()=>({todos:(O?te(O,M.session?.revert?.messageID):void 0)??Ke,isWorking:M.status?.type===`busy`||M.status?.type===`retry`}),t[83]=M.session?.revert?.messageID,t[84]=M.status?.type,t[85]=O,t[86]=me):me=t[86],M.session?.revert?.messageID;let he;t[87]===me?he=t[88]:(he=me(),t[87]=me,t[88]=he);let ge=he,_e;t[89]!==q||t[90]!==u.state||t[91]!==e||t[92]!==W||t[93]!==U?(_e=async()=>{y(void 0),await Promise.allSettled([U.refetch(),W.refetch(),q.refetch(),e?u.state.refreshMetadata(e):Promise.resolve()])},t[89]=q,t[90]=u.state,t[91]=e,t[92]=W,t[93]=U,t[94]=_e):_e=t[94];let ye=_e,be=v??U.error??W.error??q.error,xe;return t[95]!==r.key||t[96]!==Y||t[97]!==ge||t[98]!==ye||t[99]!==pe||t[100]!==be||t[101]!==$?(xe={project:Y,worktree:$,subagents:pe,remoteTodos:ge,stateKey:r.key,error:be,retry:ye},t[95]=r.key,t[96]=Y,t[97]=ge,t[98]=ye,t[99]=pe,t[100]=be,t[101]=$,t[102]=xe):xe=t[102],xe}function Ye(e,t){return t.path.length-e.path.length}function Xe(e,t){return t.path.length-e.path.length}function Ze(e){return e.fetchStatus}function Qe(e){return e.remoteSession}function $e(e){return e.projects}function et(){}var tt=`flex w-full min-w-0 items-center justify-start gap-2 text-left text-[13px] font-normal leading-5 tracking-normal text-muted-foreground`,nt=`size-3.5 shrink-0`,rt=`yuri-work-status-action pointer-events-none shrink-0 text-muted-foreground opacity-0 transition-opacity group-hover/copy:pointer-events-auto group-hover/copy:opacity-100 focus-visible:pointer-events-auto focus-visible:opacity-100`,it=e=>e.split(/[\\/]/).filter(Boolean).pop()||e,at=e=>{let t=(0,Z.c)(3),n=m(),r;return t[0]!==n||t[1]!==e?(r=n?.entry.location.hostId?(0,$.jsx)(ot,{...e},n.entry.key):(0,$.jsx)(st,{...e}),t[0]=n,t[1]=e,t[2]=r):r=t[2],r},ot=Q.memo(function(e){let t=(0,Z.c)(9),{t:n}=L(),r=Je(e.sessionId),i;t[0]!==r||t[1]!==e?(i=(0,$.jsx)(ct,{...e,...r}),t[0]=r,t[1]=e,t[2]=i):i=t[2];let a;t[3]!==r||t[4]!==n?(a=r.error?(0,$.jsxs)(`div`,{role:`status`,className:`px-2 text-xs text-muted-foreground`,title:String(r.error),children:[n(`common.unavailable`),(0,$.jsx)(k,{variant:`ghost`,size:`xs`,onClick:()=>void r.retry(),children:n(`chat.history.retry`)})]}):null,t[3]=r,t[4]=n,t[5]=a):a=t[5];let o;return t[6]!==i||t[7]!==a?(o=(0,$.jsxs)($.Fragment,{children:[i,a]}),t[6]=i,t[7]=a,t[8]=o):o=t[8],o}),st=e=>{let t=(0,Z.c)(16),{sessionId:n,directory:r}=e,i=w(lt),a=j(ut),o;t[0]===n?o=t[1]:(o=e=>n?e.worktreeMetadata.get(n):void 0,t[0]=n,t[1]=o);let s=j(o),c,u;if(t[2]!==a||t[3]!==r||t[4]!==i||t[5]!==s){let e=l(r),n=t=>{let n=l(t);return!!(e&&n&&(e===n||e.startsWith(`${n}/`)))},o=s&&n(s.path)?s:void 0;c=T(i.filter(dt),a,o?.projectDirectory||r);let d=c?a.get(c.path):void 0;u=o??d?.filter(e=>n(e.path)).sort(ft)[0],t[2]=a,t[3]=r,t[4]=i,t[5]=s,t[6]=c,t[7]=u}else c=t[6],u=t[7];let d=u,f;t[8]!==c||t[9]!==d?(f={project:c,worktree:d},t[8]=c,t[9]=d,t[10]=f):f=t[10];let{project:p,worktree:m}=f,h=Pe(n,r),g=p??void 0,_;return t[11]!==e||t[12]!==h||t[13]!==g||t[14]!==m?(_=(0,$.jsx)(ct,{...e,project:g,worktree:m,subagents:h}),t[11]=e,t[12]=h,t[13]=g,t[14]=m,t[15]=_):_=t[15],_},ct=({sessionId:e,directory:t,active:n=!0,placement:r=`inline`,project:i,worktree:a,subagents:o,remoteTodos:s,stateKey:c})=>{let{t:u}=L(),{git:d}=B(),f=m(),p=f?.entry.location.hostId?f.entry:void 0,h=ie(e=>e.ensureStatus),g=re(t),y=V(t),b=ae(t),S=i?.path||a?.projectDirectory||t,w=i?.label?.trim()||(S?it(S):null),T=a&&l(a.path)!==l(S)?a.name?.trim()||it(a.path):null,E=[{phase:`working`,labelKey:`chat.workStatus.subagent.workingCount`,items:o.filter(e=>e.phase===`working`)},{phase:`done`,labelKey:`chat.workStatus.subagent.doneCount`,items:o.filter(e=>e.phase===`done`)}],D=E[0].items,O=(D.length>0?D:o).slice(0,3),[A,j]=Q.useState(!1),M=Q.useId(),N=x(e=>e.setRightSidebarOpen),ee=x(e=>e.openContextPanel),te=x(e=>e.openContextPanelTab),ne=x(e=>e.setRightSidebarTab),[F,R]=Q.useState(null),[,z]=_(()=>R(null),1500,{immediate:!1}),H=v(async(e,t)=>{try{let n=await P(t);if(!n.ok)throw Error(n.error);R(e),z()}catch{C.error(u(`gitView.toast.copyFailed`))}});Q.useEffect(()=>{!t||!d||h(t,d)},[t,h,d]);let U=g?.current||null,W=a?.worktreeStatus===`pending`?0:g?.files.length??0,{additions:G,deletions:K}=Q.useMemo(()=>{let e=0,t=0;for(let n of Object.values(g?.diffStats??{}))e+=n?.insertions??0,t+=n?.deletions??0;return{additions:e,deletions:t}},[g?.diffStats]),q=a?.worktreeStatus===`pending`,J=!q&&!!g&&b!==!1,se=q?`unknown`:b===!1?`not-repository`:J?`ready`:`unknown`,ce=J&&!!g?.diffStats,le=Q.useMemo(()=>({state:se,loading:y,branch:J?U:null,changedFiles:J?W:null,additions:ce?G:null,deletions:ce?K:null}),[se,y,J,U,W,ce,G,K]),ue=Q.useMemo(()=>({sessionId:e,directory:t,placement:r,scope:p,project:S&&w?{id:i?.id,name:w,directory:S}:null,worktree:a?{name:a.name?.trim()||it(a.path),directory:a.path}:null,git:le}),[e,t,r,p,S,w,i?.id,a,le]),Y=U?`branch:${U}`:``,X=a?.path?`worktree:${a.path}`:``,de=!!(Y&&F===Y),Z=!!(X&&F===X),fe=v(()=>{U&&H(Y,U)}),pe=v(()=>{let e=a?.path;e&&H(X,e)}),me=v(()=>{t&&(ee(c??t),ne(`git`),N(!0))});return(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-0.5`,children:[w?(0,$.jsxs)(`div`,{className:`${tt} h-8 px-2`,title:`${u(`chat.workStatus.section.project`)}: ${S}`,children:[(0,$.jsx)(I,{name:`folder`,weight:`medium`,className:nt}),(0,$.jsx)(`span`,{className:`min-w-0 truncate`,children:w})]}):null,U?(0,$.jsxs)(`div`,{className:`${tt} group/copy h-8 px-2`,title:`${u(`gitView.branch.currentBranchTooltip`)}: ${U}`,children:[(0,$.jsx)(I,{name:`git-branch`,weight:`medium`,className:nt}),(0,$.jsx)(`span`,{className:`min-w-0 truncate`,children:U}),(0,$.jsx)(k,{variant:`ghost`,size:`xs`,className:rt,"aria-label":u(`chat.workStatus.action.copyBranch`),title:u(de?`contextSidebar.actions.copied`:`chat.workStatus.action.copyBranch`),onClick:fe,children:(0,$.jsx)(I,{name:de?`check`:`file-copy`,className:nt})})]}):null,T?(0,$.jsxs)(`div`,{className:`${tt} group/copy h-8 px-2`,title:`${u(`sessions.sidebar.sessionDialogs.worktree.label`)}: ${a?.path}`,children:[(0,$.jsx)(I,{name:`node-tree`,weight:`medium`,className:nt}),(0,$.jsx)(`span`,{className:`min-w-0 truncate`,children:T}),(0,$.jsx)(k,{variant:`ghost`,size:`xs`,className:rt,"aria-label":u(`agentManager.detail.actions.copyWorktreePath`),title:u(Z?`contextSidebar.actions.copied`:`agentManager.detail.actions.copyWorktreePath`),onClick:pe,children:(0,$.jsx)(I,{name:Z?`check`:`file-copy`,className:nt})})]}):null,W>0?(0,$.jsxs)(k,{variant:`ghost`,size:`sm`,className:`yuri-work-status-action ${tt}`,title:u(W===1?`chat.workStatus.git.changedFileSingle`:`chat.workStatus.git.changedFilePlural`,{count:W}),"aria-label":u(`chat.workStatus.action.openGit`),onClick:me,children:[(0,$.jsx)(I,{name:`changes`,weight:`medium`,className:nt}),(0,$.jsx)(`span`,{className:`min-w-0 truncate`,children:u(`chat.workStatus.compact.changes`)}),G>0||K>0?(0,$.jsxs)(`span`,{className:`ml-auto flex shrink-0 gap-1.5 text-[12px] tabular-nums`,children:[(0,$.jsx)(`span`,{className:`text-[var(--status-success)]`,children:`+${G}`}),(0,$.jsx)(`span`,{className:`text-[var(--status-error)]`,children:`−${K}`})]}):(0,$.jsx)(`span`,{className:`ml-auto tabular-nums`,children:W})]}):null,n?(0,$.jsx)(Ge,{input:ue}):null,(0,$.jsx)(Le,{sessionId:e,directory:t,remote:s}),o.length>0?(0,$.jsxs)(`div`,{role:`group`,"aria-label":u(`chat.workStatus.section.subagents`),className:`flex min-w-0 flex-col`,children:[(0,$.jsxs)(k,{type:`button`,variant:`ghost`,size:`sm`,className:`yuri-work-status-action ${tt} gap-1.5`,"aria-expanded":A,"aria-controls":M,onClick:()=>j(e=>!e),children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,className:`inline-flex shrink-0 items-center`,children:O.map((e,t)=>{let n=e.label.trim()||u(`chat.workStatus.subagent.untitled`);return(0,$.jsx)(oe,{name:e.seed,label:n,size:14,className:`relative bg-background ring-2 ring-background ${t>0?`-ml-1`:``}`},e.key)})}),(0,$.jsx)(`span`,{className:`flex min-w-0 flex-1 items-center gap-x-1 whitespace-nowrap text-left text-[11px] leading-5 tabular-nums`,children:E.filter(e=>e.items.length>0).map((e,t)=>(0,$.jsxs)(Q.Fragment,{children:[t>0?(0,$.jsx)(`span`,{"aria-hidden":`true`,children:`·`}):null,(0,$.jsx)(`span`,{children:u(e.labelKey,{count:e.items.length})})]},e.phase))}),(0,$.jsx)(I,{name:A?`arrow-down-s`:`arrow-right-s`,className:`size-3.5 shrink-0 text-muted-foreground opacity-70`})]}),(0,$.jsx)(`div`,{id:M,hidden:!A,className:A?`mt-1 mb-1 flex min-w-0 flex-col gap-1`:`hidden`,children:A?E.filter(e=>e.items.length>0).map(e=>(0,$.jsxs)(`section`,{"aria-label":u(e.labelKey,{count:e.items.length}),className:`flex min-w-0 flex-col gap-1 [&+section]:mt-2`,children:[(0,$.jsx)(`div`,{className:`px-2 py-1 text-[11px] leading-4 text-muted-foreground/70`,children:u(e.labelKey,{count:e.items.length})}),e.items.map(e=>{let n=e.label.trim()||u(`chat.workStatus.subagent.untitled`);return(0,$.jsxs)(k,{variant:`ghost`,size:`sm`,disabled:!e.sessionID||!t,className:`yuri-work-status-action flex w-full min-w-0 items-center justify-start gap-2 text-left text-[12px] font-normal leading-5 text-muted-foreground`,onClick:()=>{!e.sessionID||!t||te(c??t,{mode:`chat`,dedupeKey:`session:${e.sessionID}`,label:n,readOnly:!0})},children:[(0,$.jsx)(oe,{name:e.seed,label:n,size:14}),(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,title:n,children:n})]},e.key)})]},e.phase)):null})]}):null]})};function lt(e){return e.projects}function ut(e){return e.availableWorktreesByProject}function dt(e){return!e.hostId}function ft(e,t){return t.path.length-e.path.length}var pt=200,mt=264,ht=e=>{let t=(0,Z.c)(31),{sessionId:n,directory:r,visible:i,overlay:a}=e,o=a!==void 0&&a,{t:s}=L(),c=x(gt),l=Q.useRef(null),[u,d]=Q.useState(i),f,p;t[0]===i?(f=t[1],p=t[2]):(f=()=>{if(i){d(!0);return}let e=window.setTimeout(()=>d(!1),pt);return()=>window.clearTimeout(e)},p=[i],t[0]=i,t[1]=f,t[2]=p),Q.useEffect(f,p);let m,h;t[3]!==o||t[4]!==c||t[5]!==i?(m=()=>{if(!o||!i)return;let e=e=>{let t=e.target instanceof Element?e.target:null;l.current?.contains(t)||t?.closest(`[data-work-status-toggle]`)||c(!1)},t=e=>{e.key===`Escape`&&c(!1)};return document.addEventListener(`pointerdown`,e,!0),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`pointerdown`,e,!0),document.removeEventListener(`keydown`,t)}},h=[o,c,i],t[3]=o,t[4]=c,t[5]=i,t[6]=m,t[7]=h):(m=t[6],h=t[7]),Q.useEffect(m,h);let g;t[8]===s?g=t[9]:(g=s(`chat.workStatus.ariaLabel`),t[8]=s,t[9]=g);let _=!i,v=!i,y=o?`top-3 z-30 max-h-[calc(100%-1.5rem)] rounded-xl p-2 ${ce}`:`top-2`,b;t[10]===y?b=t[11]:(b=ee(`absolute z-20 flex max-h-[calc(100%-1rem)] flex-col overflow-x-hidden overflow-y-auto scrollbar-hidden bg-transparent`,y),t[10]=y,t[11]=b);let S=o?mt:i?196:0,C=+!!i,w=i?`none`:o?`translateY(-6px)`:`translateX(24px)`,T=o?`opacity, transform`:`none`,E=i?void 0:`none`,D;t[12]!==S||t[13]!==C||t[14]!==w||t[15]!==T||t[16]!==E?(D={right:14,width:S,opacity:C,transform:w,transitionProperty:T,transitionDuration:`${pt}ms`,transitionTimingFunction:`cubic-bezier(0.22, 1, 0.36, 1)`,pointerEvents:E},t[12]=S,t[13]=C,t[14]=w,t[15]=T,t[16]=E,t[17]=D):D=t[17];let O;t[18]!==u||t[19]!==r||t[20]!==o||t[21]!==n||t[22]!==i?(O=i||o&&u?(0,$.jsx)(at,{sessionId:n,directory:r,active:i,placement:o?`popover`:`inline`}):null,t[18]=u,t[19]=r,t[20]=o,t[21]=n,t[22]=i,t[23]=O):O=t[23];let k;return t[24]!==b||t[25]!==D||t[26]!==O||t[27]!==g||t[28]!==_||t[29]!==v?(k=(0,$.jsx)(`aside`,{ref:l,"aria-label":g,"aria-hidden":_,inert:v,className:b,style:D,children:O}),t[24]=b,t[25]=D,t[26]=O,t[27]=g,t[28]=_,t[29]=v,t[30]=k):k=t[30],k};function gt(e){return e.setWorkStatusOverlayOpen}var _t=e({ChatView:()=>yt}),vt=e=>{let t=(0,Z.c)(10),{sessionId:n,directory:r,visible:i,overlay:a,publishVisible:o}=e,s=a!==void 0&&a,c=o!==void 0&&o,l=x(bt),u,d;t[0]!==c||t[1]!==l||t[2]!==i?(u=()=>{if(c)return l(i),()=>l(!1)},d=[c,l,i],t[0]=c,t[1]=l,t[2]=i,t[3]=u,t[4]=d):(u=t[3],d=t[4]),Q.useEffect(u,d);let f;return t[5]!==r||t[6]!==s||t[7]!==n||t[8]!==i?(f=(0,$.jsx)(ht,{overlay:s,visible:i,sessionId:n,directory:r}),t[5]=r,t[6]=s,t[7]=n,t[8]=i,t[9]=f):f=t[9],f},yt=({readOnly:e=!1,active:t=!0,selectionOverride:i})=>{let a=m(),o=D(e=>e.remoteSession),s=i?.location??(a?.entry.location.hostId?a.entry.location:void 0),c=i?{...i,active:t,...s?{location:s,directory:i.directory??s.directory,sessionId:i.sessionId||(o&&r(o.location)===r(s)?o.sessionId:null)}:{}}:void 0,l=j(e=>e.currentSessionId),u=j(e=>e.currentSessionDirectory),d=j(e=>!!e.newSessionDraft?.open),f=j(e=>!!(e.newSessionDraft?.open&&e.newSessionDraft.pendingUserMessage&&(e.newSessionDraft.draftEstablishing||e.newSessionDraft.draftSubmitting))),p=z(),h=x(e=>e.isMobile),g=x(e=>e.isExpandedInput),_=n(),v=x(e=>e.workStatusPanelEnabled),y=x(e=>e.workStatusOverlayOpen),b=x(e=>e.setWorkStatusPanelFits),S=s&&o&&r(o.location)===r(s)?o:null,C=s?c?.sessionId??S?.sessionId??null:i?.sessionId??l,w=C,T=s?s.directory:i?.directory??u??p??null,{visible:E,fits:O,layoutAllows:k}=he({isMobile:h,isVSCode:_,directory:s?r(s):T}),A=s?!!C:i?!!i.sessionId:d?f:!!C,M=t&&!h&&!_&&!g&&A,N=M&&E,te=M&&v&&!O&&y;return Q.useEffect(()=>(b(M&&O),()=>b(!1)),[O,M,b]),(0,$.jsxs)(`div`,{className:ee(`relative h-full min-h-0 min-w-0`,N&&`yuri-chat-work-status-inline`),style:N?{"--yuri-work-status-reserve":`210px`}:void 0,children:[(0,$.jsx)(`div`,{className:`absolute inset-0 min-h-0 min-w-0`,children:(0,$.jsx)(pe,{sessionId:w||void 0,children:(0,$.jsx)(se,{readOnly:e,active:t,explicitSession:c})})}),M&&k?(0,$.jsx)(vt,{publishVisible:!0,visible:N,sessionId:C,directory:T}):null,M&&v&&!O?(0,$.jsx)(vt,{overlay:!0,visible:te,sessionId:C,directory:T}):null]})};function bt(e){return e.setWorkStatusPanelVisible}export{_t as n,yt as t};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{n as e,r as t}from"./rolldown-runtime-hePW80VL.js";import{r as n}from"./platform-CNdx57HN.js";import{ot as r,st as i}from"./vendor-base-ui-wXsskyKm.js";import{n as a}from"./vendor-react-BkccXcWz.js";import{n as o,s,t as c}from"./vendor-tanstack-react-query-DIb_ItL-.js";import{G as l,P as u,W as d}from"./runtime-file-resource-DKJJoOOc.js";import{a as f,r as p}from"./vendor-reactuses-core-DjKFMfz7.js";import{r as m}from"./useUIStore-P32bzAJc.js";import{Ba as ee,Dt as te,Pt as h,Yi as g,Yn as _,no as v,oa as y,ro as b,t as x}from"./ui-CU6n15y3.js";import{n as S}from"./Icon-zB0u-x9G.js";import{n as C,t as ne}from"./i18n-WsU03nwB.js";import{n as w}from"./ScrollableOverlay-DAMUOn67.js";import{n as re,t as T}from"./MobileResizableSheet-O2gv2sCB.js";import{i as E,t as D}from"./vendor-framer-motion-D5NyyC73.js";import{n as ie,o as ae,r as oe,t as O}from"./dialog-B2Po85oU.js";import{c as k,n as se,r as A,t as ce}from"./dropdown-menu-vW7wfT5z.js";import{a as j,n as M,r as le,t as ue}from"./context-menu-D73tnkiI.js";import{t as de}from"./textarea-ChLN9tnA.js";import{n as fe}from"./mobileBackNavigation-Ch0aK3t9.js";import{t as pe}from"./input-BpDiYSsP.js";import{D as N,E as P,O as me,T as he,_ as F,k as ge}from"./assistantQueries-DkAmjFg7.js";import{n as I}from"./AgentAvatar-5tMBB3OP.js";import{t as L}from"./MobileDetailNavigation-DKv1HfQX.js";import{t as R}from"./checkbox-hYuewn9u.js";import{a as z,c as B,r as _e}from"./insertionBoundaries-Cu6Djn8S.js";import{t as ve}from"./MobileOverlayPanel-Pr-vLaIF.js";import{t as V}from"./vendor-motion-vLNN8EMu.js";import{c as H,i as ye,n as be,s as xe,t as Se}from"./select-Ojd202kE.js";import{a as U,i as Ce,n as we}from"./projectMeta-vIaGFaQr.js";import{r as Te,t as Ee}from"./router-DXUi1sBd.js";import{t as De}from"./scheduledTaskNavigation-DpfZSGu8.js";import{t as Oe}from"./switch-BN9zvb0m.js";import{t as ke}from"./MobileTabPageHeader-T0zUz7Wl.js";import{t as Ae}from"./sortAssistantContacts-CcEdm3mS.js";import{t as W}from"./ModelSelector-BP_s_VhY.js";import{t as je}from"./AgentSelector-Cb7GNCSr.js";import{t as Me}from"./vendor-cron-parser-BmO80h0C.js";var G=t(i(),1),Ne=a(),Pe=`yuri-settings-group-row border-b border-[var(--yuri-settings-row-divider)] last:border-b-0`,Fe=`yuri-settings-group-label`,Ie=Me();function K(e){if(!e||!e.trim())return{valid:!1,error:`required`};try{return Ie.CronExpressionParser.parse(e),{valid:!0}}catch(e){return{valid:!1,error:e instanceof Error?e.message:`Invalid cron expression`}}}function Le(e,t,n=4){try{let r=t?{tz:t,currentDate:new Date}:{currentDate:new Date},i=Ie.CronExpressionParser.parse(e,r),a=[];for(let e=0;e<n;e+=1){let e=i.next();e&&a.push(e.toDate())}return a}catch{return[]}}var Re=[{expression:`*/5 * * * *`,labelKey:`sessions.scheduledTasks.editor.cronExpression.examples.every5min`},{expression:`0 * * * *`,labelKey:`sessions.scheduledTasks.editor.cronExpression.examples.everyHour`},{expression:`0 9 * * 1`,labelKey:`sessions.scheduledTasks.editor.cronExpression.examples.monday9am`},{expression:`0 9,17 * * *`,labelKey:`sessions.scheduledTasks.editor.cronExpression.examples.9am5pm`},{expression:`0 0 1 * *`,labelKey:`sessions.scheduledTasks.editor.cronExpression.examples.firstOfMonth`}],q=r(),ze=[0,1,2,3,4,5,6],Be=`!h-9 !min-h-9 w-full min-w-0 rounded-full border-0 bg-[var(--surface-elevated)] px-3 py-1 ring-1 ring-inset ring-border/60 transition-[background-color,box-shadow] duration-150 ease-out hover:[&:not(:focus)]:bg-[var(--surface-subtle)] hover:[&:not(:focus)]:ring-transparent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--interactive-focus-ring)] data-[popup-open]:bg-[var(--surface-subtle)] data-[popup-open]:shadow-sm motion-reduce:transition-none`,Ve=`yuri-settings-inline-value`,He=`yuri-settings-split-row ${Pe}`,J=Ve,Y=He,Ue=()=>{let e=new Date;return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}`},X=e=>{let t=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e);if(!t)return null;let n=Number(t[1]),r=Number(t[2]),i=Number(t[3]),a=new Date(n,r-1,i);return Number.isNaN(a.getTime())||a.getFullYear()!==n||a.getMonth()!==r-1||a.getDate()!==i?null:a},We=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}`,Ge=(e,t,n)=>{let r=X(e);return r?new Intl.DateTimeFormat(n,{month:`short`,day:`numeric`,year:`numeric`}).format(r):t},Z=(e,t)=>new Date(e.getFullYear(),e.getMonth()+t,1),Ke=(e,t)=>{let n=e.getFullYear(),r=e.getMonth(),i=(new Date(n,r,1).getDay()-t+7)%7,a=new Date(n,r+1,0).getDate(),o=new Date(n,r,0).getDate(),s=[];for(let e=0;e<42;e+=1){let t=e-i+1;if(t<=0){let e=o+t;s.push({date:new Date(n,r-1,e),inCurrentMonth:!1});continue}if(t>a){s.push({date:new Date(n,r+1,t-a),inCurrentMonth:!1});continue}s.push({date:new Date(n,r,t),inCurrentMonth:!0})}return s},Q=e=>{let t=/^([01]\d|2[0-3]):([0-5]\d)$/.exec(e);if(!t)return{hour24:`00`,hour12:`12`,minute:`00`,meridiem:`AM`};let n=Number(t[1]),r=t[2],i=n>=12?`PM`:`AM`,a=n%12==0?12:n%12;return{hour24:String(n).padStart(2,`0`),hour12:String(a).padStart(2,`0`),minute:r,meridiem:i}},qe=(e,t,n)=>{let r=Number(e),i=Number(t),a=Number.isFinite(r)?Math.min(12,Math.max(1,r)):12,o=Number.isFinite(i)?Math.min(59,Math.max(0,i)):0,s=a%12;return n===`PM`&&(s+=12),`${String(s).padStart(2,`0`)}:${String(o).padStart(2,`0`)}`},$=(e,t)=>{let{max:n,min:r=0,loop:i=!1}=t,a=Number.parseInt(e,10);return Number.isFinite(a)?(i?(a>n&&(a=r),a<r&&(a=n)):(a>n&&(a=n),a<r&&(a=r)),String(a).padStart(2,`0`)):`00`},Je=e=>/^(0[1-9]|1[0-2])$/.test(e)?e:$(e,{min:1,max:12}),Ye=e=>/^[0-5][0-9]$/.test(e)?e:$(e,{max:59}),Xe=(e,t)=>$(String(Number.parseInt(e,10)+t),{min:1,max:12,loop:!0}),Ze=(e,t)=>$(String(Number.parseInt(e,10)+t),{min:0,max:59,loop:!0}),Qe=e=>{try{let t=Intl.Locale;if(typeof t!=`function`)return 1;let n=new t(e).weekInfo?.firstDay;return typeof n==`number`?n%7:1}catch{return 1}},$e=e=>{try{let t=new Intl.DateTimeFormat(e,{hour:`numeric`}).resolvedOptions();return typeof t.hour12==`boolean`?!t.hour12:t.hourCycle===`h23`||t.hourCycle===`h24`}catch{return!0}},et=e=>{let t=new Intl.DateTimeFormat(e,{weekday:`short`}),n=new Date(2023,0,1);return ze.map(e=>t.format(new Date(n.getFullYear(),n.getMonth(),n.getDate()+e)))},tt=(e,t)=>[...e.slice(t),...e.slice(0,t)],nt=e=>{let t=(0,Ne.c)(9),{htmlFor:n,required:r,className:i,children:a}=e,o;t[0]===i?o=t[1]:(o=v(`typography-ui-label font-normal text-foreground`,i),t[0]=i,t[1]=o);let s;t[2]===r?s=t[3]:(s=r&&(0,q.jsx)(`span`,{className:`ml-0.5 text-destructive`,children:`*`}),t[2]=r,t[3]=s);let c;return t[4]!==a||t[5]!==n||t[6]!==o||t[7]!==s?(c=(0,q.jsx)(`div`,{className:`flex items-center gap-1.5`,children:(0,q.jsxs)(`label`,{htmlFor:n,className:o,children:[a,s]})}),t[4]=a,t[5]=n,t[6]=o,t[7]=s,t[8]=c):c=t[8],c},rt=e=>{let t=(0,Ne.c)(85),{value:n,onChange:r,className:i,use24Hour:a,hourAriaLabel:o,minuteAriaLabel:s,periodAriaLabel:c,amLabel:l,pmLabel:u}=e,d;t[0]===n?d=t[1]:(d=Q(n),t[0]=n,t[1]=d);let f=d,p=G.useRef(null),m=G.useRef(null),[ee,te]=G.useState(null),[h,g]=G.useState(null),_=G.useRef(null),y=G.useRef(null),b;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(b=e=>{_.current=e,te(e)},t[2]=b):b=t[2];let x=b,S;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(S=e=>{y.current=e,g(e)},t[3]=S):S=t[3];let C=S,ne=pt,w=mt,re=ht,T;t[4]!==r||t[5]!==f.meridiem||t[6]!==f.minute||t[7]!==a?(T=e=>{let t=e.replace(/\D/g,``).slice(0,2);x(t),t.length===2&&(r(a?re(ne(t),f.minute):qe(Je(t),f.minute,f.meridiem)),x(null),m.current?.focus())},t[4]=r,t[5]=f.meridiem,t[6]=f.minute,t[7]=a,t[8]=T):T=t[8];let E=T,D;t[9]!==r||t[10]!==f.meridiem||t[11]!==f.minute||t[12]!==a?(D=()=>{let e=_.current;if(e!==null&&(x(null),e.length!==0)){if(a){r(re(ne(e.padStart(2,`0`)),f.minute));return}r(qe(Je(e.padStart(2,`0`)),f.minute,f.meridiem))}},t[9]=r,t[10]=f.meridiem,t[11]=f.minute,t[12]=a,t[13]=D):D=t[13];let ie=D,ae;t[14]!==r||t[15]!==f.hour12||t[16]!==f.hour24||t[17]!==f.meridiem||t[18]!==a?(ae=e=>{let t=e.replace(/\D/g,``).slice(0,2);C(t),t.length===2&&(r(a?re(f.hour24,Ye(t)):qe(f.hour12,Ye(t),f.meridiem)),C(null))},t[14]=r,t[15]=f.hour12,t[16]=f.hour24,t[17]=f.meridiem,t[18]=a,t[19]=ae):ae=t[19];let oe=ae,O;t[20]!==r||t[21]!==f.hour12||t[22]!==f.hour24||t[23]!==f.meridiem||t[24]!==a?(O=()=>{let e=y.current;e!==null&&(C(null),e.length!==0&&r(a?re(f.hour24,Ye(e.padStart(2,`0`))):qe(f.hour12,Ye(e.padStart(2,`0`)),f.meridiem)))},t[20]=r,t[21]=f.hour12,t[22]=f.hour24,t[23]=f.meridiem,t[24]=a,t[25]=O):O=t[25];let k=O,se;t[26]!==r||t[27]!==f.hour12||t[28]!==f.hour24||t[29]!==f.meridiem||t[30]!==f.minute||t[31]!==a?(se=e=>r(a?re(w(f.hour24,e),f.minute):qe(Xe(f.hour12,e),f.minute,f.meridiem)),t[26]=r,t[27]=f.hour12,t[28]=f.hour24,t[29]=f.meridiem,t[30]=f.minute,t[31]=a,t[32]=se):se=t[32];let A=se,ce;t[33]!==r||t[34]!==f.hour12||t[35]!==f.hour24||t[36]!==f.meridiem||t[37]!==f.minute||t[38]!==a?(ce=e=>r(a?re(f.hour24,Ze(f.minute,e)):qe(f.hour12,Ze(f.minute,e),f.meridiem)),t[33]=r,t[34]=f.hour12,t[35]=f.hour24,t[36]=f.meridiem,t[37]=f.minute,t[38]=a,t[39]=ce):ce=t[39];let j=ce,M;t[40]!==r||t[41]!==f.hour12||t[42]!==f.meridiem||t[43]!==f.minute?(M=e=>{e!==f.meridiem&&r(qe(f.hour12,f.minute,e))},t[40]=r,t[41]=f.hour12,t[42]=f.meridiem,t[43]=f.minute,t[44]=M):M=t[44];let le=M,ue;t[45]!==ie||t[46]!==A?(ue=e=>{if(e.key===`ArrowRight`){e.preventDefault(),ie(),m.current?.focus();return}(e.key===`ArrowUp`||e.key===`ArrowDown`)&&(e.preventDefault(),x(null),A(e.key===`ArrowUp`?1:-1))},t[45]=ie,t[46]=A,t[47]=ue):ue=t[47];let de=ue,fe;t[48]!==k||t[49]!==j?(fe=e=>{if(e.key===`ArrowLeft`&&(e.currentTarget.selectionStart??0)===0){e.preventDefault(),k(),p.current?.focus();return}(e.key===`ArrowUp`||e.key===`ArrowDown`)&&(e.preventDefault(),C(null),j(e.key===`ArrowUp`?1:-1))},t[48]=k,t[49]=j,t[50]=fe):fe=t[50];let pe=fe,N=a?`px-2`:`pl-2 pr-1`,P;t[51]!==i||t[52]!==N?(P=v(`flex h-9 w-full min-w-0 items-center gap-1 rounded-full border-0 bg-[var(--surface-elevated)] ring-1 ring-inset ring-border/60 transition duration-200 ease-out hover:[&:not(:focus-within)]:bg-[var(--surface-subtle)] hover:[&:not(:focus-within)]:ring-transparent focus-within:ring-2 focus-within:ring-[var(--interactive-focus-ring)]`,N,i),t[51]=i,t[52]=N,t[53]=P):P=t[53];let me=ee??(a?f.hour24:f.hour12),he;t[54]===E?he=t[55]:(he=e=>E(e.target.value),t[54]=E,t[55]=he);let F;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(F=()=>x(``),t[56]=F):F=t[56];let ge;t[57]!==ie||t[58]!==o||t[59]!==de||t[60]!==me||t[61]!==he?(ge=(0,q.jsx)(`input`,{ref:p,inputMode:`numeric`,value:me,onChange:he,onKeyDown:de,onFocus:F,onBlur:ie,maxLength:2,"aria-label":o,className:`h-7 w-7 shrink-0 rounded-sm bg-transparent text-center font-mono text-sm tabular-nums text-foreground outline-none caret-transparent focus:bg-interactive-hover`}),t[57]=ie,t[58]=o,t[59]=de,t[60]=me,t[61]=he,t[62]=ge):ge=t[62];let I;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,q.jsx)(`span`,{className:`font-mono text-sm text-muted-foreground`,children:`:`}),t[63]=I):I=t[63];let L=h??f.minute,R;t[64]===oe?R=t[65]:(R=e=>oe(e.target.value),t[64]=oe,t[65]=R);let z;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(z=()=>C(``),t[66]=z):z=t[66];let B;t[67]!==k||t[68]!==s||t[69]!==pe||t[70]!==L||t[71]!==R?(B=(0,q.jsx)(`input`,{ref:m,inputMode:`numeric`,value:L,onChange:R,onKeyDown:pe,onFocus:z,onBlur:k,maxLength:2,"aria-label":s,className:`h-7 w-7 shrink-0 rounded-sm bg-transparent text-center font-mono text-sm tabular-nums text-foreground outline-none caret-transparent focus:bg-interactive-hover`}),t[67]=k,t[68]=s,t[69]=pe,t[70]=L,t[71]=R,t[72]=B):B=t[72];let _e;t[73]!==l||t[74]!==f.meridiem||t[75]!==c||t[76]!==u||t[77]!==le||t[78]!==a?(_e=a?null:(0,q.jsxs)(Se,{value:f.meridiem,onValueChange:e=>le(e),children:[(0,q.jsx)(xe,{"aria-label":c,className:`ml-1 h-7 w-fit border-0 bg-transparent pl-2 pr-1 shadow-none hover:bg-interactive-hover focus:ring-0`,children:(0,q.jsx)(H,{})}),(0,q.jsxs)(be,{className:`motion-reduce:transition-none`,children:[(0,q.jsx)(ye,{value:`AM`,children:l}),(0,q.jsx)(ye,{value:`PM`,children:u})]})]}),t[73]=l,t[74]=f.meridiem,t[75]=c,t[76]=u,t[77]=le,t[78]=a,t[79]=_e):_e=t[79];let ve;return t[80]!==P||t[81]!==ge||t[82]!==B||t[83]!==_e?(ve=(0,q.jsxs)(`div`,{className:P,children:[ge,I,B,_e]}),t[80]=P,t[81]=ge,t[82]=B,t[83]=_e,t[84]=ve):ve=t[84],ve},it=e=>new Date(e.getFullYear(),e.getMonth(),1),at=()=>{let e=new Date;return new Date(e.getFullYear(),e.getMonth(),e.getDate())},ot=(e,t)=>e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate(),st=e=>{if(!e)return[`09:00`];let t=(Array.isArray(e.schedule.times)?e.schedule.times:e.schedule.time?[e.schedule.time]:[]).filter(e=>typeof e==`string`&&/^([01]\d|2[0-3]):([0-5]\d)$/.test(e)).map(e=>e.trim()),n=Array.from(new Set(t)).sort((e,t)=>e.localeCompare(t));return n.length>0?n:[`09:00`]},ct=(e,t)=>{let n=Intl.DateTimeFormat().resolvedOptions().timeZone||`UTC`;return e?{id:e.id,name:e.name,enabled:e.enabled,schedule:{kind:e.schedule.kind===`cron`?`cron`:e.schedule.kind===`once`?`once`:e.schedule.kind===`weekly`?`weekly`:`daily`,times:st(e),onceDate:typeof e.schedule.date==`string`&&/^\d{4}-\d{2}-\d{2}$/.test(e.schedule.date)?e.schedule.date:Ue(),onceTime:typeof e.schedule.time==`string`&&/^([01]\d|2[0-3]):([0-5]\d)$/.test(e.schedule.time)?e.schedule.time:`09:00`,weekdays:Array.isArray(e.schedule.weekdays)?e.schedule.weekdays:[1],timezone:e.schedule.timezone||n,cronExpression:e.schedule.kind===`cron`&&typeof e.schedule.cron==`string`?e.schedule.cron:``},execution:{prompt:e.execution.prompt,providerID:e.execution.providerID,modelID:e.execution.modelID,variant:e.execution.variant||``,agent:e.execution.agent||``,goalEnabled:e.execution.goalEnabled===!0},state:e.state}:{name:``,enabled:!0,schedule:{kind:`daily`,times:[`09:00`],onceDate:Ue(),onceTime:`09:00`,weekdays:[1],timezone:n,cronExpression:``},execution:{prompt:``,providerID:t.providerID,modelID:t.modelID,variant:t.variant,agent:t.agent,goalEnabled:!1}}},lt=(e,t)=>{if(!e.name.trim())return t(`sessions.scheduledTasks.editor.validation.taskNameRequired`);if(!e.execution.prompt.trim())return t(`sessions.scheduledTasks.editor.validation.promptRequired`);if(!e.execution.providerID.trim()||!e.execution.modelID.trim())return t(`sessions.scheduledTasks.editor.validation.modelRequired`);if(e.schedule.kind===`once`){if(!/^\d{4}-\d{2}-\d{2}$/.test(e.schedule.onceDate))return t(`sessions.scheduledTasks.editor.validation.dateFormat`);if(!/^([01]\d|2[0-3]):([0-5]\d)$/.test(e.schedule.onceTime))return t(`sessions.scheduledTasks.editor.validation.timeFormat`)}else if(e.schedule.kind===`cron`){if(!e.schedule.cronExpression.trim())return t(`sessions.scheduledTasks.editor.validation.cronRequired`);if(!K(e.schedule.cronExpression).valid)return t(`sessions.scheduledTasks.editor.validation.cronInvalid`)}else if(e.schedule.times.filter(e=>/^([01]\d|2[0-3]):([0-5]\d)$/.test(e)).length===0)return t(`sessions.scheduledTasks.editor.validation.atLeastOneTime`);return e.schedule.kind===`weekly`&&e.schedule.weekdays.length===0?t(`sessions.scheduledTasks.editor.validation.atLeastOneWeekday`):e.schedule.timezone.trim()?null:t(`sessions.scheduledTasks.editor.validation.timezoneRequired`)},ut=e=>{let t=e.filter(e=>/^([01]\d|2[0-3]):([0-5]\d)$/.test(e));return Array.from(new Set(t)).sort((e,t)=>e.localeCompare(t))},dt=e=>{let t=(0,Ne.c)(74),{draft:n,setDraft:r,locale:i,t:a,panel:o,mobilePanel:s}=e,c=o!==void 0&&o,l=s!==void 0&&s,u=c||l,d=l?Y:He,f=n.schedule.cronExpression,p;t[0]===f?p=t[1]:(p=f.trim()?K(f):null,t[0]=f,t[1]=p);let m=p,ee;bb0:{if(!m?.valid||!f.trim()){let e;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=[],t[2]=e):e=t[2],ee=e;break bb0}let e;t[3]!==f||t[4]!==n.schedule.timezone?(e=Le(f,n.schedule.timezone),t[3]=f,t[4]=n.schedule.timezone,t[5]=e):e=t[5],ee=e}let te=ee,h;t[6]!==n.schedule.timezone||t[7]!==i?(h=e=>new Intl.DateTimeFormat(i,{timeZone:n.schedule.timezone,month:`short`,day:`numeric`,hour:`numeric`,minute:`2-digit`}).format(e),t[6]=n.schedule.timezone,t[7]=i,t[8]=h):h=t[8];let g=h,y=u&&`gap-0`,b;t[9]===y?b=t[10]:(b=v(`flex flex-col gap-3`,y),t[9]=y,t[10]=b);let x=u&&d,S;t[11]===x?S=t[12]:(S=v(`flex flex-col gap-1`,x),t[11]=x,t[12]=S);let C;t[13]===a?C=t[14]:(C=a(`sessions.scheduledTasks.editor.cronExpression.label`),t[13]=a,t[14]=C);let ne;t[15]===C?ne=t[16]:(ne=(0,q.jsx)(nt,{htmlFor:`sched-cron`,required:!0,children:C}),t[15]=C,t[16]=ne);let w=u?``:void 0,re=u&&`yuri-settings-split-row-control flex-wrap`,T;t[17]===re?T=t[18]:(T=v(`min-w-0`,re),t[17]=re,t[18]=T);let E;t[19]===r?E=t[20]:(E=e=>r(t=>({...t,schedule:{...t.schedule,cronExpression:e.target.value}})),t[19]=r,t[20]=E);let D;t[21]===a?D=t[22]:(D=a(`sessions.scheduledTasks.editor.cronExpression.placeholder`),t[21]=a,t[22]=D);let ie=u&&`min-w-[140px] text-right`,ae;t[23]===ie?ae=t[24]:(ae=v(`w-full font-mono`,ie),t[23]=ie,t[24]=ae);let oe;t[25]!==f||t[26]!==E||t[27]!==D||t[28]!==ae?(oe=(0,q.jsx)(pe,{id:`sched-cron`,value:f,onChange:E,placeholder:D,className:ae}),t[25]=f,t[26]=E,t[27]=D,t[28]=ae,t[29]=oe):oe=t[29];let O;t[30]!==f||t[31]!==m||t[32]!==a?(O=m&&!m.valid&&f.trim()?(0,q.jsx)(`span`,{className:`w-full typography-micro text-right text-destructive`,children:a(`sessions.scheduledTasks.editor.validation.cronInvalid`)}):null,t[30]=f,t[31]=m,t[32]=a,t[33]=O):O=t[33];let k;t[34]!==w||t[35]!==T||t[36]!==oe||t[37]!==O?(k=(0,q.jsxs)(`div`,{"data-settings-value":w,className:T,children:[oe,O]}),t[34]=w,t[35]=T,t[36]=oe,t[37]=O,t[38]=k):k=t[38];let se;t[39]!==ne||t[40]!==k||t[41]!==S?(se=(0,q.jsxs)(`div`,{className:S,children:[ne,k]}),t[39]=ne,t[40]=k,t[41]=S,t[42]=se):se=t[42];let A;t[43]!==g||t[44]!==u||t[45]!==te||t[46]!==d||t[47]!==a?(A=te.length>0?(0,q.jsxs)(`div`,{className:v(`flex flex-col gap-1`,u&&[d,`yuri-scheduled-task-detail-row`]),children:[(0,q.jsx)(`span`,{className:`typography-meta text-muted-foreground`,children:a(`sessions.scheduledTasks.editor.cronExpression.nextRuns`)}),(0,q.jsx)(`span`,{"data-settings-value":u?``:void 0,className:`flex min-w-0 flex-wrap gap-x-4 gap-y-1 typography-micro text-muted-foreground`,children:te.map(e=>(0,q.jsx)(`span`,{className:`whitespace-nowrap tabular-nums`,children:g(e)},e.toISOString()))})]}):null,t[43]=g,t[44]=u,t[45]=te,t[46]=d,t[47]=a,t[48]=A):A=t[48];let ce;t[49]!==u||t[50]!==d?(ce=u&&[d,`yuri-scheduled-task-detail-row`],t[49]=u,t[50]=d,t[51]=ce):ce=t[51];let j;t[52]===ce?j=t[53]:(j=v(`flex flex-col gap-1`,ce),t[52]=ce,t[53]=j);let M;t[54]===a?M=t[55]:(M=a(`sessions.scheduledTasks.editor.cronExpression.examples`),t[54]=a,t[55]=M);let le;t[56]===M?le=t[57]:(le=(0,q.jsx)(`span`,{className:`typography-meta text-muted-foreground`,children:M}),t[56]=M,t[57]=le);let ue=u?``:void 0,de;t[58]!==f||t[59]!==r||t[60]!==a?(de=Re.map(e=>(0,q.jsx)(_,{type:`button`,variant:`chip`,size:`xs`,"aria-pressed":f.trim()===e.expression,title:e.expression,onClick:()=>r(t=>({...t,schedule:{...t.schedule,cronExpression:e.expression}})),children:a(e.labelKey)},e.expression)),t[58]=f,t[59]=r,t[60]=a,t[61]=de):de=t[61];let fe;t[62]!==ue||t[63]!==de?(fe=(0,q.jsx)(`div`,{"data-settings-value":ue,className:`flex min-w-0 flex-wrap gap-1.5`,children:de}),t[62]=ue,t[63]=de,t[64]=fe):fe=t[64];let N;t[65]!==j||t[66]!==le||t[67]!==fe?(N=(0,q.jsxs)(`div`,{className:j,children:[le,fe]}),t[65]=j,t[66]=le,t[67]=fe,t[68]=N):N=t[68];let P;return t[69]!==se||t[70]!==A||t[71]!==N||t[72]!==b?(P=(0,q.jsxs)(`div`,{className:b,children:[se,A,N]}),t[69]=se,t[70]=A,t[71]=N,t[72]=b,t[73]=P):P=t[73],P};function ft(e){let{open:t,task:n,onOpenChange:r,onSave:i,presentation:a=`dialog`,onDirtyChange:o,onRun:s,onOpenTaskHistory:c,onDelete:l,onToggleEnabled:u,actionBusy:d=!1,projectID:f=``,projectOptions:p=[],onProjectChange:ee}=e,te=a===`panel`,h=a===`mobile-panel`,b=a===`mobile-tab`,C=h||b,re=h||b,T=te||C,E=C?J:Ve,D=C?Y:He,{t:j,locale:M}=ne(),le=g(e=>e.loadProviders),ue=g(e=>e.loadAgents),fe=g(e=>e.providers),N=g(e=>e.currentProviderId),P=g(e=>e.currentModelId),me=g(e=>e.currentVariant||``),he=g(e=>e.currentAgentName||``),F=m(e=>e.timeFormatPreference),ge=m(e=>e.weekStartPreference),I=m(e=>e.isMobile),[V,U]=G.useState(()=>ct(n,{providerID:N,modelID:P,variant:me,agent:he})),[Ce,we]=G.useState(!1),[Te,Ee]=G.useState(!1),[De,ke]=G.useState(!1),[Ae,Me]=G.useState(``),[Ne,Pe]=G.useState(!1),[Ie,K]=G.useState(``),[Le,Re]=G.useState(()=>{let e=X(n?.schedule?.date||``)||new Date;return new Date(e.getFullYear(),e.getMonth(),1)}),Ue=G.useRef(null),Q=G.useRef(null),qe=G.useRef(null),$=G.useRef(null),Je=G.useRef(``),Ye=G.useRef(void 0),Xe=G.useRef(n);Xe.current=n;let Ze=n?.id||null,st=G.useMemo(()=>$e(M),[M]),ft=G.useMemo(()=>Qe(M),[M]),pt=G.useMemo(()=>F===`24h`||F!==`12h`&&st,[F,st]),mt=G.useMemo(()=>ge===`sunday`?0:ge===`monday`?1:ft,[ge,ft]),ht=G.useMemo(()=>{let e=et(M);return tt(ze.map(t=>({value:t,label:e[t]||``})),mt)},[M,mt]);G.useEffect(()=>{t&&(le({source:`scheduledTaskEditor`}),ue({source:`scheduledTaskEditor`}))},[t,le,ue]),G.useEffect(()=>{if(!t){Ye.current=void 0;return}if(Ye.current===Ze)return;Ye.current=Ze;let e=Xe.current,n=ct(e,{providerID:N,modelID:P,variant:me,agent:he});Je.current=JSON.stringify(n),U(n),o?.(!1);let r=X(e?.schedule?.date||``)||new Date;Re(new Date(r.getFullYear(),r.getMonth(),1)),Ee(!1),Pe(!1),ke(!1),K(``),Me(``)},[t,Ze,N,P,me,he,o]),G.useEffect(()=>{if(!(!t||!n||V.id!==n.id||V.enabled===n.enabled)&&(U(e=>({...e,enabled:n.enabled})),Je.current)){let e=JSON.parse(Je.current);Je.current=JSON.stringify({...e,enabled:n.enabled})}},[V.enabled,V.id,t,n]),G.useEffect(()=>{!t||!Je.current||o?.(JSON.stringify(V)!==Je.current)},[V,o,t]),G.useEffect(()=>{if(!Te)return;let e=e=>{Ue.current&&!Ue.current.contains(e.target)&&Ee(!1)};return document.addEventListener(`mousedown`,e),()=>{document.removeEventListener(`mousedown`,e)}},[Te]);let gt=G.useMemo(()=>fe.find(e=>e.id===V.execution.providerID)?.models?.find(e=>e.id===V.execution.modelID),[V.execution.modelID,V.execution.providerID,fe]),_t=G.useMemo(()=>gt?.variants?Object.keys(gt.variants):[],[gt]);G.useEffect(()=>{!gt||!V.execution.variant||_t.includes(V.execution.variant)||U(e=>({...e,execution:{...e.execution,variant:``}}))},[_t,V.execution.variant,gt]);let vt=G.useCallback((e,t)=>{U(n=>{let r=new Set(n.schedule.weekdays);return t?r.add(e):r.delete(e),{...n,schedule:{...n.schedule,weekdays:Array.from(r).sort((e,t)=>e-t)}}})},[]),yt=G.useCallback((e,t)=>{U(n=>{let r=n.schedule.times.slice();return r[e]=t,{...n,schedule:{...n.schedule,times:r}}})},[]),bt=G.useCallback(e=>{U(t=>{let n=t.schedule.times.filter((t,n)=>n!==e);return{...t,schedule:{...t.schedule,times:n.length>0?n:[`09:00`]}}})},[]),xt=G.useCallback(()=>{U(e=>({...e,schedule:{...e.schedule,times:[...e.schedule.times,`12:00`]}}))},[]),St=G.useMemo(()=>at(),[]),Ct=G.useMemo(()=>it(St),[St]),wt=G.useMemo(()=>{let e=X(V.schedule.onceDate);return e?ot(e,St)?j(`sessions.scheduledTasks.editor.date.today`):new Intl.DateTimeFormat(M,{weekday:`short`}).format(e):null},[V.schedule.onceDate,M,j,St]),Tt=G.useMemo(()=>it(Le).getTime()<=Ct.getTime(),[Le,Ct]),Et=G.useMemo(()=>ht.map(e=>e.label),[ht]),Dt=G.useCallback(e=>{U(t=>({...t,schedule:{...t.schedule,onceDate:e}}))},[]),Ot=G.useCallback((e,t)=>{if(e.startsWith(`/`)){let n=e.indexOf(` `),r=e.indexOf(`
|
|
2
|
-
`),i=Math.min(n===-1?e.length:n,r===-1?e.length:r);if(t<=i&&n===-1){K(e.substring(1,i)),Pe(!0),ke(!1);return}}Pe(!1);let n=e.substring(0,t),r=n.lastIndexOf(`@`);if(r!==-1){let e=r>0?n[r-1]:null,t=n.substring(r+1);(!e||/\s/.test(e))&&!t.includes(` `)&&!t.includes(`
|
|
3
|
-
`)?(Me(t),ke(!0)):ke(!1);return}ke(!1)},[]),kt=G.useCallback(e=>{U(t=>({...t,execution:{...t.execution,prompt:e}}))},[]),At=G.useCallback(e=>{let t=V.execution.prompt,n=Q.current?.selectionStart??t.length,r=t.substring(0,n).lastIndexOf(`@`),i=e.relativePath&&e.relativePath.trim().length>0?e.relativePath.trim():e.path||e.name,a=_e(t,r===-1?n:r,n,`@${i}`);kt(a.text),ke(!1),Me(``),requestAnimationFrame(()=>{let e=Q.current;e&&(e.selectionStart=a.caret,e.selectionEnd=a.caret,e.focus()),Ot(a.text,a.caret)})},[V.execution.prompt,kt,Ot]),jt=G.useCallback(e=>{let t=V.execution.prompt,n=Q.current?.selectionStart??t.length,r=t.substring(0,n).lastIndexOf(`@`),i=_e(t,r===-1?n:r,n,`@${e}`);kt(i.text),ke(!1),Me(``),requestAnimationFrame(()=>{let e=Q.current;e&&(e.selectionStart=i.caret,e.selectionEnd=i.caret,e.focus()),Ot(i.text,i.caret)})},[V.execution.prompt,kt,Ot]),Mt=G.useCallback(e=>{let t=`/${e.name} `;kt(t),Pe(!1),K(``),requestAnimationFrame(()=>{let e=Q.current;e&&(e.focus(),e.selectionStart=e.value.length,e.selectionEnd=e.value.length),Ot(t,t.length)})},[kt,Ot]),Nt=G.useCallback(e=>{if(Ne&&$.current&&(e.key===`Enter`||e.key===`ArrowUp`||e.key===`ArrowDown`||e.key===`Escape`||e.key===`Tab`)){e.preventDefault(),$.current.handleKeyDown(e.key);return}De&&qe.current&&(e.key===`Enter`||e.key===`ArrowUp`||e.key===`ArrowDown`||e.key===`Escape`||e.key===`Tab`)&&(e.preventDefault(),qe.current.handleKeyDown(e.key))},[Ne,De]),Pt=G.useCallback(async()=>{let e=lt(V,j);if(e){x.error(e);return}let t={...V.id?{id:V.id}:{},name:V.name.trim(),enabled:V.enabled,schedule:{kind:V.schedule.kind,timezone:V.schedule.timezone.trim(),...V.schedule.kind===`cron`?{cron:V.schedule.cronExpression.trim()}:V.schedule.kind===`once`?{date:V.schedule.onceDate,time:V.schedule.onceTime}:{times:ut(V.schedule.times),...V.schedule.kind===`weekly`?{weekdays:V.schedule.weekdays}:{}}},execution:{prompt:V.execution.prompt,providerID:V.execution.providerID,modelID:V.execution.modelID,...V.execution.variant.trim()?{variant:V.execution.variant.trim()}:{},...V.execution.agent.trim()?{agent:V.execution.agent.trim()}:{},...V.execution.goalEnabled?{goalEnabled:!0}:{}},...V.state?{state:V.state}:{}};we(!0);try{let e=await i(t);if(a===`panel`){let t=ct(e||n,{providerID:N,modelID:P,variant:me,agent:he});Je.current=JSON.stringify(t),U(t),o?.(!1)}else r(!1)}catch(e){x.error(e instanceof Error?e.message:j(`sessions.scheduledTasks.editor.toast.saveFailed`))}finally{we(!1)}},[he,P,N,me,V,o,r,i,a,j,n]),Ft=G.useId(),It=G.useCallback(()=>typeof document>`u`?!1:!!document.querySelector(`[data-slot="dropdown-menu-content"], [data-slot="select-content"]`),[]),Lt=j(n?`sessions.scheduledTasks.editor.title.edit`:`sessions.scheduledTasks.editor.title.new`),Rt=j(`sessions.scheduledTasks.editor.description`),zt=(0,q.jsxs)(`div`,{className:v(`yuri-settings-workspace yuri-settings-page-content yuri-scheduled-task-form`,I?`yuri-settings-workspace-mobile`:`yuri-settings-workspace-desktop`),children:[(0,q.jsxs)(`div`,{className:v(`flex flex-col gap-1`,(te||b)&&`hidden`),children:[(0,q.jsx)(nt,{htmlFor:`sched-name`,required:!0,children:j(`sessions.scheduledTasks.editor.taskName.label`)}),(0,q.jsx)(pe,{id:`sched-name`,value:V.name,onChange:e=>U(t=>({...t,name:e.target.value})),placeholder:j(`sessions.scheduledTasks.editor.taskName.placeholder`),maxLength:80,required:!0,"aria-invalid":!V.name.trim(),className:`yuri-scheduled-task-title w-full`})]}),(0,q.jsxs)(`div`,{className:v(`flex flex-col gap-3 border-t border-border/40 pt-5`,T&&`yuri-settings-group order-4 animate-in fade-in slide-in-from-right-1 border-0 pt-0 duration-200 [animation-delay:80ms] [animation-fill-mode:both] motion-reduce:animate-none`),children:[T?(0,q.jsx)(`h3`,{className:Fe,children:j(`sessions.scheduledTasks.editor.panel.frequency`)}):null,(0,q.jsxs)(`div`,{className:v(T&&`yuri-settings-group-card`,T&&V.schedule.kind===`once`&&Te&&`overflow-visible`),children:[(0,q.jsx)(`div`,{className:v(`grid grid-cols-1 gap-x-4 gap-y-3`,T&&`flex flex-col gap-0`,!I&&!T&&`sm:grid-cols-2`),children:(0,q.jsxs)(`div`,{className:v(`flex min-w-0 flex-col gap-1`,T&&[D,`last:border-b`]),children:[(0,q.jsx)(nt,{children:j(`sessions.scheduledTasks.editor.scheduleType.label`)}),(0,q.jsx)(`div`,{"data-settings-value":T?``:void 0,className:v(T&&`yuri-settings-split-row-control`),children:(0,q.jsxs)(Se,{value:V.schedule.kind,onValueChange:e=>{U(t=>({...t,schedule:{...t.schedule,kind:e,...e===`cron`&&!t.schedule.cronExpression?{cronExpression:`0 * * * *`}:{}}}))},children:[(0,q.jsx)(xe,{className:v(!T&&Be,T&&E),children:(0,q.jsx)(H,{children:e=>j(e===`daily`?`sessions.scheduledTasks.editor.scheduleType.daily`:e===`weekly`?`sessions.scheduledTasks.editor.scheduleType.weekly`:e===`cron`?`sessions.scheduledTasks.editor.scheduleType.cron`:`sessions.scheduledTasks.editor.scheduleType.once`)})}),(0,q.jsxs)(be,{className:`motion-reduce:transition-none`,children:[(0,q.jsx)(ye,{value:`daily`,children:j(`sessions.scheduledTasks.editor.scheduleType.daily`)}),(0,q.jsx)(ye,{value:`weekly`,children:j(`sessions.scheduledTasks.editor.scheduleType.weekly`)}),(0,q.jsx)(ye,{value:`once`,children:j(`sessions.scheduledTasks.editor.scheduleType.once`)}),(0,q.jsx)(ye,{value:`cron`,children:j(`sessions.scheduledTasks.editor.scheduleType.cron`)})]})]})})]})}),V.schedule.kind===`cron`?(0,q.jsx)(dt,{draft:V,setDraft:U,locale:M,t:j,panel:te,mobilePanel:C}):V.schedule.kind===`once`?(0,q.jsxs)(`div`,{className:v(`grid grid-cols-1 gap-x-4 gap-y-3`,T&&`flex flex-col gap-0`,!I&&!T&&`sm:grid-cols-2`),children:[(0,q.jsxs)(`div`,{className:v(`flex min-w-0 flex-col gap-1`,T&&D),ref:Ue,children:[(0,q.jsx)(nt,{children:j(`sessions.scheduledTasks.editor.date.label`)}),(0,q.jsxs)(`div`,{"data-settings-value":T?``:void 0,className:v(`relative`,T&&`yuri-settings-split-row-control`),children:[(0,q.jsxs)(`button`,{type:`button`,className:v(!T&&Be,`flex items-center justify-between gap-2 text-left`,T&&[E,`w-full`]),onClick:()=>Ee(e=>!e),children:[(0,q.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-2`,children:[(0,q.jsx)(S,{name:`calendar`,className:`h-4 w-4 shrink-0 text-muted-foreground`}),(0,q.jsx)(`span`,{className:`truncate typography-ui-label text-foreground`,children:Ge(V.schedule.onceDate,j(`sessions.scheduledTasks.editor.date.placeholder`),M)})]}),(0,q.jsx)(S,{name:`arrow-down-s`,className:`h-4 w-4 shrink-0 text-muted-foreground`})]}),Te?(0,q.jsxs)(`div`,{className:v(`absolute top-[calc(100%+6px)] z-50 w-[min(288px,calc(100vw-2rem))] animate-in fade-in zoom-in-95 slide-in-from-top-1 rounded-xl border border-border bg-background p-3 shadow-sm duration-150 motion-reduce:animate-none`,C?`right-0`:`left-0`),children:[(0,q.jsxs)(`div`,{className:`mb-2 flex items-center justify-between`,children:[(0,q.jsx)(`button`,{type:`button`,className:`inline-flex h-8 w-8 items-center justify-center rounded-md hover:bg-interactive-hover disabled:cursor-not-allowed disabled:opacity-40`,onClick:()=>Re(e=>Z(e,-1)),"aria-label":j(`sessions.scheduledTasks.editor.date.previousMonth`),disabled:Tt,children:(0,q.jsx)(S,{name:`arrow-left-s`,className:`h-4 w-4`})}),(0,q.jsx)(`div`,{className:`typography-ui-label text-foreground`,children:new Intl.DateTimeFormat(M,{month:`long`,year:`numeric`}).format(Le)}),(0,q.jsx)(`button`,{type:`button`,className:`inline-flex h-8 w-8 items-center justify-center rounded-md hover:bg-interactive-hover`,onClick:()=>Re(e=>Z(e,1)),"aria-label":j(`sessions.scheduledTasks.editor.date.nextMonth`),children:(0,q.jsx)(S,{name:`arrow-right-s`,className:`h-4 w-4`})})]}),(0,q.jsx)(`div`,{className:`mb-1 grid grid-cols-7 gap-1 px-1`,children:Et.map((e,t)=>(0,q.jsx)(`div`,{className:`py-1 text-center typography-micro text-muted-foreground`,children:e},`${e}-${t}`))}),(0,q.jsx)(`div`,{className:`grid grid-cols-7 gap-1`,children:Ke(Le,mt).map(({date:e,inCurrentMonth:t})=>{let n=We(e),r=n===V.schedule.onceDate,i=ot(e,St),a=e.getTime()<St.getTime();return(0,q.jsx)(`button`,{type:`button`,onClick:()=>{a||(Dt(n),Ee(!1))},disabled:a,className:[`h-8 rounded-md typography-ui-label`,r?`bg-interactive-selection text-interactive-selection-foreground`:a?`text-muted-foreground/40`:t?`text-foreground hover:bg-interactive-hover`:`text-muted-foreground/60 hover:bg-interactive-hover`,i&&!r?`ring-1 ring-inset ring-interactive-focusRing bg-interactive-hover/50`:``,a?`cursor-not-allowed opacity-45`:``].join(` `),children:e.getDate()},n)})}),(0,q.jsxs)(`div`,{className:`mt-2 flex items-center justify-between border-t border-border pt-2`,children:[(0,q.jsx)(`div`,{className:`typography-micro text-muted-foreground`,children:wt||``}),(0,q.jsx)(_,{type:`button`,size:`xs`,variant:`ghost`,onClick:()=>{Dt(We(St)),Re(new Date(St.getFullYear(),St.getMonth(),1))},children:j(`sessions.scheduledTasks.editor.date.jumpToToday`)})]})]}):null]})]}),(0,q.jsxs)(`div`,{className:v(`flex min-w-0 flex-col gap-1`,T&&D),children:[(0,q.jsx)(nt,{children:j(`sessions.scheduledTasks.editor.time.label`)}),(0,q.jsx)(`div`,{"data-settings-value":T?``:void 0,className:v(T&&`yuri-settings-split-row-control`),children:(0,q.jsx)(rt,{value:V.schedule.onceTime,className:v(T&&`yuri-settings-inline-value w-fit min-w-0 justify-end`),use24Hour:pt,hourAriaLabel:j(`sessions.scheduledTasks.editor.time.hourAria`),minuteAriaLabel:j(`sessions.scheduledTasks.editor.time.minuteAria`),periodAriaLabel:j(`sessions.scheduledTasks.editor.time.periodAria`),amLabel:j(`sessions.scheduledTasks.editor.time.period.am`),pmLabel:j(`sessions.scheduledTasks.editor.time.period.pm`),onChange:e=>U(t=>({...t,schedule:{...t.schedule,onceTime:e}}))})})]})]}):(0,q.jsxs)(`div`,{className:v(`grid grid-cols-1 gap-x-4 gap-y-3`,T&&`flex flex-col gap-0`,!I&&!T&&`sm:grid-cols-2`),children:[V.schedule.kind===`weekly`?(0,q.jsxs)(`div`,{className:v(`flex flex-col gap-1`,T&&[`yuri-settings-group-row border-b border-[var(--yuri-settings-row-divider)] last:border-b-0`,`yuri-settings-split-row`],!I&&!T&&`sm:col-span-2`),children:[(0,q.jsx)(nt,{children:j(`sessions.scheduledTasks.editor.weekdays.label`)}),(0,q.jsx)(`div`,{"data-settings-value":T?``:void 0,className:v(`flex flex-wrap gap-x-3 gap-y-2`,T&&`yuri-settings-split-row-control justify-end`),children:ht.map(e=>{let t=V.schedule.weekdays.includes(e.value);return(0,q.jsxs)(`div`,{className:[`group inline-flex items-center gap-1.5 px-0.5 py-0.5 typography-meta`,t?`text-foreground`:`text-muted-foreground`].join(` `),children:[(0,q.jsx)(R,{checked:t,onChange:t=>vt(e.value,t),ariaLabel:e.label}),(0,q.jsx)(`button`,{type:`button`,onClick:()=>vt(e.value,!t),className:`group-hover:text-foreground`,children:e.label})]},e.value)})})]}):null,(0,q.jsxs)(`div`,{className:v(`flex min-w-0 flex-col gap-2`,T&&[D,`justify-start`],C&&`flex-col items-stretch`),children:[(0,q.jsx)(nt,{children:j(`sessions.scheduledTasks.editor.times.label`)}),(0,q.jsxs)(`div`,{"data-settings-value":T?``:void 0,className:v(T?`yuri-settings-split-row-control relative flex-wrap justify-end`:`contents`),children:[(0,q.jsx)(`div`,{className:v(`flex flex-col gap-2`,T&&`flex-row flex-wrap justify-end transition-[padding] motion-reduce:transition-none`,te&&`group-hover:pr-8`),children:V.schedule.times.map((e,t)=>(0,q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,q.jsx)(rt,{value:e,className:v(T&&`yuri-settings-inline-value w-fit min-w-0`),use24Hour:pt,hourAriaLabel:j(`sessions.scheduledTasks.editor.time.hourAria`),minuteAriaLabel:j(`sessions.scheduledTasks.editor.time.minuteAria`),periodAriaLabel:j(`sessions.scheduledTasks.editor.time.periodAria`),amLabel:j(`sessions.scheduledTasks.editor.time.period.am`),pmLabel:j(`sessions.scheduledTasks.editor.time.period.pm`),onChange:e=>yt(t,e)}),V.schedule.times.length>1?(0,q.jsx)(_,{type:`button`,size:`icon`,variant:`ghost`,onClick:()=>bt(t),"aria-label":j(`sessions.scheduledTasks.editor.times.removeAria`),children:(0,q.jsx)(S,{name:`close`,className:`h-4 w-4`})}):null]},t))}),(0,q.jsx)(`div`,{className:v(T&&`shrink-0`,te&&`absolute right-0`),children:(0,q.jsxs)(_,{type:`button`,size:T?`icon`:`sm`,variant:T?`ghost`:`outline`,className:v(`h-9`,te&&`size-7 opacity-0 transition-opacity group-hover:opacity-100 focus-visible:opacity-100 motion-reduce:transition-none`,C&&`size-9`),onClick:xt,"aria-label":j(`sessions.scheduledTasks.editor.times.add`),children:[(0,q.jsx)(S,{name:`add`,className:v(`h-4 w-4`,!T&&`mr-1`)}),T?null:j(`sessions.scheduledTasks.editor.times.add`)]})})]})]})]})]})]}),(0,q.jsxs)(`div`,{className:v(`flex flex-col gap-3 border-t border-border/40 pt-5`,T&&`contents`),children:[(0,q.jsxs)(`div`,{className:v(T?`yuri-settings-group order-2`:`contents`),children:[T?(0,q.jsx)(`h3`,{className:Fe,children:j(`sessions.scheduledTasks.editor.panel.details`)}):null,(0,q.jsxs)(`div`,{className:v(`grid grid-cols-1 gap-x-4 gap-y-3`,T&&[`flex flex-col gap-0 animate-in fade-in slide-in-from-right-1 duration-200 [animation-delay:40ms] [animation-fill-mode:both] motion-reduce:animate-none`,`yuri-settings-group-card`],!I&&!T&&`sm:grid-cols-2`),children:[p.length>0?(0,q.jsxs)(`div`,{className:v(`flex min-w-0 flex-col gap-1`,T&&D),children:[(0,q.jsx)(nt,{children:j(`sessions.scheduledTasks.dialog.project.label`)}),(0,q.jsx)(`div`,{"data-settings-value":T?``:void 0,className:v(T&&`yuri-settings-split-row-control`),children:(0,q.jsxs)(Se,{value:f,disabled:!ee,onValueChange:ee,children:[(0,q.jsx)(xe,{className:v(!T&&Be,T&&E),children:(0,q.jsx)(H,{children:e=>p.find(t=>t.id===e)?.label})}),(0,q.jsx)(be,{className:`motion-reduce:transition-none`,children:p.map(e=>(0,q.jsx)(ye,{value:e.id,children:e.label},e.id))})]})})]}):null,(0,q.jsxs)(`div`,{className:v(`flex min-w-0 flex-col gap-1`,T&&D),children:[(0,q.jsx)(nt,{required:!0,children:j(`sessions.scheduledTasks.editor.model.label`)}),(0,q.jsx)(`div`,{"data-settings-value":T?``:void 0,className:v(T&&`yuri-settings-split-row-control`),children:(0,q.jsx)(W,{providerId:V.execution.providerID,modelId:V.execution.modelID,variant:V.execution.variant,className:v(!T&&Be,T&&E,`[&>div]:min-w-0 [&>div]:flex-1 [&_span]:truncate`),showIcon:!te,onChange:(e,t,n=``)=>{U(r=>({...r,execution:{...r.execution,providerID:e,modelID:t,variant:n}}))}})})]}),T?(0,q.jsxs)(`div`,{className:D,children:[(0,q.jsx)(nt,{children:j(`sessions.scheduledTasks.editor.agent.label`)}),(0,q.jsx)(`div`,{"data-settings-value":``,className:`yuri-settings-split-row-control`,children:(0,q.jsx)(je,{agentName:V.execution.agent,className:v(E,`[&>div]:min-w-0 [&>div]:flex-1 [&_span]:truncate`),showIcon:!0,filter:e=>y(e.mode),onChange:e=>U(t=>({...t,execution:{...t.execution,agent:e}}))})})]}):null,T?(0,q.jsxs)(`label`,{className:v(D,`cursor-pointer`),children:[(0,q.jsx)(`span`,{className:`typography-ui-label text-foreground`,children:j(`sessions.scheduledTasks.editor.goal.label`)}),(0,q.jsx)(`span`,{"data-settings-value":``,className:`yuri-settings-split-row-control`,children:(0,q.jsx)(R,{checked:V.execution.goalEnabled,onChange:e=>U(t=>({...t,execution:{...t.execution,goalEnabled:e}})),ariaLabel:j(`sessions.scheduledTasks.editor.goal.aria`)})})]}):null]})]}),T?null:(0,q.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,q.jsx)(nt,{children:j(`sessions.scheduledTasks.editor.agent.label`)}),(0,q.jsx)(je,{agentName:V.execution.agent,className:v(Be,`[&>div]:min-w-0 [&>div]:flex-1 [&_span]:truncate`),filter:e=>y(e.mode),onChange:e=>U(t=>({...t,execution:{...t.execution,agent:e}}))})]}),(0,q.jsxs)(`div`,{className:v(`flex flex-col gap-1`,T&&`order-1`),children:[(0,q.jsx)(`div`,{className:v(T&&`sr-only`),children:(0,q.jsx)(nt,{htmlFor:`sched-prompt`,required:!0,children:j(`sessions.scheduledTasks.editor.prompt.label`)})}),(0,q.jsxs)(`div`,{className:`relative`,children:[(0,q.jsx)(de,{id:`sched-prompt`,ref:Q,value:V.execution.prompt,onChange:e=>{let t=e.target.value;kt(t);let n=e.target.selectionStart??t.length;Ot(t,n)},onKeyDown:Nt,rows:8,outerClassName:`h-64 min-h-32`,placeholder:j(`sessions.scheduledTasks.editor.prompt.placeholder`),className:v(`typography-meta min-h-0 overflow-y-auto`,T&&`px-4 pt-4 text-base placeholder:text-muted-foreground/65`)}),Ne?(0,q.jsx)(z,{ref:$,searchQuery:Ie,onCommandSelect:Mt,onClose:()=>Pe(!1),style:{left:0,top:`auto`,bottom:`calc(100% + 6px)`,marginBottom:0,maxWidth:`100%`}}):null,De?(0,q.jsx)(B,{ref:qe,searchQuery:Ae,onFileSelect:At,onAgentSelect:jt,onSkillSelect:e=>jt(e.name),onClose:()=>ke(!1),style:{left:0,top:`auto`,bottom:`calc(100% + 6px)`,marginBottom:0,maxWidth:`100%`}}):null]})]}),T?null:(0,q.jsx)(`div`,{className:`flex flex-wrap items-center gap-x-8 gap-y-2`,children:(0,q.jsxs)(`label`,{className:`inline-flex cursor-pointer items-center gap-2`,children:[(0,q.jsx)(R,{checked:V.execution.goalEnabled,onChange:e=>U(t=>({...t,execution:{...t.execution,goalEnabled:e}})),ariaLabel:j(`sessions.scheduledTasks.editor.goal.aria`)}),(0,q.jsx)(`span`,{className:`typography-meta`,children:j(`sessions.scheduledTasks.editor.goal.label`)})]})})]})]}),Bt=(0,q.jsxs)(`div`,{className:v(`flex flex-wrap items-center justify-between gap-3`,a===`panel`&&`justify-end`,re&&`flex-nowrap gap-2`),children:[(0,q.jsxs)(`label`,{className:v(`inline-flex items-center gap-2`,a===`panel`&&`hidden`),children:[(0,q.jsx)(R,{checked:V.enabled,onChange:e=>U(t=>({...t,enabled:e})),ariaLabel:j(`sessions.scheduledTasks.editor.enabled.aria`)}),(0,q.jsx)(`span`,{className:`typography-meta`,children:j(`sessions.scheduledTasks.editor.enabled.label`)})]}),(0,q.jsxs)(`div`,{className:v(`flex flex-wrap items-center justify-end gap-2`,re&&`ml-auto flex-nowrap`),children:[a!==`panel`&&!re?(0,q.jsx)(_,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>r(!1),disabled:Ce,children:j(`sessions.scheduledTasks.editor.actions.cancel`)}):null,(0,q.jsx)(_,{type:`button`,size:`sm`,className:v(a===`panel`&&`rounded-lg`,re&&`min-h-11 px-5`),onClick:Pt,disabled:Ce,children:j(Ce?`sessions.scheduledTasks.editor.actions.saving`:n?`sessions.scheduledTasks.editor.actions.save`:`sessions.scheduledTasks.dialog.actions.create`)})]})]}),Vt=!!(n&&c),Ht=n&&l&&s?(0,q.jsxs)(ce,{children:[(0,q.jsx)(k,{asChild:!0,children:(0,q.jsx)(_,{type:`button`,variant:b?`mobileGlass`:`ghost`,size:b?`mobileIcon`:`icon`,className:v(!b&&`rounded-lg`,!b&&(I?`size-11`:`size-8`)),disabled:Ce||d,"aria-label":j(`sessions.scheduledTasks.dialog.actions.moreAria`,{taskName:n.name}),children:(0,q.jsx)(S,{name:`more-2`,className:b?`size-5`:`size-4`})})}),(0,q.jsxs)(se,{align:`end`,className:`min-w-40 motion-reduce:transition-none`,children:[(0,q.jsxs)(A,{className:v(b&&`min-h-11`),onSelect:()=>void s(n),children:[(0,q.jsx)(S,{name:`play`,className:`size-4`}),j(`sessions.scheduledTasks.dialog.actions.runNow`)]}),Vt?(0,q.jsxs)(A,{className:v(b&&`min-h-11`),onSelect:()=>c?.(n),children:[(0,q.jsx)(S,{name:`history`,className:`size-4`}),j(`sessions.scheduledTasks.workspace.views.history`)]}):null,u?(0,q.jsxs)(A,{className:v(b&&`min-h-11`),onSelect:()=>void u(n,!n.enabled),children:[(0,q.jsx)(S,{name:n.enabled?`pause`:`play`,className:`size-4`}),n.enabled?j(`sessions.scheduledTasks.dialog.taskToggle.pauseAria`,{taskName:n.name}):j(`sessions.scheduledTasks.dialog.taskToggle.enableAria`,{taskName:n.name})]}):null,(0,q.jsxs)(A,{variant:`destructive`,className:v(b&&`min-h-11`),onSelect:()=>void l(n),children:[(0,q.jsx)(S,{name:`delete-bin`,className:`size-4`}),j(`sessions.scheduledTasks.dialog.actions.delete`)]})]})]}):null;return a===`panel`?t?(0,q.jsxs)(`section`,{className:`flex h-full min-h-0 flex-col bg-background`,"aria-labelledby":`scheduled-task-panel-title`,children:[(0,q.jsxs)(`header`,{className:`shrink-0 animate-in fade-in slide-in-from-right-1 px-6 pb-4 pt-5 duration-200 motion-reduce:animate-none`,children:[(0,q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,q.jsx)(`span`,{className:v(`typography-meta font-medium`,n?.enabled?`text-[var(--status-info)]`:`text-muted-foreground`),children:n?n.enabled?j(`sessions.scheduledTasks.dialog.taskToggle.enabled`):j(`sessions.scheduledTasks.dialog.taskToggle.paused`):Lt}),(0,q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[Ht,n&&u?(0,q.jsx)(_,{type:`button`,variant:`ghost`,size:`icon`,className:v(`rounded-lg`,I?`size-11`:`size-8`),disabled:Ce||d,onClick:()=>void u(n,!n.enabled),"aria-label":n.enabled?j(`sessions.scheduledTasks.dialog.taskToggle.pauseAria`,{taskName:n.name}):j(`sessions.scheduledTasks.dialog.taskToggle.enableAria`,{taskName:n.name}),children:(0,q.jsx)(S,{name:n.enabled?`pause`:`play`,className:`size-4`})}):null,(0,q.jsx)(_,{type:`button`,variant:`ghost`,size:`icon`,className:v(`rounded-lg`,I?`size-11`:`size-8`),onClick:()=>r(!1),"aria-label":j(`sessions.scheduledTasks.editor.actions.cancel`),children:(0,q.jsx)(S,{name:I?`arrow-left`:`close`,className:`size-4`})})]})]}),(0,q.jsx)(`h2`,{id:`scheduled-task-panel-title`,className:`sr-only`,children:Lt}),(0,q.jsx)(pe,{value:V.name,onChange:e=>U(t=>({...t,name:e.target.value})),placeholder:j(`sessions.scheduledTasks.editor.taskName.placeholder`),"aria-label":j(`sessions.scheduledTasks.editor.taskName.label`),maxLength:80,required:!0,"aria-invalid":!V.name.trim(),className:`yuri-scheduled-task-title mt-1 !h-9 !min-h-9 border-0 bg-transparent px-0 text-lg font-semibold shadow-none ring-0 hover:!bg-transparent focus:!bg-transparent focus:ring-0`})]}),(0,q.jsx)(w,{className:`min-h-0 flex-1 overflow-auto [scrollbar-gutter:stable]`,size:64,hideTopShadow:!0,children:(0,q.jsx)(`div`,{className:`px-6 pb-6 pt-2`,children:zt})}),(0,q.jsx)(`footer`,{className:`shrink-0 border-t border-border/50 bg-background/95 px-6 py-3 backdrop-blur-sm`,children:Bt})]}):null:a===`mobile-panel`?t?(0,q.jsxs)(`section`,{className:`flex min-h-0 flex-1 flex-col bg-background`,"aria-label":Lt,children:[(0,q.jsx)(w,{className:`min-h-0 flex-1 overflow-y-auto overflow-x-hidden`,size:48,hideTopShadow:!0,children:(0,q.jsx)(`div`,{className:`w-full px-3 pb-6 pt-4`,children:zt})}),(0,q.jsx)(`footer`,{className:`shrink-0 border-t border-border/50 bg-background/95 px-3 py-2 backdrop-blur-sm`,children:Bt})]}):null:a===`mobile-tab`?t?(0,q.jsxs)(`section`,{className:`flex h-full min-h-0 flex-col bg-background`,"aria-label":Lt,children:[(0,q.jsx)(L,{sticky:!0,title:Lt,backAriaLabel:j(`header.actions.backAria`),onBack:()=>r(!1),backDisabled:Ce,trailing:[(0,q.jsx)(_,{type:`button`,size:`mobileIcon`,onClick:Pt,disabled:Ce,"aria-label":j(Ce?`sessions.scheduledTasks.editor.actions.saving`:n?`sessions.scheduledTasks.editor.actions.save`:`sessions.scheduledTasks.dialog.actions.create`),"aria-busy":Ce,children:(0,q.jsx)(S,{name:Ce?`loader-4`:`check`,className:v(`size-5`,Ce&&`animate-spin motion-reduce:animate-none`)})},`save`),Ht?(0,q.jsx)(G.Fragment,{children:Ht},`more`):null]}),(0,q.jsxs)(`div`,{className:`yuri-mobile-scheduled-editor-body min-h-0 flex-1 overflow-y-auto overflow-x-hidden px-[var(--yuri-mobile-page-inline-inset)] pt-4`,children:[(0,q.jsxs)(`div`,{className:`mb-5 flex items-center gap-4`,children:[(0,q.jsx)(pe,{value:V.name,onChange:e=>U(t=>({...t,name:e.target.value})),placeholder:j(`sessions.scheduledTasks.editor.taskName.placeholder`),"aria-label":j(`sessions.scheduledTasks.editor.taskName.label`),maxLength:80,required:!0,"aria-invalid":!V.name.trim(),className:`yuri-scheduled-task-title yuri-mobile-detail-editor-title min-w-0 flex-1 !h-auto min-h-0 border-0 bg-transparent px-0 py-0 text-xl font-semibold shadow-none ring-0 hover:!bg-transparent focus:!bg-transparent focus:ring-0`}),(0,q.jsx)(Oe,{checked:V.enabled,onCheckedChange:e=>U(t=>({...t,enabled:e})),disabled:Ce,"aria-label":j(`sessions.scheduledTasks.editor.enabled.aria`)})]}),zt]})]}):null:I?(0,q.jsx)(ve,{open:t,title:Lt,onClose:()=>r(!1),contentMaxHeightClassName:`max-h-[min(80vh,640px)]`,renderHeader:e=>(0,q.jsxs)(`div`,{className:`flex flex-col gap-1 border-b border-border/40 px-3 py-2`,children:[(0,q.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,q.jsx)(`h2`,{className:`typography-ui-label font-semibold text-foreground`,children:Lt}),e]}),(0,q.jsx)(`p`,{className:`typography-micro text-muted-foreground`,children:Rt})]}),footer:Bt,children:zt}):(0,q.jsx)(O,{open:t,onOpenChange:e=>{!e&&It()||r(e)},children:(0,q.jsxs)(ie,{"aria-describedby":Ft,className:`!max-w-[720px] w-[90vw] h-[680px] max-h-[85vh] gap-0 p-0 overflow-hidden`,children:[(0,q.jsx)(oe,{id:Ft,className:`sr-only`,children:Rt}),(0,q.jsx)(`header`,{className:`shrink-0 px-4 sm:px-6 pt-5 pb-3`,children:(0,q.jsxs)(`div`,{className:`mx-auto w-full max-w-2xl`,children:[(0,q.jsx)(ae,{className:`typography-ui-label font-medium text-foreground`,children:Lt}),(0,q.jsx)(`p`,{className:`typography-meta mt-0.5 text-muted-foreground`,children:Rt})]})}),(0,q.jsx)(w,{className:`flex-1 min-h-0 overflow-auto [scrollbar-gutter:stable_both-edges]`,size:64,hideTopShadow:!0,children:(0,q.jsx)(`div`,{className:`mx-auto w-full max-w-2xl px-4 sm:px-6 pb-5`,children:zt})}),(0,q.jsx)(`div`,{className:`shrink-0 px-4 sm:px-6 py-3`,children:(0,q.jsx)(`div`,{className:`mx-auto w-full max-w-2xl`,children:Bt})})]})})}function pt(e){return $(e,{min:0,max:23})}function mt(e,t){return $(String(Number.parseInt(e,10)+t),{min:0,max:23,loop:!0})}function ht(e,t){let n=Number(e),r=Number(t),i=Number.isFinite(n)?Math.min(23,Math.max(0,n)):0,a=Number.isFinite(r)?Math.min(59,Math.max(0,r)):0;return`${String(i).padStart(2,`0`)}:${String(a).padStart(2,`0`)}`}var gt=e=>{if(!e.enabled)return null;let t=Ae(e.assistants).pinned[0]??e.assistants[0];return t?{id:t.id,name:t.name,seed:t.avatarSeed??t.id}:null};function _t(e){let t=(0,Ne.c)(20),{assistant:n}=e,{t:r}=ne(),[i,a]=G.useState(!0),o=i?`true`:`false`,s;t[0]!==n.name||t[1]!==r?(s=r(`sessions.scheduledTasks.assistant.openAria`,{name:n.name}),t[0]=n.name,t[1]=r,t[2]=s):s=t[2];let c;t[3]===n.id?c=t[4]:(c=()=>h.getState().openAssistant(n.id),t[3]=n.id,t[4]=c);let l;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(l=e=>{e.target===e.currentTarget&&e.animationName===`yuri-schedule-assistant-clip`&&a(!1)},t[5]=l):l=t[5];let u;t[6]!==n.id||t[7]!==n.seed||t[8]!==i?(u=(0,q.jsx)(`span`,{className:`yuri-mobile-schedule-assistant-face`,"aria-hidden":`true`,children:(0,q.jsx)(I,{seed:n.seed,size:40,motion:`idle`,animateIdle:i,followPointer:!1,animationKey:n.id,blinkOnMount:2})}),t[6]=n.id,t[7]=n.seed,t[8]=i,t[9]=u):u=t[9];let d;t[10]===r?d=t[11]:(d=r(`sessions.scheduledTasks.assistant.offer`),t[10]=r,t[11]=d);let f;t[12]===d?f=t[13]:(f=(0,q.jsx)(`span`,{className:`yuri-mobile-schedule-assistant-label`,"aria-hidden":`true`,children:d}),t[12]=d,t[13]=f);let p;return t[14]!==o||t[15]!==s||t[16]!==c||t[17]!==u||t[18]!==f?(p=(0,q.jsx)(`span`,{className:`yuri-mobile-schedule-assistant-anchor`,children:(0,q.jsxs)(_,{type:`button`,variant:`ghost`,size:`mobileIcon`,className:`yuri-mobile-schedule-assistant`,"data-visiting":o,"aria-label":s,onClick:c,onAnimationEnd:l,children:[u,f]})}),t[14]=o,t[15]=s,t[16]=c,t[17]=u,t[18]=f,t[19]=p):p=t[19],p}function vt(){let e=(0,Ne.c)(2),{data:t}=F(gt),n;return e[0]===t?n=e[1]:(n=t?(0,q.jsx)(_t,{assistant:t},t.id):null,e[0]=t,e[1]=n),n}var yt=G.memo(function(e){let t=(0,Ne.c)(3),{active:n}=e,r=h(bt),i;return t[0]!==n||t[1]!==r?(i=n&&r?(0,q.jsx)(vt,{}):null,t[0]=n,t[1]=r,t[2]=i):i=t[2],i});function bt(e){return e.activeTab===`scheduled`&&e.secondary===null}var xt=e({ScheduledTasksDialog:()=>Pt,ScheduledTasksWorkspace:()=>zt}),St=e=>{let t=(Array.isArray(e.schedule.times)?e.schedule.times:e.schedule.time?[e.schedule.time]:[]).filter(e=>typeof e==`string`&&/^([01]\d|2[0-3]):([0-5]\d)$/.test(e));return Array.from(new Set(t)).sort((e,t)=>e.localeCompare(t))},Ct=(e,t,n=!0)=>{let r=St(e).join(`, `)||`--:--`,i=e=>t(e===0?`sessions.scheduledTasks.dialog.schedule.weekdayShort.sun`:e===1?`sessions.scheduledTasks.dialog.schedule.weekdayShort.mon`:e===2?`sessions.scheduledTasks.dialog.schedule.weekdayShort.tue`:e===3?`sessions.scheduledTasks.dialog.schedule.weekdayShort.wed`:e===4?`sessions.scheduledTasks.dialog.schedule.weekdayShort.thu`:e===5?`sessions.scheduledTasks.dialog.schedule.weekdayShort.fri`:e===6?`sessions.scheduledTasks.dialog.schedule.weekdayShort.sat`:`sessions.scheduledTasks.dialog.schedule.weekdayShort.unknown`);if(e.schedule.kind===`daily`)return n&&e.schedule.timezone?t(`sessions.scheduledTasks.dialog.schedule.dailyWithTimezone`,{time:r,timezone:e.schedule.timezone}):t(`sessions.scheduledTasks.dialog.schedule.daily`,{time:r});if(e.schedule.kind===`weekly`){let a=Array.isArray(e.schedule.weekdays)?e.schedule.weekdays.map(e=>i(e)).join(`, `):``;return n&&e.schedule.timezone?t(`sessions.scheduledTasks.dialog.schedule.weeklyWithTimezone`,{days:a,time:r,timezone:e.schedule.timezone}):t(`sessions.scheduledTasks.dialog.schedule.weekly`,{days:a,time:r})}if(e.schedule.kind===`once`){let r=typeof e.schedule.date==`string`&&e.schedule.date.trim().length>0?e.schedule.date:t(`sessions.scheduledTasks.dialog.schedule.unknownDate`),i=typeof e.schedule.time==`string`&&e.schedule.time.trim().length>0?e.schedule.time:`--:--`;return n&&e.schedule.timezone?t(`sessions.scheduledTasks.dialog.schedule.onceWithTimezone`,{date:r,time:i,timezone:e.schedule.timezone}):t(`sessions.scheduledTasks.dialog.schedule.once`,{date:r,time:i})}return n&&e.schedule.timezone?t(`sessions.scheduledTasks.dialog.schedule.cronWithTimezone`,{cron:e.schedule.cron||``,timezone:e.schedule.timezone}):t(`sessions.scheduledTasks.dialog.schedule.cron`,{cron:e.schedule.cron||``})},wt=(e,t)=>{if(!e||!Number.isFinite(e))return``;let n=e-Date.now(),r=Math.abs(n),i=6e4,a=60*i,o=24*a,s=n>=0;if(r<i)return t(s?`sessions.scheduledTasks.dialog.relativeTime.inLessThanOneMinute`:`sessions.scheduledTasks.dialog.relativeTime.justNow`);if(r<a){let e=Math.round(r/i);return t(s?`sessions.scheduledTasks.dialog.relativeTime.inMinutes`:`sessions.scheduledTasks.dialog.relativeTime.minutesAgo`,{count:e})}if(r<o){let e=Math.floor(r/a),n=Math.round(r%a/i),o=n>0?`${e}h ${n}m`:`${e}h`;return t(s?`sessions.scheduledTasks.dialog.relativeTime.inDuration`:`sessions.scheduledTasks.dialog.relativeTime.durationAgo`,{duration:o})}let c=Math.floor(r/o),l=Math.round(r%o/a),u=l>0?`${c}d ${l}h`:`${c}d`;return t(s?`sessions.scheduledTasks.dialog.relativeTime.inDuration`:`sessions.scheduledTasks.dialog.relativeTime.durationAgo`,{duration:u})},Tt=e=>new Intl.DateTimeFormat(C(),{month:`numeric`,day:`numeric`,hour:`2-digit`,minute:`2-digit`}).format(new Date(e)),Et=(e,t)=>{if(e.status===`running`)return Math.max(0,t-e.startedAt);if(typeof e.finishedAt==`number`&&Number.isFinite(e.finishedAt)){let t=Math.max(0,e.finishedAt-e.startedAt);return typeof e.durationMs==`number`&&Number.isFinite(e.durationMs)&&e.durationMs>=0?Math.max(e.durationMs,t):t}return typeof e.durationMs==`number`&&Number.isFinite(e.durationMs)&&e.durationMs>=0?e.durationMs:null},Dt=e=>{if(e===null||!Number.isFinite(e)||e<0)return null;if(e<1e3)return`<1s`;let t=Math.floor(e/1e3);if(t<60)return`${t}s`;let n=Math.floor(t/60),r=t%60;if(n<60)return r>0?`${n}m ${r}s`:`${n}m`;let i=Math.floor(n/60),a=n%60;return a>0?`${i}h ${a}m`:`${i}h`},Ot={success:{tone:`success`,Icon:`checkbox-circle`},error:{tone:`error`,Icon:`error-warning`},running:{tone:`warning`,Icon:`loader-4`,spin:!0},idle:{tone:`muted`,Icon:`pulse`}},kt=e=>e===`muted`?{}:{color:`var(--status-${e})`,backgroundColor:`var(--status-${e}-background)`,borderColor:`var(--status-${e}-border)`},At=({projectId:e,taskId:t})=>`${e}:${t}`,jt=null,Mt=()=>jt?jt():(m.getState().setScheduledTasksDialogOpen(!1),!0),Nt=(e,t,n)=>({tasks:[...e?.tasks.filter(e=>e.projectId!==t)??[],...n.map(e=>({projectId:t,task:e}))],failedProjectIds:e?.failedProjectIds.filter(e=>e!==t)??[]});function Pt(){let e=(0,Ne.c)(18),{t}=ne(),n=m(Rt),r=m(Lt);if(!m(It))return null;let i;e[0]===t?i=e[1]:(i=t(`sessions.scheduledTasks.dialog.title`),e[0]=t,e[1]=i);let a;e[2]===t?a=e[3]:(a=t(`sessions.scheduledTasks.dialog.title`),e[2]=t,e[3]=a);let o;e[4]===t?o=e[5]:(o=t(`mobile.surface.closeAria`),e[4]=t,e[5]=o);let s;e[6]===t?s=e[7]:(s=t(`mobile.sessions.sheet.resizeAria`),e[6]=t,e[7]=s);let c;e[8]!==n||e[9]!==r?(c=(0,q.jsx)(zt,{presentation:`mobile-panel`,open:n,onOpenChange:r}),e[8]=n,e[9]=r,e[10]=c):c=e[10];let l;return e[11]!==n||e[12]!==i||e[13]!==a||e[14]!==o||e[15]!==s||e[16]!==c?(l=(0,q.jsx)(T,{id:`scheduled-tasks`,open:n,initiallyExpanded:!0,title:i,ariaLabel:a,closeAriaLabel:o,resizeAriaLabel:s,onOpenChange:Ft,children:c}),e[11]=n,e[12]=i,e[13]=a,e[14]=o,e[15]=s,e[16]=c,e[17]=l):l=e[17],l}function Ft(e){e||Mt()}function It(e){return e.isMobile}function Lt(e){return e.setScheduledTasksDialogOpen}function Rt(e){return e.isScheduledTasksDialogOpen}function zt({presentation:e=`workspace`,open:t=!0,onOpenChange:r,registerEditorBackHandler:i,onEditorActiveChange:a}={}){let{t:h}=ne(),g=l.runtime()[0],y=G.useMemo(()=>[g,`scheduled-tasks`],[g]),C=G.useMemo(()=>[g,`scheduled-task-runs`],[g]),w=D(),T=m(e=>e.isMobile),ie=m(e=>e.scheduledTaskOpenRequest),ae=m(e=>e.isScheduledTasksDialogOpen),oe=m(e=>e.setMainTabGuard),O=ee(e=>e.projects),de=ee(e=>e.getActiveProject())?.id||O[0]?.id||``,[F,I]=G.useState(de),[L,R]=G.useState(()=>{if(T&&e!==`mobile-panel`)return null;let t=Te();return t.scheduleProjectId&&t.scheduleTaskId?{projectId:t.scheduleProjectId,taskId:t.scheduleTaskId}:null}),[z,B]=G.useState(()=>L?`edit`:`closed`),[_e,ve]=G.useState(`all`),[H,ye]=G.useState(()=>Te().scheduleView===`history`?`history`:`tasks`),[be,xe]=G.useState(``),[Se,Oe]=G.useState(!1),Ae=G.useRef(!1),W=p(e=>{Ae.current=e,Oe(e)}),[je,Me]=G.useState(null),[Ne,Pe]=G.useState(null),[Fe,Ie]=G.useState(null),[K,Le]=G.useState(null),Re=G.useRef(null),[ze,Be]=G.useState(null),Ve=G.useRef(null),He=G.useRef(null),J=e===`mobile-tab`,Y=e===`mobile-panel`||J,Ue=p(e=>{Be(J?e?.closest(`[role="tabpanel"]`)??null:e)});G.useEffect(()=>{if(J)return a?.(z!==`closed`),()=>a?.(!1)},[z,J,a]),G.useEffect(()=>{if(!t)return;let n=t=>{let n=Te();if(n.tab===`schedule`){if(T&&e!==`mobile-panel`&&n.scheduleTaskId){R(null),B(`closed`),W(!1);return}let t=n.scheduleView===`history`?`history`:`tasks`;ye(e=>e===t?e:t);let r=n.scheduleProjectId&&n.scheduleTaskId?{projectId:n.scheduleProjectId,taskId:n.scheduleTaskId}:null;R(r),B(r?`edit`:`closed`),W(!1)}else t&&e===`mobile-panel`&&r?.(!1)};return n(),window.addEventListener(`popstate`,n),()=>window.removeEventListener(`popstate`,n)},[t,T,e,r,W]),G.useEffect(()=>{!t||!ie||T&&e!==`mobile-panel`&&ae||(R(ie),B(`edit`),ye(`tasks`),W(!1),m.getState().setScheduledTaskOpenRequest(null))},[t,ie,T,e,ae,W]),G.useEffect(()=>{O.some(e=>e.id===F)||I(de)},[F,de,O]);let X=s({queryKey:y,enabled:t,refetchOnMount:`always`,queryFn:P,select:e=>({...e,tasks:[...e.tasks].sort((e,t)=>e.task.enabled===t.task.enabled?e.task.name.localeCompare(t.task.name):e.task.enabled?-1:1)})}),We=G.useMemo(()=>X.data?.tasks??[],[X.data]),Ge=X.data?.failedProjectIds??[],Z=G.useMemo(()=>L?We.find(({projectId:e,task:t})=>e===L.projectId&&t.id===L.taskId)??null:null,[L,We]),Ke=Z?.task??null,Q=c({queryKey:[...C,K?.projectId??``,K?.taskId??``],enabled:t&&H===`history`,initialPageParam:void 0,queryFn:({pageParam:e,signal:t})=>N({before:e,limit:20,...K?{projectId:K.projectId,taskId:K.taskId}:{}},t),getNextPageParam:e=>e.complete?void 0:e.nextCursor??void 0,refetchOnMount:`always`}),qe=t&&H===`history`&&z===`closed`&&!!ze&&Q.hasNextPage&&!Q.isFetching&&!Q.error;f(qe?Re:null,p(e=>{qe&&e.some(e=>e.isIntersecting)&&Q.fetchNextPage({cancelRefetch:!1})}),{root:ze,rootMargin:`0px 0px 240px 0px`});let $=G.useMemo(()=>{let e=new Set,t=[];for(let n of Q.data?.pages??[])for(let r of n.runs)e.has(r.id)||(e.add(r.id),t.push(r));return t},[Q.data]),Je=G.useMemo(()=>$.some(e=>e.status===`running`),[$]),Ye=G.useMemo(()=>{if(!K)return null;let e=We.find(({projectId:e,task:t})=>e===K.projectId&&t.id===K.taskId);return e?.task.name?e.task.name:$.find(e=>e.projectId===K.projectId&&e.taskId===K.taskId)?.taskName||K.taskId},[K,$,We]),[Xe,Ze]=G.useState(()=>Date.now());G.useEffect(()=>{if(!t||H!==`history`||!Je)return;Ze(Date.now());let e=window.setInterval(()=>Ze(Date.now()),1e3);return()=>window.clearInterval(e)},[Je,t,H]);let Qe=G.useMemo(()=>new Map(O.map(e=>[e.id,e])),[O]);G.useEffect(()=>{let e=null,t=u(t=>{(t.type===`scheduled-task-ran`||t.type===`event-stream-ready`)&&(e&&clearTimeout(e),e=setTimeout(()=>{d.invalidateQueries({queryKey:y,exact:!0}),d.invalidateQueries({queryKey:C})},400))});return()=>{e&&clearTimeout(e),t()}},[y,C]);let $e=o({mutationFn:({projectID:e,taskDraft:t})=>ge(e,t),onSuccess:(e,{projectID:t})=>{d.setQueryData(y,n=>Nt(n,t,e))}}),et=o({mutationFn:({projectID:e,taskID:t})=>he(e,t),onSuccess:(e,{projectID:t})=>{d.setQueryData(y,n=>Nt(n,t,e))}}),tt=o({mutationFn:({projectID:e,taskID:t})=>me(e,t),onSuccess:()=>{d.invalidateQueries({queryKey:y,exact:!0}),d.invalidateQueries({queryKey:C})}}),nt=o({mutationFn:({projectID:e,task:t})=>ge(e,t),onMutate:({projectID:e,task:t})=>{let n=d.getQueryData(y);return d.setQueryData(y,n=>n&&{...n,tasks:n.tasks.map(n=>n.projectId===e&&n.task.id===t.id?{projectId:e,task:t}:n)}),{previousTasks:n}},onSuccess:(e,{projectID:t})=>{d.setQueryData(y,n=>Nt(n,t,e))},onError:(e,t,n)=>{n?.previousTasks&&d.setQueryData(y,n.previousTasks)}}),rt=p(()=>!Ae.current||window.confirm(h(`sessions.scheduledTasks.workspace.confirm.discardChanges`)));G.useEffect(()=>{if(!Se){oe(null);return}let e=e=>e===`schedule`||window.confirm(h(`sessions.scheduledTasks.workspace.confirm.discardChanges`));return oe(e),()=>{m.getState().mainTabGuard===e&&oe(null)}},[Se,oe,h]);let it=p(t=>{let n={projectId:t.projectId,taskId:t.task.id};if((At(n)!==(L?At(L):``)||z!==`edit`)&&rt()){if(T&&e!==`mobile-panel`){De(n.projectId,n.taskId);return}R(n),B(`edit`),W(!1),ot(`tasks`,n)}}),at=p(()=>{!F||!rt()||(R(null),B(`create`),W(!1),ot(`tasks`,null))}),ot=p((e,t)=>{let n=m.getState();Ee({sessionId:null,tab:`schedule`,isSettingsOpen:n.isSettingsDialogOpen,settingsPath:n.settingsPage,diffFile:null,scheduleView:e,scheduleProjectId:t?.projectId??null,scheduleTaskId:t?.taskId??null})}),st=p(e=>{H!==e&&(z!==`closed`&&!rt()||(R(null),B(`closed`),W(!1),Le(null),ye(e),ot(e,null)))}),ct=p((t,i)=>{e===`mobile-panel`&&t&&i&&r?.(!1),te(t,i,{phoneShell:!!(Y&&!n()),switchToChat:!0})}),lt=p(e=>{ct(e.sessionId,e.directory)}),ut=p(e=>{z!==`closed`&&!rt()||(R(null),B(`closed`),W(!1),Le({projectId:e.projectId,taskId:e.task.id}),ye(`history`),ot(`history`,null))}),dt=p(()=>{Le(null)}),pt=p(()=>{Z&&ut(Z)}),mt=p(async()=>{if(Q.data&&Q.hasNextPage){await Q.fetchNextPage();return}await Q.refetch()}),ht=p(e=>{e||!rt()||(R(null),B(`closed`),W(!1),ot(`tasks`,null))}),gt=p(()=>e===`mobile-panel`?!rt()||(R(null),B(`closed`),W(!1),ot(`tasks`,null),r?.(!1),!0):z===`closed`?(r?.(!1),!0):(ht(!1),!0));G.useEffect(()=>{if(e!==`mobile-panel`||!t)return;jt=gt;let n=()=>gt();return window.addEventListener(`yuri:scheduled-tasks-close-request`,n),()=>{jt===gt&&(jt=null),window.removeEventListener(`yuri:scheduled-tasks-close-request`,n)}},[e,t]);let _t=p(()=>z!==`closed`&&(ht(!1),!0));fe({id:`mobile-scheduled-editor`,active:J&&z!==`closed`,onBack:_t,surfaceRef:Ve,underlayRef:He}),G.useEffect(()=>{if(i)return i(_t),()=>i(null)},[i]);let vt=p(async e=>{let t=L?.projectId||F;if(!t)throw Error(h(`sessions.scheduledTasks.dialog.error.chooseProjectFirst`));let n=new Set(We.filter(e=>e.projectId===t).map(e=>e.task.id)),r=await $e.mutateAsync({projectID:t,taskDraft:e}),i=e.id?r.find(t=>t.id===e.id):r.find(e=>!n.has(e.id)),a=[...r].filter(t=>t.name===e.name).sort((e,t)=>(t.state?.updatedAt||0)-(e.state?.updatedAt||0))[0],o=i||a;return o&&(R({projectId:t,taskId:o.id}),B(`edit`),ot(`tasks`,{projectId:t,taskId:o.id})),W(!1),x.success(h(`sessions.scheduledTasks.dialog.toast.saved`)),o}),bt=p(async e=>{let{projectId:t,task:n}=e;if(window.confirm(h(`sessions.scheduledTasks.dialog.confirm.deleteTask`,{taskName:n.name}))){Me(At({projectId:t,taskId:n.id}));try{await et.mutateAsync({projectID:t,taskID:n.id});let e=At({projectId:t,taskId:n.id});L&&At(L)===e&&(R(null),B(`closed`),W(!1),ot(`tasks`,null)),x.success(h(`sessions.scheduledTasks.dialog.toast.deleted`))}catch(e){x.error(e instanceof Error?e.message:h(`sessions.scheduledTasks.dialog.toast.deleteFailed`))}finally{Me(null)}}}),xt=p(async({projectId:e,task:t})=>{Me(At({projectId:e,taskId:t.id}));try{await tt.mutateAsync({projectID:e,taskID:t.id}),x.success(h(`sessions.scheduledTasks.dialog.toast.started`))}catch(e){x.error(e instanceof Error?e.message:h(`sessions.scheduledTasks.dialog.toast.runFailed`))}finally{Me(null)}}),St=p(async({projectId:e,task:t},n)=>{Me(At({projectId:e,taskId:t.id}));try{await nt.mutateAsync({projectID:e,task:{...t,enabled:n}})}catch(e){x.error(e instanceof Error?e.message:h(`sessions.scheduledTasks.dialog.toast.updateFailed`))}finally{Me(null)}}),Mt=G.useMemo(()=>{let e=be.trim().toLocaleLowerCase();return We.filter(({task:t})=>_e===`active`&&!t.enabled||_e===`paused`&&t.enabled?!1:!e||t.name.toLocaleLowerCase().includes(e)||Ct(t,h).toLocaleLowerCase().includes(e))},[_e,be,h,We]),Pt=e=>{let t=e.icon?Ce[e.icon]:null,n=e.color?we[e.color]:void 0,r=(0,q.jsx)(S,{name:t??`folder`,className:`size-3.5`,style:n?{color:n}:void 0});return(0,q.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-1.5`,children:[(0,q.jsx)(`span`,{className:`relative top-px flex size-4 shrink-0 items-center justify-center overflow-hidden text-muted-foreground`,children:e.iconImage?(0,q.jsx)(U,{project:e,className:`size-full object-contain`,fallback:r}):r}),(0,q.jsx)(`span`,{className:`truncate`,children:b(e.path)})]})},Ft=O.map(e=>({id:e.id,label:Pt(e)}));return(0,q.jsxs)(`div`,{className:v(`relative flex min-h-0`,J?`yuri-mobile-scheduled-workspace w-full flex-col overflow-visible bg-transparent`:`h-full overflow-hidden bg-background`,Y&&`flex-col`),"data-presentation":e,children:[(0,q.jsxs)(`div`,{ref:J?He:void 0,"data-mobile-navigation-underlay":J?`true`:void 0,"aria-hidden":J&&z!==`closed`?!0:void 0,inert:J&&z!==`closed`?!0:void 0,className:v(J?`flex w-full min-w-0 flex-col gap-[var(--yuri-mobile-page-gap)]`:`contents`),children:[J?(0,q.jsx)(ke,{title:h(`sessions.scheduledTasks.dialog.title`),trailing:(0,q.jsx)(yt,{active:z===`closed`})}):null,Y&&!J?(0,q.jsx)(re,{children:z===`edit`&&Z?(0,q.jsxs)(ce,{children:[(0,q.jsx)(k,{asChild:!0,children:(0,q.jsx)(_,{type:`button`,variant:`ghost`,size:`icon`,className:`size-11 shrink-0 rounded-lg`,disabled:!!je,"aria-label":h(`sessions.scheduledTasks.dialog.actions.moreAria`,{taskName:Z.task.name}),children:(0,q.jsx)(S,{name:`more-2`,className:`size-5`})})}),(0,q.jsxs)(se,{align:`end`,className:`min-w-40`,children:[(0,q.jsxs)(A,{className:`min-h-11`,onSelect:()=>void xt(Z),children:[(0,q.jsx)(S,{name:`play`,className:`size-4`}),h(`sessions.scheduledTasks.dialog.actions.runNow`)]}),(0,q.jsxs)(A,{className:`min-h-11`,onSelect:()=>ut(Z),children:[(0,q.jsx)(S,{name:`history`,className:`size-4`}),h(`sessions.scheduledTasks.workspace.views.history`)]}),(0,q.jsxs)(A,{className:`min-h-11`,onSelect:()=>void St(Z,!Z.task.enabled),children:[(0,q.jsx)(S,{name:Z.task.enabled?`pause`:`play`,className:`size-4`}),Z.task.enabled?h(`sessions.scheduledTasks.dialog.actions.pause`):h(`sessions.scheduledTasks.dialog.actions.resume`)]}),(0,q.jsxs)(A,{variant:`destructive`,className:`min-h-11`,onSelect:()=>void bt(Z),children:[(0,q.jsx)(S,{name:`delete-bin`,className:`size-4`}),h(`sessions.scheduledTasks.dialog.actions.delete`)]})]})]}):null}):null,(0,q.jsxs)(`section`,{className:v(`min-w-0 flex-col transition-[width] duration-300 ease-out`,J?`flex-none overflow-visible`:`flex-1 overflow-hidden`,Y&&!J&&z!==`closed`?`hidden`:`flex`),children:[(0,q.jsx)(`header`,{className:v(`shrink-0`,J?`pb-0 pt-0`:Y?`px-3 pb-3 pt-3`:`px-4 pb-5 pt-4 sm:px-6`),children:(0,q.jsxs)(`div`,{className:v(`mx-auto w-full`,J?`max-w-[26rem]`:`max-w-4xl`),children:[(0,q.jsx)(`div`,{className:v((H===`tasks`||K||!J)&&`mb-3`,J?`yuri-mobile-floating-surface yuri-mobile-segmented-track`:`grid grid-cols-2 gap-1 rounded-xl bg-[var(--surface-muted)] p-1`),role:`tablist`,"aria-label":h(`sessions.scheduledTasks.workspace.views.aria`),children:[`tasks`,`history`].map(e=>(0,q.jsxs)(_,{type:`button`,variant:`ghost`,size:`sm`,role:`tab`,"aria-selected":H===e,className:v(J?`yuri-mobile-segmented-item`:`relative min-h-9 rounded-lg text-muted-foreground transition-[background-color,color,box-shadow] motion-reduce:transition-none`,!J&&Y&&`min-h-11`,!J&&(H===e?`text-foreground hover:bg-transparent hover:text-foreground`:`hover:bg-interactive-hover/40 hover:text-foreground`)),onClick:()=>st(e),children:[H===e?(0,q.jsx)(V.span,{layoutId:`scheduled-workspace-view-pill`,className:v(`yuri-segmented-selected-pill absolute inset-0`,!J&&`rounded-lg`),transition:{duration:w?0:.18,ease:[.22,1,.36,1]},"aria-hidden":`true`}):null,(0,q.jsxs)(`span`,{className:`relative z-[1] inline-flex items-center gap-1.5`,children:[(0,q.jsx)(S,{name:e===`tasks`?`calendar-schedule`:`history`,className:`size-4 shrink-0`}),h(`sessions.scheduledTasks.workspace.views.${e}`)]})]},e))}),H===`history`&&Ye?(0,q.jsx)(`div`,{className:v(`flex min-w-0 items-center`,J?`mt-[var(--yuri-mobile-page-gap)]`:`mt-3`),role:`status`,"aria-label":h(`sessions.scheduledTasks.history.filter.aria`,{name:Ye}),children:(0,q.jsxs)(`span`,{className:`inline-flex min-w-0 max-w-full items-center gap-1 rounded-full border border-border/60 bg-[var(--surface-elevated)] py-1 pl-3 pr-1`,children:[(0,q.jsx)(`span`,{className:`min-w-0 truncate typography-meta text-foreground`,children:Ye}),(0,q.jsx)(_,{type:`button`,variant:`ghost`,size:`icon`,className:v(`shrink-0 rounded-full`,Y?`size-8`:`size-7`),onClick:dt,"aria-label":h(`sessions.scheduledTasks.history.filter.clearAria`),children:(0,q.jsx)(S,{name:`close`,className:`size-3.5`})})]})}):null,H===`tasks`?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`div`,{className:v(J?`yuri-mobile-floating-surface yuri-mobile-segmented-track yuri-mobile-scheduled-controls`:v(`flex items-center justify-between`,Y?`gap-2`:`gap-3`)),children:[(0,q.jsx)(`div`,{className:v(J?`yuri-mobile-segmented-group`:v(`flex items-center gap-1`,Y&&`min-w-0 flex-1`)),role:`group`,"aria-label":h(`sessions.scheduledTasks.dialog.title`),children:[`all`,`active`,`paused`].map(e=>(0,q.jsxs)(_,{type:`button`,variant:`ghost`,size:`sm`,className:v(J?`yuri-mobile-segmented-item`:`relative border-0 bg-transparent text-muted-foreground shadow-none transition-[color,background-color] duration-150 ease-out motion-reduce:transition-none`,!J&&(Y?`h-11 min-h-11 min-w-0 flex-1 rounded-xl px-2`:`!h-9 !min-h-9 rounded-xl px-3`),!J&&(_e===e?`text-foreground hover:bg-transparent hover:text-foreground`:`hover:bg-interactive-hover/40 hover:text-foreground`)),"aria-pressed":_e===e,onClick:()=>ve(e),children:[_e===e?(0,q.jsx)(V.span,{layoutId:`scheduled-task-filter-pill`,className:v(`yuri-segmented-selected-pill absolute inset-0`,!J&&`rounded-xl`),transition:{duration:w?0:.18,ease:[.22,1,.36,1]},"aria-hidden":`true`}):null,(0,q.jsx)(`span`,{className:`relative z-[1]`,children:h(`sessions.scheduledTasks.workspace.filters.${e}`)})]},e))}),J?(0,q.jsx)(_,{variant:`mobileGlass`,size:`mobileIcon`,"data-mobile-press-feedback":`compact`,className:`yuri-mobile-segmented-action yuri-mobile-inverse-action shrink-0`,onClick:at,disabled:!F,"aria-label":h(`sessions.scheduledTasks.dialog.actions.create`),children:(0,q.jsx)(S,{name:`add`,className:`size-5`})}):(0,q.jsx)(`div`,{className:`flex min-w-0 items-center gap-2`,children:(0,q.jsxs)(_,{variant:`ghost`,"data-mobile-press-feedback":Y?`compact`:void 0,className:v(`shrink-0 rounded-full bg-foreground text-background transition-[background-color,box-shadow] duration-150 ease-out hover:bg-foreground/90 hover:text-background hover:shadow-sm active:bg-interactive-active motion-reduce:transition-none`,Y?`size-11 min-h-11 px-0 min-[400px]:w-auto min-[400px]:px-3.5`:`!h-9 !min-h-9 px-3.5`),onClick:at,disabled:!F,"aria-label":h(`sessions.scheduledTasks.dialog.actions.create`),children:[(0,q.jsx)(S,{name:`add`,className:`h-4 w-4`}),` `,(0,q.jsx)(`span`,{className:v(Y&&`hidden min-[400px]:inline`),children:h(`sessions.scheduledTasks.dialog.actions.create`)})]})})]}),J?null:(0,q.jsxs)(`div`,{className:v(`group relative w-full`,Y?`mt-3`:`mt-7`),children:[(0,q.jsx)(S,{name:`search`,className:`pointer-events-none absolute left-3.5 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground transition-[color,transform] duration-150 ease-out group-focus-within:scale-105 group-focus-within:text-foreground motion-reduce:transition-none`}),(0,q.jsx)(pe,{value:be,onChange:e=>xe(e.target.value),placeholder:h(`sessions.scheduledTasks.workspace.search.placeholder`),className:v(`rounded-full bg-[var(--surface-elevated)] pl-10 pr-4 ring-1 ring-inset ring-border/50 transition-[background-color,box-shadow,color] duration-200 ease-out hover:[&:not(:focus)]:ring-border focus:bg-[var(--surface-elevated)] focus:shadow-sm focus:ring-2 focus:ring-[var(--interactive-focus-ring)] motion-reduce:transition-none`,Y?`h-11 min-h-11`:`!h-9 !min-h-9`)})]})]}):null]})}),(0,q.jsx)(`div`,{ref:Ue,className:v(J?`flex-none overflow-visible pt-[var(--yuri-mobile-page-gap)]`:`min-h-0 flex-1 overflow-y-auto`,!J&&(Y?`overscroll-none px-3 pb-[max(1rem,env(safe-area-inset-bottom))]`:`px-6 pb-6 [scrollbar-gutter:stable]`)),children:(0,q.jsx)(`div`,{className:v(`mx-auto w-full`,J?`max-w-[26rem]`:`max-w-4xl pt-4`),children:H===`history`?(0,q.jsxs)(`div`,{className:`space-y-3`,children:[Q.isLoading?(0,q.jsxs)(`div`,{className:`flex items-center gap-2 px-4 py-3 typography-meta text-muted-foreground`,children:[(0,q.jsx)(S,{name:`loader-4`,className:`size-4 animate-spin motion-reduce:animate-none`}),h(`sessions.scheduledTasks.history.loading`)]}):Q.error&&$.length===0?(0,q.jsx)(`div`,{className:`rounded-xl border border-dashed border-border p-4`,children:(0,q.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,q.jsx)(S,{name:`error-warning`,className:`mt-0.5 size-4 shrink-0 text-[var(--status-error)]`}),(0,q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,q.jsx)(`p`,{className:`typography-ui-label font-medium text-foreground`,children:h(`sessions.scheduledTasks.history.error.title`)}),(0,q.jsx)(`p`,{className:`mt-1 break-words typography-meta text-muted-foreground`,children:Q.error instanceof Error?Q.error.message:h(`sessions.scheduledTasks.history.error.description`)})]}),(0,q.jsx)(_,{variant:`outline`,size:`sm`,onClick:()=>void mt(),children:h(`sessions.scheduledTasks.history.retry`)})]})}):$.length===0?(0,q.jsxs)(`div`,{className:`rounded-xl border border-dashed border-border p-6 text-center`,children:[(0,q.jsx)(S,{name:`history`,className:`mx-auto size-5 text-muted-foreground`}),(0,q.jsx)(`p`,{className:`mt-2 typography-ui-label font-medium text-foreground`,children:h(`sessions.scheduledTasks.history.empty.title`)}),(0,q.jsx)(`p`,{className:`mt-1 typography-meta text-muted-foreground`,children:h(`sessions.scheduledTasks.history.empty.description`)})]}):(0,q.jsxs)(`div`,{className:v(J?`space-y-4`:Y?`space-y-2`:`divide-y divide-border/50 overflow-hidden rounded-xl border border-border/60 bg-[var(--surface-elevated)]`),children:[$.map(e=>{let t=Qe.get(e.projectId),n=t?b(t.path):e.projectId,r=e.directory?b(e.directory):null,i=r&&r!==n?`${n} · ${r}`:n,a=Ot[e.status],o=!!(e.sessionId&&e.directory),s=Dt(Et(e,Xe))??(e.status===`running`?h(`sessions.scheduledTasks.history.duration.pending`):null),c=Tt(e.startedAt),l=h(`sessions.scheduledTasks.history.trigger.${e.trigger}`),u=e.trigger===`manual`?`play`:`calendar-schedule`,d=h(`sessions.scheduledTasks.dialog.status.${e.status}`),f=a.tone===`muted`?void 0:{color:`var(--status-${a.tone})`},p=t?.icon?Ce[t.icon]??`folder`:`folder`,m=t?.color?we[t.color]:void 0,ee=(0,q.jsx)(`span`,{className:`flex size-3.5 shrink-0 items-center justify-center overflow-hidden text-muted-foreground`,children:t?.iconImage?(0,q.jsx)(U,{project:t,className:`size-full object-contain`,fallback:(0,q.jsx)(S,{name:p,className:`size-3.5`,style:m?{color:m}:void 0})}):(0,q.jsx)(S,{name:p,className:`size-3.5`,style:m?{color:m}:void 0})}),te=(0,q.jsx)(`span`,{className:v(`mt-0.5 flex shrink-0 items-center justify-center rounded-full border`,Y?`size-7`:`size-8`),style:kt(a.tone),title:d,"aria-label":d,children:(0,q.jsx)(S,{name:a.Icon,className:v(Y?`size-3.5`:`size-4`,a.spin&&`animate-spin motion-reduce:animate-none`)})}),g=(0,q.jsxs)(`p`,{className:v(`mt-0.5 flex min-w-0 items-center gap-1.5 text-muted-foreground`,Y?`typography-micro`:`truncate typography-meta`),title:e.directory??n,children:[ee,(0,q.jsx)(`span`,{className:v(`min-w-0`,Y?`break-words`:`truncate`),children:i})]}),_=(0,q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[s?(0,q.jsx)(`span`,{className:`typography-micro tabular-nums text-muted-foreground`,title:s,children:s}):null,(0,q.jsx)(`span`,{className:`typography-micro font-medium`,style:f,children:d})]}),y=(0,q.jsxs)(`div`,{className:v(`flex w-full min-w-0 items-start`,Y?`gap-2.5`:`gap-3`),children:[te,(0,q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,q.jsxs)(`div`,{className:`flex w-full min-w-0 items-start justify-between gap-2`,children:[(0,q.jsx)(`h3`,{className:v(`min-w-0 flex-1 font-semibold text-foreground`,Y?`break-words typography-meta leading-snug`:`truncate typography-ui-label`),children:e.taskName}),_]}),g,(0,q.jsxs)(`div`,{className:v(`mt-1 flex w-full min-w-0 gap-2`,Y?`items-center`:`items-center justify-between gap-3`),children:[(0,q.jsxs)(`div`,{className:v(`flex min-w-0 flex-1 flex-wrap items-center gap-x-3 gap-y-1 typography-micro text-muted-foreground`,Y&&`gap-x-2.5 gap-y-0.5`),children:[(0,q.jsxs)(`span`,{className:`inline-flex min-w-0 max-w-full items-center gap-1`,title:c,children:[(0,q.jsx)(S,{name:`time`,className:`size-3 shrink-0`,"aria-hidden":`true`}),(0,q.jsx)(`span`,{className:`whitespace-nowrap tabular-nums`,children:c})]}),(0,q.jsxs)(`span`,{className:`inline-flex min-w-0 max-w-full items-center gap-1`,title:l,children:[(0,q.jsx)(S,{name:u,className:`size-3 shrink-0`,"aria-hidden":`true`}),(0,q.jsx)(`span`,{className:`whitespace-nowrap`,children:l})]})]}),!Y&&o?(0,q.jsx)(`span`,{className:`shrink-0 self-center typography-ui-label font-medium text-foreground`,children:h(`sessions.scheduledTasks.history.openSession`)}):null]}),e.error?(0,q.jsxs)(`p`,{className:v(`mt-1.5 min-w-0 break-words typography-micro text-[var(--surface-muted-foreground)] [overflow-wrap:anywhere]`,Y?`line-clamp-3`:`line-clamp-1`),title:e.error.slice(0,300),children:[(0,q.jsx)(S,{name:`error-warning`,className:`mr-1 inline-block size-3 align-[-0.125em] text-[var(--status-error)]`,"aria-hidden":`true`}),e.error.slice(0,300)]}):null]})]});if(Y){let t=h(`sessions.scheduledTasks.history.openSession`),n=v(`yuri-mobile-scheduled-task-card w-full`,J?`yuri-mobile-floating-surface yuri-mobile-project-shell rounded-[var(--yuri-mobile-surface-radius)]`:`rounded-xl border border-border/60 bg-[var(--surface-elevated)] shadow-sm dark:shadow-none`);return o?(0,q.jsx)(`article`,{"data-mobile-press-surface":`soft`,className:n,children:(0,q.jsx)(`button`,{type:`button`,"data-mobile-press-surface-trigger":!0,className:v(`yuri-mobile-scheduled-task-row w-full p-3 text-left outline-none`,`focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-[var(--interactive-focus-ring)]`),"aria-label":t,onClick:()=>lt(e),children:y})},e.id):(0,q.jsx)(`article`,{className:v(n,`p-3`),children:y},e.id)}return o?(0,q.jsx)(`article`,{className:`w-full min-w-0`,children:(0,q.jsx)(`button`,{type:`button`,className:`w-full min-w-0 px-4 py-3 text-left outline-none transition-colors hover:bg-interactive-hover focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-[var(--interactive-focus-ring)] motion-reduce:transition-none`,"aria-label":h(`sessions.scheduledTasks.history.openSession`),onClick:()=>lt(e),children:y})},e.id):(0,q.jsx)(`article`,{className:`w-full min-w-0 px-4 py-3`,children:y},e.id)}),Q.error?(0,q.jsxs)(`div`,{className:v(`flex flex-wrap items-center justify-between gap-2 p-3 typography-meta text-[var(--status-error-foreground)]`,Y?`rounded-xl border border-[var(--status-error-border)] bg-[var(--status-error-background)]`:`border-t border-[var(--status-error-border)] bg-[var(--status-error-background)]`),children:[(0,q.jsx)(`span`,{children:h(`sessions.scheduledTasks.history.error.more`)}),(0,q.jsx)(_,{variant:`outline`,size:`sm`,onClick:()=>void mt(),children:h(`sessions.scheduledTasks.history.retry`)})]}):null]}),Q.hasNextPage?(0,q.jsx)(`div`,{ref:Re,className:`flex min-h-px justify-center`,children:Q.isFetchingNextPage?(0,q.jsx)(`span`,{role:`status`,"aria-label":h(`sessions.scheduledTasks.history.loadingMore`),className:`py-1 text-muted-foreground`,children:(0,q.jsx)(S,{name:`loader-4`,className:`size-4 animate-spin motion-reduce:animate-none`,"aria-hidden":`true`})}):null}):null]}):(0,q.jsxs)(q.Fragment,{children:[Ge.length>0?(0,q.jsx)(`div`,{className:`mb-3 rounded-xl border p-3 typography-meta`,style:kt(`warning`),children:h(`sessions.scheduledTasks.workspace.partialLoadWarning`)}):null,X.isLoading?(0,q.jsxs)(`div`,{className:`flex items-center gap-2 px-4 py-3 typography-meta text-muted-foreground`,children:[(0,q.jsx)(S,{name:`loader-4`,className:`h-4 w-4 animate-spin`}),` `,h(`sessions.scheduledTasks.dialog.loading`)]}):X.error&&!X.data?(0,q.jsx)(`div`,{className:`rounded-xl border border-dashed border-border p-4 typography-meta text-muted-foreground`,children:X.error instanceof Error?X.error.message:h(`sessions.scheduledTasks.dialog.toast.loadFailed`)}):(0,q.jsx)(E,{initial:!1,mode:`popLayout`,children:Mt.length===0?(0,q.jsx)(V.div,{initial:w?{opacity:0}:{opacity:0,y:4},animate:{opacity:1,y:0},exit:w?{opacity:0}:{opacity:0,y:-4},transition:{duration:w?0:.18,ease:[.22,1,.36,1]},className:`rounded-xl border border-dashed border-border p-4 typography-meta text-muted-foreground`,children:We.length>0?h(`sessions.scheduledTasks.workspace.search.noResults`):h(`sessions.scheduledTasks.dialog.empty.noTasks`)},`empty`):(0,q.jsx)(V.div,{initial:w?{opacity:0}:{opacity:0,y:4},animate:{opacity:1,y:0},exit:w?{opacity:0}:{opacity:0,y:-4},transition:{duration:w?0:.18,ease:[.22,1,.36,1]},className:v(J?`space-y-4`:`space-y-1`),children:(0,q.jsx)(E,{initial:!1,mode:`popLayout`,children:Mt.map(e=>{let{projectId:t,task:n}=e,r=At({projectId:t,taskId:n.id}),i=z===`edit`&&L!==null&&At(L)===r,a=n.state?.nextRunAt,o=n.state?.lastStatus||`idle`,s=Ot[o],c=je===r,l=t=>(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(t,{className:v(Y&&`min-h-11`),onClick:t=>{t.stopPropagation(),xt(e)},disabled:c,children:[(0,q.jsx)(S,{name:`play`,className:`size-4`}),h(`sessions.scheduledTasks.dialog.actions.runNow`)]}),(0,q.jsxs)(t,{className:v(Y&&`min-h-11`),onClick:t=>{t.stopPropagation(),ut(e)},children:[(0,q.jsx)(S,{name:`history`,className:`size-4`}),h(`sessions.scheduledTasks.workspace.views.history`)]}),(0,q.jsxs)(t,{className:v(Y&&`min-h-11`),onClick:t=>{t.stopPropagation(),St(e,!n.enabled)},disabled:c,children:[(0,q.jsx)(S,{name:n.enabled?`pause`:`play`,className:`size-4`}),n.enabled?h(`sessions.scheduledTasks.dialog.actions.pause`):h(`sessions.scheduledTasks.dialog.actions.resume`)]}),(0,q.jsxs)(t,{onClick:t=>{t.stopPropagation(),bt(e)},disabled:c,className:v(`text-destructive focus:text-destructive`,Y&&`min-h-11`),children:[(0,q.jsx)(S,{name:`delete-bin`,className:`size-4 text-inherit`}),h(`sessions.scheduledTasks.dialog.actions.delete`)]})]});return(0,q.jsx)(V.div,{layout:`position`,initial:!w&&{opacity:0,y:6},animate:{opacity:1,y:0},exit:w?{opacity:0}:{opacity:0,y:-6},transition:{duration:w?0:.18,ease:[.22,1,.36,1]},"data-mobile-press-surface":J?`soft`:void 0,className:v(J&&`yuri-mobile-floating-surface yuri-mobile-project-shell yuri-mobile-scheduled-task-card`),children:(0,q.jsxs)(ue,{open:Ne===r,onOpenChange:e=>{e&&Ie(null),Pe(e?r:null)},children:[(0,q.jsxs)(`div`,{className:v(`group flex w-full items-center gap-1`,J&&`yuri-mobile-project-card`),children:[(0,q.jsxs)(j,{render:(0,q.jsx)(`button`,{type:`button`,onClick:()=>it(e),onContextMenu:!Y&&!T?e=>{e.preventDefault(),Ie(null),Pe(r)}:void 0,"data-mobile-press-surface-trigger":J?!0:void 0,className:v(`flex min-h-11 min-w-0 flex-1 items-center rounded-xl border py-3 text-left outline-none focus-visible:ring-2 focus-visible:ring-[var(--interactive-focus-ring)] motion-reduce:transition-none`,J?`yuri-mobile-project-trigger yuri-mobile-scheduled-task-row border-0 bg-transparent transition-opacity duration-150`:`transition-[background-color,border-color,box-shadow,opacity] duration-150 ease-out active:bg-interactive-active`,Y&&!J?`gap-2.5 px-3`:J?void 0:`gap-3 px-4`,!J&&(i?`border-border/50 bg-[var(--surface-elevated)] shadow-sm dark:shadow-none`:`border-transparent hover:bg-interactive-hover`),!n.enabled&&`opacity-65`),"aria-pressed":i}),children:[(0,q.jsx)(`span`,{className:v(`flex shrink-0 items-center justify-center rounded-full text-muted-foreground transition-[border-color,color,background-color] duration-150 motion-reduce:transition-none`,J?`yuri-mobile-project-icon yuri-mobile-glass-control`:`size-5 border border-border`),style:n.enabled&&s.tone!==`muted`?{color:`var(--status-${s.tone})`}:void 0,children:(0,q.jsx)(E,{initial:!1,mode:`wait`,children:(0,q.jsx)(V.span,{initial:!w&&{opacity:0,scale:.72},animate:{opacity:1,scale:1},exit:w?{opacity:0}:{opacity:0,scale:.72},transition:{duration:w?0:.15},className:`flex`,children:(0,q.jsx)(S,{name:n.enabled?s.Icon:`pause`,className:v(J?`yuri-mobile-project-icon-glyph`:`size-3.5`,s.spin&&n.enabled&&`animate-spin`)})},`${n.enabled}-${o}`)})}),(0,q.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,q.jsx)(`span`,{className:v(`block truncate font-medium`,J?`yuri-mobile-project-title yuri-mobile-entity-title font-semibold`:`typography-ui-label`),children:n.name}),(0,q.jsxs)(`span`,{className:v(`mt-1 flex min-w-0 items-center text-muted-foreground`,J?`yuri-mobile-project-meta yuri-mobile-entity-meta`:`gap-1 typography-micro`),children:[(0,q.jsx)(`span`,{className:`truncate`,children:Ct(n,h,!J)}),(0,q.jsx)(`span`,{className:`shrink-0 text-muted-foreground/50`,children:`·`}),(0,q.jsx)(`span`,{className:`shrink-0 truncate`,children:a?wt(a,h):`—`})]})]})]}),(0,q.jsx)(_,{type:`button`,variant:`ghost`,size:`icon`,className:v(`shrink-0 self-center rounded-lg text-muted-foreground`,Y?`size-11 rounded-full`:`size-9`),onClick:t=>{t.stopPropagation(),ut(e)},"aria-label":h(`sessions.scheduledTasks.workspace.views.history`),children:(0,q.jsx)(S,{name:`history`,className:`size-4`})}),(0,q.jsxs)(ce,{open:Fe===r,onOpenChange:e=>{e&&Pe(null),Ie(e?r:null)},children:[(0,q.jsx)(k,{asChild:!0,children:(0,q.jsx)(_,{type:`button`,variant:`ghost`,size:`icon`,className:v(`shrink-0 self-center text-muted-foreground transition-[opacity,transform,background-color] duration-150 ease-out data-[popup-open]:bg-interactive-hover motion-reduce:transition-none`,J?`yuri-mobile-project-action yuri-mobile-scheduled-task-action rounded-full`:`rounded-lg`,J?void 0:Y?`size-11`:`size-8 translate-x-1 opacity-0 group-hover:translate-x-0 group-hover:opacity-100 data-[popup-open]:translate-x-0 data-[popup-open]:opacity-100`,i&&!J&&`opacity-100`),onClick:e=>e.stopPropagation(),"aria-label":h(`sessions.scheduledTasks.dialog.actions.moreAria`,{taskName:n.name}),children:(0,q.jsx)(S,{name:`more-2`,className:J?`size-5`:`size-4`})})}),(0,q.jsx)(se,{align:`end`,className:`min-w-40 motion-reduce:transition-none`,onClick:e=>e.stopPropagation(),children:l(A)})]})]}),(0,q.jsx)(M,{className:`min-w-40 motion-reduce:transition-none`,children:l(le)})]})},r)})})},`tasks`)})]})})})]})]}),z===`edit`&&!Ke?(0,q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col items-center justify-center gap-3 p-4`,role:`status`,children:[X.isPending?h(`sessions.scheduledTasks.dialog.loading`):h(`common.unavailable`),X.isPending?null:(0,q.jsx)(_,{variant:`outline`,size:`sm`,onClick:()=>void X.refetch(),children:h(`assistants.actions.retry`)})]}):null,T?z===`create`||z===`edit`&&Ke?(0,q.jsx)(`div`,{ref:J?Ve:void 0,className:v(J?`yuri-mobile-scheduled-editor-overlay flex w-full min-w-0 max-w-full flex-col overflow-hidden bg-background [contain:layout_paint]`:`contents`),children:(0,q.jsx)(ft,{open:!0,presentation:J?`mobile-tab`:Y?`mobile-panel`:void 0,task:z===`edit`?Ke:null,onOpenChange:ht,onSave:vt,onDirtyChange:W,onRun:async()=>{Z&&await xt(Z)},onOpenTaskHistory:pt,onDelete:async()=>{Z&&await bt(Z)},onToggleEnabled:async(e,t)=>{Z&&await St(Z,t)},actionBusy:!!je,projectID:L?.projectId||F,projectOptions:Ft,onProjectChange:z===`create`?I:void 0})}):null:(0,q.jsx)(E,{initial:!1,children:z===`create`||z===`edit`&&Ke?(0,q.jsx)(V.div,{initial:w?{opacity:1,width:0}:{opacity:0,width:0,x:24},animate:{opacity:1,width:`clamp(380px, 36vw, 480px)`,x:0},exit:w?{opacity:0,width:0}:{opacity:0,width:0,x:24},transition:{duration:w?0:.26,ease:[.22,1,.36,1]},className:`h-full min-h-0 max-w-[480px] shrink-0 overflow-hidden`,children:(0,q.jsx)(`aside`,{className:`h-full min-h-0 w-[clamp(380px,36vw,480px)] border-l border-border/60 bg-background`,children:(0,q.jsx)(ft,{open:!0,presentation:`panel`,task:z===`edit`?Ke:null,onOpenChange:ht,onSave:vt,onDirtyChange:W,onRun:async()=>{Z&&await xt(Z)},onOpenTaskHistory:pt,onDelete:async()=>{Z&&await bt(Z)},onToggleEnabled:async(e,t)=>{Z&&await St(Z,t)},actionBusy:!!je,projectID:L?.projectId||F,projectOptions:Ft,onProjectChange:z===`create`?I:void 0})})},`scheduled-task-details`):null})]})}export{zt as n,xt as t};
|