@yuriai/web 0.3.6-beta.7 → 0.3.6
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/README.md +19 -3
- package/bin/install-portable.sh +102 -0
- package/bin/install-portable.test.js +112 -0
- package/bin/lib/DOCUMENTATION.md +2 -0
- package/bin/lib/cli-startup.js +7 -2
- package/bin/lib/cli-startup.portable.test.js +30 -0
- package/bin/lib/commands-serve.js +4 -1
- package/bin/lib/commands-update.js +3 -0
- package/bin/lib/commands-update.test.js +18 -0
- package/dist/assets/{AgentAvatar-BAQBlzA3.js → AgentAvatar-BOvjZ-DI.js} +1 -1
- package/dist/assets/{AgentSelector-J9hP4-Bk.js → AgentSelector-Dl_zIOMk.js} +1 -1
- package/dist/assets/ArchivedSessionsDialog-Cr9Ji-RY.js +1 -0
- package/dist/assets/{AssistantConversationSurface-_A2W4Tnz.js → AssistantConversationSurface-CLdjNFeJ.js} +3 -3
- package/dist/assets/{AssistantSessionCard-DwFD8GED.js → AssistantSessionCard-BufyrOfo.js} +2 -2
- package/dist/assets/{AssistantUnreadBadge-CE-vFrqq.js → AssistantUnreadBadge-Dn9HAEDr.js} +1 -1
- package/dist/assets/{AssistantView-CwbzFAMd.js → AssistantView-Cg0wPomu.js} +1 -1
- package/dist/assets/{AssistantWorkingAvatar-BsEtliRi.js → AssistantWorkingAvatar-1KNjr2A2.js} +1 -1
- package/dist/assets/{AssistantsSettingsPage-D9VPa4dh.js → AssistantsSettingsPage-DeYfZAYH.js} +1 -1
- package/dist/assets/BinaryFileFallback-DfD02fS_.js +1 -0
- package/dist/assets/{BtwPanel-BKb8rDF4.js → BtwPanel-B_2w8P0X.js} +2 -2
- package/dist/assets/BusyDots-CAv4ygIO.js +4 -0
- package/dist/assets/{ChatContainer-ZnwOYIsK.js → ChatContainer-Dgv075jT.js} +23 -23
- package/dist/assets/ChatView-Cr71C0ZB.js +3 -0
- package/dist/assets/{DiagramView-DlPmGnFF.js → DiagramView-CTnpBsWU.js} +1 -1
- package/dist/assets/{DiffView-C4OcFwR2.js → DiffView-j_yWF1Mz.js} +2 -2
- package/dist/assets/{DiffViewToggle-DP9SqcOq.js → DiffViewToggle-CYusbmY5.js} +1 -1
- package/dist/assets/{ErrorBoundary-4W-EnYOU.js → ErrorBoundary-yr_JeVdx.js} +1 -1
- package/dist/assets/{FadeInOnReveal-nGKSFTqz.js → FadeInOnReveal-C56koblQ.js} +1 -1
- package/dist/assets/{GuiPluginMount-c2DXwGOK.js → GuiPluginMount-CBJiLdzR.js} +1 -1
- package/dist/assets/{GuiPluginPage-DqdVVRyY.js → GuiPluginPage-DJa8gFLk.js} +1 -1
- package/dist/assets/{GuiPluginSurface-CHSyQ4aq.js → GuiPluginSurface-Cc7q80jp.js} +1 -1
- package/dist/assets/{GuiPluginTitlebarItems-CBKus1Mw.js → GuiPluginTitlebarItems-rbK3leaL.js} +1 -1
- package/dist/assets/{GuiPluginWindow-AKqPYEmj.js → GuiPluginWindow-Cpg2HYWe.js} +1 -1
- package/dist/assets/{Icon-DlTEfBVi.js → Icon-C1rjS64C.js} +1 -1
- package/dist/assets/{ImageLoadingPlaceholder-ashKHrbc.js → ImageLoadingPlaceholder-2hMqBtYh.js} +1 -1
- package/dist/assets/{LoadingImage-3JaK3zim.js → LoadingImage-Bs-621ZL.js} +1 -1
- package/dist/assets/MarkdownRenderer-BZl_T1ng.js +2 -0
- package/dist/assets/{MarkdownRendererImpl-B1l_DAn4.js → MarkdownRendererImpl-DiCCNjDr.js} +3 -3
- package/dist/assets/{MarkstreamRendererImpl-D6ZF2eue.js → MarkstreamRendererImpl-Bzz3OZlX.js} +2 -2
- package/dist/assets/{MobileAssistantSettingsPage-Dm4f6DKQ.js → MobileAssistantSettingsPage-pBhJR2t6.js} +1 -1
- package/dist/assets/{MobileAssistantTab-CmMbLmB9.js → MobileAssistantTab-Ceo442NF.js} +1 -1
- package/dist/assets/{MobileBtwPage-CNj2pFrK.js → MobileBtwPage-DPPmDMA6.js} +1 -1
- package/dist/assets/{MobileChangesSurface-CLD7Fujk.js → MobileChangesSurface-DfDoSkTS.js} +1 -1
- package/dist/assets/{MobileChatScreen-a7vpuIM7.js → MobileChatScreen-DHTbrnAr.js} +1 -1
- package/dist/assets/{MobileDetailNavigation-BPj5iEVr.js → MobileDetailNavigation-e1u1y59T.js} +1 -1
- package/dist/assets/{MobileFilesSurface-Ct7W0756.js → MobileFilesSurface-CJoqR3By.js} +2 -2
- package/dist/assets/{MobileHtmlNetworkBoundary-BcAbBib9.js → MobileHtmlNetworkBoundary-GBhYVYvu.js} +2 -2
- package/dist/assets/{MobileOverlayPanel-Dn4b7Mdh.js → MobileOverlayPanel-DzKTKeZX.js} +1 -1
- package/dist/assets/{MobileResizableSheet-BMSiXFxQ.js → MobileResizableSheet-CkA7qhco.js} +1 -1
- package/dist/assets/{MobileSettingsTab-b_XK7f7k.js → MobileSettingsTab-Bv0HsXFH.js} +1 -1
- package/dist/assets/{MobileShareBridge-BCHk5fz-.js → MobileShareBridge-B-co2UPE.js} +1 -1
- package/dist/assets/{MobileSurface-CXbG9hIC.js → MobileSurface-D63k27t5.js} +1 -1
- package/dist/assets/{MobileTabPageHeader-CipRIWUc.js → MobileTabPageHeader-FmtbGhwq.js} +1 -1
- package/dist/assets/{ModelLogo-Bbgp7ClJ.js → ModelLogo-CMnp5fyy.js} +1 -1
- package/dist/assets/{ModelSelector-BkrO8Ru2.js → ModelSelector-BF4wYwaz.js} +1 -1
- package/dist/assets/{MultiRunWindow-rDqLANIK.js → MultiRunWindow-D0OU63re.js} +1 -1
- package/dist/assets/{OnboardingScreen-DOcb9Wbw.js → OnboardingScreen-CDHtDQ0k.js} +1 -1
- package/dist/assets/{OverlayScrollbar-qJOPKg_1.js → OverlayScrollbar-m1EAqRES.js} +1 -1
- package/dist/assets/{PierreDiffViewer-DkAFZ6Oy.js → PierreDiffViewer-CZk1tZ3K.js} +1 -1
- package/dist/assets/{ProviderLogo-xLMKk9bq.js → ProviderLogo-BqQTME35.js} +1 -1
- package/dist/assets/{RemoteAssistantSessionCard-iPGtzThJ.js → RemoteAssistantSessionCard-CrbCVhqD.js} +1 -1
- package/dist/assets/{RemoteDesktopPanel-Da5Cb1yO.js → RemoteDesktopPanel-BzLmzmjb.js} +1 -1
- package/dist/assets/ScheduledTasksDialog-DmtcDZHc.js +3 -0
- package/dist/assets/{ScrollableOverlay-X1R_GNYm.js → ScrollableOverlay-CEglrXfm.js} +1 -1
- package/dist/assets/{SettingsGroup-DYxliYJo.js → SettingsGroup-Bm-l3IIs.js} +1 -1
- package/dist/assets/{SettingsView-Dfvs9-aB.js → SettingsView-CYEjDYWC.js} +15 -15
- package/dist/assets/{SettingsWindow-CCACaIcI.js → SettingsWindow-CvJsxUyu.js} +1 -1
- package/dist/assets/{SetupTourDialog-CTzVvWuI.js → SetupTourDialog-DWaVtkY0.js} +1 -1
- package/dist/assets/{SyncActions-BKhytR-H.js → SyncActions-C0gph0P8.js} +1 -1
- package/dist/assets/TerminalView-Cm8Ts51w.js +9 -0
- package/dist/assets/{TextSelectionMenu-C--W3Vxw.js → TextSelectionMenu-Dcv_PdES.js} +2 -2
- package/dist/assets/{ToolOutputDialog-4QosyyR-.js → ToolOutputDialog-QJpQjmqK.js} +2 -2
- package/dist/assets/{YuriLogo-YAE_6MsI.js → YuriLogo-BbS_Wj4g.js} +1 -1
- package/dist/assets/{YuriWordmark-BFHeVOwW.js → YuriWordmark-CqkcfAJl.js} +1 -1
- package/dist/assets/{assistant-attachment-cache-B8Bvp93X.js → assistant-attachment-cache-CIij0OGm.js} +1 -1
- package/dist/assets/{assistantMessagePreview-Dnt4nt3K.js → assistantMessagePreview-wmP-d_oa.js} +1 -1
- package/dist/assets/{assistantQueries-CV8A3Du5.js → assistantQueries-Dpxq78yP.js} +1 -1
- package/dist/assets/{auto-read-context-DWZsSvww.js → auto-read-context-aRn5yhDb.js} +1 -1
- package/dist/assets/{capgoAdapter-Dlf0ZlyX.js → capgoAdapter-BSnmtwX8.js} +1 -1
- package/dist/assets/{card-5xUgzwRy.js → card-aoveY4I3.js} +1 -1
- package/dist/assets/{chatUpwardIntent-ExbNZtoR.js → chatUpwardIntent-WxxmOppY.js} +1 -1
- package/dist/assets/{checkbox-BFuJ7w49.js → checkbox-CljLXON1.js} +1 -1
- package/dist/assets/{client-Brr-ja1l.js → client-CmtAKi5B.js} +1 -1
- package/dist/assets/{collapsible-DVLlg0W-.js → collapsible-DkeWKEAb.js} +1 -1
- package/dist/assets/{connection-hint-BARMaHbM.js → connection-hint-DsKyICgn.js} +1 -1
- package/dist/assets/{context-menu-CUqRZr1z.js → context-menu-XuMa5TsA.js} +1 -1
- package/dist/assets/{desktopHosts-BBCo4tyU.js → desktopHosts-COI-czjF.js} +1 -1
- package/dist/assets/{desktopRelayRestore-Cm2ITP98.js → desktopRelayRestore-BEPNc7qb.js} +1 -1
- package/dist/assets/device-TCHW5U2y.js +2 -0
- package/dist/assets/{diagram-BazwKH8x.js → diagram-DFv7Lh0h.js} +1 -1
- package/dist/assets/dialog-B6B8FIrL.css +1 -0
- package/dist/assets/{dialog-C_SxVFAo.js → dialog-Cx20I73q.js} +1 -1
- package/dist/assets/{dropdown-menu-CtAMJkEu.js → dropdown-menu-XdfySbu2.js} +1 -1
- package/dist/assets/es-CLAEdHpc.js +15 -0
- package/dist/assets/{fileMentionTouchSelection-DTWPCfYk.js → fileMentionTouchSelection-pXNTKHAc.js} +1 -1
- package/dist/assets/{fileReferenceActions-ez7SW3IW.js → fileReferenceActions-wN7mWY3w.js} +1 -1
- package/dist/assets/fr-BOB0gfdQ.js +13 -0
- package/dist/assets/{gitApi-SW-vcLxI.js → gitApi-LXGRaDt8.js} +1 -1
- package/dist/assets/{gitApiHttp-fl5lB9Lu.js → gitApiHttp-ZjM4HkSo.js} +2 -2
- package/dist/assets/{githubAuthQueries-2oyz-OKR.js → githubAuthQueries-3AJp5LD5.js} +1 -1
- package/dist/assets/{historyImportQueries-CTTVEQfk.js → historyImportQueries-B_mfphxe.js} +1 -1
- package/dist/assets/host-fTclNJST.js +1 -0
- package/dist/assets/{i18n-CzwXzoAE.js → i18n-iu4pzqPi.js} +1 -1
- package/dist/assets/{icons-B9kwDPqG.js → icons-BWijARKS.js} +1 -1
- package/dist/assets/{imageSource-5oLkHxn4.js → imageSource-qzgDdfT4.js} +1 -1
- package/dist/assets/{input-JTEWOZSR.js → input-BMYgp87Q.js} +1 -1
- package/dist/assets/{input-store-olhHHDxh.js → input-store-CzG_3qFv.js} +1 -1
- package/dist/assets/insertionBoundaries-bmxIeFzH.js +1 -0
- package/dist/assets/ja-CfM9jZ6u.js +15 -0
- package/dist/assets/{kbd-2UM_iptD.js → kbd-6RW-BxuR.js} +1 -1
- package/dist/assets/ko-DZOSVPHB.js +15 -0
- package/dist/assets/main-B-Wdp6An.js +169 -0
- package/dist/assets/main-BLBAaohb.js +2 -0
- package/dist/assets/{markdownHeightCache-CYOg5vHN.js → markdownHeightCache-ojT5txMS.js} +1 -1
- package/dist/assets/{mcpQueries-BBdJw27k.js → mcpQueries-BRuytwhB.js} +1 -1
- package/dist/assets/miniChat-BsrHy2rU.js +2 -0
- package/dist/assets/mobile-B8SHiXyq.js +2 -0
- package/dist/assets/{mobileBackNavigation-BMKb1AFe.js → mobileBackNavigation-CVrR_jtn.js} +1 -1
- package/dist/assets/{mobileConnections-B3sO6LHd.js → mobileConnections-iSUwFNqu.js} +2 -2
- package/dist/assets/{multirun-CIo87Y8M.js → multirun-Y3K5yS-8.js} +1 -1
- package/dist/assets/{native-config-B9rt7FGl.js → native-config-tvqKHwCC.js} +1 -1
- package/dist/assets/{nativeComposerCover-692JM3W7.js → nativeComposerCover-5rYz1E3W.js} +1 -1
- package/dist/assets/{navigation-DZmwc567.js → navigation-DFmCAq2g.js} +2 -2
- package/dist/assets/openRemoteProjectSession-CeSahDtQ.js +1 -0
- package/dist/assets/openSessionFromDeepLink-DsZnNy4W.js +2 -0
- package/dist/assets/pl-CaT81Sz8.js +15 -0
- package/dist/assets/platform-B2ylz14u.js +1 -0
- package/dist/assets/{pluginPresentation-mP_3zj0n.js → pluginPresentation-rls1AMJN.js} +2 -2
- package/dist/assets/{project-preview-D6gRDnY0.js → project-preview-yQerlKs2.js} +1 -1
- package/dist/assets/{projectActions-BhKknl2F.js → projectActions-B11KAI3f.js} +1 -1
- package/dist/assets/{prompt-attachment-upload-DmbZaK4Q.js → prompt-attachment-upload-BzYqZdzd.js} +1 -1
- package/dist/assets/pt-BR-9p1IKCEF.js +15 -0
- package/dist/assets/pwa-BrLPfcLk.js +2 -0
- package/dist/assets/{queue-abort-optimistic-DEP8n-eH.js → queue-abort-optimistic-CXKdQu_T.js} +1 -1
- package/dist/assets/{quota-noApkDjp.js → quota-BhdKv_Wc.js} +1 -1
- package/dist/assets/{reference-history-YQuuHaEQ.js → reference-history-Bzn-aPYg.js} +1 -1
- package/dist/assets/{remote-input-store-BuAuKvuo.js → remote-input-store-DPw_n0MZ.js} +1 -1
- package/dist/assets/{remoteProjectQueries-DtoxpM86.js → remoteProjectQueries-BQzoY_Y9.js} +1 -1
- package/dist/assets/{remoteSessionReference-Dh6CWWHy.js → remoteSessionReference-DORvqUYQ.js} +1 -1
- package/dist/assets/{renderElectronMiniChatApp-BXmpVc6d.js → renderElectronMiniChatApp-DXKgwBat.js} +2 -2
- package/dist/assets/renderMobileApp-CKN6rWxR.js +17 -0
- package/dist/assets/{runtime-file-download-CljroGkE.js → runtime-file-download-CaeLqIEY.js} +1 -1
- package/dist/assets/{runtime-file-resource-BlS-Ew1z.js → runtime-file-resource-BGZ4tGr5.js} +1 -1
- package/dist/assets/{runtimeConfig-CuW_HzK3.js → runtimeConfig-BqUZF6Wt.js} +1 -1
- package/dist/assets/runtimeEndpointReset-Bu02gAs3.js +4 -0
- package/dist/assets/{scheduledTaskNavigation-B1lpSDXk.js → scheduledTaskNavigation-r3g3DfXq.js} +1 -1
- package/dist/assets/{select-CDQXclVD.js → select-BPIsJWhM.js} +1 -1
- package/dist/assets/{sessionLookup-CQ0NWnCZ.js → sessionLookup-DZhrkKRI.js} +1 -1
- package/dist/assets/sessionOwnership-LoUNVeuJ.js +2 -0
- package/dist/assets/{shortcuts-DstiGEO9.js → shortcuts-DMupfl7l.js} +1 -1
- package/dist/assets/{sortable-tabs-strip-DyQNBvm3.js → sortable-tabs-strip-1bKw81VO.js} +1 -1
- package/dist/assets/{speechSettingsQueries-BkOKGdjP.js → speechSettingsQueries-C3JgzCqy.js} +1 -1
- package/dist/assets/src-BacdFOCS.css +2 -0
- package/dist/assets/{store-BRt8bo0A.js → store-BgsgBTwJ.js} +5 -5
- package/dist/assets/{switch-zJbRtv_r.js → switch-B4-v9kvg.js} +1 -1
- package/dist/assets/{terminalApi-FD8v3NAb.js → terminalApi-wdwb9MVG.js} +1 -1
- package/dist/assets/{textarea-DTZqFbDz.js → textarea-DExmj0ZR.js} +1 -1
- package/dist/assets/{timeFormat-Cfigwcpm.js → timeFormat-BlSO2-ws.js} +1 -1
- package/dist/assets/{tooltip-dWH5QFxu.js → tooltip-Di-WRJUZ.js} +1 -1
- package/dist/assets/{truncated-path-CXZAFwlh.js → truncated-path-nKzykV5p.js} +1 -1
- package/dist/assets/types-4xeqxklF.js +2 -0
- package/dist/assets/ui-BCYkB585.js +13 -0
- package/dist/assets/uk-BUSl_Y_1.js +15 -0
- package/dist/assets/useAppFontEffects-BCJPQstm.js +7 -0
- package/dist/assets/{useAssistantUIStore-90j09IZB.js → useAssistantUIStore-BUWPTwNV.js} +1 -1
- package/dist/assets/{useDesktopWindowControlsLayout-DGB6_pWm.js → useDesktopWindowControlsLayout-BtpyMlOS.js} +1 -1
- package/dist/assets/{useDictation-hf70zk6P.js → useDictation-4HBMkISY.js} +1 -1
- package/dist/assets/{useEffectiveDirectory-CcSfY1lN.js → useEffectiveDirectory-BYswRwIv.js} +1 -1
- package/dist/assets/useFontPreferences-C4dQT72k.js +1 -0
- package/dist/assets/{useGitStore-IAG82rgx.js → useGitStore-DqBPgmf-.js} +1 -1
- package/dist/assets/{useInlineCommentDraftStore-DAq3lz0A.js → useInlineCommentDraftStore-CGJ6dM8d.js} +1 -1
- package/dist/assets/useMcpConfigStore-DEcxFuzW.js +1 -0
- package/dist/assets/{useMobileSwipeActions-5-ZcwhfI.js → useMobileSwipeActions-DqlR4X-T.js} +1 -1
- package/dist/assets/useMobileTranscriptSyncHint-BDKcqtq_.js +10 -0
- package/dist/assets/{useModelLists-D8s2D-yz.js → useModelLists-DsFTBlMr.js} +1 -1
- package/dist/assets/{useOpenCodeReadiness-BIyAApPB.js → useOpenCodeReadiness-CHybAoBh.js} +1 -1
- package/dist/assets/usePluginsStore-BIBHPK4A.js +1 -0
- package/dist/assets/{useProjectGitActions-DPqScNnn.js → useProjectGitActions-DeFcqi_O.js} +1 -1
- package/dist/assets/{useProjectGitStore-BOiooCle.js → useProjectGitStore-JGZk-NCk.js} +1 -1
- package/dist/assets/{useProjectRuntimeAPIs-DQaT_Ok_.js → useProjectRuntimeAPIs-BMBBtJB-.js} +1 -1
- package/dist/assets/{useQuotaStore-C3FDA_wk.js → useQuotaStore-C3qJTiD7.js} +1 -1
- package/dist/assets/{useSessionBtwStore-eNT3w9Un.js → useSessionBtwStore-D7P-pknd.js} +1 -1
- package/dist/assets/{useStreamingTextThrottle-D8r8Ox9l.js → useStreamingTextThrottle-CjWAE0oQ.js} +1 -1
- package/dist/assets/useTerminalStore-C_QzSEgP.js +1 -0
- package/dist/assets/{useUIStore-BkYqSmAD.js → useUIStore-68ZPpgYA.js} +1 -1
- package/dist/assets/worktreeManager-pRvX5dQT.js +1 -0
- package/dist/assets/{worktreeSourceBranchPreference-B9rTzT2t.js → worktreeSourceBranchPreference-B7d3RYcc.js} +1 -1
- package/dist/assets/zh-CN-BGKgQtWd.js +15 -0
- package/dist/assets/zh-TW-jM5lIKfe.js +15 -0
- package/dist/index.html +16 -16
- package/dist/mini-chat.html +16 -16
- package/dist/mobile.html +2 -2
- package/package.json +2 -1
- package/server/index.js +22 -10
- package/server/lib/assistants/DOCUMENTATION.md +11 -6
- package/server/lib/assistants/builtin-skills.js +19 -3
- package/server/lib/assistants/builtin-skills.test.js +17 -0
- package/server/lib/assistants/contact-tools.js +47 -3
- package/server/lib/assistants/contact-tools.test.js +59 -0
- package/server/lib/assistants/harness.js +5 -2
- package/server/lib/assistants/harness.test.js +1 -1
- package/server/lib/assistants/routes.js +1 -0
- package/server/lib/assistants/service.js +7 -2
- package/server/lib/assistants/yuri-tools.js +1 -1
- package/server/lib/assistants/yuri-tools.test.js +1 -1
- package/server/lib/gui-customization/DOCUMENTATION.md +32 -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 +7 -6
- package/server/lib/gui-customization/remote-connections.test.js +17 -0
- package/server/lib/gui-customization/session-skill.js +16 -4
- package/server/lib/gui-customization/session-skill.test.js +16 -0
- package/server/lib/gui-customization/skill/SKILL.md +2 -2
- package/server/lib/gui-customization/skill/references/deep-links.md +15 -11
- package/server/lib/gui-customization/skill/references/gui-api.md +50 -1
- package/server/lib/gui-customization/skill/references/projects.md +19 -0
- package/server/lib/gui-customization/skill/references/remote-connections.md +3 -0
- package/server/lib/gui-customization/skill-caller.js +18 -0
- package/server/lib/host-update/DOCUMENTATION.md +5 -0
- package/server/lib/host-update/cli.js +5 -2
- package/server/lib/host-update/cli.test.js +15 -2
- package/server/lib/opencode/DOCUMENTATION.md +2 -1
- package/server/lib/opencode/custom-provider.test.js +41 -0
- package/server/lib/opencode/feature-routes-runtime.js +20 -3
- package/server/lib/opencode/settings-helpers.js +5 -0
- package/server/lib/opencode/settings-helpers.test.js +10 -0
- package/server/lib/package-manager.js +14 -0
- package/server/lib/package-manager.test.js +7 -0
- package/server/lib/portable-installation.js +34 -0
- package/server/lib/portable-installation.test.js +38 -0
- package/server/lib/session-index/DOCUMENTATION.md +8 -0
- package/server/lib/session-index/adopt-unindexed-session.js +46 -0
- package/server/lib/session-index/adopt-unindexed-session.test.js +77 -0
- package/server/lib/session-index/event-ingest.js +14 -1
- package/server/lib/session-index/event-ingest.test.js +18 -0
- package/dist/assets/ArchivedSessionsDialog-8KudFtdU.js +0 -1
- package/dist/assets/BinaryFileFallback-DhRqRBKp.js +0 -1
- package/dist/assets/BusyDots-BRm9osT-.js +0 -4
- package/dist/assets/ChatView-CZyfJPJI.js +0 -3
- package/dist/assets/MarkdownRenderer-MCdcFkrB.js +0 -2
- package/dist/assets/ScheduledTasksDialog-CBVwmP3I.js +0 -3
- package/dist/assets/TerminalView-BE88iCut.js +0 -8
- package/dist/assets/device-DaBjLp2g.js +0 -2
- package/dist/assets/dialog-D9CkSNCA.css +0 -1
- package/dist/assets/es-BuXtFKUW.js +0 -15
- package/dist/assets/fr-BaZeffY9.js +0 -13
- package/dist/assets/host-DkOpLMtd.js +0 -1
- package/dist/assets/insertionBoundaries-CmHoHHu4.js +0 -1
- package/dist/assets/ja-CGVx5A8U.js +0 -15
- package/dist/assets/ko-C663nzbf.js +0 -15
- package/dist/assets/main-2WZS1sUa.js +0 -2
- package/dist/assets/main-BoaXbSk_.js +0 -169
- package/dist/assets/miniChat-sY4pEF3a.js +0 -2
- package/dist/assets/mobile-oVfsL7ax.js +0 -2
- package/dist/assets/openRemoteProjectSession-CU45azVB.js +0 -1
- package/dist/assets/openSessionFromDeepLink-BoGMvzx0.js +0 -2
- package/dist/assets/pl-CeBOMwg9.js +0 -15
- package/dist/assets/platform-B_vXw3WJ.js +0 -1
- package/dist/assets/pt-BR-r8268Pk6.js +0 -15
- package/dist/assets/pwa-Cni1iHtS.js +0 -2
- package/dist/assets/renderMobileApp-B7v2goOK.js +0 -17
- package/dist/assets/runtimeEndpointReset-rGqYbpcd.js +0 -4
- package/dist/assets/sessionOwnership-DHLgtM_g.js +0 -2
- package/dist/assets/src-DYCPWwUH.css +0 -2
- package/dist/assets/types-CXWh93pl.js +0 -2
- package/dist/assets/ui-DiWlcrZU.js +0 -13
- package/dist/assets/uk-CeQ1XJ99.js +0 -15
- package/dist/assets/useAppFontEffects-DvftNvNI.js +0 -7
- package/dist/assets/useFontPreferences-BPtsS6hr.js +0 -1
- package/dist/assets/useMcpConfigStore-C6bGnrzx.js +0 -1
- package/dist/assets/useMobileTranscriptSyncHint-DwKbHgxp.js +0 -10
- package/dist/assets/usePluginsStore-DF6jfADo.js +0 -1
- package/dist/assets/worktreeManager-Dm96jF0K.js +0 -1
- package/dist/assets/zh-CN-Bv854olO.js +0 -15
- package/dist/assets/zh-TW-gx8cO-Cx.js +0 -15
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{$ as t,Q as n,et as r,ot as i,rt as a,st as o,tt as s}from"./vendor-base-ui-wXsskyKm.js";import{n as c}from"./vendor-react-BkccXcWz.js";import{
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{$ as t,Q as n,et as r,ot as i,rt as a,st as o,tt as s}from"./vendor-base-ui-wXsskyKm.js";import{n as c}from"./vendor-react-BkccXcWz.js";import{io as l}from"./ui-BCYkB585.js";import{t as u}from"./i18n-iu4pzqPi.js";import{SettingsView as d}from"./SettingsView-CYEjDYWC.js";var f=c(),p=e(o(),1),m=i(),h=e=>{let i=(0,f.c)(19),{open:o,onOpenChange:c}=e,{t:h}=u(),_=p.useId(),v=g,y;i[0]===c?y=i[1]:(y=e=>{!e&&v()||c(e)},i[0]=c,i[1]=y);let b;i[2]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,m.jsx)(a,{className:l(`fixed inset-0 z-50 bg-black/50 dark:bg-black/75`,`transition-opacity duration-150 ease-out`,`data-[starting-style]:opacity-0 data-[ending-style]:opacity-0`)}),i[2]=b):b=i[2];let x;i[3]===Symbol.for(`react.memo_cache_sentinel`)?(x=l(`relative pointer-events-auto`,`w-[90vw] max-w-[1200px] h-[85vh] max-h-[900px]`,`rounded-xl border shadow-none overflow-hidden origin-center`,`bg-background`,`transition-all duration-150 ease-out`,`data-[starting-style]:opacity-0 data-[starting-style]:scale-[0.98]`,`data-[ending-style]:opacity-0 data-[ending-style]:scale-[0.98]`,`data-[nested-dialog-open]:brightness-[0.55] dark:data-[nested-dialog-open]:brightness-[0.4]`),i[3]=x):x=i[3];let S;i[4]===h?S=i[5]:(S=h(`settings.window.description`),i[4]=h,i[5]=S);let C;i[6]!==_||i[7]!==S?(C=(0,m.jsx)(s,{id:_,className:`sr-only`,children:S}),i[6]=_,i[7]=S,i[8]=C):C=i[8];let w;i[9]===c?w=i[10]:(w=(0,m.jsx)(d,{onClose:()=>c(!1),isWindowed:!0}),i[9]=c,i[10]=w);let T;i[11]!==_||i[12]!==C||i[13]!==w?(T=(0,m.jsxs)(t,{children:[b,(0,m.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center pointer-events-none`,children:(0,m.jsxs)(r,{"aria-describedby":_,className:x,children:[C,w]})})]}),i[11]=_,i[12]=C,i[13]=w,i[14]=T):T=i[14];let E;return i[15]!==o||i[16]!==y||i[17]!==T?(E=(0,m.jsx)(n,{open:o,onOpenChange:y,children:T}),i[15]=o,i[16]=y,i[17]=T,i[18]=E):E=i[18],E};function g(){return typeof document>`u`?!1:!!document.querySelector(`[data-slot="dropdown-menu-content"][data-open], [data-slot="select-content"][data-open]`)}export{h as SettingsWindow};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,n}from"./runtime-switch-DEPKHgdL.js";import{ot as r,st as i}from"./vendor-base-ui-wXsskyKm.js";import{n as a}from"./vendor-react-BkccXcWz.js";import{s as o}from"./vendor-tanstack-react-query-DIb_ItL-.js";import{W as s}from"./runtime-file-resource-BlS-Ew1z.js";import{r as c}from"./vendor-reactuses-core-DjKFMfz7.js";import{Na as l,Yi as u,Yn as d,no as f}from"./ui-DiWlcrZU.js";import{n as p}from"./Icon-DlTEfBVi.js";import{t as m}from"./i18n-CzwXzoAE.js";import{a as h,n as g,o as _,t as v}from"./dialog-C_SxVFAo.js";import{n as y}from"./MarkdownRenderer-MCdcFkrB.js";import{t as b}from"./checkbox-BFuJ7w49.js";import{t as x}from"./YuriLogo-YAE_6MsI.js";import{a as S,i as C}from"./ModelLogo-Bbgp7ClJ.js";import{l as w}from"./zhipuai-coding-plan-CcFj8zKy.js";import{t as T}from"./ProviderLogo-xLMKk9bq.js";import{n as E}from"./speechSettingsQueries-BkOKGdjP.js";import{n as D,t as O}from"./YuriWordmark-BFHeVOwW.js";import{n as k}from"./SettingsGroup-DYxliYJo.js";import{a as A,c as j,n as M,r as N,t as P}from"./usePluginsStore-DF6jfADo.js";import{a as F,l as I,n as ee,o as te,r as L,t as R}from"./pluginPresentation-mP_3zj0n.js";import{a as z,c as ne,d as re,l as B,o as V,s as ie,t as H,u as U}from"./historyImportQueries-CTTVEQfk.js";var W=e(i(),1),G=a(),K=[{name:`Magpie`,spec:`opencode-magpie-plugin`},{name:`Eficy`,spec:`@eficy/opencode2-plugin`},{name:`yee-profile`,spec:`@yee94/opencode-profile`}];function ae(e,t){return e.some(e=>e.parsedKind===`npm`&&R(e.spec).name===t)}async function q(e,t){let n=[];for(let r of new Set(e)){if(!t.current())throw Error(`Runtime changed`);try{let e=await t.list();if(!t.current())throw Error(`Runtime changed`);ae(e,r)||(await t.create(r)).ok||n.push(r)}catch{n.push(r)}}if(!t.current())throw Error(`Runtime changed`);return{failed:n}}function oe(e,r,i){let a=t(),o=n();return q(e,{current:()=>!i.aborted&&o===n()&&a===t(),list:async()=>(await s.fetchQuery({...N(r,a),staleTime:0})).entries,create:e=>P.getState().createEntry({spec:e,scope:`user`})})}var J=`data:image/svg+xml,%3csvg%20viewBox='0%200%2024%2024'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eClaude%20Code%3c/title%3e%3cpath%20clip-rule='evenodd'%20d='M20.998%2010.949H24v3.102h-3v3.028h-1.487V20H18v-2.921h-1.487V20H15v-2.921H9V20H7.488v-2.921H6V20H4.487v-2.921H3V14.05H0V10.95h3V5h17.998v5.949zM6%2010.949h1.488V8.102H6v2.847zm10.51%200H18V8.102h-1.49v2.847z'%20fill='%23D97757'%20fill-rule='evenodd'/%3e%3c/svg%3e`,Y=`data:image/svg+xml,%3csvg%20viewBox='0%200%2024%2024'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eCodex%3c/title%3e%3cpath%20d='M19.503%200H4.496A4.496%204.496%200%20000%204.496v15.007A4.496%204.496%200%20004.496%2024h15.007A4.496%204.496%200%200024%2019.503V4.496A4.496%204.496%200%200019.503%200z'%20fill='%23fff'/%3e%3cpath%20d='M9.064%203.344a4.578%204.578%200%20012.285-.312c1%20.115%201.891.54%202.673%201.275.01.01.024.017.037.021a.09.09%200%2000.043%200%204.55%204.55%200%20013.046.275l.047.022.116.057a4.581%204.581%200%20012.188%202.399c.209.51.313%201.041.315%201.595a4.24%204.24%200%2001-.134%201.223.123.123%200%2000.03.115c.594.607.988%201.33%201.183%202.17.289%201.425-.007%202.71-.887%203.854l-.136.166a4.548%204.548%200%2001-2.201%201.388.123.123%200%2000-.081.076c-.191.551-.383%201.023-.74%201.494-.9%201.187-2.222%201.846-3.711%201.838-1.187-.006-2.239-.44-3.157-1.302a.107.107%200%2000-.105-.024c-.388.125-.78.143-1.204.138a4.441%204.441%200%2001-1.945-.466%204.544%204.544%200%2001-1.61-1.335c-.152-.202-.303-.392-.414-.617a5.81%205.81%200%2001-.37-.961%204.582%204.582%200%2001-.014-2.298.124.124%200%2000.006-.056.085.085%200%2000-.027-.048%204.467%204.467%200%2001-1.034-1.651%203.896%203.896%200%2001-.251-1.192%205.189%205.189%200%2001.141-1.6c.337-1.112.982-1.985%201.933-2.618.212-.141.413-.251.601-.33.215-.089.43-.164.646-.227a.098.098%200%2000.065-.066%204.51%204.51%200%2001.829-1.615%204.535%204.535%200%20011.837-1.388zm3.482%2010.565a.637.637%200%20000%201.272h3.636a.637.637%200%20100-1.272h-3.636zM8.462%209.23a.637.637%200%2000-1.106.631l1.272%202.224-1.266%202.136a.636.636%200%20101.095.649l1.454-2.455a.636.636%200%2000.005-.64L8.462%209.23z'%20fill='url(%23codex-gradient)'/%3e%3cdefs%3e%3clinearGradient%20gradientUnits='userSpaceOnUse'%20id='codex-gradient'%20x1='12'%20x2='12'%20y1='3'%20y2='21'%3e%3cstop%20stop-color='%23B1A7FF'/%3e%3cstop%20offset='.5'%20stop-color='%237A9DFF'/%3e%3cstop%20offset='1'%20stop-color='%233941FF'/%3e%3c/linearGradient%3e%3c/defs%3e%3c/svg%3e`,X=r(),se={claude:J,codex:Y,cursor:S,dsh:C,opencode:w};function ce({onBusy:e,directory:r=null,onPrimaryChange:i,onComplete:a}){let{t:o,locale:s}=m(),l=t(),u=n(),[h,g]=W.useState([]),[_,v]=W.useState(!1),[y,x]=W.useState(null),S=V(),C=S.data?.state===`running`,w=ie(S.isSuccess&&!C),T=ne(w.data?.id,r,`${S.data?.id??``}:${S.data?.state??``}`,!C&&!w.isFetching&&!w.isError),E=W.useRef(null),D=W.useRef(!1),O=W.useRef(null),k=W.useRef(null),A=c(e),j=c(e=>i?.(e)),M=c((e,t)=>g(n=>t?n.includes(e)?n:[...n,e]:n.filter(t=>t!==e)));W.useEffect(()=>{let e=new AbortController;return E.current=e,()=>{e.abort(),A(!1)}},[l,u,A]);let N=W.useMemo(()=>{let e=B.map(e=>({...e,sessions:[]}));for(let t of w.data?.sessions??[]){let n=e.find(e=>e.id===t.source);n&&n.sessions.length<5&&n.sessions.push(t)}return e.filter(e=>e.sessions.length)},[w.data]),P=!!(O.current&&S.data?.id===O.current&&re(S.data)),F=_||!C&&!P&&(w.isFetching||!w.data||w.isError||S.isError);W.useEffect(()=>{j({disabled:F,background:C})},[F,C,j]);let I=()=>!E.current?.signal.aborted&&l===t()&&u===n(),ee=async e=>{if(!(D.current||!E.current)){D.current=!0,v(!0),A(!0),x(null);try{await e(E.current.signal)}catch(e){I()&&x(e instanceof Error&&/^[a-z_]+$/.test(e.message)?e.message:`import_failed`)}finally{D.current=!1,I()&&(v(!1),A(!1))}}},te=()=>ee(async e=>{if(F)return;if(C||P){I()&&a?.();return}if(!h.length){I()&&a?.();return}let t=await z(h,r,e,l,u);I()&&(O.current=t.id,k.current?.scrollIntoView({block:`start`}))}),L=w.error??S.error,R=y||(L instanceof Error&&/^[a-z_]+$/.test(L.message)?L.message:w.isError||S.isError?`import_failed`:null),G=W.useMemo(()=>new Intl.DateTimeFormat(s,{month:`short`,day:`numeric`}),[s]),K=S.data?U(S.data):null,ae=W.useMemo(()=>new Intl.NumberFormat(s),[s]),q=(e,t)=>{let n=w.data?.counts?.[e],r=n?.value;if(r==null||w.isError)return null;let i=ae.format(r),a=o(n?.approximate?`historyImport.estimatedCount`:`historyImport.sourceCount`,{count:i});return(0,X.jsx)(`span`,{id:t,"data-history-count":e,className:`yuri-import-source-count`,title:a,"aria-label":a,children:w.isFetching?(0,X.jsx)(p,{name:`loader-4`,className:`size-3 animate-spin`,"aria-label":o(`historyImport.scanning`)}):`${n?.approximate?`≈ `:``}${i}`})};return(0,X.jsxs)(`form`,{id:`yuri-tour-import`,className:`yuri-history-import`,"data-history-import":!0,onSubmit:e=>{e.preventDefault(),te()},children:[(0,X.jsx)(`h2`,{ref:k,className:`yuri-import-heading`,children:o(`historyImport.heading`)}),(0,X.jsx)(`p`,{className:`yuri-import-subtitle`,children:o(`historyImport.deduplication`)}),S.data&&!re(S.data)&&(C||O.current===S.data.id)&&(0,X.jsxs)(`div`,{className:`yuri-import-job`,role:`status`,children:[(0,X.jsx)(p,{name:C?`loader-4`:`error-warning`,className:f(`size-4`,C&&`animate-spin`)}),(0,X.jsx)(`span`,{children:o(C&&K?`historyImport.phase.${K.phase}`:`historyImport.state.${S.data.state}`)}),K&&K.total>0&&(0,X.jsxs)(`span`,{className:`tabular-nums`,children:[K.completed,` / `,K.total]}),C&&(0,X.jsx)(d,{variant:`ghost`,size:`icon`,disabled:_,"aria-label":o(`historyImport.cancel`),title:o(`historyImport.cancel`),onClick:()=>void ee(async e=>{await H(S.data.id,e,l),I()&&await S.refetch()}),children:(0,X.jsx)(p,{name:`stop`,className:`size-4`})}),C&&K&&(0,X.jsx)(`progress`,{value:K.total?K.completed:void 0,max:K.total||1,"aria-label":o(`historyImport.progress`)}),S.data.progress?.code&&(0,X.jsxs)(`p`,{role:`alert`,children:[o(`historyImport.failed`),` `,(0,X.jsx)(`code`,{children:S.data.progress.code})]}),S.data.results.some(e=>e.status===`failed`||e.project===`failed`||e.index===`failed`)&&(0,X.jsxs)(`p`,{role:`alert`,children:[o(`historyImport.failed`),[...new Set(S.data.results.filter(e=>e.status===`failed`&&e.code).map(e=>e.code))].map(e=>(0,X.jsxs)(`code`,{children:[` `,e]},e))]})]}),(0,X.jsx)(`div`,{className:`yuri-import-source-grid`,"aria-label":o(`historyImport.sources`),children:B.map(e=>{let t=w.data?.installations?.[e.id],n=o(t===!0?`historyImport.installed`:t===!1?`historyImport.notDetected`:`historyImport.installationUnknown`),r=w.data?.counts?.[e.id]?.value!=null&&!w.isError?` history-import-count-${e.id}`:``;return(0,X.jsxs)(d,{variant:`ghost`,"data-history-source":e.id,className:f(`yuri-import-source-card`,(e.id===`cursor`||e.id===`opencode`)&&`yuri-import-source-cursor`),disabled:_||C,"aria-pressed":h.includes(e.id),"aria-label":e.name,"aria-describedby":`history-import-installed-${e.id}${r}`,onClick:()=>M(e.id,!h.includes(e.id)),children:[(0,X.jsxs)(`span`,{className:`yuri-import-logo-wrap`,children:[(0,X.jsx)(`img`,{src:se[e.id],alt:``,draggable:!1,className:`yuri-import-source-logo`}),(0,X.jsx)(`span`,{id:`history-import-installed-${e.id}`,role:`img`,"aria-label":n,title:n,"data-installed":t===!0?`true`:t===!1?`false`:`unknown`,className:`yuri-import-installation`})]}),(0,X.jsx)(`span`,{className:`yuri-import-source-name`,children:e.name}),q(e.id,`history-import-count-${e.id}`),(0,X.jsx)(`span`,{className:`yuri-import-source-check`,"aria-hidden":`true`,children:(0,X.jsx)(p,{name:`check`,className:`size-3`})})]},e.id)})}),R&&(0,X.jsxs)(`div`,{role:`alert`,className:`yuri-tour-feedback`,children:[(0,X.jsxs)(`p`,{children:[o(R===`history_import_unsupported`?`historyImport.unsupported`:`historyImport.failed`),` `,(0,X.jsx)(`code`,{children:R})]}),(w.isError||S.isError)&&(0,X.jsx)(d,{variant:`ghost`,size:`xs`,disabled:w.isFetching||S.isFetching,onClick:()=>{Promise.all([w.refetch(),S.refetch()])},children:o(`settings.plugins.status.retry`)})]}),w.data&&!w.isFetching&&!w.isError&&!w.data.sessions.length&&!w.data.errors.length&&(0,X.jsx)(`p`,{className:`yuri-tour-feedback`,children:o(`historyImport.empty`)}),N.length>0&&(0,X.jsxs)(`section`,{"aria-label":o(`historyImport.sessions`),children:[(0,X.jsx)(`div`,{className:`yuri-import-list-heading`,children:o(`historyImport.sessions`)}),(0,X.jsx)(`div`,{className:`yuri-import-preview-groups`,children:N.map(e=>(0,X.jsxs)(`section`,{"aria-label":e.name,"data-source-selected":h.includes(e.id),children:[(0,X.jsxs)(`div`,{className:`yuri-import-preview-heading`,children:[(0,X.jsx)(`h3`,{children:e.name}),q(e.id),(0,X.jsx)(b,{checked:h.includes(e.id),disabled:_||C,ariaLabel:e.name,onChange:t=>M(e.id,t)})]}),(0,X.jsx)(`ul`,{className:`yuri-import-session-grid`,children:e.sessions.map(e=>(0,X.jsxs)(`li`,{"data-history-session":e.key,className:f(`yuri-import-session-card`,(e.source===`cursor`||e.source===`opencode`)&&`yuri-import-source-cursor`),title:e.title,children:[(0,X.jsx)(`img`,{src:se[e.source],alt:``,draggable:!1,className:`yuri-import-session-logo`}),(0,X.jsxs)(`span`,{className:`yuri-import-session-copy`,children:[(0,X.jsxs)(`span`,{className:`yuri-import-session-heading`,children:[(0,X.jsx)(`span`,{className:`yuri-import-session-title`,children:e.title}),!T.isError&&T.data?.states[e.key]===`imported`&&(0,X.jsx)(`span`,{className:`yuri-import-session-imported`,"data-history-imported":!0,children:o(`historyImport.alreadyImported`)}),e.updated&&e.updated>0?(0,X.jsx)(`time`,{dateTime:new Date(e.updated).toISOString(),children:G.format(e.updated)}):null]}),e.excerpt&&(0,X.jsx)(`span`,{className:`yuri-import-session-excerpt`,children:e.excerpt})]})]},e.key))})]},e.id))})]})]})}var Z=K.map(e=>e.spec),le=[`tour.models`,`tour.plugins`,`tour.import`,`tour.voice`],ue=[{id:`openai`,name:`OpenAI`},{id:`anthropic`,name:`Anthropic`},{id:`google`,name:`Google Gemini`},{id:`github-copilot`,name:`GitHub Copilot`},{id:`deepseek`,name:`DeepSeek`},{id:`openrouter`,name:`OpenRouter`}];function de(e){let t=(0,G.c)(48),{index:n,info:r,installed:i,selected:a,onSelect:o,onReadme:s}=e,{t:c}=m(),l=K[n],u=r?.kind===`npm-ok`?r:void 0,h=a&&`yuri-tour-card-selected`,g;t[0]===h?g=t[1]:(g=f(`yuri-tour-plugin yuri-tour-select-card`,h),t[0]=h,t[1]=g);let _;t[2]===a?_=t[3]:(_=a&&(0,X.jsx)(p,{name:`check`,className:`size-5`}),t[2]=a,t[3]=_);let v;t[4]===_?v=t[5]:(v=(0,X.jsx)(`span`,{className:`yuri-tour-card-check`,"aria-hidden":`true`,children:_}),t[4]=_,t[5]=v);let y;t[6]!==o||t[7]!==l.name||t[8]!==a||t[9]!==v?(y=(0,X.jsx)(d,{variant:`ghost`,className:`yuri-tour-card-toggle`,"aria-label":l.name,"aria-pressed":a,onClick:o,children:v}),t[6]=o,t[7]=l.name,t[8]=a,t[9]=v,t[10]=y):y=t[10];let b=u?.icon,x;t[11]!==l.name||t[12]!==b?(x=(0,X.jsx)(I,{name:l.name,src:b,size:30}),t[11]=l.name,t[12]=b,t[13]=x):x=t[13];let S;t[14]===l.name?S=t[15]:(S=(0,X.jsx)(`h3`,{className:`typography-ui-label font-medium`,children:l.name}),t[14]=l.name,t[15]=S);let C;t[16]===l.spec?C=t[17]:(C=(0,X.jsx)(`p`,{className:`break-all typography-micro text-muted-foreground`,children:l.spec}),t[16]=l.spec,t[17]=C);let w;t[18]!==S||t[19]!==C?(w=(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[S,C]}),t[18]=S,t[19]=C,t[20]=w):w=t[20];let T;t[21]===u?T=t[22]:(T=u?.latestVersion&&(0,X.jsx)(`span`,{className:`typography-micro text-muted-foreground`,children:u.latestVersion}),t[21]=u,t[22]=T);let E;t[23]!==w||t[24]!==T||t[25]!==x?(E=(0,X.jsxs)(`div`,{className:`flex items-start gap-3 pr-10`,children:[x,w,T]}),t[23]=w,t[24]=T,t[25]=x,t[26]=E):E=t[26];let D;t[27]!==r||t[28]!==u?.description||t[29]!==c?(D=u?.description||c(r?`tour.metadataUnavailable`:`common.loading`),t[27]=r,t[28]=u?.description,t[29]=c,t[30]=D):D=t[30];let O;t[31]===D?O=t[32]:(O=(0,X.jsx)(`p`,{className:`flex-1 typography-meta text-muted-foreground`,children:D}),t[31]=D,t[32]=O);let k=!u,A;t[33]!==s||t[34]!==k?(A=(0,X.jsx)(d,{size:`xs`,variant:`ghost`,className:`yuri-tour-card-link`,disabled:k,onClick:s,children:`README`}),t[33]=s,t[34]=k,t[35]=A):A=t[35];let j;t[36]!==i||t[37]!==c?(j=i&&(0,X.jsx)(`span`,{className:`typography-meta text-muted-foreground`,children:c(`tour.saved`)}),t[36]=i,t[37]=c,t[38]=j):j=t[38];let M;t[39]!==A||t[40]!==j?(M=(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[A,j]}),t[39]=A,t[40]=j,t[41]=M):M=t[41];let N;return t[42]!==E||t[43]!==O||t[44]!==M||t[45]!==g||t[46]!==y?(N=(0,X.jsxs)(`section`,{className:g,children:[y,E,O,M]}),t[42]=E,t[43]=O,t[44]=M,t[45]=g,t[46]=y,t[47]=N):N=t[47],N}function fe(e){let t=(0,G.c)(28),{settings:n,onComplete:r,onBusy:i}=e,{t:a}=m(),o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o={voiceProvider:`volcengine`,sttProvider:`volcengine`,dictationEnabled:!0,showMessageTTSButtons:!0},t[0]=o):o=t[0];let s=L(n,o),l=c(i),u,d;t[1]!==s.saving||t[2]!==l?(u=()=>(l(s.saving),()=>l(!1)),d=[s.saving,l],t[1]=s.saving,t[2]=l,t[3]=u,t[4]=d):(u=t[3],d=t[4]),W.useEffect(u,d);let f;t[5]!==s||t[6]!==r||t[7]!==n.configured?(f=async e=>{e.preventDefault(),!(!n.configured&&!s.draft.apiKey?.trim())&&(await s.save())?.configured&&r()},t[5]=s,t[6]=r,t[7]=n.configured,t[8]=f):f=t[8];let p=f,h;t[9]===p?h=t[10]:(h=e=>void p(e),t[9]=p,t[10]=h);let g;t[11]===a?g=t[12]:(g=a(`settings.voice.volcengine.name`),t[11]=a,t[12]=g);let _,v;t[13]===s?(_=t[14],v=t[15]):(_=(0,X.jsx)(F,{mode:`tts`,form:s}),v=(0,X.jsx)(F,{mode:`asr`,form:s,showCredentials:!1}),t[13]=s,t[14]=_,t[15]=v);let y;t[16]!==g||t[17]!==_||t[18]!==v?(y=(0,X.jsxs)(k,{label:g,children:[_,v]}),t[16]=g,t[17]=_,t[18]=v,t[19]=y):y=t[19];let b;t[20]!==s.draft||t[21]!==n.configured||t[22]!==a?(b=!n.configured&&!s.draft.apiKey?.trim()&&(0,X.jsx)(`p`,{className:`typography-meta text-muted-foreground`,children:a(`settings.providers.page.toast.apiKeyRequired`)}),t[20]=s.draft,t[21]=n.configured,t[22]=a,t[23]=b):b=t[23];let x;return t[24]!==b||t[25]!==h||t[26]!==y?(x=(0,X.jsxs)(`form`,{id:`yuri-tour-voice`,onSubmit:h,className:`yuri-settings-section-stack`,children:[y,b]}),t[24]=b,t[25]=h,t[26]=y,t[27]=x):x=t[27],x}function pe({runtime:e,onClose:r}){let{t:i}=m(),a=A(),c=D(t=>t.progress[e]?.step??0),[b,S]=W.useState(`magpie`),[C,w]=W.useState(),[k,N]=W.useState(Z.slice(1)),[P,F]=W.useState(`tour`),[I,L]=W.useState(null),[R,z]=W.useState(!1),[ne,re]=W.useState({disabled:!0}),[B,V]=W.useState(null),ie=n(),H=t(),U=W.useRef(null),G=W.useRef(!1);W.useEffect(()=>{let e=new AbortController;return U.current=e,()=>e.abort()},[]);let q=j(),J=o({...M(a,Z.slice(1),!1,H,!0),enabled:c===1}),Y=o({...E(H),enabled:c===3}),se=q.data?.entries??[],pe=e=>{let t=u.getState(),n=e&&t.providers.some(t=>t.id===e);S(`other`),w(n?void 0:e),t.setSelectedProvider(n?e:`__add_provider__`),F(`providers`)},Q=()=>!U.current?.signal.aborted&&ie===n()&&H===t(),$=t=>{F(`tour`),V(null),D.getState().move(e,t)},me=()=>{Q()&&r()},he=()=>{c===3?me():$(c+1)},ge=async()=>{if(c===2){he();return}if(!(G.current||R||!U.current)){G.current=!0,z(!0),V(null);try{let e=c===0?b===`magpie`?[Z[0]]:[]:k;if(e.length){let t=await oe(e,a,U.current.signal);if(!Q())return;if(t.failed.length){V(i(`tour.saveFailed`,{names:t.failed.join(`, `)}));return}}if(c===0&&b===`other`){let e=await s.fetchQuery({...l(a,H),staleTime:0});if(!Q())return;if(e.partial||!e.providers.some(e=>Object.keys(e.models).length>0)){V(i(`tour.noModels`));return}await u.getState().loadProviders({directory:a,forceRefresh:!0,source:`setup-tour`})}Q()&&he()}catch{Q()&&V(i(`tour.operationFailed`))}finally{G.current=!1,Q()&&z(!1)}}},_e=()=>{I===null?P===`tour`?c>0&&$(c-1):F(`tour`):L(null)},ve=I===null?void 0:J.data?.[Z[I]],ye=ve?.kind===`npm-ok`?ve.readme:void 0;return(0,X.jsx)(v,{open:!0,onOpenChange:e=>{!e&&!R&&(I!==null||P!==`tour`?_e():me())},children:(0,X.jsxs)(g,{className:`yuri-setup-tour yuri-settings-workspace`,showCloseButton:!1,"aria-describedby":void 0,children:[(0,X.jsx)(`div`,{className:`yuri-tour-watermark`,"aria-hidden":`true`,children:(0,X.jsx)(x,{width:440,height:440})}),(0,X.jsx)(h,{children:(0,X.jsxs)(_,{className:`yuri-tour-title`,children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,children:`👋`}),i(`tour.title`).split(`Yuri`).map((e,t)=>(0,X.jsxs)(W.Fragment,{children:[t>0&&(0,X.jsx)(O,{width:`2.05em`}),(0,X.jsx)(`span`,{children:e.trim()})]},t))]})}),(0,X.jsxs)(`div`,{className:`yuri-tour-body`,children:[(0,X.jsx)(`nav`,{className:`yuri-tour-progress`,"aria-label":i(`tour.title`),children:le.map((e,t)=>(0,X.jsxs)(d,{variant:`ghost`,size:`lg`,disabled:R,"aria-current":c===t?`step`:void 0,onClick:()=>{L(null),$(t)},children:[(0,X.jsx)(`span`,{className:`yuri-tour-number`,"aria-hidden":`true`,children:String(t+1).padStart(2,`0`)}),(0,X.jsx)(`span`,{children:i(e)})]},e))}),(0,X.jsx)(`div`,{className:f(`yuri-tour-content`,P===`providers`&&I===null&&`yuri-tour-provider-content`),children:(0,X.jsxs)(`fieldset`,{disabled:R,className:`contents`,children:[I===null?P===`providers`?(0,X.jsx)(te,{initialConnectionId:C}):P===`voice`&&Y.data?(0,X.jsx)(fe,{settings:Y.data,onComplete:me,onBusy:z}):P===`asr`||P===`tts`?(0,X.jsx)(ee,{section:P}):(0,X.jsxs)(X.Fragment,{children:[c<2&&(c===1&&J.isError||q.isError)&&(0,X.jsxs)(`div`,{role:`alert`,className:`yuri-tour-feedback`,children:[(0,X.jsx)(`p`,{children:i(`tour.metadataUnavailable`)}),(0,X.jsx)(d,{size:`xs`,onClick:()=>{c===1&&J.refetch(),q.refetch()},children:i(`settings.plugins.status.retry`)})]}),c===0&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`section`,{className:f(`yuri-tour-magpie yuri-tour-select-card`,b===`magpie`&&`yuri-tour-card-selected`),children:[(0,X.jsx)(d,{variant:`ghost`,className:`yuri-tour-card-toggle`,"aria-label":`Magpie`,"aria-pressed":b===`magpie`,onClick:()=>S(b===`magpie`?`other`:`magpie`),children:(0,X.jsx)(`span`,{className:`yuri-tour-card-check`,"aria-hidden":`true`,children:b===`magpie`&&(0,X.jsx)(p,{name:`check`,className:`size-5`})})}),(0,X.jsxs)(`div`,{className:`flex w-full items-center gap-3 pr-10`,children:[(0,X.jsx)(T,{providerId:`magpie`,alt:`Magpie`,className:`size-8 shrink-0`}),(0,X.jsx)(`span`,{className:`typography-ui-label`,children:`Magpie`}),(0,X.jsx)(`span`,{className:`yuri-tour-recommended`,children:i(`tour.recommended`)})]}),(0,X.jsx)(`p`,{className:`typography-meta text-muted-foreground`,children:i(`tour.magpieDescription`)}),(0,X.jsxs)(`a`,{className:`yuri-tour-card-link typography-meta text-muted-foreground underline`,href:`https://usemagpie.ai/docs/start`,target:`_blank`,rel:`noreferrer`,children:[i(`tour.docs`),` ↗`]})]}),(0,X.jsxs)(`div`,{className:`yuri-tour-provider-heading`,children:[(0,X.jsx)(`span`,{className:`typography-meta text-muted-foreground`,children:`OpenCode`}),(0,X.jsxs)(`a`,{className:`typography-meta text-muted-foreground underline`,href:`https://opencode.ai/docs/providers/`,target:`_blank`,rel:`noreferrer`,children:[i(`tour.docs`),` ↗`]})]}),(0,X.jsx)(`div`,{className:`yuri-tour-provider-grid`,children:ue.map(e=>(0,X.jsxs)(d,{variant:`ghost`,className:`yuri-tour-provider-choice`,onClick:()=>pe(e.id),children:[(0,X.jsx)(T,{providerId:e.id,alt:e.name,className:`size-6 shrink-0`}),(0,X.jsx)(`span`,{children:e.name})]},e.id))}),(0,X.jsxs)(d,{className:`mt-3`,size:`sm`,variant:`ghost`,onClick:()=>pe(),children:[i(`tour.otherProvider`),(0,X.jsx)(p,{name:`arrow-right-s`,className:`size-4`})]})]}),c===1&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`div`,{className:`yuri-tour-plugins`,children:[1,2].map(e=>(0,X.jsx)(de,{index:e,info:J.data?.[Z[e]],installed:ae(se,Z[e]),selected:k.includes(Z[e]),onSelect:()=>N(t=>t.includes(Z[e])?t.filter(t=>t!==Z[e]):[...t,Z[e]]),onReadme:()=>L(e)},e))}),(0,X.jsxs)(`a`,{className:`mt-4 inline-block typography-meta text-muted-foreground underline underline-offset-4 hover:text-foreground`,href:`https://opencode.ai/docs/ecosystem/#plugins`,target:`_blank`,rel:`noopener noreferrer`,children:[i(`tour.morePlugins`),` ↗`]})]}),c===2&&(0,X.jsx)(ce,{onBusy:z,directory:a,onPrimaryChange:re,onComplete:()=>$(3)}),c===3&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`yuri-tour-voice-intro`,children:[(0,X.jsx)(`h2`,{children:i(`tour.voiceHeading`)}),(0,X.jsx)(`p`,{children:i(`tour.voiceIntro`)})]}),(0,X.jsxs)(`div`,{className:`yuri-tour-voice-capabilities`,children:[(0,X.jsxs)(`section`,{children:[(0,X.jsx)(p,{name:`mic`,className:`yuri-tour-voice-icon`}),(0,X.jsx)(`h3`,{children:i(`settings.voice.page.section.speechRecognition`)}),(0,X.jsx)(`p`,{children:i(`tour.dictationDescription`)}),(0,X.jsxs)(`div`,{className:`yuri-tour-voice-services`,children:[(0,X.jsxs)(`span`,{children:[(0,X.jsx)(`img`,{src:`data:image/svg+xml,%3csvg%20height='24'%20style='flex:none;line-height:1'%20viewBox='0%200%2024%2024'%20width='24'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eDoubao%3c/title%3e%3cpath%20d='M5.31%2015.756c.172-3.75%201.883-5.999%202.549-6.739-3.26%202.058-5.425%205.658-6.358%208.308v1.12C1.501%2021.513%204.226%2024%207.59%2024a6.59%206.59%200%20002.2-.375c.353-.12.7-.248%201.039-.378.913-.899%201.65-1.91%202.243-2.992-4.877%202.431-7.974.072-7.763-4.5l.002.001z'%20fill='%231E37FC'%3e%3c/path%3e%3cpath%20d='M22.57%2010.283c-1.212-.901-4.109-2.404-7.397-2.8.295%203.792.093%208.766-2.1%2012.773a12.782%2012.782%200%2001-2.244%202.992c3.764-1.448%206.746-3.457%208.596-5.219%202.82-2.683%203.353-5.178%203.361-6.66a2.737%202.737%200%2000-.216-1.084v-.002z'%20fill='%2337E1BE'%3e%3c/path%3e%3cpath%20d='M14.303%201.867C12.955.7%2011.248%200%209.39%200%207.532%200%205.883.677%204.545%201.807%202.791%203.29%201.627%205.557%201.5%208.125v9.201c.932-2.65%203.097-6.25%206.357-8.307.5-.318%201.025-.595%201.569-.829%201.883-.801%203.878-.932%205.746-.706-.222-2.83-.718-5.002-.87-5.617h.001z'%20fill='%23A569FF'%3e%3c/path%3e%3cpath%20d='M17.305%204.961a199.47%20199.47%200%2001-1.08-1.094c-.202-.213-.398-.419-.586-.622l-1.333-1.378c.151.615.648%202.786.869%205.617%203.288.395%206.185%201.898%207.396%202.8-1.306-1.275-3.475-3.487-5.266-5.323z'%20fill='%231E37FC'%3e%3c/path%3e%3c/svg%3e`,alt:``,className:`size-4`}),i(`settings.voice.volcengine.name`)]}),(0,X.jsxs)(`span`,{children:[(0,X.jsx)(p,{name:`computer`}),i(`settings.voice.page.provider.local`)]}),(0,X.jsxs)(`span`,{children:[(0,X.jsx)(p,{name:`server`}),i(`settings.voice.page.provider.server`)]})]}),(0,X.jsxs)(d,{size:`sm`,onClick:()=>F(`asr`),children:[i(`tour.configureInput`),(0,X.jsx)(p,{name:`arrow-right-s`,className:`size-4`})]})]}),(0,X.jsxs)(`section`,{children:[(0,X.jsx)(p,{name:`volume-up`,className:`yuri-tour-voice-icon`}),(0,X.jsx)(`h3`,{children:i(`tour.readAloudTitle`)}),(0,X.jsx)(`p`,{children:i(`tour.readAloudDescription`)}),(0,X.jsxs)(`div`,{className:`yuri-tour-voice-services`,children:[(0,X.jsxs)(`span`,{children:[(0,X.jsx)(`img`,{src:`data:image/svg+xml,%3csvg%20height='24'%20style='flex:none;line-height:1'%20viewBox='0%200%2024%2024'%20width='24'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eDoubao%3c/title%3e%3cpath%20d='M5.31%2015.756c.172-3.75%201.883-5.999%202.549-6.739-3.26%202.058-5.425%205.658-6.358%208.308v1.12C1.501%2021.513%204.226%2024%207.59%2024a6.59%206.59%200%20002.2-.375c.353-.12.7-.248%201.039-.378.913-.899%201.65-1.91%202.243-2.992-4.877%202.431-7.974.072-7.763-4.5l.002.001z'%20fill='%231E37FC'%3e%3c/path%3e%3cpath%20d='M22.57%2010.283c-1.212-.901-4.109-2.404-7.397-2.8.295%203.792.093%208.766-2.1%2012.773a12.782%2012.782%200%2001-2.244%202.992c3.764-1.448%206.746-3.457%208.596-5.219%202.82-2.683%203.353-5.178%203.361-6.66a2.737%202.737%200%2000-.216-1.084v-.002z'%20fill='%2337E1BE'%3e%3c/path%3e%3cpath%20d='M14.303%201.867C12.955.7%2011.248%200%209.39%200%207.532%200%205.883.677%204.545%201.807%202.791%203.29%201.627%205.557%201.5%208.125v9.201c.932-2.65%203.097-6.25%206.357-8.307.5-.318%201.025-.595%201.569-.829%201.883-.801%203.878-.932%205.746-.706-.222-2.83-.718-5.002-.87-5.617h.001z'%20fill='%23A569FF'%3e%3c/path%3e%3cpath%20d='M17.305%204.961a199.47%20199.47%200%2001-1.08-1.094c-.202-.213-.398-.419-.586-.622l-1.333-1.378c.151.615.648%202.786.869%205.617%203.288.395%206.185%201.898%207.396%202.8-1.306-1.275-3.475-3.487-5.266-5.323z'%20fill='%231E37FC'%3e%3c/path%3e%3c/svg%3e`,alt:``,className:`size-4`}),i(`settings.voice.volcengine.name`)]}),(0,X.jsxs)(`span`,{children:[(0,X.jsx)(T,{providerId:`openai`,alt:`OpenAI`,className:`size-4`}),`OpenAI`]}),(0,X.jsxs)(`span`,{children:[(0,X.jsx)(p,{name:`computer`}),i(`settings.voice.page.provider.browser`)]}),(0,X.jsxs)(`span`,{children:[(0,X.jsx)(p,{name:`cloud`}),i(`settings.voice.page.provider.custom`)]})]}),(0,X.jsxs)(d,{size:`sm`,onClick:()=>F(`tts`),children:[i(`tour.configureReadAloud`),(0,X.jsx)(p,{name:`arrow-right-s`,className:`size-4`})]})]})]}),(0,X.jsxs)(`section`,{className:`yuri-tour-voice-recommendation`,children:[(0,X.jsx)(`img`,{src:`data:image/svg+xml,%3csvg%20height='24'%20style='flex:none;line-height:1'%20viewBox='0%200%2024%2024'%20width='24'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eDoubao%3c/title%3e%3cpath%20d='M5.31%2015.756c.172-3.75%201.883-5.999%202.549-6.739-3.26%202.058-5.425%205.658-6.358%208.308v1.12C1.501%2021.513%204.226%2024%207.59%2024a6.59%206.59%200%20002.2-.375c.353-.12.7-.248%201.039-.378.913-.899%201.65-1.91%202.243-2.992-4.877%202.431-7.974.072-7.763-4.5l.002.001z'%20fill='%231E37FC'%3e%3c/path%3e%3cpath%20d='M22.57%2010.283c-1.212-.901-4.109-2.404-7.397-2.8.295%203.792.093%208.766-2.1%2012.773a12.782%2012.782%200%2001-2.244%202.992c3.764-1.448%206.746-3.457%208.596-5.219%202.82-2.683%203.353-5.178%203.361-6.66a2.737%202.737%200%2000-.216-1.084v-.002z'%20fill='%2337E1BE'%3e%3c/path%3e%3cpath%20d='M14.303%201.867C12.955.7%2011.248%200%209.39%200%207.532%200%205.883.677%204.545%201.807%202.791%203.29%201.627%205.557%201.5%208.125v9.201c.932-2.65%203.097-6.25%206.357-8.307.5-.318%201.025-.595%201.569-.829%201.883-.801%203.878-.932%205.746-.706-.222-2.83-.718-5.002-.87-5.617h.001z'%20fill='%23A569FF'%3e%3c/path%3e%3cpath%20d='M17.305%204.961a199.47%20199.47%200%2001-1.08-1.094c-.202-.213-.398-.419-.586-.622l-1.333-1.378c.151.615.648%202.786.869%205.617%203.288.395%206.185%201.898%207.396%202.8-1.306-1.275-3.475-3.487-5.266-5.323z'%20fill='%231E37FC'%3e%3c/path%3e%3c/svg%3e`,alt:``,className:`size-6 shrink-0`}),(0,X.jsxs)(`div`,{children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(`h3`,{children:i(`settings.voice.volcengine.name`)}),(0,X.jsx)(`span`,{className:`yuri-tour-recommended`,children:i(`tour.recommended`)})]}),(0,X.jsx)(`p`,{children:i(`tour.voiceAllowance`)})]}),(0,X.jsx)(d,{disabled:!Y.data,size:`sm`,onClick:()=>F(`voice`),children:i(`tour.configureVoice`)})]}),Y.isError&&(0,X.jsxs)(`div`,{role:`alert`,className:`yuri-tour-feedback`,children:[(0,X.jsx)(`p`,{children:i(`settings.voice.volcengine.loadFailed`)}),(0,X.jsx)(d,{size:`xs`,onClick:()=>void Y.refetch(),children:i(`settings.voice.volcengine.retry`)})]})]})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`h3`,{className:`typography-ui-label mb-4`,children:[K[I].name,` · README`]}),ye?(0,X.jsx)(y,{content:ye,enableFileReferences:!1}):(0,X.jsx)(`p`,{className:`typography-meta text-muted-foreground`,children:i(`tour.metadataUnavailable`)})]}),B&&I===null&&(0,X.jsx)(`p`,{role:`alert`,className:`yuri-tour-feedback`,children:B})]})})]}),(0,X.jsxs)(`footer`,{className:`yuri-tour-footer`,children:[(P!==`tour`||I!==null)&&(0,X.jsx)(d,{variant:`ghost`,size:`sm`,disabled:R,onClick:_e,children:i(`onboarding.common.actions.back`)}),I===null&&(0,X.jsxs)(`div`,{className:`ml-auto flex flex-wrap justify-end gap-2`,children:[(0,X.jsx)(d,{variant:`ghost`,size:`sm`,disabled:R,onClick:he,children:i(`tour.later`)}),c===2?(0,X.jsxs)(d,{size:`sm`,type:`submit`,form:`yuri-tour-import`,disabled:R||ne.disabled,"aria-busy":R,children:[R&&(0,X.jsx)(p,{name:`loader-4`,className:`size-3 animate-spin`}),i(ne.background?`historyImport.background`:`historyImport.next`)]}):c===3?(0,X.jsx)(d,{size:`sm`,disabled:R,type:P===`voice`?`submit`:`button`,form:P===`voice`?`yuri-tour-voice`:void 0,onClick:P===`voice`?void 0:me,children:i(P===`voice`?`settings.common.actions.saveChanges`:`tour.finish`)}):(0,X.jsxs)(d,{size:`sm`,disabled:R||c<2&&(!q.data||q.isError),"aria-busy":R,onClick:()=>void ge(),children:[R&&(0,X.jsx)(p,{name:`loader-4`,className:`size-3 animate-spin`}),i(`tour.continue`)]})]})]})]})})}export{pe as SetupTourDialog};
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,n}from"./runtime-switch-DEPKHgdL.js";import{ot as r,st as i}from"./vendor-base-ui-wXsskyKm.js";import{n as a}from"./vendor-react-BkccXcWz.js";import{s as o}from"./vendor-tanstack-react-query-DIb_ItL-.js";import{W as s}from"./runtime-file-resource-BGZ4tGr5.js";import{r as c}from"./vendor-reactuses-core-DjKFMfz7.js";import{Fa as l,Xn as u,Zi as d,io as f}from"./ui-BCYkB585.js";import{n as p}from"./Icon-C1rjS64C.js";import{t as m}from"./i18n-iu4pzqPi.js";import{a as h,n as g,o as _,t as v}from"./dialog-Cx20I73q.js";import{n as y}from"./MarkdownRenderer-BZl_T1ng.js";import{t as b}from"./checkbox-CljLXON1.js";import{t as x}from"./YuriLogo-BbS_Wj4g.js";import{a as S,i as C}from"./ModelLogo-CMnp5fyy.js";import{l as w}from"./zhipuai-coding-plan-CcFj8zKy.js";import{t as T}from"./ProviderLogo-BqQTME35.js";import{n as E}from"./speechSettingsQueries-C3JgzCqy.js";import{n as D,t as O}from"./YuriWordmark-CqkcfAJl.js";import{n as k}from"./SettingsGroup-Bm-l3IIs.js";import{a as A,c as j,n as M,r as N,t as P}from"./usePluginsStore-BIBHPK4A.js";import{a as F,l as I,n as ee,o as te,r as L,t as R}from"./pluginPresentation-rls1AMJN.js";import{a as z,c as ne,d as re,l as B,o as V,s as ie,t as H,u as U}from"./historyImportQueries-B_mfphxe.js";var W=e(i(),1),G=a(),K=[{name:`Magpie`,spec:`opencode-magpie-plugin`},{name:`Eficy`,spec:`@eficy/opencode2-plugin`},{name:`yee-profile`,spec:`@yee94/opencode-profile`}];function ae(e,t){return e.some(e=>e.parsedKind===`npm`&&R(e.spec).name===t)}async function q(e,t){let n=[];for(let r of new Set(e)){if(!t.current())throw Error(`Runtime changed`);try{let e=await t.list();if(!t.current())throw Error(`Runtime changed`);ae(e,r)||(await t.create(r)).ok||n.push(r)}catch{n.push(r)}}if(!t.current())throw Error(`Runtime changed`);return{failed:n}}function oe(e,r,i){let a=t(),o=n();return q(e,{current:()=>!i.aborted&&o===n()&&a===t(),list:async()=>(await s.fetchQuery({...N(r,a),staleTime:0})).entries,create:e=>P.getState().createEntry({spec:e,scope:`user`})})}var J=`data:image/svg+xml,%3csvg%20viewBox='0%200%2024%2024'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eClaude%20Code%3c/title%3e%3cpath%20clip-rule='evenodd'%20d='M20.998%2010.949H24v3.102h-3v3.028h-1.487V20H18v-2.921h-1.487V20H15v-2.921H9V20H7.488v-2.921H6V20H4.487v-2.921H3V14.05H0V10.95h3V5h17.998v5.949zM6%2010.949h1.488V8.102H6v2.847zm10.51%200H18V8.102h-1.49v2.847z'%20fill='%23D97757'%20fill-rule='evenodd'/%3e%3c/svg%3e`,Y=`data:image/svg+xml,%3csvg%20viewBox='0%200%2024%2024'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eCodex%3c/title%3e%3cpath%20d='M19.503%200H4.496A4.496%204.496%200%20000%204.496v15.007A4.496%204.496%200%20004.496%2024h15.007A4.496%204.496%200%200024%2019.503V4.496A4.496%204.496%200%200019.503%200z'%20fill='%23fff'/%3e%3cpath%20d='M9.064%203.344a4.578%204.578%200%20012.285-.312c1%20.115%201.891.54%202.673%201.275.01.01.024.017.037.021a.09.09%200%2000.043%200%204.55%204.55%200%20013.046.275l.047.022.116.057a4.581%204.581%200%20012.188%202.399c.209.51.313%201.041.315%201.595a4.24%204.24%200%2001-.134%201.223.123.123%200%2000.03.115c.594.607.988%201.33%201.183%202.17.289%201.425-.007%202.71-.887%203.854l-.136.166a4.548%204.548%200%2001-2.201%201.388.123.123%200%2000-.081.076c-.191.551-.383%201.023-.74%201.494-.9%201.187-2.222%201.846-3.711%201.838-1.187-.006-2.239-.44-3.157-1.302a.107.107%200%2000-.105-.024c-.388.125-.78.143-1.204.138a4.441%204.441%200%2001-1.945-.466%204.544%204.544%200%2001-1.61-1.335c-.152-.202-.303-.392-.414-.617a5.81%205.81%200%2001-.37-.961%204.582%204.582%200%2001-.014-2.298.124.124%200%2000.006-.056.085.085%200%2000-.027-.048%204.467%204.467%200%2001-1.034-1.651%203.896%203.896%200%2001-.251-1.192%205.189%205.189%200%2001.141-1.6c.337-1.112.982-1.985%201.933-2.618.212-.141.413-.251.601-.33.215-.089.43-.164.646-.227a.098.098%200%2000.065-.066%204.51%204.51%200%2001.829-1.615%204.535%204.535%200%20011.837-1.388zm3.482%2010.565a.637.637%200%20000%201.272h3.636a.637.637%200%20100-1.272h-3.636zM8.462%209.23a.637.637%200%2000-1.106.631l1.272%202.224-1.266%202.136a.636.636%200%20101.095.649l1.454-2.455a.636.636%200%2000.005-.64L8.462%209.23z'%20fill='url(%23codex-gradient)'/%3e%3cdefs%3e%3clinearGradient%20gradientUnits='userSpaceOnUse'%20id='codex-gradient'%20x1='12'%20x2='12'%20y1='3'%20y2='21'%3e%3cstop%20stop-color='%23B1A7FF'/%3e%3cstop%20offset='.5'%20stop-color='%237A9DFF'/%3e%3cstop%20offset='1'%20stop-color='%233941FF'/%3e%3c/linearGradient%3e%3c/defs%3e%3c/svg%3e`,X=r(),se={claude:J,codex:Y,cursor:S,dsh:C,opencode:w};function ce({onBusy:e,directory:r=null,onPrimaryChange:i,onComplete:a}){let{t:o,locale:s}=m(),l=t(),d=n(),[h,g]=W.useState([]),[_,v]=W.useState(!1),[y,x]=W.useState(null),S=V(),C=S.data?.state===`running`,w=ie(S.isSuccess&&!C),T=ne(w.data?.id,r,`${S.data?.id??``}:${S.data?.state??``}`,!C&&!w.isFetching&&!w.isError),E=W.useRef(null),D=W.useRef(!1),O=W.useRef(null),k=W.useRef(null),A=c(e),j=c(e=>i?.(e)),M=c((e,t)=>g(n=>t?n.includes(e)?n:[...n,e]:n.filter(t=>t!==e)));W.useEffect(()=>{let e=new AbortController;return E.current=e,()=>{e.abort(),A(!1)}},[l,d,A]);let N=W.useMemo(()=>{let e=B.map(e=>({...e,sessions:[]}));for(let t of w.data?.sessions??[]){let n=e.find(e=>e.id===t.source);n&&n.sessions.length<5&&n.sessions.push(t)}return e.filter(e=>e.sessions.length)},[w.data]),P=!!(O.current&&S.data?.id===O.current&&re(S.data)),F=_||!C&&!P&&(w.isFetching||!w.data||w.isError||S.isError);W.useEffect(()=>{j({disabled:F,background:C})},[F,C,j]);let I=()=>!E.current?.signal.aborted&&l===t()&&d===n(),ee=async e=>{if(!(D.current||!E.current)){D.current=!0,v(!0),A(!0),x(null);try{await e(E.current.signal)}catch(e){I()&&x(e instanceof Error&&/^[a-z_]+$/.test(e.message)?e.message:`import_failed`)}finally{D.current=!1,I()&&(v(!1),A(!1))}}},te=()=>ee(async e=>{if(F)return;if(C||P){I()&&a?.();return}if(!h.length){I()&&a?.();return}let t=await z(h,r,e,l,d);I()&&(O.current=t.id,k.current?.scrollIntoView({block:`start`}))}),L=w.error??S.error,R=y||(L instanceof Error&&/^[a-z_]+$/.test(L.message)?L.message:w.isError||S.isError?`import_failed`:null),G=W.useMemo(()=>new Intl.DateTimeFormat(s,{month:`short`,day:`numeric`}),[s]),K=S.data?U(S.data):null,ae=W.useMemo(()=>new Intl.NumberFormat(s),[s]),q=(e,t)=>{let n=w.data?.counts?.[e],r=n?.value;if(r==null||w.isError)return null;let i=ae.format(r),a=o(n?.approximate?`historyImport.estimatedCount`:`historyImport.sourceCount`,{count:i});return(0,X.jsx)(`span`,{id:t,"data-history-count":e,className:`yuri-import-source-count`,title:a,"aria-label":a,children:w.isFetching?(0,X.jsx)(p,{name:`loader-4`,className:`size-3 animate-spin`,"aria-label":o(`historyImport.scanning`)}):`${n?.approximate?`≈ `:``}${i}`})};return(0,X.jsxs)(`form`,{id:`yuri-tour-import`,className:`yuri-history-import`,"data-history-import":!0,onSubmit:e=>{e.preventDefault(),te()},children:[(0,X.jsx)(`h2`,{ref:k,className:`yuri-import-heading`,children:o(`historyImport.heading`)}),(0,X.jsx)(`p`,{className:`yuri-import-subtitle`,children:o(`historyImport.deduplication`)}),S.data&&!re(S.data)&&(C||O.current===S.data.id)&&(0,X.jsxs)(`div`,{className:`yuri-import-job`,role:`status`,children:[(0,X.jsx)(p,{name:C?`loader-4`:`error-warning`,className:f(`size-4`,C&&`animate-spin`)}),(0,X.jsx)(`span`,{children:o(C&&K?`historyImport.phase.${K.phase}`:`historyImport.state.${S.data.state}`)}),K&&K.total>0&&(0,X.jsxs)(`span`,{className:`tabular-nums`,children:[K.completed,` / `,K.total]}),C&&(0,X.jsx)(u,{variant:`ghost`,size:`icon`,disabled:_,"aria-label":o(`historyImport.cancel`),title:o(`historyImport.cancel`),onClick:()=>void ee(async e=>{await H(S.data.id,e,l),I()&&await S.refetch()}),children:(0,X.jsx)(p,{name:`stop`,className:`size-4`})}),C&&K&&(0,X.jsx)(`progress`,{value:K.total?K.completed:void 0,max:K.total||1,"aria-label":o(`historyImport.progress`)}),S.data.progress?.code&&(0,X.jsxs)(`p`,{role:`alert`,children:[o(`historyImport.failed`),` `,(0,X.jsx)(`code`,{children:S.data.progress.code})]}),S.data.results.some(e=>e.status===`failed`||e.project===`failed`||e.index===`failed`)&&(0,X.jsxs)(`p`,{role:`alert`,children:[o(`historyImport.failed`),[...new Set(S.data.results.filter(e=>e.status===`failed`&&e.code).map(e=>e.code))].map(e=>(0,X.jsxs)(`code`,{children:[` `,e]},e))]})]}),(0,X.jsx)(`div`,{className:`yuri-import-source-grid`,"aria-label":o(`historyImport.sources`),children:B.map(e=>{let t=w.data?.installations?.[e.id],n=o(t===!0?`historyImport.installed`:t===!1?`historyImport.notDetected`:`historyImport.installationUnknown`),r=w.data?.counts?.[e.id]?.value!=null&&!w.isError?` history-import-count-${e.id}`:``;return(0,X.jsxs)(u,{variant:`ghost`,"data-history-source":e.id,className:f(`yuri-import-source-card`,(e.id===`cursor`||e.id===`opencode`)&&`yuri-import-source-cursor`),disabled:_||C,"aria-pressed":h.includes(e.id),"aria-label":e.name,"aria-describedby":`history-import-installed-${e.id}${r}`,onClick:()=>M(e.id,!h.includes(e.id)),children:[(0,X.jsxs)(`span`,{className:`yuri-import-logo-wrap`,children:[(0,X.jsx)(`img`,{src:se[e.id],alt:``,draggable:!1,className:`yuri-import-source-logo`}),(0,X.jsx)(`span`,{id:`history-import-installed-${e.id}`,role:`img`,"aria-label":n,title:n,"data-installed":t===!0?`true`:t===!1?`false`:`unknown`,className:`yuri-import-installation`})]}),(0,X.jsx)(`span`,{className:`yuri-import-source-name`,children:e.name}),q(e.id,`history-import-count-${e.id}`),(0,X.jsx)(`span`,{className:`yuri-import-source-check`,"aria-hidden":`true`,children:(0,X.jsx)(p,{name:`check`,className:`size-3`})})]},e.id)})}),R&&(0,X.jsxs)(`div`,{role:`alert`,className:`yuri-tour-feedback`,children:[(0,X.jsxs)(`p`,{children:[o(R===`history_import_unsupported`?`historyImport.unsupported`:`historyImport.failed`),` `,(0,X.jsx)(`code`,{children:R})]}),(w.isError||S.isError)&&(0,X.jsx)(u,{variant:`ghost`,size:`xs`,disabled:w.isFetching||S.isFetching,onClick:()=>{Promise.all([w.refetch(),S.refetch()])},children:o(`settings.plugins.status.retry`)})]}),w.data&&!w.isFetching&&!w.isError&&!w.data.sessions.length&&!w.data.errors.length&&(0,X.jsx)(`p`,{className:`yuri-tour-feedback`,children:o(`historyImport.empty`)}),N.length>0&&(0,X.jsxs)(`section`,{"aria-label":o(`historyImport.sessions`),children:[(0,X.jsx)(`div`,{className:`yuri-import-list-heading`,children:o(`historyImport.sessions`)}),(0,X.jsx)(`div`,{className:`yuri-import-preview-groups`,children:N.map(e=>(0,X.jsxs)(`section`,{"aria-label":e.name,"data-source-selected":h.includes(e.id),children:[(0,X.jsxs)(`div`,{className:`yuri-import-preview-heading`,children:[(0,X.jsx)(`h3`,{children:e.name}),q(e.id),(0,X.jsx)(b,{checked:h.includes(e.id),disabled:_||C,ariaLabel:e.name,onChange:t=>M(e.id,t)})]}),(0,X.jsx)(`ul`,{className:`yuri-import-session-grid`,children:e.sessions.map(e=>(0,X.jsxs)(`li`,{"data-history-session":e.key,className:f(`yuri-import-session-card`,(e.source===`cursor`||e.source===`opencode`)&&`yuri-import-source-cursor`),title:e.title,children:[(0,X.jsx)(`img`,{src:se[e.source],alt:``,draggable:!1,className:`yuri-import-session-logo`}),(0,X.jsxs)(`span`,{className:`yuri-import-session-copy`,children:[(0,X.jsxs)(`span`,{className:`yuri-import-session-heading`,children:[(0,X.jsx)(`span`,{className:`yuri-import-session-title`,children:e.title}),!T.isError&&T.data?.states[e.key]===`imported`&&(0,X.jsx)(`span`,{className:`yuri-import-session-imported`,"data-history-imported":!0,children:o(`historyImport.alreadyImported`)}),e.updated&&e.updated>0?(0,X.jsx)(`time`,{dateTime:new Date(e.updated).toISOString(),children:G.format(e.updated)}):null]}),e.excerpt&&(0,X.jsx)(`span`,{className:`yuri-import-session-excerpt`,children:e.excerpt})]})]},e.key))})]},e.id))})]})]})}var Z=K.map(e=>e.spec),le=[`tour.models`,`tour.plugins`,`tour.import`,`tour.voice`],ue=[{id:`openai`,name:`OpenAI`},{id:`anthropic`,name:`Anthropic`},{id:`google`,name:`Google Gemini`},{id:`github-copilot`,name:`GitHub Copilot`},{id:`deepseek`,name:`DeepSeek`},{id:`openrouter`,name:`OpenRouter`}];function de(e){let t=(0,G.c)(48),{index:n,info:r,installed:i,selected:a,onSelect:o,onReadme:s}=e,{t:c}=m(),l=K[n],d=r?.kind===`npm-ok`?r:void 0,h=a&&`yuri-tour-card-selected`,g;t[0]===h?g=t[1]:(g=f(`yuri-tour-plugin yuri-tour-select-card`,h),t[0]=h,t[1]=g);let _;t[2]===a?_=t[3]:(_=a&&(0,X.jsx)(p,{name:`check`,className:`size-5`}),t[2]=a,t[3]=_);let v;t[4]===_?v=t[5]:(v=(0,X.jsx)(`span`,{className:`yuri-tour-card-check`,"aria-hidden":`true`,children:_}),t[4]=_,t[5]=v);let y;t[6]!==o||t[7]!==l.name||t[8]!==a||t[9]!==v?(y=(0,X.jsx)(u,{variant:`ghost`,className:`yuri-tour-card-toggle`,"aria-label":l.name,"aria-pressed":a,onClick:o,children:v}),t[6]=o,t[7]=l.name,t[8]=a,t[9]=v,t[10]=y):y=t[10];let b=d?.icon,x;t[11]!==l.name||t[12]!==b?(x=(0,X.jsx)(I,{name:l.name,src:b,size:30}),t[11]=l.name,t[12]=b,t[13]=x):x=t[13];let S;t[14]===l.name?S=t[15]:(S=(0,X.jsx)(`h3`,{className:`typography-ui-label font-medium`,children:l.name}),t[14]=l.name,t[15]=S);let C;t[16]===l.spec?C=t[17]:(C=(0,X.jsx)(`p`,{className:`break-all typography-micro text-muted-foreground`,children:l.spec}),t[16]=l.spec,t[17]=C);let w;t[18]!==S||t[19]!==C?(w=(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[S,C]}),t[18]=S,t[19]=C,t[20]=w):w=t[20];let T;t[21]===d?T=t[22]:(T=d?.latestVersion&&(0,X.jsx)(`span`,{className:`typography-micro text-muted-foreground`,children:d.latestVersion}),t[21]=d,t[22]=T);let E;t[23]!==w||t[24]!==T||t[25]!==x?(E=(0,X.jsxs)(`div`,{className:`flex items-start gap-3 pr-10`,children:[x,w,T]}),t[23]=w,t[24]=T,t[25]=x,t[26]=E):E=t[26];let D;t[27]!==r||t[28]!==d?.description||t[29]!==c?(D=d?.description||c(r?`tour.metadataUnavailable`:`common.loading`),t[27]=r,t[28]=d?.description,t[29]=c,t[30]=D):D=t[30];let O;t[31]===D?O=t[32]:(O=(0,X.jsx)(`p`,{className:`flex-1 typography-meta text-muted-foreground`,children:D}),t[31]=D,t[32]=O);let k=!d,A;t[33]!==s||t[34]!==k?(A=(0,X.jsx)(u,{size:`xs`,variant:`ghost`,className:`yuri-tour-card-link`,disabled:k,onClick:s,children:`README`}),t[33]=s,t[34]=k,t[35]=A):A=t[35];let j;t[36]!==i||t[37]!==c?(j=i&&(0,X.jsx)(`span`,{className:`typography-meta text-muted-foreground`,children:c(`tour.saved`)}),t[36]=i,t[37]=c,t[38]=j):j=t[38];let M;t[39]!==A||t[40]!==j?(M=(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[A,j]}),t[39]=A,t[40]=j,t[41]=M):M=t[41];let N;return t[42]!==E||t[43]!==O||t[44]!==M||t[45]!==g||t[46]!==y?(N=(0,X.jsxs)(`section`,{className:g,children:[y,E,O,M]}),t[42]=E,t[43]=O,t[44]=M,t[45]=g,t[46]=y,t[47]=N):N=t[47],N}function fe(e){let t=(0,G.c)(28),{settings:n,onComplete:r,onBusy:i}=e,{t:a}=m(),o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o={voiceProvider:`volcengine`,sttProvider:`volcengine`,dictationEnabled:!0,showMessageTTSButtons:!0},t[0]=o):o=t[0];let s=L(n,o),l=c(i),u,d;t[1]!==s.saving||t[2]!==l?(u=()=>(l(s.saving),()=>l(!1)),d=[s.saving,l],t[1]=s.saving,t[2]=l,t[3]=u,t[4]=d):(u=t[3],d=t[4]),W.useEffect(u,d);let f;t[5]!==s||t[6]!==r||t[7]!==n.configured?(f=async e=>{e.preventDefault(),!(!n.configured&&!s.draft.apiKey?.trim())&&(await s.save())?.configured&&r()},t[5]=s,t[6]=r,t[7]=n.configured,t[8]=f):f=t[8];let p=f,h;t[9]===p?h=t[10]:(h=e=>void p(e),t[9]=p,t[10]=h);let g;t[11]===a?g=t[12]:(g=a(`settings.voice.volcengine.name`),t[11]=a,t[12]=g);let _,v;t[13]===s?(_=t[14],v=t[15]):(_=(0,X.jsx)(F,{mode:`tts`,form:s}),v=(0,X.jsx)(F,{mode:`asr`,form:s,showCredentials:!1}),t[13]=s,t[14]=_,t[15]=v);let y;t[16]!==g||t[17]!==_||t[18]!==v?(y=(0,X.jsxs)(k,{label:g,children:[_,v]}),t[16]=g,t[17]=_,t[18]=v,t[19]=y):y=t[19];let b;t[20]!==s.draft||t[21]!==n.configured||t[22]!==a?(b=!n.configured&&!s.draft.apiKey?.trim()&&(0,X.jsx)(`p`,{className:`typography-meta text-muted-foreground`,children:a(`settings.providers.page.toast.apiKeyRequired`)}),t[20]=s.draft,t[21]=n.configured,t[22]=a,t[23]=b):b=t[23];let x;return t[24]!==b||t[25]!==h||t[26]!==y?(x=(0,X.jsxs)(`form`,{id:`yuri-tour-voice`,onSubmit:h,className:`yuri-settings-section-stack`,children:[y,b]}),t[24]=b,t[25]=h,t[26]=y,t[27]=x):x=t[27],x}function pe({runtime:e,onClose:r}){let{t:i}=m(),a=A(),c=D(t=>t.progress[e]?.step??0),[b,S]=W.useState(`magpie`),[C,w]=W.useState(),[k,N]=W.useState(Z.slice(1)),[P,F]=W.useState(`tour`),[I,L]=W.useState(null),[R,z]=W.useState(!1),[ne,re]=W.useState({disabled:!0}),[B,V]=W.useState(null),ie=n(),H=t(),U=W.useRef(null),G=W.useRef(!1);W.useEffect(()=>{let e=new AbortController;return U.current=e,()=>e.abort()},[]);let q=j(),J=o({...M(a,Z.slice(1),!1,H,!0),enabled:c===1}),Y=o({...E(H),enabled:c===3}),se=q.data?.entries??[],pe=e=>{let t=d.getState(),n=e&&t.providers.some(t=>t.id===e);S(`other`),w(n?void 0:e),t.setSelectedProvider(n?e:`__add_provider__`),F(`providers`)},Q=()=>!U.current?.signal.aborted&&ie===n()&&H===t(),$=t=>{F(`tour`),V(null),D.getState().move(e,t)},me=()=>{Q()&&r()},he=()=>{c===3?me():$(c+1)},ge=async()=>{if(c===2){he();return}if(!(G.current||R||!U.current)){G.current=!0,z(!0),V(null);try{let e=c===0?b===`magpie`?[Z[0]]:[]:k;if(e.length){let t=await oe(e,a,U.current.signal);if(!Q())return;if(t.failed.length){V(i(`tour.saveFailed`,{names:t.failed.join(`, `)}));return}}if(c===0&&b===`other`){let e=await s.fetchQuery({...l(a,H),staleTime:0});if(!Q())return;if(e.partial||!e.providers.some(e=>Object.keys(e.models).length>0)){V(i(`tour.noModels`));return}await d.getState().loadProviders({directory:a,forceRefresh:!0,source:`setup-tour`})}Q()&&he()}catch{Q()&&V(i(`tour.operationFailed`))}finally{G.current=!1,Q()&&z(!1)}}},_e=()=>{I===null?P===`tour`?c>0&&$(c-1):F(`tour`):L(null)},ve=I===null?void 0:J.data?.[Z[I]],ye=ve?.kind===`npm-ok`?ve.readme:void 0;return(0,X.jsx)(v,{open:!0,onOpenChange:e=>{!e&&!R&&(I!==null||P!==`tour`?_e():me())},children:(0,X.jsxs)(g,{className:`yuri-setup-tour yuri-settings-workspace`,showCloseButton:!1,"aria-describedby":void 0,children:[(0,X.jsx)(`div`,{className:`yuri-tour-watermark`,"aria-hidden":`true`,children:(0,X.jsx)(x,{width:440,height:440})}),(0,X.jsx)(h,{children:(0,X.jsxs)(_,{className:`yuri-tour-title`,children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,children:`👋`}),i(`tour.title`).split(`Yuri`).map((e,t)=>(0,X.jsxs)(W.Fragment,{children:[t>0&&(0,X.jsx)(O,{width:`2.05em`}),(0,X.jsx)(`span`,{children:e.trim()})]},t))]})}),(0,X.jsxs)(`div`,{className:`yuri-tour-body`,children:[(0,X.jsx)(`nav`,{className:`yuri-tour-progress`,"aria-label":i(`tour.title`),children:le.map((e,t)=>(0,X.jsxs)(u,{variant:`ghost`,size:`lg`,disabled:R,"aria-current":c===t?`step`:void 0,onClick:()=>{L(null),$(t)},children:[(0,X.jsx)(`span`,{className:`yuri-tour-number`,"aria-hidden":`true`,children:String(t+1).padStart(2,`0`)}),(0,X.jsx)(`span`,{children:i(e)})]},e))}),(0,X.jsx)(`div`,{className:f(`yuri-tour-content`,P===`providers`&&I===null&&`yuri-tour-provider-content`),children:(0,X.jsxs)(`fieldset`,{disabled:R,className:`contents`,children:[I===null?P===`providers`?(0,X.jsx)(te,{initialConnectionId:C}):P===`voice`&&Y.data?(0,X.jsx)(fe,{settings:Y.data,onComplete:me,onBusy:z}):P===`asr`||P===`tts`?(0,X.jsx)(ee,{section:P}):(0,X.jsxs)(X.Fragment,{children:[c<2&&(c===1&&J.isError||q.isError)&&(0,X.jsxs)(`div`,{role:`alert`,className:`yuri-tour-feedback`,children:[(0,X.jsx)(`p`,{children:i(`tour.metadataUnavailable`)}),(0,X.jsx)(u,{size:`xs`,onClick:()=>{c===1&&J.refetch(),q.refetch()},children:i(`settings.plugins.status.retry`)})]}),c===0&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`section`,{className:f(`yuri-tour-magpie yuri-tour-select-card`,b===`magpie`&&`yuri-tour-card-selected`),children:[(0,X.jsx)(u,{variant:`ghost`,className:`yuri-tour-card-toggle`,"aria-label":`Magpie`,"aria-pressed":b===`magpie`,onClick:()=>S(b===`magpie`?`other`:`magpie`),children:(0,X.jsx)(`span`,{className:`yuri-tour-card-check`,"aria-hidden":`true`,children:b===`magpie`&&(0,X.jsx)(p,{name:`check`,className:`size-5`})})}),(0,X.jsxs)(`div`,{className:`flex w-full items-center gap-3 pr-10`,children:[(0,X.jsx)(T,{providerId:`magpie`,alt:`Magpie`,className:`size-8 shrink-0`}),(0,X.jsx)(`span`,{className:`typography-ui-label`,children:`Magpie`}),(0,X.jsx)(`span`,{className:`yuri-tour-recommended`,children:i(`tour.recommended`)})]}),(0,X.jsx)(`p`,{className:`typography-meta text-muted-foreground`,children:i(`tour.magpieDescription`)}),(0,X.jsxs)(`a`,{className:`yuri-tour-card-link typography-meta text-muted-foreground underline`,href:`https://usemagpie.ai/docs/start`,target:`_blank`,rel:`noreferrer`,children:[i(`tour.docs`),` ↗`]})]}),(0,X.jsxs)(`div`,{className:`yuri-tour-provider-heading`,children:[(0,X.jsx)(`span`,{className:`typography-meta text-muted-foreground`,children:`OpenCode`}),(0,X.jsxs)(`a`,{className:`typography-meta text-muted-foreground underline`,href:`https://opencode.ai/docs/providers/`,target:`_blank`,rel:`noreferrer`,children:[i(`tour.docs`),` ↗`]})]}),(0,X.jsx)(`div`,{className:`yuri-tour-provider-grid`,children:ue.map(e=>(0,X.jsxs)(u,{variant:`ghost`,className:`yuri-tour-provider-choice`,onClick:()=>pe(e.id),children:[(0,X.jsx)(T,{providerId:e.id,alt:e.name,className:`size-6 shrink-0`}),(0,X.jsx)(`span`,{children:e.name})]},e.id))}),(0,X.jsxs)(u,{className:`mt-3`,size:`sm`,variant:`ghost`,onClick:()=>pe(),children:[i(`tour.otherProvider`),(0,X.jsx)(p,{name:`arrow-right-s`,className:`size-4`})]})]}),c===1&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`div`,{className:`yuri-tour-plugins`,children:[1,2].map(e=>(0,X.jsx)(de,{index:e,info:J.data?.[Z[e]],installed:ae(se,Z[e]),selected:k.includes(Z[e]),onSelect:()=>N(t=>t.includes(Z[e])?t.filter(t=>t!==Z[e]):[...t,Z[e]]),onReadme:()=>L(e)},e))}),(0,X.jsxs)(`a`,{className:`mt-4 inline-block typography-meta text-muted-foreground underline underline-offset-4 hover:text-foreground`,href:`https://opencode.ai/docs/ecosystem/#plugins`,target:`_blank`,rel:`noopener noreferrer`,children:[i(`tour.morePlugins`),` ↗`]})]}),c===2&&(0,X.jsx)(ce,{onBusy:z,directory:a,onPrimaryChange:re,onComplete:()=>$(3)}),c===3&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`yuri-tour-voice-intro`,children:[(0,X.jsx)(`h2`,{children:i(`tour.voiceHeading`)}),(0,X.jsx)(`p`,{children:i(`tour.voiceIntro`)})]}),(0,X.jsxs)(`div`,{className:`yuri-tour-voice-capabilities`,children:[(0,X.jsxs)(`section`,{children:[(0,X.jsx)(p,{name:`mic`,className:`yuri-tour-voice-icon`}),(0,X.jsx)(`h3`,{children:i(`settings.voice.page.section.speechRecognition`)}),(0,X.jsx)(`p`,{children:i(`tour.dictationDescription`)}),(0,X.jsxs)(`div`,{className:`yuri-tour-voice-services`,children:[(0,X.jsxs)(`span`,{children:[(0,X.jsx)(`img`,{src:`data:image/svg+xml,%3csvg%20height='24'%20style='flex:none;line-height:1'%20viewBox='0%200%2024%2024'%20width='24'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eDoubao%3c/title%3e%3cpath%20d='M5.31%2015.756c.172-3.75%201.883-5.999%202.549-6.739-3.26%202.058-5.425%205.658-6.358%208.308v1.12C1.501%2021.513%204.226%2024%207.59%2024a6.59%206.59%200%20002.2-.375c.353-.12.7-.248%201.039-.378.913-.899%201.65-1.91%202.243-2.992-4.877%202.431-7.974.072-7.763-4.5l.002.001z'%20fill='%231E37FC'%3e%3c/path%3e%3cpath%20d='M22.57%2010.283c-1.212-.901-4.109-2.404-7.397-2.8.295%203.792.093%208.766-2.1%2012.773a12.782%2012.782%200%2001-2.244%202.992c3.764-1.448%206.746-3.457%208.596-5.219%202.82-2.683%203.353-5.178%203.361-6.66a2.737%202.737%200%2000-.216-1.084v-.002z'%20fill='%2337E1BE'%3e%3c/path%3e%3cpath%20d='M14.303%201.867C12.955.7%2011.248%200%209.39%200%207.532%200%205.883.677%204.545%201.807%202.791%203.29%201.627%205.557%201.5%208.125v9.201c.932-2.65%203.097-6.25%206.357-8.307.5-.318%201.025-.595%201.569-.829%201.883-.801%203.878-.932%205.746-.706-.222-2.83-.718-5.002-.87-5.617h.001z'%20fill='%23A569FF'%3e%3c/path%3e%3cpath%20d='M17.305%204.961a199.47%20199.47%200%2001-1.08-1.094c-.202-.213-.398-.419-.586-.622l-1.333-1.378c.151.615.648%202.786.869%205.617%203.288.395%206.185%201.898%207.396%202.8-1.306-1.275-3.475-3.487-5.266-5.323z'%20fill='%231E37FC'%3e%3c/path%3e%3c/svg%3e`,alt:``,className:`size-4`}),i(`settings.voice.volcengine.name`)]}),(0,X.jsxs)(`span`,{children:[(0,X.jsx)(p,{name:`computer`}),i(`settings.voice.page.provider.local`)]}),(0,X.jsxs)(`span`,{children:[(0,X.jsx)(p,{name:`server`}),i(`settings.voice.page.provider.server`)]})]}),(0,X.jsxs)(u,{size:`sm`,onClick:()=>F(`asr`),children:[i(`tour.configureInput`),(0,X.jsx)(p,{name:`arrow-right-s`,className:`size-4`})]})]}),(0,X.jsxs)(`section`,{children:[(0,X.jsx)(p,{name:`volume-up`,className:`yuri-tour-voice-icon`}),(0,X.jsx)(`h3`,{children:i(`tour.readAloudTitle`)}),(0,X.jsx)(`p`,{children:i(`tour.readAloudDescription`)}),(0,X.jsxs)(`div`,{className:`yuri-tour-voice-services`,children:[(0,X.jsxs)(`span`,{children:[(0,X.jsx)(`img`,{src:`data:image/svg+xml,%3csvg%20height='24'%20style='flex:none;line-height:1'%20viewBox='0%200%2024%2024'%20width='24'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eDoubao%3c/title%3e%3cpath%20d='M5.31%2015.756c.172-3.75%201.883-5.999%202.549-6.739-3.26%202.058-5.425%205.658-6.358%208.308v1.12C1.501%2021.513%204.226%2024%207.59%2024a6.59%206.59%200%20002.2-.375c.353-.12.7-.248%201.039-.378.913-.899%201.65-1.91%202.243-2.992-4.877%202.431-7.974.072-7.763-4.5l.002.001z'%20fill='%231E37FC'%3e%3c/path%3e%3cpath%20d='M22.57%2010.283c-1.212-.901-4.109-2.404-7.397-2.8.295%203.792.093%208.766-2.1%2012.773a12.782%2012.782%200%2001-2.244%202.992c3.764-1.448%206.746-3.457%208.596-5.219%202.82-2.683%203.353-5.178%203.361-6.66a2.737%202.737%200%2000-.216-1.084v-.002z'%20fill='%2337E1BE'%3e%3c/path%3e%3cpath%20d='M14.303%201.867C12.955.7%2011.248%200%209.39%200%207.532%200%205.883.677%204.545%201.807%202.791%203.29%201.627%205.557%201.5%208.125v9.201c.932-2.65%203.097-6.25%206.357-8.307.5-.318%201.025-.595%201.569-.829%201.883-.801%203.878-.932%205.746-.706-.222-2.83-.718-5.002-.87-5.617h.001z'%20fill='%23A569FF'%3e%3c/path%3e%3cpath%20d='M17.305%204.961a199.47%20199.47%200%2001-1.08-1.094c-.202-.213-.398-.419-.586-.622l-1.333-1.378c.151.615.648%202.786.869%205.617%203.288.395%206.185%201.898%207.396%202.8-1.306-1.275-3.475-3.487-5.266-5.323z'%20fill='%231E37FC'%3e%3c/path%3e%3c/svg%3e`,alt:``,className:`size-4`}),i(`settings.voice.volcengine.name`)]}),(0,X.jsxs)(`span`,{children:[(0,X.jsx)(T,{providerId:`openai`,alt:`OpenAI`,className:`size-4`}),`OpenAI`]}),(0,X.jsxs)(`span`,{children:[(0,X.jsx)(p,{name:`computer`}),i(`settings.voice.page.provider.browser`)]}),(0,X.jsxs)(`span`,{children:[(0,X.jsx)(p,{name:`cloud`}),i(`settings.voice.page.provider.custom`)]})]}),(0,X.jsxs)(u,{size:`sm`,onClick:()=>F(`tts`),children:[i(`tour.configureReadAloud`),(0,X.jsx)(p,{name:`arrow-right-s`,className:`size-4`})]})]})]}),(0,X.jsxs)(`section`,{className:`yuri-tour-voice-recommendation`,children:[(0,X.jsx)(`img`,{src:`data:image/svg+xml,%3csvg%20height='24'%20style='flex:none;line-height:1'%20viewBox='0%200%2024%2024'%20width='24'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eDoubao%3c/title%3e%3cpath%20d='M5.31%2015.756c.172-3.75%201.883-5.999%202.549-6.739-3.26%202.058-5.425%205.658-6.358%208.308v1.12C1.501%2021.513%204.226%2024%207.59%2024a6.59%206.59%200%20002.2-.375c.353-.12.7-.248%201.039-.378.913-.899%201.65-1.91%202.243-2.992-4.877%202.431-7.974.072-7.763-4.5l.002.001z'%20fill='%231E37FC'%3e%3c/path%3e%3cpath%20d='M22.57%2010.283c-1.212-.901-4.109-2.404-7.397-2.8.295%203.792.093%208.766-2.1%2012.773a12.782%2012.782%200%2001-2.244%202.992c3.764-1.448%206.746-3.457%208.596-5.219%202.82-2.683%203.353-5.178%203.361-6.66a2.737%202.737%200%2000-.216-1.084v-.002z'%20fill='%2337E1BE'%3e%3c/path%3e%3cpath%20d='M14.303%201.867C12.955.7%2011.248%200%209.39%200%207.532%200%205.883.677%204.545%201.807%202.791%203.29%201.627%205.557%201.5%208.125v9.201c.932-2.65%203.097-6.25%206.357-8.307.5-.318%201.025-.595%201.569-.829%201.883-.801%203.878-.932%205.746-.706-.222-2.83-.718-5.002-.87-5.617h.001z'%20fill='%23A569FF'%3e%3c/path%3e%3cpath%20d='M17.305%204.961a199.47%20199.47%200%2001-1.08-1.094c-.202-.213-.398-.419-.586-.622l-1.333-1.378c.151.615.648%202.786.869%205.617%203.288.395%206.185%201.898%207.396%202.8-1.306-1.275-3.475-3.487-5.266-5.323z'%20fill='%231E37FC'%3e%3c/path%3e%3c/svg%3e`,alt:``,className:`size-6 shrink-0`}),(0,X.jsxs)(`div`,{children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(`h3`,{children:i(`settings.voice.volcengine.name`)}),(0,X.jsx)(`span`,{className:`yuri-tour-recommended`,children:i(`tour.recommended`)})]}),(0,X.jsx)(`p`,{children:i(`tour.voiceAllowance`)})]}),(0,X.jsx)(u,{disabled:!Y.data,size:`sm`,onClick:()=>F(`voice`),children:i(`tour.configureVoice`)})]}),Y.isError&&(0,X.jsxs)(`div`,{role:`alert`,className:`yuri-tour-feedback`,children:[(0,X.jsx)(`p`,{children:i(`settings.voice.volcengine.loadFailed`)}),(0,X.jsx)(u,{size:`xs`,onClick:()=>void Y.refetch(),children:i(`settings.voice.volcengine.retry`)})]})]})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`h3`,{className:`typography-ui-label mb-4`,children:[K[I].name,` · README`]}),ye?(0,X.jsx)(y,{content:ye,enableFileReferences:!1}):(0,X.jsx)(`p`,{className:`typography-meta text-muted-foreground`,children:i(`tour.metadataUnavailable`)})]}),B&&I===null&&(0,X.jsx)(`p`,{role:`alert`,className:`yuri-tour-feedback`,children:B})]})})]}),(0,X.jsxs)(`footer`,{className:`yuri-tour-footer`,children:[(P!==`tour`||I!==null)&&(0,X.jsx)(u,{variant:`ghost`,size:`sm`,disabled:R,onClick:_e,children:i(`onboarding.common.actions.back`)}),I===null&&(0,X.jsxs)(`div`,{className:`ml-auto flex flex-wrap justify-end gap-2`,children:[(0,X.jsx)(u,{variant:`ghost`,size:`sm`,disabled:R,onClick:he,children:i(`tour.later`)}),c===2?(0,X.jsxs)(u,{size:`sm`,type:`submit`,form:`yuri-tour-import`,disabled:R||ne.disabled,"aria-busy":R,children:[R&&(0,X.jsx)(p,{name:`loader-4`,className:`size-3 animate-spin`}),i(ne.background?`historyImport.background`:`historyImport.next`)]}):c===3?(0,X.jsx)(u,{size:`sm`,disabled:R,type:P===`voice`?`submit`:`button`,form:P===`voice`?`yuri-tour-voice`:void 0,onClick:P===`voice`?void 0:me,children:i(P===`voice`?`settings.common.actions.saveChanges`:`tour.finish`)}):(0,X.jsxs)(u,{size:`sm`,disabled:R||c<2&&(!q.data||q.isError),"aria-busy":R,onClick:()=>void ge(),children:[R&&(0,X.jsx)(p,{name:`loader-4`,className:`size-3 animate-spin`}),i(`tour.continue`)]})]})]})]})})}export{pe as SetupTourDialog};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./rolldown-runtime-hePW80VL.js";import{ot as e,st as t}from"./vendor-base-ui-wXsskyKm.js";import{n}from"./vendor-react-BkccXcWz.js";import{n as r}from"./Icon-
|
|
1
|
+
import"./rolldown-runtime-hePW80VL.js";import{ot as e,st as t}from"./vendor-base-ui-wXsskyKm.js";import{n}from"./vendor-react-BkccXcWz.js";import{n as r}from"./Icon-C1rjS64C.js";import{t as i}from"./i18n-iu4pzqPi.js";import{i as a,n as o,t as s}from"./tooltip-Di-WRJUZ.js";var c=n();t();var l=e(),u=e=>{let t=(0,c.c)(38),{syncAction:n,remotes:u,onSync:d,disabled:f,aheadCount:p,behindCount:m,trackingRemoteName:h,hasUncommittedChanges:g}=e,_;t[0]===u?_=t[1]:(_=u===void 0?[]:u,t[0]=u,t[1]=_);let v=_,y=p===void 0?0:p,b=m===void 0?0:m,x=g!==void 0&&g,{t:S}=i(),C;t[2]!==v||t[3]!==h?(C=v.find(e=>e.name===h)??v[0],t[2]=v,t[3]=h,t[4]=C):C=t[4];let w=C,T=b>0&&x,E=f||n!==null||!w||T,D=y>0||b>0,O;t[5]!==y||t[6]!==b||t[7]!==T||t[8]!==D||t[9]!==S||t[10]!==w?(O=T?S(`gitView.sync.commitOrStashTooltip`):w?D?S(`gitView.sync.syncChangesTooltip`,{ahead:y,behind:b}):S(`gitView.sync.syncChanges`):S(`gitView.sync.noRemoteTooltip`),t[5]=y,t[6]=b,t[7]=T,t[8]=D,t[9]=S,t[10]=w,t[11]=O):O=t[11];let k=O,A;t[12]!==d||t[13]!==w?(A=()=>{w&&d(w)},t[12]=d,t[13]=w,t[14]=A):A=t[14];let j=A,M=D?0:void 0,N;t[15]!==y||t[16]!==b||t[17]!==D||t[18]!==S?(N=D?S(`gitView.sync.syncChangesTooltip`,{ahead:y,behind:b}):S(`gitView.sync.syncChanges`),t[15]=y,t[16]=b,t[17]=D,t[18]=S,t[19]=N):N=t[19];let P;t[20]===n?P=t[21]:(P=n===`sync`?(0,l.jsx)(r,{name:`loader-4`,className:`size-3.5 animate-spin`}):(0,l.jsx)(r,{name:`refresh`,className:`size-3.5`}),t[20]=n,t[21]=P);let F;t[22]===D?F=t[23]:(F=D?(0,l.jsx)(`span`,{"aria-hidden":`true`,className:`absolute -right-0.5 top-0 size-1 rounded-full bg-[var(--status-error)] ring-1 ring-[var(--surface-background)]`}):null,t[22]=D,t[23]=F);let I;t[24]!==P||t[25]!==F?(I=(0,l.jsxs)(`span`,{className:`relative flex size-3.5 shrink-0`,children:[P,F]}),t[24]=P,t[25]=F,t[26]=I):I=t[26];let L;t[27]!==j||t[28]!==E||t[29]!==N||t[30]!==I?(L=(0,l.jsx)(a,{asChild:!0,children:(0,l.jsx)(`button`,{type:`button`,onClick:j,disabled:E,className:`inline-flex h-6 w-fit shrink-0 items-center justify-center gap-1 rounded px-1 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`,"aria-label":N,children:I})}),t[27]=j,t[28]=E,t[29]=N,t[30]=I,t[31]=L):L=t[31];let R;t[32]===k?R=t[33]:(R=(0,l.jsx)(o,{side:`bottom`,sideOffset:8,children:k}),t[32]=k,t[33]=R);let z;return t[34]!==L||t[35]!==R||t[36]!==M?(z=(0,l.jsxs)(s,{delayDuration:M,children:[L,R]}),t[34]=L,t[35]=R,t[36]=M,t[37]=z):z=t[37],z};export{u as t};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t}from"./runtime-switch-DEPKHgdL.js";import{n}from"./runtime-fetch-V-iMWR8t.js";import{I as r,s as i}from"./platform-B2ylz14u.js";import{it as a,ot as o,st as s}from"./vendor-base-ui-wXsskyKm.js";import{n as c}from"./client-CmtAKi5B.js";import{o as l,s as u,u as d}from"./vendor-tanstack-react-query-DIb_ItL-.js";import{r as f}from"./vendor-reactuses-core-DjKFMfz7.js";import{f as p,p as m,r as h}from"./useUIStore-68ZPpgYA.js";import{s as g}from"./terminalApi-wdwb9MVG.js";import{n as _,r as v,t as y}from"./vendor-ghostty-web-DbBrwBII.js";import{r as b}from"./vendor-sonner-DX3nfJx4.js";import{Xn as x,f as S,io as ee,ro as te}from"./ui-BCYkB585.js";import{n as C}from"./Icon-C1rjS64C.js";import{t as w}from"./i18n-iu4pzqPi.js";import{t as ne}from"./OverlayScrollbar-m1EAqRES.js";import{n as T}from"./useThemeSystem-BIXghnHj.js";import{r as re}from"./device-TCHW5U2y.js";import{n as ie}from"./useEffectiveDirectory-BYswRwIv.js";import{n as ae}from"./useProjectRuntimeAPIs-BMBBtJB-.js";import{t as E}from"./sortable-tabs-strip-1bKw81VO.js";import{t as D}from"./useTerminalStore-C_QzSEgP.js";import{t as oe}from"./useFontPreferences-C4dQT72k.js";import{t as se}from"./project-preview-yQerlKs2.js";import{n as ce}from"./projectActions-B11KAI3f.js";var O=e(s(),1);function k(e){let{colors:t}=e,n=t.syntax.base;return{background:t.surface.background,foreground:n.foreground,cursor:t.interactive.cursor,cursorAccent:t.surface.background,selectionBackground:t.interactive.selection,selectionForeground:t.interactive.selectionForeground,selectionInactiveBackground:t.interactive.selection+`50`,black:t.surface.muted,red:t.status.error,green:t.status.success,yellow:t.status.warning,blue:n.function,magenta:n.keyword,cyan:n.type,white:n.foreground,brightBlack:n.comment,brightRed:t.status.error,brightGreen:t.status.success,brightYellow:t.status.warning,brightBlue:n.function,brightMagenta:n.keyword,brightCyan:n.type,brightWhite:t.surface.elevatedForeground}}function le(e,t,n,r,i=!1){return{cursorBlink:!1,cursorStyle:`bar`,fontSize:t,lineHeight:1.15,fontFamily:`${e}, "JetBrainsMonoNL Nerd Font", "FiraCode Nerd Font", "Cascadia Code PL", "Fira Code", "JetBrains Mono", "SFMono-Regular", Menlo, Consolas, "Liberation Mono", "Courier New", monospace`,allowTransparency:!1,theme:{background:n.background,foreground:n.foreground,cursor:n.cursor,cursorAccent:n.cursorAccent,selectionBackground:n.selectionBackground,selectionForeground:n.selectionForeground,black:n.black,red:n.red,green:n.green,yellow:n.yellow,blue:n.blue,magenta:n.magenta,cyan:n.cyan,white:n.white,brightBlack:n.brightBlack,brightRed:n.brightRed,brightGreen:n.brightGreen,brightYellow:n.brightYellow,brightBlue:n.brightBlue,brightMagenta:n.brightMagenta,brightCyan:n.brightCyan,brightWhite:n.brightWhite},scrollback:1e4,ghostty:r,disableStdin:i}}var ue=e(a(),1),A=o(),j=null;function de(){return j||=v.load(),j}function M(e){if(typeof window>`u`)return null;let t=[e,...Array.from(e.querySelectorAll(`*`))],n=null;for(let e of t){let t=window.getComputedStyle(e).overflowY;if(t===`auto`||t===`scroll`){if(e.scrollHeight-e.clientHeight>2)return e;n||=e}}return n}var N=O.forwardRef(({sessionKey:e,chunks:t,onInput:n,onResize:r,theme:i,fontFamily:a,fontSize:o,className:s,enableTouchScroll:c,autoFocus:l=!0,isVisible:u=!0,readOnly:d=!1},f)=>{let{t:p}=w(),m=O.useRef(null),h=O.useRef(null),g=O.useRef(null),v=O.useRef(null),b=O.useRef(n),x=O.useRef(r),S=O.useRef(null),C=O.useRef(``),T=O.useRef(null),re=O.useRef(!1),ie=O.useRef(null),ae=O.useRef(!0),E=O.useRef(null),D=O.useRef(null),oe=O.useRef(0),se=O.useRef(null),ce=O.useRef(null),k=O.useRef(!1),j=O.useRef(!1),N=O.useRef(null),fe=O.useRef(null),P=O.useRef(null),F=O.useRef(``),pe=O.useRef(null),me=O.useRef(!c),he=O.useRef(u),[,ge]=O.useReducer(e=>e+1,0),[_e,ve]=O.useReducer(e=>e+1,0);b.current=d?()=>{}:n,x.current=r;let ye=typeof navigator<`u`&&(/Android/i.test(navigator.userAgent)||navigator.userAgentData?.platform===`Android`),I=!!c&&!d;O.useEffect(()=>{if(!c){me.current=!0,he.current=u;return}!he.current&&u&&(me.current=!1),he.current=u},[c,u]);let be=O.useCallback(()=>{if(!I)return;let e=m.current,t=se.current;if(!e)return;let n=[];e.getAttribute(`contenteditable`)===`true`&&n.push(e),n.push(...Array.from(e.querySelectorAll(`[contenteditable="true"]`))),n.forEach(e=>{e.setAttribute(`data-terminal-disabled-contenteditable`,`true`),e.setAttribute(`contenteditable`,`false`),e.setAttribute(`aria-hidden`,`true`),e.tabIndex=-1,e.style.setProperty(`caret-color`,`transparent`),e.style.color=`transparent`,e.style.setProperty(`-webkit-text-fill-color`,`transparent`),e.style.background=`transparent`,e.style.outline=`none`,e.style.boxShadow=`none`,e.style.textShadow=`none`,e.style.setProperty(`user-select`,`none`),e.style.setProperty(`-webkit-user-select`,`none`)}),e.tabIndex=-1,e.removeAttribute(`role`),e.removeAttribute(`aria-multiline`),Array.from(e.querySelectorAll(`textarea`)).forEach(e=>{e.style.setProperty(`caret-color`,`transparent`),e.style.color=`transparent`,e.style.setProperty(`-webkit-text-fill-color`,`transparent`),e.style.background=`transparent`,e.style.border=`0`,e.style.outline=`none`,e.style.boxShadow=`none`,e.style.textShadow=`none`,e.style.fontSize=`0`,e.style.lineHeight=`0`,e!==t&&e.getAttribute(`data-terminal-disabled-input`)!==`true`&&(e.setAttribute(`data-terminal-disabled-input`,`true`),e.setAttribute(`aria-hidden`,`true`),e.tabIndex=-1,e.disabled=!0,e.style.position=`absolute`,e.style.opacity=`0`,e.style.width=`0px`,e.style.height=`0px`,e.style.pointerEvents=`none`,e.style.zIndex=`-1`)})},[I]),L=O.useCallback(e=>{if(pe.current===e)return;let t=g.current;if(t)try{if(typeof t.setOption==`function`){t.setOption(`cursorBlink`,e),pe.current=e;return}t.options&&(t.options.cursorBlink=e,pe.current=e)}catch{}},[]),xe=I&&ye,R=O.useCallback((e,t)=>{let n=xe?ce.current:se.current,r=m.current;if(!n||!r)return;let i=r.getBoundingClientRect(),a=typeof window<`u`?window.innerWidth:i.width,o=typeof window<`u`?window.innerHeight:i.height,s=i.left+i.width/2,c=i.top+i.height-12,l=typeof e==`number`?e:s,u=typeof t==`number`?t:c,d=Math.max(8,Math.min(a-8,l)),f=Math.max(8,Math.min(o-8,u));n.style.left=`${d}px`,n.style.top=`${f}px`,n.style.bottom=``,(n instanceof HTMLTextAreaElement||n instanceof HTMLInputElement)&&(n.disabled=!1,n.readOnly=!1,n.removeAttribute(`disabled`),n.removeAttribute(`readonly`));try{n.focus({preventScroll:!0})}catch{try{n.focus()}catch{}}},[xe]),z=O.useCallback(()=>{if(I){R(),L(!0);return}g.current?.focus(),L(!0)},[R,L,I]),B=O.useCallback(e=>e instanceof HTMLTextAreaElement||e instanceof HTMLInputElement?e.value:e.textContent??``,[]),V=O.useCallback(e=>{if(e instanceof HTMLTextAreaElement||e instanceof HTMLInputElement){e.value=``;return}e.textContent=``},[]),Se=O.useCallback(e=>{if(typeof window>`u`||xe)return;P.current!==null&&(window.clearTimeout(P.current),P.current=null);let t=0,n=()=>{P.current=window.setTimeout(()=>{P.current=null;let r=B(e);if(!r){if(t+=1,t<3){n();return}return}let i=F.current;F.current=r;let a=r.startsWith(i)?r.slice(i.length):r;a&&b.current(a.replace(/\r\n|\r|\n/g,`\r`)),V(e),F.current=``},t===0?0:24)};n()},[V,B,xe]);O.useEffect(()=>{let e=m.current;if(!I||!e||c)return;let t=t=>{let n=t.target;if(n&&n.getAttribute(`data-terminal-hidden-input`)!==`true`&&e.contains(n)){try{n.blur()}catch{}R()}};return e.addEventListener(`focusin`,t,!0),()=>{e.removeEventListener(`focusin`,t,!0)}},[c,I,R]);let Ce=O.useCallback(()=>{let e=g.current;if(!e||typeof e.getSelection!=`function`)return``;let t=e.getSelection();return typeof t==`string`?t:``},[]),H=O.useCallback(()=>{if(typeof window>`u`)return``;let e=window.getSelection();if(!e)return``;let t=e.toString();if(!t.trim())return``;let n=m.current;if(!n)return``;let r=e.anchorNode,i=e.focusNode;return r&&!n.contains(r)||i&&!n.contains(i)?``:t},[]),U=O.useCallback(async()=>{if(typeof document>`u`)return;let e=Ce()||H();e.trim()&&await te(e)},[H,Ce]),W=O.useCallback(()=>Ce().trim()?!0:!!H().trim(),[H,Ce]);O.useEffect(()=>{if(typeof window>`u`)return;let e=e=>{W()&&(e.preventDefault(),U())};return window.addEventListener(`yuri:copy`,e),()=>{window.removeEventListener(`yuri:copy`,e)}},[U,W]);let G=O.useCallback(()=>{C.current=``,T.current!==null&&typeof window<`u`&&window.cancelAnimationFrame(T.current),T.current=null,re.current=!1,ie.current=null},[]),K=O.useCallback(()=>{let e=v.current,t=g.current,n=m.current;if(!e||!t||!n)return;let r=n.getBoundingClientRect();if(!(r.width<24||r.height<24))try{e.fit();let n={cols:t.cols,rows:t.rows},r=S.current;(!r||r.cols!==n.cols||r.rows!==n.rows)&&(S.current=n,x.current(n.cols,n.rows))}catch{}},[]),we=O.useCallback(()=>{if(re.current)return;let e=g.current;if(!e){G();return}if(!C.current)return;let t=C.current;C.current=``,re.current=!0,e.write(t,()=>{re.current=!1,C.current&&(typeof window<`u`?T.current=window.requestAnimationFrame(()=>{T.current=null,we()}):we())})},[G]),Te=O.useCallback(()=>{T.current===null&&(typeof window<`u`?T.current=window.requestAnimationFrame(()=>{T.current=null,we()}):we())},[we]),Ee=O.useCallback(e=>{e&&(C.current+=e,Te())},[Te]),De=O.useCallback(()=>{if(E.current?.(),E.current=null,D.current!==null&&typeof window<`u`&&(window.clearTimeout(D.current),D.current=null),!c){oe.current=0;return}let e=m.current;if(!e)return;let t=g.current;if(!t)return;oe.current=0;let n=2.2,r=2.8,i=.25,a=.05,s=.015,l={lastY:null,lastTime:null,velocity:0,rafId:null,startX:null,startY:null,didMove:!1},u=()=>typeof performance<`u`?performance.now():Date.now(),d=Math.max(12,Math.round(o*1.35)),f=0,p=e=>{if(!e)return!1;let n=t.getViewportY(),r=f+e,i=Math.trunc(r/d);return f=r-i*d,i!==0&&t.scrollLines(i),t.getViewportY()!==n},h=()=>{l.rafId!==null&&typeof window<`u`&&window.cancelAnimationFrame(l.rafId),l.rafId=null},_={passive:!1,capture:!1};if(typeof window<`u`&&`PointerEvent`in window){let t=Object.assign(l,{pointerId:null,startX:null,startY:null,moved:!1}),o=n=>{if(n.pointerType===`touch`){h(),t.pointerId=n.pointerId,t.startX=n.clientX,t.startY=n.clientY,t.moved=!1,t.lastY=n.clientY,t.lastTime=u(),t.velocity=0;try{e.setPointerCapture(n.pointerId)}catch{}}},d=e=>{if(e.pointerType!==`touch`||t.pointerId!==e.pointerId)return;if(t.startX!==null&&t.startY!==null&&!t.moved){let n=e.clientX-t.startX,r=e.clientY-t.startY;Math.hypot(n,r)>=6&&(t.moved=!0)}if(t.lastY===null){t.lastY=e.clientY,t.lastTime=u();return}let a=t.lastY,o=t.lastTime??u(),s=u();t.lastY=e.clientY,t.lastTime=s;let c=a-e.clientY;if(Math.abs(c)<1)return;let l=Math.max(s-o,8),d=c*(n+Math.min(r,Math.abs(c)/25)),f=d/l;t.velocity=t.velocity*.75+f*i,t.velocity>8?t.velocity=8:t.velocity<-8&&(t.velocity=-8),t.moved&&(e.cancelable&&e.preventDefault(),e.stopPropagation()),p(d)},f=n=>{if(n.pointerType!==`touch`||t.pointerId!==n.pointerId)return;let r=!t.moved;t.pointerId=null,t.startX=null,t.startY=null,t.moved=!1,t.lastY=null,t.lastTime=null;try{e.releasePointerCapture(n.pointerId)}catch{}if(r){I?R(n.clientX,n.clientY):c&&!me.current&&(me.current=!0,g.current?.focus());return}if(typeof window>`u`)return;if(Math.abs(t.velocity)<a){t.velocity=0;return}let i=u(),o=()=>{let e=u(),n=Math.max(e-i,8);i=e;let r=p(t.velocity*n)??!1,c=Math.sign(t.velocity),l=Math.max(0,Math.abs(t.velocity)-s*n);if(t.velocity=l*c,!r||l<=a){h(),t.velocity=0;return}t.rafId=window.requestAnimationFrame(o)};t.rafId=window.requestAnimationFrame(o)};e.addEventListener(`pointerdown`,o,_),e.addEventListener(`pointermove`,d,_),e.addEventListener(`pointerup`,f,_),e.addEventListener(`pointercancel`,f,_);let m=e.style.touchAction,v=e.style.overscrollBehaviorY;e.style.touchAction=`none`,e.style.overscrollBehaviorY=`contain`,E.current=()=>{h(),D.current!==null&&typeof window<`u`&&(window.clearTimeout(D.current),D.current=null),oe.current=0,e.removeEventListener(`pointerdown`,o,_),e.removeEventListener(`pointermove`,d,_),e.removeEventListener(`pointerup`,f,_),e.removeEventListener(`pointercancel`,f,_),e.style.touchAction=m,e.style.overscrollBehaviorY=v};return}let v=e=>{e.touches.length===1&&(h(),l.lastY=e.touches[0].clientY,l.lastTime=u(),l.velocity=0,l.startX=e.touches[0].clientX,l.startY=e.touches[0].clientY,l.didMove=!1)},y=e=>{if(e.touches.length!==1){l.lastY=null,l.lastTime=null,l.velocity=0,l.startX=null,l.startY=null,l.didMove=!1,h();return}let t=e.touches[0].clientX,a=e.touches[0].clientY;if(l.startX!==null&&l.startY!==null&&!l.didMove){let e=t-l.startX,n=a-l.startY;Math.hypot(e,n)>=6&&(l.didMove=!0)}if(l.lastY===null){l.lastY=a,l.lastTime=u();return}let o=l.lastY,s=l.lastTime??u(),c=u();l.lastY=a,l.lastTime=c;let d=o-a;if(Math.abs(d)<1)return;let f=Math.max(c-s,8),m=d*(n+Math.min(r,Math.abs(d)/25)),g=m/f;l.velocity=l.velocity*.75+g*i,l.velocity>8?l.velocity=8:l.velocity<-8&&(l.velocity=-8),l.didMove&&(e.preventDefault(),e.stopPropagation()),p(m)},b=e=>{let t=!l.didMove;l.lastY=null,l.lastTime=null;let n=l.velocity;if(l.startX=null,l.startY=null,l.didMove=!1,t){let t=e.changedTouches?.[0];I?R(t?.clientX,t?.clientY):c&&!me.current&&(me.current=!0,g.current?.focus());return}if(typeof window>`u`)return;if(Math.abs(n)<a){l.velocity=0;return}let r=u(),i=()=>{let e=u(),t=Math.max(e-r,8);r=e;let n=p(l.velocity*t)??!1,o=Math.sign(l.velocity),c=Math.max(0,Math.abs(l.velocity)-s*t);if(l.velocity=c*o,!n||c<=a){h(),l.velocity=0;return}l.rafId=window.requestAnimationFrame(i)};l.rafId=window.requestAnimationFrame(i)};e.addEventListener(`touchstart`,v,_),e.addEventListener(`touchmove`,y,_),e.addEventListener(`touchend`,b,_),e.addEventListener(`touchcancel`,b,_);let x=e.style.touchAction,S=e.style.overscrollBehaviorY;e.style.touchAction=`none`,e.style.overscrollBehaviorY=`contain`,E.current=()=>{h(),D.current!==null&&typeof window<`u`&&(window.clearTimeout(D.current),D.current=null),oe.current=0,e.removeEventListener(`touchstart`,v,_),e.removeEventListener(`touchmove`,y,_),e.removeEventListener(`touchend`,b,_),e.removeEventListener(`touchcancel`,b,_),e.style.touchAction=x,e.style.overscrollBehaviorY=S}},[c,I,R,o]);O.useEffect(()=>{let e=!1,t=null,n=null,r=null,s=[],l=null,u=null,f=null,p=m.current;if(!p)return;if(p.tabIndex=I?-1:0,I){let e=p.focus.bind(p),t=p;t.focus=((...e)=>{R()}),f=()=>{t.focus=e}}let x=()=>{L(!0)},ee=()=>{L(!1)},te=e=>{let t=e.target;if(t&&p.contains(t)){if(I&&t instanceof HTMLElement){window.setTimeout(()=>{t.blur(),R()},0),L(!1);return}if(c&&!me.current&&t instanceof HTMLElement){window.setTimeout(()=>{t.blur()},0),L(!1);return}L(!0);return}L(!1)},C=()=>{L(!1)},w=null;return(async()=>{try{let f=await de();if(e)return;let m=le(a,o,i,f,d),S=new _(m);ae.current=!0,I&&(S.focus=()=>{});let te=S;if(typeof te.scrollToBottom==`function`){let e=te.scrollToBottom.bind(te);te.scrollToBottom=()=>{ae.current&&e()},l=()=>{te.scrollToBottom=e}}let C=new y;if(t=S,g.current=S,v.current=C,S.loadAddon(C),S.open(p),c){let e=S.renderer;if(e&&typeof e.renderScrollbar==`function`){let t=e.renderScrollbar.bind(e);e.renderScrollbar=()=>{},u=()=>{e.renderScrollbar=t}}}ve(),pe.current=!1,w=S.textarea??p.querySelector(`textarea`),w&&(w.readOnly=d,w.addEventListener(`focus`,x),w.addEventListener(`blur`,ee)),be(),typeof MutationObserver<`u`&&(r=new MutationObserver(()=>{be()}),r.observe(p,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`contenteditable`,`role`,`tabindex`,`aria-label`]}));let ne=M(p);ne?(ne.classList.add(`overlay-scrollbar-target`,`overlay-scrollbar-container`),h.current=ne,ge()):h.current=null,K();let T=C;typeof T.observeResize==`function`&&T.observeResize(),De(),s=[S.onData(e=>{b.current(e)}),S.onScroll(e=>{if(typeof e==`number`&&Number.isFinite(e)){let t=typeof S.hasSelection==`function`&&S.hasSelection();ae.current=!t&&e<=.5}}),S.onSelectionChange(()=>{if(typeof S.hasSelection==`function`&&S.hasSelection()){ae.current=!1;return}let e=typeof S.getViewportY==`function`?S.getViewportY():0;ae.current=e<=.5})],n=new ResizeObserver(()=>{K()}),n.observe(p),typeof window<`u`&&window.setTimeout(()=>{K()},0)}catch{}})(),document.addEventListener(`focusin`,te,!0),window.addEventListener(`blur`,C),()=>{e=!0,E.current?.(),E.current=null,document.removeEventListener(`focusin`,te,!0),window.removeEventListener(`blur`,C),s.forEach(e=>e.dispose()),l?.(),l=null,u?.(),u=null,w&&(w.removeEventListener(`focus`,x),w.removeEventListener(`blur`,ee)),n?.disconnect(),r?.disconnect(),f?.(),t?.dispose(),g.current=null,v.current=null,h.current=null,S.current=null,pe.current=null,G()}},[be,c,K,R,a,o,De,i,G,L,I,d]),O.useEffect(()=>{let e=g.current;e&&(e.reset(),G(),S.current=null,K())},[e,_e,K,G]),O.useEffect(()=>{l&&g.current&&z()},[l,z,e,_e]),O.useEffect(()=>(De(),()=>{E.current?.(),E.current=null}),[De,e]),O.useEffect(()=>{let e=g.current;if(!e)return;if(t.length===0){ie.current!==null&&(e.reset(),G(),K());return}let n=ie.current,r;if(n===null)r=t;else{let e=t.findIndex(e=>e.id===n);r=e>=0?t.slice(e+1):t}r.length>0&&Ee(r.map(e=>e.data).join(``)),ie.current=t[t.length-1].id},[t,_e,Ee,K,G]),O.useImperativeHandle(f,()=>({focus:()=>{z()},clear:()=>{let e=g.current;e&&(e.reset(),G(),K())},fit:()=>{K()}}),[z,K,G]);let Oe=O.useCallback(e=>{if(!I)return;let t=m.current,n=e.relatedTarget,r=n?.tagName;r===`INPUT`||r===`TEXTAREA`||n?.isContentEditable,n?.getAttribute(`data-terminal-hidden-input`),n&&t?.contains(n)},[I]),ke=O.useCallback(e=>{let t=e.nativeEvent,n=t?.inputType??``,r=typeof t?.data==`string`?t.data:``;if(fe.current=typeof performance<`u`?performance.now():Date.now(),n===`insertCompositionText`){k.current=!0;return}if(!n&&r){if(k.current)return;e.preventDefault(),b.current(r),N.current={type:`insertText`,at:typeof performance<`u`?performance.now():Date.now()},j.current=!0;return}if(n===`insertText`&&r){if(k.current)return;e.preventDefault(),b.current(r),N.current={type:n,at:typeof performance<`u`?performance.now():Date.now()},j.current=!0;return}if(n===`insertLineBreak`){if(k.current)return;e.preventDefault(),b.current(`\r`),N.current={type:n,at:typeof performance<`u`?performance.now():Date.now()},j.current=!0;return}if(n===`deleteContentBackward`){if(k.current)return;e.preventDefault(),b.current(``),N.current={type:n,at:typeof performance<`u`?performance.now():Date.now()},j.current=!0}},[]),Ae=O.useCallback(e=>{let t=e.currentTarget;if(fe.current=typeof performance<`u`?performance.now():Date.now(),k.current)return;if(j.current){let e=N.current,n=typeof performance<`u`?performance.now():Date.now();if(e&&n-e.at<50){j.current=!1,V(t);return}j.current=!1}let n=B(t);if(!n)return;F.current=n;let r=n.replace(/\r\n|\r|\n/g,`\r`);b.current(r),V(t),F.current=``},[V,B]),q=O.useCallback(e=>{e.stopPropagation();let t=e.key.toLowerCase(),n=e.metaKey&&!e.ctrlKey&&!e.altKey&&t===`c`,r=e.ctrlKey&&e.shiftKey&&!e.metaKey&&!e.altKey&&t===`c`;if((n||r)&&W()){e.preventDefault(),U();return}if(e.ctrlKey&&!e.metaKey&&!e.altKey&&e.key.length===1){let t=e.key.toUpperCase();if(t>=`A`&&t<=`Z`){e.preventDefault(),e.nativeEvent?.stopImmediatePropagation(),b.current(String.fromCharCode(t.charCodeAt(0)-64)),V(e.currentTarget);return}}if(e.altKey&&!e.ctrlKey&&!e.metaKey&&e.key.length===1){e.preventDefault(),e.nativeEvent?.stopImmediatePropagation(),b.current(`\x1B`+e.key),V(e.currentTarget);return}let i={ArrowUp:`\x1B[A`,ArrowDown:`\x1B[B`,ArrowRight:`\x1B[C`,ArrowLeft:`\x1B[D`,Escape:`\x1B`,Tab:` `,Delete:`\x1B[3~`,Home:`\x1B[H`,End:`\x1B[F`}[e.key];if(i){e.preventDefault(),b.current(i),V(e.currentTarget);return}let a=e.currentTarget;if(e.nativeEvent?.isComposing)return;let o=N.current,s=typeof performance<`u`?performance.now():Date.now(),c=!!(o&&s-o.at<50);if(e.key===`Enter`){if(c&&o?.type===`insertLineBreak`)return;e.preventDefault(),b.current(`\r`),V(a);return}if(e.key===`Backspace`){if(e.preventDefault(),c&&o?.type===`deleteContentBackward`)return;B(a)||b.current(``)}if(e.key.length===1&&!e.ctrlKey&&!e.metaKey&&!e.altKey){let t=fe.current;t&&s-t<50||(e.preventDefault(),b.current(e.key),j.current=!0,N.current={type:`keydown-text`,at:s})}Se(a)},[V,U,W,B,Se]),je=O.useCallback(e=>{e.stopPropagation();let t=e.currentTarget;e.nativeEvent?.isComposing||Se(t)},[Se]),J=O.useCallback(e=>{let t=e.currentTarget;k.current=!1;let n=e.data||B(t);if(fe.current=typeof performance<`u`?performance.now():Date.now(),!n)return;let r=n.replace(/\r\n|\r|\n/g,`\r`);b.current(r),V(t),N.current={type:`compositionend`,at:typeof performance<`u`?performance.now():Date.now()},j.current=!0},[V,B]),Me=O.useCallback(e=>{e.stopPropagation();let t=e.clipboardData?.getData(`text`)??``;if(!t)return;e.preventDefault();let n=g.current?.hasBracketedPaste?.()?`\x1b[200~${t}\x1b[201~`:t;b.current(n)},[]),Y={position:`fixed`,left:0,top:0,width:1,height:1,opacity:0,zIndex:-1,background:`transparent`,color:`transparent`,WebkitTextFillColor:`transparent`,caretColor:`transparent`,textShadow:`none`,WebkitAppearance:`none`,appearance:`none`,resize:`none`,overflow:`hidden`,whiteSpace:`nowrap`,border:`0`,padding:0,margin:0,outline:`none`,outlineOffset:0,fontSize:16,fontWeight:400,pointerEvents:`none`,WebkitUserSelect:`none`,userSelect:`none`};return(0,A.jsxs)(`div`,{ref:m,className:ee(`relative h-full w-full terminal-viewport-container`,s),"data-hidden-input-overlay-active":I?`true`:void 0,style:{backgroundColor:i.background},onTouchStart:e=>{if(!(!I||c)&&!W()){let t=e.touches?.[0];R(t?.clientX,t?.clientY)}},onClick:e=>{if(!c)if(I){if(W())return;R(e.clientX,e.clientY)}else g.current?.focus()},onMouseUp:()=>{!c&&W()&&U()},onTouchEnd:()=>{!c&&W()&&U()},children:[I&&typeof document<`u`?(0,ue.createPortal)((0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`input`,{ref:ce,type:`text`,inputMode:`text`,autoCapitalize:`off`,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,tabIndex:-1,enterKeyHint:`send`,"data-terminal-hidden-input":`true`,"aria-label":p(`terminalView.viewport.inputAria`),"aria-hidden":`true`,style:{...Y,display:xe?`block`:`none`},onBlur:Oe,onBeforeInput:ke,onCompositionStart:()=>{k.current=!0},onInput:Ae,onKeyDown:q,onKeyUp:je,onCompositionEnd:J,onPaste:Me}),(0,A.jsx)(`textarea`,{ref:se,inputMode:`text`,autoCapitalize:`off`,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,tabIndex:-1,enterKeyHint:`send`,"data-terminal-hidden-input":`true`,"aria-label":p(`terminalView.viewport.inputAria`),"aria-hidden":`true`,style:{...Y,display:xe?`none`:`block`},onBlur:Oe,onBeforeInput:ke,onCompositionStart:()=>{k.current=!0},onInput:Ae,onKeyDown:q,onKeyUp:je,onCompositionEnd:J,onPaste:Me})]}),document.body):null,h.current&&!c?(0,A.jsx)(ne,{containerRef:h,disableHorizontal:!0,className:`overlay-scrollbar--flush overlay-scrollbar--dense overlay-scrollbar--zero`}):null]})});N.displayName=`TerminalViewport`;function fe(e,t=!1){return e.replace(/\n/g,(n,r)=>(r===0?t:e[r-1]===`\r`)?n:`\r
|
|
2
|
+
`)}function P(e,t){let n=[e.transport,`shellLog`,e.directory,e.id];return l({queryKey:n,queryFn:async({signal:r})=>{let i=t.getQueryData(n),a=c.getScopedSdkClient(e.directory),o={id:e.id,location:{directory:e.directory}},s=await a.shell.get(o,{signal:r}),l=await a.shell.output({...o,cursor:i?.cursor??0,limit:65536},{signal:r});if(!s?.data||!l?.data||typeof l.data.output!=`string`)throw Error(`Shell log unavailable`);let u=i?.chunks??[];if(l.data.output){u=[...u,{id:l.data.cursor,data:fe(l.data.output,i?.endsWithCR)}];let e=0,t=u.length;for(;t>0&&e+u[t-1].data.length<=1e6;)e+=u[--t].data.length;u=u.slice(t)}return{cursor:l.data.cursor,size:l.data.size,chunks:u,status:s.data.status,endsWithCR:l.data.output?l.data.output.endsWith(`\r`):i?.endsWithCR??!1}},refetchInterval:e=>{let t=e.state.data;return e.state.error||!t?2e3:t.cursor<t.size?100:t.status===`running`&&1e3},retry:1,gcTime:6e4})}var F=()=>{},pe=[];function me({shell:e,theme:n,fontFamily:r,fontSize:i}){let{t:a}=w(),o=d(),s=e.transport===t(),l=P(e,o),p=u({...l,enabled:s}),[m,h]=O.useState(!1),g=f(async()=>{if(!(!s||m)){h(!0);try{await c.getScopedSdkClient(e.directory).shell.remove({id:e.id,location:{directory:e.directory}}),await o.invalidateQueries({queryKey:l.queryKey})}catch{b.error(a(`chat.workStatus.shell.stopFailed`))}finally{h(!1)}}});return(0,A.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,"data-shell-log":e.id,children:[(0,A.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 px-4 py-1 text-xs text-muted-foreground`,children:[(0,A.jsx)(C,{name:`lock`,className:`size-3.5`}),(0,A.jsx)(`span`,{children:a(`chat.workStatus.shell.readOnly`)}),p.data&&p.data.status!==`running`?(0,A.jsx)(`span`,{role:`status`,children:a(`chat.workStatus.shell.exited`)}):null,!s||p.isError?(0,A.jsx)(`span`,{role:`alert`,children:a(`chat.workStatus.shell.outputUnavailable`)}):null,s&&p.data?.status===`running`?(0,A.jsxs)(x,{variant:`ghost`,size:`xs`,className:`ml-auto`,disabled:m,onClick:()=>void g(),children:[(0,A.jsx)(C,{name:`stop-circle`,className:`size-3.5`}),a(`chat.workStatus.shell.stop`)]}):null]}),(0,A.jsx)(`div`,{className:`min-h-0 flex-1 px-4 pb-2`,children:(0,A.jsx)(N,{sessionKey:`${e.transport}:${e.id}`,chunks:p.data?.chunks??pe,onInput:F,onResize:F,theme:n,fontFamily:r,fontSize:i,readOnly:!0,autoFocus:!1})})]})}var he=RegExp(`\x1B\\[[0-9;?]*[ -/]*[@-~]`,`g`),ge=/(https?:\/\/(?:localhost|127\.0\.0\.1|0\.0\.0\.0|\[(?:::1|::)\])(?::\d{2,5})?(?:\/[^\s<>'"`]*)?)/gi,_e=/(?:➜\s*(?:Local|Network):)|\b(?:local|network|loopback|serving|listening|available|ready|started|running|server|vite|webpack|next\.js|astro|sveltekit|nuxt)\b/i,ve=/Serving HTTP on .*? port (\d{2,5})/i,ye=new Set([`.`,`,`,`;`,`:`,`!`,`?`]),I=e=>{let t=e;for(;t.length>0;){let e=t[t.length-1];if(e===`)`||e===`]`||e===`}`||e===`>`){let n=e===`)`?`(`:e===`]`?`[`:e===`}`?`{`:`<`,r=t.slice(0,-1);if((r.match(RegExp(`\\${n}`,`g`))||[]).length>(r.match(RegExp(`\\${e}`,`g`))||[]).length)break;t=r;continue}if(ye.has(e)){t=t.slice(0,-1);continue}break}return t},be=e=>{let t=I(e);return t=t.replace(`0.0.0.0`,`127.0.0.1`),t=t.replace(`[::1]`,`127.0.0.1`),t=t.replace(`[::]`,`127.0.0.1`),t},L=e=>{if(!e)return null;let t=e.replace(he,``),n=t.match(ve);if(n?.[1]){let e=Number.parseInt(n[1],10);if(Number.isFinite(e)&&e>0&&e<=65535)return`http://127.0.0.1:${e}/`}let r=t.split(`
|
|
3
|
+
`);for(let e of r){if(!_e.test(e))continue;let t=Array.from(e.matchAll(ge));if(t.length!==0)return be((t.find(e=>{try{return!!new URL(be(e[1])).port}catch{return!1}})??t[0])[1])}return null},xe=async(e,t=1500)=>{if(!e||typeof window>`u`)return!1;let r;try{r=new URL(e)}catch{return!1}if(r.protocol!==`http:`&&r.protocol!==`https:`)return!1;let i=r.hostname.toLowerCase();if(i!==`localhost`&&i!==`127.0.0.1`&&i!==`0.0.0.0`&&i!==`::1`&&i!==`::`)return!1;let a=new AbortController,o=window.setTimeout(()=>a.abort(),t);try{let e=await n(`/api/system/probe-url`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({url:r.toString()}),cache:`no-store`,signal:a.signal});return e.ok?(await e.json().catch(()=>null))?.ok===!0:!1}catch{return!1}finally{window.clearTimeout(o)}},R={esc:`\x1B`,tab:` `,enter:`\r`,"arrow-up":`\x1B[A`,"arrow-down":`\x1B[B`,"arrow-left":`\x1B[D`,"arrow-right":`\x1B[C`},z={ctrl:`5`,cmd:`3`},B={retry:{maxRetries:3,initialDelayMs:500,maxDelayMs:8e3},connectionTimeoutMs:1e4},V={retry:{maxRetries:8,initialDelayMs:400,maxDelayMs:8e3},connectionTimeoutMs:15e3},Se=(e,t)=>{if(t)switch(e){case`arrow-up`:return`\u001b[1;${z[t]}A`;case`arrow-down`:return`\u001b[1;${z[t]}B`;case`arrow-right`:return`\u001b[1;${z[t]}C`;case`arrow-left`:return`\u001b[1;${z[t]}D`}return R[e]??null},Ce=()=>{let{t:e}=w(),{terminal:t,runtime:n,projectScope:a}=ae(),{currentTheme:o}=T(),{monoFont:s}=oe(),c=h(e=>e.terminalFontSize),l=h(e=>e.bottomTerminalHeight),u=h(e=>e.isBottomTerminalExpanded),{isMobile:d,isTablet:f,hasTouchOnlyPointer:_}=re(),v=d||f,y=(v||_)&&n.platform===`web`,b=n.platform!==`vscode`,te=h(e=>e.showTerminalQuickKeysOnDesktop),ne=!r()&&(v||te),le=S(e=>e.currentSessionId),ue=S(e=>e.newSessionDraft),j=!!a||le!==null||ue?.open===!0,de=ie()??null??a?.location.directory??null,M=a?i({...a.location,directory:de??a.location.directory}):de,fe=D(e=>e.sessions),P=D(e=>e.hasHydrated),F=D(e=>e.ensureDirectory),pe=D(e=>e.createTab),he=D(e=>e.setActiveTab),ge=D(e=>e.closeTab),_e=O.useMemo(()=>a?async(e,n)=>{await ge(e,n,t.close)}:ge,[a,t,ge]),ve=D(e=>e.setTabSessionId),ye=D(e=>e.setTabLifecycle),I=D(e=>e.setConnecting),be=D(e=>e.appendToBuffer),R=D(e=>e.setTabPreviewUrl),z=D(e=>e.clearBuffer),Ce=h(e=>e.openContextPreview),H=O.useMemo(()=>{if(M)return fe.get(M)},[fe,M]),U=O.useMemo(()=>H?b?H.activeTabId??H.tabs[0]?.id??null:H.tabs[0]?.id??null:null,[H,b]),W=O.useMemo(()=>{if(H)return U?H.tabs.find(e=>e.id===U)??H.tabs[0]:H.tabs[0]},[H,U]),G=O.useMemo(()=>(H?.tabs??[]).map(t=>({icon:(()=>{let e=t.iconKey?ce[t.iconKey]??`terminal`:`terminal`;return(0,A.jsx)(C,{name:e,className:`h-4 w-4`})})(),id:t.id,label:t.shellLog?`Agent Shell`:t.label,title:t.label,closeLabel:e(`terminalView.tabs.closeTabTitle`)})),[H?.tabs,e]),K=W?.terminalSessionId??null,we=W?.shellLog,Te=ne&&!we,Ee=W?.lifecycle??`idle`,De=W?.bufferChunks??[],Oe=W?.isConnecting??!1,ke=W?.previewUrl??null,[Ae,q]=O.useState(null),[je,J]=O.useState(!1),[Me,Y]=O.useState(!1),[X,Z]=O.useState(null),[Ne,Pe]=O.useState(!1),[Fe,Ie]=O.useState(0),Le=O.useRef(null),Re=O.useRef(null),ze=O.useRef(U),Be=O.useRef(K),Ve=O.useRef(M),He=O.useRef(null),Ue=O.useRef(null),We=O.useRef(!1),Ge=O.useRef(!1),Ke=O.useRef(null),qe=O.useRef(null),Je=O.useRef(new Set),Ye=O.useRef(!1),Xe=O.useRef(``),Ze=O.useRef(new Set),Qe=O.useRef(0),$e=O.useCallback(()=>{Xe.current=``,Ze.current.clear(),Qe.current+=1},[]),et=O.useCallback(()=>{y||typeof document<`u`&&!document.hasFocus()||He.current?.focus()},[y]),tt=O.useCallback(()=>{y||He.current?.focus()},[y]);O.useEffect(()=>{if(!P||Ye.current)return;Ye.current=!0;let e=new Set;for(let[,t]of D.getState().sessions.entries())for(let n of t.tabs)n.terminalSessionId&&e.add(n.terminalSessionId);Je.current=e},[P]);let nt=h(e=>e.activeMainTab),rt=h(e=>e.isBottomTerminalOpen),it=h(e=>e.setBottomTerminalOpen),at=h(e=>e.setBottomTerminalExpanded),ot=nt===`terminal`,Q=ot||rt,[st,ct]=O.useState(Q);O.useEffect(()=>{!Q||n.platform===`vscode`||a||g()},[Q,n.platform,a]),O.useEffect(()=>{Q&&ct(!0)},[Q]),O.useEffect(()=>{Ge.current=Q},[Q]),O.useEffect(()=>{Be.current=K},[K]),O.useEffect(()=>{ze.current=U,$e()},[U,$e]),O.useEffect(()=>{Ve.current=M},[M]),O.useEffect(()=>{!Te&&X!==null&&Z(null)},[Te,X,Z]),O.useEffect(()=>{!K&&X!==null&&Z(null)},[K,X,Z]);let $=O.useCallback(()=>{Le.current?.(),Le.current=null,Re.current=null,Ke.current=null,Y(!1)},[]);O.useEffect(()=>()=>{$(),Be.current=null},[$]),O.useEffect(()=>($(),$),[t,$]);let lt=O.useCallback((e,t,n)=>{if(!n)return;let r=`${Xe.current}${n}`.replace(/\r\n|\r/g,`
|
|
4
|
+
`),i=r.split(`
|
|
5
|
+
`),o=r.endsWith(`
|
|
6
|
+
`)?i.join(`
|
|
7
|
+
`):i.slice(0,-1).join(`
|
|
8
|
+
`);if(Xe.current=r.endsWith(`
|
|
9
|
+
`)?``:(i[i.length-1]??``).slice(-1024),!o)return;let s=L(o);if(!s||Ze.current.has(s))return;let c=Qe.current;Ze.current.add(s),(a?se(a,s):xe(s)).then(n=>{if(Ze.current.delete(s),!n||Qe.current!==c)return;let r=D.getState().getDirectoryState(e)?.tabs.find(e=>e.id===t);!r||r.previewUrlLocked||r.previewUrl===s||R(e,t,s,{locked:!1,autoOpened:!1})})},[R,a]),ut=O.useCallback((n,r,i,a=B,o=!1)=>{if(Re.current===i)return;$(),Re.current=i;let s=t.connect(i,{onEvent:a=>{if(Re.current===i)switch(a.type){case`connected`:Ke.current=i,I(n,r,!1),q(null),J(!1),Y(!1),et(),qe.current===i&&(qe.current=null,t.sendInput(i,`\r`).catch(()=>{}));break;case`reconnecting`:q(null),J(!1),Y(!0);break;case`data`:a.data&&(be(n,r,a.data),lt(n,r,a.data));break;case`exit`:{let t=typeof a.exitCode==`number`?a.exitCode:null,i=typeof a.signal==`number`?a.signal:null,o=!!(D.getState().getDirectoryState(n)?.tabs.find(e=>e.id===r))?.label?.startsWith(`Action:`);be(n,r,e(`terminalView.stream.processExitedMessage`,{exitCodeSegment:t===null?``:e(`terminalView.stream.processExitedWithCode`,{exitCode:t}),signalSegment:i===null?``:e(`terminalView.stream.processExitedWithSignal`,{signal:i})})),ye(n,r,`exited`),ve(n,r,null),I(n,r,!1),q(o?null:e(`terminalView.error.sessionEnded`)),J(!1),Y(!1),$();break}}},onError:(t,a)=>{if(Re.current===i){if(!a){q(null),J(!1);return}if(/session not found/i.test(t.message)||o){Y(!1),q(null),J(!1),I(n,r,!0),z(n,r),ye(n,r,`idle`),ve(n,r,null),$();return}Y(!1),q(e(`terminalView.error.connectionFailed`,{message:t.message})),J(!0),I(n,r,!1),z(n,r),ye(n,r,`exited`),ve(n,r,null),$()}}},a);Le.current=()=>{s.close(),Re.current=null}},[be,z,$,et,lt,I,ye,ve,e,t]);O.useEffect(()=>{let n=!1;if(!(!P||!st)){if(!M){q(e(j?`terminalView.empty.noWorkingDirectory`:`terminalView.empty.selectSession`));return}return(async()=>{let r=M;if(!Ve.current||Ve.current!==r)return;F(r);let i=D.getState().getDirectoryState(r);if(!i||i.tabs.length===0)return;let a=b?i.activeTabId??i.tabs[0]?.id??null:i.tabs[0]?.id??null;if(!a)return;let o=i.tabs.find(e=>e.id===a)??i.tabs[0];if(o?.shellLog)return;let s=o?.terminalSessionId??null,c=o?.lifecycle??`idle`,l=!!o?.label?.startsWith(`Action:`),u=(o?.bufferLength??0)>0||(o?.bufferChunks?.length??0)>0;if(s)return;if(c===`exited`){I(r,a,!1);return}if(l&&u){I(r,a,!1);return}let d=Ue.current;if(!(!d&&Ge.current)){q(null),J(!1),Y(!1),I(r,a,!0);try{let e=await t.createSession({cwd:de??``,cols:d?.cols,rows:d?.rows});if(!(!n&&Ve.current===r&&ze.current===a)){try{await t.close(e.sessionId)}catch{}return}if(D.getState().getDirectoryState(r)?.tabs.find(e=>e.id===a)?.terminalSessionId){try{await t.close(e.sessionId)}catch{}return}ve(r,a,e.sessionId)}catch(t){n||(q(t instanceof Error?t.message:e(`terminalView.error.startSessionFailed`)),J(!0),Y(!1),I(r,a,!1))}}})(),()=>{n=!0}}},[j,M,de,K,Ee,U,st,Fe,b,P,F,I,ve,e,t]);let dt=O.useRef(ut);dt.current=ut;let ft=O.useRef($);ft.current=$,O.useEffect(()=>{if(!P||!st)return;if(!M){ft.current();return}let e=M,t=D.getState().getDirectoryState(e);if(!t||t.tabs.length===0){ft.current();return}let n=b?t.activeTabId??t.tabs[0]?.id??null:t.tabs[0]?.id??null;if(!n){ft.current();return}let r=t.tabs.find(e=>e.id===n)??t.tabs[0],i=r?.terminalSessionId??null;if(!i){ft.current(),Be.current=null;return}if(Re.current===i&&Le.current){Be.current=i;return}Be.current=i;let a=Je.current.has(i),o=a&&(r?.bufferLength??0)===0&&(r?.bufferChunks?.length??0)===0;a&&Je.current.delete(i),o&&(qe.current=i),dt.current(e,n,i,a?V:B,a)},[M,K,U,b,st,P,t]),O.useEffect(()=>{if(!Q||y)return;if(typeof window>`u`){et();return}let e=window.requestAnimationFrame(()=>{et()});return()=>{window.cancelAnimationFrame(e)}},[U,et,Q,y]);let pt=O.useCallback(async()=>{if(!M||Ne)return;let t=D.getState().getDirectoryState(M),n=b?U??t?.activeTabId??t?.tabs[0]?.id??null:t?.tabs[0]?.id??null;if(n){Pe(!0),q(null),J(!1),Y(!1),$(),z(M,n),$e();try{await _e(M,n)}catch(t){q(t instanceof Error?t.message:e(`terminalView.error.restartFailed`)),J(!0),Y(!1)}finally{Pe(!1)}}},[U,z,_e,$,M,b,Ne,$e,e]),mt=O.useCallback(async()=>{await pt()},[pt]),ht=O.useCallback(()=>{if(!M)return;let e=pe(M);he(M,e),q(null),J(!1),Y(!1),$()},[pe,$,M,he]),gt=O.useCallback(e=>{M&&(he(M,e),q(null),J(!1),Y(!1),$())},[$,M,he]),_t=O.useCallback(e=>{M&&(e===U&&$(),q(null),J(!1),Y(!1),_e(M,e))},[U,_e,$,M]),vt=O.useCallback(n=>{if(!n||Me)return;let r=n,i=!1;if(X&&n.length>0){let e=n[0];if(e.length===1&&/[a-zA-Z]/.test(e)){let t=e.toUpperCase();(X===`ctrl`||X===`cmd`)&&(r=String.fromCharCode(t.charCodeAt(0)&31),i=!0)}i||=!0}let a=Be.current;!a||Ke.current!==a||(t.sendInput(a,r).catch(t=>{Me||q(t instanceof Error?t.message:e(`terminalView.error.sendInputFailed`))}),i&&(Z(null),tt()))},[X,tt,Me,Z,e,t]),yt=O.useCallback((e,n)=>{let r=Ue.current;if((!r||r.cols!==e||r.rows!==n)&&(Ue.current={cols:e,rows:n}),We.current||(We.current=!0,Ie(e=>e+1)),!Ge.current)return;let i=Be.current;!i||Ke.current!==i||t.resize({sessionId:i,cols:e,rows:n}).catch(()=>{})},[t]),bt=O.useCallback(e=>{Z(t=>t===e?null:e),tt()},[tt,Z]),xt=O.useCallback(e=>{let t=Se(e,X);t&&(vt(t),Z(null),tt())},[X,tt,vt,Z]);O.useEffect(()=>{if(!Te||!X||!K)return;let e=e=>{if(e.repeat)return;let t=e.key;if(!t||t===`Control`||t===`Meta`||t===`Alt`||t===`Shift`)return;let n=t.length===1?t.toLowerCase():t,r=e.code??``,i=r.startsWith(`Key`)&&r.length===4?r.slice(3).toUpperCase():null,a=t.length===1&&/[a-zA-Z]/.test(t)?t.toUpperCase():i,o={Tab:`tab`,Enter:`enter`,ArrowUp:`arrow-up`,ArrowDown:`arrow-down`,ArrowLeft:`arrow-left`,ArrowRight:`arrow-right`,Escape:`esc`,tab:`tab`,enter:`enter`,arrowup:`arrow-up`,arrowdown:`arrow-down`,arrowleft:`arrow-left`,arrowright:`arrow-right`,escape:`esc`};if(n in o){e.preventDefault(),e.stopPropagation(),xt(o[n]);return}if(X===`ctrl`&&a&&a.length===1&&a>=`A`&&a<=`Z`){let t=String.fromCharCode(a.charCodeAt(0)&31);e.preventDefault(),e.stopPropagation(),vt(t),Z(null),tt()}};return window.addEventListener(`keydown`,e),()=>{window.removeEventListener(`keydown`,e)}},[X,xt,vt,tt,Te,Z,K]);let St=O.useMemo(()=>{let e=p[m].stack;if(typeof window>`u`)return(p[s]??p[`system-mono`]).stack;let t=window.getComputedStyle(document.documentElement).getPropertyValue(`--font-family-mono`);return t&&t.trim().length>0?t.trim():(p[s]??p[`system-mono`]).stack??e},[s]),Ct=O.useMemo(()=>k(o),[o]),wt=O.useMemo(()=>`${M??`no-dir`}::${U??`no-tab`}`,[M,U]);if(O.useEffect(()=>{if(!Q||y)return;let e=He.current;if(!e)return;let t=()=>{e.fit()};if(typeof window<`u`){let e=window.requestAnimationFrame(()=>{t(),et()}),n=[220,400].map(e=>window.setTimeout(t,e));return()=>{window.cancelAnimationFrame(e),n.forEach(e=>window.clearTimeout(e))}}t()},[et,Q,y,wt,K]),O.useEffect(()=>{if(y||!Q||!rt)return;let e=He.current;if(!e)return;let t=()=>{e.fit()};if(typeof window<`u`){let e=window.requestAnimationFrame(()=>{t()}),n=[0,80,180,320].map(e=>window.setTimeout(t,e));return()=>{window.cancelAnimationFrame(e),n.forEach(e=>window.clearTimeout(e))}}t()},[l,u,rt,Q,y]),!j)return(0,A.jsx)(`div`,{className:`flex h-full items-center justify-center p-4 text-center text-sm text-muted-foreground`,children:e(`terminalView.empty.selectSession`)});if(!M)return(0,A.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-2 p-4 text-center text-sm text-muted-foreground`,children:[(0,A.jsx)(`p`,{children:e(`terminalView.empty.noWorkingDirectoryForSession`)}),(0,A.jsx)(x,{onClick:pt,size:`sm`,children:e(`terminalView.actions.retry`)})]});let Tt=!K||Oe||Ne||Me,Et=st,Dt=!v&&rt&&!ot,Ot=(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(x,{type:`button`,size:`sm`,variant:`outline`,className:`h-6 px-2 text-xs`,onClick:()=>xt(`esc`),disabled:Tt,children:e(`terminalView.quickKeys.escape`)}),(0,A.jsxs)(x,{type:`button`,size:`sm`,variant:`outline`,className:`h-6 w-9 p-0`,onClick:()=>xt(`tab`),disabled:Tt,children:[(0,A.jsx)(C,{name:`arrow-right`,className:`h-4 w-4`}),(0,A.jsx)(`span`,{className:`sr-only`,children:e(`terminalView.quickKeys.tabAria`)})]}),(0,A.jsxs)(x,{type:`button`,size:`sm`,variant:`chip`,"aria-pressed":X===`ctrl`,className:`h-6 w-9 p-0`,onClick:()=>bt(`ctrl`),disabled:Tt,children:[(0,A.jsx)(`span`,{className:`text-xs font-medium`,children:e(`terminalView.quickKeys.controlLabel`)}),(0,A.jsx)(`span`,{className:`sr-only`,children:e(`terminalView.quickKeys.controlModifierAria`)})]}),(0,A.jsxs)(x,{type:`button`,size:`sm`,variant:`chip`,"aria-pressed":X===`cmd`,className:`h-6 w-9 p-0`,onClick:()=>bt(`cmd`),disabled:Tt,children:[(0,A.jsx)(C,{name:`command`}),(0,A.jsx)(`span`,{className:`sr-only`,children:e(`terminalView.quickKeys.commandModifierAria`)})]}),(0,A.jsxs)(x,{type:`button`,size:`sm`,variant:`outline`,className:`h-6 w-9 p-0`,onClick:()=>xt(`arrow-up`),disabled:Tt,children:[(0,A.jsx)(C,{name:`arrow-up`}),(0,A.jsx)(`span`,{className:`sr-only`,children:e(`terminalView.quickKeys.arrowUpAria`)})]}),(0,A.jsxs)(x,{type:`button`,size:`sm`,variant:`outline`,className:`h-6 w-9 p-0`,onClick:()=>xt(`arrow-left`),disabled:Tt,children:[(0,A.jsx)(C,{name:`arrow-left`}),(0,A.jsx)(`span`,{className:`sr-only`,children:e(`terminalView.quickKeys.arrowLeftAria`)})]}),(0,A.jsxs)(x,{type:`button`,size:`sm`,variant:`outline`,className:`h-6 w-9 p-0`,onClick:()=>xt(`arrow-down`),disabled:Tt,children:[(0,A.jsx)(C,{name:`arrow-down`}),(0,A.jsx)(`span`,{className:`sr-only`,children:e(`terminalView.quickKeys.arrowDownAria`)})]}),(0,A.jsxs)(x,{type:`button`,size:`sm`,variant:`outline`,className:`h-6 w-9 p-0`,onClick:()=>xt(`arrow-right`),disabled:Tt,children:[(0,A.jsx)(C,{name:`arrow-right`}),(0,A.jsx)(`span`,{className:`sr-only`,children:e(`terminalView.quickKeys.arrowRightAria`)})]}),(0,A.jsxs)(x,{type:`button`,size:`sm`,variant:`outline`,className:`h-6 w-9 p-0`,onClick:()=>xt(`enter`),disabled:Tt,children:[(0,A.jsx)(C,{name:`arrow-go-back`}),(0,A.jsx)(`span`,{className:`sr-only`,children:e(`terminalView.quickKeys.enterAria`)})]})]});return(0,A.jsxs)(`div`,{"data-terminal-view":`true`,className:`flex h-full flex-col overflow-hidden bg-[var(--surface-background)]`,children:[(0,A.jsxs)(`div`,{className:ee(`app-region-no-drag sticky top-0 z-20 shrink-0 bg-[var(--surface-background)] text-xs`,v?`px-3 py-1.5`:`pl-3 pr-1.5 py-1`),children:[b&&H?(0,A.jsxs)(`div`,{className:`flex items-center gap-2 pl-1 pr-1`,children:[(0,A.jsx)(`div`,{className:ee(`min-w-0 flex-1`,v?`h-8`:`h-7`),children:(0,A.jsx)(E,{items:G,activeId:U,onSelect:gt,onClose:_t,layoutMode:`scrollable`,variant:`default`,className:`h-full bg-transparent`})}),(0,A.jsx)(x,{type:`button`,size:`xs`,variant:`ghost`,className:ee(`shrink-0`,v?`h-8 w-8 p-0`:`h-7 w-7 p-0`),onClick:ht,title:e(`terminalView.tabs.newTabTitle`),children:(0,A.jsx)(C,{name:`add`,className:`${v?`h-[18px] w-[18px]`:`h-4 w-4`}`})}),(0,A.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1 overflow-visible`,children:[ke?(0,A.jsxs)(x,{type:`button`,size:`xs`,variant:`outline`,className:`h-6 shrink-0 gap-1 px-2`,onClick:()=>{M&&Ce(M,ke)},title:e(`terminalView.preview.openTitle`),children:[(0,A.jsx)(C,{name:`global`,className:`h-3.5 w-3.5 shrink-0`}),(0,A.jsx)(`span`,{className:`whitespace-nowrap`,children:e(`terminalView.preview.open`)})]}):null,Dt?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(x,{type:`button`,size:`xs`,variant:`ghost`,onClick:()=>at(!u),className:ee(`shrink-0 p-0`,d?`h-8 w-8`:`h-7 w-7`),title:e(u?`terminalView.bottomDock.restoreTitle`:`terminalView.bottomDock.expandTitle`),"aria-label":e(u?`terminalView.bottomDock.restoreAria`:`terminalView.bottomDock.expandAria`),children:u?(0,A.jsx)(C,{name:`fullscreen-exit`,className:`h-4 w-4`}):(0,A.jsx)(C,{name:`fullscreen`,className:`h-4 w-4`})}),(0,A.jsx)(x,{type:`button`,size:`xs`,variant:`ghost`,onClick:()=>it(!1),className:ee(`shrink-0 p-0`,d?`h-8 w-8`:`h-7 w-7`),title:e(`terminalView.bottomDock.closeTitle`),"aria-label":e(`terminalView.bottomDock.closeAria`),children:(0,A.jsx)(C,{name:`close`,className:`h-4 w-4`})})]}):null]})]}):null,!d&&Te&&b&&H?(0,A.jsx)(`div`,{className:`mt-2 flex flex-wrap items-center gap-1 pl-1 pr-1`,children:Ot}):null,Te&&(d||!b||!H)?(0,A.jsx)(`div`,{className:`mt-2 flex flex-wrap items-center gap-1`,children:Ot}):null]}),(0,A.jsxs)(`div`,{className:`relative flex-1 overflow-hidden`,style:{backgroundColor:Ct.background},children:[we?Q?(0,A.jsx)(me,{shell:we,theme:Ct,fontFamily:St,fontSize:c},U):null:(0,A.jsx)(`div`,{className:`h-full w-full box-border pl-4 pr-1.5 pt-3 pb-4`,children:Et?(0,A.jsx)(N,{ref:e=>{He.current=e},sessionKey:wt,chunks:De,onInput:vt,onResize:yt,theme:Ct,fontFamily:St,fontSize:c,enableTouchScroll:y,autoFocus:!y&&Q,isVisible:Q},wt):null}),!we&&!Me&&Ae&&(0,A.jsxs)(`div`,{className:`absolute inset-x-0 bottom-0 bg-[var(--status-error-background)] px-3 py-2 text-xs text-[var(--status-error-foreground)] flex items-center justify-between gap-2`,children:[(0,A.jsx)(`span`,{children:Ae}),je&&d&&(0,A.jsx)(x,{size:`sm`,variant:`secondary`,className:`h-6 px-2 py-0 text-xs`,onClick:mt,disabled:Ne,title:e(`terminalView.actions.hardRestartTitle`),type:`button`,children:e(`terminalView.actions.hardRestart`)})]})]})]})};export{Ce as TerminalView};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{c as t}from"./platform-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{c as t}from"./platform-B2ylz14u.js";import{a as n}from"./vendor-zustand-CTekDqaS.js";import{it as r,ot as i,st as a}from"./vendor-base-ui-wXsskyKm.js";import{E as o}from"./runtime-file-resource-BGZ4tGr5.js";import{r as s}from"./vendor-reactuses-core-DjKFMfz7.js";import{a as c,o as l,r as u}from"./useUIStore-68ZPpgYA.js";import{Mt as d,Xn as ee,f,io as p,uo as m}from"./ui-BCYkB585.js";import{t as te}from"./i18n-iu4pzqPi.js";import{n as ne}from"./useEffectiveDirectory-BYswRwIv.js";import{s as h}from"./mobileBackNavigation-CVrR_jtn.js";import{i as g,n as _}from"./shortcuts-DMupfl7l.js";import{a as re,c as v,l as y,s as ie,u as ae}from"./SessionSurfaceContext-BP4NCKp6.js";import{o as oe}from"./useSessionBtwStore-D7P-pknd.js";import{a as se,i as b,r as ce,t as x}from"./nativeComposerCover-5rYz1E3W.js";var S=e(a(),1),le=e(r(),1),C=(e,t)=>{if(!(t in e))return e;let n={...e};return delete n[t],n},w=n(e=>({quotesByKey:{},addQuote:(t,n)=>e(e=>{let r=e.quotesByKey[t]??v,i=y(r,n);return i===r?e:{quotesByKey:{...e.quotesByKey,[t]:i}}}),removeQuote:(t,n)=>e(e=>{let r=e.quotesByKey[t];if(!r||n<0||n>=r.length)return e;let i=r.filter((e,t)=>t!==n);return{quotesByKey:i.length===0?C(e.quotesByKey,t):{...e.quotesByKey,[t]:i}}}),removeLast:t=>e(e=>{let n=e.quotesByKey[t];if(!n||n.length===0)return e;let r=n.slice(0,-1);return{quotesByKey:r.length===0?C(e.quotesByKey,t):{...e.quotesByKey,[t]:r}}}),clear:t=>e(e=>({quotesByKey:C(e.quotesByKey,t)})),restore:(t,n)=>e(e=>n.length===0?{quotesByKey:C(e.quotesByKey,t)}:{quotesByKey:{...e.quotesByKey,[t]:n}})})),T=e=>t=>e?t.quotesByKey[e]??v:v,E=()=>{typeof window>`u`||window.requestAnimationFrame(()=>{document.querySelector(`[data-btw-composer] textarea`)?.focus()})},D=e=>{let t=e.directory??null;d({sessionId:e.sessionId,directory:t})?b(x):u.getState().openContextPanelTab(t??``,{mode:`btw`}),E()},O=e=>{let t=Number.isFinite(e.cssInsetPx)?Math.max(0,e.cssInsetPx):0,n=e.visualHeight,r=n==null||!Number.isFinite(n)?0:Math.max(0,e.innerHeight-n-(e.visualOffsetTop??0));return Math.max(t,r)},k=e=>{let t=Number.parseFloat(e??``);return Number.isFinite(t)?Math.max(0,t):0},A=48,j=88,M=e=>{let t=e.composer;if(t&&t.height>=A&&t.width>=A)return{left:t.left,top:t.top,width:t.width,height:t.height};let n=e.nativeComposerHeightPx>=A?e.nativeComposerHeightPx:e.lastHeightPx>=A?e.lastHeightPx:j,r=Math.max(0,e.keyboardOverlapPx);return{left:0,top:Math.max(0,e.viewportHeight-r-n),width:Math.max(0,e.viewportWidth),height:n}},N=i(),P=8,F=`mod+l`,I=`mod+shift+s`,L=[`⌃`,`⌥`,`⇧`,`⌘`],ue=e=>{let t=g(e).split(` + `);if(!m())return t.join(`+`);let n=t[t.length-1];return[...t.slice(0,-1).sort((e,t)=>L.indexOf(e)-L.indexOf(t)),n].join(``)},de=280,R=()=>{if(typeof document>`u`)return null;let e=null;for(let t of document.querySelectorAll(`.yuri-mobile-composer`)){let n=window.getComputedStyle(t);if(n.display===`none`||n.visibility===`hidden`)continue;let r=t.getBoundingClientRect();r.height<48||r.width<48||r.bottom<0||r.top>window.innerHeight||(!e||r.bottom>e.top+e.height)&&(e={left:r.left,top:r.top,width:r.width,height:r.height})}return e},fe=e=>{let t=document.documentElement,n=window.visualViewport;return M({composer:R(),viewportWidth:window.innerWidth,viewportHeight:window.innerHeight,keyboardOverlapPx:O({cssInsetPx:k(t.style.getPropertyValue(`--yuri-keyboard-inset`)),innerHeight:window.innerHeight,visualHeight:n?.height,visualOffsetTop:n?.offsetTop}),nativeComposerHeightPx:k(t.style.getPropertyValue(h)),lastHeightPx:e})},z=null;l(()=>{typeof window<`u`&&!document.activeElement?.matches(`textarea[data-chat-input="true"]`)&&window.getSelection()?.removeAllRanges(),z?.()});var B=new Set(`address.article.aside.blockquote.dd.div.dl.dt.fieldset.figcaption.figure.footer.form.h1.h2.h3.h4.h5.h6.header.hr.li.main.nav.ol.p.pre.section.table.ul`.split(`.`)),V=e=>e.replace(/\r\n?/g,`
|
|
2
2
|
`),H=e=>V(e).trim(),U=(e,t)=>{if(e.contains(t))return!0;let n=t instanceof ShadowRoot?t:t.getRootNode();return n instanceof ShadowRoot&&e.contains(n.host)},W=e=>{let t=[],n=e=>{for(let r of e.querySelectorAll(`*`))r.shadowRoot&&(t.push(r.shadowRoot),n(r.shadowRoot))};return n(e),t},G=(e,t)=>{let n=W(t),r=e.getComposedRanges?.({shadowRoots:n})[0];if(r){let e=document.createRange();if(e.setStart(r.startContainer,r.startOffset),e.setEnd(r.endContainer,r.endOffset),U(t,e.commonAncestorContainer))return e}if(e.rangeCount===0)return null;let i=e.getRangeAt(0);return U(t,i.commonAncestorContainer)?i:null},K=e=>e.replace(/\s+/g,` `).trim(),q=e=>{if(e.nodeType===Node.TEXT_NODE)return K(e.textContent||``);if(e.nodeType!==Node.ELEMENT_NODE)return``;let t=e,n=t.tagName.toLowerCase(),r=Array.from(t.childNodes).map(e=>q(e)).join(``).replace(/\s+/g,` `).trim();if(!r&&n!==`br`)return``;if(n===`br`)return`
|
|
3
3
|
`;if(n===`strong`||n===`b`)return`**${r}**`;if(n===`em`||n===`i`)return`*${r}*`;if(n===`code`)return`\`${r.replace(/`/g,"\\`")}\``;if(n===`a`){let e=t.getAttribute(`href`);return e?`[${r}](${e})`:r}return r},J=(e,t)=>Array.from(e.children).filter(e=>e instanceof HTMLElement&&e.tagName.toLowerCase()===`li`).map((e,n)=>{let r=t?`${n+1}. `:`- `,i=Array.from(e.childNodes).map(e=>q(e)).join(``).replace(/\s+/g,` `).trim();return i?`${r}${i}`:``}).filter(Boolean).join(`
|
|
4
4
|
`),Y=e=>{if(e.nodeType===Node.TEXT_NODE)return H(e.textContent||``);if(e.nodeType!==Node.ELEMENT_NODE)return``;let t=e,n=t.tagName.toLowerCase();if(n===`pre`){let e=t.querySelector(`code`);return`\`\`\`${((e?.className||``).match(/language-([\w-]+)/)?.[1]||``).trim()}\n${V(e?.textContent||t.textContent||``).replace(/\n$/,``)}\n\`\`\``}if(n===`code`){let e=V(t.textContent||``).trim();return e?`\`${e.replace(/`/g,"\\`")}\``:``}if(n===`ul`)return J(t,!1);if(n===`ol`)return J(t,!0);if(n===`blockquote`)return H(Array.from(t.childNodes).map(e=>Y(e)).join(`
|
|
@@ -8,4 +8,4 @@ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{c as t}from"./platform
|
|
|
8
8
|
|
|
9
9
|
`):H(Array.from(t.childNodes).map(e=>q(e)).join(``))},X=e=>Array.from(e.childNodes).every(e=>{if(e.nodeType===Node.TEXT_NODE||e.nodeType!==Node.ELEMENT_NODE)return!0;let t=e;return!B.has(t.tagName.toLowerCase())}),Z=(e,t)=>{let n=e.cloneContents();if(X(n)){let e=H(Array.from(n.childNodes).map(e=>q(e)).join(``));if(e)return e}return Array.from(n.childNodes).map(e=>Y(e)).filter(e=>e.length>0).join(`
|
|
10
10
|
|
|
11
|
-
`).trim()||H(t)},Q=({containerRef:e})=>{let{t:n}=
|
|
11
|
+
`).trim()||H(t)},Q=({containerRef:e})=>{let{t:n}=te(),[r,i]=S.useState({x:0,y:0,show:!1}),[a,l]=S.useState(``),d=S.useRef(!1),[m,h]=S.useState(!1),g=S.useRef(null),v=S.useRef(de),y=S.useRef(null),b=S.useRef(null),x=S.useRef(null),C=S.useRef(!1),T=S.useRef(0),[E,O]=S.useState(null),k=f(e=>e.currentSessionId),A=ne()??null,j=u(e=>e.isMobile),M=ie(),L=o(),R=L?.entry.location.hostId?L.entry:void 0,B=R?M.sessionId:k,V=re(M).textSelectionMutation,U=M.kind===`primary`&&!!B;S.useEffect(()=>{C.current=r.show},[r.show]);let K=S.useCallback(()=>{y.current=null,z===K&&(z=null),x.current!==null&&(window.clearTimeout(x.current),x.current=null),b.current!==null&&(window.cancelAnimationFrame(b.current),b.current=null),C.current&&=(h(!1),i(e=>({...e,show:!1})),l(``),!1)},[]);S.useLayoutEffect(()=>K,[K]);let q=S.useCallback(e=>{if(typeof window>`u`)return e;let t=window.innerWidth,n=v.current/2,r=P+n,i=t-P-n;return r>i?t/2:Math.min(Math.max(e,r),i)},[]),J=S.useCallback(()=>{if(!y.current)return;z!==K&&(z?.(),z=K);let{markdownText:e,rect:t}=y.current,n=!r.show,a=j?t.left+t.width/2:q(t.left+t.width/2),o=t.top-10;l(e),i({x:a,y:o,show:!0}),C.current=!0,n&&(h(!0),b.current!==null&&window.cancelAnimationFrame(b.current),b.current=window.requestAnimationFrame(()=>{h(!1),b.current=null}))},[q,K,j,r.show]);S.useLayoutEffect(()=>{if(!r.show||j||!g.current)return;let e=g.current.offsetWidth;!Number.isFinite(e)||e<=0||e===v.current||(v.current=e,i(e=>({...e,x:q(e.x)})))},[q,j,r.show]),S.useEffect(()=>{if(!r.show||j)return;let e=()=>{i(e=>({...e,x:q(e.x)}))};return window.addEventListener(`resize`,e),()=>{window.removeEventListener(`resize`,e)}},[q,j,r.show]);let Y=S.useCallback(()=>{let t=window.getSelection(),n=e.current;if(!t||!n){d.current||K();return}let r=H(t.toString());if(!r){d.current||K();return}let i=G(t,n);if(!i){d.current||K();return}let a=i.getBoundingClientRect();y.current={plainText:r,markdownText:Z(i,r),rect:a},d.current||J()},[e,K,J]);S.useEffect(()=>{let t=e.current;if(!t)return;let n=()=>{d.current=!0,K()},r=()=>{d.current=!1,x.current!==null&&window.clearTimeout(x.current);let e=c();x.current=window.setTimeout(()=>{x.current=null,c()===e&&Y()},10)},i=new Set,a=()=>{for(let e of W(t))i.has(e)||(i.add(e),e.addEventListener(`selectionchange`,Y))};a();let o=new MutationObserver(a);o.observe(t,{childList:!0,subtree:!0}),document.addEventListener(`selectionchange`,Y),t.addEventListener(`mousedown`,n),document.addEventListener(`mouseup`,r);let s=e=>{g.current&&!g.current.contains(e.target)&&!window.getSelection()?.toString().trim()&&K()};return document.addEventListener(`mousedown`,s),()=>{x.current!==null&&(window.clearTimeout(x.current),x.current=null),o.disconnect();for(let e of i)e.removeEventListener(`selectionchange`,Y);document.removeEventListener(`selectionchange`,Y),t.removeEventListener(`mousedown`,n),document.removeEventListener(`mouseup`,r),document.removeEventListener(`mousedown`,s)}},[e,Y,K,J]),S.useLayoutEffect(()=>{if(!j||!r.show){T.current=0,O(null);return}let e=se(ce),t=0,n=0,i=()=>{let e=fe(T.current);T.current=e.height,O(t=>t&&t.left===e.left&&t.top===e.top&&t.width===e.width&&t.height===e.height?t:e)},a=e=>{i(),e<n&&(t=window.requestAnimationFrame(a))},o=()=>{n=performance.now()+320,window.cancelAnimationFrame(t),t=window.requestAnimationFrame(a)};i(),o();let s=window.visualViewport;return s?.addEventListener(`resize`,o),s?.addEventListener(`scroll`,o),window.addEventListener(`resize`,o),window.addEventListener(`yuri:keyboard-anim`,o),window.addEventListener(`yuri:keyboard-settled`,o),()=>{window.cancelAnimationFrame(t),s?.removeEventListener(`resize`,o),s?.removeEventListener(`scroll`,o),window.removeEventListener(`resize`,o),window.removeEventListener(`yuri:keyboard-anim`,o),window.removeEventListener(`yuri:keyboard-settled`,o),e()}},[j,r.show]),S.useEffect(()=>{if(!r.show)return;let e=e=>{g.current&&e.target instanceof Node&&g.current.contains(e.target)||K()};return window.addEventListener(`scroll`,e,{capture:!0,passive:!0}),()=>{window.removeEventListener(`scroll`,e,!0)}},[r.show,K]);let X=()=>{K(),window.getSelection()?.removeAllRanges()},Q=s(e=>{if(!e)return;let n=f.getState().newSessionDraft.draftID,r=ae(R&&B?t(R.location,B):B,n);r&&(w.getState().addQuote(r,e),X(),requestAnimationFrame(()=>{Array.from(document.querySelectorAll(`textarea[data-chat-input="true"]`)).find(e=>!e.disabled&&e.getClientRects().length>0&&!e.closest(`[data-btw-composer]`))?.focus({preventScroll:!0})}))}),$=s(e=>{if(!e||!B)return;let t={sessionId:B,directory:R?.location.directory??A,host:R};oe.getState().addQuote(t,e),X(),D(t)});if(S.useEffect(()=>{if(!V)return;let t=t=>{let n=_(t,F),r=U&&_(t,I);if(!n&&!r)return;let i=window.getSelection(),a=e.current;if(!i||!a||!i.toString().trim())return;let o=G(i,a);if(!o)return;t.preventDefault(),t.stopPropagation();let s=Z(o,i.toString());n?Q(s):$(s)};return window.addEventListener(`keydown`,t,!0),()=>window.removeEventListener(`keydown`,t,!0)},[Q,$,U,V,e]),!r.show||!V)return null;let pe=[{id:`chat`,label:n(`chat.textSelection.actions.addToChat`),shortcut:F,run:()=>Q(a)},...U?[{id:`side`,label:n(`chat.textSelection.actions.addToSideChat`),shortcut:I,run:()=>$(a)}]:[]];if(j){let e=E??{left:0,top:Math.max(0,window.innerHeight-88),width:window.innerWidth,height:88};return(0,le.createPortal)((0,N.jsx)(`div`,{ref:g,"data-text-selection-menu":!0,className:p(`fixed z-50 flex items-center justify-center gap-2 bg-background px-4`,`transition-opacity duration-200 ease-out`,m?`opacity-0`:`opacity-100`),style:{left:e.left,top:e.top,width:e.width,height:e.height,paddingBottom:`max(0.75rem, var(--yuri-safe-area-bottom-visual, env(safe-area-inset-bottom, 0px)))`},onPointerDown:e=>{e.preventDefault()},children:pe.map(e=>(0,N.jsx)(ee,{type:`button`,variant:`secondary`,size:`sm`,onClick:e.run,className:`max-w-[11rem] min-w-0`,children:(0,N.jsx)(`span`,{className:`truncate`,children:e.label})},e.id))}),document.body)}return(0,le.createPortal)((0,N.jsx)(`div`,{ref:g,"data-text-selection-menu":!0,className:`fixed z-50`,style:{left:r.x,top:r.y,transform:`translate(-50%, -100%)`},children:(0,N.jsx)(`div`,{className:p(`flex items-center gap-0.5 whitespace-nowrap rounded-lg p-0.5`,`border border-[var(--interactive-border)] bg-[var(--surface-elevated)] shadow-sm`,`transition-[opacity,transform] duration-200 ease-out will-change-[opacity,transform]`,m?`opacity-0 translate-y-[4px]`:`opacity-100 translate-y-0`),children:pe.map((e,t)=>(0,N.jsxs)(S.Fragment,{children:[t>0?(0,N.jsx)(`div`,{className:`h-3 w-px shrink-0 bg-[var(--interactive-border)]`}):null,(0,N.jsxs)(`button`,{type:`button`,onClick:e.run,className:`flex h-6 items-center gap-1.5 rounded-md px-2 typography-meta text-[var(--surface-foreground)] transition-colors duration-150 hover:bg-[var(--interactive-hover)]`,children:[(0,N.jsx)(`span`,{children:e.label}),(0,N.jsx)(`span`,{className:`tracking-[0.08em] text-[var(--surface-muted-foreground)]`,"aria-hidden":`true`,children:ue(e.shortcut)})]})]},e.id))})}),document.body)};export{w as i,D as n,T as r,Q as t};
|