@yuriai/web 0.2.38-beta.2 → 0.2.38-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{AgentAvatar-DNVD6VCV.js → AgentAvatar-CjZAr6nn.js} +1 -1
- package/dist/assets/AssistantContactStatus-DoZk9r1D.js +3 -0
- package/dist/assets/AssistantUnreadBadge-BJHZUf6Z.js +1 -0
- package/dist/assets/AssistantView-DkjXm6xL.js +1 -0
- package/dist/assets/DiagramView-Byel_g4U.js +1 -0
- package/dist/assets/{FadeInOnReveal-CK7jBcu4.js → FadeInOnReveal-BrPG6IFE.js} +1 -1
- package/dist/assets/GuiPluginPage-C6iXAYM8.js +1 -0
- package/dist/assets/GuiPluginSurface-DPXPl4xG.js +1 -0
- package/dist/assets/GuiPluginWindow-BdtIwEmZ.js +1 -0
- package/dist/assets/{Icon-DsN23fuV.js → Icon-C5rHjO1K.js} +1 -1
- package/dist/assets/ImageLoadingPlaceholder-Cdj2zS3j.js +1 -0
- package/dist/assets/LoadingImage-Gh9OduKR.js +1 -0
- package/dist/assets/MarkdownRenderer-DErp8UoS.js +2 -0
- package/dist/assets/{MarkdownRendererImpl-ecACjpZw.js → MarkdownRendererImpl-H41Q6Ds9.js} +3 -3
- package/dist/assets/MarkstreamRendererImpl-CJcHC4Ts.js +3 -0
- package/dist/assets/MobileDetailNavigation-fdYiFD76.js +1 -0
- package/dist/assets/MobileResizableSheet-DDzgYZmt.js +1 -0
- package/dist/assets/MobileShareBridge-BNPPhHGf.js +3 -0
- package/dist/assets/MobileTabPageHeader-ZZPrTJl4.js +2 -0
- package/dist/assets/MultiRunWindow-DoeszXM5.js +1 -0
- package/dist/assets/OnboardingScreen-BrYqOlrO.js +1 -0
- package/dist/assets/{OverlayScrollbar-BLhv7Nq-.js → OverlayScrollbar-8lCP3DZq.js} +1 -1
- package/dist/assets/SettingsView-UuXi7Uya.js +29 -0
- package/dist/assets/SettingsWindow-DIYoXakh.js +1 -0
- package/dist/assets/SetupTourDialog-BF50uUTW.js +1 -0
- package/dist/assets/TerminalView-uVsRpvjV.js +8 -0
- package/dist/assets/ToolOutputDialog-Bz23N8ob.js +10 -0
- package/dist/assets/VoiceSettings-DbbeM4JG.js +2 -0
- package/dist/assets/YuriLogo-DcoYyXzq.js +1 -0
- package/dist/assets/YuriWordmark-Dlsq3scd.js +1 -0
- package/dist/assets/appThemeRegistry-DE7vwd6j.js +1 -0
- package/dist/assets/{appearance--vFosLNi.js → appearance-DFsI3pnP.js} +1 -1
- package/dist/assets/{assistant-attachment-cache-C-SlEpSB.js → assistant-attachment-cache-Cmzt4xXE.js} +1 -1
- package/dist/assets/bootstrap-BhC95qVC.js +1 -0
- package/dist/assets/{capgoAdapter-DceVw3SM.js → capgoAdapter-BPZyUAQO.js} +1 -1
- package/dist/assets/{checkbox-CJsiyoER.js → checkbox-Dgn0NjAK.js} +1 -1
- package/dist/assets/{collapsible-B3zojUm2.js → collapsible-DbkDwHwV.js} +1 -1
- package/dist/assets/{context-menu-DFRg1NJF.js → context-menu-HomYNhkr.js} +1 -1
- package/dist/assets/desktopHosts-DovfbQPm.js +1 -0
- package/dist/assets/desktopRelayRestore-D4pbpNKN.js +1 -0
- package/dist/assets/device-DNG0cNwQ.js +2 -0
- package/dist/assets/{diagram-OTF8YAve.js → diagram-if-ktgjK.js} +1 -1
- package/dist/assets/dialog-0fjbRGoX.js +1 -0
- package/dist/assets/{es-CrVDn7XV.js → es-30Wqm-Bx.js} +1 -1
- package/dist/assets/{fileMentionTouchSelection-CorehkTj.js → fileMentionTouchSelection-OwF_hr-t.js} +1 -1
- package/dist/assets/{fileQueries-BaEKb7SZ.js → fileQueries-D9l0crnM.js} +1 -1
- package/dist/assets/fileReferenceActions-BRF8f7uA.js +1 -0
- package/dist/assets/{fileReferenceParser-BayaidRM.js → fileReferenceParser-1HHDBUum.js} +1 -1
- package/dist/assets/{fr-CCwt5AOu.js → fr-BbWLXNYa.js} +1 -1
- package/dist/assets/{gitApi-C6rhS4rG.js → gitApi-dAPSCbXA.js} +8 -8
- package/dist/assets/gitApiHttp-B1mApXwC.js +9 -0
- package/dist/assets/{gui-CFdPKvfq.js → gui-DN2sVP96.js} +1 -1
- package/dist/assets/{historyImportQueries-BrhVXQhP.js → historyImportQueries-DkB2_92i.js} +1 -1
- package/dist/assets/host-kMLXU0hK.js +1 -0
- package/dist/assets/i18n-BU14awhU.js +1 -0
- package/dist/assets/image-loading-DEXNCcCm.js +1 -0
- package/dist/assets/{input-B7-PmgcW.js → input-DYmLJuhI.js} +1 -1
- package/dist/assets/insertionBoundaries-CYfwgLf1.js +1 -0
- package/dist/assets/{ja-BfwjUNPc.js → ja-BI7m9bgW.js} +1 -1
- package/dist/assets/{ko-CZQZFkal.js → ko-B89SVFZa.js} +1 -1
- package/dist/assets/main-CaueNFt7.js +169 -0
- package/dist/assets/main-DrIci_pj.js +2 -0
- package/dist/assets/{markdownHeightCache-DlRC53XG.js → markdownHeightCache-D8yqNy2h.js} +1 -1
- package/dist/assets/mcpQueries-DO2TKARf.js +1 -0
- package/dist/assets/miniChat-BTI2ObZ2.js +2 -0
- package/dist/assets/mobile-Cf_sQtW6.js +2 -0
- package/dist/assets/mobile-html-network-CsjZ_Ur0.js +2 -0
- package/dist/assets/mobile-network-bridge-B_h92A-9.js +1 -0
- package/dist/assets/mobileBackNavigation-DxG3cz8q.js +1 -0
- package/dist/assets/mobileConnections-CK4dMDCg.js +2 -0
- package/dist/assets/modulepreload-polyfill-P2Xu9kJm.js +1 -0
- package/dist/assets/multirun-Cd2-PUEk.js +3 -0
- package/dist/assets/native-config-C_nB8tLu.js +1 -0
- package/dist/assets/pages-CYkE04ml.js +1 -0
- package/dist/assets/path-utils-jGozTg9d.js +1 -0
- package/dist/assets/pathNormalization-ewtPqJWn.js +1 -0
- package/dist/assets/{pl-B6C3vXqv.js → pl-B55Lf3HE.js} +1 -1
- package/dist/assets/platform-DMsFWy1a.js +1 -0
- package/dist/assets/projectMeta-apTlCt8d.js +1 -0
- package/dist/assets/{pt-BR-BUDTNopP.js → pt-BR-CFZj-ECy.js} +1 -1
- package/dist/assets/pwa-wwvKWKhX.js +2 -0
- package/dist/assets/queue-abort-optimistic-BnynR3mX.js +1 -0
- package/dist/assets/react-B-mb0CtR.js +1 -0
- package/dist/assets/readiness-0tATst8c.js +1 -0
- package/dist/assets/reasoning-projection-client-BEhVknv9.js +1 -0
- package/dist/assets/renderElectronMiniChatApp-xQdVdaLB.js +2 -0
- package/dist/assets/renderMobileApp-D95eHLRE.js +29 -0
- package/dist/assets/{runtime-auth-Bh3htXtG.js → runtime-auth-mjIpsk3N.js} +1 -1
- package/dist/assets/runtime-fetch-DKZOpfzo.js +1 -0
- package/dist/assets/runtime-file-download-DMY1k1af.js +1 -0
- package/dist/assets/runtime-file-resource-CL7EVzOG.js +2 -0
- package/dist/assets/runtime-switch-BMjl5Y5W.js +1 -0
- package/dist/assets/runtimeAPIRegistry-C2VogTny.js +1 -0
- package/dist/assets/runtimeConfig-BfzZj4LK.js +2 -0
- package/dist/assets/runtimeEndpointReset-CjKHwDvh.js +149 -0
- package/dist/assets/{scheduledTaskNavigation-C8tBjNoP.js → scheduledTaskNavigation-PH-etFzZ.js} +1 -1
- package/dist/assets/select-B9Km1pk9.js +1 -0
- package/dist/assets/sessionLookup-8gdDN8Tx.js +1 -0
- package/dist/assets/sortable-tabs-strip-BU0Puyy0.js +1 -0
- package/dist/assets/{speechSettingsQueries-CJqxaC2Q.js → speechSettingsQueries-C9LCquzH.js} +1 -1
- package/dist/assets/src-BFQde2OG.css +2 -0
- package/dist/assets/{store-Myt_Fv8d.js → store-BNNIbb4k.js} +3 -3
- package/dist/assets/terminalApi-BXKIVBPo.js +1 -0
- package/dist/assets/textarea-bB6aD-GS.js +1 -0
- package/dist/assets/{tooltip-D5Xeh6py.js → tooltip-DgWHbKz2.js} +1 -1
- package/dist/assets/{types-DXSnGXVb.js → types-CnJjf4tP.js} +1 -1
- package/dist/assets/{uk-Ct9y1Y2t.js → uk-CS2c4Dtj.js} +1 -1
- package/dist/assets/{useAppFontEffects-Blo2lGTo.js → useAppFontEffects-DJp1u2mc.js} +35 -35
- package/dist/assets/{useAssistantUIStore-CVSFSgJV.js → useAssistantUIStore-Du8puXWz.js} +1 -1
- package/dist/assets/useDesktopWindowControlsLayout-DOmb8EnW.js +1 -0
- package/dist/assets/useDictation-CyWtsxSn.js +1 -0
- package/dist/assets/useEffectiveDirectory-DmGrksdp.js +1 -0
- package/dist/assets/{useFontPreferences-DqBoLHp6.js → useFontPreferences-CAdw6cBK.js} +1 -1
- package/dist/assets/useMobileHtmlPreviewStore-C03uVLfX.js +1 -0
- package/dist/assets/useMobileNavigationStore-CJBLQxTz.js +17 -0
- package/dist/assets/usePluginsStore-El9Tx9Q3.js +1 -0
- package/dist/assets/useStreamingTextThrottle-BbUkYQhX.js +1 -0
- package/dist/assets/useUIStore-BF882_0b.js +1 -0
- package/dist/assets/useWorkerHighlightedLines-CZ8YG-Hi.js +7 -0
- package/dist/assets/{zh-CN-BegPizz4.js → zh-CN-BpiwUUs4.js} +1 -1
- package/dist/assets/{zh-TW-4xftqQQG.js → zh-TW-Bl9CnlGi.js} +1 -1
- package/dist/index.html +26 -21
- package/dist/mini-chat.html +26 -21
- package/dist/mobile.html +4 -32
- package/package.json +1 -1
- package/server/index.js +10 -0
- package/server/lib/gui-customization/DOCUMENTATION.md +2 -0
- package/server/lib/gui-customization/skill/SKILL.md +1 -1
- package/server/lib/gui-customization/skill/references/global-pages.md +19 -4
- package/server/lib/gui-customization/skill/references/gui-api.md +1 -1
- package/server/lib/gui-customization/skill/references/icons.md +35 -8
- package/server/lib/gui-network/DOCUMENTATION.md +123 -0
- package/server/lib/gui-network/native-ios.test.js +127 -0
- package/server/lib/gui-network/runtime.js +146 -0
- package/server/lib/gui-network/runtime.test.js +129 -0
- package/server/lib/preview/proxy-runtime.js +1 -1
- package/server/lib/preview/proxy-runtime.test.js +4 -0
- package/server/lib/relay/DOCUMENTATION.md +5 -0
- package/server/lib/relay/tunnel-host.js +2 -1
- package/server/lib/ui-auth/DOCUMENTATION.md +8 -0
- package/server/lib/ui-auth/ui-auth.js +6 -0
- package/server/lib/ui-auth/ui-auth.test.js +10 -0
- package/dist/assets/AssistantContactStatus-C5zpVdGa.js +0 -3
- package/dist/assets/AssistantUnreadBadge-7KpCtnd3.js +0 -1
- package/dist/assets/AssistantView-BZU6TlwK.js +0 -1
- package/dist/assets/DiagramView-CXgsVJ3A.js +0 -1
- package/dist/assets/GuiPluginSurface-Bk01hnV6.js +0 -1
- package/dist/assets/GuiPluginWindow-BgOCEgEb.js +0 -1
- package/dist/assets/ImageLoadingPlaceholder-MfVzv_y1.js +0 -1
- package/dist/assets/LoadingImage-MAgXscGl.js +0 -1
- package/dist/assets/MarkdownRenderer-DswMDaKf.js +0 -2
- package/dist/assets/MarkstreamRendererImpl-Bqbq2VPn.js +0 -3
- package/dist/assets/MobileDetailNavigation-CXcMdlRH.js +0 -1
- package/dist/assets/MobileResizableSheet-D_PnyzR0.js +0 -1
- package/dist/assets/MobileShareBridge-DfgyncNh.js +0 -4
- package/dist/assets/MobileTabPageHeader-Bm8nYrzH.js +0 -2
- package/dist/assets/MultiRunWindow-CvCgKiyV.js +0 -1
- package/dist/assets/OnboardingScreen-BwJ3iMGY.js +0 -1
- package/dist/assets/SettingsView-DGduWj3I.js +0 -29
- package/dist/assets/SettingsWindow-BM8abllV.js +0 -1
- package/dist/assets/SetupTourDialog-vmNGHNXl.js +0 -1
- package/dist/assets/TerminalView-BZObkK0H.js +0 -8
- package/dist/assets/ToolOutputDialog-CbGuK5bP.css +0 -1
- package/dist/assets/ToolOutputDialog-D_CH2A0-.js +0 -10
- package/dist/assets/VoiceSettings-Ru8tm8eq.js +0 -2
- package/dist/assets/YuriLogo-C5K_9jSK.js +0 -1
- package/dist/assets/YuriWordmark-CJ8qJ14A.js +0 -1
- package/dist/assets/appThemeRegistry-CcdIpK3S.js +0 -1
- package/dist/assets/bootstrap-BzeQds0D.js +0 -9
- package/dist/assets/desktop-Brp3xDpd.js +0 -1
- package/dist/assets/desktopHosts-qQ2Rz26_.js +0 -1
- package/dist/assets/desktopRelayRestore-DifJHAur.js +0 -1
- package/dist/assets/device-Db_TcRdX.js +0 -2
- package/dist/assets/dialog-CgtwKUKd.js +0 -1
- package/dist/assets/fileReferenceActions-D06_lyuL.js +0 -1
- package/dist/assets/host-8TDDnZXo.js +0 -1
- package/dist/assets/image-loading-D1DfK_bJ.js +0 -1
- package/dist/assets/insertionBoundaries-B-ncem5c.js +0 -1
- package/dist/assets/main-BMvwUUi4.js +0 -2
- package/dist/assets/main-Chq1F31E.js +0 -169
- package/dist/assets/mcpQueries-BRFr-Gfm.js +0 -1
- package/dist/assets/miniChat-C3vDY9WG.js +0 -2
- package/dist/assets/mobile-B2KYTY1c.js +0 -2
- package/dist/assets/mobileBackNavigation-ByUDCJde.js +0 -1
- package/dist/assets/multirun-F1yOJb2_.js +0 -3
- package/dist/assets/native-config-C2j59qnN.js +0 -1
- package/dist/assets/path-utils-HRmerlyU.js +0 -1
- package/dist/assets/platform-Dids8J9D.js +0 -1
- package/dist/assets/projectMeta-C08trpZE.js +0 -1
- package/dist/assets/pwa-C956NPB0.js +0 -2
- package/dist/assets/queue-abort-optimistic-CWyeG_sJ.js +0 -1
- package/dist/assets/react-a6PrrNTm.js +0 -1
- package/dist/assets/readiness-CUPPcONt.js +0 -1
- package/dist/assets/renderElectronMiniChatApp-DNK4YFG8.js +0 -2
- package/dist/assets/renderMobileApp-DagPx3n0.js +0 -28
- package/dist/assets/runtime-fetch-9B8F_rKW.js +0 -1
- package/dist/assets/runtime-file-download-D4WGSMk-.js +0 -1
- package/dist/assets/runtime-file-resource-tDTBpJT_.js +0 -2
- package/dist/assets/runtime-switch-ibQIZnws.js +0 -1
- package/dist/assets/runtimeConfig-D_McrwNd.js +0 -2
- package/dist/assets/runtimeEndpointReset-D-aHzKPN.js +0 -149
- package/dist/assets/select-DoYUmvbX.js +0 -1
- package/dist/assets/sessionLookup-D2JIMvDo.js +0 -1
- package/dist/assets/sortable-tabs-strip-B-W7ADKC.js +0 -1
- package/dist/assets/src-CzDk_0Pp.css +0 -2
- package/dist/assets/terminalApi-BXf0a2VZ.js +0 -1
- package/dist/assets/textarea-BCTNmuPZ.js +0 -1
- package/dist/assets/url-DO6Zrx1P.js +0 -1
- package/dist/assets/useDesktopWindowControlsLayout-YAxhtSDl.js +0 -1
- package/dist/assets/useDictation-Dp2Y3X49.js +0 -1
- package/dist/assets/useEffectiveDirectory-Uc8I6wXt.js +0 -1
- package/dist/assets/useMobileNavigationStore-SCjA_7jP.js +0 -17
- package/dist/assets/usePluginsStore-DfksbEZx.js +0 -1
- package/dist/assets/useStreamingTextThrottle-BY1Ynoj1.js +0 -1
- package/dist/assets/useUIStore-BsCfUWQw.js +0 -1
- package/dist/assets/useWorkerHighlightedLines-DAxMD3fK.js +0 -7
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ToolOutputDialog-D_CH2A0-.js","assets/rolldown-runtime-hePW80VL.js","assets/runtime-auth-Bh3htXtG.js","assets/runtime-switch-ibQIZnws.js","assets/runtime-fetch-9B8F_rKW.js","assets/desktop-Brp3xDpd.js","assets/path-utils-HRmerlyU.js","assets/vendor-base-ui-CzHs0bHY.js","assets/useUIStore-BsCfUWQw.js","assets/vendor-zustand-vDaAPGfl.js","assets/brand-storage-bootstrap-D4BW3w-M.js","assets/brand-storage-migration-Bhz6UOBJ.js","assets/vendor-react-DlzBev0S.js","assets/vendor-tanstack-react-query-B-Wpqq5J.js","assets/vendor-tanstack-query-core-Y_YoRHtC.js","assets/runtime-file-resource-tDTBpJT_.js","assets/fileQueries-BaEKb7SZ.js","assets/runtime-file-store-BVRgEtI-.js","assets/vendor-aparajita-capacitor-secure-storage-xol_6BsB.js","assets/platform-Dids8J9D.js","assets/vendor-pathe-vBmvQE8f.js","assets/runtime-file-download-D4WGSMk-.js","assets/vendor-pierre-diffs-BFiZ3IhI.js","assets/vendor-hast-util-to-html-Bw_SgZ1t.js","assets/vendor-character-entities-legacy-Wut6vMuj.js","assets/vendor-character-entities-html4-DlN_yAFd.js","assets/vendor-ccount-CyGsA0u7.js","assets/vendor-comma-separated-tokens-B9ouxNNS.js","assets/vendor-oniguruma-to-es-CrHzjjSU.js","assets/vendor-oniguruma-parser-D2DIvhSP.js","assets/vendor-diff-Dq7CZNim.js","assets/vendor-lru_map-BMOrLc9L.js","assets/vendor-reactuses-core-CuTmqEMK.js","assets/vendor-lodash-es-BS45jPoZ.js","assets/vendor-js-cookie-hSOiFTtX.js","assets/useMobileNavigationStore-SCjA_7jP.js","assets/bootstrap-BzeQds0D.js","assets/vendor-opencode-client-cQ47ywrT.js","assets/vendor-effect-X1Hqc7ba.js","assets/runtime-ead7P81A.js","assets/vendor-sonner-BEHGipm5.js","assets/store-Myt_Fv8d.js","assets/tour-DDI0Zg7l.js","assets/useAssistantUIStore-CVSFSgJV.js","assets/vendor-zod-DZzbCm1s.js","assets/vendor-opencode-schema-DWT45VBX.js","assets/vendor-class-variance-authority-BLUaYARZ.js","assets/vendor-tailwind-merge-BicNWLTg.js","assets/useThemeSystem-CNzUUkFn.js","assets/vendor-framer-motion-DDMKlXiP.js","assets/Icon-DsN23fuV.js","assets/dialog-CgtwKUKd.js","assets/dialog-CTYD3Sbr.css","assets/tap-LkQum5bB.js","assets/themes-BgDJcxRc.js","assets/MobileWindowStack-DGLdgoGr.js","assets/appThemeRegistry-CcdIpK3S.js","assets/agentColors-DWSbQXy2.js","assets/rasterizePng-056Poix7.js","assets/MarkdownRenderer-DswMDaKf.js","assets/useEffectiveDirectory-Uc8I6wXt.js","assets/markdownHeightCache-DlRC53XG.js","assets/dualLimitLru-D8Sphgua.js","assets/toolHelpers-iEHVHQ9p.js","assets/image-loading-D1DfK_bJ.js","assets/image-loading-D9Z_BASK.css","assets/ImageLoadingPlaceholder-MfVzv_y1.js","assets/vendor-tanstack-react-virtual-DSFNK3qc.js","assets/useWorkerHighlightedLines-DAxMD3fK.js","assets/markdownTheme-CHNl6tUv.js","assets/markdown-worker-oBGEB9Eg.js","assets/mobileBackNavigation-ByUDCJde.js","assets/touch-gestures-CErgaXZ7.js","assets/ToolOutputDialog-CbGuK5bP.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,n}from"./runtime-switch-ibQIZnws.js";import{a as r}from"./vendor-zustand-vDaAPGfl.js";import{d as i,f as a,g as o,h as s,m as c,ot as l,p as u,st as d,u as f}from"./vendor-base-ui-CzHs0bHY.js";import{An as p,Cn as m,Dn as h,Tn as g,_n as _,bn as v,gn as y,wn as b,zr as x}from"./bootstrap-BzeQds0D.js";import{r as S}from"./useUIStore-BsCfUWQw.js";import{n as C}from"./vendor-react-DlzBev0S.js";import{s as w}from"./vendor-tanstack-react-query-B-Wpqq5J.js";import{o as T}from"./vendor-aparajita-capacitor-secure-storage-xol_6BsB.js";import{n as E,r as D}from"./platform-Dids8J9D.js";import{a as O,f as k,i as A,o as j,p as ee,r as M}from"./vendor-reactuses-core-CuTmqEMK.js";import{Ba as te,Ct as ne,Jn as N,K as P,Kn as F,Va as I,oi as re,or as ie,s as L,si as R}from"./useMobileNavigationStore-SCjA_7jP.js";import{i as z,n as B}from"./MobileShareBridge-DfgyncNh.js";import{N as V,T as H,_ as U,f as ae,g as W,h as oe,j as G,n as K,r as se,u as ce,v as le,w as ue}from"./MobileDetailNavigation-CXcMdlRH.js";import{n as de}from"./useAssistantUIStore-CVSFSgJV.js";import{a as fe}from"./fileMentionAutocompleteState-BZJqfgae.js";import{o as pe,p as me,t as he}from"./AgentAvatar-DNVD6VCV.js";import{d as ge,o as _e,t as ve}from"./vendor-framer-motion-DDMKlXiP.js";import{n as q}from"./Icon-DsN23fuV.js";import{t as ye}from"./scheduledTaskNavigation-C8tBjNoP.js";import{D as be,E as xe,O as Se,a as J,c as Ce,d as we,f as Te,g as Ee,h as De,l as Oe,m as ke,o as Y,s as Ae,t as X,u as je,w as Me,x as Ne}from"./sessionLookup-D2JIMvDo.js";import{a as Pe,n as Fe,r as Ie,t as Le}from"./fileMentionTouchSelection-CorehkTj.js";import{a as Re,o as ze,t as Be}from"./MarkdownRenderer-DswMDaKf.js";import{c as Ve,s as He}from"./image-loading-D1DfK_bJ.js";import{t as Ue}from"./ImageLoadingPlaceholder-MfVzv_y1.js";import{t as We}from"./LoadingImage-MAgXscGl.js";import{n as Ge}from"./textarea-BCTNmuPZ.js";import{t as Ke}from"./vendor-motion-C9oiAdx-.js";import{i as qe,n as Je,r as Ye}from"./assistant-attachment-cache-C-SlEpSB.js";var Z=C(),Q=e(d(),1),$=l();function Xe(e){let r=(0,Z.c)(12),{assistantID:i,position:a}=e,o=Q.useRef(null),s=Q.useRef(!1),c;r[0]===Symbol.for(`react.memo_cache_sentinel`)?(c={busy:!1,done:!1,retryAt:0},r[0]=c):c=r[0];let l=Q.useRef(c),[u]=Q.useState(nt),d;r[1]!==i||r[2]!==a||r[3]!==u?(d=()=>{let e=o.current;if(!e||!s.current||l.current.busy||l.current.done||Date.now()<l.current.retryAt||u.transport!==t()||u.generation!==n()||document.visibilityState!==`visible`||(E()?!document.documentElement.classList.contains(`yuri-native-app-active`):!document.hasFocus())||e.parentElement?.closest(`[inert], [aria-hidden="true"]`))return;let r=e.closest(`[data-assistant-contact-transcript]`);if(!r||r.scrollHeight-r.scrollTop-r.clientHeight>2)return;let c=e.getBoundingClientRect(),d=r.getBoundingClientRect(),f=window.visualViewport,p=f?.offsetTop??0,m=p+(f?.height??window.innerHeight);c.height<=0||c.width<=0||c.bottom>Math.min(d.bottom,m)||c.top<Math.max(d.top,p)||c.right<=Math.max(d.left,0)||c.left>=Math.min(d.right,window.innerWidth)||(l.current.busy=!0,ce(i,a).then(()=>{l.current.done=!0}).catch(()=>{l.current.retryAt=Date.now()+15e3}).finally(()=>{l.current.busy=!1}))},r[1]=i,r[2]=a,r[3]=u,r[4]=d):d=r[4];let f=M(d),p;r[5]===f?p=r[6]:(p=e=>{s.current=e.some(tt),f()},r[5]=f,r[6]=p);let m;r[7]===Symbol.for(`react.memo_cache_sentinel`)?(m={threshold:1},r[7]=m):m=r[7],O(o,M(p),m),A(`visibilitychange`,f,et),A(`focus`,f,$e),A(`resize`,f,Qe);let h,g;r[8]===Symbol.for(`react.memo_cache_sentinel`)?(h=()=>o.current?.closest(`[data-assistant-contact-transcript]`),g={passive:!0},r[8]=h,r[9]=g):(h=r[8],g=r[9]),A(`scroll`,f,h,g);let _;r[10]===Symbol.for(`react.memo_cache_sentinel`)?(_={attributes:!0,attributeFilter:[`class`]},r[10]=_):_=r[10],k(f,Ze,_),j(f,15e3);let v;return r[11]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,$.jsx)(`span`,{ref:o,"aria-hidden":`true`,className:`absolute bottom-0 left-0 block h-px w-px`,"data-assistant-read-marker":``}),r[11]=v):v=r[11],v}function Ze(){return document.documentElement}function Qe(){return window.visualViewport}function $e(){return window}function et(){return document}function tt(e){return e.isIntersecting&&e.intersectionRatio===1}function nt(){return{transport:t(),generation:n()}}var rt=()=>{},it=Q.memo(Se),at=e=>e?.directories.flatMap(({directory:e,sessions:t})=>e?t.filter(e=>!e.time.archived).map(t=>({...t,directory:e||t.location?.directory||t.directory||``})).filter(e=>e.directory.length>0):[])??null,ot=Q.forwardRef(({query:e,isMobile:t,listId:n,onHighlightChange:r,onSelect:i,onClose:a},o)=>{let{t:s}=I(),c=Ve(),l=w({...R(c),select:at}),u=Q.useMemo(()=>fe({sessions:l.data??[],currentSessionId:null,searchQuery:e,limit:e.trim()?10:3}),[l.data,e]),[d,f]=Q.useState({query:e,index:0}),p=Math.min(d.query===e?d.index:0,Math.max(0,u.length-1)),m=Q.useRef(null),h=Q.useRef([]),g=Q.useMemo(Le,[]);A(`pointerdown`,e=>{e.target instanceof Node&&!m.current?.contains(e.target)&&a()},void 0,{capture:!0}),Q.useLayoutEffect(()=>{h.current[p]?.scrollIntoView?.({block:`nearest`})},[p]),Q.useLayoutEffect(()=>{r(u.length?`${n}-${p}`:void 0)},[p,n,u.length,r]);let _=M(t=>{if(t===`Escape`){a();return}u.length&&(t===`ArrowDown`&&f({query:e,index:(p+1)%u.length}),t===`ArrowUp`&&f({query:e,index:(p-1+u.length)%u.length}),(t===`Enter`||t===`Tab`)&&i(u[p]))});return Q.useImperativeHandle(o,()=>({keyDown:_}),[_]),(0,$.jsxs)(Fe,{ref:m,isMobile:t,className:`max-w-[640px] max-h-64`,children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 px-3 py-1`,children:[(0,$.jsx)(`span`,{className:`min-w-0 flex-1 text-[length:calc(var(--text-meta)*0.875)] leading-4 text-muted-foreground`,children:s(`assistants.contact.sessionMention.scope`)}),(0,$.jsx)(F,{type:`button`,size:`xs`,variant:`ghost`,"aria-label":s(`dialog.common.actions.close`),onClick:a,children:(0,$.jsx)(q,{name:`close`,className:`size-4`})})]}),l.isPending?(0,$.jsx)(`p`,{role:`status`,className:`px-3 py-2 typography-meta text-muted-foreground`,children:s(`common.loading`)}):null,l.isError?(0,$.jsxs)(`div`,{role:`alert`,className:`px-3 py-2 typography-meta text-[var(--status-error)]`,children:[s(`assistants.contact.sessionMention.loadFailed`),(0,$.jsx)(F,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>void l.refetch(),children:s(`chat.history.retry`)})]}):null,l.isSuccess&&!u.length?(0,$.jsx)(`p`,{role:`status`,className:`px-3 py-2 typography-meta text-muted-foreground`,children:s(l.data===null?`common.unavailable`:`sessions.sidebar.empty.noMatches.title`)}):null,(0,$.jsx)(Ge,{preventOverscroll:!0,outerClassName:`flex-1 min-h-0`,className:`px-0`,children:(0,$.jsx)(`div`,{id:n,role:`listbox`,"aria-label":s(`chat.fileMentionAutocomplete.groups.sessions`),className:`p-1.5`,children:u.map((r,a)=>(0,$.jsxs)(`div`,{id:`${n}-${a}`,role:`option`,"aria-selected":a===p,ref:e=>{h.current[a]=e},className:N(`flex min-h-10 cursor-pointer items-center gap-2 rounded-md px-1.5 py-1 typography-ui-label`,Ie(t,a===p)),onMouseDown:e=>e.preventDefault(),onMouseMove:()=>f({query:e,index:a}),onPointerDown:e=>{e.pointerType===`touch`&&g.pointerDown(e.clientX,e.clientY)},onPointerMove:e=>{e.pointerType===`touch`&&g.pointerMove(e.clientX,e.clientY)},onPointerUp:e=>{e.pointerType===`touch`&&g.pointerUp(()=>i(r))&&(e.preventDefault(),e.stopPropagation())},onPointerCancel:()=>g.pointerCancel(),onClick:()=>g.click(()=>i(r)),children:[(0,$.jsx)(q,{name:`chat-thread`,className:`size-4 shrink-0 text-muted-foreground`}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`div`,{className:`truncate font-medium leading-5`,title:r.title,children:r.title||s(`chat.fileMentionAutocomplete.untitledSession`)}),(0,$.jsx)(`div`,{className:`truncate text-[length:calc(var(--text-meta)*0.875)] leading-4 text-muted-foreground`,title:r.directory,children:r.directory})]})]},`${r.directory}:${r.id}`))})}),t?null:(0,$.jsx)(`div`,{className:`mx-1.5 shrink-0 border-t px-1.5 py-1 text-[length:calc(var(--text-meta)*0.875)] leading-4 text-muted-foreground`,children:s(`chat.autocomplete.keyboardHint`)})]})}),st=e=>{let t=(0,Z.c)(120),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({active:n,onChange:r,onVoiceSend:i,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let{t:o}=I(),s=Q.useRef(null),c=n&&!!a.isMobile&&!!i,l;t[5]===c?l=t[6]:(l={available:c},t[5]=c,t[6]=l);let{enabled:u,hint:d,onHintChange:f}=be(l),p;t[7]!==d||t[8]!==a.placeholder||t[9]!==o?(p=d===null?a.placeholder:o(d===`recording`?`chat.dictation.releaseSend`:d===`cancelling`?`chat.dictation.releaseCancel`:d===`editing`?`chat.dictation.releaseEdit`:`chat.dictation.processing`),t[7]=d,t[8]=a.placeholder,t[9]=o,t[10]=p):p=t[10];let h=p,S;t[11]===a.value?S=t[12]:(S=()=>({canonical:a.value,document:v(a.value,new Map)}),t[11]=a.value,t[12]=S);let[C,w]=Q.useState(S),T;t[13]!==C.canonical||t[14]!==C.document||t[15]!==a.value?(T=C.canonical===a.value?C.document:v(a.value,new Map),t[13]=C.canonical,t[14]=C.document,t[15]=a.value,t[16]=T):T=t[16];let E=T,[D,O]=Q.useState(0),[k,A]=Q.useState(!0),[j,ee]=Q.useState(!1),[te,ne]=Q.useState(),P=Q.useRef(null),F=Q.useRef(null),re=Q.useRef(null),ie=Q.useRef(null),L;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(L=Ce(),t[17]=L):L=t[17];let R=Q.useRef(L),z=Q.useId(),B;t[18]!==n||t[19]!==j||t[20]!==D||t[21]!==k||t[22]!==E.text||t[23]!==a.disabled||t[24]!==a.pending?(B=n&&!a.pending&&!a.disabled&&!k&&!j?Pe({text:E.text,cursor:D}):null,t[18]=n,t[19]=j,t[20]=D,t[21]=k,t[22]=E.text,t[23]=a.disabled,t[24]=a.pending,t[25]=B):B=t[25];let V=B,H=V?.kind===`mention`?V:null,U;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(U=()=>{ie.current!==null&&(P.current?.focus({preventScroll:!0}),P.current?.setSelectionRange(ie.current,ie.current),ie.current=null)},t[26]=U):U=t[26];let ae;t[27]===E?ae=t[28]:(ae=[E],t[27]=E,t[28]=ae),Q.useLayoutEffect(U,ae);let W;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(W=()=>A(!0),t[29]=W):W=t[29];let oe=M(W),G;t[30]!==j||t[31]!==D||t[32]!==E||t[33]!==r?(G=(e,t,n)=>{let i=n===void 0||n,a=g(e);a.ok&&(i&&(R.current=Oe(R.current,{before:Ae(E,[],{start:P.current?.selectionStart??D,end:P.current?.selectionEnd??D}),after:Ae(e,[],{start:t,end:t})})),j||(ie.current=t),O(t),w({canonical:a.text,document:e}),r(a.text))},t[30]=j,t[31]=D,t[32]=E,t[33]=r,t[34]=G):G=t[34];let K=M(G),se;t[35]!==K||t[36]!==E||t[37]!==H||t[38]!==o?(se=e=>{if(!H)return;let t=e.title||o(`chat.fileMentionAutocomplete.untitledSession`),n=_(E,H.tokenStart,H.tokenEnd,{id:`session:${e.id}:${crypto.randomUUID()}`,kind:`session`,sessionId:e.id,display:x({trigger:`@`,icon:`chat-thread`,label:t})},{inlineBoundaries:!0,padDocumentEdges:!0}),r=n.caret+ +(n.document.text[n.caret]===` `);A(!0),K(n.document,r)},t[35]=K,t[36]=E,t[37]=H,t[38]=o,t[39]=se):se=t[39];let ce=M(se),le;t[40]!==n||t[41]!==K||t[42]!==E||t[43]!==a.disabled||t[44]!==a.pending?(le=e=>{if(!n||a.pending||a.disabled||!e.trim())return;let t=E.text?`${E.text} ${e}`:e,r=m(E,t,t.length,t.length);K(r.document,r.caret),A(!0)},t[40]=n,t[41]=K,t[42]=E,t[43]=a.disabled,t[44]=a.pending,t[45]=le):le=t[45];let ue=M(le),de;t[46]!==n||t[47]!==E.text||t[48]!==ue||t[49]!==r||t[50]!==i||t[51]!==a.disabled||t[52]!==a.pending?(de=e=>{if(!(!n||a.pending||a.disabled||!e.trim())){if(E.text){ue(e);return}r(e),i?.(e)}},t[46]=n,t[47]=E.text,t[48]=ue,t[49]=r,t[50]=i,t[51]=a.disabled,t[52]=a.pending,t[53]=de):de=t[53];let fe=M(de),pe;t[54]!==K||t[55]!==E?(pe=(e,t)=>{let n=e.currentTarget;if(n.selectionStart===n.selectionEnd||!e.clipboardData||!E.references.some(e=>e.start<n.selectionEnd&&e.end>n.selectionStart))return;let r=y(n.selectionStart,n.selectionEnd,E.references)??{start:n.selectionStart,end:n.selectionEnd},i=g({text:E.text.slice(r.start,r.end),references:E.references.filter(e=>e.start>=r.start&&e.end<=r.end).map(e=>({...e,start:e.start-r.start,end:e.end-r.start}))});if(i.ok&&(e.preventDefault(),e.clipboardData.setData(`text/plain`,i.text),t)){let e=m(E,E.text.slice(0,r.start)+E.text.slice(r.end),r.start,r.start);K(e.document,e.caret)}},t[54]=K,t[55]=E,t[56]=pe):pe=t[56];let me=M(pe),he;t[57]!==E.references||t[58]!==E.text?(he=Ee(E.text,E.references.map(ct))?.map(lt),t[57]=E.references,t[58]=E.text,t[59]=he):he=t[59];let ge=he,_e=u&&E.text.length===0?`true`:void 0,ve;t[60]!==u||t[61]!==ue||t[62]!==a.disabled||t[63]!==a.pending||t[64]!==fe||t[65]!==f?(ve=u&&(0,$.jsx)(it,{containerRef:s,disabled:!!(a.pending||a.disabled),onInsert:ue,onSend:fe,onRelease:rt,onHintChange:f}),t[60]=u,t[61]=ue,t[62]=a.disabled,t[63]=a.pending,t[64]=fe,t[65]=f,t[66]=ve):ve=t[66];let q=E.text,ye=a.pending,xe;t[67]===a?xe=t[68]:(xe=()=>{a.pending||a.onSubmit()},t[67]=a,t[68]=xe);let Se=a.layout===`inline`?`py-3 leading-6`:`pt-4 pb-2`,J;t[69]!==a.textLayoutClassName||t[70]!==Se?(J=N(`whitespace-pre-wrap break-words overflow-hidden px-3 typography-markdown md:typography-ui-label`,Se,a.textLayoutClassName),t[69]=a.textLayoutClassName,t[70]=Se,t[71]=J):J=t[71];let Te;t[72]!==K||t[73]!==E?(Te=(e,t)=>{let n=m(E,e,t?.target.selectionStart??e.length,t?.target.selectionEnd??e.length);K(n.document,n.caret),A(t?.nativeEvent?.inputType===`insertFromPaste`)},t[72]=K,t[73]=E,t[74]=Te):Te=t[74];let De=H?z:void 0,ke=H?te:void 0,Y;t[75]===a.textareaProps?Y=t[76]:(Y=e=>{a.textareaProps?.onScroll?.(e),F.current&&(F.current.scrollTop=e.currentTarget.scrollTop,F.current.scrollLeft=e.currentTarget.scrollLeft)},t[75]=a.textareaProps,t[76]=Y);let X,Fe;t[77]!==me||t[78]!==a.textareaProps?(X=e=>{a.textareaProps?.onCopy?.(e),e.defaultPrevented||me(e,!1)},Fe=e=>{a.textareaProps?.onCut?.(e),e.defaultPrevented||me(e,!0)},t[77]=me,t[78]=a.textareaProps,t[79]=X,t[80]=Fe):(X=t[79],Fe=t[80]);let Ie;t[81]===a.textareaProps?Ie=t[82]:(Ie=e=>{O(e.currentTarget.selectionStart),a.textareaProps?.onSelect?.(e)},t[81]=a.textareaProps,t[82]=Ie);let Le,Re;t[83]===Symbol.for(`react.memo_cache_sentinel`)?(Le=()=>{ee(!0)},Re=e=>{ee(!1),O(e.currentTarget.selectionStart)},t[83]=Le,t[84]=Re):(Le=t[83],Re=t[84]);let ze;t[85]!==K||t[86]!==j||t[87]!==E||t[88]!==H||t[89]!==a.textareaProps?(ze=e=>{if(a.textareaProps?.onKeyDown?.(e),!(e.defaultPrevented||Me(e))){if(j){e.key===`Enter`&&e.preventDefault();return}if((e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`z`){let t=e.shiftKey?je(R.current,E):we(R.current,E);t&&(e.preventDefault(),R.current=t.history,K(t.snapshot.document,t.snapshot.selection.end,!1),A(!0));return}if(e.key===`Backspace`||e.key===`Delete`){let t=b(E,{key:e.key,selectionStart:e.currentTarget.selectionStart,selectionEnd:e.currentTarget.selectionEnd,altKey:e.altKey});if(t){e.preventDefault(),K(t.document,t.caret),A(!0);return}}H&&[`ArrowDown`,`ArrowUp`,`Enter`,`Tab`,`Escape`].includes(e.key)&&(e.preventDefault(),e.stopPropagation(),re.current?.keyDown(e.key))}},t[85]=K,t[86]=j,t[87]=E,t[88]=H,t[89]=a.textareaProps,t[90]=ze):ze=t[90];let Be;t[91]!==a.textareaProps||t[92]!==De||t[93]!==ke||t[94]!==Y||t[95]!==X||t[96]!==Fe||t[97]!==Ie||t[98]!==ze?(Be={...a.textareaProps,"aria-controls":De,"aria-activedescendant":ke,"aria-autocomplete":`list`,onScroll:Y,onCopy:X,onCut:Fe,onSelect:Ie,onCompositionStart:Le,onCompositionEnd:Re,onKeyDown:ze},t[91]=a.textareaProps,t[92]=De,t[93]=ke,t[94]=Y,t[95]=X,t[96]=Fe,t[97]=Ie,t[98]=ze,t[99]=Be):Be=t[99];let Ve;t[100]!==oe||t[101]!==z||t[102]!==H||t[103]!==a.isMobile||t[104]!==ce?(Ve=H?(0,$.jsx)(ot,{ref:re,query:H.query,isMobile:a.isMobile??!1,listId:z,onHighlightChange:ne,onSelect:ce,onClose:oe}):null,t[100]=oe,t[101]=z,t[102]=H,t[103]=a.isMobile,t[104]=ce,t[105]=Ve):Ve=t[105];let He;t[106]!==E.text||t[107]!==ge||t[108]!==h||t[109]!==a||t[110]!==xe||t[111]!==J||t[112]!==Te||t[113]!==Be||t[114]!==Ve?(He=(0,$.jsx)(Ne,{...a,value:q,pending:ye,placeholder:h,disableInputWhilePending:!1,inputRef:P,onSubmit:xe,highlightedContent:ge,highlightRef:F,textLayoutClassName:J,onChange:Te,textareaProps:Be,children:Ve}),t[106]=E.text,t[107]=ge,t[108]=h,t[109]=a,t[110]=xe,t[111]=J,t[112]=Te,t[113]=Be,t[114]=Ve,t[115]=He):He=t[115];let Ue;return t[116]!==_e||t[117]!==ve||t[118]!==He?(Ue=(0,$.jsxs)(`div`,{ref:s,className:`yuri-hold-to-talk-container`,"data-hold-to-talk-empty":_e,children:[ve,He]}),t[116]=_e,t[117]=ve,t[118]=He,t[119]=Ue):Ue=t[119],Ue};function ct(e){return{start:e.start,end:e.end,priority:103,...h(e)}}function lt(e,t){return(0,$.jsx)(`span`,{className:e.className,children:e.visual?(0,$.jsx)(De,{visual:e.visual,text:e.text}):e.text},`${t}-${e.text.length}`)}var ut=`rounded-[1.35rem] border border-border/40 cursor-zoom-in`;function dt({assistantID:e,descriptor:t,onShowPopup:n}){let{t:r}=I(),i=Ve(),{attachmentID:a,sha256:o,size:s,mime:c,filename:l}=t,u=Q.useMemo(()=>({type:`file`,attachmentID:a,sha256:o,size:s,mime:c,filename:l}),[a,o,s,c,l]),d=c.startsWith(`image/`),f=Re(l??``,c),[p,m]=Q.useState(0),[h,g]=Q.useState(``),[_,v]=Q.useState(!1),[y,b]=Q.useState(!1),x=Q.useRef(null),S=Q.useRef([]);Q.useEffect(()=>{g(``),v(!1);let t=new AbortController,n;return d&&Ye(e,u,{signal:t.signal}).then(e=>{if(t.signal.aborted){e.release();return}n=e.release,g(e.url)}).catch(()=>{t.signal.aborted||v(!0)}),()=>{t.abort(),n?.()}},[e,u,i,d,p]),Q.useEffect(()=>()=>{x.current?.abort(),S.current.forEach(e=>URL.revokeObjectURL(e)),S.current=[]},[e,u,i]);let C=M(async(t=!1)=>{if(x.current)return;let i=new AbortController;x.current=i,b(!0),v(!1);try{let a=await Je(e,u,{signal:i.signal});if(i.signal.aborted)return;S.current.forEach(e=>URL.revokeObjectURL(e));let o=URL.createObjectURL(a);if(S.current=[o],t&&n){n({open:!0,title:l||r(`assistants.contact.attachment.file`),content:``,video:{url:o,mimeType:c,filename:l}});return}let s=document.createElement(`a`);s.href=o,s.download=l||r(`assistants.contact.attachment.file`),document.body.appendChild(s),s.click(),s.remove()}catch{i.signal.aborted||v(!0)}finally{x.current===i&&(x.current=null),i.signal.aborted||b(!1)}}),w=l||r(d?`assistants.contact.attachment.image`:`assistants.contact.attachment.file`),T=M(e=>{!n||!h||n({open:!0,title:w,content:``,metadata:{tool:`image-preview`,filename:w,mime:c},previewSource:e.currentTarget,image:{url:h,mimeType:c,filename:w,size:s,gallery:[{url:h,mimeType:c,filename:w,size:s}],index:0}})});return d&&h&&!_?(0,$.jsx)(We,{src:h,alt:w,contentFrame:!0,className:ut,onError:()=>v(!0),onClick:T,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),T(e))},role:`button`,tabIndex:0,"data-assistant-contact-image":``}):d&&!_?(0,$.jsx)(Ue,{className:`h-[var(--yuri-content-image-height)] w-[min(20rem,100%)] rounded-[1.35rem]`}):(0,$.jsxs)(`div`,{className:`flex max-w-full flex-col gap-1 rounded-[1.25rem] bg-[var(--surface-muted)] px-3.5 py-2.5 ring-1 ring-inset ring-[var(--surface-subtle)]`,"data-assistant-contact-file":``,children:[(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2.5`,children:[(0,$.jsx)(q,{name:`file-text`,className:`size-4 shrink-0 text-muted-foreground`}),(0,$.jsx)(`span`,{className:`truncate typography-ui`,children:w})]}),_?(0,$.jsx)(`p`,{role:`alert`,className:`typography-micro text-[var(--status-error)]`,children:r(`assistants.contact.attachment.loadFailed`)}):null,d&&!_||y?(0,$.jsx)(`span`,{role:`status`,className:`typography-micro text-muted-foreground`,children:r(`common.loading`)}):(0,$.jsx)(F,{type:`button`,size:`sm`,variant:`ghost`,onClick:d?()=>m(e=>e+1):()=>void C(f&&!!n),children:r(_?`chat.history.retry`:f&&n?`contextPanel.mode.preview`:`assistants.contact.attachment.download`)})]})}function ft(e){let t=(0,Z.c)(39),{part:n,onShowPopup:r}=e,{t:i}=I(),a=/^(?:https?:|data:|blob:)/i.test(n.url)?n.url:``,o=He(a,``),[s,c]=Q.useState(!1),l;t[0]!==n.filename||t[1]!==i?(l=n.filename||i(`assistants.contact.attachment.image`),t[0]=n.filename,t[1]=i,t[2]=l):l=t[2];let u=l,d;t[3]!==u||t[4]!==r||t[5]!==o?(d=e=>{!r||!o||r({open:!0,title:u,content:``,metadata:{tool:`image-preview`,filename:u},previewSource:e.currentTarget,image:{url:o,filename:u,gallery:[{url:o,filename:u}],index:0}})},t[3]=u,t[4]=r,t[5]=o,t[6]=d):d=t[6];let f=M(d);if(Re(a,n.mime)&&a&&r){let e;t[7]!==r||t[8]!==n.filename||t[9]!==n.mime||t[10]!==a||t[11]!==i?(e=()=>r({open:!0,title:n.filename||i(`assistants.contact.attachment.file`),content:``,video:{url:a,filename:n.filename,mimeType:n.mime}}),t[7]=r,t[8]=n.filename,t[9]=n.mime,t[10]=a,t[11]=i,t[12]=e):e=t[12];let o;t[13]!==n.filename||t[14]!==i?(o=n.filename||i(`contextPanel.mode.preview`),t[13]=n.filename,t[14]=i,t[15]=o):o=t[15];let s;return t[16]!==e||t[17]!==o?(s=(0,$.jsx)(F,{variant:`secondary`,size:`sm`,onClick:e,children:o}),t[16]=e,t[17]=o,t[18]=s):s=t[18],s}if(n.mime.startsWith(`image/`)&&o&&!s){let e;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(e=()=>c(!0),t[19]=e):e=t[19];let n;t[20]===f?n=t[21]:(n=e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),f(e))},t[20]=f,t[21]=n);let r;return t[22]!==u||t[23]!==f||t[24]!==o||t[25]!==n?(r=(0,$.jsx)(We,{src:o,alt:u,contentFrame:!0,className:ut,onError:e,onClick:f,onKeyDown:n,role:`button`,tabIndex:0,"data-assistant-contact-image":``}),t[22]=u,t[23]=f,t[24]=o,t[25]=n,t[26]=r):r=t[26],r}let p;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,$.jsx)(q,{name:`file-text`,className:`size-4 shrink-0 text-muted-foreground`}),t[27]=p):p=t[27];let m;t[28]!==n.filename||t[29]!==i?(m=n.filename||i(`assistants.contact.attachment.file`),t[28]=n.filename,t[29]=i,t[30]=m):m=t[30];let h;t[31]===m?h=t[32]:(h=(0,$.jsx)(`span`,{className:`truncate typography-ui`,children:m}),t[31]=m,t[32]=h);let g;t[33]!==s||t[34]!==i?(g=s?(0,$.jsx)(F,{type:`button`,size:`sm`,variant:`ghost`,onClick:()=>c(!1),children:i(`chat.history.retry`)}):null,t[33]=s,t[34]=i,t[35]=g):g=t[35];let _;return t[36]!==h||t[37]!==g?(_=(0,$.jsxs)(`div`,{className:`flex max-w-full items-center gap-2.5 rounded-[1.25rem] bg-[var(--surface-muted)] px-3.5 py-2.5`,"data-assistant-contact-file":``,children:[p,h,g]}),t[36]=h,t[37]=g,t[38]=_):_=t[38],_}function pt(e){let t=(0,Z.c)(5),{assistantID:n,part:r,onShowPopup:i}=e,a=Ve(),o;return t[0]!==n||t[1]!==i||t[2]!==r||t[3]!==a?(o=`attachmentID`in r?(0,$.jsx)(dt,{assistantID:n,descriptor:r,onShowPopup:i},`${a}:${n}:${r.attachmentID}:${r.sha256}`):(0,$.jsx)(ft,{part:r,onShowPopup:i},`${a}:${r.url}`),t[0]=n,t[1]=i,t[2]=r,t[3]=a,t[4]=o):o=t[4],o}var mt=Q.memo(e=>{let t=(0,Z.c)(32),{turn:n,retryDisabled:r,onRetry:l}=e,{t:d}=I(),p;t[0]===d?p=t[1]:(p=d(`assistants.contact.sendError.viewDetails`),t[0]=d,t[1]=p);let m;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,$.jsx)(q,{name:`exclamation-fill`,className:`size-[18px] text-[var(--status-error)]`,"data-assistant-contact-error-dot":``}),t[2]=m):m=t[2];let h;t[3]===p?h=t[4]:(h=(0,$.jsx)(s,{type:`button`,"aria-label":p,"data-assistant-contact-send-error":``,className:`absolute right-full top-1/2 mr-1.5 flex size-9 -translate-y-1/2 cursor-pointer items-center justify-center rounded-md border-0 bg-transparent p-0 shadow-none outline-none focus-visible:opacity-70`,children:m}),t[3]=p,t[4]=h);let g;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(g={side:`flip`,align:`shift`,fallbackAxisSide:`end`},t[5]=g):g=t[5];let _;t[6]===d?_=t[7]:(_=d(`assistants.contact.sendError.title`),t[6]=d,t[7]=_);let v;t[8]===_?v=t[9]:(v=(0,$.jsx)(i,{className:`typography-ui-label font-medium`,children:_}),t[8]=_,t[9]=v);let y;t[10]!==d||t[11]!==n.error?(y=n.error||d(`assistants.contact.sendFailed`),t[10]=d,t[11]=n.error,t[12]=y):y=t[12];let b;t[13]===y?b=t[14]:(b=(0,$.jsx)(f,{role:`alert`,className:`mt-2 max-h-48 overflow-y-auto whitespace-pre-wrap typography-meta leading-relaxed [overflow-wrap:anywhere]`,children:y}),t[13]=y,t[14]=b);let x;t[15]!==l||t[16]!==n.messageID?(x=()=>l(n.messageID),t[15]=l,t[16]=n.messageID,t[17]=x):x=t[17];let S;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,$.jsx)(q,{name:`refresh`,className:`size-3`}),t[18]=S):S=t[18];let C;t[19]===d?C=t[20]:(C=d(`chat.history.retry`),t[19]=d,t[20]=C);let w;t[21]!==r||t[22]!==C||t[23]!==x?(w=(0,$.jsx)(`div`,{className:`mt-4 flex justify-end`,children:(0,$.jsxs)(F,{type:`button`,size:`xs`,disabled:r,onClick:x,children:[S,C]})}),t[21]=r,t[22]=C,t[23]=x,t[24]=w):w=t[24];let T;t[25]!==w||t[26]!==v||t[27]!==b?(T=(0,$.jsx)(c,{children:(0,$.jsx)(u,{side:`left`,align:`center`,sideOffset:6,collisionPadding:12,collisionAvoidance:g,className:`z-50`,children:(0,$.jsxs)(a,{className:`yuri-mobile-overlay-surface w-72 max-w-[calc(100vw-2rem)] rounded-xl p-4 text-foreground outline-none`,"data-assistant-contact-send-error-popup":``,children:[v,b,w]})})}),t[25]=w,t[26]=v,t[27]=b,t[28]=T):T=t[28];let E;return t[29]!==T||t[30]!==h?(E=(0,$.jsxs)(o,{children:[h,T]}),t[29]=T,t[30]=h,t[31]=E):E=t[31],E});function ht(e){let t=(0,Z.c)(7),{children:n,failedTurn:r,retryDisabled:i,onRetry:a}=e,o;t[0]!==r||t[1]!==a||t[2]!==i?(o=r?.status===`failed`?(0,$.jsx)(mt,{turn:r,retryDisabled:i,onRetry:a}):null,t[0]=r,t[1]=a,t[2]=i,t[3]=o):o=t[3];let s;return t[4]!==n||t[5]!==o?(s=(0,$.jsxs)(`div`,{className:`relative min-w-0 max-w-full`,"data-assistant-contact-user-part":``,children:[n,o]}),t[4]=n,t[5]=o,t[6]=s):s=t[6],s}var gt=[],_t=e=>e.flatMap(e=>e.type===`text`&&e.text.trim()?[e.text]:[]).join(`
|
|
3
|
-
`),vt=(e,t,n,r=Date.now())=>({assistantID:e,messageID:t,parts:n,status:`sending`,createdAt:r}),yt=(e,t)=>{let n=e.filter(e=>e.assistantID===t);return n.length===e.length?e:n},bt=(e,t)=>{let n=e.filter(e=>e.assistantID===t);return n.length===e.length?e:n},xt=(e,t,n,r)=>({messageID:t?`${e.turnID}:preview:${t.bubbleIndex}`:`${e.turnID}:preview:${r}`,assistantID:e.assistantID,role:`assistant`,turnID:e.turnID,bubbleIndex:t?.bubbleIndex??0,createdAt:t?.occurredAt??e.occurredAt,ordinal:n,status:r,fromAssistantID:null,fromAssistantName:null,parts:t?[{type:`text`,text:t.text}]:[],text:t?.text??``,cards:[]}),St=(e,t,n)=>{let r=e.bubbles.filter(e=>!t.has(e.bubbleIndex)).map((t,r)=>xt(e,t,n+r,t.done?`complete`:`streaming`));return e.status===`failed`?[...r,xt(e,null,n+r.length,`failed`)]:e.status===`admitted`||e.status===`streaming`?[...r,xt(e,null,n+r.length,`admitted`)]:r},Ct=(e,t,n,r=[])=>{let i=new Set(e.map(e=>e.messageID)),a=t.flatMap((t,r)=>t.assistantID!==n||i.has(t.messageID)?[]:[{messageID:t.messageID,assistantID:n,role:`user`,turnID:t.messageID,bubbleIndex:0,createdAt:t.createdAt,ordinal:e.length+r,status:t.status,fromAssistantID:null,fromAssistantName:null,parts:[...t.parts],text:_t(t.parts),cards:[]}]),o=a.length===0?e:[...e,...a],s=r.filter(e=>e.assistantID===n);if(s.length===0)return o;let c=new Map,l=new Map;o.forEach((e,t)=>{if(c.set(e.turnID,t),e.role!==`assistant`||e.messageID.includes(`:preview:`))return;let n=l.get(e.turnID)??new Set;n.add(e.bubbleIndex),l.set(e.turnID,n)});let u=new Map,d=[];for(let e of s){let t=St(e,l.get(e.turnID)??new Set,o.length+d.length);if(t.length===0)continue;let n=c.get(e.turnID);if(n===void 0){if(e.status===`failed`&&o.some(t=>t.turnID!==e.turnID))continue;d.push(...t);continue}let r=u.get(n)??[];r.push(...t),u.set(n,r)}return u.size===0&&d.length===0?o:o.flatMap((e,t)=>[e,...u.get(t)??[]]).concat(d)},wt=(e,t)=>{let n=new Set(t.map(e=>e.messageID)),r=e.filter(e=>!n.has(e.messageID));return r.length===e.length?e:r},Tt=(e,t)=>e.map(e=>e.messageID===t?{...e,status:`admitted`}:e),Et=(e,t,n,r=Date.now())=>{let i=e.filter(e=>e.assistantID!==t||e.status!==`failed`||e.turnID===n);return i.some(e=>e.assistantID===t&&e.turnID===n)?i.length===e.length?e:i:[...i,{assistantID:t,turnID:n,status:`admitted`,bubbles:[],occurredAt:r}]},Dt=(e,t,n)=>!t?.turnID||!t.assistantID||n?.has(t.turnID)?e:Et(e,t.assistantID,t.turnID,t.admittedAt),Ot=(e,t)=>{let n=t.assistantID,r=t.pendingSendTurnIDs??new Set,i=t.settledTurnIDs??new Set,a=typeof t.snapshotRevision==`number`&&Number.isFinite(t.snapshotRevision)?t.snapshotRevision:null,o=t.admissionRevisionByTurnID instanceof Map?t.admissionRevisionByTurnID:new Map(Object.entries(t.admissionRevisionByTurnID??{}).map(([e,t])=>[e,Number(t)])),s=t.occurredAt??Date.now(),c=t.activeContactTurn&&t.activeContactTurn.turnID?t.activeContactTurn:null,l=!!(t.serverWorking||c),u=Dt(e,c?{assistantID:n,turnID:c.turnID,admittedAt:c.admittedAt}:null,i),d=Array.isArray(t.messages)?t.messages:[];for(let e of d)e.role===`assistant`&&e.status===`error`&&(r.has(e.turnID)||i.has(e.turnID)||(u=At(u,{assistantID:n,turnID:e.turnID,status:`error`,error:e.text||`upstream_error`,occurredAt:s})));if(u=jt(u,d),l){let t=u.filter(e=>{if(e.assistantID!==n||e.status!==`admitted`&&e.status!==`streaming`||r.has(e.turnID)||c&&e.turnID===c.turnID)return!0;let t=o.get(e.turnID);return typeof t==`number`&&a!=null&&a<t?!0:typeof t==`number`&&a!=null&&a>=t&&e.turnID!==c?.turnID?!1:!c||e.turnID===c.turnID});return t.length===e.length&&t.every((t,n)=>t===e[n])?e:t}if(a==null)return u.length===e.length&&u.every((t,n)=>t===e[n])?e:u;let f=u.filter(e=>{if(e.assistantID!==n||e.status!==`admitted`&&e.status!==`streaming`||r.has(e.turnID))return!0;if(i.has(e.turnID))return!1;let t=o.get(e.turnID);return typeof t==`number`&&a<t});return f.length===e.length&&f.every((t,n)=>t===e[n])?e:f.length===u.length?u:f},kt=(e,t)=>Et(e,t.assistantID,t.turnID,t.occurredAt).map(e=>{if(e.assistantID!==t.assistantID||e.turnID!==t.turnID||e.status===`failed`||e.status===`complete`)return e;let n=e.bubbles.find(e=>e.bubbleIndex===t.bubbleIndex);if(n?.done)return e;let r=n?{...n,text:`${n.text}${t.delta}`,done:t.done,occurredAt:t.occurredAt}:{bubbleIndex:t.bubbleIndex,text:t.delta,done:t.done,occurredAt:t.occurredAt},i=n?e.bubbles.map(e=>e.bubbleIndex===t.bubbleIndex?r:e):[...e.bubbles,r].sort((e,t)=>e.bubbleIndex-t.bubbleIndex);return{...e,status:`streaming`,bubbles:i}}),At=(e,t,n={})=>n.requireExisting&&!e.some(e=>e.assistantID===t.assistantID&&e.turnID===t.turnID)?e:Et(e,t.assistantID,t.turnID,t.occurredAt).map(e=>e.assistantID!==t.assistantID||e.turnID!==t.turnID||e.status===`complete`||e.status===`failed`?e:{...e,status:t.status===`error`?`failed`:`complete`,...t.error?{error:t.error}:{}}),jt=(e,t)=>{let n=new Set(t.map(e=>e.turnID).filter(Boolean)),r=t.length>0?t[t.length-1]?.turnID??null:null,i=[...e].reverse().find(e=>e.status===`admitted`||e.status===`streaming`)?.turnID??r,a=new Set(t.flatMap(e=>e.role===`assistant`?[e.turnID]:[])),o=e.filter(e=>e.status===`admitted`||e.status===`streaming`||!(e.status===`complete`&&a.has(e.turnID)||!n.has(e.turnID)||e.status===`failed`&&(i&&i!==e.turnID||r&&r!==e.turnID)));return o.length===e.length?e:o},Mt=(e,t,n)=>e.map(e=>e.messageID===t?{...e,status:`failed`,error:n}:e),Nt=(e,t)=>e instanceof G?e.code===`no_provider`?t.noProvider:e.code===`admission_timeout`||e.code===`generate_timeout`?t.timedOut:e.message&&e.message!==e.code?e.message:`${t.sendFailed}\n\n${e.code} (HTTP ${e.status})`:V(e)?t.timedOut:e instanceof Error&&e.message.trim()?e.message:t.sendFailed,Pt=()=>{let e=!1;return{tryAcquire:()=>!e&&(e=!0,!0),release:()=>{e=!1}}},Ft=e=>{let t=e.text.trim();if(e.sending||!t&&e.attachments.length===0||!e.gate.tryAcquire())return{ok:!1};let n=[...t?[{type:`text`,text:t}]:[],...e.attachments.map(e=>({type:`file`,mime:e.mime,url:e.url,filename:e.name}))],r=e.createMessageID();return{ok:!0,messageID:r,parts:n,turn:vt(e.assistantID,r,n,e.createdAt)}},It=e=>e.some(e=>e.status===`sending`),Lt=e=>e.some(e=>e.status===`admitted`||e.status===`streaming`),Rt=r(e=>({workingByID:{},setWorking:(t,n)=>e(e=>({workingByID:{...e.workingByID,[t]:n}}))})),zt=({sending:e=!1,processing:t=!1,serverWorking:n=!1})=>e||t||n,Bt=(e,t)=>{let n=(0,Z.c)(5),r=t!==void 0&&t,i;n[0]===e?i=n[1]:(i=t=>!!t.workingByID[e],n[0]=e,n[1]=i);let a=Rt(i),o;return n[2]!==a||n[3]!==r?(o=zt({processing:a,serverWorking:r}),n[2]=a,n[3]=r,n[4]=o):o=n[4],o},Vt=e=>{let t=(0,Z.c)(25),{name:n,avatarSeed:r,size:i,label:a,working:o,showWorkingDot:s,className:c,hoverTarget:l,followPointer:u,blinkOnMount:d}=e,f=i===void 0?24:i,p=s===void 0||s,m=d===void 0||d,{t:h}=I(),g;t[0]!==n||t[1]!==o?(g=e=>o!==void 0&&!!e.workingByID[n],t[0]=n,t[1]=o,t[2]=g):g=t[2];let _=Rt(g),v=!!(o||_),y=`calc(${f}px * var(--dpt-n, 1))`,b;t[3]===c?b=t[4]:(b=N(`relative inline-block shrink-0 align-middle leading-none`,c),t[3]=c,t[4]=b);let x;t[5]===y?x=t[6]:(x={width:y,minWidth:y,maxWidth:y,height:y,minHeight:y,maxHeight:y},t[5]=y,t[6]=x);let S=o===void 0?void 0:v?`working`:`idle`,C=r??n,w;t[7]!==m||t[8]!==u||t[9]!==l||t[10]!==a||t[11]!==n||t[12]!==f||t[13]!==S||t[14]!==C?(w=(0,$.jsx)(he,{kind:`assistant`,motion:S,name:C,size:f,label:a,hoverTarget:l,followPointer:u,animationKey:n,blinkOnMount:m}),t[7]=m,t[8]=u,t[9]=l,t[10]=a,t[11]=n,t[12]=f,t[13]=S,t[14]=C,t[15]=w):w=t[15];let T;t[16]!==p||t[17]!==h||t[18]!==o?(T=o&&p?(0,$.jsx)(`span`,{className:`pointer-events-none absolute right-0 bottom-0 size-2.5 translate-x-0.5 translate-y-0.5 rounded-full bg-[var(--status-success)] ring-2 ring-background`,"data-assistant-working-dot":``,"aria-label":h(`assistants.contact.working`)}):null,t[16]=p,t[17]=h,t[18]=o,t[19]=T):T=t[19];let E;return t[20]!==T||t[21]!==b||t[22]!==x||t[23]!==w?(E=(0,$.jsxs)(`span`,{className:b,style:x,"data-assistant-working-avatar":``,children:[w,T]}),t[20]=T,t[21]=b,t[22]=x,t[23]=w,t[24]=E):E=t[24],E};function Ht(e){let t=(0,Z.c)(6),{value:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,$.jsx)(q,{name:`brain`,weight:`medium`,className:`size-3.5 shrink-0`}),t[0]=r):r=t[0];let i;t[1]===n?i=t[2]:(i=(0,$.jsx)(`span`,{className:`min-w-0 truncate`,children:n}),t[1]=n,t[2]=i);let a;return t[3]!==i||t[4]!==n?(a=(0,$.jsxs)(`p`,{"data-contact-card-model":``,className:`flex min-w-0 flex-1 items-center gap-1.5 text-[0.75em] leading-4 text-muted-foreground`,title:n,children:[r,i]}),t[3]=i,t[4]=n,t[5]=a):a=t[5],a}var Ut=Q.createContext(null),Wt=[`grid h-[calc(148px*var(--padding-scale,1))] w-[19rem] min-w-0 max-w-full shrink-0 grid-rows-[calc(40px*var(--padding-scale,1))_calc(20px*var(--padding-scale,1))_calc(20px*var(--padding-scale,1))_calc(48px*var(--padding-scale,1))] content-start cursor-pointer rounded-[1.35rem] bg-[var(--surface-muted)]`,`px-4 py-2.5 text-left typography-ui-label transition-colors duration-150 motion-reduce:transition-none`,`hover:bg-interactive-hover/45`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--interactive-focus-ring)]`].join(` `),Gt=Wt,Kt=Wt,qt=`row-start-1 mb-2 flex h-8 min-w-0 items-center gap-2`,Jt=`row-start-2 min-w-0 self-start truncate font-medium leading-5 text-foreground`,Yt=`row-start-4 flex h-12 min-w-0 flex-col justify-center`;function Xt(e,t){(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),t())}var Zt=e=>{let t=(0,Z.c)(36),{card:n,assistant:r,active:i}=e,a=i===void 0||i,{t:o}=I(),s=xe(),c;t[0]===s?c=t[1]:(c=s&&!D(),t[0]=s,t[1]=c);let l=!!c,u=n.name,d=`${n.providerID}/${n.modelID}`,f=Q.useContext(Ut),p;t[2]!==n.assistantID||t[3]!==l||t[4]!==f?(p=()=>{if(f)return f({assistantID:n.assistantID});if(l){L.getState().openAssistant(n.assistantID);return}de(n.assistantID)},t[2]=n.assistantID,t[3]=l,t[4]=f,t[5]=p):p=t[5];let m=M(p),h;t[6]===m?h=t[7]:(h=e=>{Xt(e,m)},t[6]=m,t[7]=h);let g=M(h),_;t[8]!==o||t[9]!==u?(_=o(`assistants.contact.card.assistant.aria`,{name:u}),t[8]=o,t[9]=u,t[10]=_):_=t[10];let v=r?.avatarSeed,y=a?!!(r?.working||r?.activeContactTurn):void 0,b;t[11]!==n.assistantID||t[12]!==v||t[13]!==y?(b=(0,$.jsx)(`span`,{className:`relative inline-block shrink-0 leading-none`,"aria-hidden":!0,children:(0,$.jsx)(Vt,{name:n.assistantID,avatarSeed:v,size:32,working:y,showWorkingDot:!1,followPointer:!1})}),t[11]=n.assistantID,t[12]=v,t[13]=y,t[14]=b):b=t[14];let x;t[15]===o?x=t[16]:(x=o(`assistants.contact.card.assistant.label`),t[15]=o,t[16]=x);let S;t[17]===x?S=t[18]:(S=(0,$.jsx)(`span`,{className:`min-w-0 truncate text-[0.8em] leading-4 text-muted-foreground`,children:x}),t[17]=x,t[18]=S);let C;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,$.jsx)(q,{name:`arrow-right-s`,weight:`medium`,className:`ml-auto size-4 shrink-0 text-muted-foreground`}),t[19]=C):C=t[19];let w;t[20]!==S||t[21]!==b?(w=(0,$.jsxs)(`div`,{className:qt,children:[b,S,C]}),t[20]=S,t[21]=b,t[22]=w):w=t[22];let T;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(T=N(Jt,`row-span-2 self-center`),t[23]=T):T=t[23];let E;t[24]===u?E=t[25]:(E=(0,$.jsx)(`h3`,{className:T,title:u,children:u}),t[24]=u,t[25]=E);let O;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(O=N(Yt,`justify-end pb-1`),t[26]=O):O=t[26];let k;t[27]===d?k=t[28]:(k=(0,$.jsx)(`div`,{className:O,children:(0,$.jsx)(`div`,{className:`flex h-4 min-w-0 items-center`,children:(0,$.jsx)(Ht,{value:d})})}),t[27]=d,t[28]=k);let A;return t[29]!==g||t[30]!==m||t[31]!==w||t[32]!==E||t[33]!==k||t[34]!==_?(A=(0,$.jsxs)(`article`,{className:Gt,role:`button`,tabIndex:0,"aria-label":_,"data-assistant-contact-card":`assistant`,onClick:m,onKeyDown:g,children:[w,E,k]}),t[29]=g,t[30]=m,t[31]=w,t[32]=E,t[33]=k,t[34]=_,t[35]=A):A=t[35],A},Qt=e=>!!(e&&typeof e==`object`&&!Array.isArray(e)),$t=e=>typeof e==`string`&&/^([01]\d|2[0-3]):[0-5]\d$/.test(e),en=e=>typeof e==`number`&&Number.isInteger(e)&&e>=0&&e<=6,tn=e=>e.kind===`cron`?e.cron===void 0:e.kind===`once`?e.date===void 0:e.kind===`weekly`?e.times===void 0||e.weekdays===void 0:e.kind===`daily`&&e.times===void 0,nn=e=>{if(!Qt(e)||e.timezone!==void 0&&typeof e.timezone!=`string`)return!1;if(e.kind===`cron`)return typeof e.cron==`string`&&!!e.cron.trim();if(e.kind===`once`)return typeof e.date==`string`&&/^\d{4}-\d{2}-\d{2}$/.test(e.date)&&$t(e.time);let t=Array.isArray(e.times)&&e.times.length>0&&e.times.every($t);return e.kind===`daily`?t||$t(e.time):e.kind===`weekly`&&(t||$t(e.time))&&Array.isArray(e.weekdays)&&e.weekdays.length>0&&e.weekdays.every(en)},rn=(e,t)=>{if(!tn(e)||!nn(t?.schedule))return e;let n=t.schedule;return{...e,kind:n.kind,time:n.time??n.times?.[0]??null,timezone:n.timezone??e.timezone,cron:n.cron??null,date:n.date??null,times:n.times??null,weekdays:n.weekdays??null}},an=(e,t)=>{let n=e.kind===`daily`||e.kind===`weekly`||e.kind===`once`||e.kind===`cron`?t(`sessions.scheduledTasks.editor.scheduleType.${e.kind}`):e.kind||``,r=[...new Set((e.times?.length?e.times:e.time?[e.time]:[]).filter($t))].sort(),i=r.join(`, `),a=n,o=r.length===1;if(e.kind===`cron`)i=e.cron?.trim()||n,a=e.cron?.trim()?n:``,o=!1;else if(e.kind===`once`)i=[e.date?.trim(),i].filter(Boolean).join(` `),o=!1;else if(e.kind===`weekly`&&e.weekdays?.length){let n=[`sun`,`mon`,`tue`,`wed`,`thu`,`fri`,`sat`];a=[...new Set(e.weekdays.filter(en))].sort((e,t)=>e-t).map(e=>t(`sessions.scheduledTasks.dialog.schedule.weekdayShort.${n[e]}`)).join(`, `)}return{value:i||t(`assistants.contact.card.schedule.timeUnavailable`),cadence:a,clock:o,timezone:e.timezone}},on=e=>{let t=(0,Z.c)(44),{card:n,task:r}=e,{t:i}=I(),a=n.name,o;t[0]!==n||t[1]!==i||t[2]!==r?(o=an(rn(n,r),i),t[0]=n,t[1]=i,t[2]=r,t[3]=o):o=t[3];let s=o,c;t[4]===n.prompt?c=t[5]:(c=n.prompt?.trim(),t[4]=n.prompt,t[5]=c);let l=c,u=Q.useContext(Ut),d;t[6]!==n.projectID||t[7]!==n.taskID||t[8]!==u?(d=()=>{if(u)return u({projectID:n.projectID,taskID:n.taskID});ye(n.projectID,n.taskID)},t[6]=n.projectID,t[7]=n.taskID,t[8]=u,t[9]=d):d=t[9];let f=M(d),p;t[10]===f?p=t[11]:(p=e=>{Xt(e,f)},t[10]=f,t[11]=p);let m=M(p),h;t[12]!==i||t[13]!==a?(h=i(`assistants.contact.card.schedule.aria`,{name:a}),t[12]=i,t[13]=a,t[14]=h):h=t[14];let g;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,$.jsx)(q,{name:`calendar`,weight:`medium`,className:`size-4 shrink-0`}),t[15]=g):g=t[15];let _;t[16]===i?_=t[17]:(_=i(`assistants.contact.card.schedule.label`),t[16]=i,t[17]=_);let v;t[18]===_?v=t[19]:(v=(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2 text-[0.8em] leading-4 text-muted-foreground`,children:[g,(0,$.jsx)(`span`,{className:`truncate`,children:_})]}),t[18]=_,t[19]=v);let y;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,$.jsx)(q,{name:`arrow-right-s`,weight:`medium`,className:`ml-auto size-4 shrink-0 text-muted-foreground`}),t[20]=y):y=t[20];let b;t[21]===v?b=t[22]:(b=(0,$.jsxs)(`div`,{className:qt,children:[v,y]}),t[21]=v,t[22]=b);let x;t[23]===a?x=t[24]:(x=(0,$.jsx)(`h3`,{className:Jt,title:a,children:a}),t[23]=a,t[24]=x);let S;t[25]===l?S=t[26]:(S=l?(0,$.jsx)(`p`,{className:`row-start-3 mt-1 min-w-0 truncate text-[0.8em] leading-4 text-muted-foreground`,title:l,children:l}):null,t[25]=l,t[26]=S);let C;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(C=N(Yt,`justify-end`),t[27]=C):C=t[27];let w;t[28]===s.cadence?w=t[29]:(w=s.cadence?(0,$.jsx)(`span`,{"data-contact-schedule-cadence":``,className:`min-w-0 max-w-[36%] flex-[0_1_auto] truncate text-[0.75em] leading-4 text-muted-foreground`,title:s.cadence,children:s.cadence}):null,t[28]=s.cadence,t[29]=w);let T=`min-w-0 flex-[0_1_auto] truncate leading-[22px] text-foreground tabular-nums ${s.clock?`text-[1.25em] font-normal tracking-[-0.3px]`:`text-[0.85em]`}`,E;t[30]!==s.value||t[31]!==T?(E=(0,$.jsx)(`p`,{className:T,title:s.value,children:s.value}),t[30]=s.value,t[31]=T,t[32]=E):E=t[32];let D;t[33]!==w||t[34]!==E?(D=(0,$.jsx)(`div`,{className:C,children:(0,$.jsxs)(`div`,{"data-contact-schedule-time":``,className:`flex min-w-0 flex-none items-baseline gap-1.5`,children:[w,E]})}),t[33]=w,t[34]=E,t[35]=D):D=t[35];let O;return t[36]!==m||t[37]!==f||t[38]!==b||t[39]!==x||t[40]!==S||t[41]!==D||t[42]!==h?(O=(0,$.jsxs)(`article`,{className:Gt,role:`button`,tabIndex:0,"aria-label":h,"data-assistant-contact-card":`schedule`,onClick:f,onKeyDown:m,children:[b,x,S,D]}),t[36]=m,t[37]=f,t[38]=b,t[39]=x,t[40]=S,t[41]=D,t[42]=h,t[43]=O):O=t[43],O},sn=(e,t)=>t===`cancelled`?t:e===`busy`||e===`retry`?e:t===`error`||t===`question`||t===`complete`||t===`busy`||t===`retry`?t:e===`idle`?`complete`:t===`idle`?t:t||`busy`,cn=e=>e===`cancelled`?`assistants.contact.card.session.status.cancelled`:e===`busy`?`assistants.contact.card.session.status.busy`:e===`retry`?`assistants.contact.card.session.status.retry`:e===`idle`?`assistants.contact.card.session.status.idle`:e===`complete`?`assistants.contact.card.session.status.complete`:e===`error`?`assistants.contact.card.session.status.error`:e===`question`?`assistants.contact.card.session.status.question`:null,ln=e=>e===`busy`?`text-[var(--status-info)]`:e===`retry`||e===`question`?`text-[var(--status-warning)]`:e===`error`?`text-[var(--status-error)]`:e===`idle`||e===`complete`?`text-[var(--status-success)]`:`text-muted-foreground`,un=e=>e.split(/[/\\]/u).filter(Boolean).at(-1)||e,dn=e=>{let t=(0,Z.c)(57),{card:n}=e,{t:r}=I(),i=xe(),a;t[0]===i?a=t[1]:(a=i&&!D(),t[0]=i,t[1]=a);let o=!!a,s;t[2]===n.sessionID?s=t[3]:(s=e=>e.activeSessions.find(e=>e.id===n.sessionID)??e.archivedSessions.find(e=>e.id===n.sessionID)??null,t[2]=n.sessionID,t[3]=s);let c=re(s),l=P(n.sessionID),u=(typeof c?.title==`string`&&c.title.trim()?c.title.trim():null)||n.title||r(`assistants.contact.card.session.untitled`),d=sn(l?.type,n.status),f=cn(d),p;t[4]!==n.directory||t[5]!==c?(p=typeof c?.directory==`string`&&c.directory.trim()?c.directory.trim():n.directory,t[4]=n.directory,t[5]=c,t[6]=p):p=t[6];let m=p,h;t[7]===m?h=t[8]:(h=un(m),t[7]=m,t[8]=h);let g=h,_=ie(m).data?.current?.trim()||null,v;t[9]===c?v=t[10]:(v=Y(c),t[9]=c,t[10]=v);let y=v,b=d===`complete`||d===`idle`?J(c):null,x=Q.useContext(Ut),C;t[11]!==n.directory||t[12]!==n.sessionID||t[13]!==o||t[14]!==x?(C=()=>{let e=X(n.sessionID)?.directory||n.directory;if(x)return x({sessionId:n.sessionID,directory:e});ne(n.sessionID,e,{phoneShell:o,switchToChat:!0}),o||S.getState().setActiveMainTab(`chat`)},t[11]=n.directory,t[12]=n.sessionID,t[13]=o,t[14]=x,t[15]=C):C=t[15];let w=M(C),T;t[16]===w?T=t[17]:(T=e=>{Xt(e,w)},t[16]=w,t[17]=T);let E=M(T),O=Kt,k=r(`assistants.contact.card.session.aria`,{title:u}),A;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,$.jsx)(q,{name:`chat-thread`,weight:`medium`,className:`size-4 shrink-0`}),t[18]=A):A=t[18];let j;t[19]===r?j=t[20]:(j=r(`assistants.contact.card.session.label`),t[19]=r,t[20]=j);let ee;t[21]===j?ee=t[22]:(ee=(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2 text-[0.8em] leading-4 text-muted-foreground`,children:[A,(0,$.jsx)(`span`,{className:`truncate`,children:j})]}),t[21]=j,t[22]=ee);let te=f?(0,$.jsxs)(`span`,{"data-assistant-session-status":``,className:N(`ml-auto inline-flex shrink-0 items-center gap-1.5 whitespace-nowrap text-[0.75em] leading-4`,ln(d)),children:[(0,$.jsx)(`span`,{className:`size-1.5 shrink-0 rounded-full bg-current`,"aria-hidden":!0}),r(f)]}):null,F;t[23]!==ee||t[24]!==te?(F=(0,$.jsxs)(`div`,{className:qt,children:[ee,te]}),t[23]=ee,t[24]=te,t[25]=F):F=t[25];let L;t[26]===u?L=t[27]:(L=(0,$.jsx)(`h3`,{className:Jt,title:u,children:u}),t[26]=u,t[27]=L);let R=N(`flex min-w-0 items-center gap-1.5 text-foreground`,_&&`max-w-[45%] shrink-0`),z;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,$.jsx)(q,{name:`folder`,weight:`medium`,className:`size-3.5 shrink-0 text-muted-foreground`}),t[28]=z):z=t[28];let B;t[29]===g?B=t[30]:(B=(0,$.jsx)(`span`,{className:`min-w-0 truncate`,children:g}),t[29]=g,t[30]=B);let V;t[31]!==m||t[32]!==R||t[33]!==B?(V=(0,$.jsxs)(`p`,{className:R,title:m,children:[z,B]}),t[31]=m,t[32]=R,t[33]=B,t[34]=V):V=t[34];let H;t[35]===_?H=t[36]:(H=_?(0,$.jsxs)(`p`,{"data-contact-session-branch":``,className:`flex min-w-0 items-center gap-1 text-muted-foreground`,title:_,children:[(0,$.jsx)(q,{name:`git-branch`,weight:`medium`,className:`size-3 shrink-0`}),(0,$.jsx)(`span`,{className:`min-w-0 truncate`,children:_})]}):null,t[35]=_,t[36]=H);let U;t[37]!==V||t[38]!==H?(U=(0,$.jsxs)(`div`,{"data-contact-session-project":``,className:`flex h-4 min-w-0 flex-none items-center gap-2 text-[0.8em] leading-4`,children:[V,H]}),t[37]=V,t[38]=H,t[39]=U):U=t[39];let ae=b?(0,$.jsxs)(`p`,{"data-contact-session-changes":``,className:`flex h-4 min-w-0 flex-none items-center gap-1.5 overflow-hidden whitespace-nowrap text-[0.8em] leading-4 text-muted-foreground tabular-nums`,children:[(0,$.jsx)(q,{name:`code`,weight:`medium`,className:`size-3.5 shrink-0`}),b.additions===void 0?null:(0,$.jsxs)(`span`,{className:`text-[var(--status-success)]`,children:[`+`,b.additions]}),b.deletions===void 0?null:(0,$.jsxs)(`span`,{className:`text-[var(--status-error)]`,children:[`−`,b.deletions]}),b.files===void 0?null:(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:b.files===1?r(`assistants.contact.card.session.changes.filesSingle`,{count:b.files}):r(`assistants.contact.card.session.changes.filesPlural`,{count:b.files})})]}):null,W;t[40]===y?W=t[41]:(W=y?(0,$.jsx)(Ht,{value:y}):null,t[40]=y,t[41]=W);let oe;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,$.jsx)(q,{name:`arrow-right-s`,weight:`medium`,className:`ml-auto size-4 shrink-0 text-muted-foreground`}),t[42]=oe):oe=t[42];let G;t[43]===W?G=t[44]:(G=(0,$.jsxs)(`div`,{"data-contact-session-bottom":``,className:`mt-auto flex h-4 min-w-0 flex-none items-center gap-2`,children:[W,oe]}),t[43]=W,t[44]=G);let K;t[45]!==U||t[46]!==ae||t[47]!==G?(K=(0,$.jsxs)(`div`,{"data-contact-session-details":``,className:`row-start-3 row-end-5 flex min-w-0 flex-col gap-1.5 py-1`,children:[U,ae,G]}),t[45]=U,t[46]=ae,t[47]=G,t[48]=K):K=t[48];let se;return t[49]!==E||t[50]!==w||t[51]!==k||t[52]!==F||t[53]!==L||t[54]!==K||t[55]!==O?(se=(0,$.jsxs)(`article`,{className:O,role:`button`,tabIndex:0,"aria-label":k,"data-assistant-contact-card":`session`,onClick:w,onKeyDown:E,children:[F,L,K]}),t[49]=E,t[50]=w,t[51]=k,t[52]=F,t[53]=L,t[54]=K,t[55]=O,t[56]=se):se=t[56],se},fn=3e5,pn=(e,t)=>e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate();function mn(e){let t=new Map,n=null;for(let r of e){if(!(r.status===`error`||r.status===`failed`||r.parts.some(e=>e.type!==`text`||e.text.trim()&&!e.text.trim().startsWith(`yuri.settle.`)&&!e.text.trim().startsWith(`oc.settle.`))))continue;let e=new Date(r.createdAt);Number.isFinite(e.getTime())&&((!n||!pn(n,e)||e.getTime()-n.getTime()>fn)&&t.set(r.messageID,r.createdAt),n=e)}return t}function hn(e,t,n){let r=new Intl.DateTimeFormat(e,{hour:`2-digit`,minute:`2-digit`,hourCycle:`h23`}),i=new Intl.DateTimeFormat(e,{month:`long`,day:`numeric`}),a=new Intl.DateTimeFormat(e,{year:`numeric`,month:`long`,day:`numeric`});return e=>{let o=new Date(e);return`${pn(o,n)?t:(o.getFullYear()===n.getFullYear()?i:a).format(o)} ${r.format(o)}`}}var gn=2,_n=1500,vn=e=>({scrollTop:e.scrollTop,scrollHeight:e.scrollHeight,clientHeight:e.clientHeight}),yn=e=>e.scrollHeight-e.scrollTop-e.clientHeight,bn=e=>yn(e)<=gn,xn=(e,t)=>{let n=t instanceof Element?t:t instanceof Node?t.parentElement:null;for(;n&&n!==e;){if(n instanceof HTMLElement&&n.scrollHeight>n.clientHeight+1&&n.scrollTop+n.clientHeight<n.scrollHeight-1)return!0;n=n.parentElement}return!1},Sn=e=>e.altKey||e.ctrlKey||e.metaKey?!1:e.key===`ArrowDown`||e.key===`PageDown`||e.key===`End`,Cn=({active:e,assistantID:t,contentRevision:n,onLoadEarlier:r})=>{let i=Q.useRef(null),[a,o]=Q.useState(null),[s,c]=Q.useState(null),l=Q.useRef(!0),u=Q.useRef(null),d=Q.useRef(null),f=Q.useRef(null),p=Q.useRef(0),m=Q.useRef(null),h=Q.useRef(null),g=Q.useRef(e);g.current=e;let _=ve(),v=Q.useRef(!1),y=Q.useRef(null),b=Q.useRef(null),x=M(()=>{y.current?.stop(),y.current=null,b.current=null}),S=Q.useMemo(()=>e=>{i.current=e,o(t=>t===e?t:e)},[]),C=Q.useMemo(()=>e=>{c(t=>t===e?t:e)},[]),w=M(()=>{let e=i.current;if(!e||!g.current||l.current)return;let t=e.getBoundingClientRect().top,n=Array.from(e.querySelectorAll(`[data-message-id]`)).find(e=>e.getBoundingClientRect().bottom>t);u.current=n?{id:n.dataset.messageId,offset:n.getBoundingClientRect().top-t,scrollTop:e.scrollTop}:null}),T=M(()=>{let e=i.current,t=u.current;if(!e||!g.current||l.current)return;if(!t){w();return}let n=e.scrollTop-t.scrollTop;if(Math.abs(n)>.5&&m.current){p.current=e.scrollTop,w();return}let r=Array.from(e.querySelectorAll(`[data-message-id]`)).find(e=>e.dataset.messageId===t.id);if(!r){w();return}let a=r.getBoundingClientRect().top-e.getBoundingClientRect().top-(t.offset-n);Math.abs(a)>.5&&(e.scrollTop+=a),p.current=e.scrollTop,u.current={id:t.id,offset:r.getBoundingClientRect().top-e.getBoundingClientRect().top,scrollTop:e.scrollTop}}),E=M(()=>{x(),l.current=!1,p.current=i.current?.scrollTop??0,w()}),D=Q.useRef(null),O=M(e=>{let t=i.current;!g.current||!t||(D.current=e??null,l.current=!0,u.current=null,h.current=null,p.current=t.scrollTop)}),k=M(()=>{if(!g.current||!l.current)return!1;let e=i.current;if(!e)return!1;let t=vn(e),n=Math.min(p.current,Math.max(0,t.scrollHeight-t.clientHeight));if(t.scrollTop<n-.5)return x(),l.current=!1,p.current=t.scrollTop,w(),!1;let r=!v.current;if(r&&e.querySelector(`[data-message-id]`)&&(v.current=!0),bn(t))return x(),p.current=t.scrollTop,!1;let a=Math.max(0,t.scrollHeight-t.clientHeight);if(!r&&!_){if(b.current===a)return!1;x(),b.current=a;let t=D.current;return D.current=null,y.current=_e(e.scrollTop,a,{duration:t?.duration??.22,ease:t?[...t.ease]:`easeOut`,onUpdate:t=>{if(!g.current||!l.current||i.current!==e)return;let n=Math.max(0,e.scrollHeight-e.clientHeight);if(e.scrollTop<Math.min(p.current,n)-.5){l.current=!1,x(),p.current=e.scrollTop,w();return}e.scrollTop=Math.min(Math.max(e.scrollTop,t),n),p.current=e.scrollTop},onComplete:()=>{y.current=null,b.current=null}}),!0}return x(),e.scrollTop=a,p.current=e.scrollTop,!0}),j=M(e=>{h.current={direction:e,expiresAt:performance.now()+_n}}),te=M(()=>{let e=h.current;return e?performance.now()>e.expiresAt?(h.current=null,null):e.direction:null}),ne=M(()=>{x(),l.current=!1,w()}),N=M(()=>{if(!g.current)return;let e=i.current;if(!e)return;let t=vn(e),n=t.scrollTop>p.current,a=Math.min(p.current,Math.max(0,t.scrollHeight-t.clientHeight));if(p.current=t.scrollTop,l.current){t.scrollTop<a-.5&&ne();return}let o=te();T(),t.scrollTop<=80&&o===`up`&&r?.(),n&&bn(t)&&(o===`down`||o===`scrollbar`)&&(l.current=!0)}),P=M(e=>{let t=i.current;if(!(!t||e.deltaY===0)){if(e.deltaY<0){if(ke(t,e.target))return;j(`up`),ne(),t.scrollTop<=80&&r?.();return}xn(t,e.target)||j(`down`)}}),F=M(e=>{h.current=null;let t=e.touches.item(0);m.current=t?{x:t.clientX,y:t.clientY,deltaX:0,deltaY:0}:null}),I=M(e=>{let t=i.current,n=e.touches.item(0);if(!t||!n){m.current=null;return}let a=m.current;if(!a)return;let o=n.clientY-a.y,s=o*a.deltaY<0,c=(s?0:a.deltaX)+n.clientX-a.x,l=(s?0:a.deltaY)+o;if(m.current={x:n.clientX,y:n.clientY,deltaX:c,deltaY:l},!(Math.abs(c)>=Math.abs(l))){if(l>0&&ke(t,e.target)||l<0&&xn(t,e.target)){m.current.deltaX=0,m.current.deltaY=0;return}j(l>0?`up`:`down`),l>2&&(ne(),t.scrollTop<=80&&r?.())}}),re=M(()=>{m.current=null}),ie=M(e=>{if(Te(e)){j(`up`),ne(),(i.current?.scrollTop??1/0)<=80&&r?.();return}Sn(e)&&j(`down`)}),L=M(e=>{let t=i.current;e.pointerType===`mouse`&&e.target===t&&j(`scrollbar`)});Q.useLayoutEffect(()=>{let n=e?t:null,r=i.current;(d.current!==n||f.current!==r)&&(x(),v.current=!1,d.current=n,f.current=r,l.current=!0,u.current=null,h.current=null,m.current=null,p.current=r?.scrollTop??0),e&&(k(),T())},[e,t,n,a,_]),Q.useLayoutEffect(()=>()=>{x()},[e,t,a,x]);let R=Q.useMemo(()=>()=>void 0,[]),z=e&&a?a:R,B=Q.useMemo(()=>({passive:!0}),[]);A(`scroll`,N,z,B),A(`wheel`,P,z,B),A(`touchstart`,F,z,B),A(`touchmove`,I,z,B),A(`touchend`,re,z,B),A(`touchcancel`,re,z,B),A(`keydown`,ie,z),A(`pointerdown`,L,z,B);let V=M(()=>{k(),T()});return ee(typeof ResizeObserver<`u`&&e?s:null,V),{scrollRef:S,contentRef:C,preparePrepend:E,followLatest:O}},wn=.3,Tn=[.19919472913616398,.010644531250000006,.27920937042459737,.91025390625],En=[.23,1,.32,1],Dn=ge(...Tn),On=ge(...En),kn=.15,An=.1,jn=.08,Mn=e=>({left:e.left,top:e.top,width:e.width,height:e.height}),Nn=e=>Number.parseFloat(e)||0,Pn=(e,t,n)=>e+(t-e)*n,Fn=e=>[e.borderTopLeftRadius,e.borderTopRightRadius,e.borderBottomRightRadius,e.borderBottomLeftRadius],In=e=>{let t=e.getBoundingClientRect(),n=window.getComputedStyle(e),r=t.left+Nn(n.borderLeftWidth)+Nn(n.paddingLeft),i=t.top+Nn(n.borderTopWidth)+Nn(n.paddingTop);return{left:r,top:i,width:t.right-Nn(n.borderRightWidth)-Nn(n.paddingRight)-r,height:t.bottom-Nn(n.borderBottomWidth)-Nn(n.paddingBottom)-i}},Ln=e=>({color:e.color,fontFamily:e.fontFamily,fontSize:e.fontSize,fontWeight:e.fontWeight,fontFeatureSettings:e.fontFeatureSettings,letterSpacing:e.letterSpacing,lineHeight:e.lineHeight,whiteSpace:`pre-wrap`,overflowWrap:`anywhere`}),Rn=(e,t,n=!1)=>{if(!t.value.trim())return null;let r=window.getComputedStyle(e),i=In(t),a=t.parentElement?.querySelector(`[data-composer-highlight]`),o=Ln(window.getComputedStyle(t));return a&&(o.color=window.getComputedStyle(a).color),{compact:n,background:Mn(e.getBoundingClientRect()),backgroundColor:r.backgroundColor,radii:Fn(r),text:t.value,textBox:{...i,top:i.top-t.scrollTop},textStyle:o}},zn=e=>{let t=document.createElement(`div`);return Object.assign(t.style,{position:`absolute`,pointerEvents:`none`,margin:`0px`,...e}),t},Bn=(e,t,n,r)=>(e.style.opacity=String(t),_e(e,{opacity:[t,n]},{duration:r,ease:`linear`})),Vn=(e,t,n=t,r)=>{let i=window.getComputedStyle(t),a=Fn(i),o=Mn(t.getBoundingClientRect()),s=In(t),c=e.compact?{...e.background,left:e.textBox.left-Nn(i.paddingLeft),width:Math.min(e.background.width,Math.max(120,o.width+32))}:e.background,l={left:c.left,top:c.top+c.height-o.height},u={x:e.textBox.left-l.left-(s.left-o.left),y:e.textBox.top-l.top-(s.top-o.top)},d=zn({position:`fixed`,left:`0px`,top:`0px`,overflow:`hidden`,zIndex:`60`,willChange:`transform, width, height`});d.setAttribute(`aria-hidden`,`true`),d.setAttribute(`data-assistant-contact-send-flight`,``),d.style.backgroundColor=e.backgroundColor;let f=zn({...e.textStyle,left:`0px`,top:`0px`,width:`${e.textBox.width}px`});f.textContent=e.text;let p=zn({...Ln(i),left:`0px`,top:`0px`,width:`${s.width}px`});p.textContent=t.textContent??``,d.append(f,p);let m=n=>{let r=Dn(n),i=On(n),m=Mn(t.getBoundingClientRect()),h=c,g=Pn(h.left,m.left,i),_=Pn(h.left+h.width,m.left+m.width,i),v=Pn(h.top+h.height,m.top+m.height,r),y=Pn(h.height,m.height,r),b=v-y;d.style.transform=`translate3d(${g}px, ${b}px, 0)`,d.style.width=`${_-g}px`,d.style.height=`${y}px`,d.style.borderRadius=a.map((t,n)=>`${Pn(Nn(e.radii[n]),Nn(t),r)}px`).join(` `);let x=m.left+(l.left-o.left)*(1-i),S=m.top+(l.top-o.top)*(1-r),C=`translate3d(${x+(s.left-o.left)+u.x*(1-r)-g}px, ${S+(s.top-o.top)+u.y*(1-r)-b}px, 0)`;f.style.transform=C,p.style.transform=C},h=!1,g=[],_=()=>{h||(h=!0,g.forEach(e=>e.stop()),d.remove(),n.style.visibility=``,r?.())};return n.style.visibility=`hidden`,m(0),document.body.appendChild(d),g.push(_e(d,{backgroundColor:[e.backgroundColor,i.backgroundColor]},{duration:kn,ease:`linear`}),Bn(f,1,0,An),Bn(p,0,1,jn),_e(0,1,{duration:wn,ease:`linear`,onUpdate:m,onComplete:_})),_},Hn=64,Un=e=>{if(!e)return[];let t=Array.from(e.files||[]);return t.length>0?t:Array.from(e.items||[]).filter(e=>e.kind===`file`).map(e=>e.getAsFile()).filter(e=>e instanceof File)},Wn=e=>Array.from(e?.files||[]),Gn=async(e,t=p)=>{let n=[],r=0;for(let i of Array.from(e||[])){if(!i||i.size<=0)continue;if(i.size>26214400){r+=1;continue}let e=URL.createObjectURL(i);n.push({id:t(),url:e,name:i.name.trim()||`attachment`,mime:i.type.trim()||`application/octet-stream`,file:i})}return{attachments:n,skippedTooLarge:r}},Kn=(e,t)=>{let n=[...e,...t];for(let e of n.slice(Hn))e.url.startsWith(`blob:`)&&URL.revokeObjectURL(e.url);return n.slice(0,Hn)},qn=ze(()=>T(()=>import(`./ToolOutputDialog-D_CH2A0-.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73]))),Jn=e=>e.trim().startsWith(`yuri.settle.`)||e.trim().startsWith(`oc.settle.`),Yn=e=>e.status===`error`||e.status===`failed`&&e.messageID.endsWith(`:preview:failed`),Xn=e=>e.role===`assistant`&&e.status!==`error`&&e.parts.some(e=>e.type===`text`)?`${e.turnID}:assistant:${e.bubbleIndex}`:e.messageID,Zn=({assistant:e,warning:t,active:n,overlayHeader:r=!1})=>{let{t:i,locale:a}=I(),o=Ve(),s=S(e=>e.isMobile),c=oe(),l=le(),u=W(e.id,n),d=S(e=>e.isSettingsDialogOpen),f=n&&!d&&!u.hasMessageGap?ue(e,u.data):null,m=z(e.name).displayName||e.name,h=pe(me(e.avatarSeed??e.id).color),g=(e,t)=>{let n=e?l.data?.assistants.find(t=>t.id===e):void 0;return n?z(n.name).displayName||n.name:t||i(`assistants.contact.peer.unknown`)},[_,v]=Q.useState(``),[y,b]=Q.useState([]),x=Q.useRef(new Map),C=Q.useRef(new Map),w=Q.useRef(new AbortController);Q.useEffect(()=>{let e=new AbortController;return w.current=e,()=>e.abort()},[e.id,o]);let T=Q.useRef(new Set),[E,D]=Q.useState([]);Q.useEffect(()=>{let e=new Set(y.map(e=>e.url));for(let t of x.current.values())for(let n of t.attachments)e.add(n.url);for(let t of T.current)e.has(t)||URL.revokeObjectURL(t);T.current=e},[y,E]),Q.useEffect(()=>()=>{for(let e of T.current)URL.revokeObjectURL(e)},[]);let[O,k]=Q.useState([]),[A,j]=Q.useState(null),[ee,ne]=Q.useState({open:!1,title:``,content:``}),P=S(e=>e.setImagePreviewOpen),re=M(e=>{(e.image||e.mermaid||e.video)&&(ne(e),P(!0))}),ie=M(e=>{ne(t=>({...t,open:e})),P(e)});Q.useEffect(()=>()=>{P(!1)},[P]),Q.useEffect(()=>{C.current.clear(),x.current.clear(),D([]),k([]),j(null)},[o]);let L=Q.useMemo(()=>Pt(),[]),R=Q.useRef(new Set),V=Q.useRef(new Map),H=Rt(e=>e.setWorking),K=u.data?.messages??gt,ce=Q.useMemo(()=>K.some(e=>e.parts.some(e=>e.type===`card`&&e.cardType===`schedule`&&tn(e))),[K]),de=U(e.id,n&&ce),fe=Q.useMemo(()=>{let e=new Map;for(let t of de.data?.tasks??[]){if(!t.task)continue;let n=e.get(t.projectID);n||(n=new Map,e.set(t.projectID,n)),n.set(t.taskID,t.task)}return e},[de.data]),he=yt(E,e.id),ge=bt(O,e.id),_e=Ct(K,he,e.id,ge).filter(e=>{if(e.status===`admitted`&&e.messageID.endsWith(`:preview:admitted`))return!1;let t=Array.isArray(e.parts)?e.parts:[];return t.length===0||t.some(e=>!(e.type===`text`&&Jn(e.text)))}),ye=_e.length-1;for(;ye>=0&&Yn(_e[ye]);)--ye;let be=_e.filter((e,t)=>!Yn(e)||t>ye),xe=mn(be),Se=ve(),J=`${o}:${e.id}`,Ce=Q.useRef(null),we=Ce.current,Te=we?.lastID?be.findIndex(e=>Xn(e)===we.lastID):-1,Ee=n&&!Se&&we?.scope===J&&we.ready&&(we.lastID===null||Te>=0);Q.useLayoutEffect(()=>{let e=be.at(-1);Ce.current={scope:J,ready:n&&u.isSuccess,lastID:e?Xn(e):null}});let De=new Date().toDateString(),Oe=i(`common.date.today`),ke=Q.useMemo(()=>hn(a,Oe,new Date(De)),[a,Oe,De]),Y=It(he),Ae=Lt(ge),X=!!(e.working||e.activeContactTurn),je=l.data?.revision??null,Me=ge.reduce((e,t)=>e+t.bubbles.reduce((e,t)=>e+t.text.length,0),0),Ne=new Map(ge.map(e=>[e.turnID,e])),Pe=Q.useRef(!1),Fe=M(async(e=!1)=>{if(!(!n||Pe.current||u.isFetchingPreviousPage||u.isFillingMessageGap)&&!(e&&u.previousPageError)&&!(!u.hasPreviousPage&&!u.hasMessageGap)){Pe.current=!0,Re();try{u.hasMessageGap?await u.retryMessageGap():await u.fetchPreviousPage()}catch{}finally{Pe.current=!1}}}),{scrollRef:Ie,contentRef:Le,preparePrepend:Re,followLatest:ze}=Cn({active:n,assistantID:e.id,contentRevision:`${be[0]?.messageID}:${be.length}:${Me}:${u.isFetchingPreviousPage}:${u.hasPreviousPage}:${u.isFillingMessageGap}`,onLoadEarlier:()=>{Fe(!0)}}),He=Q.useRef(null),Ue=Q.useRef(null),We=Q.useRef(null),Ge=Q.useRef(null),Je=Q.useRef(null),[Ye,Z]=Q.useState(null),Ze=()=>{let e=Ue.current?.querySelector(`[data-assistant-contact-composer-surface]`),t=e?.querySelector(`textarea`);return e&&t?Rn(e,t,!s):null};Q.useLayoutEffect(()=>{let e=We.current;if(!e)return;We.current=null;let t=Array.from(He.current?.querySelectorAll(`[data-message-id]`)??[]).find(t=>t.dataset.messageId===e.messageID)?.querySelector(`[data-assistant-contact-text]`),n=()=>Z(t=>t?.messageID===e.messageID?null:t);if(!t){n();return}Je.current?.(),Je.current=Vn(e.source,t,t,n)}),Q.useEffect(()=>()=>{We.current=null,Je.current?.(),Je.current=null},[n,e.id,o]),Q.useEffect(()=>{j(null),x.current.clear(),C.current.clear(),R.current.clear(),V.current=new Map,D(t=>yt(t,e.id)),k(t=>bt(t,e.id)),ne({open:!1,title:``,content:``}),P(!1)},[e.id,P]),Q.useEffect(()=>{for(let e of K){let t=x.current.get(e.messageID);if(t){for(let e of t.attachments)C.current.delete(`${t.assistantID}:${e.id}`);x.current.delete(e.messageID)}}D(e=>wt(e,K))},[K]),Q.useEffect(()=>{let t=new Set(he.filter(e=>e.status===`sending`).map(e=>e.messageID));k(n=>Ot(n,{assistantID:e.id,activeContactTurn:e.activeContactTurn?{turnID:e.activeContactTurn.turnID,admittedAt:e.activeContactTurn.admittedAt}:null,serverWorking:X,snapshotRevision:je,admissionRevisionByTurnID:V.current,pendingSendTurnIDs:t,messages:K,settledTurnIDs:R.current}))},[e.activeContactTurn,e.id,K,he,X,je]),Q.useEffect(()=>{H(e.id,Y||Ae||X)},[e.id,Ae,Y,X,H]),Q.useEffect(()=>{let t=e.id;return()=>{H(t,!1)}},[e.id,H]);let Qe=M(t=>{if(!(!(`assistantID`in t)||t.assistantID!==e.id)){if(t.type===`contact-turn-start`){R.current.delete(t.turnID),k(e=>Et(e,t.assistantID,t.turnID,t.occurredAt));return}if(t.type===`contact-bubble-delta`){if(R.current.has(t.turnID))return;k(e=>kt(e,t));return}t.type===`contact-turn-end`&&(R.current.add(t.turnID),k(e=>jt(At(e,t,{requireExisting:!0}),K)))}});Q.useEffect(()=>{if(n)return te(Qe)},[n,e.id]);let $e=M(async e=>{if(Y)return;let t=w.current,n=await Gn(e);if(t.signal.aborted){n.attachments.forEach(e=>URL.revokeObjectURL(e.url));return}n.skippedTooLarge>0&&j(i(`assistants.contact.attachment.tooLarge`)),n.attachments.length!==0&&b(e=>Kn(e,n.attachments))}),et=M(e=>{let t=Un(e.clipboardData);t.length!==0&&(e.preventDefault(),$e(t))}),tt=M(e=>{Array.from(e.dataTransfer?.types??[]).includes(`Files`)&&(e.preventDefault(),e.dataTransfer.dropEffect=`copy`)}),nt=M(e=>{let t=Wn(e.dataTransfer);t.length!==0&&(e.preventDefault(),$e(t))}),rt=M(async(t,r)=>{let a=w.current,o=e.id,s=r?x.current.get(r):void 0;if(r&&(!s||s.assistantID!==o))return;let l=s?.text??t??_,u=s?.attachments??y,d=Ft({gate:L,sending:It(he),text:l,attachments:u,assistantID:o,createMessageID:()=>r||`yuri_contact_${p()}`});if(!d.ok)return;H(o,!0),x.current.set(d.messageID,{assistantID:o,text:l,attachments:u});let f=u.length===0&&t===void 0&&!r&&n&&!Se?Ze():null;We.current=f?{messageID:d.messageID,source:f}:null,Z(f?{scope:J,messageID:d.messageID}:null),Ge.current=f?d.messageID:Ge.current,r||(ze(f?{duration:wn,ease:Tn}:void 0),v(e=>e===l?``:e),b(e=>e.filter(e=>!u.includes(e)))),D(e=>e.some(e=>e.messageID===d.messageID)?e.map(e=>e.messageID===d.messageID?{...d.turn,createdAt:e.createdAt}:e):[...e,d.turn]),j(null);let h=()=>{u.forEach(e=>C.current.delete(`${o}:${e.id}`)),x.current.delete(d.messageID)};try{let t=[];for(let e of u){let n=`${o}:${e.id}`,r=C.current.get(n);if(!r){if(r=await qe(o,e.file,e.id,a.signal),a.signal.aborted)return;C.current.set(n,r)}t.push(r)}if(a.signal.aborted)return;let n=[...d.parts.filter(e=>e.type===`text`),...t];D(e=>e.map(e=>e.messageID===d.messageID?{...e,parts:n}:e));let r=await ae(o,d.messageID,{parts:n});if(a.signal.aborted)return;h(),typeof r.revision==`number`&&V.current.set(d.messageID,r.revision),D(e=>Tt(e,d.messageID)),R.current.has(d.messageID)||k(e=>Et(e,o,d.messageID)),c.data?.serverInstanceID&&B({serverInstanceID:c.data.serverInstanceID,assistantID:o,name:m,avatarSeed:e.avatarSeed??o}).catch(()=>void 0)}catch(e){if(a.signal.aborted)return;if(e instanceof G&&e.code===`admission_timeout`)try{let e=await se(o,d.messageID);if(a.signal.aborted)return;if(e){h(),typeof e.revision==`number`&&V.current.set(d.messageID,e.revision),D(e=>Tt(e,d.messageID)),R.current.has(d.messageID)||k(e=>Et(e,o,d.messageID));return}}catch{}let t=Nt(e,{noProvider:i(`assistants.contact.noProvider`),sendFailed:i(`assistants.contact.sendFailed`),timedOut:i(`assistants.contact.timedOut`)});D(e=>Mt(e,d.messageID,t))}finally{L.release()}}),it=M(e=>{rt(void 0,e)}),at=u.isError&&be.length===0,ot=u.isSuccess&&be.length===0,ct=new Map(he.map(e=>[e.messageID,e]));return(0,$.jsxs)(`div`,{ref:He,className:`flex min-h-0 flex-1 flex-col bg-background`,children:[(0,$.jsxs)(`div`,{ref:Ie,className:N(`min-h-0 flex-1 overflow-x-hidden overflow-y-auto px-4 sm:px-8`,s&&`pb-11`,r?`pt-[calc(max(0.625rem,var(--yuri-safe-area-top,0px))+var(--yuri-mobile-detail-navigation-height)+1.25rem)]`:`pt-5 sm:pt-7`),style:{overflowAnchor:`none`,overscrollBehavior:`contain`,overscrollBehaviorY:`contain`},"data-assistant-contact-transcript":``,children:[t?(0,$.jsx)(`p`,{className:`mb-3 typography-micro text-[var(--status-warning)]`,children:t}):null,at?(0,$.jsxs)(`div`,{ref:Le,className:`mx-auto flex h-full min-h-56 max-w-xs flex-col items-center justify-center pb-16 text-center`,"data-assistant-contact-error":``,children:[(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(Vt,{name:e.id,avatarSeed:e.avatarSeed,size:44,label:m,working:n?X:void 0,showWorkingDot:!1,followPointer:!1}),(0,$.jsx)(`span`,{"aria-hidden":!0,className:`absolute -right-1 -bottom-1 flex size-5 items-center justify-center rounded-full bg-[var(--surface-elevated)] text-[var(--status-error)] ring-2 ring-background`,children:(0,$.jsx)(q,{name:`error-warning`,className:`size-3`})})]}),(0,$.jsx)(`p`,{className:`mt-4 typography-ui-label font-medium text-foreground`,children:m}),(0,$.jsx)(`p`,{className:`mt-1.5 typography-ui leading-6 text-muted-foreground`,children:i(`assistants.contact.loadFailed`)}),(0,$.jsx)(F,{type:`button`,size:`sm`,variant:`ghost`,onClick:()=>void u.refetch(),children:i(`chat.history.retry`)})]}):ot?(0,$.jsxs)(`div`,{ref:Le,className:`mx-auto flex h-full min-h-56 max-w-sm flex-col items-center justify-center pb-16 text-center`,"data-assistant-contact-empty":``,children:[(0,$.jsx)(Vt,{name:e.id,avatarSeed:e.avatarSeed,size:48,label:m,className:`opacity-90`,working:n?X:void 0,showWorkingDot:!1,followPointer:!1}),(0,$.jsx)(`p`,{className:`mt-5 typography-ui-header font-medium tracking-[-0.01em] text-foreground`,children:i(`assistants.conversation.emptyTitle`,{name:m})}),(0,$.jsx)(`p`,{className:`mt-2 max-w-xs typography-ui leading-6 text-muted-foreground/80`,children:i(`assistants.contact.empty`)})]}):(0,$.jsxs)(`div`,{ref:Le,className:`relative mx-auto flex w-full max-w-[42rem] flex-col pb-12`,"data-assistant-contact-content":``,children:[u.isPending?(0,$.jsx)(`p`,{role:`status`,className:`py-3 text-center typography-micro text-muted-foreground`,children:i(`common.loading`)}):null,u.hasPreviousPage||u.hasMessageGap?(0,$.jsxs)(`div`,{className:`mb-3 flex flex-col items-center gap-1`,"data-assistant-contact-pagination":``,"aria-busy":u.isFetchingPreviousPage||u.isFillingMessageGap,children:[u.previousPageError?(0,$.jsx)(`p`,{role:`alert`,className:`typography-micro text-[var(--status-error)]`,children:i(`chat.history.loadOlderFailed`)}):null,u.hasMessageGap?(0,$.jsx)(`p`,{role:`status`,className:`typography-micro text-muted-foreground`,children:i(`assistants.contact.history.gap`)}):null,(0,$.jsx)(F,{type:`button`,size:`sm`,variant:`ghost`,disabled:u.isFetchingPreviousPage||u.isFillingMessageGap,onClick:()=>void Fe(),children:i(u.isFetchingPreviousPage||u.isFillingMessageGap?`chat.history.loadingMore`:u.previousPageError||u.hasMessageGap?`chat.history.retry`:`chat.history.loadOlder`)})]}):null,be.map((t,r)=>{let a=`${J}:${Xn(t)}`,c=r>0?be[r-1]:null,u=xe.get(t.messageID),d=u!==void 0,p=d?(0,$.jsx)(`div`,{className:`flex w-full justify-center px-4 pt-7 pb-4 first:pt-1`,"data-assistant-contact-time":``,children:(0,$.jsx)(`time`,{dateTime:new Date(u).toISOString(),className:`text-[11px] font-normal leading-4 tabular-nums text-muted-foreground/70`,children:ke(u)})}):null,_=t.role===`user`,v=t.role===`peer`,y=t.role===`assistant`&&!d&&c?.role===`assistant`&&c.turnID===t.turnID,b=c?.turnID!==t.turnID,x=!_&&(v||!y),S=v?g(t.fromAssistantID,t.fromAssistantName):m,C=v&&t.fromAssistantID?l.data?.assistants.find(e=>e.id===t.fromAssistantID):e,w=ct.get(t.messageID),T=Ne.get(t.turnID),E=t.status===`failed`&&t.messageID.endsWith(`:preview:failed`),D=(e,t)=>_?(0,$.jsx)(ht,{failedTurn:n?w:void 0,retryDisabled:Y,onRetry:it,children:e},t):e;return t.status===`error`||E?(0,$.jsxs)(Q.Fragment,{children:[p,(0,$.jsxs)(`div`,{"data-message-id":t.messageID,"data-assistant-contact-error":``,className:N(`relative px-1`,!d&&`mt-3`),children:[(0,$.jsx)(`p`,{role:`alert`,className:`whitespace-pre-wrap text-center text-[11px] font-normal leading-4 text-muted-foreground [overflow-wrap:anywhere]`,children:t.text||T?.error||i(`assistants.contact.sendFailed`)}),f?.messageID===t.messageID?(0,$.jsx)(Xe,{assistantID:e.id,position:f},`${o}:${e.id}:${f.generation}:${f.ordinal}`):null]})]},a):(0,$.jsxs)(Q.Fragment,{children:[p,(0,$.jsxs)(Ke.div,{"data-message-id":t.messageID,initial:Ee&&r>Te&&t.messageID!==Ge.current?{opacity:0,y:4}:!1,animate:{opacity:1,y:0},transition:{duration:Se?0:.18,ease:`easeOut`},className:N(`flex w-full`,_?`justify-end`:`justify-start`,d?`mt-0`:b?`mt-6 first:mt-0`:y?`mt-1.5`:`mt-3`),"data-assistant-contact-role":t.role,"data-assistant-contact-turn-status":w?.status??t.status,"data-assistant-contact-run-start":t.role===`assistant`&&!y?``:void 0,children:[_?null:(0,$.jsx)(`div`,{className:`mr-2.5 flex w-9 shrink-0 justify-center pt-0.5`,children:x?(0,$.jsx)(Vt,{name:C?.id||t.fromAssistantID||e.id,avatarSeed:C?.avatarSeed??(t.fromAssistantID?void 0:e.avatarSeed),size:32,label:S,working:n?!!(C?.working||C?.activeContactTurn):void 0,showWorkingDot:!1,followPointer:!1}):(0,$.jsx)(`span`,{className:`size-8`,"aria-hidden":!0})}),(0,$.jsxs)(`div`,{className:N(`relative flex min-w-0 flex-col gap-1.5`,_?`max-w-[min(82%,30rem)] items-end`:`max-w-[min(84%,34rem)] items-start`),children:[v?(0,$.jsx)(`span`,{className:`mb-0.5 px-1 typography-micro text-muted-foreground/75`,children:i(`assistants.contact.peer.from`,{name:S})}):null,t.parts.map((r,o)=>{if(r.type===`card`&&r.cardType===`session`)return(0,$.jsx)(dn,{card:r},`${a}:card:${o}`);if(r.type===`card`&&r.cardType===`assistant`)return(0,$.jsx)(Zt,{card:r,assistant:l.data?.assistants.find(e=>e.id===r.assistantID),active:n},`${a}:card:${o}`);if(r.type===`card`&&r.cardType===`schedule`)return(0,$.jsx)(on,{card:r,task:fe.get(r.projectID)?.get(r.taskID)},`${a}:card:${o}`);if(r.type===`file`)return D((0,$.jsx)(pt,{assistantID:e.id,part:r,onShowPopup:re},`${a}:file:${o}`),`${a}:file:${o}`);if(r.type===`text`&&Jn(r.text))return null;if(r.type===`text`&&(r.text.trim()||t.status===`streaming`)){let e=!_,n=e&&/^!\[(?:\\.|[^\]\\\n])*\]\(\s*(?:<[^>\n]+>|[^\s()]+)(?:\s+"[^"\n]*")?\s*\)$/.test(r.text.trim());return D((0,$.jsx)(`div`,{"aria-label":v?i(`assistants.contact.peer.aria`,{name:S}):void 0,"data-assistant-contact-text":``,"data-assistant-contact-media":n||void 0,style:_?{backgroundColor:h.background,color:h.foreground}:void 0,className:N(`min-w-0 max-w-full [overflow-wrap:anywhere] rounded-[1.35rem] typography-markdown leading-6`,s&&!n&&`touch-manipulation [-webkit-user-select:all] [user-select:all]`,n?`p-0`:`px-4 py-2.5`,e?null:`whitespace-pre-wrap`,n?`text-foreground`:_?`rounded-[1.15rem] rounded-br-lg`:v?`rounded-[1.25rem] border border-dashed border-border/50 bg-[var(--surface-muted)]/70 text-foreground`:`bg-[var(--surface-muted)] text-foreground`),children:e?(0,$.jsx)(Be,{content:r.text,messageId:a,isAnimated:!1,isStreaming:t.status===`streaming`,variant:`assistant`,enableFileReferences:!1,onShowPopup:re,className:`w-full min-w-0 [overflow-wrap:anywhere]`}):r.text},`${a}:text:${o}`),`${a}:text:${o}`)}return null}),w?.status===`sending`?(0,$.jsx)(`p`,{className:`absolute right-1 top-full mt-1 typography-micro text-muted-foreground/75`,children:i(`assistants.contact.sending`)}):null,f?.messageID===t.messageID?(0,$.jsx)(Xe,{assistantID:e.id,position:f},`${o}:${e.id}:${f.generation}:${f.ordinal}`):null]})]})]},a)}),(0,$.jsx)(`div`,{className:`pointer-events-none absolute bottom-1 left-[2.875rem] flex h-10 items-center`,"data-assistant-contact-status-slot":``,children:!Y&&Ye?.scope!==J&&(Ae||X)?(0,$.jsxs)(Ke.div,{role:`status`,"aria-label":i(`assistants.contact.processing`),initial:!Se&&{opacity:0,scale:.8},animate:{opacity:1,scale:1},transition:{duration:Se?0:.18,ease:`easeOut`},className:`relative inline-flex h-9 origin-bottom-left items-center gap-1 rounded-[1.35rem] bg-[var(--surface-muted)] px-4 text-muted-foreground/70`,"data-assistant-contact-processing":``,children:[(0,$.jsx)(`div`,{className:`absolute -left-[2.875rem] top-0.5 flex w-9 justify-center`,"data-assistant-contact-processing-avatar":``,children:(0,$.jsx)(Vt,{name:e.id,avatarSeed:e.avatarSeed,size:32,label:m,working:n?X:void 0,showWorkingDot:!1,followPointer:!1})}),(0,$.jsx)(`span`,{"aria-hidden":!0,className:`size-1.5 animate-pulse rounded-full bg-current [animation-delay:-0.45s] [animation-duration:1.4s] motion-reduce:animate-none`}),(0,$.jsx)(`span`,{"aria-hidden":!0,className:`size-1.5 animate-pulse rounded-full bg-current [animation-delay:-0.22s] [animation-duration:1.4s] motion-reduce:animate-none`}),(0,$.jsx)(`span`,{"aria-hidden":!0,className:`size-1.5 animate-pulse rounded-full bg-current [animation-duration:1.4s] motion-reduce:animate-none`})]}):null})]})]}),(0,$.jsxs)(`footer`,{ref:Ue,className:`relative z-10 shrink-0 bg-background pt-1`,"data-assistant-contact-composer":``,children:[A?(0,$.jsx)(`div`,{className:`chat-input-column mb-2`,children:(0,$.jsx)(`p`,{role:`alert`,className:`typography-micro text-[var(--status-error)]`,children:A})}):null,(0,$.jsx)(`form`,{className:N(`relative w-full pt-1.5 pb-4`,s&&`bottom-safe-area yuri-mobile-composer`),onSubmit:e=>{e.preventDefault(),rt()},onDragOver:tt,onDrop:nt,children:(0,$.jsx)(`div`,{className:`chat-input-column relative overflow-visible`,children:(0,$.jsx)(st,{active:n,layout:`inline`,value:_,attachments:y,pending:Y,isMobile:s,placeholder:i(`assistants.contact.placeholder`,{name:m}),sendLabel:i(`assistants.contact.send`),addFilesLabel:i(`assistants.contact.addFiles`),removeAttachmentLabel:i(`assistants.contact.removeAttachment`),fileAccept:`*/*`,onChange:e=>v(e),onVoiceSend:e=>{rt(e)},onSubmit:()=>{rt()},onAddFiles:e=>{$e(e)},onRemoveAttachment:t=>{Y||(C.current.delete(`${e.id}:${t}`),b(e=>e.filter(e=>e.id!==t)))},onPaste:et,onDragOver:tt,onDrop:nt,className:N(`relative z-10`,s&&`yuri-mobile-composer-surface`),style:{borderRadius:`1.5rem`},"data-assistant-contact-composer-surface":``,textareaProps:{"aria-label":i(`assistants.contact.placeholder`,{name:m})}},`${o}:${e.id}`)})})]}),ee.open?(0,$.jsx)(Q.Suspense,{fallback:null,children:(0,$.jsx)(qn,{popup:ee,onOpenChange:ie,isMobile:s})}):null]})},Qn=e=>{for(let t=e.messages.length-1;t>=0;t--){let n=e.messages[t];if(n.parts.some(H)&&Number.isFinite(new Date(n.createdAt).getTime()))return{timestamp:n.createdAt,empty:!1}}return{timestamp:void 0,empty:e.generation>=0&&e.olderComplete&&!e.hasMessageGap}},$n=(e,t)=>{let n=(0,Z.c)(5),r;n[0]!==e||n[1]!==t?(r=K(e,t),n[0]=e,n[1]=t,n[2]=r):r=n[2];let i;return n[3]===r?i=n[4]:(i={...r,enabled:!1,select:Qn},n[3]=r,n[4]=i),w(i)},er=Q.memo(e=>{let t=(0,Z.c)(17),{assistantID:n,serverWorking:r,lastContactAt:i}=e,{t:a,locale:o}=I(),s=Bt(n,r),c=$n(n,Ve()),l;t[0]!==c||t[1]!==i?(l=i!==void 0&&Number.isFinite(new Date(i).getTime())?i:c.data?.timestamp,t[0]=c,t[1]=i,t[2]=l):l=t[2];let u=l,d;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=new Date().toDateString(),t[3]=d):d=t[3];let f=d,p;t[4]===a?p=t[5]:(p=a(`common.date.today`),t[4]=a,t[5]=p);let m=p,h;bb0:{if(u===void 0){h=null;break bb0}let e;t[6]!==o||t[7]!==u||t[8]!==m?(e=hn(o,m,new Date(f))(u),t[6]=o,t[7]=u,t[8]=m,t[9]=e):e=t[9],h=e}let g=h,_;t[10]!==c||t[11]!==g||t[12]!==a||t[13]!==s?(_=s?a(`assistants.conversation.typing`):g?a(`assistants.conversation.lastContact`,{time:g}):c.data?.empty?a(`assistants.conversation.neverContacted`):c.isError?a(`assistants.contact.loadFailed`):a(`common.loading`),t[10]=c,t[11]=g,t[12]=a,t[13]=s,t[14]=_):_=t[14];let v=_,y;return t[15]===v?y=t[16]:(y=(0,$.jsx)(`span`,{className:`mt-1 block truncate typography-micro font-normal leading-4 text-muted-foreground/70`,"aria-live":`polite`,title:v,children:v}),t[15]=v,t[16]=y),y});export{Bt as a,Vt as i,Zn as n,Ut as r,er as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{ot as e}from"./vendor-base-ui-CzHs0bHY.js";import{n as t}from"./vendor-react-DlzBev0S.js";import{Jn as n,Va as r}from"./useMobileNavigationStore-SCjA_7jP.js";import{y as i}from"./MobileDetailNavigation-CXcMdlRH.js";function a(e){return[...e].sort((e,t)=>{let n=e.latestMessagePreview?.createdAt??-1/0,r=t.latestMessagePreview?.createdAt??-1/0;return n===r?0:r-n})}function o(e){let t;for(let n of e)n.pinnedAt!=null&&(!t||n.pinnedAt>t.pinnedAt)&&(t=n);return{pinned:t?[t]:[],unpinned:a(e.filter(e=>e!==t))}}var s=t(),c=e();function l(e){let t=(0,s.c)(10),{count:i,className:a}=e,{t:o}=r();if(!(i>0))return null;let l;t[0]===a?l=t[1]:(l=n(`inline-flex h-[18px] min-w-[18px] shrink-0 items-center justify-center rounded-full bg-[var(--status-info)] px-1.5 typography-micro font-semibold leading-none text-[var(--status-info-foreground)] tabular-nums shadow-[inset_0_0_0_1px_color-mix(in_srgb,var(--status-info-foreground)_15%,transparent)]`,a),t[0]=a,t[1]=l);let u;t[2]!==i||t[3]!==o?(u=o(`assistants.unread.label`,{count:i}),t[2]=i,t[3]=o,t[4]=u):u=t[4];let d=i>99?`99+`:i,f;return t[5]!==i||t[6]!==l||t[7]!==u||t[8]!==d?(f=(0,c.jsx)(`span`,{className:l,"aria-label":u,"data-assistant-unread-count":i,children:d}),t[5]=i,t[6]=l,t[7]=u,t[8]=d,t[9]=f):f=t[9],f}function u(e){let t=(0,s.c)(3),{className:n}=e,r=i(),a;return t[0]!==n||t[1]!==r?(a=(0,c.jsx)(l,{count:r,className:n}),t[0]=n,t[1]=r,t[2]=a):a=t[2],a}export{a as i,l as n,o as r,u as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e,r as t}from"./rolldown-runtime-hePW80VL.js";import{c as n,w as r}from"./runtime-auth-Bh3htXtG.js";import{c as i,i as a,t as o}from"./runtime-switch-ibQIZnws.js";import{n as s,y as c}from"./desktop-Brp3xDpd.js";import{ot as l,st as u}from"./vendor-base-ui-CzHs0bHY.js";import{r as d}from"./useUIStore-BsCfUWQw.js";import{n as f}from"./vendor-react-DlzBev0S.js";import{n as p}from"./vendor-tanstack-react-query-B-Wpqq5J.js";import{r as m}from"./vendor-sonner-BEHGipm5.js";import{r as h}from"./vendor-reactuses-core-CuTmqEMK.js";import{Jn as g,Kn as _,Va as v}from"./useMobileNavigationStore-SCjA_7jP.js";import{i as y}from"./MobileShareBridge-DfgyncNh.js";import{a as b,h as x,l as S,m as C,s as w,t as T,v as E}from"./MobileDetailNavigation-CXcMdlRH.js";import{i as D,r as O}from"./useAssistantUIStore-CVSFSgJV.js";import{n as k}from"./Icon-DsN23fuV.js";import{a as A,i as j,n as M,o as N,r as P,t as F}from"./dialog-CgtwKUKd.js";import{r as ee}from"./device-Db_TcRdX.js";import{E as te}from"./sessionLookup-D2JIMvDo.js";import{a as ne,i as re,n as ie,t as ae}from"./AssistantContactStatus-C5zpVdGa.js";import{n as I,r as oe}from"./AssistantUnreadBadge-7KpCtnd3.js";import{a as L,i as se,n as ce,r as R,t as z}from"./context-menu-DFRg1NJF.js";var B=t(u(),1),V=f(),le=()=>s()&&!r(),ue=async e=>{if(!le())throw Error(`Assistant Mini Chat requires a direct desktop connection`);await c(`desktop_open_assistant_mini_chat_window`,{assistantID:e,apiBaseUrl:o(),clientToken:n()})},H=l();function U(e){let t=(0,V.c)(49),{assistant:n,trigger:r,onEdit:i,onDelete:o,doubleClickMiniChat:s}=e,c=s!==void 0&&s,{t:l}=v(),u;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=a(),t[0]=u):u=t[0];let d;t[1]===n.id?d=t[2]:(d=[u,`assistants`,n.id,`pin`],t[1]=n.id,t[2]=d);let f;t[3]===n?f=t[4]:(f=()=>C(n,{pinned:n.pinnedAt==null}),t[3]=n,t[4]=f);let h;t[5]===l?h=t[6]:(h=()=>m.error(l(`assistants.menu.pinError`)),t[5]=l,t[6]=h);let g;t[7]!==d||t[8]!==f||t[9]!==h?(g={mutationKey:d,mutationFn:f,onError:h},t[7]=d,t[8]=f,t[9]=h,t[10]=g):g=t[10];let _=p(g),y;t[11]!==n.id||t[12]!==l?(y=()=>{ue(n.id).catch(()=>m.error(l(`miniChat.actions.failed`)))},t[11]=n.id,t[12]=l,t[13]=y):y=t[13];let b=y,x=r,S;t[14]!==x||t[15]!==c||t[16]!==b||t[17]!==r?(S=c?B.cloneElement(x,{onDoubleClick:e=>{x.props.onDoubleClick?.(e),!e.defaultPrevented&&le()&&b()}}):r,t[14]=x,t[15]=c,t[16]=b,t[17]=r,t[18]=S):S=t[18];let w;t[19]===S?w=t[20]:(w=(0,H.jsx)(L,{render:S}),t[19]=S,t[20]=w);let T;t[21]!==n.pinnedAt||t[22]!==_||t[23]!==l?(T=n.pinnedAt===void 0?null:(0,H.jsxs)(R,{disabled:_.isPending,onClick:()=>_.mutate(),children:[(0,H.jsx)(k,{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]=_,t[23]=l,t[24]=T):T=t[24];let E;t[25]!==b||t[26]!==l?(E=le()?(0,H.jsxs)(R,{onClick:b,children:[(0,H.jsx)(k,{name:`external-link`,className:`size-4`}),l(`sessions.sidebar.session.menu.openMiniChatWindow`)]}):null,t[25]=b,t[26]=l,t[27]=E):E=t[27];let D;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,H.jsx)(k,{name:`edit`,className:`size-4`}),t[28]=D):D=t[28];let O;t[29]===l?O=t[30]:(O=l(`assistants.menu.edit`),t[29]=l,t[30]=O);let A;t[31]!==i||t[32]!==O?(A=(0,H.jsxs)(R,{onClick:i,children:[D,O]}),t[31]=i,t[32]=O,t[33]=A):A=t[33];let j;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,H.jsx)(se,{}),t[34]=j):j=t[34];let M;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,H.jsx)(k,{name:`delete-bin`,className:`size-4 text-inherit`}),t[35]=M):M=t[35];let N;t[36]===l?N=t[37]:(N=l(`assistants.settings.delete`),t[36]=l,t[37]=N);let P;t[38]!==o||t[39]!==N?(P=(0,H.jsxs)(R,{onClick:o,className:`text-[var(--status-error)] focus:text-[var(--status-error)] data-[highlighted]:text-[var(--status-error)]`,children:[M,N]}),t[38]=o,t[39]=N,t[40]=P):P=t[40];let F;t[41]!==T||t[42]!==E||t[43]!==A||t[44]!==P?(F=(0,H.jsxs)(ce,{className:`min-w-[10rem]`,children:[T,E,A,j,P]}),t[41]=T,t[42]=E,t[43]=A,t[44]=P,t[45]=F):F=t[45];let ee;return t[46]!==F||t[47]!==w?(ee=(0,H.jsxs)(z,{children:[w,F]}),t[46]=F,t[47]=w,t[48]=ee):ee=t[48],ee}function de(e){let t=(0,V.c)(38),{assistant:n,selected:r,onSelect:i,onEdit:a,onDelete:o}=e,s=B.useRef(null),c=ne(n.id,n.working),l;t[0]===n.name?l=t[1]:(l=y(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,m;t[8]!==n.id||t[9]!==i?(m=()=>i(n.id),t[8]=n.id,t[9]=i,t[10]=m):m=t[10];let h=r?`bg-[var(--surface-muted)]`:`hover:bg-interactive-hover`,_;t[11]===h?_=t[12]:(_=g(`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`,h),t[11]=h,t[12]=_);let v;t[13]!==n.avatarSeed||t[14]!==n.id||t[15]!==u||t[16]!==c?(v=(0,H.jsx)(re,{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 b=n.unreadCount??0,x;t[18]===b?x=t[19]:(x=(0,H.jsx)(I,{count:b,className:`absolute -right-1 -top-1`}),t[18]=b,t[19]=x);let S;t[20]!==x||t[21]!==v?(S=(0,H.jsxs)(`span`,{className:`relative`,children:[v,x]}),t[20]=x,t[21]=v,t[22]=S):S=t[22];let C;t[23]===u?C=t[24]:(C=(0,H.jsx)(`span`,{className:`w-full truncate typography-ui-label font-medium leading-5`,children:u}),t[23]=u,t[24]=C);let w;t[25]!==n.id||t[26]!==u||t[27]!==r||t[28]!==S||t[29]!==C||t[30]!==m||t[31]!==_?(w=(0,H.jsxs)(`button`,{ref:s,type:`button`,role:`option`,"aria-selected":r,title:u,"data-assistant-pinned":p,"data-mobile-press-feedback":`soft`,onClick:m,className:_,children:[S,C]}),t[25]=n.id,t[26]=u,t[27]=r,t[28]=S,t[29]=C,t[30]=m,t[31]=_,t[32]=w):w=t[32];let T;return t[33]!==n||t[34]!==w||t[35]!==d||t[36]!==f?(T=(0,H.jsx)(U,{assistant:n,doubleClickMiniChat:!0,onEdit:d,onDelete:f,trigger:w}),t[33]=n,t[34]=w,t[35]=d,t[36]=f,t[37]=T):T=t[37],T}function fe(e){let t=(0,V.c)(16),{contacts:n,selectedAssistantID:r,onSelect:i,onEdit:a,onDelete:o}=e,{t:s}=v();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,H.jsx)(de,{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,H.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 pe({snapshot:e,rowClassName:t,compact:n=!1,mobile:r=!1}){let{t:i}=v(),[a,o]=B.useState(!1),s=B.useRef(!1),c=h(async()=>{if(!s.current){s.current=!0,o(!0);try{(await S(e)).failed&&m.error(i(`assistants.unread.markAllFailed`))}catch{m.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,H.jsx)(`div`,{className:t,style:n&&!l?{visibility:`hidden`}:void 0,children:(0,H.jsx)(_,{type:`button`,variant:r?`mobileGlass`:`ghost`,size:r?`mobileIcon`:`icon`,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,H.jsx)(k,{name:`check-double`,className:r?`size-5`:`size-4`})})})}async function me(e){await b(e);let t=D.getState().defaultShareAssistant;if(t?.assistantID!==e.id)return;let n=await w();n.serverInstanceID&&t.serverInstanceID===n.serverInstanceID&&D.getState().setDefaultShareAssistant(null)}function he({assistant:e,open:t,onOpenChange:n,onDeleted:r}){let{t:i}=v(),[a,o]=B.useState(!1),s=e?y(e.name).displayName||e.name:``,c=h(e=>{a&&!e||n(e)}),l=h(()=>{a||n(!1)}),u=h(async()=>{if(!(!e||a)){o(!0);try{await me(e),r?.(e.id),n(!1),m.success(i(`assistants.settings.toast.deleted`))}catch{m.error(i(`assistants.settings.toast.deleteFailed`))}finally{o(!1)}}});return(0,H.jsx)(F,{open:t&&e!==null,onOpenChange:c,children:(0,H.jsxs)(M,{className:`max-w-md`,children:[(0,H.jsxs)(A,{children:[(0,H.jsx)(N,{children:i(`assistants.settings.delete`)}),(0,H.jsx)(P,{children:i(`assistants.settings.deleteConfirm`,{name:s})})]}),(0,H.jsxs)(j,{children:[(0,H.jsx)(_,{size:`sm`,variant:`ghost`,onClick:l,disabled:a,children:i(`settings.common.actions.cancel`)}),(0,H.jsx)(_,{size:`sm`,variant:`destructive`,onClick:u,disabled:a,children:i(`settings.common.actions.delete`)})]})]})})}var W=`block min-w-0 max-w-full truncate typography-micro text-muted-foreground`,ge={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 _e(e,t){return e?.text.replace(/\s+/gu,` `).trim()||t(e?.fallbackKind?ge[e.fallbackKind]:`assistants.contact.empty`)}var ve=e=>e.capabilityPending?`loading`:e.capabilityError||e.supported!==!0||e.capabilityEnabled!==!0?`unavailable`:e.snapshotPending?`loading`:e.snapshotEnabled===!0?e.assistantCount===0?`onboarding`:e.hasAssistant?`ready`:e.snapshotSettled?`unavailable`:`loading`:`unavailable`,ye=e({AssistantView:()=>G}),be=e=>{let t=(0,V.c)(21),{assistant:n,onBack:r,onOpenSettings:i}=e,{t:a}=v(),o=te(),s;t[0]===n?s=t[1]:(s=n?y(n.name):null,t[0]=n,t[1]=s);let c=s,l=n&&c?c.displayName||n.name:``,u;t[2]!==n||t[3]!==o||t[4]!==i?(u=()=>{if(n){if(i){i(n.id);return}O(n.id,o?{openMobileSettings:o.openSettings}:void 0)}},t[2]=n,t[3]=o,t[4]=i,t[5]=u):u=t[5];let d=h(u),f;t[6]!==n||t[7]!==l||t[8]!==a?(f=n?(0,H.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-2.5`,children:[(0,H.jsx)(re,{name:n.id,avatarSeed:n.avatarSeed,size:40,label:l,working:!!(n.working||n.activeContactTurn),showWorkingDot:!1}),(0,H.jsxs)(`span`,{className:`min-w-0`,children:[(0,H.jsx)(`span`,{className:`block truncate font-medium leading-5 tracking-[-0.01em]`,children:l||a(`assistants.title`)}),(0,H.jsx)(ae,{assistantID:n.id,serverWorking:!!(n.working||n.activeContactTurn),lastContactAt:n.latestMessagePreview?.createdAt})]})]}):l||a(`assistants.title`),t[6]=n,t[7]=l,t[8]=a,t[9]=f):f=t[9];let p;t[10]===a?p=t[11]:(p=a(`assistants.actions.backToChat`),t[10]=a,t[11]=p);let m;t[12]!==n||t[13]!==d||t[14]!==a?(m=n?[{icon:`settings-3`,ariaLabel:a(`assistants.conversation.openSettings`),onClick:d}]:[],t[12]=n,t[13]=d,t[14]=a,t[15]=m):m=t[15];let g;return t[16]!==r||t[17]!==f||t[18]!==p||t[19]!==m?(g=(0,H.jsx)(T,{title:f,backAriaLabel:p,onBack:r,actions:m,overlay:!0}),t[16]=r,t[17]=f,t[18]=p,t[19]=m,t[20]=g):g=t[20],g},xe=e=>{let t=(0,V.c)(34),{assistant:n,avatarSeed:r,unreadCount:i,summary:a,assistantID:o,displayName:s,selected:c,onSelect:l,onEdit:u,onDelete:d,serverWorking:f}=e,p=ne(o,f!==void 0&&f),m=B.useRef(null),_;t[0]===l?_=t[1]:(_=()=>l(),t[0]=l,t[1]=_);let v=h(_),y=c?`border-border/50 bg-[var(--surface-elevated)]`:`border-transparent hover:bg-interactive-hover`,b;t[2]===y?b=t[3]:(b=g(`flex w-full min-h-11 items-center gap-3 rounded-xl border px-3 py-3 text-left outline-none transition-[background-color,border-color,opacity] duration-150 ease-out active:bg-interactive-active focus-visible:ring-2 focus-visible:ring-[var(--interactive-focus-ring)] motion-reduce:transition-none`,y),t[2]=y,t[3]=b);let x;t[4]!==o||t[5]!==r||t[6]!==s||t[7]!==p?(x=(0,H.jsx)(re,{name:o,avatarSeed:r,size:44,label:s,working:p,hoverTarget:m}),t[4]=o,t[5]=r,t[6]=s,t[7]=p,t[8]=x):x=t[8];let S=c?`font-semibold`:`font-medium`,C;t[9]===S?C=t[10]:(C=g(`block truncate typography-ui-label leading-5`,S),t[9]=S,t[10]=C);let w;t[11]!==s||t[12]!==C?(w=(0,H.jsx)(`span`,{className:C,children:s}),t[11]=s,t[12]=C,t[13]=w):w=t[13];let T;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(T=g(W,`mt-1 text-[length:calc(var(--text-micro)*0.9)] leading-5`),t[14]=T):T=t[14];let E;t[15]===a?E=t[16]:(E=(0,H.jsx)(`span`,{className:T,children:a}),t[15]=a,t[16]=E);let D;t[17]!==E||t[18]!==w?(D=(0,H.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[w,E]}),t[17]=E,t[18]=w,t[19]=D):D=t[19];let O;t[20]===i?O=t[21]:(O=(0,H.jsx)(I,{count:i,className:`h-3.5 min-w-3.5 bg-[oklch(from_var(--primary-base)_calc(l_*_0.78)_c_h)] px-1 text-[10px] text-[var(--color-white)] shadow-none`}),t[20]=i,t[21]=O);let k;t[22]!==v||t[23]!==c||t[24]!==D||t[25]!==O||t[26]!==b||t[27]!==x?(k=(0,H.jsxs)(`button`,{ref:m,type:`button`,role:`option`,"aria-selected":c,onClick:v,className:b,children:[x,D,O]}),t[22]=v,t[23]=c,t[24]=D,t[25]=O,t[26]=b,t[27]=x,t[28]=k):k=t[28];let A;return t[29]!==n||t[30]!==d||t[31]!==u||t[32]!==k?(A=(0,H.jsx)(U,{assistant:n,doubleClickMiniChat:!0,onEdit:u,onDelete:d,trigger:k}),t[29]=n,t[30]=d,t[31]=u,t[32]=k,t[33]=A):A=t[33],A},G=e=>{let t=(0,V.c)(117),{activeOverride:n,onMobileBack:r,onMobileOpenSettings:o}=e,{t:s}=v(),{isMobile:c}=ee(),l=te(),u=B.useSyncExternalStore(i,a,a),f=d(Se),p=n??f,b=d(Ce),S=c||b,C=x(),w=E(),T=w.data;T?.assistants;let A;t[0]===T?.assistants?A=t[1]:(A=T?.assistants??[],t[0]=T?.assistants,t[1]=A);let j;t[2]===A?j=t[3]:(j=oe(A),t[2]=A,t[3]=j);let M=j,N;t[4]===u?N=t[5]:(N=e=>e.assistantByTransport[u]??null,t[4]=u,t[5]=N);let P=D(N),F=D(we),ne=D(Te),I;t[6]!==P||t[7]!==T?.assistants?(I=T?.assistants.find(e=>e.id===P)??null,t[6]=P,t[7]=T?.assistants,t[8]=I):I=t[8];let L=I,se;t[9]!==F||t[10]!==P||t[11]!==T?(se=()=>{!P&&T?.assistants[0]&&F(T.assistants[0].id)},t[9]=F,t[10]=P,t[11]=T,t[12]=se):se=t[12];let ce=T?.assistants,R;t[13]!==F||t[14]!==P||t[15]!==ce?(R=[F,P,ce],t[13]=F,t[14]=P,t[15]=ce,t[16]=R):R=t[16],B.useEffect(se,R);let z;t[17]!==L||t[18]!==F||t[19]!==P||t[20]!==T?.assistants||t[21]!==w.isSuccess?(z=()=>{w.isSuccess&&P&&!L&&F(T?.assistants[0]?.id??null)},t[17]=L,t[18]=F,t[19]=P,t[20]=T?.assistants,t[21]=w.isSuccess,t[22]=z):z=t[22];let U=T?.assistants,de;t[23]!==L||t[24]!==F||t[25]!==P||t[26]!==w.isSuccess||t[27]!==U?(de=[L,F,P,U,w.isSuccess],t[23]=L,t[24]=F,t[25]=P,t[26]=w.isSuccess,t[27]=U,t[28]=de):de=t[28],B.useEffect(z,de);let me;t[29]!==l||t[30]!==ne?(me=()=>{if(ne(),l){l.openSettings();return}let e=d.getState();e.setSettingsPage(`assistants`),e.setSettingsDialogOpen(!0)},t[29]=l,t[30]=ne,t[31]=me):me=t[31];let W=h(me),ge;t[32]===l?ge=t[33]:(ge=e=>{O(e,l?{openMobileSettings:l.openSettings}:void 0)},t[32]=l,t[33]=ge);let ye=h(ge),G;t[34]!==L||t[35]!==l?(G=()=>{L&&O(L.id,l?{openMobileSettings:l.openSettings}:void 0)},t[34]=L,t[35]=l,t[36]=G):G=t[36];let De=h(G),[Oe,ke]=B.useState(null),Ae;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(Ae=e=>{ke(e)},t[37]=Ae):Ae=t[37];let je=h(Ae),Me;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(Me=e=>{e||ke(null)},t[38]=Me):Me=t[38];let Ne=h(Me),Pe=h(Ee),Fe;t[39]!==r||t[40]!==Pe?(Fe=()=>{if(r){r();return}Pe()},t[39]=r,t[40]=Pe,t[41]=Fe):Fe=t[41];let K=h(Fe),Ie=ve({capabilityPending:C.isPending,snapshotPending:w.isPending,capabilityError:C.isError,supported:C.data?.supported,capabilityEnabled:C.data?.enabled,snapshotEnabled:T?.enabled,snapshotSettled:w.isSuccess,assistantCount:T?.assistants.length??0,hasAssistant:!!L}),Le;t[42]!==L||t[43]!==K||t[44]!==S||t[45]!==o?(Le=(e,t,n,r)=>(0,H.jsxs)(`div`,{className:`relative flex h-full min-h-0 flex-col`,children:[S?(0,H.jsx)(be,{assistant:L,onBack:K,onOpenSettings:o}):null,(0,H.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col items-center justify-center px-6 pt-[calc(max(0.25rem,var(--yuri-safe-area-top,0px))+var(--yuri-mobile-detail-navigation-height,3.5rem))] text-center`,children:[(0,H.jsx)(k,{name:e,className:`size-6 text-muted-foreground`}),(0,H.jsx)(`h1`,{className:`mt-4 typography-ui-header font-semibold`,children:t}),n?(0,H.jsx)(`p`,{className:`mt-2 max-w-md typography-ui text-muted-foreground`,children:n}):null,r?(0,H.jsx)(`div`,{className:`mt-5`,children:r}):null]})]}),t[42]=L,t[43]=K,t[44]=S,t[45]=o,t[46]=Le):Le=t[46];let q=Le;if(Ie===`loading`){let e;t[47]!==L||t[48]!==K||t[49]!==S||t[50]!==o?(e=S?(0,H.jsx)(be,{assistant:L,onBack:K,onOpenSettings:o}):null,t[47]=L,t[48]=K,t[49]=S,t[50]=o,t[51]=e):e=t[51];let n;t[52]===s?n=t[53]:(n=s(`common.loading`),t[52]=s,t[53]=n);let r;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,H.jsx)(k,{name:`loader-4`,className:`size-6 animate-spin text-muted-foreground`}),t[54]=r):r=t[54];let i;t[55]===n?i=t[56]:(i=(0,H.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col items-center justify-center px-6 pt-[calc(max(0.25rem,var(--yuri-safe-area-top,0px))+var(--yuri-mobile-detail-navigation-height,3.5rem))] text-center`,"aria-busy":`true`,"aria-label":n,"data-assistant-workspace-loading":``,children:r}),t[55]=n,t[56]=i);let a;return t[57]!==e||t[58]!==i?(a=(0,H.jsxs)(`div`,{className:`relative flex h-full min-h-0 flex-col`,children:[e,i]}),t[57]=e,t[58]=i,t[59]=a):a=t[59],a}if(Ie===`unavailable`){let e;return t[60]!==q||t[61]!==s?(e=q(`cloud-off`,s(`assistants.state.unavailable`)),t[60]=q,t[61]=s,t[62]=e):e=t[62],e}if(Ie===`onboarding`){let e;if(t[63]!==W||t[64]!==q||t[65]!==s){let n=s(`assistants.onboarding.title`),r=s(`assistants.onboarding.description`),i;t[67]===s?i=t[68]:(i=s(`assistants.onboarding.action`),t[67]=s,t[68]=i);let a;t[69]!==W||t[70]!==i?(a=(0,H.jsx)(_,{onClick:W,children:i}),t[69]=W,t[70]=i,t[71]=a):a=t[71],e=q(`ai-agent`,n,r,a),t[63]=W,t[64]=q,t[65]=s,t[66]=e}else e=t[66];return e}if(!T||!L){let e;return t[72]!==q||t[73]!==s?(e=q(`cloud-off`,s(`assistants.state.unavailable`)),t[72]=q,t[73]=s,t[74]=e):e=t[74],e}let Re;t[75]===L.name?Re=t[76]:(Re=y(L.name),t[75]=L.name,t[76]=Re);let ze=Re,Be;t[77]!==w.isError||t[78]!==s?(Be=w.isError?s(`assistants.state.staleSnapshot`):null,t[77]=w.isError,t[78]=s,t[79]=Be):Be=t[79];let Ve=Be,J;t[80]!==M||t[81]!==S||t[82]!==W||t[83]!==ye||t[84]!==je||t[85]!==F||t[86]!==P||t[87]!==T||t[88]!==s?(J=S?null:(0,H.jsxs)(`section`,{className:`flex h-full min-h-0 w-[clamp(16rem,22vw,20rem)] shrink-0 flex-col overflow-hidden`,children:[(0,H.jsxs)(`header`,{className:`flex shrink-0 items-center gap-3 px-4 pb-1 pt-4 sm:px-5`,children:[(0,H.jsx)(`h1`,{className:`min-w-0 truncate typography-ui-label font-semibold text-foreground`,children:s(`assistants.title`)}),(0,H.jsx)(pe,{snapshot:T,compact:!0,rowClassName:`flex min-w-0 flex-1 justify-end`}),(0,H.jsx)(_,{type:`button`,variant:`mobileGlass`,size:`mobileIcon`,className:`size-8 min-h-0 min-w-0 !shadow-[0_0_0_0.5px_rgb(0_0_0/0.08),0_1px_2px_rgb(0_0_0/0.05)] dark:!shadow-[var(--yuri-mobile-glass-shadow)]`,"aria-label":s(`assistants.settings.create`),onClick:W,children:(0,H.jsx)(k,{name:`add`,className:`size-4`})})]}),(0,H.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-3 pb-4 sm:px-4`,role:`listbox`,"aria-label":s(`assistants.listAria`),children:[(0,H.jsx)(fe,{contacts:M.pinned,selectedAssistantID:P,onSelect:F,onEdit:ye,onDelete:je}),(0,H.jsx)(`div`,{className:`flex flex-col gap-1 pt-1`,children:M.unpinned.map(e=>{let t=e.id===P,n=y(e.name);return(0,H.jsx)(xe,{assistant:e,assistantID:e.id,avatarSeed:e.avatarSeed,unreadCount:e.unreadCount??0,summary:_e(e.latestMessagePreview,s),displayName:n.displayName,selected:t,assignedSessionIDs:e.assignedSessionIDs,serverWorking:e.working,onSelect:()=>F(e.id),onEdit:()=>ye(e.id),onDelete:()=>je(e)},e.id)})})]})]}),t[80]=M,t[81]=S,t[82]=W,t[83]=ye,t[84]=je,t[85]=F,t[86]=P,t[87]=T,t[88]=s,t[89]=J):J=t[89];let He=Oe!==null,Y;t[90]!==Oe||t[91]!==Ne||t[92]!==He?(Y=(0,H.jsx)(he,{assistant:Oe,open:He,onOpenChange:Ne}),t[90]=Oe,t[91]=Ne,t[92]=He,t[93]=Y):Y=t[93];let Ue=!S&&`border-l border-[var(--surface-subtle)]`,X;t[94]===Ue?X=t[95]:(X=g(`relative flex min-h-0 min-w-0 flex-1 flex-col overflow-clip bg-background`,Ue),t[94]=Ue,t[95]=X);let Z;t[96]!==L||t[97]!==K||t[98]!==S||t[99]!==o||t[100]!==De||t[101]!==ze||t[102]!==s?(Z=S?(0,H.jsx)(be,{assistant:L,onBack:K,onOpenSettings:o}):(0,H.jsxs)(`header`,{className:`flex h-16 shrink-0 items-center gap-3.5 border-b border-[var(--surface-subtle)]/70 px-5 sm:px-7`,children:[(0,H.jsx)(re,{name:L.id,avatarSeed:L.avatarSeed,size:40,label:ze.displayName||L.name,working:!!(L.working||L.activeContactTurn),showWorkingDot:!1}),(0,H.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,H.jsx)(`div`,{className:`truncate typography-ui-label font-semibold leading-5 tracking-[-0.01em] text-foreground`,children:ze.displayName}),(0,H.jsx)(ae,{assistantID:L.id,serverWorking:!!(L.working||L.activeContactTurn),lastContactAt:L.latestMessagePreview?.createdAt})]}),le()?(0,H.jsx)(_,{type:`button`,variant:`ghost`,size:`icon`,className:`text-muted-foreground/65`,onClick:()=>{ue(L.id).catch(()=>m.error(s(`miniChat.actions.failed`)))},"aria-label":s(`sessions.sidebar.session.menu.openMiniChatWindow`),title:s(`sessions.sidebar.session.menu.openMiniChatWindow`),children:(0,H.jsx)(k,{name:`external-link`,className:`size-4`})}):null,(0,H.jsx)(_,{type:`button`,variant:`ghost`,size:`icon`,className:`size-8 shrink-0 rounded-full text-muted-foreground/65 transition-colors hover:text-foreground`,onClick:De,"aria-label":s(`assistants.conversation.openSettings`),children:(0,H.jsx)(k,{name:`settings-3`,className:`size-4`})})]}),t[96]=L,t[97]=K,t[98]=S,t[99]=o,t[100]=De,t[101]=ze,t[102]=s,t[103]=Z):Z=t[103];let Q;t[104]!==p||t[105]!==L||t[106]!==S||t[107]!==Ve?(Q=(0,H.jsx)(ie,{assistant:L,warning:Ve,active:p,overlayHeader:S}),t[104]=p,t[105]=L,t[106]=S,t[107]=Ve,t[108]=Q):Q=t[108];let $;t[109]!==X||t[110]!==Z||t[111]!==Q?($=(0,H.jsxs)(`div`,{className:X,children:[Z,Q]}),t[109]=X,t[110]=Z,t[111]=Q,t[112]=$):$=t[112];let We;return t[113]!==J||t[114]!==Y||t[115]!==$?(We=(0,H.jsxs)(`div`,{className:`relative flex h-full min-h-0 overflow-clip bg-background`,"data-presentation":`workspace`,children:[J,Y,$]}),t[113]=J,t[114]=Y,t[115]=$,t[116]=We):We=t[116],We};function Se(e){return e.activeMainTab===`assistant`}function Ce(e){return e.isMobile}function we(e){return e.selectAssistant}function Te(e){return e.requestCreate}function Ee(){d.getState().setActiveMainTab(`chat`)}export{he as a,U as c,_e as i,ye as n,pe as o,W as r,fe as s,G as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t}from"./runtime-switch-ibQIZnws.js";import{ot as n,st as r}from"./vendor-base-ui-CzHs0bHY.js";import{r as i}from"./useUIStore-BsCfUWQw.js";import{l as a}from"./vendor-tanstack-react-query-B-Wpqq5J.js";import{a as o,i as s,t as c,u as l}from"./fileQueries-BaEKb7SZ.js";import{r as u}from"./vendor-sonner-BEHGipm5.js";import{Va as d}from"./useMobileNavigationStore-SCjA_7jP.js";import{n as f}from"./Icon-DsN23fuV.js";import{n as p}from"./useEffectiveDirectory-Uc8I6wXt.js";import{t as m}from"./diagram-OTF8YAve.js";var h=e(r(),1),g=n();function _(){let{t:e}=d(),{files:n}=l(),r=a(),_=p()??null,v=t(),[y,b]=h.useState(null),[x,S]=h.useState(``),C=h.useRef(null),w=h.useRef(!1),T=h.useRef(null),E=h.useRef(0),D=h.useRef(Promise.resolve()),O=i(e=>e.pendingDiagramFile),k=o({scopeDirectory:_,path:y},{enabled:!!y});if(y&&(T.current?.path!==y||T.current.transport!==v||T.current.scopeDirectory!==_)){let e=E.current+1;E.current=e,T.current={path:y,generation:e,transport:v,scopeDirectory:_}}h.useEffect(()=>(w.current=!0,()=>{w.current=!1,E.current+=1}),[]),h.useEffect(()=>{if(!O)return;let e=i.getState().consumePendingDiagramFile();if(e){let t=E.current+1;E.current=t,T.current={path:e,generation:t,transport:v,scopeDirectory:_},b(e)}},[_,O,v]),h.useEffect(()=>{let e=T.current;if(!(!e||e.path!==y||e.transport!==v||e.scopeDirectory!==_)){if(k.data!==void 0){S(k.data);return}k.isError&&S(``)}},[_,y,k.data,k.isError,v]);let A=h.useCallback(async()=>{let t=C.current?.getXml(),i=T.current,a=n?.writeFile;if(!y||!a||!t||t===x||i?.path!==y)return;let{path:o,generation:l,scopeDirectory:d,transport:f}=i,p=D.current.then(async()=>{try{if(!(await a(o,t))?.success)throw Error(e(`filesView.toast.writeFileFailed`));let n={scopeDirectory:d,path:o};await r.cancelQueries({queryKey:c(n,f),exact:!0}),s(r,n,f,t);let i=T.current;w.current&&i?.path===o&&i.generation===l&&i.transport===f&&i.scopeDirectory===d&&S(t)}catch(t){u.error(t instanceof Error?t.message:e(`filesView.toast.saveFailed`))}});D.current=p.catch(()=>void 0),await p},[y,n,r,e,x]),j=y?y.split(`/`).pop()||y:``;return y?k.isPending?(0,g.jsx)(`div`,{className:`flex h-full items-center justify-center p-3`,children:(0,g.jsx)(f,{name:`loader-4`,className:`size-4 animate-spin`})}):(0,g.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border/30 px-3 py-1.5`,children:[(0,g.jsx)(f,{name:`file`,className:`size-4 shrink-0 text-muted-foreground`}),(0,g.jsx)(`span`,{className:`typography-ui text-muted-foreground truncate flex-1`,children:j}),(0,g.jsx)(`button`,{type:`button`,onClick:()=>void A(),className:`size-6 flex items-center justify-center rounded-md text-foreground hover:bg-interactive-hover/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary`,title:e(`filesView.diagram.saveDiagram`),children:(0,g.jsx)(f,{name:`save-3`,className:`size-4`})}),(0,g.jsx)(`button`,{type:`button`,onClick:()=>i.getState().setActiveMainTab(`chat`),className:`size-6 flex items-center justify-center rounded-md text-muted-foreground hover:bg-interactive-hover/50 hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary`,title:e(`filesView.diagram.closeDiagramView`),children:(0,g.jsx)(f,{name:`close`,className:`size-4`})})]}),(0,g.jsx)(`div`,{className:`flex-1 min-h-0`,children:(0,g.jsx)(m,{ref:C,xml:x,className:`h-full`})})]}):(0,g.jsx)(`div`,{className:`flex h-full items-center justify-center p-3`,children:(0,g.jsx)(`div`,{className:`typography-ui text-muted-foreground`,children:e(`filesView.editor.pickFileFromTree`)})})}export{_ as DiagramView};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{ot as t,st as n}from"./vendor-base-ui-CzHs0bHY.js";import{n as r}from"./vendor-react-DlzBev0S.js";import{Kn as i,Va as a}from"./useMobileNavigationStore-SCjA_7jP.js";import{r as o}from"./device-Db_TcRdX.js";import{a as s}from"./react-a6PrrNTm.js";import{a as c,n as l,t as u}from"./readiness-CUPPcONt.js";import{t as d}from"./GuiPluginWindow-BgOCEgEb.js";var f=r(),p=e(n(),1),m=t();function h(){let e=(0,f.c)(12),{host:t,snapshot:n}=s(),{t:r}=a(),{isMobile:h}=o(),[_]=p.useState(g),v;if(e[0]!==_||e[1]!==t||e[2]!==h||e[3]!==n.activePanel||e[4]!==n.panels||e[5]!==n.plugins||e[6]!==r){let a;e[8]===n.activePanel?a=e[9]:(a=e=>e.key===n.activePanel&&!e.inline,e[8]=n.activePanel,e[9]=a);let o=n.panels.find(a),s;e[10]===t?s=e[11]:(s=()=>t?.hidePanel(),e[10]=t,e[11]=s),v=(0,m.jsx)(d,{id:`gui-plugin-panel`,open:!!(t&&o),title:o?.title??r(`guiPlugins.title`),onClose:s,actions:h&&o?(0,m.jsx)(c,{target:_}):null,children:t&&o?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`div`,{className:`flex shrink-0 flex-wrap gap-1`,"aria-label":r(`guiPlugins.panels`),children:n.panels.map(e=>(0,m.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1`,children:[(0,m.jsx)(i,{variant:`chip`,size:`sm`,"aria-pressed":e.key===o.key,onClick:()=>t.selectPanel(e.key),className:`max-w-64 truncate`,children:e.title}),(0,m.jsx)(i,{variant:`ghost`,size:`xs`,"aria-label":r(`guiPlugins.closePanel`,{title:e.title}),onClick:()=>t.closePanel(e.key),children:r(`guiPlugins.close`)})]},e.key))}),(0,m.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,"data-mobile-edge-to-edge-preview":`true`,children:(0,m.jsx)(l,{host:t,contributionKey:o.key,kind:`panel`,actions:h?_:void 0,revision:u(n.plugins,o.pluginId)})})]}):null}),e[0]=_,e[1]=t,e[2]=h,e[3]=n.activePanel,e[4]=n.panels,e[5]=n.plugins,e[6]=r,e[7]=v}else v=e[7];return v}function g(){return document.createElement(`div`)}export{h as GuiPluginSurface};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{ot as e}from"./vendor-base-ui-CzHs0bHY.js";import{n as t}from"./vendor-react-DlzBev0S.js";import{Va as n}from"./useMobileNavigationStore-SCjA_7jP.js";import{a as r,n as i,o as a,t as o}from"./dialog-CgtwKUKd.js";import{r as s}from"./device-Db_TcRdX.js";import{t as c}from"./MobileResizableSheet-D_PnyzR0.js";var l=t(),u=e();function d(e){let t=(0,l.c)(24),{id:d,open:f,title:p,onClose:m,children:h,actions:g}=e,{isMobile:_}=s(),{t:v}=n(),y;t[0]===m?y=t[1]:(y=e=>{e||m()},t[0]=m,t[1]=y);let b=y;if(_){let e;t[2]===v?e=t[3]:(e=v(`guiPlugins.close`),t[2]=v,t[3]=e);let n;t[4]===v?n=t[5]:(n=v(`guiPlugins.resize`),t[4]=v,t[5]=n);let r;return t[6]!==g||t[7]!==h||t[8]!==d||t[9]!==b||t[10]!==f||t[11]!==e||t[12]!==n||t[13]!==p?(r=(0,u.jsx)(c,{id:d,open:f,onOpenChange:b,title:p,ariaLabel:p,closeAriaLabel:e,resizeAriaLabel:n,trailing:g,initiallyExpanded:!0,children:h}),t[6]=g,t[7]=h,t[8]=d,t[9]=b,t[10]=f,t[11]=e,t[12]=n,t[13]=p,t[14]=r):r=t[14],r}let x;t[15]===p?x=t[16]:(x=(0,u.jsx)(r,{children:(0,u.jsx)(a,{children:p})}),t[15]=p,t[16]=x);let S;t[17]!==h||t[18]!==x?(S=(0,u.jsxs)(i,{className:`flex h-[80dvh] max-w-5xl flex-col overflow-hidden`,"aria-describedby":void 0,children:[x,h]}),t[17]=h,t[18]=x,t[19]=S):S=t[19];let C;return t[20]!==b||t[21]!==f||t[22]!==S?(C=(0,u.jsx)(o,{open:f,onOpenChange:b,children:S}),t[20]=b,t[21]=f,t[22]=S,t[23]=C):C=t[23],C}export{d as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{ot as e}from"./vendor-base-ui-CzHs0bHY.js";import{n as t}from"./vendor-react-DlzBev0S.js";import{Jn as n,Va as r}from"./useMobileNavigationStore-SCjA_7jP.js";import"./image-loading-D1DfK_bJ.js";var i=t(),a=e();function o(e){let t=(0,i.c)(7),{className:o}=e,{t:s}=r(),c;t[0]===o?c=t[1]:(c=n(`yuri-image-loading`,o),t[0]=o,t[1]=c);let l;t[2]===s?l=t[3]:(l=s(`chat.fileAttachment.image.loading`),t[2]=s,t[3]=l);let u;return t[4]!==c||t[5]!==l?(u=(0,a.jsx)(`span`,{className:c,role:`status`,"aria-label":l}),t[4]=c,t[5]=l,t[6]=u):u=t[6],u}export{o as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{ot as t,st as n}from"./vendor-base-ui-CzHs0bHY.js";import{r}from"./useUIStore-BsCfUWQw.js";import{n as i}from"./vendor-react-DlzBev0S.js";import{Va as a}from"./useMobileNavigationStore-SCjA_7jP.js";import{t as o}from"./ImageLoadingPlaceholder-MfVzv_y1.js";var s=i(),c=e(n(),1),l=t();function u(e){let t=(0,s.c)(39),n,i,u,f,p,m,h;t[0]===e?(n=t[1],i=t[2],u=t[3],f=t[4],p=t[5],m=t[6],h=t[7]):({resourceError:m,fill:i,contentFrame:n,onLoad:f,onError:u,style:h,...p}=e,t[0]=e,t[1]=n,t[2]=i,t[3]=u,t[4]=f,t[5]=p,t[6]=m,t[7]=h);let g=r(d),{t:_}=a(),v=c.useRef(null),[y,b]=c.useState(`loading`),x=m?`error`:y,S,C;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(S=()=>{let e=v.current;e?.complete&&e.naturalWidth>0&&b(`loaded`)},C=[],t[8]=S,t[9]=C):(S=t[8],C=t[9]),c.useLayoutEffect(S,C);let w=i||void 0,T=n?g?`mobile`:`desktop`:void 0,E=x===`loading`,D=p.src||void 0,O;t[10]===x?O=t[11]:(O=x===`loaded`?{}:{opacity:0},t[10]=x,t[11]=O);let k;t[12]!==h||t[13]!==O?(k={...h,...O},t[12]=h,t[13]=O,t[14]=k):k=t[14];let A;t[15]===f?A=t[16]:(A=e=>{b(`loaded`),f?.(e)},t[15]=f,t[16]=A);let j;t[17]!==u||t[18]!==p.src?(j=e=>{p.src&&(b(`error`),u?.(e))},t[17]=u,t[18]=p.src,t[19]=j):j=t[19];let M;t[20]!==p||t[21]!==j||t[22]!==D||t[23]!==k||t[24]!==A?(M=(0,l.jsx)(`img`,{...p,ref:v,src:D,style:k,onLoad:A,onError:j}),t[20]=p,t[21]=j,t[22]=D,t[23]=k,t[24]=A,t[25]=M):M=t[25];let N;t[26]===x?N=t[27]:(N=x===`loading`&&(0,l.jsx)(o,{}),t[26]=x,t[27]=N);let P;t[28]!==x||t[29]!==_?(P=x===`error`&&(0,l.jsx)(`span`,{className:`yuri-image-error`,role:`status`,children:_(`chat.fileAttachment.image.loadFailed`)}),t[28]=x,t[29]=_,t[30]=P):P=t[30];let F;return t[31]!==x||t[32]!==M||t[33]!==N||t[34]!==P||t[35]!==w||t[36]!==T||t[37]!==E?(F=(0,l.jsxs)(`span`,{className:`yuri-image-frame`,"data-image-state":x,"data-image-fill":w,"data-image-content":T,"aria-busy":E,children:[M,N,P]}),t[31]=x,t[32]=M,t[33]=N,t[34]=P,t[35]=w,t[36]=T,t[37]=E,t[38]=F):F=t[38],F}function d(e){return e.isMobile}var f=c.memo(function(e){let t=(0,s.c)(11),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({resourceError:a,fill:r,contentFrame:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=`${i.src??``}\n${i.srcSet??``}`,c;return t[5]!==n||t[6]!==r||t[7]!==i||t[8]!==a||t[9]!==o?(c=(0,l.jsx)(u,{...i,resourceError:a,fill:r,contentFrame:n},o),t[5]=n,t[6]=r,t[7]=i,t[8]=a,t[9]=o,t[10]=c):c=t[10],c});export{f as t};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/MarkstreamRendererImpl-Bqbq2VPn.js","assets/rolldown-runtime-hePW80VL.js","assets/vendor-base-ui-CzHs0bHY.js","assets/useUIStore-BsCfUWQw.js","assets/runtime-switch-ibQIZnws.js","assets/runtime-auth-Bh3htXtG.js","assets/vendor-zustand-vDaAPGfl.js","assets/brand-storage-bootstrap-D4BW3w-M.js","assets/brand-storage-migration-Bhz6UOBJ.js","assets/vendor-react-DlzBev0S.js","assets/fileQueries-BaEKb7SZ.js","assets/runtime-fetch-9B8F_rKW.js","assets/vendor-tanstack-query-core-Y_YoRHtC.js","assets/vendor-tanstack-react-query-B-Wpqq5J.js","assets/platform-Dids8J9D.js","assets/desktop-Brp3xDpd.js","assets/path-utils-HRmerlyU.js","assets/vendor-pathe-vBmvQE8f.js","assets/vendor-markstream-react-6zxyQLCD.js","assets/vendor-aparajita-capacitor-secure-storage-xol_6BsB.js","assets/vendor-markstream-core-Cm34iPLL.js","assets/vendor-floating-ui-dom-BHhLtF5l.js","assets/vendor-floating-ui-core-Co1I1lFV.js","assets/vendor-reactuses-core-CuTmqEMK.js","assets/vendor-lodash-es-BS45jPoZ.js","assets/vendor-js-cookie-hSOiFTtX.js","assets/useMobileNavigationStore-SCjA_7jP.js","assets/bootstrap-BzeQds0D.js","assets/vendor-opencode-client-cQ47ywrT.js","assets/vendor-effect-X1Hqc7ba.js","assets/runtime-file-resource-tDTBpJT_.js","assets/runtime-file-store-BVRgEtI-.js","assets/runtime-ead7P81A.js","assets/vendor-sonner-BEHGipm5.js","assets/store-Myt_Fv8d.js","assets/tour-DDI0Zg7l.js","assets/useAssistantUIStore-CVSFSgJV.js","assets/vendor-zod-DZzbCm1s.js","assets/vendor-opencode-schema-DWT45VBX.js","assets/vendor-class-variance-authority-BLUaYARZ.js","assets/vendor-tailwind-merge-BicNWLTg.js","assets/useThemeSystem-CNzUUkFn.js","assets/vendor-framer-motion-DDMKlXiP.js","assets/tooltip-D5Xeh6py.js","assets/url-DO6Zrx1P.js","assets/useEffectiveDirectory-Uc8I6wXt.js","assets/image-loading-D1DfK_bJ.js","assets/image-loading-D9Z_BASK.css","assets/LoadingImage-MAgXscGl.js","assets/ImageLoadingPlaceholder-MfVzv_y1.js","assets/FadeInOnReveal-CK7jBcu4.js","assets/markdownHeightCache-DlRC53XG.js","assets/dualLimitLru-D8Sphgua.js","assets/useStreamingTextThrottle-BY1Ynoj1.js","assets/MarkdownRendererImpl-ecACjpZw.js","assets/vendor-katex-DNVSTX6g.js","assets/themes-BgDJcxRc.js","assets/vendor-marked-S3gCOYp1.js","assets/markdownTheme-CHNl6tUv.js","assets/vendor-pierre-diffs-BFiZ3IhI.js","assets/vendor-hast-util-to-html-Bw_SgZ1t.js","assets/vendor-character-entities-legacy-Wut6vMuj.js","assets/vendor-character-entities-html4-DlN_yAFd.js","assets/vendor-ccount-CyGsA0u7.js","assets/vendor-comma-separated-tokens-B9ouxNNS.js","assets/vendor-oniguruma-to-es-CrHzjjSU.js","assets/vendor-oniguruma-parser-D2DIvhSP.js","assets/vendor-diff-Dq7CZNim.js","assets/vendor-lru_map-BMOrLc9L.js","assets/markdown-worker-oBGEB9Eg.js","assets/vendor-morphdom-BbKiNDAu.js","assets/vendor-dompurify-CeJNOzik.js","assets/vendor-pele-C1WTNWUm.js","assets/vendor-remend-C3cXc-tf.js","assets/fileReferenceActions-D06_lyuL.js","assets/toolHelpers-iEHVHQ9p.js","assets/fileReferenceParser-BayaidRM.js","assets/MarkstreamRendererImpl-C6aiJnjl.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{a as t}from"./vendor-zustand-vDaAPGfl.js";import{ot as n,st as r}from"./vendor-base-ui-CzHs0bHY.js";import"./brand-storage-bootstrap-D4BW3w-M.js";import{n as i}from"./vendor-react-DlzBev0S.js";import{o as a}from"./vendor-aparajita-capacitor-secure-storage-xol_6BsB.js";import{Jn as o}from"./useMobileNavigationStore-SCjA_7jP.js";import{t as s}from"./useEffectiveDirectory-Uc8I6wXt.js";import{i as c,n as l,t as u}from"./markdownHeightCache-DlRC53XG.js";var d=i(),f=e(r(),1),p=`yuri:chunk-import-reload`,m=250,h=3e4,g=[/Importing a module script failed/i,/Failed to fetch dynamically imported module/i,/error loading dynamically imported module/i,/Loading chunk \S+ failed/i,/ChunkLoadError/i];function _(e){if(e instanceof Error)return`${e.name}\n${e.message}\n${e.stack??``}`;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}function v(e){let t=_(e);return g.some(e=>e.test(t))}function y(e){return`0.2.38-beta.2:${_(e).slice(0,500)}`}function b(e){if(typeof window>`u`)return;let t=Date.now(),n=y(e),r=null;try{let e=window.sessionStorage.getItem(p);if(e)try{r=JSON.parse(e)}catch{r=null}}catch{return}let i=typeof r?.timestamp==`number`?r.timestamp:0;if(!(r?.signature===n&&t-i<h)){try{window.sessionStorage.setItem(p,JSON.stringify({signature:n,timestamp:t}))}catch{return}console.error(`[refresh-debug] chunk-import-reload`,{error:_(e).slice(0,1e3)}),window.setTimeout(()=>{window.location.reload()},0)}}async function x(e,t={}){let n=t.retries??1,r;for(let t=0;t<=n;t+=1)try{return await e()}catch(e){if(r=e,!v(e)||t>=n)break;await new Promise(e=>setTimeout(e,m*(t+1)))}throw v(r)&&b(r),r}var S=e=>(0,f.lazy)(()=>x(e)),C=(e,t)=>!!t?.toLowerCase().startsWith(`video/`)||/^data:video\//i.test(e)||/\.(?:mp4|m4v|webm|mov|ogv|ogg)(?:[?#]|$)/i.test(e),w=(e,t)=>{try{let n=t??(typeof localStorage>`u`?null:localStorage);return!n||n.getItem(e)!==`0`}catch{return!0}},T=(e,t)=>{try{typeof localStorage<`u`&&localStorage.setItem(e,t?`1`:`0`)}catch{}},E=`yuri:markstream-react`,D=e=>w(E,e),O=t(e=>({markstreamReactEnabled:D(),setMarkstreamReactEnabled:t=>{T(E,t),e({markstreamReactEnabled:t})}})),k=null,A=()=>(k??=a(()=>import(`./MarkstreamRendererImpl-Bqbq2VPn.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77])).catch(e=>{throw k=null,e}),k),j=()=>{A().catch(()=>void 0)},M=null,N=()=>(M??=a(()=>import(`./MarkdownRendererImpl-ecACjpZw.js`).then(e=>e.n),__vite__mapDeps([54,1,4,5,15,16,2,3,6,7,8,9,10,11,12,13,14,17,55,23,24,25,26,27,28,29,30,31,19,32,33,34,35,36,37,38,39,40,52,41,56,44,45,46,47,50,51,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76])).catch(e=>{throw M=null,e}),M),P=()=>{N().catch(()=>void 0),D()&&j()},F=class extends f.Component{state={hasError:!1};static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(e){console.warn(`[markstream-react] falling back to the current Markdown renderer`,e)}render(){return this.state.hasError?this.props.fallback:this.props.children}},I=f.createContext(!0),L=()=>f.useContext(I),R=n(),z=S(()=>N().then(e=>({default:e.MarkdownRenderer}))),B=S(()=>A().then(e=>({default:e.MarkstreamRenderer}))),V=S(()=>N().then(e=>({default:e.SimpleMarkdownRenderer}))),H=e=>e===`tool`?`markdown-content markdown-tool`:e===`reasoning`?`markdown-content markdown-reasoning`:`markdown-content leading-relaxed`,U=e=>{let t=(0,d.c)(15),n=O(K),r=typeof e.content==`string`?e.content:``,i=typeof e.variant==`string`?e.variant:`assistant`,a;t[0]!==r||t[1]!==n||t[2]!==e.reserveMeasuredHeight||t[3]!==i?(a=e.reserveMeasuredHeight?l(u(r,n?`markstream:${i}`:i)):void 0,t[0]=r,t[1]=n,t[2]=e.reserveMeasuredHeight,t[3]=i,t[4]=a):a=t[4];let s=a,f;t[5]!==e.className||t[6]!==e.variant?(f=o(`relative break-words w-full min-w-0`,H(e.variant),typeof e.className==`string`?e.className:void 0),t[5]=e.className,t[6]=e.variant,t[7]=f):f=t[7];let p;t[8]!==r||t[9]!==e.animated||t[10]!==s?(p=(0,R.jsx)(c,{animated:e.animated,content:r,reservedHeight:s}),t[8]=r,t[9]=e.animated,t[10]=s,t[11]=p):p=t[11];let m;return t[12]!==f||t[13]!==p?(m=(0,R.jsx)(`div`,{className:f,"aria-busy":`true`,"data-markdown-hydration":`deferred`,"data-markdown-ready":`false`,children:p}),t[12]=f,t[13]=p,t[14]=m):m=t[14],m},W=e=>{let t=(0,d.c)(13),n=L(),r=O(q);if(!n&&e.isStreaming!==!0){let n;return t[0]===e?n=t[1]:(n=(0,R.jsx)(U,{...e,animated:!1,reserveMeasuredHeight:!0}),t[0]=e,t[1]=n),n}let i;t[2]===e?i=t[3]:(i=(0,R.jsx)(f.Suspense,{fallback:(0,R.jsx)(U,{...e,reserveMeasuredHeight:!0}),children:(0,R.jsx)(z,{...e})}),t[2]=e,t[3]=i);let a=i,o;t[4]!==a||t[5]!==r||t[6]!==e?(o=r?(0,R.jsx)(F,{fallback:a,children:(0,R.jsx)(f.Suspense,{fallback:(0,R.jsx)(U,{...e,reserveMeasuredHeight:!0}),children:(0,R.jsx)(B,{...e})})}):a,t[4]=a,t[5]=r,t[6]=e,t[7]=o):o=t[7];let c=o,l;t[8]===e?l=t[9]:(l=t=>{if(!e.onShowPopup||t.button!==0||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey)return;let n=t.target instanceof Element?t.target.closest(`a[href]`):null,r=n?.getAttribute(`href`);if(!r||!C(r))return;t.preventDefault(),t.stopPropagation();let i=n?.textContent?.trim()||r.split(/[/?#]/).filter(Boolean).pop()||r;e.onShowPopup({open:!0,title:i,content:``,video:{url:r,filename:i,directory:s()??``}})},t[8]=e,t[9]=l);let u;return t[10]!==c||t[11]!==l?(u=(0,R.jsx)(`div`,{className:`contents`,onClickCapture:l,children:c}),t[10]=c,t[11]=l,t[12]=u):u=t[12],u},G=e=>{let t=(0,d.c)(4);if(!L()){let n;return t[0]===e?n=t[1]:(n=(0,R.jsx)(U,{...e,animated:!1}),t[0]=e,t[1]=n),n}let n;return t[2]===e?n=t[3]:(n=(0,R.jsx)(f.Suspense,{fallback:(0,R.jsx)(U,{...e}),children:(0,R.jsx)(V,{...e})}),t[2]=e,t[3]=n),n};function K(e){return e.markstreamReactEnabled}function q(e){return e.markstreamReactEnabled}export{C as a,P as i,G as n,S as o,I as r,W as t};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{ot as t,st as n}from"./vendor-base-ui-CzHs0bHY.js";import{r}from"./useUIStore-BsCfUWQw.js";import{n as i}from"./vendor-react-DlzBev0S.js";import{u as a}from"./fileQueries-BaEKb7SZ.js";import{t as o}from"./platform-Dids8J9D.js";import{a as s,i as c,n as l,o as u,r as d,t as f}from"./vendor-markstream-react-6zxyQLCD.js";import{i as p,p as m,r as h}from"./vendor-reactuses-core-CuTmqEMK.js";import{Jn as g,Rn as _}from"./useMobileNavigationStore-SCjA_7jP.js";import{t as v}from"./useThemeSystem-CNzUUkFn.js";import{a as y,t as b}from"./vendor-framer-motion-DDMKlXiP.js";import{i as x,n as S,t as C}from"./tooltip-D5Xeh6py.js";import{a as w,r as T}from"./url-DO6Zrx1P.js";import{n as E}from"./useEffectiveDirectory-Uc8I6wXt.js";import{o as D}from"./image-loading-D1DfK_bJ.js";import{t as O}from"./LoadingImage-MAgXscGl.js";import{r as k}from"./FadeInOnReveal-CK7jBcu4.js";import{r as ee,t as te}from"./markdownHeightCache-DlRC53XG.js";import{t as A}from"./useStreamingTextThrottle-BY1Ynoj1.js";import{r as j,t as M}from"./MarkdownRendererImpl-ecACjpZw.js";import{n as N}from"./fileReferenceParser-BayaidRM.js";import{a as P,c as F,f as I,h as L,i as ne,l as re,m as R,o as z,s as ie,t as ae}from"./fileReferenceActions-D06_lyuL.js";var B=e(n(),1),V=i(),H=`img:not([data-md-link-favicon="true"])`,U=e=>e.getAttribute(`data-md-image-source`)??e.getAttribute(`src`)??``,oe=(e,t)=>{if(e.defaultPrevented||e.button!==0||e.altKey||e.shiftKey)return;let n=e.target;if(!(n instanceof Element))return;if(e.metaKey||e.ctrlKey){let e=n.closest(`a[href]`);if(!(e instanceof HTMLAnchorElement)||!L(e.getAttribute(`href`)??``))return}let r=n.closest(H);if(r instanceof HTMLImageElement&&t.onShowPopup){let n=e.currentTarget;if(!(n instanceof HTMLElement))return;let i=Array.from(n.querySelectorAll(H)).map(e=>({url:U(e),filename:e.alt||U(e)||void 0})).filter(e=>e.url),a=U(r),o=i.findIndex(e=>e.url===a);if(!a)return;e.preventDefault(),e.stopPropagation(),t.onShowPopup({open:!0,title:r.alt||a,content:``,previewSource:r,image:{url:a,...t.effectiveDirectory?{directory:t.effectiveDirectory}:{},filename:r.alt||a,gallery:i,index:o>=0?o:0}});return}if(t.fileReference){let r=n.closest(I);if(r instanceof HTMLElement){e.preventDefault(),e.stopPropagation(),z(r,t.fileReference);return}}let i=n.closest(`a[href]`);if(!(i instanceof HTMLAnchorElement))return;let a=i.getAttribute(`href`)??``;if(L(a)){e.preventDefault(),e.stopPropagation(),t.fileReference&&z(i,t.fileReference);return}if(!T(a))return;e.preventDefault(),e.stopPropagation();let o=(t.effectiveDirectory||``).trim();if(!_()&&o&&t.openInAppBrowser){t.openInAppBrowser(o,a);return}w(a)},se=(e,t)=>{if(e.key!==`Enter`&&e.key!==` `||!t.fileReference)return;let n=e.target;if(!(n instanceof Element))return;let r=n.closest(I);!(r instanceof HTMLElement)||r.getAttribute(`data-yuri-file-link`)!==`true`||(e.preventDefault(),e.stopPropagation(),z(r,t.fileReference))},ce=(e,t)=>{let n=t>=2?e.slice(t-2,t):``;return(t>=1?e.charAt(t-1):``)===`:`||n===`:/`},le=e=>{if(!e.includes(`/`)||!e.includes(`.`))return[{kind:`text`,value:e}];N.lastIndex=0;let t=[],n=0,r=N.exec(e);for(;r;){let i=r[0];if(!i||ce(e,r.index)||!R(i)){r=N.exec(e);continue}r.index>n&&t.push({kind:`text`,value:e.slice(n,r.index)}),t.push({kind:`path`,value:i}),n=r.index+i.length,r=N.exec(e)}return n===0?[{kind:`text`,value:e}]:(n<e.length&&t.push({kind:`text`,value:e.slice(n)}),t)},W=B.createContext({messageId:`markstream`,isStreaming:!1,disableStreamAnimation:!1,variant:`assistant`,enableFileReferences:!0}),G=()=>B.useContext(W),K=t(),ue=24,q=4,de=new Intl.Segmenter(void 0,{granularity:`grapheme`});function fe({node:e}){let t=G(),n=b(),r=t.isStreaming&&!t.disableStreamAnimation&&!n,i=e.content??``,a=B.useRef(i),o=B.useRef(i),s=B.useRef(null),c=B.useRef(new Map);return B.useLayoutEffect(()=>{let e=s.current;if(!e)return;let t=t=>{c.current.delete(t),t.parentNode===e&&(t.replaceWith(document.createTextNode(t.textContent??``)),e.normalize())},n=()=>{for(let[e,n]of c.current)n.stop(),t(e)};if(!r||!i.startsWith(o.current)){n(),e.textContent=i,o.current=i;return}let a=i.slice(o.current.length);if(o.current=i,!a)return;let l=Array.from(de.segment(a),e=>e.segment),u=Math.max(0,l.length-96),d=[];for(let e=u;e<l.length;e+=q)d.push(l.slice(e,e+q).join(``));c.current.size+d.length>ue&&n(),u>0&&e.appendChild(document.createTextNode(l.slice(0,u).join(``))),d.forEach((n,r)=>{let i=document.createElement(`span`);i.dataset.motionStreamChunk=``,i.textContent=n,i.style.opacity=`0`,e.appendChild(i);let a=y([i],{opacity:[0,1]},{duration:.16,delay:Math.min(r*.008,.08),ease:`easeOut`});c.current.set(i,a),a.then(()=>t(i))})},[i,r]),B.useLayoutEffect(()=>{let e=c.current;return()=>{for(let t of e.values())t.stop();e.clear()}},[]),(0,K.jsx)(`span`,{ref:s,className:g(`text-node whitespace-pre-wrap break-words`,e.center&&`text-node-center`),children:a.current})}var J=B.createContext({enabled:!1,insideLink:!1,isMobileSurface:!1,effectiveDirectory:``,preferRuntimeEditor:!1,slots:{used:0,limit:0}}),pe=e=>{let t=(0,V.c)(14),{enabled:n,effectiveDirectory:r,editor:i,preferRuntimeEditor:a,onShowPopup:o,content:s,children:c}=e,l=n?s:``,u;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=_(),t[0]=u):u=t[0];let d;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(d=ne(),t[1]=d):d=t[1];let f;t[2]===l?f=t[3]:(f={content:l,used:0,limit:d},t[2]=l,t[3]=f);let p;t[4]!==i||t[5]!==r||t[6]!==n||t[7]!==o||t[8]!==a||t[9]!==f?(p={enabled:n,insideLink:!1,isMobileSurface:u,effectiveDirectory:r,editor:i,preferRuntimeEditor:a,onShowPopup:o,slots:f},t[4]=i,t[5]=r,t[6]=n,t[7]=o,t[8]=a,t[9]=f,t[10]=p):p=t[10];let m=p,h;return t[11]!==c||t[12]!==m?(h=(0,K.jsx)(J.Provider,{value:m,children:c}),t[11]=c,t[12]=m,t[13]=h):h=t[13],h},Y=({raw:e,referenceKind:t,children:n})=>{let r=B.useContext(J),i=P(e,r.effectiveDirectory,t),a=B.useRef(!1);r.enabled&&i&&!a.current&&r.slots.used<r.slots.limit&&(r.slots.used+=1,a.current=!0);let[o,s]=B.useState(i?ie(i.resolvedPath,r.effectiveDirectory)??null:null),c=i?.resolvedPath;if(B.useEffect(()=>{if(!r.enabled||!c||!a.current)return;let e=!1;return F(c,r.effectiveDirectory).then(t=>{e||s(t)}).catch(()=>{}),()=>{e=!0}},[r.enabled,r.effectiveDirectory,c]),!i)return n??e;let l=!!(a.current&&o&&re(i.resolvedPath,o,r.isMobileSurface));return(0,K.jsx)(`span`,{"data-yuri-block-path-token":`true`,...l?{"data-yuri-file-link":`true`,"data-yuri-file-ref":e,"data-yuri-file-path":i.resolvedPath,"data-yuri-file-binary":String(o?.isBinary===!0),title:ae,...n?{}:{role:`button`,tabIndex:0}}:{},children:n??e})};function me(e){let t=(0,V.c)(18),n=B.useContext(J),r=G(),i;t[0]===r?i=t[1]:(i=()=>r.isStreaming&&!r.disableStreamAnimation&&r.variant!==`tool`?fe:d,t[0]=r,t[1]=i);let[a]=B.useState(i),o=e.node.content??``;if(!n.enabled||n.insideLink){let n;return t[2]!==a||t[3]!==e?(n=(0,K.jsx)(a,{...e,fade:!1}),t[2]=a,t[3]=e,t[4]=n):n=t[4],n}let s,c;if(t[5]!==a||t[6]!==o||t[7]!==e){c=Symbol.for(`react.early_return_sentinel`);bb0:{let n=le(o);if(n.length===1&&n[0]?.kind!==`path`){let n;t[10]!==a||t[11]!==e?(n=(0,K.jsx)(a,{...e,fade:!1}),t[10]=a,t[11]=e,t[12]=n):n=t[12],c=n;break bb0}let r;t[13]!==a||t[14]!==e?(r=(t,n)=>t.kind===`path`?(0,K.jsx)(Y,{raw:t.value},`path-${n}-${t.value}`):(0,K.jsx)(a,{...e,fade:!1,node:{...e.node,content:t.value}},`text-${n}`),t[13]=a,t[14]=e,t[15]=r):r=t[15],s=n.map(r)}t[5]=a,t[6]=o,t[7]=e,t[8]=s,t[9]=c}else s=t[8],c=t[9];if(c!==Symbol.for(`react.early_return_sentinel`))return c;let l;return t[16]===s?l=t[17]:(l=(0,K.jsx)(K.Fragment,{children:s}),t[16]=s,t[17]=l),l}function he(e){let t=(0,V.c)(7),n=B.useContext(J),r=e.node.code??``;if(!n.enabled||!R(r)){let n;return t[0]===e?n=t[1]:(n=(0,K.jsx)(c,{...e}),t[0]=e,t[1]=n),n}let i;t[2]===r?i=t[3]:(i=(0,K.jsx)(Y,{raw:r}),t[2]=r,t[3]=i);let a;return t[4]!==e||t[5]!==i?(a=(0,K.jsx)(c,{...e,children:i}),t[4]=e,t[5]=i,t[6]=a):a=t[6],a}function ge(e){let t=(0,V.c)(20),n=B.useContext(J),r=e.node.href??``,i;t[0]!==n.enabled||t[1]!==r?(i=n.enabled&&R(r),t[0]=n.enabled,t[1]=r,t[2]=i):i=t[2];let a=i,o;t[3]===e?o=t[4]:(o=(0,K.jsx)(l,{...e,showTooltip:!1}),t[3]=e,t[4]=o);let s=o,c;t[5]!==n.isMobileSurface||t[6]!==r||t[7]!==s||t[8]!==e.node.title||t[9]!==e.showTooltip?(c=n.isMobileSurface||e.showTooltip===!1?s:(0,K.jsxs)(C,{children:[(0,K.jsx)(x,{asChild:!0,children:(0,K.jsx)(`span`,{children:s})}),(0,K.jsx)(S,{children:e.node.title||r})]}),t[5]=n.isMobileSurface,t[6]=r,t[7]=s,t[8]=e.node.title,t[9]=e.showTooltip,t[10]=c):c=t[10];let u=c,d;t[11]===n?d=t[12]:(d={...n,insideLink:!0},t[11]=n,t[12]=d);let f;t[13]!==u||t[14]!==a||t[15]!==r?(f=a?(0,K.jsx)(Y,{raw:r,referenceKind:`href`,children:u}):u,t[13]=u,t[14]=a,t[15]=r,t[16]=f):f=t[16];let p;return t[17]!==d||t[18]!==f?(p=(0,K.jsx)(J.Provider,{value:d,children:f}),t[17]=d,t[18]=f,t[19]=p):p=t[19],p}var _e=/^[ \t]{0,3}(`{3,}|~{3,})/,ve=e=>{if(typeof e!=`string`||e.length===0)return!1;let t=e.split(/\r?\n/,1)[0]??``;return _e.test(t)},ye=e=>{let t=0,n=0,r=e.match(/[`~]+/g)??[];for(let e of r)e[0]==="`"?t=Math.max(t,e.length):n=Math.max(n,e.length);return t>=3?"`".repeat(Math.max(3,t+1)):n>=3&&t===0?"```":n>=3?`~`.repeat(Math.max(3,n+1)):"```"},be=e=>{let t=typeof e.raw==`string`?e.raw:``;if(ve(t))return t.endsWith(`
|
|
2
|
-
`)?t:`${t}\n`;let n=(e.language??``).trim(),r=e.code??``,i=ye(r),a=r.endsWith(`
|
|
3
|
-
`)?r:`${r}\n`;return e.loading?`${i}${n}\n${a}`:`${i}${n}\n${a}${i}\n`},xe=e=>{let t=e.partId?`part-${e.partId}`:`body`,n=e.indexKey!==void 0&&e.indexKey!==null&&String(e.indexKey).length>0?String(e.indexKey):e.language&&e.language.length>0?e.language:`code`;return`${e.messageId}:${t}:code:${n}`};function Se(e,t){let n=5381;for(let e=0;e<t.length;e+=1)n=Math.imul(n,33)^t.charCodeAt(e);return`${e}:${(n>>>0).toString(36)}:${t.length}`}function X(e){let t=(0,V.c)(7),n;if(t[0]!==e.indexKey||t[1]!==e.node.code||t[2]!==e.node.language){let r=(e.node.language??``).trim().toLowerCase()||`diagram`;n=e.indexKey??Se(r,e.node.code??``),t[0]=e.indexKey,t[1]=e.node.code,t[2]=e.node.language,t[3]=n}else n=t[3];let r=n,i;return t[4]!==r||t[5]!==e?(i=(0,K.jsx)(Z,{...e,indexKey:r}),t[4]=r,t[5]=e,t[6]=i):i=t[6],i}function Z(e){let t=(0,V.c)(21),n=G(),r=e.node.language??``,i=e.node.code??``,a=e.node.raw??``,o=e.node.loading===!0||e.loading===!0,s;t[0]!==i||t[1]!==r||t[2]!==o||t[3]!==a?(s=be({type:`code_block`,language:r,code:i,raw:a,loading:o}),t[0]=i,t[1]=r,t[2]=o,t[3]=a,t[4]=s):s=t[4];let c=s,l=n.isStreaming||e.loading===!0||e.node.loading===!0,u;t[5]!==n.messageId||t[6]!==n.partId||t[7]!==e.indexKey||t[8]!==e.node.language?(u=xe({messageId:n.messageId,partId:n.partId,indexKey:e.indexKey,language:e.node.language}),t[5]=n.messageId,t[6]=n.partId,t[7]=e.indexKey,t[8]=e.node.language,t[9]=u):u=t[9];let d=u,f=n.enableFileReferences&&!l,p;t[10]!==c||t[11]!==n.disableStreamAnimation||t[12]!==n.onShowPopup||t[13]!==n.variant||t[14]!==d||t[15]!==l||t[16]!==f?(p=(0,K.jsx)(M,{content:c,messageId:d,isAnimated:!1,skipFadeIn:!0,isStreaming:l,disableStreamAnimation:n.disableStreamAnimation,sourceIsPaced:!0,variant:n.variant,onShowPopup:n.onShowPopup,enableFileReferences:f}),t[10]=c,t[11]=n.disableStreamAnimation,t[12]=n.onShowPopup,t[13]=n.variant,t[14]=d,t[15]=l,t[16]=f,t[17]=p):p=t[17];let m;return t[18]!==d||t[19]!==p?(m=(0,K.jsx)(`div`,{className:`yuri-markstream-code-host min-w-0 w-full`,"data-yuri-markstream-code":`markdown-impl`,"data-yuri-markstream-code-id":d,children:p}),t[18]=d,t[19]=p,t[20]=m):m=t[20],m}function Ce(e){let t=(0,V.c)(9),{node:n}=e,r=E()??``,i=D(n.src,r),{onShowPopup:a}=G(),o=h(we),s=i.source||void 0,c=n.title??void 0,l=a?`button`:void 0,u=a?0:void 0,d=a?o:void 0,f;return t[0]!==n.alt||t[1]!==n.src||t[2]!==i.error||t[3]!==s||t[4]!==c||t[5]!==l||t[6]!==u||t[7]!==d?(f=(0,K.jsx)(O,{contentFrame:!0,src:s,resourceError:i.error,"data-md-image-source":n.src,alt:n.alt,title:c,className:`rounded-lg`,role:l,tabIndex:u,onKeyDown:d}),t[0]=n.alt,t[1]=n.src,t[2]=i.error,t[3]=s,t[4]=c,t[5]=l,t[6]=u,t[7]=d,t[8]=f):f=t[8],f}function we(e){(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),e.currentTarget.click())}function Q(e){let t=(0,V.c)(4);if(e.node.type===`code_block`){let n=e,r;return t[0]===n?r=t[1]:(r=(0,K.jsx)(Z,{...n}),t[0]=n,t[1]=r),r}let n=e,r;return t[2]===n?r=t[3]:(r=(0,K.jsx)(Ce,{...n}),t[2]=n,t[3]=r),r}var $=!1;function Te(e){return e.node?.type===`code_block`?B.createElement(Z,e):B.createElement(me,e)}var Ee=()=>{$||($=!0,s({text:Te,inline_code:he,link:ge,image:Q,code_block:u(Z,`block`),mermaid:u(X,`block`),d2:u(X,`block`),d2lang:u(X,`block`),infographic:u(X,`block`)}))},De={parseOptions:{reuseStableTopLevelNodes:!0},maxLiveNodes:0,liveNodeBuffer:0,batchRendering:!1,deferNodesUntilVisible:!1,viewportPriority:!1,smoothStreaming:!1,typewriter:!1,fade:!1};Ee();var Oe=e=>(e.inline.ruler.at(`math`,(e,t)=>{let n=e.src.slice(e.pos),r=j(n),i=n.startsWith(`\\(`)?/^\\\(([\s\S]+?)\\\)/.exec(n):null,a=r?.raw??i?.[0],o=r?.text??i?.[1];if(!a||!o)return!1;if(!t){let t=e.push(`math_inline`,`math`,0);t.content=o,t.markup=r?r.display?`$$`:`$`:`\\(\\)`}return e.pos+=a.length,!0}),e),ke=e=>e===`tool`?`markdown-content markdown-tool yuri-markstream-host`:e===`reasoning`?`markdown-content markdown-reasoning yuri-markstream-host`:`markdown-content leading-relaxed yuri-markstream-host`,Ae=B.memo(({content:e,part:t,messageId:n,className:i,isStreaming:o=!1,disableStreamAnimation:s=!1,variant:c=`assistant`,onShowPopup:l,enableFileReferences:u=!0})=>{let d=v()?.currentTheme.metadata.variant===`dark`,{editor:_,runtime:y}=a(),b=E()??``,x=B.useRef(null),S=t?.id?`yuri-ms-${t.id}`:`yuri-ms-${n}`,C=t?.id,w=!o,T=w?te(e,`markstream:${c}`):``,D=u&&!o,O=D?{effectiveDirectory:b,editor:_,preferRuntimeEditor:y.isVSCode,onShowPopup:l}:void 0,k=B.useMemo(()=>({messageId:n,partId:C,isStreaming:o,disableStreamAnimation:s,variant:c,onShowPopup:l,enableFileReferences:u}),[n,C,o,s,c,l,u]),A=B.useRef(w);A.current=w;let j=B.useRef(T);j.current=T;let M=h(e=>{if(!A.current)return;let t=e[0];if(!t)return;let n=t.borderBoxSize?.[0],r=n?n.blockSize:t.contentRect.height,i=n?n.inlineSize:t.contentRect.width;ee(j.current,r,i)});m(x,M);let N=h((e,t)=>{r.getState().openContextBrowser(e,t)}),P=h(e=>{oe(e,{onShowPopup:l,fileReference:O,effectiveDirectory:b,openInAppBrowser:N})}),F=h(e=>{se(e,{fileReference:O})});return p(`click`,P,x),p(`keydown`,F,x),(0,K.jsx)(`div`,{ref:x,className:g(`relative break-words w-full min-w-0`,ke(c),i),"data-markdown-ready":`true`,"data-markdown-hydration":`ready`,"data-yuri-markdown-engine":`markstream`,"data-yuri-markstream-virtual":`off`,"data-yuri-markstream-streaming":o?`true`:void 0,children:(0,K.jsx)(W.Provider,{value:k,children:(0,K.jsx)(pe,{enabled:D,effectiveDirectory:b,editor:_,preferRuntimeEditor:y.isVSCode,onShowPopup:l,content:e,children:(0,K.jsx)(f,{content:e,customMarkdownIt:Oe,customId:S,final:!o,isDark:d,codeBlockStream:o,...De})})})})},(e,t)=>e.content===t.content&&e.isStreaming===t.isStreaming&&e.disableStreamAnimation===t.disableStreamAnimation&&e.variant===t.variant&&e.isAnimated===t.isAnimated&&e.skipFadeIn===t.skipFadeIn&&e.className===t.className&&e.messageId===t.messageId&&e.onShowPopup===t.onShowPopup&&e.enableFileReferences===t.enableFileReferences&&e.part?.id===t.part?.id),je=e=>{let t=(0,V.c)(7),n=e.content,r=e.isStreaming===!0,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=k(o()),t[0]=i):i=t[0];let a;t[1]!==e.content||t[2]!==r?(a={text:n,isStreaming:r,throttleMs:i.markdownPaceMs},t[1]=e.content,t[2]=r,t[3]=a):a=t[3];let s=A(a),c=e.isStreaming?s:e.content,l;return t[4]!==e||t[5]!==c?(l=(0,K.jsx)(Ae,{...e,content:c}),t[4]=e,t[5]=c,t[6]=l):l=t[6],l},Me=e=>{let t=(0,V.c)(3),n=`${e.messageId}:${e.part?.id??`text`}`,r;return t[0]!==e||t[1]!==n?(r=(0,K.jsx)(je,{...e},n),t[0]=e,t[1]=n,t[2]=r):r=t[2],r};export{Me as MarkstreamRenderer};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,n}from"./runtime-switch-ibQIZnws.js";import{n as r}from"./runtime-fetch-9B8F_rKW.js";import{ot as i,st as a}from"./vendor-base-ui-CzHs0bHY.js";import{n as o}from"./vendor-react-DlzBev0S.js";import{s}from"./vendor-tanstack-react-query-B-Wpqq5J.js";import{g as c}from"./fileQueries-BaEKb7SZ.js";import{Ba as l,Jn as u,Kn as d,Ra as f}from"./useMobileNavigationStore-SCjA_7jP.js";import{i as p}from"./store-Myt_Fv8d.js";import{n as m}from"./Icon-DsN23fuV.js";var h=e(a(),1),g=o(),_=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}},v=e=>{if(!e||typeof e!=`object`)return!1;let t=`name`in e?String(e.name):``;return t===`AbortError`||t===`TimeoutError`},y=class extends _{operation;constructor(e,t,n){super(e,t,`share_operation`),this.operation=n}},b=(e,t=200)=>{throw new _(`invalid_${e}_response`,t,e)},x=(e,t)=>e&&typeof e==`object`&&!Array.isArray(e)?e:b(t),S=(e,t)=>typeof e==`string`?e:b(t),C=(e,t)=>e===null||typeof e==`string`?e:b(t),w=(e,t)=>typeof e==`number`&&Number.isFinite(e)?e:b(t),T=(e,t)=>e===null?null:w(e,t),E=(e,t)=>typeof e==`boolean`?e:b(t),D=(e,t,n)=>t.includes(e)?e:b(n),O=e=>{let t=x(e,`capability`);return{supported:E(t.supported,`capability`),enabled:E(t.enabled,`capability`),revision:w(t.revision,`capability`),serverInstanceID:C(t.serverInstanceID,`capability`),sharingAvailable:t.sharingAvailable!==void 0&&E(t.sharingAvailable,`capability`)}},k=e=>{if(e==null)return null;let t=x(e,`assistant`);return{turnID:S(t.turnID,`assistant`),messageID:S(t.messageID,`assistant`),status:D(t.status,[`queued`,`running`],`assistant`),admittedAt:w(t.admittedAt,`assistant`)}},A=e=>{if(e==null)return null;let t=x(e,`assistant_preview`),n=w(t.ordinal,`assistant_preview`);return!Number.isSafeInteger(n)||n<0?b(`assistant_preview`):{...t.createdAt===void 0?{}:{createdAt:w(t.createdAt,`assistant_preview`)},messageID:S(t.messageID,`assistant_preview`),ordinal:n,role:D(t.role,[`user`,`assistant`],`assistant_preview`),text:S(t.text,`assistant_preview`),fallbackKind:t.fallbackKind===null?null:D(t.fallbackKind,[`image`,`file`,`session`,`assistant`,`schedule`],`assistant_preview`)}},j=e=>{let t=w(e,`assistant_read`);return Number.isSafeInteger(t)&&t>=0?t:b(`assistant_read`)},M=e=>{let t=x(e,`assistant_read`);return{generation:j(t.generation),ordinal:j(t.ordinal),messageID:S(t.messageID,`assistant_read`)}},N=e=>({unreadCount:e.unreadCount===void 0?0:j(e.unreadCount),readWatermark:e.readWatermark==null?null:M(e.readWatermark),readTip:e.readTip==null?null:M(e.readTip)}),P=e=>{let t=x(e,`assistant_read`);return{assistantID:S(t.assistantID,`assistant_read`),changed:E(t.changed,`assistant_read`),unreadCount:j(t.unreadCount),readWatermark:M(t.readWatermark),readTip:M(t.readTip),revision:j(t.revision)}},F=e=>{let t=x(e,`assistant`),n=Array.isArray(t.historySessionIDs)?t.historySessionIDs.map(e=>S(e,`assistant`)):[],r=t.historySessionCount===void 0?n.length:w(t.historySessionCount,`assistant`);if(!Number.isSafeInteger(r)||r<n.length)return b(`assistant`);let i=Array.isArray(t.assignedSessionIDs)?t.assignedSessionIDs.map(e=>S(e,`assistant`)):[],a=t.activeContactTurn===void 0?null:k(t.activeContactTurn),o=t.working===void 0?a!=null:E(t.working,`assistant`);return{...N(t),pinnedAt:t.pinnedAt===void 0?void 0:T(t.pinnedAt,`assistant`),latestMessagePreview:A(t.latestMessagePreview),id:S(t.id,`assistant`),avatarSeed:S(t.avatarSeed??t.id,`assistant`),revision:w(t.revision,`assistant`),enabled:E(t.enabled,`assistant`),name:S(t.name,`assistant`),defaultPrompt:S(t.defaultPrompt,`assistant`),workspacePath:C(t.workspacePath,`assistant`),effectiveWorkspacePath:S(t.effectiveWorkspacePath,`assistant`),managedWorkspacePath:C(t.managedWorkspacePath??null,`assistant`),providerID:S(t.providerID,`assistant`),modelID:S(t.modelID,`assistant`),agent:C(t.agent,`assistant`),variant:C(t.variant??null,`assistant`),mode:D(t.mode,[`continuous`,`stateless`],`assistant`),sessionID:C(t.sessionID,`assistant`),sessionGeneration:w(t.sessionGeneration,`assistant`),historySessionIDs:n,historySessionCount:r,assignedSessionIDs:i,working:o,activeContactTurn:a,createdAt:T(t.createdAt,`assistant`),updatedAt:w(t.updatedAt,`assistant`),tombstoneAt:T(t.tombstoneAt,`assistant`)}},I=e=>{let t=x(e,`snapshot`);return{revision:w(t.revision,`snapshot`),enabled:E(t.enabled,`snapshot`),assistants:Array.isArray(t.assistants)?t.assistants.map(F):b(`snapshot`)}},L=e=>{let t=x(e,`binding`);return{sessionID:C(t.sessionID,`binding`),directory:S(t.directory,`binding`),sessionGeneration:w(t.sessionGeneration,`binding`)}},R=e=>{let t=x(e,`message_admission`);if(t.admitted!==!0)return b(`message_admission`);let n=t.revision===void 0||t.revision===null?null:w(t.revision,`message_admission`);return{binding:L(t.binding),messageID:S(t.messageID,`message_admission`),admitted:!0,revision:n,...t.replayed===!0?{replayed:!0}:{}}},z=e=>{let t=x(e,`share_operation`);return{operationID:S(t.operationID,`share_operation`),assistantID:S(t.assistantID,`share_operation`),sessionID:C(t.sessionID,`share_operation`),messageID:C(t.messageID,`share_operation`),state:D(t.state,[`submitting`,`running`,`completed`,`failed`,`unresolved`],`share_operation`),phase:S(t.phase,`share_operation`),attempt:w(t.attempt,`share_operation`),leaseExpiresAt:T(t.leaseExpiresAt,`share_operation`),errorCode:C(t.errorCode,`share_operation`)}},B=e=>{let t=x(e,`assistant_contact_part`);if(t.type===`text`)return{type:`text`,text:S(t.text,`assistant_contact_part`)};if(t.type===`file`){let e=t.filename===void 0||t.filename===null?void 0:S(t.filename,`assistant_contact_part`),n=S(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 b(`assistant_contact_part`);if(i){let r=w(t.size,`assistant_contact_part`);return!Number.isSafeInteger(r)||r<0?b(`assistant_contact_part`):{type:`file`,mime:n,attachmentID:S(t.attachmentID,`assistant_contact_part`),sha256:S(t.sha256,`assistant_contact_part`),size:r,...e?{filename:e}:{}}}return r?{type:`file`,mime:n,url:S(t.url,`assistant_contact_part`),...e?{filename:e}:{}}:b(`assistant_contact_part`)}if(t.type===`card`){let e=D(t.cardType,[`session`,`assistant`,`schedule`],`assistant_contact_part`);return e===`session`?{type:`card`,cardType:`session`,sessionID:S(t.sessionID,`assistant_contact_part`),directory:S(t.directory,`assistant_contact_part`),title:C(t.title??null,`assistant_contact_part`),status:C(t.status??null,`assistant_contact_part`),branch:C(t.branch??null,`assistant_contact_part`)}:e===`assistant`?{type:`card`,cardType:`assistant`,assistantID:S(t.assistantID,`assistant_contact_part`),name:S(t.name,`assistant_contact_part`),providerID:S(t.providerID,`assistant_contact_part`),modelID:S(t.modelID,`assistant_contact_part`),mode:D(t.mode??`continuous`,[`continuous`,`stateless`],`assistant_contact_part`)}:{type:`card`,cardType:`schedule`,taskID:S(t.taskID,`assistant_contact_part`),projectID:S(t.projectID,`assistant_contact_part`),name:S(t.name,`assistant_contact_part`),kind:C(t.kind??null,`assistant_contact_part`),time:C(t.time??null,`assistant_contact_part`),timezone:C(t.timezone??null,`assistant_contact_part`),prompt:C(t.prompt??null,`assistant_contact_part`),...t.cron===void 0?{}:{cron:C(t.cron,`assistant_contact_part`)},...t.date===void 0?{}:{date:C(t.date,`assistant_contact_part`)},...t.times===void 0?{}:{times:t.times===null?null:Array.isArray(t.times)?t.times.map(e=>S(e,`assistant_contact_part`)):b(`assistant_contact_part`)},...t.weekdays===void 0?{}:{weekdays:t.weekdays===null?null:Array.isArray(t.weekdays)?t.weekdays.map(e=>{let t=w(e,`assistant_contact_part`);return Number.isInteger(t)&&t>=0&&t<=6?t:b(`assistant_contact_part`)}):b(`assistant_contact_part`)}}}return b(`assistant_contact_part`)},ee=e=>{let t=x(e,`assistant_contact`),n=C(t.nextCursor,`assistant_contact`),r=E(t.complete,`assistant_contact`);if(!r&&!n||r&&n||!Array.isArray(t.messages))return b(`assistant_contact`);let i=w(t.generation,`assistant_contact`),a=w(t.revision,`assistant_contact`);return!Number.isSafeInteger(i)||i<0||!Number.isSafeInteger(a)||a<0?b(`assistant_contact`):{messages:t.messages.map(e=>{let t=x(e,`assistant_contact_message`);if(!Array.isArray(t.parts))return b(`assistant_contact_message`);let n=t.parts.map(B);return{messageID:S(t.messageID,`assistant_contact_message`),assistantID:S(t.assistantID,`assistant_contact_message`),role:D(t.role,[`user`,`assistant`,`peer`],`assistant_contact_message`),turnID:S(t.turnID,`assistant_contact_message`),bubbleIndex:w(t.bubbleIndex,`assistant_contact_message`),createdAt:w(t.createdAt,`assistant_contact_message`),ordinal:w(t.ordinal,`assistant_contact_message`),status:S(t.status,`assistant_contact_message`),fromAssistantID:C(t.fromAssistantID??null,`assistant_contact_message`),fromAssistantName:C(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}},te=e=>{let t=x(e,`assistant_scheduled_tasks`);return Array.isArray(t.tasks)?{tasks:t.tasks.map(e=>{let t=x(e,`assistant_scheduled_task`),n=t.task===null||t.task===void 0?null:x(t.task,`assistant_scheduled_task_live`);return{assistantID:S(t.assistantID,`assistant_scheduled_task`),projectID:S(t.projectID,`assistant_scheduled_task`),taskID:S(t.taskID,`assistant_scheduled_task`),createdAt:w(t.createdAt,`assistant_scheduled_task`),projectPath:C(t.projectPath??null,`assistant_scheduled_task`),projectLabel:C(t.projectLabel??null,`assistant_scheduled_task`),task:n}})}:b(`assistant_scheduled_tasks`)},V=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},H=e=>{let t=typeof e==`string`?e.trim():``;if(!t)throw Error(`projectId is required`);return t},ne=e=>e===null||typeof e==`string`,re=e=>e===null||typeof e==`number`&&Number.isFinite(e),ie=e=>typeof e==`number`&&Number.isFinite(e)&&e>=0&&e<=864e13,ae=e=>e===null||ie(e),oe=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`)&&ne(t.sessionId)&&ne(t.directory)&&ne(t.error)&&ie(t.startedAt)&&ae(t.finishedAt)&&re(t.durationMs)&&(t.durationMs===null||t.durationMs>=0)},se=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(oe)||!ne(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}},ce=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 V(a,`Failed to load scheduled task history`));return se(await a.json().catch(()=>null))},le=async({signal:e}={})=>{let t=await r(`/api/yuri/scheduled-tasks`,{signal:e});if(!t.ok)throw Error(await V(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`):[]}},ue=async(e,t)=>{let n=H(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 V(i,`Failed to save schedule`));let a=await i.json().catch(()=>null);return!a||!Array.isArray(a.tasks)?[]:a.tasks},de=async(e,t)=>{let n=H(e),i=H(t),a=await r(`/api/projects/${encodeURIComponent(n)}/scheduled-tasks/${encodeURIComponent(i)}`,{method:`DELETE`,headers:{accept:`application/json`}});if(!a.ok)throw Error(await V(a,`Failed to delete schedule`));let o=await a.json().catch(()=>null);return!o||!Array.isArray(o.tasks)?[]:o.tasks},fe=async(e,t)=>{let n=H(e),i=H(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 V(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}},pe=(e,t)=>e.ordinal===t.ordinal?e.messageID<t.messageID?-1:+(e.messageID>t.messageID):e.ordinal-t.ordinal,me=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.`)},he=(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(me)){r=i;break}}if(!r)return null;let i=e.readWatermark;return i&&(i.generation>t.generation||i.generation===t.generation&&pe({ordinal:i.ordinal,messageID:i.messageID},{ordinal:r.ordinal,messageID:r.messageID})>=0)?null:{generation:t.generation,ordinal:r.ordinal,messageID:r.messageID}},ge=()=>({messages:[],generation:-1,revision:0,olderCursor:null,olderComplete:!0,hasMessageGap:!1,gapCursor:null,gapRequestIDs:null,gapTargetIDs:null,liveWindowIDs:[]}),_e=e=>!!(e&&e.generation>=0),ve=(e,t)=>pe({ordinal:e.ordinal,messageID:e.messageID},{ordinal:t.ordinal,messageID:t.messageID}),U=(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(ve)},ye=e=>{let t=1/0;for(let n of e)n.ordinal<t&&(t=n.ordinal);return Number.isFinite(t)?t:null},be=e=>e.map(e=>e.messageID),xe=(e,t)=>{for(let n of e)if(t.has(n))return!0;return!1},Se=e=>new Set(e),Ce=(e,t)=>!e||!t||e.length!==t.length?!1:e.every((e,n)=>e===t[n]),we=e=>({...e,hasMessageGap:!1,gapCursor:null,gapRequestIDs:null,gapTargetIDs:null}),Te=e=>({ordinal:e.ordinal,messageID:e.messageID}),Ee=(e,t,n)=>{if(n)return[...t];if(t.length===0)return[...e];let r=t[0];return[...e.filter(e=>pe(Te(e),Te(r))<0),...t]},De=(e,t)=>{let n=e??ge(),r=_e(n),i=[...t.messages].sort(ve),a=be(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=Ee(n.messages,i,t.complete);else{let e=ye(i);c=U(n.messages.filter(t=>t.ordinal<e),U(n.messages.filter(t=>t.ordinal>=e),i,`existing`),`incoming`)}let l=n.liveWindowIDs,u=Se(a),d=l.length>0&&xe(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}},Oe=(e,t)=>{if(!_e(e)||t.generation!==e.generation)return e;let n=t.revision>=e.revision?`incoming`:`existing`,r=U(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}},ke=(e,t,n)=>{if(!_e(e)||t.generation!==e.generation)return e;let r=t.revision>=e.revision?`incoming`:`existing`,i=U(e.messages,t.messages,r),a=Math.max(e.revision,t.revision),o=n?.requestIDs??e.gapRequestIDs;if(!(e.hasMessageGap&&o&&e.gapRequestIDs&&Ce(o,e.gapRequestIDs)))return{...e,messages:i,revision:a};let s=be(t.messages),c=e.gapTargetIDs??[],l=Se(c);return c.length>0&&xe(s,l)||t.complete||!t.nextCursor?we({...e,messages:i,revision:a}):{...e,messages:i,revision:a,hasMessageGap:!0,gapCursor:t.nextCursor??e.gapCursor,gapRequestIDs:e.gapRequestIDs,gapTargetIDs:e.gapTargetIDs}},W={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`]},G=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 _(e,n.status,void 0,t)}return i},K=(e,t)=>({method:e,headers:{"Content-Type":`application/json`},body:t===void 0?void 0:JSON.stringify(t)}),q=(e,r)=>{if(t()!==e||n()!==r)throw new _(`runtime_stale`,409)},Ae=(e,t,r)=>{c.setQueryData(W.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:W.snapshot(r)}),c.invalidateQueries({queryKey:[r,n(),`assistants`,`history`,e]})},je=(e,t)=>{c.setQueryData(W.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:W.snapshot(t)})},Me=2500,Ne=15e3,Pe=e=>!!e?.assistants.some(e=>e.working||e.activeContactTurn),Fe=(e,t={})=>{if(t.assistantID){let n=e?.assistants.find(e=>e.id===t.assistantID);return n?.working||n?.activeContactTurn?Me:Ne}return Pe(e)?Me:Ne},J=(e=t())=>({queryKey:W.snapshot(e),queryFn:async({signal:e})=>I(await G(`/api/yuri/assistants/snapshot`,{signal:e})),staleTime:0,retry:2,refetchInterval:e=>Fe(e.state.data),refetchIntervalInBackground:!1,refetchOnWindowFocus:!0,refetchOnReconnect:!0}),Y=new Map,Ie=e=>{let r=Y.get(e);if(r)r.count+=1;else{let r=n(),i=!1,a=!1,o=!1,s=()=>!i&&t()===e&&n()===r,u=async()=>{if(o=!0,!a){a=!0;try{do o=!1,c.getQueryCache().find({queryKey:W.snapshot(e),exact:!0})?.state.fetchStatus===`fetching`&&(o=!0),await c.invalidateQueries({queryKey:W.snapshot(e),exact:!0},{cancelRefetch:!1});while(o&&s())}finally{a=!1}}},d=l(t=>{if(!s())return;let n=c.getQueryData(W.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()});Y.set(e,{count:1,dispose:()=>{i=!0,d()}})}return()=>{let t=Y.get(e);t&&--t.count===0&&(t.dispose(),Y.delete(e))}},Le=e=>{let n=(0,g.c)(7),r,i,a;n[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=t(),i=s,r=J(a),n[0]=r,n[1]=i,n[2]=a):(r=n[0],i=n[1],a=n[2]);let o;n[3]===e?o=n[4]:(o={...r,select:e},n[3]=e,n[4]=o);let c=i(o),l,u;return n[5]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>Ie(a),u=[a],n[5]=l,n[6]=u):(l=n[5],u=n[6]),h.useEffect(l,u),c},Re=e=>e.enabled?e.assistants.reduce((e,t)=>e+(t.unreadCount??0),0):0,ze=()=>{let e=(0,g.c)(5),n,r,i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=t(),n=s,r={...J(i),select:Re},e[0]=n,e[1]=r,e[2]=i):(n=e[0],r=e[1],i=e[2]);let a=n(r),o,c;return e[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>Ie(i),c=[i],e[3]=o,e[4]=c):(o=e[3],c=e[4]),h.useEffect(o,c),a.data??0},Be=e=>e.enabled&&Pe(e),Ve=()=>{let e=(0,g.c)(5),n,r,i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=t(),n=s,r={...J(i),select:Be},e[0]=n,e[1]=r,e[2]=i):(n=e[0],r=e[1],i=e[2]);let a=n(r),o,c;return e[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>Ie(i),c=[i],e[3]=o,e[4]=c):(o=e[3],c=e[4]),h.useEffect(o,c),a.data??!1},He=(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}`},X=async(e,t,n)=>ee(await G(He(e,t),n?{signal:n}:{})),Ue=(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,Z=new Map,We=new Map,Q=e=>e.join(``),Ge=async(e,t,n,r,i)=>{let a=Q(t),o=We.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;){q(r.transport,r.runtimeGeneration),o+=1;let n=a.gapCursor;try{let o=await X(e,{limit:20,before:n},i);q(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=ke(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||v(e))break;l=!0,a=c.getQueryData(t)??a;break}}return{view:c.getQueryData(t)??a,failed:l,progressed:s}})();We.set(a,s);try{return await s}finally{We.get(a)===s&&We.delete(a)}},Ke=(e,r=t(),i=n(),a={})=>({queryKey:W.contact(e,r,i),queryFn:async({signal:t})=>{q(r,i),await f(),q(r,i);let n=W.contact(e,r,i),a=c.getQueryData(n),o=await X(e,{limit:20},t);q(r,i);let s=De(c.getQueryData(n)??a??null,o);c.setQueryData(n,s);let l=Q(n);if(s.hasMessageGap&&s.gapCursor){Z.delete(l);let a=await Ge(e,n,s,{transport:r,runtimeGeneration:i},t);s=a.view,(a.failed||a.view.hasMessageGap&&!a.progressed)&&a.view.gapCursor&&Z.set(l,a.view.gapCursor)}else Z.delete(l);q(r,i);let u=c.getQueryData(n)??s;return a&&Ue(a,u)?a:u},retry:2,staleTime:0,refetchInterval:()=>a.reconcileInForeground?Fe(c.getQueryData(W.snapshot(r)),{assistantID:e}):!1,refetchIntervalInBackground:!1,refetchOnWindowFocus:!0,refetchOnReconnect:!0,structuralSharing:!0}),qe=(e,r=!0)=>{let i=t(),a=n(),[o,u]=h.useState(!1),[d,f]=h.useState(null),[p,m]=h.useState(!1),g=h.useRef(null),_=h.useRef(null),y=h.useRef(null),b=h.useRef(null),x=h.useRef({assistantID:e,transport:i,runtimeGeneration:a,enabled:r});x.current={assistantID:e,transport:i,runtimeGeneration:a,enabled:r};let S=s({...Ke(e,i,a,{reconcileInForeground:!0}),enabled:r&&!!e});h.useEffect(()=>{!r||!e||c.invalidateQueries({queryKey:W.snapshot(i),exact:!0},{cancelRefetch:!1})},[e,r,a,i]),h.useEffect(()=>l(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:W.contact(e,i,a),exact:!0}))}),[e,a,i]),h.useEffect(()=>{let t=Q(W.contact(e,i,a));return()=>{y.current?.abort(),b.current?.abort(),y.current=null,b.current=null,g.current=null,_.current=null,Z.delete(t)}},[e,i,a,r]);let C=S.data,w=W.contact(e,i,a),T=async()=>{if(!e||!r)return;if(g.current)return g.current;let t=c.getQueryData(w)??C;if(!t||t.olderComplete||!t.olderCursor)return;f(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{q(o.transport,o.runtimeGeneration);let e=await X(o.assistantID,{limit:20,before:o.cursor},n.signal);if(n.signal.aborted||(q(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,Oe(r,e))}catch(e){if(n.signal.aborted||v(e))return;let t=e instanceof Error?e:Error(String(e));throw f(t),t}finally{b.current===n&&(b.current=null),u(!1),g.current=null}})();return g.current=s,s},E=async(t=`explicit`)=>{if(!e||!r)return;if(_.current)return _.current;let n=c.getQueryData(w)??C;if(!n?.hasMessageGap||!n.gapCursor)return;let o=Q(w);if(t===`auto`&&Z.get(o)===n.gapCursor)return;t===`explicit`&&Z.delete(o),m(!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{q(l.transport,l.runtimeGeneration);let e=await Ge(l.assistantID,w,n,{transport:l.transport,runtimeGeneration:l.runtimeGeneration},s.signal);if(s.signal.aborted)return;if(q(l.transport,l.runtimeGeneration),e.failed||!e.progressed){e.view.gapCursor&&Z.set(o,e.view.gapCursor);return}e.view.hasMessageGap||Z.delete(o)}catch(e){if(s.signal.aborted||v(e))return;throw Z.set(o,l.cursor),e}finally{y.current===s&&(y.current=null),m(!1),_.current=null}})();return _.current=u,u};return h.useEffect(()=>{if(!r||!e||!C?.hasMessageGap||!C.gapCursor||S.isFetching||p)return;let t=Q(w);Z.get(t)!==C.gapCursor&&E(`auto`).catch(()=>void 0)},[r,e,C?.hasMessageGap,C?.gapCursor,S.isFetching,p,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:o,previousPageError:d,hasMessageGap:!!C?.hasMessageGap,isFillingMessageGap:p,retryMessageGap:()=>E(`explicit`)}},Je=async(e,r)=>{let i=t(),a=n();await f(),q(i,a);let o=await X(e,{messageID:r,limit:1});if(q(i,a),!o.messages.some(e=>e.messageID===r&&e.role===`user`))return null;c.invalidateQueries({queryKey:W.contact(e,i,a),exact:!0}),c.invalidateQueries({queryKey:W.snapshot(i),exact:!0});let s=c.getQueryData(W.snapshot(i));return{admitted:!0,messageID:r,revision:o.revision??s?.revision??null}},Ye=(e,r=t(),i=n())=>({queryKey:W.scheduledTasks(e,r,i),queryFn:async({signal:t})=>{q(r,i);let n=te(await G(`/api/yuri/assistants/${encodeURIComponent(e)}/scheduled-tasks`,{signal:t}));return q(r,i),n},refetchOnMount:`always`,retry:(e,t)=>!(t instanceof _&&t.status===404)&&e<2}),Xe=(e,r)=>{let i=(0,g.c)(6),a=r===void 0||r,o,c;if(i[0]!==e){let r=t(),a=n();c=s,o=Ye(e,r,a),i[0]=e,i[1]=o,i[2]=c}else o=i[1],c=i[2];let l=a&&!!e,u;return i[3]!==o||i[4]!==l?(u={...o,enabled:l},i[3]=o,i[4]=l,i[5]=u):u=i[5],c(u)},Ze=(e=t())=>({queryKey:W.globalScheduledTasks(e),queryFn:le,refetchOnMount:`always`}),Qe=e=>{let t=(0,g.c)(3),n=e===void 0||e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=Ze(),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),s(i)},$e=e=>e.tasks.some(({task:e})=>e.state.lastStatus===`running`),et=()=>{let e=(0,g.c)(5),n,r,i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=t(),n=s,r={...Ze(i),select:$e,staleTime:0,refetchInterval:yt,refetchIntervalInBackground:!1},e[0]=n,e[1]=r,e[2]=i):(n=e[0],r=e[1],i=e[2]);let a=n(r),o,u;return e[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>l(e=>{t()===i&&(e.type===`scheduled-task-ran`||e.type===`event-stream-ready`)&&c.invalidateQueries({queryKey:Ze(i).queryKey,exact:!0})}),u=[i],e[3]=o,e[4]=u):(o=e[3],u=e[4]),h.useEffect(o,u),a.data===!0},tt=(e,r=t())=>{c.invalidateQueries({queryKey:[r,n(),`assistants`,`contact`,e]})},nt=(e=t())=>({queryKey:W.capability(e),queryFn:()=>gt(),retry:!1}),rt=()=>{let e=(0,g.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=nt(),e[0]=t):t=e[0],s(t)},it=(e=c,n=t())=>e.getQueryData(W.snapshot(n)),at=(e=c,n=t())=>e.fetchQuery(J(n)),ot=async(e=c)=>{let r=t(),i=n();await e.invalidateQueries({queryKey:W.snapshot(r),exact:!0}),q(r,i);let a=await e.fetchQuery(J(r));return q(r,i),a},st=15e3,ct=e=>{throw e instanceof _?e:v(e)?new _(`admission_timeout`,408):e},lt=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(st);try{let t=R(await G(`/api/yuri/assistants/${encodeURIComponent(e)}/messages`,{...K(`POST`,{messageID:r,parts:s,language:p.getState().locale}),signal:c}));return q(a,o),Ae(e,t.binding,a),tt(e,a),t}catch(e){return ct(e)}},ut=async(e,r,i,a,o)=>{let s=t(),c=n(),l=z(await G(`/api/yuri/assistants/${encodeURIComponent(e)}/share`,K(`POST`,{operationID:r,payload:{messageID:i,parts:a,source:o}})));return q(s,c),l},dt=async(e,r=t(),i=n())=>{q(r,i);let a=z(await G(`/api/yuri/assistants/share-operations/${encodeURIComponent(e)}`));return q(r,i),a},ft=async(e,r=t(),i=n())=>{let a=e;for(let e=0;e<60&&(a.state===`running`||a.state===`submitting`);e+=1)q(r,i),await new Promise(e=>setTimeout(e,750)),a=await dt(a.operationID,r,i);if(q(r,i),a.state===`completed`)return a;throw a.state===`failed`?new y(a.errorCode??`share_failed`,400,a):new y(`share_unresolved`,408,a)},pt=async e=>{let n=t(),r=F(await G(`/api/yuri/assistants`,K(`POST`,{...e,language:p.getState().locale})));return je(r,n),r},mt=async(e,r)=>{let i=t(),a=n(),o=F(await G(`/api/yuri/assistants/${encodeURIComponent(e.id)}`,K(`PATCH`,{...r,expectedRevision:e.revision})));return q(i,a),r.pinned===void 0?je(o,i):(await c.cancelQueries({queryKey:W.snapshot(i),exact:!0}),q(i,a),await c.fetchQuery(J(i)),q(i,a)),o},ht=async e=>{await G(`/api/yuri/assistants/${encodeURIComponent(e.id)}`,K(`DELETE`,{expectedRevision:e.revision})),await c.invalidateQueries({queryKey:W.snapshot(t())})},gt=async()=>O(await G(`/api/yuri/assistants/capability`)),_t=async(e,r)=>{let i=t(),a=n(),o=M(r);try{let t=P(await G(`/api/yuri/assistants/${encodeURIComponent(e)}/contact/read`,{...K(`POST`,o),signal:AbortSignal.timeout(15e3)}));if(q(i,a),t.assistantID!==e)throw new _(`invalid_assistant_read_response`,200);return t}finally{t()===i&&n()===a&&c.invalidateQueries({queryKey:W.snapshot(i),exact:!0})}},vt=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=>(q(i,a),_t(e.id,e.position)))));return{failed:o.filter(e=>e.status===`rejected`).length}};function yt(e){return e.state.data&&$e(e.state.data)?2500:15e3}var $=i();function bt(e){let t=(0,g.c)(33),{title:n,subtitle:r,backAriaLabel:i,onBack:a,backDisabled:o,actions:s,trailing:c,sticky:l,overlay:f,elevated:p,collapsible:h}=e,_=o!==void 0&&o,v;t[0]===s?v=t[1]:(v=s===void 0?[]:s,t[0]=s,t[1]=v);let y=v,b=l!==void 0&&l,x=f!==void 0&&f,S=p!==void 0&&p,C=h!==void 0&&h,w=Array.isArray(c)?c.filter(Boolean).length:+!!c,T=S||y.some(St),E=C?`true`:void 0,D=b&&`yuri-mobile-detail-navigation-sticky`,O=x&&`absolute inset-x-0 top-0`,k=T?`z-[60]`:x?`z-30`:void 0,A;t[2]!==O||t[3]!==k||t[4]!==D?(A=u(`yuri-mobile-detail-navigation relative shrink-0 pt-[max(0.25rem,var(--yuri-safe-area-top,0px))]`,D,O,k),t[2]=O,t[3]=k,t[4]=D,t[5]=A):A=t[5];let j=y.length+w>1?`grid-cols-[2.75rem_minmax(0,1fr)_auto]`:`grid-cols-[2.75rem_minmax(0,1fr)_2.75rem]`,M;t[6]===j?M=t[7]:(M=u(`yuri-mobile-detail-navigation-content grid items-center gap-1 px-4`,j),t[6]=j,t[7]=M);let N;t[8]!==i||t[9]!==_||t[10]!==a?(N=a?(0,$.jsx)(d,{type:`button`,variant:`mobileGlass`,size:`mobileIcon`,className:`justify-self-start`,onClick:a,disabled:_,"aria-label":i,children:(0,$.jsx)(m,{name:`arrow-left-s`,className:`size-5`})}):(0,$.jsx)(`span`,{"aria-hidden":`true`}),t[8]=i,t[9]=_,t[10]=a,t[11]=N):N=t[11];let P;t[12]===n?P=t[13]:(P=(0,$.jsx)(`div`,{className:`yuri-mobile-detail-title w-full truncate typography-ui-label font-medium text-foreground`,children:n}),t[12]=n,t[13]=P);let F;t[14]===r?F=t[15]:(F=r?(0,$.jsx)(`div`,{className:`yuri-mobile-detail-subtitle w-full truncate text-muted-foreground`,"aria-live":`polite`,children:r}):null,t[14]=r,t[15]=F);let I;t[16]!==P||t[17]!==F?(I=(0,$.jsxs)(`div`,{className:`flex w-full max-w-72 min-w-0 flex-col items-center justify-center justify-self-center px-1`,children:[P,F]}),t[16]=P,t[17]=F,t[18]=I):I=t[18];let L;t[19]===y?L=t[20]:(L=y.map(xt),t[19]=y,t[20]=L);let R;t[21]!==L||t[22]!==c?(R=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center justify-end gap-2`,children:[c,L]}),t[21]=L,t[22]=c,t[23]=R):R=t[23];let z;t[24]!==M||t[25]!==N||t[26]!==I||t[27]!==R?(z=(0,$.jsxs)(`div`,{className:M,children:[N,I,R]}),t[24]=M,t[25]=N,t[26]=I,t[27]=R,t[28]=z):z=t[28];let B;return t[29]!==A||t[30]!==z||t[31]!==E?(B=(0,$.jsx)(`header`,{"data-yuri-collapsible-header":E,className:A,children:z}),t[29]=A,t[30]=z,t[31]=E,t[32]=B):B=t[32],B}function xt(e,t){return(0,$.jsx)(d,{type:`button`,variant:`mobileGlass`,size:`mobileIcon`,className:u(e.elevated&&`relative z-[60]`),onClick:e.onClick,disabled:e.disabled,"aria-label":e.ariaLabel,"aria-expanded":e.pressed,title:e.title,children:(0,$.jsx)(m,{name:e.icon,className:`size-5`})},`${e.icon}:${t}`)}function St(e){return e.elevated}export{ue as A,ft as C,le as D,de as E,y as M,v as N,ce as O,et as S,me as T,Xe as _,ht as a,Ve as b,ot as c,it as d,lt as f,qe as g,rt as h,pt as i,_ as j,fe as k,vt as l,mt as m,Ke as n,at as o,ut as p,Je as r,gt as s,bt as t,_t as u,Le as v,he as w,Qe as x,ze as y};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{at as t,ot as n,st as r}from"./vendor-base-ui-CzHs0bHY.js";import{n as i}from"./vendor-react-DlzBev0S.js";import{r as a}from"./vendor-reactuses-core-CuTmqEMK.js";import{Jn as o,Kn as s}from"./useMobileNavigationStore-SCjA_7jP.js";import{a as c,c as l}from"./vendor-framer-motion-DDMKlXiP.js";import{n as u}from"./Icon-DsN23fuV.js";import{t as d}from"./MobileWindowStack-DGLdgoGr.js";var f=e(r(),1),p=i(),m=n(),h=e(t(),1),g=0,_=()=>{g=Date.now()+800},v=()=>Date.now()<g;function y(e){let t=(0,p.c)(9),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=o(`flex cursor-ns-resize touch-none justify-center focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-[var(--interactive-focus-ring)]`,n),t[3]=n,t[4]=i);let a;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,m.jsx)(`div`,{className:`pointer-events-none h-1.5 w-11 rounded-full bg-[var(--interactive-border)]`}),t[5]=a):a=t[5];let s;return t[6]!==r||t[7]!==i?(s=(0,m.jsx)(`div`,{role:`separator`,tabIndex:0,"aria-orientation":`horizontal`,className:i,...r,children:a}),t[6]=r,t[7]=i,t[8]=s):s=t[8],s}var b=100,x=.35;function S(e,t,n){let r=e.at(-1),i=e.at(-2);for(r&&i&&Math.abs(t-r.height)>2&&(t-r.height)*(r.height-i.height)<0&&e.splice(0,e.length-1),e.push({height:t,time:n});e.length>2&&(e.length>16||e[1].time<n-b);)e.shift()}function C(e,t){let n=e.at(-1);if(!n||t-n.time>=b)return 0;let r=e.find(e=>e.time>=t-b);return!r||n.time<=r.time?0:Math.max(-4,Math.min(4,(n.height-r.height)/Math.max(1,t-r.time)))}function w(e,t,n,r,i){let a=Math.abs(r)>=x&&Math.abs(i)>=8,o=n+(a?r*180:0),s=e.reduce((e,t)=>Math.abs(t.height-o)<Math.abs(e.height-o)?t:e),c=e.find(e=>e.id===t)??s;return!a||Math.abs(s.height-c.height)>1?s.id:[...e].sort((e,t)=>r>0?e.height-t.height:t.height-e.height).find(e=>r>0?e.height>c.height+1:e.height<c.height-1)?.id??s.id}function T(e,t,n){let r=e<t?t:e>n?n:e,i=e-r;return r+Math.sign(i)*48*(1-1/(1+Math.abs(i)*.55/48))}function E(e){let t=(0,p.c)(82),{surfaceRef:n,initialPoint:r,getPoints:i,minimumHeight:o,onRelease:s,onCommit:u,renderMode:d}=e,m=d===void 0?`height`:d,[h,g]=(0,f.useState)(r),[_,v]=(0,f.useState)(!1),[y,b]=(0,f.useState)(!1),x=(0,f.useRef)(r),E=(0,f.useRef)(null),A=(0,f.useRef)(null),j=(0,f.useRef)(null),M=(0,f.useRef)(null),N=(0,f.useRef)(!1),P=(0,f.useRef)(null),F;t[0]===n?F=t[1]:(F=()=>{let e=n.current;if(!e)return 0;if(!P.current)return e.getBoundingClientRect().height;let t=parseFloat(getComputedStyle(e).translate.split(` `)[1])||0;return P.current.layoutHeight-t},t[0]=n,t[1]=F);let I=a(F),L;t[2]===n?L=t[3]:(L=e=>{let t=n.current;t&&(P.current?t.style.translate=`0 ${P.current.layoutHeight-e}px`:t.style.height=`${e}px`)},t[2]=n,t[3]=L);let R=a(L),z;t[4]!==m||t[5]!==n||t[6]!==R?(z=(e,t)=>{let r=n.current;if(r){if(m===`translate`&&!P.current){let e=Math.max(...t.map(k))+144,{maxHeight:n,position:i,bottom:a,left:o,right:s}=r.style;P.current={layoutHeight:e,styles:{maxHeight:n,position:i,bottom:a,left:o,right:s}},Object.assign(r.style,{position:`absolute`,bottom:`0px`,left:`0px`,right:`0px`}),r.style.maxHeight=`none`,r.style.height=`${e}px`}r.setAttribute(`data-height-snap-active`,``),r.style.willChange=P.current?`translate`:`height`,R(e)}},t[4]=m,t[5]=n,t[6]=R,t[7]=z):z=t[7];let ae=a(z),B;t[8]===n?B=t[9]:(B=()=>{let e=n.current;e&&(P.current&&(e.style.translate=``,Object.assign(e.style,P.current.styles),e.style.height=``),e.style.willChange=``,e.removeAttribute(`data-height-snap-active`)),P.current=null},t[8]=n,t[9]=B);let V=a(B),H;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(H=()=>{A.current!==null&&cancelAnimationFrame(A.current),A.current=null,j.current=null,M.current?.cancel(),M.current=null},t[10]=H):H=t[10];let U=a(H),W;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(W=()=>{let e=E.current;E.current=null,e?.handle.hasPointerCapture?.(e.pointerId)&&e.handle.releasePointerCapture(e.pointerId)},t[11]=W):W=t[11];let G=a(W),oe;t[12]!==U||t[13]!==V||t[14]!==i||t[15]!==u||t[16]!==ae||t[17]!==I||t[18]!==G||t[19]!==n||t[20]!==R?(oe=(e,t,r,a)=>{let o=r===void 0||r,s=a===void 0?0:a,d=n.current;if(!d)return;let f=t??I();U(),R(f);let p=i(),m=p.find(t=>t.id===e);if(!m)return;if(ae(f,p),G(),v(!1),b(!1),x.current=e,g(e),R(m.height),u?.(e),!o||Math.abs(f-m.height)<1||typeof d.animate!=`function`||window.matchMedia(`(prefers-reduced-motion: reduce)`).matches){V();return}b(!0);let h=P.current?.layoutHeight,_=m.height-f,y=c([d],h===void 0?{height:[`${f}px`,`${m.height}px`]}:{translate:[`0 ${h-f}px`,`0 ${h-m.height}px`]},{type:l,stiffness:576,damping:48,mass:1,velocity:s*1e3*100/_,restDelta:20/Math.abs(_),restSpeed:500/Math.abs(_)});M.current=y,y.finished.catch(O).then(()=>{M.current===y&&(M.current=null,V(),b(!1))})},t[12]=U,t[13]=V,t[14]=i,t[15]=u,t[16]=ae,t[17]=I,t[18]=G,t[19]=n,t[20]=R,t[21]=oe):oe=t[21];let K=a(oe),se;t[22]!==U||t[23]!==i||t[24]!==o||t[25]!==ae||t[26]!==I||t[27]!==n||t[28]!==R?(se=e=>{if(E.current||!e.isPrimary||e.pointerType===`mouse`&&e.button!==0||!n.current)return;let t=I();U(),R(t);let r=i();r.length&&(b(!1),E.current={pointerId:e.pointerId,startY:e.clientY,height:t,point:x.current,points:r,handle:e.currentTarget,minimum:o??Math.min(...r.map(ie)),maximum:Math.max(...r.map(re)),samples:[{height:t,time:e.timeStamp}]},N.current=!1,ae(t,r),v(!0),e.currentTarget.setPointerCapture(e.pointerId),e.preventDefault())},t[22]=U,t[23]=i,t[24]=o,t[25]=ae,t[26]=I,t[27]=n,t[28]=R,t[29]=se):se=t[29];let ce=a(se),le;t[30]!==m||t[31]!==R?(le=e=>{let t=E.current;if(!t||t.pointerId!==e.pointerId)return;let n=t.startY-e.clientY;Math.abs(n)>3&&(N.current=!0),S(t.samples,t.height+n,e.timeStamp);let r=T(t.height+n,t.minimum,t.maximum);j.current=m===`height`?Math.max(t.minimum,r):r,A.current===null&&(A.current=requestAnimationFrame(()=>{A.current=null,j.current!==null&&R(j.current)})),e.preventDefault()},t[30]=m,t[31]=R,t[32]=le):le=t[32];let ue=a(le),de;t[33]!==U||t[34]!==s||t[35]!==I||t[36]!==G||t[37]!==K||t[38]!==n?(de=(e,t)=>{let r=E.current;if(!r||r.pointerId!==e.pointerId)return;let i=j.current??I(),a=r.height+r.startY-e.clientY;t||S(r.samples,a,e.timeStamp);let o=t?0:C(r.samples,e.timeStamp);if(G(),!t&&N.current&&s?.(i,o,r.height))U(),v(!1),n.current&&(n.current.style.willChange=``);else{let e=t||!N.current?r.point:w(r.points,r.point,i,o,a-r.height);K(e,i,!0,o)}e.preventDefault()},t[33]=U,t[34]=s,t[35]=I,t[36]=G,t[37]=K,t[38]=n,t[39]=de):de=t[39];let q=a(de),fe;t[40]!==i||t[41]!==K?(fe=e=>{let t=[...i()].sort(ne),n=t.find(e=>e.id===x.current);if(!n)return;let r=e>0?t.find(e=>e.height>n.height+1):t.sort(te).find(e=>e.height<n.height-1);r&&K(r.id)},t[40]=i,t[41]=K,t[42]=fe):fe=t[42];let J=a(fe),pe;t[43]!==i||t[44]!==K||t[45]!==J?(pe=()=>{if(N.current){N.current=!1;return}let e=[...i()].sort(ee);x.current===e.at(-1)?.id?K(e[0].id):J(1)},t[43]=i,t[44]=K,t[45]=J,t[46]=pe):pe=t[46];let me=a(pe),Y;t[47]!==i||t[48]!==me||t[49]!==K||t[50]!==J?(Y=e=>{if(![`ArrowUp`,`ArrowDown`,`Home`,`End`,`Enter`,` `].includes(e.key))return;e.preventDefault();let t=[...i()].sort(D);t.length&&(e.key===`ArrowUp`?J(1):e.key===`ArrowDown`?J(-1):e.key===`Home`?K(t.at(-1).id):e.key===`End`?K(t[0].id):me())},t[47]=i,t[48]=me,t[49]=K,t[50]=J,t[51]=Y):Y=t[51];let X=a(Y),he;t[52]!==U||t[53]!==V||t[54]!==r||t[55]!==G||t[56]!==n?(he=()=>{U(),G(),V(),x.current=r,g(r),v(!1),b(!1),N.current=!1,n.current&&(n.current.style.height=``,n.current.style.willChange=``)},t[52]=U,t[53]=V,t[54]=r,t[55]=G,t[56]=n,t[57]=he):he=t[57];let Z=a(he),Q,ge;t[58]!==U||t[59]!==V||t[60]!==G?(Q=()=>()=>{U(),G(),V()},ge=[U,G,V],t[58]=U,t[59]=V,t[60]=G,t[61]=Q,t[62]=ge):(Q=t[61],ge=t[62]),(0,f.useLayoutEffect)(Q,ge);let $;t[63]===q?$=t[64]:($=e=>q(e,!1),t[63]=q,t[64]=$);let _e=a($),ve;t[65]===q?ve=t[66]:(ve=e=>q(e,!0),t[65]=q,t[66]=ve);let ye=a(ve),be;t[67]===q?be=t[68]:(be=e=>q(e,!0),t[67]=q,t[68]=be);let xe=a(be),Se;return t[69]!==_||t[70]!==me||t[71]!==X||t[72]!==ce||t[73]!==ue||t[74]!==Z||t[75]!==K||t[76]!==y||t[77]!==h||t[78]!==_e||t[79]!==ye||t[80]!==xe?(Se={snapPoint:h,dragging:_,settling:y,settleAt:K,reset:Z,handlePointerDown:ce,handlePointerMove:ue,handlePointerUp:_e,handlePointerCancel:ye,handleLostPointerCapture:xe,handleClick:me,handleKeyDown:X},t[69]=_,t[70]=me,t[71]=X,t[72]=ce,t[73]=ue,t[74]=Z,t[75]=K,t[76]=y,t[77]=h,t[78]=_e,t[79]=ye,t[80]=xe,t[81]=Se):Se=t[81],Se}function D(e,t){return e.height-t.height}function ee(e,t){return e.height-t.height}function te(e,t){return t.height-e.height}function ne(e,t){return e.height-t.height}function re(e){return e.height}function ie(e){return e.height}function O(){}function k(e){return e.height}var A=.72,j=.98,M=64,N=()=>Math.max(1,window.innerHeight),P=(e,t)=>{let n=Math.max(1,e)*A;return t==null||!Number.isFinite(t)?n:Math.min(n,Math.max(0,t))},F=e=>{let t=(0,p.c)(20),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{initialSnapPoint:r,fitContent:i,onDismiss:o,dismissThresholdPx:s}=n,c=r===void 0?A:r,l=i!==void 0&&i,u=s===void 0?M:s,d=f.useRef(null),m=f.useRef(null),h=f.useRef(c),g=o?0:void 0,_;t[2]===l?_=t[3]:(_=()=>{let e=N(),t=d.current?.parentElement?.clientHeight||e;return l&&h.current===.72&&d.current&&!d.current.hasAttribute(`data-height-snap-active`)&&(m.current=P(e,d.current.getBoundingClientRect().height)),[{id:A,height:Math.min(t,P(e,l?m.current:void 0))},{id:j,height:Math.min(t,e*j)}]},t[2]=l,t[3]=_);let v;t[4]!==u||t[5]!==l||t[6]!==o?(v=(e,t,n)=>{let r=d.current?.parentElement?.clientHeight||N(),i=Math.min(r,P(N(),l?m.current:void 0)),a=t<-.55&&n<=i+1&&e<i-8;return!o||!a&&e>i-u?!1:(o(),!0)},t[4]=u,t[5]=l,t[6]=o,t[7]=v):v=t[7];let y;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(y=e=>{h.current=e},t[8]=y):y=t[8];let b;t[9]!==c||t[10]!==g||t[11]!==_||t[12]!==v?(b={surfaceRef:d,initialPoint:c,renderMode:`translate`,minimumHeight:g,getPoints:_,onRelease:v,onCommit:y},t[9]=c,t[10]=g,t[11]=_,t[12]=v,t[13]=b):b=t[13];let x=E(b),S;t[14]!==x||t[15]!==c?(S=()=>{m.current=null,h.current=c,x.reset()},t[14]=x,t[15]=c,t[16]=S):S=t[16];let C=a(S),w;return t[17]!==x||t[18]!==C?(w={...x,surfaceRef:d,reset:C},t[17]=x,t[18]=C,t[19]=w):w=t[19],w},I=e=>{let t=(0,p.c)(12),{controller:n,ariaLabel:r}=e,i;t[0]===n.snapPoint?i=t[1]:(i=Math.round(n.snapPoint*100),t[0]=n.snapPoint,t[1]=i);let a;return t[2]!==r||t[3]!==n.handleClick||t[4]!==n.handleKeyDown||t[5]!==n.handleLostPointerCapture||t[6]!==n.handlePointerCancel||t[7]!==n.handlePointerDown||t[8]!==n.handlePointerMove||t[9]!==n.handlePointerUp||t[10]!==i?(a=(0,m.jsx)(y,{"data-mobile-sheet-snap-handle":!0,role:`separator`,tabIndex:0,"aria-label":r,"aria-orientation":`horizontal`,"aria-valuemin":A*100,"aria-valuemax":j*100,"aria-valuenow":i,className:`flex min-h-8 cursor-ns-resize touch-none justify-center pt-2.5 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-[var(--interactive-focus-ring)]`,onPointerDown:n.handlePointerDown,onPointerMove:n.handlePointerMove,onPointerUp:n.handlePointerUp,onPointerCancel:n.handlePointerCancel,onLostPointerCapture:n.handleLostPointerCapture,onClick:n.handleClick,onKeyDown:n.handleKeyDown}),t[2]=r,t[3]=n.handleClick,t[4]=n.handleKeyDown,t[5]=n.handleLostPointerCapture,t[6]=n.handlePointerCancel,t[7]=n.handlePointerDown,t[8]=n.handlePointerMove,t[9]=n.handlePointerUp,t[10]=i,t[11]=a):a=t[11],a},L=new WeakMap;function R(e){L.set(e.currentTarget,!0)}function z(e){if(L.delete(e.currentTarget))return!0;if(e.detail!==0)return!1;if(typeof document>`u`)return!0;let t=document.activeElement,n=e.currentTarget;return n instanceof Node&&t instanceof Node&&n.contains(t)}function ae(e){e.target===e.currentTarget&&R(e)}function B(e){return e.target===e.currentTarget&&z(e)}var V=(0,f.createContext)(!0),H=(e,t)=>{let n=`flex min-h-0 flex-col bg-background shadow-none`;if(e===`page`)return`${n} h-full w-full`;let r=`${n} pwa-overlay-panel`;return t===`top`?`${r} mx-auto mb-auto max-h-[calc(100dvh-0.75rem)] w-full max-w-lg rounded-b-xl border-x border-b border-border/50`:t===`left`?`${r} h-full w-[min(86vw,24rem)] rounded-r-xl border-r border-y border-border/50`:t===`right`?`${r} ml-auto h-full w-[min(86vw,24rem)] rounded-l-xl border-l border-y border-border/50`:`${r} mx-auto mt-auto max-h-[calc(100dvh-0.75rem)] w-full max-w-lg rounded-t-2xl border-x border-t border-border/50 pb-[max(0.5rem,var(--yuri-app-bottom-safe,0px),var(--yuri-safe-area-bottom,env(safe-area-inset-bottom,0px)))]`},U=e=>Math.min(1,Math.max(0,Number.isFinite(e)?e:0)),W=(e,t)=>{let n=U(t),r=`${(1-n)*100}%`;return{progress:n,scrimOpacity:n,surfaceOpacity:n,surfaceTransform:e===`left`?`translate3d(-${r}, 0, 0)`:e===`right`?`translate3d(${r}, 0, 0)`:e===`top`?`translate3d(0, -${r}, 0)`:`translate3d(0, ${r}, 0)`}},G=(e,t)=>{let n=U(t);return e===`present`?n:1-n},oe=(e,t)=>e===`present`?+(t===`commit`):t===`commit`?0:1,K=e=>+!!e,se=`mobile-sessions`,ce=new Map,le=e=>ce.get(e)??null,ue=(e,t)=>(ce.set(e,t),()=>{ce.get(e)===t&&ce.delete(e)}),de=`.overlay-scrollbar-container`,q=1,fe=e=>e===`left`||e===`right`?`x`:`y`,J=e=>e===`bottom`||e===`right`?1:-1,pe=(e,t,n)=>{let r=fe(e)===`x`?t:n;return Math.max(0,r*J(e))},me=(e,t,n,r,i)=>{let a=pe(e,t,n),o=Math.abs(fe(e)===`x`?n:t);return Math.hypot(t,n)>r&&a>0&&o<a*i},Y=(e,t)=>Math.min(1,Math.max(0,e/Math.max(1,t))),X=(e,t,n,r)=>Math.min(r,Math.max(n,e*t)),he=(e,t,n,r,i)=>e>=n||e>=i&&t>=r,Z=(e,t,n,r,i)=>t!==0&&n>0?t*i/n:r>80?0:e,Q=(e,t,n=q)=>{if(t===`bottom`)return e.scrollTop<=n;if(t===`top`)return e.scrollTop>=e.scrollHeight-e.clientHeight-n;if(e.matches?.(`:dir(rtl)`)){let r=e.scrollWidth-e.clientWidth;return t===`right`?Math.abs(e.scrollLeft)<=n:Math.abs(e.scrollLeft)>=r-n}return t===`right`?e.scrollLeft<=n:e.scrollLeft>=e.scrollWidth-e.clientWidth-n},ge=(e,t)=>{for(let n=0;n<e.length;n+=1){let r=e.item(n);if(r?.identifier===t)return r}return null},$=(e,t)=>{let n=window.getComputedStyle(e),r=fe(t),i=r===`x`?n.overflowX:n.overflowY,a=r===`x`?e.scrollWidth:e.scrollHeight,o=r===`x`?e.clientWidth:e.clientHeight;return(i===`auto`||i===`scroll`||i===`overlay`)&&a>o},_e=(e,t,n,r)=>{let i=t instanceof Element?t:null,a=i instanceof HTMLElement?i:i?.parentElement??null;for(;a&&e.contains(a);){if($(a,n))return a;if(a===e)break;a=a.parentElement}let o=i?.closest(r)??null;return o&&e.contains(o)&&$(o,n)?o:null},ve=e=>{let t=f.useRef(e),n=f.useRef(null),r=f.useRef(null);return t.current=e,f.useCallback(e=>{if(n.current?.(),n.current=null,!e)return;let i=()=>{let e=r.current;r.current=null,e?.active&&e.controller?.finish(`cancel`)},a=(e,t,n)=>{let r=fe(e.edge)===`x`?t.clientX:t.clientY,i=n-e.lastTime,a=r-e.lastPrimary;e.velocity=Z(e.velocity,a,i,n-e.lastVelocityTime,J(e.edge)),a!==0&&i>0&&(e.lastVelocityTime=n),e.lastPrimary=r,e.lastTime=n,e.distance=pe(e.edge,t.clientX-e.startX,t.clientY-e.startY)},o=n=>{i();let a=t.current;if(a.disabled||n.touches.length!==1)return;let o=n.target instanceof Element?n.target:null,s=a.reservedTargetSelector?o?.closest(a.reservedTargetSelector):null;if(s&&e.contains(s)||o?.closest(`input, textarea, select, [contenteditable=""], [contenteditable="true"], [data-mobile-sheet-no-dismiss]`))return;let c=n.touches[0],l=_e(e,n.target,a.edge,a.scrollContainerSelector??de);if(l&&!Q(l,a.edge))return;let u=e.getBoundingClientRect(),d=fe(a.edge)===`x`?u.width||window.innerWidth:u.height||window.innerHeight;r.current={edge:a.edge,motionId:a.motionId,touchId:c.identifier,startX:c.clientX,startY:c.clientY,lastPrimary:fe(a.edge)===`x`?c.clientX:c.clientY,lastTime:n.timeStamp,lastVelocityTime:n.timeStamp,velocity:0,distance:0,commitDistance:X(d,a.commitDistanceRatio??.1,a.minCommitDistance??40,a.maxCommitDistance??64),motionDistance:d,intentDistance:a.intentDistance??8,maxOffAxisRatio:a.maxOffAxisRatio??1,flingVelocity:a.flingVelocity??.65,flingMinDistance:a.flingMinDistance??12,controller:null,active:!1}},s=e=>{let n=r.current;if(!n)return;if(t.current.disabled||e.touches.length!==1){i();return}let o=ge(e.touches,n.touchId);if(!o){i();return}if(a(n,o,e.timeStamp),!n.active){if(Math.hypot(o.clientX-n.startX,o.clientY-n.startY)<=n.intentDistance)return;if(!me(n.edge,o.clientX-n.startX,o.clientY-n.startY,n.intentDistance,n.maxOffAxisRatio)){r.current=null;return}let e=le(n.motionId);if(!e){r.current=null;return}if(!e.begin(`dismiss`)){r.current=null;return}n.active=!0,n.controller=e}n.controller?.update(Y(n.distance,n.motionDistance)),e.preventDefault()},c=e=>{let t=r.current;if(!t)return;let n=ge(e.changedTouches,t.touchId);if(!n){i();return}if(r.current=null,!t.active)return;a(t,n,e.timeStamp),t.controller?.update(Y(t.distance,t.motionDistance));let o=he(t.distance,t.velocity,t.commitDistance,t.flingVelocity,t.flingMinDistance);t.controller?.finish(o?`commit`:`cancel`),e.preventDefault()},l=()=>i();e.addEventListener(`touchstart`,o,{passive:!0,capture:!0}),e.addEventListener(`touchmove`,s,{passive:!1,capture:!0}),e.addEventListener(`touchend`,c,{passive:!1,capture:!0}),e.addEventListener(`touchcancel`,l,{passive:!0,capture:!0}),n.current=()=>{i(),e.removeEventListener(`touchstart`,o,!0),e.removeEventListener(`touchmove`,s,!0),e.removeEventListener(`touchend`,c,!0),e.removeEventListener(`touchcancel`,l,!0)}},[])},ye=`mobile-overlay-root`,be=200,xe=80,Se=`cubic-bezier(0.32, 0.72, 0, 1)`,Ce=`a[href], button:not(:disabled), input:not(:disabled), select:not(:disabled), textarea:not(:disabled), [tabindex]:not([tabindex="-1"])`,we=()=>{if(typeof document>`u`)return null;let e=document.getElementById(ye);return e||(e=document.createElement(`div`),e.id=ye,document.body.appendChild(e)),e},Te=()=>typeof window<`u`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches,Ee=({id:e,open:t,onOpenChange:n,keepMounted:r=!1,presentation:i=`sheet`,edge:a=`bottom`,children:s,className:c,scrimClassName:l,surfaceClassName:u,surfaceElementRef:p,dismissGesture:g=!1,onExitComplete:_,onPreviewChange:y,ariaLabel:b})=>{let x=f.useRef(null),S=f.useRef(null),C=f.useRef(null),w=f.useRef(null),T=f.useRef(t),E=f.useRef(n),D=f.useRef(_),ee=f.useRef(y),te=f.useRef(0),ne=f.useRef(0),re=f.useRef(null),ie=f.useRef([]),O=f.useRef(null),k=f.useRef(`standard`),A=f.useRef(`present`),j=f.useRef(0),M=f.useRef(!1),N=f.useRef(t),P=f.useRef(!1),F=f.useRef(t),I=f.useRef(null),[L,R]=f.useState(t),[z,U]=f.useState(t),[se,ce]=f.useState(`standard`),[le,de]=f.useState(!1),q=se===`interactive-present`,fe=f.useSyncExternalStore(d.subscribe,d.getSnapshot,d.getSnapshot),J=z&&!q&&fe===e,pe=ve({motionId:e,edge:a,disabled:!g,...typeof g==`object`?g:{}}),me=f.useCallback(e=>{C.current=e,pe(e),typeof p==`function`?p(e):p&&typeof p==`object`&&(p.current=e)},[pe,p]),Y=f.useCallback(()=>{F.current&&(F.current=!1,U(!1),r||R(!1),D.current?.())},[r]);T.current=t,E.current=n,D.current=_,ee.current=y,f.useLayoutEffect(()=>{ee.current?.(z&&q)},[z,q]),typeof document<`u`&&!x.current&&(x.current=we());let X=f.useCallback(e=>{let t=W(a,e);te.current=t.progress,!(!S.current||!C.current)&&(S.current.style.opacity=String(t.scrimOpacity),C.current.style.transform=t.surfaceTransform,C.current.style.opacity=String(t.surfaceOpacity))},[a]),he=f.useCallback(()=>{re.current!==null&&window.cancelAnimationFrame(re.current),re.current=null},[]),Z=f.useCallback(()=>{S.current&&(S.current.style.willChange=``),C.current&&(C.current.style.willChange=``)},[]),Q=f.useCallback((e=ie.current)=>{for(let t of e)t.cancel();ie.current=[]},[]),ge=f.useCallback(()=>{he();let e=O.current;if(e){let t=e.animations[1]?.effect?.getComputedTiming().progress;X(typeof t==`number`&&Number.isFinite(t)?e.from+(e.target-e.from)*t:te.current),Q(e.animations),O.current=null}else Q();Z(),de(!1)},[X,Q,he,Z]),$=f.useCallback((e,t)=>{if(O.current?.target===e)return;ge();let n=te.current,r=S.current,i=C.current;if(de(!0),!r||!i||Te()||n===e){X(e),Z(),de(!1),t?.();return}let o=W(a,n),s=W(a,e);r.style.willChange=`opacity`,i.style.willChange=`transform, opacity`;let c=Math.max(xe,be*Math.abs(e-n)),l=[r.animate([{opacity:o.scrimOpacity},{opacity:s.scrimOpacity}],{duration:c,easing:Se,fill:`forwards`}),i.animate([{transform:o.surfaceTransform,opacity:o.surfaceOpacity},{transform:s.surfaceTransform,opacity:s.surfaceOpacity}],{duration:c,easing:Se,fill:`forwards`})];ie.current=l;let u={from:n,target:e,animations:l};O.current=u,Promise.all(l.map(e=>e.finished.catch(()=>void 0))).then(()=>{O.current===u&&(X(e),Q(l),O.current=null,Z(),de(!1),t?.())})},[X,Q,Z,a,ge]);if(f.useLayoutEffect(()=>{P.current=L,L&&X(ne.current)},[X,L]),f.useLayoutEffect(()=>{F.current=z},[z]),f.useEffect(()=>{t&&!P.current&&(ne.current=te.current,R(!0)),t&&!F.current&&(F.current=!0,U(!0)),P.current&&k.current===`standard`&&$(K(t),()=>{!T.current&&k.current===`standard`&&Y()})},[Y,t,$]),f.useLayoutEffect(()=>{!L||k.current!==`standard`||$(+!!t,()=>{!T.current&&k.current===`standard`&&Y()})},[Y,L,t,$]),f.useEffect(()=>{if(!(!z||q))return window.dispatchEvent(new Event(`yuri:mobile-overlay-opened`)),()=>{window.dispatchEvent(new Event(`yuri:mobile-overlay-closed`))}},[z,q]),f.useEffect(()=>{if(!(!z||q))return d.add({id:e,onClose:()=>E.current(!1)},document.body)},[z,e,q]),f.useEffect(()=>{if(!z||q||!J)return;let e=C.current,t=document.activeElement instanceof HTMLElement?document.activeElement:null;w.current?.focus({preventScroll:!0});let n=t=>{if(t.key===`Escape`&&d.closeTop(),t.key!==`Tab`||!e)return;let n=Array.from(e.querySelectorAll(Ce)).filter(e=>!e.closest(`[data-mobile-sheet-snap-handle]`)),r=n[0]??w.current,i=n.at(-1)??w.current;!r||!i||(t.shiftKey&&document.activeElement===r&&(t.preventDefault(),i.focus({preventScroll:!0})),!t.shiftKey&&document.activeElement===i&&(t.preventDefault(),r.focus({preventScroll:!0})))};return document.addEventListener(`keydown`,n),()=>{document.removeEventListener(`keydown`,n),v()||t?.focus({preventScroll:!0})}},[z,q,J]),I.current={begin:e=>{if(e===`dismiss`&&(!F.current||k.current===`interactive-present`))return!1;ge(),j.current+=1,M.current=!0,A.current=e;let t=e===`present`?`interactive-present`:`interactive-dismiss`;return k.current=t,ce(t),de(!0),e===`present`&&(ne.current=te.current,F.current=!0,U(!0),R(!0)),!0},update:e=>{M.current&&(ne.current=G(A.current,e),re.current===null&&(re.current=window.requestAnimationFrame(()=>{re.current=null,M.current&&X(ne.current)})))},finish:e=>{if(!M.current)return;M.current=!1;let t=j.current,n=A.current,r=oe(n,e);re.current!==null&&(he(),X(ne.current)),$(r,()=>{t===j.current&&(e===`commit`&&E.current(n===`present`),n===`present`&&e===`cancel`&&!T.current&&Y(),k.current=`standard`,ce(`standard`),r===0&&Y())})},interrupt:()=>{j.current+=1,M.current=!1;let e=k.current===`interactive-present`&&!T.current;e||(k.current=`standard`,ce(`standard`)),ge(),$(K(T.current),()=>{T.current||Y(),e&&(k.current=`standard`,ce(`standard`))})}},f.useLayoutEffect(()=>{let e=N.current;N.current=t,e&&!t&&k.current!==`standard`&&I.current?.interrupt()},[t]),f.useEffect(()=>{let t=ue(e,{begin:e=>I.current?.begin(e)??!1,update:e=>I.current?.update(e),finish:e=>I.current?.finish(e),interrupt:()=>I.current?.interrupt()});return()=>{t(),he(),Q(),O.current=null,Z(),I.current=null}},[Q,he,Z,e]),!L||!x.current)return null;let _e=(0,m.jsx)(`div`,{ref:S,className:o(`yuri-mobile-window-motion yuri-keyboard-inset-surface fixed inset-0 z-[60] flex flex-col bg-[rgb(0_0_0_/_0.45)]`,le&&`yuri-mobile-window-motion-active`,!z&&!q&&`pointer-events-none invisible`,l,c),"data-mobile-overlay-active":String(z),role:q?void 0:`dialog`,"aria-label":q?void 0:b,"aria-modal":z&&J?`true`:void 0,"aria-hidden":q||!z||!J||void 0,inert:q||!z||!J||void 0,onPointerDown:ae,onClick:e=>{!z||q||!J||B(e)&&E.current(!1)},children:(0,m.jsxs)(`div`,{ref:me,className:o(`yuri-mobile-floating-shell`,H(i,a),u),"data-yuri-motion-id":e,style:{contain:`layout paint style`},onClick:e=>e.stopPropagation(),children:[(0,m.jsx)(`span`,{ref:w,tabIndex:-1,className:`sr-only`,role:`group`,"aria-label":b}),(0,m.jsx)(V.Provider,{value:J,children:s})]})});return(0,h.createPortal)(_e,x.current)},De=f.createContext(null),Oe=e=>{let t=(0,p.c)(5),{children:n}=e,r=f.useContext(De);if(!r)return null;let i;t[0]===n?i=t[1]:(i=(0,m.jsx)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:n}),t[0]=n,t[1]=i);let a;return t[2]!==r||t[3]!==i?(a=(0,h.createPortal)(i,r),t[2]=r,t[3]=i,t[4]=a):a=t[4],a},ke=e=>{let t=(0,p.c)(47),{id:n,open:r,onOpenChange:i,title:a,leading:c,trailing:l,ariaLabel:d,closeAriaLabel:h,resizeAriaLabel:g,initiallyExpanded:_,fitContent:v,bodyClassName:y,className:b,children:x}=e,S=_!==void 0&&_,C=v!==void 0&&v,w=S?j:void 0,T;t[0]!==i||t[1]!==r?(T=r?()=>i(!1):void 0,t[0]=i,t[1]=r,t[2]=T):T=t[2];let E;t[3]!==C||t[4]!==w||t[5]!==T?(E={initialSnapPoint:w,fitContent:C,onDismiss:T},t[3]=C,t[4]=w,t[5]=T,t[6]=E):E=t[6];let D=F(E),[ee,te]=f.useState(null),ne=a!=null||c!=null||l!=null,re=D.snapPoint===j,ie=re||!C,O;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(O={reservedTargetSelector:`[data-mobile-sheet-snap-handle]`},t[7]=O):O=t[7];let k=re?`h-[98dvh] max-h-[98dvh]`:C?`h-auto max-h-[72dvh]`:`h-[72dvh] max-h-[98dvh]`,A=D.surfaceRef,M=D.reset,N=ie&&`flex-1`,P;t[8]===N?P=t[9]:(P=o(`flex min-h-0 flex-col`,N),t[8]=N,t[9]=P);let L;t[10]!==g||t[11]!==D?(L=(0,m.jsx)(I,{controller:D,ariaLabel:g}),t[10]=g,t[11]=D,t[12]=L):L=t[12];let R;t[13]!==h||t[14]!==C||t[15]!==ne||t[16]!==c||t[17]!==i||t[18]!==a||t[19]!==l?(R=ne?(0,m.jsxs)(`div`,{className:C?`flex min-h-9 items-center gap-2 px-4 pb-1`:`flex min-h-10 items-center gap-2 px-4 pb-2`,children:[c?(0,m.jsx)(`div`,{className:`flex shrink-0 items-center`,children:c}):null,(0,m.jsx)(`div`,{className:`min-w-0 flex-1`,children:a}),l?(0,m.jsx)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:l}):null,(0,m.jsx)(`div`,{ref:te,className:`contents`}),(0,m.jsx)(s,{type:`button`,variant:`ghost`,size:`icon`,onClick:()=>i(!1),"aria-label":h,className:`shrink-0 text-muted-foreground`,style:{touchAction:`manipulation`},children:(0,m.jsx)(u,{name:`close`,className:`size-5`})})]}):null,t[13]=h,t[14]=C,t[15]=ne,t[16]=c,t[17]=i,t[18]=a,t[19]=l,t[20]=R):R=t[20];let z;t[21]!==L||t[22]!==R?(z=(0,m.jsxs)(`div`,{className:`shrink-0`,children:[L,R]}),t[21]=L,t[22]=R,t[23]=z):z=t[23];let ae=ie&&`flex-1`,B;t[24]!==y||t[25]!==ae?(B=o(`flex min-h-0 flex-col overflow-hidden`,ae,y),t[24]=y,t[25]=ae,t[26]=B):B=t[26];let V;t[27]!==x||t[28]!==B?(V=(0,m.jsx)(`div`,{className:B,"data-page-scroll-lock":`true`,children:x}),t[27]=x,t[28]=B,t[29]=V):V=t[29];let H;t[30]!==P||t[31]!==z||t[32]!==V?(H=(0,m.jsxs)(`div`,{className:P,children:[z,V]}),t[30]=P,t[31]=z,t[32]=V,t[33]=H):H=t[33];let U;t[34]!==d||t[35]!==b||t[36]!==n||t[37]!==i||t[38]!==r||t[39]!==D.reset||t[40]!==D.surfaceRef||t[41]!==H||t[42]!==k?(U=(0,m.jsx)(Ee,{id:n,className:b,open:r,onOpenChange:i,presentation:`sheet`,edge:`bottom`,dismissGesture:O,ariaLabel:d,surfaceClassName:k,surfaceElementRef:A,onExitComplete:M,children:H}),t[34]=d,t[35]=b,t[36]=n,t[37]=i,t[38]=r,t[39]=D.reset,t[40]=D.surfaceRef,t[41]=H,t[42]=k,t[43]=U):U=t[43];let W;return t[44]!==ee||t[45]!==U?(W=(0,m.jsx)(De.Provider,{value:ee,children:U}),t[44]=ee,t[45]=U,t[46]=W):W=t[46],W};export{_ as C,v as S,I as _,pe as a,E as b,me as c,le as d,V as f,B as g,ae as h,X as i,he as l,R as m,Oe as n,Y as o,z as p,Ee as r,Z as s,ke as t,se as u,j as v,y as x,F as y};
|