@yuriai/web 0.3.8-beta.14 → 0.3.8-beta.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{AgentAvatar-BSBHv-65.js → AgentAvatar-DrZGU5TL.js} +1 -1
- package/dist/assets/{AgentSelector-DaT_IvwI.js → AgentSelector-D6x-93xO.js} +1 -1
- package/dist/assets/ArchivedSessionsDialog-C-Q7IKD0.js +1 -0
- package/dist/assets/AssistantConversationSurface-C9S2c33z.css +1 -0
- package/dist/assets/AssistantConversationSurface-DNOnoTTE.js +3 -0
- package/dist/assets/{AssistantSessionCard-D4cDykNE.js → AssistantSessionCard-B2nmiy2w.js} +2 -2
- package/dist/assets/{AssistantUnreadBadge-kuD0NRB3.js → AssistantUnreadBadge-CAgjtCiJ.js} +1 -1
- package/dist/assets/{AssistantView-C-UaXYpz.js → AssistantView-yJTsJbIU.js} +1 -1
- package/dist/assets/{AssistantWorkingAvatar-VQGkgNuo.js → AssistantWorkingAvatar-C5PFB26I.js} +1 -1
- package/dist/assets/{AssistantsSettingsPage-D01452ix.js → AssistantsSettingsPage-Cw2GK4ku.js} +1 -1
- package/dist/assets/{BinaryFileFallback-Darn77R4.js → BinaryFileFallback-BGku68Il.js} +1 -1
- package/dist/assets/{BtwPanel-CgSxuUbP.js → BtwPanel-CM97m0W-.js} +1 -1
- package/dist/assets/{BusyDots-CTw2sYb1.js → BusyDots-BfwpONQS.js} +1 -1
- package/dist/assets/ChatContainer-uZMwglI2.js +65 -0
- package/dist/assets/{ChatView-BfrJ1ZTv.js → ChatView-CMjNZnr2.js} +1 -1
- package/dist/assets/{DiagramView-BcD_t3y-.js → DiagramView-B8KyrEfz.js} +1 -1
- package/dist/assets/{DiffView-DyYip1lP.js → DiffView-DpmXkaMB.js} +1 -1
- package/dist/assets/{DiffViewToggle-Da3vQFP9.js → DiffViewToggle-C2OUNYuF.js} +1 -1
- package/dist/assets/{ErrorBoundary-D6SF_urL.js → ErrorBoundary-DPRw2Hb8.js} +1 -1
- package/dist/assets/{FadeInOnReveal-DJrSq3fM.js → FadeInOnReveal-CbsnPxv2.js} +1 -1
- package/dist/assets/{GuiPluginMount-BD0R2vTk.js → GuiPluginMount-a0GlByhj.js} +1 -1
- package/dist/assets/{GuiPluginPage-DGysjIM8.js → GuiPluginPage-CWIqxrTF.js} +1 -1
- package/dist/assets/{GuiPluginSurface-CIbn8VvC.js → GuiPluginSurface-CEJE7Jej.js} +1 -1
- package/dist/assets/{GuiPluginTitlebarItems-BYCWC7Ia.js → GuiPluginTitlebarItems-DzUKXkjc.js} +1 -1
- package/dist/assets/{GuiPluginWindow-cCmvyMMm.js → GuiPluginWindow-D-YAzycZ.js} +1 -1
- package/dist/assets/{Icon-DrsaL1yC.js → Icon-BUHzyKnj.js} +1 -1
- package/dist/assets/{ImageLoadingPlaceholder-Br3hw4E6.js → ImageLoadingPlaceholder-C-g4U5hR.js} +1 -1
- package/dist/assets/{LoadingImage-BBQSz8J1.js → LoadingImage-B0wwLqli.js} +1 -1
- package/dist/assets/{MarkdownRenderer-CGgHX4n3.js → MarkdownRenderer-Cr-3HunB.js} +2 -2
- package/dist/assets/{MarkdownRendererImpl-CiuncbTc.js → MarkdownRendererImpl-DnWMM_aX.js} +1 -1
- package/dist/assets/{MarkstreamRendererImpl-DT9tgQ6L.js → MarkstreamRendererImpl-DpY69J2T.js} +1 -1
- package/dist/assets/{MobileAssistantSettingsPage-DIilwadN.js → MobileAssistantSettingsPage-BDvEr-7Z.js} +1 -1
- package/dist/assets/{MobileAssistantTab-CTyT31et.js → MobileAssistantTab-Cko8n9EA.js} +1 -1
- package/dist/assets/{MobileBtwPage-Buz1Kf7W.js → MobileBtwPage-DvXj1534.js} +1 -1
- package/dist/assets/{MobileChangesSurface-DsnPRa6f.js → MobileChangesSurface-Bs91NGZz.js} +1 -1
- package/dist/assets/{MobileChatScreen-DRNBeviQ.js → MobileChatScreen-BCwCAJoA.js} +1 -1
- package/dist/assets/{MobileDetailNavigation-_0qkfML1.js → MobileDetailNavigation-Bgns21JD.js} +1 -1
- package/dist/assets/{MobileFilesSurface-CKHljNp8.js → MobileFilesSurface-CKnb4sMb.js} +2 -2
- package/dist/assets/{MobileHtmlNetworkBoundary-BMTmOSuT.js → MobileHtmlNetworkBoundary-uqjb6Mla.js} +2 -2
- package/dist/assets/{MobileOverlayPanel-cwgcgCxI.js → MobileOverlayPanel-DiSPQ_Ds.js} +1 -1
- package/dist/assets/{MobileResizableSheet-DKpNzqfc.js → MobileResizableSheet-CTVXT44f.js} +1 -1
- package/dist/assets/{MobileSettingsTab-BQnzgATX.js → MobileSettingsTab-BX9NpdML.js} +1 -1
- package/dist/assets/{MobileShareBridge-1O5JUriq.js → MobileShareBridge-XOWIghHm.js} +1 -1
- package/dist/assets/{MobileSurface-nz7712mA.js → MobileSurface-CSgwDfWV.js} +1 -1
- package/dist/assets/{MobileTabPageHeader-B0_vB3Tg.js → MobileTabPageHeader-BhCUjFE_.js} +1 -1
- package/dist/assets/{ModelLogo-CwKqpjSR.js → ModelLogo-NNl7OHLT.js} +1 -1
- package/dist/assets/{ModelSelector-C0LV5Vo7.js → ModelSelector-DQdCn2b7.js} +1 -1
- package/dist/assets/{MultiRunWindow-C0muk8Ec.js → MultiRunWindow-D4LkgbX5.js} +1 -1
- package/dist/assets/{OnboardingScreen-T4NAO5Nc.js → OnboardingScreen-DvRHPlCp.js} +1 -1
- package/dist/assets/{OverlayScrollbar-CZ86VwiO.js → OverlayScrollbar-DhCgiS2Z.js} +1 -1
- package/dist/assets/{PierreDiffViewer-0MHiuNI_.js → PierreDiffViewer-D41Qra1m.js} +1 -1
- package/dist/assets/ProjectSettingsPanel-BCB8uMLe.js +2 -0
- package/dist/assets/{ProviderLogo-BRhDuhtX.js → ProviderLogo-oCOoqwHl.js} +1 -1
- package/dist/assets/{RemoteAssistantSessionCard-BAbf5uBX.js → RemoteAssistantSessionCard-xNxKMyYj.js} +1 -1
- package/dist/assets/{RemoteDesktopPanel-vKqD4HzW.js → RemoteDesktopPanel-epeXSiEK.js} +1 -1
- package/dist/assets/ScheduledTasksDialog-CjD_d4Mg.js +3 -0
- package/dist/assets/{ScrollableOverlay-CFjKY4OJ.js → ScrollableOverlay-BqOsMuIW.js} +1 -1
- package/dist/assets/{SettingsGroup-5yNRBDTj.js → SettingsGroup-DOaDdTNM.js} +1 -1
- package/dist/assets/{SettingsView-4rxkTHGv.js → SettingsView-BXBFTsek.js} +12 -12
- package/dist/assets/{SettingsWindow-D5JUctj6.js → SettingsWindow-CRSH_XPR.js} +1 -1
- package/dist/assets/{SetupTourDialog-Bp8wlcPT.js → SetupTourDialog-DaYKYPQf.js} +1 -1
- package/dist/assets/{SyncActions-DiGfo7cp.js → SyncActions-C1oPXB4Y.js} +1 -1
- package/dist/assets/TerminalView-DlWCt09v.js +9 -0
- package/dist/assets/{TextSelectionMenu-DcQCHZnp.js → TextSelectionMenu-Dt5sL7-Z.js} +1 -1
- package/dist/assets/{ToolOutputDialog-D_Kl-Bc5.js → ToolOutputDialog-C0nc9IV3.js} +5 -5
- package/dist/assets/{YuriLogo-CcVNX93s.js → YuriLogo-JAwGFlRv.js} +1 -1
- package/dist/assets/{assistantMessagePreview-a6gzdseQ.js → assistantMessagePreview-DWC6UVyn.js} +1 -1
- package/dist/assets/{assistantQueries-6GJP0jCO.js → assistantQueries-Bgxhg5pZ.js} +1 -1
- package/dist/assets/{auto-read-context-Dov0luVf.js → auto-read-context-Bk1mCpDV.js} +1 -1
- package/dist/assets/{capgoAdapter-CVPNGTnk.js → capgoAdapter-BoD0Rn9k.js} +1 -1
- package/dist/assets/{card-DjqjGN8X.js → card-CnJNUKRc.js} +1 -1
- package/dist/assets/{chatUpwardIntent-uWd0ddoK.js → chatUpwardIntent-VIpGQNvT.js} +1 -1
- package/dist/assets/{checkbox-BIU2MT0K.js → checkbox-Bk8-0KZQ.js} +1 -1
- package/dist/assets/{collapsible-B2X0QDoQ.js → collapsible-C5tnXbXB.js} +1 -1
- package/dist/assets/{connection-hint-Ca1b_CjA.js → connection-hint-C48bNniv.js} +1 -1
- package/dist/assets/{context-menu-C-FLHb_6.js → context-menu-CFyL4DQd.js} +1 -1
- package/dist/assets/{diagram-CJeSxjCC.js → diagram-CiQzMXnl.js} +1 -1
- package/dist/assets/{dialog-DnZWrDDM.js → dialog-C1xZ7qi4.js} +1 -1
- package/dist/assets/{dropdown-menu-CZWYeFpO.js → dropdown-menu-9VcdFkMY.js} +1 -1
- package/dist/assets/es-BEjOp002.js +15 -0
- package/dist/assets/{fileMentionAutocompleteState-B9411b4o.js → fileMentionAutocompleteState-CEwRZk1h.js} +1 -1
- package/dist/assets/{fileMentionTouchSelection-Bwr_ZfU3.js → fileMentionTouchSelection-CzP2ohnN.js} +1 -1
- package/dist/assets/{fileReferenceActions-KSYTdo_6.js → fileReferenceActions-BpqKMP6J.js} +1 -1
- package/dist/assets/{fr-BoFSg4oh.js → fr-DpO_m9TK.js} +2 -2
- package/dist/assets/{gitApi-CT9_Fyh4.js → gitApi-DjtVUPlT.js} +1 -1
- package/dist/assets/{gitApiHttp-Cx9rEFyN.js → gitApiHttp-CStyHJBc.js} +2 -2
- package/dist/assets/{i18n-BZ_vx76q.js → i18n-CJn52oz0.js} +1 -1
- package/dist/assets/{icons-B6gke_oc.js → icons-Dy_xbx4O.js} +1 -1
- package/dist/assets/{input-DSY3Mg4G.js → input-DXdhngzo.js} +1 -1
- package/dist/assets/{insertionBoundaries-C1ACCndo.js → insertionBoundaries-BRqBLgMY.js} +1 -1
- package/dist/assets/{ja-DmxgfcWg.js → ja-0nVMWVFA.js} +2 -2
- package/dist/assets/{kbd-U9NdVaVr.js → kbd-C_ERslx0.js} +1 -1
- package/dist/assets/{ko-DH3El5QZ.js → ko-B17Bm_ms.js} +2 -2
- package/dist/assets/main--h-KJbB4.js +169 -0
- package/dist/assets/main-DIHvURq9.js +2 -0
- package/dist/assets/{markdownHeightCache-BhpqKZQB.js → markdownHeightCache-DwMwTsag.js} +1 -1
- package/dist/assets/{mcpQueries-BInByFPg.js → mcpQueries-B5a60zt5.js} +1 -1
- package/dist/assets/miniChat-ByVMduTe.js +2 -0
- package/dist/assets/mobile-B_lhvL6h.js +2 -0
- package/dist/assets/{mobileBackNavigation-CUoYXnE0.js → mobileBackNavigation-Br4xDLTP.js} +1 -1
- package/dist/assets/{mobileConnections-DDPYhrR6.js → mobileConnections-CHYr70nO.js} +2 -2
- package/dist/assets/{multirun-h_L8IaS5.js → multirun-DHceRpGb.js} +1 -1
- package/dist/assets/{native-config-DJLqkXGY.js → native-config-CUl4EJwt.js} +1 -1
- package/dist/assets/{nativeComposerCover-Cnky140u.js → nativeComposerCover-sATsn8i9.js} +1 -1
- package/dist/assets/{navigation-b6ZJiTeF.js → navigation-ihRiR3Ol.js} +1 -1
- package/dist/assets/{openRemoteProjectSession-C85euMiR.js → openRemoteProjectSession-4G0Mp1ns.js} +1 -1
- package/dist/assets/{openSessionFromDeepLink-CDs-skAS.js → openSessionFromDeepLink-B3BzCo20.js} +2 -2
- package/dist/assets/{pl-CD38psJG.js → pl-CDqj2zfd.js} +2 -2
- package/dist/assets/{pluginPresentation-upXqjrId.js → pluginPresentation-Cw-C09Hc.js} +1 -1
- package/dist/assets/{pt-BR-DBB59YTx.js → pt-BR-BXJe1xYL.js} +2 -2
- package/dist/assets/{pwa-BSv0q2V7.js → pwa-Djnoay3N.js} +1 -1
- package/dist/assets/{queue-abort-optimistic-CkmS8yTs.js → queue-abort-optimistic-CpPpvdxn.js} +1 -1
- package/dist/assets/{quota-BFl8FaMm.js → quota-W4rU9QuH.js} +1 -1
- package/dist/assets/{reference-history-BfwrDjks.js → reference-history-qVIiJFY6.js} +1 -1
- package/dist/assets/remoteProjectQueries-CopzDHZe.js +1 -0
- package/dist/assets/{remoteSessionReference-DRv5U8a9.js → remoteSessionReference-9anx54fV.js} +1 -1
- package/dist/assets/{renderElectronMiniChatApp-YbsPMg7E.js → renderElectronMiniChatApp-EDpvGixT.js} +2 -2
- package/dist/assets/{renderMobileApp-QD_41cfk.js → renderMobileApp-CRTFdfsV.js} +5 -5
- package/dist/assets/{runtimeConfig-BT-o1J3r.js → runtimeConfig-D1vp1jXa.js} +1 -1
- package/dist/assets/runtimeEndpointReset-D3PK9OY3.js +4 -0
- package/dist/assets/{scheduledTaskNavigation-SCU3wxYg.js → scheduledTaskNavigation-BfgxRBkZ.js} +1 -1
- package/dist/assets/{select-DNrc5_kl.js → select-ByWzzgfq.js} +1 -1
- package/dist/assets/{sessionLookup-DNi6Sfyx.js → sessionLookup-BCD7xQ0s.js} +1 -1
- package/dist/assets/shortcuts-BIwHgZl-.js +1 -0
- package/dist/assets/{sortable-tabs-strip-DqPiLPN2.js → sortable-tabs-strip-BTww8YS1.js} +1 -1
- package/dist/assets/spacedFileMention-DfI79AYT.js +1 -0
- package/dist/assets/{speechSettingsQueries-CVATB1QU.js → speechSettingsQueries-BaFoYcSY.js} +1 -1
- package/dist/assets/{store-1zpYqZEm.js → store-BUNov-dS.js} +4 -4
- package/dist/assets/{switch-COh9mZOL.js → switch-nBnRBAW3.js} +1 -1
- package/dist/assets/{terminalApi-Cs8T3taw.js → terminalApi-Cg9eNRXp.js} +1 -1
- package/dist/assets/{textarea-DnOdSgZM.js → textarea-DbKqSgXl.js} +1 -1
- package/dist/assets/{timeFormat-ZGJSZlGk.js → timeFormat-jyRFc3TA.js} +1 -1
- package/dist/assets/{tooltip-wFf92wqJ.js → tooltip-KqYXHoiE.js} +1 -1
- package/dist/assets/{truncated-path-CNuLLJYq.js → truncated-path-BVONNNs1.js} +1 -1
- package/dist/assets/{types-C4KUivVG.js → types-CuAxZ5HG.js} +1 -1
- package/dist/assets/ui-gH75_gWj.js +13 -0
- package/dist/assets/{uk-Cvg8_R2n.js → uk-B5z71t0I.js} +2 -2
- package/dist/assets/useAppFontEffects-TjnIqwlI.js +7 -0
- package/dist/assets/{useAssistantUIStore-jd_I1qR9.js → useAssistantUIStore-D_7_VmeY.js} +1 -1
- package/dist/assets/{useDesktopWindowControlsLayout-DJTBs9Ai.js → useDesktopWindowControlsLayout-pEDvGCAI.js} +1 -1
- package/dist/assets/{useDictation-Dw4cPz-9.js → useDictation-CtI9i0nb.js} +1 -1
- package/dist/assets/{useEffectiveDirectory-DleT4CpD.js → useEffectiveDirectory-DO47kx8J.js} +1 -1
- package/dist/assets/{useFontPreferences-D8ajsrAw.js → useFontPreferences-C_U0TdQZ.js} +1 -1
- package/dist/assets/{useGitStore-DTlP-L0a.js → useGitStore-DdWKLUCb.js} +1 -1
- package/dist/assets/{useInlineCommentDraftStore-Wde2bT5p.js → useInlineCommentDraftStore-BhYBTBtT.js} +1 -1
- package/dist/assets/useMcpConfigStore-DeBLHEln.js +1 -0
- package/dist/assets/{useMobileSwipeActions-k7KGPpqM.js → useMobileSwipeActions-Ksa_CkbQ.js} +1 -1
- package/dist/assets/{useMobileTranscriptSyncHint-BLI4fy8Q.js → useMobileTranscriptSyncHint-i3zhVIUh.js} +1 -1
- package/dist/assets/{useModelLists-DUsn2kaq.js → useModelLists-7_E2T5ev.js} +1 -1
- package/dist/assets/{useOpenCodeReadiness-Bxz72dNZ.js → useOpenCodeReadiness-JFbJk0Mg.js} +1 -1
- package/dist/assets/{usePluginsStore-DzweL9M8.js → usePluginsStore-DP3gcI-s.js} +1 -1
- package/dist/assets/{useProjectGitActions-BPlLnhmx.js → useProjectGitActions-C25uO6_j.js} +1 -1
- package/dist/assets/{useProjectGitStore-EZRP6D6M.js → useProjectGitStore-BYfY7A74.js} +1 -1
- package/dist/assets/{useProjectRuntimeAPIs-Cbt-c1SP.js → useProjectRuntimeAPIs-DGVmHgCx.js} +1 -1
- package/dist/assets/{useQuotaStore-cFgc-IG2.js → useQuotaStore-CYSImtuE.js} +1 -1
- package/dist/assets/{useSessionBtwStore-DjwWijyt.js → useSessionBtwStore-kbteXiWK.js} +1 -1
- package/dist/assets/{useStreamingTextThrottle-B8aWuwgs.js → useStreamingTextThrottle-Cv2XQjeg.js} +1 -1
- package/dist/assets/{useTerminalStore-BEY9gQzc.js → useTerminalStore-BRbNqUvc.js} +1 -1
- package/dist/assets/useUIStore-1DE4XJOx.js +1 -0
- package/dist/assets/{worktreeManager-BbQ4inHD.js → worktreeManager-DDEk6-Rl.js} +1 -1
- package/dist/assets/{worktreeSourceBranchPreference-7Id37MxY.js → worktreeSourceBranchPreference-DLhyD194.js} +1 -1
- package/dist/assets/{zh-CN-B6Gc3wZh.js → zh-CN-D4vLeHqe.js} +2 -2
- package/dist/assets/zh-TW-DPqnNQKu.js +15 -0
- package/dist/index.html +8 -8
- package/dist/mini-chat.html +8 -8
- package/dist/mobile.html +1 -1
- package/package.json +1 -1
- package/server/index.js +1 -0
- package/server/lib/assistants/DOCUMENTATION.md +10 -2
- package/server/lib/assistants/builtin-skills.js +4 -4
- package/server/lib/assistants/builtin-skills.test.js +7 -4
- package/server/lib/assistants/harness.js +2 -1
- package/server/lib/assistants/remote-execution.test.js +60 -1
- package/server/lib/assistants/service.js +1 -0
- package/server/lib/assistants/yuri-tools.js +42 -6
- package/server/lib/gui-customization/DOCUMENTATION.md +13 -6
- package/server/lib/gui-customization/projects-client.mjs +5 -3
- package/server/lib/gui-customization/projects.js +16 -4
- package/server/lib/gui-customization/projects.test.js +38 -2
- package/server/lib/gui-customization/session-skill.js +3 -3
- package/server/lib/gui-customization/session-skill.test.js +9 -7
- package/server/lib/gui-customization/skill/SKILL.md +22 -13
- package/server/lib/gui-customization/skill/references/projects.md +16 -2
- package/server/lib/opencode/feature-routes-runtime.js +6 -2
- package/server/lib/opencode/session-directory-runtime.js +5 -1
- package/server/lib/opencode/session-directory-runtime.test.js +39 -0
- package/server/lib/projects/DOCUMENTATION.md +4 -3
- package/server/lib/projects/registry.js +12 -1
- package/server/lib/remote-hosts/DOCUMENTATION.md +5 -1
- package/server/lib/remote-hosts/gateway.js +21 -0
- package/server/lib/remote-hosts/routes.js +44 -0
- package/server/lib/remote-hosts/routes.test.js +48 -0
- package/server/lib/scheduled-tasks/session-skill.test.js +9 -3
- package/server/lib/session-index/DOCUMENTATION.md +6 -2
- package/server/lib/session-index/sync-runtime.js +117 -89
- package/dist/assets/ArchivedSessionsDialog-C3Yn2T92.js +0 -1
- package/dist/assets/AssistantConversationSurface-B59k-lXE.css +0 -1
- package/dist/assets/AssistantConversationSurface-BnoGpvaw.js +0 -3
- package/dist/assets/ChatContainer-DQ2aAjYQ.js +0 -65
- package/dist/assets/ScheduledTasksDialog-BMoHLXYW.js +0 -3
- package/dist/assets/TerminalView-BwradFZm.js +0 -9
- package/dist/assets/es-Dl_f-VoR.js +0 -15
- package/dist/assets/main-Bd77IVQE.js +0 -2
- package/dist/assets/main-HeMyVqAF.js +0 -169
- package/dist/assets/miniChat-Brvg2KsE.js +0 -2
- package/dist/assets/mobile-BOuoV895.js +0 -2
- package/dist/assets/remoteProjectQueries-DFbTE2e2.js +0 -1
- package/dist/assets/runtimeEndpointReset-CltKCEAq.js +0 -4
- package/dist/assets/sessionOwnership-B4NyrdiS.js +0 -2
- package/dist/assets/shortcuts-B0XmqH9X.js +0 -1
- package/dist/assets/spacedFileMention-Ds4GtgiF.js +0 -1
- package/dist/assets/ui-BPOP32rM.js +0 -13
- package/dist/assets/useAppFontEffects-BxzLAPb0.js +0 -7
- package/dist/assets/useMcpConfigStore-CQCdt0vJ.js +0 -1
- package/dist/assets/useUIStore-CxX_u4P7.js +0 -1
- package/dist/assets/zh-TW-C2bT0lOZ.js +0 -15
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import{n as e,r as t}from"./rolldown-runtime-hePW80VL.js";import{T as n,t as r,v as i,y as a}from"./runtime-auth-CyWl56mL.js";import{c as o,i as s}from"./runtime-switch-CSXCC6XM.js";import{n as c}from"./runtime-fetch-ykYB0sSi.js";import{n as l,z as u}from"./platform-BQipzOYw.js";import{t as d}from"./runtimeAPIRegistry-C2VogTny.js";import{it as f,ot as p,st as m}from"./vendor-base-ui-wXsskyKm.js";import{n as h}from"./vendor-react-BkccXcWz.js";import{s as g}from"./vendor-tanstack-react-query-DIb_ItL-.js";import{E as _,c as v,f as y,o as b,s as x}from"./runtime-file-resource-DDGMqGyv.js";import{r as S}from"./vendor-reactuses-core-DjKFMfz7.js";import{a as C,n as w}from"./vendor-aparajita-capacitor-secure-storage-xol_6BsB.js";import{S as T,x as E}from"./useUIStore-CxX_u4P7.js";import{n as D,t as O}from"./runtime-file-download-Cb3-EjAg.js";import{n as k,t as A}from"./vendor-pierre-diffs-B0OmIhMO.js";import{Xn as j,io as M}from"./ui-BPOP32rM.js";import{n as N}from"./Icon-DrsaL1yC.js";import{t as P}from"./i18n-BZ_vx76q.js";import{a as F,n as I,r as L}from"./toolHelpers-iEHVHQ9p.js";import{l as R,o as ee,s as te,u as ne}from"./vendor-framer-motion-D5NyyC73.js";import{t as z}from"./MobileWindowStack-DGLdgoGr.js";import{t as re}from"./vendor-tanstack-react-virtual-qsd3nvZb.js";import{n as ie,t as ae}from"./dialog-DnZWrDDM.js";import{t as oe}from"./tap-LkQum5bB.js";import{n as se,t as ce}from"./useThemeSystem-BIXghnHj.js";import{t as B}from"./appThemeRegistry-BdjrGBQ4.js";import{r as le}from"./themes-BgDJcxRc.js";import{n as ue}from"./useEffectiveDirectory-DleT4CpD.js";import{n as de}from"./mobileBackNavigation-CUoYXnE0.js";import{t as fe}from"./ImageLoadingPlaceholder-Br3hw4E6.js";import{n as V,r as pe}from"./MarkdownRenderer-CGgHX4n3.js";import{a as H,c as me,i as U,o as W}from"./imageSource-q3O_Nkg5.js";import{n as G}from"./markdownTheme-D84XyNiT.js";import{n as K,t as he}from"./markdown-worker-oBGEB9Eg.js";import{t as ge}from"./DiffViewToggle-Da3vQFP9.js";import{t as _e}from"./touch-gestures-DOoBxhz5.js";var q=t(m(),1),J=h(),Y=p(),X=e=>e===`in_progress`||e===`completed`||e===`cancelled`?e:`pending`,Z=e=>e.status===`completed`||e.status===`cancelled`,ve={in_progress:`chat.statusRow.todo.status.inProgress`,pending:`chat.statusRow.todo.status.pending`,completed:`chat.statusRow.todo.status.completed`,cancelled:`chat.statusRow.todo.status.cancelled`},ye={in_progress:`text-foreground`,pending:`text-muted-foreground/60`,completed:`text-muted-foreground`,cancelled:`text-muted-foreground/60`},be={in_progress:`text-foreground`,pending:`text-muted-foreground`,completed:`text-muted-foreground/60 line-through decoration-1`,cancelled:`text-muted-foreground/60 line-through decoration-1`},xe=1.2,Se=24,Ce=`1 1`,we=e=>{let t=(0,J.c)(23),{status:n,className:r}=e,{t:i}=P(),a=ve[n],o;t[0]!==i||t[1]!==a?(o=i(a),t[0]=i,t[1]=a,t[2]=o):o=t[2];let s=ye[n],c;t[3]!==r||t[4]!==s?(c=M(`size-[1em] shrink-0 transition-colors duration-300`,s,r),t[3]=r,t[4]=s,t[5]=c):c=t[5];let l=n===`pending`?xe:void 0,u=n===`pending`?Se:void 0,d=n===`pending`?Ce:void 0,f;t[6]!==l||t[7]!==u||t[8]!==d?(f=(0,Y.jsx)(`circle`,{cx:`8`,cy:`8`,r:`6.5`,stroke:`currentColor`,strokeWidth:l,pathLength:u,strokeDasharray:d}),t[6]=l,t[7]=u,t[8]=d,t[9]=f):f=t[9];let p;t[10]===n?p=t[11]:(p=n===`in_progress`?(0,Y.jsx)(`path`,{d:`M4.8 8h6.4M8.6 5.4 11.2 8l-2.6 2.6`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`}):null,t[10]=n,t[11]=p);let m;t[12]===n?m=t[13]:(m=n===`completed`?(0,Y.jsx)(`path`,{d:`M5 8 7.5 11 11 5.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`}):null,t[12]=n,t[13]=m);let h;t[14]===n?h=t[15]:(h=n===`cancelled`?(0,Y.jsx)(`path`,{d:`M3.5 12.5 12.5 3.5`,stroke:`currentColor`}):null,t[14]=n,t[15]=h);let g;return t[16]!==m||t[17]!==h||t[18]!==o||t[19]!==c||t[20]!==f||t[21]!==p?(g=(0,Y.jsxs)(`svg`,{viewBox:`0 0 16 16`,fill:`none`,role:`img`,"aria-label":o,className:c,children:[f,p,m,h]}),t[16]=m,t[17]=h,t[18]=o,t[19]=c,t[20]=f,t[21]=p,t[22]=g):g=t[22],g},Te=3.2,Ee=e=>{let t=Math.PI*2*e,n=8+Te*Math.sin(t),r=8-Te*Math.cos(t);return`M8 8 L8 4.8 A${Te} ${Te} 0 ${+(e>.5)} 1 ${n.toFixed(3)} ${r.toFixed(3)} Z`},De=e=>{let t=(0,J.c)(11),{done:n,total:r,spinning:i,className:a}=e,o=n===void 0?0:n,s=r===void 0?0:r,c=i!==void 0&&i,l=s>0?Math.min(1,o/s):0,u;t[0]===a?u=t[1]:(u=M(`size-[1.15em] shrink-0 text-foreground`,a),t[0]=a,t[1]=u);let d=c?`yuri-todo-spin`:void 0,f;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(f={transformBox:`fill-box`,transformOrigin:`center`},t[2]=f):f=t[2];let p;t[3]===d?p=t[4]:(p=(0,Y.jsx)(`circle`,{cx:`8`,cy:`8`,r:`6.5`,stroke:`currentColor`,strokeWidth:xe,pathLength:Se,strokeDasharray:Ce,className:d,style:f}),t[3]=d,t[4]=p);let m;t[5]===l?m=t[6]:(m=l>0?(0,Y.jsx)(`path`,{d:Ee(l),fill:`currentColor`,className:`transition-opacity duration-300`}):null,t[5]=l,t[6]=m);let h;return t[7]!==u||t[8]!==p||t[9]!==m?(h=(0,Y.jsxs)(`svg`,{viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":`true`,className:u,children:[p,m]}),t[7]=u,t[8]=p,t[9]=m,t[10]=h):h=t[10],h},Oe=({done:e,total:t,className:n,animate:r=!0})=>{let i=q.useRef(e),a=r&&i.current!==e;return q.useEffect(()=>{i.current=e},[e]),(0,Y.jsxs)(`span`,{className:M(`shrink-0 tabular-nums`,n),children:[(0,Y.jsx)(`span`,{className:M(a&&`yuri-todo-count-tick`),children:e},e),`/${t}`]})},ke=e=>{let t=(0,J.c)(5),{className:n}=e,r;t[0]===n?r=t[1]:(r=M(`flex size-[1.15em] shrink-0 items-center justify-center rounded-full bg-[var(--status-success)] text-[var(--status-success-foreground)]`,n),t[0]=n,t[1]=r);let i;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Y.jsx)(`svg`,{viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":`true`,className:`size-[70%]`,children:(0,Y.jsx)(`path`,{d:`M4.5 8.2 7 10.8 11.5 5.5`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`})}),t[2]=i):i=t[2];let a;return t[3]===r?a=t[4]:(a=(0,Y.jsx)(`span`,{"data-todo-complete":!0,className:r,children:i}),t[3]=r,t[4]=a),a},Ae=e=>{let t=(0,J.c)(27),{todos:n,isWorking:r,animate:i,className:a,rowClassName:o,listRef:s,id:c}=e,l=r!==void 0&&r,u=i!==void 0&&i,{t:d}=P(),f=n.findIndex(je),p;t[0]!==f||t[1]!==n?(p=f>=0?f:n.findIndex(Me),t[0]=f,t[1]=n,t[2]=p):p=t[2];let m=p,h;t[3]===n?h=t[4]:(h=n.some(Ne),t[3]=n,t[4]=h);let g=h,_;t[5]===a?_=t[6]:(_=M(`m-0 flex min-w-0 list-none flex-col gap-[0.125em] p-0`,a),t[5]=a,t[6]=_);let v;if(t[7]!==m||t[8]!==u||t[9]!==g||t[10]!==l||t[11]!==o||t[12]!==d||t[13]!==n){let e;t[15]!==m||t[16]!==u||t[17]!==g||t[18]!==l||t[19]!==o||t[20]!==d?(e=(e,t)=>{let n=X(e.status),r=l&&!g&&t===m&&n===`pending`?`in_progress`:n;return(0,Y.jsxs)(`li`,{"data-status":r,"aria-current":t===m?`step`:void 0,className:M(`grid min-w-0 shrink-0 grid-cols-[auto_minmax(0,1fr)] items-start py-[0.25em]`,o??`gap-[0.6em] px-[0.5em]`,u&&`yuri-todo-row-in`),children:[(0,Y.jsx)(`span`,{className:M(`flex h-[1.32em] w-[1.15em] items-center justify-center`,u&&`yuri-todo-icon-pop`),title:d(ve[r]),children:(0,Y.jsx)(we,{status:r})},r),(0,Y.jsx)(`span`,{dir:`auto`,title:e.content,className:M(`line-clamp-3 min-w-0 whitespace-normal text-[0.88em] break-words leading-[1.5] transition-colors duration-300`,be[r]),children:(0,Y.jsx)(`span`,{className:M(r===`in_progress`&&`animate-text-shimmer`),children:e.content})})]},e.id??`${t}:${e.content}`)},t[15]=m,t[16]=u,t[17]=g,t[18]=l,t[19]=o,t[20]=d,t[21]=e):e=t[21],v=n.map(e),t[7]=m,t[8]=u,t[9]=g,t[10]=l,t[11]=o,t[12]=d,t[13]=n,t[14]=v}else v=t[14];let y;return t[22]!==c||t[23]!==s||t[24]!==_||t[25]!==v?(y=(0,Y.jsx)(`ul`,{id:c,ref:s,className:_,children:v}),t[22]=c,t[23]=s,t[24]=_,t[25]=v,t[26]=y):y=t[26],y};function je(e){return e.status===`in_progress`}function Me(e){return e.status===`pending`}function Ne(e){return e.status===`in_progress`}var Pe=e=>e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`),Fe=e=>e?Object.entries(e).map(([e,t])=>t==null?``:`${e.startsWith(`--`)?e:e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}:${typeof t==`number`?`${t}px`:t};`).join(``):``,Ie=(e,t,n)=>{let r=e.querySelector(`pre`);r&&(r.style.margin=`0`,r.style.background=`transparent`,r.style.whiteSpace=t?`pre-wrap`:`pre`,t&&(r.style.wordBreak=`break-word`,r.style.overflowWrap=`break-word`));let i=e.querySelector(`code`);if(i){let e=Fe(n);e&&i.setAttribute(`style`,`${i.getAttribute(`style`)??``}${e}`)}},Le=e=>`<pre><code>${Pe(e)}</code></pre>`,Re=e=>{let t=(0,J.c)(21),{code:n,language:r,className:i,style:a,codeStyle:o,wrap:s}=e,c=s!==void 0&&s,{currentTheme:l}=se(),u=q.useRef(null),d;t[0]===l?d=t[1]:(d=G(l),t[0]=l,t[1]=d);let f=d,p,m;t[2]!==n||t[3]!==o||t[4]!==c?(p=()=>{let e=u.current;e&&(e.innerHTML=Le(n),Ie(e,c,o))},m=[n,c,o],t[2]=n,t[3]=o,t[4]=c,t[5]=p,t[6]=m):(p=t[5],m=t[6]),q.useLayoutEffect(p,m);let h,g;t[7]!==n||t[8]!==o||t[9]!==r||t[10]!==c?(h=()=>{let e=u.current;if(!e)return;let t=!0,i=new AbortController;return he(n,(r||`text`).toLowerCase(),{signal:i.signal,priority:`visible`}).then(n=>{!t||!e||!n||(e.innerHTML=n,Ie(e,c,o))}),()=>{t=!1,i.abort()}},g=[n,r,c,o],t[7]=n,t[8]=o,t[9]=r,t[10]=c,t[11]=h,t[12]=g):(h=t[11],g=t[12]),q.useEffect(h,g);let _;t[13]===i?_=t[14]:(_=M(`typography-code`,i),t[13]=i,t[14]=_);let v=f,y;t[15]!==a||t[16]!==v?(y={...v,...a},t[15]=a,t[16]=v,t[17]=y):y=t[17];let b;return t[18]!==_||t[19]!==y?(b=(0,Y.jsx)(`div`,{ref:u,className:_,style:y}),t[18]=_,t[19]=y,t[20]=b):b=t[20],b},ze=e=>{let t=e.replace(/^<file>\s*\n?/,``).replace(/\n?<\/file>\s*$/,``);return t=t.replace(/^\s*\d{5}\|\s?/gm,``),t.trim()},Be=(e,t=``)=>{if(typeof e==`string`)return e;if(e==null)return t;if(typeof e==`number`||typeof e==`boolean`||typeof e==`bigint`)return String(e);try{return JSON.stringify(e)}catch{return t}},Ve=e=>e?e.includes(`<diagnostics`)||e.includes(`<file_diagnostics>`)||e.includes(`LSP errors detected`)||e.includes(`This file has errors`):!1,He=e=>e?e.replace(/\n{0,2}LSP errors detected[\s\S]*?<diagnostics[^>]*>[\s\S]*?<\/diagnostics>/g,``).replace(/\n{0,2}This file has errors[\s\S]*?<\/file_diagnostics>/g,``).replace(/<diagnostics[^>]*>[\s\S]*?<\/diagnostics>/g,``).replace(/<file_diagnostics>[\s\S]*?<\/file_diagnostics>/g,``).trim():``,Ue=(e,t)=>!e||typeof e!=`object`?String(e):L(e,t||``),We=e=>{if(typeof e==`string`){let t=e.trim();return t.length>0?t:void 0}if(e&&typeof e==`object`){let t=e.patch;if(typeof t==`string`){let e=t.trim();return e.length>0?e:void 0}}},Ge=e=>{if(!e||typeof e!=`object`)return;let t=We(e.patch)??We(e.diff);if(t)return t;let n=Array.isArray(e.files)?e.files:[];for(let e of n){if(!e||typeof e!=`object`)continue;let t=We(e.patch)??We(e.diff);if(t)return t}},Ke=e=>{if(!e||typeof e!=`string`)return{data:null,isJson:!1};let t=e.trim();if(!t.startsWith(`{`)&&!t.startsWith(`[`)||!t.endsWith(`}`)&&!t.endsWith(`]`)||t.length<2)return{data:null,isJson:!1};try{let e=JSON.parse(t);return typeof e==`object`&&e?{data:e,isJson:!0}:{data:null,isJson:!1}}catch{return{data:null,isJson:!1}}},qe=(e,t,n)=>{let r=ze(e);if((t===`edit`||t===`multiedit`||t===`write`||t===`apply_patch`)&&Ve(r)&&(r=He(r)),(t===`edit`||t===`multiedit`||t===`apply_patch`)&&r.trim().length===0){let e=Ge(n);if(e)return e}return r},Je=e=>{let t=e.match(/<type>(file|directory)<\/type>/i)?.[1]?.toLowerCase()??`unknown`,n=(e.match(/<content>([\s\S]*?)<\/content>/i)?.[1]??e).replace(/\r\n/g,`
|
|
1
|
+
import{n as e,r as t}from"./rolldown-runtime-hePW80VL.js";import{T as n,t as r,v as i,y as a}from"./runtime-auth-CyWl56mL.js";import{c as o,i as s}from"./runtime-switch-CSXCC6XM.js";import{n as c}from"./runtime-fetch-ykYB0sSi.js";import{n as l,z as u}from"./platform-BQipzOYw.js";import{t as d}from"./runtimeAPIRegistry-C2VogTny.js";import{it as f,ot as p,st as m}from"./vendor-base-ui-wXsskyKm.js";import{n as h}from"./vendor-react-BkccXcWz.js";import{s as g}from"./vendor-tanstack-react-query-DIb_ItL-.js";import{E as _,c as v,f as y,o as b,s as x}from"./runtime-file-resource-DDGMqGyv.js";import{r as S}from"./vendor-reactuses-core-DjKFMfz7.js";import{a as C,n as w}from"./vendor-aparajita-capacitor-secure-storage-xol_6BsB.js";import{C as T,w as E}from"./useUIStore-1DE4XJOx.js";import{n as D,t as O}from"./runtime-file-download-Cb3-EjAg.js";import{n as k,t as A}from"./vendor-pierre-diffs-B0OmIhMO.js";import{Xn as j,io as M}from"./ui-gH75_gWj.js";import{n as N}from"./Icon-BUHzyKnj.js";import{t as P}from"./i18n-CJn52oz0.js";import{a as F,n as I,r as L}from"./toolHelpers-iEHVHQ9p.js";import{l as R,o as ee,s as te,u as ne}from"./vendor-framer-motion-D5NyyC73.js";import{t as z}from"./MobileWindowStack-DGLdgoGr.js";import{t as re}from"./vendor-tanstack-react-virtual-qsd3nvZb.js";import{n as ie,t as ae}from"./dialog-C1xZ7qi4.js";import{t as oe}from"./tap-LkQum5bB.js";import{n as se,t as ce}from"./useThemeSystem-BIXghnHj.js";import{t as B}from"./appThemeRegistry-BdjrGBQ4.js";import{r as le}from"./themes-BgDJcxRc.js";import{n as ue}from"./useEffectiveDirectory-DO47kx8J.js";import{n as de}from"./mobileBackNavigation-Br4xDLTP.js";import{t as fe}from"./ImageLoadingPlaceholder-C-g4U5hR.js";import{n as V,r as pe}from"./MarkdownRenderer-Cr-3HunB.js";import{a as H,c as me,i as U,o as W}from"./imageSource-q3O_Nkg5.js";import{n as G}from"./markdownTheme-D84XyNiT.js";import{n as K,t as he}from"./markdown-worker-oBGEB9Eg.js";import{t as ge}from"./DiffViewToggle-C2OUNYuF.js";import{t as _e}from"./touch-gestures-DOoBxhz5.js";var q=t(m(),1),J=h(),Y=p(),X=e=>e===`in_progress`||e===`completed`||e===`cancelled`?e:`pending`,Z=e=>e.status===`completed`||e.status===`cancelled`,ve={in_progress:`chat.statusRow.todo.status.inProgress`,pending:`chat.statusRow.todo.status.pending`,completed:`chat.statusRow.todo.status.completed`,cancelled:`chat.statusRow.todo.status.cancelled`},ye={in_progress:`text-foreground`,pending:`text-muted-foreground/60`,completed:`text-muted-foreground`,cancelled:`text-muted-foreground/60`},be={in_progress:`text-foreground`,pending:`text-muted-foreground`,completed:`text-muted-foreground/60 line-through decoration-1`,cancelled:`text-muted-foreground/60 line-through decoration-1`},xe=1.2,Se=24,Ce=`1 1`,we=e=>{let t=(0,J.c)(23),{status:n,className:r}=e,{t:i}=P(),a=ve[n],o;t[0]!==i||t[1]!==a?(o=i(a),t[0]=i,t[1]=a,t[2]=o):o=t[2];let s=ye[n],c;t[3]!==r||t[4]!==s?(c=M(`size-[1em] shrink-0 transition-colors duration-300`,s,r),t[3]=r,t[4]=s,t[5]=c):c=t[5];let l=n===`pending`?xe:void 0,u=n===`pending`?Se:void 0,d=n===`pending`?Ce:void 0,f;t[6]!==l||t[7]!==u||t[8]!==d?(f=(0,Y.jsx)(`circle`,{cx:`8`,cy:`8`,r:`6.5`,stroke:`currentColor`,strokeWidth:l,pathLength:u,strokeDasharray:d}),t[6]=l,t[7]=u,t[8]=d,t[9]=f):f=t[9];let p;t[10]===n?p=t[11]:(p=n===`in_progress`?(0,Y.jsx)(`path`,{d:`M4.8 8h6.4M8.6 5.4 11.2 8l-2.6 2.6`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`}):null,t[10]=n,t[11]=p);let m;t[12]===n?m=t[13]:(m=n===`completed`?(0,Y.jsx)(`path`,{d:`M5 8 7.5 11 11 5.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`}):null,t[12]=n,t[13]=m);let h;t[14]===n?h=t[15]:(h=n===`cancelled`?(0,Y.jsx)(`path`,{d:`M3.5 12.5 12.5 3.5`,stroke:`currentColor`}):null,t[14]=n,t[15]=h);let g;return t[16]!==m||t[17]!==h||t[18]!==o||t[19]!==c||t[20]!==f||t[21]!==p?(g=(0,Y.jsxs)(`svg`,{viewBox:`0 0 16 16`,fill:`none`,role:`img`,"aria-label":o,className:c,children:[f,p,m,h]}),t[16]=m,t[17]=h,t[18]=o,t[19]=c,t[20]=f,t[21]=p,t[22]=g):g=t[22],g},Te=3.2,Ee=e=>{let t=Math.PI*2*e,n=8+Te*Math.sin(t),r=8-Te*Math.cos(t);return`M8 8 L8 4.8 A${Te} ${Te} 0 ${+(e>.5)} 1 ${n.toFixed(3)} ${r.toFixed(3)} Z`},De=e=>{let t=(0,J.c)(11),{done:n,total:r,spinning:i,className:a}=e,o=n===void 0?0:n,s=r===void 0?0:r,c=i!==void 0&&i,l=s>0?Math.min(1,o/s):0,u;t[0]===a?u=t[1]:(u=M(`size-[1.15em] shrink-0 text-foreground`,a),t[0]=a,t[1]=u);let d=c?`yuri-todo-spin`:void 0,f;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(f={transformBox:`fill-box`,transformOrigin:`center`},t[2]=f):f=t[2];let p;t[3]===d?p=t[4]:(p=(0,Y.jsx)(`circle`,{cx:`8`,cy:`8`,r:`6.5`,stroke:`currentColor`,strokeWidth:xe,pathLength:Se,strokeDasharray:Ce,className:d,style:f}),t[3]=d,t[4]=p);let m;t[5]===l?m=t[6]:(m=l>0?(0,Y.jsx)(`path`,{d:Ee(l),fill:`currentColor`,className:`transition-opacity duration-300`}):null,t[5]=l,t[6]=m);let h;return t[7]!==u||t[8]!==p||t[9]!==m?(h=(0,Y.jsxs)(`svg`,{viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":`true`,className:u,children:[p,m]}),t[7]=u,t[8]=p,t[9]=m,t[10]=h):h=t[10],h},Oe=({done:e,total:t,className:n,animate:r=!0})=>{let i=q.useRef(e),a=r&&i.current!==e;return q.useEffect(()=>{i.current=e},[e]),(0,Y.jsxs)(`span`,{className:M(`shrink-0 tabular-nums`,n),children:[(0,Y.jsx)(`span`,{className:M(a&&`yuri-todo-count-tick`),children:e},e),`/${t}`]})},ke=e=>{let t=(0,J.c)(5),{className:n}=e,r;t[0]===n?r=t[1]:(r=M(`flex size-[1.15em] shrink-0 items-center justify-center rounded-full bg-[var(--status-success)] text-[var(--status-success-foreground)]`,n),t[0]=n,t[1]=r);let i;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Y.jsx)(`svg`,{viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":`true`,className:`size-[70%]`,children:(0,Y.jsx)(`path`,{d:`M4.5 8.2 7 10.8 11.5 5.5`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`})}),t[2]=i):i=t[2];let a;return t[3]===r?a=t[4]:(a=(0,Y.jsx)(`span`,{"data-todo-complete":!0,className:r,children:i}),t[3]=r,t[4]=a),a},Ae=e=>{let t=(0,J.c)(27),{todos:n,isWorking:r,animate:i,className:a,rowClassName:o,listRef:s,id:c}=e,l=r!==void 0&&r,u=i!==void 0&&i,{t:d}=P(),f=n.findIndex(je),p;t[0]!==f||t[1]!==n?(p=f>=0?f:n.findIndex(Me),t[0]=f,t[1]=n,t[2]=p):p=t[2];let m=p,h;t[3]===n?h=t[4]:(h=n.some(Ne),t[3]=n,t[4]=h);let g=h,_;t[5]===a?_=t[6]:(_=M(`m-0 flex min-w-0 list-none flex-col gap-[0.125em] p-0`,a),t[5]=a,t[6]=_);let v;if(t[7]!==m||t[8]!==u||t[9]!==g||t[10]!==l||t[11]!==o||t[12]!==d||t[13]!==n){let e;t[15]!==m||t[16]!==u||t[17]!==g||t[18]!==l||t[19]!==o||t[20]!==d?(e=(e,t)=>{let n=X(e.status),r=l&&!g&&t===m&&n===`pending`?`in_progress`:n;return(0,Y.jsxs)(`li`,{"data-status":r,"aria-current":t===m?`step`:void 0,className:M(`grid min-w-0 shrink-0 grid-cols-[auto_minmax(0,1fr)] items-start py-[0.25em]`,o??`gap-[0.6em] px-[0.5em]`,u&&`yuri-todo-row-in`),children:[(0,Y.jsx)(`span`,{className:M(`flex h-[1.32em] w-[1.15em] items-center justify-center`,u&&`yuri-todo-icon-pop`),title:d(ve[r]),children:(0,Y.jsx)(we,{status:r})},r),(0,Y.jsx)(`span`,{dir:`auto`,title:e.content,className:M(`line-clamp-3 min-w-0 whitespace-normal text-[0.88em] break-words leading-[1.5] transition-colors duration-300`,be[r]),children:(0,Y.jsx)(`span`,{className:M(r===`in_progress`&&`animate-text-shimmer`),children:e.content})})]},e.id??`${t}:${e.content}`)},t[15]=m,t[16]=u,t[17]=g,t[18]=l,t[19]=o,t[20]=d,t[21]=e):e=t[21],v=n.map(e),t[7]=m,t[8]=u,t[9]=g,t[10]=l,t[11]=o,t[12]=d,t[13]=n,t[14]=v}else v=t[14];let y;return t[22]!==c||t[23]!==s||t[24]!==_||t[25]!==v?(y=(0,Y.jsx)(`ul`,{id:c,ref:s,className:_,children:v}),t[22]=c,t[23]=s,t[24]=_,t[25]=v,t[26]=y):y=t[26],y};function je(e){return e.status===`in_progress`}function Me(e){return e.status===`pending`}function Ne(e){return e.status===`in_progress`}var Pe=e=>e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`),Fe=e=>e?Object.entries(e).map(([e,t])=>t==null?``:`${e.startsWith(`--`)?e:e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}:${typeof t==`number`?`${t}px`:t};`).join(``):``,Ie=(e,t,n)=>{let r=e.querySelector(`pre`);r&&(r.style.margin=`0`,r.style.background=`transparent`,r.style.whiteSpace=t?`pre-wrap`:`pre`,t&&(r.style.wordBreak=`break-word`,r.style.overflowWrap=`break-word`));let i=e.querySelector(`code`);if(i){let e=Fe(n);e&&i.setAttribute(`style`,`${i.getAttribute(`style`)??``}${e}`)}},Le=e=>`<pre><code>${Pe(e)}</code></pre>`,Re=e=>{let t=(0,J.c)(21),{code:n,language:r,className:i,style:a,codeStyle:o,wrap:s}=e,c=s!==void 0&&s,{currentTheme:l}=se(),u=q.useRef(null),d;t[0]===l?d=t[1]:(d=G(l),t[0]=l,t[1]=d);let f=d,p,m;t[2]!==n||t[3]!==o||t[4]!==c?(p=()=>{let e=u.current;e&&(e.innerHTML=Le(n),Ie(e,c,o))},m=[n,c,o],t[2]=n,t[3]=o,t[4]=c,t[5]=p,t[6]=m):(p=t[5],m=t[6]),q.useLayoutEffect(p,m);let h,g;t[7]!==n||t[8]!==o||t[9]!==r||t[10]!==c?(h=()=>{let e=u.current;if(!e)return;let t=!0,i=new AbortController;return he(n,(r||`text`).toLowerCase(),{signal:i.signal,priority:`visible`}).then(n=>{!t||!e||!n||(e.innerHTML=n,Ie(e,c,o))}),()=>{t=!1,i.abort()}},g=[n,r,c,o],t[7]=n,t[8]=o,t[9]=r,t[10]=c,t[11]=h,t[12]=g):(h=t[11],g=t[12]),q.useEffect(h,g);let _;t[13]===i?_=t[14]:(_=M(`typography-code`,i),t[13]=i,t[14]=_);let v=f,y;t[15]!==a||t[16]!==v?(y={...v,...a},t[15]=a,t[16]=v,t[17]=y):y=t[17];let b;return t[18]!==_||t[19]!==y?(b=(0,Y.jsx)(`div`,{ref:u,className:_,style:y}),t[18]=_,t[19]=y,t[20]=b):b=t[20],b},ze=e=>{let t=e.replace(/^<file>\s*\n?/,``).replace(/\n?<\/file>\s*$/,``);return t=t.replace(/^\s*\d{5}\|\s?/gm,``),t.trim()},Be=(e,t=``)=>{if(typeof e==`string`)return e;if(e==null)return t;if(typeof e==`number`||typeof e==`boolean`||typeof e==`bigint`)return String(e);try{return JSON.stringify(e)}catch{return t}},Ve=e=>e?e.includes(`<diagnostics`)||e.includes(`<file_diagnostics>`)||e.includes(`LSP errors detected`)||e.includes(`This file has errors`):!1,He=e=>e?e.replace(/\n{0,2}LSP errors detected[\s\S]*?<diagnostics[^>]*>[\s\S]*?<\/diagnostics>/g,``).replace(/\n{0,2}This file has errors[\s\S]*?<\/file_diagnostics>/g,``).replace(/<diagnostics[^>]*>[\s\S]*?<\/diagnostics>/g,``).replace(/<file_diagnostics>[\s\S]*?<\/file_diagnostics>/g,``).trim():``,Ue=(e,t)=>!e||typeof e!=`object`?String(e):L(e,t||``),We=e=>{if(typeof e==`string`){let t=e.trim();return t.length>0?t:void 0}if(e&&typeof e==`object`){let t=e.patch;if(typeof t==`string`){let e=t.trim();return e.length>0?e:void 0}}},Ge=e=>{if(!e||typeof e!=`object`)return;let t=We(e.patch)??We(e.diff);if(t)return t;let n=Array.isArray(e.files)?e.files:[];for(let e of n){if(!e||typeof e!=`object`)continue;let t=We(e.patch)??We(e.diff);if(t)return t}},Ke=e=>{if(!e||typeof e!=`string`)return{data:null,isJson:!1};let t=e.trim();if(!t.startsWith(`{`)&&!t.startsWith(`[`)||!t.endsWith(`}`)&&!t.endsWith(`]`)||t.length<2)return{data:null,isJson:!1};try{let e=JSON.parse(t);return typeof e==`object`&&e?{data:e,isJson:!0}:{data:null,isJson:!1}}catch{return{data:null,isJson:!1}}},qe=(e,t,n)=>{let r=ze(e);if((t===`edit`||t===`multiedit`||t===`write`||t===`apply_patch`)&&Ve(r)&&(r=He(r)),(t===`edit`||t===`multiedit`||t===`apply_patch`)&&r.trim().length===0){let e=Ge(n);if(e)return e}return r},Je=e=>{let t=e.match(/<type>(file|directory)<\/type>/i)?.[1]?.toLowerCase()??`unknown`,n=(e.match(/<content>([\s\S]*?)<\/content>/i)?.[1]??e).replace(/\r\n/g,`
|
|
2
2
|
`).split(`
|
|
3
3
|
`),r=e=>/\(\s*File has more lines\..*offset.*\)/i.test(e.trim());return{type:t,lines:n.map(e=>{let n=e.trim(),i=n.startsWith(`(`)&&n.endsWith(`)`)||r(n);if(t!==`directory`){let t=e.match(/^(\d+):\s?(.*)$/);if(t){let e=t[2],n=e.trim(),i=n.startsWith(`(`)&&n.endsWith(`)`)||r(n);return{lineNumber:i?null:Number(t[1]),text:e,isInfo:i}}}return{lineNumber:null,text:e,isInfo:i}}).filter((e,t,n)=>{if(e.text.trim().length>0)return!0;let r=n[t-1],i=n[t+1],a=!!(r?.isInfo||i?.isInfo),o=e.lineNumber!==null;return!(a&&o)})}},Ye=(e,t)=>{try{let n=e.trim().split(`
|
|
4
|
-
`).filter(Boolean);if(n.length===0)return null;let r=[];return n.forEach(e=>{let t=e.match(/^(\s*)(.+)$/);if(t){let[,e,n]=t,i=Math.floor(e.length/2),a=!n.endsWith(`/`);r.push({name:n.replace(/\/$/,``),depth:i,isFile:a})}}),(0,Y.jsx)(`div`,{className:M(`w-full min-w-0 font-mono space-y-0.5`,t?.unstyled?null:`p-3 bg-muted/20 rounded-xl border border-border/30`),style:
|
|
5
|
-
`).filter(Boolean);if(r.length===0)return null;let i={};return r.forEach(e=>{let t=e.match(/^(.+?):(\d+):(.*)$/)||e.match(/^(.+?):(.*)$/);if(t){let[,e,n,r]=t,a=r===void 0?``:n,o=r===void 0?n:r;i[e]||(i[e]=[]),i[e].push({lineNum:a,content:o})}}),(0,Y.jsxs)(`div`,{className:M(`space-y-2 w-full min-w-0`,n?.unstyled?null:`p-3 bg-muted/20 rounded-xl border border-border/30`),style:
|
|
6
|
-
`).filter(Boolean);if(r.length===0)return null;let i={};r.forEach(e=>{let t=e.lastIndexOf(`/`),n=t>0?e.substring(0,t):`/`,r=t>=0?e.substring(t+1):e;i[n]||(i[n]=[]),i[n].push(r)});let a=Object.keys(i).sort();return(0,Y.jsxs)(`div`,{className:M(`space-y-2 w-full min-w-0`,n?.unstyled?null:`p-3 bg-muted/20 rounded-xl border border-border/30`),style:
|
|
4
|
+
`).filter(Boolean);if(n.length===0)return null;let r=[];return n.forEach(e=>{let t=e.match(/^(\s*)(.+)$/);if(t){let[,e,n]=t,i=Math.floor(e.length/2),a=!n.endsWith(`/`);r.push({name:n.replace(/\/$/,``),depth:i,isFile:a})}}),(0,Y.jsx)(`div`,{className:M(`w-full min-w-0 font-mono space-y-0.5`,t?.unstyled?null:`p-3 bg-muted/20 rounded-xl border border-border/30`),style:E.tool.popup,children:r.map((e,t)=>(0,Y.jsx)(`div`,{className:`min-w-0`,style:{paddingLeft:`${e.depth*20}px`},children:e.isFile?(0,Y.jsx)(`span`,{className:`text-foreground/90 block truncate`,children:e.name}):(0,Y.jsxs)(`span`,{className:`font-semibold text-foreground block truncate`,children:[e.name,`/`]})},t))})}catch{return null}},Xe={backgroundColor:`var(--status-info)`,opacity:.6},Ze=(e,t,n)=>{try{let r=e.trim().split(`
|
|
5
|
+
`).filter(Boolean);if(r.length===0)return null;let i={};return r.forEach(e=>{let t=e.match(/^(.+?):(\d+):(.*)$/)||e.match(/^(.+?):(.*)$/);if(t){let[,e,n,r]=t,a=r===void 0?``:n,o=r===void 0?n:r;i[e]||(i[e]=[]),i[e].push({lineNum:a,content:o})}}),(0,Y.jsxs)(`div`,{className:M(`space-y-2 w-full min-w-0`,n?.unstyled?null:`p-3 bg-muted/20 rounded-xl border border-border/30`),style:E.tool.popup,children:[(0,Y.jsxs)(`div`,{className:`typography-meta text-muted-foreground mb-2`,children:[`Found `,r.length,` match`,r.length===1?``:`es`]}),Object.entries(i).map(([e,n])=>(0,Y.jsxs)(`div`,{className:`space-y-1`,children:[(0,Y.jsx)(`div`,{className:M(`font-medium text-muted-foreground`,t?`typography-micro`:`typography-code`),children:e}),(0,Y.jsx)(`div`,{className:`pl-4 space-y-1`,children:n.map((e,n)=>!e.lineNum&&!e.content?null:(0,Y.jsxs)(`div`,{className:M(`flex items-start gap-2 min-w-0`,t?`typography-micro`:`typography-code`),children:[(0,Y.jsx)(`div`,{className:`w-1.5 h-1.5 rounded-full flex-shrink-0 mt-1.5`,style:Xe}),(0,Y.jsxs)(`div`,{className:`flex gap-2 min-w-0 flex-1`,children:[e.lineNum&&(0,Y.jsxs)(`span`,{className:`text-muted-foreground font-mono whitespace-nowrap`,children:[`Line `,e.lineNum,`:`]}),(0,Y.jsx)(`span`,{className:`text-foreground font-mono break-words flex-1`,children:e.content||`\xA0`})]})]},n))})]},e))]})}catch{return null}},Qe={backgroundColor:`var(--status-info)`,opacity:.6},$e=(e,t,n)=>{try{let r=e.trim().split(`
|
|
6
|
+
`).filter(Boolean);if(r.length===0)return null;let i={};r.forEach(e=>{let t=e.lastIndexOf(`/`),n=t>0?e.substring(0,t):`/`,r=t>=0?e.substring(t+1):e;i[n]||(i[n]=[]),i[n].push(r)});let a=Object.keys(i).sort();return(0,Y.jsxs)(`div`,{className:M(`space-y-2 w-full min-w-0`,n?.unstyled?null:`p-3 bg-muted/20 rounded-xl border border-border/30`),style:E.tool.popup,children:[(0,Y.jsxs)(`div`,{className:`typography-meta text-muted-foreground mb-2`,children:[`Found `,r.length,` file`,r.length===1?``:`s`]}),a.map(e=>(0,Y.jsxs)(`div`,{className:`space-y-1`,children:[(0,Y.jsxs)(`div`,{className:M(`font-medium text-muted-foreground`,t?`typography-micro`:`typography-code`),children:[e,`/`]}),(0,Y.jsx)(`div`,{className:M(`pl-4 grid gap-1`,t?`grid-cols-1`:`grid-cols-2`),children:i[e].sort().map(e=>(0,Y.jsxs)(`div`,{className:M(`flex items-center gap-2 min-w-0`,t?`typography-micro`:`typography-code`),children:[(0,Y.jsx)(`div`,{className:`w-1.5 h-1.5 rounded-full flex-shrink-0`,style:Qe}),(0,Y.jsx)(`span`,{className:`text-foreground font-mono truncate`,children:e})]},e))})]},e))]})}catch{return null}},et=new Set([`in_progress`,`pending`,`completed`,`cancelled`]),tt=(e,t,n)=>{try{let t=JSON.parse(e);if(!Array.isArray(t))return null;let r=t.filter(e=>!!e&&typeof e==`object`&&typeof e.content==`string`&&typeof e.status==`string`&&et.has(e.status));return r.length===0?null:(0,Y.jsx)(Ae,{todos:r,className:M(`px-1 py-1`,n?.listClassName)})}catch{return null}},nt=(e,t)=>{try{return(0,Y.jsx)(`div`,{className:M(`typography-code max-w-none w-full min-w-0`,t?.unstyled?null:`p-3 bg-muted/20 rounded-xl border border-border/20`),style:E.tool.popup,children:(0,Y.jsx)(V,{content:e,variant:`tool`})})}catch{return null}},rt=e=>{let t=e.split(`
|
|
7
7
|
`),n=``,r=[],i=0;for(;i<t.length;){let e=t[i];if(e.startsWith(`Index:`)||e.startsWith(`===`)||e.startsWith(`---`)||e.startsWith(`+++`)){e.startsWith(`Index:`)&&(n=e.split(` `)[1].split(`/`).pop()||`file`),i++;continue}if(e.startsWith(`@@`)){let a=e.match(/@@ -(\d+),\d+ \+(\d+),\d+ @@/),o=a?parseInt(a[1]):0,s=a?parseInt(a[2]):0,c=[],l=o,u=s,d=i+1;for(;d<t.length&&!t[d].startsWith(`@@`)&&!t[d].startsWith(`Index:`);){let e=t[d];e.startsWith(`+`)?(c.push({type:`added`,lineNumber:u,content:e.substring(1)}),u++):e.startsWith(`-`)?(c.push({type:`removed`,lineNumber:l,content:e.substring(1)}),l++):e.startsWith(` `)&&(c.push({type:`context`,lineNumber:u,content:e.substring(1)}),l++,u++),d++}r.push({file:n,oldStart:o,newStart:s,lines:c}),i=d;continue}i++}return r},it=(e,t,n)=>I(t,e,n),at=(e,t)=>{let n=(0,J.c)(4),[r,i]=q.useState(null),a,o;return n[0]!==e||n[1]!==t?(a=()=>{let n=!0,r=new AbortController;return i(null),K(e,(t||`text`).toLowerCase(),{signal:r.signal,priority:`visible`}).then(e=>{n&&i(e)}),()=>{n=!1,r.abort()}},o=[e,t],n[0]=e,n[1]=t,n[2]=a,n[3]=o):(a=n[2],o=n[3]),q.useEffect(a,o),r},ot=80,st=20,ct=q.memo(e=>{let t=(0,J.c)(26),{lines:n,language:r,maxHeight:i,showLineNumbers:a,lineStyles:o}=e,s=i===void 0?`60vh`:i,c=a===void 0||a,{currentTheme:l}=se(),u;t[0]===l?u=t[1]:(u=G(l),t[0]=l,t[1]=u);let d=u,f;t[2]===n?f=t[3]:(f=n.map(dt).join(`
|
|
8
8
|
`),t[2]=n,t[3]=f);let p=at(f,r);if(!(n.length>ot)){let e=d,r;t[4]!==s||t[5]!==e?(r={...e,maxHeight:s,overflow:`auto`},t[4]=s,t[5]=e,t[6]=r):r=t[6];let i;if(t[7]!==p||t[8]!==o||t[9]!==n||t[10]!==c){let e;t[12]!==p||t[13]!==o||t[14]!==c?(e=(e,t)=>(0,Y.jsx)(ut,{line:e,html:p?.[t],showLineNumbers:c,style:o?.(e)},t),t[12]=p,t[13]=o,t[14]=c,t[15]=e):e=t[15],i=n.map(e),t[7]=p,t[8]=o,t[9]=n,t[10]=c,t[11]=i}else i=t[11];let a;return t[16]!==r||t[17]!==i?(a=(0,Y.jsx)(`div`,{className:`typography-code font-mono w-full min-w-0`,style:r,children:i}),t[16]=r,t[17]=i,t[18]=a):a=t[18],a}let m;return t[19]!==p||t[20]!==o||t[21]!==n||t[22]!==s||t[23]!==c||t[24]!==d?(m=(0,Y.jsx)(lt,{lines:n,highlighted:p,syntaxVars:d,maxHeight:s,showLineNumbers:c,lineStyles:o}),t[19]=p,t[20]=o,t[21]=n,t[22]=s,t[23]=c,t[24]=d,t[25]=m):m=t[25],m});ct.displayName=`VirtualizedCodeBlock`;var lt=q.memo(({lines:e,highlighted:t,syntaxVars:n,maxHeight:r,showLineNumbers:i,lineStyles:a})=>{let o=q.useRef(null),s=`min(${e.length*st}px, ${r})`,c=re({count:e.length,getScrollElement:()=>o.current,estimateSize:()=>st,overscan:20}),l=c.getVirtualItems();return(0,Y.jsx)(`div`,{ref:o,className:`typography-code font-mono w-full min-w-0`,style:{...n,height:s,maxHeight:r,overflow:`auto`},children:(0,Y.jsx)(`div`,{style:{height:c.getTotalSize(),position:`relative`},children:l.map(n=>{let r=e[n.index];return r?(0,Y.jsx)(`div`,{"data-index":n.index,ref:c.measureElement,style:{position:`absolute`,top:0,left:0,width:`100%`,transform:`translateY(${n.start}px)`},children:(0,Y.jsx)(ut,{line:r,html:t?.[n.index],showLineNumbers:i,style:a?.(r)})},n.index):null})})})});lt.displayName=`VirtualizedRows`;var ut=q.memo(e=>{let t=(0,J.c)(12),{line:n,html:r,showLineNumbers:i,style:a}=e,o;t[0]!==n.isInfo||t[1]!==n.lineNumber||t[2]!==i?(o=i&&(0,Y.jsx)(`span`,{className:`w-10 flex-shrink-0 text-right pr-3 select-none border-r mr-3 -my-0.5 py-0.5`,style:{color:`var(--tools-edit-line-number)`,borderColor:`var(--tools-border)`},children:!n.isInfo&&n.lineNumber!=null?n.lineNumber:``}),t[0]=n.isInfo,t[1]=n.lineNumber,t[2]=i,t[3]=o):o=t[3];let s;t[4]!==r||t[5]!==n.isInfo||t[6]!==n.text?(s=(0,Y.jsx)(`div`,{className:`flex-1 min-w-0`,children:n.isInfo?(0,Y.jsx)(`div`,{className:`whitespace-pre-wrap break-words text-muted-foreground/70 italic`,children:n.text}):r===void 0?(0,Y.jsx)(`div`,{className:`whitespace-pre`,children:n.text}):(0,Y.jsx)(`div`,{className:`whitespace-pre`,dangerouslySetInnerHTML:{__html:r}})}),t[4]=r,t[5]=n.isInfo,t[6]=n.text,t[7]=s):s=t[7];let c;return t[8]!==a||t[9]!==o||t[10]!==s?(c=(0,Y.jsxs)(`div`,{className:`typography-code font-mono flex w-full min-w-0`,style:a,children:[o,s]}),t[8]=a,t[9]=o,t[10]=s,t[11]=c):c=t[11],c});ut.displayName=`VirtualizedCodeBlock.Row`;function dt(e){return e.text}var ft={maxDepth:50,maxNodes:1e5,initiallyExpandedDepth:2};function pt(e){return e===null?`null`:Array.isArray(e)?`array`:typeof e==`object`?`object`:typeof e==`string`?`string`:typeof e==`number`?`number`:typeof e==`boolean`?`boolean`:`null`}function mt(e){if(e.length===0)return`root`;let t=`root`;for(let n of e)/^\d+$/.test(n)?t+=`[${n}]`:t+=`.${n}`;return t}var ht=0;function gt(e,t,n,r,i){if(ht>=i.maxNodes)return null;ht++;let a=pt(e),o=mt(n),s=a===`object`||a===`array`,c={id:o,key:t,value:e,type:a,depth:r,path:n,isExpandable:s};if(s&&r<i.maxDepth){let t=a===`array`?e.map((e,t)=>[String(t),e]):Object.entries(e);c.childCount=t.length,c.children=[];for(let[e,a]of t){let t=gt(a,e,[...n,e],r+1,i);t&&c.children.push(t)}}else s&&(c.childCount=a===`array`?e.length:Object.keys(e).length);return c}function _t(e,t){let n={...ft,...t};ht=0;try{let t=e.trim();return t?gt(JSON.parse(t),`root`,[],0,n):null}catch{return null}}function vt(e,t){if(!e)return[];let n=[];function r(e){let i=!t.has(e.id);if(n.push({node:e,isExpanded:i}),e.isExpandable&&i&&e.children)for(let t of e.children)r(t)}return r(e),n}function yt(e){if(!e)return[];let t=[];function n(e){if(e.isExpandable&&(t.push(e.id),e.children))for(let t of e.children)n(t)}return n(e),t}function bt(e,t){if(!e)return[];let n=[];function r(e){if(e.isExpandable&&e.depth>=t&&n.push(e.id),e.children)for(let t of e.children)r(t)}return r(e),n}var xt=[`var(--syntax-key)`,`color-mix(in oklch, var(--syntax-key) 85%, var(--syntax-string))`,`color-mix(in oklch, var(--syntax-key) 70%, var(--syntax-number))`,`color-mix(in oklch, var(--syntax-key) 55%, var(--syntax-function))`,`color-mix(in oklch, var(--syntax-key) 40%, var(--syntax-type))`,`color-mix(in oklch, var(--syntax-key) 30%, var(--syntax-keyword))`];function St(e){return xt[e%xt.length]}function Ct(e){switch(e.type){case`string`:return`var(--syntax-string)`;case`number`:return`var(--syntax-number)`;case`boolean`:return`var(--syntax-keyword)`;case`null`:return`var(--syntax-comment)`;default:return`var(--surface-foreground)`}}function wt(e){switch(e.type){case`string`:{let t=e.value;return t.length>60?`"${t.slice(0,57)}..."`:`"${t}"`}case`number`:case`boolean`:return String(e.value);case`null`:return`null`;case`object`:return`{${e.childCount??0} ${e.childCount===1?`item`:`items`}}`;case`array`:return`[${e.childCount??0}]`;default:return String(e.value)}}function Tt(e){if(e.type===`object`){let t=e.children?.map(e=>e.key).slice(0,3)??[],n=(e.childCount??0)>3?`, ...`:``;return`{ ${t.map(e=>`"${e}": ...`).join(`, `)}${n} }`}if(e.type===`array`){let t=e.childCount??0;return t<=3?`[${e.children?.map(e=>wt(e)).join(`, `)??``}]`:`[${t} items]`}return wt(e)}var Et=q.memo(e=>{let t=(0,J.c)(29),{flatNode:n,onToggle:r,onCopyPath:i}=e,{node:a,isExpanded:o}=n,s=a.depth*20,c;t[0]!==a.id||t[1]!==r?(c=()=>{r(a.id)},t[0]=a.id,t[1]=r,t[2]=c):c=t[2];let l=c,u;t[3]!==a.id||t[4]!==i?(u=e=>{i&&(e.preventDefault(),i(a.id))},t[3]=a.id,t[4]=i,t[5]=u):u=t[5];let d=u,f;t[6]===a.depth?f=t[7]:(f=St(a.depth),t[6]=a.depth,t[7]=f);let p=f,m;t[8]===a?m=t[9]:(m=Ct(a),t[8]=a,t[9]=m);let h=m,g=a.isExpandable&&a.children&&a.children.length>0,_=`${s+8}px`,v;t[10]===_?v=t[11]:(v={paddingLeft:_},t[10]=_,t[11]=v);let y;t[12]!==l||t[13]!==g||t[14]!==o?(y=g?(0,Y.jsx)(`button`,{type:`button`,onClick:l,className:`mr-1 flex h-4 w-4 shrink-0 items-center justify-center rounded-sm hover:bg-[var(--interactive-hover)] text-muted-foreground`,children:o?(0,Y.jsx)(N,{name:`arrow-down-s`,className:`h-3 w-3`}):(0,Y.jsx)(N,{name:`arrow-right-s`,className:`h-3 w-3`})}):(0,Y.jsx)(`span`,{className:`mr-1 w-4`}),t[12]=l,t[13]=g,t[14]=o,t[15]=y):y=t[15];let b;t[16]!==p||t[17]!==a.key?(b=a.key!==`root`&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`span`,{className:`mr-1 font-semibold`,style:{color:p},children:/^\d+$/.test(a.key)?a.key:`"${a.key}"`}),(0,Y.jsx)(`span`,{className:`mr-1 text-[var(--surface-foreground)]`,children:`:`})]}),t[16]=p,t[17]=a.key,t[18]=b):b=t[18];let x;t[19]!==o||t[20]!==a||t[21]!==h?(x=a.isExpandable?o?(0,Y.jsx)(`span`,{className:`text-[var(--surface-foreground)]`,children:a.type===`object`?`{`:`[`}):(0,Y.jsx)(`span`,{style:{color:`var(--surface-mutedForeground)`},children:Tt(a)}):(0,Y.jsx)(`span`,{style:{color:h},children:wt(a)}),t[19]=o,t[20]=a,t[21]=h,t[22]=x):x=t[22];let S;return t[23]!==d||t[24]!==v||t[25]!==y||t[26]!==b||t[27]!==x?(S=(0,Y.jsxs)(`div`,{className:`flex items-center py-0.5 px-2 hover:bg-[var(--surface-hover)] rounded-sm cursor-default font-mono text-xs leading-5 whitespace-nowrap`,style:v,onContextMenu:d,children:[y,b,x]}),t[23]=d,t[24]=v,t[25]=y,t[26]=b,t[27]=x,t[28]=S):S=t[28],S});Et.displayName=`JsonRow`;var Dt=200,Ot=22,kt=q.forwardRef(function({data:e,className:t,maxHeight:n=`100%`,initiallyExpandedDepth:r=2,onCopyPath:i},a){let o=q.useMemo(()=>{try{return JSON.stringify(e)}catch{return null}},[e]),s=q.useMemo(()=>o?_t(o):null,[o]),[c,l]=q.useState(()=>s?new Set(bt(s,r)):new Set),u=q.useMemo(()=>vt(s,c),[s,c]),d=u.length>Dt,f=q.useRef(null),p=re({count:u.length,enabled:d,getScrollElement:()=>f.current,estimateSize:()=>Ot,overscan:20,getItemKey:e=>u[e]?.node.id??e}),m=q.useCallback(e=>{l(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),h=q.useCallback(()=>{l(new Set)},[]),g=q.useCallback(()=>{s&&l(new Set(yt(s)))},[s]);return q.useImperativeHandle(a,()=>({expandAll:h,collapseAll:g}),[h,g]),s?d?(0,Y.jsx)(`div`,{ref:f,className:t,style:{maxHeight:n,overflow:`auto`},children:(0,Y.jsx)(`div`,{style:{height:p.getTotalSize(),position:`relative`},children:p.getVirtualItems().map(e=>{let t=u[e.index];return t?(0,Y.jsx)(`div`,{"data-index":e.index,ref:p.measureElement,style:{position:`absolute`,top:0,left:0,width:`100%`,transform:`translateY(${e.start}px)`},children:(0,Y.jsx)(Et,{flatNode:t,onToggle:m,onCopyPath:i})},t.node.id):null})})}):(0,Y.jsx)(`div`,{ref:f,className:t,style:{maxHeight:n,overflow:`auto`},children:u.map(e=>(0,Y.jsx)(Et,{flatNode:e,onToggle:m,onCopyPath:i},e.node.id))}):null}),At=q.memo(function({jsonString:e,className:t,maxHeight:n=`100%`,initiallyExpandedDepth:r=2}){let{t:i}=P(),a=q.useRef(null),[o,s]=q.useState(null),c=q.useMemo(()=>{try{let t=e.trim();if(!t)return s(i(`jsonTreeView.error.emptyJson`)),null;let n=JSON.parse(t);return s(null),n}catch(e){return s(e instanceof Error?e.message:i(`jsonTreeView.error.invalidJson`)),null}},[e,i]),l=q.useCallback(()=>{a.current?.expandAll()},[]),u=q.useCallback(()=>{a.current?.collapseAll()},[]);return o?(0,Y.jsx)(`div`,{className:t,children:(0,Y.jsxs)(`div`,{className:`rounded-md border border-[var(--interactive-border)] bg-[var(--syntax-base-background)] p-4`,children:[(0,Y.jsx)(`div`,{className:`mb-1 font-medium text-[var(--surface-foreground)]`,children:i(`jsonTreeView.error.invalidJsonTitle`)}),(0,Y.jsx)(`div`,{className:`font-mono text-xs text-[var(--surface-mutedForeground)]`,children:o})]})}):c===null?null:(0,Y.jsxs)(`div`,{className:t,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-1 border-b border-[var(--interactive-border)] px-2 py-1`,children:[(0,Y.jsxs)(j,{variant:`ghost`,size:`xs`,onClick:l,className:`gap-1 text-xs text-muted-foreground`,children:[(0,Y.jsx)(N,{name:`arrow-down-s`,className:`h-3 w-3`}),i(`jsonTreeView.actions.expandAll`)]}),(0,Y.jsxs)(j,{variant:`ghost`,size:`xs`,onClick:u,className:`gap-1 text-xs text-muted-foreground`,children:[(0,Y.jsx)(N,{name:`arrow-up-s`,className:`h-3 w-3`}),i(`jsonTreeView.actions.collapseAll`)]})]}),(0,Y.jsx)(`div`,{className:`bg-[var(--syntax-base-background)] py-1`,style:{maxHeight:n,overflow:`auto`},children:(0,Y.jsx)(kt,{ref:a,data:c,maxHeight:n,initiallyExpandedDepth:r})})]})}),jt=class extends Error{key;params;constructor(e,t){super(e),this.name=`MermaidLoadFailure`,this.key=e,this.params=t}},Mt=(e,t)=>new jt(e,t),Nt=e=>e instanceof jt,Pt=e=>e+1,Ft=(e,t)=>e===t,It=e=>{let t=e.indexOf(`,`);if(t<0)throw Mt(`chat.toolOutputDialog.mermaid.dataUrlMalformed`);let n=e.slice(0,t).toLowerCase(),r=e.slice(t+1);return n.includes(`;base64`)?atob(r):decodeURIComponent(r)},Lt=e=>Promise.resolve().then(()=>It(e)),Rt=1,zt=56,Q=(e,t,n)=>Math.min(n,Math.max(t,e)),Bt=({isMobile:e,pointerType:t,cancelled:n,moved:r,suppressTap:i,targetWasCanvas:a,start:o,end:s,startScale:c,hasMultipleImages:l})=>{if(n||i)return`none`;let u={x:s.x-o.x,y:s.y-o.y},d=Math.hypot(u.x,u.y),f=t!==`mouse`;if(e&&f&&c<=1.01&&Math.abs(u.x)>=zt&&Math.abs(u.x)>Math.abs(u.y)*1.2)return l?u.x<0?`next`:`previous`:`none`;let p=!r&&d<=10;return e&&f&&p||!e&&t===`mouse`&&p&&a?`close`:`none`},Vt=(e,t)=>{if(e.width<=0||e.height<=0||t.width<=0||t.height<=0)return{width:1,height:1};let n=Math.min(t.width/e.width,t.height/e.height);return{width:Math.max(1,e.width*n),height:Math.max(1,e.height*n)}},Ht=(e,t)=>{let n=t.minScale??Rt,r=t.maxScale??5,i=Q(e.scale,n,r),a=Math.max(0,(t.image.width*i-t.viewport.width)/2),o=Math.max(0,(t.image.height*i-t.viewport.height)/2);return{scale:i,x:Q(e.x,-a,a),y:Q(e.y,-o,o)}},Ut=(e,t,n,r,i)=>{let a=Q(t,i.minScale??Rt,i.maxScale??5),o=a/e.scale;return Ht({scale:a,x:n.x-r.x-(n.x-r.x-e.x)*o,y:n.y-r.y-(n.y-r.y-e.y)*o},i)},Wt=(e,t,n)=>Ht({...e,x:e.x+t.x,y:e.y+t.y},n),Gt=.25,Kt=32,qt=(e,t)=>({scale:1-Math.min(.45,e/t*.65),opacity:Q(1-e/(t*.55),.15,1)}),Jt=(e,t,n,r)=>n?t.y>Kt?`y`:r&&Math.abs(t.x)>Kt?`x`:null:Math.hypot(e.x,e.y)<=10?null:!r||e.y>0&&e.y>=Math.abs(e.x)*.6?`y`:Math.abs(e.x)>=Math.abs(e.y)?`x`:`y`,Yt=(e,t,n,r,i)=>{let a=Wt(e,t,n),o={x:e.x+t.x-a.x,y:e.y+t.y-a.y},s=e.scale>1.01;r??=Jt(t,o,s,i);let c=s?Kt:0,l=r===`x`&&i?Math.sign(o.x)*Math.max(0,Math.abs(o.x)-c):0,u=r===`y`?Math.max(0,o.y-c):0,d=qt(u,n.viewport.height);return{transform:a,axis:r,galleryX:Q(l,-n.viewport.width,n.viewport.width),dismissY:u,dismissX:u>0?t.x*Gt:0,dismissScale:d.scale,backdropOpacity:d.opacity}},Xt=e=>{let t=e[e.length-1];if(!t)return{x:0,y:0};let n=e.find(e=>t.time-e.time<=100)??t,r=t.time-n.time;return r>0?{x:(t.x-n.x)/r,y:(t.y-n.y)/r}:{x:0,y:0}},Zt=280,Qt=(e,t)=>oe(e,t),$t=(e,t,n)=>{let r=Math.abs(e.galleryX);return r>=Math.min(96,n.width*.22)||r>18&&Math.abs(t.x)>.55&&t.x*e.galleryX>0?e.galleryX<0?`next`:`previous`:e.dismissY>=Math.min(140,n.height*.18)||e.dismissY>48&&t.y>.65?`close`:`none`},en=(e,t,n,r,i,a)=>{let o=Q(r,a.minScale??Rt,a.maxScale??5),s=o/e.scale;return Ht({scale:o,x:n.x-i.x-(t.x-i.x-e.x)*s,y:n.y-i.y-(t.y-i.y-e.y)*s},a)};function tn(e){let t=(0,J.c)(39),{url:n,directory:r,label:i,active:a,returnToSource:o,sourceElement:s,viewport:c,isMobile:l,position:u,onActiveImage:d}=e,{t:f}=P(),p=W(n,r,`preview`),m=p.source||s?.currentSrc||``,h=`${p.key}\n${m}`,g=q.useRef(null),[_,v]=q.useState(null),[y,b]=q.useState(null),x;t[0]!==_||t[1]!==h||t[2]!==s?(x=_?.key===h?_.size:s?.naturalWidth&&s.naturalHeight?{width:s.naturalWidth,height:s.naturalHeight}:null,t[0]=_,t[1]=h,t[2]=s,t[3]=x):x=t[3];let S=x,C=!!S,w=!!(p.error||y===h),T=S??c,E=Math.max(1,c.width*(l?1:.8)),D=Math.max(1,c.height*(l?1:.95)),O;t[4]!==T||t[5]!==E||t[6]!==D?(O=Vt(T,{width:E,height:D}),t[4]=T,t[5]=E,t[6]=D,t[7]=O):O=t[7];let k=O,A,j;t[8]!==a||t[9]!==w||t[10]!==C||t[11]!==S||t[12]!==d||t[13]!==p.key||t[14]!==m?(A=()=>{a&&d({element:g.current,source:m,resourceKey:p.key,naturalSize:S,loaded:C,error:w})},j=[a,m,p.key,S,C,w,d],t[8]=a,t[9]=w,t[10]=C,t[11]=S,t[12]=d,t[13]=p.key,t[14]=m,t[15]=A,t[16]=j):(A=t[15],j=t[16]),q.useLayoutEffect(A,j);let M=!a||void 0,N=`translate3d(${u*(c.width+16)}px, 0, 0)`,F;t[17]===N?F=t[18]:(F={transform:N},t[17]=N,t[18]=F);let I;t[19]!==a||t[20]!==w||t[21]!==C?(I=!C&&!w&&(0,Y.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center`,role:a?`status`:void 0,children:(0,Y.jsx)(fe,{className:`aspect-square w-64 max-w-[80vw] rounded-xl`})}),t[19]=a,t[20]=w,t[21]=C,t[22]=I):I=t[22];let L;t[23]!==a||t[24]!==h||t[25]!==w||t[26]!==i||t[27]!==C||t[28]!==o||t[29]!==k||t[30]!==m||t[31]!==f?(L=w?(0,Y.jsx)(`p`,{role:a?`status`:void 0,className:`px-6 text-center typography-ui-label`,children:f(`filesView.error.readFileFailed`)}):(0,Y.jsx)(`img`,{ref:g,"data-preview-transition-target":a?``:void 0,"data-preview-return":o,src:m||void 0,alt:a?i:``,className:`block max-w-none touch-none object-contain will-change-transform ${a?`pointer-events-auto`:``} ${C?`opacity-100`:`opacity-0`}`,style:{width:`${k.width}px`,height:`${k.height}px`},loading:`eager`,draggable:!1,onLoad:e=>{let t=e.currentTarget;t.naturalWidth&&t.naturalHeight&&v({key:h,size:{width:t.naturalWidth,height:t.naturalHeight}})},onError:()=>b(h)}),t[23]=a,t[24]=h,t[25]=w,t[26]=i,t[27]=C,t[28]=o,t[29]=k,t[30]=m,t[31]=f,t[32]=L):L=t[32];let R;return t[33]!==u||t[34]!==F||t[35]!==I||t[36]!==L||t[37]!==M?(R=(0,Y.jsxs)(`div`,{"data-image-viewer-slide":u,"aria-hidden":M,className:`pointer-events-none absolute inset-0 flex items-center justify-center overflow-hidden`,style:F,children:[I,L]}),t[33]=u,t[34]=F,t[35]=I,t[36]=L,t[37]=M,t[38]=R):R=t[38],R}var nn=500,rn=24,an=(e,t={})=>{let n=t.target??(typeof document>`u`?null:document);if(!n)return()=>{};let r=t.durationMs??nn,i=t.maxDistance??rn,a=!0,o,s=()=>{a&&(a=!1,n.removeEventListener(`click`,c,!0),o!==void 0&&globalThis.clearTimeout(o))},c=t=>{let n=t;typeof n.clientX==`number`&&typeof n.clientY==`number`&&(Math.hypot(n.clientX-e.x,n.clientY-e.y)>i||(s(),t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation()))};return n.addEventListener(`click`,c,!0),o=globalThis.setTimeout(s,r),s},on=(e,t,n={})=>{an(e,n),t()},sn=t(f(),1);function cn(e,t,n,r,i){let a=e instanceof HTMLImageElement?e:e.querySelector(`img`);if(!a||!t.complete||!t.naturalWidth||!t.animate)return;let o=t.getBoundingClientRect(),s=a.getBoundingClientRect();if(!o.width||!o.height||!s.width||!s.height)return;let c=getComputedStyle(a),l=t.naturalWidth/t.naturalHeight,u=c.objectFit===`cover`?Math.max(s.width,s.height*l):Math.min(s.width,s.height*l),d=u/l,f=c.objectPosition.split(` `);if(!f.every(e=>e.endsWith(`%`)))return;let p=(s.width-u)*parseFloat(f[0])/100,m=(s.height-d)*parseFloat(f[1]??f[0])/100,h=s.left,g=s.top,_=s.right,v=s.bottom,y=c.borderRadius;for(let e=a.parentElement;e;e=e.parentElement){let t=getComputedStyle(e),n=e.getBoundingClientRect();[`hidden`,`clip`,`auto`,`scroll`].includes(t.overflowX)&&(h=Math.max(h,n.left),_=Math.min(_,n.right)),[`hidden`,`clip`,`auto`,`scroll`].includes(t.overflowY)&&(g=Math.max(g,n.top),v=Math.min(v,n.bottom)),n.width===s.width&&n.height===s.height&&t.borderRadius!==`0px`&&(y=t.borderRadius)}if(_<=h||v<=g)return;let b=document.createElement(`div`);b.dataset.mediaCropAnimation=``,b.setAttribute(`aria-hidden`,`true`),Object.assign(b.style,{position:`fixed`,left:`0`,top:`0`,overflow:`hidden`,pointerEvents:`none`,zIndex:`51`,contain:`paint`});let x=document.createElement(`img`);x.src=t.currentSrc||t.src,x.alt=``,Object.assign(x.style,{display:`block`,width:`${o.width}px`,height:`${o.height}px`,maxWidth:`none`,transformOrigin:`0 0`}),b.append(x),document.body.append(b);let S={transform:`translate(${o.left}px, ${o.top}px)`,width:`${o.width}px`,height:`${o.height}px`,borderRadius:`0px`},C={transform:`translate(${h}px, ${g}px)`,width:`${_-h}px`,height:`${v-g}px`,borderRadius:y},w={transform:`translate(0px, 0px) scale(1)`},T={transform:`translate(${s.left+p-h}px, ${s.top+m-g}px) scale(${u/o.width})`},E={duration:280,easing:`cubic-bezier(0.2, 0, 0, 1)`,fill:`both`},D=t.style.visibility;t.style.visibility=`hidden`;let O=[b.animate(r?[S,C]:[C,S],E),x.animate(r?[w,T]:[T,w],E),n.animate({opacity:r?[1,0]:[0,1]},E)],k=!1,A=(e=!1)=>{b.remove(),t.style.visibility=D,O.forEach((t,n)=>{(!e||n!==2)&&t.cancel()})};return Promise.all(O.map(e=>e.finished)).then(()=>{k||(A(r),i())},()=>{k||(A(),i())}),()=>{k=!0,A()}}function ln(e,t,n,r,i=()=>{}){let a=e?.getBoundingClientRect(),o=window.matchMedia(`(prefers-reduced-motion: reduce)`).matches;if(!o&&e?.isConnected&&t instanceof HTMLImageElement&&n&&a?.width&&a.height&&a.bottom>0&&a.top<window.innerHeight&&a.right>0&&a.left<window.innerWidth){let a=cn(e,t,n,r,i);if(a)return a}if(!document.startViewTransition||o||!e?.isConnected||!t||!n||!a?.width||!a.height||a.bottom<=0||a.top>=window.innerHeight||a.right<=0||a.left>=window.innerWidth){if(!n?.animate||o)return i(),()=>{};let e=n.animate({opacity:r?[1,0]:[0,1]},{duration:150,fill:`forwards`}),t=!1;return e.finished.then(()=>{t||i()},()=>{}),()=>{t=!0,e.cancel()}}let s=e.style.viewTransitionName,c=t.style.viewTransitionName,l=n.style.visibility,u=!1,d=`yuri-media-preview`;e.style.viewTransitionName=r?`none`:d,t.style.viewTransitionName=r?d:`none`,r||(n.style.visibility=`hidden`);let f=document.startViewTransition(()=>{u||(e.style.viewTransitionName=r?d:`none`,t.style.viewTransitionName=r?`none`:d,n.style.visibility=r?`hidden`:l)}),p=()=>{e.style.viewTransitionName=s,t.style.viewTransitionName=c,n.style.visibility=l};f.ready.catch(()=>{});let m=()=>{u||(p(),i())};return f.finished.then(m,m),()=>{u=!0,f.skipTransition(),p()}}function un(e){let t=(0,J.c)(12),{onClose:n,isMobile:r,size:i}=e,{t:a}=P(),o;t[0]!==r||t[1]!==i?(o=r?{top:`calc(var(--yuri-safe-area-top, 0px) + 0.5rem)`,right:`calc(var(--yuri-safe-area-right, 0px) + 0.75rem)`}:{top:i?`calc(50% - ${i.height/2}px + 0.5rem)`:`0.5rem`,right:i?`calc(50% - ${i.width/2}px + 0.5rem)`:`0.5rem`},t[0]=r,t[1]=i,t[2]=o):o=t[2];let s;t[3]===a?s=t[4]:(s=a(`dialog.common.actions.close`),t[3]=a,t[4]=s);let c;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Y.jsx)(N,{name:`close`,className:`size-5`}),t[5]=c):c=t[5];let l;t[6]!==n||t[7]!==s?(l=(0,Y.jsx)(j,{variant:`mobileGlass`,size:`mobileIcon`,"aria-label":s,onClick:n,children:c}),t[6]=n,t[7]=s,t[8]=l):l=t[8];let u;return t[9]!==o||t[10]!==l?(u=(0,Y.jsx)(`div`,{className:`absolute right-3 z-20`,style:o,children:l}),t[9]=o,t[10]=l,t[11]=u):u=t[11],u}function dn(e){let t=(0,J.c)(9),{children:n,isMobile:r}=e,i;t[0]===r?i=t[1]:(i=r?{bottom:`calc(var(--yuri-safe-area-bottom, 0px) + 0.75rem)`,right:`calc(var(--yuri-safe-area-right, 0px) + 0.75rem)`}:{bottom:`1rem`,left:`1rem`},t[0]=r,t[1]=i);let a=r?`mobile`:`desktop`,o=`pointer-events-auto flex items-center text-[var(--yuri-media-preview-foreground)] ${r?`gap-1.5`:`gap-2`}`,s;t[2]!==n||t[3]!==a||t[4]!==o?(s=(0,Y.jsx)(`div`,{"data-media-preview-toolbar":a,className:o,onPointerDown:pn,onDoubleClick:fn,children:n}),t[2]=n,t[3]=a,t[4]=o,t[5]=s):s=t[5];let c;return t[6]!==i||t[7]!==s?(c=(0,Y.jsx)(`div`,{className:`pointer-events-none absolute z-20`,style:i,children:s}),t[6]=i,t[7]=s,t[8]=c):c=t[8],c}function fn(e){return e.stopPropagation()}function pn(e){return e.stopPropagation()}function mn(e){let t=(0,J.c)(30),{open:n,title:r,kind:i,source:a,isMobile:o,onOpenChange:s,children:c}=e,l=q.useRef(null),u=q.useId(),d=q.useRef(null),f=q.useRef(!1),[p,m]=q.useState(!1),h;t[0]!==s||t[1]!==a?(h=()=>{if(f.current)return;f.current=!0,l.current&&(l.current.dataset.mediaPreviewClosing=`true`),d.current?.();let e=l.current?.querySelector(`[data-preview-transition-target]`)??null;d.current=ln(e?.dataset.previewReturn===`false`?void 0:a,e,l.current,!0,()=>{m(!0),s(!1)})},t[0]=s,t[1]=a,t[2]=h):h=t[2];let g=S(h),_=`${i}-preview`,v=n&&!p&&o,y;t[3]!==g||t[4]!==_||t[5]!==v?(y={id:_,active:v,layer:`overlay`,onBack:g,surfaceRef:l},t[3]=g,t[4]=_,t[5]=v,t[6]=y):y=t[6],de(y);let b,x;if(t[7]!==g||t[8]!==p||t[9]!==o||t[10]!==u||t[11]!==n||t[12]!==a?(b=()=>{if(!n){m(!1),f.current=!1;return}if(p)return;let e=l.current;e&&delete e.dataset.mediaPreviewClosing;let t=document.activeElement instanceof HTMLElement?document.activeElement:null,r=o?z.add({id:u,onClose:g},document.body):void 0;return e?.querySelector(`button`)?.focus({preventScroll:!0}),d.current=ln(a,e?.querySelector(`[data-preview-transition-target]`)??null,e,!1),()=>{d.current?.(),d.current=null,f.current=!1,r?.(),t?.isConnected&&t.focus({preventScroll:!0})}},x=[p,n,a,o,u,g],t[7]=g,t[8]=p,t[9]=o,t[10]=u,t[11]=n,t[12]=a,t[13]=b,t[14]=x):(b=t[13],x=t[14]),q.useLayoutEffect(b,x),!n||p||typeof document>`u`)return null;let C;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(C={color:`var(--yuri-media-preview-foreground)`},t[15]=C):C=t[15];let w;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(w=e=>{if(f.current){e.preventDefault(),e.stopPropagation();return}d.current?.(),d.current=null},t[16]=w):w=t[16];let T;t[17]===g?T=t[18]:(T=e=>{if(!e.currentTarget.contains(e.target)||(e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),g()),e.key!==`Tab`))return;let t=Array.from(e.currentTarget.querySelectorAll(`button:not([disabled]), a[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex="0"]`)),n=t[0],r=t.at(-1);e.shiftKey&&document.activeElement===n?(e.preventDefault(),r?.focus()):!e.shiftKey&&document.activeElement===r&&(e.preventDefault(),n?.focus())},t[17]=g,t[18]=T);let E=o?`var(--yuri-media-preview-background)`:`color-mix(in srgb, var(--yuri-media-preview-background) ${i===`mermaid`?90:70}%, transparent)`,D;t[19]===E?D=t[20]:(D=(0,Y.jsx)(`div`,{"data-media-preview-backdrop":``,"aria-hidden":`true`,className:`pointer-events-none absolute inset-0`,style:{backgroundColor:E}}),t[19]=E,t[20]=D);let O;t[21]!==c||t[22]!==g?(O=c(g),t[21]=c,t[22]=g,t[23]=O):O=t[23];let k;return t[24]!==i||t[25]!==D||t[26]!==O||t[27]!==T||t[28]!==r?(k=(0,sn.createPortal)((0,Y.jsxs)(`div`,{ref:l,role:`dialog`,"aria-modal":`true`,"aria-label":r,"data-media-preview":i,"data-page-scroll-lock":`true`,tabIndex:-1,className:`fixed inset-0 z-[80] overflow-hidden select-none [-webkit-touch-callout:none]`,style:C,onClick:hn,onPointerDownCapture:w,onKeyDown:T,children:[D,O]}),document.body),t[24]=i,t[25]=D,t[26]=O,t[27]=T,t[28]=r,t[29]=k):k=t[29],k}function hn(e){e.stopPropagation()}var gn=1048576,$=C(`YuriVideo`),_n=e=>{let t=/^bytes=(\d*)-(\d*)$/.exec(e||`bytes=0-1048575`);if(!t||!t[1]&&!t[2])throw Error(`Invalid media range`);if(!t[1]){let e=Number(t[2]);if(!Number.isSafeInteger(e)||e<=0)throw Error(`Invalid media range`);return`bytes=-${Math.min(e,gn)}`}let n=Number(t[1]),r=t[2]?Number(t[2]):n+gn-1;if(!Number.isSafeInteger(n)||!Number.isSafeInteger(r)||r<n)throw Error(`Invalid media range`);return`bytes=${n}-${Math.min(r,n+gn-1)}`},vn=e=>{let t=``;for(let n=0;n<e.length;n+=32768)t+=String.fromCharCode(...e.subarray(n,n+32768));return btoa(t)};async function yn(e,t,n){if(!w.isNativePlatform()||w.getPlatform()!==`ios`||!w.isPluginAvailable(`YuriVideo`))return null;let r=s(),a=crypto.randomUUID(),l=new Map,u=!1,d=()=>{},f=()=>{},p=async()=>{if(!u){u=!0,d(),f(),n.removeEventListener(`abort`,m);for(let e of l.values())e.abort();l.clear(),await Promise.allSettled([g?.remove(),$.release({assetId:a})])}},m=()=>{p()},h=async i=>{if(i.assetId!==a||u)return;if(i.cancelled){l.get(i.requestId)?.abort();return}if(l.has(i.requestId))return;let o=new AbortController;l.set(i.requestId,o);let d;try{if(r!==s()||n.aborted)throw Error(`Video runtime changed`);let a=i.method===`HEAD`?`bytes=0-0`:_n(i.range),l=new URLSearchParams(e.split(`?`)[1]??``);(t.query instanceof URLSearchParams?t.query:new URLSearchParams(t.query)).forEach((e,t)=>l.set(t,e));let f=l.get(`path`);d=e.split(`?`)[0]===`/api/fs/raw`&&f?await x({path:f,range:a,signal:o.signal,directory:new Headers(t.headers).get(`x-opencode-directory`)??l.get(`directory`)??void 0,allowOutsideWorkspace:l.get(`allowOutsideWorkspace`)===`true`,outsideFileGrant:l.get(`outsideFileGrant`)??void 0}):await c(e,{...t,headers:{Range:a},signal:o.signal});let p=d.headers.get(`content-range`)||``;if(d.status===416&&/^bytes \*\/\d+$/.test(p)){await $.respond({requestId:i.requestId,status:416,contentRange:p,dataBase64:``});return}let m=/^bytes (\d+)-(\d+)\/(\d+)$/.exec(p);if(d.status!==206||!m)throw Error(`Host does not support video ranges`);let[h,g,_]=m.slice(1).map(Number),v=g-h+1;if(![h,g,_].every(Number.isSafeInteger)||v<=0||v>1048576||g>=_)throw Error(`Invalid video range response`);let y=d.body?.getReader();if(!y)throw Error(`Missing video response body`);let b=new Uint8Array(v),S=0;try{for(;;){let{done:e,value:t}=await y.read();if(e)break;if(S+t.length>v)throw Error(`Oversized video range`);b.set(t,S),S+=t.length}}finally{await y.cancel().catch(()=>{}),y.releaseLock()}if(S!==v)throw Error(`Truncated video range`);if(u||o.signal.aborted||r!==s())return;let C=d.headers.get(`content-type`)?.split(`;`)[0]||`application/octet-stream`;await $.respond({requestId:i.requestId,status:i.method===`HEAD`?200:206,contentType:C,contentRange:i.method===`HEAD`?void 0:p,contentLength:i.method===`HEAD`?_:v,dataBase64:i.method===`HEAD`?``:vn(b)})}catch{!u&&!o.signal.aborted&&await $.respond({requestId:i.requestId,status:502,dataBase64:``}).catch(()=>{})}finally{d?.body&&!d.body.locked&&await d.body.cancel().catch(()=>{}),l.delete(i.requestId)}},g=await $.addListener(`request`,e=>{h(e)});n.addEventListener(`abort`,m,{once:!0}),d=o(m),f=i(m);try{n.throwIfAborted();let{url:e}=await $.create({assetId:a});if(u||n.aborted)throw await $.release({assetId:a}),new DOMException(`Aborted`,`AbortError`);return{url:e,release:p}}catch(e){throw await p(),e}}var bn=`image/png`,xn=C(`YuriMedia`),Sn=e=>{let t=e.toLowerCase().split(`;`)[0]?.trim()||bn;if(t===`image/jpeg`||t===`image/jpg`)return`jpg`;if(t===`image/webp`)return`webp`;if(t===`image/gif`)return`gif`;if(t===`image/svg+xml`)return`svg`;if(t===`image/png`)return`png`;if(t===`video/quicktime`)return`mov`;let n=t.split(`/`)[1];return n&&/^[a-z0-9.+-]+$/i.test(n)?n:`png`},Cn=(e,t)=>{let n=`${t.startsWith(`video/`)?`video`:`image`}.${Sn(t)}`,r=(((e||``).trim()||n).split(/[\\/]/).pop()||n).replace(/[^\w.\- ()[\]]+/g,`_`).replace(/^\.+/,``);return r?/\.[a-z0-9]{1,8}$/i.test(r)?r:`${r}.${Sn(t)}`:n},wn=e=>new Promise((t,n)=>{let r=new FileReader;r.onload=()=>{if(typeof r.result==`string`){t(r.result);return}n(Error(`Failed to encode image`))},r.onerror=()=>n(r.error??Error(`Failed to encode image`)),r.readAsDataURL(e)}),Tn=async e=>{let t=await wn(e),n=t.indexOf(`,`);return n>=0?t.slice(n+1):t},En=(e,t)=>{let n=URL.createObjectURL(e),r=document.createElement(`a`);r.href=n,r.download=t,document.body.appendChild(r),r.click(),document.body.removeChild(r),window.setTimeout(()=>URL.revokeObjectURL(n),1e3)},Dn=async(e,t,n)=>{if(e.startsWith(`yuri-asset:`)){let r=await y(e,t,n);if(r)return r;if(l())throw Error(`Image display stream is no longer available`)}return b(e,t,n)},On=async(e,t,n)=>v({path:e,signal:t},n),kn=async(e,t,n)=>{let r=e.effectiveDirectory??``,i=null;e.prefetchedBlob&&e.prefetchedBlob.size>0&&(i=e.prefetchedBlob);let a=e.displayUrl?.trim();if(!i&&a&&(!/^https?:/i.test(a)||!U(H(e.sourceUrl,r))))try{i=await Dn(a,t,n)}catch{t?.throwIfAborted(),i=null,n?.(0)}if(!i){let a=e.sourceUrl.trim();if(!a)throw Error(`Image source is empty`);if(/^(?:data|blob):/i.test(a)||/^https?:/i.test(a)||/^\/api(?=\/|[?#]|$)/.test(a))i=await Dn(a,t,n);else{let e=H(a,r);i=U(e)?await On(e.path,t,n):await Dn(e.source,t,n)}}if(!i||i.size<=0)throw Error(`Image is empty`);n?.(100);let o=(e.mimeType||(i.type&&/^(image|video)\//.test(i.type)?i.type:``)||(e.kind===`video`?`video/mp4`:``)||bn).split(`;`)[0].trim()||bn;return{blob:i,filename:Cn(e.filename,o),mimeType:o}},An=()=>!l()||w===void 0?!1:w.isPluginAvailable(`YuriMedia`),jn=async(e,t,n)=>{let r=H(e.sourceUrl,e.effectiveDirectory??``);if(u()&&e.kind===`video`&&!An()){let e=d()?.files;if(U(r)&&e?.downloadFile)return t?.throwIfAborted(),await e.downloadFile(r.path),`saved`;throw Error(`Video download is unavailable for this source in VS Code`)}if(U(r)&&!e.prefetchedBlob&&!/^(?:blob|data|yuri-asset):/i.test(e.displayUrl??``)&&!An()&&!u())return await O({path:r.path,filename:e.filename,signal:t},n),`downloaded`;let{blob:i,filename:a,mimeType:o}=await kn(e,t,n);if(t?.throwIfAborted(),An()){let n=await Tn(i);if(t?.throwIfAborted(),e.kind===`video`){if((await xn.saveFile({dataBase64:n,mimeType:o,filename:a}))?.cancelled)throw new DOMException(`Save cancelled`,`AbortError`);return`saved`}return await xn.saveImage({dataBase64:n,mimeType:o,filename:a}),`saved`}if(u()){let e=d()?.vscode;if(e?.saveImage){let t=await wn(i);return await e.saveImage({fileName:a,dataUrl:t}),`saved`}}return En(i,a),`downloaded`};function Mn(e){let t=(0,J.c)(34),{target:n,isMobile:r}=e,{t:i}=P(),[a,o]=q.useState(`idle`),[s,c]=q.useState(0),l=q.useRef(null),u,d;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=()=>()=>l.current?.abort(),d=[],t[0]=u,t[1]=d):(u=t[0],d=t[1]),q.useEffect(u,d);let f;t[2]===n?f=t[3]:(f=async()=>{if(l.current)return;let e=new AbortController;l.current=e,o(`saving`),c(0);try{await jn(n,e.signal,t=>{e.signal.aborted||c(t)}),e.signal.aborted||o(`saved`)}catch(t){let n=t;if(e.signal.aborted)return;l.current=null,o(n instanceof DOMException&&n.name===`AbortError`?`idle`:`error`)}},t[2]=n,t[3]=f);let p=S(f),m=a===`saving`,h=a===`saved`,g;t[4]!==h||t[5]!==m||t[6]!==i||t[7]!==n?(g=i(m?`chat.image.actions.saving`:h?`filesView.editor.saved`:n.kind===`video`?`filesView.editor.saveFile`:`chat.image.actions.saveImage`),t[4]=h,t[5]=m,t[6]=i,t[7]=n,t[8]=g):g=t[8];let _=g,v=r?`ghost`:`mobileGlass`,y=r?`icon`:`mobileIcon`,b=m||h,x;t[9]!==r||t[10]!==_||t[11]!==s||t[12]!==h||t[13]!==m?(x=m?(0,Y.jsxs)(`svg`,{viewBox:`0 0 24 24`,className:r?`size-4`:`size-6`,role:`progressbar`,"aria-label":_,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":s??void 0,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,children:[(0,Y.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`,opacity:`0.25`}),(0,Y.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`,pathLength:`100`,strokeDasharray:`${s??0} 100`,transform:`rotate(-90 12 12)`})]}):h?(0,Y.jsx)(N,{name:`check`,weight:`medium`,className:r?`size-4`:`size-6`}):(0,Y.jsx)(N,{name:`download-2-fill`,className:r?`size-4`:`size-6`}),t[9]=r,t[10]=_,t[11]=s,t[12]=h,t[13]=m,t[14]=x):x=t[14];let C;t[15]!==_||t[16]!==p||t[17]!==m||t[18]!==a||t[19]!==v||t[20]!==y||t[21]!==b||t[22]!==x?(C=(0,Y.jsx)(j,{variant:v,size:y,"data-media-save":a,className:`rounded-full [corner-shape:round] disabled:opacity-100`,"aria-label":_,"aria-busy":m,disabled:b,onClick:p,children:x}),t[15]=_,t[16]=p,t[17]=m,t[18]=a,t[19]=v,t[20]=y,t[21]=b,t[22]=x,t[23]=C):C=t[23];let w;t[24]!==_||t[25]!==a||t[26]!==i||t[27]!==n?(w=a===`error`?i(n.kind===`video`?`filesView.toast.saveFailed`:`chat.image.actions.saveFailed`):a===`idle`?``:_,t[24]=_,t[25]=a,t[26]=i,t[27]=n,t[28]=w):w=t[28];let T;t[29]===w?T=t[30]:(T=(0,Y.jsx)(`span`,{className:`sr-only`,role:`status`,"aria-live":`polite`,children:w}),t[29]=w,t[30]=T);let E;return t[31]!==T||t[32]!==C?(E=(0,Y.jsxs)(Y.Fragment,{children:[C,T]}),t[31]=T,t[32]=C,t[33]=E):E=t[33],E}function Nn({video:e,onClose:t,isMobile:i}){let{t:o}=P(),s=ue()??``,c=e.directory??s,l=me(),u=H(e.url,c),d=U(u)?u.path:``,f=/^\/api(?=\/|[?#]|$)/.test(e.url)?e.url:``,p=!!(d||f),m=`${l}\n${c}\n${e.url}`,[h,_]=q.useState();q.useEffect(()=>{if(!p)return;let e=new AbortController,t;return yn(f||`/api/fs/raw`,{query:d?{path:d}:void 0},e.signal).then(async n=>{if(e.signal.aborted){await n?.release();return}t=n?.release,_({key:m,url:n?.url,unsupported:!n})}).catch(()=>{e.signal.aborted||_({key:m,error:!0})}),()=>{e.abort(),t?.()}},[p,d,f,m]);let y=h?.key===m?h:void 0,[x,S]=q.useState(0);q.useEffect(()=>{if(!p||n())return;let e=r(),t=a(()=>S(e=>e+1));return()=>{t(),e()}},[p,l]);let C=g({queryKey:[`video-preview`,l,c,e.url,x],enabled:p&&y?.unsupported===!0,gcTime:0,staleTime:1/0,retry:!1,queryFn:async({signal:e})=>{if(!n()){let t=await D(f||`/api/fs/raw`,d?{path:d}:void 0);return e.throwIfAborted(),{url:t,blob:void 0}}return{blob:d?await v({path:d,signal:e}):await b(f,e),url:void 0}}}),[w,T]=q.useState(null);q.useEffect(()=>{if(!C.data?.blob)return;let e=URL.createObjectURL(C.data.blob);return T({blob:C.data.blob,url:e}),()=>URL.revokeObjectURL(e)},[C.data]);let E=p?y?.url||C.data?.url||(w?.blob===C.data?.blob?w?.url:``):u.source,[O,k]=q.useState(),A=y?.error||C.isError||!!(E&&O===E);return(0,Y.jsxs)(`div`,{className:`absolute inset-0 flex flex-col items-center justify-center gap-3 p-4`,children:[(0,Y.jsx)(un,{onClose:t,isMobile:i}),!E&&!A&&(0,Y.jsx)(`p`,{role:`status`,children:o(`common.loading`)}),A&&(0,Y.jsx)(`p`,{role:`alert`,children:o(`filesView.error.readFileFailed`)}),E&&(0,Y.jsx)(`video`,{src:E,controls:!0,playsInline:!0,preload:`metadata`,"aria-label":e.filename,className:`max-h-[80dvh] w-full max-w-5xl object-contain`,onError:()=>k(E),controlsList:`nodownload`,onContextMenu:e=>e.preventDefault()},E),(0,Y.jsx)(dn,{isMobile:i,children:(0,Y.jsx)(Mn,{isMobile:i,target:{kind:`video`,sourceUrl:e.url,displayUrl:y?.url||C.data?.url?void 0:E,filename:e.filename,mimeType:e.mimeType,effectiveDirectory:c,prefetchedBlob:C.data?.blob}},m)})]})}var Pn=e({default:()=>Xn}),Fn=400,In=(e,t,n)=>{e&&e.style[t]!==n&&(e.style[t]=n)},Ln=(e,t)=>new jt(e,t),Rn=e=>{let t=`h-3.5 w-3.5 flex-shrink-0`,n=e.toLowerCase();return n===`reasoning`?(0,Y.jsx)(N,{name:`brain-ai-3`,className:t}):n===`image-preview`?(0,Y.jsx)(N,{name:`file-image`,className:t}):n===`mermaid-preview`?(0,Y.jsx)(N,{name:`file-list-2`,className:t}):n===`edit`||n===`multiedit`||n===`apply_patch`||n===`str_replace`||n===`str_replace_based_edit_tool`?(0,Y.jsx)(N,{name:`pencil-ai`,className:t}):n===`write`||n===`create`||n===`file_write`||n===`read`||n===`view`||n===`file_read`||n===`cat`?(0,Y.jsx)(N,{name:`file-pdf`,className:t}):n===`bash`||n===`shell`||n===`cmd`||n===`terminal`?(0,Y.jsx)(N,{name:`terminal-box`,className:t}):n===`list`||n===`ls`||n===`dir`||n===`list_files`?(0,Y.jsx)(N,{name:`folder-6`,className:t}):n===`search`||n===`grep`||n===`find`||n===`ripgrep`?(0,Y.jsx)(N,{name:`search`,className:t}):n===`glob`?(0,Y.jsx)(N,{name:`file-search`,className:t}):n===`fetch`||n===`curl`||n===`wget`||n===`webfetch`?(0,Y.jsx)(N,{name:`global`,className:t}):n===`web-search`||n===`websearch`||n===`search_web`||n===`google`||n===`bing`||n===`duckduckgo`?(0,Y.jsx)(N,{name:`search`,className:t}):n===`todowrite`||n===`todoread`?(0,Y.jsx)(De,{className:M(`text-current`,t)}):n.startsWith(`git`)?(0,Y.jsx)(N,{name:`git-branch`,className:t}):(0,Y.jsx)(N,{name:`tools`,className:t})},zn={style:{background:`transparent`,backgroundColor:`transparent`,fontSize:`inherit`}},Bn={download:!1,copy:!1,showPanZoomControls:!0},Vn=`
|
|
9
9
|
[data-diff-header],
|
|
@@ -13,4 +13,4 @@ import{n as e,r as t}from"./rolldown-runtime-hePW80VL.js";import{T as n,t as r,v
|
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
15
|
`,Hn={hunkLineCount:50,lineHeight:24,diffHeaderHeight:44,hunkSeparatorHeight:24,spacing:0},Un=()=>{let e=(0,J.c)(22),t=ce(),n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=le(!1),e[0]=n):n=e[0];let r=n,i;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=le(!0),e[1]=i):i=e[1];let a=i,o;e[2]===t?.availableThemes?o=e[3]:(o=()=>t?.availableThemes??[r,a],e[2]=t?.availableThemes,e[3]=o),t?.availableThemes;let s;e[4]===o?s=e[5]:(s=o(),e[4]=o,e[5]=s);let c=s,l=t?.lightThemeId??r.metadata.id,u=t?.darkThemeId??a.metadata.id,d;e[6]!==c||e[7]!==l?(d=c.find(e=>e.metadata.id===l)??r,e[6]=c,e[7]=l,e[8]=d):d=e[8];let f=d,p;e[9]!==c||e[10]!==u?(p=c.find(e=>e.metadata.id===u)??a,e[9]=c,e[10]=u,e[11]=p):p=e[11];let m=p,h,g;e[12]!==m||e[13]!==f?(h=()=>{B(f),B(m)},g=[m,f],e[12]=m,e[13]=f,e[14]=h,e[15]=g):(h=e[14],g=e[15]),q.useEffect(h,g);let _=t?.currentTheme.metadata.variant??`light`,v;e[16]!==m.metadata.id||e[17]!==f.metadata.id?(v={light:f.metadata.id,dark:m.metadata.id},e[16]=m.metadata.id,e[17]=f.metadata.id,e[18]=v):v=e[18];let y=_===`dark`?`dark`:`light`,b;return e[19]!==v||e[20]!==y?(b={theme:v,themeType:y},e[19]=v,e[20]=y,e[21]=b):b=e[21],b},Wn=()=>({width:typeof window<`u`?window.innerWidth:0,height:typeof window<`u`?window.innerHeight:0}),Gn=e=>{let t=(0,J.c)(3),[n,r]=q.useState(Wn),i,a;return t[0]===e?(i=t[1],a=t[2]):(i=()=>{if(!e||typeof window>`u`)return;let t=()=>{r(Wn())};return t(),window.addEventListener(`resize`,t),()=>{window.removeEventListener(`resize`,t)}},a=[e],t[0]=e,t[1]=i,t[2]=a),q.useEffect(i,a),n},Kn=({popup:e,onOpenChange:t,isMobile:n})=>{let{t:r}=P(),i=ce(),a=ue()??``,o=e.image?.directory??a,s=q.useMemo(()=>{let t=e.image;if(!t)return[];let n=Array.isArray(t.gallery)?t.gallery.filter(e=>!!e?.url):[];return n.length>0?n:[{url:t.url,mimeType:t.mimeType,filename:t.filename,size:t.size}]},[e.image]),[c,l]=q.useState(()=>{let t=e.image?.index??s.findIndex(t=>t.url===e.image?.url);return t>=0&&t<s.length?t:0}),u=e.previewSource instanceof HTMLImageElement?e.previewSource:void 0,[d,f]=q.useState(null),p=d?.naturalSize,m=e.open,h=Gn(e.open),g=q.useRef(null),_=q.useRef(null),v=q.useRef(null),y=q.useRef(null),b=q.useRef(null),x=q.useRef(null),C=q.useRef(null),[w]=q.useState(()=>({trackX:te(0),dismissX:te(0),dismissY:te(0)})),T=q.useRef(null),E=q.useRef(null),D=q.useRef(null),O=q.useRef(null),k=q.useRef({scale:1,x:0,y:0}),A=q.useRef({image:{width:1,height:1},viewport:{width:1,height:1},maxScale:5}),F=q.useRef(new Map),I=q.useRef(null),L=q.useRef(null),z=q.useRef(null),re=q.useRef(0);q.useEffect(()=>{e.open&&(re.current=typeof performance<`u`?performance.now():Date.now())},[e.open]);let ie=S(()=>(typeof performance<`u`?performance.now():Date.now())-re.current<Fn);q.useEffect(()=>{if(!e.open||s.length===0)return;let t=typeof e.image?.index==`number`?e.image.index:-1;if(t>=0&&t<s.length){l(t);return}let n=e.image?.url?s.findIndex(t=>t.url===e.image?.url):-1;l(n>=0?n:0)},[s,e.image?.index,e.image?.url,e.open]);let ae=s[c]??s[0]??e.image,oe=d?.source??``,se=d?.resourceKey??``,B=s.length>1,le=n&&B?Array.from(new Set([(c-1+s.length)%s.length,c,(c+1)%s.length])):[c],de=e=>{v.current=e.element,f(t=>t?.element===e.element&&t.source===e.source&&t.resourceKey===e.resourceKey&&t.loaded===e.loaded&&t.error===e.error&&t.naturalSize?.width===e.naturalSize?.width&&t.naturalSize?.height===e.naturalSize?.height?t:e)},fe=S(()=>{s.length<=1||l(e=>(e-1+s.length)%s.length)}),V=S(()=>{s.length<=1||l(e=>(e+1)%s.length)}),pe=q.useMemo(()=>{let e={width:Math.max(1,h.width*(n?1:.8)),height:Math.max(1,h.height*(n?1:.95))};return p?Vt(p,e):e},[p,n,h.height,h.width]),H=q.useMemo(()=>({image:pe,viewport:{width:Math.max(1,h.width),height:Math.max(1,h.height)},maxScale:5}),[pe,h.height,h.width]),me=S(()=>{let e=z.current;z.current=null,e&&(v.current&&(v.current.style.transition=e.animate?`transform 180ms cubic-bezier(0.22, 1, 0.36, 1)`:`none`,v.current.style.transform=`translate3d(${e.transform.x}px, ${e.transform.y}px, 0) scale(${e.transform.scale})`),O.current&&(O.current.textContent=`${Math.round(e.transform.scale*100)}%`),g.current&&(g.current.style.cursor=e.transform.scale>1?`grab`:`zoom-in`));let t=w.trackX.get(),n=w.dismissY.get(),r=qt(n,A.current.viewport.height),i=y.current;In(i,`transform`,`translate3d(${t}px, 0, 0)`),i&&s.length===2&&In(i.querySelector(`[data-image-viewer-slide]:not([data-image-viewer-slide="0"])`),`transform`,`translate3d(${(t>0?-1:1)*(h.width+16)}px, 0, 0)`),In(b.current,`transform`,`translate3d(${w.dismissX.get()}px, ${n}px, 0) scale(${r.scale})`),In(C.current,`opacity`,`${r.opacity}`),In(x.current,`opacity`,`${r.opacity}`)}),U=S(()=>ne.render(me)),W=S(()=>{R(me),me()}),G=S((e,t=!1,n=null)=>{let r=Ht(e,A.current);k.current=r,z.current={transform:r,animate:t},w.trackX.jump(n?.galleryX??0),w.dismissX.jump(n?.dismissX??0),w.dismissY.jump(n?.dismissY??0),U()}),K=S(()=>{let e=T.current;T.current=null,e?.animations.forEach(e=>e.stop())}),he=S(()=>{D.current!==null&&clearTimeout(D.current),D.current=null}),ge=S((e,t={x:0,y:0})=>{K(),W();let n=e===`next`?-(h.width+16):e===`previous`?h.width+16:0,r=()=>{e===`next`?V():e===`previous`?fe():(G(k.current),W())},i=[[w.trackX,n,t.x],[w.dismissX,0,t.x*Gt],[w.dismissY,0,t.y]].filter(([e,t])=>Math.abs(e.get()-t)>.5);if(i.length===0||window.matchMedia(`(prefers-reduced-motion: reduce)`).matches){r();return}let a=i.map(([t,n,r])=>{let i=r*(n-t.get())>0?r*1e3:0;return ee(t,n,{type:`spring`,bounce:0,visualDuration:e===`none`?.32:.26,velocity:i,restDelta:1,restSpeed:60,onUpdate:U})}),o={animations:a};T.current=o,Promise.all(a.map(e=>e.finished)).then(()=>{T.current===o&&(T.current=null,_.current?.closest(`[data-media-preview-closing]`)||r())},()=>{T.current===o&&(T.current=null,G(k.current),W())})}),J=S((e=!0)=>{K(),G({scale:1,x:0,y:0},e)}),X=S(()=>({x:A.current.viewport.width/2,y:A.current.viewport.height/2})),Z=S((e,t,n=!1)=>{K(),G(Ut(k.current,e,t,X(),A.current),n)}),ve=S(e=>{if(k.current.scale>1.01){J(!0);return}Z(2,e,!0)}),ye=S(e=>{if(he(),Qt(E.current,e)){E.current=null,ve(e);return}E.current=e,!ie()&&(D.current=setTimeout(()=>{D.current=null,E.current=null,on(e,()=>t(!1))},Zt))}),be=S(e=>{if(!(n||e.defaultPrevented)){if(e.key===`+`||e.key===`=`){e.preventDefault(),Z(k.current.scale*1.4,X(),!0);return}if(e.key===`-`||e.key===`_`){e.preventDefault(),Z(k.current.scale/1.4,X(),!0);return}if(e.key===`0`){e.preventDefault(),J(!0);return}if(e.key===`ArrowLeft`&&B){e.preventDefault(),fe();return}e.key===`ArrowRight`&&B&&(e.preventDefault(),V())}});q.useEffect(()=>{if(e.open)return window.addEventListener(`keydown`,be),()=>{window.removeEventListener(`keydown`,be)}},[e.open]),q.useLayoutEffect(()=>{R(me),z.current=null,K(),he(),E.current=null,w.trackX.jump(0),w.dismissX.jump(0),w.dismissY.jump(0),k.current={scale:1,x:0,y:0},F.current.clear(),I.current=null,L.current=null,y.current?.querySelectorAll(`img`).forEach(e=>{e.style.transition=`none`,e.style.transform=`translate3d(0, 0, 0) scale(1)`}),y.current&&(y.current.style.transform=`translate3d(0, 0, 0)`),b.current&&(b.current.style.transform=`none`),C.current=_.current?.closest(`[data-media-preview]`)?.querySelector(`[data-media-preview-backdrop]`)??null,C.current&&(C.current.style.opacity=`1`),x.current&&(x.current.style.opacity=`1`),O.current&&(O.current.textContent=`100%`)},[c,o,e.image?.url,w]),q.useLayoutEffect(()=>{let e=A.current.viewport.width!==H.viewport.width||A.current.viewport.height!==H.viewport.height;A.current=H;let t=Ht(k.current,A.current);k.current=t,v.current&&(v.current.style.transition=`none`,v.current.style.transform=`translate3d(${t.x}px, ${t.y}px, 0) scale(${t.scale})`),e&&(K(),F.current.clear(),I.current=null,L.current=null,G(t),W())},[H,K,G,W]),q.useEffect(()=>()=>{K(),he(),R(me),z.current=null},[]);let xe=S(e=>{if(n)return;e.preventDefault();let t={x:e.clientX,y:e.clientY},r=Math.exp(-e.deltaY*.002);Z(k.current.scale*r,t)});q.useEffect(()=>{let e=g.current;if(!(!m||n||!e))return e.addEventListener(`wheel`,xe,{passive:!1}),()=>e.removeEventListener(`wheel`,xe)},[n,m]),q.useEffect(()=>{let e=g.current;if(!(!m||!n||!e))return _e(e)},[n,m]);let Se=S(e=>{n||(e.preventDefault(),ve({x:e.clientX,y:e.clientY}))}),Ce=S(e=>{e.preventDefault(),e.stopPropagation()}),we=S(e=>{e.pointerType!==`mouse`&&e.preventDefault(),e.currentTarget.setPointerCapture(e.pointerId);let t={x:e.clientX,y:e.clientY};F.current.set(e.pointerId,{point:t,pointerType:e.pointerType});let r=T.current!==null;if(K(),he(),F.current.size===1){let i=t,a=null,o=w.trackX.get(),s=w.dismissY.get(),c=r&&n&&e.pointerType!==`mouse`&&k.current.scale<=1.01;c&&Math.abs(o)>.5?(a=`x`,i={x:t.x-o,y:t.y}):c&&s>.5?(a=`y`,i={x:t.x-w.dismissX.get()/Gt,y:t.y-s}):r&&(G(k.current),W()),I.current={pointerId:e.pointerId,pointerType:e.pointerType,start:i,transform:k.current,moved:a!==null,targetWasCanvas:e.target===e.currentTarget,suppressTap:!1,axis:a,samples:[{...t,time:e.timeStamp}]},g.current&&k.current.scale>1&&(g.current.style.cursor=`grabbing`);return}I.current&&(I.current.suppressTap=!0),G(k.current),W();let i=Array.from(F.current.values()).slice(0,2).map(e=>e.point),a=i[1].x-i[0].x,o=i[1].y-i[0].y;L.current={distance:Math.max(1,Math.hypot(a,o)),midpoint:{x:(i[0].x+i[1].x)/2,y:(i[0].y+i[1].y)/2},transform:k.current},I.current&&(I.current.suppressTap=!0)}),Te=S(e=>{if(!F.current.has(e.pointerId))return;e.preventDefault();let t={x:e.clientX,y:e.clientY};if(F.current.set(e.pointerId,{point:t,pointerType:e.pointerType}),F.current.size>=2&&L.current){let e=Array.from(F.current.values()).slice(0,2).map(e=>e.point),t=e[1].x-e[0].x,n=e[1].y-e[0].y,r={x:(e[0].x+e[1].x)/2,y:(e[0].y+e[1].y)/2},i=L.current.transform.scale*Math.hypot(t,n)/L.current.distance;G(en(L.current.transform,L.current.midpoint,r,i,X(),A.current));return}let r=I.current;if(!r||r.pointerId!==e.pointerId)return;let i={x:t.x-r.start.x,y:t.y-r.start.y};for(r.samples.push({...t,time:e.timeStamp});r.samples.length>2&&e.timeStamp-r.samples[0].time>100;)r.samples.shift();if(Math.hypot(i.x,i.y)>10&&(r.moved=!0),n&&r.pointerType!==`mouse`&&!r.suppressTap){let e=Yt(r.transform,i,A.current,r.axis,B);r.axis=e.axis,G(e.transform,!1,e)}else r.transform.scale>1.01&&G(Wt(r.transform,i,A.current))}),Ee=S((e,r)=>{let i=I.current,a=F.current.get(e.pointerId);if(!a)return;let o=a?{x:e.clientX,y:e.clientY}:void 0;F.current.delete(e.pointerId);let s;if(i?.pointerId===e.pointerId&&o){let t={x:o.x-i.start.x,y:o.y-i.start.y},a=i.moved||Math.hypot(t.x,t.y)>10;if(n&&i.pointerType!==`mouse`&&!i.suppressTap&&a){let n=Yt(i.transform,t,A.current,i.axis,B);G(n.transform,!1,n);let a=Xt([...i.samples,{...o,time:e.timeStamp}]),c=r?`none`:$t(n,a,A.current.viewport);c===`close`&&!ie()?s=o:ge(c===`close`?`none`:c,a)}else{let t=Bt({isMobile:n,pointerType:i.pointerType,cancelled:r,moved:a,suppressTap:i.suppressTap,targetWasCanvas:i.targetWasCanvas,start:i.start,end:o,startScale:i.transform.scale,hasMultipleImages:B});t===`next`&&V(),t===`previous`&&fe(),t===`close`&&n&&i.pointerType!==`mouse`?ye({...o,time:e.timeStamp}):t===`close`&&!ie()&&(s=o)}}if(F.current.size===1){let[t,n]=Array.from(F.current.entries())[0];I.current={pointerId:t,pointerType:n.pointerType,start:n.point,transform:k.current,moved:!1,targetWasCanvas:!1,suppressTap:!0,axis:null,samples:[{...n.point,time:e.timeStamp}]},L.current=null}else F.current.size===0&&(I.current=null,L.current=null,g.current&&(g.current.style.cursor=k.current.scale>1?`grab`:`zoom-in`));e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId),s&&(W(),n&&i?.pointerType!==`mouse`?on(s,()=>t(!1)):t(!1))}),De=S(e=>{e.preventDefault(),e.stopPropagation(),I.current&&(I.current.suppressTap=!0)});if(!m||!ae||typeof document>`u`)return null;let Oe=i?.currentTheme.metadata.variant===`dark`?`text-foreground hover:bg-foreground/15 hover:text-foreground`:`text-background hover:bg-background/15 hover:text-background`;return(0,Y.jsxs)(`div`,{ref:_,className:`absolute inset-0 overflow-hidden select-none`,tabIndex:-1,onClick:Ce,children:[(0,Y.jsx)(`div`,{ref:g,"data-image-viewer-canvas":``,className:`absolute inset-0 flex items-center justify-center overflow-hidden touch-none [overscroll-behavior:none]`,onDoubleClick:n?void 0:Se,onContextMenu:De,onPointerDown:we,onPointerMove:Te,onPointerUp:e=>Ee(e,!1),onPointerCancel:e=>Ee(e,!0),onLostPointerCapture:e=>Ee(e,!0),children:(0,Y.jsx)(`div`,{ref:b,"data-image-viewer-dismiss":``,className:`pointer-events-none absolute inset-0 will-change-transform`,children:(0,Y.jsx)(`div`,{ref:y,"data-image-viewer-track":``,className:`pointer-events-none absolute inset-0 will-change-transform`,children:le.map(t=>{let r=s[t];if(!r)return null;let i=t===c,a=i?0:s.length===2||t===(c+1)%s.length?1:-1;return(0,Y.jsx)(tn,{url:r.url,directory:o,label:r.filename||e.title,active:i,returnToSource:r.url===e.image?.url,sourceElement:r.url===e.image?.url?u:void 0,viewport:h,isMobile:n,position:a,onActiveImage:de},`${t}\n${r.url}`)})})})}),(0,Y.jsxs)(`div`,{ref:x,className:`pointer-events-none absolute inset-0 [&_button]:pointer-events-auto`,children:[(0,Y.jsx)(un,{onClose:()=>t(!1),isMobile:n,size:pe}),(0,Y.jsxs)(dn,{isMobile:n,children:[B&&(0,Y.jsxs)(`span`,{"data-media-gallery-counter":``,className:`min-w-10 px-1 text-center typography-micro tabular-nums opacity-80`,children:[c+1,` / `,s.length]}),B&&(0,Y.jsx)(`span`,{className:`mx-0.5 h-4 w-px bg-current opacity-15`,"aria-hidden":`true`}),(0,Y.jsx)(j,{variant:n?`ghost`:`mobileGlass`,size:n?`icon`:`mobileIcon`,className:M(`rounded-full`,n&&`size-8`,n&&Oe),onClick:()=>Z(k.current.scale/1.4,X(),!0),"aria-label":r(`chat.toolOutputDialog.image.zoomOutAria`),title:r(`chat.toolOutputDialog.image.zoomOutAria`),children:(0,Y.jsx)(N,{name:`subtract`,weight:`medium`,className:n?`size-4`:`size-6`})}),(0,Y.jsxs)(j,{variant:n?`ghost`:`mobileGlass`,size:n?`sm`:`lg`,"data-media-zoom-reset":``,className:M(`rounded-full tabular-nums`,n?`min-w-12`:`min-w-20`,n&&Oe),onClick:()=>J(!0),"aria-label":r(`chat.toolOutputDialog.image.resetZoomAria`),title:r(`chat.toolOutputDialog.image.resetZoomAria`),children:[(0,Y.jsx)(N,{name:`restart`,weight:`medium`,className:n?`size-3.5`:`size-5`}),(0,Y.jsx)(`span`,{ref:O,children:`100%`})]}),(0,Y.jsx)(j,{variant:n?`ghost`:`mobileGlass`,size:n?`icon`:`mobileIcon`,className:M(`rounded-full`,n&&`size-8`,n&&Oe),onClick:()=>Z(k.current.scale*1.4,X(),!0),"aria-label":r(`chat.toolOutputDialog.image.zoomInAria`),title:r(`chat.toolOutputDialog.image.zoomInAria`),children:(0,Y.jsx)(N,{name:`add`,weight:`medium`,className:n?`size-4`:`size-6`})}),(0,Y.jsx)(Mn,{isMobile:n,target:{sourceUrl:ae.url||oe,displayUrl:oe||void 0,filename:ae.filename||e.image?.filename||e.title,mimeType:ae.mimeType||e.image?.mimeType,effectiveDirectory:o}},se)]})]})]})},qn=q.memo(e=>{let t=(0,J.c)(7),{popup:n,diffViewMode:r,pierreThemeConfig:i}=e,a=n.content||``,o=r===`unified`?`unified`:`split`,s;t[0]!==i.theme||t[1]!==i.themeType||t[2]!==o?(s={diffStyle:o,diffIndicators:`none`,hunkSeparators:`line-info-basic`,lineDiffType:`none`,disableFileHeader:!0,maxLineDiffLength:1e3,expansionLineCount:20,overflow:`wrap`,theme:i.theme,themeType:i.themeType,unsafeCSS:Vn},t[0]=i.theme,t[1]=i.themeType,t[2]=o,t[3]=s):s=t[3];let c;return t[4]!==a||t[5]!==s?(c=(0,Y.jsx)(`div`,{className:`typography-code`,children:(0,Y.jsx)(A,{patch:a,metrics:Hn,options:s,className:`block w-full`})}),t[4]=a,t[5]=s,t[6]=c):c=t[6],c});qn.displayName=`DialogUnifiedDiff`;var Jn=q.memo(e=>{let t=(0,J.c)(29),{popup:n,pierreThemeConfig:r}=e,i;t[0]===n.content?i=t[1]:(i=Je(n.content),t[0]=n.content,t[1]=i);let a=i,o=n.metadata?.input,s;t[2]===o?s=t[3]:(s=typeof o==`object`&&o?o:{},t[2]=o,t[3]=s);let c=s,l=typeof c.offset==`number`?c.offset:0,u=typeof c.file_path==`string`?c.file_path:typeof c.filePath==`string`?c.filePath:typeof c.path==`string`?c.path:`read-output`,d;t[4]===a.lines?d=t[5]:(d=a.lines.map(Zn).join(`
|
|
16
|
-
`),t[4]=a.lines,t[5]=d);let f=d,p;t[6]!==u||t[7]!==n.language?(p=n.language||F(u)||`text`,t[6]=u,t[7]=n.language,t[8]=p):p=t[8];let m=p,h;t[9]===a.lines?h=t[10]:(h=a.lines.some(Qn),t[9]=a.lines,t[10]=h);let g=h,_;if(t[11]!==g||t[12]!==l||t[13]!==a.lines||t[14]!==a.type){_=[];let e=l;for(let t of a.lines){t.lineNumber!==null&&(e=t.lineNumber);let n=a.type===`file`&&!g&&t.lineNumber===null&&!t.isInfo,r=t.lineNumber??(n?e+1:null);typeof r==`number`&&(e=r),_.push({text:t.text,lineNumber:r,isInfo:t.isInfo})}t[11]=g,t[12]=l,t[13]=a.lines,t[14]=a.type,t[15]=_}else _=t[15];let v=_;if(a.type===`file`){let e=m||void 0,n;t[16]!==f||t[17]!==u||t[18]!==e?(n={name:u,contents:f,lang:e},t[16]=f,t[17]=u,t[18]=e,t[19]=n):n=t[19];let i;t[20]!==r.theme||t[21]!==r.themeType?(i={disableFileHeader:!0,overflow:`wrap`,theme:r.theme,themeType:r.themeType},t[20]=r.theme,t[21]=r.themeType,t[22]=i):i=t[22];let a;return t[23]!==n||t[24]!==i?(a=(0,Y.jsx)(k,{file:n,options:i,className:`block w-full`}),t[23]=n,t[24]=i,t[25]=a):a=t[25],a}let y;return t[26]!==v||t[27]!==m?(y=(0,Y.jsx)(ct,{lines:v,language:m,maxHeight:`70vh`}),t[26]=v,t[27]=m,t[28]=y):y=t[28],y});Jn.displayName=`DialogReadContent`;var Yn=({popup:e,onOpenChange:t,isMobile:n})=>{let r=_(),i=r?.entry.location.hostId?r.entry:void 0,{t:a}=P(),o=ce(),s=q.useMemo(()=>o?.currentTheme.metadata.variant===`dark`?o.currentTheme:o?.availableThemes.find(e=>e.metadata.id===o.darkThemeId&&e.metadata.variant===`dark`)??le(!0),[o?.currentTheme,o?.availableThemes,o?.darkThemeId]),[c,l]=q.useState(e.mermaid?.source||``),[u,d]=q.useState(e.mermaid?.source?`ready`:`idle`),[f,p]=q.useState(``),m=q.useRef(0),h=q.useCallback(e=>{let t=e.trim();if(!t.toLowerCase().startsWith(`file://`))return null;let n=e=>{if(!e||/[\0\r\n]/.test(e))return!1;let t=e.replace(/\\/g,`/`);return t.split(`/`).filter(Boolean).includes(`..`)?!1:t.startsWith(`/`)?!0:/^[A-Za-z]:\//.test(t)},r=e=>e.replace(/%([0-9A-Fa-f]{2})/g,(e,t)=>{let n=Number.parseInt(t,16);return Number.isFinite(n)?String.fromCharCode(n):`%${t}`});if(typeof URL.canParse==`function`&&URL.canParse(t)){let e=r(new URL(t).pathname||``);return/^\/[A-Za-z]:\//.test(e)&&(e=e.slice(1)),n(e)?e:null}let i=t.replace(/^file:\/\//i,``),a=r(i);return n(a)?a:n(i)?i:null},[]),g=q.useCallback(async()=>{let t=e.mermaid,n=Pt(m.current);if(m.current=n,!t?.url){d(`error`),p(a(`chat.toolOutputDialog.mermaid.missingSource`));return}if(t.source){l(t.source),d(`ready`),p(``);return}d(`loading`),p(``);let r;if(t.url.startsWith(`data:`))r=Lt(t.url);else if(t.url.toLowerCase().startsWith(`file://`)){let e=h(t.url);r=e?x({path:e,scope:i}).then(e=>e.ok?e.text():Promise.reject(Ln(`chat.toolOutputDialog.mermaid.readFileFailedWithStatus`,{status:e.status}))):Promise.reject(Ln(`chat.toolOutputDialog.mermaid.invalidLocalPath`))}else{let e=typeof URL.canParse==`function`&&URL.canParse(t.url,window.location.origin)?new URL(t.url,window.location.origin):null;r=!e||e.protocol!==`http:`&&e.protocol!==`https:`?Promise.reject(Ln(`chat.toolOutputDialog.mermaid.unsupportedUrlProtocol`)):fetch(e.toString()).then(e=>e.ok?e.text():Promise.reject(Ln(`chat.toolOutputDialog.mermaid.loadFailedWithStatus`,{status:e.status})))}await r.then(e=>{Ft(m.current,n)&&(l(e),d(`ready`))}).catch(e=>{Ft(m.current,n)&&(d(`error`),p(Nt(e)?a(e.key,e.params):a(`chat.toolOutputDialog.mermaid.loadFailed`)))})},[h,e.mermaid,a,i]);q.useEffect(()=>{!e.open||!e.mermaid||g()},[g,e.mermaid,e.open]);let v=`\`\`\`mermaid\n${c}\n\`\`\``;return!e.open||typeof document>`u`?null:(0,Y.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center`,onClick:e=>{e.target===e.currentTarget&&t(!1)},children:(0,Y.jsxs)(`div`,{"data-mermaid-preview":`true`,"data-preview-transition-target":``,className:`relative flex min-h-0 flex-col overflow-hidden`,style:{width:n?`100%`:`80%`,height:n?`100%`:`95%`},onMouseDown:e=>e.stopPropagation(),children:[(0,Y.jsx)(un,{onClose:()=>t(!1),isMobile:n}),(0,Y.jsx)(`div`,{className:`relative min-h-0 flex-1 overflow-hidden`,children:(0,Y.jsxs)(`div`,{className:`h-full overflow-hidden`,children:[u===`loading`&&(0,Y.jsxs)(`div`,{className:`h-full min-h-28 flex items-center justify-center gap-2 text-muted-foreground typography-meta`,children:[(0,Y.jsx)(N,{name:`loader-4`,className:`h-4 w-4 animate-spin`}),(0,Y.jsx)(`span`,{children:a(`chat.toolOutputDialog.mermaid.loading`)})]}),u===`error`&&(0,Y.jsxs)(`div`,{className:`rounded-xl border p-3 space-y-3`,style:{backgroundColor:`var(--status-error-background)`,borderColor:`var(--status-error-border)`},children:[(0,Y.jsx)(`p`,{className:`typography-markdown`,style:{color:`var(--status-error)`},children:f||a(`chat.toolOutputDialog.mermaid.renderFailed`)}),(0,Y.jsx)(`button`,{type:`button`,onClick:()=>{g()},className:`px-3 py-1.5 rounded-lg typography-meta border transition-colors hover:bg-[var(--interactive-hover)]`,style:{borderColor:`var(--interactive-border)`,color:`var(--surface-foreground)`},children:a(`chat.toolOutputDialog.mermaid.retry`)})]}),u===`ready`&&(0,Y.jsx)(`div`,{className:`h-full`,children:(0,Y.jsx)(V,{content:v,variant:`tool`,allowMermaidWheelEvents:!0,className:`markdown-mermaid-fullscreen h-full`,mermaidControls:Bn,mermaidTheme:s,enableFileReferences:!1})})]})})]})})},Xn=e=>{let t=(0,J.c)(52),{popup:n,onOpenChange:r,isMobile:i}=e,{t:a}=P(),[o,s]=q.useState(`unified`),c=Un(),l;t[0]===n.open?l=t[1]:(l=()=>{n.open&&s(`unified`)},t[0]=n.open,t[1]=l);let u;t[2]!==n.open||t[3]!==n.title?(u=[n.open,n.title],t[2]=n.open,t[3]=n.title,t[4]=u):u=t[4],q.useEffect(l,u);let d=n.video??(n.image&&pe(n.image.url,n.image.mimeType)?n.image:void 0);if(n.image||n.mermaid||d){let e=d?`video`:n.image?`image`:`mermaid`,a;t[5]!==i||t[6]!==n||t[7]!==d?(a=e=>(0,Y.jsx)(Y.Fragment,{children:d?(0,Y.jsx)(Nn,{video:d,onClose:e,isMobile:i}):n.image?(0,Y.jsx)(Kn,{popup:n,onOpenChange:e,isMobile:i}):(0,Y.jsx)(Yn,{popup:n,onOpenChange:e,isMobile:i})}),t[5]=i,t[6]=n,t[7]=d,t[8]=a):a=t[8];let o;return t[9]!==i||t[10]!==r||t[11]!==n.open||t[12]!==n.previewSource||t[13]!==n.title||t[14]!==e||t[15]!==a?(o=(0,Y.jsx)(mn,{open:n.open,title:n.title,kind:e,source:n.previewSource,isMobile:i,onOpenChange:r,children:a}),t[9]=i,t[10]=r,t[11]=n.open,t[12]=n.previewSource,t[13]=n.title,t[14]=e,t[15]=a,t[16]=o):o=t[16],o}let f=n.open,p=i?`w-[95vw] max-w-[95vw]`:`max-w-5xl`,m=i?`[&>button]:right-1`:`[&>button]:top-2.5 [&>button]:right-4`,h;t[17]!==p||t[18]!==m?(h=M(`overflow-hidden flex flex-col min-h-0 pt-3 pb-4 px-4 gap-1`,`[&>button]:top-1.5`,p,m),t[17]=p,t[18]=m,t[19]=h):h=t[19];let g;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(g={maxHeight:`90vh`},t[20]=g):g=t[20];let _;t[21]===n.metadata?_=t[22]:(_=n.metadata?.tool?Rn(n.metadata.tool):(0,Y.jsx)(N,{name:`tools`,className:`h-3.5 w-3.5 text-foreground flex-shrink-0`}),t[21]=n.metadata,t[22]=_);let v;t[23]===n.title?v=t[24]:(v=(0,Y.jsx)(`span`,{className:`break-words flex-1 leading-tight`,children:n.title}),t[23]=n.title,t[24]=v);let y;t[25]!==o||t[26]!==n.isDiff?(y=n.isDiff&&(0,Y.jsx)(ge,{mode:o,onModeChange:s,className:`mr-8 flex-shrink-0`}),t[25]=o,t[26]=n.isDiff,t[27]=y):y=t[27];let b;t[28]!==y||t[29]!==_||t[30]!==v?(b=(0,Y.jsx)(`div`,{className:`flex-shrink-0 pb-1`,children:(0,Y.jsxs)(`div`,{className:`flex items-start gap-2 text-foreground typography-ui-header font-semibold`,children:[_,v,y]})}),t[28]=y,t[29]=_,t[30]=v,t[31]=b):b=t[31];let x;t[32]!==c||t[33]!==n.metadata?(x=n.metadata?.input&&typeof n.metadata.input==`object`&&Object.keys(n.metadata.input).length>0&&n.metadata?.tool!==`todowrite`&&n.metadata?.tool!==`todoread`&&n.metadata?.tool!==`apply_patch`?(()=>{let e=n.metadata,t=e.input,r=e=>{let n=t[e];return typeof n==`string`?n:typeof n==`number`?String(n):null};return(0,Y.jsxs)(`div`,{className:`border-b border-border/20 p-4 -mx-3`,children:[(0,Y.jsx)(`div`,{className:`typography-markdown font-medium text-muted-foreground mb-2 px-3`,children:e.tool===`bash`||e.tool===`shell`?`Command:`:e.tool===`task`||e.tool===`subagent`?`Task Details:`:`Input:`}),(e.tool===`bash`||e.tool===`shell`)&&r(`command`)?(0,Y.jsx)(`div`,{className:`tool-input-surface bg-transparent rounded-xl border border-border/20 mx-3`,children:(0,Y.jsx)(Re,{language:`bash`,code:r(`command`),style:E.getPopupStyles(),codeStyle:zn.style,wrap:!0})}):(e.tool===`task`||e.tool===`subagent`)&&r(`prompt`)?(0,Y.jsxs)(`div`,{className:`tool-input-surface bg-transparent rounded-xl border border-border/20 font-mono whitespace-pre-wrap text-foreground/90 mx-3`,style:E.getPopupStyles(),children:[r(`description`)?`Task: ${r(`description`)}\n`:``,r(`subagent_type`)||r(`agent`)?`Agent Type: ${r(`subagent_type`)||r(`agent`)}\n`:``,`Instructions:\n${r(`prompt`)}`]}):e.tool===`write`&&r(`content`)?(0,Y.jsx)(`div`,{className:`tool-input-surface bg-transparent rounded-xl border border-border/20 mx-3`,children:(0,Y.jsx)(k,{file:{name:r(`filePath`)||r(`file_path`)||`new-file`,contents:r(`content`),lang:F(r(`filePath`)||r(`file_path`)||``)||void 0},options:{disableFileHeader:!0,overflow:`wrap`,theme:c.theme,themeType:c.themeType},className:`block w-full`})}):(0,Y.jsx)(`div`,{className:`tool-input-surface bg-transparent rounded-xl border border-border/20 font-mono whitespace-pre-wrap text-foreground/90 mx-3`,style:E.getPopupStyles(),children:Ue(t,e.tool)})]})})():null,t[32]=c,t[33]=n.metadata,t[34]=x):x=t[34];let S;t[35]!==o||t[36]!==i||t[37]!==c||t[38]!==n||t[39]!==a?(S=n.isDiff?(0,Y.jsx)(qn,{popup:n,diffViewMode:o,pierreThemeConfig:c}):n.content?(0,Y.jsx)(`div`,{className:`p-4`,children:(()=>{let e=n.metadata?.tool;return e===`todowrite`||e===`todoread`?tt(n.content)||(0,Y.jsx)(Re,{language:`json`,code:n.content,style:E.getPopupContainerStyles(),codeStyle:zn.style,wrap:!0}):e===`list`?Ye(n.content)||(0,Y.jsx)(`pre`,{className:`typography-markdown bg-muted/30 p-2 rounded-xl border border-border/20 font-mono whitespace-pre-wrap`,children:n.content}):e===`grep`?Ze(n.content,i)||(0,Y.jsx)(`pre`,{className:`typography-code bg-muted/30 p-2 rounded-xl border border-border/20 font-mono whitespace-pre-wrap`,children:n.content}):e===`glob`?$e(n.content,i)||(0,Y.jsx)(`pre`,{className:`typography-code bg-muted/30 p-2 rounded-xl border border-border/20 font-mono whitespace-pre-wrap`,children:n.content}):e===`task`||e===`subagent`||e===`reasoning`?(0,Y.jsx)(`div`,{className:e===`reasoning`?`text-muted-foreground/70`:``,children:(0,Y.jsx)(V,{content:n.content,variant:`tool`})}):e===`web-search`||e===`websearch`||e===`search_web`?nt(n.content)||(0,Y.jsx)(Re,{language:`text`,code:n.content,style:E.getPopupContainerStyles(),codeStyle:zn.style,wrap:!0}):e===`read`?(0,Y.jsx)(Jn,{popup:n,pierreThemeConfig:c}):(n.content?Ke(n.content):{data:null,isJson:!1}).isJson?(0,Y.jsx)(At,{jsonString:n.content,initiallyExpandedDepth:3,maxHeight:`70vh`}):(0,Y.jsx)(Re,{language:n.language||`text`,code:n.content,style:E.getPopupContainerStyles(),codeStyle:zn.style,wrap:!0})})()}):(0,Y.jsxs)(`div`,{className:`p-8 text-muted-foreground typography-ui-header`,children:[(0,Y.jsx)(`div`,{className:`mb-2`,children:a(`chat.toolOutputDialog.commandCompleted`)}),(0,Y.jsx)(`div`,{className:`typography-meta`,children:a(`chat.toolOutputDialog.noOutputProduced`)})]}),t[35]=o,t[36]=i,t[37]=c,t[38]=n,t[39]=a,t[40]=S):S=t[40];let C;t[41]!==x||t[42]!==S?(C=(0,Y.jsx)(`div`,{className:`flex-1 min-h-0 rounded-xl border border-border/30 bg-muted/10 overflow-hidden`,children:(0,Y.jsxs)(`div`,{className:`tool-output-surface h-full max-h-[75vh] overflow-y-auto px-3 pr-4`,children:[x,S]})}),t[41]=x,t[42]=S,t[43]=C):C=t[43];let w;t[44]!==b||t[45]!==C||t[46]!==h?(w=(0,Y.jsxs)(ie,{className:h,style:g,children:[b,C]}),t[44]=b,t[45]=C,t[46]=h,t[47]=w):w=t[47];let T;return t[48]!==r||t[49]!==n.open||t[50]!==w?(T=(0,Y.jsx)(ae,{open:f,onOpenChange:r,children:w}),t[48]=r,t[49]=n.open,t[50]=w,t[51]=T):T=t[51],T};function Zn(e){return e.text}function Qn(e){return e.lineNumber!==null}export{it as a,rt as c,Re as d,ke as f,Z as g,De as h,Be as i,tt as l,Ae as m,Pn as n,qe as o,Oe as p,at as r,Ue as s,Xn as t,Ke as u};
|
|
16
|
+
`),t[4]=a.lines,t[5]=d);let f=d,p;t[6]!==u||t[7]!==n.language?(p=n.language||F(u)||`text`,t[6]=u,t[7]=n.language,t[8]=p):p=t[8];let m=p,h;t[9]===a.lines?h=t[10]:(h=a.lines.some(Qn),t[9]=a.lines,t[10]=h);let g=h,_;if(t[11]!==g||t[12]!==l||t[13]!==a.lines||t[14]!==a.type){_=[];let e=l;for(let t of a.lines){t.lineNumber!==null&&(e=t.lineNumber);let n=a.type===`file`&&!g&&t.lineNumber===null&&!t.isInfo,r=t.lineNumber??(n?e+1:null);typeof r==`number`&&(e=r),_.push({text:t.text,lineNumber:r,isInfo:t.isInfo})}t[11]=g,t[12]=l,t[13]=a.lines,t[14]=a.type,t[15]=_}else _=t[15];let v=_;if(a.type===`file`){let e=m||void 0,n;t[16]!==f||t[17]!==u||t[18]!==e?(n={name:u,contents:f,lang:e},t[16]=f,t[17]=u,t[18]=e,t[19]=n):n=t[19];let i;t[20]!==r.theme||t[21]!==r.themeType?(i={disableFileHeader:!0,overflow:`wrap`,theme:r.theme,themeType:r.themeType},t[20]=r.theme,t[21]=r.themeType,t[22]=i):i=t[22];let a;return t[23]!==n||t[24]!==i?(a=(0,Y.jsx)(k,{file:n,options:i,className:`block w-full`}),t[23]=n,t[24]=i,t[25]=a):a=t[25],a}let y;return t[26]!==v||t[27]!==m?(y=(0,Y.jsx)(ct,{lines:v,language:m,maxHeight:`70vh`}),t[26]=v,t[27]=m,t[28]=y):y=t[28],y});Jn.displayName=`DialogReadContent`;var Yn=({popup:e,onOpenChange:t,isMobile:n})=>{let r=_(),i=r?.entry.location.hostId?r.entry:void 0,{t:a}=P(),o=ce(),s=q.useMemo(()=>o?.currentTheme.metadata.variant===`dark`?o.currentTheme:o?.availableThemes.find(e=>e.metadata.id===o.darkThemeId&&e.metadata.variant===`dark`)??le(!0),[o?.currentTheme,o?.availableThemes,o?.darkThemeId]),[c,l]=q.useState(e.mermaid?.source||``),[u,d]=q.useState(e.mermaid?.source?`ready`:`idle`),[f,p]=q.useState(``),m=q.useRef(0),h=q.useCallback(e=>{let t=e.trim();if(!t.toLowerCase().startsWith(`file://`))return null;let n=e=>{if(!e||/[\0\r\n]/.test(e))return!1;let t=e.replace(/\\/g,`/`);return t.split(`/`).filter(Boolean).includes(`..`)?!1:t.startsWith(`/`)?!0:/^[A-Za-z]:\//.test(t)},r=e=>e.replace(/%([0-9A-Fa-f]{2})/g,(e,t)=>{let n=Number.parseInt(t,16);return Number.isFinite(n)?String.fromCharCode(n):`%${t}`});if(typeof URL.canParse==`function`&&URL.canParse(t)){let e=r(new URL(t).pathname||``);return/^\/[A-Za-z]:\//.test(e)&&(e=e.slice(1)),n(e)?e:null}let i=t.replace(/^file:\/\//i,``),a=r(i);return n(a)?a:n(i)?i:null},[]),g=q.useCallback(async()=>{let t=e.mermaid,n=Pt(m.current);if(m.current=n,!t?.url){d(`error`),p(a(`chat.toolOutputDialog.mermaid.missingSource`));return}if(t.source){l(t.source),d(`ready`),p(``);return}d(`loading`),p(``);let r;if(t.url.startsWith(`data:`))r=Lt(t.url);else if(t.url.toLowerCase().startsWith(`file://`)){let e=h(t.url);r=e?x({path:e,scope:i}).then(e=>e.ok?e.text():Promise.reject(Ln(`chat.toolOutputDialog.mermaid.readFileFailedWithStatus`,{status:e.status}))):Promise.reject(Ln(`chat.toolOutputDialog.mermaid.invalidLocalPath`))}else{let e=typeof URL.canParse==`function`&&URL.canParse(t.url,window.location.origin)?new URL(t.url,window.location.origin):null;r=!e||e.protocol!==`http:`&&e.protocol!==`https:`?Promise.reject(Ln(`chat.toolOutputDialog.mermaid.unsupportedUrlProtocol`)):fetch(e.toString()).then(e=>e.ok?e.text():Promise.reject(Ln(`chat.toolOutputDialog.mermaid.loadFailedWithStatus`,{status:e.status})))}await r.then(e=>{Ft(m.current,n)&&(l(e),d(`ready`))}).catch(e=>{Ft(m.current,n)&&(d(`error`),p(Nt(e)?a(e.key,e.params):a(`chat.toolOutputDialog.mermaid.loadFailed`)))})},[h,e.mermaid,a,i]);q.useEffect(()=>{!e.open||!e.mermaid||g()},[g,e.mermaid,e.open]);let v=`\`\`\`mermaid\n${c}\n\`\`\``;return!e.open||typeof document>`u`?null:(0,Y.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center`,onClick:e=>{e.target===e.currentTarget&&t(!1)},children:(0,Y.jsxs)(`div`,{"data-mermaid-preview":`true`,"data-preview-transition-target":``,className:`relative flex min-h-0 flex-col overflow-hidden`,style:{width:n?`100%`:`80%`,height:n?`100%`:`95%`},onMouseDown:e=>e.stopPropagation(),children:[(0,Y.jsx)(un,{onClose:()=>t(!1),isMobile:n}),(0,Y.jsx)(`div`,{className:`relative min-h-0 flex-1 overflow-hidden`,children:(0,Y.jsxs)(`div`,{className:`h-full overflow-hidden`,children:[u===`loading`&&(0,Y.jsxs)(`div`,{className:`h-full min-h-28 flex items-center justify-center gap-2 text-muted-foreground typography-meta`,children:[(0,Y.jsx)(N,{name:`loader-4`,className:`h-4 w-4 animate-spin`}),(0,Y.jsx)(`span`,{children:a(`chat.toolOutputDialog.mermaid.loading`)})]}),u===`error`&&(0,Y.jsxs)(`div`,{className:`rounded-xl border p-3 space-y-3`,style:{backgroundColor:`var(--status-error-background)`,borderColor:`var(--status-error-border)`},children:[(0,Y.jsx)(`p`,{className:`typography-markdown`,style:{color:`var(--status-error)`},children:f||a(`chat.toolOutputDialog.mermaid.renderFailed`)}),(0,Y.jsx)(`button`,{type:`button`,onClick:()=>{g()},className:`px-3 py-1.5 rounded-lg typography-meta border transition-colors hover:bg-[var(--interactive-hover)]`,style:{borderColor:`var(--interactive-border)`,color:`var(--surface-foreground)`},children:a(`chat.toolOutputDialog.mermaid.retry`)})]}),u===`ready`&&(0,Y.jsx)(`div`,{className:`h-full`,children:(0,Y.jsx)(V,{content:v,variant:`tool`,allowMermaidWheelEvents:!0,className:`markdown-mermaid-fullscreen h-full`,mermaidControls:Bn,mermaidTheme:s,enableFileReferences:!1})})]})})]})})},Xn=e=>{let t=(0,J.c)(52),{popup:n,onOpenChange:r,isMobile:i}=e,{t:a}=P(),[o,s]=q.useState(`unified`),c=Un(),l;t[0]===n.open?l=t[1]:(l=()=>{n.open&&s(`unified`)},t[0]=n.open,t[1]=l);let u;t[2]!==n.open||t[3]!==n.title?(u=[n.open,n.title],t[2]=n.open,t[3]=n.title,t[4]=u):u=t[4],q.useEffect(l,u);let d=n.video??(n.image&&pe(n.image.url,n.image.mimeType)?n.image:void 0);if(n.image||n.mermaid||d){let e=d?`video`:n.image?`image`:`mermaid`,a;t[5]!==i||t[6]!==n||t[7]!==d?(a=e=>(0,Y.jsx)(Y.Fragment,{children:d?(0,Y.jsx)(Nn,{video:d,onClose:e,isMobile:i}):n.image?(0,Y.jsx)(Kn,{popup:n,onOpenChange:e,isMobile:i}):(0,Y.jsx)(Yn,{popup:n,onOpenChange:e,isMobile:i})}),t[5]=i,t[6]=n,t[7]=d,t[8]=a):a=t[8];let o;return t[9]!==i||t[10]!==r||t[11]!==n.open||t[12]!==n.previewSource||t[13]!==n.title||t[14]!==e||t[15]!==a?(o=(0,Y.jsx)(mn,{open:n.open,title:n.title,kind:e,source:n.previewSource,isMobile:i,onOpenChange:r,children:a}),t[9]=i,t[10]=r,t[11]=n.open,t[12]=n.previewSource,t[13]=n.title,t[14]=e,t[15]=a,t[16]=o):o=t[16],o}let f=n.open,p=i?`w-[95vw] max-w-[95vw]`:`max-w-5xl`,m=i?`[&>button]:right-1`:`[&>button]:top-2.5 [&>button]:right-4`,h;t[17]!==p||t[18]!==m?(h=M(`overflow-hidden flex flex-col min-h-0 pt-3 pb-4 px-4 gap-1`,`[&>button]:top-1.5`,p,m),t[17]=p,t[18]=m,t[19]=h):h=t[19];let g;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(g={maxHeight:`90vh`},t[20]=g):g=t[20];let _;t[21]===n.metadata?_=t[22]:(_=n.metadata?.tool?Rn(n.metadata.tool):(0,Y.jsx)(N,{name:`tools`,className:`h-3.5 w-3.5 text-foreground flex-shrink-0`}),t[21]=n.metadata,t[22]=_);let v;t[23]===n.title?v=t[24]:(v=(0,Y.jsx)(`span`,{className:`break-words flex-1 leading-tight`,children:n.title}),t[23]=n.title,t[24]=v);let y;t[25]!==o||t[26]!==n.isDiff?(y=n.isDiff&&(0,Y.jsx)(ge,{mode:o,onModeChange:s,className:`mr-8 flex-shrink-0`}),t[25]=o,t[26]=n.isDiff,t[27]=y):y=t[27];let b;t[28]!==y||t[29]!==_||t[30]!==v?(b=(0,Y.jsx)(`div`,{className:`flex-shrink-0 pb-1`,children:(0,Y.jsxs)(`div`,{className:`flex items-start gap-2 text-foreground typography-ui-header font-semibold`,children:[_,v,y]})}),t[28]=y,t[29]=_,t[30]=v,t[31]=b):b=t[31];let x;t[32]!==c||t[33]!==n.metadata?(x=n.metadata?.input&&typeof n.metadata.input==`object`&&Object.keys(n.metadata.input).length>0&&n.metadata?.tool!==`todowrite`&&n.metadata?.tool!==`todoread`&&n.metadata?.tool!==`apply_patch`?(()=>{let e=n.metadata,t=e.input,r=e=>{let n=t[e];return typeof n==`string`?n:typeof n==`number`?String(n):null};return(0,Y.jsxs)(`div`,{className:`border-b border-border/20 p-4 -mx-3`,children:[(0,Y.jsx)(`div`,{className:`typography-markdown font-medium text-muted-foreground mb-2 px-3`,children:e.tool===`bash`||e.tool===`shell`?`Command:`:e.tool===`task`||e.tool===`subagent`?`Task Details:`:`Input:`}),(e.tool===`bash`||e.tool===`shell`)&&r(`command`)?(0,Y.jsx)(`div`,{className:`tool-input-surface bg-transparent rounded-xl border border-border/20 mx-3`,children:(0,Y.jsx)(Re,{language:`bash`,code:r(`command`),style:T.getPopupStyles(),codeStyle:zn.style,wrap:!0})}):(e.tool===`task`||e.tool===`subagent`)&&r(`prompt`)?(0,Y.jsxs)(`div`,{className:`tool-input-surface bg-transparent rounded-xl border border-border/20 font-mono whitespace-pre-wrap text-foreground/90 mx-3`,style:T.getPopupStyles(),children:[r(`description`)?`Task: ${r(`description`)}\n`:``,r(`subagent_type`)||r(`agent`)?`Agent Type: ${r(`subagent_type`)||r(`agent`)}\n`:``,`Instructions:\n${r(`prompt`)}`]}):e.tool===`write`&&r(`content`)?(0,Y.jsx)(`div`,{className:`tool-input-surface bg-transparent rounded-xl border border-border/20 mx-3`,children:(0,Y.jsx)(k,{file:{name:r(`filePath`)||r(`file_path`)||`new-file`,contents:r(`content`),lang:F(r(`filePath`)||r(`file_path`)||``)||void 0},options:{disableFileHeader:!0,overflow:`wrap`,theme:c.theme,themeType:c.themeType},className:`block w-full`})}):(0,Y.jsx)(`div`,{className:`tool-input-surface bg-transparent rounded-xl border border-border/20 font-mono whitespace-pre-wrap text-foreground/90 mx-3`,style:T.getPopupStyles(),children:Ue(t,e.tool)})]})})():null,t[32]=c,t[33]=n.metadata,t[34]=x):x=t[34];let S;t[35]!==o||t[36]!==i||t[37]!==c||t[38]!==n||t[39]!==a?(S=n.isDiff?(0,Y.jsx)(qn,{popup:n,diffViewMode:o,pierreThemeConfig:c}):n.content?(0,Y.jsx)(`div`,{className:`p-4`,children:(()=>{let e=n.metadata?.tool;return e===`todowrite`||e===`todoread`?tt(n.content)||(0,Y.jsx)(Re,{language:`json`,code:n.content,style:T.getPopupContainerStyles(),codeStyle:zn.style,wrap:!0}):e===`list`?Ye(n.content)||(0,Y.jsx)(`pre`,{className:`typography-markdown bg-muted/30 p-2 rounded-xl border border-border/20 font-mono whitespace-pre-wrap`,children:n.content}):e===`grep`?Ze(n.content,i)||(0,Y.jsx)(`pre`,{className:`typography-code bg-muted/30 p-2 rounded-xl border border-border/20 font-mono whitespace-pre-wrap`,children:n.content}):e===`glob`?$e(n.content,i)||(0,Y.jsx)(`pre`,{className:`typography-code bg-muted/30 p-2 rounded-xl border border-border/20 font-mono whitespace-pre-wrap`,children:n.content}):e===`task`||e===`subagent`||e===`reasoning`?(0,Y.jsx)(`div`,{className:e===`reasoning`?`text-muted-foreground/70`:``,children:(0,Y.jsx)(V,{content:n.content,variant:`tool`})}):e===`web-search`||e===`websearch`||e===`search_web`?nt(n.content)||(0,Y.jsx)(Re,{language:`text`,code:n.content,style:T.getPopupContainerStyles(),codeStyle:zn.style,wrap:!0}):e===`read`?(0,Y.jsx)(Jn,{popup:n,pierreThemeConfig:c}):(n.content?Ke(n.content):{data:null,isJson:!1}).isJson?(0,Y.jsx)(At,{jsonString:n.content,initiallyExpandedDepth:3,maxHeight:`70vh`}):(0,Y.jsx)(Re,{language:n.language||`text`,code:n.content,style:T.getPopupContainerStyles(),codeStyle:zn.style,wrap:!0})})()}):(0,Y.jsxs)(`div`,{className:`p-8 text-muted-foreground typography-ui-header`,children:[(0,Y.jsx)(`div`,{className:`mb-2`,children:a(`chat.toolOutputDialog.commandCompleted`)}),(0,Y.jsx)(`div`,{className:`typography-meta`,children:a(`chat.toolOutputDialog.noOutputProduced`)})]}),t[35]=o,t[36]=i,t[37]=c,t[38]=n,t[39]=a,t[40]=S):S=t[40];let C;t[41]!==x||t[42]!==S?(C=(0,Y.jsx)(`div`,{className:`flex-1 min-h-0 rounded-xl border border-border/30 bg-muted/10 overflow-hidden`,children:(0,Y.jsxs)(`div`,{className:`tool-output-surface h-full max-h-[75vh] overflow-y-auto px-3 pr-4`,children:[x,S]})}),t[41]=x,t[42]=S,t[43]=C):C=t[43];let w;t[44]!==b||t[45]!==C||t[46]!==h?(w=(0,Y.jsxs)(ie,{className:h,style:g,children:[b,C]}),t[44]=b,t[45]=C,t[46]=h,t[47]=w):w=t[47];let E;return t[48]!==r||t[49]!==n.open||t[50]!==w?(E=(0,Y.jsx)(ae,{open:f,onOpenChange:r,children:w}),t[48]=r,t[49]=n.open,t[50]=w,t[51]=E):E=t[51],E};function Zn(e){return e.text}function Qn(e){return e.lineNumber!==null}export{it as a,rt as c,Re as d,ke as f,Z as g,De as h,Be as i,tt as l,Ae as m,Pn as n,qe as o,Oe as p,at as r,Ue as s,Xn as t,Ke as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{ot as t,st as n}from"./vendor-base-ui-wXsskyKm.js";import{n as r}from"./vendor-react-BkccXcWz.js";import{t as i}from"./i18n-BZ_vx76q.js";import{t as a}from"./useThemeSystem-BIXghnHj.js";var o=r(),s=e(n(),1),c=(0,s.createContext)(null),l=t(),u=e=>{let t=(0,o.c)(22),{className:n,width:r,height:u,isAnimated:d}=e,f=n===void 0?``:n,p=r===void 0?70:r,m=u===void 0?70:u,h=d!==void 0&&d,{t:g}=i(),_=a(),v=s.useContext(c),y=_?_.currentTheme.metadata.variant!==`light`:typeof window<`u`&&window.matchMedia(`(prefers-color-scheme: dark)`).matches;if(v?.logo){let e=v.logo,n;t[0]===g?n=t[1]:(n=g(`yuriLogo.aria.logo`),t[0]=g,t[1]=n);let r;return t[2]!==v.logo||t[3]!==f||t[4]!==m||t[5]!==n||t[6]!==p?(r=(0,l.jsx)(`img`,{src:e,width:p,height:m,className:f,alt:n,"data-yuri-logo":!0}),t[2]=v.logo,t[3]=f,t[4]=m,t[5]=n,t[6]=p,t[7]=r):r=t[7],r}let b;t[8]===g?b=t[9]:(b=g(`yuriLogo.aria.logo`),t[8]=g,t[9]=b);let x;t[10]===h?x=t[11]:(x=h?(0,l.jsx)(`style`,{children:`@keyframes yuri-logo-breathe{50%{opacity:.65}}.yuri-logo-breathe{animation:yuri-logo-breathe 1.8s ease-in-out infinite}@media(prefers-reduced-motion:reduce){.yuri-logo-breathe{animation:none}}`}):null,t[10]=h,t[11]=x);let S=y?`white`:`black`,C=h?`yuri-logo-breathe`:void 0,w;t[12]!==S||t[13]!==C?(w=(0,l.jsx)(`path`,{fill:S,fillRule:`evenodd`,className:C,d:`M48.34 6.03L47.62 6.07L46.95 6.12L46.64 6.15L46.20 6.21L45.36 6.34L44.97 6.42L44.61 6.48L43.53 6.73L43.27 6.79L43.01 6.86L42.16 7.13L41.77 7.24L41.22 7.41L40.38 7.70L39.25 8.13L38.84 8.30L38.28 8.57L37.62 8.85L37.30 9.01L36.95 9.20L36.25 9.59L35.44 10.06L34.74 10.46L34.40 10.67L33.76 11.16L33.51 11.34L32.95 11.71L32.41 12.10L31.98 12.42L31.81 12.56L31.64 12.71L31.06 13.26L30.53 13.75L29.89 14.37L29.30 14.91L29.11 15.10L28.90 15.33L28.71 15.57L28.17 16.29L27.78 16.77L27.42 17.22L27.26 17.44L26.87 17.99L26.58 18.43L26.27 18.87L25.98 19.32L25.77 19.71L25.04 21.09L24.83 21.54L24.51 22.27L24.32 22.73L24.11 23.31L23.97 23.69L23.84 24.11L23.62 24.79L23.45 25.39L23.37 25.79L23.26 26.22L23.20 26.52L23.10 27.10L23.04 27.49L22.92 28.38L22.88 28.87L22.85 29.36L22.84 29.89L22.83 30.38L22.83 31.01L22.84 31.45L22.87 31.85L22.89 32.21L23.02 33.41L23.08 33.89L23.14 34.20L23.24 34.63L23.36 35.06L23.46 35.50L23.62 36.10L23.79 36.66L23.96 37.16L24.14 37.67L24.41 38.37L24.55 38.70L24.93 39.51L25.38 40.48L25.73 41.20L25.85 41.44L26.10 41.86L26.38 42.32L26.89 43.21L27.25 43.83L27.50 44.30L27.83 44.88L27.96 45.16L28.19 45.65L28.34 46.02L28.52 46.48L28.66 46.90L28.85 47.54L29.02 48.19L29.06 48.41L29.14 48.89L29.23 49.42L29.27 49.82L29.30 50.58L29.30 51.24L29.27 52.09L29.25 52.45L29.23 52.67L29.15 53.38L29.06 53.99L28.78 55.40L28.71 55.79L28.52 56.62L28.36 57.22L28.11 57.93L27.59 59.31L27.47 59.60L27.33 59.88L26.73 61.12L26.64 61.28L26.25 61.92L25.96 62.38L25.53 63.10L25.31 63.44L24.96 63.96L23.92 65.41L23.70 65.69L23.25 66.19L23.05 66.42L22.89 66.64L22.52 67.14L22.14 67.58L21.72 68.10L21.36 68.56L21.25 68.70L21.23 68.74L21.23 68.78L21.26 68.82L21.30 68.83L21.34 68.83L22.18 68.73L23.16 68.63L23.38 68.61L24.10 68.60L25.08 68.60L25.43 68.61L25.97 68.64L26.63 68.72L27.08 68.75L27.25 68.78L28.22 68.92L29.19 69.11L29.41 69.15L30.10 69.33L30.70 69.49L31.08 69.61L31.72 69.81L32.23 69.99L32.97 70.28L33.75 70.61L34.40 70.92L34.80 71.11L35.31 71.38L36.00 71.79L36.55 72.09L36.85 72.28L37.58 72.79L38.10 73.14L38.46 73.41L38.70 73.60L39.82 74.49L40.06 74.68L40.49 75.00L40.77 75.22L41.10 75.52L41.55 75.96L41.98 76.35L42.17 76.53L42.39 76.76L42.72 77.18L42.90 77.38L43.02 77.51L43.47 77.94L43.74 78.24L44.15 78.71L44.64 79.29L44.98 79.71L45.13 79.92L45.26 80.16L45.28 80.20L45.29 80.24L45.27 80.27L45.23 80.29L45.19 80.27L44.95 80.08L44.75 79.90L44.40 79.56L44.07 79.26L43.64 78.87L43.44 78.70L42.77 78.16L42.42 77.89L41.51 77.25L40.74 76.64L39.96 76.05L39.26 75.58L38.54 75.12L37.39 74.44L36.59 73.96L36.31 73.81L35.95 73.63L34.83 73.09L33.89 72.67L33.57 72.52L33.11 72.34L31.78 71.84L31.61 71.78L31.23 71.66L30.79 71.55L29.81 71.27L29.20 71.11L29.03 71.07L28.33 70.93L27.71 70.84L27.32 70.77L27.10 70.74L26.83 70.71L26.39 70.68L25.86 70.61L25.28 70.57L24.96 70.56L24.52 70.56L24.03 70.56L23.76 70.58L23.10 70.64L22.30 70.73L22.08 70.76L21.15 70.92L20.72 71.03L20.33 71.12L19.74 71.31L19.15 71.51L18.77 71.64L18.40 71.80L17.87 72.03L17.71 72.11L17.55 72.20L17.21 72.41L16.74 72.75L16.22 73.09L15.90 73.33L15.61 73.54L15.30 73.80L14.97 74.09L14.52 74.53L14.27 74.78L13.90 75.23L13.34 75.92L13.09 76.24L12.89 76.53L12.31 77.49L12.16 77.76L12.06 77.96L11.97 78.16L11.86 78.45L11.84 78.49L11.84 78.54L11.85 78.58L11.88 78.61L11.93 78.62L12.88 78.37L13.40 78.26L14.01 78.14L14.54 78.03L14.84 77.97L15.59 77.87L16.57 77.77L17.32 77.67L17.50 77.66L17.72 77.65L18.52 77.63L19.82 77.63L20.58 77.63L21.87 77.67L22.31 77.70L22.62 77.72L23.65 77.82L24.00 77.86L24.57 77.95L25.24 78.04L25.98 78.16L26.42 78.24L26.91 78.33L27.26 78.39L27.65 78.47L28.13 78.56L28.57 78.67L28.96 78.74L29.31 78.83L29.74 78.92L30.12 79.04L30.94 79.26L31.54 79.44L32.18 79.64L32.98 79.91L33.79 80.15L33.96 80.21L35.30 80.71L36.63 81.22L37.04 81.39L37.58 81.60L38.49 81.98L39.48 82.39L39.92 82.59L40.36 82.81L40.60 82.92L41.18 83.18L41.92 83.49L42.44 83.73L42.84 83.92L43.73 84.34L44.42 84.66L45.15 85.00L45.51 85.18L46.29 85.60L46.66 85.77L47.13 86.01L47.74 86.29L48.22 86.52L49.54 87.17L50.10 87.46L50.94 87.87L52.09 88.45L53.85 89.22L54.05 89.31L54.52 89.56L54.88 89.74L55.21 89.89L55.58 90.05L56.65 90.50L57.21 90.77L57.70 90.99L58.15 91.17L58.48 91.31L58.94 91.47L59.54 91.67L59.92 91.79L60.30 91.92L60.88 92.13L61.59 92.40L62.01 92.55L62.78 92.78L63.99 93.10L64.68 93.28L65.12 93.37L65.55 93.47L66.25 93.62L67.39 93.81L67.75 93.85L68.06 93.88L69.17 93.95L69.70 93.99L70.02 94.00L70.24 93.99L70.28 93.98L70.32 93.96L70.31 93.92L70.28 93.89L70.21 93.84L70.09 93.79L69.55 93.57L69.06 93.35L68.46 93.06L66.66 92.08L66.00 91.71L65.73 91.55L65.35 91.31L64.91 91.01L64.23 90.58L63.75 90.25L63.32 89.94L63.03 89.73L61.99 88.89L61.42 88.46L61.01 88.12L60.74 87.88L60.22 87.39L59.66 86.82L59.10 86.24L58.62 85.78L58.43 85.59L58.24 85.40L57.95 85.06L57.51 84.56L57.09 84.04L56.42 83.25L56.03 82.77L55.87 82.56L55.64 82.23L55.40 81.91L54.98 81.28L54.78 80.98L54.25 80.10L54.00 79.68L53.37 78.55L53.20 78.23L52.81 77.43L52.64 77.07L52.48 76.66L52.12 75.69L51.96 75.23L51.85 74.89L51.76 74.60L51.60 74.04L51.41 73.21L51.34 72.82L51.25 72.38L51.14 71.77L50.98 71.03L50.79 70.29L50.61 69.65L50.45 69.14L50.26 68.59L50.00 67.97L49.91 67.77L49.82 67.61L49.60 67.23L49.21 66.63L49.05 66.42L48.85 66.17L48.71 66.00L48.56 65.84L48.18 65.46L47.95 65.25L47.74 65.08L46.72 64.29L46.52 64.11L46.12 63.75L45.29 62.94L45.10 62.75L44.65 62.26L44.37 61.91L43.99 61.41L43.64 60.90L43.38 60.48L43.16 60.10L43.03 59.86L42.63 59.06L42.31 58.33L42.23 58.12L42.16 57.91L42.15 57.87L42.15 57.82L42.17 57.78L42.21 57.77L42.25 57.78L42.32 57.84L42.41 57.94L42.49 58.04L42.67 58.30L42.80 58.48L43.19 58.96L43.99 59.86L44.18 60.05L44.38 60.24L44.55 60.38L45.02 60.78L45.97 61.60L46.35 61.91L46.63 62.13L46.99 62.39L47.56 62.75L47.79 62.88L49.13 63.59L49.77 63.91L50.54 64.27L51.31 64.62L51.59 64.74L51.97 64.89L53.02 65.27L53.77 65.53L54.40 65.77L55.12 66.01L55.67 66.18L56.58 66.42L57.52 66.70L59.15 67.14L59.84 67.35L60.30 67.51L60.75 67.69L60.96 67.78L61.20 67.90L61.40 68.00L61.59 68.11L61.81 68.26L62.10 68.47L62.28 68.61L62.41 68.72L62.66 68.97L62.81 69.14L62.93 69.28L63.06 69.46L63.21 69.68L64.12 71.16L64.32 71.46L64.45 71.64L64.65 71.88L65.19 72.53L65.49 72.86L65.84 73.20L66.11 73.44L66.31 73.61L66.91 74.08L67.41 74.45L67.67 74.63L68.04 74.87L68.23 74.98L68.28 74.99L68.32 74.97L68.32 74.92L68.32 74.88L68.31 74.84L68.23 74.67L67.56 73.27L67.47 73.06L67.27 72.52L67.16 72.23L66.93 71.46L66.89 71.28L66.85 71.06L66.81 70.75L66.79 70.49L66.78 70.27L66.77 70.00L66.77 69.60L66.78 69.37L66.81 68.97L66.84 68.71L66.90 68.40L66.95 68.14L67.06 67.75L67.12 67.54L67.27 67.12L67.44 66.66L67.51 66.49L67.61 66.29L67.98 65.58L68.38 64.78L68.51 64.50L68.57 64.38L68.64 64.27L68.74 64.12L68.77 64.09L68.81 64.08L68.85 64.11L68.86 64.16L68.85 64.20L68.83 64.33L68.79 64.46L68.73 64.67L68.60 65.05L68.51 65.35L68.39 65.78L68.33 66.04L68.21 66.61L68.07 67.49L68.01 67.98L67.98 68.29L67.96 68.87L67.96 69.31L67.98 69.76L68.01 70.11L68.06 70.47L68.18 71.03L68.22 71.21L68.37 71.72L68.43 71.89L68.53 72.14L68.75 72.63L68.93 72.98L69.39 73.80L69.56 74.11L69.75 74.51L70.07 75.20L70.25 75.71L70.69 76.97L71.04 77.88L71.14 78.18L71.28 78.65L71.46 79.20L71.58 79.54L71.69 79.78L71.78 79.98L71.94 80.30L72.22 80.81L72.62 81.56L72.82 81.91L72.98 82.17L73.30 82.66L73.62 83.14L73.81 83.39L74.24 83.96L74.41 84.17L74.58 84.37L74.83 84.63L75.05 84.84L75.26 85.02L75.30 85.04L75.34 85.05L75.37 85.02L75.37 84.98L75.36 84.94L75.24 84.65L74.99 84.08L74.62 83.21L74.43 82.67L74.06 81.57L73.92 81.01L73.69 79.91L73.57 79.26L73.52 78.90L73.37 77.53L73.33 77.17L73.32 76.86L73.29 76.06L73.28 75.75L73.29 75.44L73.32 74.81L73.34 74.55L73.57 72.78L73.69 72.07L73.82 71.46L73.98 70.54L74.02 70.28L74.10 69.70L74.17 69.04L74.20 68.64L74.22 68.14L74.21 67.83L74.20 67.61L74.19 67.39L74.14 66.99L74.01 66.20L73.95 65.94L73.83 65.51L73.67 65.05L73.51 64.68L73.27 64.19L72.81 63.28L72.70 63.04L72.65 62.91L72.59 62.75L72.54 62.53L72.51 62.35L72.50 62.18L72.50 62.00L72.50 61.86L72.52 61.69L72.55 61.56L72.58 61.43L72.65 61.26L72.72 61.10L72.81 60.94L72.93 60.76L73.02 60.66L73.11 60.56L73.31 60.38L73.69 60.08L73.82 59.95L73.93 59.82L73.98 59.74L74.02 59.66L74.06 59.58L74.10 59.46L74.12 59.33L74.14 59.24L74.14 59.15L74.14 59.06L74.12 58.97L74.09 58.84L74.05 58.72L74.02 58.63L73.96 58.52L73.91 58.44L73.83 58.33L73.78 58.27L73.68 58.18L73.61 58.13L73.53 58.08L73.45 58.05L73.28 58.00L73.06 57.97L72.74 57.96L72.48 57.97L72.25 57.99L71.86 58.03L71.59 58.08L70.33 58.35L70.11 58.41L69.47 58.59L69.17 58.69L68.58 58.87L68.44 58.89L68.31 58.91L68.27 58.90L68.25 58.87L68.26 58.83L68.28 58.80L68.46 58.66L68.67 58.50L68.93 58.32L69.20 58.16L69.59 57.95L69.79 57.85L70.00 57.76L70.20 57.69L71.26 57.34L71.78 57.19L71.95 57.15L72.56 57.02L72.78 56.98L73.14 56.94L73.71 56.90L73.85 56.88L73.97 56.85L74.10 56.81L74.22 56.75L74.34 56.69L74.46 56.62L74.57 56.55L74.67 56.47L74.77 56.38L74.83 56.31L74.89 56.25L74.97 56.14L75.05 55.98L75.11 55.81L75.13 55.73L75.15 55.60L75.16 55.46L75.16 55.33L75.14 54.93L75.10 54.49L75.07 54.31L75.05 54.18L75.00 54.01L74.92 53.80L74.85 53.64L74.76 53.48L74.61 53.26L74.44 53.05L74.23 52.82L73.98 52.57L73.89 52.47L73.86 52.43L73.85 52.39L73.86 52.35L73.88 52.31L73.92 52.29L73.96 52.28L74.09 52.26L74.27 52.26L74.58 52.26L74.94 52.29L75.11 52.31L75.29 52.35L75.59 52.41L75.94 52.48L76.51 52.61L76.86 52.67L77.17 52.70L77.48 52.72L77.75 52.71L77.97 52.68L78.19 52.64L78.36 52.59L78.53 52.53L78.69 52.45L78.85 52.37L79.00 52.27L79.10 52.19L79.20 52.10L79.29 52.00L79.36 51.89L79.45 51.73L79.50 51.61L79.54 51.48L79.57 51.35L79.58 51.22L79.57 51.09L79.56 50.91L79.53 50.78L79.50 50.65L79.36 50.13L79.25 49.75L79.13 49.27L78.88 48.47L78.48 47.14L78.34 46.72L78.08 45.86L77.99 45.57L77.89 45.22L77.64 44.41L77.48 43.86L77.37 43.42L77.27 43.08L77.11 42.48L76.94 41.83L76.86 41.44L76.77 41.09L76.69 40.66L76.56 40.09L76.39 39.21L76.25 38.47L76.18 38.16L76.14 38.04L76.08 37.87L75.99 37.72L75.88 37.53L75.59 37.13L75.39 36.88L75.28 36.75L75.04 36.49L74.65 36.12L74.48 35.97L74.30 35.84L73.80 35.47L73.35 35.17L72.97 34.95L72.42 34.66L71.81 34.38L70.44 33.83L69.90 33.62L69.39 33.45L68.28 33.11L67.77 32.98L67.64 32.93L67.48 32.86L67.44 32.84L67.41 32.81L67.41 32.78L67.44 32.75L67.49 32.74L67.71 32.73L67.98 32.74L68.20 32.77L68.82 32.86L69.30 32.93L70.14 33.07L70.84 33.21L71.10 33.28L72.17 33.58L72.72 33.75L72.94 33.81L73.44 33.99L73.65 34.07L73.86 34.15L74.54 34.48L74.94 34.67L75.30 34.86L75.69 35.08L75.99 35.27L76.28 35.48L76.58 35.74L76.98 36.10L77.21 36.30L77.32 36.38L77.40 36.40L77.48 36.41L77.56 36.39L77.63 36.35L77.74 36.28L77.84 36.19L77.96 36.06L78.07 35.92L78.14 35.80L78.20 35.69L78.26 35.56L78.30 35.44L78.33 35.31L78.35 35.18L78.36 35.04L78.34 34.73L78.31 34.51L78.28 34.34L78.03 33.25L77.92 32.64L77.82 32.20L77.79 32.02L77.77 31.80L77.72 31.27L77.65 30.16L77.57 29.18L77.39 27.94L77.36 27.72L77.28 27.33L77.20 26.89L77.04 26.20L77.00 26.02L76.85 25.51L76.69 24.95L76.49 24.36L76.40 24.11L76.31 23.81L76.23 23.60L76.14 23.39L76.05 23.19L75.61 22.27L75.23 21.51L74.93 20.96L74.38 19.99L73.64 18.82L73.18 18.17L72.96 17.89L72.11 16.91L71.27 15.87L70.77 15.30L70.49 15.02L70.16 14.71L69.60 14.20L69.17 13.81L68.94 13.60L68.54 13.25L68.16 12.94L67.75 12.59L67.54 12.42L67.22 12.18L66.68 11.79L65.94 11.29L65.20 10.79L64.71 10.48L64.05 10.10L62.65 9.33L62.29 9.14L62.01 9.01L61.73 8.87L60.87 8.51L60.34 8.27L59.93 8.08L59.61 7.94L59.15 7.77L58.13 7.42L57.79 7.32L57.50 7.23L56.86 7.03L56.26 6.86L55.39 6.64L54.74 6.49L54.34 6.42L53.86 6.33L53.29 6.24L52.58 6.15L52.36 6.12L51.11 6.04L50.53 6.01L50.13 6.00L49.38 6.00L48.66 6.01ZM84.78 23.79L84.64 23.81L84.51 23.84L84.08 23.95L83.87 24.03L83.63 24.14L83.51 24.21L83.40 24.28L83.18 24.44L82.99 24.62L82.84 24.79L82.66 25.04L82.52 25.27L82.46 25.39L82.39 25.55L82.33 25.72L82.28 25.84L82.18 26.23L82.13 26.49L82.12 26.63L82.11 26.76L82.12 26.89L82.13 27.07L82.15 27.20L82.18 27.38L82.23 27.60L82.28 27.77L82.36 27.98L82.49 28.26L82.55 28.38L82.62 28.49L82.70 28.60L82.79 28.70L82.97 28.90L83.07 28.99L83.20 29.10L83.42 29.26L83.54 29.32L83.66 29.39L84.06 29.57L84.19 29.61L84.32 29.65L84.58 29.70L84.71 29.72L84.84 29.73L85.16 29.74L85.33 29.73L85.47 29.71L85.82 29.65L86.03 29.60L86.16 29.55L86.36 29.47L86.61 29.35L86.76 29.26L86.91 29.16L87.16 28.98L87.43 28.74L87.52 28.65L87.61 28.55L87.73 28.36L87.88 28.09L87.99 27.84L88.04 27.67L88.08 27.55L88.13 27.28L88.15 27.11L88.16 26.97L88.16 26.66L88.14 26.35L88.10 26.09L88.07 25.95L88.03 25.83L87.92 25.53L87.87 25.41L87.78 25.25L87.72 25.14L87.64 25.03L87.48 24.82L87.29 24.63L87.08 24.46L86.83 24.28L86.59 24.15L86.35 24.04L86.10 23.95L85.62 23.83L85.40 23.79L85.27 23.78L85.09 23.77L84.91 23.78ZM63.90 37.84L63.95 37.83L63.99 37.83L64.15 37.92L64.63 38.23L65.01 38.47L65.60 38.87L66.10 39.16L66.54 39.39L66.78 39.50L67.02 39.61L67.44 39.77L68.36 40.10L68.88 40.25L69.05 40.30L69.22 40.34L69.92 40.46L70.15 40.49L70.37 40.52L71.66 40.61L72.15 40.63L72.59 40.62L72.68 40.63L72.72 40.65L72.75 40.68L72.77 40.72L72.76 40.77L72.74 40.81L72.71 40.84L72.60 40.91L72.41 41.03L72.22 41.13L72.01 41.22L71.68 41.35L71.51 41.41L71.00 41.56L70.87 41.59L70.65 41.62L70.25 41.67L69.98 41.69L69.63 41.68L69.31 41.66L69.00 41.62L68.83 41.59L68.66 41.55L68.11 41.37L67.78 41.24L67.41 41.07L67.09 40.91L66.82 40.76L66.63 40.64L66.45 40.51L65.95 40.13L65.68 39.90L65.38 39.64L65.05 39.33L64.77 39.04L64.51 38.74L64.11 38.26L63.92 38.01L63.90 37.98L63.88 37.93L63.88 37.89Z`}),t[12]=S,t[13]=C,t[14]=w):w=t[14];let T;return t[15]!==f||t[16]!==m||t[17]!==b||t[18]!==x||t[19]!==w||t[20]!==p?(T=(0,l.jsxs)(`svg`,{width:p,height:m,viewBox:`0 0 100 100`,xmlns:`http://www.w3.org/2000/svg`,className:f,role:`img`,"aria-label":b,"data-yuri-logo":!0,children:[x,w]}),t[15]=f,t[16]=m,t[17]=b,t[18]=x,t[19]=w,t[20]=p,t[21]=T):T=t[21],T};export{c as n,u as t};
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{ot as t,st as n}from"./vendor-base-ui-wXsskyKm.js";import{n as r}from"./vendor-react-BkccXcWz.js";import{t as i}from"./i18n-CJn52oz0.js";import{t as a}from"./useThemeSystem-BIXghnHj.js";var o=r(),s=e(n(),1),c=(0,s.createContext)(null),l=t(),u=e=>{let t=(0,o.c)(22),{className:n,width:r,height:u,isAnimated:d}=e,f=n===void 0?``:n,p=r===void 0?70:r,m=u===void 0?70:u,h=d!==void 0&&d,{t:g}=i(),_=a(),v=s.useContext(c),y=_?_.currentTheme.metadata.variant!==`light`:typeof window<`u`&&window.matchMedia(`(prefers-color-scheme: dark)`).matches;if(v?.logo){let e=v.logo,n;t[0]===g?n=t[1]:(n=g(`yuriLogo.aria.logo`),t[0]=g,t[1]=n);let r;return t[2]!==v.logo||t[3]!==f||t[4]!==m||t[5]!==n||t[6]!==p?(r=(0,l.jsx)(`img`,{src:e,width:p,height:m,className:f,alt:n,"data-yuri-logo":!0}),t[2]=v.logo,t[3]=f,t[4]=m,t[5]=n,t[6]=p,t[7]=r):r=t[7],r}let b;t[8]===g?b=t[9]:(b=g(`yuriLogo.aria.logo`),t[8]=g,t[9]=b);let x;t[10]===h?x=t[11]:(x=h?(0,l.jsx)(`style`,{children:`@keyframes yuri-logo-breathe{50%{opacity:.65}}.yuri-logo-breathe{animation:yuri-logo-breathe 1.8s ease-in-out infinite}@media(prefers-reduced-motion:reduce){.yuri-logo-breathe{animation:none}}`}):null,t[10]=h,t[11]=x);let S=y?`white`:`black`,C=h?`yuri-logo-breathe`:void 0,w;t[12]!==S||t[13]!==C?(w=(0,l.jsx)(`path`,{fill:S,fillRule:`evenodd`,className:C,d:`M48.34 6.03L47.62 6.07L46.95 6.12L46.64 6.15L46.20 6.21L45.36 6.34L44.97 6.42L44.61 6.48L43.53 6.73L43.27 6.79L43.01 6.86L42.16 7.13L41.77 7.24L41.22 7.41L40.38 7.70L39.25 8.13L38.84 8.30L38.28 8.57L37.62 8.85L37.30 9.01L36.95 9.20L36.25 9.59L35.44 10.06L34.74 10.46L34.40 10.67L33.76 11.16L33.51 11.34L32.95 11.71L32.41 12.10L31.98 12.42L31.81 12.56L31.64 12.71L31.06 13.26L30.53 13.75L29.89 14.37L29.30 14.91L29.11 15.10L28.90 15.33L28.71 15.57L28.17 16.29L27.78 16.77L27.42 17.22L27.26 17.44L26.87 17.99L26.58 18.43L26.27 18.87L25.98 19.32L25.77 19.71L25.04 21.09L24.83 21.54L24.51 22.27L24.32 22.73L24.11 23.31L23.97 23.69L23.84 24.11L23.62 24.79L23.45 25.39L23.37 25.79L23.26 26.22L23.20 26.52L23.10 27.10L23.04 27.49L22.92 28.38L22.88 28.87L22.85 29.36L22.84 29.89L22.83 30.38L22.83 31.01L22.84 31.45L22.87 31.85L22.89 32.21L23.02 33.41L23.08 33.89L23.14 34.20L23.24 34.63L23.36 35.06L23.46 35.50L23.62 36.10L23.79 36.66L23.96 37.16L24.14 37.67L24.41 38.37L24.55 38.70L24.93 39.51L25.38 40.48L25.73 41.20L25.85 41.44L26.10 41.86L26.38 42.32L26.89 43.21L27.25 43.83L27.50 44.30L27.83 44.88L27.96 45.16L28.19 45.65L28.34 46.02L28.52 46.48L28.66 46.90L28.85 47.54L29.02 48.19L29.06 48.41L29.14 48.89L29.23 49.42L29.27 49.82L29.30 50.58L29.30 51.24L29.27 52.09L29.25 52.45L29.23 52.67L29.15 53.38L29.06 53.99L28.78 55.40L28.71 55.79L28.52 56.62L28.36 57.22L28.11 57.93L27.59 59.31L27.47 59.60L27.33 59.88L26.73 61.12L26.64 61.28L26.25 61.92L25.96 62.38L25.53 63.10L25.31 63.44L24.96 63.96L23.92 65.41L23.70 65.69L23.25 66.19L23.05 66.42L22.89 66.64L22.52 67.14L22.14 67.58L21.72 68.10L21.36 68.56L21.25 68.70L21.23 68.74L21.23 68.78L21.26 68.82L21.30 68.83L21.34 68.83L22.18 68.73L23.16 68.63L23.38 68.61L24.10 68.60L25.08 68.60L25.43 68.61L25.97 68.64L26.63 68.72L27.08 68.75L27.25 68.78L28.22 68.92L29.19 69.11L29.41 69.15L30.10 69.33L30.70 69.49L31.08 69.61L31.72 69.81L32.23 69.99L32.97 70.28L33.75 70.61L34.40 70.92L34.80 71.11L35.31 71.38L36.00 71.79L36.55 72.09L36.85 72.28L37.58 72.79L38.10 73.14L38.46 73.41L38.70 73.60L39.82 74.49L40.06 74.68L40.49 75.00L40.77 75.22L41.10 75.52L41.55 75.96L41.98 76.35L42.17 76.53L42.39 76.76L42.72 77.18L42.90 77.38L43.02 77.51L43.47 77.94L43.74 78.24L44.15 78.71L44.64 79.29L44.98 79.71L45.13 79.92L45.26 80.16L45.28 80.20L45.29 80.24L45.27 80.27L45.23 80.29L45.19 80.27L44.95 80.08L44.75 79.90L44.40 79.56L44.07 79.26L43.64 78.87L43.44 78.70L42.77 78.16L42.42 77.89L41.51 77.25L40.74 76.64L39.96 76.05L39.26 75.58L38.54 75.12L37.39 74.44L36.59 73.96L36.31 73.81L35.95 73.63L34.83 73.09L33.89 72.67L33.57 72.52L33.11 72.34L31.78 71.84L31.61 71.78L31.23 71.66L30.79 71.55L29.81 71.27L29.20 71.11L29.03 71.07L28.33 70.93L27.71 70.84L27.32 70.77L27.10 70.74L26.83 70.71L26.39 70.68L25.86 70.61L25.28 70.57L24.96 70.56L24.52 70.56L24.03 70.56L23.76 70.58L23.10 70.64L22.30 70.73L22.08 70.76L21.15 70.92L20.72 71.03L20.33 71.12L19.74 71.31L19.15 71.51L18.77 71.64L18.40 71.80L17.87 72.03L17.71 72.11L17.55 72.20L17.21 72.41L16.74 72.75L16.22 73.09L15.90 73.33L15.61 73.54L15.30 73.80L14.97 74.09L14.52 74.53L14.27 74.78L13.90 75.23L13.34 75.92L13.09 76.24L12.89 76.53L12.31 77.49L12.16 77.76L12.06 77.96L11.97 78.16L11.86 78.45L11.84 78.49L11.84 78.54L11.85 78.58L11.88 78.61L11.93 78.62L12.88 78.37L13.40 78.26L14.01 78.14L14.54 78.03L14.84 77.97L15.59 77.87L16.57 77.77L17.32 77.67L17.50 77.66L17.72 77.65L18.52 77.63L19.82 77.63L20.58 77.63L21.87 77.67L22.31 77.70L22.62 77.72L23.65 77.82L24.00 77.86L24.57 77.95L25.24 78.04L25.98 78.16L26.42 78.24L26.91 78.33L27.26 78.39L27.65 78.47L28.13 78.56L28.57 78.67L28.96 78.74L29.31 78.83L29.74 78.92L30.12 79.04L30.94 79.26L31.54 79.44L32.18 79.64L32.98 79.91L33.79 80.15L33.96 80.21L35.30 80.71L36.63 81.22L37.04 81.39L37.58 81.60L38.49 81.98L39.48 82.39L39.92 82.59L40.36 82.81L40.60 82.92L41.18 83.18L41.92 83.49L42.44 83.73L42.84 83.92L43.73 84.34L44.42 84.66L45.15 85.00L45.51 85.18L46.29 85.60L46.66 85.77L47.13 86.01L47.74 86.29L48.22 86.52L49.54 87.17L50.10 87.46L50.94 87.87L52.09 88.45L53.85 89.22L54.05 89.31L54.52 89.56L54.88 89.74L55.21 89.89L55.58 90.05L56.65 90.50L57.21 90.77L57.70 90.99L58.15 91.17L58.48 91.31L58.94 91.47L59.54 91.67L59.92 91.79L60.30 91.92L60.88 92.13L61.59 92.40L62.01 92.55L62.78 92.78L63.99 93.10L64.68 93.28L65.12 93.37L65.55 93.47L66.25 93.62L67.39 93.81L67.75 93.85L68.06 93.88L69.17 93.95L69.70 93.99L70.02 94.00L70.24 93.99L70.28 93.98L70.32 93.96L70.31 93.92L70.28 93.89L70.21 93.84L70.09 93.79L69.55 93.57L69.06 93.35L68.46 93.06L66.66 92.08L66.00 91.71L65.73 91.55L65.35 91.31L64.91 91.01L64.23 90.58L63.75 90.25L63.32 89.94L63.03 89.73L61.99 88.89L61.42 88.46L61.01 88.12L60.74 87.88L60.22 87.39L59.66 86.82L59.10 86.24L58.62 85.78L58.43 85.59L58.24 85.40L57.95 85.06L57.51 84.56L57.09 84.04L56.42 83.25L56.03 82.77L55.87 82.56L55.64 82.23L55.40 81.91L54.98 81.28L54.78 80.98L54.25 80.10L54.00 79.68L53.37 78.55L53.20 78.23L52.81 77.43L52.64 77.07L52.48 76.66L52.12 75.69L51.96 75.23L51.85 74.89L51.76 74.60L51.60 74.04L51.41 73.21L51.34 72.82L51.25 72.38L51.14 71.77L50.98 71.03L50.79 70.29L50.61 69.65L50.45 69.14L50.26 68.59L50.00 67.97L49.91 67.77L49.82 67.61L49.60 67.23L49.21 66.63L49.05 66.42L48.85 66.17L48.71 66.00L48.56 65.84L48.18 65.46L47.95 65.25L47.74 65.08L46.72 64.29L46.52 64.11L46.12 63.75L45.29 62.94L45.10 62.75L44.65 62.26L44.37 61.91L43.99 61.41L43.64 60.90L43.38 60.48L43.16 60.10L43.03 59.86L42.63 59.06L42.31 58.33L42.23 58.12L42.16 57.91L42.15 57.87L42.15 57.82L42.17 57.78L42.21 57.77L42.25 57.78L42.32 57.84L42.41 57.94L42.49 58.04L42.67 58.30L42.80 58.48L43.19 58.96L43.99 59.86L44.18 60.05L44.38 60.24L44.55 60.38L45.02 60.78L45.97 61.60L46.35 61.91L46.63 62.13L46.99 62.39L47.56 62.75L47.79 62.88L49.13 63.59L49.77 63.91L50.54 64.27L51.31 64.62L51.59 64.74L51.97 64.89L53.02 65.27L53.77 65.53L54.40 65.77L55.12 66.01L55.67 66.18L56.58 66.42L57.52 66.70L59.15 67.14L59.84 67.35L60.30 67.51L60.75 67.69L60.96 67.78L61.20 67.90L61.40 68.00L61.59 68.11L61.81 68.26L62.10 68.47L62.28 68.61L62.41 68.72L62.66 68.97L62.81 69.14L62.93 69.28L63.06 69.46L63.21 69.68L64.12 71.16L64.32 71.46L64.45 71.64L64.65 71.88L65.19 72.53L65.49 72.86L65.84 73.20L66.11 73.44L66.31 73.61L66.91 74.08L67.41 74.45L67.67 74.63L68.04 74.87L68.23 74.98L68.28 74.99L68.32 74.97L68.32 74.92L68.32 74.88L68.31 74.84L68.23 74.67L67.56 73.27L67.47 73.06L67.27 72.52L67.16 72.23L66.93 71.46L66.89 71.28L66.85 71.06L66.81 70.75L66.79 70.49L66.78 70.27L66.77 70.00L66.77 69.60L66.78 69.37L66.81 68.97L66.84 68.71L66.90 68.40L66.95 68.14L67.06 67.75L67.12 67.54L67.27 67.12L67.44 66.66L67.51 66.49L67.61 66.29L67.98 65.58L68.38 64.78L68.51 64.50L68.57 64.38L68.64 64.27L68.74 64.12L68.77 64.09L68.81 64.08L68.85 64.11L68.86 64.16L68.85 64.20L68.83 64.33L68.79 64.46L68.73 64.67L68.60 65.05L68.51 65.35L68.39 65.78L68.33 66.04L68.21 66.61L68.07 67.49L68.01 67.98L67.98 68.29L67.96 68.87L67.96 69.31L67.98 69.76L68.01 70.11L68.06 70.47L68.18 71.03L68.22 71.21L68.37 71.72L68.43 71.89L68.53 72.14L68.75 72.63L68.93 72.98L69.39 73.80L69.56 74.11L69.75 74.51L70.07 75.20L70.25 75.71L70.69 76.97L71.04 77.88L71.14 78.18L71.28 78.65L71.46 79.20L71.58 79.54L71.69 79.78L71.78 79.98L71.94 80.30L72.22 80.81L72.62 81.56L72.82 81.91L72.98 82.17L73.30 82.66L73.62 83.14L73.81 83.39L74.24 83.96L74.41 84.17L74.58 84.37L74.83 84.63L75.05 84.84L75.26 85.02L75.30 85.04L75.34 85.05L75.37 85.02L75.37 84.98L75.36 84.94L75.24 84.65L74.99 84.08L74.62 83.21L74.43 82.67L74.06 81.57L73.92 81.01L73.69 79.91L73.57 79.26L73.52 78.90L73.37 77.53L73.33 77.17L73.32 76.86L73.29 76.06L73.28 75.75L73.29 75.44L73.32 74.81L73.34 74.55L73.57 72.78L73.69 72.07L73.82 71.46L73.98 70.54L74.02 70.28L74.10 69.70L74.17 69.04L74.20 68.64L74.22 68.14L74.21 67.83L74.20 67.61L74.19 67.39L74.14 66.99L74.01 66.20L73.95 65.94L73.83 65.51L73.67 65.05L73.51 64.68L73.27 64.19L72.81 63.28L72.70 63.04L72.65 62.91L72.59 62.75L72.54 62.53L72.51 62.35L72.50 62.18L72.50 62.00L72.50 61.86L72.52 61.69L72.55 61.56L72.58 61.43L72.65 61.26L72.72 61.10L72.81 60.94L72.93 60.76L73.02 60.66L73.11 60.56L73.31 60.38L73.69 60.08L73.82 59.95L73.93 59.82L73.98 59.74L74.02 59.66L74.06 59.58L74.10 59.46L74.12 59.33L74.14 59.24L74.14 59.15L74.14 59.06L74.12 58.97L74.09 58.84L74.05 58.72L74.02 58.63L73.96 58.52L73.91 58.44L73.83 58.33L73.78 58.27L73.68 58.18L73.61 58.13L73.53 58.08L73.45 58.05L73.28 58.00L73.06 57.97L72.74 57.96L72.48 57.97L72.25 57.99L71.86 58.03L71.59 58.08L70.33 58.35L70.11 58.41L69.47 58.59L69.17 58.69L68.58 58.87L68.44 58.89L68.31 58.91L68.27 58.90L68.25 58.87L68.26 58.83L68.28 58.80L68.46 58.66L68.67 58.50L68.93 58.32L69.20 58.16L69.59 57.95L69.79 57.85L70.00 57.76L70.20 57.69L71.26 57.34L71.78 57.19L71.95 57.15L72.56 57.02L72.78 56.98L73.14 56.94L73.71 56.90L73.85 56.88L73.97 56.85L74.10 56.81L74.22 56.75L74.34 56.69L74.46 56.62L74.57 56.55L74.67 56.47L74.77 56.38L74.83 56.31L74.89 56.25L74.97 56.14L75.05 55.98L75.11 55.81L75.13 55.73L75.15 55.60L75.16 55.46L75.16 55.33L75.14 54.93L75.10 54.49L75.07 54.31L75.05 54.18L75.00 54.01L74.92 53.80L74.85 53.64L74.76 53.48L74.61 53.26L74.44 53.05L74.23 52.82L73.98 52.57L73.89 52.47L73.86 52.43L73.85 52.39L73.86 52.35L73.88 52.31L73.92 52.29L73.96 52.28L74.09 52.26L74.27 52.26L74.58 52.26L74.94 52.29L75.11 52.31L75.29 52.35L75.59 52.41L75.94 52.48L76.51 52.61L76.86 52.67L77.17 52.70L77.48 52.72L77.75 52.71L77.97 52.68L78.19 52.64L78.36 52.59L78.53 52.53L78.69 52.45L78.85 52.37L79.00 52.27L79.10 52.19L79.20 52.10L79.29 52.00L79.36 51.89L79.45 51.73L79.50 51.61L79.54 51.48L79.57 51.35L79.58 51.22L79.57 51.09L79.56 50.91L79.53 50.78L79.50 50.65L79.36 50.13L79.25 49.75L79.13 49.27L78.88 48.47L78.48 47.14L78.34 46.72L78.08 45.86L77.99 45.57L77.89 45.22L77.64 44.41L77.48 43.86L77.37 43.42L77.27 43.08L77.11 42.48L76.94 41.83L76.86 41.44L76.77 41.09L76.69 40.66L76.56 40.09L76.39 39.21L76.25 38.47L76.18 38.16L76.14 38.04L76.08 37.87L75.99 37.72L75.88 37.53L75.59 37.13L75.39 36.88L75.28 36.75L75.04 36.49L74.65 36.12L74.48 35.97L74.30 35.84L73.80 35.47L73.35 35.17L72.97 34.95L72.42 34.66L71.81 34.38L70.44 33.83L69.90 33.62L69.39 33.45L68.28 33.11L67.77 32.98L67.64 32.93L67.48 32.86L67.44 32.84L67.41 32.81L67.41 32.78L67.44 32.75L67.49 32.74L67.71 32.73L67.98 32.74L68.20 32.77L68.82 32.86L69.30 32.93L70.14 33.07L70.84 33.21L71.10 33.28L72.17 33.58L72.72 33.75L72.94 33.81L73.44 33.99L73.65 34.07L73.86 34.15L74.54 34.48L74.94 34.67L75.30 34.86L75.69 35.08L75.99 35.27L76.28 35.48L76.58 35.74L76.98 36.10L77.21 36.30L77.32 36.38L77.40 36.40L77.48 36.41L77.56 36.39L77.63 36.35L77.74 36.28L77.84 36.19L77.96 36.06L78.07 35.92L78.14 35.80L78.20 35.69L78.26 35.56L78.30 35.44L78.33 35.31L78.35 35.18L78.36 35.04L78.34 34.73L78.31 34.51L78.28 34.34L78.03 33.25L77.92 32.64L77.82 32.20L77.79 32.02L77.77 31.80L77.72 31.27L77.65 30.16L77.57 29.18L77.39 27.94L77.36 27.72L77.28 27.33L77.20 26.89L77.04 26.20L77.00 26.02L76.85 25.51L76.69 24.95L76.49 24.36L76.40 24.11L76.31 23.81L76.23 23.60L76.14 23.39L76.05 23.19L75.61 22.27L75.23 21.51L74.93 20.96L74.38 19.99L73.64 18.82L73.18 18.17L72.96 17.89L72.11 16.91L71.27 15.87L70.77 15.30L70.49 15.02L70.16 14.71L69.60 14.20L69.17 13.81L68.94 13.60L68.54 13.25L68.16 12.94L67.75 12.59L67.54 12.42L67.22 12.18L66.68 11.79L65.94 11.29L65.20 10.79L64.71 10.48L64.05 10.10L62.65 9.33L62.29 9.14L62.01 9.01L61.73 8.87L60.87 8.51L60.34 8.27L59.93 8.08L59.61 7.94L59.15 7.77L58.13 7.42L57.79 7.32L57.50 7.23L56.86 7.03L56.26 6.86L55.39 6.64L54.74 6.49L54.34 6.42L53.86 6.33L53.29 6.24L52.58 6.15L52.36 6.12L51.11 6.04L50.53 6.01L50.13 6.00L49.38 6.00L48.66 6.01ZM84.78 23.79L84.64 23.81L84.51 23.84L84.08 23.95L83.87 24.03L83.63 24.14L83.51 24.21L83.40 24.28L83.18 24.44L82.99 24.62L82.84 24.79L82.66 25.04L82.52 25.27L82.46 25.39L82.39 25.55L82.33 25.72L82.28 25.84L82.18 26.23L82.13 26.49L82.12 26.63L82.11 26.76L82.12 26.89L82.13 27.07L82.15 27.20L82.18 27.38L82.23 27.60L82.28 27.77L82.36 27.98L82.49 28.26L82.55 28.38L82.62 28.49L82.70 28.60L82.79 28.70L82.97 28.90L83.07 28.99L83.20 29.10L83.42 29.26L83.54 29.32L83.66 29.39L84.06 29.57L84.19 29.61L84.32 29.65L84.58 29.70L84.71 29.72L84.84 29.73L85.16 29.74L85.33 29.73L85.47 29.71L85.82 29.65L86.03 29.60L86.16 29.55L86.36 29.47L86.61 29.35L86.76 29.26L86.91 29.16L87.16 28.98L87.43 28.74L87.52 28.65L87.61 28.55L87.73 28.36L87.88 28.09L87.99 27.84L88.04 27.67L88.08 27.55L88.13 27.28L88.15 27.11L88.16 26.97L88.16 26.66L88.14 26.35L88.10 26.09L88.07 25.95L88.03 25.83L87.92 25.53L87.87 25.41L87.78 25.25L87.72 25.14L87.64 25.03L87.48 24.82L87.29 24.63L87.08 24.46L86.83 24.28L86.59 24.15L86.35 24.04L86.10 23.95L85.62 23.83L85.40 23.79L85.27 23.78L85.09 23.77L84.91 23.78ZM63.90 37.84L63.95 37.83L63.99 37.83L64.15 37.92L64.63 38.23L65.01 38.47L65.60 38.87L66.10 39.16L66.54 39.39L66.78 39.50L67.02 39.61L67.44 39.77L68.36 40.10L68.88 40.25L69.05 40.30L69.22 40.34L69.92 40.46L70.15 40.49L70.37 40.52L71.66 40.61L72.15 40.63L72.59 40.62L72.68 40.63L72.72 40.65L72.75 40.68L72.77 40.72L72.76 40.77L72.74 40.81L72.71 40.84L72.60 40.91L72.41 41.03L72.22 41.13L72.01 41.22L71.68 41.35L71.51 41.41L71.00 41.56L70.87 41.59L70.65 41.62L70.25 41.67L69.98 41.69L69.63 41.68L69.31 41.66L69.00 41.62L68.83 41.59L68.66 41.55L68.11 41.37L67.78 41.24L67.41 41.07L67.09 40.91L66.82 40.76L66.63 40.64L66.45 40.51L65.95 40.13L65.68 39.90L65.38 39.64L65.05 39.33L64.77 39.04L64.51 38.74L64.11 38.26L63.92 38.01L63.90 37.98L63.88 37.93L63.88 37.89Z`}),t[12]=S,t[13]=C,t[14]=w):w=t[14];let T;return t[15]!==f||t[16]!==m||t[17]!==b||t[18]!==x||t[19]!==w||t[20]!==p?(T=(0,l.jsxs)(`svg`,{width:p,height:m,viewBox:`0 0 100 100`,xmlns:`http://www.w3.org/2000/svg`,className:f,role:`img`,"aria-label":b,"data-yuri-logo":!0,children:[x,w]}),t[15]=f,t[16]=m,t[17]=b,t[18]=x,t[19]=w,t[20]=p,t[21]=T):T=t[21],T};export{c as n,u as t};
|
package/dist/assets/{assistantMessagePreview-a6gzdseQ.js → assistantMessagePreview-DWC6UVyn.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{T as t,c as n}from"./runtime-auth-CyWl56mL.js";import{i as r,t as i}from"./runtime-switch-CSXCC6XM.js";import{f as a,j as o}from"./platform-BQipzOYw.js";import{ot as s,st as c}from"./vendor-base-ui-wXsskyKm.js";import{n as l}from"./vendor-react-BkccXcWz.js";import{n as u}from"./vendor-tanstack-react-query-DIb_ItL-.js";import{r as d}from"./vendor-reactuses-core-DjKFMfz7.js";import{r as f}from"./vendor-sonner-DX3nfJx4.js";import{Xn as p,io as m}from"./ui-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{T as t,c as n}from"./runtime-auth-CyWl56mL.js";import{i as r,t as i}from"./runtime-switch-CSXCC6XM.js";import{f as a,j as o}from"./platform-BQipzOYw.js";import{ot as s,st as c}from"./vendor-base-ui-wXsskyKm.js";import{n as l}from"./vendor-react-BkccXcWz.js";import{n as u}from"./vendor-tanstack-react-query-DIb_ItL-.js";import{r as d}from"./vendor-reactuses-core-DjKFMfz7.js";import{r as f}from"./vendor-sonner-DX3nfJx4.js";import{Xn as p,io as m}from"./ui-gH75_gWj.js";import{n as h}from"./Icon-BUHzyKnj.js";import{t as g}from"./i18n-CJn52oz0.js";import{i as _}from"./useAssistantUIStore-D_7_VmeY.js";import{a as v,i as y,n as b,o as x,r as S,t as C}from"./dialog-C1xZ7qi4.js";import{a as w,i as T,n as E,r as D,t as O}from"./context-menu-CFyL4DQd.js";import{c as k,i as A,o as j,p as M}from"./assistantQueries-Bgxhg5pZ.js";import{t as N}from"./assistantPresentation-DRbsH1Ej.js";import{r as P,t as F}from"./AssistantWorkingAvatar-C5PFB26I.js";import{n as I}from"./AssistantUnreadBadge-CAgjtCiJ.js";var L=e(c(),1),R=l(),z=()=>a()&&!t(),B=async e=>{if(!z())throw Error(`Assistant Mini Chat requires a direct desktop connection`);await o(`desktop_open_assistant_mini_chat_window`,{assistantID:e,apiBaseUrl:i(),clientToken:n()})},V=s();function H(e){let t=(0,R.c)(49),{assistant:n,trigger:i,onEdit:a,onDelete:o,doubleClickMiniChat:s}=e,c=s!==void 0&&s,{t:l}=g(),d;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(d=r(),t[0]=d):d=t[0];let p;t[1]===n.id?p=t[2]:(p=[d,`assistants`,n.id,`pin`],t[1]=n.id,t[2]=p);let m;t[3]===n?m=t[4]:(m=()=>M(n,{pinned:n.pinnedAt==null}),t[3]=n,t[4]=m);let _;t[5]===l?_=t[6]:(_=()=>f.error(l(`assistants.menu.pinError`)),t[5]=l,t[6]=_);let v;t[7]!==p||t[8]!==m||t[9]!==_?(v={mutationKey:p,mutationFn:m,onError:_},t[7]=p,t[8]=m,t[9]=_,t[10]=v):v=t[10];let y=u(v),b;t[11]!==n.id||t[12]!==l?(b=()=>{B(n.id).catch(()=>f.error(l(`miniChat.actions.failed`)))},t[11]=n.id,t[12]=l,t[13]=b):b=t[13];let x=b,S=i,C;t[14]!==S||t[15]!==c||t[16]!==x||t[17]!==i?(C=c?L.cloneElement(S,{onDoubleClick:e=>{S.props.onDoubleClick?.(e),!e.defaultPrevented&&z()&&x()}}):i,t[14]=S,t[15]=c,t[16]=x,t[17]=i,t[18]=C):C=t[18];let k;t[19]===C?k=t[20]:(k=(0,V.jsx)(w,{render:C}),t[19]=C,t[20]=k);let A;t[21]!==n.pinnedAt||t[22]!==y||t[23]!==l?(A=n.pinnedAt===void 0?null:(0,V.jsxs)(D,{disabled:y.isPending,onClick:()=>y.mutate(),children:[(0,V.jsx)(h,{name:n.pinnedAt==null?`pushpin-2`:`unpin`,className:`size-4`}),l(n.pinnedAt==null?`assistants.menu.pin`:`assistants.menu.unpin`)]}),t[21]=n.pinnedAt,t[22]=y,t[23]=l,t[24]=A):A=t[24];let j;t[25]!==x||t[26]!==l?(j=z()?(0,V.jsxs)(D,{onClick:x,children:[(0,V.jsx)(h,{name:`external-link`,className:`size-4`}),l(`sessions.sidebar.session.menu.openMiniChatWindow`)]}):null,t[25]=x,t[26]=l,t[27]=j):j=t[27];let N;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,V.jsx)(h,{name:`edit`,className:`size-4`}),t[28]=N):N=t[28];let P;t[29]===l?P=t[30]:(P=l(`assistants.menu.edit`),t[29]=l,t[30]=P);let F;t[31]!==a||t[32]!==P?(F=(0,V.jsxs)(D,{onClick:a,children:[N,P]}),t[31]=a,t[32]=P,t[33]=F):F=t[33];let I;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,V.jsx)(T,{}),t[34]=I):I=t[34];let H;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,V.jsx)(h,{name:`delete-bin`,className:`size-4 text-inherit`}),t[35]=H):H=t[35];let U;t[36]===l?U=t[37]:(U=l(`assistants.settings.delete`),t[36]=l,t[37]=U);let W;t[38]!==o||t[39]!==U?(W=(0,V.jsxs)(D,{onClick:o,className:`text-[var(--status-error)] focus:text-[var(--status-error)] data-[highlighted]:text-[var(--status-error)]`,children:[H,U]}),t[38]=o,t[39]=U,t[40]=W):W=t[40];let G;t[41]!==A||t[42]!==j||t[43]!==F||t[44]!==W?(G=(0,V.jsxs)(E,{className:`min-w-[10rem]`,children:[A,j,F,I,W]}),t[41]=A,t[42]=j,t[43]=F,t[44]=W,t[45]=G):G=t[45];let K;return t[46]!==G||t[47]!==k?(K=(0,V.jsxs)(O,{children:[k,G]}),t[46]=G,t[47]=k,t[48]=K):K=t[48],K}function U(e){let t=(0,R.c)(38),{assistant:n,selected:r,onSelect:i,onEdit:a,onDelete:o}=e,s=L.useRef(null),c=P(n.id,n.working),l;t[0]===n.name?l=t[1]:(l=N(n.name).displayName||n.name,t[0]=n.name,t[1]=l);let u=l,d;t[2]!==n.id||t[3]!==a?(d=()=>a(n.id),t[2]=n.id,t[3]=a,t[4]=d):d=t[4];let f;t[5]!==n||t[6]!==o?(f=()=>o(n),t[5]=n,t[6]=o,t[7]=f):f=t[7];let p=n.id,h;t[8]!==n.id||t[9]!==i?(h=()=>i(n.id),t[8]=n.id,t[9]=i,t[10]=h):h=t[10];let g=r?`bg-[var(--surface-muted)]`:`hover:bg-interactive-hover`,_;t[11]===g?_=t[12]:(_=m(`flex w-full min-w-0 max-w-28 flex-col items-center gap-2 rounded-2xl px-2 py-3 text-center outline-none transition-colors focus-visible:ring-2 focus-visible:ring-[var(--interactive-focus-ring)] active:bg-interactive-active motion-reduce:transition-none`,g),t[11]=g,t[12]=_);let v;t[13]!==n.avatarSeed||t[14]!==n.id||t[15]!==u||t[16]!==c?(v=(0,V.jsx)(F,{name:n.id,avatarSeed:n.avatarSeed,size:64,label:u,working:c,hoverTarget:s}),t[13]=n.avatarSeed,t[14]=n.id,t[15]=u,t[16]=c,t[17]=v):v=t[17];let y=n.unreadCount??0,b;t[18]===y?b=t[19]:(b=(0,V.jsx)(I,{count:y,className:`absolute -right-1 -top-1`}),t[18]=y,t[19]=b);let x;t[20]!==b||t[21]!==v?(x=(0,V.jsxs)(`span`,{className:`relative`,children:[v,b]}),t[20]=b,t[21]=v,t[22]=x):x=t[22];let S;t[23]===u?S=t[24]:(S=(0,V.jsx)(`span`,{className:`w-full truncate typography-ui-label font-medium leading-5`,children:u}),t[23]=u,t[24]=S);let C;t[25]!==n.id||t[26]!==u||t[27]!==r||t[28]!==x||t[29]!==S||t[30]!==h||t[31]!==_?(C=(0,V.jsxs)(`button`,{ref:s,type:`button`,role:`option`,"aria-selected":r,title:u,"data-assistant-pinned":p,"data-mobile-press-feedback":`soft`,onClick:h,className:_,children:[x,S]}),t[25]=n.id,t[26]=u,t[27]=r,t[28]=x,t[29]=S,t[30]=h,t[31]=_,t[32]=C):C=t[32];let w;return t[33]!==n||t[34]!==C||t[35]!==d||t[36]!==f?(w=(0,V.jsx)(H,{assistant:n,doubleClickMiniChat:!0,onEdit:d,onDelete:f,trigger:C}),t[33]=n,t[34]=C,t[35]=d,t[36]=f,t[37]=w):w=t[37],w}function W(e){let t=(0,R.c)(16),{contacts:n,selectedAssistantID:r,onSelect:i,onEdit:a,onDelete:o}=e,{t:s}=g();if(n.length===0)return null;let c;t[0]===s?c=t[1]:(c=s(`assistants.list.pinned`),t[0]=s,t[1]=c);let l;if(t[2]!==n||t[3]!==o||t[4]!==a||t[5]!==i||t[6]!==r){let e;t[8]!==o||t[9]!==a||t[10]!==i||t[11]!==r?(e=e=>(0,V.jsx)(U,{assistant:e,selected:e.id===r,onSelect:i,onEdit:a,onDelete:o},e.id),t[8]=o,t[9]=a,t[10]=i,t[11]=r,t[12]=e):e=t[12],l=n.map(e),t[2]=n,t[3]=o,t[4]=a,t[5]=i,t[6]=r,t[7]=l}else l=t[7];let u;return t[13]!==c||t[14]!==l?(u=(0,V.jsx)(`div`,{role:`group`,"aria-label":c,className:`yuri-assistant-pinned-contacts grid grid-cols-1 justify-items-center gap-2 pb-3 pt-2`,children:l}),t[13]=c,t[14]=l,t[15]=u):u=t[15],u}function G({snapshot:e,rowClassName:t,compact:n=!1,mobile:r=!1}){let{t:i}=g(),[a,o]=L.useState(!1),s=L.useRef(!1),c=d(async()=>{if(!s.current){s.current=!0,o(!0);try{(await k(e)).failed&&f.error(i(`assistants.unread.markAllFailed`))}catch{f.error(i(`assistants.unread.markAllFailed`))}finally{s.current=!1,o(!1)}}}),l=e.assistants.some(e=>(e.unreadCount??0)>0);return!n&&!l?null:(0,V.jsx)(`div`,{className:t,style:n&&!l?{visibility:`hidden`}:void 0,children:(0,V.jsx)(p,{type:`button`,variant:r?`mobileGlass`:`ghost`,size:r?`mobileIcon`:`icon`,className:`app-region-no-drag`,onClick:c,"aria-label":i(`assistants.unread.markAll`),title:i(`assistants.unread.markAll`),disabled:a||!e.assistants.some(e=>(e.unreadCount??0)>0&&e.readTip),"aria-busy":a,children:(0,V.jsx)(h,{name:`check-double`,className:r?`size-5`:`size-4`})})})}async function K(e){await A(e);let t=_.getState().defaultShareAssistant;if(t?.assistantID!==e.id)return;let n=await j();n.serverInstanceID&&t.serverInstanceID===n.serverInstanceID&&_.getState().setDefaultShareAssistant(null)}function q({assistant:e,open:t,onOpenChange:n,onDeleted:r}){let{t:i}=g(),[a,o]=L.useState(!1),s=e?N(e.name).displayName||e.name:``,c=d(e=>{a&&!e||n(e)}),l=d(()=>{a||n(!1)}),u=d(async()=>{if(!(!e||a)){o(!0);try{await K(e),r?.(e.id),n(!1),f.success(i(`assistants.settings.toast.deleted`))}catch{f.error(i(`assistants.settings.toast.deleteFailed`))}finally{o(!1)}}});return(0,V.jsx)(C,{open:t&&e!==null,onOpenChange:c,children:(0,V.jsxs)(b,{className:`max-w-md`,children:[(0,V.jsxs)(v,{children:[(0,V.jsx)(x,{children:i(`assistants.settings.delete`)}),(0,V.jsx)(S,{children:i(`assistants.settings.deleteConfirm`,{name:s})})]}),(0,V.jsxs)(y,{children:[(0,V.jsx)(p,{size:`sm`,variant:`ghost`,onClick:l,disabled:a,children:i(`settings.common.actions.cancel`)}),(0,V.jsx)(p,{size:`sm`,variant:`destructive`,onClick:u,disabled:a,children:i(`settings.common.actions.delete`)})]})]})})}var J=`block min-w-0 max-w-full truncate typography-micro text-muted-foreground`,Y={image:`assistants.contact.attachment.image`,file:`assistants.contact.attachment.file`,session:`assistants.contact.card.session.untitled`,assistant:`assistants.title`,schedule:`assistants.settings.scheduledTasks.title`};function X(e,t){let n=e?.text??``;return(e?.fallbackKind?n:n.replace(/^\s{0,3}(?:`{3,}|~{3,})[\w+-]*(?:\s+|$)/gmu,``).replace(/`{3,}|~{3,}/gu,``).replace(/^\s{0,3}(?:#{1,6}\s+|(?:>\s*)+|[-+*]\s+(?:\[[ xX]\]\s*)?|\d+[.)]\s+)/gmu,``).replace(/!?\[([^\]\n]*)\]\([^\n)]*(?:\)|$)/gu,`$1`).replace(/!\[([^\]\n]*)(?:\]|$)/gu,`$1`).replace(/(`+)([^`\n]+)\1/gu,`$2`).replace(/(\*{1,3}|~~)(?=\S)(.+?)\1/gu,`$2`).replace(/(?<![\p{L}\p{N}_])(_{1,3})(?=\S)(.+?)\1(?![\p{L}\p{N}_])/gu,`$2`)).replace(/\s+/gu,` `).trim()||t(e?.fallbackKind?Y[e.fallbackKind]:`assistants.contact.empty`)}export{W as a,G as i,X as n,H as o,q as r,J as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,n}from"./runtime-switch-CSXCC6XM.js";import{n as r}from"./runtime-fetch-ykYB0sSi.js";import{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{P as s,W as c}from"./runtime-file-resource-DDGMqGyv.js";import{Et as l}from"./ui-BPOP32rM.js";import{i as u}from"./store-1zpYqZEm.js";var d=e(i(),1),f=a(),p=class extends Error{code;status;resource;constructor(e,t,n,r){super(typeof r==`string`&&r.trim()?r.trim():e),this.code=e,this.status=t,this.resource=n}},m=e=>{if(!e||typeof e!=`object`)return!1;let t=`name`in e?String(e.name):``;return t===`AbortError`||t===`TimeoutError`},h=class extends p{operation;constructor(e,t,n){super(e,t,`share_operation`),this.operation=n}},g=(e,t=200)=>{throw new p(`invalid_${e}_response`,t,e)},_=(e,t)=>e&&typeof e==`object`&&!Array.isArray(e)?e:g(t),v=(e,t)=>typeof e==`string`?e:g(t),y=(e,t)=>e===null||typeof e==`string`?e:g(t),b=(e,t)=>typeof e==`number`&&Number.isFinite(e)?e:g(t),x=(e,t)=>e===null?null:b(e,t),S=(e,t)=>typeof e==`boolean`?e:g(t),C=(e,t,n)=>t.includes(e)?e:g(n),w=e=>{let t=_(e,`capability`);return{supported:S(t.supported,`capability`),enabled:S(t.enabled,`capability`),revision:b(t.revision,`capability`),serverInstanceID:y(t.serverInstanceID,`capability`),sharingAvailable:t.sharingAvailable!==void 0&&S(t.sharingAvailable,`capability`)}},T=e=>{if(e==null)return null;let t=_(e,`assistant`);return{turnID:v(t.turnID,`assistant`),messageID:v(t.messageID,`assistant`),status:C(t.status,[`queued`,`running`],`assistant`),admittedAt:b(t.admittedAt,`assistant`)}},E=e=>{if(e==null)return null;let t=_(e,`assistant_preview`),n=b(t.ordinal,`assistant_preview`);return!Number.isSafeInteger(n)||n<0?g(`assistant_preview`):{...t.createdAt===void 0?{}:{createdAt:b(t.createdAt,`assistant_preview`)},messageID:v(t.messageID,`assistant_preview`),ordinal:n,role:C(t.role,[`user`,`assistant`],`assistant_preview`),text:v(t.text,`assistant_preview`),fallbackKind:t.fallbackKind===null?null:C(t.fallbackKind,[`image`,`file`,`session`,`assistant`,`schedule`],`assistant_preview`)}},D=e=>{let t=b(e,`assistant_read`);return Number.isSafeInteger(t)&&t>=0?t:g(`assistant_read`)},O=e=>{let t=_(e,`assistant_read`);return{generation:D(t.generation),ordinal:D(t.ordinal),messageID:v(t.messageID,`assistant_read`)}},ee=e=>({unreadCount:e.unreadCount===void 0?0:D(e.unreadCount),readWatermark:e.readWatermark==null?null:O(e.readWatermark),readTip:e.readTip==null?null:O(e.readTip)}),te=e=>{let t=_(e,`assistant_read`);return{assistantID:v(t.assistantID,`assistant_read`),changed:S(t.changed,`assistant_read`),unreadCount:D(t.unreadCount),readWatermark:O(t.readWatermark),readTip:O(t.readTip),revision:D(t.revision)}},k=e=>{let t=_(e,`assistant`),n=Array.isArray(t.historySessionIDs)?t.historySessionIDs.map(e=>v(e,`assistant`)):[],r=t.historySessionCount===void 0?n.length:b(t.historySessionCount,`assistant`);if(!Number.isSafeInteger(r)||r<n.length)return g(`assistant`);let i=Array.isArray(t.assignedSessionIDs)?t.assignedSessionIDs.map(e=>v(e,`assistant`)):[],a=t.activeContactTurn===void 0?null:T(t.activeContactTurn),o=t.working===void 0?a!=null:S(t.working,`assistant`);return{...ee(t),pinnedAt:t.pinnedAt===void 0?void 0:x(t.pinnedAt,`assistant`),latestMessagePreview:E(t.latestMessagePreview),id:v(t.id,`assistant`),avatarSeed:v(t.avatarSeed??t.id,`assistant`),revision:b(t.revision,`assistant`),enabled:S(t.enabled,`assistant`),name:v(t.name,`assistant`),defaultPrompt:v(t.defaultPrompt,`assistant`),workspacePath:y(t.workspacePath,`assistant`),effectiveWorkspacePath:v(t.effectiveWorkspacePath,`assistant`),managedWorkspacePath:y(t.managedWorkspacePath??null,`assistant`),providerID:v(t.providerID,`assistant`),modelID:v(t.modelID,`assistant`),agent:y(t.agent,`assistant`),variant:y(t.variant??null,`assistant`),mode:C(t.mode,[`continuous`,`stateless`],`assistant`),sessionID:y(t.sessionID,`assistant`),sessionGeneration:b(t.sessionGeneration,`assistant`),historySessionIDs:n,historySessionCount:r,assignedSessionIDs:i,working:o,activeContactTurn:a,createdAt:x(t.createdAt,`assistant`),updatedAt:b(t.updatedAt,`assistant`),tombstoneAt:x(t.tombstoneAt,`assistant`)}},ne=e=>{let t=_(e,`snapshot`);return{revision:b(t.revision,`snapshot`),enabled:S(t.enabled,`snapshot`),assistants:Array.isArray(t.assistants)?t.assistants.map(k):g(`snapshot`)}},re=e=>{let t=_(e,`binding`);return{sessionID:y(t.sessionID,`binding`),directory:v(t.directory,`binding`),sessionGeneration:b(t.sessionGeneration,`binding`)}},ie=e=>{let t=_(e,`message_admission`);if(t.admitted!==!0)return g(`message_admission`);let n=t.revision===void 0||t.revision===null?null:b(t.revision,`message_admission`);return{binding:re(t.binding),messageID:v(t.messageID,`message_admission`),admitted:!0,revision:n,...t.replayed===!0?{replayed:!0}:{}}},A=e=>{let t=_(e,`share_operation`);return{operationID:v(t.operationID,`share_operation`),assistantID:v(t.assistantID,`share_operation`),sessionID:y(t.sessionID,`share_operation`),messageID:y(t.messageID,`share_operation`),state:C(t.state,[`submitting`,`running`,`completed`,`failed`,`unresolved`],`share_operation`),phase:v(t.phase,`share_operation`),attempt:b(t.attempt,`share_operation`),leaseExpiresAt:x(t.leaseExpiresAt,`share_operation`),errorCode:y(t.errorCode,`share_operation`)}},ae=e=>{let t=_(e,`assistant_contact_part`);if(t.type===`text`)return{type:`text`,text:v(t.text,`assistant_contact_part`)};if(t.type===`file`){let e=t.filename===void 0||t.filename===null?void 0:v(t.filename,`assistant_contact_part`),n=v(t.mime,`assistant_contact_part`),r=t.url!==void 0&&t.url!==null,i=t.attachmentID!==void 0&&t.attachmentID!==null;if(r&&i)return g(`assistant_contact_part`);if(i){let r=b(t.size,`assistant_contact_part`);return!Number.isSafeInteger(r)||r<0?g(`assistant_contact_part`):{type:`file`,mime:n,attachmentID:v(t.attachmentID,`assistant_contact_part`),sha256:v(t.sha256,`assistant_contact_part`),size:r,...e?{filename:e}:{}}}return r?{type:`file`,mime:n,url:v(t.url,`assistant_contact_part`),...e?{filename:e}:{}}:g(`assistant_contact_part`)}if(t.type===`card`){let e=C(t.cardType,[`session`,`assistant`,`schedule`],`assistant_contact_part`);if(e===`session`){let e;if(t.target!==void 0){let n=_(t.target,`assistant_contact_part`),r=e=>{let t=v(n[e],`assistant_contact_part`);return!t||t!==t.trim()||t.length>512||Array.from(t).some(e=>e.charCodeAt(0)<32)?g(`assistant_contact_part`):t};e={hubId:r(`hubId`),hostId:r(`hostId`),instanceId:r(`instanceId`)}}return{type:`card`,cardType:`session`,sessionID:v(t.sessionID,`assistant_contact_part`),directory:v(t.directory,`assistant_contact_part`),title:y(t.title??null,`assistant_contact_part`),status:y(t.status??null,`assistant_contact_part`),branch:y(t.branch??null,`assistant_contact_part`),...e?{target:e}:{}}}return e===`assistant`?{type:`card`,cardType:`assistant`,assistantID:v(t.assistantID,`assistant_contact_part`),name:v(t.name,`assistant_contact_part`),providerID:v(t.providerID,`assistant_contact_part`),modelID:v(t.modelID,`assistant_contact_part`),mode:C(t.mode??`continuous`,[`continuous`,`stateless`],`assistant_contact_part`)}:{type:`card`,cardType:`schedule`,taskID:v(t.taskID,`assistant_contact_part`),projectID:v(t.projectID,`assistant_contact_part`),name:v(t.name,`assistant_contact_part`),kind:y(t.kind??null,`assistant_contact_part`),time:y(t.time??null,`assistant_contact_part`),timezone:y(t.timezone??null,`assistant_contact_part`),prompt:y(t.prompt??null,`assistant_contact_part`),...t.cron===void 0?{}:{cron:y(t.cron,`assistant_contact_part`)},...t.date===void 0?{}:{date:y(t.date,`assistant_contact_part`)},...t.times===void 0?{}:{times:t.times===null?null:Array.isArray(t.times)?t.times.map(e=>v(e,`assistant_contact_part`)):g(`assistant_contact_part`)},...t.weekdays===void 0?{}:{weekdays:t.weekdays===null?null:Array.isArray(t.weekdays)?t.weekdays.map(e=>{let t=b(e,`assistant_contact_part`);return Number.isInteger(t)&&t>=0&&t<=6?t:g(`assistant_contact_part`)}):g(`assistant_contact_part`)}}}return g(`assistant_contact_part`)},oe=e=>{let t=_(e,`assistant_contact`),n=y(t.nextCursor,`assistant_contact`),r=S(t.complete,`assistant_contact`);if(!r&&!n||r&&n||!Array.isArray(t.messages))return g(`assistant_contact`);let i=b(t.generation,`assistant_contact`),a=b(t.revision,`assistant_contact`);return!Number.isSafeInteger(i)||i<0||!Number.isSafeInteger(a)||a<0?g(`assistant_contact`):{messages:t.messages.map(e=>{let t=_(e,`assistant_contact_message`);if(!Array.isArray(t.parts))return g(`assistant_contact_message`);let n=t.parts.map(ae);return{messageID:v(t.messageID,`assistant_contact_message`),assistantID:v(t.assistantID,`assistant_contact_message`),role:C(t.role,[`user`,`assistant`,`peer`],`assistant_contact_message`),turnID:v(t.turnID,`assistant_contact_message`),bubbleIndex:b(t.bubbleIndex,`assistant_contact_message`),createdAt:b(t.createdAt,`assistant_contact_message`),ordinal:b(t.ordinal,`assistant_contact_message`),status:v(t.status,`assistant_contact_message`),fromAssistantID:y(t.fromAssistantID??null,`assistant_contact_message`),fromAssistantName:y(t.fromAssistantName??null,`assistant_contact_message`),parts:n,text:typeof t.text==`string`?t.text:n.filter(e=>e.type===`text`).map(e=>e.text).join(``),cards:n.filter(e=>e.type===`card`)}}),nextCursor:n,complete:r,generation:i,revision:a}},se=e=>{let t=_(e,`assistant_scheduled_tasks`);return Array.isArray(t.tasks)?{tasks:t.tasks.map(e=>{let t=_(e,`assistant_scheduled_task`),n=t.task===null||t.task===void 0?null:_(t.task,`assistant_scheduled_task_live`);return{assistantID:v(t.assistantID,`assistant_scheduled_task`),projectID:v(t.projectID,`assistant_scheduled_task`),taskID:v(t.taskID,`assistant_scheduled_task`),createdAt:b(t.createdAt,`assistant_scheduled_task`),projectPath:y(t.projectPath??null,`assistant_scheduled_task`),projectLabel:y(t.projectLabel??null,`assistant_scheduled_task`),task:n}})}:g(`assistant_scheduled_tasks`)},j=async(e,t)=>{try{let t=await e.json();if(t&&typeof t.error==`string`&&t.error.trim().length>0)return t.error}catch{return t}return t},M=e=>{let t=typeof e==`string`?e.trim():``;if(!t)throw Error(`projectId is required`);return t},N=e=>e===null||typeof e==`string`,ce=e=>e===null||typeof e==`number`&&Number.isFinite(e),le=e=>typeof e==`number`&&Number.isFinite(e)&&e>=0&&e<=864e13,ue=e=>e===null||le(e),de=e=>{if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;return typeof t.id==`string`&&t.id.length>0&&typeof t.projectId==`string`&&t.projectId.length>0&&typeof t.taskId==`string`&&t.taskId.length>0&&typeof t.taskName==`string`&&(t.trigger===`scheduled`||t.trigger===`manual`)&&(t.status===`running`||t.status===`success`||t.status===`error`)&&N(t.sessionId)&&N(t.directory)&&N(t.error)&&le(t.startedAt)&&ue(t.finishedAt)&&ce(t.durationMs)&&(t.durationMs===null||t.durationMs>=0)},fe=e=>{if(!e||typeof e!=`object`||Array.isArray(e))throw Error(`Malformed scheduled task runs response`);let t=e;if(!Array.isArray(t.runs)||!t.runs.every(de)||!N(t.nextCursor)||typeof t.complete!=`boolean`||t.complete!==(t.nextCursor===null)||t.nextCursor!==null&&t.nextCursor.length===0)throw Error(`Malformed scheduled task runs response`);return{runs:t.runs,nextCursor:t.nextCursor,complete:t.complete}},pe=async(e,t)=>{let n=new URLSearchParams;e.before&&n.set(`before`,e.before);let i=e.limit??20;if(!Number.isInteger(i)||i<1)throw Error(`limit must be a positive integer`);n.set(`limit`,String(i)),e.projectId&&n.set(`projectId`,e.projectId),e.taskId&&n.set(`taskId`,e.taskId);let a=await r(`/api/yuri/scheduled-task-runs?${n.toString()}`,{signal:t});if(!a.ok)throw Error(await j(a,`Failed to load scheduled task history`));return fe(await a.json().catch(()=>null))},me=async({signal:e}={})=>{let t=await r(`/api/yuri/scheduled-tasks`,{signal:e});if(!t.ok)throw Error(await j(t,`Failed to load schedules`));let n=await t.json().catch(()=>null);if(!n||!Array.isArray(n.tasks))throw Error(`Malformed schedules response`);return{tasks:Array.isArray(n?.tasks)?n.tasks:[],failedProjectIds:Array.isArray(n?.failedProjectIds)?n.failedProjectIds.filter(e=>typeof e==`string`):[]}},he=async(e,t)=>{let n=M(e),i=await r(`/api/projects/${encodeURIComponent(n)}/scheduled-tasks`,{method:`PUT`,headers:{"content-type":`application/json`,accept:`application/json`},body:JSON.stringify({task:t})});if(!i.ok)throw Error(await j(i,`Failed to save schedule`));let a=await i.json().catch(()=>null);return!a||!Array.isArray(a.tasks)?[]:a.tasks},ge=async(e,t)=>{let n=M(e),i=M(t),a=await r(`/api/projects/${encodeURIComponent(n)}/scheduled-tasks/${encodeURIComponent(i)}`,{method:`DELETE`,headers:{accept:`application/json`}});if(!a.ok)throw Error(await j(a,`Failed to delete schedule`));let o=await a.json().catch(()=>null);return!o||!Array.isArray(o.tasks)?[]:o.tasks},_e=async(e,t)=>{let n=M(e),i=M(t),a=await r(`/api/projects/${encodeURIComponent(n)}/scheduled-tasks/${encodeURIComponent(i)}/run`,{method:`POST`,headers:{accept:`application/json`}});if(!a.ok)throw Error(await j(a,`Failed to run schedule`));let o=await a.json().catch(()=>null);return{sessionId:typeof o?.sessionId==`string`&&o.sessionId.length>0?o.sessionId:void 0}},P=(e,t)=>e.ordinal===t.ordinal?e.messageID<t.messageID?-1:+(e.messageID>t.messageID):e.ordinal-t.ordinal,ve=e=>{if(e.type===`file`||e.type===`card`)return!0;if(e.type!==`text`)return!1;let t=typeof e.text==`string`?e.text.trim():``;return!!t&&!t.startsWith(`yuri.settle.`)&&!t.startsWith(`oc.settle.`)},ye=(e,t)=>{if(!t||!e.readTip||!((e.unreadCount??0)>0))return null;let n=e.readTip;if(t.generation!==n.generation)return null;let r;for(let n=t.messages.length-1;n>=0;--n){let i=t.messages[n];if(i.assistantID===e.id&&(i.status===`complete`||i.status===`error`)&&i.parts.some(ve)){r=i;break}}if(!r)return null;let i=e.readWatermark;return i&&(i.generation>t.generation||i.generation===t.generation&&P({ordinal:i.ordinal,messageID:i.messageID},{ordinal:r.ordinal,messageID:r.messageID})>=0)?null:{generation:t.generation,ordinal:r.ordinal,messageID:r.messageID}},be=()=>({messages:[],generation:-1,revision:0,olderCursor:null,olderComplete:!0,hasMessageGap:!1,gapCursor:null,gapRequestIDs:null,gapTargetIDs:null,liveWindowIDs:[]}),F=e=>!!(e&&e.generation>=0),I=(e,t)=>P({ordinal:e.ordinal,messageID:e.messageID},{ordinal:t.ordinal,messageID:t.messageID}),L=(e,t,n=`incoming`)=>{let r=new Map;for(let t of e)r.set(t.messageID,t);for(let e of t)(n===`incoming`||!r.has(e.messageID))&&r.set(e.messageID,e);return[...r.values()].sort(I)},xe=e=>{let t=1/0;for(let n of e)n.ordinal<t&&(t=n.ordinal);return Number.isFinite(t)?t:null},R=e=>e.map(e=>e.messageID),z=(e,t)=>{for(let n of e)if(t.has(n))return!0;return!1},B=e=>new Set(e),Se=(e,t)=>!e||!t||e.length!==t.length?!1:e.every((e,n)=>e===t[n]),Ce=e=>({...e,hasMessageGap:!1,gapCursor:null,gapRequestIDs:null,gapTargetIDs:null}),V=e=>({ordinal:e.ordinal,messageID:e.messageID}),we=(e,t,n)=>{if(n)return[...t];if(t.length===0)return[...e];let r=t[0];return[...e.filter(e=>P(V(e),V(r))<0),...t]},Te=(e,t)=>{let n=e??be(),r=F(n),i=[...t.messages].sort(I),a=R(i);if(r&&t.generation<n.generation)return n;if(r&&t.generation>n.generation)return{messages:i,generation:t.generation,revision:t.revision,olderCursor:t.nextCursor,olderComplete:t.complete,hasMessageGap:!1,gapCursor:null,gapRequestIDs:null,gapTargetIDs:null,liveWindowIDs:a};if(!r)return{messages:i,generation:t.generation,revision:t.revision,olderCursor:t.complete?null:t.nextCursor,olderComplete:t.complete,hasMessageGap:!1,gapCursor:null,gapRequestIDs:null,gapTargetIDs:null,liveWindowIDs:a};let o=Math.max(n.revision,t.revision),s=t.revision>=n.revision;if(i.length===0)return s&&t.complete?{messages:[],generation:t.generation,revision:o,olderCursor:null,olderComplete:!0,hasMessageGap:!1,gapCursor:null,gapRequestIDs:null,gapTargetIDs:null,liveWindowIDs:[]}:{...n,generation:t.generation,revision:o,olderCursor:n.olderCursor??t.nextCursor,olderComplete:n.olderComplete&&t.complete,liveWindowIDs:[],hasMessageGap:n.hasMessageGap,gapCursor:n.hasMessageGap?t.nextCursor??n.gapCursor:null,gapRequestIDs:n.hasMessageGap?n.gapRequestIDs:null,gapTargetIDs:n.hasMessageGap?n.gapTargetIDs:null};let c;if(s)c=we(n.messages,i,t.complete);else{let e=xe(i);c=L(n.messages.filter(t=>t.ordinal<e),L(n.messages.filter(t=>t.ordinal>=e),i,`existing`),`incoming`)}let l=n.liveWindowIDs,u=B(a),d=l.length>0&&z(l,u),f=n.hasMessageGap,p=n.gapCursor,m=n.gapRequestIDs,h=n.gapTargetIDs;if(!d&&l.length>0&&t.nextCursor){f=!0,p=t.nextCursor;let e=l.filter(e=>!u.has(e));m=e.length>0?e:[...l],h=n.hasMessageGap&&n.gapTargetIDs&&n.gapTargetIDs.length>0?n.gapTargetIDs:m}else n.hasMessageGap?(f=!0,p=n.gapCursor,m=n.gapRequestIDs,h=n.gapTargetIDs):(f=!1,p=null,m=null,h=null);return{messages:c,generation:t.generation,revision:o,olderCursor:n.liveWindowIDs.length===0&&n.messages.length===0?t.complete?null:t.nextCursor:n.olderCursor,olderComplete:!r||n.liveWindowIDs.length===0&&n.messages.length===0?t.complete:n.olderComplete,hasMessageGap:f,gapCursor:f?p:null,gapRequestIDs:f?m:null,gapTargetIDs:f?h:null,liveWindowIDs:a}},Ee=(e,t)=>{if(!F(e)||t.generation!==e.generation)return e;let n=t.revision>=e.revision?`incoming`:`existing`,r=L(e.messages,t.messages,n);return{...e,messages:r,revision:Math.max(e.revision,t.revision),olderCursor:t.complete?null:t.nextCursor,olderComplete:t.complete}},De=(e,t,n)=>{if(!F(e)||t.generation!==e.generation)return e;let r=t.revision>=e.revision?`incoming`:`existing`,i=L(e.messages,t.messages,r),a=Math.max(e.revision,t.revision),o=n?.requestIDs??e.gapRequestIDs;if(!(e.hasMessageGap&&o&&e.gapRequestIDs&&Se(o,e.gapRequestIDs)))return{...e,messages:i,revision:a};let s=R(t.messages),c=e.gapTargetIDs??[],l=B(c);return c.length>0&&z(s,l)||t.complete||!t.nextCursor?Ce({...e,messages:i,revision:a}):{...e,messages:i,revision:a,hasMessageGap:!0,gapCursor:t.nextCursor??e.gapCursor,gapRequestIDs:e.gapRequestIDs,gapTargetIDs:e.gapTargetIDs}},H={snapshot:(e=t())=>[e,`assistants`,`snapshot`],capability:(e=t())=>[e,`assistants`,`capability`],history:(e,r,i,a=t(),o=n())=>[a,o,`assistants`,`history`,e,r,i],contact:(e,r=t(),i=n())=>[r,i,`assistants`,`contact`,e],scheduledTasks:(e,r=t(),i=n())=>[r,i,`assistants`,`scheduled-tasks`,e],globalScheduledTasks:(e=t())=>[e,`scheduled-tasks`]},U=async(e,t={})=>{let n=await r(e,t),i=await n.json().catch(()=>null);if(!n.ok){let e=i&&typeof i==`object`&&`error`in i&&typeof i.error==`string`?i.error:`request_failed`,t=i&&typeof i==`object`&&`message`in i&&typeof i.message==`string`?i.message:void 0;throw new p(e,n.status,void 0,t)}return i},W=(e,t)=>({method:e,headers:{"Content-Type":`application/json`},body:t===void 0?void 0:JSON.stringify(t)}),G=(e,r)=>{if(t()!==e||n()!==r)throw new p(`runtime_stale`,409)},Oe=(e,t,r)=>{c.setQueryData(H.snapshot(r),n=>n&&{...n,assistants:n.assistants.map(n=>n.id!==e||n.sessionGeneration>t.sessionGeneration?n:{...n,sessionID:t.sessionID,sessionGeneration:t.sessionGeneration,effectiveWorkspacePath:t.directory})}),c.invalidateQueries({queryKey:H.snapshot(r)}),c.invalidateQueries({queryKey:[r,n(),`assistants`,`history`,e]})},ke=(e,t)=>{c.setQueryData(H.snapshot(t),t=>t&&{...t,assistants:t.assistants.some(t=>t.id===e.id)?t.assistants.map(t=>t.id===e.id?e:t):[...t.assistants,e]}),c.invalidateQueries({queryKey:H.snapshot(t)})},Ae=2500,je=15e3,Me=e=>!!e?.assistants.some(e=>e.working||e.activeContactTurn),Ne=(e,t={})=>{if(t.assistantID){let n=e?.assistants.find(e=>e.id===t.assistantID);return n?.working||n?.activeContactTurn?Ae:je}return Me(e)?Ae:je},K=(e=t())=>({queryKey:H.snapshot(e),queryFn:async({signal:e})=>ne(await U(`/api/yuri/assistants/snapshot`,{signal:e})),staleTime:0,retry:2,refetchInterval:e=>Ne(e.state.data),refetchIntervalInBackground:!1,refetchOnWindowFocus:!0,refetchOnReconnect:!0}),q=new Map,J=e=>{let r=q.get(e);if(r)r.count+=1;else{let r=n(),i=!1,a=!1,o=!1,l=()=>!i&&t()===e&&n()===r,u=async()=>{if(o=!0,!a){a=!0;try{do o=!1,c.getQueryCache().find({queryKey:H.snapshot(e),exact:!0})?.state.fetchStatus===`fetching`&&(o=!0),await c.invalidateQueries({queryKey:H.snapshot(e),exact:!0},{cancelRefetch:!1});while(o&&l())}finally{a=!1}}},d=s(t=>{if(!l())return;let n=c.getQueryData(H.snapshot(e));(t.type===`event-stream-ready`||t.type===`contact-turn-start`||t.type===`contact-turn-end`||t.type===`assistants-changed`&&(!n||t.revision>n.revision))&&u()});q.set(e,{count:1,dispose:()=>{i=!0,d()}})}return()=>{let t=q.get(e);t&&--t.count===0&&(t.dispose(),q.delete(e))}},Pe=e=>{let n=(0,f.c)(7),r,i,a;n[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=t(),i=o,r=K(a),n[0]=r,n[1]=i,n[2]=a):(r=n[0],i=n[1],a=n[2]);let s;n[3]===e?s=n[4]:(s={...r,select:e},n[3]=e,n[4]=s);let c=i(s),l,u;return n[5]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>J(a),u=[a],n[5]=l,n[6]=u):(l=n[5],u=n[6]),d.useEffect(l,u),c},Fe=e=>e.enabled?e.assistants.reduce((e,t)=>e+(t.unreadCount??0),0):0,Ie=()=>{let e=(0,f.c)(5),n,r,i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=t(),n=o,r={...K(i),select:Fe},e[0]=n,e[1]=r,e[2]=i):(n=e[0],r=e[1],i=e[2]);let a=n(r),s,c;return e[3]===Symbol.for(`react.memo_cache_sentinel`)?(s=()=>J(i),c=[i],e[3]=s,e[4]=c):(s=e[3],c=e[4]),d.useEffect(s,c),a.data??0},Le=e=>e.enabled&&Me(e),Re=()=>{let e=(0,f.c)(5),n,r,i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=t(),n=o,r={...K(i),select:Le},e[0]=n,e[1]=r,e[2]=i):(n=e[0],r=e[1],i=e[2]);let a=n(r),s,c;return e[3]===Symbol.for(`react.memo_cache_sentinel`)?(s=()=>J(i),c=[i],e[3]=s,e[4]=c):(s=e[3],c=e[4]),d.useEffect(s,c),a.data??!1},ze=(e,t={})=>{let n=new URLSearchParams;return n.set(`limit`,String(t.limit??20)),t.before&&n.set(`before`,t.before),t.messageID&&n.set(`messageID`,t.messageID),`/api/yuri/assistants/${encodeURIComponent(e)}/contact/messages?${n}`},Y=async(e,t,n)=>oe(await U(ze(e,t),n?{signal:n}:{})),Be=(e,t)=>e.generation===t.generation&&e.revision===t.revision&&e.olderCursor===t.olderCursor&&e.olderComplete===t.olderComplete&&e.hasMessageGap===t.hasMessageGap&&e.gapCursor===t.gapCursor&&e.messages===t.messages&&e.liveWindowIDs===t.liveWindowIDs&&e.gapRequestIDs===t.gapRequestIDs&&e.gapTargetIDs===t.gapTargetIDs,X=new Map,Z=new Map,Q=e=>e.join(``),Ve=async(e,t,n,r,i)=>{let a=Q(t),o=Z.get(a);if(o)return o;let s=(async()=>{let a=c.getQueryData(t)??n,o=0,s=!1,l=!1,u=a.gapRequestIDs?[...a.gapRequestIDs]:null,d=a.gapCursor;for(;a.hasMessageGap&&a.gapCursor&&o<5&&!i?.aborted;){G(r.transport,r.runtimeGeneration),o+=1;let n=a.gapCursor;try{let o=await Y(e,{limit:20,before:n},i);G(r.transport,r.runtimeGeneration);let l=c.getQueryData(t)??a;if(o.generation!==l.generation){a=l;break}let f=!u||!!(l.hasMessageGap&&l.gapRequestIDs&&l.gapRequestIDs.length===u.length&&l.gapRequestIDs.every((e,t)=>e===u[t]));if(a=De(l,o,u?{requestIDs:u,cursor:d}:void 0),c.setQueryData(t,a),!f)break;if(!a.hasMessageGap){s=!0;break}if(a.gapCursor&&a.gapCursor!==n)s=!0;else break}catch(e){if(i?.aborted||m(e))break;l=!0,a=c.getQueryData(t)??a;break}}return{view:c.getQueryData(t)??a,failed:l,progressed:s}})();Z.set(a,s);try{return await s}finally{Z.get(a)===s&&Z.delete(a)}},He=(e,r=t(),i=n(),a={})=>({queryKey:H.contact(e,r,i),queryFn:async({signal:t})=>{G(r,i),await l(),G(r,i);let n=H.contact(e,r,i),a=c.getQueryData(n),o=await Y(e,{limit:20},t);G(r,i);let s=Te(c.getQueryData(n)??a??null,o);c.setQueryData(n,s);let u=Q(n);if(s.hasMessageGap&&s.gapCursor){X.delete(u);let a=await Ve(e,n,s,{transport:r,runtimeGeneration:i},t);s=a.view,(a.failed||a.view.hasMessageGap&&!a.progressed)&&a.view.gapCursor&&X.set(u,a.view.gapCursor)}else X.delete(u);G(r,i);let d=c.getQueryData(n)??s;return a&&Be(a,d)?a:d},retry:2,staleTime:0,refetchInterval:()=>a.reconcileInForeground?Ne(c.getQueryData(H.snapshot(r)),{assistantID:e}):!1,refetchIntervalInBackground:!1,refetchOnWindowFocus:!0,refetchOnReconnect:!0,structuralSharing:!0}),Ue=(e,r=!0)=>{let i=t(),a=n(),[l,u]=d.useState(!1),[f,p]=d.useState(null),[h,g]=d.useState(!1),_=d.useRef(null),v=d.useRef(null),y=d.useRef(null),b=d.useRef(null),x=d.useRef({assistantID:e,transport:i,runtimeGeneration:a,enabled:r});x.current={assistantID:e,transport:i,runtimeGeneration:a,enabled:r};let S=o({...He(e,i,a,{reconcileInForeground:!0}),enabled:r&&!!e});d.useEffect(()=>{!r||!e||c.invalidateQueries({queryKey:H.snapshot(i),exact:!0},{cancelRefetch:!1})},[e,r,a,i]),d.useEffect(()=>s(n=>{t()===i&&(n.type===`assistants-changed`||n.type===`event-stream-ready`||n.type===`contact-turn-end`)&&(n.type===`contact-turn-end`&&`assistantID`in n&&n.assistantID!==e||c.invalidateQueries({queryKey:H.contact(e,i,a),exact:!0}))}),[e,a,i]),d.useEffect(()=>{let t=Q(H.contact(e,i,a));return()=>{y.current?.abort(),b.current?.abort(),y.current=null,b.current=null,_.current=null,v.current=null,X.delete(t)}},[e,i,a,r]);let C=S.data,w=H.contact(e,i,a),T=async()=>{if(!e||!r)return;if(_.current)return _.current;let t=c.getQueryData(w)??C;if(!t||t.olderComplete||!t.olderCursor)return;p(null),u(!0);let n=new AbortController;b.current?.abort(),b.current=n;let o={transport:i,runtimeGeneration:a,assistantID:e,cursor:t.olderCursor},s=(async()=>{try{G(o.transport,o.runtimeGeneration);let e=await Y(o.assistantID,{limit:20,before:o.cursor},n.signal);if(n.signal.aborted||(G(o.transport,o.runtimeGeneration),x.current.assistantID!==o.assistantID||x.current.transport!==o.transport||x.current.runtimeGeneration!==o.runtimeGeneration))return;let r=c.getQueryData(w)??t;if(e.generation!==r.generation)return;c.setQueryData(w,Ee(r,e))}catch(e){if(n.signal.aborted||m(e))return;let t=e instanceof Error?e:Error(String(e));throw p(t),t}finally{b.current===n&&(b.current=null),u(!1),_.current=null}})();return _.current=s,s},E=async(t=`explicit`)=>{if(!e||!r)return;if(v.current)return v.current;let n=c.getQueryData(w)??C;if(!n?.hasMessageGap||!n.gapCursor)return;let o=Q(w);if(t===`auto`&&X.get(o)===n.gapCursor)return;t===`explicit`&&X.delete(o),g(!0);let s=new AbortController;y.current?.abort(),y.current=s;let l={transport:i,runtimeGeneration:a,assistantID:e,cursor:n.gapCursor},u=(async()=>{try{G(l.transport,l.runtimeGeneration);let e=await Ve(l.assistantID,w,n,{transport:l.transport,runtimeGeneration:l.runtimeGeneration},s.signal);if(s.signal.aborted)return;if(G(l.transport,l.runtimeGeneration),e.failed||!e.progressed){e.view.gapCursor&&X.set(o,e.view.gapCursor);return}e.view.hasMessageGap||X.delete(o)}catch(e){if(s.signal.aborted||m(e))return;throw X.set(o,l.cursor),e}finally{y.current===s&&(y.current=null),g(!1),v.current=null}})();return v.current=u,u};return d.useEffect(()=>{if(!r||!e||!C?.hasMessageGap||!C.gapCursor||S.isFetching||h)return;let t=Q(w);X.get(t)!==C.gapCursor&&E(`auto`).catch(()=>void 0)},[r,e,C?.hasMessageGap,C?.gapCursor,S.isFetching,h,w]),{data:C?{messages:C.messages,generation:C.generation,revision:C.revision,nextCursor:C.olderCursor,complete:C.olderComplete}:void 0,status:S.status,fetchStatus:S.fetchStatus,isError:S.isError,isPending:S.isPending,isFetching:S.isFetching,isSuccess:S.isSuccess,error:S.error instanceof Error?S.error:S.error?Error(String(S.error)):null,refetch:()=>S.refetch(),fetchPreviousPage:T,hasPreviousPage:!!(C&&!C.olderComplete&&C.olderCursor),isFetchingPreviousPage:l,previousPageError:f,hasMessageGap:!!C?.hasMessageGap,isFillingMessageGap:h,retryMessageGap:()=>E(`explicit`)}},We=async(e,r)=>{let i=t(),a=n();await l(),G(i,a);let o=await Y(e,{messageID:r,limit:1});if(G(i,a),!o.messages.some(e=>e.messageID===r&&e.role===`user`))return null;c.invalidateQueries({queryKey:H.contact(e,i,a),exact:!0}),c.invalidateQueries({queryKey:H.snapshot(i),exact:!0});let s=c.getQueryData(H.snapshot(i));return{admitted:!0,messageID:r,revision:o.revision??s?.revision??null}},Ge=(e,r=t(),i=n())=>({queryKey:H.scheduledTasks(e,r,i),queryFn:async({signal:t})=>{G(r,i);let n=se(await U(`/api/yuri/assistants/${encodeURIComponent(e)}/scheduled-tasks`,{signal:t}));return G(r,i),n},refetchOnMount:`always`,retry:(e,t)=>!(t instanceof p&&t.status===404)&&e<2}),Ke=(e,r)=>{let i=(0,f.c)(6),a=r===void 0||r,s,c;if(i[0]!==e){let r=t(),a=n();c=o,s=Ge(e,r,a),i[0]=e,i[1]=s,i[2]=c}else s=i[1],c=i[2];let l=a&&!!e,u;return i[3]!==s||i[4]!==l?(u={...s,enabled:l},i[3]=s,i[4]=l,i[5]=u):u=i[5],c(u)},$=(e=t())=>({queryKey:H.globalScheduledTasks(e),queryFn:me,refetchOnMount:`always`}),qe=e=>{let t=(0,f.c)(3),n=e===void 0||e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=$(),t[0]=r):r=t[0];let i;return t[1]===n?i=t[2]:(i={...r,enabled:n},t[1]=n,t[2]=i),o(i)},Je=e=>e.tasks.some(({task:e})=>e.state.lastStatus===`running`),Ye=()=>{let e=(0,f.c)(5),n,r,i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=t(),n=o,r={...$(i),select:Je,staleTime:0,refetchInterval:mt,refetchIntervalInBackground:!1},e[0]=n,e[1]=r,e[2]=i):(n=e[0],r=e[1],i=e[2]);let a=n(r),l,u;return e[3]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>s(e=>{t()===i&&(e.type===`scheduled-task-ran`||e.type===`event-stream-ready`)&&c.invalidateQueries({queryKey:$(i).queryKey,exact:!0})}),u=[i],e[3]=l,e[4]=u):(l=e[3],u=e[4]),d.useEffect(l,u),a.data===!0},Xe=(e,r=t())=>{c.invalidateQueries({queryKey:[r,n(),`assistants`,`contact`,e]})},Ze=(e=t())=>({queryKey:H.capability(e),queryFn:()=>dt(),retry:!1}),Qe=()=>{let e=(0,f.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=Ze(),e[0]=t):t=e[0],o(t)},$e=(e=c,n=t())=>e.getQueryData(H.snapshot(n)),et=(e=c,n=t())=>e.fetchQuery(K(n)),tt=async(e=c)=>{let r=t(),i=n();await e.invalidateQueries({queryKey:H.snapshot(r),exact:!0}),G(r,i);let a=await e.fetchQuery(K(r));return G(r,i),a},nt=15e3,rt=e=>{throw e instanceof p?e:m(e)?new p(`admission_timeout`,408):e},it=async(e,r,i)=>{let a=t(),o=n(),s=typeof i==`string`?[{type:`text`,text:i}]:Array.isArray(i.parts)&&i.parts.length>0?i.parts:[{type:`text`,text:i.text??``}],c=AbortSignal.timeout(nt);try{let t=ie(await U(`/api/yuri/assistants/${encodeURIComponent(e)}/messages`,{...W(`POST`,{messageID:r,parts:s,language:u.getState().locale}),signal:c}));return G(a,o),Oe(e,t.binding,a),Xe(e,a),t}catch(e){return rt(e)}},at=async(e,r,i,a,o)=>{let s=t(),c=n(),l=A(await U(`/api/yuri/assistants/${encodeURIComponent(e)}/share`,W(`POST`,{operationID:r,payload:{messageID:i,parts:a,source:o}})));return G(s,c),l},ot=async(e,r=t(),i=n())=>{G(r,i);let a=A(await U(`/api/yuri/assistants/share-operations/${encodeURIComponent(e)}`));return G(r,i),a},st=async(e,r=t(),i=n())=>{let a=e;for(let e=0;e<60&&(a.state===`running`||a.state===`submitting`);e+=1)G(r,i),await new Promise(e=>setTimeout(e,750)),a=await ot(a.operationID,r,i);if(G(r,i),a.state===`completed`)return a;throw a.state===`failed`?new h(a.errorCode??`share_failed`,400,a):new h(`share_unresolved`,408,a)},ct=async e=>{let n=t(),r=k(await U(`/api/yuri/assistants`,W(`POST`,{...e,language:u.getState().locale})));return ke(r,n),r},lt=async(e,r)=>{let i=t(),a=n(),o=k(await U(`/api/yuri/assistants/${encodeURIComponent(e.id)}`,W(`PATCH`,{...r,expectedRevision:e.revision})));return G(i,a),r.pinned===void 0?ke(o,i):(await c.cancelQueries({queryKey:H.snapshot(i),exact:!0}),G(i,a),await c.fetchQuery(K(i)),G(i,a)),o},ut=async e=>{await U(`/api/yuri/assistants/${encodeURIComponent(e.id)}`,W(`DELETE`,{expectedRevision:e.revision})),await c.invalidateQueries({queryKey:H.snapshot(t())})},dt=async()=>w(await U(`/api/yuri/assistants/capability`)),ft=async(e,r)=>{let i=t(),a=n(),o=O(r);try{let t=te(await U(`/api/yuri/assistants/${encodeURIComponent(e)}/contact/read`,{...W(`POST`,o),signal:AbortSignal.timeout(15e3)}));if(G(i,a),t.assistantID!==e)throw new p(`invalid_assistant_read_response`,200);return t}finally{t()===i&&n()===a&&c.invalidateQueries({queryKey:H.snapshot(i),exact:!0})}},pt=async e=>{let r=e.assistants.filter(e=>(e.unreadCount??0)>0&&e.readTip).map(e=>({id:e.id,position:{...e.readTip}})),i=t(),a=n(),o=[];for(let e=0;e<r.length;e+=4)o.push(...await Promise.allSettled(r.slice(e,e+4).map(async e=>(G(i,a),ft(e.id,e.position)))));return{failed:o.filter(e=>e.status===`rejected`).length}};function mt(e){return e.state.data&&Je(e.state.data)?2500:15e3}export{p as A,ye as C,pe as D,me as E,m as M,_e as O,st as S,ge as T,Pe as _,et as a,qe as b,pt as c,it as d,at as f,Ke as g,Ue as h,ut as i,h as j,he as k,ft as l,Qe as m,We as n,dt as o,lt as p,ct as r,tt as s,He as t,$e as u,Ie as v,ve as w,Ye as x,Re as y};
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,n}from"./runtime-switch-CSXCC6XM.js";import{n as r}from"./runtime-fetch-ykYB0sSi.js";import{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{P as s,W as c}from"./runtime-file-resource-DDGMqGyv.js";import{Et as l}from"./ui-gH75_gWj.js";import{i as u}from"./store-BUNov-dS.js";var d=e(i(),1),f=a(),p=class extends Error{code;status;resource;constructor(e,t,n,r){super(typeof r==`string`&&r.trim()?r.trim():e),this.code=e,this.status=t,this.resource=n}},m=e=>{if(!e||typeof e!=`object`)return!1;let t=`name`in e?String(e.name):``;return t===`AbortError`||t===`TimeoutError`},h=class extends p{operation;constructor(e,t,n){super(e,t,`share_operation`),this.operation=n}},g=(e,t=200)=>{throw new p(`invalid_${e}_response`,t,e)},_=(e,t)=>e&&typeof e==`object`&&!Array.isArray(e)?e:g(t),v=(e,t)=>typeof e==`string`?e:g(t),y=(e,t)=>e===null||typeof e==`string`?e:g(t),b=(e,t)=>typeof e==`number`&&Number.isFinite(e)?e:g(t),x=(e,t)=>e===null?null:b(e,t),S=(e,t)=>typeof e==`boolean`?e:g(t),C=(e,t,n)=>t.includes(e)?e:g(n),w=e=>{let t=_(e,`capability`);return{supported:S(t.supported,`capability`),enabled:S(t.enabled,`capability`),revision:b(t.revision,`capability`),serverInstanceID:y(t.serverInstanceID,`capability`),sharingAvailable:t.sharingAvailable!==void 0&&S(t.sharingAvailable,`capability`)}},T=e=>{if(e==null)return null;let t=_(e,`assistant`);return{turnID:v(t.turnID,`assistant`),messageID:v(t.messageID,`assistant`),status:C(t.status,[`queued`,`running`],`assistant`),admittedAt:b(t.admittedAt,`assistant`)}},E=e=>{if(e==null)return null;let t=_(e,`assistant_preview`),n=b(t.ordinal,`assistant_preview`);return!Number.isSafeInteger(n)||n<0?g(`assistant_preview`):{...t.createdAt===void 0?{}:{createdAt:b(t.createdAt,`assistant_preview`)},messageID:v(t.messageID,`assistant_preview`),ordinal:n,role:C(t.role,[`user`,`assistant`],`assistant_preview`),text:v(t.text,`assistant_preview`),fallbackKind:t.fallbackKind===null?null:C(t.fallbackKind,[`image`,`file`,`session`,`assistant`,`schedule`],`assistant_preview`)}},D=e=>{let t=b(e,`assistant_read`);return Number.isSafeInteger(t)&&t>=0?t:g(`assistant_read`)},O=e=>{let t=_(e,`assistant_read`);return{generation:D(t.generation),ordinal:D(t.ordinal),messageID:v(t.messageID,`assistant_read`)}},ee=e=>({unreadCount:e.unreadCount===void 0?0:D(e.unreadCount),readWatermark:e.readWatermark==null?null:O(e.readWatermark),readTip:e.readTip==null?null:O(e.readTip)}),te=e=>{let t=_(e,`assistant_read`);return{assistantID:v(t.assistantID,`assistant_read`),changed:S(t.changed,`assistant_read`),unreadCount:D(t.unreadCount),readWatermark:O(t.readWatermark),readTip:O(t.readTip),revision:D(t.revision)}},k=e=>{let t=_(e,`assistant`),n=Array.isArray(t.historySessionIDs)?t.historySessionIDs.map(e=>v(e,`assistant`)):[],r=t.historySessionCount===void 0?n.length:b(t.historySessionCount,`assistant`);if(!Number.isSafeInteger(r)||r<n.length)return g(`assistant`);let i=Array.isArray(t.assignedSessionIDs)?t.assignedSessionIDs.map(e=>v(e,`assistant`)):[],a=t.activeContactTurn===void 0?null:T(t.activeContactTurn),o=t.working===void 0?a!=null:S(t.working,`assistant`);return{...ee(t),pinnedAt:t.pinnedAt===void 0?void 0:x(t.pinnedAt,`assistant`),latestMessagePreview:E(t.latestMessagePreview),id:v(t.id,`assistant`),avatarSeed:v(t.avatarSeed??t.id,`assistant`),revision:b(t.revision,`assistant`),enabled:S(t.enabled,`assistant`),name:v(t.name,`assistant`),defaultPrompt:v(t.defaultPrompt,`assistant`),workspacePath:y(t.workspacePath,`assistant`),effectiveWorkspacePath:v(t.effectiveWorkspacePath,`assistant`),managedWorkspacePath:y(t.managedWorkspacePath??null,`assistant`),providerID:v(t.providerID,`assistant`),modelID:v(t.modelID,`assistant`),agent:y(t.agent,`assistant`),variant:y(t.variant??null,`assistant`),mode:C(t.mode,[`continuous`,`stateless`],`assistant`),sessionID:y(t.sessionID,`assistant`),sessionGeneration:b(t.sessionGeneration,`assistant`),historySessionIDs:n,historySessionCount:r,assignedSessionIDs:i,working:o,activeContactTurn:a,createdAt:x(t.createdAt,`assistant`),updatedAt:b(t.updatedAt,`assistant`),tombstoneAt:x(t.tombstoneAt,`assistant`)}},ne=e=>{let t=_(e,`snapshot`);return{revision:b(t.revision,`snapshot`),enabled:S(t.enabled,`snapshot`),assistants:Array.isArray(t.assistants)?t.assistants.map(k):g(`snapshot`)}},re=e=>{let t=_(e,`binding`);return{sessionID:y(t.sessionID,`binding`),directory:v(t.directory,`binding`),sessionGeneration:b(t.sessionGeneration,`binding`)}},ie=e=>{let t=_(e,`message_admission`);if(t.admitted!==!0)return g(`message_admission`);let n=t.revision===void 0||t.revision===null?null:b(t.revision,`message_admission`);return{binding:re(t.binding),messageID:v(t.messageID,`message_admission`),admitted:!0,revision:n,...t.replayed===!0?{replayed:!0}:{}}},A=e=>{let t=_(e,`share_operation`);return{operationID:v(t.operationID,`share_operation`),assistantID:v(t.assistantID,`share_operation`),sessionID:y(t.sessionID,`share_operation`),messageID:y(t.messageID,`share_operation`),state:C(t.state,[`submitting`,`running`,`completed`,`failed`,`unresolved`],`share_operation`),phase:v(t.phase,`share_operation`),attempt:b(t.attempt,`share_operation`),leaseExpiresAt:x(t.leaseExpiresAt,`share_operation`),errorCode:y(t.errorCode,`share_operation`)}},ae=e=>{let t=_(e,`assistant_contact_part`);if(t.type===`text`)return{type:`text`,text:v(t.text,`assistant_contact_part`)};if(t.type===`file`){let e=t.filename===void 0||t.filename===null?void 0:v(t.filename,`assistant_contact_part`),n=v(t.mime,`assistant_contact_part`),r=t.url!==void 0&&t.url!==null,i=t.attachmentID!==void 0&&t.attachmentID!==null;if(r&&i)return g(`assistant_contact_part`);if(i){let r=b(t.size,`assistant_contact_part`);return!Number.isSafeInteger(r)||r<0?g(`assistant_contact_part`):{type:`file`,mime:n,attachmentID:v(t.attachmentID,`assistant_contact_part`),sha256:v(t.sha256,`assistant_contact_part`),size:r,...e?{filename:e}:{}}}return r?{type:`file`,mime:n,url:v(t.url,`assistant_contact_part`),...e?{filename:e}:{}}:g(`assistant_contact_part`)}if(t.type===`card`){let e=C(t.cardType,[`session`,`assistant`,`schedule`],`assistant_contact_part`);if(e===`session`){let e;if(t.target!==void 0){let n=_(t.target,`assistant_contact_part`),r=e=>{let t=v(n[e],`assistant_contact_part`);return!t||t!==t.trim()||t.length>512||Array.from(t).some(e=>e.charCodeAt(0)<32)?g(`assistant_contact_part`):t};e={hubId:r(`hubId`),hostId:r(`hostId`),instanceId:r(`instanceId`)}}return{type:`card`,cardType:`session`,sessionID:v(t.sessionID,`assistant_contact_part`),directory:v(t.directory,`assistant_contact_part`),title:y(t.title??null,`assistant_contact_part`),status:y(t.status??null,`assistant_contact_part`),branch:y(t.branch??null,`assistant_contact_part`),...e?{target:e}:{}}}return e===`assistant`?{type:`card`,cardType:`assistant`,assistantID:v(t.assistantID,`assistant_contact_part`),name:v(t.name,`assistant_contact_part`),providerID:v(t.providerID,`assistant_contact_part`),modelID:v(t.modelID,`assistant_contact_part`),mode:C(t.mode??`continuous`,[`continuous`,`stateless`],`assistant_contact_part`)}:{type:`card`,cardType:`schedule`,taskID:v(t.taskID,`assistant_contact_part`),projectID:v(t.projectID,`assistant_contact_part`),name:v(t.name,`assistant_contact_part`),kind:y(t.kind??null,`assistant_contact_part`),time:y(t.time??null,`assistant_contact_part`),timezone:y(t.timezone??null,`assistant_contact_part`),prompt:y(t.prompt??null,`assistant_contact_part`),...t.cron===void 0?{}:{cron:y(t.cron,`assistant_contact_part`)},...t.date===void 0?{}:{date:y(t.date,`assistant_contact_part`)},...t.times===void 0?{}:{times:t.times===null?null:Array.isArray(t.times)?t.times.map(e=>v(e,`assistant_contact_part`)):g(`assistant_contact_part`)},...t.weekdays===void 0?{}:{weekdays:t.weekdays===null?null:Array.isArray(t.weekdays)?t.weekdays.map(e=>{let t=b(e,`assistant_contact_part`);return Number.isInteger(t)&&t>=0&&t<=6?t:g(`assistant_contact_part`)}):g(`assistant_contact_part`)}}}return g(`assistant_contact_part`)},oe=e=>{let t=_(e,`assistant_contact`),n=y(t.nextCursor,`assistant_contact`),r=S(t.complete,`assistant_contact`);if(!r&&!n||r&&n||!Array.isArray(t.messages))return g(`assistant_contact`);let i=b(t.generation,`assistant_contact`),a=b(t.revision,`assistant_contact`);return!Number.isSafeInteger(i)||i<0||!Number.isSafeInteger(a)||a<0?g(`assistant_contact`):{messages:t.messages.map(e=>{let t=_(e,`assistant_contact_message`);if(!Array.isArray(t.parts))return g(`assistant_contact_message`);let n=t.parts.map(ae);return{messageID:v(t.messageID,`assistant_contact_message`),assistantID:v(t.assistantID,`assistant_contact_message`),role:C(t.role,[`user`,`assistant`,`peer`],`assistant_contact_message`),turnID:v(t.turnID,`assistant_contact_message`),bubbleIndex:b(t.bubbleIndex,`assistant_contact_message`),createdAt:b(t.createdAt,`assistant_contact_message`),ordinal:b(t.ordinal,`assistant_contact_message`),status:v(t.status,`assistant_contact_message`),fromAssistantID:y(t.fromAssistantID??null,`assistant_contact_message`),fromAssistantName:y(t.fromAssistantName??null,`assistant_contact_message`),parts:n,text:typeof t.text==`string`?t.text:n.filter(e=>e.type===`text`).map(e=>e.text).join(``),cards:n.filter(e=>e.type===`card`)}}),nextCursor:n,complete:r,generation:i,revision:a}},se=e=>{let t=_(e,`assistant_scheduled_tasks`);return Array.isArray(t.tasks)?{tasks:t.tasks.map(e=>{let t=_(e,`assistant_scheduled_task`),n=t.task===null||t.task===void 0?null:_(t.task,`assistant_scheduled_task_live`);return{assistantID:v(t.assistantID,`assistant_scheduled_task`),projectID:v(t.projectID,`assistant_scheduled_task`),taskID:v(t.taskID,`assistant_scheduled_task`),createdAt:b(t.createdAt,`assistant_scheduled_task`),projectPath:y(t.projectPath??null,`assistant_scheduled_task`),projectLabel:y(t.projectLabel??null,`assistant_scheduled_task`),task:n}})}:g(`assistant_scheduled_tasks`)},j=async(e,t)=>{try{let t=await e.json();if(t&&typeof t.error==`string`&&t.error.trim().length>0)return t.error}catch{return t}return t},M=e=>{let t=typeof e==`string`?e.trim():``;if(!t)throw Error(`projectId is required`);return t},N=e=>e===null||typeof e==`string`,ce=e=>e===null||typeof e==`number`&&Number.isFinite(e),le=e=>typeof e==`number`&&Number.isFinite(e)&&e>=0&&e<=864e13,ue=e=>e===null||le(e),de=e=>{if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;return typeof t.id==`string`&&t.id.length>0&&typeof t.projectId==`string`&&t.projectId.length>0&&typeof t.taskId==`string`&&t.taskId.length>0&&typeof t.taskName==`string`&&(t.trigger===`scheduled`||t.trigger===`manual`)&&(t.status===`running`||t.status===`success`||t.status===`error`)&&N(t.sessionId)&&N(t.directory)&&N(t.error)&&le(t.startedAt)&&ue(t.finishedAt)&&ce(t.durationMs)&&(t.durationMs===null||t.durationMs>=0)},fe=e=>{if(!e||typeof e!=`object`||Array.isArray(e))throw Error(`Malformed scheduled task runs response`);let t=e;if(!Array.isArray(t.runs)||!t.runs.every(de)||!N(t.nextCursor)||typeof t.complete!=`boolean`||t.complete!==(t.nextCursor===null)||t.nextCursor!==null&&t.nextCursor.length===0)throw Error(`Malformed scheduled task runs response`);return{runs:t.runs,nextCursor:t.nextCursor,complete:t.complete}},pe=async(e,t)=>{let n=new URLSearchParams;e.before&&n.set(`before`,e.before);let i=e.limit??20;if(!Number.isInteger(i)||i<1)throw Error(`limit must be a positive integer`);n.set(`limit`,String(i)),e.projectId&&n.set(`projectId`,e.projectId),e.taskId&&n.set(`taskId`,e.taskId);let a=await r(`/api/yuri/scheduled-task-runs?${n.toString()}`,{signal:t});if(!a.ok)throw Error(await j(a,`Failed to load scheduled task history`));return fe(await a.json().catch(()=>null))},me=async({signal:e}={})=>{let t=await r(`/api/yuri/scheduled-tasks`,{signal:e});if(!t.ok)throw Error(await j(t,`Failed to load schedules`));let n=await t.json().catch(()=>null);if(!n||!Array.isArray(n.tasks))throw Error(`Malformed schedules response`);return{tasks:Array.isArray(n?.tasks)?n.tasks:[],failedProjectIds:Array.isArray(n?.failedProjectIds)?n.failedProjectIds.filter(e=>typeof e==`string`):[]}},he=async(e,t)=>{let n=M(e),i=await r(`/api/projects/${encodeURIComponent(n)}/scheduled-tasks`,{method:`PUT`,headers:{"content-type":`application/json`,accept:`application/json`},body:JSON.stringify({task:t})});if(!i.ok)throw Error(await j(i,`Failed to save schedule`));let a=await i.json().catch(()=>null);return!a||!Array.isArray(a.tasks)?[]:a.tasks},ge=async(e,t)=>{let n=M(e),i=M(t),a=await r(`/api/projects/${encodeURIComponent(n)}/scheduled-tasks/${encodeURIComponent(i)}`,{method:`DELETE`,headers:{accept:`application/json`}});if(!a.ok)throw Error(await j(a,`Failed to delete schedule`));let o=await a.json().catch(()=>null);return!o||!Array.isArray(o.tasks)?[]:o.tasks},_e=async(e,t)=>{let n=M(e),i=M(t),a=await r(`/api/projects/${encodeURIComponent(n)}/scheduled-tasks/${encodeURIComponent(i)}/run`,{method:`POST`,headers:{accept:`application/json`}});if(!a.ok)throw Error(await j(a,`Failed to run schedule`));let o=await a.json().catch(()=>null);return{sessionId:typeof o?.sessionId==`string`&&o.sessionId.length>0?o.sessionId:void 0}},P=(e,t)=>e.ordinal===t.ordinal?e.messageID<t.messageID?-1:+(e.messageID>t.messageID):e.ordinal-t.ordinal,ve=e=>{if(e.type===`file`||e.type===`card`)return!0;if(e.type!==`text`)return!1;let t=typeof e.text==`string`?e.text.trim():``;return!!t&&!t.startsWith(`yuri.settle.`)&&!t.startsWith(`oc.settle.`)},ye=(e,t)=>{if(!t||!e.readTip||!((e.unreadCount??0)>0))return null;let n=e.readTip;if(t.generation!==n.generation)return null;let r;for(let n=t.messages.length-1;n>=0;--n){let i=t.messages[n];if(i.assistantID===e.id&&(i.status===`complete`||i.status===`error`)&&i.parts.some(ve)){r=i;break}}if(!r)return null;let i=e.readWatermark;return i&&(i.generation>t.generation||i.generation===t.generation&&P({ordinal:i.ordinal,messageID:i.messageID},{ordinal:r.ordinal,messageID:r.messageID})>=0)?null:{generation:t.generation,ordinal:r.ordinal,messageID:r.messageID}},be=()=>({messages:[],generation:-1,revision:0,olderCursor:null,olderComplete:!0,hasMessageGap:!1,gapCursor:null,gapRequestIDs:null,gapTargetIDs:null,liveWindowIDs:[]}),F=e=>!!(e&&e.generation>=0),I=(e,t)=>P({ordinal:e.ordinal,messageID:e.messageID},{ordinal:t.ordinal,messageID:t.messageID}),L=(e,t,n=`incoming`)=>{let r=new Map;for(let t of e)r.set(t.messageID,t);for(let e of t)(n===`incoming`||!r.has(e.messageID))&&r.set(e.messageID,e);return[...r.values()].sort(I)},xe=e=>{let t=1/0;for(let n of e)n.ordinal<t&&(t=n.ordinal);return Number.isFinite(t)?t:null},R=e=>e.map(e=>e.messageID),z=(e,t)=>{for(let n of e)if(t.has(n))return!0;return!1},B=e=>new Set(e),Se=(e,t)=>!e||!t||e.length!==t.length?!1:e.every((e,n)=>e===t[n]),Ce=e=>({...e,hasMessageGap:!1,gapCursor:null,gapRequestIDs:null,gapTargetIDs:null}),V=e=>({ordinal:e.ordinal,messageID:e.messageID}),we=(e,t,n)=>{if(n)return[...t];if(t.length===0)return[...e];let r=t[0];return[...e.filter(e=>P(V(e),V(r))<0),...t]},Te=(e,t)=>{let n=e??be(),r=F(n),i=[...t.messages].sort(I),a=R(i);if(r&&t.generation<n.generation)return n;if(r&&t.generation>n.generation)return{messages:i,generation:t.generation,revision:t.revision,olderCursor:t.nextCursor,olderComplete:t.complete,hasMessageGap:!1,gapCursor:null,gapRequestIDs:null,gapTargetIDs:null,liveWindowIDs:a};if(!r)return{messages:i,generation:t.generation,revision:t.revision,olderCursor:t.complete?null:t.nextCursor,olderComplete:t.complete,hasMessageGap:!1,gapCursor:null,gapRequestIDs:null,gapTargetIDs:null,liveWindowIDs:a};let o=Math.max(n.revision,t.revision),s=t.revision>=n.revision;if(i.length===0)return s&&t.complete?{messages:[],generation:t.generation,revision:o,olderCursor:null,olderComplete:!0,hasMessageGap:!1,gapCursor:null,gapRequestIDs:null,gapTargetIDs:null,liveWindowIDs:[]}:{...n,generation:t.generation,revision:o,olderCursor:n.olderCursor??t.nextCursor,olderComplete:n.olderComplete&&t.complete,liveWindowIDs:[],hasMessageGap:n.hasMessageGap,gapCursor:n.hasMessageGap?t.nextCursor??n.gapCursor:null,gapRequestIDs:n.hasMessageGap?n.gapRequestIDs:null,gapTargetIDs:n.hasMessageGap?n.gapTargetIDs:null};let c;if(s)c=we(n.messages,i,t.complete);else{let e=xe(i);c=L(n.messages.filter(t=>t.ordinal<e),L(n.messages.filter(t=>t.ordinal>=e),i,`existing`),`incoming`)}let l=n.liveWindowIDs,u=B(a),d=l.length>0&&z(l,u),f=n.hasMessageGap,p=n.gapCursor,m=n.gapRequestIDs,h=n.gapTargetIDs;if(!d&&l.length>0&&t.nextCursor){f=!0,p=t.nextCursor;let e=l.filter(e=>!u.has(e));m=e.length>0?e:[...l],h=n.hasMessageGap&&n.gapTargetIDs&&n.gapTargetIDs.length>0?n.gapTargetIDs:m}else n.hasMessageGap?(f=!0,p=n.gapCursor,m=n.gapRequestIDs,h=n.gapTargetIDs):(f=!1,p=null,m=null,h=null);return{messages:c,generation:t.generation,revision:o,olderCursor:n.liveWindowIDs.length===0&&n.messages.length===0?t.complete?null:t.nextCursor:n.olderCursor,olderComplete:!r||n.liveWindowIDs.length===0&&n.messages.length===0?t.complete:n.olderComplete,hasMessageGap:f,gapCursor:f?p:null,gapRequestIDs:f?m:null,gapTargetIDs:f?h:null,liveWindowIDs:a}},Ee=(e,t)=>{if(!F(e)||t.generation!==e.generation)return e;let n=t.revision>=e.revision?`incoming`:`existing`,r=L(e.messages,t.messages,n);return{...e,messages:r,revision:Math.max(e.revision,t.revision),olderCursor:t.complete?null:t.nextCursor,olderComplete:t.complete}},De=(e,t,n)=>{if(!F(e)||t.generation!==e.generation)return e;let r=t.revision>=e.revision?`incoming`:`existing`,i=L(e.messages,t.messages,r),a=Math.max(e.revision,t.revision),o=n?.requestIDs??e.gapRequestIDs;if(!(e.hasMessageGap&&o&&e.gapRequestIDs&&Se(o,e.gapRequestIDs)))return{...e,messages:i,revision:a};let s=R(t.messages),c=e.gapTargetIDs??[],l=B(c);return c.length>0&&z(s,l)||t.complete||!t.nextCursor?Ce({...e,messages:i,revision:a}):{...e,messages:i,revision:a,hasMessageGap:!0,gapCursor:t.nextCursor??e.gapCursor,gapRequestIDs:e.gapRequestIDs,gapTargetIDs:e.gapTargetIDs}},H={snapshot:(e=t())=>[e,`assistants`,`snapshot`],capability:(e=t())=>[e,`assistants`,`capability`],history:(e,r,i,a=t(),o=n())=>[a,o,`assistants`,`history`,e,r,i],contact:(e,r=t(),i=n())=>[r,i,`assistants`,`contact`,e],scheduledTasks:(e,r=t(),i=n())=>[r,i,`assistants`,`scheduled-tasks`,e],globalScheduledTasks:(e=t())=>[e,`scheduled-tasks`]},U=async(e,t={})=>{let n=await r(e,t),i=await n.json().catch(()=>null);if(!n.ok){let e=i&&typeof i==`object`&&`error`in i&&typeof i.error==`string`?i.error:`request_failed`,t=i&&typeof i==`object`&&`message`in i&&typeof i.message==`string`?i.message:void 0;throw new p(e,n.status,void 0,t)}return i},W=(e,t)=>({method:e,headers:{"Content-Type":`application/json`},body:t===void 0?void 0:JSON.stringify(t)}),G=(e,r)=>{if(t()!==e||n()!==r)throw new p(`runtime_stale`,409)},Oe=(e,t,r)=>{c.setQueryData(H.snapshot(r),n=>n&&{...n,assistants:n.assistants.map(n=>n.id!==e||n.sessionGeneration>t.sessionGeneration?n:{...n,sessionID:t.sessionID,sessionGeneration:t.sessionGeneration,effectiveWorkspacePath:t.directory})}),c.invalidateQueries({queryKey:H.snapshot(r)}),c.invalidateQueries({queryKey:[r,n(),`assistants`,`history`,e]})},ke=(e,t)=>{c.setQueryData(H.snapshot(t),t=>t&&{...t,assistants:t.assistants.some(t=>t.id===e.id)?t.assistants.map(t=>t.id===e.id?e:t):[...t.assistants,e]}),c.invalidateQueries({queryKey:H.snapshot(t)})},Ae=2500,je=15e3,Me=e=>!!e?.assistants.some(e=>e.working||e.activeContactTurn),Ne=(e,t={})=>{if(t.assistantID){let n=e?.assistants.find(e=>e.id===t.assistantID);return n?.working||n?.activeContactTurn?Ae:je}return Me(e)?Ae:je},K=(e=t())=>({queryKey:H.snapshot(e),queryFn:async({signal:e})=>ne(await U(`/api/yuri/assistants/snapshot`,{signal:e})),staleTime:0,retry:2,refetchInterval:e=>Ne(e.state.data),refetchIntervalInBackground:!1,refetchOnWindowFocus:!0,refetchOnReconnect:!0}),q=new Map,J=e=>{let r=q.get(e);if(r)r.count+=1;else{let r=n(),i=!1,a=!1,o=!1,l=()=>!i&&t()===e&&n()===r,u=async()=>{if(o=!0,!a){a=!0;try{do o=!1,c.getQueryCache().find({queryKey:H.snapshot(e),exact:!0})?.state.fetchStatus===`fetching`&&(o=!0),await c.invalidateQueries({queryKey:H.snapshot(e),exact:!0},{cancelRefetch:!1});while(o&&l())}finally{a=!1}}},d=s(t=>{if(!l())return;let n=c.getQueryData(H.snapshot(e));(t.type===`event-stream-ready`||t.type===`contact-turn-start`||t.type===`contact-turn-end`||t.type===`assistants-changed`&&(!n||t.revision>n.revision))&&u()});q.set(e,{count:1,dispose:()=>{i=!0,d()}})}return()=>{let t=q.get(e);t&&--t.count===0&&(t.dispose(),q.delete(e))}},Pe=e=>{let n=(0,f.c)(7),r,i,a;n[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=t(),i=o,r=K(a),n[0]=r,n[1]=i,n[2]=a):(r=n[0],i=n[1],a=n[2]);let s;n[3]===e?s=n[4]:(s={...r,select:e},n[3]=e,n[4]=s);let c=i(s),l,u;return n[5]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>J(a),u=[a],n[5]=l,n[6]=u):(l=n[5],u=n[6]),d.useEffect(l,u),c},Fe=e=>e.enabled?e.assistants.reduce((e,t)=>e+(t.unreadCount??0),0):0,Ie=()=>{let e=(0,f.c)(5),n,r,i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=t(),n=o,r={...K(i),select:Fe},e[0]=n,e[1]=r,e[2]=i):(n=e[0],r=e[1],i=e[2]);let a=n(r),s,c;return e[3]===Symbol.for(`react.memo_cache_sentinel`)?(s=()=>J(i),c=[i],e[3]=s,e[4]=c):(s=e[3],c=e[4]),d.useEffect(s,c),a.data??0},Le=e=>e.enabled&&Me(e),Re=()=>{let e=(0,f.c)(5),n,r,i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=t(),n=o,r={...K(i),select:Le},e[0]=n,e[1]=r,e[2]=i):(n=e[0],r=e[1],i=e[2]);let a=n(r),s,c;return e[3]===Symbol.for(`react.memo_cache_sentinel`)?(s=()=>J(i),c=[i],e[3]=s,e[4]=c):(s=e[3],c=e[4]),d.useEffect(s,c),a.data??!1},ze=(e,t={})=>{let n=new URLSearchParams;return n.set(`limit`,String(t.limit??20)),t.before&&n.set(`before`,t.before),t.messageID&&n.set(`messageID`,t.messageID),`/api/yuri/assistants/${encodeURIComponent(e)}/contact/messages?${n}`},Y=async(e,t,n)=>oe(await U(ze(e,t),n?{signal:n}:{})),Be=(e,t)=>e.generation===t.generation&&e.revision===t.revision&&e.olderCursor===t.olderCursor&&e.olderComplete===t.olderComplete&&e.hasMessageGap===t.hasMessageGap&&e.gapCursor===t.gapCursor&&e.messages===t.messages&&e.liveWindowIDs===t.liveWindowIDs&&e.gapRequestIDs===t.gapRequestIDs&&e.gapTargetIDs===t.gapTargetIDs,X=new Map,Z=new Map,Q=e=>e.join(``),Ve=async(e,t,n,r,i)=>{let a=Q(t),o=Z.get(a);if(o)return o;let s=(async()=>{let a=c.getQueryData(t)??n,o=0,s=!1,l=!1,u=a.gapRequestIDs?[...a.gapRequestIDs]:null,d=a.gapCursor;for(;a.hasMessageGap&&a.gapCursor&&o<5&&!i?.aborted;){G(r.transport,r.runtimeGeneration),o+=1;let n=a.gapCursor;try{let o=await Y(e,{limit:20,before:n},i);G(r.transport,r.runtimeGeneration);let l=c.getQueryData(t)??a;if(o.generation!==l.generation){a=l;break}let f=!u||!!(l.hasMessageGap&&l.gapRequestIDs&&l.gapRequestIDs.length===u.length&&l.gapRequestIDs.every((e,t)=>e===u[t]));if(a=De(l,o,u?{requestIDs:u,cursor:d}:void 0),c.setQueryData(t,a),!f)break;if(!a.hasMessageGap){s=!0;break}if(a.gapCursor&&a.gapCursor!==n)s=!0;else break}catch(e){if(i?.aborted||m(e))break;l=!0,a=c.getQueryData(t)??a;break}}return{view:c.getQueryData(t)??a,failed:l,progressed:s}})();Z.set(a,s);try{return await s}finally{Z.get(a)===s&&Z.delete(a)}},He=(e,r=t(),i=n(),a={})=>({queryKey:H.contact(e,r,i),queryFn:async({signal:t})=>{G(r,i),await l(),G(r,i);let n=H.contact(e,r,i),a=c.getQueryData(n),o=await Y(e,{limit:20},t);G(r,i);let s=Te(c.getQueryData(n)??a??null,o);c.setQueryData(n,s);let u=Q(n);if(s.hasMessageGap&&s.gapCursor){X.delete(u);let a=await Ve(e,n,s,{transport:r,runtimeGeneration:i},t);s=a.view,(a.failed||a.view.hasMessageGap&&!a.progressed)&&a.view.gapCursor&&X.set(u,a.view.gapCursor)}else X.delete(u);G(r,i);let d=c.getQueryData(n)??s;return a&&Be(a,d)?a:d},retry:2,staleTime:0,refetchInterval:()=>a.reconcileInForeground?Ne(c.getQueryData(H.snapshot(r)),{assistantID:e}):!1,refetchIntervalInBackground:!1,refetchOnWindowFocus:!0,refetchOnReconnect:!0,structuralSharing:!0}),Ue=(e,r=!0)=>{let i=t(),a=n(),[l,u]=d.useState(!1),[f,p]=d.useState(null),[h,g]=d.useState(!1),_=d.useRef(null),v=d.useRef(null),y=d.useRef(null),b=d.useRef(null),x=d.useRef({assistantID:e,transport:i,runtimeGeneration:a,enabled:r});x.current={assistantID:e,transport:i,runtimeGeneration:a,enabled:r};let S=o({...He(e,i,a,{reconcileInForeground:!0}),enabled:r&&!!e});d.useEffect(()=>{!r||!e||c.invalidateQueries({queryKey:H.snapshot(i),exact:!0},{cancelRefetch:!1})},[e,r,a,i]),d.useEffect(()=>s(n=>{t()===i&&(n.type===`assistants-changed`||n.type===`event-stream-ready`||n.type===`contact-turn-end`)&&(n.type===`contact-turn-end`&&`assistantID`in n&&n.assistantID!==e||c.invalidateQueries({queryKey:H.contact(e,i,a),exact:!0}))}),[e,a,i]),d.useEffect(()=>{let t=Q(H.contact(e,i,a));return()=>{y.current?.abort(),b.current?.abort(),y.current=null,b.current=null,_.current=null,v.current=null,X.delete(t)}},[e,i,a,r]);let C=S.data,w=H.contact(e,i,a),T=async()=>{if(!e||!r)return;if(_.current)return _.current;let t=c.getQueryData(w)??C;if(!t||t.olderComplete||!t.olderCursor)return;p(null),u(!0);let n=new AbortController;b.current?.abort(),b.current=n;let o={transport:i,runtimeGeneration:a,assistantID:e,cursor:t.olderCursor},s=(async()=>{try{G(o.transport,o.runtimeGeneration);let e=await Y(o.assistantID,{limit:20,before:o.cursor},n.signal);if(n.signal.aborted||(G(o.transport,o.runtimeGeneration),x.current.assistantID!==o.assistantID||x.current.transport!==o.transport||x.current.runtimeGeneration!==o.runtimeGeneration))return;let r=c.getQueryData(w)??t;if(e.generation!==r.generation)return;c.setQueryData(w,Ee(r,e))}catch(e){if(n.signal.aborted||m(e))return;let t=e instanceof Error?e:Error(String(e));throw p(t),t}finally{b.current===n&&(b.current=null),u(!1),_.current=null}})();return _.current=s,s},E=async(t=`explicit`)=>{if(!e||!r)return;if(v.current)return v.current;let n=c.getQueryData(w)??C;if(!n?.hasMessageGap||!n.gapCursor)return;let o=Q(w);if(t===`auto`&&X.get(o)===n.gapCursor)return;t===`explicit`&&X.delete(o),g(!0);let s=new AbortController;y.current?.abort(),y.current=s;let l={transport:i,runtimeGeneration:a,assistantID:e,cursor:n.gapCursor},u=(async()=>{try{G(l.transport,l.runtimeGeneration);let e=await Ve(l.assistantID,w,n,{transport:l.transport,runtimeGeneration:l.runtimeGeneration},s.signal);if(s.signal.aborted)return;if(G(l.transport,l.runtimeGeneration),e.failed||!e.progressed){e.view.gapCursor&&X.set(o,e.view.gapCursor);return}e.view.hasMessageGap||X.delete(o)}catch(e){if(s.signal.aborted||m(e))return;throw X.set(o,l.cursor),e}finally{y.current===s&&(y.current=null),g(!1),v.current=null}})();return v.current=u,u};return d.useEffect(()=>{if(!r||!e||!C?.hasMessageGap||!C.gapCursor||S.isFetching||h)return;let t=Q(w);X.get(t)!==C.gapCursor&&E(`auto`).catch(()=>void 0)},[r,e,C?.hasMessageGap,C?.gapCursor,S.isFetching,h,w]),{data:C?{messages:C.messages,generation:C.generation,revision:C.revision,nextCursor:C.olderCursor,complete:C.olderComplete}:void 0,status:S.status,fetchStatus:S.fetchStatus,isError:S.isError,isPending:S.isPending,isFetching:S.isFetching,isSuccess:S.isSuccess,error:S.error instanceof Error?S.error:S.error?Error(String(S.error)):null,refetch:()=>S.refetch(),fetchPreviousPage:T,hasPreviousPage:!!(C&&!C.olderComplete&&C.olderCursor),isFetchingPreviousPage:l,previousPageError:f,hasMessageGap:!!C?.hasMessageGap,isFillingMessageGap:h,retryMessageGap:()=>E(`explicit`)}},We=async(e,r)=>{let i=t(),a=n();await l(),G(i,a);let o=await Y(e,{messageID:r,limit:1});if(G(i,a),!o.messages.some(e=>e.messageID===r&&e.role===`user`))return null;c.invalidateQueries({queryKey:H.contact(e,i,a),exact:!0}),c.invalidateQueries({queryKey:H.snapshot(i),exact:!0});let s=c.getQueryData(H.snapshot(i));return{admitted:!0,messageID:r,revision:o.revision??s?.revision??null}},Ge=(e,r=t(),i=n())=>({queryKey:H.scheduledTasks(e,r,i),queryFn:async({signal:t})=>{G(r,i);let n=se(await U(`/api/yuri/assistants/${encodeURIComponent(e)}/scheduled-tasks`,{signal:t}));return G(r,i),n},refetchOnMount:`always`,retry:(e,t)=>!(t instanceof p&&t.status===404)&&e<2}),Ke=(e,r)=>{let i=(0,f.c)(6),a=r===void 0||r,s,c;if(i[0]!==e){let r=t(),a=n();c=o,s=Ge(e,r,a),i[0]=e,i[1]=s,i[2]=c}else s=i[1],c=i[2];let l=a&&!!e,u;return i[3]!==s||i[4]!==l?(u={...s,enabled:l},i[3]=s,i[4]=l,i[5]=u):u=i[5],c(u)},$=(e=t())=>({queryKey:H.globalScheduledTasks(e),queryFn:me,refetchOnMount:`always`}),qe=e=>{let t=(0,f.c)(3),n=e===void 0||e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=$(),t[0]=r):r=t[0];let i;return t[1]===n?i=t[2]:(i={...r,enabled:n},t[1]=n,t[2]=i),o(i)},Je=e=>e.tasks.some(({task:e})=>e.state.lastStatus===`running`),Ye=()=>{let e=(0,f.c)(5),n,r,i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=t(),n=o,r={...$(i),select:Je,staleTime:0,refetchInterval:mt,refetchIntervalInBackground:!1},e[0]=n,e[1]=r,e[2]=i):(n=e[0],r=e[1],i=e[2]);let a=n(r),l,u;return e[3]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>s(e=>{t()===i&&(e.type===`scheduled-task-ran`||e.type===`event-stream-ready`)&&c.invalidateQueries({queryKey:$(i).queryKey,exact:!0})}),u=[i],e[3]=l,e[4]=u):(l=e[3],u=e[4]),d.useEffect(l,u),a.data===!0},Xe=(e,r=t())=>{c.invalidateQueries({queryKey:[r,n(),`assistants`,`contact`,e]})},Ze=(e=t())=>({queryKey:H.capability(e),queryFn:()=>dt(),retry:!1}),Qe=()=>{let e=(0,f.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=Ze(),e[0]=t):t=e[0],o(t)},$e=(e=c,n=t())=>e.getQueryData(H.snapshot(n)),et=(e=c,n=t())=>e.fetchQuery(K(n)),tt=async(e=c)=>{let r=t(),i=n();await e.invalidateQueries({queryKey:H.snapshot(r),exact:!0}),G(r,i);let a=await e.fetchQuery(K(r));return G(r,i),a},nt=15e3,rt=e=>{throw e instanceof p?e:m(e)?new p(`admission_timeout`,408):e},it=async(e,r,i)=>{let a=t(),o=n(),s=typeof i==`string`?[{type:`text`,text:i}]:Array.isArray(i.parts)&&i.parts.length>0?i.parts:[{type:`text`,text:i.text??``}],c=AbortSignal.timeout(nt);try{let t=ie(await U(`/api/yuri/assistants/${encodeURIComponent(e)}/messages`,{...W(`POST`,{messageID:r,parts:s,language:u.getState().locale}),signal:c}));return G(a,o),Oe(e,t.binding,a),Xe(e,a),t}catch(e){return rt(e)}},at=async(e,r,i,a,o)=>{let s=t(),c=n(),l=A(await U(`/api/yuri/assistants/${encodeURIComponent(e)}/share`,W(`POST`,{operationID:r,payload:{messageID:i,parts:a,source:o}})));return G(s,c),l},ot=async(e,r=t(),i=n())=>{G(r,i);let a=A(await U(`/api/yuri/assistants/share-operations/${encodeURIComponent(e)}`));return G(r,i),a},st=async(e,r=t(),i=n())=>{let a=e;for(let e=0;e<60&&(a.state===`running`||a.state===`submitting`);e+=1)G(r,i),await new Promise(e=>setTimeout(e,750)),a=await ot(a.operationID,r,i);if(G(r,i),a.state===`completed`)return a;throw a.state===`failed`?new h(a.errorCode??`share_failed`,400,a):new h(`share_unresolved`,408,a)},ct=async e=>{let n=t(),r=k(await U(`/api/yuri/assistants`,W(`POST`,{...e,language:u.getState().locale})));return ke(r,n),r},lt=async(e,r)=>{let i=t(),a=n(),o=k(await U(`/api/yuri/assistants/${encodeURIComponent(e.id)}`,W(`PATCH`,{...r,expectedRevision:e.revision})));return G(i,a),r.pinned===void 0?ke(o,i):(await c.cancelQueries({queryKey:H.snapshot(i),exact:!0}),G(i,a),await c.fetchQuery(K(i)),G(i,a)),o},ut=async e=>{await U(`/api/yuri/assistants/${encodeURIComponent(e.id)}`,W(`DELETE`,{expectedRevision:e.revision})),await c.invalidateQueries({queryKey:H.snapshot(t())})},dt=async()=>w(await U(`/api/yuri/assistants/capability`)),ft=async(e,r)=>{let i=t(),a=n(),o=O(r);try{let t=te(await U(`/api/yuri/assistants/${encodeURIComponent(e)}/contact/read`,{...W(`POST`,o),signal:AbortSignal.timeout(15e3)}));if(G(i,a),t.assistantID!==e)throw new p(`invalid_assistant_read_response`,200);return t}finally{t()===i&&n()===a&&c.invalidateQueries({queryKey:H.snapshot(i),exact:!0})}},pt=async e=>{let r=e.assistants.filter(e=>(e.unreadCount??0)>0&&e.readTip).map(e=>({id:e.id,position:{...e.readTip}})),i=t(),a=n(),o=[];for(let e=0;e<r.length;e+=4)o.push(...await Promise.allSettled(r.slice(e,e+4).map(async e=>(G(i,a),ft(e.id,e.position)))));return{failed:o.filter(e=>e.status===`rejected`).length}};function mt(e){return e.state.data&&Je(e.state.data)?2500:15e3}export{p as A,ye as C,pe as D,me as E,m as M,_e as O,st as S,ge as T,Pe as _,et as a,qe as b,pt as c,it as d,at as f,Ke as g,Ue as h,ut as i,h as j,he as k,ft as l,Qe as m,We as n,dt as o,lt as p,ct as r,tt as s,He as t,$e as u,Ie as v,ve as w,Ye as x,Re as y};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{c as t}from"./runtime-switch-CSXCC6XM.js";import{n}from"./runtime-fetch-ykYB0sSi.js";import{U as r}from"./client-DfhjGjVo.js";import{st as i}from"./vendor-base-ui-wXsskyKm.js";import{n as a}from"./vendor-react-BkccXcWz.js";import{i as o,r as s}from"./vendor-reactuses-core-DjKFMfz7.js";import{Zi as c}from"./ui-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{c as t}from"./runtime-switch-CSXCC6XM.js";import{n}from"./runtime-fetch-ykYB0sSi.js";import{U as r}from"./client-DfhjGjVo.js";import{st as i}from"./vendor-base-ui-wXsskyKm.js";import{n as a}from"./vendor-react-BkccXcWz.js";import{i as o,r as s}from"./vendor-reactuses-core-DjKFMfz7.js";import{Zi as c}from"./ui-gH75_gWj.js";import{n as l,r as u}from"./audio-session-BndHNBbW.js";import{n as d,r as f,t as p}from"./browserVoiceService-CJ9dlXi4.js";var m=e=>!!(e&&typeof e==`object`&&typeof e.type==`string`),h=e=>e.filter(m),g=e=>{let t=e,n=t.text;return typeof n==`string`?n:t.content||t.value||``},_=e=>/[^\s\u200B-\u200D\u2060\uFEFF]/u.test(e),v=e=>e.type===`text`&&!_(g(e)),y=(e,t={})=>{let{includeReasoning:n=!0}=t,i=h(e),a=i.some(e=>!e.synthetic);return i.filter(e=>{let t=!!e.synthetic;if(e.type===`text`){if(v(e))return!1;let t=g(e);if(t.includes(`<system-reminder>`)&&r(t).length===0)return!1}return t&&a||!n&&e.type===`reasoning`?!1:e.type!==`patch`})},b=e(i(),1),x=3e4,S=null,C=null;async function w(){return S&&Date.now()-S.checkedAt<x?S:C||(C=(async()=>{try{let e=await n(`/api/tts/say/status`);if(!e.ok){let e={available:!1,voices:[],checkedAt:Date.now()};return S=e,e}let t=await e.json(),r={available:!!t.available,voices:Array.isArray(t.voices)?t.voices:[],checkedAt:Date.now()};return S=r,r}catch{let e={available:!1,voices:[],checkedAt:Date.now()};return S=e,e}finally{C=null}})(),C)}var T=null;function E(){return l(),T||=new(window.AudioContext||window.webkitAudioContext),T}function D(e={}){let t=e.enabled??!0,[r,i]=(0,b.useState)(!1),[a,o]=(0,b.useState)(!1),[s,c]=(0,b.useState)([]),[l,d]=(0,b.useState)(null),f=(0,b.useRef)(null),p=(0,b.useRef)(null),m=(0,b.useCallback)(async()=>{try{let e=E();e.state===`suspended`&&await e.resume();let t=e.createBuffer(1,1,22050),n=e.createBufferSource();n.buffer=t,n.connect(e.destination),n.start(0)}catch(e){console.error(`[useSayTTS] Failed to unlock audio:`,e)}},[]),h=(0,b.useCallback)(async()=>{if(!t)return o(!1),c([]),!1;try{let e=await w();return o(e.available),c(e.voices),e.available}catch{return o(!1),c([]),!1}},[t]);(0,b.useEffect)(()=>{h()},[h]);let g=(0,b.useCallback)(()=>{if(f.current){try{f.current.stop()}catch{}f.current=null}p.current&&=(p.current.abort(),null),i(!1)},[]),_=(0,b.useCallback)(async(e,t)=>{if(g(),!e.trim()){d(`No text to speak`),t?.onError?.(`No text to speak`);return}d(null);try{p.current=new AbortController;let r=await n(`/api/tts/say/speak`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({text:e.trim()}),signal:p.current.signal});if(!r.ok){let e=await r.json().catch(()=>({error:`Unknown error`}));throw Error(e.error||`HTTP ${r.status}`)}let a=await r.blob(),o=await a.arrayBuffer();a.size;let s=E();s.state===`suspended`&&await s.resume();let c=await s.decodeAudioData(o),l=s.createBufferSource();l.buffer=c,l.connect(s.destination),f.current=l,l.onended=()=>{i(!1),f.current=null,t?.onEnd?.()},i(!0),t?.onStart?.(),l.start(0)}catch(e){if(e.name===`AbortError`)return;let n=e instanceof Error?e.message:`Failed to speak`;console.error(`[useSayTTS] Error:`,n),d(n),t?.onError?.(n),i(!1)}},[g]);return(0,b.useEffect)(()=>u(g),[g]),(0,b.useEffect)(()=>()=>{g()},[g]),{isPlaying:r,isAvailable:a,voices:s,error:l,speak:_,stop:g,checkAvailability:h,unlockAudio:m}}function O(e,t=!1){return e?e.replace(/```[\s\S]*?```/g,``).replace(/`([^`\n]*)`/g,`$1`).replace(/!\[(?:\\.|[^\]\\])*\]\((?:\\.|[^()\\]|\((?:\\.|[^()\\])*\))*\)/g,` `).replace(/[*_~#]/g,``).replace(/https?:\/\/[^\s]+/g,``).replace(/(^|\s)\/(?:[\w.-]+\/)*[\w.-]+/g,`$1`).replace(/[//]+/g,` `).replace(/^\s*[$#>]\s*/gm,``).replace(/[[\]{}()<>|&;]/g,` `).replace(/\\/g,``).replace(/\s+/g,e=>t&&/\n\s*\n/.test(e)?`
|
|
2
2
|
|
|
3
3
|
`:` `).trim():``}function k(e){let t=[],n=e.trim();for(;n;){let e=n.indexOf(`
|
|
4
4
|
|