pisper 0.6.14 → 0.6.15
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/bin/pisper.mjs +5 -1
- package/lib/executor-node.mjs +590 -0
- package/lib/npm-update.mjs +2 -0
- package/package.json +5 -5
- package/web/.vite/manifest.json +852 -856
- package/web/assets/{AppDialog-DrhCZm1r.js → AppDialog-CgJEhcYw.js} +1 -1
- package/web/assets/{AppOverlays-CxgReqGn.js → AppOverlays-BBlYyb_U.js} +1 -1
- package/web/assets/{AppSelect-BGVBQRP1.js → AppSelect-BD6RAaJ5.js} +1 -1
- package/web/assets/{AssetsPage-CKK-byQY.js → AssetsPage-D3F4T0_j.js} +1 -1
- package/web/assets/BoardPage-CO7nU2Mw.js +3 -0
- package/web/assets/BotAvatar-CNL-APwP.js +1 -0
- package/web/assets/ChannelsPage-CsRbj9St.js +1 -0
- package/web/assets/{ChatAppearancePage-BhqRLf-2.js → ChatAppearancePage-Sc1V75I3.js} +1 -1
- package/web/assets/{ChatHistoryPage-DBsNyGYj.js → ChatHistoryPage-BT0mIaDN.js} +1 -1
- package/web/assets/ChatPage-C-hswZf9.js +553 -0
- package/web/assets/ConfigPage-DH2d8YGn.js +5 -0
- package/web/assets/{DesktopWindowControls-DCtIkpTs.js → DesktopWindowControls-Bo5vvIFH.js} +1 -1
- package/web/assets/{FeaturePage-Bkt1wWVg.js → FeaturePage-B3wCvGpC.js} +1 -1
- package/web/assets/{FileAttachmentPreview-Cnmi_2U-.js → FileAttachmentPreview-D8YqjbeC.js} +1 -1
- package/web/assets/{FloatingWidgets-BIJSFz34.js → FloatingWidgets-Dz_T7XWC.js} +1 -1
- package/web/assets/FocusRuntimeControls-hYDoXwg7.js +1 -0
- package/web/assets/{GitDiffViewer-rjt5_KOt.js → GitDiffViewer-CBju_Sj4.js} +3 -3
- package/web/assets/ManageProjectsDialog-Dtb2K7BK.js +1 -0
- package/web/assets/{MarkdownMessage-yl-PSRAz.js → MarkdownMessage-BDztlYIy.js} +1 -1
- package/web/assets/{McpPage-D6GyZCpt.js → McpPage-DQ6AILOH.js} +1 -1
- package/web/assets/MemoryPage-CK4evs_P.js +1 -0
- package/web/assets/{MobileNavigation-DcBH2I9Y.js → MobileNavigation-BICCops3.js} +1 -1
- package/web/assets/MobileViewportStabilizer-uKI4Zp7f.js +1 -0
- package/web/assets/{MorePage-BBfiQbiP.js → MorePage-DuML7bhr.js} +1 -1
- package/web/assets/NewBotDialog--2DSe9Sy.js +1 -0
- package/web/assets/{NewFolderDialog-BinpbTs8.js → NewFolderDialog-S-Qzjzfu.js} +1 -1
- package/web/assets/{PageHeader-D_J-19ni.js → PageHeader-B78dHJed.js} +1 -1
- package/web/assets/{PhoneDrawer-CwxDkWZQ.js → PhoneDrawer-DHRBi4XA.js} +1 -1
- package/web/assets/PhoneMenuButton-BjDV-dPl.js +1 -0
- package/web/assets/PhoneTopBar-BuyzXL4Z.js +1 -0
- package/web/assets/PluginsPage-Cd9bu2AS.js +1 -0
- package/web/assets/{SafeModePrompt-CLyt-z14.js → SafeModePrompt-BnoccbWI.js} +1 -1
- package/web/assets/SchedulesPage-DUhUUQP5.js +1 -0
- package/web/assets/SessionBrowserPane-B3weAiaB.js +2 -0
- package/web/assets/SessionContextPanel-BtxUlk9m.js +2 -0
- package/web/assets/SessionHome-ByiFmH18.js +1 -0
- package/web/assets/SessionInspector-VKOz4Rxs.js +1 -0
- package/web/assets/SessionShell-BsDAwWHd.js +1 -0
- package/web/assets/{SettingsSidebar-IqsOv5h1.js → SettingsSidebar-B-COw6Uw.js} +1 -1
- package/web/assets/{ShortcutHelpDialog-DKDAF94g.js → ShortcutHelpDialog-DquhK-Uh.js} +1 -1
- package/web/assets/{ShortcutKeys-DQFnMnX1.js → ShortcutKeys-BgwCWvNY.js} +1 -1
- package/web/assets/{SidebarUpdateStatus-Cbwy5ii9.js → SidebarUpdateStatus-Ci0ugb91.js} +1 -1
- package/web/assets/{SkillsPage-DTOzYSaS.js → SkillsPage-B46uoO_g.js} +1 -1
- package/web/assets/{TaskProcessesPane-DRFmGkE3.js → TaskProcessesPane-CI_5lWbf.js} +1 -1
- package/web/assets/{TaskTerminalView-DWNACXyI.js → TaskTerminalView-C2acHnAH.js} +1 -1
- package/web/assets/{TerminalPanel-QEt-SRiM.js → TerminalPanel-BAQ2VwKg.js} +1 -1
- package/web/assets/{WebDesktopPet-4CDch3gC.js → WebDesktopPet-D3bdxKPz.js} +1 -1
- package/web/assets/{WorkflowsPage-AMKQBlPo.js → WorkflowsPage-Dp1PRKQb.js} +1 -1
- package/web/assets/WorkspacePicker-BJhBGRH0.js +1 -0
- package/web/assets/accordion-CiJMkjqX.js +1 -0
- package/web/assets/{api-BO7LAPSQ.js → api-CKJOip3Q.js} +1 -1
- package/web/assets/{app-update-DKWPHTUY.js → app-update-yPQVXuw5.js} +1 -1
- package/web/assets/{approval-confirm-ByiI22Wo.js → approval-confirm-Cv754IjO.js} +1 -1
- package/web/assets/board-messages-CIYKjAla.js +1 -0
- package/web/assets/board-projects-wd79Rqt5.js +2 -0
- package/web/assets/channels-messages-KabR1HOR.js +1 -0
- package/web/assets/chat-api-Bvirerdj.js +1 -0
- package/web/assets/{client-store-6GNC8uyK.js → client-store-BaTctJrB.js} +1 -1
- package/web/assets/collapsible-Dcoy-qnz.js +1 -0
- package/web/assets/config-search-KYVClDpx.js +1 -0
- package/web/assets/{dialog-CUhFgsVd.js → dialog-Cb_sjjQV.js} +1 -1
- package/web/assets/{collapsible-DMaUQRX4.js → dist-DUSSw9eQ.js} +1 -1
- package/web/assets/events-CZTn9wa-.js +1 -0
- package/web/assets/file-diff-GxOMJkLj.js +1 -0
- package/web/assets/folder-paths--euvEC5U.js +1 -0
- package/web/assets/{hosts-1yQREdMi.js → hosts-BRPznOHU.js} +1 -1
- package/web/assets/i18n-DEs6BBob.js +1 -0
- package/web/assets/{index-CsE52ydO.js → index-C5aKcTGw.js} +2 -2
- package/web/assets/index-DD2H2OOC.css +2 -0
- package/web/assets/message-circle-question-mark-D7ehy_mi.js +1 -0
- package/web/assets/{mobile-remote-fallback-NJCTBu85.js → mobile-remote-fallback-DG_urwIg.js} +1 -1
- package/web/assets/mount-app-BdXRP9D-.js +9 -0
- package/web/assets/navigation-DkcKi1_5.js +1 -0
- package/web/assets/new-task-uLEgjs2Z.js +1 -0
- package/web/assets/{palette-navigation-ByC1_QS5.js → palette-navigation-HbVGltCo.js} +1 -1
- package/web/assets/{permission-rules-api-BoJ_1W-m.js → permission-rules-api-C9oRUm6Z.js} +1 -1
- package/web/assets/{pick-system-directory-B_RJmP26.js → pick-system-directory-B__qKy-X.js} +1 -1
- package/web/assets/placements-Bn0vPyEI.js +2 -0
- package/web/assets/{popover--UmYQ9yB.js → popover-CiVxYUEU.js} +1 -1
- package/web/assets/public-9meoHs0K.js +4 -0
- package/web/assets/public-D6X148yH.js +2 -0
- package/web/assets/public-DenVz3gW.js +2 -0
- package/web/assets/{public-components-DYGekkA7.js → public-components-BfHcj0Pn.js} +1 -1
- package/web/assets/public-diff-BqcNo4lt.js +1 -0
- package/web/assets/public-events-DCyxz5zX.js +1 -0
- package/web/assets/public-flags-BOI2nkm4.js +1 -0
- package/web/assets/public-launch-D0t4Hqf5.js +1 -0
- package/web/assets/public-sidebar-CdxAohEH.js +1 -0
- package/web/assets/react-bits-BsPlLi8F.css +1 -0
- package/web/assets/routes-DIeaqWVc.js +1 -0
- package/web/assets/runtime-capabilities-CHYOF_hE.js +1 -0
- package/web/assets/{runtime-capabilities-store-C2Qv7uDP.js → runtime-capabilities-store-D2d_9z0D.js} +1 -1
- package/web/assets/{safe-mode-instance-BiAPYJ2-.js → safe-mode-instance-hnF1BJYr.js} +1 -1
- package/web/assets/safe-mode-sentinel-CPmhLLXT.js +1 -0
- package/web/assets/{session-change-summary-api-DgRT32uh.js → session-change-summary-api-DmmNGbP7.js} +1 -1
- package/web/assets/{session-home-BktP6sGF.js → session-home-BAFT2Fk1.js} +1 -1
- package/web/assets/{session-organization-api-DFu3Chto.js → session-organization-api-Bs8DdxU1.js} +1 -1
- package/web/assets/{session-scope-DQPNgQMm.js → session-scope-XRVRtwow.js} +1 -1
- package/web/assets/{session-tree-actions-DfO8QHBO.js → session-tree-actions-Dzj7hrvM.js} +1 -1
- package/web/assets/{session-tree-summary-BwYRdui2.js → session-tree-summary-BXVKYODc.js} +1 -1
- package/web/assets/settings-navigation-DiP_AM1C.js +1 -0
- package/web/assets/{shortcuts-Cvp9WD9O.js → shortcuts-IA6Uq_O6.js} +1 -1
- package/web/assets/side-chat-context-CZ4IqNxt.js +7 -0
- package/web/assets/sidebar-Do_8-Hyh.js +2 -0
- package/web/assets/sidebar-store-DuRlD5qg.js +1 -0
- package/web/assets/{speech-session-DK_09Wky.js → speech-session-D_W5Ulli.js} +1 -1
- package/web/assets/{startup-queries-6Oztqpto.js → startup-queries-DeNu46nT.js} +1 -1
- package/web/assets/storage-DH3bQdy6.js +1 -0
- package/web/assets/tool-labels-ghvpPFmc.js +1 -0
- package/web/assets/{use-i18n-B5p-Kzvz.js → use-i18n-CUS2_EGy.js} +1 -1
- package/web/assets/use-mobile-C2tPBAza.js +1 -0
- package/web/assets/use-studio-actions-CYnwfaOn.js +3 -0
- package/web/assets/useNewProjectPicker-CacWA0IS.js +1 -0
- package/web/assets/usePhoneShell-cYrS53S8.js +1 -0
- package/web/assets/useSessionRowActions-DtunSg_Q.js +1 -0
- package/web/assets/useSidebarModel-6sqN4VA5.js +1 -0
- package/web/assets/web-preview-Dgng80ZD.js +1 -0
- package/web/assets/{web-preview-events-DQchQHt3.js → web-preview-events-JGegs4uF.js} +1 -1
- package/web/assets/workflow-messages-Cj35aJZc.js +1 -0
- package/web/assets/workspace-order-store-BuPmheRT.js +1 -0
- package/web/index.html +2 -2
- package/web/assets/BoardPage-vwv5vTDm.js +0 -3
- package/web/assets/ChannelsPage-L-wcVDSN.js +0 -1
- package/web/assets/ChatPage-DS0euFxR.js +0 -553
- package/web/assets/ConfigPage-pOzONr8e.js +0 -5
- package/web/assets/DispatchOverlay-n-qbkOP-.js +0 -1
- package/web/assets/FocusRuntimeControls-C7NIdpV4.js +0 -1
- package/web/assets/LaunchConsole-DtxzpXJo.js +0 -3
- package/web/assets/ManageProjectsDialog-RiFg3h1p.js +0 -1
- package/web/assets/MemoryPage-Dsx_6JpI.js +0 -1
- package/web/assets/MobileViewportStabilizer-OtwVmIPm.js +0 -1
- package/web/assets/PhoneMenuButton-B0AwvqEo.js +0 -1
- package/web/assets/PhoneTopBar-Dw0mIaWC.js +0 -1
- package/web/assets/PluginsPage-BzxPAX26.js +0 -1
- package/web/assets/QuickPromptIdeas-Cd3SwBqS.js +0 -1
- package/web/assets/SchedulesPage-Cbgl5v_8.js +0 -1
- package/web/assets/SessionBrowserPane-CB7jn-MS.js +0 -2
- package/web/assets/SessionContextPanel-CNmAp0ed.js +0 -2
- package/web/assets/SessionHome-Ck_daJT0.js +0 -1
- package/web/assets/SessionInspector-cSzwsc4b.js +0 -1
- package/web/assets/SessionShell-BOZ7h0yz.js +0 -1
- package/web/assets/WorkspacePicker-B9vYtfab.js +0 -1
- package/web/assets/board-launch-BmmPYZe8.js +0 -1
- package/web/assets/board-messages-BOWWyhz_.js +0 -1
- package/web/assets/board-projects-BU9fZB1q.js +0 -1
- package/web/assets/channels-messages-DazltGVm.js +0 -1
- package/web/assets/chat-api-DkdyVQY9.js +0 -1
- package/web/assets/config-search-HBKDuym0.js +0 -1
- package/web/assets/events-DrAPv0se.js +0 -1
- package/web/assets/file-text-N9JICX6E.js +0 -1
- package/web/assets/folder-paths-DQTpuGh9.js +0 -1
- package/web/assets/i18n-CHmr7GzM.js +0 -1
- package/web/assets/index-CfTBR7Rs.css +0 -2
- package/web/assets/list-checks-B5Jl4aiO.js +0 -1
- package/web/assets/mount-app-DfSFF0xv.js +0 -9
- package/web/assets/navigation-EoDz3gT8.js +0 -1
- package/web/assets/new-task-C3wuHTor.js +0 -1
- package/web/assets/placements-CqwqXPTp.js +0 -2
- package/web/assets/public-diff-DK-VNIar.js +0 -1
- package/web/assets/public-fqyTjQ0F.js +0 -2
- package/web/assets/public-jQjEc6OO.js +0 -1
- package/web/assets/public-launch-CT_m9KWo.js +0 -1
- package/web/assets/react-bits-DQli9s7O.css +0 -1
- package/web/assets/routes-Da0OHSy6.js +0 -1
- package/web/assets/runtime-capabilities-4_ZwLBqF.js +0 -1
- package/web/assets/safe-mode-sentinel-Ccu3Vmta.js +0 -1
- package/web/assets/session-workspaces-BWTBYaGT.js +0 -1
- package/web/assets/settings-navigation-_yUm71Uk.js +0 -1
- package/web/assets/shield-B1ruzHd0.js +0 -1
- package/web/assets/side-chat-context-BfOm4dFp.js +0 -7
- package/web/assets/sidebar-BLeRyb55.js +0 -2
- package/web/assets/sidebar-commands-ZA1UOA_F.js +0 -1
- package/web/assets/sidebar-store-1-aNPlDu.js +0 -1
- package/web/assets/storage-BY6wEHPw.js +0 -1
- package/web/assets/tool-labels-BUEvdohv.js +0 -1
- package/web/assets/use-mobile-DauOEda6.js +0 -1
- package/web/assets/use-studio-actions-D6c_pSJK.js +0 -3
- package/web/assets/useBoardItems-CzEbgTLJ.js +0 -1
- package/web/assets/useFleetSystemInfo-Bd8zJIFa.js +0 -1
- package/web/assets/useNewProjectPicker-DQY1X_ua.js +0 -1
- package/web/assets/useNow-Bxn4_OW9.js +0 -1
- package/web/assets/usePagePrimaryAction-CWPC0C_f.js +0 -1
- package/web/assets/usePhoneShell-Bvb7m-m4.js +0 -1
- package/web/assets/useSessionListQuery-D44XZfGr.js +0 -2
- package/web/assets/useSessionRowActions-Cr6SUAeE.js +0 -1
- package/web/assets/useSidebarModel-CWED0rsw.js +0 -1
- package/web/assets/wand-sparkles-CvEBNUFz.js +0 -1
- package/web/assets/web-preview-CqwSe9Zn.js +0 -1
- package/web/assets/workflow-messages-CMCQrs5q.js +0 -1
- package/web/assets/workspace-order-store-RYWvGOeR.js +0 -1
- /package/web/assets/{AnimatedList-D8fxDNGr.js → AnimatedList-DB5vqafO.js} +0 -0
- /package/web/assets/{ClickSpark-DmnEAJNI.js → ClickSpark-B1Rn7ZwL.js} +0 -0
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/AnimatedList-D8fxDNGr.js","assets/rolldown-runtime-B0Z9INg1.js","assets/vendor-react-DwNgTV1j.js","assets/utils-C8uzG5AZ.js","assets/vendor-ui-DvrYggeS.js","assets/vendor-motion-DSW3wzXK.js","assets/react-bits-DQli9s7O.css","assets/ClickSpark-DmnEAJNI.js","assets/approval-confirm-ByiI22Wo.js","assets/use-i18n-B5p-Kzvz.js","assets/i18n-CHmr7GzM.js","assets/vendor-router-CSN_DGvx.js","assets/index-CsE52ydO.js","assets/index-CfTBR7Rs.css","assets/storage-BY6wEHPw.js","assets/vendor-state-GkUciC5H.js","assets/shield-alert-oZqX6MNu.js","assets/createLucideIcon-Cd-3GVxJ.js","assets/button-CCcCN8tE.js","assets/dist-41X0pdUs.js","assets/kbd-CAufZTkl.js","assets/sheet-BTaIEX4w.js","assets/x-07u4-129.js","assets/dist-BHkR6BLP.js","assets/dist-BsRXXcSL.js","assets/es2015-DTZdOI9P.js","assets/card-presentation-1oph2b8P.js","assets/session-board-status-D2lpFPiI.js","assets/dialog-CUhFgsVd.js","assets/HoldToConfirmButton-BxdJ7icc.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{h as t}from"./vendor-router-CSN_DGvx.js";import{i as n,n as r,r as i}from"./vendor-react-DwNgTV1j.js";import{f as a}from"./routes-Da0OHSy6.js";import{r as o}from"./i18n-CHmr7GzM.js";import{t as s}from"./use-i18n-B5p-Kzvz.js";import{o as c}from"./vendor-state-GkUciC5H.js";import{a as l}from"./session-board-status-D2lpFPiI.js";import{t as u}from"./usePhoneShell-Bvb7m-m4.js";import{t as d}from"./createLucideIcon-Cd-3GVxJ.js";import{a as f,i as p,n as m,t as h}from"./permission-rules-api-BoJ_1W-m.js";import{t as g}from"./arrow-down-CDGua-ue.js";import{t as _}from"./check-2vYc6QaP.js";import{t as v}from"./chevron-down-CxtxIjiP.js";import{t as y}from"./chevron-left-BAtyp3_6.js";import{t as b}from"./chevron-right-C3t2Rckj.js";import{t as x}from"./chevron-up-D_ZcXjqr.js";import{t as S}from"./copy-DHmIFc52.js";import{t as C}from"./download-BCfIiuaL.js";import{t as w}from"./ellipsis-CfGKfbq6.js";import{t as T}from"./eye-uWAPXNzJ.js";import{a as E,o as D,t as O}from"./GitDiffViewer-rjt5_KOt.js";import{t as k}from"./file-Bllajneu.js";import{t as A}from"./folder-open-FIShC5Qk.js";import{t as j}from"./info-DATxy0fb.js";import{t as M}from"./loader-circle-BOwQzHB-.js";import{t as N}from"./monitor-ORxecA9m.js";import{t as P}from"./refresh-cw-TbWxTY4K.js";import{t as F}from"./rotate-ccw-clock-CO6Bw-sF.js";import{t as I}from"./rotate-ccw-C0v8V77_.js";import{t as L}from"./shield-alert-oZqX6MNu.js";import{t as R}from"./shield-check-Gvek4RJ7.js";import{t as z}from"./tag-CqkeJlBf.js";import{t as B}from"./trash-2-CNrPOoPR.js";import{t as V}from"./x-07u4-129.js";import{n as H,r as ee,t as U}from"./collapsible-DMaUQRX4.js";import{i as W,p as G,r as te,t as ne}from"./dropdown-menu-CFIFNaKO.js";import{i as K,n as re,r as ie,t as ae}from"./popover--UmYQ9yB.js";import{i as oe,n as se,t as ce}from"./tooltip-D4MFbqcG.js";import{t as q}from"./utils-C8uzG5AZ.js";import{n as le,t as J}from"./button-CCcCN8tE.js";import{a as ue,d as de,m as fe,o as pe,v as me}from"./events-DrAPv0se.js";import{a as he,c as ge,g as _e,n as ve}from"./shortcuts-Cvp9WD9O.js";import{t as Y}from"./chat-api-DkdyVQY9.js";import{r as ye}from"./format-DMJQzoZ7.js";import{r as be}from"./PageState-Cz6vFMXv.js";import{t as xe}from"./input-CPw-zkYh.js";import{d as Se,f as Ce,l as we,m as Te,n as Ee,p as De,r as Oe,s as ke,t as Ae}from"./run-activity-CwfO0cui.js";import{t as je}from"./alert-firawb0H.js";import{t as Me}from"./vendor-motion-DSW3wzXK.js";import{i as Ne,n as Pe,r as Fe,t as Ie}from"./MarkdownMessage-yl-PSRAz.js";import{t as Le}from"./route-context-DvWDul4T.js";import{t as Re}from"./esm-DCV8yILT.js";import{t as ze}from"./StatusGlyph-1KgitlUg.js";import{t as Be}from"./motion-DTR4ZVle.js";import{t as Ve}from"./HoldToConfirmButton-BxdJ7icc.js";import{t as He}from"./card-C3A0b5KR.js";import{t as Ue}from"./BrandLogo-k3CvJjd4.js";import{a as We,o as Ge,r as Ke,t as qe}from"./session-tree-summary-BwYRdui2.js";import{t as Je}from"./FileAttachmentPreview-Cnmi_2U-.js";var Ye=d(`files`,[[`path`,{d:`M15 2h-4a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V8`,key:`14sh0y`}],[`path`,{d:`M16.706 2.706A2.4 2.4 0 0 0 15 2v5a1 1 0 0 0 1 1h5a2.4 2.4 0 0 0-.706-1.706z`,key:`1970lx`}],[`path`,{d:`M5 7a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 1.732-1`,key:`l4dndm`}]]),Xe=d(`git-fork`,[[`circle`,{cx:`12`,cy:`18`,r:`3`,key:`1mpf1b`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`path`,{d:`M18 9v2c0 .6-.4 1-1 1H7c-.6 0-1-.4-1-1V9`,key:`1uq4wg`}],[`path`,{d:`M12 12v3`,key:`158kv8`}]]),Ze=d(`lightbulb`,[[`path`,{d:`M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5`,key:`1gvzjb`}],[`path`,{d:`M9 18h6`,key:`x1upvd`}],[`path`,{d:`M10 22h4`,key:`ceow96`}]]),Qe=d(`list-todo`,[[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`rect`,{x:`3`,y:`4`,width:`6`,height:`6`,rx:`1`,key:`cif1o7`}]]),$e=d(`message-square-plus`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}],[`path`,{d:`M12 8v6`,key:`1ib9pf`}],[`path`,{d:`M9 11h6`,key:`1fldmi`}]]),et=d(`undo-2`,[[`path`,{d:`M9 14 4 9l5-5`,key:`102s5s`}],[`path`,{d:`M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11`,key:`f3b9sd`}]]),tt=d(`user`,[[`path`,{d:`M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2`,key:`975kel`}],[`circle`,{cx:`12`,cy:`7`,r:`4`,key:`17ys0d`}]]),X=e(n(),1),nt=Object.freeze({messages:[],tools:[],approvals:[],questions:[],agents:[],team:null,currentActivity:null,activityFeed:[],lifecycle:null,sessionTreeRevision:0,thinkingText:``,queuedInputs:[],hadQueuedInput:!1,plan:null,executionMode:null,runMode:null,contextUsage:null,sessionUsage:null,promptCache:null,compaction:null,streaming:!1,error:``,loaded:!1,messageStart:null,hasOlder:!1,olderCursor:null});function rt(e,t){if(e===t)return!1;if(!e||!t)return!0;let n=new Set([...Object.keys(e),...Object.keys(t)]);for(let r of n)if(e[r]!==t[r])return!0;return!1}function it(e,t){let n=e||nt,r=typeof t==`function`?t(n):{...n,...t};return rt(n,r)?r:n}function at(e,t){return t===void 0?e||[]:Array.isArray(t)?t:[]}function ot(e,t){return Number.isSafeInteger(e.queueRevision)&&Number.isSafeInteger(t.queueRevision)&&t.queueRevision<e.queueRevision}function st(e,t){let n=t.removedInputId?[...new Set([...e.withdrawnInputIds||[],t.removedInputId])]:e.withdrawnInputIds||[],r=new Set(n),i=r.size?e.messages.filter(e=>!r.has(e.queuedInputId)):e.messages;if(ot(e,t))return{...e,messages:i,withdrawnInputIds:n};let a=at(e.queuedInputs,t.queuedInputs);return{...e,messages:i,withdrawnInputIds:n,queuedInputs:r.size?a.filter(e=>!r.has(e.id)):a,...Number.isSafeInteger(t.queueRevision)?{queueRevision:t.queueRevision}:{},hadQueuedInput:!!(e.hadQueuedInput||a.length)}}function ct(e=[],t){let n=Array.isArray(e)?e:[],r=-1;for(let e=n.length-1;e>=0;--e)if(n[e]?.role===`agent`){r=e;break}return r<0?[...n,t]:[...n.slice(0,r),t,...n.slice(r)]}function lt(e){return!!(e?.streaming||e?.recovering||e?.pendingRuntimeSelection||e?.switchingModel||e?.switchingThinking||e?.agents?.some(e=>[`queued`,`starting`,`running`].includes(e.status)))}function ut(e){return!!(e&&(e.streaming||String(e.thinkingText||``).trim()||e.tools?.length||e.currentActivity?.type===`agent`||e.activityFeed?.some(e=>e.type===`agent`)||e.team))}function dt(e,t,n){return t&&ut(n)?n:ut(e.runActivity)?e.runActivity:null}function ft(e,t){if(e&&(e.loaded||e.streaming||De(e)!==void 0))return Te(e,null);let n=De(t);return n===void 0?Te(e,null):n}function pt(e,t={}){return!!e?.items?.length}var Z=i(),mt=e(r(),1);function ht(e,t){return!!(t.sessionId&&e?.sessionId===t.sessionId&&e.streaming&&!e.completed&&!t.streaming&&t.completed&&e.runStartedAt&&Number.isFinite(Date.parse(e.runStartedAt))&&e.runStartedAt===t.runStartedAt)}function gt(e,t,n=[]){if(!ht(e,t))return!1;let r=Date.parse(t.runStartedAt||``);return Number.isFinite(r)?n.some(e=>{let t=Date.parse(e.changedAt);return e.reverted||!Number.isFinite(t)||t<r?!1:e.added>0||e.removed>0||e.status===`created`||e.status===`deleted`||!e.snapshot&&e.pending}):!1}function _t(e,t){let n=Math.min(400,t-280-8),r=Math.max(280,Math.min(720,t-n-8));return Math.min(r,vt(e))}function vt(e){return typeof e!=`number`||!Number.isFinite(e)?360:Math.min(720,Math.max(280,Math.round(e)))}var yt=new Set([`changes`,`files`,`plan`,`processes`,`sources`,`side-chat`]);function bt(e,t,n=``){return{id:e,kind:t,resourceId:n,draft:``,url:``,view:{reading:{},expandedFiles:[],expandedProcesses:[],processFollow:{},processScroll:{},query:``,filter:``,selectedSourceId:``,follow:!0}}}function xt(e){return{pages:e?[bt(`page-1`,e)]:[],activeId:e?`page-1`:``,nextId:e?2:1,contentOpen:!1,summaryOpen:!1,contentWidth:null,conversationScrollTop:null}}function St(e,t){if(t.type===`workspace`)return{...e,...t.contentWidth===void 0?{}:{contentWidth:vt(t.contentWidth)},...t.contentOpen===void 0?{}:{contentOpen:t.contentOpen&&e.pages.length>0},...t.summaryOpen===void 0?{}:{summaryOpen:t.summaryOpen},...t.conversationScrollTop!==void 0&&Number.isFinite(t.conversationScrollTop)?{conversationScrollTop:Math.max(0,t.conversationScrollTop)}:{}};if(t.type===`add`||t.type===`open`||t.type===`kind`){let n=t.type===`kind`?t.id:t.type===`open`?t.replaceId:void 0,r=e.pages.find(e=>e.id===n);if(t.type===`kind`&&!r)return e;let i=`resourceId`in t&&t.resourceId||``,a=e.pages.find(e=>e.id!==n&&e.kind===t.kind&&e.resourceId===i&&(yt.has(t.kind)||!!i));if(a){let t=r?.kind===`new`?e.pages.filter(e=>e.id!==n):e.pages;return{...e,pages:t,activeId:a.id,contentOpen:!0,summaryOpen:!1}}if(!r&&e.pages.length>=12)return e;let o=bt(r?.id||`page-${e.nextId}`,t.kind,i);return{...e,pages:r?e.pages.map(e=>e.id===o.id?o:e):[...e.pages,o],activeId:o.id,nextId:e.nextId+ +!r,contentOpen:!0,summaryOpen:!1}}let n=e.pages.findIndex(e=>e.id===t.id);if(n<0)return e;if(t.type===`select`)return{...e,activeId:t.id,contentOpen:!0};if(t.type===`close`){let r=e.pages.filter(e=>e.id!==t.id);return{...e,pages:r,activeId:e.activeId===t.id?r[Math.min(n,r.length-1)]?.id||``:e.activeId,contentOpen:r.length>0&&e.contentOpen}}return{...e,pages:e.pages.map(e=>e.id===t.id?t.type===`resource`?{...e,resourceId:t.resourceId}:t.type===`view`?{...e,view:{...e.view,...t.patch,reading:{...e.view.reading,...t.patch.reading}}}:{...e,...t.draft===void 0?{}:{draft:t.draft},...t.url===void 0?{}:{url:t.url}}:e)}}var Ct=c(e=>({sessions:{},update:(t,n,r)=>{let i=`unchanged`;return t&&e(e=>{let a=Object.prototype.hasOwnProperty.call(e.sessions,t)?e.sessions[t]:xt(`id`in r?n:void 0),o=St(a,r);return o===a?((r.type===`add`||r.type===`open`)&&a.pages.length>=12&&(i=`limit`),e):(i=`updated`,{sessions:{...e.sessions,[t]:o}})}),i},forget:t=>e(e=>{let n={...e.sessions};return delete n[t],{sessions:n}})})),wt=(0,X.createContext)(null);function Tt(e,t,n=!1){let r=Object.fromEntries(E(e).filter(e=>e.hunks.length>0).map(e=>{let t=0,n=0;for(let r of e.hunks)for(let e of r.rows)e.kind===`pair`&&(e.next.tone===`added`&&t++,e.old.tone===`deleted`&&n++);return[e.path,{added:t,removed:n}]}));return{added:Object.values(r).reduce((e,t)=>e+t.added,0),removed:Object.values(r).reduce((e,t)=>e+t.removed,0),partial:n||t.some(e=>!Object.hasOwn(r,e)),files:r}}var Et=(0,X.createContext)(null),Dt=(0,X.createContext)(null),Ot=(0,X.createContext)(null);function kt({error:e,title:t,pending:n=!1,onRetry:r,className:i}){let{t:a}=s(),[o,c]=(0,X.useState)(!1),[l,u]=(0,X.useState)(!1);return(0,Z.jsx)(je,{role:`group`,className:q(`min-w-0 rounded-md border-stroke bg-surface-subtle px-3 py-2 text-content-secondary`,i),children:(0,Z.jsxs)(U,{open:o,onOpenChange:c,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:[(0,Z.jsxs)(`div`,{role:`status`,className:`flex min-w-0 flex-1 items-center gap-2 text-[13px]`,children:[n?(0,Z.jsx)(le,{className:`size-4`}):(0,Z.jsx)(j,{"aria-hidden":`true`,className:`size-4 shrink-0 text-content-muted`}),(0,Z.jsx)(`span`,{children:t||a(`chat:requestNotice.incomplete`)})]}),r&&(0,Z.jsxs)(J,{type:`button`,variant:`ghost`,size:`sm`,className:`h-7 shrink-0 gap-1 px-2 text-xs text-content-secondary max-[650px]:min-h-11 pointer-coarse:min-h-11`,disabled:n||l,onClick:async()=>{if(!l){u(!0);try{await r()}catch{}finally{u(!1)}}},children:[(0,Z.jsx)(I,{"aria-hidden":`true`,className:q(`size-3.5`,l&&`animate-spin`)}),a(`chat:chatMessage.retry`)]}),e&&(0,Z.jsx)(ee,{asChild:!0,children:(0,Z.jsxs)(J,{type:`button`,variant:`ghost`,size:`sm`,className:`h-7 shrink-0 gap-1 px-2 text-xs text-content-muted max-[650px]:min-h-11 pointer-coarse:min-h-11`,children:[a(o?`chat:requestNotice.hideDetails`:`chat:requestNotice.showDetails`),(0,Z.jsx)(v,{"aria-hidden":`true`,className:q(`size-3 transition-transform`,o&&`rotate-180`)})]})})]}),(0,Z.jsx)(H,{children:(0,Z.jsx)(`pre`,{tabIndex:0,"aria-label":a(`chat:requestNotice.details`),className:`mt-2 max-h-48 overflow-auto rounded-sm border border-stroke-soft bg-code p-[8px_10px] font-mono text-[12px] leading-[1.6] whitespace-pre-wrap text-content-soft [overflow-wrap:anywhere] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus`,children:e})})]})})}function At(e,{threshold:t=64,onUnreadChange:n,requestFrame:r=e=>requestAnimationFrame(e),cancelFrame:i=e=>cancelAnimationFrame(e),reducedMotion:a}){let o=e.ownerDocument,s=o.defaultView?.matchMedia?.(`(prefers-reduced-motion: reduce)`),c=a||(()=>{let e=o.documentElement.dataset.motion;return e===`reduced`||e!==`full`&&!!s?.matches}),l=!0,u=!1,d=!1,f=null,p=null,m=null,h=e.scrollTop,g=!1,_=!1,v=null,y=()=>Math.max(0,e.scrollHeight-e.clientHeight),b=()=>_||v!==null,x=()=>h-e.scrollTop>Math.max(t,e.clientHeight/2)&&y()-e.scrollTop>t,S=e=>{u!==e&&(u=e,n(e))},C=()=>{p!==null&&i(p),p=null},w=()=>{f!==null&&i(f),f=null,m=null,C(),g=!1,h=e.scrollTop},T=()=>{C(),g=!0},E=()=>{C(),p=r(()=>{p=r(()=>{if(p=null,x()){A();return}if(l&&!b()&&Math.abs(y()-e.scrollTop)>1){k();return}g=!1,h=e.scrollTop})})},D=t=>{e.scrollTo({top:t,behavior:`instant`}),h=e.scrollTop},O=t=>{if(f=null,d||!l||b())return;if(x()){A();return}let n=y(),i=n-e.scrollTop,a=m===null?1e3/60:Math.min(64,t-m);m=t;let o=1-.85**(Math.max(0,a)/(1e3/60));if(c()||Math.abs(i)<=1){i!==0&&D(n),m=null,E();return}D(e.scrollTop+Math.sign(i)*Math.min(Math.abs(i),Math.max(1,Math.abs(i)*o))),f=r(O)},k=()=>{d||!l||b()||(T(),f===null&&(f=r(O)))},A=()=>{d||(l=!1,w())},j=()=>{l=!0,S(!1),k()},M=()=>{if(d)return;if(g){x()&&A();return}let n=e.scrollTop-h;h=e.scrollTop,n<-.5&&y()-e.scrollTop>1?A():n>.5&&y()-e.scrollTop<=t&&j()},N=t=>{t.ctrlKey||Math.abs(t.deltaX)>Math.abs(t.deltaY)||(t.deltaY<0?A():t.deltaY>0&&y()-e.scrollTop<=1&&j())},P=e=>{let t=e.touches[0];t&&(v={x:t.clientX,y:t.clientY},w())},F=e=>{let t=e.touches[0];if(!t||!v)return;let n=t.clientX-v.x,r=t.clientY-v.y;Math.abs(r)<2||(r>0&&r>Math.abs(n)&&A(),v={x:t.clientX,y:t.clientY})},I=()=>{v=null,k()},L=e=>{e.pointerType===`touch`||e.button>1||(_=!0,w())},R=()=>{_&&(_=!1,k())},z=e=>{let t=e.target;e.defaultPrevented||t?.closest?.(`input, textarea, select, [contenteditable]`)||(e.key===`ArrowUp`||e.key===`PageUp`||e.key===`Home`||e.key===` `&&e.shiftKey)&&A()};e.addEventListener(`scroll`,M,{passive:!0}),e.addEventListener(`wheel`,N,{passive:!0}),e.addEventListener(`touchstart`,P,{passive:!0}),e.addEventListener(`touchmove`,F,{passive:!0}),e.addEventListener(`touchend`,I,{passive:!0}),e.addEventListener(`touchcancel`,I,{passive:!0}),e.addEventListener(`pointerdown`,L,{passive:!0}),e.addEventListener(`keydown`,z),o.addEventListener(`pointerup`,R,{passive:!0}),o.addEventListener(`pointercancel`,R,{passive:!0}),s?.addEventListener?.(`change`,k);let B=typeof ResizeObserver>`u`?null:new ResizeObserver(k);return B?.observe(e),{maintainBottom:k,pauseFollowing:A,restorePosition(e){d||!Number.isFinite(e)||(A(),S(!1),D(Math.max(0,e)))},contentChanged(){d||(l?k():S(!0))},scrollToBottom(e=`auto`){d||(w(),l=!0,S(!1),e===`smooth`?k():(T(),D(y()),E()))},dispose(){d=!0,w(),B?.disconnect(),e.removeEventListener(`scroll`,M),e.removeEventListener(`wheel`,N),e.removeEventListener(`touchstart`,P),e.removeEventListener(`touchmove`,F),e.removeEventListener(`touchend`,I),e.removeEventListener(`touchcancel`,I),e.removeEventListener(`pointerdown`,L),e.removeEventListener(`keydown`,z),o.removeEventListener(`pointerup`,R),o.removeEventListener(`pointercancel`,R),s?.removeEventListener?.(`change`,k)}}}function jt(e,{threshold:t=64,resetKey:n,readInitialPosition:r}={}){let i=(0,X.useRef)(r);i.current=r;let a=(0,X.useRef)(null),[o,s]=(0,X.useState)(null),[c,l]=(0,X.useState)(!1),u=(0,X.useRef)(null),d=(0,X.useCallback)(e=>{a.current=e,s(e)},[]);return(0,X.useLayoutEffect)(()=>{if(!o)return;let e=At(o,{threshold:t,onUnreadChange:l});u.current=e,l(!1);let n=i.current?.();return typeof n==`number`?e.restorePosition(n):e.scrollToBottom(),()=>{e.dispose(),u.current=null}},[n,o,t]),(0,X.useEffect)(()=>{u.current?.contentChanged()},[e]),{scrollRef:a,scrollElement:o,setScrollRef:d,hasUnread:c,scrollToBottom:(0,X.useCallback)((e=`auto`)=>{u.current?.scrollToBottom(e)},[]),maintainBottom:(0,X.useCallback)(()=>{u.current?.maintainBottom()},[]),pauseFollowing:(0,X.useCallback)(()=>{u.current?.pauseFollowing()},[])}}function Mt(e){let t=e.runActivity,n=t?.activityFeed,r=t?.tools;return Array.isArray(n)&&n.length?n.length:Array.isArray(r)?r.length:0}function Nt(e){return String(e||``).split(`
|
|
3
|
-
`).map(e=>e.trim()).find(Boolean)||``}function Pt(e,{turnsKnown:t}){let n=-1;for(let t=e.length-1;t>=0;--t)if(e[t]?.role===`user`){n=t;break}if(n<=0)return null;let r=-1,i=0;for(let t=0;t<n;t+=1)e[t]?.role===`user`&&(r=t,i+=1);let a=0,o=!1;for(let t=Math.max(0,r);t<n;t+=1){let n=e[t];n?.role===`agent`&&(a+=Mt(n),o=!!n.error)}return{latestIndex:n,turnBase:i,previous:{turn:t&&r>=0?i:null,text:r>=0?Nt(e[r]?.text):``,operations:a,failed:o}}}function Ft({text:e,copyLabel:t,getText:n}){let{t:r}=s(),[i,a]=(0,X.useState)(`idle`),o=(0,X.useRef)(0),c=(0,X.useRef)(null);(0,X.useEffect)(()=>(a(`idle`),()=>{o.current+=1,c.current!==null&&clearTimeout(c.current)}),[e]);let l=async()=>{if(i===`pending`||i===`copied`)return;let t=++o.current;c.current!==null&&clearTimeout(c.current),a(`pending`);try{if(await navigator.clipboard.writeText(n?.()||e),t!==o.current)return;a(`copied`),c.current=setTimeout(()=>a(`idle`),1800)}catch{t===o.current&&a(`failed`)}},u=i===`copied`?r(`common:markdownMessage.copied`):t??r(`chat:chatMessage.copyReply`);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(ce,{children:[(0,Z.jsx)(oe,{asChild:!0,children:(0,Z.jsx)(J,{type:`button`,variant:`ghost`,size:`icon`,disabledMode:`focusable`,"aria-label":u,"aria-busy":i===`pending`||void 0,"aria-disabled":i===`pending`||i===`copied`||void 0,onClick:i===`copied`||i===`pending`?void 0:()=>void l(),children:i===`copied`?(0,Z.jsx)(_,{size:16,className:`text-success`}):i===`pending`?(0,Z.jsx)(M,{size:16,className:`animate-spin`}):(0,Z.jsx)(S,{size:16})})}),(0,Z.jsx)(se,{children:u})]}),(0,Z.jsx)(`span`,{role:`status`,className:i===`failed`?`order-last basis-full text-xs text-destructive`:`sr-only`,children:i===`failed`?r(`chat:chatMessage.copyReplyFailed`):i===`copied`?r(`common:markdownMessage.copied`):``})]})}var It=new Map,Lt=e=>{let t=It.get(e);return t||(t=Me.create(e),It.set(e,t)),t};(0,X.memo)(({children:e,as:t=`p`,className:n,duration:r=2,spread:i=2})=>{let a=Lt(t),o=(0,X.useMemo)(()=>(e?.length??0)*i,[e,i]);return(0,Z.jsx)(a,{animate:{backgroundPosition:`0% center`},className:q(`relative inline-block bg-[length:250%_100%,auto] bg-clip-text text-transparent`,`[--bg:linear-gradient(90deg,#0000_calc(50%-var(--spread)),var(--color-background),#0000_calc(50%+var(--spread)))] [background-repeat:no-repeat,padding-box]`,n),initial:{backgroundPosition:`100% center`},style:{"--spread":`${o}px`,backgroundImage:`var(--bg), linear-gradient(var(--color-muted-foreground), var(--color-muted-foreground))`},transition:{duration:r,ease:`linear`,repeat:1/0},children:e})});var Rt=(0,X.createContext)(null),zt=({className:e,isStreaming:t=!1,children:n,...r})=>{let i=(0,X.useMemo)(()=>({isStreaming:t}),[t]);return(0,Z.jsx)(Rt.Provider,{value:i,children:(0,Z.jsx)(U,{asChild:!0,"data-slot":`plan`,...r,children:(0,Z.jsx)(He,{className:q(`shadow-none`,e),children:n})})})},Bt=({defaultOpen:e=!0,className:t,...n})=>(0,Z.jsx)(U,{className:q(t),defaultOpen:e,...n}),Vt=4e3,Ht=`… earlier output omitted …`;function Ut(e){let t=String(e||``),n=``;for(let e=0;e<t.length;e+=1){let r=t.charCodeAt(e);if(r===27){let n=t.charCodeAt(e+1);if(n===91)for(e+=2;e<t.length&&t.charCodeAt(e)<64;)e+=1;else if(n===93)for(e+=2;e<t.length;){let n=t.charCodeAt(e);if(n===7)break;if(n===27&&t.charCodeAt(e+1)===92){e+=1;break}e+=1}else e+=1;continue}(r===9||r===10||r===13||r>=32&&r!==127)&&(n+=t[e])}return n}function Wt(e,t=Vt){let n=String(e||``),r=Math.max(1,Math.floor(Number(t)||4e3));if(n.length<=r)return{text:Ut(n),truncated:!1};let i=n.slice(-r),a=i.indexOf(`
|
|
4
|
-
`);return a>=0&&a<Math.floor(r/3)&&(i=i.slice(a+1)),{text:Ut(`${Ht}\n${i}`),truncated:!0}}function Gt(){let e=globalThis.pisperDesktop;return e?.computerUseStartStream?e:null}function Kt({target:e,fallbackImage:t,streaming:n}){let{t:r}=s(),i=Number(e.target?.windowId)||0,[a,o]=(0,X.useState)(null),[c,l]=(0,X.useState)(`connecting`),[u,d]=(0,X.useState)(!1),f=(0,X.useRef)(null);(0,X.useEffect)(()=>{if(!n)return;let e=Gt();if(!e?.computerUseSecureInputState)return;let t=!0,r=()=>{e.computerUseSecureInputState?.().then(e=>{t&&d(!!e?.active)}).catch(()=>{t&&d(!1)})};r();let i=window.setInterval(r,2e3);return()=>{t=!1,window.clearInterval(i)}},[n]),(0,X.useEffect)(()=>{if(!n||!i)return;let e=Gt();if(!e){l(`unavailable`);return}l(`connecting`);let t=!0;return e.computerUseStartStream?.(i,e=>{t&&(e.type===`frame`?(f.current=`data:image/jpeg;base64,${e.jpegBase64}`,o({url:f.current,width:e.width,height:e.height,timestampMs:e.timestampMs}),l(`live`)):e.type===`error`?l(`unavailable`):e.type===`downgraded`?l(e=>e===`live`?e:`connecting`):e.type===`stopped`&&l(`unavailable`))}).catch(()=>{t&&l(`unavailable`)}),()=>{t=!1,e.computerUseStopStream?.(i).catch(()=>{})}},[n,i]);let p=a?.url||(t?.url?String(t.url):``),m=String(e.target?.windowTitle||e.target?.app||``),h=c===`live`,g=(0,X.useMemo)(()=>`${a?.width||16} / ${a?.height||10}`,[a?.width,a?.height]);return(0,Z.jsxs)(`div`,{className:`computer-use-live-mirror my-0.5 w-full overflow-hidden rounded-md border border-stroke bg-code`,"data-pisper-live-mirror":h?`live`:c,children:[p?(0,Z.jsx)(`img`,{alt:m||r(`chat:computerUseLive.previewAlt`),className:`computer-use-live-frame block max-h-[240px] w-full object-contain object-top`,src:p}):(0,Z.jsx)(`div`,{className:`computer-use-live-placeholder grid min-h-[84px] w-full place-items-center text-xs text-content-muted`,style:{aspectRatio:g},children:r(`chat:computerUseLive.waitingForFirstFrame`)}),u?(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5 border-t border-stroke-soft bg-warning-soft px-2.5 py-1 text-xs text-warning-strong`,"data-pisper-secure-input":`active`,children:[(0,Z.jsx)(L,{size:12,className:`flex-none`}),(0,Z.jsx)(`span`,{className:`min-w-0`,children:r(`chat:computerUseLive.secureInput`)})]}):null,(0,Z.jsxs)(`div`,{className:`flex min-h-7 items-center justify-between gap-2 border-t border-stroke-soft bg-panel px-2.5 text-xs text-content-muted`,children:[(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,Z.jsx)(N,{size:12}),(0,Z.jsx)(`span`,{className:`truncate`,title:m,children:m||r(`chat:computerUseLive.appWindow`)})]}),(0,Z.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1.5 ${h?`font-medium text-accent-fg`:`text-content-muted`}`,"data-pisper-live-mirror-status":c,children:[h&&(0,Z.jsx)(le,{className:`size-3`}),r(h?`chat:computerUseLive.live`:c===`connecting`?`chat:computerUseLive.connecting`:`chat:computerUseLive.staticPreview`)]})]})]})}var qt=(0,X.memo)(Kt),Jt=new Set([`find_roots`,`observe_ui`,`search_ui`,`expand_ui`,`inspect_ui`,`act_ui`,`read_text`,`wait_for`,`launch_browser`,`navigate_browser`,`evaluate_browser`]);function Yt(e){return Jt.has(String(e||``))}function Xt(e){for(let t=e.length-1;t>=0;--t){let n=e[t];if(n?.type===`tool`&&Yt(n.name)&&Number(n.target?.windowId)>0)return n}return null}function Zt(e,t){return e===`read`?t(`chat:agentRunActivity.readingFiles`):e===`grep`?t(`chat:agentRunActivity.searchingContent`):e===`find`?t(`chat:agentRunActivity.findingFiles`):e===`ls`?t(`chat:agentRunActivity.browsingDirectories`):e===`edit`?t(`chat:agentRunActivity.editingFiles`):e===`write`?t(`chat:agentRunActivity.writingFiles`):e===`bash`?t(`chat:agentRunActivity.runningCommands`):e===`codemode`?t(`chat:agentRunActivity.runningScript`):e===`memory_search`?t(`chat:agentRunActivity.searchingMemory`):e===`memory_remember`?t(`chat:agentRunActivity.savingMemory`):e===`spawn_agent`?t(`chat:agentRunActivity.startingSubagent`):e===`list_agents`?t(`chat:agentRunActivity.checkingSubagents`):e===`send_message`?t(`chat:agentRunActivity.messagingSubagent`):e===`send_team_message`?t(`chat:agentRunActivity.messagingTeamMember`):e===`list_team_members`?t(`chat:agentRunActivity.checkingTeamMembers`):e===`run_team_workflow`?t(`chat:agentRunActivity.runningTeamWorkflow`):e===`followup_task`?t(`chat:agentRunActivity.addingSubagentTask`):e===`wait_agent`?t(`chat:agentRunActivity.waitingForSubagent`):e===`interrupt_agent`?t(`chat:agentRunActivity.interruptingSubagent`):we(e)?t(`chat:agentRunActivity.readingPlan`):Se(e)?t(`chat:agentRunActivity.updatingPlan`):e===`browser_automation`?t(`chat:agentRunActivity.controllingBrowser`):e===`observe_ui`||e===`inspect_ui`||e===`expand_ui`?t(`chat:agentRunActivity.observingInterface`):e===`act_ui`?t(`chat:agentRunActivity.operatingInterface`):e===`search_ui`?t(`chat:agentRunActivity.searchingInterface`):e===`find_roots`?t(`chat:agentRunActivity.findingAppWindows`):e===`ocr_ui`?t(`chat:agentRunActivity.readingInterfaceText`):e===`wait_for`?t(`chat:agentRunActivity.waitingForInterface`):e===`read_text`?t(`chat:agentRunActivity.readingInterfaceText`):e===`generate_visual`?t(`chat:agentRunActivity.generatingVisualContent`):e===`discover_tools`?t(`chat:agentRunActivity.discoveringTools`):t(`chat:agentRunActivity.usingTool`,{tool:String(e||t(`chat:agentRunActivity.tools`))})}function Qt(e,t){return e===`read`?t(`chat:agentRunActivity.filesRead`):e===`grep`?t(`chat:agentRunActivity.searchCompleted`):e===`find`?t(`chat:agentRunActivity.findCompleted`):e===`ls`?t(`chat:agentRunActivity.directoriesBrowsed`):e===`edit`?t(`chat:agentRunActivity.filesEdited`):e===`write`?t(`chat:agentRunActivity.filesWritten`):e===`bash`?t(`chat:agentRunActivity.commandCompleted`):e===`codemode`?t(`chat:agentRunActivity.scriptCompleted`):e===`spawn_agent`?t(`chat:agentRunActivity.subagentStarted`):e===`send_team_message`?t(`chat:agentRunActivity.teamMessageSent`):e===`list_team_members`?t(`chat:agentRunActivity.teamMembersListed`):e===`run_team_workflow`?t(`chat:agentRunActivity.teamWorkflowStarted`):e===`wait_agent`?t(`chat:agentRunActivity.subagentStatusUpdated`):e===`observe_ui`||e===`inspect_ui`||e===`expand_ui`?t(`chat:agentRunActivity.interfaceObserved`):e===`act_ui`?t(`chat:agentRunActivity.interfaceActionCompleted`):e===`ocr_ui`||e===`read_text`?t(`chat:agentRunActivity.interfaceTextRead`):Se(e)?t(`chat:agentRunActivity.planUpdated`):t(e===`discover_tools`?`chat:agentRunActivity.toolsDiscovered`:`chat:agentRunActivity.currentOperationCompleted`)}function $t(e,t,n){return n(e===`queued`?`chat:agentRunActivity.agentQueued`:e===`starting`?`chat:agentRunActivity.agentStarting`:e===`running`?`chat:agentRunActivity.agentRunning`:e===`completed`?`chat:agentRunActivity.agentCompleted`:e===`interrupted`?`chat:agentRunActivity.agentInterrupted`:e===`failed`?`chat:agentRunActivity.agentFailed`:`chat:agentRunActivity.agentStatusUpdated`,{name:t})}function en(e,t){let n=e?.items||[],r=e?.counts?.completed??n.filter(e=>e.status===`completed`).length,i=e?.counts?.inProgress??n.filter(e=>e.status===`in_progress`).length;return[n.length?t(`chat:agentRunActivity.completedTotalCompleted`,{completed:r,total:n.length}):``,i?t(`chat:agentRunActivity.countInProgress`,{count:i}):``].filter(Boolean).join(` · `)||t(`chat:agentRunActivity.planCleared`)}function tn(e,t){return e.kind===`removed`?t(`chat:agentRunActivity.removedTitle`,{title:e.title}):e.status===`completed`?t(`chat:agentRunActivity.completedTitle`,{title:e.title}):e.status===`in_progress`?t(`chat:agentRunActivity.inProgressTitle`,{title:e.title}):e.status===`blocked`?t(`chat:agentRunActivity.blockedTitle`,{title:e.title}):e.kind===`added`?t(`chat:agentRunActivity.addedTitle`,{title:e.title}):t(`chat:agentRunActivity.pendingTitle`,{title:e.title})}function nn(e,t){return e?.active?e.reason===`overflow`?t(`chat:agentRunActivity.contextIsFullTheRequestWillRetryAfterCompaction`):e.reason===`manual`?t(`chat:agentRunActivity.summarizingOlderMessagesAsRequested`):t(`chat:agentRunActivity.contextIsNearingItsLimitSummarizingOlderMessages`):e?.tokensBefore!=null&&e?.estimatedTokensAfter!=null?t(`chat:agentRunActivity.contextCompactedBeforeAfterTokens`,{before:ye(e.tokensBefore),after:ye(e.estimatedTokensAfter)}):t(`chat:agentRunActivity.summarizingOlderMessages`)}function rn(e){if(typeof e!=`string`&&typeof e!=`number`)return 0;let t=new Date(e).getTime();return Number.isFinite(t)?t:0}function an(e){if(!e||e.status===`running`)return null;let t=e.type===`agent`&&e.agent||{},n=rn(e.startedAt||t.startedAt),r=rn(e.finishedAt||t.completedAt||e.updatedAt);return!n||!r||r<n?null:r-n}function on(e,t=!1){let n=Math.max(0,Math.round(e));if(n<1e3)return t?`0 s`:`${n} ms`;if(n<1e4&&!t)return`${(n/1e3).toFixed(1)} s`;let r=Math.floor(n/1e3);if(r<60)return`${r} s`;let i=Math.floor(r/60),a=String(r%60).padStart(2,`0`);return i<60?`${i}:${a}`:`${Math.floor(i/60)}:${String(i%60).padStart(2,`0`)}:${a}`}function sn(e){if(e?.type!==`tool`||e.status!==`error`)return null;let t=/Command exited with code (\d+)/.exec(`${String(e.output||``)}\n${String(e.message||``)}`);return t?t[1]:null}var cn=[],ln=`flex min-h-[36px] min-w-0 items-center gap-[10px] px-[12px] py-[5px] text-[13px] max-[650px]:min-h-11 pointer-coarse:min-h-11 [.agent-run-activity.compact_&]:min-h-[30px]`,un=`cursor-pointer list-none transition-colors duration-(--d-fast) ease-precise focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus [&::-webkit-details-marker]:hidden`,dn=`${un} hover:bg-surface-subtle [details[open]>&]:bg-surface-subtle`,fn=`${un} bg-st-run-soft`,pn=`agent-run-disclosure size-[14px] flex-none text-content-muted transition-transform duration-(--d-fast) ease-precise [details[open]>summary_&]:rotate-90`,mn=(0,X.lazy)(()=>t(()=>import(`./AnimatedList-D8fxDNGr.js`).then(e=>({default:e.AnimatedList})),__vite__mapDeps([0,1,2,3,4,5,6])));function hn(e,t){return t(e===`queued`?`chat:agentRunActivity.teamTaskQueued`:e===`starting`?`chat:agentRunActivity.teamTaskStarting`:e===`running`?`chat:agentRunActivity.teamTaskRunning`:e===`completed`?`chat:agentRunActivity.teamTaskCompleted`:e===`failed`?`chat:agentRunActivity.teamTaskFailed`:e===`interrupted`?`chat:agentRunActivity.teamTaskInterrupted`:e===`blocked`?`chat:agentRunActivity.teamTaskBlocked`:`chat:agentRunActivity.teamTaskStatusUpdated`)}function gn(e){let[t,n]=(0,X.useState)(()=>Date.now());return(0,X.useEffect)(()=>{if(n(Date.now()),!e)return;let t=window.setInterval(()=>n(Date.now()),1e3);return()=>window.clearInterval(t)},[e]),t}function _n({startedAt:e,finishedAt:t,streaming:n}){let r=gn(n),i=ke(e,t,r);return!i&&!n?null:(0,Z.jsx)(`span`,{className:`agent-run-duration flex-none text-[12px] whitespace-nowrap text-content-muted tabular-nums`,children:on(i,!!n)})}function Q(e){return String(e||``).replace(/\s+/g,` `).trim()}function vn(e){let t=e?.args||{};return e?.name===`bash`?{text:String(t.command||``).trim(),command:!0}:e?.name===`codemode`?{text:String(t.code||``).split(`
|
|
5
|
-
`).map(e=>e.trim()).find(e=>e&&!e.startsWith(`// @options:`))||``,command:!0}:[`read`,`edit`,`write`,`ls`].includes(e?.name)?{text:Q(t.path)}:e?.name===`grep`?{text:[t.pattern?`“${Q(t.pattern)}”`:``,Q(t.path)].filter(Boolean).join(` · `)}:e?.name===`find`?{text:[Q(t.pattern),Q(t.path)].filter(Boolean).join(` · `)}:e?.name===`browser_automation`?{text:[Q(t.action),Q(t.url||t.selector)].filter(Boolean).join(` · `)}:e?.name===`observe_ui`?{text:Q(t.root||t.mode)}:e?.name===`act_ui`?{text:Array.isArray(t.actions)?t.actions.slice(0,3).map(e=>Q(e?.action)).filter(Boolean).join(` · `):``}:e?.name===`search_ui`?{text:Q(t.text||t.role)}:e?.name===`find_roots`?{text:Q(t.app||t.text)}:e?.name===`ocr_ui`?{text:Q(t.language)}:e?.name===`spawn_agent`?{text:Q(t.taskName)}:[`send_message`,`followup_task`,`wait_agent`,`interrupt_agent`].includes(e?.name)?{text:Q(t.target)}:e?.name===`generate_visual`?{text:Q(t.outputName||t.kind)}:e?.name===`discover_tools`?{text:Q(t.query)}:{text:``}}function yn(e,{t,streaming:n,text:r,thinkingText:i,compaction:a,error:o,stopped:s,notice:c,lastActivityAt:l,now:u}){let d=`running`,f=t(`chat:agentRunActivity.understandingTheTask`),p=c||``,m=``,h=!1,g=e.startedAt,_=cn;if(e.type===`tool`){let n=e.status===`error`,r=e.status===`done`;d=n?`failed`:r?`completed`:`running`,f=n?t(`chat:agentRunActivity.toolFailed`,{tool:Zt(e.name,t)}):r?Qt(e.name,t):Zt(e.name,t);let i=vn(e);p=i.text,h=!!i.command,m=Q(e.message)}else if(e.type===`plan`){d=`plan`;let n=Ce(e);f=n?.items?.length?t(`chat:agentRunActivity.planUpdated`):t(`chat:agentRunActivity.planCleared`),_=e.changes||cn,p=_.length?t(`chat:agentRunActivity.countPlanChanges`,{count:_.length}):en(n,t)}else if(e.type===`agent`){let n=e.agent||{},r=Q(n.taskName)||t(`chat:agentRunActivity.subagent`),i=Q(n.agentProfile),a=Q(n.modelTier),o=Q(n.model),s=i||a?t(`chat:agentRunActivity.subagentWithProfile`,{name:r,profile:i||a,model:o}):r,c=!Array.isArray(n.modelFallbackReasons)||!n.modelFallbackReasons.length?``:n.modelSource===`tier`?t(`chat:agentRunActivity.subagentTierModelFallback`,{model:o}):t(i?`chat:agentRunActivity.subagentParentModelFallback`:`chat:agentRunActivity.subagentTierUnavailableFallback`,{model:o}),l=Oe(n.status);f=$t(n.status,s,t),d=l.tone,p=(n.currentActivity?.type===`tool`?vn(n.currentActivity).text||n.currentActivity.name:``)||Q(n.error)||c||Q(n.message),m=n.status===`running`?Q(n.output):``,g=n.startedAt||g}else if(e.type===`communication`){let n=e.communication||{};d=`running`,f=t(`chat:agentRunActivity.teamMessageActivity`),p=t(`chat:agentRunActivity.teamMessageDetail`,{from:n.fromTaskName||n.fromAgentId||`lead`,to:n.toTaskName||n.toAgentId||``}),m=Q(n.message)}else if(e.type===`compaction`)d=`compacting`,f=t(`chat:agentRunActivity.compactingContext`),p=nn(e.compaction||a,t);else if(e.type===`retry`)d=`waiting`,f=t(`chat:agentRunActivity.retryingRequest`),p=e.summary||c||``;else{let a=Math.max(0,u-new Date(l||u).getTime());o?(d=`failed`,f=t(`chat:agentRunActivity.thisRunFailed`),p=o):s?(d=`stopped`,f=t(`chat:agentRunActivity.runStopped`)):n?a>=1e4?(d=`waiting`,f=t(`chat:agentRunActivity.waitingForTheModel`),p=t(`chat:agentRunActivity.noNewProgressForCountS`,{count:Math.floor(a/1e3)})):f=e.stage===`starting`?t(`chat:agentRunActivity.startingTheModel`):e.stage===`responding`?t(`chat:agentRunActivity.preparingTheResponse`):e.stage===`processing_result`?t(`chat:agentRunActivity.processingToolResult`):e.stage===`waiting_retry`?t(`chat:agentRunActivity.waitingToRetry`):e.stage===`finalizing`?t(`chat:agentRunActivity.finalizingTheRun`):e.stage===`working`?t(`chat:agentRunActivity.advancingTheTask`):String(i||``).trim()?t(`chat:agentRunActivity.reasoningAboutTheNextStep`):String(r||``).trim()?t(`chat:agentRunActivity.preparingTheResponse`):t(`chat:agentRunActivity.understandingTheTask`):(d=`completed`,f=t(`chat:agentRunActivity.reasoningCompleted`),p=Q(i)),String(i||``).trim()&&(p=Q(i))}return{tone:d,title:f,detail:p,output:m,command:h,startedAt:g,changes:_}}var bn={running:{kind:`run`,color:`text-st-run`},compacting:{kind:`run`,color:`text-st-run`},completed:{kind:`done`,color:`text-st-done`},plan:{kind:`done`,color:`text-st-done`},failed:{kind:`failed`,color:`text-st-fail`},stopped:{kind:`stopped`,color:`text-st-queue`},waiting:{kind:`queued`,color:`text-st-queue`}};function xn({tone:e,spin:t=!0}){let n=bn[e]??{kind:`queued`,color:`text-st-queue`};return(0,Z.jsx)(`span`,{className:`agent-run-status-icon grid size-[18px] flex-none place-items-center`,children:(0,Z.jsx)(ze,{status:n.kind,spin:t&&n.kind===`run`,className:`size-[15px] ${n.color}`})})}function Sn(e,t){let n=e.type===`agent`?e.agent?.status:e.status;return n===`error`||n===`failed`?`failed`:t&&[`running`,`starting`,`queued`].includes(String(n))||t&&e.type===`compaction`?`running`:`done`}function Cn(e,t){let n={total:e.length,done:0,running:0,failed:0};for(let r of e)n[Sn(r,t)]+=1;return n}function wn({activity:e,className:t,children:n}){return e.type===`tool`?(0,Z.jsx)(`div`,{className:t,"data-pisper-activity-type":`tool`,children:n}):e.type===`plan`?(0,Z.jsx)(zt,{className:`${t} !gap-0 !rounded-none !border-0 !bg-transparent !p-0 !shadow-none`,"data-pisper-activity-type":`plan`,children:n}):e.type===`agent`?(0,Z.jsx)(Bt,{className:t,"data-pisper-activity-type":`agent`,children:n}):(0,Z.jsx)(`div`,{className:t,"data-pisper-activity-type":e.type,children:n})}var Tn=/^\s*(?:●|✗|✕|×|npm ERR!|ERR!|(?:Error|TypeError|SyntaxError|ReferenceError)\b:?)|^Command exited with code \d+/,En=/^\s*[✓✔]/;function Dn({line:e}){let t=/^(PASS|FAIL)(?=\s|$)/.exec(e)?.[1];if(t)return(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`b`,{className:`mr-[6px] rounded-[3px] px-[5px] text-[11.5px] font-semibold tracking-[.02em] ${t===`PASS`?`bg-success-soft text-success`:`bg-danger-soft text-danger`}`,children:t}),e.slice(t.length).trimStart()]});let n=Tn.test(e)?`text-danger`:En.test(e)?`text-success`:void 0;return(0,Z.jsx)(`span`,{className:n,children:e})}function On({output:e,command:t,streaming:n,t:r,children:i}){let a=Wt(e),o=(0,X.useRef)(null);return(0,X.useEffect)(()=>{if(!n)return;let e=window.requestAnimationFrame(()=>{let e=o.current;e&&(e.scrollTop=e.scrollHeight)});return()=>window.cancelAnimationFrame(e)},[a.text,n]),!a.text.trim()&&!(n&&t)?(0,Z.jsx)(`div`,{className:ln,children:i}):(0,Z.jsxs)(`details`,{className:`agent-run-command-output [.agent-run-feed:has(&[open])]:max-h-[320px] [&_>_pre]:max-h-[112px] [&_>_pre]:overflow-auto [&_>_pre]:m-0 [&_>_pre]:relative [&_>_pre]:border-t [&_>_pre]:border-well-stroke [&_>_pre]:bg-well [&_>_pre]:py-[8px] [&_>_pre]:pr-[14px] [&_>_pre]:pl-[40px] [&_>_pre]:font-mono [&_>_pre]:text-[12px] [&_>_pre]:leading-[1.7] [&_>_pre]:text-well-text [&_>_pre]:whitespace-pre-wrap [&_>_pre]:[overflow-wrap:anywhere] [&_>_pre>span]:block [&_>_pre>span]:min-h-[1.7em] [&_>_pre]:before:absolute [&_>_pre]:before:top-0 [&_>_pre]:before:bottom-[12px] [&_>_pre]:before:left-[20px] [&_>_pre]:before:w-px [&_>_pre]:before:bg-well-stroke max-[650px]:[&_>_pre]:pl-[12px] max-[650px]:[&_>_pre]:before:hidden min-w-0`,"data-truncated":a.truncated||void 0,"data-running":n||void 0,open:n||void 0,children:[(0,Z.jsxs)(`summary`,{className:`${ln} ${n?fn:dn}`,children:[i,(0,Z.jsx)(`span`,{className:`sr-only`,children:r(n?`chat:agentRunActivity.liveCommandOutput`:`chat:agentRunActivity.commandOutput`)}),(0,Z.jsx)(b,{className:pn,"aria-hidden":`true`})]}),(0,Z.jsxs)(`pre`,{ref:o,children:[t?(0,Z.jsxs)(`span`,{className:`text-well-text`,children:[(0,Z.jsx)(`span`,{className:`text-well-muted select-none`,children:`$ `}),t]}):null,a.text?a.text.split(`
|
|
6
|
-
`).map((e,t)=>(0,Z.jsx)(Dn,{line:e},t)):null]})]})}function kn({image:e,t}){let n=String(e.url||``);return n?(0,Z.jsx)(`a`,{className:`agent-run-tool-preview block w-full overflow-hidden rounded-sm border border-stroke-soft bg-surface-subtle`,href:n,target:`_blank`,rel:`noreferrer`,title:String(e.name||``),children:(0,Z.jsx)(`img`,{alt:String(e.name||t(`chat:agentRunActivity.toolPreviewAlt`)),className:`block max-h-[168px] w-full object-contain object-top`,loading:`lazy`,src:n})}):null}function An(e,t){return e.activity!==t.activity||e.latest!==t.latest||e.t!==t.t||e.streaming!==t.streaming?!1:[`tool`,`plan`,`agent`].includes(t.activity.type)?!0:e.text===t.text&&e.thinkingText===t.thinkingText&&e.compaction===t.compaction&&e.error===t.error&&e.stopped===t.stopped&&e.notice===t.notice&&e.lastActivityAt===t.lastActivityAt}var jn=(0,X.memo)(function({activity:e,latest:t,t:n,streaming:r,text:i,thinkingText:a,compaction:o,error:s,stopped:c,notice:l,lastActivityAt:u}){let d=yn(e,{t:n,streaming:r,text:i,thinkingText:a,compaction:o,error:s,stopped:c,notice:l,lastActivityAt:u,now:Date.now()}),f=!!(r&&e.type===`tool`&&e.status===`running`),p=e.name===`bash`&&!!(e.output||f);if(e.type===`retry`)return(0,Z.jsx)(kt,{title:e.summary||n(`chat:agentRunActivity.retryingRequest`),error:String(e.message||``),pending:!!(r&&t),className:`rounded-none border-0 bg-transparent`});let m=e.type===`tool`?String(e.name||``):``,h=sn(e),g=an(e),_=d.tone===`failed`,v=!p&&d.output&&d.output!==d.detail?d.output:``,y=(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(xn,{tone:d.tone,spin:!!r}),m?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`span`,{className:`agent-run-verb max-w-[40%] min-w-[34px] flex-none truncate font-mono text-[12px] font-semibold ${f?`text-st-run`:`text-content-secondary`}`,children:m}),(0,Z.jsx)(`span`,{className:`agent-run-arg min-w-0 flex-1 truncate font-mono text-[12.5px] ${d.detail?`text-foreground`:`text-content-muted`}`,title:d.detail||d.title,children:d.detail||d.title}),d.detail?(0,Z.jsx)(`span`,{className:`sr-only`,children:d.title}):null]}):(0,Z.jsxs)(`span`,{className:`agent-run-arg min-w-0 flex-1 truncate`,title:[d.title,d.detail].filter(Boolean).join(` · `),children:[(0,Z.jsx)(`span`,{className:`text-foreground`,children:d.title}),d.detail?(0,Z.jsxs)(`span`,{className:`text-content-muted`,children:[` · `,d.detail]}):null]}),h!==null&&(0,Z.jsx)(`span`,{className:`flex-none font-mono text-[12px] font-medium text-st-fail`,children:n(`chat:agentRunActivity.exitCode`,{code:h})}),g===null?f&&e.startedAt?(0,Z.jsx)(_n,{startedAt:String(e.startedAt),streaming:!0}):null:(0,Z.jsx)(`span`,{className:`agent-run-elapsed min-w-[44px] flex-none text-right font-mono text-[12px] text-content-muted tabular-nums`,children:on(g)})]});return(0,Z.jsxs)(wn,{activity:e,className:`agent-run-summary flex w-full min-w-0 flex-none flex-col [transition:background_var(--d-fast)_var(--ease)] ${d.tone} ${t?`current [.agent-run-feed.live_&]:bg-surface-subtle`:``}`,children:[p?(0,Z.jsx)(On,{output:e.output,command:d.detail,streaming:f,t:n,children:y}):(0,Z.jsxs)(`div`,{className:`${ln} ${f?`bg-st-run-soft`:``}`,children:[y,(0,Z.jsx)(`span`,{className:`size-[14px] flex-none`,"aria-hidden":`true`})]}),(d.changes.length>0||v||e.previewImage?.url)&&(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-[4px] pr-[12px] pb-[8px] pl-[40px] text-[12px] leading-[1.45]`,children:[d.changes.length>0&&(0,Z.jsxs)(`span`,{className:`agent-run-plan-changes flex min-w-0 flex-col gap-[1px] border-l border-stroke pl-[8px] text-content-secondary`,children:[d.changes.slice(0,4).map(e=>(0,Z.jsx)(`small`,{className:`truncate text-[12px]`,children:tn(e,n)},`${e.id}-${e.kind}-${e.status}`)),d.changes.length>4&&(0,Z.jsx)(`small`,{className:`text-[12px] text-content-muted`,children:n(`chat:agentRunActivity.countMoreChanges`,{count:d.changes.length-4})})]}),v?(0,Z.jsx)(`small`,{className:`truncate text-[12px] ${_?`text-st-fail`:`text-content-muted`}`,title:v,children:v}):null,e.previewImage&&e.previewImage.url?(0,Z.jsx)(kn,{image:e.previewImage,t:n}):null]})]})},An);function Mn({streaming:e,text:t,thinkingText:n,team:r,activityFeed:i=cn,tools:a=cn,compaction:o,error:c,stopped:l,notice:u,startedAt:d,lastActivityAt:m,finishedAt:h,compact:g=!1}){let{t:_}=s(),v=String(n||``).trim(),y=(0,X.useRef)(null),x=(0,X.useRef)(null);(0,X.useEffect)(()=>{if(!v)return;let e=window.requestAnimationFrame(()=>{let e=y.current;e&&(e.scrollTop=e.scrollHeight)});return()=>window.cancelAnimationFrame(e)},[v]);let S=i.length?i:a,[C,w]=(0,X.useState)(!!e),T=(0,X.useRef)(!!e);(0,X.useEffect)(()=>{T.current!==!!e&&(T.current=!!e,w(!!e))},[e]);let E=(0,X.useContext)(Dt),D=p(e=>e.tab),O=!!(E?.open&&D===`preview`),k=e&&!g&&!O?Xt(S):null,A=Ee(S),j=Array.isArray(r?.tasks)?r.tasks:[],M=Number(r?.completedTaskCount??0),N=Number(r?.taskCount??j.length),P=Number(r?.tokenUsed??r?.tokensUsed??0),F=Number(r?.tokenBudget??r?.teamTokenBudget??0),I=Array.isArray(r?.communications)?r.communications:[],L=N>0?Math.min(100,Math.round(M/N*100)):0;if((0,X.useEffect)(()=>{if(!e||!S.length)return;let t=window.requestAnimationFrame(()=>{let e=x.current;e&&(e.scrollTop=e.scrollHeight)});return()=>window.cancelAnimationFrame(t)},[A,S.length,e]),!v&&!S.length&&!r)return null;let R=Cn(S,e),z=(r=>r.map((i,a)=>(0,Z.jsx)(jn,{activity:i,compaction:o,error:c,lastActivityAt:m,latest:a===r.length-1,notice:u,stopped:l,streaming:e,t:_,text:t,thinkingText:v?``:n},Ae(i,a))))(S),B=!!(r&&(j.length>0||I.length>0||(r.blockers?.length??0)>0||(r.conflicts?.length??0)>0||r.scriptPath||r.summary?.text)),V=!!(B||S.length>0),H=[_(`board:transcript.operations`,{count:R.total}),R.running?_(`board:transcript.running`,{count:R.running}):``,R.failed?_(`board:transcript.failed`,{count:R.failed}):``,!e&&!R.failed&&!R.running?_(`board:transcript.allDone`):``].filter(Boolean);return(0,Z.jsxs)(`section`,{className:`agent-run-activity flex w-full flex-col items-start gap-[10px] [margin:2px_0_14px] text-foreground [&.compact]:m-[4px_0_0_40px] ${g?`compact`:``}`,"aria-live":`polite`,children:[v&&(0,Z.jsxs)(`details`,{className:`agent-thinking-window group/thinking w-full min-w-0 ${e?`running`:`completed`}`,"data-pisper-activity-type":`reasoning`,children:[(0,Z.jsxs)(`summary`,{className:`agent-thinking-head inline-flex h-7 max-w-full items-center gap-[6px] rounded-sm pr-[8px] pl-[6px] text-[12px] text-content-secondary ring-1 ring-stroke ring-inset ${un} hover:bg-surface-hover max-[650px]:h-11 pointer-coarse:h-11`,"aria-label":_(`chat:agentRunActivity.toggleReasoning`),children:[e?(0,Z.jsx)(ze,{status:`run`,className:`size-[14px] text-st-run`}):(0,Z.jsx)(Ze,{className:`size-[14px] flex-none text-content-muted`,strokeWidth:1.75}),(0,Z.jsxs)(`strong`,{className:`flex min-w-0 items-center truncate font-medium`,children:[_(e?`chat:agentRunActivity.reasoningInProgress`:`chat:agentRunActivity.reasoningCompleted`),e?(0,Z.jsxs)(`span`,{className:`agent-thinking-dots [&_i]:w-[3px] [&_i]:h-[3px] [&_i]:rounded-[50%] [&_i]:bg-[currentColor] [&_i]:[animation:agent-thinking-dot_1.15s_ease-in-out_infinite] [&_i:nth-child(2)]:[animation-delay:.14s] [&_i:nth-child(3)]:[animation-delay:.28s] inline-flex items-end gap-[2px] [margin-left:5px]`,"aria-hidden":`true`,children:[(0,Z.jsx)(`i`,{}),(0,Z.jsx)(`i`,{}),(0,Z.jsx)(`i`,{})]}):null]}),!S.length&&(0,Z.jsx)(_n,{startedAt:d,finishedAt:h,streaming:e}),(0,Z.jsx)(b,{className:pn,"aria-hidden":`true`})]}),(0,Z.jsx)(`div`,{ref:y,className:`agent-thinking-scroll mt-[8px] max-h-[190px] overflow-auto rounded-md border border-stroke-soft bg-surface-subtle px-[14px] py-[9px] text-content-secondary [scroll-behavior:smooth]`,children:(0,Z.jsx)(Ie,{streaming:e,children:v})})]}),V&&(0,Z.jsxs)(`div`,{className:`agent-run-log w-full overflow-hidden rounded-[var(--r-md)] border border-stroke bg-solid [&>*+*]:border-t [&>*+*]:border-stroke-soft`,children:[r&&B&&(0,Z.jsxs)(`details`,{className:`agent-team-panel min-w-0`,children:[(0,Z.jsxs)(`summary`,{className:`${ln} ${dn} justify-between`,children:[(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-[10px]`,children:[(0,Z.jsx)(`span`,{className:`grid size-[18px] flex-none place-items-center`,"aria-hidden":`true`,children:(0,Z.jsx)(`span`,{className:`team-status-dot h-[7px] w-[7px] shrink-0 rounded-full ${r.status===`complete`?`bg-success`:r.status===`stalled`||r.status===`budget_limited`?`bg-warning-strong`:r.status===`paused`?`bg-content-muted`:`bg-star [animation:agent-status-pulse_1.6s_ease-in-out_infinite]`}`})}),(0,Z.jsx)(`span`,{className:`min-w-0 truncate font-medium text-content-secondary`,children:r.status===`complete`?_(`chat:agentRunActivity.teamComplete`):r.status===`budget_limited`?_(`chat:agentRunActivity.teamBudgetLimited`):r.status===`paused`?_(`chat:agentRunActivity.teamPaused`):r.status===`stalled`?_(`chat:agentRunActivity.teamStalled`):_(`chat:agentRunActivity.teamActive`)}),N>0&&(0,Z.jsxs)(`small`,{className:`shrink-0 text-[12px] text-content-muted tabular-nums`,children:[M,`/`,N,` · `,L,`%`]})]}),(0,Z.jsxs)(`span`,{className:`flex shrink-0 items-center gap-[8px]`,children:[F>0&&(0,Z.jsx)(`small`,{className:`text-[12px] whitespace-nowrap text-content-muted tabular-nums`,children:_(`chat:agentRunActivity.teamBudget`,{used:P,budget:F})}),(0,Z.jsx)(b,{className:pn,"aria-hidden":`true`})]})]}),N>0&&(0,Z.jsx)(`div`,{"aria-hidden":`true`,className:`team-progress-track mx-[12px] mb-[6px] h-[4px] overflow-hidden rounded-full bg-surface-active`,children:(0,Z.jsx)(`div`,{className:`team-progress-fill h-full rounded-full bg-content-secondary [transition:width_var(--d-base)_var(--ease)]`,style:{width:`${L}%`}})}),(0,Z.jsxs)(`div`,{className:`grid max-h-[min(42vh,360px)] grid-cols-[repeat(auto-fit,minmax(190px,1fr))] gap-[6px] overflow-y-auto overscroll-contain border-t border-stroke-soft bg-surface-subtle p-[8px_12px]`,children:[j.map(e=>{let t=typeof e.role==`string`?e.role.trim():``,n=hn(e.status,_);return(0,Z.jsxs)(`div`,{className:`grid min-w-0 gap-[4px] rounded-sm border border-stroke-soft bg-panel p-[7px_8px] text-[12px]`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-start gap-[6px]`,children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`team-task-dot mt-[5px] h-[6px] w-[6px] shrink-0 rounded-full ${e.status===`running`?`bg-star [animation:agent-status-pulse_1.6s_ease-in-out_infinite]`:e.status===`completed`?`bg-success`:e.status===`failed`||e.status===`interrupted`?`bg-danger`:e.status===`blocked`?`bg-warning-strong`:`bg-stroke-strong`}`}),(0,Z.jsxs)(`span`,{className:`grid min-w-0 gap-[1px]`,children:[(0,Z.jsx)(`strong`,{className:`font-medium break-words`,children:t?_(`chat:agentRunActivity.teamTaskStatus`,{name:e.taskName,role:t,status:n}):_(`chat:agentRunActivity.teamTaskStatusWithoutRole`,{name:e.taskName,status:n})}),(0,Z.jsx)(`small`,{className:`text-[12px] text-content-muted`,children:n})]})]}),e.error&&(0,Z.jsx)(`small`,{className:`text-[12px] break-words text-danger`,children:e.error}),e.output&&(0,Z.jsx)(`small`,{className:`text-[12px] break-words text-content-muted`,children:e.output})]},e.id||e.taskName)}),(r.blockers?.length??0)>0&&(0,Z.jsx)(`small`,{className:`text-[12px] text-warning-strong`,children:_(`chat:agentRunActivity.teamBlocked`,{count:r.blockers?.length??0})}),(r.conflicts?.length??0)>0&&(0,Z.jsx)(`small`,{className:`text-[12px] text-danger`,children:_(`chat:agentRunActivity.teamConflicts`,{count:r.conflicts?.length??0})}),r.scriptPath&&(0,Z.jsx)(`small`,{className:`font-mono text-[12px] break-all text-content-muted`,children:_(`chat:agentRunActivity.teamScript`,{path:r.scriptPath})}),I.length>0&&(0,Z.jsxs)(`div`,{className:`grid gap-[3px] border-t border-stroke-soft pt-[6px]`,children:[(0,Z.jsx)(`small`,{className:`text-[12px] text-content-muted`,children:_(`chat:agentRunActivity.teamCommunicationCount`,{count:I.length})}),I.slice(-6).map(e=>(0,Z.jsxs)(`div`,{className:`grid min-w-0 gap-[1px] rounded-xs border-l-2 border-stroke-strong bg-panel p-[4px_8px]`,children:[(0,Z.jsxs)(`strong`,{className:`font-mono text-[12px] font-medium break-all`,children:[e.fromTaskName||e.fromAgentId||`lead`,` ->`,` `,e.toTaskName||e.toAgentId]}),(0,Z.jsx)(`small`,{className:`text-[12px] break-words text-content-secondary`,children:e.message})]},e.id))]}),r.summary?.text&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`small`,{className:`text-[12px] text-content-muted`,children:_(`chat:agentRunActivity.teamSummary`)}),r.summary.text&&(0,Z.jsx)(`p`,{className:`m-0 line-clamp-4 text-[12px] leading-[1.45] text-content-secondary`,children:r.summary.text})]})]})]},String(r.id||r.scriptPath||`team`)),S.length>0&&(0,Z.jsxs)(`details`,{className:`agent-run-history min-w-0`,open:C,onToggle:e=>w(e.currentTarget.open),"data-tool-group":e?`running`:`done`,children:[(0,Z.jsxs)(`summary`,{className:`flex min-h-[38px] min-w-0 items-center gap-[8px] px-[12px] py-[4px] text-[13px] text-content-secondary ${un} hover:bg-surface-hover max-[650px]:min-h-11 pointer-coarse:min-h-11`,"data-tool-group-summary":!0,children:[(0,Z.jsx)(f,{className:`size-[14px] flex-none text-content-muted`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex min-w-0 flex-1 items-center gap-[6px] truncate tabular-nums`,children:H.map((e,t)=>(0,Z.jsxs)(`span`,{className:t===0?`font-semibold text-content`:void 0,children:[t>0&&(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`mr-[6px] text-content-muted`,children:`·`}),e]},t))}),(0,Z.jsx)(_n,{startedAt:d,finishedAt:h,streaming:e}),(0,Z.jsx)(b,{className:pn,"aria-hidden":`true`})]}),(0,Z.jsx)(`div`,{ref:x,className:`agent-run-feed focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus flex max-h-[184px] flex-col overflow-y-auto [overscroll-behavior:contain] border-t border-stroke-soft [&>*+*]:border-t [&>*+*]:border-stroke-soft ${e?`live`:`completed`}`,"aria-label":_(`chat:agentRunActivity.toolActivityAriaLabel`),tabIndex:S.length>3?0:void 0,children:e?(0,Z.jsx)(X.Suspense,{fallback:z,children:(0,Z.jsx)(mn,{children:z})}):(0,Z.jsx)(X.Suspense,{fallback:z,children:z})})]})]}),e&&!g&&k?(0,Z.jsx)(qt,{fallbackImage:k.previewImage,streaming:e,target:k}):null]})}function Nn(e,t){return e.streaming===t.streaming&&e.text===t.text&&e.thinkingText===t.thinkingText&&e.currentActivity===t.currentActivity&&e.team===t.team&&e.activityFeed===t.activityFeed&&e.compaction===t.compaction&&e.error===t.error&&e.stopped===t.stopped&&e.notice===t.notice&&e.startedAt===t.startedAt&&e.lastActivityAt===t.lastActivityAt&&e.finishedAt===t.finishedAt&&e.compact===t.compact&&e.tools===t.tools}var Pn=(0,X.memo)(Mn,Nn);function Fn({className:e,from:t,...n}){return(0,Z.jsx)(`div`,{"data-ai-element":`message`,"data-role":t,className:q(`group flex w-full max-w-[95%] flex-col gap-2`,t===`user`?`is-user ml-auto justify-end`:`is-assistant`,e),...n})}function In({images:e,index:t,onClose:n,onNavigate:r}){let{t:i}=s(),a=(0,X.useRef)(null),o=e[t],c=t>0,l=t<e.length-1,u=(0,X.useCallback)(t=>{t>=0&&t<e.length&&r(t)},[e.length,r]);return(0,X.useEffect)(()=>{let e=document.body.style.overflow,r=e=>{e.key===`Escape`?n():e.key===`ArrowLeft`?(e.preventDefault(),u(t-1)):e.key===`ArrowRight`&&(e.preventDefault(),u(t+1))};return document.body.style.overflow=`hidden`,window.addEventListener(`keydown`,r),()=>{document.body.style.overflow=e,window.removeEventListener(`keydown`,r)}},[t,u,n]),o?(0,Z.jsxs)(`div`,{className:`image-lightbox [&_img]:h-full [&_img]:min-h-0 [&_img]:w-full [&_img]:object-contain fixed z-[100] inset-0 grid grid-rows-[auto_minmax(0,1fr)] gap-[12px] bg-[var(--lightbox-bg)] [padding:18px_72px_24px_24px] max-sm:[padding:12px_56px_16px_12px]`,role:`dialog`,"aria-modal":`true`,"aria-label":i(`chat:chatMessage.fullScreenImagePreview`),children:[(0,Z.jsxs)(`div`,{className:`image-lightbox-toolbar flex min-w-0 items-center justify-between gap-[16px] text-[var(--on-ink)]`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-[10px]`,children:[(0,Z.jsx)(`span`,{className:`overflow-hidden text-[13px] font-medium text-ellipsis whitespace-nowrap`,title:o.attachment.name,children:o.attachment.name||i(`chat:chatMessage.generatedImage`)}),e.length>1&&(0,Z.jsxs)(`span`,{className:`flex-none text-[12px] text-[var(--on-ink)]/70 tabular-nums`,children:[t+1,` / `,e.length]})]}),(0,Z.jsxs)(`div`,{className:`flex flex-none items-center gap-[8px]`,children:[(0,Z.jsx)(J,{asChild:!0,size:`lg`,className:`border border-[var(--lightbox-action-border)] bg-[var(--lightbox-action-bg)] text-[var(--lightbox-action-text)] shadow-[0_8px_24px_var(--lightbox-action-shadow)] hover:bg-[var(--accent-soft)] hover:text-[var(--star-strong)]`,children:(0,Z.jsxs)(`a`,{href:o.attachment.downloadUrl||o.source,download:o.attachment.name||`generated-image`,"aria-label":i(`chat:chatMessage.downloadOriginal`),title:i(`chat:chatMessage.downloadOriginal`),children:[(0,Z.jsx)(C,{size:14}),(0,Z.jsx)(`span`,{className:`max-sm:hidden`,children:i(`chat:chatMessage.downloadOriginal`)})]})}),(0,Z.jsx)(J,{type:`button`,variant:`ghost`,size:`icon-lg`,className:`size-11 bg-[var(--lightbox-control-bg)] text-[var(--on-ink)] hover:bg-[var(--lightbox-control-bg)] hover:text-[var(--on-ink)]`,"aria-label":i(`chat:chatMessage.closePreview`),title:i(`chat:chatMessage.closePreview`),onClick:n,children:(0,Z.jsx)(V,{size:20})})]})]}),(0,Z.jsxs)(`div`,{className:`relative flex min-h-0 items-center justify-center [touch-action:pan-y]`,onTouchStart:e=>{a.current=e.changedTouches[0]?.clientX??null},onTouchEnd:e=>{let n=a.current;a.current=null;let r=e.changedTouches[0]?.clientX;n===null||r===void 0||Math.abs(r-n)<48||u(t+(r<n?1:-1))},onTouchCancel:()=>{a.current=null},children:[e.length>1&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(J,{type:`button`,variant:`ghost`,size:`icon-lg`,className:`absolute left-0 z-10 size-11 rounded-full bg-[var(--lightbox-control-bg)] text-[var(--on-ink)] shadow-[0_8px_24px_var(--lightbox-action-shadow)] hover:bg-[var(--lightbox-control-bg)] hover:text-[var(--on-ink)] disabled:opacity-30`,"aria-label":i(`chat:chatMessage.previousImage`),title:i(`chat:chatMessage.previousImage`),disabled:!c,onClick:()=>u(t-1),children:(0,Z.jsx)(y,{size:22})}),(0,Z.jsx)(J,{type:`button`,variant:`ghost`,size:`icon-lg`,className:`absolute right-0 z-10 size-11 rounded-full bg-[var(--lightbox-control-bg)] text-[var(--on-ink)] shadow-[0_8px_24px_var(--lightbox-action-shadow)] hover:bg-[var(--lightbox-control-bg)] hover:text-[var(--on-ink)] disabled:opacity-30`,"aria-label":i(`chat:chatMessage.nextImage`),title:i(`chat:chatMessage.nextImage`),disabled:!l,onClick:()=>u(t+1),children:(0,Z.jsx)(b,{size:22})})]}),(0,Z.jsx)(`img`,{alt:o.attachment.name||i(`chat:chatMessage.generatedImage`),decoding:`async`,src:o.source})]})]}):null}function Ln(e,t){window.dispatchEvent(new CustomEvent(Le,{detail:{message:e,tone:t}}))}function Rn({icon:e,label:t,onClick:n,disabled:r=!1}){return(0,Z.jsxs)(`button`,{type:`button`,disabled:r,onClick:n,className:`flex min-h-[30px] cursor-pointer items-center gap-[8px] rounded-sm border-0 bg-transparent px-[8px] text-left text-[13px] text-content-secondary transition-colors duration-(--d-fast) hover:bg-surface-hover hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50 pointer-coarse:min-h-11`,children:[e,t]})}var zn=6,Bn=4;function Vn(e){let t=!!(e.url||e.data);return(e.kind===`image`||e.kind===`video`)&&t}function Hn({attachments:e,compact:t=!1,sessionId:n,sessionStreaming:r=!1}){let{t:i}=s(),[a,o]=(0,X.useState)(null),[c,l]=(0,X.useState)(!1),[u,d]=(0,X.useState)(null),[f,p]=(0,X.useState)(null),[m,h]=(0,X.useState)(null),g=(0,X.useRef)(null),[_,y]=(0,X.useState)(null),[b,S]=(0,X.useState)(null),[w,E]=(0,X.useState)(null),[j,N]=(0,X.useState)({}),P=e.flatMap((e,t)=>{let n=e.url||(e.data?`data:${e.mimeType};base64,${e.data}`:``);return e.kind===`image`&&n?[{attachment:e,source:n,attachmentIndex:t}]:[]}),F=new Map;e.forEach((e,t)=>{Vn(e)||F.set(t,F.size)});let I=!c&&F.size>zn?F.size-Bn:0,L=async e=>{try{await Fe(e,Ne),Ln(i(`common:markdownMessage.revealLocalPathOk`,{path:e}),`info`)}catch(t){Ln(t instanceof Pe&&t.reason===`unavailable`?i(`common:markdownMessage.revealLocalPathUnavailable`):t instanceof Pe&&t.reason===`timeout`?i(`common:markdownMessage.revealLocalPathTimeout`):i(`common:markdownMessage.revealLocalPathFailed`,{path:e}),`error`)}},R=async(e,t)=>{if(n)try{let r=await Y.getFileDiff(n,t);N(t=>({...t,[e]:r.diff?.trim()?{diff:r.diff,truncated:!!r.diffTruncated,canRevert:!!r.canRevert}:null}))}catch{N(t=>({...t,[e]:null}))}},z=async(e,t)=>{if(!(!n||r||b)){if(_!==e){y(e);return}y(null),S(e);try{await Y.revertSessionFileChanges(n,t),N(t=>({...t,[e]:null})),Ln(i(`chat:chatMessage.fileActionRevertDone`,{path:t}),`info`)}catch(e){Ln(i(`chat:chatMessage.fileActionRevertFailed`,{path:t}),`error`),console.error(`[chat] 撤销文件改动失败。`,e)}finally{S(null)}}},B=async(e,t)=>{if(!(!n||m)){h(e);try{let e=await Y.getFileDiff(n,t);e.diff?.trim()?(d(null),E({diff:e.diff,truncated:!!e.diffTruncated})):Ln(i(`chat:chatMessage.fileDiffEmpty`),`info`)}catch(e){Ln(e instanceof Error?e.message:i(`chat:chatMessage.fileDiffFailed`),`error`)}finally{h(null)}}},V=e=>{if(!e.downloadUrl)return;let t=document.createElement(`a`);t.href=e.downloadUrl,e.name&&(t.download=e.name),t.click()};return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`div`,{className:`message-attachments flex flex-wrap gap-[6px] [margin-top:6px] ${t?`compact`:``}`,children:[e.map((e,t)=>{if(I&&(F.get(t)??-1)>=Bn)return null;let a=String(e.id||t),s=e.url||(e.data?`data:${e.mimeType};base64,${e.data}`:``);return e.kind===`image`&&s?(0,Z.jsxs)(`button`,{type:`button`,className:`generated-media [.message-attachments_&]:flex [.message-attachments_&]:w-[min(360px,100%)] [.message-attachments_&]:flex-col [.message-attachments_&]:gap-[5px] [.message-attachments_&]:text-[var(--text-muted)] [.message-attachments_&]:no-underline [.message-attachments_button&]:border-0 [.message-attachments_button&]:bg-transparent [.message-attachments_button&]:p-0 [.message-attachments_button&]:text-left [.message-attachments_button&]:[cursor:zoom-in] [.message-attachments_&_img]:w-full [.message-attachments_&_img]:max-h-[320px] [.message-attachments_&_img]:[border:1px_solid_var(--stroke)] [.message-attachments_&_img]:rounded-[var(--r-sm)] [.message-attachments_&_img]:object-contain [.message-attachments_&_img]:bg-[var(--media-bg)] [.message-attachments_&_video]:w-full [.message-attachments_&_video]:max-h-[320px] [.message-attachments_&_video]:[border:1px_solid_var(--stroke)] [.message-attachments_&_video]:rounded-[var(--r-sm)] [.message-attachments_&_video]:object-contain [.message-attachments_&_video]:bg-[var(--media-bg)] [.message-attachments_&_small]:overflow-hidden [.message-attachments_&_small]:text-[13px] [.message-attachments_&_small]:text-ellipsis [.message-attachments_&_small]:whitespace-nowrap [.message-attachments.compact_&]:w-[min(190px,100%)] [.message-attachments.compact_&_img]:max-h-[130px] [.message-attachments.compact_&_video]:max-h-[130px]`,onClick:()=>{let e=P.findIndex(e=>e.attachmentIndex===t);e>=0&&o({images:P,index:e})},title:i(`chat:chatMessage.openFullScreenPreview`),children:[(0,Z.jsx)(`img`,{alt:e.name||i(`chat:chatMessage.imageAttachment`),decoding:`async`,loading:`lazy`,src:s}),(0,Z.jsx)(`small`,{children:e.name||i(`chat:chatMessage.generatedImage`)})]},a):e.kind===`video`&&s?(0,Z.jsxs)(`div`,{className:`generated-media [.message-attachments_&]:flex [.message-attachments_&]:w-[min(360px,100%)] [.message-attachments_&]:flex-col [.message-attachments_&]:gap-[5px] [.message-attachments_&]:text-[var(--text-muted)] [.message-attachments_&]:no-underline [.message-attachments_button&]:border-0 [.message-attachments_button&]:bg-transparent [.message-attachments_button&]:p-0 [.message-attachments_button&]:text-left [.message-attachments_button&]:[cursor:zoom-in] [.message-attachments_&_img]:w-full [.message-attachments_&_img]:max-h-[320px] [.message-attachments_&_img]:[border:1px_solid_var(--stroke)] [.message-attachments_&_img]:rounded-[var(--r-sm)] [.message-attachments_&_img]:object-contain [.message-attachments_&_img]:bg-[var(--media-bg)] [.message-attachments_&_video]:w-full [.message-attachments_&_video]:max-h-[320px] [.message-attachments_&_video]:[border:1px_solid_var(--stroke)] [.message-attachments_&_video]:rounded-[var(--r-sm)] [.message-attachments_&_video]:object-contain [.message-attachments_&_video]:bg-[var(--media-bg)] [.message-attachments_&_small]:overflow-hidden [.message-attachments_&_small]:text-[13px] [.message-attachments_&_small]:text-ellipsis [.message-attachments_&_small]:whitespace-nowrap [.message-attachments.compact_&]:w-[min(190px,100%)] [.message-attachments.compact_&_img]:max-h-[130px] [.message-attachments.compact_&_video]:max-h-[130px] video`,children:[(0,Z.jsx)(`video`,{controls:!0,preload:`metadata`,src:s}),(0,Z.jsx)(`small`,{children:e.name||i(`chat:chatMessage.generatedVideo`)})]},a):e.kind===`link`?(0,Z.jsxs)(`a`,{className:`inline-flex min-h-[28px] max-w-full min-w-0 items-center gap-[6px] rounded-sm border border-stroke bg-panel px-[9px] text-[13px] text-content-secondary no-underline transition-colors duration-(--d-fast) hover:bg-surface-hover hover:text-foreground max-[650px]:min-h-11`,href:e.downloadUrl||void 0,children:[(0,Z.jsx)(k,{size:14,className:`shrink-0 text-content-muted`}),(0,Z.jsx)(`span`,{className:`truncate`,children:e.name||i(`chat:chatMessage.fileAttachment`)})]},a):(0,Z.jsxs)(ae,{open:u===a,onOpenChange:t=>{d(t?a:null),t&&e.path&&n?R(a,String(e.path)):y(null)},children:[(0,Z.jsx)(K,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,onClick:e=>{g.current=e.currentTarget},className:`inline-flex min-h-[28px] max-w-full min-w-0 cursor-pointer items-center gap-[6px] rounded-sm border border-stroke bg-panel px-[9px] text-[13px] text-content-secondary transition-colors duration-(--d-fast) hover:bg-surface-hover hover:text-foreground max-[650px]:min-h-11`,children:[(0,Z.jsx)(k,{size:14,className:`shrink-0 text-content-muted`}),(0,Z.jsx)(`span`,{className:`truncate`,children:e.name||i(`chat:chatMessage.fileAttachment`)})]})}),(0,Z.jsxs)(re,{align:`start`,sideOffset:6,className:`flex w-[190px] max-w-[calc(100vw-2rem)] flex-col gap-[2px] p-[4px]`,children:[(0,Z.jsx)(Rn,{icon:(0,Z.jsx)(T,{size:13}),label:i(`chat:chatMessage.fileActionPreview`),onClick:()=>{d(null),p(e)}}),(0,Z.jsx)(Rn,{icon:(0,Z.jsx)(C,{size:13}),label:i(`chat:chatMessage.fileActionDownload`),disabled:!e.downloadUrl,onClick:()=>V(e)}),e.path&&(0,Z.jsx)(Rn,{icon:(0,Z.jsx)(A,{size:13}),label:i(`chat:chatMessage.fileActionReveal`),onClick:()=>void L(String(e.path))}),n&&e.path&&(0,Z.jsx)(Rn,{icon:m===a?(0,Z.jsx)(M,{size:13,className:`animate-spin`}):(0,Z.jsx)(D,{size:13}),label:i(`chat:chatMessage.fileActionDiff`),disabled:!!m,onClick:()=>void B(a,String(e.path))}),j[String(a)]?.canRevert&&(0,Z.jsx)(Rn,{icon:b===String(a)?(0,Z.jsx)(M,{className:`animate-spin`,size:13}):(0,Z.jsx)(et,{size:13}),label:i(_===String(a)?`chat:chatMessage.fileActionConfirmRevert`:`chat:chatMessage.fileActionRevert`),disabled:!!(r||b),onClick:()=>void z(String(a),String(e.path))})]})]},a)}),F.size>zn&&(0,Z.jsx)(`button`,{type:`button`,"aria-expanded":!I,onClick:()=>l(e=>!e),className:`inline-flex min-h-[28px] cursor-pointer items-center gap-[4px] rounded-sm border border-dashed border-stroke bg-transparent px-[9px] text-[13px] text-content-muted transition-colors duration-(--d-fast) hover:bg-surface-hover hover:text-foreground max-[650px]:min-h-11`,children:I?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(v,{size:14,className:`shrink-0`}),i(`chat:chatMessage.moreFiles`,{count:I})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(x,{size:14,className:`shrink-0`}),i(`chat:chatMessage.fewerFiles`)]})})]}),a&&(0,mt.createPortal)((0,Z.jsx)(In,{images:a.images,index:a.index,onClose:()=>o(null),onNavigate:e=>o(t=>t&&{...t,index:e})}),document.body),f&&(0,Z.jsx)(Je,{attachment:f,onClose:()=>p(null),onRestoreFocus:()=>g.current?.focus(),onDownload:()=>V(f)}),w&&(0,Z.jsx)(O,{diff:w.diff,truncated:w.truncated,onClose:()=>E(null)})]})}function Un({sessionId:e,entryId:t,savedLabel:n,openRequest:r=0}){let{t:i}=s(),[a,o]=(0,X.useState)(!1);(0,X.useEffect)(()=>{r&&o(!0)},[r]);let[c,l]=(0,X.useState)(``),[u,d]=(0,X.useState)(!1),[f,p]=(0,X.useState)(!1),[m,h]=(0,X.useState)(``);(0,X.useEffect)(()=>{if(!a)return;let n=!0;return d(!0),h(``),Ke(e).then(e=>n&&l(e.labels[t]||``)).catch(e=>n&&h(Ge(e))).finally(()=>n&&d(!1)),()=>{n=!1}},[t,a,e]);let g=async()=>{if(!(f||u)){p(!0),h(``);try{let n=await Y.setSessionTreeLabel(e,t,c);qe(e,n),o(!1)}catch(e){h(Ge(e))}finally{p(!1)}}},v=async()=>{if(!(f||u)){p(!0),h(``);try{let n=await Y.setSessionTreeLabel(e,t,``);qe(e,n),l(``),o(!1)}catch(e){h(Ge(e))}finally{p(!1)}}};return(0,Z.jsxs)(ae,{open:a,onOpenChange:o,children:[(0,Z.jsxs)(ce,{children:[(0,Z.jsx)(oe,{asChild:!0,children:(0,Z.jsx)(K,{asChild:!0,children:(0,Z.jsx)(J,{type:`button`,variant:`ghost`,size:`icon`,className:n?`bg-surface-hover text-brand`:void 0,"aria-label":i(`chat:chatMessage.labelThisTurn`),"aria-pressed":!!n,"data-pisper-label-entry":t,children:(0,Z.jsx)(z,{size:14})})})}),(0,Z.jsx)(se,{side:`top`,sideOffset:6,children:i(`chat:chatMessage.labelThisTurn`)})]}),(0,Z.jsx)(re,{className:`message-label-popover [&_form]:grid [&_form]:gap-[10px] [&_[data-slot='popover-title']]:text-[12px]`,align:`end`,sideOffset:6,children:(0,Z.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),g()},children:[(0,Z.jsx)(ie,{children:i(`chat:sessionTree.nodeLabel`)}),(0,Z.jsx)(xe,{autoFocus:!0,value:c,maxLength:80,disabled:u||f,placeholder:i(`chat:sessionTree.labelPlaceholder`),onChange:e=>l(e.target.value)}),m&&(0,Z.jsx)(`small`,{className:`danger-text`,children:m}),(0,Z.jsxs)(`div`,{className:`message-label-actions flex items-center justify-between gap-[8px]`,children:[(0,Z.jsx)(J,{type:`button`,size:`icon-sm`,variant:`ghost`,title:i(`chat:sessionTree.removeLabel`),"aria-label":i(`chat:sessionTree.removeLabel`),disabled:u||f,onClick:()=>void v(),children:(0,Z.jsx)(B,{})}),(0,Z.jsxs)(J,{className:`message-label-save [.message-label-actions_&]:min-w-[104px] [.message-label-actions_&]:text-[var(--primary-foreground)]`,type:`submit`,disabled:u||f,children:[f?(0,Z.jsx)(M,{className:`animate-spin`}):(0,Z.jsx)(_,{}),i(f?`chat:sessionTree.savingLabel`:`chat:sessionTree.saveLabel`)]})]})]})})]})}function Wn(e){if(e<6e4)return`${(Math.max(e,100)/1e3).toFixed(1)}s`;let t=Math.round(e/1e3);return`${Math.floor(t/60)}m ${t%60}s`}function Gn(e,t){if(typeof e!=`number`&&typeof e!=`string`)return null;let n=new Date(e);if(!Number.isFinite(n.getTime()))return null;let r=new Date().toDateString()===n.toDateString();return{iso:n.toISOString(),label:n.toLocaleString(t,{...r?{}:{month:`2-digit`,day:`2-digit`},hour:`2-digit`,minute:`2-digit`,hour12:!1}),full:n.toLocaleString(t)}}function Kn(e,t){return e.sessionId===t.sessionId&&e.message===t.message&&e.agentState===t.agentState&&e.showRunActivity===t.showRunActivity&&e.runProps===t.runProps&&e.cwd===t.cwd&&e.sessionStreaming===t.sessionStreaming&&e.onBranchFromHere===t.onBranchFromHere&&e.onCreateChildSession===t.onCreateChildSession&&e.retryUserMessageId===t.retryUserMessageId&&e.hideErrorNotice===t.hideErrorNotice&&e.onRetryLastTurn===t.onRetryLastTurn&&e.latest===t.latest&&e.turn===t.turn}var qn=(0,X.memo)(function({sessionId:e,message:t,agentState:n,showRunActivity:r,runProps:i,cwd:a,sessionStreaming:o,onBranchFromHere:c,onCreateChildSession:l,retryUserMessageId:u,hideErrorNotice:d,onRetryLastTurn:f,latest:p=!1,turn:m}){let{t:h,language:g}=s(),_=(0,X.useContext)(Ot),[v,y]=(0,X.useState)(!1),[b,x]=(0,X.useState)(!1),[C,T]=(0,X.useState)(!1),[E,D]=(0,X.useState)(0),O=(0,X.useRef)(!1),k=(0,X.useRef)(null),A=!!(t.turnBoundaryEntryId&&c&&l),j=We(e,A?t.turnBoundaryEntryId:void 0),N=!!t.streaming,P=t.text||``,L=t.error&&P===t.error?``:P,R=!!(i&&(String(i.thinkingText||``).trim()||(i.activityFeed?.length??0)>0||(i.tools?.length??0)>0||i.team)),B=t.role===`agent`?Gn(t.timestamp,g):null,V=t.role===`agent`&&typeof t.thinkingMs==`number`&&Number.isFinite(t.thinkingMs)&&t.thinkingMs>0?t.thinkingMs:null,H=V===null?``:h(`chat:chatMessage.thinkingTime`,{duration:Wn(V)}),ee=t.role===`agent`&&!!(N||L||R||t.error||t.attachments?.length);return(0,Z.jsxs)(Fn,{from:t.role===`agent`?`assistant`:`user`,className:q(`message group/message mx-auto mb-[var(--chat-message-gap,32px)] w-full max-w-[var(--chat-content-width,1040px)] min-w-0 gap-0`,t.role===`agent`?`items-stretch`:`items-end [[data-chat-message-style='plain']_&]:items-start`,t.role),"data-pisper-message-id":t.id,"data-pisper-role":t.role,"data-pisper-turn":m,"data-pisper-streaming":N||void 0,"data-pisper-error":t.error?`true`:void 0,children:[ee&&(0,Z.jsxs)(`div`,{className:`agent-message-head mb-2 flex h-6 min-w-0 items-center gap-2 text-[13px]`,children:[(0,Z.jsx)(`span`,{className:`agent-message-mark grid size-[22px] flex-none place-items-center`,"data-state":n,"aria-hidden":`true`,children:(0,Z.jsx)(Ue,{size:22})}),(0,Z.jsx)(`span`,{className:`min-w-0 truncate font-medium text-content-secondary`,"data-agent-model":_&&p&&_.model?_.model:void 0,children:_&&p&&_.model?_.model:`Pisper`}),H&&(0,Z.jsx)(`span`,{className:`flex-none text-[12px] text-content-muted tabular-nums`,"data-agent-thinking":V??void 0,children:H}),n===`thinking`&&(0,Z.jsx)(le,{className:`size-3.5`}),j&&(0,Z.jsxs)(`button`,{type:`button`,className:`inline-flex h-[22px] min-w-0 max-w-[45%] items-center gap-1 rounded-full bg-surface-muted px-2 text-[12px] text-content-secondary transition-colors duration-(--d-fast) hover:bg-surface-hover hover:text-content focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-focus max-[650px]:h-11 pointer-coarse:h-11`,"aria-label":h(`chat:chatMessage.turnLabel`,{label:j}),title:h(`chat:chatMessage.turnLabel`,{label:j}),"data-turn-label":t.turnBoundaryEntryId,disabled:N,onClick:()=>D(e=>e+1),children:[(0,Z.jsx)(z,{size:12,"aria-hidden":`true`,className:`flex-none`}),(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:j})]}),B&&(0,Z.jsx)(`time`,{className:`ml-auto flex-none text-[12px] text-content-muted tabular-nums`,dateTime:B.iso,title:B.full,children:B.label})]}),(0,Z.jsxs)(`div`,{ref:k,className:q(`message-content relative min-w-0`,t.role===`agent`?`w-full`:`w-fit max-w-[min(640px,88%)] [[data-chat-message-style='plain']_&]:w-full [[data-chat-message-style='plain']_&]:max-w-full`),children:[r&&i&&(0,Z.jsx)(Pn,{...i}),L&&(0,Z.jsx)(Ie,{cwd:a,streaming:N,className:q(`min-h-[34px] [overflow-wrap:anywhere] text-[length:var(--app-message-font-size)] [font-family:var(--font-content-family)] font-[400]`,t.role===`agent`?`w-full max-w-full rounded-none border-0 bg-transparent pt-1 leading-[1.625] [&_h1]:text-[1.5em]! [&_h1]:leading-[1.333333]! [&_h2]:text-[1.25em]! [&_h2]:leading-[1.4]! [&_h3]:text-[1.125em]! [&_h3]:leading-[1.555556]! [&_h1]:mt-[1em]! [&_h2]:mt-[1em]! [&_h3]:mt-[1em]! [&_h1]:mb-[.25em]! [&_h2]:mb-[.25em]! [&_h3]:mb-[.25em]! [&_li]:py-0! [&_li+li]:mt-[.25em]! [&_p]:mt-0! [&_p]:mb-[.25em]! [&_ul]:my-[.25em]! [&_ol]:my-[.25em]! [&_.markdown-content>p:first-child]:mt-0! [&_.markdown-content>p:last-child]:mb-0!`:`rounded-[18px] border-0 bg-[var(--user-bubble-bg)] px-4 py-2.5 text-[length:calc(var(--app-message-font-size)*.9375)]! leading-[1.65] text-[var(--user-bubble-text)] [&_.markdown-content>p]:my-0! [&_h1]:text-inherit! [&_h2]:text-inherit! [&_h3]:text-inherit! [&_h4]:text-inherit! [&_a]:text-inherit! [&_blockquote]:text-inherit! [&_code]:bg-panel [&_code]:shadow-[0_0_0_1px_var(--stroke-soft)] [[data-chat-message-style='plain']_&]:rounded-none [[data-chat-message-style='plain']_&]:bg-transparent [[data-chat-message-style='plain']_&]:px-0 [[data-chat-message-style='plain']_&]:py-1`),children:L}),t.attachments&&t.attachments.length>0&&(0,Z.jsx)(Hn,{attachments:t.attachments,sessionId:e,sessionStreaming:o}),t.role===`user`&&L&&(0,Z.jsx)(`div`,{className:`message-actions mt-1 -mr-1.5 flex flex-wrap justify-end min-h-5 gap-0 text-muted-foreground opacity-0 group-hover/message:opacity-100 focus-within:opacity-100 [@media(hover:none)]:opacity-100 max-[650px]:opacity-100 min-[651px]:absolute min-[651px]:right-full min-[651px]:bottom-0 min-[651px]:mr-1 min-[651px]:mt-0 [[data-chat-message-style='plain']_&]:static [[data-chat-message-style='plain']_&]:mr-0 [[data-chat-message-style='plain']_&]:justify-start [&_button]:size-7 [&_button]:min-h-7 max-[650px]:[&_button]:size-11 max-[650px]:[&_button]:min-h-11 pointer-coarse:[&_button]:size-11 pointer-coarse:[&_button]:min-h-11 [&_button]:rounded-md`,children:(0,Z.jsx)(Ft,{text:L,copyLabel:h(`chat:chatMessage.copyMessage`)})})]}),t.error&&!N&&!d&&(0,Z.jsx)(kt,{error:String(t.error),className:`mt-3`}),t.role===`agent`&&!N&&(L||t.turnBoundaryEntryId||u)&&(0,Z.jsxs)(`div`,{className:`message-actions mt-2 -ml-1.5 flex flex-wrap items-center min-h-5 gap-0 text-[var(--text-muted)] opacity-0 transition-opacity duration-(--d-fast) group-hover/message:opacity-100 focus-within:opacity-100 has-[[data-state=open]]:opacity-100 has-[[aria-busy=true]]:opacity-100 [@media(hover:none)]:opacity-100 max-[650px]:opacity-100 [&_button]:size-7 [&_button]:min-h-7 max-[650px]:[&_button]:size-11 max-[650px]:[&_button]:min-h-11 pointer-coarse:[&_button]:size-11 pointer-coarse:[&_button]:min-h-11 [&_button]:rounded-md [&_button]:text-[var(--text-muted)] [&_button:hover]:bg-[var(--surface-hover)] [&_button:hover]:text-[var(--text)]`,"data-reply-actions":!0,children:[L&&(0,Z.jsx)(Ft,{text:L,getText:()=>k.current?.querySelector(`.markdown-content`)?.innerText.trim()||``}),A&&t.turnBoundaryEntryId&&(0,Z.jsx)(Un,{sessionId:e,entryId:t.turnBoundaryEntryId,savedLabel:j,openRequest:E}),u&&(0,Z.jsxs)(ce,{children:[(0,Z.jsx)(oe,{asChild:!0,children:(0,Z.jsx)(J,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":h(`chat:chatMessage.retry`),"data-pisper-retry-message":u,disabled:C||o,onClick:async()=>{T(!0);try{await f()}finally{T(!1)}},children:C?(0,Z.jsx)(M,{className:`animate-spin`,size:14}):(0,Z.jsx)(I,{size:14})})}),(0,Z.jsx)(se,{side:`top`,sideOffset:6,children:h(`chat:chatMessage.retry`)})]}),(L||A)&&(0,Z.jsxs)(ne,{children:[(0,Z.jsx)(G,{asChild:!0,children:(0,Z.jsx)(J,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":h(`chat:chatMessage.moreReplyActions`),"data-reply-more":!0,children:(0,Z.jsx)(w,{size:16})})}),(0,Z.jsxs)(te,{align:`start`,className:`min-w-52 p-1 [&_[role=menuitem]]:min-h-9 max-[650px]:[&_[role=menuitem]]:min-h-11`,onCloseAutoFocus:e=>{O.current&&(O.current=!1,e.preventDefault())},children:[A&&t.turnBoundaryEntryId&&(0,Z.jsxs)(W,{"data-pisper-derive-entry":t.turnBoundaryEntryId,disabled:v||b||o,onSelect:async()=>{let e=t.turnBoundaryEntryId;if(!(!e||!c)){y(!0);try{await c(e)}finally{y(!1)}}},children:[(0,Z.jsx)(Xe,{size:16}),h(`chat:chatMessage.deriveFromHere`)]}),A&&t.turnBoundaryEntryId&&(0,Z.jsxs)(W,{"data-pisper-rewind-entry":t.turnBoundaryEntryId,disabled:v||b||o,onSelect:async()=>{let e=t.turnBoundaryEntryId;if(!(!e||!c)){y(!0);try{await c(e,{rewindFiles:!0})}finally{y(!1)}}},children:[(0,Z.jsx)(F,{size:16}),h(`chat:chatMessage.rewindHere`)]}),A&&t.turnBoundaryEntryId&&(0,Z.jsxs)(W,{"data-reply-label":!0,onSelect:()=>{O.current=!0,window.setTimeout(()=>D(e=>e+1),0)},children:[(0,Z.jsx)(z,{size:16}),h(`chat:chatMessage.labelThisTurn`)]}),L&&(0,Z.jsxs)(W,{"data-reply-copy-markdown":!0,onSelect:()=>{navigator.clipboard?.writeText(L).catch(()=>void 0)},children:[(0,Z.jsx)(S,{size:16}),h(`board:transcript.copyMarkdown`)]}),A&&t.turnBoundaryEntryId&&(0,Z.jsxs)(W,{"data-pisper-child-entry":t.turnBoundaryEntryId,disabled:v||b,onSelect:async()=>{let e=t.turnBoundaryEntryId;if(!(!e||!l)){x(!0);try{await l(e)}finally{x(!1)}}},children:[(0,Z.jsx)($e,{size:16}),h(`chat:chatMessage.createChildChat`)]})]})]})]})]})},Kn);function Jn(e,t){return e.message===t.message}(0,X.memo)(function({message:e}){return(0,Z.jsxs)(Fn,{from:e.role===`agent`?`assistant`:`user`,className:`[&_>_span]:pt-[5px] [&_>_span]:text-[var(--text-muted)] [&_>_span]:font-[ui-monospace,_SFMono-Regular,_Consolas,_'Liberation_Mono',_monospace] [&_>_span]:text-[12px] [&_>_span]:font-medium [&.agent_>_span::before]:[content:'✦'] [&.agent_>_span::before]:mr-[4px] [&.agent_>_span::before]:text-content-muted [&_.markdown-body]:rounded-[var(--r-xs)] [&_.markdown-body]:bg-[var(--surface-subtle)] [&_.markdown-body]:[padding:6px_8px] [&_.markdown-body]:text-[13px] [&_.markdown-body]:leading-[1.45] [&_.markdown-body]:[overflow-wrap:anywhere] [&.agent_.markdown-body]:bg-[var(--surface-muted)] [&_.markdown-body_pre]:max-h-[130px] [&_.markdown-body_pre]:[padding:7px] grid grid-cols-[34px_minmax(0,1fr)] gap-[6px] [margin-bottom:6px] [align-items:start] ${e.role}`,"data-pisper-message-id":e.id,"data-pisper-role":e.role,"data-pisper-streaming":e.streaming||void 0,children:[(0,Z.jsx)(`span`,{children:e.role===`agent`?`Pisper`:`You`}),(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(e.text||!e.streaming)&&(0,Z.jsx)(Ie,{streaming:e.streaming,children:e.text}),e.attachments&&e.attachments.length>0&&(0,Z.jsx)(Hn,{attachments:e.attachments,compact:!0})]})]})},Jn);function Yn(e){return(e||0)>0&&Number(e)<650?260:164}function Xn(e,t){let n=t?.borderBoxSize?.[0];return Math.ceil(n?.blockSize??e.getBoundingClientRect().height)}function Zn(e,t,n){let[r,i]=(0,X.useState)(0);return(0,X.useLayoutEffect)(()=>{let r=n.current;if(!e||!r)return;let a=()=>{let t=Math.max(0,r.getBoundingClientRect().top-e.getBoundingClientRect().top+e.scrollTop);i(e=>Math.abs(e-t)<1?e:t)},o=null,s=()=>{o===null&&(o=window.requestAnimationFrame(()=>{o=null,a()}))};a();let c=typeof ResizeObserver>`u`?null:new ResizeObserver(s);return c?.observe(e),t.current&&c?.observe(t.current),c?.observe(r),window.addEventListener(`resize`,s),()=>{c?.disconnect(),window.removeEventListener(`resize`,s),o!==null&&window.cancelAnimationFrame(o)}},[n,t,e]),r}var Qn=(0,X.memo)(function({sessionId:e,layoutMeasurementKey:t,messages:n,historical:r=!1,streaming:i,latestRunProps:a,scrollElement:o,prefixRef:s,cwd:c,targetEntryId:l,onContentSizeChange:u,onTargetScroll:d,onTargetLocated:f,onBranchFromHere:p,onCreateChildSession:m,onRetryLastTurn:h,turnsKnown:g=!1,turnBase:_=0}){let v=(0,X.useRef)(null),[y,b]=(0,X.useState)(``),x=n.map(e=>e.id),S=(0,X.useRef)(x);(S.current.length!==x.length||S.current.some((e,t)=>e!==x[t]))&&(S.current=x);let C=S.current,w=(0,X.useMemo)(()=>{let e=Array.from({length:n.length}),t;for(let r=0;r<n.length;r+=1)n[r]?.role===`user`&&(t=n[r].id),e[r]=t;return e},[n]),T=(0,X.useMemo)(()=>{if(!g)return null;let e=Array.from({length:n.length}),t=_;for(let r=0;r<n.length;r+=1)n[r]?.role===`user`&&(t+=1),e[r]=t;return e},[n,_,g]),E=Zn(o,s,v),D=(0,X.useCallback)(e=>C[e]??`transcript-message-${e}`,[C]),O=(0,X.useCallback)(()=>Yn(o?.clientWidth),[o]),k=Re({useFlushSync:!1,anchorTo:`end`,followOnAppend:!1,count:n.length,getScrollElement:()=>o,getItemKey:D,estimateSize:O,measureElement:Xn,overscan:6,scrollMargin:E,useAnimationFrameWithResizeObserver:!0}),A=k.getVirtualItems(),j=k.getTotalSize(),M=(0,X.useCallback)(()=>{let e=v.current;if(!e||!o||e.getBoundingClientRect().width<1)return;let t=o.scrollTop,n=k.getVirtualItems().find(e=>e.end>t),r=n?Math.max(0,t-n.start):0;k.measure(),k.getTotalSize();for(let t of e.children)t instanceof HTMLDivElement&&k.measureElement(t);if(k.getTotalSize(),n){let e=k.getOffsetForIndex(n.index,`start`)?.[0];e!==void 0&&k.scrollToOffset(e+r)}u()},[u,o,k]);return(0,X.useLayoutEffect)(()=>{M()},[t,M]),(0,X.useLayoutEffect)(()=>{let e=v.current;if(!e||typeof ResizeObserver>`u`)return;let t=e.getBoundingClientRect().width,n=null,r=new ResizeObserver(()=>{let r=e.getBoundingClientRect().width;Math.abs(r-t)<1||(t=r,n!==null&&window.cancelAnimationFrame(n),n=window.requestAnimationFrame(()=>{n=null,M()}))});return r.observe(e),()=>{r.disconnect(),n!==null&&window.cancelAnimationFrame(n)}},[M]),(0,X.useLayoutEffect)(()=>{u()},[u,j]),(0,X.useEffect)(()=>{if(!l)return;let e=n.findIndex(e=>e.turnBoundaryEntryId===l);if(e<0)return;d(),k.scrollToIndex(e,{align:`center`}),b(l);let t=window.requestAnimationFrame(()=>{k.scrollToIndex(e,{align:`center`}),f(l)});return()=>window.cancelAnimationFrame(t)},[n,f,d,l,k]),(0,X.useEffect)(()=>{if(!y)return;let e=window.setTimeout(()=>b(``),2200);return()=>window.clearTimeout(e)},[y]),(0,Z.jsx)(`div`,{className:`relative w-full`,"data-pisper-transcript-size":n.length,"data-pisper-rendered-count":A.length,ref:v,style:{height:`${j}px`},children:A.map(t=>{let o=n[t.index];if(!o)return null;let s=!r&&o.role===`agent`&&t.index===n.length-1,l=o.streaming||s&&i?`thinking`:s&&!o.error?`waiting`:`idle`,u=dt(o,s,a);return(0,Z.jsx)(`div`,{className:`virtual-transcript-item absolute left-0 [display:flow-root] w-full rounded-[var(--r-sm)] ${o.turnBoundaryEntryId===y?`targeted [.virtual-transcript-item&]:bg-[var(--star-soft)] [.virtual-transcript-item&]:shadow-[inset_3px_0_0_var(--star-strong)]`:``}`,"data-index":t.index,"data-pisper-target-entry":o.turnBoundaryEntryId===y?o.turnBoundaryEntryId:void 0,"data-pisper-virtual-item":o.id,ref:k.measureElement,style:{top:`${t.start-E}px`},children:(0,Z.jsx)(qn,{sessionId:e,message:o,agentState:l,showRunActivity:!!u,runProps:u,cwd:c,sessionStreaming:i,onBranchFromHere:p,onCreateChildSession:m,retryUserMessageId:s?w[t.index]:void 0,hideErrorNotice:s&&!!o.error,onRetryLastTurn:h,latest:s,turn:T?.[t.index]||void 0})},t.key)})})});function $n(e){let t=e.getHours();return t>=5&&t<9?0:t>=9&&t<12?1:t>=12&&t<14?2:t>=14&&t<18?3:t>=18&&t<23?4:5}function er(e){for(let t of[5,9,12,14,18,23,29]){let n=new Date(e);if(n.setHours(t,0,0,0),n.getTime()>e.getTime())return n.getTime()-e.getTime()}return 6e4}function tr(e,t){return!Number.isFinite(e)||!Number.isFinite(t)||e<=0||t<=0?30:Math.max(20,Math.min(30,Math.floor(30*e/t)))}function nr(){let{t:e}=s(),[t,n]=(0,X.useState)(()=>new Date),[r,i]=(0,X.useState)(30),a=(0,X.useRef)(null),o=(0,X.useRef)(null),c=[e(`chat:workbench.morningEarly`),e(`chat:workbench.morning`),e(`chat:workbench.noon`),e(`chat:workbench.afternoon`),e(`chat:workbench.evening`),e(`chat:workbench.lateNight`)][$n(t)];return(0,X.useEffect)(()=>{let e=window.setTimeout(()=>n(new Date),er(t)),r=()=>n(new Date);return window.addEventListener(`focus`,r),()=>{window.clearTimeout(e),window.removeEventListener(`focus`,r)}},[t]),(0,X.useLayoutEffect)(()=>{let e=a.current,t=o.current;if(!e||!t)return;let n=()=>i(tr(e.clientWidth-32,t.getBoundingClientRect().width));n();let r=new ResizeObserver(n);return r.observe(e),r.observe(t),()=>r.disconnect()},[c]),(0,Z.jsxs)(`div`,{className:`relative mx-auto flex w-full max-w-2xl flex-col items-center justify-center gap-3 text-foreground [[data-mobile-keyboard='open']_&]:pointer-events-none [[data-mobile-keyboard-transition='opening']_&]:pointer-events-none`,"data-testid":`workbench-greeting`,children:[(0,Z.jsx)(be,{size:40}),(0,Z.jsxs)(`h1`,{ref:a,style:{fontSize:Math.min(24,r)},className:`relative z-10 m-0 w-full px-4 text-center leading-[1.4] font-normal tracking-[-.01em]`,children:[(0,Z.jsx)(`span`,{ref:o,"aria-hidden":`true`,className:`pointer-events-none invisible absolute text-3xl leading-[1.2] whitespace-nowrap`,children:c}),(0,Z.jsx)(`span`,{children:c})]})]})}function rr({label:e}){return(0,Z.jsxs)(`div`,{className:`session-history-loading grid min-h-[100%] place-content-center justify-items-center gap-[20px] text-content-muted [animation:transcript-stage-enter_.18s_var(--ease-out)_both]`,role:`status`,"aria-live":`polite`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-[10px]`,children:[(0,Z.jsx)(Ue,{size:22}),(0,Z.jsx)(`strong`,{className:`text-[13px] font-medium text-content-secondary`,children:e}),(0,Z.jsx)(le,{className:`size-4`})]}),(0,Z.jsxs)(`div`,{className:`grid w-[min(560px,78vw)] gap-[12px]`,"aria-hidden":`true`,children:[(0,Z.jsx)(`div`,{className:`h-[40px] w-[46%] justify-self-end rounded-[12px_12px_3px_12px] bg-[var(--user-bubble-bg)]`}),(0,Z.jsxs)(`div`,{className:`grid gap-[8px]`,children:[(0,Z.jsx)(`div`,{className:`h-[34px] rounded-md border border-stroke-soft bg-surface-subtle`}),(0,Z.jsx)(`div`,{className:`h-[10px] w-[82%] rounded-full bg-surface-muted`}),(0,Z.jsx)(`div`,{className:`h-[10px] w-[64%] rounded-full bg-surface-muted`})]})]})]})}function ir(e){return e.map(e=>e.id).join(`
|
|
7
|
-
`)}function ar(e){let{pathname:t,search:n,hash:r}=window.location;return r.startsWith(`#/`)?`${t}${n}#${a(e)}`:a(e)}function or({sessionId:e,emptyState:t,messages:n,layoutMeasurementKey:r,transcriptLoadState:i=`ready`,messageStart:a,hasOlder:o,hasNewer:c,onLoadLatest:l,loadingOlder:u,olderError:d,currentActivity:f,team:p,activityFeed:m,tools:h,thinkingText:_,compaction:v,streaming:y,runStartedAt:x,lastActivityAt:S,runFinishedAt:C,runStopped:w,runNotice:T,error:E,scrollRequest:D,cwd:O,lineage:k,onLoadOlder:A,onBranchFromHere:j,onCreateChildSession:M,onRetryLastTurn:N,collapseEarlierTurns:F=!1}){let{t:I}=s(),[L,R]=(0,X.useState)(!1),z=(0,X.useRef)(null),[B,V]=(0,X.useState)(!1),H=(0,X.useRef)(e);H.current=e,(0,X.useEffect)(()=>{z.current=null,V(!1)},[e]);let ee=(0,X.useRef)(null),[U,W]=(0,X.useState)(()=>fe(e)),G=(0,X.useMemo)(()=>F?Pt(n,{turnsKnown:!o}):null,[F,o,n]),te=!!G&&!L&&!U,ne=te&&G?n.slice(G.latestIndex):n,K=n[n.length-1],re=Math.floor((K?.text?.length||0)/64),ie=Ee(m),ae=Math.floor(String(_||``).length/128),oe=`${e}:${K?.id||``}:${re}:${ae}:${K?.attachments?.length||0}:${ie}:${v?.status||``}:${v?.finishedAt||``}:${E||``}:${y?`1`:`0`}`,se=(0,X.useRef)(!1),ce=(0,X.useRef)(Ct.getState().sessions[e]?.conversationScrollTop??null),{scrollRef:he,scrollElement:ge,setScrollRef:_e,hasUnread:ve,scrollToBottom:Y,maintainBottom:ye,pauseFollowing:be}=jt(oe,{resetKey:`${e}:${i}`,readInitialPosition:()=>i===`ready`?ce.current:null});(0,X.useEffect)(()=>{let t=null,n=()=>{let t=ge;if(!t||i!==`ready`||t.clientHeight<=0)return;let n=Ct.getState();n.sessions[e]?.conversationScrollTop!==t.scrollTop&&n.update(e,`files`,{type:`workspace`,conversationScrollTop:t.scrollTop})},r=()=>{n(),se.current=!0,t!==null&&cancelAnimationFrame(t),t=requestAnimationFrame(()=>{se.current=!1,t=null})};return window.addEventListener(ue,r),window.addEventListener(`pointerdown`,n,!0),()=>{window.removeEventListener(ue,r),t!==null&&cancelAnimationFrame(t),window.removeEventListener(`pointerdown`,n,!0)}},[e,ge,i]),(0,X.useLayoutEffect)(()=>{let t=ge;if(!(!t||i!==`ready`))return()=>{if(t.clientHeight<=0)return;let n=Ct.getState();n.sessions[e]?.conversationScrollTop!==t.scrollTop&&n.update(e,`files`,{type:`workspace`,conversationScrollTop:t.scrollTop})}},[e,ge,i]);let xe=(0,X.useMemo)(()=>({streaming:y,text:K?.role===`agent`?K.text:``,currentActivity:f,team:p,activityFeed:m,tools:h,thinkingText:_,compaction:v,error:E||(K?.role===`agent`?K.error:``),stopped:w,notice:T,startedAt:x,lastActivityAt:S,finishedAt:C}),[y,K,f,p,m,h,_,v,E,w,T,x,S,C]),Se=(0,X.useCallback)(async()=>{if(!he.current||!o||u||z.current)return;be();let t={};z.current=t;let n=e,r=await A?.();H.current===n&&!r&&z.current===t&&(z.current=null)},[o,u,A,be,e,he]),Ce=(0,X.useCallback)(t=>{!se.current&&i===`ready`&&t.currentTarget.clientHeight>0&&Ct.getState().update(e,`files`,{type:`workspace`,conversationScrollTop:t.currentTarget.scrollTop}),!te&&t.currentTarget.scrollTop<=96&&Se()},[te,Se,e,i]);(0,X.useLayoutEffect)(()=>{z.current=null},[a]);let we=(0,X.useRef)(n);(0,X.useEffect)(()=>{we.current=n});let Te=(0,X.useRef)(null),[De,Oe]=(0,X.useState)(0);return(0,X.useEffect)(()=>{W(fe(e));let t=0,n=n=>{let r=n.detail;r?.sessionId===e&&r.targetEntryId&&(Te.current=ir(we.current),window.clearTimeout(t),t=window.setTimeout(()=>{Te.current=null,Oe(e=>e+1)},4e3),W(r.targetEntryId))};return window.addEventListener(pe,n),()=>{window.clearTimeout(t),Te.current=null,window.removeEventListener(pe,n)}},[e]),(0,X.useEffect)(()=>{if(!(!U||a==null)&&!n.some(e=>e.turnBoundaryEntryId===U)){if(Te.current!==null){if(Te.current===ir(n))return;Te.current=null}if(!u){if(o){Se();return}de(e,U),W(``)}}},[o,Se,u,a,n,e,U,De]),(0,X.useEffect)(()=>{D&&Y(`smooth`)},[D,Y]),(0,Z.jsxs)(`div`,{className:`relative min-h-0 flex-1`,children:[(0,Z.jsxs)(`div`,{className:`transcript flex flex-col [.focus-session.has-conversation_&]:p-[var(--chat-transcript-block-padding,30px)_max(24px,calc((100%_-_var(--chat-content-width,1040px))/2))] [.focus-session.has-conversation_&]:[scroll-padding-bottom:32px] @max-[700px]:p-[20px_14px] @max-[700px]:[.focus-session.has-conversation_&]:p-[24px_16px] @max-[470px]:[padding-inline:10px] max-[650px]:p-[20px_14px] min-h-0 h-full flex-1 overflow-auto overscroll-contain scroll-auto [overflow-anchor:none] [scrollbar-gutter:stable_both-edges] m-0 border-0 [padding:26px_max(24px,calc((100%_-_var(--chat-content-width,1040px))/2))] [padding-bottom:70px] [scroll-padding-bottom:70px]`,"data-pisper-transcript-state":i,"aria-busy":i===`loading`,ref:_e,onScroll:Ce,tabIndex:0,children:[(0,Z.jsxs)(`div`,{className:`[display:flow-root] w-full ${i===`ready`&&n.length>0?`mt-auto`:``}`,ref:ee,children:[typeof k?.parentSessionId==`string`&&k.parentSessionId&&(0,Z.jsx)(`div`,{className:`history-page-loader flex w-[min(var(--chat-content-width,1040px),100%)] min-h-[42px] items-center justify-center [margin:0_auto_18px] text-[var(--text-muted)] text-[12px] session-lineage`,children:(0,Z.jsxs)(`a`,{href:ar(k.parentSessionId),className:`inline-flex min-h-8 max-w-full items-center gap-[7px] rounded-md px-2 text-inherit underline-offset-2 transition-colors duration-(--d-fast) hover:bg-surface-hover hover:text-content hover:underline focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-focus max-[650px]:min-h-11`,"data-pisper-parent-session":k.parentSessionId,title:I(`chat:focusSession.openSourceTurn`),onClick:e=>{e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||(e.preventDefault(),me(String(k.parentSessionId),`open`,typeof k.sourceEntryId==`string`?k.sourceEntryId:``))},children:[(0,Z.jsx)(Xe,{size:13,"aria-hidden":`true`,className:`flex-none`}),(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:I(`chat:focusSession.derivedFromSession`,{name:k.sourceSessionName||I(`chat:focusSession.unknownSourceSession`)})})]})}),te&&G&&(0,Z.jsx)(`div`,{className:`flex justify-center pb-3`,children:(0,Z.jsxs)(`button`,{type:`button`,"data-earlier-turns":G.turnBase,"aria-expanded":!1,"aria-label":I(`board:phone.earlierTurns`,{summary:[G.previous.turn?I(`board:transcript.turn`,{count:G.previous.turn}):I(`board:phone.previousTurn`),G.previous.text].filter(Boolean).join(` · `)}),className:`inline-flex min-h-11 max-w-full min-w-0 items-center gap-1.5 rounded-full px-3 text-xs text-content-muted ring-1 ring-stroke ring-inset transition-colors duration-(--d-fast) hover:bg-surface-hover focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-focus`,onClick:()=>R(!0),children:[(0,Z.jsx)(ze,{status:G.previous.failed?`failed`:`done`,className:q(`size-3.5 flex-none`,G.previous.failed?`text-st-fail`:`text-st-done`)}),(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:[G.previous.turn?I(`board:transcript.turn`,{count:G.previous.turn}):I(`board:phone.previousTurn`),G.previous.text,G.previous.operations?I(`board:transcript.operations`,{count:G.previous.operations}):``].filter(Boolean).join(` · `)}),(0,Z.jsx)(b,{className:`size-3.5 flex-none`,"aria-hidden":`true`})]})}),!te&&(o||u||d)&&(0,Z.jsx)(`div`,{className:`history-page-loader flex w-[min(var(--chat-content-width,1040px),100%)] min-h-[42px] items-center justify-center gap-[7px] [margin:0_auto_18px] text-[var(--text-muted)] text-[12px]`,children:d?(0,Z.jsxs)(J,{type:`button`,variant:`secondary`,size:`sm`,className:`max-[650px]:h-11`,onClick:Se,children:[(0,Z.jsx)(P,{size:13}),I(`chat:focusSession.retryOlderMessages`)]}):u?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(le,{className:`size-3.5`}),I(`chat:focusSession.loadingOlderMessages`)]}):(0,Z.jsxs)(J,{type:`button`,variant:`secondary`,size:`sm`,className:`max-[650px]:h-11`,onClick:Se,children:[(0,Z.jsx)(g,{className:`history-up-arrow [.history-page-loader_&]:[transform:rotate(180deg)]`,size:14}),I(`chat:focusSession.loadOlderMessages`)]})})]}),i===`loading`&&(0,Z.jsx)(rr,{label:I(`chat:focusSession.loadingConversationHistory`)}),i===`ready`&&!n.length&&(t??(0,Z.jsx)(`div`,{className:`agent-welcome relative grid min-h-full place-content-center justify-items-center text-center text-muted-foreground [[data-mobile-keyboard='open']_&]:pointer-events-none [[data-mobile-keyboard-transition='opening']_&]:pointer-events-none [[data-mobile-keyboard-transition='closing']_&]:pointer-events-none`,children:(0,Z.jsx)(nr,{})})),i===`ready`&&n.length>0&&(0,Z.jsx)(`div`,{className:`[animation:transcript-reveal-enter_.22s_var(--ease-out)_both]`,children:(0,Z.jsx)(Qn,{layoutMeasurementKey:r,sessionId:e,messages:ne,historical:c,streaming:y,latestRunProps:xe,scrollElement:ge,prefixRef:ee,cwd:O,targetEntryId:U,onContentSizeChange:ye,onTargetScroll:be,onTargetLocated:t=>{de(e,t),W(``)},onBranchFromHere:j,onCreateChildSession:M,onRetryLastTurn:N,turnsKnown:!o,turnBase:te&&G?G.turnBase:0},e)})]}),i===`ready`&&n.length>0&&(0,Z.jsx)(`div`,{"aria-hidden":`true`,className:`pointer-events-none absolute inset-x-0 top-0 z-[2] h-6 bg-linear-to-b from-panel to-transparent max-[650px]:h-10`}),(ve||c)&&(0,Z.jsx)(`div`,{className:`pointer-events-none absolute inset-x-0 bottom-[6px] z-[5] flex justify-center`,children:(0,Z.jsxs)(J,{type:`button`,variant:`secondary`,size:`sm`,className:`pointer-events-auto rounded-full px-3 shadow-float max-[650px]:h-11`,disabled:B,"aria-busy":B||void 0,onClick:async()=>{if(!c){Y(`smooth`);return}let t=e;if(c){V(!0);try{await l?.()}finally{H.current===t&&V(!1)}}H.current===t&&requestAnimationFrame(()=>Y(`auto`))},children:[(0,Z.jsx)(g,{size:14}),I(c?`chat:focusSession.returnToLatest`:`chat:focusSession.newContent`)]})})]})}(0,X.lazy)(()=>t(()=>import(`./ClickSpark-DmnEAJNI.js`).then(e=>({default:e.ClickSpark})),__vite__mapDeps([7,1,2,3,4,6])));var sr=(0,X.createContext)(null),cr=({className:e,approval:t,state:n,...r})=>{let i=(0,X.useMemo)(()=>({approval:t,state:n}),[t,n]);return!t||n===`input-streaming`||n===`input-available`?null:(0,Z.jsx)(sr.Provider,{value:i,children:(0,Z.jsx)(je,{className:q(`flex flex-col gap-2`,e),...r})})},lr=(0,X.lazy)(async()=>{let[{ApprovalConfirm:e}]=await Promise.all([t(()=>import(`./approval-confirm-ByiI22Wo.js`),__vite__mapDeps([8,1,2,9,10,11,12,13,14,15,16,17,3,4,18,19,20,21,22,23,24,25,26,27,28,29])),o()]);return{default:e}});function $(e){return typeof e==`string`?e:``}function ur(e){let t=e.args&&typeof e.args==`object`&&!Array.isArray(e.args)?e.args:{};return{id:$(e.id),toolName:$(e.toolName),toolCallId:$(e.toolCallId),args:t,command:$(t.command),path:$(t.path),reason:$(e.reason),risk:$(e.risk),severity:`critical`,createdAt:$(e.createdAt)||null}}function dr(e){return e.trimStart().startsWith(`命令守卫拦截`)&&e.trimStart().slice(6).replace(/^[\s::·-]+/u,``).split(/[\n。;;]/u)[0]?.trim()||``}function fr({text:e,prefix:t}){let{t:n}=s(),r=(0,X.useRef)(null),[i,a]=(0,X.useState)(!1),[o,c]=(0,X.useState)(!1);return(0,X.useLayoutEffect)(()=>{let e=r.current;if(!e||o)return;let t=()=>a(e.scrollHeight>e.clientHeight+1);if(t(),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[o,e]),(0,Z.jsxs)(`div`,{className:`min-w-0 rounded-sm border border-well-stroke bg-well`,"data-approval-command":!0,children:[(0,Z.jsx)(`div`,{className:`px-2.5 py-1.5`,children:(0,Z.jsxs)(`pre`,{ref:r,className:q(`min-w-0 font-mono text-xs leading-5 whitespace-pre-wrap wrap-anywhere text-well-text`,!o&&`line-clamp-3`),children:[t&&(0,Z.jsxs)(`span`,{className:`text-well-muted select-none`,children:[t,` `]}),e]})}),(i||o)&&(0,Z.jsx)(`button`,{type:`button`,className:`w-full border-t border-well-stroke px-2.5 py-1 text-left text-xs text-content-secondary hover:text-content focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus max-[650px]:min-h-11 pointer-coarse:min-h-11`,"aria-expanded":o,onClick:()=>c(e=>!e),children:n(o?`board:card.collapse`:`board:card.expand`)})]})}function pr({approvals:e,onResolve:t,compact:n=!1,sessionTitle:r=``,cwd:i=``}){let{t:a}=s(),o=u(),[c,d]=(0,X.useState)(!1),[f,p]=(0,X.useState)(!1),[g,v]=(0,X.useState)(!1),[y]=(0,X.useState)(()=>Be()),x=(0,X.useRef)(!1),[S,C]=(0,X.useState)(``),w=(0,X.useRef)(null),T=ge(e=>e.boardBindings),E=e[0];(0,X.useEffect)(()=>{p(!1),v(!1),C(``)},[E?.id]);let k=E?.id;if((0,X.useEffect)(()=>{if(!k)return;let e=e=>{if(he(e)||ve(e.target)||e.target instanceof Element&&e.target.closest(`[data-shell-sidebar]`))return;let t=w.current;if(!t||t.getClientRects().length===0)return;let n=_e(e,T.boardApprove)?`[data-approval-primary]`:_e(e,T.boardDeny)?`[data-approval-deny]`:``,r=n?t.querySelector(n):null;!r||r.disabled||(e.preventDefault(),r.focus())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[k,T.boardApprove,T.boardDeny]),!E)return null;let A=l(E)===`critical`,j=E.fileChange,M=typeof j?.diff==`string`?j.diff:``,N=E.args&&typeof E.args==`object`&&!Array.isArray(E.args)?E.args:{},F=$(N.command)||$(N.path),I=A?dr($(E.reason)):``,z=I?``:$(E.reason),B=A&&!y,V=async e=>{if(!x.current){x.current=!0,d(!0);try{await t(E.id,e)}finally{x.current=!1,d(!1)}}},H=!A&&E.toolName===`bash`&&i?m($(N.command)):``,ee=async()=>{if(!(x.current||!H)){x.current=!0,d(!0),C(``);try{await h.add({effect:`allow`,tool:`bash`,pattern:H,cwd:i}),await t(E.id,!0)}catch(e){C(e instanceof Error?e.message:String(e))}finally{x.current=!1,d(!1)}}};return(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1.5`,ref:w,"data-approval-stack":!0,children:[(0,Z.jsxs)(cr,{approval:{id:E.id},state:`approval-requested`,className:`tool-approval grid grid-cols-[minmax(0,1fr)_auto] items-center gap-x-3 gap-y-2.5 rounded-(--r-lg) border border-st-attn-border bg-st-attn-soft px-3.5 py-3 text-foreground [&.compact]:px-2.5 [&.compact]:py-1.5 max-[470px]:grid-cols-1 ${n?`compact`:``}`,"data-pisper-approval-id":E.id,"data-approval-current":!0,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5 [grid-column:1/-1]`,children:[(0,Z.jsx)(`span`,{className:`grid size-[18px] flex-none place-items-center text-st-attn`,children:A?(0,Z.jsx)(L,{size:16,strokeWidth:1.75}):(0,Z.jsx)(R,{size:16,strokeWidth:1.75})}),(0,Z.jsx)(`strong`,{className:`min-w-0 flex-1 truncate text-[13.5px] font-medium`,children:a(`chat:focusSession.toolRequestsApproval`,{tool:E.toolName})}),(0,Z.jsx)(`span`,{className:q(`min-w-0 flex-none truncate text-xs`,A?`font-medium text-st-attn`:`text-content-muted`),"data-severity":A?`critical`:`standard`,children:A?I?a(`board:card.criticalWithReason`,{reason:I}):a(`board:card.critical`):a(`board:card.standard`)})]}),F&&(0,Z.jsx)(`div`,{className:`min-w-0 [grid-column:1/-1]`,children:(0,Z.jsx)(fr,{text:F,prefix:N.command?`$`:``})}),z&&(0,Z.jsx)(`p`,{className:`min-w-0 text-xs text-content-secondary [grid-column:1/-1] [overflow-wrap:anywhere]`,children:z}),!n&&(M||Object.keys(N).length>0)&&(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-start gap-x-3 gap-y-1.5 [grid-column:1/-1]`,children:[M&&(0,Z.jsxs)(`button`,{type:`button`,className:`tool-approval-view-diff inline-flex min-h-7 flex-none cursor-pointer items-center gap-1.5 rounded-sm border border-stroke-strong bg-solid px-2 text-xs font-medium text-content-secondary transition-colors duration-(--d-fast) hover:bg-surface-hover hover:text-foreground max-[650px]:min-h-11`,onClick:()=>p(!0),children:[(0,Z.jsx)(D,{size:13}),a(`chat:focusSession.gitViewDiff`)]}),(0,Z.jsxs)(`details`,{className:`group/args min-w-0 flex-1 text-xs text-content-muted`,children:[(0,Z.jsxs)(`summary`,{className:`inline-flex min-h-7 cursor-pointer list-none items-center gap-1 rounded-sm hover:text-foreground focus-visible:outline-2 focus-visible:outline-focus max-[650px]:min-h-11 [&::-webkit-details-marker]:hidden`,children:[(0,Z.jsx)(b,{size:13,className:`transition-transform duration-(--d-fast) group-open/args:rotate-90`}),a(`chat:focusSession.viewCallArguments`)]}),(0,Z.jsx)(`pre`,{className:`mt-1.5 max-h-[130px] overflow-auto rounded-sm border border-well-stroke bg-well p-[8px_10px] font-mono text-xs leading-[1.6] whitespace-pre-wrap text-well-text`,children:JSON.stringify(E.args,null,2)})]})]}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center justify-between gap-2 [grid-column:1/-1]`,children:[(0,Z.jsx)(J,{type:`button`,variant:`outline`,size:`sm`,className:`bg-solid max-[650px]:h-11 max-[650px]:px-4`,disabled:c,"data-approval-deny":!0,onClick:()=>V(!1),children:a(`chat:focusSession.deny`)}),(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2.5`,children:[B&&(0,Z.jsx)(`span`,{className:`min-w-0 truncate text-xs text-content-muted max-[470px]:hidden`,children:a(o?`board:confirm.hintTouch`:`board:card.holdHint`)}),H&&(0,Z.jsx)(J,{type:`button`,variant:`outline`,size:`sm`,className:`min-w-0 bg-solid max-[650px]:h-11 max-[650px]:px-4`,disabled:c,"data-approval-allow-rule":!0,title:a(`chat:focusSession.allowAlwaysHint`,{prefix:H}),onClick:()=>void ee(),children:(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:a(`chat:focusSession.allowAlways`,{prefix:H})})}),B?(0,Z.jsxs)(Ve,{size:`sm`,className:`max-[650px]:h-11 max-[650px]:px-4`,disabled:c,"data-approval-critical":!0,"data-approval-primary":!0,"data-approval-hold":!0,"aria-label":a(`board:card.holdToApprove`),onConfirm:()=>void V(!0),onActivate:()=>v(!0),children:[c?(0,Z.jsx)(P,{className:`animate-spin`,size:12}):(0,Z.jsx)(_,{size:12}),a(`board:card.holdToApprove`)]}):(0,Z.jsxs)(J,{type:`button`,size:`sm`,variant:A?`outline`:`default`,className:q(`max-[650px]:h-11 max-[650px]:px-4`,A&&`bg-solid`),disabled:c,"data-approval-critical":A||void 0,"data-approval-primary":!0,"aria-haspopup":A?`dialog`:void 0,onClick:()=>A?v(!0):V(!0),children:[c?(0,Z.jsx)(P,{className:`animate-spin`,size:12}):(0,Z.jsx)(_,{size:12}),a(A?`board:card.approveCritical`:`chat:focusSession.allow`)]})]})]}),S&&(0,Z.jsx)(`p`,{role:`alert`,className:`min-w-0 text-xs text-danger [grid-column:1/-1]`,children:S}),A&&g&&(0,Z.jsx)(X.Suspense,{fallback:null,children:(0,Z.jsx)(lr,{target:{sessionId:``,title:r||$(E.toolName),cwd:i,approval:ur(E)},phone:o,pending:c,error:``,onConfirm:()=>{V(!0).then(()=>v(!1),()=>void 0)},onOpenChange:e=>{e||v(!1)}})}),f&&(0,Z.jsx)(O,{diff:M,truncated:!!j?.truncated,onClose:()=>p(!1)})]}),e.length>1&&(0,Z.jsxs)(`p`,{className:`flex min-h-8 min-w-0 items-center gap-2 rounded-(--r-md) border border-st-attn-border px-3 text-xs text-st-attn`,"data-approval-more":e.length-1,children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`size-2 flex-none rounded-full bg-st-attn-fill`}),a(`board:card.moreWaiting`,{count:e.length-1})]})]})}function mr(e,t){return e?.streaming?!0:!e?.loaded&&!!t?.streaming}var hr={session:null,expiresAt:null,created:!1,loading:!1,error:``,draft:``,expired:!1},gr=(0,X.createContext)(null);function _r(e){let t=(0,X.useContext)(gr);if(!t)throw Error(`Side chat requires its runtime provider`);return{...t,entry:t.entries[e]??hr}}export{et as A,it as C,ft as D,st as E,Qe as M,Xe as N,lt as O,Ye as P,nt as S,pt as T,St as _,pr as a,_t as b,qt as c,Et as d,Ot as f,xt as g,Ct as h,mr as i,$e as j,tt as k,kt as l,wt as m,gr as n,or as o,Tt as p,_r as r,Xt as s,hr as t,Dt as u,ht as v,ct as w,gt as x,vt as y};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ManageProjectsDialog-RiFg3h1p.js","assets/rolldown-runtime-B0Z9INg1.js","assets/vendor-react-DwNgTV1j.js","assets/use-i18n-B5p-Kzvz.js","assets/i18n-CHmr7GzM.js","assets/vendor-router-CSN_DGvx.js","assets/index-CsE52ydO.js","assets/index-CfTBR7Rs.css","assets/storage-BY6wEHPw.js","assets/vendor-state-GkUciC5H.js","assets/createLucideIcon-Cd-3GVxJ.js","assets/arrow-down-CDGua-ue.js","assets/arrow-up-DST6-qVQ.js","assets/folder-plus-OPHZsJho.js","assets/pencil-U08v_vV9.js","assets/rotate-ccw-C0v8V77_.js","assets/trash-2-CNrPOoPR.js","assets/utils-C8uzG5AZ.js","assets/vendor-ui-DvrYggeS.js","assets/button-CCcCN8tE.js","assets/dist-41X0pdUs.js","assets/useSessionListQuery-D44XZfGr.js","assets/query-Bj-DUNYq.js","assets/useQuery-DdcpUQhO.js","assets/startup-queries-6Oztqpto.js","assets/mutation-CEbxdVYy.js","assets/api-BO7LAPSQ.js","assets/abort-signal-f4JsiYKX.js","assets/component-changes-Q9Bf64Ob.js","assets/runtime-capabilities-store-C2Qv7uDP.js","assets/runtime-capabilities-4_ZwLBqF.js","assets/session-board-status-D2lpFPiI.js","assets/chat-api-DkdyVQY9.js","assets/session-organization-api-DFu3Chto.js","assets/events-DrAPv0se.js","assets/session-workspaces-BWTBYaGT.js","assets/session-questions-Cf-1g85h.js","assets/card-presentation-1oph2b8P.js","assets/dialog-CUhFgsVd.js","assets/x-07u4-129.js","assets/dist-BHkR6BLP.js","assets/dist-BsRXXcSL.js","assets/es2015-DTZdOI9P.js","assets/workspace-order-store-RYWvGOeR.js","assets/board-projects-BU9fZB1q.js","assets/WorkspacePicker-B9vYtfab.js","assets/check-2vYc6QaP.js","assets/triangle-alert-CE1q54ci.js","assets/input-CPw-zkYh.js","assets/alert-firawb0H.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{c as t,h as n}from"./vendor-router-CSN_DGvx.js";import{i as r,r as i}from"./vendor-react-DwNgTV1j.js";import{f as a}from"./routes-Da0OHSy6.js";import{t as o}from"./use-i18n-B5p-Kzvz.js";import{t as s}from"./createLucideIcon-Cd-3GVxJ.js";import{t as c}from"./chevron-down-CxtxIjiP.js";import{t as l}from"./chevron-right-C3t2Rckj.js";import{t as u}from"./ellipsis-CfGKfbq6.js";import{_ as d,a as f,c as p,d as m,g as h,i as g,l as _,n as v,o as y,p as b,r as x,s as S,t as C,u as w}from"./useSessionRowActions-Cr6SUAeE.js";import{t as T}from"./folder-plus-OPHZsJho.js";import{i as E}from"./useNewProjectPicker-DQY1X_ua.js";import{t as D}from"./pin-CU0FG0lI.js";import{t as O}from"./rotate-ccw-clock-CO6Bw-sF.js";import{i as k,p as A,r as j,t as M}from"./dropdown-menu-CFIFNaKO.js";import{t as N}from"./utils-C8uzG5AZ.js";import{c as P,g as F}from"./shortcuts-Cvp9WD9O.js";import{t as I}from"./sidebar-store-1-aNPlDu.js";import{n as ee}from"./useSessionListQuery-D44XZfGr.js";import{c as L,l as te,n as R,r as z,t as B}from"./useNow-Bxn4_OW9.js";import{t as V}from"./useBoardItems-CzEbgTLJ.js";import{t as H}from"./useSidebarModel-CWED0rsw.js";import{t as U}from"./new-task-C3wuHTor.js";import{t as W}from"./shortcut-aria-jHRmld9z.js";import{t as G}from"./StatusGlyph-1KgitlUg.js";import{t as K}from"./sidebar-commands-ZA1UOA_F.js";var ne=s(`layout-list`,[[`rect`,{width:`7`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`1g98yp`}],[`rect`,{width:`7`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`1bb6yr`}],[`path`,{d:`M14 4h7`,key:`3xa0d5`}],[`path`,{d:`M14 9h7`,key:`1icrd9`}],[`path`,{d:`M14 15h7`,key:`1mj8o2`}],[`path`,{d:`M14 20h7`,key:`11slyb`}]]),q=e(r(),1),J=i(),Y=160,X=600;function re(e,t){switch(t){case`attention`:return e(`board:sidebar.group.attention`);case`running`:return e(`board:sidebar.group.running`);case`queued`:return e(`board:sidebar.group.queued`);case`pinned`:return e(`board:sidebar.group.pinned`);default:return e(`board:sidebar.group.done`)}}function Z(e){return e?[...e.querySelectorAll(`[data-sidebar-row]`)]:[]}function Q(e,t={}){$(()=>e(Z(document.querySelector(`[data-sidebar-groups]`))),t)}function $(e,{unclaimed:t=!1}={}){let n=0,r=()=>{let i=document.activeElement;if(t&&i&&i!==document.body&&!i.closest(`[data-shell-sidebar]`))return;let a=e();if(a){a.focus(),a.scrollIntoView?.({block:`nearest`});return}(n+=1)<20&&requestAnimationFrame(r)};requestAnimationFrame(r)}function ie({resolveCurrentId:e,renderedSessionId:t,onOpenSession:n,onWaiting:r}){let{t:i}=o(),{model:a,isLoading:s}=H(),c=(0,q.useRef)(a);c.current=a;let l=(0,q.useRef)({resolveCurrentId:e,onOpenSession:n});l.current={resolveCurrentId:e,onOpenSession:n},(0,q.useEffect)(()=>{let e=e=>{let t=e.detail;if(!t)return;let n=c.current;if(t.kind===`adjacent`){let e=I.getState().doneCollapsed?n.groups.flatMap(e=>e.id===`done`?[]:e.rows.map(e=>e.id)):n.order,r=z(e,l.current.resolveCurrentId()||null,t.direction);r&&l.current.onOpenSession(r);return}let r=I.getState();if(document.documentElement.hasAttribute(`data-phone-shell`)){let e=t.kind===`focus-attention`?n.longestWaitingId:l.current.resolveCurrentId();if(t.kind===`focus-attention`&&!e)return;r.setDrawerOpen(!0),Q(n=>n.find(t=>t.dataset.sidebarRow===e)??(t.kind===`focus-list`?n[0]:void 0));return}let i=document.querySelector(`[data-settings-sidebar]`);if(i){let e=t.kind===`focus-attention`?`[data-sidebar-fleet-line]`:`[data-settings-section][aria-current="page"]`;$(()=>i.querySelector(e)??void 0);return}let a=document.querySelector(`[data-overview]`);if(t.kind===`focus-attention`){let e=n.longestWaitingId;if(!e)return;if(a){h(e);return}r.collapsed&&r.setPeeking(!0),Q(t=>t.find(t=>t.dataset.sidebarRow===e));return}if(r.collapsed&&r.setPeeking(!0),a){$(()=>{let e=document.querySelector(`[data-shell-sidebar] [data-sidebar-filters]`);return e?.querySelector(`[data-sidebar-filter][aria-pressed="true"]`)??e?.querySelector(`[data-sidebar-filter]`)??void 0});return}let o=l.current.resolveCurrentId();Q(e=>e.find(e=>e.dataset.sidebarRow===o)??e[0])};return window.addEventListener(K,e),()=>window.removeEventListener(K,e)},[]);let u=(0,q.useRef)(t),d=(0,q.useRef)(null);(0,q.useEffect)(()=>{let e=u.current;if(u.current=t,t===null){e&&(d.current=e);return}if(e!==null)return;let n=d.current;d.current=null,!(!n||n!==t||I.getState().collapsed)&&Q(e=>e.find(e=>e.dataset.sidebarRow===n),{unclaimed:!0})},[t]);let f=(0,q.useRef)(r);f.current=r;let p=(0,q.useRef)(null),[m,g]=(0,q.useState)(``);return(0,q.useEffect)(()=>{if(s)return;let e=a.groups.find(e=>e.id===`attention`)?.rows??[],t=p.current;if(p.current=new Set(e.map(e=>e.id)),!t)return;let n=e.filter(e=>!t.has(e.id));if(n.length){for(let e of n)e.reasons.some(e=>e.kind===`approval`||e.kind===`question`)&&f.current?.({title:e.title,reason:w(i,e.reasons)});g(n.map(e=>i(`board:sidebar.announce`,{title:e.title,reason:w(i,e.reasons)})).join(i(`board:sidebar.announceSeparator`)))}},[a.groups,s,i]),(0,J.jsx)(`p`,{"data-sidebar-announce":!0,"aria-live":`polite`,role:`status`,className:`sr-only`,children:m})}function ae({onOpenBoard:e}){let{t}=o(),{model:n,isLoading:r}=H(),i=L(e=>e.setLaneFilter),a=t=>{i([t]),e()},s=n.counts.attention,c=n.counts.running,l=`grid size-10 place-items-center rounded-[var(--r-md)] text-xs font-semibold tabular-nums transition-colors duration-(--d-fast) focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-focus pointer-coarse:size-11`;return(0,J.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,"aria-busy":r||void 0,children:[(0,J.jsx)(`button`,{type:`button`,"data-rail-count":`attention`,"aria-label":t(`board:sidebar.railAttention`,{count:s}),title:t(`board:sidebar.railAttention`,{count:s}),className:N(l,s>0?`bg-warning-soft text-warning-strong ring-1 ring-st-attn-border ring-inset hover:brightness-[.98]`:`text-content-muted hover:bg-surface-hover`),onClick:()=>a(`attention`),children:(0,J.jsxs)(`span`,{className:`flex flex-col items-center gap-0.5 leading-none`,children:[(0,J.jsx)(G,{status:`attention`,className:N(`size-3.5`,s===0&&`text-content-faint`)}),(0,J.jsx)(`span`,{children:s})]})}),(0,J.jsx)(`button`,{type:`button`,"data-rail-count":`running`,"aria-label":t(`board:sidebar.railRunning`,{count:c}),title:t(`board:sidebar.railRunning`,{count:c}),className:N(l,`hover:bg-surface-hover`,c>0?`text-content-secondary`:`text-content-muted`),onClick:()=>a(`running`),children:(0,J.jsxs)(`span`,{className:`flex flex-col items-center gap-0.5 leading-none`,children:[(0,J.jsx)(G,{status:`run`,spin:c>0,className:N(`size-3.5`,c===0&&`text-content-faint`)}),(0,J.jsx)(`span`,{children:c})]})})]})}function oe({onOpenBoard:e}){let{t}=o(),{model:n,isLoading:r}=H(),i=L(e=>e.setLaneFilter),a=n.counts.attention,s=n.counts.running;return(0,J.jsxs)(`button`,{type:`button`,"data-sidebar-fleet-line":!0,"aria-busy":r||void 0,"aria-label":t(`board:sidebar.fleet.label`,{attention:a,running:s}),className:`flex h-10 w-full min-w-0 items-center gap-1.5 rounded-[var(--r-md)] px-2.5 text-left text-[12.5px] text-content-secondary transition-colors duration-(--d-fast) hover:bg-surface-hover focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus pointer-coarse:h-11`,onClick:()=>{i([]),e()},children:[(0,J.jsx)(G,{status:`attention`,className:N(`size-3.5 flex-none`,a===0&&`text-content-faint`)}),(0,J.jsx)(`span`,{"data-sidebar-fleet":`attention`,className:N(`truncate`,a>0&&`font-medium text-warning-strong`),children:t(`board:sidebar.fleet.attention`,{count:a})}),(0,J.jsx)(`span`,{"aria-hidden":`true`,className:`text-content-faint`,children:`·`}),(0,J.jsx)(G,{status:`run`,spin:s>0,className:`size-3.5 flex-none`}),(0,J.jsx)(`span`,{"data-sidebar-fleet":`running`,className:`truncate`,children:t(`board:sidebar.fleet.running`,{count:s})}),(0,J.jsx)(l,{className:`ml-auto size-3.5 flex-none text-content-muted`,"aria-hidden":`true`})]})}function se({currentId:e,notify:n,requestText:r,onOpenSession:i,onOpenBoard:s,onOpenHistory:c,onArchived:l,drawer:u=!1}){let{t:d}=o(),{model:f,isLoading:p,error:m,refetch:h}=H(),_=te(),v=(0,q.useRef)(_);v.current=_;let y=I(e=>e.doneCollapsed),b=I(e=>e.setDoneCollapsed),x=L(e=>e.setLaneFilter),S=P(e=>e.boardBindings),w=t(`/`),T=(0,q.useCallback)(e=>w.replace(/\/$/,``)+a(e),[w]),E=f.counts.attention+f.counts.running>0,D=R(E),k=(0,q.useRef)(null),[A,j]=(0,q.useState)(()=>new Set),M=(e,t)=>j(n=>{let r=new Set(n);return t?r.add(e):r.delete(e),r}),N=(0,q.useRef)(null),[ee,z]=(0,q.useState)(()=>new Set),B=(0,q.useMemo)(()=>f.groups.find(e=>e.id===`attention`)?.rows??[],[f.groups]),V=(0,q.useRef)(new Set);V.current=new Set(B.map(e=>e.id)),(0,q.useEffect)(()=>{if(p)return;let e=new Set(B.map(e=>e.id)),t=N.current;if(N.current=e,!t)return;let n=B.filter(e=>!t.has(e.id));n.length&&z(new Set(n.map(e=>e.id)))},[B,p]);let U=C({notify:n,requestText:r,onOpenSession:i,onArchived:l}),W=U.report,G=(0,q.useCallback)(async(e,t,n)=>{if(e.quickAction.kind!==`decide`){i(e.id);return}let{approvalId:r,remaining:a}=e.quickAction,o=a===0,s=!!n?.contains(document.activeElement),c=Z(k.current),l=c.findIndex(t=>t.dataset.sidebarRow===e.id),u=c[l+1]??c[l-1];s&&o&&u?.focus();let d=!1,f=o?g(n,{duration:160,scale:.6}).then(()=>{d||M(e.id,!0)}):Promise.resolve(),p=t?await v.current.approve(e.id,r,{confirmCritical:!1}):await v.current.deny(e.id,r);if(p.ok){if(!o||(await f,!V.current.has(e.id)))return;M(e.id,!1),n?.getAnimations?.().forEach(e=>e.cancel());return}d=!0,await f,M(e.id,!1),n?.getAnimations?.().forEach(e=>e.cancel()),p.reason===`confirmation-required`?i(e.id):W(p)},[i,W]);(0,q.useEffect)(()=>{j(e=>{if(!e.size)return e;let t=new Set(B.map(e=>e.id)),n=new Set([...e].filter(e=>t.has(e)));return n.size===e.size?e:n})},[B]);let K=(0,q.useMemo)(()=>({...U,decide:(e,t,n)=>void G(e,t,n)}),[G,U]),ne=(e,t)=>{if(e.altKey||e.metaKey||e.ctrlKey)return;if(e.key===`ArrowDown`||e.key===`ArrowUp`){e.preventDefault();let t=Z(k.current);t[t.indexOf(e.currentTarget)+(e.key===`ArrowDown`?1:-1)]?.focus();return}if(t.group!==`attention`||e.shiftKey)return;let n=F(e.nativeEvent,S.boardApprove),r=!n&&F(e.nativeEvent,S.boardDeny);!n&&!r||(e.preventDefault(),t.quickAction.kind===`decide`&&K.decide(t,n,e.currentTarget.closest(`[data-sidebar-item]`)))},Y=()=>{x([`running`]),s()};if(p)return(0,J.jsx)(le,{label:d(`board:sidebar.loading`)});let X=!m&&f.groups.every(e=>e.count===0)&&f.groups.length<=2;return(0,J.jsxs)(`div`,{ref:k,"data-sidebar-groups":!0,className:`flex flex-col gap-3 pb-2`,children:[m&&f.groups.every(e=>e.count===0)?(0,J.jsxs)(`div`,{className:`flex flex-col items-start gap-1.5 px-2.5 py-2 text-xs text-content-muted`,children:[(0,J.jsx)(`p`,{children:d(`board:sidebar.error`)}),(0,J.jsx)(`button`,{type:`button`,className:`rounded-sm text-content-secondary underline underline-offset-2 hover:text-content focus-visible:outline-2 focus-visible:outline-focus`,onClick:h,children:d(`board:sidebar.retry`)})]}):X?(0,J.jsx)(`p`,{className:`px-2.5 py-2 text-xs leading-5 text-content-muted`,children:d(`board:sidebar.empty`)}):f.groups.map(t=>(0,J.jsx)(de,{group:t,title:re(d,t.id),collapsed:t.id===`done`&&y,onToggle:t.id===`done`?()=>b(!y):void 0,footer:t.id===`running`&&t.hidden>0?(0,J.jsx)(ue,{onClick:Y,children:d(`board:sidebar.moreRunning`,{count:t.hidden})}):t.id===`done`&&t.hidden>0?(0,J.jsx)(ue,{onClick:c,children:d(`board:sidebar.allDone`)}):null,emptyText:t.id===`attention`?d(`board:sidebar.emptyAttention`):t.id===`running`?d(`board:sidebar.emptyRunning`):``,children:t.rows.map(t=>(0,J.jsx)(fe,{row:t,href:T(t.id),current:t.id===e,now:D,hidden:A.has(t.id),fresh:ee.has(t.id),handlers:K,approveBinding:S.boardApprove,denyBinding:S.boardDeny,onKeyDown:ne,drawer:u},t.id))},t.id)),(0,J.jsxs)(`a`,{href:w.replace(/\/$/,``)+`/chat/history`,className:`flex h-8 items-center gap-2 rounded-[var(--r-md)] px-2.5 text-[13px] text-content-muted transition-colors duration-(--d-fast) hover:bg-surface-hover hover:text-content-secondary focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus pointer-coarse:h-11`,onClick:e=>{ce(e)&&(e.preventDefault(),c())},children:[(0,J.jsx)(O,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":`true`}),d(`board:sidebar.history`)]})]})}function ce(e){return e.button===0&&!e.metaKey&&!e.ctrlKey&&!e.shiftKey&&!e.altKey}function le({label:e}){return(0,J.jsx)(`div`,{role:`status`,"aria-busy":`true`,"aria-label":e,className:`flex flex-col gap-1 px-1 pt-1`,children:[64,48,72,56].map(e=>(0,J.jsxs)(`div`,{className:`flex h-9 items-center gap-2.5 px-1.5`,"aria-hidden":`true`,children:[(0,J.jsx)(`span`,{className:`size-4 flex-none rounded-full bg-surface-hover`}),(0,J.jsx)(`span`,{className:`h-3 rounded-sm bg-surface-hover`,style:{width:`${e}%`}})]},e))})}function ue({children:e,onClick:t}){return(0,J.jsx)(`button`,{type:`button`,className:`flex h-7 w-full items-center gap-1 rounded-[var(--r-md)] px-2.5 pl-[34px] text-left text-xs text-content-muted transition-colors duration-(--d-fast) hover:bg-surface-hover hover:text-content-secondary focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus pointer-coarse:h-11`,onClick:t,children:e})}function de({group:e,title:t,collapsed:n,onToggle:r,footer:i,emptyText:a,children:o}){let s=`sidebar-group-${e.id}`,u=e.id===`attention`,d=(0,J.jsx)(`span`,{"data-sidebar-count":!0,className:N(`tabular-nums`,u&&e.count>0&&`inline-grid h-[18px] min-w-[18px] place-items-center rounded-full bg-warning-soft px-1.5 text-[11.5px] font-semibold ring-1 ring-st-attn-border ring-inset`),children:e.count}),f=N(`flex h-7 items-center gap-1.5 px-2.5 text-xs font-medium`,u&&e.count>0?`text-warning-strong`:`text-content-muted`);return(0,J.jsxs)(`section`,{"aria-labelledby":s,"data-sidebar-group":e.id,children:[(0,J.jsx)(`h2`,{id:s,className:`m-0`,children:r?(0,J.jsxs)(`button`,{type:`button`,"aria-expanded":!n,className:N(f,`w-full rounded-[var(--r-md)] text-left hover:text-content-secondary focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus pointer-coarse:h-11`),onClick:r,children:[t,d,n?(0,J.jsx)(l,{className:`size-3`,"aria-hidden":`true`}):(0,J.jsx)(c,{className:`size-3`,"aria-hidden":`true`})]}):(0,J.jsxs)(`span`,{className:f,children:[t,d]})}),!n&&(e.rows.length?(0,J.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-px p-0`,children:o}):a?(0,J.jsx)(`p`,{className:`px-2.5 pl-[34px] text-xs leading-7 text-content-faint`,children:a}):null),!n&&i]})}function fe({row:e,href:t,current:n,now:r,hidden:i,fresh:a,handlers:s,approveBinding:c,denyBinding:l,onKeyDown:u,drawer:d=!1}){let{t:h}=o(),g=(0,q.useRef)(null),v=(0,q.useRef)(null),b=(0,q.useRef)(null),[x,C]=(0,q.useState)(!1),T=e.group===`attention`;(0,q.useLayoutEffect)(()=>{if(!a||!f())return;let e=g.current,t=v.current;e&&typeof e.animate==`function`&&(e.style.transformOrigin=`top center`,e.animate([{transform:`scaleY(.6)`,opacity:0},{transform:`scaleY(1)`,opacity:1}],{duration:Y,easing:`ease-out`})),t&&typeof t.animate==`function`&&t.animate([{transform:`scale(1)`,opacity:.55},{transform:`scale(2.6)`,opacity:0}],{duration:X,easing:`ease-out`})},[a]),(0,q.useLayoutEffect)(()=>{let e=g.current,t=b.current;if(!e||!t)return;let n=()=>e.style.setProperty(`--quick-w`,`${t.offsetWidth+12}px`);if(n(),typeof ResizeObserver!=`function`)return;let r=new ResizeObserver(n);return r.observe(t),()=>r.disconnect()},[]);let E=``,O=``;e.group===`attention`?(E=_(e.waitingSince===null?null:r-e.waitingSince),O=w(h,e.reasons)):E=e.group===`running`?y(e.startedAt===null?null:r-e.startedAt):e.group===`queued`?`#${e.position}`:e.group===`pinned`?S(e.at,r):p(e.finishedAt);let k=e.group===`attention`?E?h(`board:sidebar.attentionRow`,{title:e.title,reason:O,wait:E}):h(`board:sidebar.attentionRowNoWait`,{title:e.title,reason:O}):void 0,A=`flex h-[26px] flex-none items-center gap-1 rounded-[var(--r-sm)] px-2 text-[12.5px] leading-none font-medium transition-colors duration-(--d-fast) focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-focus`;return(0,J.jsxs)(`li`,{ref:g,"data-sidebar-item":e.id,"data-menu-open":x||void 0,hidden:i,className:`group/row relative`,children:[(0,J.jsxs)(`a`,{href:t,"data-sidebar-row":e.id,"data-sidebar-group-row":e.group,"aria-current":n?`page`:void 0,"aria-label":k,className:N(`flex min-w-0 items-center gap-2.5 rounded-[var(--r-md)] px-2.5 text-base text-content [transition:color_var(--d-fast),background-color_var(--d-fast),padding-right_0s_80ms] focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus`,T?d?`h-14`:`h-12 pointer-coarse:h-14`:d?`h-11`:`h-9 pointer-coarse:h-11`,`group-hover/row:pr-[max(10px,var(--quick-w,0px))] group-focus-within/row:pr-[max(10px,var(--quick-w,0px))] group-data-[menu-open]/row:pr-[max(10px,var(--quick-w,0px))]`,n?`bg-surface-active`:`group-hover/row:bg-surface-hover`),onClick:t=>{ce(t)&&(t.preventDefault(),s.open(e))},onKeyDown:t=>u(t,e),children:[(0,J.jsxs)(`span`,{className:N(`relative grid size-4 flex-none place-items-center`,T&&`self-start mt-[7px]`),children:[e.group===`pinned`?(0,J.jsx)(D,{className:`size-3.5 text-content-muted`,strokeWidth:1.75,role:`img`,"aria-label":h(`board:sidebar.group.pinned`)}):(0,J.jsx)(G,{status:e.glyph,phase:e.group===`running`?e.phase:void 0,label:T?void 0:me(h,e)}),T&&(0,J.jsx)(`span`,{ref:v,"aria-hidden":`true`,className:`pointer-events-none absolute inset-1 rounded-full bg-st-attn-fill opacity-0`})]}),(0,J.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,J.jsxs)(`span`,{className:`flex min-w-0 items-baseline gap-1.5`,children:[(0,J.jsx)(`span`,{className:N(`min-w-0 truncate leading-5`,e.group===`done`&&`text-content-secondary`),children:e.title}),e.group===`done`&&e.unread&&(0,J.jsx)(`span`,{role:`img`,"aria-label":h(`board:sidebar.unread`),className:`size-1.5 flex-none translate-y-[-1px] self-center rounded-full bg-content-secondary`})]}),T&&(0,J.jsx)(`span`,{className:`truncate text-xs leading-[17px] text-warning-strong`,children:O})]}),E&&(0,J.jsx)(`span`,{"aria-hidden":T||void 0,className:N(`flex-none text-xs tabular-nums`,e.group===`running`?`font-mono text-content-secondary`:n?`text-content-secondary`:`text-content-muted`,T&&`self-start mt-[7px]`,`max-w-24 overflow-hidden whitespace-nowrap [transition:opacity_120ms_80ms,max-width_0s_80ms] group-hover/row:max-w-0 group-hover/row:opacity-0 group-focus-within/row:max-w-0 group-focus-within/row:opacity-0 group-data-[menu-open]/row:max-w-0 group-data-[menu-open]/row:opacity-0 pointer-coarse:group-hover/row:max-w-24 pointer-coarse:group-hover/row:opacity-100`),children:E})]}),d&&e.group===`attention`&&e.quickAction.kind===`decide`&&(0,J.jsxs)(`div`,{"data-sidebar-drawer-actions":!0,className:`flex gap-2 pr-2.5 pb-1.5 pl-[36px]`,children:[(0,J.jsx)(`button`,{type:`button`,className:`flex h-11 min-w-0 flex-1 items-center justify-center rounded-[var(--r-md)] bg-solid text-sm font-medium text-content ring-1 ring-stroke-strong ring-inset focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-focus active:bg-surface-hover`,"aria-label":h(`board:sidebar.denyNamed`,{title:e.title}),onClick:t=>s.decide(e,!1,t.currentTarget.closest(`[data-sidebar-item]`)),children:h(`board:sidebar.deny`)}),(0,J.jsx)(`button`,{type:`button`,className:`flex h-11 min-w-0 flex-1 items-center justify-center rounded-[var(--r-md)] bg-star text-sm font-medium text-on-accent focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-focus active:bg-star-hover`,"aria-label":h(`board:sidebar.approveNamed`,{title:e.title}),onClick:t=>s.decide(e,!0,t.currentTarget.closest(`[data-sidebar-item]`)),children:h(`board:sidebar.approve`)})]}),(0,J.jsxs)(`div`,{ref:b,"data-sidebar-quick":!0,className:N(`absolute top-1/2 right-1.5 flex -translate-y-1/2 items-center gap-1`,`invisible opacity-0 transition-[opacity,visibility] delay-[80ms] duration-[120ms] group-hover/row:visible group-hover/row:opacity-100 group-focus-within/row:visible group-focus-within/row:opacity-100 group-data-[menu-open]/row:visible group-data-[menu-open]/row:opacity-100 pointer-coarse:hidden`,d&&`hidden`),children:[e.group===`attention`&&(e.quickAction.kind===`decide`?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`button`,{type:`button`,className:N(A,`bg-solid text-content ring-1 ring-stroke-strong ring-inset hover:bg-surface-hover`),"aria-label":h(`board:sidebar.denyNamed`,{title:e.title}),"aria-keyshortcuts":W(l),onClick:t=>s.decide(e,!1,t.currentTarget.closest(`[data-sidebar-item]`)),children:[h(`board:sidebar.deny`),(0,J.jsx)(pe,{binding:l})]}),(0,J.jsxs)(`button`,{type:`button`,className:N(A,`bg-star text-on-accent hover:bg-star-hover`),"aria-label":h(`board:sidebar.approveNamed`,{title:e.title}),"aria-keyshortcuts":W(c),onClick:t=>s.decide(e,!0,t.currentTarget.closest(`[data-sidebar-item]`)),children:[h(`board:sidebar.approve`),(0,J.jsx)(pe,{binding:c})]})]}):(0,J.jsxs)(`button`,{type:`button`,className:N(A,`bg-solid text-content ring-1 ring-stroke-strong ring-inset hover:bg-surface-hover`),"aria-label":h(`board:sidebar.openNamed`,{title:e.title}),onClick:()=>s.open(e),children:[h(`board:sidebar.open`),(0,J.jsx)(`span`,{"aria-hidden":`true`,className:`text-content-faint`,children:`↵`})]})),(0,J.jsx)(m,{row:e,actions:s,canMarkHandled:e.group===`attention`&&e.status===`failed`,open:x,onOpenChange:C,side:`right`})]})]})}function pe({binding:e}){let t=e&&/^Key[A-Z]$/.test(e)?e.slice(3):``;return t?(0,J.jsx)(`span`,{"aria-hidden":`true`,className:`font-normal opacity-60`,children:t}):null}function me(e,t){switch(t.glyph){case`run`:return e(`common:statusGlyph.run`);case`queued`:return e(`common:statusGlyph.queued`);case`failed`:return e(`common:statusGlyph.failed`);case`stopped`:return e(`common:statusGlyph.stopped`);case`attention`:return e(`common:statusGlyph.attention`);default:return e(`common:statusGlyph.done`)}}var he=(0,q.lazy)(()=>n(()=>import(`./ManageProjectsDialog-RiFg3h1p.js`).then(e=>({default:e.ManageProjectsDialog})),__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]))),ge=(0,q.lazy)(()=>n(()=>import(`./WorkspacePicker-B9vYtfab.js`).then(e=>({default:e.WorkspacePicker})),__vite__mapDeps([45,1,2,3,4,5,6,7,8,9,10,46,47,19,18,20,17,38,39,40,41,42,48,49]))),_e=[{lane:`attention`,glyph:`attention`},{lane:`running`,glyph:`run`},{lane:`queued`,glyph:`queued`},{lane:`done`,glyph:`done`}],ve=`flex h-8 w-full min-w-0 items-center gap-2.5 rounded-[var(--r-md)] px-2.5 text-left text-[13.5px] text-content transition-colors duration-(--d-fast) hover:bg-surface-hover focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus pointer-coarse:h-11`,ye=`flex h-7 min-w-0 flex-1 items-center px-2.5 text-xs font-medium text-content-muted`;function be(e){return e?[...e.querySelectorAll(`[data-sidebar-filter]`)]:[]}function xe({notify:e,requestConfirm:n,requestText:r,onNewTask:i,onOpenHistory:a}){let{t:s}=o(),{items:c,capabilities:l,isLoading:f}=V(`today`),p=B(),m=L(e=>e.lanes),h=L(e=>e.projects),g=L(e=>e.setLaneFilter),_=L(e=>e.setProjectFilter),y=L(e=>e.clearFilters),S=(0,q.useMemo)(()=>b(c,{now:p,capabilities:l}),[l,c,p]),C=x((0,q.useMemo)(()=>ee(c),[c])),w=(0,q.useRef)(null),D=t(`/`),P=v({notify:e,requestConfirm:n,requestText:r,onProjectChosen:i,announceChoice:!0}),[F,I]=(0,q.useState)(!1),[te,R]=(0,q.useState)(!1),z=(0,q.useRef)(null),{mounted:H,...W}=P.picker,K={attention:s(`board:sidebar.group.attention`),running:s(`board:sidebar.group.running`),queued:s(`board:sidebar.group.queued`),done:s(`board:sidebar.group.done`)},Y=e=>g(m.length===1&&m[0]===e?[]:[e]),X=e=>_(h.length===1&&h[0]===e?[]:[e]),re=e=>{if(e.altKey||e.metaKey||e.ctrlKey||e.shiftKey)return;let t=e.target;if(!t.hasAttribute(`data-sidebar-filter`))return;let n=be(w.current),r=n.indexOf(t),i=e.key===`ArrowDown`?n[r+1]:e.key===`ArrowUp`?n[r-1]:e.key===`Home`?n[0]:e.key===`End`?n.at(-1):void 0;i&&(e.preventDefault(),i.focus())};if(f)return(0,J.jsx)(le,{label:s(`board:sidebar.loading`)});let Z=_e.filter(({lane:e})=>e!==`queued`||l.sessionQueue===!0&&S.lanes.queued>0),Q=s(`board:filter.projects`);return(0,J.jsxs)(`div`,{ref:w,"data-sidebar-filters":!0,className:`flex flex-col gap-3 pb-2`,onKeyDown:re,children:[(0,J.jsxs)(`section`,{"aria-labelledby":`sidebar-filter-status`,children:[(0,J.jsx)(`h2`,{id:`sidebar-filter-status`,className:ye,children:s(`board:filter.statuses`)}),(0,J.jsxs)(`ul`,{className:`m-0 flex list-none flex-col gap-px p-0`,children:[(0,J.jsx)(`li`,{children:(0,J.jsx)(Se,{id:U,filter:`all`,pressed:m.length===0&&h.length===0,label:s(`board:sidebar.filter.all`),count:S.total,icon:(0,J.jsx)(ne,{className:`size-3.5 text-content-muted`,strokeWidth:1.75,"aria-hidden":`true`}),onClick:y})}),Z.map(({lane:e,glyph:t})=>{let n=S.lanes[e],r=e===`attention`&&n>0;return(0,J.jsx)(`li`,{children:(0,J.jsx)(Se,{filter:e,pressed:m.includes(e),label:K[e],count:n,attention:r,icon:(0,J.jsx)(G,{status:t,spin:!1,className:N(`size-4`,n===0&&e===`attention`&&`text-content-faint`)}),onClick:()=>Y(e)})},e)})]})]}),(0,J.jsxs)(`section`,{"aria-labelledby":`sidebar-filter-projects`,children:[(0,J.jsxs)(`div`,{className:`flex items-center pr-1`,children:[(0,J.jsx)(`h2`,{id:`sidebar-filter-projects`,className:ye,children:Q}),(0,J.jsxs)(M,{children:[(0,J.jsx)(A,{asChild:!0,children:(0,J.jsx)(`button`,{type:`button`,"data-sidebar-projects-menu":!0,"aria-label":s(`board:sidebar.filter.projectActions`),title:s(`board:sidebar.filter.projectActions`),className:`grid size-6 flex-none place-items-center rounded-[var(--r-sm)] text-content-muted transition-colors duration-(--d-fast) hover:bg-surface-hover hover:text-content focus-visible:outline-2 focus-visible:outline-focus pointer-coarse:size-11`,children:(0,J.jsx)(u,{className:`size-3.5`,"aria-hidden":`true`})})}),(0,J.jsxs)(j,{align:`end`,className:`w-48`,onCloseAutoFocus:e=>{let t=z.current;t&&(z.current=null,e.preventDefault(),t())},children:[(0,J.jsxs)(k,{disabled:P.picking,onSelect:()=>z.current=()=>void P.newProject(),children:[(0,J.jsx)(T,{"aria-hidden":`true`}),s(`board:sidebar.filter.addProject`)]}),(0,J.jsxs)(k,{onSelect:()=>z.current=()=>{I(!0),R(!0)},children:[(0,J.jsx)(d,{"aria-hidden":`true`}),s(`board:project.manage`)]})]})]})]}),C.length?(0,J.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-px p-0`,children:C.map(e=>(0,J.jsx)(`li`,{children:(0,J.jsx)(Se,{filter:`project:${e.key}`,pressed:h.includes(e.key),label:e.label,mono:!!e.cwd&&!e.custom,count:S.projects[e.key]??0,icon:(0,J.jsx)(E,{className:`size-3.5 text-content-muted`,strokeWidth:1.75,"aria-hidden":`true`}),onClick:()=>X(e.key)})},e.key))}):(0,J.jsx)(`p`,{className:`px-2.5 text-xs leading-7 text-content-faint`,children:s(`board:sidebar.filter.noProjects`)})]}),(0,J.jsxs)(`a`,{href:D.replace(/\/$/,``)+`/chat/history`,className:`flex h-8 items-center gap-2 rounded-[var(--r-md)] px-2.5 text-[13px] text-content-muted transition-colors duration-(--d-fast) hover:bg-surface-hover hover:text-content-secondary focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus pointer-coarse:h-11`,onClick:e=>{e.button===0&&!e.metaKey&&!e.ctrlKey&&!e.shiftKey&&!e.altKey&&(e.preventDefault(),a())},children:[(0,J.jsx)(O,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":`true`}),s(`board:sidebar.history`)]}),H&&(0,J.jsx)(q.Suspense,{fallback:null,children:(0,J.jsx)(ge,{...W})}),F&&(0,J.jsx)(q.Suspense,{fallback:null,children:(0,J.jsx)(he,{open:te,onOpenChange:R,commands:P})})]})}function Se({id:e,filter:t,pressed:n,label:r,count:i,icon:a,attention:o=!1,mono:s=!1,onClick:c}){return(0,J.jsxs)(`button`,{type:`button`,id:e,"data-sidebar-filter":t,"aria-pressed":n,title:r,className:N(ve,n&&`bg-surface-active font-medium hover:bg-surface-active`,o&&`text-warning-strong`),onClick:c,children:[(0,J.jsx)(`span`,{className:`grid size-4 flex-none place-items-center`,children:a}),(0,J.jsx)(`span`,{className:N(`min-w-0 flex-1 truncate`,s&&`font-mono text-[12.5px]`),children:r}),(0,J.jsx)(`span`,{"data-sidebar-filter-count":!0,className:N(`flex-none text-xs tabular-nums`,o?`font-semibold`:`text-content-muted`),children:i})]})}export{xe as SidebarBoardFilters,ie as SidebarCommands,oe as SidebarFleetLine,ae as SidebarRailCounts,se as SidebarSessions};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var e=`pisper:sidebar-command`;function t(t){window.dispatchEvent(new CustomEvent(e,{detail:t}))}export{t as n,e as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./index-CsE52ydO.js";import{o as t}from"./vendor-state-GkUciC5H.js";import{t as n}from"./storage-BY6wEHPw.js";var r=Object.freeze({collapsed:!1,doneCollapsed:!1});function i(e){let t=e;if(typeof e==`string`)try{t=JSON.parse(e)}catch{return{...r}}if(!t||typeof t!=`object`||Array.isArray(t))return{...r};let n=t;return{collapsed:n.collapsed===!0,doneCollapsed:n.doneCollapsed===!0}}function a(e){return JSON.stringify({collapsed:e.collapsed===!0,doneCollapsed:e.doneCollapsed===!0})}function o(){try{return i(e.getItem(n.sidebar))}catch{return{...r}}}var s=t((t,r)=>{let i=i=>{let o=r(),s={...o,collapsed:o.preferenceCollapsed,...i};try{e.setItem(n.sidebar,a(s))}catch{}t(i.collapsed===void 0?i:{...i,preferenceCollapsed:i.collapsed})},s=e=>{t({peeking:!1}),r().routeRail?t({collapsed:e}):i({collapsed:e})},c=o();return{...c,preferenceCollapsed:c.collapsed,routeRail:!1,peeking:!1,drawerOpen:!1,setCollapsed:e=>s(e),toggleCollapsed:()=>s(!r().collapsed),enterRouteRail:()=>t({routeRail:!0,collapsed:!0,peeking:!1}),leaveRouteRail:()=>{r().routeRail&&t({routeRail:!1,collapsed:r().preferenceCollapsed,peeking:!1})},setDoneCollapsed:e=>i({doneCollapsed:e}),setPeeking:e=>t({peeking:e}),setDrawerOpen:e=>t({drawerOpen:e})}});typeof window<`u`&&window.addEventListener(`storage`,e=>{if(e.key!==n.sidebar&&e.key!==null)return;let t=o();s.setState(e=>e.routeRail?{doneCollapsed:t.doneCollapsed,preferenceCollapsed:t.collapsed}:{...t,preferenceCollapsed:t.collapsed})});export{s as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var e=Object.freeze({theme:`pisper-theme`,chatMode:`pisper-chat-mode`,activeSession:`pisper-active-session`,mobileSessionTabs:`pisper-mobile-session-tabs`,mobileRemoteFallbackAttempt:`pisper-mobile-remote-fallback-attempt`,mobileRemoteFallbackNotice:`pisper-mobile-remote-fallback-notice`,sessionOpenRequest:`pisper-session-open-request`,sessionCreateRequest:`pisper-session-create-request`,sessionMessageTarget:`pisper-session-message-target`,webPreviewRequest:`pisper-web-preview-request`,language:`pisper-language`,sidebar:`pisper-sidebar`,density:`pisper-density`,shortcuts:`pisper-shortcuts`,boardShortcuts:`pisper-board-shortcuts`,terminalPanel:`pisper-terminal-panel`,modelOnboardingDismissed:`pisper-model-onboarding-v1-dismissed`});export{e as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
function e(e,t){return e?.id===`image_assets`?t(`plugins:toolLabels.imageAssets`):e?.id===`read`?t(`plugins:toolLabels.read`):e?.id===`ls`?t(`plugins:toolLabels.list`):e?.id===`grep`?t(`plugins:toolLabels.grep`):e?.id===`find`?t(`plugins:toolLabels.find`):e?.id===`edit`?t(`plugins:toolLabels.edit`):e?.id===`write`?t(`plugins:toolLabels.write`):e?.id===`bash`?t(`plugins:toolLabels.shell`):e?.id===`web_search`?t(`plugins:toolLabels.webSearch`):e?.id===`browser_automation`?t(`plugins:toolLabels.browserControl`):e?.id===`generate_visual`?t(`plugins:toolLabels.visualGeneration`):e?.id===`skill_create`?t(`plugins:toolLabels.skillCreate`):e?.id===`plugin_create`?t(`plugins:toolLabels.pluginCreate`):e?.id===`memory_search`?t(`plugins:toolLabels.memorySearch`):e?.id===`memory_remember`?t(`plugins:toolLabels.memoryRemember`):e?.id===`mcp_list`?t(`plugins:toolLabels.mcpList`):e?.id===`mcp_manage`?t(`plugins:toolLabels.mcpManage`):e?.id===`codemode`?t(`plugins:toolLabels.codemode`):String(e?.name||e?.id||``)}function t(e,t){return e?.id===`image_assets`?t(`plugins:toolLabels.imageAssetsDescription`):e?.id===`read`?t(`plugins:toolLabels.readDescription`):e?.id===`ls`?t(`plugins:toolLabels.listDescription`):e?.id===`grep`?t(`plugins:toolLabels.grepDescription`):e?.id===`find`?t(`plugins:toolLabels.findDescription`):e?.id===`edit`?t(`plugins:toolLabels.editDescription`):e?.id===`write`?t(`plugins:toolLabels.writeDescription`):e?.id===`bash`?t(`plugins:toolLabels.shellDescription`):e?.id===`web_search`?t(`plugins:toolLabels.webSearchDescription`):e?.id===`browser_automation`?t(`plugins:toolLabels.browserControlDescription`):e?.id===`generate_visual`?t(`plugins:toolLabels.visualGenerationDescription`):e?.id===`skill_create`?t(`plugins:toolLabels.skillCreateDescription`):e?.id===`plugin_create`?t(`plugins:toolLabels.pluginCreateDescription`):e?.id===`memory_search`?t(`plugins:toolLabels.memorySearchDescription`):e?.id===`memory_remember`?t(`plugins:toolLabels.memoryRememberDescription`):e?.id===`mcp_list`?t(`plugins:toolLabels.mcpListDescription`):e?.id===`mcp_manage`?t(`plugins:toolLabels.mcpManageDescription`):e?.id===`codemode`?t(`plugins:toolLabels.codemodeDescription`):String(e?.description||``)}function n(e,t){return e===`high`||e===`高风险`?t(`plugins:toolLabels.highRisk`):e===`medium`||e===`中风险`?t(`plugins:toolLabels.mediumRisk`):e===`low`||e===`低风险`?t(`plugins:toolLabels.lowRisk`):String(e||``)}function r(e,t){return e===`filesystem`||e===`文件系统`?t(`plugins:toolLabels.fileSystem`):e===`search`||e===`搜索`?t(`plugins:toolLabels.search`):e===`terminal`||e===`终端`?t(`plugins:toolLabels.terminal`):e===`visual`||e===`视觉`?t(`plugins:toolLabels.visual`):e===`skills`||e===`技能`?t(`plugins:toolLabels.skills`):e===`plugins`||e===`插件`?t(`plugins:toolLabels.plugins`):e===`browser`||e===`浏览器`?t(`plugins:toolLabels.browser`):e===`memory`||e===`星忆`?t(`plugins:toolLabels.memory`):e===`mcp`||e===`MCP`?t(`plugins:toolLabels.mcp`):e===`collaboration`||e===`协作`?t(`plugins:toolLabels.collaboration`):e===`orchestration`?t(`plugins:toolLabels.orchestration`):String(e||``)}function i(e,t){return e.id===`image_assets`?t(`plugins:toolLabels.imageAssetsScope`):[`read`,`ls`,`grep`,`find`,`edit`,`write`].includes(String(e.id))?t(`plugins:toolLabels.currentChatWorkspace`):e.id===`bash`?t(`plugins:toolLabels.currentOsUser`):e.id===`web_search`?t(`plugins:toolLabels.bingPublicWebSearch`):e.id===`browser_automation`?t(`plugins:toolLabels.isolatedSessionBrowser`):e.id===`generate_visual`?t(`plugins:toolLabels.visualProviderAndWorkspace`):e.id===`skill_create`?t(`plugins:toolLabels.projectAndGlobalSkills`):e.id===`plugin_create`?t(`plugins:toolLabels.globalPluginSources`):e.id===`memory_search`||e.id===`memory_remember`?t(`plugins:toolLabels.globalAndProjectMemory`):e.id===`mcp_list`||e.id===`mcp_manage`?t(`plugins:toolLabels.applicationMcpConfiguration`):e.id===`codemode`?t(`plugins:toolLabels.codemodeScope`):String(e.scope||``)}function a(e){return e===`high`||e===`高风险`}function o(e){return e===`medium`||e===`中风险`}export{e as a,t as i,o as n,n as o,r,i as s,a as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t}from"./vendor-react-DwNgTV1j.js";var n=e(t(),1),r=`(min-width: 960px) and (min-height: 640px)`;function i(e){let[t,r]=n.useState(()=>window.matchMedia(e).matches);return n.useEffect(()=>{let t=window.matchMedia(e),n=()=>r(t.matches);return n(),t.addEventListener(`change`,n),()=>t.removeEventListener(`change`,n)},[e]),t}function a(){return i(`(max-width: 650px)`)}function o(){return i(r)}function s(){return i(`(pointer: coarse)`)}export{i,a as n,o as r,s as t};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{h as t}from"./vendor-router-CSN_DGvx.js";import{i as n,r}from"./vendor-react-DwNgTV1j.js";import{t as i}from"./vendor-ui-DvrYggeS.js";import{t as a}from"./use-i18n-B5p-Kzvz.js";import{r as o,t as s}from"./useQuery-DdcpUQhO.js";import{a as c,i as l,u}from"./api-BO7LAPSQ.js";import{A as d,C as f,D as p,E as m,O as h,S as g,a as _,b as v,c as y,d as b,f as x,h as S,i as C,j as w,k as T,l as E,m as D,n as ee,p as O,s as te,u as ne,w as re,x as ie,y as ae}from"./session-scope-DQPNgQMm.js";import{o as oe}from"./session-board-status-D2lpFPiI.js";import{t as se}from"./checkbox-BrEHgFV0.js";import{t as ce}from"./progress-5odAz3B9.js";import{t as le}from"./separator-BPh_qxvc.js";import{t as ue}from"./switch-D_G8wFhs.js";import{t as de}from"./segmented-control-BlM_GKV6.js";import{i as fe,n as pe,r as me,t as he}from"./tooltip-D4MFbqcG.js";import{t as k}from"./utils-C8uzG5AZ.js";import{n as ge,t as A}from"./button-CCcCN8tE.js";import{t as _e}from"./kbd-CAufZTkl.js";import{r as ve,t as ye}from"./useSessionListQuery-D44XZfGr.js";import{n as be}from"./useFleetSystemInfo-Bd8zJIFa.js";import"./public-jQjEc6OO.js";import{i as xe,r as Se}from"./board-launch-BmmPYZe8.js";import{t as Ce}from"./input-CPw-zkYh.js";import{t as we}from"./textarea-DmATpOqT.js";import{t as Te}from"./StatusGlyph-1KgitlUg.js";import{t as Ee}from"./badge-CWB3lj2H.js";import{t as De}from"./safe-mode-instance-BiAPYJ2-.js";var j=e(n(),1),M=r();function Oe({className:e,...t}){return(0,M.jsx)(`div`,{"data-slot":`skeleton`,className:k(`animate-pulse rounded-sm bg-surface-hover`,e),...t})}function N(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function P(e,t=4e3){return typeof e==`string`?e.slice(0,t):``}function F(e){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0?e:0}var I=e=>`/api/custom-ui/components/${encodeURIComponent(e)}`,ke=[`network`,`notify`,`sessions.read`,`sessions.open`,`storage`,`provider.request`];function L(e){let t=N(e)?v(e.component):null;if(!t)throw Error(`Invalid custom UI component response`);return t}function Ae(e){return!N(e)||!Number.isSafeInteger(e.n)||Number(e.n)<1?null:{n:Number(e.n),at:typeof e.at==`string`?e.at:null,summary:P(e.summary,200),source:[`agent`,`import`,`restore`,`local`].includes(e.source)?e.source:null,files:(Array.isArray(e.files)?e.files.slice(0,64):[]).flatMap(e=>N(e)&&typeof e.path==`string`?[{path:P(e.path,512),added:F(e.added),removed:F(e.removed)}]:[]),deleted:(Array.isArray(e.deleted)?e.deleted.slice(0,64):[]).filter(e=>typeof e==`string`)}}function je(e){let t=N(e)?Ae(e.current):null;if(!t||!N(e)||!Array.isArray(e.versions))throw Error(`Invalid custom UI versions response`);return{current:t,versions:e.versions.flatMap(e=>Ae(e)??[]),max:F(e.max)||20}}function Me(e,t){return c(`${I(e)}/versions`,{signal:t,parse:je})}function Ne(e){return!N(e)||typeof e.diff!=`string`?null:{diff:e.diff,truncated:e.truncated===!0,files:(Array.isArray(e.files)?e.files.slice(0,256):[]).flatMap(e=>N(e)&&typeof e.path==`string`&&(e.status===`added`||e.status===`deleted`||e.status===`modified`)?[{path:e.path,status:e.status}]:[])}}function Pe(e,t,n){return c(`${I(e)}/versions/${t}/diff`,{signal:n,parse:e=>{let t=Ne(e);if(!t)throw Error(`Invalid custom UI diff response`);return t}})}function Fe(e,t){return c(`${I(e)}/versions/${t}/restore`,{method:`POST`,body:{},parse:e=>({...je(e),component:L(e)})})}function Ie(e,t){return l(`${I(e)}/export`,{signal:t,timeout:6e4})}function Le(e){if(!N(e)||!Array.isArray(e.entries))throw Error(`Invalid custom UI trash response`);return{retentionDays:F(e.retentionDays)||7,entries:e.entries.slice(0,200).flatMap(e=>N(e)&&typeof e.entry==`string`&&/^[a-z0-9][a-z0-9._-]{0,63}-\d{8}T\d{6}Z(?:-\d{1,4})?$/.test(e.entry)&&typeof e.id==`string`?[{entry:e.entry,id:P(e.id,64),name:P(e.name,120)||P(e.id,64),version:P(e.version,64),kind:e.kind===`native`||e.kind===`legacy`?e.kind:`broken`,reason:e.reason===`legacy-retired`?`legacy-retired`:`deleted`,deletedAt:P(e.deletedAt,64),expiresAt:typeof e.expiresAt==`string`?e.expiresAt:null,instances:F(e.instances)}]:[])}}function Re(e){return c(`/api/custom-ui/trash`,{signal:e,parse:Le})}function ze(e){return c(`/api/custom-ui/trash/${encodeURIComponent(e)}/restore`,{method:`POST`,body:{},parse:e=>({component:L(e),restoredInstances:N(e)?F(e.restoredInstances):0})})}function Be(e){return c(`/api/custom-ui/trash/${encodeURIComponent(e)}`,{method:`DELETE`,parse:()=>void 0})}function Ve(e){if(e.size>16777216)throw new u(`Component archive exceeds 16 MiB`,{kind:`protocol`,data:{code:`component_archive_too_large`}});let t=encodeURIComponent(e.name.slice(0,200));return c(`/api/custom-ui/import?stage=1&name=${t}`,{method:`POST`,data:e,timeout:12e4,parse:e=>{let t=N(e)?re(e.staged):null;if(!t)throw Error(`Invalid custom UI staged response`);return t}})}function He(e){let t=N(e)?re(e.staged):null;if(!t||!N(e))throw Error(`Invalid custom UI staged response`);return{staged:t,manifest:f(t.id,e.manifest),errors:g(e.errors),files:ae(e.files),scan:ie(e.scan),installed:e.installed?v(e.installed):null,diff:e.diff?Ne(e.diff):null}}var R=e=>`/api/custom-ui/staged/${encodeURIComponent(e)}`;function Ue(e,t){return c(R(e),{signal:t,parse:He})}function We(e,t,n){return c(`${R(e)}/file?path=${encodeURIComponent(t)}`,{signal:n,parse:e=>{if(!N(e)||typeof e.content!=`string`)throw Error(`Invalid custom UI staged file response`);return{path:P(e.path,512),binary:e.binary===!0,content:e.content,truncated:e.truncated===!0}}})}function Ge(e){return c(`${R(e)}/trust`,{method:`POST`,body:{},parse:e=>({component:L(e),replaced:N(e)&&e.replaced===!0})})}function Ke(e){return c(`${R(e)}/discard`,{method:`POST`,body:{},parse:()=>void 0})}function qe(e){if(!N(e)||!N(e.usage))throw Error(`Invalid custom UI usage response`);let t={};for(let n of ke){let r=e.usage[n];!N(r)||typeof r.lastAt!=`string`||(t[n]={lastAt:r.lastAt,target:P(r.target,120),today:F(r.today),total:F(r.total)})}let n=Array.isArray(e.revoked)?e.revoked:[];return{usage:t,revoked:ke.filter(e=>n.includes(e))}}function Je(e,t){return c(`${I(e)}/usage`,{signal:t,parse:qe})}function Ye(e,t){return c(I(e),{method:`PATCH`,body:{revoked:t},parse:L})}function z(e,t){let n=e?.[t];return typeof n==`string`||typeof n==`number`?n:``}function Xe(e){let t=z(e,`max`);return typeof t==`number`?Math.round(t/1024):t}function B(e,t,n){let r=z(n,`max`);return{manifest_missing:()=>t(`custom-ui:errors.manifest_missing`),manifest_too_large:()=>t(`custom-ui:errors.manifest_too_large`),manifest_json_invalid:()=>t(`custom-ui:errors.manifest_json_invalid`),manifest_not_object:()=>t(`custom-ui:errors.manifest_not_object`),entry_missing:()=>t(`custom-ui:errors.entry_missing`),style_missing:()=>t(`custom-ui:errors.style_missing`),component_too_large:()=>t(`custom-ui:errors.component_too_large`),runtime_not_native:()=>t(`custom-ui:errors.runtime_not_native`),name_invalid:()=>t(`custom-ui:errors.name_invalid`),version_invalid:()=>t(`custom-ui:errors.version_invalid`),description_invalid:()=>t(`custom-ui:errors.description_invalid`),icon_invalid:()=>t(`custom-ui:errors.icon_invalid`),entry_invalid:()=>t(`custom-ui:errors.entry_invalid`),styles_invalid:()=>t(`custom-ui:errors.styles_invalid`),sdk_invalid:()=>t(`custom-ui:errors.sdk_invalid`),sdk_unsupported:()=>t(`custom-ui:errors.sdk_unsupported`),min_host_version_invalid:()=>t(`custom-ui:errors.min_host_version_invalid`),host_too_old:()=>n?.required?t(`custom-ui:errors.host_too_old_version`,{required:z(n,`required`)}):t(`custom-ui:errors.host_too_old`),placements_invalid:()=>t(`custom-ui:errors.placements_invalid`),placement_invalid:()=>t(`custom-ui:errors.placement_invalid`),placement_surface_invalid:()=>t(`custom-ui:errors.placement_surface_invalid`,{surface:z(n,`surface`)}),placement_duplicate:()=>t(`custom-ui:errors.placement_duplicate`,{surface:z(n,`surface`)}),placement_sizes_invalid:()=>t(`custom-ui:errors.placement_sizes_invalid`),placement_size_invalid:()=>t(`custom-ui:errors.placement_size_invalid`,{minW:z(n,`minW`),maxW:z(n,`maxW`),minH:z(n,`minH`),maxH:z(n,`maxH`)}),capability_invalid:()=>t(`custom-ui:errors.capability_invalid`),capability_unknown:()=>t(`custom-ui:errors.capability_unknown`,{capability:z(n,`capability`)}),capability_duplicate:()=>t(`custom-ui:errors.capability_duplicate`,{capability:z(n,`capability`)}),capability_reason_invalid:()=>t(`custom-ui:errors.capability_reason_invalid`),network_hosts_invalid:()=>t(`custom-ui:errors.network_hosts_invalid`,{max:r}),network_host_invalid:()=>t(`custom-ui:errors.network_host_invalid`),provider_paths_invalid:()=>t(`custom-ui:errors.provider_paths_invalid`),provider_methods_invalid:()=>t(`custom-ui:errors.provider_methods_invalid`),component_provider_request_invalid:()=>t(`custom-ui:errors.component_provider_request_invalid`),component_provider_path_denied:()=>t(`custom-ui:errors.component_provider_path_denied`),component_provider_session_mismatch:()=>t(`custom-ui:errors.component_provider_session_mismatch`),storage_quota_invalid:()=>t(`custom-ui:errors.storage_quota_invalid`,{max:r}),i18n_invalid:()=>t(`custom-ui:errors.i18n_invalid`),i18n_strings_invalid:()=>t(`custom-ui:errors.i18n_strings_invalid`,{max:r}),i18n_string_invalid:()=>t(`custom-ui:errors.i18n_string_invalid`),props_schema_invalid:()=>t(`custom-ui:errors.props_schema_invalid`),props_type_unsupported:()=>t(`custom-ui:errors.props_type_unsupported`),props_field_invalid:()=>t(`custom-ui:errors.props_field_invalid`),props_key_invalid:()=>t(`custom-ui:errors.props_key_invalid`),props_keyword_unsupported:()=>t(`custom-ui:errors.props_keyword_unsupported`,{keyword:z(n,`keyword`)}),props_format_invalid:()=>t(`custom-ui:errors.props_format_invalid`),props_max_length_invalid:()=>t(`custom-ui:errors.props_max_length_invalid`,{max:r}),props_enum_list_invalid:()=>t(`custom-ui:errors.props_enum_list_invalid`,{max:r}),props_number_invalid:()=>t(`custom-ui:errors.props_number_invalid`),props_unit_invalid:()=>t(`custom-ui:errors.props_unit_invalid`),props_items_invalid:()=>t(`custom-ui:errors.props_items_invalid`),props_max_items_invalid:()=>t(`custom-ui:errors.props_max_items_invalid`,{max:r}),props_too_many_fields:()=>t(`custom-ui:errors.props_too_many_fields`,{max:r}),props_required_invalid:()=>t(`custom-ui:errors.props_required_invalid`),props_default_invalid:()=>t(`custom-ui:errors.props_default_invalid`),props_i18n_invalid:()=>t(`custom-ui:errors.props_i18n_invalid`),props_title_invalid:()=>t(`custom-ui:errors.props_title_invalid`),props_description_invalid:()=>t(`custom-ui:errors.props_description_invalid`),props_type_invalid:()=>t(`custom-ui:errors.props_type_invalid`),props_too_long:()=>t(`custom-ui:errors.props_too_long`,{max:r}),props_enum_invalid:()=>t(`custom-ui:errors.props_enum_invalid`),props_url_invalid:()=>t(`custom-ui:errors.props_url_invalid`),props_color_invalid:()=>t(`custom-ui:errors.props_color_invalid`),props_out_of_range:()=>t(`custom-ui:errors.props_out_of_range`),props_too_many:()=>t(`custom-ui:errors.props_too_many`,{max:r}),props_unknown:()=>t(`custom-ui:errors.props_unknown`),props_required:()=>t(`custom-ui:errors.props_required`),props_too_large:()=>t(`custom-ui:errors.props_too_large`),component_files_invalid:()=>t(`custom-ui:errors.component_files_invalid`),component_manifest_invalid:()=>t(`custom-ui:errors.component_manifest_invalid`),component_file_path_invalid:()=>t(`custom-ui:errors.component_file_path_invalid`),component_file_duplicate:()=>t(`custom-ui:errors.component_file_duplicate`),component_file_content_invalid:()=>t(`custom-ui:errors.component_file_content_invalid`),component_file_too_large:()=>t(`custom-ui:errors.component_file_too_large`,{max:Xe(n)}),component_files_too_large:()=>t(`custom-ui:errors.component_files_too_large`,{max:Xe(n)}),component_files_too_many:()=>t(`custom-ui:errors.component_files_too_many`,{max:r}),component_bare_import:()=>t(`custom-ui:errors.component_bare_import`,{specifier:z(n,`specifier`)}),component_html_unsupported:()=>t(`custom-ui:errors.component_html_unsupported`),path_not_writable:()=>t(`custom-ui:errors.path_not_writable`),component_template_invalid:()=>t(`custom-ui:errors.component_template_invalid`),component_id_reserved:()=>t(`custom-ui:errors.component_id_reserved`),component_id_taken_by_legacy:()=>t(`custom-ui:errors.component_id_taken_by_legacy`),component_legacy_unsupported:()=>t(`custom-ui:errors.component_legacy_unsupported`),component_import_unavailable:()=>t(`custom-ui:errors.component_import_unavailable`),component_request_invalid:()=>t(`custom-ui:errors.component_request_invalid`),component_request_too_large:()=>t(`custom-ui:errors.component_request_too_large`),component_asset_missing:()=>t(`custom-ui:errors.component_asset_missing`),component_capability_denied:()=>t(`custom-ui:errors.component_capability_denied`),component_session_required:()=>t(`custom-ui:errors.component_session_required`),component_session_invalid:()=>t(`custom-ui:errors.component_session_invalid`),component_capability_revoked:()=>t(`custom-ui:errors.component_capability_revoked`),component_archive_invalid:()=>t(`custom-ui:errors.component_archive_invalid`),component_archive_too_large:()=>t(`custom-ui:errors.component_archive_too_large`),component_manifest_missing:()=>t(`custom-ui:errors.component_manifest_missing`),component_staging_full:()=>t(`custom-ui:errors.component_staging_full`),component_staged_not_found:()=>t(`custom-ui:errors.component_staged_not_found`),component_file_not_found:()=>t(`custom-ui:errors.component_file_not_found`),component_version_not_found:()=>t(`custom-ui:errors.component_version_not_found`),component_trash_not_found:()=>t(`custom-ui:errors.component_trash_not_found`),component_not_found:()=>t(`custom-ui:errors.component_not_found`),component_name_invalid:()=>t(`custom-ui:errors.component_name_invalid`),component_id_invalid:()=>t(`custom-ui:errors.component_id_invalid`),component_already_installed:()=>t(`custom-ui:errors.component_already_installed`),component_disabled:()=>t(`custom-ui:errors.component_disabled`),component_invalid:()=>t(`custom-ui:errors.component_invalid`),component_surface_invalid:()=>t(`custom-ui:errors.component_surface_invalid`),component_surface_unsupported:()=>t(`custom-ui:errors.component_surface_unsupported`),component_size_invalid:()=>t(`custom-ui:errors.component_size_invalid`),component_scope_invalid:()=>t(`custom-ui:errors.component_scope_invalid`),component_title_invalid:()=>t(`custom-ui:errors.component_title_invalid`),component_props_invalid:()=>t(`custom-ui:errors.component_props_invalid`),component_instance_exists:()=>t(`custom-ui:errors.component_instance_exists`),component_instance_not_found:()=>t(`custom-ui:errors.component_instance_not_found`),component_instances_full:()=>t(`custom-ui:errors.component_instances_full`),component_instances_conflict:()=>t(`custom-ui:errors.component_instances_conflict`),component_instances_order_invalid:()=>t(`custom-ui:errors.component_instances_order_invalid`)}[e]?.()??e}function Ze({thresholdMs:e=200,streak:t=3}={}){let n=null,r=0,i=null,a=!1;return{start(e){n===null&&(n=e)},commit(o){if(n===null)return null;let s=Math.max(0,o-n);n=null,i=s;let c=s>e;return r=c?r+1:0,r>=t&&(a=!0),{duration:s,slow:c,warning:a}},last:()=>i,warning:()=>a,reset(){n=null,r=0,i=null,a=!1}}}var Qe=function(e,t,n,r){var i;t[0]=0;for(var a=1;a<t.length;a++){var o=t[a++],s=t[a]?(t[0]|=o?1:2,n[t[a++]]):t[++a];o===3?r[0]=s:o===4?r[1]=Object.assign(r[1]||{},s):o===5?(r[1]=r[1]||{})[t[++a]]=s:o===6?r[1][t[++a]]+=s+``:o?(i=e.apply(s,Qe(e,s,n,[``,null])),r.push(i),s[0]?t[0]|=2:(t[a-2]=0,t[a]=i)):r.push(s)}return r},$e=new Map;function et(e){var t=$e.get(this);return t||(t=new Map,$e.set(this,t)),(t=Qe(this,t.get(e)||(t.set(e,t=function(e){for(var t,n,r=1,i=``,a=``,o=[0],s=function(e){r===1&&(e||(i=i.replace(/^\s*\n\s*|\s*\n\s*$/g,``)))?o.push(0,e,i):r===3&&(e||i)?(o.push(3,e,i),r=2):r===2&&i===`...`&&e?o.push(4,e,0):r===2&&i&&!e?o.push(5,0,!0,i):r>=5&&((i||!e&&r===5)&&(o.push(r,0,i,n),r=6),e&&(o.push(r,e,0,n),r=6)),i=``},c=0;c<e.length;c++){c&&(r===1&&s(),s(c));for(var l=0;l<e[c].length;l++)t=e[c][l],r===1?t===`<`?(s(),o=[o],r=3):i+=t:r===4?i===`--`&&t===`>`?(r=1,i=``):i=t+i[0]:a?t===a?a=``:i+=t:t===`"`||t===`'`?a=t:t===`>`?(s(),r=1):r&&(t===`=`?(r=5,n=i,i=``):t===`/`&&(r<5||e[c][l+1]===`>`)?(s(),r===3&&(o=o[0]),r=o,(o=o[0]).push(2,0,r),r=0):t===` `||t===` `||t===`
|
|
2
|
-
`||t===`\r`?(s(),r=2):i+=t),r===3&&i===`!--`&&(r=4,o=o[0])}return s(),o}(e)),t),arguments,[])).length>1?t:t[0]}var tt=et.bind(j.createElement),nt=6e4;function rt(e,t,{windowMs:n=nt,threshold:r=3}={}){let i=[...(e?.crashes??[]).filter(e=>t-e<n),t];return{crashes:i,paused:e?.paused===!0||i.length>=r}}function it({now:e=()=>Date.now(),windowMs:t=nt,threshold:n=3}={}){let r=new Map,i=new Set,a=0,o=()=>{a+=1;for(let e of[...i])e()};return{record(i,a){let s=rt(r.get(i),e(),{windowMs:t,threshold:n});return a&&(s.rev=a),r.set(i,s),o(),s},pause(e){r.set(e,{crashes:r.get(e)?.crashes??[],paused:!0}),o()},resume(e){r.delete(e),o()},isPaused:e=>r.get(e)?.paused===!0,hasTrouble:(e,t)=>{let n=r.get(e);return n?n.paused?!0:t&&n.rev&&n.rev!==t?!1:n.crashes.length>0:!1},subscribe(e){return i.add(e),()=>{i.delete(e)}},version:()=>a}}var V=500,at=4e3,ot=/^[a-zA-Z0-9._:-]{1,64}$/;function H(e){return e.map(e=>{if(typeof e==`string`)return e;if(e instanceof Error)return`${e.name}: ${e.message}`;try{let t=JSON.stringify(e);return t===void 0?String(e):t}catch{return String(e)}}).join(` `).slice(0,V)}function st(e){if(e instanceof Error){let t=`${e.name}: ${e.message}`.slice(0,V);return typeof e.stack==`string`?{message:t,stack:e.stack.slice(0,at)}:{message:t}}return{message:H([e])}}var ct=1024;function lt(e,t){let n=e.trim(),r=(t??``).trim(),i=r.startsWith(n)?r.slice(n.length).trim():r;return i?`${n}\n${i.slice(0,ct)}`:n}function ut(e=200){let t=new Map,n=new Set;return{append(r){let i=t.get(r.componentId)??[];i.push(r),i.length>e&&i.splice(0,i.length-e),t.set(r.componentId,i);for(let e of[...n])e(r.componentId)},read:e=>[...t.get(e)??[]],clear(e){t.delete(e);for(let t of[...n])t(e)},subscribe(e){return n.add(e),()=>{n.delete(e)}}}}function dt({send:e,now:t=()=>Date.now(),perMinute:n=20}){let r=new Map;return{report(i,a){let o=t(),s=r.get(i);if((!s||o-s.at>=6e4)&&(s={at:o,count:0,dropped:s?.dropped??0},r.set(i,s)),s.count>=n)return s.dropped+=1,!1;s.count+=1;let{instanceId:c,...l}=a;return e(i,{...l,...c&&ot.test(c)?{instanceId:c}:{},message:a.message.slice(0,V)||a.kind,...a.stack?{stack:a.stack.slice(0,at)}:{}}).catch(()=>void 0),!0},dropped:e=>r.get(e)?.dropped??0}}function ft({componentId:e,instanceId:t,surface:n,buffer:r,reporter:i,now:a=()=>Date.now()}){let o=(o,s,c,l)=>{r.append({at:a(),componentId:e,...t?{instanceId:t}:{},...n?{surface:n}:{},kind:o,level:s,message:c,...l?{stack:l}:{}}),s!==`info`&&i.report(e,{...t?{instanceId:t}:{},...n?{surface:n}:{},kind:o,level:s,message:c,...l?{stack:l}:{}})};return{info:(...e)=>o(`log`,`info`,H(e)),warn:(...e)=>o(`log`,`warn`,H(e)),error:(...e)=>o(`log`,`error`,H(e)),record(e,t,n){let r=st(n);o(e,t,r.message,r.stack)}}}var U=class extends Error{code;constructor(e,t,n){super(t,n),this.name=`ComponentLoadError`,this.code=e}};function pt(e){return e instanceof Error?e.message:String(e)}function mt({importer:e,limit:t=20}){let n=new Map,r=new Map,i=new Set;return{load(t,a,o){let s=`${t}@${a}`,c=n.get(s);if(c)return c;let l;try{l=te(t,a,o)}catch(e){return Promise.reject(new U(`module_load_failed`,pt(e),{cause:e}))}let u=e(l).then(e=>{let n=e&&typeof e==`object`?e.default:null;if(typeof n!=`function`)throw new U(`default_export_invalid`,`Component module must export a default function`);let o=r.get(t);if(o||r.set(t,o=new Set),!o.has(a)){o.add(a);for(let e of[...i])e()}return n},e=>{throw e instanceof U?e:new U(`module_load_failed`,pt(e),{cause:e})});return n.set(s,u),u.catch(()=>{n.get(s)===u&&n.delete(s)}),u},versions:e=>r.get(e)?.size??0,reloadRecommended:e=>(r.get(e)?.size??0)>=t,subscribe(e){return i.add(e),()=>{i.delete(e)}}}}function ht(e){let t=new Map;return{retain(n,r,i){let a=[];for(let o of i){let i;try{i=te(n,r,o)}catch{continue}a.push(i);let s=t.get(i);if(s){s.count+=1;continue}let c=e.createElement(`link`);c.rel=`stylesheet`,c.href=i,c.dataset.componentStyle=n,e.head.appendChild(c),t.set(i,{element:c,count:1})}let o=!1;return()=>{if(!o){o=!0;for(let e of a){let n=t.get(e);n&&(--n.count,!(n.count>0)&&(n.element.remove(),t.delete(e)))}}}},size:()=>t.size}}var W=class extends Error{code;constructor(e,t=e){super(t),this.name=`ComponentRequestError`,this.code=e}},gt=32768;function _t(e){let t=``;for(let n=0;n<e.length;n+=gt)t+=String.fromCharCode(...e.subarray(n,n+gt));return btoa(t)}function vt(e){let t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e+=1)n[e]=t.charCodeAt(e);return n}function yt(e){if(!e)return;let t={},n=typeof Headers<`u`&&e instanceof Headers?[...e.entries()]:Array.isArray(e)?e:Object.entries(e);for(let[e,r]of n){if(typeof e!=`string`||typeof r!=`string`)throw new W(`component_fetch_invalid`,`headers must be strings`);t[e.toLowerCase()]=r}return t}function bt(e,t={}){if(typeof e!=`string`||!e)throw new W(`component_fetch_invalid`,`url must be a string`);let n={url:e};if(t.method!==void 0){if(typeof t.method!=`string`)throw new W(`component_fetch_invalid`,`method must be a string`);n.method=t.method.toUpperCase()}let r=yt(t.headers);r&&(n.headers=r);let i=t.body;if(i==null)return n;if(typeof i==`string`)n.body=i,n.bodyEncoding=`utf8`;else if(i instanceof ArrayBuffer)n.body=_t(new Uint8Array(i)),n.bodyEncoding=`base64`;else if(ArrayBuffer.isView(i))n.body=_t(new Uint8Array(i.buffer,i.byteOffset,i.byteLength)),n.bodyEncoding=`base64`;else throw new W(`component_fetch_invalid`,`unsupported body type`);return n}function xt(e){let t=()=>e.bodyEncoding===`base64`?vt(e.body):new TextEncoder().encode(e.body),n=()=>e.bodyEncoding===`utf8`?e.body:new TextDecoder().decode(t());return Object.freeze({ok:e.status>=200&&e.status<300,status:e.status,statusText:e.statusText,headers:Object.freeze({...e.headers}),url:e.url,redirected:e.redirected,text:async()=>n(),json:async()=>JSON.parse(n()),arrayBuffer:async()=>{let e=t();return e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)}})}function St(e){let t=new AbortController,n=[];for(let r of e){if(!r)continue;if(r.aborted){t.abort(r.reason);break}let e=()=>t.abort(r.reason);r.addEventListener(`abort`,e,{once:!0}),n.push(()=>r.removeEventListener(`abort`,e))}return{signal:t.signal,release:()=>{for(let e of n)e()}}}var Ct=new Set([`attention`,`running`,`queued`,`done`,`idle`]);function wt(e,t){let n=new Map(t.map(e=>[e.id,e])),r=[];for(let t of e){if(t.archived)continue;let e=n.get(t.id),i={id:t.id,title:t.title,cwd:t.cwd??``,status:e?.lane??`idle`,updatedAt:t.modified??``};typeof e?.totalTokens==`number`&&Number.isFinite(e.totalTokens)&&(i.usage={totalTokens:e.totalTokens}),r.push(Object.freeze(i))}return r.sort((e,t)=>(Date.parse(t.updatedAt)||0)-(Date.parse(e.updatedAt)||0))}function Tt(e){let t=e&&typeof e==`object`&&!Array.isArray(e)?e:{};return{limit:typeof t.limit==`number`&&Number.isFinite(t.limit)?Math.min(100,Math.max(1,Math.floor(t.limit))):50,...typeof t.cwd==`string`&&t.cwd?{cwd:t.cwd}:{},...typeof t.status==`string`&&Ct.has(t.status)?{status:t.status}:{}}}function Et(e,t){let{cwd:n,status:r,limit:i}=Tt(t),a=n?oe(n):null,o=[];for(let t of e)if(!(r&&t.status!==r)&&(a===null||oe(t.cwd)===a)&&(o.push(t),o.length>=i))break;return o}function Dt(){let e=[],t=new Set;return{get:()=>e,set(n){if(!(n.length===e.length&&n.every((t,n)=>t===e[n]))){e=n;for(let n of[...t])n(e)}},subscribe(e){return t.add(e),()=>{t.delete(e)}}}}var Ot=2147483647;function kt(e,t){return Math.min(Ot,Math.max(t,typeof e==`number`&&Number.isFinite(e)?e:0))}function At({host:e,onError:t}){let n=new Set,r=new Set,i=!1,a=e=>{try{e()}catch(e){t(e)}};return{setTimeout(t,r){if(i||typeof t!=`function`)return 0;let o=e.setTimeout(()=>{n.delete(o),i||a(t)},kt(r,0));return n.add(o),o},setInterval(t,n){if(i||typeof t!=`function`)return 0;let o=e.setInterval(()=>{i||a(t)},kt(n,16));return r.add(o),o},clearTimeout(t){typeof t!=`number`||!n.delete(t)||e.clearTimeout(t)},clearInterval(t){typeof t!=`number`||!r.delete(t)||e.clearInterval(t)},active:()=>n.size+r.size,dispose(){i=!0;for(let t of n)e.clearTimeout(t);for(let t of r)e.clearInterval(t);n.clear(),r.clear()}}}var jt=/^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$/,Mt=class extends Error{capability;reason;constructor(e,t=`undeclared`){super(t===`revoked`?`Capability "${e}" was revoked by the user`:`Capability "${e}" is not declared in manifest.json`),this.name=`CapabilityError`,this.capability=e,this.reason=t}};function Nt(){return{setTimeout:(e,t)=>window.setTimeout(e,t),setInterval:(e,t)=>window.setInterval(e,t),clearTimeout:e=>window.clearTimeout(e),clearInterval:e=>window.clearInterval(e)}}function Pt(e,t,n,r){if(typeof n!=`string`)return``;let i=t===`zh-CN`?`en-US`:`zh-CN`,a=e.i18n[t]?.strings?.[n]??e.i18n[i]?.strings?.[n]??n;if(!r||typeof r!=`object`)return a;let o=r;return a.replace(/\{([a-zA-Z0-9_]{1,64})\}/g,(e,t)=>{let n=Object.hasOwn(o,t)?o[t]:void 0;return typeof n==`string`||typeof n==`number`&&Number.isFinite(n)?String(n):e})}function Ft(e){let{manifest:t,getLanguage:n,kit:r,services:i,logger:a,onCallbackError:o}=e,s=e.now??(()=>Date.now()),c=new AbortController,l=new Set,u=!1,d=t.capabilities,f=e=>{u||(a.record(`callback`,`error`,e),o(e))},p=At({host:e.timers??Nt(),onError:f}),m=new Set(e.revoked??[]),h=e=>{if(d[e]&&!m.has(e))return;let t=new Mt(e,d[e]?`revoked`:`undeclared`);throw a.record(`log`,`warn`,t),t},g=!1,_=()=>{g||u||(g=!0,i.reportUsage?.(`sessions.read`))},v=e=>{try{return h(e),null}catch(e){return Promise.reject(e)}},y=[],b=e=>{if(h("notify"),u)return;let t=s();for(;y.length&&t-y[0]>=6e4;)y.shift();if(y.length>=6){a.warn(`notify rate limited (6 per minute)`);return}let n=(typeof e==`string`?e:String(e)).trim();n&&(y.push(t),i.notify(Array.from(n).slice(0,200).join(``)),i.reportUsage?.(`notify`))},x=Object.freeze({useList(e){return h("sessions.read"),_(),Et(i.useSessions(),e)},subscribe(e){if(h("sessions.read"),typeof e!=`function`||u)return()=>{};_();let t=i.subscribeSessions(t=>{if(!u)try{e(t)}catch(e){f(e)}}),n=!0,r=()=>{n&&(n=!1,l.delete(r),t())};return l.add(r),r},open(e){h("sessions.open"),!(u||typeof e!=`string`||!e)&&(i.openSession(e),i.reportUsage?.(`sessions.open`))}}),S=Object.freeze({fetch(e,t){let n=v(`network`);if(n)return n;let r;try{r=bt(e,t??{})}catch(e){return Promise.reject(e)}let a=St([c.signal,t?.signal]);return i.fetch(r,a.signal).then(xt,e=>{throw e instanceof W?e:G(e)}).finally(a.release)}}),C=e=>{if(typeof e!=`string`||!jt.test(e))throw new W(`component_storage_key_invalid`,`invalid storage key`);return e},w=Object.freeze({get(e){let t=v(`storage`);if(t)return t;try{return i.storageGet(C(e))}catch(e){return Promise.reject(e)}},set(e,t){let n=v(`storage`);if(n)return n;try{return i.storageSet(C(e),t)}catch(e){return Promise.reject(e)}},remove(e){let t=v(`storage`);if(t)return t;try{return i.storageRemove(C(e))}catch(e){return Promise.reject(e)}}}),T=Object.freeze({info:(...e)=>a.info(...e),warn:(...e)=>a.warn(...e),error:(...e)=>a.error(...e)}),E=Object.freeze({useTheme:r.useTheme}),D=(e,r)=>Pt(t,n(),e,r);return{get signal(){return c.signal},get disposed(){return u},context({size:e,placement:t,session:n}){return Object.freeze({sdk:1,React:r.React,html:r.html,ui:r.ui,theme:E,sessions:x,notify:b,net:S,storage:w,provider:Object.freeze({request(e){let t=v(`provider.request`);if(t)return t;if(!n?.id)return Promise.reject(new W(`component_session_required`));let r;try{if(!e||typeof e!=`object`)throw new W(`component_provider_request_invalid`);let{url:t,...n}=bt(e.path,e);r={...n,path:t,...e.auth===void 0?{}:{auth:e.auth}}}catch(e){return Promise.reject(e)}let a=St([c.signal,e.signal]);return i.providerRequest(n.id,r,a.signal).then(xt,e=>{throw G(e)}).finally(a.release)}}),signal:c.signal,setTimeout:p.setTimeout,setInterval:p.setInterval,clearTimeout:p.clearTimeout,clearInterval:p.clearInterval,size:Object.freeze({...e}),placement:Object.freeze({...t}),session:n?Object.freeze({...n}):void 0,t:D,log:T,CapabilityError:Mt})},dispose(){if(!u){u=!0,p.dispose();for(let e of[...l])e();c.abort(new DOMException(`Component unmounted`,`AbortError`))}}}}function G(e){if(e&&typeof e==`object`){let t=e.data,n=t?.code??t?.error;if(typeof n==`string`&&/^[a-z0-9_]{1,64}$/.test(n))return new W(n);let r=e.kind;if(r===`cancelled`||e.name===`AbortError`)return new W(`component_request_aborted`);if(r===`timeout`)return new W(`component_request_timeout`)}return new W(`component_request_failed`)}var It=Dt();function K(){let e=ye(),{all:t}=be({doneWindow:`today`}),n=e.data?.sessions;return(0,j.useMemo)(()=>wt((n??[]).map(e=>({id:e.id,title:ve(e),cwd:typeof e.cwd==`string`?e.cwd:``,modified:typeof e.modified==`string`?e.modified:``,archived:e.archived===!0})),t.map(e=>({id:e.id,lane:e.lane,totalTokens:e.totalTokens}))),[t,n])}function Lt(){let e=K();return(0,j.useEffect)(()=>{It.set(e)},[e]),null}var Rt=5e3;function zt({send:e,now:t=()=>Date.now(),schedule:n=(e,t)=>window.setTimeout(e,t)}){let r=new Map,i=!1,a=()=>{i=!1;let t=r;r=new Map;for(let[n,r]of t)e(n,[...r].map(([e,t])=>({capability:e,count:t.count,at:new Date(t.at).toISOString()}))).catch(()=>void 0)};return{record(e,o){let s=r.get(e)??new Map,c=s.get(o);s.set(o,{count:(c?.count??0)+1,at:t()}),r.set(e,s),!i&&(i=!0,n(a,Rt))},flush:a}}var Bt=null,Vt=null,Ht=null,Ut=null,Wt=null,Gt=null;function Kt(){return Bt??=mt({importer:e=>t(()=>import(e),[])}),Bt}function qt(){return Vt??=ht(document),Vt}function Jt(){return Ht??=it(),Ht}function Yt(){return Ut??=ut(),Ut}function Xt(){return Wt??=dt({send:m}),Wt}function Zt(){return Gt??=zt({send:p}),Gt}function Qt(e,t){return{notify:t.notify,openSession:t.openSession,reportUsage:t=>Zt().record(e,t),useSessions:K,subscribeSessions:e=>It.subscribe(e),fetch:(t,n)=>_(e,t,n),providerRequest:(t,n,r)=>y(e,t,n,r),storageGet:t=>E(e,t).then(e=>e.value,e=>{if(C(e)!==`component_storage_missing`)throw G(e)}),storageSet:(t,n)=>b(e,t,n).catch(e=>{throw G(e)}),storageRemove:t=>ne(e,t).catch(e=>{throw G(e)})}}function $t({surface:e,cardSize:t,width:n,height:r}){let i=Number.isFinite(n)&&n>0?Math.round(n):0;return{units:e===`overview-card`&&t===`M`?2:1,width:i,height:Number.isFinite(r)&&r>0?Math.round(r):0,compact:i<300}}function en(e){let[t,n]=(0,j.useState)({width:0,height:0,measured:!1});return(0,j.useLayoutEffect)(()=>{let t=e.current;if(!t)return;let r=(e,t)=>n(n=>n.measured&&Math.round(n.width)===Math.round(e)&&Math.round(n.height)===Math.round(t)?n:{width:e,height:t,measured:!0}),i=t.getBoundingClientRect();if(r(i.width,i.height),typeof ResizeObserver>`u`)return;let a=new ResizeObserver(e=>{let t=e[e.length-1];t&&r(t.contentRect.width,t.contentRect.height)});return a.observe(t),()=>a.disconnect()},[e]),t}var tn=/^--[a-zA-Z0-9-]{1,64}$/;function nn(){if(typeof document>`u`)return`light|comfortable|default|default`;let e=document.documentElement;return[e.classList.contains(`dark`)?`dark`:`light`,e.dataset.density||`comfortable`,e.dataset.fontScale||`default`,e.dataset.radius||`default`,e.style.getPropertyValue(`--ui-font-size`).trim()].join(`|`)}function rn(e){if(typeof MutationObserver>`u`||typeof document>`u`)return()=>{};let t=new MutationObserver(e);return t.observe(document.documentElement,{attributes:!0,attributeFilter:[`class`,`style`,`data-density`,`data-font-scale`,`data-radius`]}),()=>t.disconnect()}function an(e){return typeof e!=`string`||!tn.test(e)||typeof document>`u`?``:getComputedStyle(document.documentElement).getPropertyValue(e).trim()}var q=new Map;function on(e){let t=q.get(e);if(t)return t;let[n,r,i,a,o]=e.split(`|`),s=Object.freeze({mode:n===`dark`?`dark`:`light`,density:r||`comfortable`,fontSize:o||i||`default`,radius:a||`default`,token:an});return q.size>64&&q.clear(),q.set(e,s),s}function sn(){return on((0,j.useSyncExternalStore)(rn,nn,nn))}var cn={attention:`attn`,run:`run`,queued:`queue`,done:`done`,failed:`fail`,stopped:`queue`},ln={run:`border-st-run-border bg-st-run-soft text-st-run`,attn:`border-st-attn-border bg-st-attn-soft text-st-attn`,fail:`border-st-fail-border bg-st-fail-soft text-st-fail`,done:`border-st-done-border bg-st-done-soft text-st-done`,queue:`border-st-queue-border bg-st-queue-soft text-st-queue`};function un({status:e,tone:t,spin:n,className:r,children:i,...a}){let o=t??cn[e];return(0,M.jsxs)(`span`,{"data-status":e,"data-tone":o,className:k(`inline-flex h-[22px] w-fit max-w-full shrink-0 items-center gap-[5px] rounded-xs border pr-2 pl-1.5 text-xs leading-none font-medium whitespace-nowrap`,ln[o],r),...a,children:[(0,M.jsx)(Te,{status:e,spin:n,className:`size-3.5`}),(0,M.jsx)(`span`,{className:`min-w-0 truncate`,children:i})]})}function dn({className:e,...t}){return(0,M.jsx)(`div`,{"data-slot":`empty`,className:k(`flex w-full min-w-0 flex-1 flex-col items-center justify-center gap-4 rounded-xl border border-dashed border-stroke-strong p-6 text-center text-balance`,e),...t})}i(`mb-2 flex shrink-0 items-center justify-center [&_svg]:pointer-events-none [&_svg]:shrink-0`,{variants:{variant:{default:`bg-transparent`,icon:`flex size-8 shrink-0 items-center justify-center rounded-md border border-stroke bg-key text-content-muted shadow-key [&_svg:not([class*='size-'])]:size-4`}},defaultVariants:{variant:`default`}});var fn=Object.freeze({Button:A,Badge:Ee,Chip:xe,Input:Ce,Textarea:we,Switch:ue,Checkbox:se,SegmentedControl:de,Progress:ce,Spinner:ge,Skeleton:Oe,Separator:le,Kbd:_e,Tooltip:he,TooltipTrigger:fe,TooltipContent:pe,TooltipProvider:me,StatusGlyph:Te,StatusTag:un,Empty:dn}),pn=Object.freeze({React:j,html:tt,ui:fn,useTheme:sn}),mn=()=>{};function hn(e,t,n){return n?`preview:${e.id}`:t.instanceId}function gn({component:e,instance:t,preview:n=!1,session:r,notify:i,onOpenSession:o,onRequestFix:s,onCommitSample:c,className:l}){let{t:u,language:d}=a(),f=hn(e,t,n),p=De(),m=(0,j.useSyncExternalStore)(p.subscribe,p.mode,p.mode),h=Jt();(0,j.useSyncExternalStore)(h.subscribe,h.version,h.version);let g=h.isPaused(f),_=(0,j.useRef)(null),v=en(_),[y,b]=(0,j.useState)(0),[x,S]=(0,j.useState)(null),C=e.manifest,w=e.rev,T=e.kind===`native`&&e.status===`ready`&&!!(C&&w),E=T&&m===`normal`&&!g,D=(0,j.useMemo)(()=>ft({componentId:e.id,instanceId:f,surface:t.surface,buffer:Yt(),reporter:Xt()}),[e.id,t.surface,f]);(0,j.useLayoutEffect)(()=>{if(E)return p.beginLoad(f),()=>p.endLoad(f)},[E,f,p]);let ee=$t({surface:t.surface,cardSize:t.size,width:v.width,height:v.height}),O=null;return T?m===`normal`?g?O=(0,M.jsx)(J,{title:u(`custom-ui:host.pausedTitle`),description:u(`custom-ui:host.pausedHint`),actions:(0,M.jsx)(A,{size:`xs`,variant:`secondary`,onClick:()=>{S(null),h.resume(f),b(e=>e+1)},children:u(`custom-ui:host.resume`)})}):v.measured&&C&&w&&(O=(0,M.jsx)(yn,{onCrash:e=>{D.record(e instanceof U?`load`:`render`,`error`,e),p.endLoad(f),h.record(f,w)},fallback:t=>(0,M.jsx)(xn,{error:t,componentId:e.id,notify:i,onReload:()=>b(e=>e+1),onRequestFix:s}),children:(0,M.jsxs)(j.Suspense,{fallback:(0,M.jsx)(Oe,{className:`size-full rounded-none`}),children:[C.capabilities[`sessions.read`]&&(0,M.jsx)(Lt,{}),(0,M.jsx)(_n,{component:e,instance:t,preview:n,session:r,size:ee,language:d,logger:D,notify:i,onOpenSession:o??mn,onCallbackError:()=>h.record(f,w),onCommit:(e,t)=>{if(t&&p.endLoad(f),e&&c?.(e.duration),e?.warning&&x===null){let t=Math.round(e.duration);D.record(`slow`,`warn`,`slow commit ${t}ms`),S(t)}}})]})},`${t.instanceId}@${w}#${y}~${e.revoked.join(`,`)}`)):O=(0,M.jsx)(J,{title:u(`custom-ui:host.safeModeTitle`),description:u(`custom-ui:host.safeModeHint`)}):O=(0,M.jsx)(J,{title:u(`custom-ui:host.unavailableTitle`)}),(0,M.jsxs)(`div`,{ref:_,"data-component-host":e.id,"data-component-instance":t.instanceId,"data-component-state":T?m===`normal`?g?`paused`:`active`:`safe-mode`:`unavailable`,className:k(`relative size-full min-h-0 min-w-0 overflow-hidden`,l),children:[O,E&&x!==null&&(0,M.jsxs)(`div`,{role:`status`,className:`absolute top-1 right-1 flex items-center gap-1 rounded-sm border border-stroke-strong bg-panel px-1.5 py-0.5 text-xs text-content-secondary shadow-key`,children:[(0,M.jsx)(`span`,{children:u(`custom-ui:host.slowWarning`,{ms:x})}),(0,M.jsx)(A,{size:`xs`,variant:`ghost`,onClick:()=>h.pause(f),children:u(`custom-ui:host.pause`)})]})]})}function _n({component:e,instance:t,preview:n,session:r,size:i,language:a,logger:o,notify:s,onOpenSession:c,onCallbackError:l,onCommit:u}){let d=e.manifest,f=e.rev,p=(0,j.use)(Kt().load(e.id,f,d.entry)),m=(0,j.useRef)({notify:s,onOpenSession:c,onCallbackError:l,language:a});m.current={notify:s,onOpenSession:c,onCallbackError:l,language:a};let h=(0,j.useRef)(()=>Ft({manifest:d,getLanguage:()=>m.current.language,kit:pn,services:Qt(e.id,{notify:e=>m.current.notify(e),openSession:e=>m.current.onOpenSession(e)}),revoked:e.revoked,logger:o,onCallbackError:e=>m.current.onCallbackError(e)})),[g,_]=(0,j.useState)(()=>h.current()),v=(0,j.useRef)(null);(0,j.useEffect)(()=>{if(v.current!==null&&(window.clearTimeout(v.current),v.current=null),g.disposed){_(h.current());return}return()=>{v.current=window.setTimeout(()=>{v.current=null,g.dispose()},0)}},[g]),(0,j.useEffect)(()=>{let t=d.styles;if(t.length)return qt().retain(e.id,f,t)},[e.id,d.styles,f]);let y=(0,j.useRef)(Ze()),b=(0,j.useRef)(!1);y.current.start(performance.now());let x={surface:t.surface,instanceId:t.instanceId,title:t.title??``,preview:n},S=g.context({size:i,placement:x,session:r});return(0,M.jsxs)(M.Fragment,{children:[(0,j.createElement)(p,{props:t.props,size:S.size,placement:S.placement,ctx:S}),(0,M.jsx)(vn,{onCommit:()=>{let e=y.current.commit(performance.now()),t=!b.current;b.current=!0,u(e,t)}})]})}function vn({onCommit:e}){return(0,j.useLayoutEffect)(()=>{e()}),null}var yn=class extends j.Component{state={error:null,failed:!1};static getDerivedStateFromError(e){return{error:e,failed:!0}}componentDidCatch(e,t){this.props.onCrash(e)}render(){return this.state.failed?this.props.fallback(this.state.error):this.props.children}};function bn({componentId:e,notify:t}){let{t:n}=a(),r=o(),i=s(ee()).data?.features.versions===!0,c=s({queryKey:w.versions(e),queryFn:({signal:t})=>Me(e,t),enabled:i,retry:!1,staleTime:1e4}),[l,u]=(0,j.useState)(!1),d=c.data?.versions[0];if(!i||!d)return null;let f=async()=>{u(!0);try{await Fe(e,d.n),t(n(`custom-ui:versions.restored`,{n:d.n})),await r.invalidateQueries({queryKey:w.all})}catch(e){let r=C(e);t(r?`${n(`custom-ui:versions.restoreFailed`)} ${B(r,n)}`:n(`custom-ui:versions.restoreFailed`)),u(!1)}};return(0,M.jsx)(A,{size:`xs`,variant:`ghost`,disabled:l,"data-component-rollback":d.n,onClick:()=>void f(),children:n(`custom-ui:host.rollbackTo`,{n:d.n})})}function xn({error:e,componentId:t,notify:n,onReload:r,onRequestFix:i}){let{t:o}=a(),[s,c]=(0,j.useState)(!1),l=st(e),u=e instanceof U;return(0,M.jsx)(J,{tone:`error`,title:o(u?`custom-ui:host.loadErrorTitle`:`custom-ui:host.renderErrorTitle`),actions:(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(A,{size:`xs`,variant:`ghost`,"aria-expanded":s,onClick:()=>c(!s),children:o(s?`custom-ui:host.hideError`:`custom-ui:host.viewError`)}),(0,M.jsx)(A,{size:`xs`,variant:`secondary`,onClick:r,children:o(`custom-ui:host.reload`)}),(0,M.jsx)(bn,{componentId:t,notify:n}),i&&(0,M.jsx)(A,{size:`xs`,variant:`ghost`,onClick:()=>i(lt(l.message,l.stack)),children:o(`custom-ui:host.askAgentFix`)})]}),children:s&&(0,M.jsx)(`pre`,{className:`max-h-32 w-full overflow-auto rounded-sm bg-surface-subtle p-2 text-left font-mono text-xs whitespace-pre-wrap text-content-secondary`,children:l.stack||l.message})})}function J({title:e,description:t,actions:n,children:r,tone:i=`neutral`}){return(0,M.jsxs)(`div`,{role:i===`error`?`alert`:`status`,className:`flex size-full min-h-0 flex-col items-start justify-center gap-1.5 overflow-auto p-3 text-left`,children:[(0,M.jsx)(`p`,{className:k(`text-sm font-medium`,i===`error`?`text-st-fail`:`text-content`),children:e}),t&&(0,M.jsx)(`p`,{className:`text-xs text-content-muted`,children:t}),r,n&&(0,M.jsx)(`div`,{className:`flex flex-wrap items-center gap-1`,children:n})]})}Object.freeze([`GET`,`HEAD`,`POST`,`PUT`,`PATCH`,`DELETE`]),Object.freeze([`overview-card`,`session-panel`,`feature-page`,`floating`]),Object.freeze([`S`,`M`]);var Sn=Object.freeze({S:Object.freeze({w:320,h:120}),M:Object.freeze({w:320,h:248})}),Cn=Object.freeze({w:320,h:200});Object.freeze({minW:160,maxW:480,minH:64,maxH:480}),Object.freeze([`network`,`notify`,`sessions.read`,`sessions.open`,`storage`,`provider.request`]);var wn=16384;Object.freeze([`pisper-island`]),Object.freeze([`sdk`,`React`,`html`,`ui`,`theme`,`sessions`,`notify`,`net`,`storage`,`provider`,`signal`,`setTimeout`,`setInterval`,`clearTimeout`,`clearInterval`,`size`,`placement`,`session`,`t`,`log`,`CapabilityError`]),Object.freeze([`Button`,`Badge`,`Chip`,`Input`,`Textarea`,`Switch`,`Checkbox`,`SegmentedControl`,`Progress`,`Spinner`,`Skeleton`,`Separator`,`Kbd`,`Tooltip`,`TooltipTrigger`,`TooltipContent`,`TooltipProvider`,`StatusGlyph`,`StatusTag`,`Empty`]),Object.freeze([`zh-CN`,`en-US`]);var Tn=/^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/;function En(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:null}function Dn(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function On(e){let t=``,n=!1;for(let r=0;r<e.length;r+=1){let i=e.charCodeAt(r);if(i>=55296&&i<=56319){let i=e.charCodeAt(r+1);if(i>=56320&&i<=57343){t+=e[r]+e[r+1],r+=1;continue}t+=`�`,n=!0;continue}if(i>=56320&&i<=57343){t+=`�`,n=!0;continue}t+=e[r]}return n?t:e}function Y(e,t,n,r){e.push(r?{path:t,code:n,params:r}:{path:t,code:n})}function kn(e,t,n,r){switch(e.type){case`string`:{if(typeof t!=`string`)return Y(r,n,`props_type_invalid`);let i=On(t);return i.length>e.maxLength?Y(r,n,`props_too_long`,{max:e.maxLength}):e.enum&&!e.enum.includes(i)?Y(r,n,`props_enum_invalid`):e.format===`url`&&i&&!/^https?:\/\/[^\s]+$/i.test(i)?Y(r,n,`props_url_invalid`):e.format===`color`&&i&&!Tn.test(i)?Y(r,n,`props_color_invalid`):i}case`number`:case`integer`:return typeof t!=`number`||!Number.isFinite(t)||e.type===`integer`&&!Number.isInteger(t)?Y(r,n,`props_type_invalid`):e.minimum!==void 0&&t<e.minimum||e.maximum!==void 0&&t>e.maximum?Y(r,n,`props_out_of_range`,{...e.minimum===void 0?{}:{min:e.minimum},...e.maximum===void 0?{}:{max:e.maximum}}):t;case`boolean`:return typeof t==`boolean`?t:Y(r,n,`props_type_invalid`);case`array`:{if(!Array.isArray(t))return Y(r,n,`props_type_invalid`);if(t.length>e.maxItems)return Y(r,n,`props_too_many`,{max:e.maxItems});let i=[];for(let a=0;a<t.length;a+=1){let o=t[a];if(typeof o!=`string`)return Y(r,`${n}.${a}`,`props_type_invalid`);let s=On(o);if(s.length>e.itemMaxLength)return Y(r,`${n}.${a}`,`props_too_long`,{max:e.itemMaxLength});i.push(s)}return i}}}function An(e){let t=JSON.stringify(e),n=0;for(let e of t){let t=e.codePointAt(0);n+=t<128?1:t<2048?2:t<65536?3:4}return n}function jn(e,t){let n=[],r={},i=e?.properties||{};t??={};let a=En(t);if(!a)return Y(n,`props`,`props_type_invalid`),{value:r,errors:n};for(let e of Object.keys(a)){let t=Dn(i,e)?i[e]:void 0;if(!t){Y(n,`props.${e}`,`props_unknown`);continue}if(a[e]===null||a[e]===void 0)continue;let o=n.length,s=kn(t,a[e],`props.${e}`,n);n.length===o&&(r[e]=s)}for(let t of e?.required||[])!Dn(r,t)&&i[t]?.default===void 0&&Y(n,`props.${t}`,`props_required`);return!n.length&&An(r)>16384&&Y(n,`props`,`props_too_large`,{max:wn}),{value:n.length?{}:r,errors:n}}function Mn(e,t){return e.placements.find(e=>e.surface===t)||null}var Nn={standard:456,min:420},Pn=1360;function Fn(e){return e.filter(e=>e.kind!==`legacy`)}function X(e,t){return(e.manifest?.i18n)?.[t]?.name||e.name||e.id}function In(e,t){return(e.manifest?.i18n)?.[t]?.description||e.description||``}function Ln(e,t){return e.kind===`broken`||e.status!==`ready`||t.has(e.id)}function Rn(e){return e.kind===`native`&&e.enabled}function zn(e,{filter:t,query:n,language:r,troubled:i}){let a=n.trim().toLocaleLowerCase();return e.filter(e=>t===`enabled`&&!Rn(e)||t===`attention`&&!Ln(e,i)?!1:!a||[X(e,r),e.id,In(e,r)].join(`
|
|
3
|
-
`).toLocaleLowerCase().includes(a))}function Bn(e,t){return{all:e.length,enabled:e.filter(Rn).length,attention:e.filter(e=>Ln(e,t)).length}}var Vn=[`overview-card`,`session-panel`,`feature-page`,`floating`];function Hn(e,t){let n=[];for(let r of Vn){let i=t.filter(t=>t.componentId===e&&t.surface===r&&t.enabled);if(!i.length)continue;let a=[`S`,`M`].filter(e=>i.some(t=>t.size===e));n.push({surface:r,sizes:r===`overview-card`?a:[],count:i.length})}return n}function Un(e){if(!e)return[];let t=[];for(let n of Vn){let r=e.placements.find(e=>e.surface===n);if(r){if(n===`overview-card`){let e=r.sizes?.length?r.sizes:[`S`,`M`];for(let n of e)t.push(n===`S`?`overview-S`:`overview-M`)}else t.push(n)}}return t}function Wn(e){return e===`overview-S`||e===`overview-M`?`overview-card`:e}function Gn(e){return e===`overview-S`?`S`:e===`overview-M`?`M`:null}function Kn(e){return e.surface===`overview-card`?e.size===`M`?`overview-M`:`overview-S`:e.surface}function qn(e,t,n){if(e===`overview-S`||e===`overview-M`){let t=e===`overview-S`?`S`:`M`,n=Sn[t];return{width:n.w,height:n.h,label:`${t} · ${n.w}×${n.h}`}}if(e===`session-panel`){let e=Nn[n];return{width:e,height:`fill`,label:`${e}`}}if(e===`floating`){let e=t?.placements.find(e=>e.surface===`floating`)?.size??Cn;return{width:e.w,height:e.h,label:`${e.w}×${e.h}`}}return n===`min`?{width:812,height:`fill`,label:`812`}:{width:`fill`,height:`fill`,label:``}}function Jn(e,t){return!!e?.placements.some(e=>e.surface===t)}function Yn(e){return e?.placements.find(e=>e.surface===`overview-card`)?.sizes?.[0]??`S`}function Xn(e){return e.kind===`native`&&e.status===`ready`&&e.enabled&&!!e.manifest}function Zn(e,t,n){return e.find(e=>e.id===t)||(t?void 0:e.find(e=>e.id===n))||(t?void 0:e[0])||null}var Qn=4e3,Z={pending:new Set,sessions:new Map},Q=new Set;function $(e){Z={...Z,...e};for(let e of[...Q])e()}function $n(e){return Q.add(e),()=>{Q.delete(e)}}function er(e){return{pending:(0,j.useSyncExternalStore)($n,()=>Z.pending.has(e)),sessionId:(0,j.useSyncExternalStore)($n,()=>Z.sessions.get(e)??``)}}async function tr(e,t){let n=await h(e);return Se({sessionId:n.sessionId,prompt:t.slice(0,Qn),commandWhenEmpty:n.command,created:n.created?n.session:null})}function nr(e){let{t,language:n}=a();return(0,j.useMemo)(()=>{let r=async(r,i,a)=>{let o=i.trim();if(!o||Z.pending.has(r.id))return null;$({pending:new Set(Z.pending).add(r.id)});let s=X(r,n);try{let n=await tr(r.id,o);return $({sessions:new Map(Z.sessions).set(r.id,n.sessionId)}),e(n.queued?t(`custom-ui:agent.queued`,{name:s}):t(a===`fix`?`custom-ui:agent.fixSent`:`custom-ui:agent.generateSent`,{name:s})),n}catch(n){let r=C(n);return e(r?`${t(`custom-ui:agent.failed`)} ${B(r,t)}`:t(`custom-ui:agent.failed`)),null}finally{let e=new Set(Z.pending);e.delete(r.id),$({pending:e})}};return{generate:(e,t)=>r(e,t,`generate`),fix:(e,n)=>r(e,t(`custom-ui:agent.fixPrompt`,{summary:n}),`fix`)}},[n,e,t])}function rr(e,t){let n=nr(t);return(0,j.useCallback)(t=>void n.fix(e,t),[n,e])}function ir(e,t){return t(e===`overview-card`?`custom-ui:studio.surfaceOverview`:e===`session-panel`?`custom-ui:studio.surfaceSession`:e===`feature-page`?`custom-ui:studio.surfaceFeature`:`custom-ui:studio.surfaceFloating`)}function ar(e,t){switch(e){case`overview-S`:return t(`custom-ui:studio.targetOverviewS`);case`overview-M`:return t(`custom-ui:studio.targetOverviewM`);case`session-panel`:return t(`custom-ui:studio.surfaceSession`);case`feature-page`:return t(`custom-ui:studio.surfaceFeature`);default:return t(`custom-ui:studio.surfaceFloating`)}}function or(e,t){switch(e){case`network`:return t(`custom-ui:studio.capNetwork`);case`notify`:return t(`custom-ui:studio.capNotify`);case`sessions.read`:return t(`custom-ui:studio.capSessionsRead`);case`sessions.open`:return t(`custom-ui:studio.capSessionsOpen`);case`provider.request`:return t(`custom-ui:studio.capProviderRequest`);default:return t(`custom-ui:studio.capStorage`)}}function sr(e,t){switch(e.source){case`agent`:return t(`custom-ui:versions.sourceAgent`);case`import`:return t(`custom-ui:versions.sourceImport`);case`restore`:return t(`custom-ui:versions.sourceRestore`);case`local`:return t(`custom-ui:versions.sourceLocal`);default:return``}}function cr(e){let t=o(),{t:n}=a();return(0,j.useMemo)(()=>{let r=()=>t.invalidateQueries({queryKey:w.all}),i=(t,r)=>{let i=C(t);e(i?`${r} ${B(i,n)}`:r)},a=async(e,t)=>{try{let t=await e();return await r(),t}catch(e){return i(e,t),null}};return{refresh:r,createFromTemplate:(e,t)=>a(()=>x({template:e,...t?{name:t}:{}}),n(`custom-ui:studio.createFailed`)),setEnabled:(e,t)=>a(()=>T(e.id,t),n(`custom-ui:studio.toggleFailed`)),remove:async t=>{let r=await a(()=>D(t.id),n(`custom-ui:studio.deleteFailed`));return r&&e(n(`custom-ui:studio.deleted`,{name:t.name})),r},place:(e,t,r)=>{let i=r.surface===`overview-card`?void 0:t.find(t=>t.componentId===e.id&&t.surface===r.surface);return a(()=>i?d(i.instanceId,{enabled:!0,...r.scope?{scope:r.scope}:{}}):O({componentId:e.id,...r}),n(`custom-ui:studio.placeFailed`))},unplace:e=>a(()=>S(e.instanceId),n(`custom-ui:studio.unplaceFailed`)),patchInstance:(e,t)=>a(()=>d(e.instanceId,t),n(`custom-ui:studio.saveFailed`)),saveProps:async(e,t)=>{let n=await d(e.instanceId,t);return await r(),n}}},[t,e,n])}export{en as A,Je as B,Wn as C,Mn as D,Sn as E,lt as F,We as G,Re as H,B as I,Ye as J,Fe as K,Pe as L,Yt as M,Kt as N,jn as O,K as P,Ke as R,Gn as S,Cn as T,Me as U,Ue as V,Be as W,Ge as X,Ve as Y,qn as _,sr as a,Bn as b,er as c,Xn as d,X as f,Hn as g,Kn as h,ar as i,Jt as j,gn as k,rr as l,zn as m,or as n,Qn as o,Yn as p,ze as q,ir as r,nr as s,cr as t,Pn as u,Un as v,Fn as w,Jn as x,Zn as y,Ie as z};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{t}from"./index-CsE52ydO.js";import{i as n}from"./vendor-react-DwNgTV1j.js";import{i as r}from"./vendor-state-GkUciC5H.js";import{t as i}from"./runtime-capabilities-store-C2Qv7uDP.js";import{E as a,i as o,t as s}from"./useSessionListQuery-D44XZfGr.js";function c(){return r(()=>({getItem:e=>{try{return t.getItem(e)}catch{return null}},setItem:(e,n)=>{try{t.setItem(e,n)}catch{}},removeItem:e=>{try{t.removeItem(e)}catch{}}}))}function l(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:{}}function u(e,{limit:t=200,maxLength:n=4096}={}){if(!Array.isArray(e))return[];let r=[];for(let i of e)if(!(typeof i!=`string`||i.length>n||r.includes(i))&&(r.push(i),r.length>=t))break;return r}var d=e(n(),1);function f(){let e=i(e=>e.capabilities.features);return(0,d.useMemo)(()=>{let t=e;return{askUser:t.askUser===!0,sessionQueue:t.sessionQueue===!0}},[e])}function p(e){let t=s(),n=a(e=>e.live),r=a(e=>e.localRuns),i=a(e=>e.runningSince),c=a(e=>e.patches),l=a(e=>e.pending),u=a(e=>e.feed.entries),p=a(e=>e.feed.ready),m=a(e=>Math.floor(e.feed.updatedAt/6e4)),h=f(),g=t.data?.sessions,_=Math.max(t.dataUpdatedAt,m*6e4),v=(0,d.useMemo)(()=>({ready:p,entries:u}),[u,p]);return{query:t,items:(0,d.useMemo)(()=>g||v.ready?o(g??[],{live:n,localRuns:r,runningSince:i,patches:c,pending:l,feed:v},{now:_,capabilities:h,doneWindow:e}):[],[h,e,v,n,r,_,c,l,i,g]),capabilities:h,isLoading:t.isPending&&!v.ready}}export{u as i,c as n,l as r,p as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t}from"./vendor-react-DwNgTV1j.js";import{t as n}from"./useQuery-DdcpUQhO.js";import{t as r}from"./api-BO7LAPSQ.js";import{S as i,a,n as o,o as s}from"./useSessionListQuery-D44XZfGr.js";import{c}from"./useNow-Bxn4_OW9.js";import{t as l}from"./useBoardItems-CzEbgTLJ.js";import{i as u}from"./format-DMJQzoZ7.js";var d=e(t(),1);function f({doneWindow:e}={}){let t=c(e=>e.groupBy),n=c(e=>e.projects),r=c(e=>e.lanes),u=c(e=>e.collapsedLanes),f=c(e=>e.doneWindow),p=e??f,{query:m,items:h,capabilities:g,isLoading:_}=l(p),v=(0,d.useMemo)(()=>a(h,{lanes:r,projects:n}),[h,r,n]),y=(0,d.useMemo)(()=>s(v),[v]),b=(0,d.useMemo)(()=>o(h),[h]),x=(0,d.useMemo)(()=>h.filter(e=>e.lane===`attention`),[h]),S=m.data?.sessions,C=(0,d.useMemo)(()=>!!S&&!(S??[]).some(e=>e.archived!==!0&&(typeof e.messageCount!=`number`||e.messageCount>0)),[S]),w=(0,d.useMemo)(()=>({groupBy:t,projects:n,lanes:r,collapsedLanes:u,doneWindow:p}),[u,p,t,r,n]),T=(0,d.useCallback)(async()=>{await i()},[]);return{all:h,items:v,lanes:y,projects:b,total:h.length,attentionAll:x,catalogEmpty:C,view:w,capabilities:g,isLoading:_,isRefreshing:m.isFetching&&!m.isPending,error:m.error??null,refresh:T}}function p(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:{}}function m(e){return typeof e==`number`&&Number.isFinite(e)&&e>=0?e:null}var h=[`input`,`output`,`cacheRead`,`cacheWrite`,`totalTokens`,`total`];function g(e,t){let n=p(e),r=h.some(e=>m(n[e])!==null)?u(e).totalTokens:null,i=p(p(t).subAgents),a=m(i.running),o=m(i.maxConcurrent);return{todayTokens:m(r),memoryBytes:m(p(p(t).memory).rss),...a!==null&&o!==null&&o>=1?{subAgents:{running:Math.floor(a),max:Math.floor(o)}}:{}}}async function _(e){let[t,n]=await Promise.allSettled([r(`/api/usage/today`,{signal:e}),r(`/api/runtime/diagnostics`,{signal:e})]);return g(t.status===`fulfilled`?t.value:void 0,n.status===`fulfilled`?n.value:void 0)}function v(e){return n({queryKey:[`board`,`fleet-system-info`],queryFn:({signal:e})=>_(e),enabled:e,staleTime:15e3,retry:!1})}export{f as n,v as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t}from"./vendor-react-DwNgTV1j.js";import{t as n}from"./use-i18n-B5p-Kzvz.js";import{a as r,o as i}from"./vendor-state-GkUciC5H.js";import{t as a}from"./createLucideIcon-Cd-3GVxJ.js";import{n as o,r as s}from"./useBoardItems-CzEbgTLJ.js";import{n as c}from"./workspace-order-store-RYWvGOeR.js";import{a as l,n as u}from"./folder-paths-DQTpuGh9.js";var d=a(`folder`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),f=e(t(),1),p=`pisper-launch-defaults`,m=[`approval-required`,`workspace-write`,`full-access`],h=[`plan`,`goal`,`team`],g=m.filter(e=>e!==`full-access`);function _(e){return g.includes(e)?e:``}var v={cwd:``,projectless:!1,model:``,thinkingLevel:``,executionMode:``,runMode:`plan`};function y(e,t,n){if(typeof e!=`string`)return``;let r=e.trim();return r.length<=t&&(!n||n.test(r))?r:``}function b(e){let t=s(e);return{cwd:y(t.cwd,4096),projectless:t.projectless===!0,model:y(t.model,256),thinkingLevel:y(t.thinkingLevel,32,/^[a-z][a-z0-9_-]*$/),executionMode:_(t.executionMode),runMode:h.includes(t.runMode)?t.runMode:`plan`}}function x(e,t){let n=t.projectless??(t.cwd===void 0&&e.projectless),r=b({...e,...t,projectless:n});return t.executionMode===`full-access`?{...r,executionMode:_(e.executionMode)}:r}var S=i()(r((e,t)=>({...v,rememberLaunch:n=>{let{cwd:r,projectless:i,model:a,thinkingLevel:o,executionMode:s,runMode:c}=t();e(x({cwd:r,projectless:i,model:a,thinkingLevel:o,executionMode:s,runMode:c},n))},resetLaunchDefaults:()=>e({...v})}),{name:p,storage:o(),version:1,partialize:({cwd:e,projectless:t,model:n,thinkingLevel:r,executionMode:i,runMode:a})=>({cwd:e,projectless:t,model:n,thinkingLevel:r,executionMode:i,runMode:a}),merge:(e,t)=>({...t,...b(e)})}));function C({onProjectChosen:e,onError:t,onRemembered:r}){let{t:i}=n(),[a,o]=(0,f.useState)(!1),[s,d]=(0,f.useState)(!1),[p,m]=(0,f.useState)(!1),[h,g]=(0,f.useState)(!1),[_,v]=(0,f.useState)(!1),[y,b]=(0,f.useState)(``),x=(0,f.useRef)(!1),C=(0,f.useRef)(0),w=(0,f.useRef)(!1),T=(0,f.useRef)({onProjectChosen:e,onError:t,onRemembered:r});T.current={onProjectChosen:e,onError:t,onRemembered:r},(0,f.useEffect)(()=>()=>{C.current+=1},[]);let E=(0,f.useCallback)(e=>{let t=c.getState().registerProject(e)||e;S.getState().rememberLaunch({cwd:t}),T.current.onRemembered?.(t)},[]),D=(0,f.useCallback)(async()=>{if(x.current)return;x.current=!0,o(!0);let e=++C.current;try{let t=await l(i);if(e!==C.current)return;t.status===`picked`?(E(t.path),T.current.onProjectChosen()):t.status===`unavailable`&&(d(!0),m(!0))}catch(t){e===C.current&&T.current.onError(t instanceof Error?t.message:String(t))}finally{e===C.current&&(x.current=!1,o(!1))}},[E,i]),O=(0,f.useCallback)((e=``)=>{b(u(e)),g(!0),v(!0)},[]),k=e=>{w.current&&(w.current=!1,e.preventDefault(),T.current.onProjectChosen())};return{newProject:D,newFolder:O,picking:a,picker:{mounted:s,open:p,description:i(`board:project.pickerDescription`),onOpenChange:m,onSelect:e=>{E(e),w.current=!0},onCloseAutoFocus:k},folderDialog:{mounted:h,open:_,initialParent:y,onOpenChange:v,onCreated:e=>{E(e),w.current=!0},onCloseAutoFocus:k}}}export{d as i,m as n,S as r,C as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t}from"./vendor-react-DwNgTV1j.js";import{a as n,o as r}from"./vendor-state-GkUciC5H.js";import{a as i}from"./startup-queries-6Oztqpto.js";import{l as a,n as o,u as s}from"./session-board-status-D2lpFPiI.js";import{u as c}from"./events-DrAPv0se.js";import{t as l}from"./chat-api-DkdyVQY9.js";import{C as u,D as d,E as f,S as p,T as m,_ as h,b as g,c as _,d as v,f as y,g as b,h as x,l as S,m as ee,p as C,v as w,w as T,x as E}from"./useSessionListQuery-D44XZfGr.js";import{i as D,n as te,r as O}from"./useBoardItems-CzEbgTLJ.js";import{n as k}from"./card-presentation-1oph2b8P.js";var A=e(t(),1),j=class extends Error{code=`board_confirmation_required`},M=()=>({ok:!1,reason:`pending`,error:null});function N(){p().catch(()=>void 0)}async function P(e,t,n,{confirmCritical:r=!1}){let i=ee(e,t);if(n&&(!i||i.severity===`critical`&&!r))return{ok:!1,reason:`confirmation-required`,error:new j};let a=n?`approve`:`deny`,o=C(a,e,t);if(!y(o,a))return M();let s=b(e).filter(e=>e.id!==t);u(e,t);let c=s.length?null:v(e,{needsAttention:!1,attentionReason:null,streaming:!0});try{await d.resolveApproval(e,t,n)}catch(t){return c!==null&&h(e,c),i&&T(e,i),g(o),N(),{ok:!1,reason:`failed`,error:t}}try{await w(e,e=>!e||!e.card.approvals.some(e=>e.id===t),{fresh:!0})}catch{}finally{c!==null&&h(e,c),g(o)}return{ok:!0}}function F(e,t,n={}){return P(e,t,!0,n)}function I(e,t){return P(e,t,!1,{})}async function L(e,t,n){let r=C(`answer`,e,t);if(!y(r,`answer`))return M();let i=v(e,{needsAttention:!1,attentionReason:null,streaming:!0});try{await l.answerQuestion(e,t,{answers:[{selected:[n]}]})}catch(t){return h(e,i),g(r),N(),{ok:!1,reason:`failed`,error:t}}try{await w(e,void 0,{fresh:!0})}catch{}finally{h(e,i),g(r)}return{ok:!0}}async function R(e){let t=C(`start`,e);if(!y(t,`start`))return M();let n=v(e,{streaming:!0});try{await l.startQueuedSession(e)}catch(r){return h(e,n),g(t),N(),{ok:!1,reason:`failed`,error:r}}try{await w(e,void 0,{fresh:!0})}catch{}finally{h(e,n),g(t)}return{ok:!0}}async function z(e){let t=C(`retry`,e);if(!y(t,`retry`))return M();let n=v(e,{streaming:!0});try{await E(e,`retry`,(t,n)=>d.retry(e,t,n))}catch(r){return h(e,n),g(t),N(),{ok:!1,reason:`failed`,error:r}}try{await w(e,e=>!e||e.session.streaming===!0)}catch{}finally{h(e,n),g(t)}return{ok:!0}}function B(e){m(e.id,{pinned:e.pinned,archived:e.archived,unread:e.unread,needsAttention:e.needsAttention,attentionReason:e.attentionReason}),i.setQueryData(S,t=>t&&{...t,sessions:t.sessions.map(t=>t.id===e.id?{...t,pinned:e.pinned,archived:e.archived,unread:e.unread,needsAttention:e.needsAttention,attentionReason:e.attentionReason}:t)})}async function V(e,t,n,r){let i=C(t,e);if(!y(i,t))return M();let a=v(e,n);try{return B(await d.updateOrganization(e,r)),{ok:!0}}catch(e){return N(),{ok:!1,reason:`failed`,error:e}}finally{h(e,a),g(i)}}function H(e){return x()?V(e,`markHandled`,{unread:!1,needsAttention:!1,attentionReason:null},{read:!0,dismissAttention:!0}):V(e,`markHandled`,{unread:!1},{read:!0})}function U(e,t=!0){return V(e,`pin`,{pinned:t},{pinned:t})}function W(e,t=!0){return V(e,`archive`,{archived:t},{archived:t})}async function G(e,t){let n=C(`rename`,e);if(!y(n,`rename`))return M();try{let n=await d.renameSession(e,t);return m(e,{name:n}),i.setQueryData(S,t=>t&&{...t,sessions:t.sessions.map(t=>t.id===e?{...t,name:n}:t)}),c({id:e,name:n}),{ok:!0}}catch(e){return N(),{ok:!1,reason:`failed`,error:e}}finally{g(n)}}function ne(){_();let e=f(e=>e.pending);return(0,A.useMemo)(()=>({approve:F,deny:I,retry:z,markHandled:H,pin:U,archive:W,rename:G,answer:L,startNow:R,pending:e,isPending:(t,n,r=``)=>!!e[C(t,n,r)]}),[e])}var re=`pisper-board-view`,ie=[`lane`,`project`],K={groupBy:`lane`,projects:[],lanes:[],collapsedLanes:[],doneWindow:`today`};function q(e){return D(e,{limit:4,maxLength:16}).filter(a)}function J(e){let t=O(e);return{groupBy:ie.includes(t.groupBy)?t.groupBy:K.groupBy,projects:D(t.projects),lanes:q(t.lanes),collapsedLanes:q(t.collapsedLanes),doneWindow:o.includes(t.doneWindow)?t.doneWindow:K.doneWindow}}function Y(e,t){return e.includes(t)?e.filter(e=>e!==t):[...e,t]}var ae=r()(n(e=>({...K,deckCollapsed:!1,setDeckCollapsed:t=>e({deckCollapsed:t===!0}),setGroupBy:t=>e({groupBy:J({groupBy:t}).groupBy}),setProjectFilter:t=>e({projects:D([...t])}),toggleProjectFilter:t=>e(e=>({projects:D(Y(e.projects,t))})),setLaneFilter:t=>e({lanes:q([...t])}),toggleLaneFilter:t=>e(e=>({lanes:q(Y(e.lanes,t))})),setLaneCollapsed:(t,n)=>e(e=>({collapsedLanes:q(n?[...e.collapsedLanes,t]:e.collapsedLanes.filter(e=>e!==t))})),setDoneWindow:t=>e({doneWindow:J({doneWindow:t}).doneWindow}),clearFilters:()=>e({projects:[],lanes:[]})}),{name:re,storage:te(),version:1,partialize:({groupBy:e,projects:t,lanes:n,collapsedLanes:r,doneWindow:i,deckCollapsed:a})=>({groupBy:e,projects:t,lanes:n,collapsedLanes:r,doneWindow:i,deckCollapsed:a}),merge:(e,t)=>({...t,...J(e),deckCollapsed:O(e).deckCollapsed===!0})}));function X(e){return typeof e==`number`&&Number.isFinite(e)?e:null}function Z(e,t=!1){return(n,r)=>{let i=X(e(n)),a=X(e(r));return i===a?n.id<r.id?-1:+(n.id>r.id):i===null?1:a===null?-1:t?a-i:i-a}}function Q(e){let t=[];e.status===`failed`&&t.push({kind:`failed`}),e.status===`approval`&&t.push({kind:`approval`,critical:e.severity===`critical`});let n=X(e.questionCount);return(e.status===`question`||n!==null&&n>0)&&t.push({kind:`question`,count:n!==null&&n>0?n:null}),t}function $(e){let t=e.approvals[0],n=X(e.questionCount);return e.status===`approval`&&e.approvalsState===`ready`&&e.severity===`standard`&&t&&!t.truncated&&!(n!==null&&n>0)?{kind:`decide`,approvalId:t.id,remaining:e.approvals.length-1}:{kind:`open`}}function oe(e){return Math.round(e*.381966%1*1e3)/1e3}function se(e,{now:t,capabilities:n,timeZoneOffsetMinutes:r}){let i=[],a=[],o=[],c=[],l=[],u=new Set;for(let d of e)!d||typeof d.id!=`string`||!d.id||u.has(d.id)||d.session?.archived!==!0&&(u.add(d.id),d.lane===`attention`?i.push(d):d.lane===`running`?a.push(d):d.lane===`queued`?n?.sessionQueue===!0&&o.push(d):d.lane===`done`&&(d.pinned?c.push(d):s(d.since,{now:t,timeZoneOffsetMinutes:r,doneWindow:`today`})&&l.push(d)));let d=i.sort(Z(e=>e.since)).map(e=>({group:`attention`,id:e.id,title:e.title,status:e.status,pinned:e.pinned===!0,glyph:`attention`,waitingSince:X(e.since),reasons:Q(e),quickAction:$(e)})),f=e=>X(e.startedAt)??X(e.since),p=a.sort(Z(f)).map((e,t)=>({group:`running`,id:e.id,title:e.title,status:e.status,pinned:e.pinned===!0,glyph:`run`,startedAt:f(e),phase:oe(t)})),m=Z(e=>e.since),h=o.sort((e,t)=>{let n=X(e.queuePosition),r=X(t.queuePosition);return n===r?m(e,t):n===null?1:r===null?-1:n-r}).map((e,t)=>({group:`queued`,id:e.id,title:e.title,status:e.status,pinned:e.pinned===!0,glyph:`queued`,position:X(e.queuePosition)??t+1})),g=c.sort(Z(e=>e.since,!0)).map(e=>({group:`pinned`,id:e.id,title:e.title,status:e.status,pinned:e.pinned===!0,glyph:k(e),at:X(e.since)})),_=l.sort(Z(e=>e.since,!0)).map(e=>({group:`done`,id:e.id,title:e.title,status:e.status,pinned:e.pinned===!0,glyph:k(e),finishedAt:X(e.since),unread:e.unread===!0})),v={attention:d.length,running:p.length,queued:h.length,pinned:g.length,done:_.length},y=(e,t,n=1/0)=>({id:e,count:t.length,rows:t.slice(0,n),hidden:Math.max(0,t.length-n)}),b=[y(`attention`,d),y(`running`,p,8)];return h.length&&b.push(y(`queued`,h)),g.length&&b.push(y(`pinned`,g)),_.length&&b.push(y(`done`,_,10)),{groups:b,counts:v,order:b.flatMap(e=>e.rows.map(e=>e.id)),longestWaitingId:d[0]?.id??null}}function ce(e,t,n){if(!e.length)return null;let r=t?e.indexOf(t):-1;return r<0?n===1?e[0]:e[e.length-1]:e[r+n]??null}function le(e){let[t,n]=(0,A.useState)(()=>Date.now());return(0,A.useEffect)(()=>{if(!e)return;let t=null,r=()=>{t||document.visibilityState===`hidden`||(n(Date.now()),t=setInterval(()=>n(Date.now()),1e3))},i=()=>{t&&clearInterval(t),t=null},a=()=>document.visibilityState===`hidden`?i():r();return r(),document.addEventListener(`visibilitychange`,a),()=>{i(),document.removeEventListener(`visibilitychange`,a)}},[e]),t}function ue(){let[e,t]=(0,A.useState)(()=>Math.floor(Date.now()/6e4)*6e4);return(0,A.useEffect)(()=>{let e=null,n=()=>{let r=Date.now();t(Math.floor(r/6e4)*6e4),e=setTimeout(n,6e4-r%6e4+50)},r=()=>{e&&clearTimeout(e),e=null},i=()=>{r(),document.visibilityState!==`hidden`&&n()};return i(),document.addEventListener(`visibilitychange`,i),()=>{r(),document.removeEventListener(`visibilitychange`,i)}},[]),e}export{Z as a,ae as c,se as i,ne as l,le as n,$ as o,ce as r,Q as s,ue as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t}from"./vendor-react-DwNgTV1j.js";var n=e(t(),1);function r(e,t){let r=(0,n.useRef)(t);r.current=t,(0,n.useEffect)(()=>{if(e)return e(()=>r.current?.())},[e])}export{r as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e,r as t}from"./use-mobile-DauOEda6.js";import{t as n}from"./client-store-6GNC8uyK.js";function r(){let r=n(e=>e.client===`mobile-app`),i=e(),a=t()&&r;return(r||i)&&!a&&typeof window<`u`&&!window.pisperDesktop}function i(){let e=n(e=>e.client===`mobile-app`);return t()&&e}export{i as n,r as t};
|