@yuriai/web 0.2.27-beta.6 → 0.2.27-beta.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -0
- package/dist/assets/{AgentAvatar-Bi1vvWPC.js → AgentAvatar-BJ42lGZD.js} +1 -1
- package/dist/assets/AssistantContactStatus-dtkObamV.js +3 -0
- package/dist/assets/{AssistantUnreadBadge-DdJyySwn.js → AssistantUnreadBadge-QwhBfXpC.js} +1 -1
- package/dist/assets/AssistantView-D7ryIKL0.js +1 -0
- package/dist/assets/{DiagramView-CI4bTtxy.js → DiagramView-ERrGEBDp.js} +1 -1
- package/dist/assets/{FadeInOnReveal-BB4qEnAn.js → FadeInOnReveal-Bu2GvaM9.js} +1 -1
- package/dist/assets/{GuiPluginSurface-CguxFUbM.js → GuiPluginSurface-MzQgEZNr.js} +1 -1
- package/dist/assets/{GuiPluginWindow-DOJ7wuRH.js → GuiPluginWindow-DZMmlQzx.js} +1 -1
- package/dist/assets/{Icon-t2xvbAyN.js → Icon-Dj4CCqCP.js} +1 -1
- package/dist/assets/{ImageLoadingPlaceholder-D1L13TK0.js → ImageLoadingPlaceholder-BnFXgUuO.js} +1 -1
- package/dist/assets/{LoadingImage-5rY_edNm.js → LoadingImage-PBnivDKv.js} +1 -1
- package/dist/assets/{MarkdownRenderer-BlGxjOei.js → MarkdownRenderer-BajF4gUU.js} +2 -2
- package/dist/assets/{MarkdownRendererImpl-cE-0AYRg.js → MarkdownRendererImpl-CfyXL4rg.js} +1 -1
- package/dist/assets/{MarkstreamRendererImpl-BZyqDl82.js → MarkstreamRendererImpl-BGadklK1.js} +1 -1
- package/dist/assets/{MobileDetailNavigation-tbfsMfB-.js → MobileDetailNavigation-DqajQdB4.js} +1 -1
- package/dist/assets/{MobileResizableSheet-BeRmT6_x.js → MobileResizableSheet-BvdUgwA3.js} +1 -1
- package/dist/assets/{MobileShareBridge-C3Equ3P_.js → MobileShareBridge-3oPoYnry.js} +2 -2
- package/dist/assets/{MobileTabPageHeader-DQRqAAEf.js → MobileTabPageHeader-B6cRyIRH.js} +1 -1
- package/dist/assets/{MultiRunWindow-CAM2XPII.js → MultiRunWindow-yhs0Ih5_.js} +1 -1
- package/dist/assets/{OnboardingScreen-4ftRerP5.js → OnboardingScreen-Bi1VWFQC.js} +1 -1
- package/dist/assets/{OverlayScrollbar-CF0PCvQz.js → OverlayScrollbar-BBDwGvGO.js} +1 -1
- package/dist/assets/{SettingsView-2tk4WH7R.js → SettingsView-BSf-SJUA.js} +15 -15
- package/dist/assets/{SettingsWindow-B9zbeJaW.js → SettingsWindow-BvSXVMTm.js} +1 -1
- package/dist/assets/{TerminalView-DfxvTHye.js → TerminalView-DhL01N7e.js} +1 -1
- package/dist/assets/{ToolOutputDialog-CrjDIhru.js → ToolOutputDialog-C8lnH4Ky.js} +1 -1
- package/dist/assets/{YuriLogo-QvS1ZEHi.js → YuriLogo-D8asj1CS.js} +1 -1
- package/dist/assets/{appThemeRegistry-Bb_DtiV9.js → appThemeRegistry-C-maYSdv.js} +1 -1
- package/dist/assets/{assistant-attachment-cache-B9iHLlm2.js → assistant-attachment-cache-B_qRvy-k.js} +1 -1
- package/dist/assets/{button-DinGM3tu.js → button-vXOdzd8x.js} +1 -1
- package/dist/assets/{capgoAdapter-DufzjXRs.js → capgoAdapter-DJ_h2x5D.js} +1 -1
- package/dist/assets/{collapsible-Bh1GLNYV.js → collapsible-DwDQs3Wa.js} +1 -1
- package/dist/assets/context-menu-BabBujQ-.js +1 -0
- package/dist/assets/{desktopRelayRestore-CoLLVJw8.js → desktopRelayRestore-D1UX7HW2.js} +1 -1
- package/dist/assets/{diagram-BmG-7Jb4.js → diagram-HwgrQxY5.js} +1 -1
- package/dist/assets/{dialog-BXssfGXA.js → dialog-Dnf626tb.js} +1 -1
- package/dist/assets/dropdown-menu.styles-CBc_a-Nv.js +1 -0
- package/dist/assets/{es-HP_Ise0X.js → es-BQkO-Odr.js} +1 -1
- package/dist/assets/feishu-Ct1ZxlzQ.svg +6 -0
- package/dist/assets/{fileMentionTouchSelection-DSl0tj2r.js → fileMentionTouchSelection-CKPnEetl.js} +1 -1
- package/dist/assets/{fileQueries-5a1jkme2.js → fileQueries-BeXkd3o6.js} +1 -1
- package/dist/assets/{fileReferenceActions-CGpBSFq4.js → fileReferenceActions-g7KZLi_G.js} +1 -1
- package/dist/assets/{fr-D0kJXJ6U.js → fr-C852roK5.js} +1 -1
- package/dist/assets/{gitApi-Wo0IZow9.js → gitApi-CVq5oKCd.js} +1 -1
- package/dist/assets/{gitApiHttp-De9liKnG.js → gitApiHttp-BYOIbYIh.js} +2 -2
- package/dist/assets/{gui-9enrif_1.js → gui-M_Rbwkyu.js} +1 -1
- package/dist/assets/host-BW3FEJdU.js +1 -0
- package/dist/assets/{image-loading-Dq1g_wpm.js → image-loading-D5UhMj7Z.js} +1 -1
- package/dist/assets/{input-v8-rVbo-.js → input-BtM712b1.js} +1 -1
- package/dist/assets/{insertionBoundaries-CZz7TWJv.js → insertionBoundaries-Dx3WAY6i.js} +1 -1
- package/dist/assets/{ja-BjHKXazE.js → ja-BqC39qK6.js} +1 -1
- package/dist/assets/{ko-Llwnl876.js → ko-BMaChAWh.js} +1 -1
- package/dist/assets/main-9uP2z1qT.js +2 -0
- package/dist/assets/main-Mey7bCWf.js +169 -0
- package/dist/assets/{markdownHeightCache-BVV2dktw.js → markdownHeightCache-Bf8iisO4.js} +1 -1
- package/dist/assets/{mcpQueries-BoBrB4a4.js → mcpQueries-DpXqegX5.js} +1 -1
- package/dist/assets/miniChat-DqZvVkme.js +2 -0
- package/dist/assets/mobile-DXAWjYcN.js +2 -0
- package/dist/assets/{mobileBackNavigation-DMSzAvb6.js → mobileBackNavigation-DZcI7aZg.js} +1 -1
- package/dist/assets/{multirun-BhWttsRQ.js → multirun-hzspPepd.js} +1 -1
- package/dist/assets/{native-DSvNnKAm.js → native-H7K64Ulc.js} +1 -1
- package/dist/assets/{native-config-DjdrW_9n.js → native-config-CddZtLQ1.js} +1 -1
- package/dist/assets/{persistence-CfrHIiIS.js → persistence-BT8045Ue.js} +1 -1
- package/dist/assets/{pl-BOd_idqn.js → pl-Ubs8p28T.js} +1 -1
- package/dist/assets/projectMeta-CEf0QPmD.js +1 -0
- package/dist/assets/{pt-BR-B8djxMsl.js → pt-BR-8rAOjJrs.js} +1 -1
- package/dist/assets/{queryRuntime-Dkpnq3Z1.js → queryRuntime-CTcigFdj.js} +1 -1
- package/dist/assets/react-DRe85o5s.js +1 -0
- package/dist/assets/readiness-Dyr7314z.js +1 -0
- package/dist/assets/{renderElectronMiniChatApp-N2r999Bf.js → renderElectronMiniChatApp-DoOq8Cuo.js} +2 -2
- package/dist/assets/{renderMobileApp-CU1ec6Ak.js → renderMobileApp-TTxtOb8b.js} +7 -7
- package/dist/assets/runtime-fetch-D0YWp3FJ.js +1 -0
- package/dist/assets/{runtime-file-download-CcNIVp7u.js → runtime-file-download-Cf1WxfeW.js} +1 -1
- package/dist/assets/{runtime-file-resource-6np6lzoV.js → runtime-file-resource-UJjHUF2C.js} +1 -1
- package/dist/assets/runtimeConfig-B8VHHNxj.js +2 -0
- package/dist/assets/runtimeEndpointReset-BC6XWntz.js +149 -0
- package/dist/assets/scheduledTaskNavigation-Zm87Nydi.js +1 -0
- package/dist/assets/sessionLookup-De53jDwM.js +1 -0
- package/dist/assets/{sortable-tabs-strip-yKyqsqut.js → sortable-tabs-strip-D4pVoodN.js} +1 -1
- package/dist/assets/speechSettingsQueries-RlCLMBtr.js +4 -0
- package/dist/assets/src-lE4uqaHS.css +2 -0
- package/dist/assets/{store-CUBymvAC.js → store-ME7oHni1.js} +2 -2
- package/dist/assets/{terminalApi-BblSkqch.js → terminalApi-BSaclMDJ.js} +1 -1
- package/dist/assets/{textarea-B39OCNPV.js → textarea-B98rsLs7.js} +1 -1
- package/dist/assets/{tooltip-d8TNN4lx.js → tooltip-B9810jbK.js} +1 -1
- package/dist/assets/{types-BqFQhQTt.js → types-DFf9vd1b.js} +1 -1
- package/dist/assets/{uk-BNd7CjVO.js → uk-LzwzUApL.js} +1 -1
- package/dist/assets/{useAppFontEffects-BVoVpJYO.js → useAppFontEffects-D2C1sBYM.js} +43 -43
- package/dist/assets/{useAssistantUIStore-Bp6TxG5E.js → useAssistantUIStore-TUN_ycy5.js} +1 -1
- package/dist/assets/{useDesktopWindowControlsLayout-CYx1LNO5.js → useDesktopWindowControlsLayout-BjKaHN0x.js} +1 -1
- package/dist/assets/{useEffectiveDirectory-D8FFE5Yn.js → useEffectiveDirectory-TEvyiQSC.js} +1 -1
- package/dist/assets/{useFontPreferences-BFyBjtQ6.js → useFontPreferences-BlhlCJCX.js} +1 -1
- package/dist/assets/{useMobileNavigationStore-BHMFeMjo.js → useMobileNavigationStore-DTvJV9s-.js} +6 -6
- package/dist/assets/useUIStore-DRx6OgCp.js +1 -0
- package/dist/assets/{useWorkerHighlightedLines-CPxG8Fya.js → useWorkerHighlightedLines-D093jNsH.js} +1 -1
- package/dist/assets/vendor-opencode-client-ZeOZ4Efz.js +23 -0
- package/dist/assets/{vendor-opencode-plugin-CgKz9Hcy.js → vendor-opencode-plugin-BBOP6WNx.js} +1 -1
- package/dist/assets/{vendor-solid-js-0T254UHG.js → vendor-solid-js-9wmPZH9g.js} +1 -1
- package/dist/assets/{zh-CN-BkTAEOZG.js → zh-CN-D-FVCeks.js} +1 -1
- package/dist/assets/{zh-TW-x8SfMzfc.js → zh-TW-B9iH_NXL.js} +1 -1
- package/dist/index.html +17 -17
- package/dist/mini-chat.html +17 -17
- package/dist/mobile.html +17 -17
- package/package.json +6 -1
- package/server/lib/assistants/DOCUMENTATION.md +13 -1
- package/server/lib/assistants/channels/DOCUMENTATION.md +291 -0
- package/server/lib/assistants/channels/PROTOCOLS.md +228 -0
- package/server/lib/assistants/channels/dingtalk-chat-adapter.js +633 -0
- package/server/lib/assistants/channels/dingtalk-chat-adapter.test.js +415 -0
- package/server/lib/assistants/channels/integration.test.js +44 -0
- package/server/lib/assistants/channels/routes.js +47 -0
- package/server/lib/assistants/channels/routes.test.js +105 -0
- package/server/lib/assistants/channels/runtime.js +867 -0
- package/server/lib/assistants/channels/runtime.test.js +723 -0
- package/server/lib/assistants/channels/sdk-adapters.js +371 -0
- package/server/lib/assistants/channels/sdk-adapters.test.js +367 -0
- package/server/lib/assistants/channels/store.js +246 -0
- package/server/lib/assistants/channels/store.test.js +286 -0
- package/server/lib/assistants/channels/transport.js +41 -0
- package/server/lib/assistants/channels/transport.test.js +23 -0
- package/server/lib/assistants/channels/wecom-chat-adapter.js +689 -0
- package/server/lib/assistants/channels/wecom-chat-adapter.test.js +109 -0
- package/server/lib/assistants/message-channel-origin.js +7 -0
- package/server/lib/assistants/routes.js +14 -1
- package/server/lib/assistants/weixin/DOCUMENTATION.md +89 -7
- package/server/lib/assistants/weixin/api.js +2 -0
- package/server/lib/assistants/weixin/chat-adapter.js +107 -0
- package/server/lib/assistants/weixin/chat-adapter.test.js +62 -0
- package/server/lib/assistants/weixin/inbound.js +147 -0
- package/server/lib/assistants/weixin/inbound.test.js +121 -0
- package/server/lib/assistants/weixin/media.js +79 -0
- package/server/lib/assistants/weixin/media.test.js +66 -0
- package/server/lib/assistants/weixin/runtime.js +89 -67
- package/server/lib/assistants/weixin/runtime.test.js +156 -4
- package/server/lib/assistants/weixin/store.js +8 -4
- package/server/lib/assistants/weixin/store.test.js +72 -0
- package/server/lib/assistants/weixin/toon.js +49 -0
- package/server/lib/assistants/weixin/toon.test.js +25 -0
- package/server/lib/github/DOCUMENTATION.md +9 -8
- package/server/lib/llm/bridge-plugin.bundle.js +188 -188
- package/server/lib/opencode/DOCUMENTATION.md +1 -1
- package/dist/assets/AssistantContactStatus-CWq-PDz6.js +0 -3
- package/dist/assets/AssistantView-Br1iETTs.js +0 -1
- package/dist/assets/context-menu-DpbkRkk1.js +0 -1
- package/dist/assets/host-FR_grJxM.js +0 -1
- package/dist/assets/main-Bp9HHqTr.js +0 -2
- package/dist/assets/main-DOwAfmxJ.js +0 -169
- package/dist/assets/miniChat-BJDgCrfF.js +0 -2
- package/dist/assets/mobile-GM9931J_.js +0 -2
- package/dist/assets/projectMeta-31PobC-M.js +0 -1
- package/dist/assets/react-B9v0P7kT.js +0 -1
- package/dist/assets/readiness-CYNnsekT.js +0 -1
- package/dist/assets/runtime-fetch-D4ja813o.js +0 -1
- package/dist/assets/runtimeConfig-Db7yfo6L.js +0 -2
- package/dist/assets/runtimeEndpointReset-DO5WVetV.js +0 -149
- package/dist/assets/scheduledTaskNavigation-Bsrhv3Ow.js +0 -1
- package/dist/assets/sessionLookup-DRVy7LM1.js +0 -1
- package/dist/assets/speechSettingsQueries-DU25rmGc.js +0 -4
- package/dist/assets/src-Bckdo2XS.css +0 -2
- package/dist/assets/useUIStore-BbYD420L.js +0 -1
- package/dist/assets/vendor-opencode-client-UL_TecvQ.js +0 -12
|
@@ -77,7 +77,7 @@ encoding, not removed V1 endpoints.
|
|
|
77
77
|
- `packages/web/server/lib/opencode/theme-runtime.js`: custom theme JSON validation and theme directory loading runtime for settings utility routes.
|
|
78
78
|
- `packages/web/server/lib/opencode/proxy.js`: OpenCode API/SSE forwarding and readiness-gate route registration.
|
|
79
79
|
- `npm-registry.js`: plugin package lookup used by `GET /api/config/plugins/registry`. It asks the user's own `npm view` first (run in the project directory, so scope registries, auth tokens and mirrors from `.npmrc` apply as they do for `npm install`) and falls back to a direct request to the public registry only when the CLI is unavailable; a CLI 404 is final. Results are cached per name and directory. The latest release's top-level package.json `icon` is returned as `icon` only when it is an `https://` URL or `data:image/` URI of at most ~1.5 MB; nested icon fields are not read or used as fallbacks.
|
|
80
|
-
- `plugin-icon.js` owns the shared icon sanitizer and optional local package metadata read for Web/Electron/mobile and VS Code. Registry `path-ok` includes the nearest package manifest's top-level `icon` for directories or built entry files. Search stops at the first manifest, root or 32 parents; malformed, unreadable or >2 MiB manifests omit artwork without changing path status. No server-side image fetch occurs. Settings
|
|
80
|
+
- `plugin-icon.js` owns the shared icon sanitizer and optional local package metadata read for Web/Electron/mobile and VS Code. Registry `path-ok` includes the nearest package manifest's top-level `icon` for directories or built entry files. Search stops at the first manifest, root or 32 parents; malformed, unreadable or >2 MiB manifests omit artwork without changing path status. No server-side image fetch occurs. Settings → Plugins renders package artwork directly; GUI sidebar/titlebar entries use official `IconName` without package-image substitution.
|
|
81
81
|
- `plugin-gui-response.js`: shared Web/Electron/VS Code code-only revision response owner for exact `GET /api/plugin/gui?id=…` (one nonempty id). The installed GUI client alias is official `@opencode/client@2.2.0`: HTTP returns `{ location, data: { code, revision, options } }`. Every call still reads the complete current upstream response through the existing auth/readiness/abort boundary; there is no Host bundle cache.
|
|
82
82
|
- Request `X-Yuri-Gui-Revision: <lowercase SHA-256 hex of UTF-8 revision>` opts into code reuse. This header and HTTP condition/range headers are stripped before upstream so Yuri always requests a complete representation. Other query and request headers retain proxy semantics.
|
|
83
83
|
- A valid upstream 200 JSON bundle (`code` string, nonempty `revision` string, `options` object) receives `X-Yuri-Gui-Revision` and `Cache-Control: private, no-store`. Matching tokens additionally receive `X-Yuri-Gui-Code: cached` and only `data.code` becomes `''`; current `options`, `revision`, location and other fields remain. Unmatched/ordinary calls preserve original body bytes. No 304 or Yuri ETag is generated. Upstream failure statuses/bodies remain failures; malformed successful bodies remain unchanged without a revision receipt.
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ToolOutputDialog-CrjDIhru.js","assets/rolldown-runtime-hePW80VL.js","assets/runtime-auth-DBn9yahL.js","assets/runtime-switch-DEZ1K7qW.js","assets/runtime-fetch-D4ja813o.js","assets/desktop-JwYqThiw.js","assets/runtimeAPIRegistry-C2VogTny.js","assets/vendor-base-ui-BQjbsJ43.js","assets/useUIStore-BbYD420L.js","assets/vendor-zustand-B43HCgwC.js","assets/brand-storage-bootstrap-D4BW3w-M.js","assets/brand-storage-migration-Bhz6UOBJ.js","assets/vendor-react-D5d-V1vN.js","assets/vendor-tanstack-react-query-C4SG3JZB.js","assets/vendor-tanstack-query-core-BWz0ose6.js","assets/runtime-file-resource-6np6lzoV.js","assets/queryRuntime-Dkpnq3Z1.js","assets/fileQueries-5a1jkme2.js","assets/runtime-file-store-BVRgEtI-.js","assets/path-utils-jGozTg9d.js","assets/vendor-aparajita-capacitor-secure-storage-xol_6BsB.js","assets/runtime-file-download-CcNIVp7u.js","assets/platform-DFJEtBlo.js","assets/vendor-pierre-diffs-Bj9Nqn6w.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-BcebBLwF.js","assets/vendor-lodash-es-DfLbG5Af.js","assets/vendor-js-cookie-hSOiFTtX.js","assets/button-DinGM3tu.js","assets/store-CUBymvAC.js","assets/vendor-class-variance-authority-BLUaYARZ.js","assets/vendor-tailwind-merge-BicNWLTg.js","assets/useThemeSystem-CGF5jnIh.js","assets/vendor-framer-motion-C1twy-GF.js","assets/Icon-t2xvbAyN.js","assets/dialog-BXssfGXA.js","assets/dialog-CTYD3Sbr.css","assets/tap-LkQum5bB.js","assets/image-loading-Dq1g_wpm.js","assets/image-loading-D9Z_BASK.css","assets/MobileWindowStack-DGLdgoGr.js","assets/appThemeRegistry-Bb_DtiV9.js","assets/useMobileNavigationStore-BHMFeMjo.js","assets/gitApiHttp-De9liKnG.js","assets/vendor-opencode-client-UL_TecvQ.js","assets/vendor-effect-DV9F8PTZ.js","assets/persistence-CfrHIiIS.js","assets/pathNormalization-ewtPqJWn.js","assets/vendor-pathe-vBmvQE8f.js","assets/vendor-sonner-r2EJnfoo.js","assets/useAssistantUIStore-Bp6TxG5E.js","assets/vendor-zod-Dzk5kdUU.js","assets/vendor-fuse.js-DB5wDJbI.js","assets/vendor-fuzzysort-ukaRp9PC.js","assets/agentColors-DWSbQXy2.js","assets/rasterizePng-056Poix7.js","assets/MarkdownRenderer-BlGxjOei.js","assets/useEffectiveDirectory-D8FFE5Yn.js","assets/markdownHeightCache-BVV2dktw.js","assets/dualLimitLru-D8Sphgua.js","assets/toolHelpers-iEHVHQ9p.js","assets/ImageLoadingPlaceholder-D1L13TK0.js","assets/useWorkerHighlightedLines-CPxG8Fya.js","assets/markdownTheme-hpURsgju.js","assets/markdown-worker-oBGEB9Eg.js","assets/vendor-tanstack-react-virtual-BeZn51tF.js","assets/mobileBackNavigation-DMSzAvb6.js","assets/touch-gestures-K2_ZOkKW.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-DEZ1K7qW.js";import{a as r}from"./vendor-zustand-B43HCgwC.js";import{at as i,c as a,d as o,f as s,it as c,l,m as u,p as d,u as f}from"./vendor-base-ui-BQjbsJ43.js";import{n as p}from"./useUIStore-BbYD420L.js";import{$ as m,B as h,J as g,K as _,U as v,X as y,q as b,st as x,z as S}from"./persistence-CfrHIiIS.js";import{n as C}from"./vendor-react-D5d-V1vN.js";import{s as w}from"./vendor-tanstack-react-query-C4SG3JZB.js";import{o as T}from"./vendor-aparajita-capacitor-secure-storage-xol_6BsB.js";import{n as E,r as D}from"./platform-DFJEtBlo.js";import{a as O,f as k,i as A,o as j,p as M,r as N}from"./vendor-reactuses-core-BcebBLwF.js";import{f as P,r as F,t as I}from"./button-DinGM3tu.js";import{i as ee,n as L}from"./MobileShareBridge-C3Equ3P_.js";import{N as R,T as te,_ as z,f as B,g as V,h as H,j as U,n as ne,r as W,u as G,v as re,w as ie}from"./MobileDetailNavigation-tbfsMfB-.js";import{En as ae,Gr as oe,Ui as K,Wi as q,Xt as se,lt as ce,s as le,yo as ue}from"./useMobileNavigationStore-BHMFeMjo.js";import{n as de}from"./useAssistantUIStore-Bp6TxG5E.js";import{t as fe}from"./AgentAvatar-Bi1vvWPC.js";import{d as pe,o as J,t as me}from"./vendor-framer-motion-C1twy-GF.js";import{n as Y}from"./Icon-t2xvbAyN.js";import{c as he,s as ge}from"./image-loading-Dq1g_wpm.js";import{t as _e}from"./scheduledTaskNavigation-Bsrhv3Ow.js";import{D as ve,E as X,O as ye,a as be,d as xe,f as Se,g as Ce,h as we,l as Te,m as Ee,o as De,p as Oe,s as ke,t as Ae,u as je,w as Me,x as Ne}from"./sessionLookup-DRVy7LM1.js";import{a as Pe,n as Fe,r as Ie,t as Le}from"./fileMentionTouchSelection-DSl0tj2r.js";import{a as Re,o as ze,t as Be}from"./MarkdownRenderer-BlGxjOei.js";import{t as Ve}from"./ImageLoadingPlaceholder-D1L13TK0.js";import{t as He}from"./LoadingImage-5rY_edNm.js";import{n as Ue}from"./textarea-B39OCNPV.js";import{t as We}from"./vendor-motion-BmLx2V78.js";import{i as Ge,n as Ke,r as qe}from"./assistant-attachment-cache-B9iHLlm2.js";var Z=C(),Q=e(i(),1),$=c();function Je(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(et),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,G(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=N(d),p;r[5]===f?p=r[6]:(p=e=>{s.current=e.some($e),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,N(p),m),A(`visibilitychange`,f,Qe),A(`focus`,f,Ze),A(`resize`,f,Xe);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,Ye,_),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 Ye(){return document.documentElement}function Xe(){return window.visualViewport}function Ze(){return window}function Qe(){return document}function $e(e){return e.isIntersecting&&e.intersectionRatio===1}function et(){return{transport:t(),generation:n()}}var tt=()=>{},nt=Q.memo(ye),rt=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,it=Q.forwardRef(({query:e,isMobile:t,listId:n,onHighlightChange:r,onSelect:i,onClose:a},o)=>{let{t:s}=P(),c=he(),l=w({...q(c),select:rt}),u=Q.useMemo(()=>ce({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 _=N(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)(I,{type:`button`,size:`xs`,variant:`ghost`,"aria-label":s(`dialog.common.actions.close`),onClick:a,children:(0,$.jsx)(Y,{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)(I,{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)(Ue,{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:F(`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)(Y,{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`)})]})}),at=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}=P(),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}=ve(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 m=p,y;t[11]===a.value?y=t[12]:(y=()=>({canonical:a.value,document:v(a.value,new Map)}),t[11]=a.value,t[12]=y);let[C,w]=Q.useState(y),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,M]=Q.useState(!1),[I,ee]=Q.useState(),L=Q.useRef(null),R=Q.useRef(null),te=Q.useRef(null),z=Q.useRef(null),B;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(B=xe(),t[17]=B):B=t[17];let V=Q.useRef(B),H=Q.useId(),U;t[18]!==n||t[19]!==j||t[20]!==D||t[21]!==k||t[22]!==E.text||t[23]!==a.disabled||t[24]!==a.pending?(U=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]=U):U=t[25];let ne=U,W=ne?.kind===`mention`?ne:null,G;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(G=()=>{z.current!==null&&(L.current?.focus({preventScroll:!0}),L.current?.setSelectionRange(z.current,z.current),z.current=null)},t[26]=G):G=t[26];let re;t[27]===E?re=t[28]:(re=[E],t[27]=E,t[28]=re),Q.useLayoutEffect(G,re);let ie;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(ie=()=>A(!0),t[29]=ie):ie=t[29];let ae=N(ie),oe;t[30]!==j||t[31]!==D||t[32]!==E||t[33]!==r?(oe=(e,t,n)=>{let i=n===void 0||n,a=g(e);a.ok&&(i&&(V.current=Se(V.current,{before:je(E,[],{start:L.current?.selectionStart??D,end:L.current?.selectionEnd??D}),after:je(e,[],{start:t,end:t})})),j||(z.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]=oe):oe=t[34];let K=N(oe),q;t[35]!==K||t[36]!==E||t[37]!==W||t[38]!==o?(q=e=>{if(!W)return;let t=e.title||o(`chat.fileMentionAutocomplete.untitledSession`),n=h(E,W.tokenStart,W.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]=W,t[38]=o,t[39]=q):q=t[39];let se=N(q),ce;t[40]!==n||t[41]!==K||t[42]!==E||t[43]!==a.disabled||t[44]!==a.pending?(ce=e=>{if(!n||a.pending||a.disabled||!e.trim())return;let t=E.text?`${E.text} ${e}`:e,r=_(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]=ce):ce=t[45];let le=N(ce),ue;t[46]!==n||t[47]!==E.text||t[48]!==le||t[49]!==r||t[50]!==i||t[51]!==a.disabled||t[52]!==a.pending?(ue=e=>{if(!(!n||a.pending||a.disabled||!e.trim())){if(E.text){le(e);return}r(e),i?.(e)}},t[46]=n,t[47]=E.text,t[48]=le,t[49]=r,t[50]=i,t[51]=a.disabled,t[52]=a.pending,t[53]=ue):ue=t[53];let de=N(ue),fe;t[54]!==K||t[55]!==E?(fe=(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=S(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=_(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]=fe):fe=t[56];let pe=N(fe),J;t[57]!==E.references||t[58]!==E.text?(J=Ce(E.text,E.references.map(ot))?.map(st),t[57]=E.references,t[58]=E.text,t[59]=J):J=t[59];let me=J,Y=u&&E.text.length===0?`true`:void 0,he;t[60]!==u||t[61]!==le||t[62]!==a.disabled||t[63]!==a.pending||t[64]!==de||t[65]!==f?(he=u&&(0,$.jsx)(nt,{containerRef:s,disabled:!!(a.pending||a.disabled),onInsert:le,onSend:de,onRelease:tt,onHintChange:f}),t[60]=u,t[61]=le,t[62]=a.disabled,t[63]=a.pending,t[64]=de,t[65]=f,t[66]=he):he=t[66];let ge=E.text,_e=a.pending,X;t[67]===a?X=t[68]:(X=()=>{a.pending||a.onSubmit()},t[67]=a,t[68]=X);let ye=a.layout===`inline`?`py-3 leading-6`:`pt-4 pb-2`,be;t[69]!==a.textLayoutClassName||t[70]!==ye?(be=F(`whitespace-pre-wrap break-words overflow-hidden px-3 typography-markdown md:typography-ui-label`,ye,a.textLayoutClassName),t[69]=a.textLayoutClassName,t[70]=ye,t[71]=be):be=t[71];let we;t[72]!==K||t[73]!==E?(we=(e,t)=>{let n=_(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]=we):we=t[74];let Te=W?H:void 0,De=W?I:void 0,ke;t[75]===a.textareaProps?ke=t[76]:(ke=e=>{a.textareaProps?.onScroll?.(e),R.current&&(R.current.scrollTop=e.currentTarget.scrollTop,R.current.scrollLeft=e.currentTarget.scrollLeft)},t[75]=a.textareaProps,t[76]=ke);let Ae,Fe;t[77]!==pe||t[78]!==a.textareaProps?(Ae=e=>{a.textareaProps?.onCopy?.(e),e.defaultPrevented||pe(e,!1)},Fe=e=>{a.textareaProps?.onCut?.(e),e.defaultPrevented||pe(e,!0)},t[77]=pe,t[78]=a.textareaProps,t[79]=Ae,t[80]=Fe):(Ae=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=()=>{M(!0)},Re=e=>{M(!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]!==W||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?Oe(V.current,E):Ee(V.current,E);t&&(e.preventDefault(),V.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}}W&&[`ArrowDown`,`ArrowUp`,`Enter`,`Tab`,`Escape`].includes(e.key)&&(e.preventDefault(),e.stopPropagation(),te.current?.keyDown(e.key))}},t[85]=K,t[86]=j,t[87]=E,t[88]=W,t[89]=a.textareaProps,t[90]=ze):ze=t[90];let Be;t[91]!==a.textareaProps||t[92]!==Te||t[93]!==De||t[94]!==ke||t[95]!==Ae||t[96]!==Fe||t[97]!==Ie||t[98]!==ze?(Be={...a.textareaProps,"aria-controls":Te,"aria-activedescendant":De,"aria-autocomplete":`list`,onScroll:ke,onCopy:Ae,onCut:Fe,onSelect:Ie,onCompositionStart:Le,onCompositionEnd:Re,onKeyDown:ze},t[91]=a.textareaProps,t[92]=Te,t[93]=De,t[94]=ke,t[95]=Ae,t[96]=Fe,t[97]=Ie,t[98]=ze,t[99]=Be):Be=t[99];let Ve;t[100]!==ae||t[101]!==H||t[102]!==W||t[103]!==a.isMobile||t[104]!==se?(Ve=W?(0,$.jsx)(it,{ref:te,query:W.query,isMobile:a.isMobile??!1,listId:H,onHighlightChange:ee,onSelect:se,onClose:ae}):null,t[100]=ae,t[101]=H,t[102]=W,t[103]=a.isMobile,t[104]=se,t[105]=Ve):Ve=t[105];let He;t[106]!==E.text||t[107]!==me||t[108]!==m||t[109]!==a||t[110]!==X||t[111]!==be||t[112]!==we||t[113]!==Be||t[114]!==Ve?(He=(0,$.jsx)(Ne,{...a,value:ge,pending:_e,placeholder:m,disableInputWhilePending:!1,inputRef:L,onSubmit:X,highlightedContent:me,highlightRef:R,textLayoutClassName:be,onChange:we,textareaProps:Be,children:Ve}),t[106]=E.text,t[107]=me,t[108]=m,t[109]=a,t[110]=X,t[111]=be,t[112]=we,t[113]=Be,t[114]=Ve,t[115]=He):He=t[115];let Ue;return t[116]!==Y||t[117]!==he||t[118]!==He?(Ue=(0,$.jsxs)(`div`,{ref:s,className:`yuri-hold-to-talk-container`,"data-hold-to-talk-empty":Y,children:[he,He]}),t[116]=Y,t[117]=he,t[118]=He,t[119]=Ue):Ue=t[119],Ue};function ot(e){return{start:e.start,end:e.end,priority:103,...y(e)}}function st(e,t){return(0,$.jsx)(`span`,{className:e.className,children:e.visual?(0,$.jsx)(we,{visual:e.visual,text:e.text}):e.text},`${t}-${e.text.length}`)}var ct=`rounded-[1.35rem] border border-border/40 cursor-zoom-in`;function lt({assistantID:e,descriptor:t,onShowPopup:n}){let{t:r}=P(),i=he(),{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&&qe(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=N(async(t=!1)=>{if(x.current)return;let i=new AbortController;x.current=i,b(!0),v(!1);try{let a=await Ke(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=N(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)(He,{src:h,alt:w,contentFrame:!0,className:ct,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)(Ve,{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)(Y,{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)(I,{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 ut(e){let t=(0,Z.c)(39),{part:n,onShowPopup:r}=e,{t:i}=P(),a=/^(?:https?:|data:|blob:)/i.test(n.url)?n.url:``,o=ge(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=N(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)(I,{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)(He,{src:o,alt:u,contentFrame:!0,className:ct,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)(Y,{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)(I,{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 dt(e){let t=(0,Z.c)(5),{assistantID:n,part:r,onShowPopup:i}=e,a=he(),o;return t[0]!==n||t[1]!==i||t[2]!==r||t[3]!==a?(o=`attachmentID`in r?(0,$.jsx)(lt,{assistantID:n,descriptor:r,onShowPopup:i},`${a}:${n}:${r.attachmentID}:${r.sha256}`):(0,$.jsx)(ut,{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 ft=Q.memo(e=>{let t=(0,Z.c)(32),{turn:n,retryDisabled:r,onRetry:i}=e,{t:c}=P(),p;t[0]===c?p=t[1]:(p=c(`assistants.contact.sendError.viewDetails`),t[0]=c,t[1]=p);let m;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,$.jsx)(Y,{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)(d,{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]===c?_=t[7]:(_=c(`assistants.contact.sendError.title`),t[6]=c,t[7]=_);let v;t[8]===_?v=t[9]:(v=(0,$.jsx)(l,{className:`typography-ui-label font-medium`,children:_}),t[8]=_,t[9]=v);let y;t[10]!==c||t[11]!==n.error?(y=n.error||c(`assistants.contact.sendFailed`),t[10]=c,t[11]=n.error,t[12]=y):y=t[12];let b;t[13]===y?b=t[14]:(b=(0,$.jsx)(a,{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]!==i||t[16]!==n.messageID?(x=()=>i(n.messageID),t[15]=i,t[16]=n.messageID,t[17]=x):x=t[17];let S;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,$.jsx)(Y,{name:`refresh`,className:`size-3`}),t[18]=S):S=t[18];let C;t[19]===c?C=t[20]:(C=c(`chat.history.retry`),t[19]=c,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)(I,{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)(s,{children:(0,$.jsx)(o,{side:`left`,align:`center`,sideOffset:6,collisionPadding:12,collisionAvoidance:g,className:`z-50`,children:(0,$.jsxs)(f,{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)(u,{children:[h,T]}),t[29]=T,t[30]=h,t[31]=E):E=t[31],E});function pt(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)(ft,{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 mt=[],ht=e=>e.flatMap(e=>e.type===`text`&&e.text.trim()?[e.text]:[]).join(`
|
|
3
|
-
`),gt=(e,t,n,r=Date.now())=>({assistantID:e,messageID:t,parts:n,status:`sending`,createdAt:r}),_t=(e,t)=>{let n=e.filter(e=>e.assistantID===t);return n.length===e.length?e:n},vt=(e,t)=>{let n=e.filter(e=>e.assistantID===t);return n.length===e.length?e:n},yt=(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:[]}),bt=(e,t,n)=>{let r=e.bubbles.filter(e=>!t.has(e.bubbleIndex)).map((t,r)=>yt(e,t,n+r,t.done?`complete`:`streaming`));return e.status===`failed`?[...r,yt(e,null,n+r.length,`failed`)]:e.status===`admitted`||e.status===`streaming`?[...r,yt(e,null,n+r.length,`admitted`)]:r},xt=(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:ht(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=bt(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)},St=(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},Ct=(e,t)=>e.map(e=>e.messageID===t?{...e,status:`admitted`}:e),wt=(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}]},Tt=(e,t,n)=>!t?.turnID||!t.assistantID||n?.has(t.turnID)?e:wt(e,t.assistantID,t.turnID,t.admittedAt),Et=(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=Tt(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=Ot(u,{assistantID:n,turnID:e.turnID,status:`error`,error:e.text||`upstream_error`,occurredAt:s})));if(u=kt(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},Dt=(e,t)=>wt(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}}),Ot=(e,t,n={})=>n.requireExisting&&!e.some(e=>e.assistantID===t.assistantID&&e.turnID===t.turnID)?e:wt(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}:{}}),kt=(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},At=(e,t,n)=>e.map(e=>e.messageID===t?{...e,status:`failed`,error:n}:e),jt=(e,t)=>e instanceof U?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})`:R(e)?t.timedOut:e instanceof Error&&e.message.trim()?e.message:t.sendFailed,Mt=()=>{let e=!1;return{tryAcquire:()=>!e&&(e=!0,!0),release:()=>{e=!1}}},Nt=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:gt(e.assistantID,r,n,e.createdAt)}},Pt=e=>e.some(e=>e.status===`sending`),Ft=e=>e.some(e=>e.status===`admitted`||e.status===`streaming`),It=r(e=>({workingByID:{},setWorking:(t,n)=>e(e=>({workingByID:{...e.workingByID,[t]:n}}))})),Lt=({sending:e=!1,processing:t=!1,serverWorking:n=!1})=>e||t||n,Rt=(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=It(i),o;return n[2]!==a||n[3]!==r?(o=Lt({processing:a,serverWorking:r}),n[2]=a,n[3]=r,n[4]=o):o=n[4],o},zt=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}=P(),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 _=It(g),v=!!(o||_),y=`calc(${f}px * var(--dpt-n, 1))`,b;t[3]===c?b=t[4]:(b=F(`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)(fe,{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 Bt(e){let t=(0,Z.c)(6),{value:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,$.jsx)(Y,{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 Vt=Q.createContext(null),Ht=[`grid h-[148px] w-[19rem] min-w-0 max-w-full shrink-0 grid-rows-[40px_20px_20px_48px] 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(` `),Ut=Ht,Wt=Ht,Gt=`row-start-1 mb-2 flex h-8 min-w-0 items-center gap-2`,Kt=`row-start-2 min-w-0 self-start truncate font-medium leading-5 text-foreground`,qt=`row-start-4 flex h-12 min-w-0 flex-col justify-center`;function Jt(e,t){(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),t())}var Yt=e=>{let t=(0,Z.c)(36),{card:n,assistant:r,active:i}=e,a=i===void 0||i,{t:o}=P(),s=X(),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(Vt),p;t[2]!==n.assistantID||t[3]!==l||t[4]!==f?(p=()=>{if(f)return f({assistantID:n.assistantID});if(l){le.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=N(p),h;t[6]===m?h=t[7]:(h=e=>{Jt(e,m)},t[6]=m,t[7]=h);let g=N(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)(zt,{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)(Y,{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:Gt,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=F(Kt,`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=F(qt,`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)(Bt,{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:Ut,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},Xt=e=>!!(e&&typeof e==`object`&&!Array.isArray(e)),Zt=e=>typeof e==`string`&&/^([01]\d|2[0-3]):[0-5]\d$/.test(e),Qt=e=>typeof e==`number`&&Number.isInteger(e)&&e>=0&&e<=6,$t=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,en=e=>{if(!Xt(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)&&Zt(e.time);let t=Array.isArray(e.times)&&e.times.length>0&&e.times.every(Zt);return e.kind===`daily`?t||Zt(e.time):e.kind===`weekly`&&(t||Zt(e.time))&&Array.isArray(e.weekdays)&&e.weekdays.length>0&&e.weekdays.every(Qt)},tn=(e,t)=>{if(!$t(e)||!en(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}},nn=(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(Zt))].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(Qt))].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}},rn=e=>{let t=(0,Z.c)(44),{card:n,task:r}=e,{t:i}=P(),a=n.name,o;t[0]!==n||t[1]!==i||t[2]!==r?(o=nn(tn(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(Vt),d;t[6]!==n.projectID||t[7]!==n.taskID||t[8]!==u?(d=()=>{if(u)return u({projectID:n.projectID,taskID:n.taskID});_e(n.projectID,n.taskID)},t[6]=n.projectID,t[7]=n.taskID,t[8]=u,t[9]=d):d=t[9];let f=N(d),p;t[10]===f?p=t[11]:(p=e=>{Jt(e,f)},t[10]=f,t[11]=p);let m=N(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)(Y,{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)(Y,{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:Gt,children:[v,y]}),t[21]=v,t[22]=b);let x;t[23]===a?x=t[24]:(x=(0,$.jsx)(`h3`,{className:Kt,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=F(qt,`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:Ut,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},an=(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`,on=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,sn=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`,cn=e=>e.split(/[/\\]/u).filter(Boolean).at(-1)||e,ln=e=>{let t=(0,Z.c)(57),{card:n}=e,{t:r}=P(),i=X(),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=K(s),l=se(n.sessionID),u=(typeof c?.title==`string`&&c.title.trim()?c.title.trim():null)||n.title||r(`assistants.contact.card.session.untitled`),d=an(l?.type,n.status),f=on(d),m;t[4]!==n.directory||t[5]!==c?(m=typeof c?.directory==`string`&&c.directory.trim()?c.directory.trim():n.directory,t[4]=n.directory,t[5]=c,t[6]=m):m=t[6];let h=m,g;t[7]===h?g=t[8]:(g=cn(h),t[7]=h,t[8]=g);let _=g,v=oe(h).data?.current?.trim()||null,y;t[9]===c?y=t[10]:(y=De(c),t[9]=c,t[10]=y);let b=y,x=d===`complete`||d===`idle`?be(c):null,S=Q.useContext(Vt),C;t[11]!==n.directory||t[12]!==n.sessionID||t[13]!==o||t[14]!==S?(C=()=>{let e=Ae(n.sessionID)?.directory||n.directory;if(S)return S({sessionId:n.sessionID,directory:e});ae(n.sessionID,e,{phoneShell:o,switchToChat:!0}),o||p.getState().setActiveMainTab(`chat`)},t[11]=n.directory,t[12]=n.sessionID,t[13]=o,t[14]=S,t[15]=C):C=t[15];let w=N(C),T;t[16]===w?T=t[17]:(T=e=>{Jt(e,w)},t[16]=w,t[17]=T);let E=N(T),O=Wt,k=r(`assistants.contact.card.session.aria`,{title:u}),A;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,$.jsx)(Y,{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 M;t[21]===j?M=t[22]:(M=(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]=M);let I=f?(0,$.jsxs)(`span`,{"data-assistant-session-status":``,className:F(`ml-auto inline-flex shrink-0 items-center gap-1.5 whitespace-nowrap text-[0.75em] leading-4`,sn(d)),children:[(0,$.jsx)(`span`,{className:`size-1.5 shrink-0 rounded-full bg-current`,"aria-hidden":!0}),r(f)]}):null,ee;t[23]!==M||t[24]!==I?(ee=(0,$.jsxs)(`div`,{className:Gt,children:[M,I]}),t[23]=M,t[24]=I,t[25]=ee):ee=t[25];let L;t[26]===u?L=t[27]:(L=(0,$.jsx)(`h3`,{className:Kt,title:u,children:u}),t[26]=u,t[27]=L);let R=F(`flex min-w-0 items-center gap-1.5 text-foreground`,v&&`max-w-[45%] shrink-0`),te;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,$.jsx)(Y,{name:`folder`,weight:`medium`,className:`size-3.5 shrink-0 text-muted-foreground`}),t[28]=te):te=t[28];let z;t[29]===_?z=t[30]:(z=(0,$.jsx)(`span`,{className:`min-w-0 truncate`,children:_}),t[29]=_,t[30]=z);let B;t[31]!==h||t[32]!==R||t[33]!==z?(B=(0,$.jsxs)(`p`,{className:R,title:h,children:[te,z]}),t[31]=h,t[32]=R,t[33]=z,t[34]=B):B=t[34];let V;t[35]===v?V=t[36]:(V=v?(0,$.jsxs)(`p`,{"data-contact-session-branch":``,className:`flex min-w-0 items-center gap-1 text-muted-foreground`,title:v,children:[(0,$.jsx)(Y,{name:`git-branch`,weight:`medium`,className:`size-3 shrink-0`}),(0,$.jsx)(`span`,{className:`min-w-0 truncate`,children:v})]}):null,t[35]=v,t[36]=V);let H;t[37]!==B||t[38]!==V?(H=(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:[B,V]}),t[37]=B,t[38]=V,t[39]=H):H=t[39];let U=x?(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)(Y,{name:`code`,weight:`medium`,className:`size-3.5 shrink-0`}),x.additions===void 0?null:(0,$.jsxs)(`span`,{className:`text-[var(--status-success)]`,children:[`+`,x.additions]}),x.deletions===void 0?null:(0,$.jsxs)(`span`,{className:`text-[var(--status-error)]`,children:[`−`,x.deletions]}),x.files===void 0?null:(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:x.files===1?r(`assistants.contact.card.session.changes.filesSingle`,{count:x.files}):r(`assistants.contact.card.session.changes.filesPlural`,{count:x.files})})]}):null,ne;t[40]===b?ne=t[41]:(ne=b?(0,$.jsx)(Bt,{value:b}):null,t[40]=b,t[41]=ne);let W;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,$.jsx)(Y,{name:`arrow-right-s`,weight:`medium`,className:`ml-auto size-4 shrink-0 text-muted-foreground`}),t[42]=W):W=t[42];let G;t[43]===ne?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:[ne,W]}),t[43]=ne,t[44]=G);let re;t[45]!==H||t[46]!==U||t[47]!==G?(re=(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:[H,U,G]}),t[45]=H,t[46]=U,t[47]=G,t[48]=re):re=t[48];let ie;return t[49]!==E||t[50]!==w||t[51]!==k||t[52]!==ee||t[53]!==L||t[54]!==re||t[55]!==O?(ie=(0,$.jsxs)(`article`,{className:O,role:`button`,tabIndex:0,"aria-label":k,"data-assistant-contact-card":`session`,onClick:w,onKeyDown:E,children:[ee,L,re]}),t[49]=E,t[50]=w,t[51]=k,t[52]=ee,t[53]=L,t[54]=re,t[55]=O,t[56]=ie):ie=t[56],ie},un=3e5,dn=(e,t)=>e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate();function fn(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||!dn(n,e)||e.getTime()-n.getTime()>un)&&t.set(r.messageID,r.createdAt),n=e)}return t}function pn(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`${dn(o,n)?t:(o.getFullYear()===n.getFullYear()?i:a).format(o)} ${r.format(o)}`}}var mn=2,hn=1500,gn=e=>({scrollTop:e.scrollTop,scrollHeight:e.scrollHeight,clientHeight:e.clientHeight}),_n=e=>e.scrollHeight-e.scrollTop-e.clientHeight,vn=e=>_n(e)<=mn,yn=(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},bn=e=>e.altKey||e.ctrlKey||e.metaKey?!1:e.key===`ArrowDown`||e.key===`PageDown`||e.key===`End`,xn=({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 _=me(),v=Q.useRef(!1),y=Q.useRef(null),b=Q.useRef(null),x=N(()=>{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=N(()=>{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=N(()=>{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=N(()=>{x(),l.current=!1,p.current=i.current?.scrollTop??0,w()}),D=Q.useRef(null),O=N(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=N(()=>{if(!g.current||!l.current)return!1;let e=i.current;if(!e)return!1;let t=gn(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),vn(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=J(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=N(e=>{h.current={direction:e,expiresAt:performance.now()+hn}}),P=N(()=>{let e=h.current;return e?performance.now()>e.expiresAt?(h.current=null,null):e.direction:null}),F=N(()=>{x(),l.current=!1,w()}),I=N(()=>{if(!g.current)return;let e=i.current;if(!e)return;let t=gn(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&&F();return}let o=P();T(),t.scrollTop<=80&&o===`up`&&r?.(),n&&vn(t)&&(o===`down`||o===`scrollbar`)&&(l.current=!0)}),ee=N(e=>{let t=i.current;if(!(!t||e.deltaY===0)){if(e.deltaY<0){if(Te(t,e.target))return;j(`up`),F(),t.scrollTop<=80&&r?.();return}yn(t,e.target)||j(`down`)}}),L=N(e=>{h.current=null;let t=e.touches.item(0);m.current=t?{x:t.clientX,y:t.clientY,deltaX:0,deltaY:0}:null}),R=N(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&&Te(t,e.target)||l<0&&yn(t,e.target)){m.current.deltaX=0,m.current.deltaY=0;return}j(l>0?`up`:`down`),l>2&&(F(),t.scrollTop<=80&&r?.())}}),te=N(()=>{m.current=null}),z=N(e=>{if(ke(e)){j(`up`),F(),(i.current?.scrollTop??1/0)<=80&&r?.();return}bn(e)&&j(`down`)}),B=N(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 V=Q.useMemo(()=>()=>void 0,[]),H=e&&a?a:V,U=Q.useMemo(()=>({passive:!0}),[]);A(`scroll`,I,H,U),A(`wheel`,ee,H,U),A(`touchstart`,L,H,U),A(`touchmove`,R,H,U),A(`touchend`,te,H,U),A(`touchcancel`,te,H,U),A(`keydown`,z,H),A(`pointerdown`,B,H,U);let ne=N(()=>{k(),T()});return M(typeof ResizeObserver<`u`&&e?s:null,ne),{scrollRef:S,contentRef:C,preparePrepend:E,followLatest:O}},Sn=.3,Cn=[.19919472913616398,.010644531250000006,.27920937042459737,.91025390625],wn=[.23,1,.32,1],Tn=pe(...Cn),En=pe(...wn),Dn=.15,On=.1,kn=.08,An=e=>({left:e.left,top:e.top,width:e.width,height:e.height}),jn=e=>Number.parseFloat(e)||0,Mn=(e,t,n)=>e+(t-e)*n,Nn=e=>[e.borderTopLeftRadius,e.borderTopRightRadius,e.borderBottomRightRadius,e.borderBottomLeftRadius],Pn=e=>{let t=e.getBoundingClientRect(),n=window.getComputedStyle(e),r=t.left+jn(n.borderLeftWidth)+jn(n.paddingLeft),i=t.top+jn(n.borderTopWidth)+jn(n.paddingTop);return{left:r,top:i,width:t.right-jn(n.borderRightWidth)-jn(n.paddingRight)-r,height:t.bottom-jn(n.borderBottomWidth)-jn(n.paddingBottom)-i}},Fn=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`}),In=(e,t,n=!1)=>{if(!t.value.trim())return null;let r=window.getComputedStyle(e),i=Pn(t),a=t.parentElement?.querySelector(`[data-composer-highlight]`),o=Fn(window.getComputedStyle(t));return a&&(o.color=window.getComputedStyle(a).color),{compact:n,background:An(e.getBoundingClientRect()),backgroundColor:r.backgroundColor,radii:Nn(r),text:t.value,textBox:{...i,top:i.top-t.scrollTop},textStyle:o}},Ln=e=>{let t=document.createElement(`div`);return Object.assign(t.style,{position:`absolute`,pointerEvents:`none`,margin:`0px`,...e}),t},Rn=(e,t,n,r)=>(e.style.opacity=String(t),J(e,{opacity:[t,n]},{duration:r,ease:`linear`})),zn=(e,t,n=t,r)=>{let i=window.getComputedStyle(t),a=Nn(i),o=An(t.getBoundingClientRect()),s=Pn(t),c=e.compact?{...e.background,left:e.textBox.left-jn(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=Ln({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=Ln({...e.textStyle,left:`0px`,top:`0px`,width:`${e.textBox.width}px`});f.textContent=e.text;let p=Ln({...Fn(i),left:`0px`,top:`0px`,width:`${s.width}px`});p.textContent=t.textContent??``,d.append(f,p);let m=n=>{let r=Tn(n),i=En(n),m=An(t.getBoundingClientRect()),h=c,g=Mn(h.left,m.left,i),_=Mn(h.left+h.width,m.left+m.width,i),v=Mn(h.top+h.height,m.top+m.height,r),y=Mn(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)=>`${Mn(jn(e.radii[n]),jn(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(J(d,{backgroundColor:[e.backgroundColor,i.backgroundColor]},{duration:Dn,ease:`linear`}),Rn(f,1,0,On),Rn(p,0,1,kn),J(0,1,{duration:Sn,ease:`linear`,onUpdate:m,onComplete:_})),_},Bn=64,Vn=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)},Hn=e=>Array.from(e?.files||[]),Un=async(e,t=m)=>{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}},Wn=(e,t)=>{let n=[...e,...t];for(let e of n.slice(Bn))e.url.startsWith(`blob:`)&&URL.revokeObjectURL(e.url);return n.slice(0,Bn)},Gn=ze(()=>T(()=>import(`./ToolOutputDialog-CrjDIhru.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]))),Kn=e=>e.trim().startsWith(`yuri.settle.`)||e.trim().startsWith(`oc.settle.`),qn=e=>e.status===`error`||e.status===`failed`&&e.messageID.endsWith(`:preview:failed`),Jn=e=>e.role===`assistant`&&e.status!==`error`&&e.parts.some(e=>e.type===`text`)?`${e.turnID}:assistant:${e.bubbleIndex}`:e.messageID,Yn=({assistant:e,warning:t,active:n,overlayHeader:r=!1})=>{let{t:i,locale:a}=P(),o=he(),s=p(e=>e.isMobile),c=H(),l=re(),u=V(e.id,n),d=p(e=>e.isSettingsDialogOpen),f=n&&!d&&!u.hasMessageGap?ie(e,u.data):null,h=ee(e.name).displayName||e.name,g=(e,t)=>{let n=e?l.data?.assistants.find(t=>t.id===e):void 0;return n?ee(n.name).displayName||n.name:t||i(`assistants.contact.peer.unknown`)},[_,v]=Q.useState(``),[y,b]=Q.useState([]),x=Q.useRef(new Map),S=Q.useRef(new Map),C=Q.useRef(new AbortController);Q.useEffect(()=>{let e=new AbortController;return C.current=e,()=>e.abort()},[e.id,o]);let w=Q.useRef(new Set),[T,E]=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 w.current)e.has(t)||URL.revokeObjectURL(t);w.current=e},[y,T]),Q.useEffect(()=>()=>{for(let e of w.current)URL.revokeObjectURL(e)},[]);let[D,O]=Q.useState([]),[k,A]=Q.useState(null),[j,M]=Q.useState({open:!1,title:``,content:``}),R=p(e=>e.setImagePreviewOpen),te=N(e=>{(e.image||e.mermaid||e.video)&&(M(e),R(!0))}),ne=N(e=>{M(t=>({...t,open:e})),R(e)});Q.useEffect(()=>()=>{R(!1)},[R]),Q.useEffect(()=>{S.current.clear(),x.current.clear(),E([]),O([]),A(null)},[o]);let G=Q.useMemo(()=>Mt(),[]),ae=Q.useRef(new Set),oe=Q.useRef(new Map),K=It(e=>e.setWorking),q=u.data?.messages??mt,se=Q.useMemo(()=>q.some(e=>e.parts.some(e=>e.type===`card`&&e.cardType===`schedule`&&$t(e))),[q]),ce=z(e.id,n&&se),le=Q.useMemo(()=>{let e=new Map;for(let t of ce.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},[ce.data]),de=_t(T,e.id),fe=vt(D,e.id),pe=xt(q,de,e.id,fe).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`&&Kn(e.text)))}),J=pe.length-1;for(;J>=0&&qn(pe[J]);)--J;let ge=pe.filter((e,t)=>!qn(e)||t>J),_e=fn(ge),ve=me(),X=`${o}:${e.id}`,ye=Q.useRef(null),be=ye.current,xe=be?.lastID?ge.findIndex(e=>Jn(e)===be.lastID):-1,Se=n&&!ve&&be?.scope===X&&be.ready&&(be.lastID===null||xe>=0);Q.useLayoutEffect(()=>{let e=ge.at(-1);ye.current={scope:X,ready:n&&u.isSuccess,lastID:e?Jn(e):null}});let Ce=new Date().toDateString(),we=i(`common.date.today`),Te=Q.useMemo(()=>pn(a,we,new Date(Ce)),[a,we,Ce]),Ee=Pt(de),De=Ft(fe),Oe=!!(e.working||e.activeContactTurn),ke=l.data?.revision??null,Ae=fe.reduce((e,t)=>e+t.bubbles.reduce((e,t)=>e+t.text.length,0),0),je=new Map(fe.map(e=>[e.turnID,e])),Me=Q.useRef(!1),Ne=N(async(e=!1)=>{if(!(!n||Me.current||u.isFetchingPreviousPage||u.isFillingMessageGap)&&!(e&&u.previousPageError)&&!(!u.hasPreviousPage&&!u.hasMessageGap)){Me.current=!0,Ie();try{u.hasMessageGap?await u.retryMessageGap():await u.fetchPreviousPage()}catch{}finally{Me.current=!1}}}),{scrollRef:Pe,contentRef:Fe,preparePrepend:Ie,followLatest:Le}=xn({active:n,assistantID:e.id,contentRevision:`${ge[0]?.messageID}:${ge.length}:${Ae}:${u.isFetchingPreviousPage}:${u.hasPreviousPage}:${u.isFillingMessageGap}`,onLoadEarlier:()=>{Ne(!0)}}),Re=Q.useRef(null),ze=Q.useRef(null),Ve=Q.useRef(null),He=Q.useRef(null),Ue=Q.useRef(null),[Ke,qe]=Q.useState(null),Z=()=>{let e=ze.current?.querySelector(`[data-assistant-contact-composer-surface]`),t=e?.querySelector(`textarea`);return e&&t?In(e,t,!s):null};Q.useLayoutEffect(()=>{let e=Ve.current;if(!e)return;Ve.current=null;let t=Array.from(Re.current?.querySelectorAll(`[data-message-id]`)??[]).find(t=>t.dataset.messageId===e.messageID)?.querySelector(`[data-assistant-contact-text]`),n=()=>qe(t=>t?.messageID===e.messageID?null:t);if(!t){n();return}Ue.current?.(),Ue.current=zn(e.source,t,t,n)}),Q.useEffect(()=>()=>{Ve.current=null,Ue.current?.(),Ue.current=null},[n,e.id,o]),Q.useEffect(()=>{A(null),x.current.clear(),S.current.clear(),ae.current.clear(),oe.current=new Map,E(t=>_t(t,e.id)),O(t=>vt(t,e.id)),M({open:!1,title:``,content:``}),R(!1)},[e.id,R]),Q.useEffect(()=>{for(let e of q){let t=x.current.get(e.messageID);if(t){for(let e of t.attachments)S.current.delete(`${t.assistantID}:${e.id}`);x.current.delete(e.messageID)}}E(e=>St(e,q))},[q]),Q.useEffect(()=>{let t=new Set(de.filter(e=>e.status===`sending`).map(e=>e.messageID));O(n=>Et(n,{assistantID:e.id,activeContactTurn:e.activeContactTurn?{turnID:e.activeContactTurn.turnID,admittedAt:e.activeContactTurn.admittedAt}:null,serverWorking:Oe,snapshotRevision:ke,admissionRevisionByTurnID:oe.current,pendingSendTurnIDs:t,messages:q,settledTurnIDs:ae.current}))},[e.activeContactTurn,e.id,q,de,Oe,ke]),Q.useEffect(()=>{K(e.id,Ee||De||Oe)},[e.id,De,Ee,Oe,K]),Q.useEffect(()=>{let t=e.id;return()=>{K(t,!1)}},[e.id,K]);let Ye=N(t=>{if(!(!(`assistantID`in t)||t.assistantID!==e.id)){if(t.type===`contact-turn-start`){ae.current.delete(t.turnID),O(e=>wt(e,t.assistantID,t.turnID,t.occurredAt));return}if(t.type===`contact-bubble-delta`){if(ae.current.has(t.turnID))return;O(e=>Dt(e,t));return}t.type===`contact-turn-end`&&(ae.current.add(t.turnID),O(e=>kt(Ot(e,t,{requireExisting:!0}),q)))}});Q.useEffect(()=>{if(n)return ue(Ye)},[n,e.id]);let Xe=N(async e=>{if(Ee)return;let t=C.current,n=await Un(e);if(t.signal.aborted){n.attachments.forEach(e=>URL.revokeObjectURL(e.url));return}n.skippedTooLarge>0&&A(i(`assistants.contact.attachment.tooLarge`)),n.attachments.length!==0&&b(e=>Wn(e,n.attachments))}),Ze=N(e=>{let t=Vn(e.clipboardData);t.length!==0&&(e.preventDefault(),Xe(t))}),Qe=N(e=>{Array.from(e.dataTransfer?.types??[]).includes(`Files`)&&(e.preventDefault(),e.dataTransfer.dropEffect=`copy`)}),$e=N(e=>{let t=Hn(e.dataTransfer);t.length!==0&&(e.preventDefault(),Xe(t))}),et=N(async(t,r)=>{let a=C.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=Nt({gate:G,sending:Pt(de),text:l,attachments:u,assistantID:o,createMessageID:()=>r||`yuri_contact_${m()}`});if(!d.ok)return;K(o,!0),x.current.set(d.messageID,{assistantID:o,text:l,attachments:u});let f=u.length===0&&t===void 0&&!r&&n&&!ve?Z():null;Ve.current=f?{messageID:d.messageID,source:f}:null,qe(f?{scope:X,messageID:d.messageID}:null),He.current=f?d.messageID:He.current,r||(Le(f?{duration:Sn,ease:Cn}:void 0),v(e=>e===l?``:e),b(e=>e.filter(e=>!u.includes(e)))),E(e=>e.some(e=>e.messageID===d.messageID)?e.map(e=>e.messageID===d.messageID?{...d.turn,createdAt:e.createdAt}:e):[...e,d.turn]),A(null);let p=()=>{u.forEach(e=>S.current.delete(`${o}:${e.id}`)),x.current.delete(d.messageID)};try{let t=[];for(let e of u){let n=`${o}:${e.id}`,r=S.current.get(n);if(!r){if(r=await Ge(o,e.file,e.id,a.signal),a.signal.aborted)return;S.current.set(n,r)}t.push(r)}if(a.signal.aborted)return;let n=[...d.parts.filter(e=>e.type===`text`),...t];E(e=>e.map(e=>e.messageID===d.messageID?{...e,parts:n}:e));let r=await B(o,d.messageID,{parts:n});if(a.signal.aborted)return;p(),typeof r.revision==`number`&&oe.current.set(d.messageID,r.revision),E(e=>Ct(e,d.messageID)),ae.current.has(d.messageID)||O(e=>wt(e,o,d.messageID)),c.data?.serverInstanceID&&L({serverInstanceID:c.data.serverInstanceID,assistantID:o,name:h,avatarSeed:e.avatarSeed??o}).catch(()=>void 0)}catch(e){if(a.signal.aborted)return;if(e instanceof U&&e.code===`admission_timeout`)try{let e=await W(o,d.messageID);if(a.signal.aborted)return;if(e){p(),typeof e.revision==`number`&&oe.current.set(d.messageID,e.revision),E(e=>Ct(e,d.messageID)),ae.current.has(d.messageID)||O(e=>wt(e,o,d.messageID));return}}catch{}let t=jt(e,{noProvider:i(`assistants.contact.noProvider`),sendFailed:i(`assistants.contact.sendFailed`),timedOut:i(`assistants.contact.timedOut`)});E(e=>At(e,d.messageID,t))}finally{G.release()}}),tt=N(e=>{et(void 0,e)}),nt=u.isError&&ge.length===0,rt=u.isSuccess&&ge.length===0,it=new Map(de.map(e=>[e.messageID,e]));return(0,$.jsxs)(`div`,{ref:Re,className:`flex min-h-0 flex-1 flex-col bg-background`,children:[(0,$.jsxs)(`div`,{ref:Pe,className:F(`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,nt?(0,$.jsxs)(`div`,{ref:Fe,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)(zt,{name:e.id,avatarSeed:e.avatarSeed,size:44,label:h,working:n?Oe: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)(Y,{name:`error-warning`,className:`size-3`})})]}),(0,$.jsx)(`p`,{className:`mt-4 typography-ui-label font-medium text-foreground`,children:h}),(0,$.jsx)(`p`,{className:`mt-1.5 typography-ui leading-6 text-muted-foreground`,children:i(`assistants.contact.loadFailed`)}),(0,$.jsx)(I,{type:`button`,size:`sm`,variant:`ghost`,onClick:()=>void u.refetch(),children:i(`chat.history.retry`)})]}):rt?(0,$.jsxs)(`div`,{ref:Fe,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)(zt,{name:e.id,avatarSeed:e.avatarSeed,size:48,label:h,className:`opacity-90`,working:n?Oe: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:h})}),(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:Fe,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)(I,{type:`button`,size:`sm`,variant:`ghost`,disabled:u.isFetchingPreviousPage||u.isFillingMessageGap,onClick:()=>void Ne(),children:i(u.isFetchingPreviousPage||u.isFillingMessageGap?`chat.history.loadingMore`:u.previousPageError||u.hasMessageGap?`chat.history.retry`:`chat.history.loadOlder`)})]}):null,ge.map((t,r)=>{let a=`${X}:${Jn(t)}`,c=r>0?ge[r-1]:null,u=_e.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:Te(u)})}):null,m=t.role===`user`,_=t.role===`peer`,v=t.role===`assistant`&&!d&&c?.role===`assistant`&&c.turnID===t.turnID,y=c?.turnID!==t.turnID,b=!m&&(_||!v),x=_?g(t.fromAssistantID,t.fromAssistantName):h,S=_&&t.fromAssistantID?l.data?.assistants.find(e=>e.id===t.fromAssistantID):e,C=it.get(t.messageID),w=je.get(t.turnID),T=t.status===`failed`&&t.messageID.endsWith(`:preview:failed`),E=(e,t)=>m?(0,$.jsx)(pt,{failedTurn:n?C:void 0,retryDisabled:Ee,onRetry:tt,children:e},t):e;return t.status===`error`||T?(0,$.jsxs)(Q.Fragment,{children:[p,(0,$.jsxs)(`div`,{"data-message-id":t.messageID,"data-assistant-contact-error":``,className:F(`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||w?.error||i(`assistants.contact.sendFailed`)}),f?.messageID===t.messageID?(0,$.jsx)(Je,{assistantID:e.id,position:f},`${o}:${e.id}:${f.generation}:${f.ordinal}`):null]})]},a):(0,$.jsxs)(Q.Fragment,{children:[p,(0,$.jsxs)(We.div,{"data-message-id":t.messageID,initial:Se&&r>xe&&t.messageID!==He.current?{opacity:0,y:4}:!1,animate:{opacity:1,y:0},transition:{duration:ve?0:.18,ease:`easeOut`},className:F(`flex w-full`,m?`justify-end`:`justify-start`,d?`mt-0`:y?`mt-6 first:mt-0`:v?`mt-1.5`:`mt-3`),"data-assistant-contact-role":t.role,"data-assistant-contact-turn-status":C?.status??t.status,"data-assistant-contact-run-start":t.role===`assistant`&&!v?``:void 0,children:[m?null:(0,$.jsx)(`div`,{className:`mr-2.5 flex w-9 shrink-0 justify-center pt-0.5`,children:b?(0,$.jsx)(zt,{name:S?.id||t.fromAssistantID||e.id,avatarSeed:S?.avatarSeed??(t.fromAssistantID?void 0:e.avatarSeed),size:32,label:x,working:n?!!(S?.working||S?.activeContactTurn):void 0,showWorkingDot:!1,followPointer:!1}):(0,$.jsx)(`span`,{className:`size-8`,"aria-hidden":!0})}),(0,$.jsxs)(`div`,{className:F(`relative flex min-w-0 flex-col gap-1.5`,m?`max-w-[min(82%,30rem)] items-end`:`max-w-[min(84%,34rem)] items-start`),children:[_?(0,$.jsx)(`span`,{className:`mb-0.5 px-1 typography-micro text-muted-foreground/75`,children:i(`assistants.contact.peer.from`,{name:x})}):null,t.parts.map((r,o)=>{if(r.type===`card`&&r.cardType===`session`)return(0,$.jsx)(ln,{card:r},`${a}:card:${o}`);if(r.type===`card`&&r.cardType===`assistant`)return(0,$.jsx)(Yt,{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)(rn,{card:r,task:le.get(r.projectID)?.get(r.taskID)},`${a}:card:${o}`);if(r.type===`file`)return E((0,$.jsx)(dt,{assistantID:e.id,part:r,onShowPopup:te},`${a}:file:${o}`),`${a}:file:${o}`);if(r.type===`text`&&Kn(r.text))return null;if(r.type===`text`&&(r.text.trim()||t.status===`streaming`)){let e=!m,n=e&&/^!\[(?:\\.|[^\]\\\n])*\]\(\s*(?:<[^>\n]+>|[^\s()]+)(?:\s+"[^"\n]*")?\s*\)$/.test(r.text.trim());return E((0,$.jsx)(`div`,{"aria-label":_?i(`assistants.contact.peer.aria`,{name:x}):void 0,"data-assistant-contact-text":``,"data-assistant-contact-media":n||void 0,className:F(`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`:m?`rounded-[1.15rem] rounded-br-lg bg-[var(--primary-base)]/90 text-[var(--primary-foreground)]`:_?`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:te,className:`w-full min-w-0 [overflow-wrap:anywhere]`}):r.text},`${a}:text:${o}`),`${a}:text:${o}`)}return null}),C?.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)(Je,{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:!Ee&&Ke?.scope!==X&&(De||Oe)?(0,$.jsxs)(We.div,{role:`status`,"aria-label":i(`assistants.contact.processing`),initial:!ve&&{opacity:0,scale:.8},animate:{opacity:1,scale:1},transition:{duration:ve?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)(zt,{name:e.id,avatarSeed:e.avatarSeed,size:32,label:h,working:n?Oe: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:ze,className:`relative z-10 shrink-0 bg-background pt-1`,"data-assistant-contact-composer":``,children:[k?(0,$.jsx)(`div`,{className:`chat-input-column mb-2`,children:(0,$.jsx)(`p`,{role:`alert`,className:`typography-micro text-[var(--status-error)]`,children:k})}):null,(0,$.jsx)(`form`,{className:F(`relative w-full pt-1.5 pb-4`,s&&`bottom-safe-area yuri-mobile-composer`),onSubmit:e=>{e.preventDefault(),et()},onDragOver:Qe,onDrop:$e,children:(0,$.jsx)(`div`,{className:`chat-input-column relative overflow-visible`,children:(0,$.jsx)(at,{active:n,layout:`inline`,value:_,attachments:y,pending:Ee,isMobile:s,placeholder:i(`assistants.contact.placeholder`,{name:h}),sendLabel:i(`assistants.contact.send`),addFilesLabel:i(`assistants.contact.addFiles`),removeAttachmentLabel:i(`assistants.contact.removeAttachment`),fileAccept:`*/*`,onChange:e=>v(e),onVoiceSend:e=>{et(e)},onSubmit:()=>{et()},onAddFiles:e=>{Xe(e)},onRemoveAttachment:t=>{Ee||(S.current.delete(`${e.id}:${t}`),b(e=>e.filter(e=>e.id!==t)))},onPaste:Ze,onDragOver:Qe,onDrop:$e,className:F(`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:h})}},`${o}:${e.id}`)})})]}),j.open?(0,$.jsx)(Q.Suspense,{fallback:null,children:(0,$.jsx)(Gn,{popup:j,onOpenChange:ne,isMobile:s})}):null]})},Xn=e=>{for(let t=e.messages.length-1;t>=0;t--){let n=e.messages[t];if(n.parts.some(te)&&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}},Zn=(e,t)=>{let n=(0,Z.c)(5),r;n[0]!==e||n[1]!==t?(r=ne(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:Xn},n[3]=r,n[4]=i),w(i)},Qn=Q.memo(e=>{let t=(0,Z.c)(17),{assistantID:n,serverWorking:r,lastContactAt:i}=e,{t:a,locale:o}=P(),s=Rt(n,r),c=Zn(n,he()),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=pn(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{Rt as a,zt as i,Yn as n,Vt as r,Qn 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-DBn9yahL.js";import{c as i,i as a,t as o}from"./runtime-switch-DEZ1K7qW.js";import{t as s,v as c}from"./desktop-JwYqThiw.js";import{at as l,it as u}from"./vendor-base-ui-BQjbsJ43.js";import{n as d}from"./useUIStore-BbYD420L.js";import{n as f}from"./vendor-react-D5d-V1vN.js";import{n as p}from"./vendor-tanstack-react-query-C4SG3JZB.js";import{r as m}from"./vendor-sonner-r2EJnfoo.js";import{r as h}from"./vendor-reactuses-core-BcebBLwF.js";import{f as g,r as _,t as v}from"./button-DinGM3tu.js";import{i as y}from"./MobileShareBridge-C3Equ3P_.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-tbfsMfB-.js";import{i as D,r as O}from"./useAssistantUIStore-Bp6TxG5E.js";import{n as k}from"./Icon-t2xvbAyN.js";import{a as A,i as ee,n as te,o as ne,r as j,t as M}from"./dialog-BXssfGXA.js";import{r as re}from"./device-BjRYYXNT.js";import{E as ie}from"./sessionLookup-DRVy7LM1.js";import{a as ae,i as oe,n as se,t as ce}from"./AssistantContactStatus-CWq-PDz6.js";import{n as N,r as le}from"./AssistantUnreadBadge-DdJyySwn.js";import{a as P,i as ue,n as de,r as F,t as I}from"./context-menu-DpbkRkk1.js";var L=t(l(),1),R=f(),fe=()=>s()&&!r(),pe=async e=>{if(!fe())throw Error(`Assistant Mini Chat requires a direct desktop connection`);await c(`desktop_open_assistant_mini_chat_window`,{assistantID:e,apiBaseUrl:o(),clientToken:n()})},z=u();function B(e){let t=(0,R.c)(41),{assistant:n,trigger:r,onEdit:i,onDelete:o}=e,{t:s}=g(),c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=a(),t[0]=c):c=t[0];let l;t[1]===n.id?l=t[2]:(l=[c,`assistants`,n.id,`pin`],t[1]=n.id,t[2]=l);let u;t[3]===n?u=t[4]:(u=()=>C(n,{pinned:n.pinnedAt==null}),t[3]=n,t[4]=u);let d;t[5]===s?d=t[6]:(d=()=>m.error(s(`assistants.menu.pinError`)),t[5]=s,t[6]=d);let f;t[7]!==l||t[8]!==u||t[9]!==d?(f={mutationKey:l,mutationFn:u,onError:d},t[7]=l,t[8]=u,t[9]=d,t[10]=f):f=t[10];let h=p(f),_;t[11]===r?_=t[12]:(_=(0,z.jsx)(P,{render:r}),t[11]=r,t[12]=_);let v;t[13]!==n.pinnedAt||t[14]!==h||t[15]!==s?(v=n.pinnedAt===void 0?null:(0,z.jsxs)(F,{disabled:h.isPending,onClick:()=>h.mutate(),children:[(0,z.jsx)(k,{name:n.pinnedAt==null?`pushpin-2`:`unpin`,className:`size-4`}),s(n.pinnedAt==null?`assistants.menu.pin`:`assistants.menu.unpin`)]}),t[13]=n.pinnedAt,t[14]=h,t[15]=s,t[16]=v):v=t[16];let y;t[17]!==n.id||t[18]!==s?(y=fe()?(0,z.jsxs)(F,{onClick:()=>{pe(n.id).catch(()=>m.error(s(`miniChat.actions.failed`)))},children:[(0,z.jsx)(k,{name:`external-link`,className:`size-4`}),s(`sessions.sidebar.session.menu.openMiniChatWindow`)]}):null,t[17]=n.id,t[18]=s,t[19]=y):y=t[19];let b;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,z.jsx)(k,{name:`edit`,className:`size-4`}),t[20]=b):b=t[20];let x;t[21]===s?x=t[22]:(x=s(`assistants.menu.edit`),t[21]=s,t[22]=x);let S;t[23]!==i||t[24]!==x?(S=(0,z.jsxs)(F,{onClick:i,children:[b,x]}),t[23]=i,t[24]=x,t[25]=S):S=t[25];let w;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,z.jsx)(ue,{}),t[26]=w):w=t[26];let T;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,z.jsx)(k,{name:`delete-bin`,className:`size-4`}),t[27]=T):T=t[27];let E;t[28]===s?E=t[29]:(E=s(`assistants.settings.delete`),t[28]=s,t[29]=E);let D;t[30]!==o||t[31]!==E?(D=(0,z.jsxs)(F,{onClick:o,className:`text-[var(--status-error)] focus:text-[var(--status-error)] data-[highlighted]:text-[var(--status-error)] [&_svg]:text-[var(--status-error)]`,children:[T,E]}),t[30]=o,t[31]=E,t[32]=D):D=t[32];let O;t[33]!==S||t[34]!==D||t[35]!==v||t[36]!==y?(O=(0,z.jsxs)(de,{className:`min-w-[10rem]`,children:[v,y,S,w,D]}),t[33]=S,t[34]=D,t[35]=v,t[36]=y,t[37]=O):O=t[37];let A;return t[38]!==O||t[39]!==_?(A=(0,z.jsxs)(I,{children:[_,O]}),t[38]=O,t[39]=_,t[40]=A):A=t[40],A}function V(e){let t=(0,R.c)(38),{assistant:n,selected:r,onSelect:i,onEdit:a,onDelete:o}=e,s=L.useRef(null),c=ae(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`,g;t[11]===h?g=t[12]:(g=_(`flex w-full min-w-0 max-w-32 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]=g);let v;t[13]!==n.avatarSeed||t[14]!==n.id||t[15]!==u||t[16]!==c?(v=(0,z.jsx)(oe,{name:n.id,avatarSeed:n.avatarSeed,size:76,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,z.jsx)(N,{count:b,className:`absolute -right-1 -top-1`}),t[18]=b,t[19]=x);let S;t[20]!==x||t[21]!==v?(S=(0,z.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,z.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]!==g?(w=(0,z.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:g,children:[S,C]}),t[25]=n.id,t[26]=u,t[27]=r,t[28]=S,t[29]=C,t[30]=m,t[31]=g,t[32]=w):w=t[32];let T;return t[33]!==n||t[34]!==w||t[35]!==d||t[36]!==f?(T=(0,z.jsx)(B,{assistant:n,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 me(e){let t=(0,R.c)(16),{contacts:n,selectedAssistantID:r,onSelect:i,onEdit:a,onDelete:o}=e,{t:s}=g();if(n.length===0)return null;let c;t[0]===s?c=t[1]:(c=s(`assistants.list.pinned`),t[0]=s,t[1]=c);let l;if(t[2]!==n||t[3]!==o||t[4]!==a||t[5]!==i||t[6]!==r){let e;t[8]!==o||t[9]!==a||t[10]!==i||t[11]!==r?(e=e=>(0,z.jsx)(V,{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,z.jsx)(`div`,{role:`group`,"aria-label":c,className:`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 he({snapshot:e,rowClassName:t,compact:n=!1,mobile:r=!1}){let{t:i}=g(),[a,o]=L.useState(!1),s=L.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,z.jsx)(`div`,{className:t,style:n&&!l?{visibility:`hidden`}:void 0,children:(0,z.jsx)(v,{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,z.jsx)(k,{name:`check-double`,className:r?`size-5`:`size-4`})})})}async function H(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 ge({assistant:e,open:t,onOpenChange:n,onDeleted:r}){let{t:i}=g(),[a,o]=L.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 H(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,z.jsx)(M,{open:t&&e!==null,onOpenChange:c,children:(0,z.jsxs)(te,{className:`max-w-md`,children:[(0,z.jsxs)(A,{children:[(0,z.jsx)(ne,{children:i(`assistants.settings.delete`)}),(0,z.jsx)(j,{children:i(`assistants.settings.deleteConfirm`,{name:s})})]}),(0,z.jsxs)(ee,{children:[(0,z.jsx)(v,{size:`sm`,variant:`ghost`,onClick:l,disabled:a,children:i(`settings.common.actions.cancel`)}),(0,z.jsx)(v,{size:`sm`,variant:`destructive`,onClick:u,disabled:a,children:i(`settings.common.actions.delete`)})]})]})})}var U=`block min-w-0 max-w-full truncate typography-micro text-muted-foreground`,W={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?W[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,R.c)(21),{assistant:n,onBack:r,onOpenSettings:i}=e,{t:a}=g(),o=ie(),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,z.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-2.5`,children:[(0,z.jsx)(oe,{name:n.id,avatarSeed:n.avatarSeed,size:40,label:l,working:!!(n.working||n.activeContactTurn),showWorkingDot:!1}),(0,z.jsxs)(`span`,{className:`min-w-0`,children:[(0,z.jsx)(`span`,{className:`block truncate font-medium leading-5 tracking-[-0.01em]`,children:l||a(`assistants.title`)}),(0,z.jsx)(ce,{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 _;return t[16]!==r||t[17]!==f||t[18]!==p||t[19]!==m?(_=(0,z.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]=_):_=t[20],_},xe=e=>{let t=(0,R.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=ae(o,f!==void 0&&f),m=L.useRef(null),g;t[0]===l?g=t[1]:(g=()=>l(),t[0]=l,t[1]=g);let v=h(g),y=c?`border-border/50 bg-[var(--surface-elevated)]`:`border-transparent hover:bg-interactive-hover`,b;t[2]===y?b=t[3]:(b=_(`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,z.jsx)(oe,{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=_(`block truncate typography-ui-label leading-5`,S),t[9]=S,t[10]=C);let w;t[11]!==s||t[12]!==C?(w=(0,z.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=_(U,`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,z.jsx)(`span`,{className:T,children:a}),t[15]=a,t[16]=E);let D;t[17]!==E||t[18]!==w?(D=(0,z.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,z.jsx)(N,{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,z.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,z.jsx)(B,{assistant:n,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,R.c)(117),{activeOverride:n,onMobileBack:r,onMobileOpenSettings:o}=e,{t:s}=g(),{isMobile:c}=re(),l=ie(),u=L.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 ee;t[2]===A?ee=t[3]:(ee=le(A),t[2]=A,t[3]=ee);let te=ee,ne;t[4]===u?ne=t[5]:(ne=e=>e.assistantByTransport[u]??null,t[4]=u,t[5]=ne);let j=D(ne),M=D(we),ae=D(Te),N;t[6]!==j||t[7]!==T?.assistants?(N=T?.assistants.find(e=>e.id===j)??null,t[6]=j,t[7]=T?.assistants,t[8]=N):N=t[8];let P=N,ue;t[9]!==M||t[10]!==j||t[11]!==T?(ue=()=>{!j&&T?.assistants[0]&&M(T.assistants[0].id)},t[9]=M,t[10]=j,t[11]=T,t[12]=ue):ue=t[12];let de=T?.assistants,F;t[13]!==M||t[14]!==j||t[15]!==de?(F=[M,j,de],t[13]=M,t[14]=j,t[15]=de,t[16]=F):F=t[16],L.useEffect(ue,F);let I;t[17]!==P||t[18]!==M||t[19]!==j||t[20]!==T?.assistants||t[21]!==w.isSuccess?(I=()=>{w.isSuccess&&j&&!P&&M(T?.assistants[0]?.id??null)},t[17]=P,t[18]=M,t[19]=j,t[20]=T?.assistants,t[21]=w.isSuccess,t[22]=I):I=t[22];let B=T?.assistants,V;t[23]!==P||t[24]!==M||t[25]!==j||t[26]!==w.isSuccess||t[27]!==B?(V=[P,M,j,B,w.isSuccess],t[23]=P,t[24]=M,t[25]=j,t[26]=w.isSuccess,t[27]=B,t[28]=V):V=t[28],L.useEffect(I,V);let H;t[29]!==l||t[30]!==ae?(H=()=>{if(ae(),l){l.openSettings();return}let e=d.getState();e.setSettingsPage(`assistants`),e.setSettingsDialogOpen(!0)},t[29]=l,t[30]=ae,t[31]=H):H=t[31];let U=h(H),W;t[32]===l?W=t[33]:(W=e=>{O(e,l?{openMobileSettings:l.openSettings}:void 0)},t[32]=l,t[33]=W);let ye=h(W),G;t[34]!==P||t[35]!==l?(G=()=>{P&&O(P.id,l?{openMobileSettings:l.openSettings}:void 0)},t[34]=P,t[35]=l,t[36]=G):G=t[36];let De=h(G),[Oe,ke]=L.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:!!P}),Le;t[42]!==P||t[43]!==K||t[44]!==S||t[45]!==o?(Le=(e,t,n,r)=>(0,z.jsxs)(`div`,{className:`relative flex h-full min-h-0 flex-col`,children:[S?(0,z.jsx)(be,{assistant:P,onBack:K,onOpenSettings:o}):null,(0,z.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,z.jsx)(k,{name:e,className:`size-6 text-muted-foreground`}),(0,z.jsx)(`h1`,{className:`mt-4 typography-ui-header font-semibold`,children:t}),n?(0,z.jsx)(`p`,{className:`mt-2 max-w-md typography-ui text-muted-foreground`,children:n}):null,r?(0,z.jsx)(`div`,{className:`mt-5`,children:r}):null]})]}),t[42]=P,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]!==P||t[48]!==K||t[49]!==S||t[50]!==o?(e=S?(0,z.jsx)(be,{assistant:P,onBack:K,onOpenSettings:o}):null,t[47]=P,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,z.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,z.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,z.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]!==U||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]!==U||t[70]!==i?(a=(0,z.jsx)(v,{onClick:U,children:i}),t[69]=U,t[70]=i,t[71]=a):a=t[71],e=q(`ai-agent`,n,r,a),t[63]=U,t[64]=q,t[65]=s,t[66]=e}else e=t[66];return e}if(!T||!P){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]===P.name?Re=t[76]:(Re=y(P.name),t[75]=P.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]!==te||t[81]!==S||t[82]!==U||t[83]!==ye||t[84]!==je||t[85]!==M||t[86]!==j||t[87]!==T||t[88]!==s?(J=S?null:(0,z.jsxs)(`section`,{className:`flex h-full min-h-0 w-[clamp(16rem,22vw,20rem)] shrink-0 flex-col overflow-hidden`,children:[(0,z.jsxs)(`header`,{className:`flex shrink-0 items-center gap-3 px-4 pb-1 pt-4 sm:px-5`,children:[(0,z.jsx)(`h1`,{className:`min-w-0 truncate typography-ui-label font-semibold text-foreground`,children:s(`assistants.title`)}),(0,z.jsx)(he,{snapshot:T,compact:!0,rowClassName:`flex min-w-0 flex-1 justify-end`}),(0,z.jsx)(v,{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:U,children:(0,z.jsx)(k,{name:`add`,className:`size-4`})})]}),(0,z.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,z.jsx)(me,{contacts:te.pinned,selectedAssistantID:j,onSelect:M,onEdit:ye,onDelete:je}),(0,z.jsx)(`div`,{className:`flex flex-col gap-1 pt-1`,children:te.unpinned.map(e=>{let t=e.id===j,n=y(e.name);return(0,z.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:()=>M(e.id),onEdit:()=>ye(e.id),onDelete:()=>je(e)},e.id)})})]})]}),t[80]=te,t[81]=S,t[82]=U,t[83]=ye,t[84]=je,t[85]=M,t[86]=j,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,z.jsx)(ge,{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=_(`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]!==P||t[97]!==K||t[98]!==S||t[99]!==o||t[100]!==De||t[101]!==ze||t[102]!==s?(Z=S?(0,z.jsx)(be,{assistant:P,onBack:K,onOpenSettings:o}):(0,z.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,z.jsx)(oe,{name:P.id,avatarSeed:P.avatarSeed,size:40,label:ze.displayName||P.name,working:!!(P.working||P.activeContactTurn),showWorkingDot:!1}),(0,z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,z.jsx)(`div`,{className:`truncate typography-ui-label font-semibold leading-5 tracking-[-0.01em] text-foreground`,children:ze.displayName}),(0,z.jsx)(ce,{assistantID:P.id,serverWorking:!!(P.working||P.activeContactTurn),lastContactAt:P.latestMessagePreview?.createdAt})]}),fe()?(0,z.jsx)(v,{type:`button`,variant:`ghost`,size:`icon`,onClick:()=>{pe(P.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,z.jsx)(k,{name:`external-link`,className:`size-4`})}):null,(0,z.jsx)(v,{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,z.jsx)(k,{name:`settings-3`,className:`size-4`})})]}),t[96]=P,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]!==P||t[106]!==S||t[107]!==Ve?(Q=(0,z.jsx)(se,{assistant:P,warning:Ve,active:p,overlayHeader:S}),t[104]=p,t[105]=P,t[106]=S,t[107]=Ve,t[108]=Q):Q=t[108];let $;t[109]!==X||t[110]!==Z||t[111]!==Q?($=(0,z.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,z.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{ge as a,B as c,_e as i,ye as n,he as o,U as r,me as s,G as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"./rolldown-runtime-hePW80VL.js";import{F as e,I as t,L as n,O as r,R as i,a,at as o,i as s,it as c}from"./vendor-base-ui-BQjbsJ43.js";import{n as l}from"./vendor-react-D5d-V1vN.js";import{r as u}from"./button-DinGM3tu.js";import{d,f,u as p}from"./scheduledTaskNavigation-Bsrhv3Ow.js";var m=l();o();var h=c();function g(e){let t=(0,m.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,h.jsx)(a,{...n}),t[2]=n,t[3]=r),r}function _(e){let t=(0,m.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,h.jsx)(s,{...n}),t[2]=n,t[3]=r),r}function v(r){let i=(0,m.c)(20),a,o,s,c,l;i[0]===r?(a=i[1],o=i[2],s=i[3],c=i[4],l=i[5]):({className:o,positionerClassName:s,children:a,style:l,...c}=r,i[0]=r,i[1]=a,i[2]=o,i[3]=s,i[4]=c,i[5]=l);let f;i[6]===s?f=i[7]:(f=u(`app-region-no-drag z-50`,s),i[6]=s,i[7]=f);let p;i[8]===l?p=i[9]:(p={color:`var(--surface-elevated-foreground)`,...l},i[8]=l,i[9]=p);let g;i[10]===o?g=i[11]:(g=u(d,o),i[10]=o,i[11]=g);let _;i[12]!==a||i[13]!==c||i[14]!==p||i[15]!==g?(_=(0,h.jsx)(n,{"data-slot":`dropdown-menu-content`,style:p,className:g,...c,children:a}),i[12]=a,i[13]=c,i[14]=p,i[15]=g,i[16]=_):_=i[16];let v;return i[17]!==f||i[18]!==_?(v=(0,h.jsx)(t,{children:(0,h.jsx)(e,{className:f,children:_})}),i[17]=f,i[18]=_,i[19]=v):v=i[19],v}function y(e){let t=(0,m.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let a;t[3]===n?a=t[4]:(a=u(p,n),t[3]=n,t[4]=a);let o;return t[5]!==r||t[6]!==a?(o=(0,h.jsx)(i,{className:a,...r}),t[5]=r,t[6]=a,t[7]=o):o=t[7],o}function b(e){let t=(0,m.c)(8),n,i;t[0]===e?(n=t[1],i=t[2]):({className:n,...i}=e,t[0]=e,t[1]=n,t[2]=i);let a;t[3]===n?a=t[4]:(a=u(f,n),t[3]=n,t[4]=a);let o;return t[5]!==i||t[6]!==a?(o=(0,h.jsx)(r,{className:a,...i}),t[5]=i,t[6]=a,t[7]=o):o=t[7],o}export{_ as a,b as i,v as n,y as r,g as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{A as e,C as t,E as n,F as r,I as i,M as a,P as o,S as s,T as c,_ as l,a as u,b as d,g as f,h as p,i as m,k as h,n as g,o as _,r as v,t as y,v as ee,x as b}from"./vendor-opencode-client-UL_TecvQ.js";import{i as te}from"./vendor-tanstack-query-core-BWz0ose6.js";import{n as ne,r as re}from"./fileQueries-5a1jkme2.js";import{o as ie}from"./path-utils-jGozTg9d.js";import{a as ae,n as oe}from"./vendor-aparajita-capacitor-secure-storage-xol_6BsB.js";import{n as se}from"./pathNormalization-ewtPqJWn.js";import{n as ce}from"./platform-DFJEtBlo.js";import{t as x}from"./native-errors-06if6eu-.js";import{i as le,o as ue}from"./fileReferenceParser-1HHDBUum.js";import{n as de,t as fe}from"./vendor-solid-js-0T254UHG.js";import{a as pe,c as me,d as he,f as ge,g as S,h as C,i as _e,l as w,m as ve,n as ye,o as T,p as E,r as D,s as O,t as k,u as A}from"./vendor-opencode-plugin-CgKz9Hcy.js";import{Et as j,mt as M,pt as N,y as P}from"./vendor-effect-DV9F8PTZ.js";var F={"@opencode/plugin/gui":T,"@opencode/plugin/gui/main":T,"@opencode/plugin/gui/file":pe,"@opencode/plugin/gui/review":_e,"@opencode/plugin/gui/browser":D,"@opencode/plugin/rpc":k,"@opencode/schema/rpc":ye,"@opencode/client":i,"@opencode/client/effect":g,"@opencode/client/solid":y,effect:P,"solid-js":a,"solid-js/web":de,"solid-js/store":u},be=new Set(`assert assert/strict async_hooks buffer child_process cluster console constants crypto dgram diagnostics_channel dns dns/promises domain events fs fs/promises http http2 https inspector inspector/promises module net os path path/posix path/win32 perf_hooks process punycode querystring readline readline/promises repl stream stream/consumers stream/promises stream/web string_decoder sys timers timers/promises tls trace_events tty url util util/types v8 vm wasi worker_threads zlib`.split(` `));function xe(){let e=new Proxy(function(){},{get:(t,n)=>n===`then`?void 0:n===Symbol.hasInstance?()=>!1:n===Symbol.toPrimitive||n===`toString`?()=>`[main-only module]`:e,apply:()=>e,construct:()=>e,set:()=>!0});return e}function Se(e,t){if(e.length>16777216)throw Error(`GUI bundle exceeds 16 MiB`);let n={exports:{}};Function(`require`,`module`,`exports`,e)(e=>{if(Object.hasOwn(F,e))return F[e];if(e===`electron`||e.startsWith(`node:`)||be.has(e))return xe();throw Error(`Unsupported GUI shared module: ${e}`)},n,n.exports);let r=n.exports,i=r&&typeof r==`object`&&`default`in r?r.default:r;if(!i||typeof i!=`object`)throw Error(`GUI bundle must default-export Plugin.define`);if((!(`setup`in i)||typeof i.setup!=`function`)&&!(t&&`main`in i&&typeof i.main==`function`))throw new x(`GUI_PLUGIN_UNSUPPORTED`,`This host requires a window setup; main-only plugins are unsupported`);if(`os`in i&&i.os!==void 0){if(!t)throw new x(`GUI_PLUGIN_UNSUPPORTED`,`OS-restricted plugins require the native GUI host`);if(!Array.isArray(i.os)||!i.os.includes(t))throw new x(`GUI_PLUGIN_UNSUPPORTED`,`GUI plugin is unavailable on this OS`)}if(`main`in i&&i.main!==void 0&&typeof i.main!=`function`)throw Error(`Invalid GUI main entry`);if(`stores`in i&&i.stores!==void 0){if(!i.stores||typeof i.stores!=`object`||Array.isArray(i.stores))throw Error(`Invalid GUI stores`);for(let e of Object.values(i.stores))if(!e||typeof e!=`object`||!(`schema`in e)||!j(e.schema)||!(`scope`in e)||![`global`,`session`].includes(String(e.scope))||!(`initial`in e))throw Error(`Invalid GUI store declaration`)}if(`i18n`in i&&i.i18n!==void 0){if(!i.i18n||typeof i.i18n!=`object`||Array.isArray(i.i18n))throw Error(`Invalid GUI locale catalog`);for(let e of Object.values(i.i18n))if(!e||typeof e!=`object`||Array.isArray(e)||Object.values(e).some(e=>typeof e!=`string`))throw Error(`GUI locales must be inline string dictionaries`)}return i}function I(e){let t=e;if(/^file:/i.test(t)){let e=new URL(t);t=`${e.hostname&&e.hostname!==`localhost`?`//${e.hostname}`:``}${decodeURIComponent(e.pathname)}`,/^\/[a-z]:\//i.test(t)&&(t=t.slice(1))}let n=se(t)??``;return n===`.`?``:n}var L=e=>/^(?:\/|[a-z]:\/)/i.test(e),R=()=>{throw Error(`Unsupported GUI file API: tree`)},z=class extends Error{},B=e=>new TextEncoder().encode(e).byteLength,Ce=class{files;query;transport;root;api;ended=!1;states=new Map;inflight=new Map;watches=new Map;apiLeases=new Map;registeredOwners=new WeakSet;endedOwners=new WeakSet;leaseCount=0;rerun=new Set;selections=new Map;scrolls=new Map;subscriptions=new Map;constructor(e,t,r,i){this.files=e,this.query=t,this.transport=r,this.root=i,this.root=I(i),this.api={root:this.root,ready:()=>!this.ended,resolve:e=>this.resolve(e),absolute:L,get:e=>{let t=this.track(e,`file`);return this.states.get(t)},missing:e=>{let t=this.track(e,`missing`);return this.states.get(t)?.notFound===!0},sync:(e,t)=>{let r=n();return this.ended||r&&this.endedOwners.has(r)?Promise.resolve():(this.acquireApiLease(e),this.sync(e,t?.force))},unwatch:e=>this.releaseApiLease(n(),this.resolve(e)),exists:async e=>{try{if(this.files.statFile)return(await this.query.fetchQuery(this.statOptions(e))).isFile;let t=this.full(e);return(await this.files.listDirectory(t.slice(0,t.lastIndexOf(`/`)))).entries.some(e=>!e.isDirectory&&I(e.path)===t)}catch{return!1}},search:async(e,t)=>{if(t?.kind===`any`)throw Error(`Unsupported GUI file search: directories`);t?.signal?.throwIfAborted();let n=await this.query.fetchQuery({queryKey:[`gui-plugin-files`,r,this.root,`search`,e,t?.limit],gcTime:3e4,queryFn:async({signal:n})=>(n.throwIfAborted(),this.files.search({directory:this.root,query:e,maxResults:t?.limit??100}))});if(t?.signal?.throwIfAborted(),this.ended)throw new DOMException(`GUI file model was disposed`,`AbortError`);return n.map(e=>this.resolve(e.path))},selection:{get:e=>this.selections.get(this.track(e,`selection`)),set:(e,t)=>{let n=this.resolve(e),r=this.selections.get(n);r===t||r&&t&&r.start===t.start&&r.end===t.end&&r.side===t.side&&r.endSide===t.endSide||(this.selections.set(n,t),this.trim(this.selections,`selection`),this.changed(n,`selection`))}},scroll:{get:e=>this.scrolls.get(this.track(e,`scroll`))??{},set:(e,t)=>{let n=this.resolve(e),r=this.scrolls.get(n),i={...r,...t};(r?.top!==i.top||r?.left!==i.left)&&(this.scrolls.set(n,i),this.trim(this.scrolls,`scroll`),this.changed(n,`scroll`))}},tree:{list:R,state:R,sync:R,expand:R,collapse:R}}}resolve(e){let t=I(e);if(!L(t))return t;if(t===this.root)return``;let n=this.root.endsWith(`/`)?this.root:`${this.root}/`;return t.startsWith(n)?t.slice(n.length):t}full(e){let t=this.resolve(e);return L(t)?t:I(`${this.root}/${t}`)}input(e){return{scopeDirectory:this.root,path:this.full(e),options:{directory:this.root}}}statOptions(e){return{...re(this.files,this.input(e),this.transport),gcTime:3e4}}track(n,r){let i=this.resolve(n),a=c();if(!a||this.ended)return i;let o=`${r}:${i}`,s=this.subscriptions.get(o);s||(s={revision:t(0),listeners:new Set},this.subscriptions.set(o,s));let l=s;return l.listeners.has(a)||(l.listeners.add(a),e(a,()=>h(()=>{l.listeners.delete(a),!l.listeners.size&&this.subscriptions.get(o)===l&&this.subscriptions.delete(o)}))),l.revision[0](),i}changed(e,t){this.ended||this.subscriptions.get(`${t}:${e}`)?.revision[1](e=>e+1)}trim(e,t){for(;e.size>64;){let n=e.keys().next().value;e.delete(n),this.changed(n,t)}}setState(e,t){let n=this.states.get(e);n?.content?.content===t.content?.content&&n?.content?.type===t.content?.type&&(t.content=n?.content),!(n&&n.loaded===t.loaded&&n.loading===t.loading&&n.error===t.error&&n.notFound===t.notFound&&n.content===t.content)&&(this.states.set(e,t),p(()=>{this.changed(e,`file`),n?.notFound===!0!=(t.notFound===!0)&&this.changed(e,`missing`)}))}acquireApiLease(e){let t=n();if(this.ended||t&&this.endedOwners.has(t)||!this.files.statFile)return;let r=this.resolve(e),i=this.apiLeases.get(t);if(i?.has(r))return;if(this.leaseCount>=256)throw Error(`GUI file consumer limit exceeded`);let a=this.watch(r);i||(i=new Map,this.apiLeases.set(t,i)),i.set(r,a),this.leaseCount++,t&&!this.registeredOwners.has(t)&&(this.registeredOwners.add(t),h(()=>{`fn`in t||this.endedOwners.add(t),this.registeredOwners.delete(t);for(let e of[...this.apiLeases.get(t)?.keys()??[]])this.releaseApiLease(t,e)}))}releaseApiLease(e,t){let n=this.apiLeases.get(e),r=n?.get(t);r&&(n.delete(t),this.leaseCount--,n.size||this.apiLeases.delete(e),r())}reserve(e){if(!this.states.has(e)){if(this.states.size>=64){let e=[...this.states.keys()].find(e=>!this.watches.has(e)&&!this.inflight.has(e));if(!e)throw Error(`GUI file cache limit exceeded`);let t=this.states.get(e)?.notFound===!0;this.states.delete(e),p(()=>{this.changed(e,`file`),t&&this.changed(e,`missing`)})}this.states.set(e,{path:e,name:e.split(`/`).at(-1)??e})}}async sync(e,t=!1){if(this.ended)return;let n=this.resolve(e);if(this.inflight.has(n))return t&&this.rerun.add(n),this.inflight.get(n);if(!t&&this.states.get(n)?.loaded&&!this.states.get(n)?.error)return;this.reserve(n);let r=this.states.get(n);this.setState(n,{...r,path:n,name:n.split(`/`).at(-1)??n,loading:!r?.loaded&&!this.watches.get(n)?.failed});let i=(async()=>{try{do{this.rerun.delete(n);let e=this.watches.get(n),r=e?.epoch;try{let i=ne(this.files,this.input(n),this.transport),a=await this.query.fetchQuery({...i,gcTime:3e4,staleTime:t?0:3e4,queryFn:async()=>{if(!this.files.readFile)throw Error(`File content reads are unavailable in this runtime`);let e=await this.files.readFile(this.full(n),{directory:this.root});if(e.exists===!1)throw new z(`File does not exist`);let t=e.content;if(B(t)>131072)throw Error(`GUI file preview exceeds 128 KiB`);return t}});if(this.ended)return;if(B(a)>131072)throw Error(`GUI file preview exceeds 128 KiB`);(!e||e.epoch===r&&!e.failed)&&this.setState(n,{path:n,name:n.split(`/`).at(-1)??n,loaded:!0,loading:!1,content:{type:`text`,content:a}})}catch(t){if(this.ended)return;if((!e||e.epoch===r&&!e.failed)&&this.setState(n,{...this.states.get(n),loading:!1,...t instanceof z?{notFound:!0}:{},error:String(t)}),!this.rerun.has(n))throw t}t=!0}while(!this.ended&&this.rerun.has(n))}finally{this.inflight.delete(n),this.rerun.delete(n)}})();return this.inflight.set(n,i),i}watch(e){if(this.ended||!this.files.statFile)return()=>{};let t=this.resolve(e),n=this.watches.get(t);if(!n){if(this.watches.size>=64)throw Error(`GUI file watch limit exceeded`);this.reserve(t),n={count:0,epoch:0,failed:!1,stop:()=>{}};let e=n;this.watches.set(t,e);let r,i=new te(this.query,{...this.statOptions(t),refetchInterval:2e3,refetchIntervalInBackground:!1}),a=i.subscribe(n=>{if(this.ended||this.watches.get(t)!==e||n.isFetching)return;if(n.isError||n.isSuccess&&!n.data.isFile){e.failed=!0,e.epoch++,this.setState(t,{...this.states.get(t),loading:!1,notFound:n.isSuccess?!0:this.states.get(t)?.notFound,error:n.isError?String(n.error):`File does not exist`});return}if(!n.data||!n.isSuccess)return;let i=`${n.data.size}:${n.data.mtimeMs??``}`,a=e.failed||r!==void 0&&i!==r;e.failed=!1,r=i,a&&(e.epoch++,this.sync(t,!0).catch(()=>{}))});e.stop=()=>{a(),i.destroy()},this.states.get(t)?.loaded&&this.sync(t,!0).catch(()=>{})}n.count++;let r=!0;return()=>{r&&(r=!1,--n.count===0&&this.watches.get(t)===n&&this.stopWatch(t))}}stopWatch(e){this.watches.get(e)?.stop(),this.watches.delete(e)}dispose(){this.ended=!0;for(let e of this.watches.values())e.stop();this.watches.clear(),this.apiLeases.clear(),this.leaseCount=0,this.rerun.clear(),this.states.clear(),this.inflight.clear(),this.selections.clear(),this.scrolls.clear(),this.subscriptions.clear()}},V=256,H=2097152,U=e=>structuredClone(_(e)),we=class{backend;transport;memory=new Map;resets=new Map;constructor(e,t){this.backend=e,this.transport=t}forPlugin(e,n){let r=(t,n=`global`)=>{if(typeof n==`object`&&`session`in n&&!n.session.location)throw Error(`Unsupported GUI storage: session location is unknown`);let r=n===`global`?n:`session`in n?[n.session.server.id,n.session.id,n.session.location]:[n.server,n.directory];return`yuri.gui-plugin.${JSON.stringify([this.transport,e,r,t])}`},i=e=>{if(n.aborted)throw Error(`GUI plugin has been disposed`);if(e!==void 0)throw Error(`Unsupported GUI storage migration: from`)},a=new Map;return{store:(e,o)=>{i(o.from);let s=r(e,o.scope),c=a.get(s);if(c)return c;if(a.size>=V)throw Error(`GUI plugin store limit exceeded`);let l=N(o.schema),u=M(o.schema),d=l(u(U(o.initial)));if(JSON.stringify(u(d)).length>H)throw Error(`GUI plugin store exceeds 2 MiB`);let f=d,p=this.backend.getItem(s);if(p!==null&&p.length<=H)try{f=l(JSON.parse(p))}catch{f=d}let[m,h]=t(f),g=e=>{i();let t=JSON.stringify(u(U(e)));if(t.length>H)throw Error(`GUI plugin store exceeds 2 MiB`);let n=l(JSON.parse(t));this.backend.setItem(s,t),h(()=>n)},_={get value(){return m()},ready:()=>!0,set:g,update:e=>{let t=U(m());if(e(t)!==void 0)throw Error(`Store update must not return a replacement`);g(t)}},v=()=>h(()=>U(d)),y=this.resets.get(s)??new Set;return y.add(v),this.resets.set(s,y),n.addEventListener(`abort`,()=>{y.delete(v),y.size||this.resets.delete(s),a.clear()},{once:!0}),a.set(s,_),_},memory:(e,t)=>{i();let n=r(e),a=this.memory.get(n);if(a)return[a[0],e=>{i(),a[1](e)}];if(this.memory.size>=V)throw Error(`GUI plugin memory store limit exceeded`);if(JSON.stringify(t.initial).length>H)throw Error(`GUI plugin memory exceeds 2 MiB`);let[o,s]=v(U(t.initial)),c=[o,e=>{i();let t=U(_(o));if(e(t)!==void 0)throw Error(`Memory update must not return a replacement`);if(JSON.stringify(t).length>H)throw Error(`GUI plugin memory exceeds 2 MiB`);s(m(t))}];return this.memory.set(n,[o,e=>{let t=U(_(o));if(e(t)!==void 0)throw Error(`Memory update must not return a replacement`);if(JSON.stringify(t).length>H)throw Error(`GUI plugin memory exceeds 2 MiB`);s(m(t))}]),c},remove:(e,t)=>{i(t?.from);let n=r(e,t?.scope);this.backend.removeItem(n);for(let e of this.resets.get(n)??[])e()}}}dispose(){this.memory.clear(),this.resets.clear()}},Te=`yuri.file-icon`,W=`http://www.w3.org/2000/svg`,Ee=new Set([`svg`,`g`,`path`,`rect`,`circle`,`ellipse`,`line`,`polyline`,`polygon`,`defs`,`linearGradient`,`radialGradient`,`stop`,`clipPath`,`mask`,`use`,`title`,`desc`]),G=e=>e.trim().replace(/^\./,``).toLowerCase();function K(e,t){if(typeof e!=`string`)throw Error(`GUI file icon requires SVG text`);let n=t.get(e);if(n)return n;if(e.length>16384)throw Error(`GUI file icon SVG exceeds 16 KiB`);let r=new TextEncoder().encode(e).byteLength;if(r>16384)throw Error(`GUI file icon SVG exceeds 16 KiB`);if(!/^\s*<svg[\s>]/.test(e)||/<!|<\?/.test(e))throw Error(`Invalid GUI file icon SVG`);let i=new DOMParser().parseFromString(e,`image/svg+xml`),a=i.documentElement;if(a?.localName!==`svg`||a.namespaceURI!==W||i.querySelector(`parsererror`))throw Error(`Invalid GUI file icon SVG`);for(let e of[a,...a.querySelectorAll(`*`)]){if(e.namespaceURI!==W||!Ee.has(e.localName))throw Error(`Unsupported GUI file icon SVG element`);for(let t of e.attributes){let e=t.name.toLowerCase(),n=t.value.trim();if(e.startsWith(`on`)||e===`style`||e===`xml:base`||n.includes(`\\`)||Array.from(n).some(e=>e.charCodeAt(0)<32)||(e===`href`||e.endsWith(`:href`))&&!/^#[\w.-]+$/.test(n)||/url\s*\(/i.test(n)&&!/^url\(\s*#[\w.-]+\s*\)$/.test(n))throw Error(`Unsupported GUI file icon SVG reference or attribute`)}}let o={source:e,bytes:r,uri:`data:image/svg+xml,${encodeURIComponent(e)}`};return t.set(e,o),o}var De=class{plugins=new Map;index=new Map;listeners=new Set;subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});get(e,t){if(t?.isDirectory)return;let n=e.split(/[\\/]/).at(-1)??``,r=t?.extension??(n.includes(`.`)?n.slice(n.lastIndexOf(`.`)+1):``),i=this.index.get(G(r));return t?.themeVariant===`light`?i?.light.uri:i?.dark.uri}replace(e,t){if(t.length>64)throw Error(`GUI file icon per-plugin limit exceeded`);if(!t.length){this.remove(e);return}let n=new Map;for(let t of this.plugins.get(e)??[])for(let e of[t.dark,t.light])n.set(e.source,e);let r=new Set,i=t.map(e=>{if(!e||typeof e!=`object`||!(`id`in e)||typeof e.id!=`string`||!e.id.trim()||e.id.length>128||r.has(e.id))throw Error(`Invalid or duplicate GUI file icon id`);if(r.add(e.id),!(`extensions`in e)||!Array.isArray(e.extensions)||!e.extensions.length||e.extensions.length>64)throw Error(`GUI file icon requires 1–64 extensions`);let t=e.extensions.map(e=>{if(typeof e!=`string`)throw Error(`Invalid GUI file icon extension`);let t=G(e);if(!/^[a-z0-9][a-z0-9_+-]{0,63}$/.test(t))throw Error(`Invalid GUI file icon extension`);return t}),i=K(`svg`in e?e.svg:void 0,n),a=`lightSvg`in e&&e.lightSvg!==void 0?K(e.lightSvg,n):i;return{id:e.id,extensions:[...new Set(t)],dark:i,light:a}}),a=i.length,o=i.reduce((e,t)=>e+t.dark.bytes+t.light.bytes,0);for(let[t,n]of this.plugins)t!==e&&(a+=n.length,o+=n.reduce((e,t)=>e+t.dark.bytes+t.light.bytes,0));if(a>512||o>8388608)throw Error(`GUI file icon total limit exceeded`);this.plugins.set(e,i),this.publish()}remove(e){this.plugins.delete(e)&&this.publish()}dispose(){this.plugins.clear(),this.publish(),this.listeners.clear()}publish(){let e=new Map;for(let t of this.plugins.values())for(let n of t)for(let t of n.extensions)e.set(t,n);let t=e.size!==this.index.size||[...e].some(([e,t])=>{let n=this.index.get(e);return n?.dark.uri!==t.dark.uri||n?.light.uri!==t.light.uri});if(this.index=e,t)for(let e of this.listeners)e()}},q=e=>e===`yuri.exportPDF`||e===`yuri.exportLongImage`,Oe=class{api;probe;clients=new Map;ended=!1;constructor(e){this.api=e}use(e,n){let r=this.clients.get(n),i=r?.get(e);if(i)return i.live;let[a,o]=t(this.api&&!n.aborted&&!this.ended?{status:`pending`}:{status:`inactive`,reason:`disabled`}),s=()=>{o({status:`inactive`,reason:`disabled`}),n.removeEventListener(`abort`,s),this.clients.delete(n)},c={live:S(a),stop:s};if(this.ended||n.aborted||(r||(r=new Map,this.clients.set(n,r)),r.set(e,c),n.addEventListener(`abort`,s,{once:!0}),!this.api))return c.live;let l=this.api;return this.probe??=Promise.resolve().then(()=>l.capabilities()),this.probe.then(t=>{if(this.ended||n.aborted)return;let r=e===`yuri.exportPDF`?`exportPDF`:`exportLongImage`;if(t.version!==1||!t[r]){o({status:`inactive`,reason:`disabled`});return}let i=async(e,t={})=>{if(this.ended||n.aborted||a().status!==`active`)return{status:`cancelled`};let i=AbortSignal.any([n,...t.signal?[t.signal]:[]]);try{return await l[r](e,{...t,signal:i})}catch(e){throw e&&typeof e==`object`&&`code`in e&&e.code===`EXPORT_UNSUPPORTED`&&o({status:`inactive`,reason:`failed`}),e}},s=Object.freeze(e===`yuri.exportPDF`?{version:1,limits:t.limits,exportPDF:i}:{version:1,limits:t.limits,exportLongImage:i});o({status:`active`,generation:1,value:s})}).catch(()=>{!this.ended&&!n.aborted&&o({status:`inactive`,reason:`failed`})}),c.live}dispose(){this.ended=!0;for(let e of this.clients.values())for(let t of e.values())t.stop();this.clients.clear()}};function ke(e,t){let n=new Map,r=Object.freeze({dismiss(){}});return e.addEventListener(`abort`,()=>{for(let e of[...n.values()])e.handle.dismiss()},{once:!0}),Object.freeze({show(i){if(e.aborted)return r;if(!t)throw new x(`GUI_PLUGIN_UNSUPPORTED`,`GUI toast is unavailable`);if(!i||typeof i!=`object`)throw new x(`GUI_PLUGIN_INVALID_INPUT`,`Expected toast options`);let{title:a,description:o,variant:s=`default`,duration:c=5e3,persistent:l=!1,icon:u,actions:d}=i;if(typeof a!=`string`||o!==void 0&&typeof o!=`string`||![`default`,`success`,`error`,`loading`].includes(s)||typeof l!=`boolean`||typeof c!=`number`||!Number.isFinite(c)||c<0)throw new x(`GUI_PLUGIN_INVALID_INPUT`,`Invalid toast options`);if(u!==void 0||d!==void 0)throw new x(`GUI_PLUGIN_UNSUPPORTED`,`GUI toast icon/actions are unsupported`);if(e.aborted)return r;let f=JSON.stringify([a,o??null,s,c,l]),p=n.get(f),m=()=>{let e=n.get(f);!e||e.id!==h||(clearTimeout(e.timer),n.delete(f))},h=(s==="default"?t:t[s])(a,{id:p?.id,description:o,duration:l?1/0:c,onDismiss:m,onAutoClose:m}),g=p?.handle??Object.freeze({dismiss(){m(),t.dismiss(h)}});clearTimeout(p?.timer);let _=s===`loading`&&!l?setTimeout(()=>g.dismiss(),c):void 0;return n.set(f,{id:h,handle:g,timer:_}),g}})}var Ae=ae(`YuriMedia`);async function je(e){let t=/\.html?$/i.test(e.name)?`text/html`:`text/plain`,n=new Blob([e.content],{type:t});if(ce()){if(!oe.isPluginAvailable(`YuriMedia`))throw new x(`GUI_PLUGIN_UNSUPPORTED`,`Native file saving is unavailable`);if(n.size>33554432)throw new x(`GUI_PLUGIN_INVALID_INPUT`,`File exceeds maximum size`);let r=await new Promise((e,t)=>{let r=new FileReader;r.onload=()=>{if(typeof r.result!=`string`){t(Error(`Failed to encode file`));return}e(r.result.slice(r.result.indexOf(`,`)+1))},r.onerror=()=>t(r.error??Error(`Failed to encode file`)),r.readAsDataURL(n)});return!(await Ae.saveFile({dataBase64:r,mimeType:t,filename:e.name})).cancelled}let r=URL.createObjectURL(n),i=document.createElement(`a`);try{return i.href=r,i.download=e.name,document.body.append(i),i.click(),!0}finally{i.remove(),setTimeout(()=>URL.revokeObjectURL(r),1e3)}}var J=ee();function Y(e){return{version:1,register(t){let n=r(J);if(!n||n.plugin!==e||n.signal.aborted||e.aborted)throw Error(`Preview actions require the owning mounted panel`);let i=new AbortController,a=AbortSignal.any([e,n.signal,i.signal]),o,s=()=>{a.removeEventListener(`abort`,s),i.abort(),o?.remove()};h(s),a.addEventListener(`abort`,s,{once:!0});try{o=t.render({element:t.element,signal:a,async snapshot(e={}){let r=AbortSignal.any([a,...e.signal?[e.signal]:[]]);if(r.throwIfAborted(),!n.content.contains(t.element)||n.target.contains(t.element))throw Error(`Preview capture region is no longer in its owning panel`);let i=await t.capture({...e,signal:r});if(r.throwIfAborted(),!n.content.contains(t.element))throw Error(`Preview capture region was replaced`);return i}}),a.throwIfAborted(),n.target.append(o)}catch(e){throw s(),e}return s}}}var X=e=>{throw new x(`GUI_PLUGIN_UNSUPPORTED`,`Unsupported GUI host API: ${e}`)};function Z(e,t){return new Proxy(t,{get:(t,n)=>n in t?Reflect.get(t,n):X(`${e}.${String(n)}`)})}var Q=e=>Object.freeze(e.map(e=>Object.freeze(e)));function Me(e,t){if(!e.fields||!t.fields)return!1;let n=Reflect.ownKeys(e.fields);return n.length===Reflect.ownKeys(t.fields).length&&n.every(n=>{let r=e.fields[n],i=t.fields[n];return i!==void 0&&`value`in r&&`value`in i&&Object.is(r.value,i.value)&&r.enumerable===i.enumerable&&r.configurable===i.configurable&&r.writable===i.writable})}function $(e,t){if(e){for(let n of e.owned??[])$(n,t);e.cleanups&&=e.cleanups.map(e=>()=>{try{Promise.resolve(e()).catch(t)}catch(e){t(e)}})}}var Ne=class{options;fileIcons=new De;instances=new Map;listeners=new Set;panelMounts=new Set;fileViews=new Map;changes=t(0);views=t(0);session=t();appearance;layouts=new Map;files;storage;ended=!1;contracts=new Map;snapshot=Object.freeze({plugins:Object.freeze([]),commands:Object.freeze([]),titlebarItems:Object.freeze([]),panels:Object.freeze([]),settings:Object.freeze([]),menuItems:Object.freeze([]),activePanel:null});screen;viewExports;constructor(e){this.options=e,this.viewExports=new Oe(e.viewExport),this.appearance=t({locale:e.locale,mode:e.mode,narrow:e.narrow}),this.storage=new we(e.storage,e.transport);let n=()=>(this.session[0](),this.files?.api??X(`screen.file without a session`));this.screen=Z(`screen`,{get file(){return n()}})}subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});getSnapshot=()=>this.snapshot;changed(e=!1){let t=this.snapshot;this.changes[1](e=>e+1),e&&t===this.snapshot&&this.publish()}setSession(e){if(this.ended)return;let t=this.session[0]();if(t?.id===e?.id&&t?.directory===e?.directory)return;if(!e)for(let e of[...this.panelMounts])e();this.files?.dispose(),this.files=e?new Ce(this.options.files,this.options.queryClient,this.options.transport,e.directory):void 0;let n=Z(`session.server`,{id:this.options.transport,name:this.options.transport,client:this.options.client}),r=e?Object.freeze(Z(`session`,{id:e.id,directory:e.directory,key:`${this.options.transport}\n${e.id}`,tab:e.id,server:n,pending:!1,visit:{},location:{directory:e.directory}})):void 0,i=this.snapshot;this.session[1](r),i===this.snapshot&&this.publish()}setAppearance(e){if(this.ended)return;let t=this.appearance[0]();(t.locale!==e.locale||t.mode!==e.mode||t.narrow!==e.narrow)&&this.appearance[1]({...e})}install(r,i,a){let c=this.instances.get(r);if(this.ended||c?.status===`active`&&c.revision===i.revision&&c.native?.active!==!1){a?.dispose();return}c&&(this.instances.delete(r),this.release(c));let u={id:r,native:a,revision:i.revision,controller:new AbortController,status:`active`,cleanups:new Set,contributions:new Set,iconChanges:t(0),commands:[],titlebarItems:[],panels:[],settings:[],menus:[]};this.instances.set(r,u);try{if(r===`yuri`||r.startsWith(`yuri.`))throw Error(`The yuri namespace is reserved to the host`);let t=Se(i.code,a?.activation.os);s(r=>{u.dispose=r,u.root=n(),f(()=>l(C.Provider,{value:u.context=this.context(u,t,i.options),get children(){u.owner=n();let e=o(()=>t.setup?.(u.context));if(typeof e==`function`)u.cleanups.add(()=>{Promise.resolve(e()).catch(e=>{u.error=String(e)})});else if(e!==void 0)throw e&&typeof e==`object`&&`then`in e&&Promise.resolve(e).catch(()=>{}),Error(`GUI setup must be synchronous and return only cleanup`);return null}}),e=>this.fail(u,e)),u.controller.signal.aborted||e(u.owner,()=>b(()=>{if(u.iconChanges[0](),!u.controller.signal.aborted)try{let e=[...u.contributions].filter(e=>e.registry===Te).map(e=>e.read()).filter(e=>e!==void 0);this.fileIcons.replace(u.id,e),u.iconError!==void 0&&o(()=>{u.iconError=void 0,this.publish()})}catch(e){o(()=>{this.fileIcons.remove(u.id),u.iconError=e instanceof Error?e.message:String(e),this.publish()})}})),u.controller.signal.aborted||e(u.owner,()=>b(()=>{this.changes[0](),this.session[0](),this.appearance[0]();try{this.derive(u)}catch(e){o(()=>this.fail(u,e))}o(()=>this.publish())}))})}catch(e){this.fail(u,e)}this.changed(!0)}release(e){e.controller.abort(),e.native?.dispose();for(let t of[...e.cleanups])try{t()}catch(t){e.error??=String(t)}e.cleanups.clear(),$(e.root,t=>{e.error??=String(t)});try{e.dispose?.()}catch(t){e.error??=String(t)}e.contributions.clear(),e.commands=[],e.titlebarItems=[],e.panels=[],e.settings=[],e.menus=[],this.fileIcons.remove(e.id);for(let t of this.contracts.values())t.provider===e&&(t.provider=void 0,t.live[1]({status:`inactive`,reason:e.status===`failed`?`failed`:`disabled`}))}fail(e,t){e.status!==`failed`&&this.instances.get(e.id)===e&&(e.status=`failed`,e.error=t instanceof Error?t.message:String(t),t instanceof x&&(e.errorCode=t.code),this.release(e),this.publish())}uninstall(e){let t=this.instances.get(e);if(t){this.instances.delete(e),this.release(t);for(let t of this.layouts.values())t.open=t.open.filter(t=>!t.startsWith(`${e}:`)),t.active?.startsWith(`${e}:`)&&(t.active=null);this.changed(!0)}}dispose(){this.ended||(this.ended=!0,p(()=>{for(let e of[...this.instances.keys()])this.uninstall(e)}),this.viewExports.dispose(),this.files?.dispose(),this.fileIcons.dispose(),this.storage.dispose(),this.layouts.clear(),this.fileViews.clear(),this.contracts.clear(),this.listeners.clear())}own(e,t){let i=!0,a=()=>{i&&(i=!1,e.cleanups.delete(a),t())};return e.controller.signal.aborted||r(E)?.ended?(a(),a):(e.cleanups.add(a),n()&&h(a),a)}list(e){this.changes[0]();let t=[];for(let n of this.instances.values())if(n.status===`active`){for(let r of n.contributions)if(r.registry===e.id){let e=r.read();e!==void 0&&t.push(e)}}return t}context(e,t,i){let a=this.storage.forPlugin(e.id,e.controller.signal),c=Object.fromEntries(Object.entries(t.stores??{}).map(([e,t])=>[e,t.scope===`global`?a.store(e,{...t,scope:`global`}):n=>a.store(e,{...t,scope:{session:n}})])),l=(e,n)=>{let r=this.appearance[0]().locale;return(t.i18n?.[r]?.[e]??t.i18n?.[r.split(`-`)[0]]?.[e]??t.i18n?.en?.[e]??e).replace(/\{\{(\w+)\}\}/g,(e,t)=>String(n?.[t]??e))},u=Z(`layout`,{narrow:()=>this.appearance[0]().narrow,ready:()=>!!this.session[0](),open:(t,n,r)=>{e.controller.signal.aborted||this.openPanel(t,n,r)},close:(t,n)=>{e.controller.signal.aborted||this.closeFor(t,n)},toggle:(e,t)=>u.state(e,t)===`visible`?u.close(e,t):u.open(e,t),hide:(t,n)=>{if(e.controller.signal.aborted)return;let r=this.layout(n);r.active===t&&r.shown&&(r.shown=!1,this.changed())},state:(e,t)=>{this.changes[0]();let n=this.layout(t);return n.active===e?n.shown?`visible`:`active`:n.open.includes(e)?`open`:`closed`},stored:t=>(this.changes[0](),this.layout(t).open.filter(t=>t.startsWith(`${e.id}:`)).map(t=>t.slice(e.id.length+1))),side:{opened:e=>(this.changes[0](),this.layout(e).shown),toggle:t=>{if(e.controller.signal.aborted)return;let n=this.layout(t);n.shown=!n.shown,this.changed()},menu:()=>this.list(w).filter(e=>e.menu===`session.panel`).sort((e,t)=>(e.order??0)-(t.order??0))},scroll:{get:(e,t)=>(this.changes[0](),this.layout(e).scroll.get(t)),set:(t,n,r)=>{if(e.controller.signal.aborted)return;let i=this.layout(t).scroll;if(!i.has(n)&&i.size>=128)throw Error(`GUI layout scroll limit exceeded`);i.set(n,{...r}),this.changed()}}}),f=Y(e.controller.signal),p=S(()=>e.controller.signal.aborted?{status:`inactive`,reason:`disabled`}:{status:`active`,generation:1,value:f});return Z(`ctx`,{id:e.id,options:i,signal:e.controller.signal,client:this.options.client,storage:a,stores:c,toast:ke(e.controller.signal,this.options.toast),app:{name:`yuri`,version:e.native?.activation.app.version??``,channel:e.native?.activation.app.packaged?`prod`:`local`,platform:e.native?`desktop`:`web`,packaged:e.native?.activation.app.packaged??!1},desktop:e.native?Z(`desktop`,{os:e.native.activation.os}):void 0,t:l,plural:(e,t,n)=>{let r=`${e}.${new Intl.PluralRules(this.appearance[0]().locale).select(t)}`;return l(r,{...n,count:t})===r?l(`${e}.other`,{...n,count:t}):l(r,{...n,count:t})},add:(t,i)=>{if(e.controller.signal.aborted||r(E)?.ended)return()=>{};if([`server`,`composer-pill`,`slot`,`file.viewer`,`menubar-item`].includes(t.id)&&X(`registry.${t.id}`),e.contributions.size>=256)throw Error(`GUI contribution limit exceeded`);let a=()=>{},c,l=s(e=>{a=e,c=n();let r=()=>typeof i==`function`?i():i,o;if(t.id===`yuri.file-icon`){let e=d(()=>{try{return{ok:!0,value:r()}}catch(e){return{ok:!1,error:e}}});o=()=>{let t=e();if(!t.ok)throw t.error;return t.value}}else o=d(r);if(t.id===`style`){let e=document.createElement(`style`);document.head.append(e),h(()=>e.remove()),b(()=>{let t=o();e.textContent=t===void 0?``:String(t)})}return{registry:t.id,read:o}},n()??e.owner);e.contributions.add(l);let u=()=>{t.id===`yuri.file-icon`&&e.iconChanges[1](e=>e+1)};return o(u),o(()=>this.changed()),this.own(e,()=>{$(c,t=>{e.error??=String(t)}),a(),e.contributions.delete(l),o(u),o(()=>this.changed())})},list:e=>this.list(e),provide:(t,n)=>{if(e.controller.signal.aborted||r(E)?.ended)return()=>{};if(q(t.id)||t.id===`yuri.previewActions`)throw Error(`Preview/export contracts are provided only by the Yuri host`);if(t.kind!==`contract`||!(t.id===e.id||t.id.startsWith(`${e.id}.`)))throw Error(`Contract must belong to the providing plugin`);let i=this.contract(t.id);if(i.provider)throw Error(`Contract already provided: ${t.id}`);return i.provider=e,i.live[1]({status:`active`,value:n,generation:++i.generation}),this.own(e,()=>{i.provider===e&&(i.provider=void 0,i.live[1]({status:`inactive`,reason:e.status===`failed`?`failed`:`disabled`}))})},use:t=>t.id===`yuri.previewActions`?t.kind===`contract`?p:X(`preview actions token must be a Contract`):q(t.id)?t.kind===`contract`?this.viewExports.use(t.id,e.controller.signal):X(`export token must be a Contract`):t.kind===`ipc`&&e.native?e.native.token(t).live:this.contract(t.id,t.kind===`ipc`).live[0],main:t=>{if(!(t.id===e.id||t.id.startsWith(`${e.id}.`)))throw new x(`GUI_PLUGIN_FORBIDDEN`,`IPC must belong to the plugin`);return e.native?e.native.token(t).value:new Proxy({state:()=>void 0},{get:(e,t)=>t===`state`?e.state:t===`on`?()=>{throw new x(`GUI_PLUGIN_UNSUPPORTED`)}:()=>Promise.reject(new x(`GUI_PLUGIN_UNSUPPORTED`))})},sessions:{current:this.session[0],list:()=>{let e=this.session[0]();return e?[e]:[]}},screen:{current:()=>this.session[0]()?this.screen:void 0},layout:u,appearance:{mode:()=>this.appearance[0]().mode,font:()=>getComputedStyle(document.documentElement).getPropertyValue(`--font-mono`).trim()||`monospace`},locale:{locale:()=>this.appearance[0]().locale,direction:()=>/^(ar|fa|he|ur)(-|$)/i.test(this.appearance[0]().locale)?`rtl`:`ltr`},system:{copy:e=>navigator.clipboard.writeText(e),openExternal:e=>{let t=new URL(e);[`https:`,`http:`,`mailto:`].includes(t.protocol)||X(`system.openExternal protocol`),window.open(e,`_blank`,`noopener,noreferrer`)},save:je},commands:{run:t=>e.controller.signal.aborted||!this.command(t)?!1:(this.runCommand(t),!0)},links:{open:t=>!e.controller.signal.aborted&&this.navigateLink(e,t),exists:t=>o(()=>{if(e.controller.signal.aborted)return!1;let n=this.linkHandler(t);try{return Promise.resolve(n?.value.exists?.(t)??!1).catch(()=>!1)}catch{return!1}})}})}contract(e,n=!1){let r=this.contracts.get(e);if(!r){if(this.contracts.size>=256)throw Error(`GUI contract limit exceeded`);let n=t({status:`inactive`,reason:`disabled`});r={live:[S(n[0]),n[1]],generation:0},this.contracts.set(e,r)}return n&&r.provider&&X(`IPC contract collision`),r}derive(e){if(e.status!==`active`)return;let t=[],n=[],r=[],i=[],a=[],s=this.session[0]();for(let o of e.contributions){if(o.registry===`yuri.file-icon`)continue;let c=o.read();if(c!==void 0){if(o.registry===O.id){let n=c;n.enabled!==!1&&t.push({key:`${e.id}.${n.id}`,pluginId:e.id,title:n.title,description:n.description,bind:n.bind,hidden:n.hidden,run:()=>this.invoke(e,()=>n.run())})}else if(o.registry===ge.id){let t=c;a.push({key:JSON.stringify([e.id,t.id]),pluginId:e.id,label:t.label,title:t.title,icon:t.icon,busy:t.busy,pressed:t.pressed,actionable:!!t.run,run:t.run})}else if(o.registry===A.id&&s){let t=c,r=`${e.id}:`,i=this.layout(s).open.filter(e=>e.startsWith(r)).map(e=>e.slice(r.length));for(let r of t.list({session:s,screen:this.screen,open:i}))n.push({plugin:e,panel:t,tab:r})}else if(o.registry===he.id){let e=c;(e.page||e.section)&&X(`SettingsPage host sections`),e.title,r.push(e)}else if(o.registry===w.id){let e=c;e.menu===`session.panel`?(e.title,i.push(e)):X(`MenuItem.${e.menu}`)}}}for(let e of n)e.tab.title;e.commands=t,e.titlebarItems=a,e.panels=n,e.settings=r,e.menus=i,o(()=>this.views[1](e=>e+1))}publish(){let e=o(this.session[0]),t=e?this.layouts.get(e.key):void 0,n=[...this.instances.values()],r=n.filter(e=>e.status===`active`),i=r.flatMap(e=>e.panels.map(({tab:n})=>{let r=n.file?this.filePath(n.file):void 0;return{key:`${e.id}:${n.id}`,pluginId:e.id,title:n.title,file:r,inline:!!(r&&this.fileViews.has(r)),active:t?.shown===!0&&t.active===`${e.id}:${n.id}`}}));this.snapshot=Object.freeze({plugins:Q(n.map(({id:e,revision:t,status:n,error:r,errorCode:i,iconError:a})=>({id:e,revision:t,status:n,error:r??a,...i?{errorCode:i}:{}}))),commands:Q(r.flatMap(e=>e.commands.filter(e=>!e.hidden))),panels:Q(i),titlebarItems:Q(r.flatMap(e=>e.titlebarItems.map(({run:e,...t})=>t))),settings:Q(r.flatMap(e=>e.settings.map(t=>({key:`${e.id}:${t.id}`,pluginId:e.id,title:t.title})))),menuItems:Q(r.flatMap(e=>e.menus.map(t=>({key:`${e.id}:${t.id}`,pluginId:e.id,title:t.title,description:t.description,run:()=>{this.invoke(e,()=>t.run())}})))),activePanel:t?.shown&&i.some(e=>e.key===t.active)?t.active:null,sessionKey:e?.key});for(let e of this.listeners)e()}invoke(t,n){if(!t.controller.signal.aborted)try{let r=e(t.owner??null,n);if(r instanceof Promise)return r.catch(e=>this.fail(t,e))}catch(e){this.fail(t,e)}}command(e){return[...this.instances.values()].flatMap(e=>e.commands).find(t=>t.key===e)}runCommand(e){return this.command(e)?.run()}runTitlebarItem(e){for(let t of this.instances.values()){let n=t.titlebarItems.find(t=>t.key===e);if(n?.run&&!n.busy)return this.invoke(t,n.run)}}linkHandler(e){let t=[];for(let e of this.instances.values())for(let n of e.contributions)if(n.registry===me.id){let r=n.read();r&&t.push({instance:e,value:r})}for(let n of t.sort((e,t)=>(t.value.priority??0)-(e.value.priority??0)))try{if(n.value.match(e))return n}catch(e){this.fail(n.instance,e)}}navigateLink(e,t){if(this.ended)return!1;let n=ue(t.href);if(!n||!le(n.path))return this.openLink(t);let r=this.session[0]();if(!r||t.session&&(t.session.key!==r.key||t.session.server.id!==r.server.id))return!1;if(!this.options.focusFile)return this.openLink(t);let i=ie(t.base??r.directory,n.path),a=n.line===void 0?``:`:${n.line}${n.column===void 0?``:`:${n.column}`}`;return this.invoke(e,()=>this.options.focusFile(i+a,r.directory)),!0}openLink(e){if(this.ended)return!1;let t={...e,session:e.session??this.session[0]()},n=this.linkHandler(t);return n?(this.invoke(n.instance,()=>n.value.open(t)),!0):!1}filePath(e,t=this.session[0]()?.directory){let n=I(e);return/^(?:\/|[a-z]:\/)/i.test(n)||!t?n:I(`${t}/${n}`)}registerFileView(e,t){if(this.ended)return()=>{};let n=this.filePath(e,t),r=this.fileViews.get(n)??0;this.fileViews.set(n,r+1),r===0&&this.changed(!0);let i=!1;return()=>{if(i||this.ended)return;i=!0;let e=(this.fileViews.get(n)??1)-1;if(e){this.fileViews.set(n,e);return}{let e=this.session[0](),t=e&&this.layouts.get(e.key);t?.active&&this.snapshot.panels.some(e=>e.key===t.active&&e.file===n)&&(t.shown=!1),this.fileViews.delete(n)}this.changed(!0)}}filePanel(e,t){let n=this.filePath(e,t);return this.snapshot.panels.find(e=>e.file===n&&e.inline)}panelVisible(e){let t=this.session[0]();if(!t)return!1;let n=this.panel(e)?.tab.file;if(n&&this.fileViews.has(this.filePath(n)))return!0;let r=this.layouts.get(t.key);return!!(r?.shown&&r.active===e)}layout(e){let t=this.layouts.get(e.key);if(!t){if(this.layouts.size>=128)throw Error(`GUI session layout limit exceeded`);t={open:[],active:null,shown:!1,scroll:new Map},this.layouts.set(e.key,t)}return t}openPanel(e,t,n){if(this.ended)return;let r=this.layout(t),i=r.active,a=r.shown,o=r.open.length;if(!r.open.includes(e)){if(r.open.length>=64)throw Error(`GUI panel tab limit exceeded`);r.open=[...r.open,e]}n?.tab!==`append`&&(r.active=e,r.shown=!(this.appearance[0]().narrow&&n?.background)),(i!==r.active||a!==r.shown||o!==r.open.length)&&this.changed(!0);let s=this.panel(e);t.key===this.session[0]()?.key&&s&&n?.tab!==`append`&&this.invoke(s.plugin,()=>s.panel.focus?.({...this.props(e),restored:!1}))}selectPanel(e){let t=this.session[0]();t&&this.openPanel(e,t)}closeFor(e,t){let n=this.layout(t),r=t.key===this.session[0]()?.key?this.panel(e):void 0;if(!n.open.includes(e)||r?.tab.pinned||r?.tab.closable===!1)return;let i=this.session[0](),a=r&&i?{tab:r.tab,session:i,screen:this.screen}:void 0;n.open=n.open.filter(t=>t!==e),n.active===e&&(n.active=n.open.at(-1)??null),this.changed(!0),r&&a&&this.invoke(r.plugin,()=>r.panel.close?.(a))}closePanel(e){let t=this.session[0]();t&&this.closeFor(e,t)}hidePanel(){let e=this.session[0]();if(!e)return;let t=this.layout(e);t.shown&&(t.shown=!1,this.changed(!0))}panel(e){return[...this.instances.values()].flatMap(e=>e.panels).find(t=>`${t.plugin.id}:${t.tab.id}`===e)}props(e,t=!1){let n=this.panel(e)?.tab,r=()=>(this.views[0](),this.panel(e)?.tab??n??X(`panel no longer listed`)),i=t?d(()=>{let e=r();return{tab:e,fields:Object.getPrototypeOf(e)===Object.prototype?Object.getOwnPropertyDescriptors(e):void 0}},void 0,{equals:Me}):void 0,a=i?()=>i().tab:r,o=()=>this.session[0]()??X(`panel without session`);return{get tab(){return a()},get session(){return o()},screen:this.screen}}mountPanel(e,t,n){let r=this.panel(e);if(!r)return()=>{};let i=new AbortController,a=()=>{let a=d(()=>{this.session[0](),this.changes[0](),this.views[0]();let t=this.panel(e)?.tab.file;return t&&this.files&&this.panelVisible(e)?{model:this.files,file:t}:void 0},void 0,{equals:(e,t)=>e?.model===t?.model&&e?.file===t?.file});b(()=>{let e=a();e&&(h(e.model.watch(e.file)),e.model.sync(e.file).catch(()=>{}))});let s=()=>o(()=>r.panel.render(this.props(e,!0)));return l(J.Provider,{value:n?{plugin:r.plugin.controller.signal,signal:i.signal,content:t,target:n}:void 0,get children(){return s()}})},s=this.mount(r.plugin,t,()=>l(ve.Provider,{value:{visible:()=>(this.changes[0](),this.panelVisible(e)),present:()=>(this.changes[0](),this.panelVisible(e)),placement:()=>this.appearance[0]().narrow?`mobile`:`side`,reserve:()=>!1,animate:()=>!1,sidebar:Z(`panel.sidebar`,{}),open:()=>{let e=this.session[0]();return e?r.plugin.context.layout.stored(e):[]}},get children(){return a()}})),c=()=>{this.panelMounts.delete(c),i.abort(),s()};return this.panelMounts.add(c),this.own(r.plugin,c)}mountSettings(e,t){for(let n of this.instances.values()){let r=n.settings.find(t=>`${n.id}:${t.id}`===e);if(r)return this.mount(n,t,()=>r.render({}))}return()=>{}}mount(e,t,r){if(e.controller.signal.aborted)return()=>{};let i=()=>{},a,s=t=>{queueMicrotask(()=>this.fail(e,t))};try{i=fe(()=>l(C.Provider,{value:e.context,get children(){return a=n(),f(()=>o(r),s)}}),t)}catch(t){this.fail(e,t)}return this.own(e,()=>{$(a,t=>{e.error??=String(t)}),i(),t.replaceChildren()})}};export{Ne as GuiPluginHost};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/vendor-workbox-window-15MWHJyx.js","assets/rolldown-runtime-hePW80VL.js","assets/renderMobileApp-CU1ec6Ak.js","assets/runtime-auth-DBn9yahL.js","assets/runtime-switch-DEZ1K7qW.js","assets/runtime-fetch-D4ja813o.js","assets/runtimeAPIRegistry-C2VogTny.js","assets/vendor-zustand-B43HCgwC.js","assets/vendor-base-ui-BQjbsJ43.js","assets/gitApiHttp-De9liKnG.js","assets/desktop-JwYqThiw.js","assets/vendor-opencode-client-UL_TecvQ.js","assets/vendor-effect-DV9F8PTZ.js","assets/brand-storage-bootstrap-D4BW3w-M.js","assets/brand-storage-migration-Bhz6UOBJ.js","assets/useUIStore-BbYD420L.js","assets/persistence-CfrHIiIS.js","assets/vendor-react-D5d-V1vN.js","assets/queryRuntime-Dkpnq3Z1.js","assets/vendor-tanstack-query-core-BWz0ose6.js","assets/pathNormalization-ewtPqJWn.js","assets/vendor-pathe-vBmvQE8f.js","assets/runtime-file-resource-6np6lzoV.js","assets/fileQueries-5a1jkme2.js","assets/vendor-tanstack-react-query-C4SG3JZB.js","assets/runtime-file-store-BVRgEtI-.js","assets/path-utils-jGozTg9d.js","assets/vendor-aparajita-capacitor-secure-storage-xol_6BsB.js","assets/platform-DFJEtBlo.js","assets/capgoAdapter-DufzjXRs.js","assets/types-BqFQhQTt.js","assets/vendor-pierre-diffs-Bj9Nqn6w.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-sonner-r2EJnfoo.js","assets/vendor-reactuses-core-BcebBLwF.js","assets/vendor-lodash-es-DfLbG5Af.js","assets/vendor-js-cookie-hSOiFTtX.js","assets/button-DinGM3tu.js","assets/store-CUBymvAC.js","assets/vendor-class-variance-authority-BLUaYARZ.js","assets/vendor-tailwind-merge-BicNWLTg.js","assets/MobileShareBridge-C3Equ3P_.js","assets/MobileDetailNavigation-tbfsMfB-.js","assets/useMobileNavigationStore-BHMFeMjo.js","assets/useAssistantUIStore-Bp6TxG5E.js","assets/vendor-zod-Dzk5kdUU.js","assets/vendor-fuse.js-DB5wDJbI.js","assets/vendor-fuzzysort-ukaRp9PC.js","assets/Icon-t2xvbAyN.js","assets/AgentAvatar-Bi1vvWPC.js","assets/agentColors-DWSbQXy2.js","assets/vendor-dicebear-core-CV95S5Pg.js","assets/vendor-dicebear-styles-C4OfoX7R.js","assets/dualLimitLru-D8Sphgua.js","assets/useThemeSystem-CGF5jnIh.js","assets/vendor-framer-motion-C1twy-GF.js","assets/dialog-BXssfGXA.js","assets/dialog-CTYD3Sbr.css","assets/rasterizePng-056Poix7.js","assets/gitApi-Wo0IZow9.js","assets/useAppFontEffects-BVoVpJYO.js","assets/desktopHosts-CB0CTcMg.js","assets/desktopRelayRestore-CoLLVJw8.js","assets/vendor-simplewebauthn-browser-Dwhcdg_5.js","assets/projectMeta-31PobC-M.js","assets/input-v8-rVbo-.js","assets/tooltip-d8TNN4lx.js","assets/device-BjRYYXNT.js","assets/MobileResizableSheet-BeRmT6_x.js","assets/MobileWindowStack-DGLdgoGr.js","assets/vendor-dnd-kit-core-B3g3zWQd.js","assets/vendor-dnd-kit-accessibility-DxpFzZhi.js","assets/vendor-dnd-kit-sortable-BKewx0Py.js","assets/textarea-B39OCNPV.js","assets/OverlayScrollbar-CF0PCvQz.js","assets/speechSettingsQueries-DU25rmGc.js","assets/scheduledTaskNavigation-Bsrhv3Ow.js","assets/YuriLogo-QvS1ZEHi.js","assets/image-loading-Dq1g_wpm.js","assets/image-loading-D9Z_BASK.css","assets/sessionLookup-DRVy7LM1.js","assets/LoadingImage-5rY_edNm.js","assets/ImageLoadingPlaceholder-D1L13TK0.js","assets/sessionLookup-8C8nv-EP.css","assets/fileMentionTouchSelection-DSl0tj2r.js","assets/insertionBoundaries-CZz7TWJv.js","assets/appThemeRegistry-Bb_DtiV9.js","assets/MarkdownRenderer-BlGxjOei.js","assets/useEffectiveDirectory-D8FFE5Yn.js","assets/markdownHeightCache-BVV2dktw.js","assets/url-MRa-FtQa.js","assets/toolHelpers-iEHVHQ9p.js","assets/react-B9v0P7kT.js","assets/FadeInOnReveal-BB4qEnAn.js","assets/useWorkerHighlightedLines-CPxG8Fya.js","assets/markdownTheme-hpURsgju.js","assets/markdown-worker-oBGEB9Eg.js","assets/vendor-tanstack-react-virtual-BeZn51tF.js","assets/vendor-cmdk-C3oBVL9X.js","assets/vendor-aria-hidden-BbL3cEyI.js","assets/sortable-tabs-strip-yKyqsqut.js","assets/vendor-motion-BmLx2V78.js","assets/useFontPreferences-BFyBjtQ6.js","assets/terminalApi-BblSkqch.js","assets/useAppFontEffects-RpgNbjA4.css","assets/tap-LkQum5bB.js","assets/MobileTabPageHeader-DQRqAAEf.js","assets/vendor-codemirror-autocomplete-7c2L_4dM.js","assets/vendor-codemirror-lang-angular-DXOgWEVj.js","assets/vendor-codemirror-lang-json-mLulNbwB.js","assets/vendor-codemirror-lang-markdown-CV1IO6Qs.js","assets/vendor-codemirror-lang-python-YM2WVLHF.js","assets/vendor-codemirror-legacy-modes-DwltVFbT.js","assets/mcpQueries-BoBrB4a4.js","assets/collapsible-Bh1GLNYV.js","assets/vendor-codemirror-commands-B8KrBQ9B.js","assets/vendor-codemirror-search-DiPwvA-6.js","assets/vendor-replit-codemirror-vim-DCdAdxvE.js","assets/vendor-codemirror-language-data-Ctd4WxgW.js","assets/projectActions-BX0cjZoq.js","assets/AssistantContactStatus-CWq-PDz6.js","assets/assistant-attachment-cache-B9iHLlm2.js","assets/runtimeEndpointReset-DO5WVetV.js","assets/mobileBackNavigation-DMSzAvb6.js","assets/AssistantUnreadBadge-DdJyySwn.js","assets/context-menu-DpbkRkk1.js","assets/readiness-CYNnsekT.js","assets/native-errors-06if6eu-.js","assets/vendor-cron-parser-BmO80h0C.js","assets/runtimeEndpointReset-BL9hV6J1.css","assets/SettingsView-2tk4WH7R.js","assets/native-config-DjdrW_9n.js","assets/vendor-qrcode-D7jBCyl-.js","assets/vendor-dijkstrajs-BAzPDGZM.js","assets/GuiPluginWindow-DOJ7wuRH.js","assets/vendor-yaml-C9KlJAlj.js","assets/SettingsView-BRIvklfP.css","assets/AssistantView-Br1iETTs.js","assets/touch-gestures-K2_ZOkKW.js","assets/renderMobileApp-1G4-5u-t.css","assets/src-Bckdo2XS.css","assets/main-DOwAfmxJ.js","assets/useDesktopWindowControlsLayout-CYx1LNO5.js","assets/diagram-BmG-7Jb4.js","assets/vendor-react-drawio-C-iPmmED.js","assets/multirun-BhWttsRQ.js","assets/vendor-zumer-snapdom-yq9vlCKr.js","assets/vendor-html-to-image-BDMm2v6d.js","assets/main-qSeeJRW1.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{n as e,t}from"./runtimeConfig-Db7yfo6L.js";import{o as n}from"./vendor-aparajita-capacitor-secure-storage-xol_6BsB.js";/* empty css */var r=`true`,i=`false`,a=r===`true`,o=i===`true`;function s(e={}){let{immediate:t=!1,onNeedReload:r,onNeedRefresh:i,onOfflineReady:s,onRegistered:c,onRegisteredSW:l,onRegisterError:u}=e,d,f,p,m=async(e=!0)=>{await f,a||p?.()};async function h(){if(`serviceWorker`in navigator){if(d=await n(async()=>{let{Workbox:e}=await import(`./vendor-workbox-window-15MWHJyx.js`).then(e=>e.t);return{Workbox:e}},__vite__mapDeps([0,1])).then(({Workbox:e})=>new e(`/sw.js`,{scope:`/`,type:`classic`})).catch(e=>{u?.(e)}),!d)return;if(p=()=>{d?.messageSkipWaiting()},!o)if(a)d.addEventListener(`activated`,e=>{(e.isUpdate||e.isExternal)&&(r?r():window.location.reload())}),d.addEventListener(`installed`,e=>{e.isUpdate||s?.()});else{let e=!1,t=()=>{e=!0,d?.addEventListener(`controlling`,e=>{e.isUpdate&&(r?r():window.location.reload())}),i?.()};d.addEventListener(`installed`,n=>{n.isUpdate===void 0?n.isExternal===void 0?!e&&s?.():n.isExternal?t():!e&&s?.():n.isUpdate||s?.()}),d.addEventListener(`waiting`,t)}d.register({immediate:t}).then(e=>{l?l(`/sw.js`,e):c?.(e)}).catch(e=>{u?.(e)})}}return f=h(),m}window.__YURI_RUNTIME_APIS__=t();var c=()=>typeof window>`u`||typeof window.matchMedia!=`function`?!1:window.matchMedia(`(pointer: coarse)`).matches,l=(()=>{let e=new URLSearchParams(window.location.search).get(`surface`);if(e===`mobile`)return`mobile`;if(e===`desktop`)return`desktop`;let t=Math.min(window.innerWidth||0,window.screen?.width||window.innerWidth||0),n=navigator.maxTouchPoints||0;return t>0&&t<=760&&(n>0||c())?`mobile`:`desktop`})();window.__YURI_SURFACE__=l;var u=()=>!(!(`serviceWorker`in navigator)||!window.isSecureContext||window.location.protocol!==`http:`&&window.location.protocol!==`https:`||document.prerendering||String(document.visibilityState)===`prerender`),d=e=>{let t=!1,n=()=>{t||u()&&(t=!0,e())},r=()=>{setTimeout(n,0)};document.readyState===`complete`?r():window.addEventListener(`load`,r,{once:!0}),(document.prerendering||String(document.visibilityState)===`prerender`)&&document.addEventListener(`visibilitychange`,n,{once:!0})},f=()=>{d(()=>{try{s({onRegisterError(e){console.warn(`[PWA] service worker registration skipped:`,e)}})}catch(e){console.warn(`[PWA] service worker registration skipped:`,e)}})},p=`yuri.dev.module-reload`,m=(e,t)=>{console.error(`[yuri] failed to load ${t}:`,e)};l===`mobile`?n(async()=>{let{renderMobileApp:e}=await import(`./renderMobileApp-CU1ec6Ak.js`);return{renderMobileApp:e}},__vite__mapDeps([2,1,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,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148])).then(({renderMobileApp:e})=>{try{sessionStorage.removeItem(p)}catch{}e(window.__YURI_RUNTIME_APIS__??t())}).catch(e=>m(e,`renderMobileApp`)):e().then(()=>n(()=>import(`./main-DOwAfmxJ.js`),__vite__mapDeps([149,1,3,4,5,10,6,69,7,8,9,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,111,30,28,115,31,32,33,34,35,36,37,38,39,40,42,43,44,45,46,47,48,50,51,41,52,53,54,55,56,62,63,64,65,67,68,70,58,61,57,59,60,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,66,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,112,114,116,117,118,119,120,121,122,123,124,125,126,127,150,130,131,132,133,134,135,136,137,151,152,153,154,155,156,148]))).then(()=>{try{sessionStorage.removeItem(p)}catch{}}).catch(e=>m(e,`desktop main`)),f();
|