pisper 0.6.20 → 0.6.21

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.
Files changed (109) hide show
  1. package/package.json +5 -5
  2. package/web/.vite/manifest.json +550 -550
  3. package/web/assets/{AppDialog-BKTqwx46.js → AppDialog-CyOinq_c.js} +1 -1
  4. package/web/assets/{AppOverlays-DEYd3Zud.js → AppOverlays-tniCecGA.js} +1 -1
  5. package/web/assets/{AssetsPage-BsIG0e5H.js → AssetsPage-DYFCPNhU.js} +1 -1
  6. package/web/assets/{BoardPage-CgbOwsbF.js → BoardPage-Dp-FZv-N.js} +3 -3
  7. package/web/assets/{ChannelsPage-C9eEdxbz.js → ChannelsPage-vBRUJEhU.js} +1 -1
  8. package/web/assets/{ChatAppearancePage-CBnvknpv.js → ChatAppearancePage-DH4LSb0w.js} +1 -1
  9. package/web/assets/{ChatHistoryPage-Bq-_Qawn.js → ChatHistoryPage-ChspTm6r.js} +1 -1
  10. package/web/assets/ChatPage-DvU-p808.js +553 -0
  11. package/web/assets/{ConfigPage-D44C5I7w.js → ConfigPage-CFFaLkKD.js} +2 -2
  12. package/web/assets/{DesktopWindowControls-DGhN5dWj.js → DesktopWindowControls-Cz0mpg2c.js} +1 -1
  13. package/web/assets/{FeaturePage-B3PLRtEG.js → FeaturePage-DT_WfUIg.js} +1 -1
  14. package/web/assets/{FileAttachmentPreview-fSmyWf24.js → FileAttachmentPreview-yuCLHoKm.js} +1 -1
  15. package/web/assets/{FloatingWidgets-C1_4vp7k.js → FloatingWidgets-D-48zs1T.js} +1 -1
  16. package/web/assets/{FocusRuntimeControls-DraooZz_.js → FocusRuntimeControls-D61-BVTV.js} +1 -1
  17. package/web/assets/{GitDiffViewer-XzdYQWbX.js → GitDiffViewer-DWHHRnjQ.js} +1 -1
  18. package/web/assets/{ManageProjectsDialog-BlXjm1PQ.js → ManageProjectsDialog-B_0l-_Th.js} +1 -1
  19. package/web/assets/{MarkdownMessage-B-IixrQ3.js → MarkdownMessage-zaqhqJ44.js} +1 -1
  20. package/web/assets/{McpPage-D0Zmfgbq.js → McpPage-CuOr94Lo.js} +1 -1
  21. package/web/assets/{MemoryPage-DgZ7cL70.js → MemoryPage-CI_OOJh3.js} +1 -1
  22. package/web/assets/{MobileNavigation-BIt1CBum.js → MobileNavigation-CpOrDVyY.js} +1 -1
  23. package/web/assets/{MorePage-BZ4iZ1n_.js → MorePage-CP0ptgQR.js} +1 -1
  24. package/web/assets/{NewFolderDialog-W9wLUVXP.js → NewFolderDialog-wwAp2HUt.js} +1 -1
  25. package/web/assets/{PageHeader-DcCyaFp0.js → PageHeader-CbiN6zVm.js} +1 -1
  26. package/web/assets/{PhoneDrawer-B_eKy4tt.js → PhoneDrawer-DN3UBXYe.js} +1 -1
  27. package/web/assets/{PhoneMenuButton-CBT0H1Cn.js → PhoneMenuButton-BMgvbvez.js} +1 -1
  28. package/web/assets/{PhoneTopBar-Czpvw2ML.js → PhoneTopBar-DFtEfuO6.js} +1 -1
  29. package/web/assets/{PluginsPage-wk5WpJ7Z.js → PluginsPage-CPkH6yN9.js} +1 -1
  30. package/web/assets/{SafeModePrompt-Dtq5wVfV.js → SafeModePrompt-vZ-kg03s.js} +1 -1
  31. package/web/assets/{SchedulesPage-BtRe2Qht.js → SchedulesPage-BQBk-HJm.js} +1 -1
  32. package/web/assets/{SessionBrowserPane-D2Z-J6tl.js → SessionBrowserPane-CC0qsCP9.js} +2 -2
  33. package/web/assets/{SessionContextPanel-Cg8AW4l1.js → SessionContextPanel-CyPu1SIQ.js} +2 -2
  34. package/web/assets/{SessionHome-DIpyJQVn.js → SessionHome-C2xp5_yM.js} +1 -1
  35. package/web/assets/{SessionInspector-DdpBBhNr.js → SessionInspector-D362Va6Y.js} +1 -1
  36. package/web/assets/{SessionShell-ocBFDevg.js → SessionShell-BmsJM64n.js} +1 -1
  37. package/web/assets/{SettingsSidebar-CP5t-q0e.js → SettingsSidebar-B7qnN1dq.js} +1 -1
  38. package/web/assets/{ShortcutHelpDialog-BOcP90RU.js → ShortcutHelpDialog-BzWvhRT2.js} +1 -1
  39. package/web/assets/{ShortcutKeys-CBl2x5Yl.js → ShortcutKeys-Cg-wl3yb.js} +1 -1
  40. package/web/assets/{SidebarUpdateStatus-CqZx7khD.js → SidebarUpdateStatus-B-MIuH8f.js} +1 -1
  41. package/web/assets/{SkillsPage-BGyMMq-9.js → SkillsPage-BowfELnZ.js} +1 -1
  42. package/web/assets/{TaskProcessesPane-B43p2Dvr.js → TaskProcessesPane-DGikk1nH.js} +1 -1
  43. package/web/assets/{TaskTerminalView-BMjmp-4_.js → TaskTerminalView-BjR4vuZI.js} +1 -1
  44. package/web/assets/{TerminalPanel-CH2-Yc1F.js → TerminalPanel-ZXcyyLBu.js} +1 -1
  45. package/web/assets/{WebDesktopPet-Fy9xj1bh.js → WebDesktopPet-CrUcp9Ym.js} +1 -1
  46. package/web/assets/{WorkflowsPage-DvZsyJSV.js → WorkflowsPage-CTKpPFrC.js} +1 -1
  47. package/web/assets/{WorkspacePicker-LbBXFH77.js → WorkspacePicker-CROSQVzJ.js} +1 -1
  48. package/web/assets/{api-m-Yq8n0q.js → api-CIB7ZPX3.js} +1 -1
  49. package/web/assets/{app-update-DVn3toIR.js → app-update-B6njQMB7.js} +1 -1
  50. package/web/assets/{approval-confirm-Ch86qdyC.js → approval-confirm-D2B0tMFE.js} +1 -1
  51. package/web/assets/{board-projects-KHcPQYWz.js → board-projects-Ca61ZKPH.js} +1 -1
  52. package/web/assets/{bots-store-BMcWJ2Gm.js → bots-store-BG81qEJz.js} +1 -1
  53. package/web/assets/{chat-api-DgJdhfOP.js → chat-api-aEirz9it.js} +1 -1
  54. package/web/assets/{client-store-BkVlLM-4.js → client-store-BSqTT-c2.js} +1 -1
  55. package/web/assets/{config-search-BqYT_Xre.js → config-search-DdXAm7PX.js} +1 -1
  56. package/web/assets/{dialog-5MLAAE-f.js → dialog-D1TVm0d6.js} +1 -1
  57. package/web/assets/{events-B0F69Vd3.js → events-CrT7ie40.js} +1 -1
  58. package/web/assets/{folder-paths-CdOS1VLF.js → folder-paths-BuiyvlAk.js} +1 -1
  59. package/web/assets/{hosts-CoGHAtF9.js → hosts-CpFGDuNR.js} +1 -1
  60. package/web/assets/i18n-CXRjs9ow.js +1 -0
  61. package/web/assets/{index-DmohsuQg.js → index-DcTDwezs.js} +2 -2
  62. package/web/assets/{mount-app-Cr5Uq-cP.js → mount-app-DhHe93-u.js} +3 -3
  63. package/web/assets/{permission-rules-api-CAxfABVR.js → permission-rules-api-Ch3fRXTD.js} +1 -1
  64. package/web/assets/{pick-system-directory-ByTVOp-v.js → pick-system-directory-B8aZR2BS.js} +1 -1
  65. package/web/assets/{placements-CuVM9Xxs.js → placements-5hgUqGzE.js} +2 -2
  66. package/web/assets/{popover-DUWwlhPy.js → popover-BMTgTASl.js} +1 -1
  67. package/web/assets/{public-CWbnixwI.js → public-BTvrDX6E.js} +1 -1
  68. package/web/assets/{public-CGbDaxd0.js → public-BZlIDP6h.js} +1 -1
  69. package/web/assets/{public-B00uoqCB.js → public-DTq_JyXj.js} +2 -2
  70. package/web/assets/{public-components-DGfACSCk.js → public-components-DUa3En6P.js} +1 -1
  71. package/web/assets/public-diff-DEL93aov.js +1 -0
  72. package/web/assets/public-events-BiaqrDkZ.js +1 -0
  73. package/web/assets/{public-flags-BRenaSzJ.js → public-flags-DEs9Uj_y.js} +1 -1
  74. package/web/assets/{public-session-BeSwdD6a.js → public-session-CXzhUUNr.js} +1 -1
  75. package/web/assets/{public-sidebar-CAWnINZG.js → public-sidebar-CJVnP7HU.js} +1 -1
  76. package/web/assets/{runtime-capabilities-store-DWW9jolt.js → runtime-capabilities-store-DpEKnn1b.js} +1 -1
  77. package/web/assets/{safe-mode-instance-65Kg_IPn.js → safe-mode-instance-CVh0Lclx.js} +1 -1
  78. package/web/assets/safe-mode-sentinel-Bm4e075H.js +1 -0
  79. package/web/assets/{session-change-summary-api-CbVgbX2o.js → session-change-summary-api-sn-ejt4H.js} +1 -1
  80. package/web/assets/{session-home-LwsMdqJu.js → session-home-DBefA-JE.js} +1 -1
  81. package/web/assets/{session-organization-api-BmX-aNPa.js → session-organization-api-BFW_7Myv.js} +1 -1
  82. package/web/assets/{session-scope-Bz6CeMq0.js → session-scope-P-D-Ssd4.js} +1 -1
  83. package/web/assets/{session-tree-actions-BLL1s_Ws.js → session-tree-actions-DZ5-Z8_F.js} +1 -1
  84. package/web/assets/{session-tree-summary-BfRtAGwx.js → session-tree-summary-Dljblf8P.js} +1 -1
  85. package/web/assets/{shortcuts-Cgx6V2jI.js → shortcuts-DXHroTTi.js} +1 -1
  86. package/web/assets/{side-chat-context-Cm84nqzk.js → side-chat-context-6tf1Gx5C.js} +4 -4
  87. package/web/assets/{sidebar-C0AjfIUc.js → sidebar-PuiNlAmD.js} +1 -1
  88. package/web/assets/{sidebar-store-BhEocW8t.js → sidebar-store-CbyxBthc.js} +1 -1
  89. package/web/assets/{speech-session-BI_qH5Lw.js → speech-session-B3-i8f64.js} +1 -1
  90. package/web/assets/{startup-queries-Cevfi-_Z.js → startup-queries-CceboYee.js} +1 -1
  91. package/web/assets/{use-i18n-Cyg5th6Z.js → use-i18n-B2p84ZNR.js} +1 -1
  92. package/web/assets/{use-open-bot-HoswiH7t.js → use-open-bot-CgFlDm0x.js} +1 -1
  93. package/web/assets/{use-studio-actions-CGzcb2Fx.js → use-studio-actions-DM2CAaXR.js} +1 -1
  94. package/web/assets/{useCatalogProjects-hKlUioWa.js → useCatalogProjects-laY-U3Br.js} +1 -1
  95. package/web/assets/{useNewProjectPicker-C9X_vJdU.js → useNewProjectPicker-rhLvXi27.js} +2 -2
  96. package/web/assets/{useNow-BBVE-LCR.js → useNow-DYvbFah-.js} +1 -1
  97. package/web/assets/{usePhoneShell-CDP-O4Gc.js → usePhoneShell-BSkh5GND.js} +1 -1
  98. package/web/assets/{useSessionListQuery-BpWfS-tU.js → useSessionListQuery-CHbg2lM2.js} +1 -1
  99. package/web/assets/{useSessionRowActions-Dd5ulVpS.js → useSessionRowActions-CO4u1xCd.js} +1 -1
  100. package/web/assets/{useSidebarModel-uxFT2LRy.js → useSidebarModel-V_SZjKZH.js} +1 -1
  101. package/web/assets/{web-preview-Bo8YMR-t.js → web-preview-CR8GMArR.js} +1 -1
  102. package/web/assets/{web-preview-events-DIPJR6oR.js → web-preview-events-DUqovP-L.js} +1 -1
  103. package/web/assets/{workspace-order-store-DshLVZf8.js → workspace-order-store-CK1RETHt.js} +1 -1
  104. package/web/index.html +1 -1
  105. package/web/assets/ChatPage-Bwn6Qfok.js +0 -553
  106. package/web/assets/i18n-Du-JO3Qx.js +0 -1
  107. package/web/assets/public-diff-DIMQ2JTm.js +0 -1
  108. package/web/assets/public-events-CxK6EdoY.js +0 -1
  109. package/web/assets/safe-mode-sentinel-CIemi_6b.js +0 -1
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t,r as n}from"./vendor-react-DwNgTV1j.js";import{t as r}from"./use-i18n-Cyg5th6Z.js";import{D as i,S as a,h as o,o as s,u as c,v as l,x as u}from"./query-Bj-DUNYq.js";import{r as d,t as f}from"./useQuery-DdcpUQhO.js";import{n as p}from"./mutation-CEbxdVYy.js";import{t as m}from"./queryOptions-Dfvzj6n2.js";import{a as h,l as g}from"./api-m-Yq8n0q.js";import{t as _}from"./check-2vYc6QaP.js";import{t as v}from"./copy-DHmIFc52.js";import{t as ee}from"./key-round-C29uZbsf.js";import{t as y}from"./plus-fQbSqB1n.js";import{t as b}from"./refresh-cw-TbWxTY4K.js";import{t as x}from"./rotate-ccw-clock-CO6Bw-sF.js";import{t as S}from"./server-BgNvmqwJ.js";import{t as C}from"./trash-2-CNrPOoPR.js";import{t as w}from"./wrench-6pg6_bqI.js";import{t as T}from"./x-07u4-129.js";import{t as E}from"./more-pages-D_PnxLN0.js";import{t as D}from"./switch-D_G8wFhs.js";import{t as O}from"./utils-C8uzG5AZ.js";import{n as k,t as A}from"./button-CCcCN8tE.js";import{s as te}from"./shortcuts-Cgx6V2jI.js";import{a as j}from"./format-DMJQzoZ7.js";import{a as M,i as N,l as P,o as F,s as ne,t as re}from"./dialog-5MLAAE-f.js";import{t as I}from"./textarea-DmATpOqT.js";import{n as L,t as R}from"./PageState-Cz6vFMXv.js";import{t as z}from"./alert-firawb0H.js";import{a as ie,i as B,n as V,o as ae,r as oe,s as se}from"./FeaturePage-B3PLRtEG.js";var ce=class extends i{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),u(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&c(t.mutationKey)!==c(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??p();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(e){s.batch(()=>{if(this.#r&&this.hasListeners()){let t=this.#t.variables,n=this.#t.context,r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{this.#r.onSuccess?.(e.data,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(e.data,null,t,n,r)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{this.#r.onError?.(e.error,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(void 0,e.error,t,n,r)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}},H=e(t(),1);function le(e,t){let n=d(t);return ue({filters:{...e,status:`pending`}},n).length}function U(e,t){return e.findAll(t.filters).map(e=>t.select?t.select(e):e.state)}function ue(e={},t){let n=d(t).getMutationCache(),r=H.useRef(e),i=H.useRef(null);return i.current===null&&(i.current=U(n,e)),H.useEffect(()=>{r.current=e}),H.useSyncExternalStore(H.useCallback(e=>n.subscribe(()=>{let t=l(i.current,U(n,r.current));i.current!==t&&(i.current=t,s.schedule(e))}),[n]),()=>i.current,()=>i.current)}function de(e,t){let n=d(t),[r]=H.useState(()=>new ce(n,e));H.useEffect(()=>{r.setOptions(e)},[r,e]);let i=H.useSyncExternalStore(H.useCallback(e=>r.subscribe(s.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),c=H.useCallback((e,t)=>{r.mutate(e,t).catch(o)},[r]);if(i.error&&a(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:c,mutateAsync:i.mutate}}function W(e){if(!e||typeof e!=`object`||Array.isArray(e))throw g();return Object.fromEntries(Object.entries(e))}function G(e,t=!1){if(e==null&&!t)return``;if(typeof e!=`string`||t&&!e)throw g();return e}function K(e,t=0){if(e==null)return t;if(typeof e!=`number`||!Number.isFinite(e))throw g();return e}function q(e){if(typeof e!=`boolean`)throw g();return e}function fe(e,t){if(e===void 0)return[];if(!Array.isArray(e))throw g();return e.map(t)}function pe(e){let t=W(e);return{id:G(t.id,!0),name:G(t.name,!0),status:G(t.status),transport:G(t.transport),endpoint:G(t.endpoint),command:G(t.command),workingDirectory:G(t.workingDirectory),enabled:q(t.enabled),error:G(t.error),latencyMs:t.latencyMs==null?null:K(t.latencyMs),lastPingAt:G(t.lastPingAt),auth:G(t.auth),authCount:K(t.authCount)}}function me(e){let t=W(e);return{serviceId:G(t.serviceId,!0),serviceName:G(t.serviceName),name:G(t.name,!0),piName:G(t.piName,!0),description:G(t.description),enabled:q(t.enabled),serviceEnabled:q(t.serviceEnabled),risk:G(t.risk)}}function he(e){let t=W(e);return{id:G(t.id,!0),serviceId:G(t.serviceId,!0),toolName:G(t.toolName),timestamp:G(t.timestamp),status:G(t.status),error:G(t.error),durationMs:K(t.durationMs)}}function J(e){let t=W(e);if(!Array.isArray(t.services))throw g();let n=t.metrics===void 0?{}:W(t.metrics);return{services:t.services.map(pe),tools:fe(t.tools,me),calls:fe(t.calls,he),metrics:{totalServices:K(n.totalServices),onlineServices:K(n.onlineServices),availableTools:K(n.availableTools),restrictedTools:K(n.restrictedTools),errorRate:K(n.errorRate)}}}var Y=e=>`/api/mcp/${encodeURIComponent(e)}`,X={dashboard:e=>h(`/api/mcp?refresh=0`,{signal:e,parse:J}),add:e=>h(`/api/mcp`,{method:`POST`,body:{spec:e},parse:J}),setServerEnabled:(e,t)=>h(Y(e),{method:`PATCH`,body:{enabled:t},parse:J}),setToolEnabled:(e,t,n)=>h(`${Y(e)}/tools/${encodeURIComponent(t)}`,{method:`PATCH`,body:{enabled:n},parse:J}),test:e=>h(`${Y(e)}/test`,{method:`POST`,body:{},parse:J}),remove:async e=>(await h(Y(e),{method:`DELETE`}),X.dashboard())};function ge(e){if(!e||typeof e!=`object`||Array.isArray(e))throw g();return Object.fromEntries(Object.entries(e))}function _e(e){let t=ge(e);if(typeof t.enabled!=`boolean`||typeof t.listening!=`boolean`||typeof t.host!=`string`||typeof t.port!=`number`||!Number.isInteger(t.port)||typeof t.url!=`string`||t.error!==null&&typeof t.error!=`string`)throw g();return{enabled:t.enabled,listening:t.listening,host:t.host,port:t.port,url:t.url,error:t.error}}function ve(e){let t=ge(e);if(typeof t.url!=`string`||!t.url||typeof t.token!=`string`||!t.token)throw g();return{url:t.url,token:t.token}}var Z={status:e=>h(`/api/mcp-host`,{signal:e,parse:_e}),setEnabled:e=>h(`/api/mcp-host`,{method:`PATCH`,body:{enabled:e},parse:_e}),credentials:e=>h(`/api/mcp-host/credentials`,{method:`POST`,body:{},signal:e,parse:ve}),rotateToken:e=>h(`/api/mcp-host/rotate-token`,{method:`POST`,body:{},signal:e,parse:ve})},Q=n(),ye=[`mcp-host`,`status`];function be(e){return JSON.stringify({mcpServers:{pisper:{url:e.url,headers:{Authorization:`Bearer ${e.token}`}}}},null,2)}function xe({notify:e,requestConfirm:t}){let{t:n}=r(),i=d(),[a,o]=(0,H.useState)(!1),[s,c]=(0,H.useState)(!1),[l,u]=(0,H.useState)(!1),[p,m]=(0,H.useState)(null),[h,g]=(0,H.useState)(``),_=(0,H.useRef)(null),y=(0,H.useRef)(null),x=typeof window<`u`&&!!window.__PISPER_MOBILE_APP__,C=f({queryKey:ye,queryFn:({signal:e})=>Z.status(e),enabled:!x&&!a,refetchInterval:15e3});if((0,H.useEffect)(()=>()=>{_.current?.abort()},[]),x)return null;let w=C.data,T=p?be(p):``,E=()=>{_.current?.abort(),_.current=null,m(null),g(``),u(!1)},te=async()=>{_.current?.abort();let e=new AbortController;_.current=e,c(!0),m(null),g(``),u(!0);try{let t=await Z.credentials(e.signal);e.signal.aborted||m(t)}catch(t){e.signal.aborted||g(t instanceof Error?t.message:n(`mcp:hostLoadFailed`))}finally{_.current===e&&(_.current=null,c(!1))}},j=async t=>{o(!0);try{let r=await Z.setEnabled(t);i.setQueryData(ye,r),t||E(),e(r.error||n(t?`mcp:hostEnabledNotice`:`mcp:hostDisabledNotice`),r.error?`error`:`success`)}catch(t){e(t instanceof Error?t.message:n(`mcp:hostUpdateFailed`),`error`)}finally{o(!1)}},L=async()=>{if(t&&!await t({title:n(`mcp:hostRotateTitle`),message:n(`mcp:hostRotateWarning`),confirmLabel:n(`mcp:hostRotate`),tone:`danger`}))return;_.current?.abort();let r=new AbortController;_.current=r,c(!0),g(``),m(null);try{let t=await Z.rotateToken(r.signal);r.signal.aborted||(m(t),e(n(`mcp:hostRotatedNotice`),`success`))}catch(e){r.signal.aborted||g(e instanceof Error?e.message:n(`mcp:hostRotateFailed`))}finally{_.current===r&&(_.current=null,c(!1))}},R=async()=>{try{await navigator.clipboard.writeText(T),e(n(`mcp:hostCopied`),`success`)}catch{y.current?.select(),e(n(`mcp:hostCopyManually`),`error`)}};return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(V,{className:`mcp-host mt-7`,children:(0,Q.jsx)(B,{"data-mcp-host":!0,icon:(0,Q.jsx)(S,{}),name:n(`mcp:hostTitle`),description:n(`mcp:hostDescription`),status:w&&(0,Q.jsxs)(`span`,{className:O(`flex items-center gap-1.5`,!w.listening&&w.enabled&&`font-medium text-st-attn`),children:[!w.listening&&w.enabled&&(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`size-2 flex-none rounded-full bg-st-attn-fill`}),w.listening?n(`mcp:hostReady`):w.enabled?n(`mcp:hostUnavailable`):n(`mcp:disabled`)]}),actions:(0,Q.jsx)(D,{checked:!!w?.enabled,disabled:!w||a,"aria-label":n(`mcp:hostEnabled`),title:n(`mcp:hostEnabled`),onCheckedChange:e=>void j(e)}),detail:C.isPending||C.error||w?.error||w?.listening?(0,Q.jsxs)(`div`,{className:`grid gap-2`,children:[C.isPending&&(0,Q.jsx)(`p`,{role:`status`,className:`text-xs text-content-muted`,children:n(`mcp:loading`)}),C.error&&(0,Q.jsxs)(z,{className:`flex flex-wrap items-center justify-between gap-2 text-xs text-muted-foreground`,children:[(0,Q.jsx)(`span`,{children:C.error.message}),(0,Q.jsx)(A,{size:`sm`,variant:`ghost`,className:`max-[650px]:h-11`,onClick:()=>void C.refetch(),children:n(`mcp:retry`)})]}),w?.error&&(0,Q.jsx)(z,{role:`status`,className:`text-xs text-muted-foreground`,children:w.error}),w?.listening&&(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-2`,children:[(0,Q.jsx)(`code`,{className:`max-w-full min-w-0 rounded-xs border border-stroke bg-code px-2 py-0.5 font-mono text-xs break-all text-content`,children:w.url}),(0,Q.jsxs)(A,{size:`sm`,variant:`secondary`,className:`max-[650px]:h-11`,onClick:()=>void te(),children:[(0,Q.jsx)(ee,{"data-icon":`inline-start`}),n(`mcp:hostShowConfig`)]})]})]}):void 0})}),(0,Q.jsx)(re,{open:l,onOpenChange:e=>!e&&E(),children:(0,Q.jsxs)(N,{className:`min-w-0 grid-cols-[minmax(0,1fr)] sm:max-w-xl`,children:[(0,Q.jsxs)(ne,{className:`min-w-0 pr-8 text-left`,children:[(0,Q.jsx)(P,{children:n(`mcp:hostConfigTitle`)}),(0,Q.jsx)(M,{className:`leading-5`,children:n(`mcp:hostConfigDescription`)})]}),s&&(0,Q.jsxs)(`p`,{role:`status`,className:`flex items-center gap-2 text-sm text-content-muted`,children:[(0,Q.jsx)(k,{}),n(`mcp:hostLoadingConfig`)]}),h&&(0,Q.jsx)(z,{role:`alert`,className:`text-sm text-muted-foreground`,children:h}),p&&(0,Q.jsx)(I,{ref:y,value:T,readOnly:!0,spellCheck:!1,"aria-label":n(`mcp:hostConfigTitle`),className:`h-52 max-h-[45dvh] resize-y bg-code font-mono text-xs [overflow-wrap:anywhere]`,onFocus:e=>e.currentTarget.select()}),(0,Q.jsxs)(F,{className:`min-w-0 flex-wrap`,children:[(0,Q.jsxs)(A,{variant:`secondary`,disabled:s,onClick:()=>void L(),children:[(0,Q.jsx)(b,{"data-icon":`inline-start`}),n(`mcp:hostRotate`)]}),(0,Q.jsxs)(A,{disabled:!p||s,onClick:()=>void R(),children:[(0,Q.jsx)(v,{"data-icon":`inline-start`}),n(`mcp:hostCopyConfig`)]})]})]})})]})}var $=[`mcp`,`dashboard`],Se=[`mcp`,`change`];function Ce(){return m({queryKey:$,queryFn:({signal:e})=>X.dashboard(e),staleTime:0,retry:!1})}function we(e){return{mutationKey:Se,scope:{id:`mcp-dashboard`},retry:!1,mutationFn:async t=>(await e.cancelQueries({queryKey:$}),t()),onSuccess:t=>e.setQueryData($,t),onSettled:()=>e.invalidateQueries({queryKey:$})}}function Te(){let e=d(),t=le({mutationKey:Se})>0,n=f({...Ce(),enabled:!t,refetchInterval:!t&&1e4}),r=de(we(e));return{data:n.data,loading:n.isPending,error:r.error||n.error,busy:t,change:r.mutateAsync,reload:()=>(r.reset(),n.refetch())}}var Ee=`grid grid-cols-[88px_minmax(0,1fr)] gap-x-3 gap-y-1.5 text-xs [&_dd]:min-w-0 [&_dd]:[overflow-wrap:anywhere] [&_dd]:text-content-soft [&_dt]:text-content-muted [&>div]:contents`;function De(e,t){return e===`online`?[t(`mcp:online`),!1]:e===`connecting`?[t(`mcp:connecting`),!1]:e===`unauthorized`?[t(`mcp:unauthorized`),!0]:e===`disabled`?[t(`mcp:disabled`),!1]:[t(`mcp:offline`),!0]}function Oe(e,t){return e===`high`||e===`高风险`?t(`mcp:highRisk`):e===`medium`||e===`中风险`?t(`mcp:mediumRisk`):e===`low`||e===`低风险`?t(`mcp:lowRisk`):String(e||``)}function ke(e,t){return e.auth===`headers`?t(`mcp:countRequestHeaders`,{count:e.authCount}):e.auth===`environment`?t(`mcp:configuredEnvironmentVariables`):e.auth===`local`?t(`mcp:localProcess`):t(`mcp:none`)}function Ae({notify:e,onBack:t,requestText:n,requestConfirm:i}){let{t:a,language:o}=r(),s=te(`focusSearch`),{data:c,busy:l,loading:u,error:d,change:f,reload:p}=Te(),[m,h]=(0,H.useState)(``),[g,v]=(0,H.useState)(``),ee=(0,H.useCallback)(async()=>{let t=await n?.({title:a(`mcp:addMCPService`),message:a(`mcp:enterAStreamableHTTPURLAStdioCommandOrJSONContainingHeadersEnv`),inputLabel:a(`mcp:serverConfiguration`),placeholder:`https://server.example.com/mcp`,maxLength:12e3,confirmLabel:a(`mcp:continue`)});if(t?.trim()&&await i?.({title:a(`mcp:connectMCPServer`),message:a(`mcp:mcpServersCanExposeToolsThatPerformExternalActionsConnectOnlyToServersYouTrust`),confirmLabel:a(`mcp:connect`),tone:`danger`})!==!1)try{let n=await f(()=>X.add(t));v(n.services.at(-1)?.id||``),e(a(`mcp:mcpServerAdded`),`success`)}catch(t){e(t instanceof Error?t.message:String(t),`error`)}},[f,e,i,n,a]),k=m.trim().toLowerCase(),M=c?.services||[],N=M.filter(e=>`${e.name} ${e.endpoint}`.toLowerCase().includes(k)),P=(c?.tools||[]).filter(e=>`${e.name} ${e.serviceName} ${e.description}`.toLowerCase().includes(k)),F=c?.metrics||{totalServices:0,onlineServices:0,availableTools:0,restrictedTools:0,errorRate:0},ne=async(t,n)=>{try{await f(()=>X.setToolEnabled(t.serviceId,t.name,n))}catch(t){e(t instanceof Error?t.message:String(t),`error`)}},re=async(t,n)=>{try{await f(()=>X.setServerEnabled(t.id,n)),e(a(n?`mcp:mcpServerEnabled`:`mcp:mcpServerDisabled`),`success`)}catch(t){e(t instanceof Error?t.message:String(t),`error`)}},I=async t=>{try{await f(()=>X.test(t.id)),e(a(`mcp:mcpConnectionTestPassed`),`success`)}catch(t){e(t instanceof Error?t.message:String(t),`error`)}},ce=async t=>{if(await i?.({title:a(`mcp:deleteMCPServer`),message:a(`mcp:afterDeletionToolsFromThisServerWillBeRemovedFromSubsequentAgentRuns`),confirmLabel:a(`mcp:delete`),tone:`danger`})!==!1)try{await f(()=>X.remove(t.id)),v(``),e(a(`mcp:mcpServerDeleted`),`success`)}catch(t){e(t instanceof Error?t.message:String(t),`error`)}},le=e=>{let t=(c?.calls||[]).filter(t=>t.serviceId===e.id);return(0,Q.jsxs)(`div`,{className:`mcp-service-detail grid gap-3`,children:[(0,Q.jsx)(`p`,{className:O(`text-xs leading-normal [overflow-wrap:anywhere]`,e.error?`font-mono text-content-secondary`:`text-content-muted`),children:e.error||a(`mcp:thisServerExposesToolsThroughAStandardMCPTransportEnabledToolsAreRegisteredInNewAgentRuntimes`)}),(0,Q.jsx)(`dl`,{className:Ee,children:[[a(`mcp:transport`),e.transport===`stdio`?`stdio`:e.transport===`sse`?`HTTP + SSE`:`Streamable HTTP`,!1],...e.transport===`stdio`?[[a(`mcp:executable`),e.command||`—`,!0],[a(`mcp:workingDirectory`),e.workingDirectory||`—`,!0]]:[[a(`mcp:serverAddress`),e.endpoint||`—`,!0]],[a(`mcp:latency`),e.latencyMs==null?`—`:`${e.latencyMs} ms`,!1],[a(`mcp:lastPing`),e.lastPingAt?j(e.lastPingAt,o):`—`,!1],[a(`mcp:authentication`),ke(e,a),!1]].map(([e,t,n])=>(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`dt`,{children:e}),(0,Q.jsx)(`dd`,{className:n?`font-mono`:`tabular-nums`,children:t})]},e))}),(0,Q.jsxs)(`section`,{className:`mcp-calls-panel min-w-0`,"aria-label":a(`mcp:recentCalls`),children:[(0,Q.jsxs)(`h3`,{className:`mb-1 text-xs font-medium text-content-muted tabular-nums`,children:[a(`mcp:recentCalls`),t.length>0&&(0,Q.jsxs)(`span`,{children:[` · `,Math.min(t.length,8)]})]}),t.length?(0,Q.jsx)(`ul`,{role:`list`,className:`m-0 list-none divide-y divide-stroke p-0`,children:t.slice(0,8).map(e=>{let t=e.status===`ok`;return(0,Q.jsxs)(`li`,{className:O(`activity-row grid min-h-10 min-w-0 grid-cols-[16px_minmax(0,1fr)_auto] items-center gap-2.5 py-1.5`,t?`completed`:`failed`),children:[(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`grid size-4 place-items-center text-content-muted [&_svg]:size-3.5 [&_svg]:stroke-[2]`,children:t?(0,Q.jsx)(_,{}):(0,Q.jsx)(T,{})}),(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,Q.jsx)(`strong`,{className:`truncate font-mono text-xs font-medium text-content`,children:e.toolName}),(0,Q.jsx)(`small`,{className:`truncate text-xs text-content-muted`,children:t?a(`mcp:callSucceeded`):e.error||a(`mcp:callFailed`)})]}),(0,Q.jsxs)(`span`,{className:`flex flex-col items-end text-xs text-content-muted tabular-nums`,children:[(0,Q.jsxs)(`span`,{className:`text-content-secondary`,children:[e.durationMs,` ms`]}),(0,Q.jsx)(`span`,{children:j(e.timestamp,o)})]})]},e.id)})}):(0,Q.jsxs)(`p`,{className:`flex items-center gap-1.5 py-1 text-xs text-content-muted`,children:[(0,Q.jsx)(x,{className:`size-3.5`,"aria-hidden":`true`}),a(`mcp:noRecentCalls`)]})]}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2`,children:[(0,Q.jsxs)(A,{size:`sm`,variant:`ghost`,className:`text-danger hover:bg-danger-soft hover:text-danger max-[650px]:h-11`,disabled:l,onClick:()=>void ce(e),children:[(0,Q.jsx)(C,{"data-icon":`inline-start`}),a(`mcp:delete`)]}),(0,Q.jsxs)(A,{size:`sm`,variant:`secondary`,className:`max-[650px]:h-11`,loading:l,disabled:!e.enabled||l,onClick:()=>void I(e),children:[(0,Q.jsx)(b,{"data-icon":`inline-start`}),a(`mcp:testConnection`)]})]})]})};return(0,Q.jsxs)(oe,{title:a(`navigation:navigation.mcp`),description:a(`mcp:lede`),back:t&&{label:a(`navigation:sidebar.features`),ariaLabel:a(`navigation:shell.backToFeaturesLabel`),onBack:t},toolbar:(0,Q.jsx)(se,{search:(0,Q.jsx)(ie,{id:E,value:m,onValueChange:h,placeholder:a(`navigation:pageHeader.searchServicesOrTools`),shortcut:s,clearLabel:a(`navigation:more.clearSearch`)}),actions:(0,Q.jsxs)(A,{type:`button`,className:`h-9`,"data-mcp-add":!0,disabled:l,onClick:()=>void ee(),children:[(0,Q.jsx)(y,{}),a(`navigation:pageHeader.addService`)]})}),children:[(0,Q.jsx)(xe,{notify:e,requestConfirm:i}),u&&!c&&!d?(0,Q.jsx)(L,{kind:`loading`,title:a(`mcp:loading`)}):!c&&d?(0,Q.jsx)(L,{kind:`error`,title:a(`mcp:loadFailed`),description:d.message,action:(0,Q.jsx)(A,{variant:`secondary`,className:`max-[650px]:h-11`,disabled:l,onClick:()=>void p(),children:a(`mcp:retry`)})}):c&&(0,Q.jsxs)(Q.Fragment,{children:[d&&(0,Q.jsxs)(z,{role:`status`,className:`mt-4 flex min-w-0 items-center justify-between gap-3 text-muted-foreground [overflow-wrap:anywhere]`,children:[(0,Q.jsx)(`span`,{children:d.message}),(0,Q.jsx)(A,{variant:`ghost`,className:`max-[650px]:h-11`,disabled:l,onClick:()=>void p(),children:a(`mcp:retry`)})]}),(0,Q.jsx)(ae,{className:`mcp-services`,title:a(`mcp:services`),count:N.length,meta:M.length>0&&a(`mcp:serviceSummary`,{online:F.onlineServices,total:F.totalServices,rate:F.errorRate}),children:N.length?(0,Q.jsx)(V,{children:N.map(e=>{let[t,n]=De(e.status,a),r=e.transport===`stdio`?e.workingDirectory||e.command:e.endpoint;return(0,Q.jsx)(B,{className:`service-row`,"data-mcp-service":e.id,icon:(0,Q.jsx)(S,{}),name:e.name,description:(0,Q.jsx)(`span`,{className:`font-mono text-xs`,title:r,children:r}),status:(0,Q.jsxs)(`span`,{"data-mcp-status":e.status||`offline`,className:O(`flex items-center gap-1.5`,n&&`font-medium text-st-attn`),children:[n&&(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`size-2 flex-none rounded-full bg-st-attn-fill`}),t]}),actions:(0,Q.jsx)(D,{checked:e.enabled,disabled:l,"aria-label":a(`mcp:toggleServiceName`,{name:e.name}),onCheckedChange:t=>void re(e,t)}),expanded:g===e.id,onExpandedChange:t=>v(t?e.id:``),toggleLabel:a(`mcp:toggleServiceDetails`,{name:e.name}),detail:le(e)},e.id)})}):(0,Q.jsx)(R,{icon:S,title:a(`mcp:noServerConfigured`),description:M.length?void 0:a(`mcp:emptyAddHint`)})}),(0,Q.jsx)(ae,{className:`mcp-tools-panel`,title:a(`mcp:toolCapabilities`),count:P.length,meta:F.restrictedTools>0&&a(`mcp:toolSummary`,{count:F.restrictedTools}),children:P.length?(0,Q.jsx)(V,{children:P.map(e=>(0,Q.jsx)(B,{className:`tool-row`,"data-mcp-tool":e.piName,icon:(0,Q.jsx)(w,{}),name:(0,Q.jsx)(`span`,{className:`font-mono`,children:e.name}),description:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`font-mono`,children:e.serviceName}),e.description&&(0,Q.jsxs)(Q.Fragment,{children:[` · `,e.description]})]}),status:Oe(e.risk,a),actions:(0,Q.jsx)(D,{checked:!!e.enabled,disabled:l||!e.serviceEnabled,"aria-label":a(`mcp:toggleToolName`,{name:e.name}),onCheckedChange:t=>void ne(e,t)})},e.piName))}):(0,Q.jsx)(R,{compact:!0,icon:w,title:a(`mcp:noToolsAvailable`)})})]})]})}export{Ae as McpPage};
1
+ import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t,r as n}from"./vendor-react-DwNgTV1j.js";import{t as r}from"./use-i18n-B2p84ZNR.js";import{D as i,S as a,h as o,o as s,u as c,v as l,x as u}from"./query-Bj-DUNYq.js";import{r as d,t as f}from"./useQuery-DdcpUQhO.js";import{n as p}from"./mutation-CEbxdVYy.js";import{t as m}from"./queryOptions-Dfvzj6n2.js";import{a as h,l as g}from"./api-CIB7ZPX3.js";import{t as _}from"./check-2vYc6QaP.js";import{t as v}from"./copy-DHmIFc52.js";import{t as ee}from"./key-round-C29uZbsf.js";import{t as y}from"./plus-fQbSqB1n.js";import{t as b}from"./refresh-cw-TbWxTY4K.js";import{t as x}from"./rotate-ccw-clock-CO6Bw-sF.js";import{t as S}from"./server-BgNvmqwJ.js";import{t as C}from"./trash-2-CNrPOoPR.js";import{t as w}from"./wrench-6pg6_bqI.js";import{t as T}from"./x-07u4-129.js";import{t as E}from"./more-pages-D_PnxLN0.js";import{t as D}from"./switch-D_G8wFhs.js";import{t as O}from"./utils-C8uzG5AZ.js";import{n as k,t as A}from"./button-CCcCN8tE.js";import{s as te}from"./shortcuts-DXHroTTi.js";import{a as j}from"./format-DMJQzoZ7.js";import{a as M,i as N,l as P,o as F,s as ne,t as re}from"./dialog-D1TVm0d6.js";import{t as I}from"./textarea-DmATpOqT.js";import{n as L,t as R}from"./PageState-Cz6vFMXv.js";import{t as z}from"./alert-firawb0H.js";import{a as ie,i as B,n as V,o as ae,r as oe,s as se}from"./FeaturePage-DT_WfUIg.js";var ce=class extends i{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),u(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&c(t.mutationKey)!==c(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??p();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(e){s.batch(()=>{if(this.#r&&this.hasListeners()){let t=this.#t.variables,n=this.#t.context,r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{this.#r.onSuccess?.(e.data,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(e.data,null,t,n,r)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{this.#r.onError?.(e.error,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(void 0,e.error,t,n,r)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}},H=e(t(),1);function le(e,t){let n=d(t);return ue({filters:{...e,status:`pending`}},n).length}function U(e,t){return e.findAll(t.filters).map(e=>t.select?t.select(e):e.state)}function ue(e={},t){let n=d(t).getMutationCache(),r=H.useRef(e),i=H.useRef(null);return i.current===null&&(i.current=U(n,e)),H.useEffect(()=>{r.current=e}),H.useSyncExternalStore(H.useCallback(e=>n.subscribe(()=>{let t=l(i.current,U(n,r.current));i.current!==t&&(i.current=t,s.schedule(e))}),[n]),()=>i.current,()=>i.current)}function de(e,t){let n=d(t),[r]=H.useState(()=>new ce(n,e));H.useEffect(()=>{r.setOptions(e)},[r,e]);let i=H.useSyncExternalStore(H.useCallback(e=>r.subscribe(s.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),c=H.useCallback((e,t)=>{r.mutate(e,t).catch(o)},[r]);if(i.error&&a(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:c,mutateAsync:i.mutate}}function W(e){if(!e||typeof e!=`object`||Array.isArray(e))throw g();return Object.fromEntries(Object.entries(e))}function G(e,t=!1){if(e==null&&!t)return``;if(typeof e!=`string`||t&&!e)throw g();return e}function K(e,t=0){if(e==null)return t;if(typeof e!=`number`||!Number.isFinite(e))throw g();return e}function q(e){if(typeof e!=`boolean`)throw g();return e}function fe(e,t){if(e===void 0)return[];if(!Array.isArray(e))throw g();return e.map(t)}function pe(e){let t=W(e);return{id:G(t.id,!0),name:G(t.name,!0),status:G(t.status),transport:G(t.transport),endpoint:G(t.endpoint),command:G(t.command),workingDirectory:G(t.workingDirectory),enabled:q(t.enabled),error:G(t.error),latencyMs:t.latencyMs==null?null:K(t.latencyMs),lastPingAt:G(t.lastPingAt),auth:G(t.auth),authCount:K(t.authCount)}}function me(e){let t=W(e);return{serviceId:G(t.serviceId,!0),serviceName:G(t.serviceName),name:G(t.name,!0),piName:G(t.piName,!0),description:G(t.description),enabled:q(t.enabled),serviceEnabled:q(t.serviceEnabled),risk:G(t.risk)}}function he(e){let t=W(e);return{id:G(t.id,!0),serviceId:G(t.serviceId,!0),toolName:G(t.toolName),timestamp:G(t.timestamp),status:G(t.status),error:G(t.error),durationMs:K(t.durationMs)}}function J(e){let t=W(e);if(!Array.isArray(t.services))throw g();let n=t.metrics===void 0?{}:W(t.metrics);return{services:t.services.map(pe),tools:fe(t.tools,me),calls:fe(t.calls,he),metrics:{totalServices:K(n.totalServices),onlineServices:K(n.onlineServices),availableTools:K(n.availableTools),restrictedTools:K(n.restrictedTools),errorRate:K(n.errorRate)}}}var Y=e=>`/api/mcp/${encodeURIComponent(e)}`,X={dashboard:e=>h(`/api/mcp?refresh=0`,{signal:e,parse:J}),add:e=>h(`/api/mcp`,{method:`POST`,body:{spec:e},parse:J}),setServerEnabled:(e,t)=>h(Y(e),{method:`PATCH`,body:{enabled:t},parse:J}),setToolEnabled:(e,t,n)=>h(`${Y(e)}/tools/${encodeURIComponent(t)}`,{method:`PATCH`,body:{enabled:n},parse:J}),test:e=>h(`${Y(e)}/test`,{method:`POST`,body:{},parse:J}),remove:async e=>(await h(Y(e),{method:`DELETE`}),X.dashboard())};function ge(e){if(!e||typeof e!=`object`||Array.isArray(e))throw g();return Object.fromEntries(Object.entries(e))}function _e(e){let t=ge(e);if(typeof t.enabled!=`boolean`||typeof t.listening!=`boolean`||typeof t.host!=`string`||typeof t.port!=`number`||!Number.isInteger(t.port)||typeof t.url!=`string`||t.error!==null&&typeof t.error!=`string`)throw g();return{enabled:t.enabled,listening:t.listening,host:t.host,port:t.port,url:t.url,error:t.error}}function ve(e){let t=ge(e);if(typeof t.url!=`string`||!t.url||typeof t.token!=`string`||!t.token)throw g();return{url:t.url,token:t.token}}var Z={status:e=>h(`/api/mcp-host`,{signal:e,parse:_e}),setEnabled:e=>h(`/api/mcp-host`,{method:`PATCH`,body:{enabled:e},parse:_e}),credentials:e=>h(`/api/mcp-host/credentials`,{method:`POST`,body:{},signal:e,parse:ve}),rotateToken:e=>h(`/api/mcp-host/rotate-token`,{method:`POST`,body:{},signal:e,parse:ve})},Q=n(),ye=[`mcp-host`,`status`];function be(e){return JSON.stringify({mcpServers:{pisper:{url:e.url,headers:{Authorization:`Bearer ${e.token}`}}}},null,2)}function xe({notify:e,requestConfirm:t}){let{t:n}=r(),i=d(),[a,o]=(0,H.useState)(!1),[s,c]=(0,H.useState)(!1),[l,u]=(0,H.useState)(!1),[p,m]=(0,H.useState)(null),[h,g]=(0,H.useState)(``),_=(0,H.useRef)(null),y=(0,H.useRef)(null),x=typeof window<`u`&&!!window.__PISPER_MOBILE_APP__,C=f({queryKey:ye,queryFn:({signal:e})=>Z.status(e),enabled:!x&&!a,refetchInterval:15e3});if((0,H.useEffect)(()=>()=>{_.current?.abort()},[]),x)return null;let w=C.data,T=p?be(p):``,E=()=>{_.current?.abort(),_.current=null,m(null),g(``),u(!1)},te=async()=>{_.current?.abort();let e=new AbortController;_.current=e,c(!0),m(null),g(``),u(!0);try{let t=await Z.credentials(e.signal);e.signal.aborted||m(t)}catch(t){e.signal.aborted||g(t instanceof Error?t.message:n(`mcp:hostLoadFailed`))}finally{_.current===e&&(_.current=null,c(!1))}},j=async t=>{o(!0);try{let r=await Z.setEnabled(t);i.setQueryData(ye,r),t||E(),e(r.error||n(t?`mcp:hostEnabledNotice`:`mcp:hostDisabledNotice`),r.error?`error`:`success`)}catch(t){e(t instanceof Error?t.message:n(`mcp:hostUpdateFailed`),`error`)}finally{o(!1)}},L=async()=>{if(t&&!await t({title:n(`mcp:hostRotateTitle`),message:n(`mcp:hostRotateWarning`),confirmLabel:n(`mcp:hostRotate`),tone:`danger`}))return;_.current?.abort();let r=new AbortController;_.current=r,c(!0),g(``),m(null);try{let t=await Z.rotateToken(r.signal);r.signal.aborted||(m(t),e(n(`mcp:hostRotatedNotice`),`success`))}catch(e){r.signal.aborted||g(e instanceof Error?e.message:n(`mcp:hostRotateFailed`))}finally{_.current===r&&(_.current=null,c(!1))}},R=async()=>{try{await navigator.clipboard.writeText(T),e(n(`mcp:hostCopied`),`success`)}catch{y.current?.select(),e(n(`mcp:hostCopyManually`),`error`)}};return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(V,{className:`mcp-host mt-7`,children:(0,Q.jsx)(B,{"data-mcp-host":!0,icon:(0,Q.jsx)(S,{}),name:n(`mcp:hostTitle`),description:n(`mcp:hostDescription`),status:w&&(0,Q.jsxs)(`span`,{className:O(`flex items-center gap-1.5`,!w.listening&&w.enabled&&`font-medium text-st-attn`),children:[!w.listening&&w.enabled&&(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`size-2 flex-none rounded-full bg-st-attn-fill`}),w.listening?n(`mcp:hostReady`):w.enabled?n(`mcp:hostUnavailable`):n(`mcp:disabled`)]}),actions:(0,Q.jsx)(D,{checked:!!w?.enabled,disabled:!w||a,"aria-label":n(`mcp:hostEnabled`),title:n(`mcp:hostEnabled`),onCheckedChange:e=>void j(e)}),detail:C.isPending||C.error||w?.error||w?.listening?(0,Q.jsxs)(`div`,{className:`grid gap-2`,children:[C.isPending&&(0,Q.jsx)(`p`,{role:`status`,className:`text-xs text-content-muted`,children:n(`mcp:loading`)}),C.error&&(0,Q.jsxs)(z,{className:`flex flex-wrap items-center justify-between gap-2 text-xs text-muted-foreground`,children:[(0,Q.jsx)(`span`,{children:C.error.message}),(0,Q.jsx)(A,{size:`sm`,variant:`ghost`,className:`max-[650px]:h-11`,onClick:()=>void C.refetch(),children:n(`mcp:retry`)})]}),w?.error&&(0,Q.jsx)(z,{role:`status`,className:`text-xs text-muted-foreground`,children:w.error}),w?.listening&&(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-2`,children:[(0,Q.jsx)(`code`,{className:`max-w-full min-w-0 rounded-xs border border-stroke bg-code px-2 py-0.5 font-mono text-xs break-all text-content`,children:w.url}),(0,Q.jsxs)(A,{size:`sm`,variant:`secondary`,className:`max-[650px]:h-11`,onClick:()=>void te(),children:[(0,Q.jsx)(ee,{"data-icon":`inline-start`}),n(`mcp:hostShowConfig`)]})]})]}):void 0})}),(0,Q.jsx)(re,{open:l,onOpenChange:e=>!e&&E(),children:(0,Q.jsxs)(N,{className:`min-w-0 grid-cols-[minmax(0,1fr)] sm:max-w-xl`,children:[(0,Q.jsxs)(ne,{className:`min-w-0 pr-8 text-left`,children:[(0,Q.jsx)(P,{children:n(`mcp:hostConfigTitle`)}),(0,Q.jsx)(M,{className:`leading-5`,children:n(`mcp:hostConfigDescription`)})]}),s&&(0,Q.jsxs)(`p`,{role:`status`,className:`flex items-center gap-2 text-sm text-content-muted`,children:[(0,Q.jsx)(k,{}),n(`mcp:hostLoadingConfig`)]}),h&&(0,Q.jsx)(z,{role:`alert`,className:`text-sm text-muted-foreground`,children:h}),p&&(0,Q.jsx)(I,{ref:y,value:T,readOnly:!0,spellCheck:!1,"aria-label":n(`mcp:hostConfigTitle`),className:`h-52 max-h-[45dvh] resize-y bg-code font-mono text-xs [overflow-wrap:anywhere]`,onFocus:e=>e.currentTarget.select()}),(0,Q.jsxs)(F,{className:`min-w-0 flex-wrap`,children:[(0,Q.jsxs)(A,{variant:`secondary`,disabled:s,onClick:()=>void L(),children:[(0,Q.jsx)(b,{"data-icon":`inline-start`}),n(`mcp:hostRotate`)]}),(0,Q.jsxs)(A,{disabled:!p||s,onClick:()=>void R(),children:[(0,Q.jsx)(v,{"data-icon":`inline-start`}),n(`mcp:hostCopyConfig`)]})]})]})})]})}var $=[`mcp`,`dashboard`],Se=[`mcp`,`change`];function Ce(){return m({queryKey:$,queryFn:({signal:e})=>X.dashboard(e),staleTime:0,retry:!1})}function we(e){return{mutationKey:Se,scope:{id:`mcp-dashboard`},retry:!1,mutationFn:async t=>(await e.cancelQueries({queryKey:$}),t()),onSuccess:t=>e.setQueryData($,t),onSettled:()=>e.invalidateQueries({queryKey:$})}}function Te(){let e=d(),t=le({mutationKey:Se})>0,n=f({...Ce(),enabled:!t,refetchInterval:!t&&1e4}),r=de(we(e));return{data:n.data,loading:n.isPending,error:r.error||n.error,busy:t,change:r.mutateAsync,reload:()=>(r.reset(),n.refetch())}}var Ee=`grid grid-cols-[88px_minmax(0,1fr)] gap-x-3 gap-y-1.5 text-xs [&_dd]:min-w-0 [&_dd]:[overflow-wrap:anywhere] [&_dd]:text-content-soft [&_dt]:text-content-muted [&>div]:contents`;function De(e,t){return e===`online`?[t(`mcp:online`),!1]:e===`connecting`?[t(`mcp:connecting`),!1]:e===`unauthorized`?[t(`mcp:unauthorized`),!0]:e===`disabled`?[t(`mcp:disabled`),!1]:[t(`mcp:offline`),!0]}function Oe(e,t){return e===`high`||e===`高风险`?t(`mcp:highRisk`):e===`medium`||e===`中风险`?t(`mcp:mediumRisk`):e===`low`||e===`低风险`?t(`mcp:lowRisk`):String(e||``)}function ke(e,t){return e.auth===`headers`?t(`mcp:countRequestHeaders`,{count:e.authCount}):e.auth===`environment`?t(`mcp:configuredEnvironmentVariables`):e.auth===`local`?t(`mcp:localProcess`):t(`mcp:none`)}function Ae({notify:e,onBack:t,requestText:n,requestConfirm:i}){let{t:a,language:o}=r(),s=te(`focusSearch`),{data:c,busy:l,loading:u,error:d,change:f,reload:p}=Te(),[m,h]=(0,H.useState)(``),[g,v]=(0,H.useState)(``),ee=(0,H.useCallback)(async()=>{let t=await n?.({title:a(`mcp:addMCPService`),message:a(`mcp:enterAStreamableHTTPURLAStdioCommandOrJSONContainingHeadersEnv`),inputLabel:a(`mcp:serverConfiguration`),placeholder:`https://server.example.com/mcp`,maxLength:12e3,confirmLabel:a(`mcp:continue`)});if(t?.trim()&&await i?.({title:a(`mcp:connectMCPServer`),message:a(`mcp:mcpServersCanExposeToolsThatPerformExternalActionsConnectOnlyToServersYouTrust`),confirmLabel:a(`mcp:connect`),tone:`danger`})!==!1)try{let n=await f(()=>X.add(t));v(n.services.at(-1)?.id||``),e(a(`mcp:mcpServerAdded`),`success`)}catch(t){e(t instanceof Error?t.message:String(t),`error`)}},[f,e,i,n,a]),k=m.trim().toLowerCase(),M=c?.services||[],N=M.filter(e=>`${e.name} ${e.endpoint}`.toLowerCase().includes(k)),P=(c?.tools||[]).filter(e=>`${e.name} ${e.serviceName} ${e.description}`.toLowerCase().includes(k)),F=c?.metrics||{totalServices:0,onlineServices:0,availableTools:0,restrictedTools:0,errorRate:0},ne=async(t,n)=>{try{await f(()=>X.setToolEnabled(t.serviceId,t.name,n))}catch(t){e(t instanceof Error?t.message:String(t),`error`)}},re=async(t,n)=>{try{await f(()=>X.setServerEnabled(t.id,n)),e(a(n?`mcp:mcpServerEnabled`:`mcp:mcpServerDisabled`),`success`)}catch(t){e(t instanceof Error?t.message:String(t),`error`)}},I=async t=>{try{await f(()=>X.test(t.id)),e(a(`mcp:mcpConnectionTestPassed`),`success`)}catch(t){e(t instanceof Error?t.message:String(t),`error`)}},ce=async t=>{if(await i?.({title:a(`mcp:deleteMCPServer`),message:a(`mcp:afterDeletionToolsFromThisServerWillBeRemovedFromSubsequentAgentRuns`),confirmLabel:a(`mcp:delete`),tone:`danger`})!==!1)try{await f(()=>X.remove(t.id)),v(``),e(a(`mcp:mcpServerDeleted`),`success`)}catch(t){e(t instanceof Error?t.message:String(t),`error`)}},le=e=>{let t=(c?.calls||[]).filter(t=>t.serviceId===e.id);return(0,Q.jsxs)(`div`,{className:`mcp-service-detail grid gap-3`,children:[(0,Q.jsx)(`p`,{className:O(`text-xs leading-normal [overflow-wrap:anywhere]`,e.error?`font-mono text-content-secondary`:`text-content-muted`),children:e.error||a(`mcp:thisServerExposesToolsThroughAStandardMCPTransportEnabledToolsAreRegisteredInNewAgentRuntimes`)}),(0,Q.jsx)(`dl`,{className:Ee,children:[[a(`mcp:transport`),e.transport===`stdio`?`stdio`:e.transport===`sse`?`HTTP + SSE`:`Streamable HTTP`,!1],...e.transport===`stdio`?[[a(`mcp:executable`),e.command||`—`,!0],[a(`mcp:workingDirectory`),e.workingDirectory||`—`,!0]]:[[a(`mcp:serverAddress`),e.endpoint||`—`,!0]],[a(`mcp:latency`),e.latencyMs==null?`—`:`${e.latencyMs} ms`,!1],[a(`mcp:lastPing`),e.lastPingAt?j(e.lastPingAt,o):`—`,!1],[a(`mcp:authentication`),ke(e,a),!1]].map(([e,t,n])=>(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`dt`,{children:e}),(0,Q.jsx)(`dd`,{className:n?`font-mono`:`tabular-nums`,children:t})]},e))}),(0,Q.jsxs)(`section`,{className:`mcp-calls-panel min-w-0`,"aria-label":a(`mcp:recentCalls`),children:[(0,Q.jsxs)(`h3`,{className:`mb-1 text-xs font-medium text-content-muted tabular-nums`,children:[a(`mcp:recentCalls`),t.length>0&&(0,Q.jsxs)(`span`,{children:[` · `,Math.min(t.length,8)]})]}),t.length?(0,Q.jsx)(`ul`,{role:`list`,className:`m-0 list-none divide-y divide-stroke p-0`,children:t.slice(0,8).map(e=>{let t=e.status===`ok`;return(0,Q.jsxs)(`li`,{className:O(`activity-row grid min-h-10 min-w-0 grid-cols-[16px_minmax(0,1fr)_auto] items-center gap-2.5 py-1.5`,t?`completed`:`failed`),children:[(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`grid size-4 place-items-center text-content-muted [&_svg]:size-3.5 [&_svg]:stroke-[2]`,children:t?(0,Q.jsx)(_,{}):(0,Q.jsx)(T,{})}),(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,Q.jsx)(`strong`,{className:`truncate font-mono text-xs font-medium text-content`,children:e.toolName}),(0,Q.jsx)(`small`,{className:`truncate text-xs text-content-muted`,children:t?a(`mcp:callSucceeded`):e.error||a(`mcp:callFailed`)})]}),(0,Q.jsxs)(`span`,{className:`flex flex-col items-end text-xs text-content-muted tabular-nums`,children:[(0,Q.jsxs)(`span`,{className:`text-content-secondary`,children:[e.durationMs,` ms`]}),(0,Q.jsx)(`span`,{children:j(e.timestamp,o)})]})]},e.id)})}):(0,Q.jsxs)(`p`,{className:`flex items-center gap-1.5 py-1 text-xs text-content-muted`,children:[(0,Q.jsx)(x,{className:`size-3.5`,"aria-hidden":`true`}),a(`mcp:noRecentCalls`)]})]}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2`,children:[(0,Q.jsxs)(A,{size:`sm`,variant:`ghost`,className:`text-danger hover:bg-danger-soft hover:text-danger max-[650px]:h-11`,disabled:l,onClick:()=>void ce(e),children:[(0,Q.jsx)(C,{"data-icon":`inline-start`}),a(`mcp:delete`)]}),(0,Q.jsxs)(A,{size:`sm`,variant:`secondary`,className:`max-[650px]:h-11`,loading:l,disabled:!e.enabled||l,onClick:()=>void I(e),children:[(0,Q.jsx)(b,{"data-icon":`inline-start`}),a(`mcp:testConnection`)]})]})]})};return(0,Q.jsxs)(oe,{title:a(`navigation:navigation.mcp`),description:a(`mcp:lede`),back:t&&{label:a(`navigation:sidebar.features`),ariaLabel:a(`navigation:shell.backToFeaturesLabel`),onBack:t},toolbar:(0,Q.jsx)(se,{search:(0,Q.jsx)(ie,{id:E,value:m,onValueChange:h,placeholder:a(`navigation:pageHeader.searchServicesOrTools`),shortcut:s,clearLabel:a(`navigation:more.clearSearch`)}),actions:(0,Q.jsxs)(A,{type:`button`,className:`h-9`,"data-mcp-add":!0,disabled:l,onClick:()=>void ee(),children:[(0,Q.jsx)(y,{}),a(`navigation:pageHeader.addService`)]})}),children:[(0,Q.jsx)(xe,{notify:e,requestConfirm:i}),u&&!c&&!d?(0,Q.jsx)(L,{kind:`loading`,title:a(`mcp:loading`)}):!c&&d?(0,Q.jsx)(L,{kind:`error`,title:a(`mcp:loadFailed`),description:d.message,action:(0,Q.jsx)(A,{variant:`secondary`,className:`max-[650px]:h-11`,disabled:l,onClick:()=>void p(),children:a(`mcp:retry`)})}):c&&(0,Q.jsxs)(Q.Fragment,{children:[d&&(0,Q.jsxs)(z,{role:`status`,className:`mt-4 flex min-w-0 items-center justify-between gap-3 text-muted-foreground [overflow-wrap:anywhere]`,children:[(0,Q.jsx)(`span`,{children:d.message}),(0,Q.jsx)(A,{variant:`ghost`,className:`max-[650px]:h-11`,disabled:l,onClick:()=>void p(),children:a(`mcp:retry`)})]}),(0,Q.jsx)(ae,{className:`mcp-services`,title:a(`mcp:services`),count:N.length,meta:M.length>0&&a(`mcp:serviceSummary`,{online:F.onlineServices,total:F.totalServices,rate:F.errorRate}),children:N.length?(0,Q.jsx)(V,{children:N.map(e=>{let[t,n]=De(e.status,a),r=e.transport===`stdio`?e.workingDirectory||e.command:e.endpoint;return(0,Q.jsx)(B,{className:`service-row`,"data-mcp-service":e.id,icon:(0,Q.jsx)(S,{}),name:e.name,description:(0,Q.jsx)(`span`,{className:`font-mono text-xs`,title:r,children:r}),status:(0,Q.jsxs)(`span`,{"data-mcp-status":e.status||`offline`,className:O(`flex items-center gap-1.5`,n&&`font-medium text-st-attn`),children:[n&&(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`size-2 flex-none rounded-full bg-st-attn-fill`}),t]}),actions:(0,Q.jsx)(D,{checked:e.enabled,disabled:l,"aria-label":a(`mcp:toggleServiceName`,{name:e.name}),onCheckedChange:t=>void re(e,t)}),expanded:g===e.id,onExpandedChange:t=>v(t?e.id:``),toggleLabel:a(`mcp:toggleServiceDetails`,{name:e.name}),detail:le(e)},e.id)})}):(0,Q.jsx)(R,{icon:S,title:a(`mcp:noServerConfigured`),description:M.length?void 0:a(`mcp:emptyAddHint`)})}),(0,Q.jsx)(ae,{className:`mcp-tools-panel`,title:a(`mcp:toolCapabilities`),count:P.length,meta:F.restrictedTools>0&&a(`mcp:toolSummary`,{count:F.restrictedTools}),children:P.length?(0,Q.jsx)(V,{children:P.map(e=>(0,Q.jsx)(B,{className:`tool-row`,"data-mcp-tool":e.piName,icon:(0,Q.jsx)(w,{}),name:(0,Q.jsx)(`span`,{className:`font-mono`,children:e.name}),description:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`font-mono`,children:e.serviceName}),e.description&&(0,Q.jsxs)(Q.Fragment,{children:[` · `,e.description]})]}),status:Oe(e.risk,a),actions:(0,Q.jsx)(D,{checked:!!e.enabled,disabled:l||!e.serviceEnabled,"aria-label":a(`mcp:toggleToolName`,{name:e.name}),onCheckedChange:t=>void ne(e,t)})},e.piName))}):(0,Q.jsx)(R,{compact:!0,icon:w,title:a(`mcp:noToolsAvailable`)})})]})]})}export{Ae as McpPage};
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t,r as n}from"./vendor-react-DwNgTV1j.js";import{t as r}from"./use-i18n-Cyg5th6Z.js";import{t as i}from"./api-m-Yq8n0q.js";import{t as a}from"./createLucideIcon-Cd-3GVxJ.js";import{t as o}from"./check-2vYc6QaP.js";import{t as s}from"./file-code-corner-BnE1ljT0.js";import{t as c}from"./info-DATxy0fb.js";import{t as l}from"./pencil-U08v_vV9.js";import{t as u}from"./plus-fQbSqB1n.js";import{t as d}from"./refresh-cw-TbWxTY4K.js";import{t as f}from"./sparkles-S_eeuqn9.js";import{t as p}from"./trash-2-CNrPOoPR.js";import{t as m}from"./x-07u4-129.js";import{t as h}from"./more-pages-D_PnxLN0.js";import{i as ee,n as g,t as te}from"./tooltip-D4MFbqcG.js";import{t as ne}from"./utils-C8uzG5AZ.js";import{n as _,t as v}from"./button-CCcCN8tE.js";import{s as y}from"./shortcuts-Cgx6V2jI.js";import{t as b}from"./input-CPw-zkYh.js";import{t as x}from"./textarea-DmATpOqT.js";import{n as S,r as re,t as ie}from"./PageState-Cz6vFMXv.js";import{a as ae,i as oe,n as se,o as ce,r as le,s as ue,t as de}from"./FeaturePage-B3PLRtEG.js";import{n as C}from"./field-DoLEb0np.js";import{t as w}from"./AppSelect-BD6RAaJ5.js";import{c as fe,i as pe,n as T,t as me}from"./app-primitives-Drz_SjnR.js";var E=a(`zoom-out`,[[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`line`,{x1:`21`,x2:`16.65`,y1:`21`,y2:`16.65`,key:`13gj7c`}],[`line`,{x1:`8`,x2:`14`,y1:`11`,y2:`11`,key:`durymu`}]]),D=a(`zoom-in`,[[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`line`,{x1:`21`,x2:`16.65`,y1:`21`,y2:`16.65`,key:`13gj7c`}],[`line`,{x1:`11`,x2:`11`,y1:`8`,y2:`14`,key:`1vmskp`}],[`line`,{x1:`8`,x2:`14`,y1:`11`,y2:`11`,key:`durymu`}]]),O=e(t(),1);function he(e={}){let{rootMargin:t=`96px 0px`,threshold:n=0}=e,[r,i]=(0,O.useState)(null),[a,o]=(0,O.useState)(()=>!document.hidden),[s,c]=(0,O.useState)(!0),l=(0,O.useCallback)(e=>{i(e)},[]);return(0,O.useEffect)(()=>{let e=()=>o(!document.hidden);return e(),document.addEventListener(`visibilitychange`,e),()=>document.removeEventListener(`visibilitychange`,e)},[]),(0,O.useEffect)(()=>{if(!r||typeof IntersectionObserver>`u`)return;let e=new IntersectionObserver(([e])=>{e&&c(e.isIntersecting)},{rootMargin:t,threshold:n});return e.observe(r),()=>e.disconnect()},[r,t,n]),{ref:l,playing:a&&s}}var k=n(),A={width:600,height:420,cx:300,cy:206},ge=24,_e=Math.PI*(3-Math.sqrt(5));function ve({type:e}){return(0,k.jsx)(`i`,{"aria-hidden":`true`,className:`g-dot g-${e} inline-block size-2 shrink-0 rounded-full ring-1 ring-stroke`,style:{background:j[e]}})}var j={concept:`var(--g-concept)`,file:`var(--g-file)`,risk:`var(--g-risk)`,preference:`var(--g-preference)`,decision:`var(--g-decision)`,fact:`var(--g-fact)`,task:`var(--g-task)`},ye={concept:`var(--g-concept-glow)`,file:`var(--g-file-glow)`,risk:`var(--g-risk-glow)`,preference:`var(--g-preference-glow)`,decision:`var(--g-decision-glow)`,fact:`var(--g-fact-glow)`,task:`var(--g-task-glow)`};function M(e){let t=0;for(let n=0;n<e.length;n+=1)t=t*31+e.charCodeAt(n)>>>0;return t}function N(e,t){let n=e.slice(0,ge);if(!n.length)return[];if(n.length===1)return[{node:n[0],x:A.cx,y:A.cy,twinkle:0}];let r=M(t||`galaxy`)%628/100,i=172/Math.sqrt(n.length);return n.map((e,t)=>{let n=M(e.id),a=t*_e+r,o=i*Math.sqrt(t+.55)+n%11-5;return{node:e,x:A.cx+Math.cos(a)*o*1.38,y:A.cy+Math.sin(a)*o*.74,twinkle:n%50/10}})}function P(e,t,n){let r=t.x-e.x,i=t.y-e.y,a=Math.hypot(r,i)||1,o=Math.min(24,a*.16)*(n%2==0?1:-1),s=(e.x+t.x)/2-i/a*o,c=(e.y+t.y)/2+r/a*o;return`M ${e.x.toFixed(1)} ${e.y.toFixed(1)} Q ${s.toFixed(1)} ${c.toFixed(1)} ${t.x.toFixed(1)} ${t.y.toFixed(1)}`}function be({nodes:e,links:t,spaceId:n,selectedId:i,loading:a,onSelect:o,onAdd:s}){let{t:c}=r(),[l,d]=(0,O.useState)(1),[f,p]=(0,O.useState)(``),m=(0,O.useRef)(null),h=(0,O.useRef)(0),{ref:ee,playing:g}=he(),te=(0,O.useCallback)(e=>{m.current=e,ee(e)},[ee]),ne=g?``:`[&:before]:[animation-play-state:paused]! [&:after]:[animation-play-state:paused]! [&_*]:[animation-play-state:paused]! [&_*:before]:[animation-play-state:paused]! [&_*:after]:[animation-play-state:paused]!`,_=e=>{if(!g)return;let t=m.current;if(!t)return;let n=t.getBoundingClientRect(),r=((e.clientX-n.left)/n.width-.5)*2,i=((e.clientY-n.top)/n.height-.5)*2;cancelAnimationFrame(h.current),h.current=requestAnimationFrame(()=>{t.style.setProperty(`--px`,r.toFixed(3)),t.style.setProperty(`--py`,i.toFixed(3))})},v=()=>{cancelAnimationFrame(h.current),m.current?.style.setProperty(`--px`,`0`),m.current?.style.setProperty(`--py`,`0`)};(0,O.useEffect)(()=>{g||(cancelAnimationFrame(h.current),h.current=0)},[g]),(0,O.useEffect)(()=>{let e=m.current?.querySelector(`svg`);e&&(g?e.unpauseAnimations():e.pauseAnimations())},[g]);let y=(0,O.useMemo)(()=>N(e,n),[e,n]),b=(0,O.useMemo)(()=>new Map(y.map(e=>[e.node.id,e])),[y]),x=(0,O.useMemo)(()=>{let e=new Set(y.map(e=>e.node.id));return t.filter(t=>e.has(t.sourceId)&&e.has(t.targetId))},[y,t]),S=f||i,ie=new Set(t.flatMap(e=>e.sourceId===S?[e.targetId]:e.targetId===S?[e.sourceId]:[]));return(0,k.jsxs)(me,{className:`graph-panel before:[content:''] before:absolute before:z-[0] before:inset-0 before:pointer-events-none before:bg-[url('/memory-galaxy-background.webp')] before:[background-position:center_48%] before:[background-size:cover] before:bg-no-repeat before:[filter:saturate(.62)_contrast(1.08)] before:[mix-blend-mode:screen] before:opacity-[.42] after:[content:''] after:absolute after:z-[0] after:inset-0 after:pointer-events-none after:[background-image:radial-gradient(var(--galaxy-dot)_.9px,transparent_1.2px),_radial-gradient(var(--galaxy-dot-dim)_.8px,transparent_1.2px),_radial-gradient(var(--galaxy-dot)_1.2px,transparent_1.6px)] after:[background-position:0_0,_37px_53px,_71px_19px] after:[background-size:96px_96px,_152px_152px,_236px_236px] after:[animation:galaxy-field-twinkle_6.4s_ease-in-out_infinite] after:opacity-[.7] before:inset-[-8%] before:[animation:galaxy-background-drift_34s_ease-in-out_infinite_alternate] before:[will-change:transform] after:[animation:galaxy-field-drift_15s_ease-in-out_infinite_alternate] after:[will-change:background-position,opacity] max-[650px]:min-h-[430px] relative min-h-[500px] overflow-hidden [border-color:var(--galaxy-border)] bg-[var(--galaxy-bg)]! [background-image:radial-gradient(ellipse_46%_40%_at_50%_48%,_var(--galaxy-core),_transparent_72%),_radial-gradient(ellipse_62%_48%_at_16%_6%,_var(--galaxy-nebula-a),_transparent_70%),_radial-gradient(ellipse_56%_52%_at_88%_98%,_var(--galaxy-nebula-b),_transparent_72%)] p-0 backdrop-blur-none! galaxy-panel ${ne}`,onPointerMove:_,onPointerLeave:v,children:[(0,k.jsxs)(`div`,{className:`graph-toolbar absolute top-2.5 left-2.5 z-[4] flex gap-0.5 rounded-sm border border-[var(--galaxy-toolbar-border)] bg-[var(--galaxy-toolbar-bg)] p-0.5 text-[var(--galaxy-toolbar-text)] [&_button]:grid [&_button]:size-7 [&_button]:place-items-center [&_button]:rounded-xs [&_button]:transition-colors [&_button]:duration-(--d-fast) [&_button:hover]:bg-[var(--galaxy-toolbar-hover)] max-[650px]:[&_button]:size-11 [&_svg]:size-3.5`,children:[(0,k.jsx)(`button`,{type:`button`,title:c(`memory:memoryPage.addMemory`),"aria-label":c(`memory:memoryPage.addMemory`),onClick:s,children:(0,k.jsx)(u,{})}),(0,k.jsx)(`button`,{type:`button`,title:c(`memory:memoryPage.zoomIn`),"aria-label":c(`memory:memoryPage.zoomIn`),onClick:()=>d(e=>Math.min(1.6,Number((e+.15).toFixed(2)))),children:(0,k.jsx)(D,{})}),(0,k.jsx)(`button`,{type:`button`,title:c(`memory:memoryPage.zoomOut`),"aria-label":c(`memory:memoryPage.zoomOut`),onClick:()=>d(e=>Math.max(.7,Number((e-.15).toFixed(2)))),children:(0,k.jsx)(E,{})})]}),(0,k.jsxs)(`div`,{className:`galaxy-stage [&_>_svg]:absolute [&_>_svg]:inset-0 [&_>_svg]:w-full [&_>_svg]:h-full [&_>_svg]:overflow-visible [&_>_svg]:z-[1] [&_>_svg]:[transform:translate3d(calc(var(--px,0)_*_9px),calc(var(--py,0)_*_6px),0)] [&_>_svg]:[transition:transform_.9s_var(--ease-out)] absolute z-[1] inset-0 [transform-origin:50%_50%] [transition:transform_var(--d2)_var(--ease-out)] ${S?`has-focus`:``}`,ref:te,style:{transform:`scale(${l})`},children:[(0,k.jsx)(`i`,{className:`galaxy-spiral absolute z-[0] block pointer-events-none [left:9%] [top:13%] w-[82%] h-[74%] rounded-[50%] bg-[conic-gradient(from_-18deg,transparent_0deg,var(--galaxy-nebula-a)_28deg,transparent_68deg,var(--galaxy-nebula-b)_118deg,transparent_170deg,var(--galaxy-nebula-a)_224deg,transparent_278deg,var(--galaxy-nebula-b)_322deg,transparent_360deg)] [filter:blur(13px)] [mask-image:radial-gradient(ellipse,transparent_0%,transparent_15%,var(--g-star-core)_38%,transparent_74%)] [-webkit-mask-image:radial-gradient(ellipse,transparent_0%,transparent_15%,var(--g-star-core)_38%,transparent_74%)] [mix-blend-mode:screen] opacity-[.38] [animation:galaxy-spiral-turn_42s_linear_infinite] [will-change:transform]`,"aria-hidden":`true`}),(0,k.jsx)(`i`,{className:`galaxy-core absolute z-[0] block pointer-events-none before:[content:''] before:absolute before:left-[50%] before:top-[50%] before:w-[46px] before:h-[46px] before:rounded-[50%] before:bg-[radial-gradient(circle,rgba(255,255,255,.82),rgba(191,219,254,.3)_55%,transparent_76%)] before:[filter:blur(6px)] before:[transform:translate(-50%,-50%)] [left:50%] [top:49%] w-[34%] h-[40%] rounded-[50%] bg-[radial-gradient(ellipse,rgba(219,232,255,.3)_0%,rgba(126,156,255,.15)_36%,transparent_70%)] [filter:blur(9px)] [mix-blend-mode:screen] [transform:translate(-50%,-50%)] [animation:galaxy-core-breathe_7.5s_ease-in-out_infinite] [will-change:transform,opacity]`,"aria-hidden":`true`}),(0,k.jsx)(`i`,{className:`galaxy-aurora absolute z-[0] block pointer-events-none w-[46%] h-[31%] rounded-[50%] [filter:blur(21px)] [mix-blend-mode:screen] opacity-[.42] [will-change:transform,opacity] [left:8%] [top:20%] bg-[radial-gradient(ellipse,var(--galaxy-nebula-a),transparent_70%)] [animation:galaxy-aurora-drift_18s_ease-in-out_infinite_alternate]`,"aria-hidden":`true`}),(0,k.jsx)(`i`,{className:`galaxy-aurora absolute z-[0] block pointer-events-none w-[46%] h-[31%] rounded-[50%] [filter:blur(21px)] [mix-blend-mode:screen] opacity-[.42] [will-change:transform,opacity] [right:5%] [bottom:14%] bg-[radial-gradient(ellipse,var(--galaxy-nebula-b),transparent_70%)] [animation:galaxy-aurora-drift_23s_ease-in-out_-9s_infinite_alternate-reverse]`,"aria-hidden":`true`}),(0,k.jsx)(`i`,{className:`galaxy-aurora absolute z-[0] block pointer-events-none w-[46%] h-[31%] rounded-[50%] [filter:blur(21px)] [mix-blend-mode:screen] opacity-[.42] [will-change:transform,opacity] galaxy-aurora-three left-[30%] top-[60%] !w-[40%] !h-[27%] bg-[radial-gradient(ellipse,var(--galaxy-nebula-c),transparent_70%)] [animation:galaxy-aurora-drift_27s_ease-in-out_-14s_infinite_alternate]`,"aria-hidden":`true`}),(0,k.jsxs)(`svg`,{viewBox:`0 0 600 420`,preserveAspectRatio:`none`,"aria-hidden":`true`,children:[(0,k.jsxs)(`g`,{className:`galaxy-orbits [&_ellipse]:[fill:none] [&_ellipse]:[stroke:var(--galaxy-line)] [&_ellipse]:[stroke-width:.72] [&_ellipse]:[stroke-dasharray:3_7] [&_ellipse]:opacity-[.52] [transform-box:fill-box] [transform-origin:center] [animation:galaxy-orbit-drift_90s_linear_infinite]`,children:[(0,k.jsx)(`ellipse`,{cx:`300`,cy:`206`,rx:`205`,ry:`122`,transform:`rotate(-8 300 206)`}),(0,k.jsx)(`ellipse`,{cx:`300`,cy:`206`,rx:`154`,ry:`88`,transform:`rotate(18 300 206)`}),(0,k.jsx)(`ellipse`,{cx:`300`,cy:`206`,rx:`95`,ry:`54`,transform:`rotate(-24 300 206)`})]}),(0,k.jsx)(`defs`,{children:x.map((e,t)=>{let n=b.get(e.sourceId),r=b.get(e.targetId);return!n||!r?null:(0,k.jsxs)(`linearGradient`,{id:`lg-${t}`,gradientUnits:`userSpaceOnUse`,x1:n.x,y1:n.y,x2:r.x,y2:r.y,children:[(0,k.jsx)(`stop`,{offset:`0`,stopColor:j[n.node.type]||`var(--galaxy-line-active)`}),(0,k.jsx)(`stop`,{offset:`1`,stopColor:j[r.node.type]||`var(--galaxy-line-active)`})]},e.id)})}),x.map((e,t)=>{let n=b.get(e.sourceId),r=b.get(e.targetId);if(!n||!r)return null;let i=e.sourceId===S||e.targetId===S,a=P(n,r,M(e.id));return(0,k.jsxs)(`g`,{children:[(0,k.jsx)(`path`,{className:`link-path [.galaxy-stage_>_svg_&]:[fill:none] [.galaxy-stage_>_svg_&]:[stroke-width:1.05] [.galaxy-stage_>_svg_&]:[stroke-dasharray:3_5] [.galaxy-stage_>_svg_&]:opacity-[.5] [.galaxy-stage_>_svg_&]:[animation:galaxy-link-flow_30s_linear_infinite] [.galaxy-stage_>_svg_&]:[transition:opacity_var(--d2)_var(--ease-out)] [.galaxy-stage_>_svg_&.active]:[stroke-width:1.55] [.galaxy-stage_>_svg_&.active]:[stroke-dasharray:none] [.galaxy-stage_>_svg_&.active]:opacity-100 [.galaxy-stage_>_svg_&.active]:[filter:drop-shadow(0_0_3.5px_var(--galaxy-line-active))] [.galaxy-stage.has-focus_&]:opacity-[.14] [.galaxy-stage.has-focus_&.active]:opacity-100 ${i?`active`:``}`,d:a,stroke:`url(#lg-${t})`}),i&&(0,k.jsx)(`circle`,{className:`link-pulse [.galaxy-stage_>_svg_&]:[fill:var(--g-star-core)] [.galaxy-stage_>_svg_&]:[filter:drop-shadow(0_0_4px_var(--galaxy-line-active))] [.galaxy-stage_>_svg_&]:pointer-events-none`,r:`2.1`,children:(0,k.jsx)(`animateMotion`,{dur:`2.8s`,repeatCount:`indefinite`,path:a})})]},e.id)})]}),(0,k.jsx)(`i`,{className:`galaxy-meteor before:[content:''] before:absolute before:top-[50%] before:left-[1px] before:w-[72px] before:h-[1px] before:bg-[linear-gradient(90deg,transparent,var(--galaxy-dot))] before:[transform:translateY(-50%)] absolute [top:14%] [left:80%] w-[2.4px] h-[2.4px] rounded-[50%] bg-[var(--galaxy-label-active)] shadow-[0_0_7px_1px_var(--galaxy-dot)] opacity-0 pointer-events-none [animation:galaxy-meteor_12s_linear_infinite] z-[3]`,"aria-hidden":`true`}),(0,k.jsx)(`i`,{className:`galaxy-meteor before:[content:''] before:absolute before:top-[50%] before:left-[1px] before:w-[72px] before:h-[1px] before:bg-[linear-gradient(90deg,transparent,var(--galaxy-dot))] before:[transform:translateY(-50%)] absolute [top:14%] [left:80%] w-[2.4px] h-[2.4px] rounded-[50%] bg-[var(--galaxy-label-active)] shadow-[0_0_7px_1px_var(--galaxy-dot)] opacity-0 pointer-events-none [animation:galaxy-meteor_12s_linear_infinite] z-[3] meteor-two [.galaxy-meteor&]:top-[63%] [.galaxy-meteor&]:left-[89%] [.galaxy-meteor&]:[animation:galaxy-meteor-b_17s_linear_4.5s_infinite]`,"aria-hidden":`true`}),(0,k.jsx)(`i`,{className:`galaxy-meteor before:[content:''] before:absolute before:top-[50%] before:left-[1px] before:w-[72px] before:h-[1px] before:bg-[linear-gradient(90deg,transparent,var(--galaxy-dot))] before:[transform:translateY(-50%)] absolute [top:14%] [left:80%] w-[2.4px] h-[2.4px] rounded-[50%] bg-[var(--galaxy-label-active)] shadow-[0_0_7px_1px_var(--galaxy-dot)] opacity-0 pointer-events-none [animation:galaxy-meteor_12s_linear_infinite] z-[3] meteor-three [.galaxy-meteor&]:top-[7%] [.galaxy-meteor&]:left-[36%] [.galaxy-meteor&]:[animation:galaxy-meteor-c_23s_linear_11s_infinite]`,"aria-hidden":`true`}),y.map(({node:e,x:t,y:n,twinkle:r},a)=>(0,k.jsxs)(`button`,{className:`galaxy-star focus-visible:rounded-[50%] focus-visible:[outline-color:var(--galaxy-line-active)] before:[content:''] before:absolute before:w-[calc(var(--star-size)_+_26px)] before:h-[calc(var(--star-size)_+_26px)] before:rounded-[50%] before:bg-[radial-gradient(circle,var(--g-star-glow),transparent_68%)] before:[filter:blur(3px)] before:opacity-[.76] before:pointer-events-none [&.active::after]:[content:''] [&.active::after]:absolute [&.active::after]:w-[calc(var(--star-size)_+_31px)] [&.active::after]:h-[calc(var(--star-size)_+_31px)] [&.active::after]:[border:1px_solid_var(--g-star-glow)] [&.active::after]:rounded-[50%] [&.active::after]:pointer-events-none [&.active::after]:[animation:galaxy-star-selection-pulse_2.3s_var(--ease-out)_infinite] [&:hover::before]:opacity-100 [&.active::before]:opacity-100 absolute z-[2] grid w-[52px] h-[52px] min-w-0 min-h-[52px] place-items-center [transform:translate(-50%,-50%)_translate3d(calc(var(--px,0)_*_(9px_+_var(--depth,0)_*_7px)),calc(var(--py,0)_*_(6px_+_var(--depth,0)_*_5px)),0)] border-0 rounded-[50%] bg-transparent p-0 cursor-pointer [transition:transform_.9s_var(--ease-out),opacity_.45s_var(--ease-out),filter_.45s_var(--ease-out)] [animation:galaxy-star-enter_.72s_var(--ease-out)_var(--enter-delay,0ms)_backwards] ${i===e.id?`active`:``} ${S&&e.id!==S&&!ie.has(e.id)?`dimmed [.galaxy-stage.has-focus_.galaxy-star&]:opacity-[.32] [.galaxy-stage.has-focus_.galaxy-star&]:[filter:saturate(.4)_brightness(.82)]`:``}`,"aria-pressed":i===e.id,onClick:()=>o(e.id),onMouseEnter:()=>p(e.id),onMouseLeave:()=>p(``),style:{left:`${t/A.width*100}%`,top:`${n/A.height*100}%`,"--star-size":`${12+Math.round((e.importance||.5)*9)}px`,"--twinkle-delay":`${r}s`,"--enter-delay":`${a*55}ms`,"--depth":M(e.id)%100/100,"--g-star-color":j[e.type],"--g-star-glow":ye[e.type]},title:e.content,children:[i===e.id&&(0,k.jsx)(`i`,{className:`orbit-ring [.galaxy-star_&]:absolute [.galaxy-star_&]:left-[50%] [.galaxy-star_&]:top-[50%] [.galaxy-star_&]:w-[calc(var(--star-size)_+_36px)] [.galaxy-star_&]:h-[calc(var(--star-size)_+_36px)] [.galaxy-star_&]:[border:1px_solid_var(--galaxy-line-active)] [.galaxy-star_&]:rounded-[50%] [.galaxy-star_&]:pointer-events-none [.galaxy-star_&]:[transform:translate(-50%,-50%)_rotate(-22deg)_scaleY(.44)] [.galaxy-star_&]:[animation:galaxy-selected-orbit_6s_linear_infinite] [.galaxy-star_&]:opacity-[.8] [.galaxy-star_&::before]:[content:''] [.galaxy-star_&::before]:absolute [.galaxy-star_&::before]:top-[-2.2px] [.galaxy-star_&::before]:left-[50%] [.galaxy-star_&::before]:w-[4.4px] [.galaxy-star_&::before]:h-[4.4px] [.galaxy-star_&::before]:ml-[-2.2px] [.galaxy-star_&::before]:rounded-[50%] [.galaxy-star_&::before]:bg-[var(--g-star-color)] [.galaxy-star_&::before]:shadow-[0_0_6px_1px_var(--g-star-glow)]`,"aria-hidden":`true`}),i===e.id&&(0,k.jsx)(`i`,{className:`dash-ring [.galaxy-star_&]:absolute [.galaxy-star_&]:left-[50%] [.galaxy-star_&]:top-[50%] [.galaxy-star_&]:w-[calc(var(--star-size)_+_23px)] [.galaxy-star_&]:h-[calc(var(--star-size)_+_23px)] [.galaxy-star_&]:[border:1px_dashed_var(--g-star-glow)] [.galaxy-star_&]:rounded-[50%] [.galaxy-star_&]:opacity-[.9] [.galaxy-star_&]:pointer-events-none [.galaxy-star_&]:[transform:translate(-50%,-50%)] [.galaxy-star_&]:[animation:galaxy-dash-spin_16s_linear_infinite]`,"aria-hidden":`true`}),(0,k.jsxs)(`svg`,{className:`star-core [.galaxy-star_&]:relative [.galaxy-star_&]:block [.galaxy-star_&]:w-[var(--star-size)] [.galaxy-star_&]:h-[var(--star-size)] [.galaxy-star_&]:[transition:transform_var(--d2)_var(--ease-spring)] [.galaxy-star_&]:[animation:galaxy-star-twinkle_3.8s_ease-in-out_var(--twinkle-delay)_infinite] [.galaxy-star_&]:overflow-visible [.galaxy-star_&]:rounded-[0] [.galaxy-star_&]:bg-transparent [.galaxy-star_&]:shadow-[none] [.galaxy-star_&]:[filter:drop-shadow(0_0_3px_var(--g-star-glow))_drop-shadow(0_0_8px_var(--g-star-glow))] [.galaxy-star_&]:origin-[center] [.galaxy-star:hover_&]:[transform:scale(1.28)] [.galaxy-star.active_&]:[transform:scale(1.32)] [.galaxy-star.active_&]:[animation:galaxy-star-twinkle_2.1s_ease-in-out_var(--twinkle-delay)_infinite]`,viewBox:`0 0 32 32`,"aria-hidden":`true`,children:[(0,k.jsx)(`path`,{className:`star-ray [.galaxy-star_.star-core_&]:[fill:var(--g-star-glow)] [.galaxy-star_.star-core_&]:opacity-[.58] [.galaxy-star_.star-core_&]:[transform-box:fill-box] [.galaxy-star_.star-core_&]:origin-[center] [.galaxy-star_.star-core_&]:[transform:scale(1.45)] [.galaxy-star.active_.star-core_&]:opacity-[.88] [.galaxy-star.active_.star-core_&]:[transform:scale(1.82)]`,d:`M16 0 L19.7 12.3 L32 16 L19.7 19.7 L16 32 L12.3 19.7 L0 16 L12.3 12.3 Z`}),(0,k.jsx)(`path`,{className:`star-shape [.galaxy-star_.star-core_&]:[fill:var(--g-star-color)]`,d:`M16 2 L18.8 13.2 L30 16 L18.8 18.8 L16 30 L13.2 18.8 L2 16 L13.2 13.2 Z`}),(0,k.jsx)(`circle`,{className:`star-heart [.galaxy-star_.star-core_&]:[fill:var(--g-star-core)]`,cx:`16`,cy:`16`,r:`3.2`})]}),(0,k.jsx)(`span`,{className:`star-label [.galaxy-stage.has-focus_.galaxy-star.dimmed_&]:opacity-[.3] [.galaxy-stage.has-focus_.galaxy-star.dimmed_&]:[transition:opacity_.45s_var(--ease-out)] [.galaxy-star_&]:absolute [.galaxy-star_&]:top-[calc(50%_+_17px)] [.galaxy-star_&]:left-[50%] [.galaxy-star_&]:max-w-[120px] [.galaxy-star_&]:overflow-hidden [.galaxy-star_&]:text-[var(--galaxy-label)] [.galaxy-star_&]:text-[11px] [.galaxy-star_&]:leading-[1.35] [.galaxy-star_&]:pointer-events-none [.galaxy-star_&]:text-ellipsis [.galaxy-star_&]:[text-shadow:0_1px_7px_var(--galaxy-bg)] [.galaxy-star_&]:[transform:translateX(-50%)] [.galaxy-star_&]:[transition:color_var(--d1)_var(--ease-out)] [.galaxy-star_&]:whitespace-nowrap [.galaxy-star:hover_&]:text-[var(--galaxy-label-active)] [.galaxy-star.active_&]:text-[var(--galaxy-label-active)] [.galaxy-star.active_&]:font-[700]`,children:e.title})]},e.id))]}),!!y.length&&(0,k.jsxs)(`span`,{className:`pointer-events-none absolute right-3 bottom-2.5 z-[3] rounded-xs border border-[var(--galaxy-toolbar-border)] bg-[var(--galaxy-toolbar-bg)] px-2 text-xs leading-5 text-[var(--galaxy-label)] tabular-nums`,children:[`✦`,` `,c(`memory:memoryPage.visibleTotalMemories`,{visible:y.length,total:e.length})]}),!a&&!y.length&&(0,k.jsxs)(`div`,{className:`memory-empty [.galaxy-panel_&]:text-[var(--galaxy-label)] [.galaxy-panel_&]:[--stroke:var(--galaxy-toolbar-border)] [.galaxy-panel_&]:[--control-muted:var(--galaxy-label)] [.galaxy-panel_&]:[--star:var(--g-decision)] [.galaxy-panel_&]:[--text-muted:var(--galaxy-label)] absolute z-[3] inset-0 grid [align-content:center] justify-items-center gap-[8px] text-[var(--text-muted)] text-[12px] pointer-events-none`,children:[(0,k.jsx)(re,{size:44}),(0,k.jsx)(`span`,{children:c(`memory:memoryPage.thisMemorySpaceIsStillUnlitClickInTheTopLeftToPlantTheFirstStar`)})]})]})}var xe=[`concept`,`file`,`risk`,`preference`,`decision`,`fact`,`task`],F=`modal-backdrop fixed inset-0 z-[70] grid place-items-center overflow-y-auto overscroll-contain bg-[var(--modal-overlay)] p-5 max-[650px]:p-2`,I=`modal grid max-h-[calc(100dvh_-_40px)] w-[min(430px,100%)] gap-0.5 overflow-y-auto overscroll-contain rounded-dialog bg-popover p-5 shadow-float max-[650px]:max-h-[calc(100dvh_-_16px)]`,L=`key-value flex min-h-[34px] min-w-0 items-center justify-between gap-4 border-t border-stroke-soft text-sm [&>dt]:shrink-0 [&>dt]:text-content-muted [&>dd]:min-w-0 [&>dd]:truncate [&>dd]:text-right [&>dd]:text-content`;function Se(e,t){return t(e===`file`?`memory:memoryPage.fileType`:e===`risk`?`memory:memoryPage.riskType`:e===`preference`?`memory:memoryPage.preferenceType`:e===`decision`?`memory:memoryPage.decisionType`:e===`fact`?`memory:memoryPage.factType`:e===`task`?`memory:memoryPage.taskType`:`memory:memoryPage.conceptType`)}function Ce(e,t=`zh-CN`){if(!e)return`—`;let n=new Date(e);return Number.isNaN(n.getTime())?e:new Intl.DateTimeFormat(t,{year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,hour12:!1}).format(n)}function R(e,t=e=>e){return e?.kind===`global`?t(`memory:memoryPage.globalMemorySpace`):e?.name||``}function z(e){return e instanceof Error?e.message:String(e)}function we({notify:e,onBack:t,requestConfirm:n}){let a=y(`focusSearch`),[x,re]=(0,O.useState)(``),{t:C,language:w}=r(),[T,me]=(0,O.useState)({spaces:[],nodes:[],links:[],candidates:[],selectedSpaceId:``}),[E,D]=(0,O.useState)(``),[he,A]=(0,O.useState)(``),[ge,_e]=(0,O.useState)(``),[j,ye]=(0,O.useState)(`galaxy`),M=(0,O.useRef)(null),N=(0,O.useRef)(0),[P,F]=(0,O.useState)(!0),[I,we]=(0,O.useState)(!1),[De,B]=(0,O.useState)(``),[V,H]=(0,O.useState)(null),[Oe,U]=(0,O.useState)(null),[W,G]=(0,O.useState)(``),[K,ke]=(0,O.useState)(null),[Ae,q]=(0,O.useState)(``),[je,Me]=(0,O.useState)(`load`),[Ne,Pe]=(0,O.useState)(!0),J=(0,O.useRef)(null),Y=(0,O.useRef)(0),Fe=(0,O.useRef)(0),Ie=(0,O.useRef)(0),Le=(0,O.useRef)(null),X=(0,O.useRef)(null),Re=(0,O.useRef)(!1),Z=(0,O.useRef)(null),Q=(0,O.useRef)(!0),[ze,Be]=(0,O.useState)(!1),$=(0,O.useCallback)(async(e=``)=>{let t=++N.current;F(!0),B(``);try{let n=new URLSearchParams;e&&n.set(`spaceId`,e),x.trim()&&n.set(`query`,x.trim());let r=await i(`/api/memory?${n}`);if(t!==N.current)return;me(r),we(!0),D(r.selectedSpaceId||``),A(e=>r.nodes.some(t=>t.id===e)?e:r.nodes[0]?.id||``)}catch(e){t===N.current&&B(z(e))}finally{t===N.current&&F(!1)}},[x]);(0,O.useEffect)(()=>($(E),()=>{N.current+=1}),[$,E]);let Ve=(0,O.useCallback)(async()=>{Le.current?.abort();let e=new AbortController;Le.current=e;let t=++Fe.current,n=Y.current,r=n===Ie.current;Pe(!0),q(``);try{let a=await i(`/api/settings/memory`,{signal:e.signal});if(e.signal.aborted||!Q.current||t!==Fe.current)return;let o=a.autoApproveConfidence;if(typeof o!=`number`||!Number.isInteger(o)||o<0||o>100)throw Error(C(`memory:memoryPage.invalidAutoApproveThreshold`));r&&Y.current===n&&(J.current=o,ke(String(o)))}catch(n){!e.signal.aborted&&Q.current&&t===Fe.current&&(Me(`load`),q(z(n)))}finally{!e.signal.aborted&&Q.current&&t===Fe.current&&Pe(!1)}},[C]);(0,O.useEffect)(()=>(Q.current=!0,Ve(),()=>{Q.current=!1,Le.current?.abort(),X.current?.abort(),Z.current=null}),[Ve]);let He=async()=>{if(K===null||!K.trim()||J.current===null)return;let t=Number(K);if(!Number.isFinite(t))return;let n=Math.min(100,Math.max(0,Math.round(t)));if(!X.current&&!Re.current&&n===J.current){Z.current=null,Ie.current=Y.current,ke(String(n)),q(``);return}if(Z.current={value:n,revision:Y.current},X.current)return;let r=new AbortController;X.current=r,Be(!0),q(``);try{for(;Z.current&&Q.current&&!r.signal.aborted;){let t=Z.current;if(Z.current=null,t.value!==J.current||Re.current){try{await i(`/api/settings/memory`,{method:`PATCH`,body:{autoApproveConfidence:t.value},signal:r.signal})}catch(e){if(!Q.current||r.signal.aborted)return;Z.current||=t,Re.current=!0,Me(`save`),q(z(e));return}if(!Q.current||r.signal.aborted)return;J.current=t.value,Re.current=!1}Ie.current=t.revision,Y.current===t.revision&&(ke(String(t.value)),Z.current||e(C(`memory:memoryPage.autoApproveSaved`)))}}finally{X.current===r&&(X.current=null,Q.current&&Be(!1))}},Ue=T.nodes.find(e=>e.id===he)||null,We=e=>{let t=new Set(T.links.flatMap(t=>t.sourceId===e?[t.targetId]:t.targetId===e?[t.sourceId]:[]));return{count:t.size,files:T.nodes.filter(n=>n.type===`file`&&(t.has(n.id)||n.id===e))}},Ge=T.spaces.find(e=>e.id===E),Ke=async t=>{if(await n({title:C(`memory:memoryPage.deleteMemory`),message:C(`memory:memoryPage.deleteMemoryName`,{name:t.title}),confirmLabel:C(`memory:memoryPage.delete`)}))try{await i(`/api/memory/nodes/${encodeURIComponent(t.id)}`,{method:`DELETE`}),e(C(`memory:memoryPage.memoryDeleted`)),await $(E)}catch(e){B(z(e))}},qe=async(t,n)=>{if(!W){G(t.id),B(``);try{await i(`/api/memory/candidates/${encodeURIComponent(t.id)}/${n}`,{method:`POST`,body:`{}`}),e(C(n===`accept`?`memory:memoryPage.memoryCandidateConfirmed`:`memory:memoryPage.memoryCandidateIgnored`)),await $(E)}catch(e){B(z(e))}finally{G(``)}}},Je=async()=>{if(!(W||!T.candidates?.length)){G(`__all__`),B(``);try{let t=await i(`/api/memory/candidates/reject-all`,{method:`POST`,body:`{}`});e(C(`memory:memoryPage.ignoredCountMemoryDrafts`,{count:t.rejected||0})),await $(E)}catch(e){B(z(e))}finally{G(``)}}},Ye=async()=>{if(Ge&&await n({title:C(`memory:memoryPage.deleteMemorySpace`),message:C(`memory:memoryPage.deleteMemorySpaceNameAndAllMemoriesInIt`,{name:R(Ge,C)}),confirmLabel:C(`memory:memoryPage.delete`)}))try{await i(`/api/memory/spaces/${encodeURIComponent(Ge.id)}`,{method:`DELETE`}),D(``),A(``),e(C(`memory:memoryPage.memorySpaceDeleted`))}catch(e){B(z(e))}},Xe=C(`navigation:navigation.memory`),Ze=R(Ge,C),Qe=e=>{A(e),requestAnimationFrame(()=>M.current?.scrollIntoView({block:`nearest`}))},$e=(e,t)=>{let n=We(e.id);return(0,k.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3`,children:[t&&(0,k.jsxs)(`header`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,k.jsx)(`h3`,{className:`text-[15px] leading-6 font-medium break-words text-content`,children:e.title}),(0,k.jsx)(`p`,{className:`text-[13px] leading-normal break-words text-content-secondary`,children:e.content})]}),(0,k.jsxs)(`dl`,{children:[(0,k.jsxs)(`div`,{className:L,children:[(0,k.jsx)(`dt`,{children:C(`memory:memoryPage.memoryType`)}),(0,k.jsxs)(`dd`,{className:`inline-flex items-center justify-end gap-2`,children:[(0,k.jsx)(ve,{type:e.type}),Se(e.type,C)]})]}),(0,k.jsxs)(`div`,{className:L,children:[(0,k.jsx)(`dt`,{children:C(`memory:memoryPage.source`)}),(0,k.jsx)(`dd`,{children:e.sourceType===`conversation_confirmed`?C(`memory:memoryPage.userConfirmedConversationCandidate`):e.sourceType===`user_confirmed`?C(`memory:memoryPage.explicitUserRequest`):e.sourceType===`agent`?C(`memory:memoryPage.createdByAgent`):C(`memory:memoryPage.addedManually`)})]}),(0,k.jsxs)(`div`,{className:L,children:[(0,k.jsx)(`dt`,{children:C(`memory:memoryPage.authority`)}),(0,k.jsxs)(`dd`,{className:`tabular-nums`,children:[e.authority??0,`/100`]})]}),e.evidence&&(0,k.jsxs)(`div`,{className:L,children:[(0,k.jsx)(`dt`,{children:C(`memory:memoryPage.evidence`)}),(0,k.jsx)(`dd`,{title:e.evidence,children:e.evidence})]}),(0,k.jsxs)(`div`,{className:L,children:[(0,k.jsx)(`dt`,{children:C(`memory:memoryPage.created`)}),(0,k.jsx)(`dd`,{className:`tabular-nums`,children:Ce(e.createdAt,w)})]}),(0,k.jsxs)(`div`,{className:L,children:[(0,k.jsx)(`dt`,{children:C(`memory:memoryPage.relatedMemories`)}),(0,k.jsx)(`dd`,{className:`tabular-nums`,children:C(`memory:memoryPage.count`,{count:n.count})})]})]}),(0,k.jsxs)(`div`,{className:`flex flex-wrap justify-end gap-2`,children:[(0,k.jsxs)(v,{variant:`ghost`,size:`sm`,className:`text-danger hover:bg-danger-soft hover:text-danger max-[650px]:h-11`,onClick:()=>void Ke(e),children:[(0,k.jsx)(p,{}),C(`memory:memoryPage.delete`)]}),(0,k.jsxs)(v,{variant:`secondary`,size:`sm`,className:`max-[650px]:h-11`,onClick:()=>H(e),children:[(0,k.jsx)(l,{}),C(`memory:memoryPage.edit`)]})]}),(0,k.jsxs)(`section`,{className:`min-w-0`,"aria-label":C(`memory:memoryPage.relatedFiles`),children:[(0,k.jsxs)(`h4`,{className:`mb-1 text-xs font-medium text-content-muted tabular-nums`,children:[C(`memory:memoryPage.relatedFiles`),` · `,n.files.length]}),n.files.length?(0,k.jsx)(`ul`,{className:`divide-y divide-stroke-soft border-t border-stroke-soft`,children:n.files.map(t=>(0,k.jsxs)(`li`,{className:`file-row grid min-h-11 min-w-0 grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-2.5 py-1`,children:[(0,k.jsx)(s,{className:`size-4 text-content-muted`,"aria-hidden":`true`}),(0,k.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,k.jsx)(`strong`,{className:`truncate text-sm font-medium text-content`,children:t.title}),(0,k.jsx)(`small`,{className:`truncate font-mono text-xs text-content-muted`,children:t.sourcePath||t.cwd||C(`memory:memoryPage.localMemory`)})]}),(0,k.jsxs)(`span`,{className:`flex items-center`,children:[t.id!==e.id&&(0,k.jsx)(v,{variant:`ghost`,size:`sm`,className:`max-[650px]:h-11`,onClick:()=>j===`galaxy`?A(t.id):_e(t.id),children:C(`memory:memoryPage.view`)}),(0,k.jsx)(v,{variant:`ghost`,size:`icon-sm`,className:`max-[650px]:size-11`,"aria-label":`${C(`memory:memoryPage.edit`)}: ${t.title}`,onClick:()=>H(t),children:(0,k.jsx)(l,{})}),(0,k.jsx)(v,{variant:`ghost`,size:`icon-sm`,className:`text-content-muted hover:bg-danger-soft hover:text-danger max-[650px]:size-11`,"aria-label":`${C(`memory:memoryPage.delete`)}: ${t.title}`,onClick:()=>void Ke(t),children:(0,k.jsx)(p,{})})]})]},t.id))}):(0,k.jsx)(`p`,{className:`text-xs text-content-muted`,children:C(`memory:memoryPage.thisMemoryHasNoRelatedFiles`)})]})]})};return(0,k.jsxs)(le,{title:Xe,description:C(`memory:memoryPage.lede`),back:t&&{label:C(`navigation:sidebar.features`),ariaLabel:C(`navigation:shell.backToFeaturesLabel`),onBack:t},toolbar:(0,k.jsx)(ue,{search:(0,k.jsx)(ae,{id:h,value:x,onValueChange:re,placeholder:C(`navigation:pageHeader.searchMemoriesOrFiles`),shortcut:a,clearLabel:C(`navigation:more.clearSearch`)}),actions:(0,k.jsxs)(v,{type:`button`,className:`h-9`,disabled:!I,onClick:()=>H({spaceId:E||T.selectedSpaceId}),children:[(0,k.jsx)(u,{}),C(`memory:memoryPage.addMemory`)]}),filters:(0,k.jsx)(fe,{options:[C(`memory:memoryPage.galaxyView`),C(`memory:memoryPage.listView`)],value:C(j===`galaxy`?`memory:memoryPage.galaxyView`:`memory:memoryPage.listView`),onChange:e=>ye(e===C(`memory:memoryPage.listView`)?`list`:`galaxy`)})}),children:[!I&&P?(0,k.jsx)(S,{kind:`loading`,title:C(`common:pageTemplate.loading`)}):I?(0,k.jsxs)(k.Fragment,{children:[De&&(0,k.jsx)(de,{children:De}),(0,k.jsx)(ce,{title:C(`memory:memoryPage.memorySpaces`),count:T.spaces.length,actions:(0,k.jsxs)(v,{variant:`ghost`,size:`sm`,onClick:()=>U({}),children:[(0,k.jsx)(u,{}),C(`memory:memoryPage.newMemorySpace`)]}),children:(0,k.jsx)(se,{children:T.spaces.map(e=>{let t=e.id===E;return(0,k.jsx)(oe,{"data-memory-space":e.id,"aria-current":t||void 0,className:ne(`relative`,t&&`after:absolute after:top-3.5 after:bottom-3.5 after:-left-3 after:w-[3px] after:rounded-r-[3px] after:bg-star max-[650px]:after:-left-2.5`),icon:(0,k.jsx)(f,{}),onOpen:()=>{D(e.id),A(``),_e(``)},name:R(e,C),status:C(`memory:memoryPage.countMemories`,{count:e.nodeCount}),actions:t&&(0,k.jsxs)(`div`,{className:`memory-space-actions flex items-center gap-1`,children:[(0,k.jsxs)(v,{variant:`ghost`,size:`sm`,onClick:()=>U(e),children:[(0,k.jsx)(l,{}),C(`memory:memoryPage.rename`)]}),e.kind!==`global`&&(0,k.jsxs)(v,{variant:`ghost`,size:`sm`,className:`text-danger hover:bg-danger-soft hover:text-danger`,onClick:()=>void Ye(),children:[(0,k.jsx)(p,{}),C(`memory:memoryPage.delete`)]})]})},e.id)})})}),(0,k.jsx)(ce,{"data-memory-stars":!0,title:Ze||C(`memory:memoryPage.memorySpaces`),count:T.nodes.length,actions:(0,k.jsx)(v,{variant:`ghost`,size:`icon-sm`,className:`text-content-muted max-[650px]:size-11 pointer-coarse:size-11`,loading:P,disabled:P,"aria-label":C(`memory:memoryPage.refresh`),title:C(`memory:memoryPage.refresh`),onClick:()=>void $(E),children:(0,k.jsx)(d,{})}),children:j===`galaxy`?(0,k.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3`,children:[(0,k.jsx)(be,{nodes:T.nodes,links:T.links,spaceId:E,selectedId:he,loading:P,onSelect:Qe,onAdd:()=>H({spaceId:E})}),(0,k.jsx)(`div`,{role:`group`,"aria-label":C(`memory:memoryPage.memoryMapTypes`),className:`galaxy-legend flex flex-wrap gap-x-4 gap-y-1.5`,children:xe.map(e=>(0,k.jsxs)(`span`,{className:`flex items-center gap-1.5 text-xs text-content-secondary`,children:[(0,k.jsx)(ve,{type:e}),Se(e,C)]},e))}),(0,k.jsx)(`div`,{ref:M,role:`region`,"data-memory-detail":!0,"aria-label":C(`memory:memoryPage.selectedMemory`),className:`min-w-0 scroll-mb-4 rounded-[var(--r-md)] border border-stroke px-4 py-3`,children:Ue?$e(Ue,!0):(0,k.jsx)(`p`,{className:`text-xs leading-normal text-content-muted`,children:C(`memory:memoryPage.selectAMemoryInTheMapToViewItsDetails`)})})]}):T.nodes.length?(0,k.jsx)(se,{children:T.nodes.map(e=>(0,k.jsx)(oe,{"data-memory-node":e.id,icon:(0,k.jsx)(ve,{type:e.type}),name:e.title,nameMeta:Se(e.type,C),description:e.content,expanded:ge===e.id,onExpandedChange:t=>_e(t?e.id:``),toggleLabel:e.title,detail:$e(e,!1)},e.id))}):(0,k.jsx)(ie,{title:x.trim()?C(`memory:memoryPage.noMatchingMemories`):C(`memory:memoryPage.noMemoriesInSpace`)})}),(0,k.jsxs)(ce,{title:C(`memory:memoryPage.memoryDrafts`),count:T.candidates?.length||0,actions:!!T.candidates?.length&&(0,k.jsxs)(v,{variant:`ghost`,size:`sm`,disabled:!!W,onClick:()=>void Je(),children:[(0,k.jsx)(m,{}),C(`memory:memoryPage.ignoreAll`)]}),children:[Ne&&(0,k.jsxs)(`p`,{role:`status`,className:`flex items-center gap-2 py-2 text-xs text-content-muted`,children:[(0,k.jsx)(_,{className:`size-3.5`}),C(`memory:memoryPage.loadingAutoApproveThreshold`)]}),Ae&&(0,k.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 py-2`,children:[(0,k.jsxs)(pe,{className:`my-0`,children:[C(`memory:memoryPage.autoApproveThresholdUnavailable`),` `,Ae]}),(0,k.jsx)(v,{variant:`secondary`,size:`sm`,className:`max-[650px]:h-11`,disabled:Ne||ze,onClick:()=>void(je===`save`?He():Ve()),children:C(`memory:memoryPage.retryAutoApproveThreshold`)})]}),K!==null&&(0,k.jsxs)(`div`,{className:`memory-auto-approve-row flex min-h-12 items-center justify-between gap-3 border-t border-stroke py-1.5`,children:[(0,k.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 text-sm font-medium text-content`,children:[(0,k.jsx)(`span`,{children:C(`memory:memoryPage.autoApproveThreshold`)}),(0,k.jsxs)(te,{children:[(0,k.jsx)(ee,{asChild:!0,children:(0,k.jsx)(c,{className:`size-3.5 shrink-0 text-content-muted`})}),(0,k.jsx)(g,{align:`center`,side:`top`,children:C(`memory:memoryPage.autoApproveThresholdHint`)})]})]}),(0,k.jsxs)(`span`,{className:`memory-auto-approve-input flex flex-none items-center gap-1.5 text-xs text-content-muted`,children:[(0,k.jsx)(b,{type:`number`,min:0,max:100,step:5,className:`h-7 w-16 text-right tabular-nums max-[650px]:h-11`,value:K,"aria-busy":ze,"aria-label":C(`memory:memoryPage.autoApproveThreshold`),onChange:e=>{Y.current+=1,ke(e.target.value)},onBlur:()=>void He(),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),He())}}),`%`,ze&&(0,k.jsx)(_,{className:`size-3.5`})]})]}),T.candidates?.length?(0,k.jsx)(se,{children:T.candidates.map(e=>(0,k.jsx)(oe,{className:`memory-candidate`,name:e.title,description:e.content,meta:(0,k.jsxs)(`span`,{className:`truncate tabular-nums`,children:[R(T.spaces.find(t=>t.id===e.spaceId),C),` · `,e.sourceType===`agent`?C(`memory:memoryPage.agentProposed`):C(`memory:memoryPage.conversationExtracted`),` · `,C(`memory:memoryPage.confidencePercent`,{value:Math.round((e.confidence||0)*100)})]}),actions:(0,k.jsxs)(k.Fragment,{children:[(0,k.jsxs)(v,{variant:`secondary`,size:`sm`,disabled:!!W,onClick:()=>void qe(e,`accept`),children:[(0,k.jsx)(o,{}),C(`memory:memoryPage.confirm`)]}),(0,k.jsxs)(v,{variant:`ghost`,size:`sm`,disabled:!!W,onClick:()=>void qe(e,`reject`),children:[(0,k.jsx)(m,{}),C(`memory:memoryPage.ignore`)]})]}),detail:(0,k.jsxs)(`div`,{className:`flex flex-col gap-0.5 text-xs leading-[1.5] text-content-muted`,children:[e.topicKey&&(0,k.jsxs)(`span`,{children:[C(`memory:memoryPage.topic`),`:`,(0,k.jsx)(`code`,{className:`font-mono`,children:e.topicKey})]}),e.evidence&&(0,k.jsxs)(`span`,{className:`[overflow-wrap:anywhere]`,children:[C(`memory:memoryPage.evidence`),`:`,e.evidence]}),(0,k.jsxs)(`span`,{className:`tabular-nums`,children:[C(`memory:memoryPage.created`),`:`,Ce(e.createdAt,w),e.expiresAt?` · ${C(`memory:memoryPage.expires`)}:${Ce(e.expiresAt,w)}`:``]})]})},e.id))}):(0,k.jsx)(`p`,{className:`border-t border-stroke py-3 text-xs text-content-muted`,children:C(`memory:memoryPage.thereAreNoPendingMemoryCandidates`)})]})]}):(0,k.jsx)(S,{kind:`error`,title:C(`memory:memoryPage.loadFailed`),description:De,action:(0,k.jsx)(v,{variant:`secondary`,className:`max-[650px]:h-11`,onClick:()=>void $(E),children:C(`common:pageTemplate.retry`)})}),V&&(0,k.jsx)(Te,{spaces:T.spaces,node:V.id?V:null,initialSpaceId:V.spaceId||E,onClose:()=>H(null),onSaved:async t=>{H(null),e(t),await $(E)}}),Oe&&(0,k.jsx)(Ee,{space:Oe.id?Oe:null,onClose:()=>U(null),onSaved:async(t,n)=>{U(null),D(t.id),e(n)}})]})}function Te({spaces:e,node:t,initialSpaceId:n,onClose:a,onSaved:o}){let{t:s}=r(),[c,u]=(0,O.useState)({spaceId:t?.spaceId||n||e[0]?.id||``,title:t?.title||``,content:t?.content||``,type:t?.type||`concept`,sourcePath:t?.sourcePath||``,importance:t?.importance??.5}),[d,f]=(0,O.useState)(!1),[p,h]=(0,O.useState)(``);return(0,k.jsx)(`div`,{className:F,onMouseDown:e=>!d&&e.target===e.currentTarget&&a(),children:(0,k.jsxs)(`form`,{role:`dialog`,"aria-modal":`true`,"aria-label":s(t?`memory:memoryPage.editMemory`:`memory:memoryPage.addMemory`),className:I,onSubmit:async e=>{if(e.preventDefault(),!d){f(!0),h(``);try{await i(t?`/api/memory/nodes/${encodeURIComponent(t.id)}`:`/api/memory/nodes`,{method:t?`PATCH`:`POST`,body:JSON.stringify(c)}),await o(s(t?`memory:memoryPage.memoryUpdated`:`memory:memoryPage.memoryCreated`))}catch(e){h(z(e))}finally{f(!1)}}},children:[(0,k.jsxs)(T,{className:`[&_h2]:text-[15px] [&_h2]:font-medium`,children:[(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`h2`,{children:s(t?`memory:memoryPage.editMemory`:`memory:memoryPage.addMemory`)}),(0,k.jsx)(`p`,{children:s(`memory:memoryPage.lightUpIdeasWorthKeepingAsMemoriesYouCanReturnToLater`)})]}),(0,k.jsx)(v,{type:`button`,variant:`ghost`,size:`icon`,className:`-mt-1 -mr-1 max-[650px]:size-11`,"aria-label":s(`memory:memoryPage.closeDialog`),disabled:d,onClick:a,children:(0,k.jsx)(m,{})})]}),(0,k.jsxs)(C,{variant:`control`,children:[s(`memory:memoryPage.memorySpace`),(0,k.jsx)(w,{value:c.spaceId,onChange:e=>u({...c,spaceId:e.target.value}),children:e.map(e=>(0,k.jsx)(`option`,{value:e.id,children:R(e,s)},e.id))})]}),(0,k.jsxs)(C,{variant:`control`,children:[s(`memory:memoryPage.memoryTitle`),(0,k.jsx)(b,{value:c.title,onChange:e=>u({...c,title:e.target.value}),placeholder:s(`memory:memoryPage.forExampleProjectUIConstraints`)})]}),(0,k.jsxs)(C,{variant:`control`,children:[s(`memory:memoryPage.memoryContent`),(0,k.jsx)(x,{value:c.content,onChange:e=>u({...c,content:e.target.value}),placeholder:s(`memory:memoryPage.recordStandaloneReusableMemoryForFutureChats`)})]}),(0,k.jsxs)(`div`,{className:`form-grid grid gap-x-2.5 sm:grid-cols-2`,children:[(0,k.jsxs)(C,{variant:`control`,children:[s(`memory:memoryPage.memoryType`),(0,k.jsx)(w,{value:c.type,onChange:e=>u({...c,type:e.target.value}),children:xe.map(e=>(0,k.jsx)(`option`,{value:e,children:Se(e,s)},e))})]}),(0,k.jsxs)(C,{variant:`control`,children:[s(`memory:memoryPage.importance`),(0,k.jsxs)(w,{value:c.importance,onChange:e=>u({...c,importance:Number(e.target.value)}),children:[(0,k.jsx)(`option`,{value:`0.3`,children:s(`memory:memoryPage.normal`)}),(0,k.jsx)(`option`,{value:`0.5`,children:s(`memory:memoryPage.common`)}),(0,k.jsx)(`option`,{value:`0.8`,children:s(`memory:memoryPage.important`)}),(0,k.jsx)(`option`,{value:`1`,children:s(`memory:memoryPage.strict`)})]})]})]}),(0,k.jsxs)(C,{variant:`control`,children:[s(`memory:memoryPage.relatedFilePath`),(0,k.jsx)(b,{value:c.sourcePath,onChange:e=>u({...c,sourcePath:e.target.value}),placeholder:s(`memory:memoryPage.optionalForExampleECodeProjectREADMEMd`)})]}),p&&(0,k.jsx)(pe,{children:p}),(0,k.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,k.jsx)(v,{type:`button`,variant:`secondary`,size:`dialogAction`,onClick:a,children:s(`memory:memoryPage.cancel`)}),(0,k.jsxs)(v,{type:`submit`,size:`dialogAction`,disabled:d||!c.spaceId||!c.title.trim()||!c.content.trim(),children:[d?(0,k.jsx)(_,{className:`text-current`}):(0,k.jsx)(l,{}),s(d?`memory:memoryPage.saving`:`memory:memoryPage.save`)]})]})]})})}function Ee({space:e,onClose:t,onSaved:n}){let{t:a}=r(),[o,s]=(0,O.useState)(e?.name||``),[c,l]=(0,O.useState)(!1),[d,f]=(0,O.useState)(``);return(0,k.jsx)(`div`,{className:F,onMouseDown:e=>!c&&e.target===e.currentTarget&&t(),children:(0,k.jsxs)(`form`,{role:`dialog`,"aria-modal":`true`,"aria-label":a(e?`memory:memoryPage.renameMemorySpace`:`memory:memoryPage.newMemorySpace`),className:I,onSubmit:async t=>{if(t.preventDefault(),!c){l(!0),f(``);try{await n(await i(e?`/api/memory/spaces/${encodeURIComponent(e.id)}`:`/api/memory/spaces`,{method:e?`PATCH`:`POST`,body:JSON.stringify({name:o,kind:`custom`})}),a(e?`memory:memoryPage.memorySpaceRenamed`:`memory:memoryPage.memorySpaceCreated`))}catch(e){f(z(e))}finally{l(!1)}}},children:[(0,k.jsxs)(T,{className:`[&_h2]:text-[15px] [&_h2]:font-medium`,children:[(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`h2`,{children:a(e?`memory:memoryPage.renameMemorySpace`:`memory:memoryPage.newMemorySpace`)}),(0,k.jsx)(`p`,{children:a(`memory:memoryPage.giveEachThemeOrProjectItsOwnMemorySpaceSoDurableMemoriesHaveSomewhereToBelong`)})]}),(0,k.jsx)(v,{type:`button`,variant:`ghost`,size:`icon`,className:`-mt-1 -mr-1 max-[650px]:size-11`,"aria-label":a(`memory:memoryPage.closeDialog`),disabled:c,onClick:t,children:(0,k.jsx)(m,{})})]}),(0,k.jsxs)(C,{variant:`control`,children:[a(`memory:memoryPage.memorySpaceName`),(0,k.jsx)(b,{value:o,onChange:e=>s(e.target.value),placeholder:a(`memory:memoryPage.forExampleProductDesignGuidelines`),autoFocus:!0})]}),d&&(0,k.jsx)(pe,{children:d}),(0,k.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,k.jsx)(v,{type:`button`,variant:`secondary`,size:`dialogAction`,onClick:t,children:a(`memory:memoryPage.cancel`)}),(0,k.jsxs)(v,{type:`submit`,size:`dialogAction`,disabled:c||!o.trim(),children:[c?(0,k.jsx)(_,{className:`text-current`}):(0,k.jsx)(u,{}),a(c?`memory:memoryPage.saving`:`memory:memoryPage.save`)]})]})]})})}export{we as MemoryPage};
1
+ import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t,r as n}from"./vendor-react-DwNgTV1j.js";import{t as r}from"./use-i18n-B2p84ZNR.js";import{t as i}from"./api-CIB7ZPX3.js";import{t as a}from"./createLucideIcon-Cd-3GVxJ.js";import{t as o}from"./check-2vYc6QaP.js";import{t as s}from"./file-code-corner-BnE1ljT0.js";import{t as c}from"./info-DATxy0fb.js";import{t as l}from"./pencil-U08v_vV9.js";import{t as u}from"./plus-fQbSqB1n.js";import{t as d}from"./refresh-cw-TbWxTY4K.js";import{t as f}from"./sparkles-S_eeuqn9.js";import{t as p}from"./trash-2-CNrPOoPR.js";import{t as m}from"./x-07u4-129.js";import{t as h}from"./more-pages-D_PnxLN0.js";import{i as ee,n as g,t as te}from"./tooltip-D4MFbqcG.js";import{t as ne}from"./utils-C8uzG5AZ.js";import{n as _,t as v}from"./button-CCcCN8tE.js";import{s as y}from"./shortcuts-DXHroTTi.js";import{t as b}from"./input-CPw-zkYh.js";import{t as x}from"./textarea-DmATpOqT.js";import{n as S,r as re,t as ie}from"./PageState-Cz6vFMXv.js";import{a as ae,i as oe,n as se,o as ce,r as le,s as ue,t as de}from"./FeaturePage-DT_WfUIg.js";import{n as C}from"./field-DoLEb0np.js";import{t as w}from"./AppSelect-BD6RAaJ5.js";import{c as fe,i as pe,n as T,t as me}from"./app-primitives-Drz_SjnR.js";var E=a(`zoom-out`,[[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`line`,{x1:`21`,x2:`16.65`,y1:`21`,y2:`16.65`,key:`13gj7c`}],[`line`,{x1:`8`,x2:`14`,y1:`11`,y2:`11`,key:`durymu`}]]),D=a(`zoom-in`,[[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`line`,{x1:`21`,x2:`16.65`,y1:`21`,y2:`16.65`,key:`13gj7c`}],[`line`,{x1:`11`,x2:`11`,y1:`8`,y2:`14`,key:`1vmskp`}],[`line`,{x1:`8`,x2:`14`,y1:`11`,y2:`11`,key:`durymu`}]]),O=e(t(),1);function he(e={}){let{rootMargin:t=`96px 0px`,threshold:n=0}=e,[r,i]=(0,O.useState)(null),[a,o]=(0,O.useState)(()=>!document.hidden),[s,c]=(0,O.useState)(!0),l=(0,O.useCallback)(e=>{i(e)},[]);return(0,O.useEffect)(()=>{let e=()=>o(!document.hidden);return e(),document.addEventListener(`visibilitychange`,e),()=>document.removeEventListener(`visibilitychange`,e)},[]),(0,O.useEffect)(()=>{if(!r||typeof IntersectionObserver>`u`)return;let e=new IntersectionObserver(([e])=>{e&&c(e.isIntersecting)},{rootMargin:t,threshold:n});return e.observe(r),()=>e.disconnect()},[r,t,n]),{ref:l,playing:a&&s}}var k=n(),A={width:600,height:420,cx:300,cy:206},ge=24,_e=Math.PI*(3-Math.sqrt(5));function ve({type:e}){return(0,k.jsx)(`i`,{"aria-hidden":`true`,className:`g-dot g-${e} inline-block size-2 shrink-0 rounded-full ring-1 ring-stroke`,style:{background:j[e]}})}var j={concept:`var(--g-concept)`,file:`var(--g-file)`,risk:`var(--g-risk)`,preference:`var(--g-preference)`,decision:`var(--g-decision)`,fact:`var(--g-fact)`,task:`var(--g-task)`},ye={concept:`var(--g-concept-glow)`,file:`var(--g-file-glow)`,risk:`var(--g-risk-glow)`,preference:`var(--g-preference-glow)`,decision:`var(--g-decision-glow)`,fact:`var(--g-fact-glow)`,task:`var(--g-task-glow)`};function M(e){let t=0;for(let n=0;n<e.length;n+=1)t=t*31+e.charCodeAt(n)>>>0;return t}function N(e,t){let n=e.slice(0,ge);if(!n.length)return[];if(n.length===1)return[{node:n[0],x:A.cx,y:A.cy,twinkle:0}];let r=M(t||`galaxy`)%628/100,i=172/Math.sqrt(n.length);return n.map((e,t)=>{let n=M(e.id),a=t*_e+r,o=i*Math.sqrt(t+.55)+n%11-5;return{node:e,x:A.cx+Math.cos(a)*o*1.38,y:A.cy+Math.sin(a)*o*.74,twinkle:n%50/10}})}function P(e,t,n){let r=t.x-e.x,i=t.y-e.y,a=Math.hypot(r,i)||1,o=Math.min(24,a*.16)*(n%2==0?1:-1),s=(e.x+t.x)/2-i/a*o,c=(e.y+t.y)/2+r/a*o;return`M ${e.x.toFixed(1)} ${e.y.toFixed(1)} Q ${s.toFixed(1)} ${c.toFixed(1)} ${t.x.toFixed(1)} ${t.y.toFixed(1)}`}function be({nodes:e,links:t,spaceId:n,selectedId:i,loading:a,onSelect:o,onAdd:s}){let{t:c}=r(),[l,d]=(0,O.useState)(1),[f,p]=(0,O.useState)(``),m=(0,O.useRef)(null),h=(0,O.useRef)(0),{ref:ee,playing:g}=he(),te=(0,O.useCallback)(e=>{m.current=e,ee(e)},[ee]),ne=g?``:`[&:before]:[animation-play-state:paused]! [&:after]:[animation-play-state:paused]! [&_*]:[animation-play-state:paused]! [&_*:before]:[animation-play-state:paused]! [&_*:after]:[animation-play-state:paused]!`,_=e=>{if(!g)return;let t=m.current;if(!t)return;let n=t.getBoundingClientRect(),r=((e.clientX-n.left)/n.width-.5)*2,i=((e.clientY-n.top)/n.height-.5)*2;cancelAnimationFrame(h.current),h.current=requestAnimationFrame(()=>{t.style.setProperty(`--px`,r.toFixed(3)),t.style.setProperty(`--py`,i.toFixed(3))})},v=()=>{cancelAnimationFrame(h.current),m.current?.style.setProperty(`--px`,`0`),m.current?.style.setProperty(`--py`,`0`)};(0,O.useEffect)(()=>{g||(cancelAnimationFrame(h.current),h.current=0)},[g]),(0,O.useEffect)(()=>{let e=m.current?.querySelector(`svg`);e&&(g?e.unpauseAnimations():e.pauseAnimations())},[g]);let y=(0,O.useMemo)(()=>N(e,n),[e,n]),b=(0,O.useMemo)(()=>new Map(y.map(e=>[e.node.id,e])),[y]),x=(0,O.useMemo)(()=>{let e=new Set(y.map(e=>e.node.id));return t.filter(t=>e.has(t.sourceId)&&e.has(t.targetId))},[y,t]),S=f||i,ie=new Set(t.flatMap(e=>e.sourceId===S?[e.targetId]:e.targetId===S?[e.sourceId]:[]));return(0,k.jsxs)(me,{className:`graph-panel before:[content:''] before:absolute before:z-[0] before:inset-0 before:pointer-events-none before:bg-[url('/memory-galaxy-background.webp')] before:[background-position:center_48%] before:[background-size:cover] before:bg-no-repeat before:[filter:saturate(.62)_contrast(1.08)] before:[mix-blend-mode:screen] before:opacity-[.42] after:[content:''] after:absolute after:z-[0] after:inset-0 after:pointer-events-none after:[background-image:radial-gradient(var(--galaxy-dot)_.9px,transparent_1.2px),_radial-gradient(var(--galaxy-dot-dim)_.8px,transparent_1.2px),_radial-gradient(var(--galaxy-dot)_1.2px,transparent_1.6px)] after:[background-position:0_0,_37px_53px,_71px_19px] after:[background-size:96px_96px,_152px_152px,_236px_236px] after:[animation:galaxy-field-twinkle_6.4s_ease-in-out_infinite] after:opacity-[.7] before:inset-[-8%] before:[animation:galaxy-background-drift_34s_ease-in-out_infinite_alternate] before:[will-change:transform] after:[animation:galaxy-field-drift_15s_ease-in-out_infinite_alternate] after:[will-change:background-position,opacity] max-[650px]:min-h-[430px] relative min-h-[500px] overflow-hidden [border-color:var(--galaxy-border)] bg-[var(--galaxy-bg)]! [background-image:radial-gradient(ellipse_46%_40%_at_50%_48%,_var(--galaxy-core),_transparent_72%),_radial-gradient(ellipse_62%_48%_at_16%_6%,_var(--galaxy-nebula-a),_transparent_70%),_radial-gradient(ellipse_56%_52%_at_88%_98%,_var(--galaxy-nebula-b),_transparent_72%)] p-0 backdrop-blur-none! galaxy-panel ${ne}`,onPointerMove:_,onPointerLeave:v,children:[(0,k.jsxs)(`div`,{className:`graph-toolbar absolute top-2.5 left-2.5 z-[4] flex gap-0.5 rounded-sm border border-[var(--galaxy-toolbar-border)] bg-[var(--galaxy-toolbar-bg)] p-0.5 text-[var(--galaxy-toolbar-text)] [&_button]:grid [&_button]:size-7 [&_button]:place-items-center [&_button]:rounded-xs [&_button]:transition-colors [&_button]:duration-(--d-fast) [&_button:hover]:bg-[var(--galaxy-toolbar-hover)] max-[650px]:[&_button]:size-11 [&_svg]:size-3.5`,children:[(0,k.jsx)(`button`,{type:`button`,title:c(`memory:memoryPage.addMemory`),"aria-label":c(`memory:memoryPage.addMemory`),onClick:s,children:(0,k.jsx)(u,{})}),(0,k.jsx)(`button`,{type:`button`,title:c(`memory:memoryPage.zoomIn`),"aria-label":c(`memory:memoryPage.zoomIn`),onClick:()=>d(e=>Math.min(1.6,Number((e+.15).toFixed(2)))),children:(0,k.jsx)(D,{})}),(0,k.jsx)(`button`,{type:`button`,title:c(`memory:memoryPage.zoomOut`),"aria-label":c(`memory:memoryPage.zoomOut`),onClick:()=>d(e=>Math.max(.7,Number((e-.15).toFixed(2)))),children:(0,k.jsx)(E,{})})]}),(0,k.jsxs)(`div`,{className:`galaxy-stage [&_>_svg]:absolute [&_>_svg]:inset-0 [&_>_svg]:w-full [&_>_svg]:h-full [&_>_svg]:overflow-visible [&_>_svg]:z-[1] [&_>_svg]:[transform:translate3d(calc(var(--px,0)_*_9px),calc(var(--py,0)_*_6px),0)] [&_>_svg]:[transition:transform_.9s_var(--ease-out)] absolute z-[1] inset-0 [transform-origin:50%_50%] [transition:transform_var(--d2)_var(--ease-out)] ${S?`has-focus`:``}`,ref:te,style:{transform:`scale(${l})`},children:[(0,k.jsx)(`i`,{className:`galaxy-spiral absolute z-[0] block pointer-events-none [left:9%] [top:13%] w-[82%] h-[74%] rounded-[50%] bg-[conic-gradient(from_-18deg,transparent_0deg,var(--galaxy-nebula-a)_28deg,transparent_68deg,var(--galaxy-nebula-b)_118deg,transparent_170deg,var(--galaxy-nebula-a)_224deg,transparent_278deg,var(--galaxy-nebula-b)_322deg,transparent_360deg)] [filter:blur(13px)] [mask-image:radial-gradient(ellipse,transparent_0%,transparent_15%,var(--g-star-core)_38%,transparent_74%)] [-webkit-mask-image:radial-gradient(ellipse,transparent_0%,transparent_15%,var(--g-star-core)_38%,transparent_74%)] [mix-blend-mode:screen] opacity-[.38] [animation:galaxy-spiral-turn_42s_linear_infinite] [will-change:transform]`,"aria-hidden":`true`}),(0,k.jsx)(`i`,{className:`galaxy-core absolute z-[0] block pointer-events-none before:[content:''] before:absolute before:left-[50%] before:top-[50%] before:w-[46px] before:h-[46px] before:rounded-[50%] before:bg-[radial-gradient(circle,rgba(255,255,255,.82),rgba(191,219,254,.3)_55%,transparent_76%)] before:[filter:blur(6px)] before:[transform:translate(-50%,-50%)] [left:50%] [top:49%] w-[34%] h-[40%] rounded-[50%] bg-[radial-gradient(ellipse,rgba(219,232,255,.3)_0%,rgba(126,156,255,.15)_36%,transparent_70%)] [filter:blur(9px)] [mix-blend-mode:screen] [transform:translate(-50%,-50%)] [animation:galaxy-core-breathe_7.5s_ease-in-out_infinite] [will-change:transform,opacity]`,"aria-hidden":`true`}),(0,k.jsx)(`i`,{className:`galaxy-aurora absolute z-[0] block pointer-events-none w-[46%] h-[31%] rounded-[50%] [filter:blur(21px)] [mix-blend-mode:screen] opacity-[.42] [will-change:transform,opacity] [left:8%] [top:20%] bg-[radial-gradient(ellipse,var(--galaxy-nebula-a),transparent_70%)] [animation:galaxy-aurora-drift_18s_ease-in-out_infinite_alternate]`,"aria-hidden":`true`}),(0,k.jsx)(`i`,{className:`galaxy-aurora absolute z-[0] block pointer-events-none w-[46%] h-[31%] rounded-[50%] [filter:blur(21px)] [mix-blend-mode:screen] opacity-[.42] [will-change:transform,opacity] [right:5%] [bottom:14%] bg-[radial-gradient(ellipse,var(--galaxy-nebula-b),transparent_70%)] [animation:galaxy-aurora-drift_23s_ease-in-out_-9s_infinite_alternate-reverse]`,"aria-hidden":`true`}),(0,k.jsx)(`i`,{className:`galaxy-aurora absolute z-[0] block pointer-events-none w-[46%] h-[31%] rounded-[50%] [filter:blur(21px)] [mix-blend-mode:screen] opacity-[.42] [will-change:transform,opacity] galaxy-aurora-three left-[30%] top-[60%] !w-[40%] !h-[27%] bg-[radial-gradient(ellipse,var(--galaxy-nebula-c),transparent_70%)] [animation:galaxy-aurora-drift_27s_ease-in-out_-14s_infinite_alternate]`,"aria-hidden":`true`}),(0,k.jsxs)(`svg`,{viewBox:`0 0 600 420`,preserveAspectRatio:`none`,"aria-hidden":`true`,children:[(0,k.jsxs)(`g`,{className:`galaxy-orbits [&_ellipse]:[fill:none] [&_ellipse]:[stroke:var(--galaxy-line)] [&_ellipse]:[stroke-width:.72] [&_ellipse]:[stroke-dasharray:3_7] [&_ellipse]:opacity-[.52] [transform-box:fill-box] [transform-origin:center] [animation:galaxy-orbit-drift_90s_linear_infinite]`,children:[(0,k.jsx)(`ellipse`,{cx:`300`,cy:`206`,rx:`205`,ry:`122`,transform:`rotate(-8 300 206)`}),(0,k.jsx)(`ellipse`,{cx:`300`,cy:`206`,rx:`154`,ry:`88`,transform:`rotate(18 300 206)`}),(0,k.jsx)(`ellipse`,{cx:`300`,cy:`206`,rx:`95`,ry:`54`,transform:`rotate(-24 300 206)`})]}),(0,k.jsx)(`defs`,{children:x.map((e,t)=>{let n=b.get(e.sourceId),r=b.get(e.targetId);return!n||!r?null:(0,k.jsxs)(`linearGradient`,{id:`lg-${t}`,gradientUnits:`userSpaceOnUse`,x1:n.x,y1:n.y,x2:r.x,y2:r.y,children:[(0,k.jsx)(`stop`,{offset:`0`,stopColor:j[n.node.type]||`var(--galaxy-line-active)`}),(0,k.jsx)(`stop`,{offset:`1`,stopColor:j[r.node.type]||`var(--galaxy-line-active)`})]},e.id)})}),x.map((e,t)=>{let n=b.get(e.sourceId),r=b.get(e.targetId);if(!n||!r)return null;let i=e.sourceId===S||e.targetId===S,a=P(n,r,M(e.id));return(0,k.jsxs)(`g`,{children:[(0,k.jsx)(`path`,{className:`link-path [.galaxy-stage_>_svg_&]:[fill:none] [.galaxy-stage_>_svg_&]:[stroke-width:1.05] [.galaxy-stage_>_svg_&]:[stroke-dasharray:3_5] [.galaxy-stage_>_svg_&]:opacity-[.5] [.galaxy-stage_>_svg_&]:[animation:galaxy-link-flow_30s_linear_infinite] [.galaxy-stage_>_svg_&]:[transition:opacity_var(--d2)_var(--ease-out)] [.galaxy-stage_>_svg_&.active]:[stroke-width:1.55] [.galaxy-stage_>_svg_&.active]:[stroke-dasharray:none] [.galaxy-stage_>_svg_&.active]:opacity-100 [.galaxy-stage_>_svg_&.active]:[filter:drop-shadow(0_0_3.5px_var(--galaxy-line-active))] [.galaxy-stage.has-focus_&]:opacity-[.14] [.galaxy-stage.has-focus_&.active]:opacity-100 ${i?`active`:``}`,d:a,stroke:`url(#lg-${t})`}),i&&(0,k.jsx)(`circle`,{className:`link-pulse [.galaxy-stage_>_svg_&]:[fill:var(--g-star-core)] [.galaxy-stage_>_svg_&]:[filter:drop-shadow(0_0_4px_var(--galaxy-line-active))] [.galaxy-stage_>_svg_&]:pointer-events-none`,r:`2.1`,children:(0,k.jsx)(`animateMotion`,{dur:`2.8s`,repeatCount:`indefinite`,path:a})})]},e.id)})]}),(0,k.jsx)(`i`,{className:`galaxy-meteor before:[content:''] before:absolute before:top-[50%] before:left-[1px] before:w-[72px] before:h-[1px] before:bg-[linear-gradient(90deg,transparent,var(--galaxy-dot))] before:[transform:translateY(-50%)] absolute [top:14%] [left:80%] w-[2.4px] h-[2.4px] rounded-[50%] bg-[var(--galaxy-label-active)] shadow-[0_0_7px_1px_var(--galaxy-dot)] opacity-0 pointer-events-none [animation:galaxy-meteor_12s_linear_infinite] z-[3]`,"aria-hidden":`true`}),(0,k.jsx)(`i`,{className:`galaxy-meteor before:[content:''] before:absolute before:top-[50%] before:left-[1px] before:w-[72px] before:h-[1px] before:bg-[linear-gradient(90deg,transparent,var(--galaxy-dot))] before:[transform:translateY(-50%)] absolute [top:14%] [left:80%] w-[2.4px] h-[2.4px] rounded-[50%] bg-[var(--galaxy-label-active)] shadow-[0_0_7px_1px_var(--galaxy-dot)] opacity-0 pointer-events-none [animation:galaxy-meteor_12s_linear_infinite] z-[3] meteor-two [.galaxy-meteor&]:top-[63%] [.galaxy-meteor&]:left-[89%] [.galaxy-meteor&]:[animation:galaxy-meteor-b_17s_linear_4.5s_infinite]`,"aria-hidden":`true`}),(0,k.jsx)(`i`,{className:`galaxy-meteor before:[content:''] before:absolute before:top-[50%] before:left-[1px] before:w-[72px] before:h-[1px] before:bg-[linear-gradient(90deg,transparent,var(--galaxy-dot))] before:[transform:translateY(-50%)] absolute [top:14%] [left:80%] w-[2.4px] h-[2.4px] rounded-[50%] bg-[var(--galaxy-label-active)] shadow-[0_0_7px_1px_var(--galaxy-dot)] opacity-0 pointer-events-none [animation:galaxy-meteor_12s_linear_infinite] z-[3] meteor-three [.galaxy-meteor&]:top-[7%] [.galaxy-meteor&]:left-[36%] [.galaxy-meteor&]:[animation:galaxy-meteor-c_23s_linear_11s_infinite]`,"aria-hidden":`true`}),y.map(({node:e,x:t,y:n,twinkle:r},a)=>(0,k.jsxs)(`button`,{className:`galaxy-star focus-visible:rounded-[50%] focus-visible:[outline-color:var(--galaxy-line-active)] before:[content:''] before:absolute before:w-[calc(var(--star-size)_+_26px)] before:h-[calc(var(--star-size)_+_26px)] before:rounded-[50%] before:bg-[radial-gradient(circle,var(--g-star-glow),transparent_68%)] before:[filter:blur(3px)] before:opacity-[.76] before:pointer-events-none [&.active::after]:[content:''] [&.active::after]:absolute [&.active::after]:w-[calc(var(--star-size)_+_31px)] [&.active::after]:h-[calc(var(--star-size)_+_31px)] [&.active::after]:[border:1px_solid_var(--g-star-glow)] [&.active::after]:rounded-[50%] [&.active::after]:pointer-events-none [&.active::after]:[animation:galaxy-star-selection-pulse_2.3s_var(--ease-out)_infinite] [&:hover::before]:opacity-100 [&.active::before]:opacity-100 absolute z-[2] grid w-[52px] h-[52px] min-w-0 min-h-[52px] place-items-center [transform:translate(-50%,-50%)_translate3d(calc(var(--px,0)_*_(9px_+_var(--depth,0)_*_7px)),calc(var(--py,0)_*_(6px_+_var(--depth,0)_*_5px)),0)] border-0 rounded-[50%] bg-transparent p-0 cursor-pointer [transition:transform_.9s_var(--ease-out),opacity_.45s_var(--ease-out),filter_.45s_var(--ease-out)] [animation:galaxy-star-enter_.72s_var(--ease-out)_var(--enter-delay,0ms)_backwards] ${i===e.id?`active`:``} ${S&&e.id!==S&&!ie.has(e.id)?`dimmed [.galaxy-stage.has-focus_.galaxy-star&]:opacity-[.32] [.galaxy-stage.has-focus_.galaxy-star&]:[filter:saturate(.4)_brightness(.82)]`:``}`,"aria-pressed":i===e.id,onClick:()=>o(e.id),onMouseEnter:()=>p(e.id),onMouseLeave:()=>p(``),style:{left:`${t/A.width*100}%`,top:`${n/A.height*100}%`,"--star-size":`${12+Math.round((e.importance||.5)*9)}px`,"--twinkle-delay":`${r}s`,"--enter-delay":`${a*55}ms`,"--depth":M(e.id)%100/100,"--g-star-color":j[e.type],"--g-star-glow":ye[e.type]},title:e.content,children:[i===e.id&&(0,k.jsx)(`i`,{className:`orbit-ring [.galaxy-star_&]:absolute [.galaxy-star_&]:left-[50%] [.galaxy-star_&]:top-[50%] [.galaxy-star_&]:w-[calc(var(--star-size)_+_36px)] [.galaxy-star_&]:h-[calc(var(--star-size)_+_36px)] [.galaxy-star_&]:[border:1px_solid_var(--galaxy-line-active)] [.galaxy-star_&]:rounded-[50%] [.galaxy-star_&]:pointer-events-none [.galaxy-star_&]:[transform:translate(-50%,-50%)_rotate(-22deg)_scaleY(.44)] [.galaxy-star_&]:[animation:galaxy-selected-orbit_6s_linear_infinite] [.galaxy-star_&]:opacity-[.8] [.galaxy-star_&::before]:[content:''] [.galaxy-star_&::before]:absolute [.galaxy-star_&::before]:top-[-2.2px] [.galaxy-star_&::before]:left-[50%] [.galaxy-star_&::before]:w-[4.4px] [.galaxy-star_&::before]:h-[4.4px] [.galaxy-star_&::before]:ml-[-2.2px] [.galaxy-star_&::before]:rounded-[50%] [.galaxy-star_&::before]:bg-[var(--g-star-color)] [.galaxy-star_&::before]:shadow-[0_0_6px_1px_var(--g-star-glow)]`,"aria-hidden":`true`}),i===e.id&&(0,k.jsx)(`i`,{className:`dash-ring [.galaxy-star_&]:absolute [.galaxy-star_&]:left-[50%] [.galaxy-star_&]:top-[50%] [.galaxy-star_&]:w-[calc(var(--star-size)_+_23px)] [.galaxy-star_&]:h-[calc(var(--star-size)_+_23px)] [.galaxy-star_&]:[border:1px_dashed_var(--g-star-glow)] [.galaxy-star_&]:rounded-[50%] [.galaxy-star_&]:opacity-[.9] [.galaxy-star_&]:pointer-events-none [.galaxy-star_&]:[transform:translate(-50%,-50%)] [.galaxy-star_&]:[animation:galaxy-dash-spin_16s_linear_infinite]`,"aria-hidden":`true`}),(0,k.jsxs)(`svg`,{className:`star-core [.galaxy-star_&]:relative [.galaxy-star_&]:block [.galaxy-star_&]:w-[var(--star-size)] [.galaxy-star_&]:h-[var(--star-size)] [.galaxy-star_&]:[transition:transform_var(--d2)_var(--ease-spring)] [.galaxy-star_&]:[animation:galaxy-star-twinkle_3.8s_ease-in-out_var(--twinkle-delay)_infinite] [.galaxy-star_&]:overflow-visible [.galaxy-star_&]:rounded-[0] [.galaxy-star_&]:bg-transparent [.galaxy-star_&]:shadow-[none] [.galaxy-star_&]:[filter:drop-shadow(0_0_3px_var(--g-star-glow))_drop-shadow(0_0_8px_var(--g-star-glow))] [.galaxy-star_&]:origin-[center] [.galaxy-star:hover_&]:[transform:scale(1.28)] [.galaxy-star.active_&]:[transform:scale(1.32)] [.galaxy-star.active_&]:[animation:galaxy-star-twinkle_2.1s_ease-in-out_var(--twinkle-delay)_infinite]`,viewBox:`0 0 32 32`,"aria-hidden":`true`,children:[(0,k.jsx)(`path`,{className:`star-ray [.galaxy-star_.star-core_&]:[fill:var(--g-star-glow)] [.galaxy-star_.star-core_&]:opacity-[.58] [.galaxy-star_.star-core_&]:[transform-box:fill-box] [.galaxy-star_.star-core_&]:origin-[center] [.galaxy-star_.star-core_&]:[transform:scale(1.45)] [.galaxy-star.active_.star-core_&]:opacity-[.88] [.galaxy-star.active_.star-core_&]:[transform:scale(1.82)]`,d:`M16 0 L19.7 12.3 L32 16 L19.7 19.7 L16 32 L12.3 19.7 L0 16 L12.3 12.3 Z`}),(0,k.jsx)(`path`,{className:`star-shape [.galaxy-star_.star-core_&]:[fill:var(--g-star-color)]`,d:`M16 2 L18.8 13.2 L30 16 L18.8 18.8 L16 30 L13.2 18.8 L2 16 L13.2 13.2 Z`}),(0,k.jsx)(`circle`,{className:`star-heart [.galaxy-star_.star-core_&]:[fill:var(--g-star-core)]`,cx:`16`,cy:`16`,r:`3.2`})]}),(0,k.jsx)(`span`,{className:`star-label [.galaxy-stage.has-focus_.galaxy-star.dimmed_&]:opacity-[.3] [.galaxy-stage.has-focus_.galaxy-star.dimmed_&]:[transition:opacity_.45s_var(--ease-out)] [.galaxy-star_&]:absolute [.galaxy-star_&]:top-[calc(50%_+_17px)] [.galaxy-star_&]:left-[50%] [.galaxy-star_&]:max-w-[120px] [.galaxy-star_&]:overflow-hidden [.galaxy-star_&]:text-[var(--galaxy-label)] [.galaxy-star_&]:text-[11px] [.galaxy-star_&]:leading-[1.35] [.galaxy-star_&]:pointer-events-none [.galaxy-star_&]:text-ellipsis [.galaxy-star_&]:[text-shadow:0_1px_7px_var(--galaxy-bg)] [.galaxy-star_&]:[transform:translateX(-50%)] [.galaxy-star_&]:[transition:color_var(--d1)_var(--ease-out)] [.galaxy-star_&]:whitespace-nowrap [.galaxy-star:hover_&]:text-[var(--galaxy-label-active)] [.galaxy-star.active_&]:text-[var(--galaxy-label-active)] [.galaxy-star.active_&]:font-[700]`,children:e.title})]},e.id))]}),!!y.length&&(0,k.jsxs)(`span`,{className:`pointer-events-none absolute right-3 bottom-2.5 z-[3] rounded-xs border border-[var(--galaxy-toolbar-border)] bg-[var(--galaxy-toolbar-bg)] px-2 text-xs leading-5 text-[var(--galaxy-label)] tabular-nums`,children:[`✦`,` `,c(`memory:memoryPage.visibleTotalMemories`,{visible:y.length,total:e.length})]}),!a&&!y.length&&(0,k.jsxs)(`div`,{className:`memory-empty [.galaxy-panel_&]:text-[var(--galaxy-label)] [.galaxy-panel_&]:[--stroke:var(--galaxy-toolbar-border)] [.galaxy-panel_&]:[--control-muted:var(--galaxy-label)] [.galaxy-panel_&]:[--star:var(--g-decision)] [.galaxy-panel_&]:[--text-muted:var(--galaxy-label)] absolute z-[3] inset-0 grid [align-content:center] justify-items-center gap-[8px] text-[var(--text-muted)] text-[12px] pointer-events-none`,children:[(0,k.jsx)(re,{size:44}),(0,k.jsx)(`span`,{children:c(`memory:memoryPage.thisMemorySpaceIsStillUnlitClickInTheTopLeftToPlantTheFirstStar`)})]})]})}var xe=[`concept`,`file`,`risk`,`preference`,`decision`,`fact`,`task`],F=`modal-backdrop fixed inset-0 z-[70] grid place-items-center overflow-y-auto overscroll-contain bg-[var(--modal-overlay)] p-5 max-[650px]:p-2`,I=`modal grid max-h-[calc(100dvh_-_40px)] w-[min(430px,100%)] gap-0.5 overflow-y-auto overscroll-contain rounded-dialog bg-popover p-5 shadow-float max-[650px]:max-h-[calc(100dvh_-_16px)]`,L=`key-value flex min-h-[34px] min-w-0 items-center justify-between gap-4 border-t border-stroke-soft text-sm [&>dt]:shrink-0 [&>dt]:text-content-muted [&>dd]:min-w-0 [&>dd]:truncate [&>dd]:text-right [&>dd]:text-content`;function Se(e,t){return t(e===`file`?`memory:memoryPage.fileType`:e===`risk`?`memory:memoryPage.riskType`:e===`preference`?`memory:memoryPage.preferenceType`:e===`decision`?`memory:memoryPage.decisionType`:e===`fact`?`memory:memoryPage.factType`:e===`task`?`memory:memoryPage.taskType`:`memory:memoryPage.conceptType`)}function Ce(e,t=`zh-CN`){if(!e)return`—`;let n=new Date(e);return Number.isNaN(n.getTime())?e:new Intl.DateTimeFormat(t,{year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,hour12:!1}).format(n)}function R(e,t=e=>e){return e?.kind===`global`?t(`memory:memoryPage.globalMemorySpace`):e?.name||``}function z(e){return e instanceof Error?e.message:String(e)}function we({notify:e,onBack:t,requestConfirm:n}){let a=y(`focusSearch`),[x,re]=(0,O.useState)(``),{t:C,language:w}=r(),[T,me]=(0,O.useState)({spaces:[],nodes:[],links:[],candidates:[],selectedSpaceId:``}),[E,D]=(0,O.useState)(``),[he,A]=(0,O.useState)(``),[ge,_e]=(0,O.useState)(``),[j,ye]=(0,O.useState)(`galaxy`),M=(0,O.useRef)(null),N=(0,O.useRef)(0),[P,F]=(0,O.useState)(!0),[I,we]=(0,O.useState)(!1),[De,B]=(0,O.useState)(``),[V,H]=(0,O.useState)(null),[Oe,U]=(0,O.useState)(null),[W,G]=(0,O.useState)(``),[K,ke]=(0,O.useState)(null),[Ae,q]=(0,O.useState)(``),[je,Me]=(0,O.useState)(`load`),[Ne,Pe]=(0,O.useState)(!0),J=(0,O.useRef)(null),Y=(0,O.useRef)(0),Fe=(0,O.useRef)(0),Ie=(0,O.useRef)(0),Le=(0,O.useRef)(null),X=(0,O.useRef)(null),Re=(0,O.useRef)(!1),Z=(0,O.useRef)(null),Q=(0,O.useRef)(!0),[ze,Be]=(0,O.useState)(!1),$=(0,O.useCallback)(async(e=``)=>{let t=++N.current;F(!0),B(``);try{let n=new URLSearchParams;e&&n.set(`spaceId`,e),x.trim()&&n.set(`query`,x.trim());let r=await i(`/api/memory?${n}`);if(t!==N.current)return;me(r),we(!0),D(r.selectedSpaceId||``),A(e=>r.nodes.some(t=>t.id===e)?e:r.nodes[0]?.id||``)}catch(e){t===N.current&&B(z(e))}finally{t===N.current&&F(!1)}},[x]);(0,O.useEffect)(()=>($(E),()=>{N.current+=1}),[$,E]);let Ve=(0,O.useCallback)(async()=>{Le.current?.abort();let e=new AbortController;Le.current=e;let t=++Fe.current,n=Y.current,r=n===Ie.current;Pe(!0),q(``);try{let a=await i(`/api/settings/memory`,{signal:e.signal});if(e.signal.aborted||!Q.current||t!==Fe.current)return;let o=a.autoApproveConfidence;if(typeof o!=`number`||!Number.isInteger(o)||o<0||o>100)throw Error(C(`memory:memoryPage.invalidAutoApproveThreshold`));r&&Y.current===n&&(J.current=o,ke(String(o)))}catch(n){!e.signal.aborted&&Q.current&&t===Fe.current&&(Me(`load`),q(z(n)))}finally{!e.signal.aborted&&Q.current&&t===Fe.current&&Pe(!1)}},[C]);(0,O.useEffect)(()=>(Q.current=!0,Ve(),()=>{Q.current=!1,Le.current?.abort(),X.current?.abort(),Z.current=null}),[Ve]);let He=async()=>{if(K===null||!K.trim()||J.current===null)return;let t=Number(K);if(!Number.isFinite(t))return;let n=Math.min(100,Math.max(0,Math.round(t)));if(!X.current&&!Re.current&&n===J.current){Z.current=null,Ie.current=Y.current,ke(String(n)),q(``);return}if(Z.current={value:n,revision:Y.current},X.current)return;let r=new AbortController;X.current=r,Be(!0),q(``);try{for(;Z.current&&Q.current&&!r.signal.aborted;){let t=Z.current;if(Z.current=null,t.value!==J.current||Re.current){try{await i(`/api/settings/memory`,{method:`PATCH`,body:{autoApproveConfidence:t.value},signal:r.signal})}catch(e){if(!Q.current||r.signal.aborted)return;Z.current||=t,Re.current=!0,Me(`save`),q(z(e));return}if(!Q.current||r.signal.aborted)return;J.current=t.value,Re.current=!1}Ie.current=t.revision,Y.current===t.revision&&(ke(String(t.value)),Z.current||e(C(`memory:memoryPage.autoApproveSaved`)))}}finally{X.current===r&&(X.current=null,Q.current&&Be(!1))}},Ue=T.nodes.find(e=>e.id===he)||null,We=e=>{let t=new Set(T.links.flatMap(t=>t.sourceId===e?[t.targetId]:t.targetId===e?[t.sourceId]:[]));return{count:t.size,files:T.nodes.filter(n=>n.type===`file`&&(t.has(n.id)||n.id===e))}},Ge=T.spaces.find(e=>e.id===E),Ke=async t=>{if(await n({title:C(`memory:memoryPage.deleteMemory`),message:C(`memory:memoryPage.deleteMemoryName`,{name:t.title}),confirmLabel:C(`memory:memoryPage.delete`)}))try{await i(`/api/memory/nodes/${encodeURIComponent(t.id)}`,{method:`DELETE`}),e(C(`memory:memoryPage.memoryDeleted`)),await $(E)}catch(e){B(z(e))}},qe=async(t,n)=>{if(!W){G(t.id),B(``);try{await i(`/api/memory/candidates/${encodeURIComponent(t.id)}/${n}`,{method:`POST`,body:`{}`}),e(C(n===`accept`?`memory:memoryPage.memoryCandidateConfirmed`:`memory:memoryPage.memoryCandidateIgnored`)),await $(E)}catch(e){B(z(e))}finally{G(``)}}},Je=async()=>{if(!(W||!T.candidates?.length)){G(`__all__`),B(``);try{let t=await i(`/api/memory/candidates/reject-all`,{method:`POST`,body:`{}`});e(C(`memory:memoryPage.ignoredCountMemoryDrafts`,{count:t.rejected||0})),await $(E)}catch(e){B(z(e))}finally{G(``)}}},Ye=async()=>{if(Ge&&await n({title:C(`memory:memoryPage.deleteMemorySpace`),message:C(`memory:memoryPage.deleteMemorySpaceNameAndAllMemoriesInIt`,{name:R(Ge,C)}),confirmLabel:C(`memory:memoryPage.delete`)}))try{await i(`/api/memory/spaces/${encodeURIComponent(Ge.id)}`,{method:`DELETE`}),D(``),A(``),e(C(`memory:memoryPage.memorySpaceDeleted`))}catch(e){B(z(e))}},Xe=C(`navigation:navigation.memory`),Ze=R(Ge,C),Qe=e=>{A(e),requestAnimationFrame(()=>M.current?.scrollIntoView({block:`nearest`}))},$e=(e,t)=>{let n=We(e.id);return(0,k.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3`,children:[t&&(0,k.jsxs)(`header`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,k.jsx)(`h3`,{className:`text-[15px] leading-6 font-medium break-words text-content`,children:e.title}),(0,k.jsx)(`p`,{className:`text-[13px] leading-normal break-words text-content-secondary`,children:e.content})]}),(0,k.jsxs)(`dl`,{children:[(0,k.jsxs)(`div`,{className:L,children:[(0,k.jsx)(`dt`,{children:C(`memory:memoryPage.memoryType`)}),(0,k.jsxs)(`dd`,{className:`inline-flex items-center justify-end gap-2`,children:[(0,k.jsx)(ve,{type:e.type}),Se(e.type,C)]})]}),(0,k.jsxs)(`div`,{className:L,children:[(0,k.jsx)(`dt`,{children:C(`memory:memoryPage.source`)}),(0,k.jsx)(`dd`,{children:e.sourceType===`conversation_confirmed`?C(`memory:memoryPage.userConfirmedConversationCandidate`):e.sourceType===`user_confirmed`?C(`memory:memoryPage.explicitUserRequest`):e.sourceType===`agent`?C(`memory:memoryPage.createdByAgent`):C(`memory:memoryPage.addedManually`)})]}),(0,k.jsxs)(`div`,{className:L,children:[(0,k.jsx)(`dt`,{children:C(`memory:memoryPage.authority`)}),(0,k.jsxs)(`dd`,{className:`tabular-nums`,children:[e.authority??0,`/100`]})]}),e.evidence&&(0,k.jsxs)(`div`,{className:L,children:[(0,k.jsx)(`dt`,{children:C(`memory:memoryPage.evidence`)}),(0,k.jsx)(`dd`,{title:e.evidence,children:e.evidence})]}),(0,k.jsxs)(`div`,{className:L,children:[(0,k.jsx)(`dt`,{children:C(`memory:memoryPage.created`)}),(0,k.jsx)(`dd`,{className:`tabular-nums`,children:Ce(e.createdAt,w)})]}),(0,k.jsxs)(`div`,{className:L,children:[(0,k.jsx)(`dt`,{children:C(`memory:memoryPage.relatedMemories`)}),(0,k.jsx)(`dd`,{className:`tabular-nums`,children:C(`memory:memoryPage.count`,{count:n.count})})]})]}),(0,k.jsxs)(`div`,{className:`flex flex-wrap justify-end gap-2`,children:[(0,k.jsxs)(v,{variant:`ghost`,size:`sm`,className:`text-danger hover:bg-danger-soft hover:text-danger max-[650px]:h-11`,onClick:()=>void Ke(e),children:[(0,k.jsx)(p,{}),C(`memory:memoryPage.delete`)]}),(0,k.jsxs)(v,{variant:`secondary`,size:`sm`,className:`max-[650px]:h-11`,onClick:()=>H(e),children:[(0,k.jsx)(l,{}),C(`memory:memoryPage.edit`)]})]}),(0,k.jsxs)(`section`,{className:`min-w-0`,"aria-label":C(`memory:memoryPage.relatedFiles`),children:[(0,k.jsxs)(`h4`,{className:`mb-1 text-xs font-medium text-content-muted tabular-nums`,children:[C(`memory:memoryPage.relatedFiles`),` · `,n.files.length]}),n.files.length?(0,k.jsx)(`ul`,{className:`divide-y divide-stroke-soft border-t border-stroke-soft`,children:n.files.map(t=>(0,k.jsxs)(`li`,{className:`file-row grid min-h-11 min-w-0 grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-2.5 py-1`,children:[(0,k.jsx)(s,{className:`size-4 text-content-muted`,"aria-hidden":`true`}),(0,k.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,k.jsx)(`strong`,{className:`truncate text-sm font-medium text-content`,children:t.title}),(0,k.jsx)(`small`,{className:`truncate font-mono text-xs text-content-muted`,children:t.sourcePath||t.cwd||C(`memory:memoryPage.localMemory`)})]}),(0,k.jsxs)(`span`,{className:`flex items-center`,children:[t.id!==e.id&&(0,k.jsx)(v,{variant:`ghost`,size:`sm`,className:`max-[650px]:h-11`,onClick:()=>j===`galaxy`?A(t.id):_e(t.id),children:C(`memory:memoryPage.view`)}),(0,k.jsx)(v,{variant:`ghost`,size:`icon-sm`,className:`max-[650px]:size-11`,"aria-label":`${C(`memory:memoryPage.edit`)}: ${t.title}`,onClick:()=>H(t),children:(0,k.jsx)(l,{})}),(0,k.jsx)(v,{variant:`ghost`,size:`icon-sm`,className:`text-content-muted hover:bg-danger-soft hover:text-danger max-[650px]:size-11`,"aria-label":`${C(`memory:memoryPage.delete`)}: ${t.title}`,onClick:()=>void Ke(t),children:(0,k.jsx)(p,{})})]})]},t.id))}):(0,k.jsx)(`p`,{className:`text-xs text-content-muted`,children:C(`memory:memoryPage.thisMemoryHasNoRelatedFiles`)})]})]})};return(0,k.jsxs)(le,{title:Xe,description:C(`memory:memoryPage.lede`),back:t&&{label:C(`navigation:sidebar.features`),ariaLabel:C(`navigation:shell.backToFeaturesLabel`),onBack:t},toolbar:(0,k.jsx)(ue,{search:(0,k.jsx)(ae,{id:h,value:x,onValueChange:re,placeholder:C(`navigation:pageHeader.searchMemoriesOrFiles`),shortcut:a,clearLabel:C(`navigation:more.clearSearch`)}),actions:(0,k.jsxs)(v,{type:`button`,className:`h-9`,disabled:!I,onClick:()=>H({spaceId:E||T.selectedSpaceId}),children:[(0,k.jsx)(u,{}),C(`memory:memoryPage.addMemory`)]}),filters:(0,k.jsx)(fe,{options:[C(`memory:memoryPage.galaxyView`),C(`memory:memoryPage.listView`)],value:C(j===`galaxy`?`memory:memoryPage.galaxyView`:`memory:memoryPage.listView`),onChange:e=>ye(e===C(`memory:memoryPage.listView`)?`list`:`galaxy`)})}),children:[!I&&P?(0,k.jsx)(S,{kind:`loading`,title:C(`common:pageTemplate.loading`)}):I?(0,k.jsxs)(k.Fragment,{children:[De&&(0,k.jsx)(de,{children:De}),(0,k.jsx)(ce,{title:C(`memory:memoryPage.memorySpaces`),count:T.spaces.length,actions:(0,k.jsxs)(v,{variant:`ghost`,size:`sm`,onClick:()=>U({}),children:[(0,k.jsx)(u,{}),C(`memory:memoryPage.newMemorySpace`)]}),children:(0,k.jsx)(se,{children:T.spaces.map(e=>{let t=e.id===E;return(0,k.jsx)(oe,{"data-memory-space":e.id,"aria-current":t||void 0,className:ne(`relative`,t&&`after:absolute after:top-3.5 after:bottom-3.5 after:-left-3 after:w-[3px] after:rounded-r-[3px] after:bg-star max-[650px]:after:-left-2.5`),icon:(0,k.jsx)(f,{}),onOpen:()=>{D(e.id),A(``),_e(``)},name:R(e,C),status:C(`memory:memoryPage.countMemories`,{count:e.nodeCount}),actions:t&&(0,k.jsxs)(`div`,{className:`memory-space-actions flex items-center gap-1`,children:[(0,k.jsxs)(v,{variant:`ghost`,size:`sm`,onClick:()=>U(e),children:[(0,k.jsx)(l,{}),C(`memory:memoryPage.rename`)]}),e.kind!==`global`&&(0,k.jsxs)(v,{variant:`ghost`,size:`sm`,className:`text-danger hover:bg-danger-soft hover:text-danger`,onClick:()=>void Ye(),children:[(0,k.jsx)(p,{}),C(`memory:memoryPage.delete`)]})]})},e.id)})})}),(0,k.jsx)(ce,{"data-memory-stars":!0,title:Ze||C(`memory:memoryPage.memorySpaces`),count:T.nodes.length,actions:(0,k.jsx)(v,{variant:`ghost`,size:`icon-sm`,className:`text-content-muted max-[650px]:size-11 pointer-coarse:size-11`,loading:P,disabled:P,"aria-label":C(`memory:memoryPage.refresh`),title:C(`memory:memoryPage.refresh`),onClick:()=>void $(E),children:(0,k.jsx)(d,{})}),children:j===`galaxy`?(0,k.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3`,children:[(0,k.jsx)(be,{nodes:T.nodes,links:T.links,spaceId:E,selectedId:he,loading:P,onSelect:Qe,onAdd:()=>H({spaceId:E})}),(0,k.jsx)(`div`,{role:`group`,"aria-label":C(`memory:memoryPage.memoryMapTypes`),className:`galaxy-legend flex flex-wrap gap-x-4 gap-y-1.5`,children:xe.map(e=>(0,k.jsxs)(`span`,{className:`flex items-center gap-1.5 text-xs text-content-secondary`,children:[(0,k.jsx)(ve,{type:e}),Se(e,C)]},e))}),(0,k.jsx)(`div`,{ref:M,role:`region`,"data-memory-detail":!0,"aria-label":C(`memory:memoryPage.selectedMemory`),className:`min-w-0 scroll-mb-4 rounded-[var(--r-md)] border border-stroke px-4 py-3`,children:Ue?$e(Ue,!0):(0,k.jsx)(`p`,{className:`text-xs leading-normal text-content-muted`,children:C(`memory:memoryPage.selectAMemoryInTheMapToViewItsDetails`)})})]}):T.nodes.length?(0,k.jsx)(se,{children:T.nodes.map(e=>(0,k.jsx)(oe,{"data-memory-node":e.id,icon:(0,k.jsx)(ve,{type:e.type}),name:e.title,nameMeta:Se(e.type,C),description:e.content,expanded:ge===e.id,onExpandedChange:t=>_e(t?e.id:``),toggleLabel:e.title,detail:$e(e,!1)},e.id))}):(0,k.jsx)(ie,{title:x.trim()?C(`memory:memoryPage.noMatchingMemories`):C(`memory:memoryPage.noMemoriesInSpace`)})}),(0,k.jsxs)(ce,{title:C(`memory:memoryPage.memoryDrafts`),count:T.candidates?.length||0,actions:!!T.candidates?.length&&(0,k.jsxs)(v,{variant:`ghost`,size:`sm`,disabled:!!W,onClick:()=>void Je(),children:[(0,k.jsx)(m,{}),C(`memory:memoryPage.ignoreAll`)]}),children:[Ne&&(0,k.jsxs)(`p`,{role:`status`,className:`flex items-center gap-2 py-2 text-xs text-content-muted`,children:[(0,k.jsx)(_,{className:`size-3.5`}),C(`memory:memoryPage.loadingAutoApproveThreshold`)]}),Ae&&(0,k.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 py-2`,children:[(0,k.jsxs)(pe,{className:`my-0`,children:[C(`memory:memoryPage.autoApproveThresholdUnavailable`),` `,Ae]}),(0,k.jsx)(v,{variant:`secondary`,size:`sm`,className:`max-[650px]:h-11`,disabled:Ne||ze,onClick:()=>void(je===`save`?He():Ve()),children:C(`memory:memoryPage.retryAutoApproveThreshold`)})]}),K!==null&&(0,k.jsxs)(`div`,{className:`memory-auto-approve-row flex min-h-12 items-center justify-between gap-3 border-t border-stroke py-1.5`,children:[(0,k.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 text-sm font-medium text-content`,children:[(0,k.jsx)(`span`,{children:C(`memory:memoryPage.autoApproveThreshold`)}),(0,k.jsxs)(te,{children:[(0,k.jsx)(ee,{asChild:!0,children:(0,k.jsx)(c,{className:`size-3.5 shrink-0 text-content-muted`})}),(0,k.jsx)(g,{align:`center`,side:`top`,children:C(`memory:memoryPage.autoApproveThresholdHint`)})]})]}),(0,k.jsxs)(`span`,{className:`memory-auto-approve-input flex flex-none items-center gap-1.5 text-xs text-content-muted`,children:[(0,k.jsx)(b,{type:`number`,min:0,max:100,step:5,className:`h-7 w-16 text-right tabular-nums max-[650px]:h-11`,value:K,"aria-busy":ze,"aria-label":C(`memory:memoryPage.autoApproveThreshold`),onChange:e=>{Y.current+=1,ke(e.target.value)},onBlur:()=>void He(),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),He())}}),`%`,ze&&(0,k.jsx)(_,{className:`size-3.5`})]})]}),T.candidates?.length?(0,k.jsx)(se,{children:T.candidates.map(e=>(0,k.jsx)(oe,{className:`memory-candidate`,name:e.title,description:e.content,meta:(0,k.jsxs)(`span`,{className:`truncate tabular-nums`,children:[R(T.spaces.find(t=>t.id===e.spaceId),C),` · `,e.sourceType===`agent`?C(`memory:memoryPage.agentProposed`):C(`memory:memoryPage.conversationExtracted`),` · `,C(`memory:memoryPage.confidencePercent`,{value:Math.round((e.confidence||0)*100)})]}),actions:(0,k.jsxs)(k.Fragment,{children:[(0,k.jsxs)(v,{variant:`secondary`,size:`sm`,disabled:!!W,onClick:()=>void qe(e,`accept`),children:[(0,k.jsx)(o,{}),C(`memory:memoryPage.confirm`)]}),(0,k.jsxs)(v,{variant:`ghost`,size:`sm`,disabled:!!W,onClick:()=>void qe(e,`reject`),children:[(0,k.jsx)(m,{}),C(`memory:memoryPage.ignore`)]})]}),detail:(0,k.jsxs)(`div`,{className:`flex flex-col gap-0.5 text-xs leading-[1.5] text-content-muted`,children:[e.topicKey&&(0,k.jsxs)(`span`,{children:[C(`memory:memoryPage.topic`),`:`,(0,k.jsx)(`code`,{className:`font-mono`,children:e.topicKey})]}),e.evidence&&(0,k.jsxs)(`span`,{className:`[overflow-wrap:anywhere]`,children:[C(`memory:memoryPage.evidence`),`:`,e.evidence]}),(0,k.jsxs)(`span`,{className:`tabular-nums`,children:[C(`memory:memoryPage.created`),`:`,Ce(e.createdAt,w),e.expiresAt?` · ${C(`memory:memoryPage.expires`)}:${Ce(e.expiresAt,w)}`:``]})]})},e.id))}):(0,k.jsx)(`p`,{className:`border-t border-stroke py-3 text-xs text-content-muted`,children:C(`memory:memoryPage.thereAreNoPendingMemoryCandidates`)})]})]}):(0,k.jsx)(S,{kind:`error`,title:C(`memory:memoryPage.loadFailed`),description:De,action:(0,k.jsx)(v,{variant:`secondary`,className:`max-[650px]:h-11`,onClick:()=>void $(E),children:C(`common:pageTemplate.retry`)})}),V&&(0,k.jsx)(Te,{spaces:T.spaces,node:V.id?V:null,initialSpaceId:V.spaceId||E,onClose:()=>H(null),onSaved:async t=>{H(null),e(t),await $(E)}}),Oe&&(0,k.jsx)(Ee,{space:Oe.id?Oe:null,onClose:()=>U(null),onSaved:async(t,n)=>{U(null),D(t.id),e(n)}})]})}function Te({spaces:e,node:t,initialSpaceId:n,onClose:a,onSaved:o}){let{t:s}=r(),[c,u]=(0,O.useState)({spaceId:t?.spaceId||n||e[0]?.id||``,title:t?.title||``,content:t?.content||``,type:t?.type||`concept`,sourcePath:t?.sourcePath||``,importance:t?.importance??.5}),[d,f]=(0,O.useState)(!1),[p,h]=(0,O.useState)(``);return(0,k.jsx)(`div`,{className:F,onMouseDown:e=>!d&&e.target===e.currentTarget&&a(),children:(0,k.jsxs)(`form`,{role:`dialog`,"aria-modal":`true`,"aria-label":s(t?`memory:memoryPage.editMemory`:`memory:memoryPage.addMemory`),className:I,onSubmit:async e=>{if(e.preventDefault(),!d){f(!0),h(``);try{await i(t?`/api/memory/nodes/${encodeURIComponent(t.id)}`:`/api/memory/nodes`,{method:t?`PATCH`:`POST`,body:JSON.stringify(c)}),await o(s(t?`memory:memoryPage.memoryUpdated`:`memory:memoryPage.memoryCreated`))}catch(e){h(z(e))}finally{f(!1)}}},children:[(0,k.jsxs)(T,{className:`[&_h2]:text-[15px] [&_h2]:font-medium`,children:[(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`h2`,{children:s(t?`memory:memoryPage.editMemory`:`memory:memoryPage.addMemory`)}),(0,k.jsx)(`p`,{children:s(`memory:memoryPage.lightUpIdeasWorthKeepingAsMemoriesYouCanReturnToLater`)})]}),(0,k.jsx)(v,{type:`button`,variant:`ghost`,size:`icon`,className:`-mt-1 -mr-1 max-[650px]:size-11`,"aria-label":s(`memory:memoryPage.closeDialog`),disabled:d,onClick:a,children:(0,k.jsx)(m,{})})]}),(0,k.jsxs)(C,{variant:`control`,children:[s(`memory:memoryPage.memorySpace`),(0,k.jsx)(w,{value:c.spaceId,onChange:e=>u({...c,spaceId:e.target.value}),children:e.map(e=>(0,k.jsx)(`option`,{value:e.id,children:R(e,s)},e.id))})]}),(0,k.jsxs)(C,{variant:`control`,children:[s(`memory:memoryPage.memoryTitle`),(0,k.jsx)(b,{value:c.title,onChange:e=>u({...c,title:e.target.value}),placeholder:s(`memory:memoryPage.forExampleProjectUIConstraints`)})]}),(0,k.jsxs)(C,{variant:`control`,children:[s(`memory:memoryPage.memoryContent`),(0,k.jsx)(x,{value:c.content,onChange:e=>u({...c,content:e.target.value}),placeholder:s(`memory:memoryPage.recordStandaloneReusableMemoryForFutureChats`)})]}),(0,k.jsxs)(`div`,{className:`form-grid grid gap-x-2.5 sm:grid-cols-2`,children:[(0,k.jsxs)(C,{variant:`control`,children:[s(`memory:memoryPage.memoryType`),(0,k.jsx)(w,{value:c.type,onChange:e=>u({...c,type:e.target.value}),children:xe.map(e=>(0,k.jsx)(`option`,{value:e,children:Se(e,s)},e))})]}),(0,k.jsxs)(C,{variant:`control`,children:[s(`memory:memoryPage.importance`),(0,k.jsxs)(w,{value:c.importance,onChange:e=>u({...c,importance:Number(e.target.value)}),children:[(0,k.jsx)(`option`,{value:`0.3`,children:s(`memory:memoryPage.normal`)}),(0,k.jsx)(`option`,{value:`0.5`,children:s(`memory:memoryPage.common`)}),(0,k.jsx)(`option`,{value:`0.8`,children:s(`memory:memoryPage.important`)}),(0,k.jsx)(`option`,{value:`1`,children:s(`memory:memoryPage.strict`)})]})]})]}),(0,k.jsxs)(C,{variant:`control`,children:[s(`memory:memoryPage.relatedFilePath`),(0,k.jsx)(b,{value:c.sourcePath,onChange:e=>u({...c,sourcePath:e.target.value}),placeholder:s(`memory:memoryPage.optionalForExampleECodeProjectREADMEMd`)})]}),p&&(0,k.jsx)(pe,{children:p}),(0,k.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,k.jsx)(v,{type:`button`,variant:`secondary`,size:`dialogAction`,onClick:a,children:s(`memory:memoryPage.cancel`)}),(0,k.jsxs)(v,{type:`submit`,size:`dialogAction`,disabled:d||!c.spaceId||!c.title.trim()||!c.content.trim(),children:[d?(0,k.jsx)(_,{className:`text-current`}):(0,k.jsx)(l,{}),s(d?`memory:memoryPage.saving`:`memory:memoryPage.save`)]})]})]})})}function Ee({space:e,onClose:t,onSaved:n}){let{t:a}=r(),[o,s]=(0,O.useState)(e?.name||``),[c,l]=(0,O.useState)(!1),[d,f]=(0,O.useState)(``);return(0,k.jsx)(`div`,{className:F,onMouseDown:e=>!c&&e.target===e.currentTarget&&t(),children:(0,k.jsxs)(`form`,{role:`dialog`,"aria-modal":`true`,"aria-label":a(e?`memory:memoryPage.renameMemorySpace`:`memory:memoryPage.newMemorySpace`),className:I,onSubmit:async t=>{if(t.preventDefault(),!c){l(!0),f(``);try{await n(await i(e?`/api/memory/spaces/${encodeURIComponent(e.id)}`:`/api/memory/spaces`,{method:e?`PATCH`:`POST`,body:JSON.stringify({name:o,kind:`custom`})}),a(e?`memory:memoryPage.memorySpaceRenamed`:`memory:memoryPage.memorySpaceCreated`))}catch(e){f(z(e))}finally{l(!1)}}},children:[(0,k.jsxs)(T,{className:`[&_h2]:text-[15px] [&_h2]:font-medium`,children:[(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`h2`,{children:a(e?`memory:memoryPage.renameMemorySpace`:`memory:memoryPage.newMemorySpace`)}),(0,k.jsx)(`p`,{children:a(`memory:memoryPage.giveEachThemeOrProjectItsOwnMemorySpaceSoDurableMemoriesHaveSomewhereToBelong`)})]}),(0,k.jsx)(v,{type:`button`,variant:`ghost`,size:`icon`,className:`-mt-1 -mr-1 max-[650px]:size-11`,"aria-label":a(`memory:memoryPage.closeDialog`),disabled:c,onClick:t,children:(0,k.jsx)(m,{})})]}),(0,k.jsxs)(C,{variant:`control`,children:[a(`memory:memoryPage.memorySpaceName`),(0,k.jsx)(b,{value:o,onChange:e=>s(e.target.value),placeholder:a(`memory:memoryPage.forExampleProductDesignGuidelines`),autoFocus:!0})]}),d&&(0,k.jsx)(pe,{children:d}),(0,k.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,k.jsx)(v,{type:`button`,variant:`secondary`,size:`dialogAction`,onClick:t,children:a(`memory:memoryPage.cancel`)}),(0,k.jsxs)(v,{type:`submit`,size:`dialogAction`,disabled:c||!o.trim(),children:[c?(0,k.jsx)(_,{className:`text-current`}):(0,k.jsx)(u,{}),a(c?`memory:memoryPage.saving`:`memory:memoryPage.save`)]})]})]})})}export{we as MemoryPage};
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t,r as n}from"./vendor-react-DwNgTV1j.js";import{t as r}from"./use-i18n-Cyg5th6Z.js";import{t as i}from"./runtime-capabilities-store-DWW9jolt.js";import{t as a}from"./chevron-left-BAtyp3_6.js";import{t as o}from"./chevron-right-C3t2Rckj.js";import{r as s}from"./settings-navigation-DiP_AM1C.js";var c=e(t(),1),l=n(),u=`flex min-h-14 w-full min-w-0 items-center gap-3 px-4 text-left text-base text-content focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus active:bg-surface-hover`;function d({onNavigate:e,onOpenFeatures:t}){let{t:n}=r(),a=i(e=>e.capabilities),d=(0,c.useMemo)(()=>s(n,{capabilities:a}),[a,n]);return(0,l.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto bg-background`,children:[(0,l.jsx)(`h1`,{className:`sr-only`,children:n(`navigation:navigation.settings`)}),(0,l.jsx)(`nav`,{"aria-label":n(`config:settingsShell.settingsNavigation`),"data-mobile-navigation":`settings`,className:`mx-4 mt-2 overflow-hidden rounded-[14px] border border-stroke-soft bg-panel`,children:(0,l.jsx)(`ul`,{className:`m-0 list-none p-0 [&>li+li]:border-t [&>li+li]:border-stroke-soft`,children:d.map(t=>{let n=t.icon;return(0,l.jsx)(`li`,{children:(0,l.jsxs)(`button`,{type:`button`,"data-settings-section":t.section,className:u,onClick:()=>e(t.section),children:[(0,l.jsx)(n,{className:`size-[18px] flex-none text-content-secondary`,strokeWidth:1.75,"aria-hidden":`true`}),(0,l.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:t.label}),(0,l.jsx)(o,{className:`size-4 flex-none text-content-faint`,"aria-hidden":`true`})]})},t.section)})})}),(0,l.jsx)(`button`,{type:`button`,"data-settings-features-hint":!0,className:`mx-4 mt-3 flex min-h-11 items-center rounded-[var(--r-md)] px-1 text-left text-sm text-content-muted focus-visible:outline-2 focus-visible:outline-focus active:text-content`,onClick:t,children:n(`config:settingsShell.featuresHint`)})]})}function f({onBack:e}){let{t}=r();return(0,l.jsx)(`div`,{className:`flex flex-none px-2 pt-1`,children:(0,l.jsxs)(`button`,{type:`button`,"data-settings-back":!0,className:`flex h-11 items-center gap-0.5 rounded-[var(--r-md)] pr-3 pl-1 text-sm text-content-secondary focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus active:bg-surface-hover`,onClick:e,children:[(0,l.jsx)(a,{className:`size-5`,"aria-hidden":`true`}),t(`navigation:navigation.settings`)]})})}export{f as MobileSettingsBack,d as MobileSettingsList};
1
+ import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t,r as n}from"./vendor-react-DwNgTV1j.js";import{t as r}from"./use-i18n-B2p84ZNR.js";import{t as i}from"./runtime-capabilities-store-DpEKnn1b.js";import{t as a}from"./chevron-left-BAtyp3_6.js";import{t as o}from"./chevron-right-C3t2Rckj.js";import{r as s}from"./settings-navigation-DiP_AM1C.js";var c=e(t(),1),l=n(),u=`flex min-h-14 w-full min-w-0 items-center gap-3 px-4 text-left text-base text-content focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus active:bg-surface-hover`;function d({onNavigate:e,onOpenFeatures:t}){let{t:n}=r(),a=i(e=>e.capabilities),d=(0,c.useMemo)(()=>s(n,{capabilities:a}),[a,n]);return(0,l.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto bg-background`,children:[(0,l.jsx)(`h1`,{className:`sr-only`,children:n(`navigation:navigation.settings`)}),(0,l.jsx)(`nav`,{"aria-label":n(`config:settingsShell.settingsNavigation`),"data-mobile-navigation":`settings`,className:`mx-4 mt-2 overflow-hidden rounded-[14px] border border-stroke-soft bg-panel`,children:(0,l.jsx)(`ul`,{className:`m-0 list-none p-0 [&>li+li]:border-t [&>li+li]:border-stroke-soft`,children:d.map(t=>{let n=t.icon;return(0,l.jsx)(`li`,{children:(0,l.jsxs)(`button`,{type:`button`,"data-settings-section":t.section,className:u,onClick:()=>e(t.section),children:[(0,l.jsx)(n,{className:`size-[18px] flex-none text-content-secondary`,strokeWidth:1.75,"aria-hidden":`true`}),(0,l.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:t.label}),(0,l.jsx)(o,{className:`size-4 flex-none text-content-faint`,"aria-hidden":`true`})]})},t.section)})})}),(0,l.jsx)(`button`,{type:`button`,"data-settings-features-hint":!0,className:`mx-4 mt-3 flex min-h-11 items-center rounded-[var(--r-md)] px-1 text-left text-sm text-content-muted focus-visible:outline-2 focus-visible:outline-focus active:text-content`,onClick:t,children:n(`config:settingsShell.featuresHint`)})]})}function f({onBack:e}){let{t}=r();return(0,l.jsx)(`div`,{className:`flex flex-none px-2 pt-1`,children:(0,l.jsxs)(`button`,{type:`button`,"data-settings-back":!0,className:`flex h-11 items-center gap-0.5 rounded-[var(--r-md)] pr-3 pl-1 text-sm text-content-secondary focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus active:bg-surface-hover`,onClick:e,children:[(0,l.jsx)(a,{className:`size-5`,"aria-hidden":`true`}),t(`navigation:navigation.settings`)]})})}export{f as MobileSettingsBack,d as MobileSettingsList};
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t,r as n}from"./vendor-react-DwNgTV1j.js";import{t as r}from"./use-i18n-Cyg5th6Z.js";import{t as i}from"./useQuery-DdcpUQhO.js";import{a,l as o}from"./api-m-Yq8n0q.js";import{a as s,n as c,t as l}from"./runtime-capabilities-CHYOF_hE.js";import{t as u}from"./runtime-capabilities-store-DWW9jolt.js";import{m as d}from"./placements-CuVM9Xxs.js";import{t as ee}from"./client-store-BkVlLM-4.js";import{t as f}from"./usePhoneShell-CDP-O4Gc.js";import{t as p}from"./createLucideIcon-Cd-3GVxJ.js";import{t as m}from"./app-window-CPNdvYNt.js";import{t as h}from"./blocks-Olsdp5Lp.js";import{t as g}from"./bot-B3TaBp_T.js";import{t as _}from"./brain-qxhnKqYP.js";import{t as v}from"./calendar-clock-VIxTaqqy.js";import{t as y}from"./chevron-right-C3t2Rckj.js";import{t as b}from"./image-BY_c3FYU.js";import{t as x}from"./monitor-smartphone-B1gIjItA.js";import{t as S}from"./plug-BsIeHRwC.js";import{t as C}from"./plus-fQbSqB1n.js";import{t as w}from"./radio-tower-jGQwrFWB.js";import{t as T}from"./rotate-ccw-clock-CO6Bw-sF.js";import{t as E}from"./search-D0mqDaf_.js";import{t as te}from"./server-BgNvmqwJ.js";import{t as ne}from"./sparkles-S_eeuqn9.js";import{t as re}from"./workflow-Bg94dy8I.js";import{t as D}from"./x-07u4-129.js";import{t as O}from"./brand-DIEc3fK8.js";import{i as k}from"./more-pages-D_PnxLN0.js";import{t as A}from"./utils-C8uzG5AZ.js";import{t as j}from"./button-CCcCN8tE.js";import{t as M}from"./kbd-CAufZTkl.js";import{g as ie}from"./events-B0F69Vd3.js";import{n as N,r as P}from"./config-search-BqYT_Xre.js";import{s as F}from"./shortcuts-Cgx6V2jI.js";var I=p(`command`,[[`path`,{d:`M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3`,key:`11bfej`}]]),L=e(t(),1),R=`add:component`;function z(e,{capabilities:t=l,mobileApp:n=!1,components:r=[]}={}){let i=(e,n,r,i)=>s(t,e)?{key:`page:${e}`,label:n,description:r,icon:i,destination:{type:`page`,id:e}}:null,a=e=>c(t,e,{mobileApp:n}),o=a(`remote-access`),u=a(`desktop-pet`),d=[a(`mobile-server`).supported?{key:`config:mobile-server`,label:e(`config:configPage.mobileServer`),description:e(`navigation:more.mobileServerHint`),icon:x,destination:{type:`config`,id:`mobile-server`}}:o.supported?{key:`config:remote-access`,label:e(`config:configPage.remoteAccess`),description:e(`navigation:more.remoteAccessHint`),icon:x,destination:{type:`config`,id:`remote-access`}}:null,u.supported||u.reason===`desktop-only`?{key:`config:desktop-pet`,label:e(`config:configPage.desktopPet`),description:e(`navigation:more.desktopPetHint`),icon:g,destination:{type:`config`,id:`desktop-pet`},...u.supported?{}:{disabledReason:e(`navigation:more.desktopOnly`)}}:null];return[{id:`sessions`,label:e(`navigation:more.groupSessions`),tiles:[i(`chatHistory`,e(`navigation:navigation.chatHistory`),e(`navigation:more.chatHistoryHint`),T),i(`assets`,e(`navigation:navigation.assets`),e(`navigation:more.assetsHint`),b),i(`memory`,e(`navigation:navigation.memory`),e(`navigation:more.memoryHint`),_)]},{id:`automation`,label:e(`navigation:more.groupAutomation`),tiles:[i(`workflows`,e(`navigation:navigation.workflows`),e(`navigation:more.workflowsHint`),re),i(`schedules`,e(`navigation:navigation.schedules`),e(`navigation:more.schedulesHint`),v),i(`channels`,e(`navigation:navigation.channels`),e(`navigation:more.channelsHint`),w)]},{id:`extensions`,label:e(`navigation:more.groupExtensions`),tiles:[i(`plugins`,e(`navigation:navigation.plugins`),e(`navigation:more.pluginsHint`),S),i(`skills`,e(`navigation:navigation.skills`),e(`navigation:more.skillsHint`),ne),i(`mcp`,e(`navigation:navigation.mcp`),e(`navigation:more.mcpHint`),te),{key:`page:components`,label:e(`navigation:shell.components`),description:e(`navigation:more.componentStudioHint`),icon:h,destination:{type:`page`,id:`components`}}]},{id:`devices`,label:e(`navigation:more.groupDevices`),tiles:d},{id:`components`,label:e(`navigation:more.groupComponents`),tiles:[...r.map(t=>({key:`component:${t.id}`,label:t.name,description:t.description||e(`navigation:more.componentHint`),icon:m,destination:{type:`component`,id:t.id}})),{key:R,label:e(`navigation:more.addComponent`),description:e(`navigation:more.addComponentHint`),icon:C,destination:{type:`page`,id:`components`}}]}].map(e=>({id:e.id,label:e.label,tiles:e.tiles.filter(e=>e!==null)})).filter(e=>e.tiles.length>0)}function B(e,t,n){let r=t.trim().toLocaleLowerCase(n);return r?e.map(e=>({...e,tiles:e.tiles.filter(t=>[t.label,t.description,e.label].some(e=>e.toLocaleLowerCase(n).includes(r)))})).filter(e=>e.tiles.length>0):[...e]}var V=new Set([`connected`,`connecting`,`reconnecting`]);function H(e){let t=e&&typeof e==`object`?e.connections:null;if(!t||typeof t!=`object`||Array.isArray(t))throw o();let n=0;for(let e of Object.values(t)){if(!e||typeof e!=`object`)continue;let{enabled:t,status:r}=e;t!==!1&&(typeof r!=`string`||!V.has(r))&&(n+=1)}return n}function U(e){return a(`/api/channels`,{signal:e,parse:H})}function W(e){let t=e&&typeof e==`object`?e.metrics:null,n=t&&typeof t==`object`?t.onlineServices:void 0;if(typeof n!=`number`||!Number.isFinite(n)||n<0)throw o();return Math.floor(n)}function G(e){return a(`/api/mcp?refresh=0`,{signal:e,parse:W})}function K(e){let t=e&&typeof e==`object`?e.tasks:null;if(!Array.isArray(t))throw o();return t.filter(e=>e&&typeof e==`object`&&e.enabled===!0).length}function q(e){return a(`/api/schedules`,{signal:e,parse:K})}function J(e){let t=e&&typeof e==`object`?e.limits:null,n=t&&typeof t==`object`?t.running:void 0;if(typeof n!=`number`||!Number.isFinite(n)||n<0)throw o();return Math.floor(n)}function ae(e){return a(`/api/workflows`,{signal:e,parse:J})}var Y=[{key:`page:workflows`,load:ae,tone:`run`,interval:15e3},{key:`page:schedules`,load:q,tone:`neutral`,interval:6e4},{key:`page:channels`,load:U,tone:`attn`,interval:3e4},{key:`page:mcp`,load:G,tone:`neutral`,interval:6e4}];function X(e,t){return i({queryKey:[`more-tile-badge`,e.key],queryFn:({signal:t})=>e.load(t),enabled:t,staleTime:1e4,refetchInterval:t?e.interval:!1,retry:!1}).data}function oe(e,t){let n=[X(Y[0],t.has(Y[0].key)),X(Y[1],t.has(Y[1].key)),X(Y[2],t.has(Y[2].key)),X(Y[3],t.has(Y[3].key))],r=[t=>e(`navigation:more.badgeRunning`,{count:t}),t=>e(`navigation:more.badgeEnabled`,{count:t}),t=>e(`navigation:more.badgeDisconnected`,{count:t}),t=>e(`navigation:more.badgeOnline`,{count:t})],i=new Map;return Y.forEach((e,a)=>{let o=n[a];typeof o==`number`&&o>0&&t.has(e.key)&&i.set(e.key,{label:r[a](o),tone:e.tone})}),i}var Z=n(),se=6,Q=`[data-more-tile]`,$=``;function ce(e,t){return e?.querySelector(`[data-more-tile="${CSS.escape(t)}"]`)??null}function le({onOpen:e}){let{t,language:n}=r(),i=(0,L.useId)(),[a,o]=(0,L.useState)(``),s=F(`commandPalette`),c=F(`focusSearch`),l=u(e=>e.capabilities),p=ee(e=>e.client===`mobile-app`),m=f(),h=t(`navigation:more.title`),g=d(),_=(0,L.useMemo)(()=>g.items.map(({componentId:e,name:t,description:n})=>({id:e,name:t,description:n})),[g.items]),v=(0,L.useMemo)(()=>z(t,{capabilities:l,mobileApp:p,components:_}),[l,_,p,t]),b=(0,L.useMemo)(()=>B(v,a,n),[v,n,a]),x=oe(t,(0,L.useMemo)(()=>new Set(v.flatMap(e=>e.tiles.map(e=>e.key))),[v])),S=(0,L.useMemo)(()=>a.trim()?P(a,n,{capabilities:l,mobileApp:p}).slice(0,se):[],[l,n,p,a]);(0,L.useEffect)(()=>(document.title=`${h} · ${O}`,()=>{document.title=O}),[h]);let C=t=>{if(t.entry.card===`interface-custom-ui`){e({type:`page`,id:`components`});return}N(t.entry.card,t.entry.section,{targetId:t.entry.targetId,targetText:t.title,expandGroup:t.entry.expandGroup}),e({type:`config`,id:t.entry.section})},w=(0,Z.jsxs)(j,{variant:`outline`,className:`h-auto min-h-11 w-full justify-start gap-2.5 py-2 text-left whitespace-normal`,"data-more-palette-search":!0,onClick:()=>ie(a.trim()),children:[m?(0,Z.jsx)(E,{className:`flex-none`,"aria-hidden":`true`}):(0,Z.jsx)(I,{className:`flex-none`,"aria-hidden":`true`}),(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,Z.jsx)(`span`,{className:`truncate text-sm text-content`,children:t(`navigation:more.searchPalette`,{query:a.trim()})}),(0,Z.jsx)(`span`,{className:`text-xs font-normal text-content-muted`,children:t(`navigation:more.searchPaletteHint`)})]})]}),T=`mb-2 text-[13px] font-medium text-content-muted`;return(0,L.useLayoutEffect)(()=>{let e=document.querySelector(`[data-features-index]`),t=$;$=``;let n=0,r=0,i=!t,a=()=>{let o=ce(e,t);o?(o.focus(),i=!0):(n+=1)<20?r=requestAnimationFrame(a):i=!0};return t&&(r=requestAnimationFrame(a)),()=>{cancelAnimationFrame(r),i||($=t);let n=document.activeElement,a=n instanceof HTMLElement&&e?.contains(n)?n.closest(Q):null;a?.dataset.moreTile&&($=a.dataset.moreTile)}},[]),(0,Z.jsxs)(`div`,{"data-features-index":!0,className:`flex h-full min-h-0 w-full flex-col bg-background`,children:[!m&&(0,Z.jsx)(`div`,{"data-window-drag-region":!0,"aria-hidden":`true`,className:`h-[52px] flex-none`}),(0,Z.jsx)(`div`,{"data-features-scroller":!0,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,onKeyDown:ue,children:(0,Z.jsxs)(`div`,{"data-features-column":!0,className:`mx-auto flex w-full max-w-[808px] flex-col px-6 pb-16 max-[650px]:px-4 max-[650px]:pt-4 max-[650px]:pb-8`,children:[(0,Z.jsxs)(`header`,{"data-focus-region":`header`,className:`flex flex-col`,children:[(0,Z.jsx)(`h1`,{id:i,className:A(`text-2xl leading-8 font-semibold tracking-[-.01em] text-content`,m&&`sr-only`),children:h}),(0,Z.jsx)(`p`,{className:A(`mt-1 text-sm text-content-muted`,m&&`hidden`),children:s&&!m?t(`navigation:more.lede`,{shortcut:s}):t(`navigation:more.ledeNoShortcut`)}),(0,Z.jsxs)(`label`,{className:A(`relative mt-5 flex h-9 w-full items-center gap-2 rounded-[var(--r-md)] border border-control bg-panel px-3 text-content-muted focus-within:border-focus focus-within:ring-3 focus-within:ring-focus-ring max-[650px]:h-11`,m&&`mt-0`),children:[(0,Z.jsx)(E,{className:`size-4 flex-none`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`sr-only`,children:t(`navigation:more.search`)}),(0,Z.jsx)(`input`,{id:k,type:`search`,value:a,placeholder:t(`navigation:more.search`),"aria-keyshortcuts":c||void 0,className:`w-full min-w-0 border-0 bg-transparent text-[length:var(--app-font-size)] text-content caret-focus outline-none max-[650px]:text-[16px] [&::-webkit-search-cancel-button]:hidden`,onChange:e=>o(e.target.value),onKeyDown:e=>{if(e.key===`Escape`&&a)e.preventDefault(),e.stopPropagation(),o(``);else if(e.key===`ArrowDown`){let t=e.currentTarget.closest(`[data-features-scroller]`)?.querySelector(Q);t&&(e.preventDefault(),e.stopPropagation(),t.focus())}}}),a?(0,Z.jsx)(`button`,{type:`button`,className:`grid size-6 flex-none place-items-center rounded-xs text-content-muted hover:bg-surface-hover hover:text-content focus-visible:outline-2 focus-visible:outline-focus pointer-coarse:size-11`,"aria-label":t(`navigation:more.clearSearch`),onClick:()=>o(``),children:(0,Z.jsx)(D,{className:`size-3.5`,"aria-hidden":`true`})}):c&&(0,Z.jsx)(M,{className:`flex-none pointer-coarse:hidden`,children:c})]})]}),b.length===0&&S.length===0?(0,Z.jsxs)(`div`,{role:`status`,"data-features-empty":!0,className:`flex flex-col items-center gap-2 py-16 text-center`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium text-content`,children:t(`navigation:more.noResults`)}),(0,Z.jsx)(`p`,{className:`max-w-sm text-xs text-content-muted`,children:t(`navigation:more.noResultsHint`,{shortcut:s||`⌘K`})}),(0,Z.jsxs)(`div`,{className:`mt-2 flex w-full max-w-sm flex-col gap-2`,children:[w,(0,Z.jsx)(j,{variant:`secondary`,className:`min-h-11`,onClick:()=>o(``),children:t(`navigation:more.clearSearch`)})]})]}):b.map(n=>{let r=`${i}-${n.id}`;return(0,Z.jsxs)(`section`,{"data-more-group":n.id,"aria-labelledby":r,className:`mt-7 flex flex-col`,children:[(0,Z.jsx)(`h2`,{id:r,className:T,children:n.label}),(0,Z.jsx)(`ul`,{className:`grid grid-cols-2 gap-2 max-[650px]:grid-cols-1`,children:n.tiles.map(t=>(0,Z.jsx)(`li`,{className:`min-w-0`,children:(0,Z.jsx)(de,{tile:t,badge:x.get(t.key),onOpen:e})},t.key))}),n.id===`components`&&!a&&g.isLoading&&(0,Z.jsx)(`p`,{role:`status`,className:`mt-2 text-xs text-content-muted`,children:t(`navigation:more.componentsLoading`)}),n.id===`components`&&!a&&!!g.error&&(0,Z.jsxs)(`p`,{role:`alert`,className:`mt-2 flex items-center gap-2 text-xs text-content-muted`,children:[t(`navigation:more.componentsError`),(0,Z.jsx)(j,{variant:`ghost`,size:`xs`,onClick:g.refetch,children:t(`navigation:more.retry`)})]})]},n.id)}),a.trim()&&(b.length>0||S.length>0)&&(0,Z.jsxs)(`section`,{"aria-labelledby":`${i}-search`,className:`mt-7 flex flex-col`,children:[(0,Z.jsx)(`h2`,{id:`${i}-search`,className:T,children:t(`navigation:more.settingsResults`)}),S.length>0&&(0,Z.jsx)(`ul`,{"data-more-settings-results":!0,className:`mb-2 flex flex-col divide-y divide-stroke-soft overflow-hidden rounded-card border border-stroke`,children:S.map(e=>(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(`button`,{type:`button`,className:`flex min-h-11 w-full min-w-0 items-center gap-3 px-3.5 py-2 text-left transition-colors duration-(--d-fast) hover:bg-surface-hover focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus`,onClick:()=>C(e),children:[(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,Z.jsx)(`span`,{className:`truncate text-sm text-content`,children:e.title}),e.sectionTitle!==e.title&&(0,Z.jsx)(`span`,{className:`truncate text-xs text-content-muted`,children:e.sectionTitle})]}),(0,Z.jsx)(y,{className:`size-4 flex-none text-content-muted`,"aria-hidden":`true`})]})},e.entry.id))}),w]})]})})]})}function ue(e){let t=e.target;if(!(t instanceof HTMLElement)||!t.matches(Q)||e.altKey||e.ctrlKey||e.metaKey||e.shiftKey)return;let n=[...e.currentTarget.querySelectorAll(Q)],r=n.indexOf(t);if(r<0)return;let i;if(e.key===`ArrowRight`)i=n[r+1];else if(e.key===`ArrowLeft`)i=n[r-1];else if(e.key===`Home`)i=n[0];else if(e.key===`End`)i=n.at(-1);else if(e.key===`ArrowDown`||e.key===`ArrowUp`){let r=t.getBoundingClientRect(),a=e.key===`ArrowDown`,o=r.left+r.width/2,s=n.map(e=>({tile:e,box:e.getBoundingClientRect()})).filter(({box:e})=>a?e.top>=r.bottom-1:e.bottom<=r.top+1);if(s.length>0){let e=a?Math.min(...s.map(({box:e})=>e.top)):Math.max(...s.map(({box:e})=>e.top));i=s.filter(({box:t})=>Math.abs(t.top-e)<2).sort((e,t)=>Math.abs(e.box.left+e.box.width/2-o)-Math.abs(t.box.left+t.box.width/2-o))[0]?.tile}else if(!a){document.getElementById(k)?.focus(),e.preventDefault();return}}else return;e.preventDefault(),i?.focus()}function de({tile:e,badge:t,onOpen:n}){let{t:i}=r(),a=e.icon,o=!!e.disabledReason,s=e.key===R;return(0,Z.jsxs)(`button`,{type:`button`,"data-more-tile":e.key,"aria-disabled":o||void 0,"aria-label":o?i(`navigation:more.disabledTile`,{label:e.label,reason:e.disabledReason}):void 0,className:A(`flex min-h-16 w-full min-w-0 items-center gap-3 rounded-card border px-3.5 py-2.5 text-left transition-colors duration-(--d-fast) focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus max-[650px]:min-h-14 max-[650px]:py-2`,s?`border-dashed border-stroke-strong`:`border-stroke`,o?`cursor-not-allowed`:`hover:bg-surface-hover`),onClick:()=>{o||($=e.key,n(e.destination))},children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:A(`grid size-[34px] flex-none place-items-center rounded-[var(--r-md)] max-[650px]:size-8`,s?`text-content-muted`:`bg-surface-subtle text-content-secondary`,o&&`text-content-muted`),children:(0,Z.jsx)(a,{className:`size-[18px]`,strokeWidth:1.75})}),(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,Z.jsx)(`span`,{className:A(`truncate text-sm font-medium text-content`,(o||s)&&`text-content-secondary`),children:e.label}),(0,Z.jsx)(`span`,{className:`truncate text-xs text-content-muted`,children:e.disabledReason||e.description})]}),t&&!o&&(0,Z.jsxs)(`span`,{"data-more-badge":t.tone,className:A(`flex max-w-[45%] flex-none items-center gap-1.5 text-xs whitespace-nowrap tabular-nums`,t.tone===`attn`?`font-medium text-st-attn`:`text-content-muted`),children:[t.tone===`attn`&&(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`size-2 flex-none rounded-full bg-st-attn-fill`}),(0,Z.jsx)(`span`,{className:`truncate`,children:t.label})]})]})}export{le as MorePage};
1
+ import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t,r as n}from"./vendor-react-DwNgTV1j.js";import{t as r}from"./use-i18n-B2p84ZNR.js";import{t as i}from"./useQuery-DdcpUQhO.js";import{a,l as o}from"./api-CIB7ZPX3.js";import{a as s,n as c,t as l}from"./runtime-capabilities-CHYOF_hE.js";import{t as u}from"./runtime-capabilities-store-DpEKnn1b.js";import{m as d}from"./placements-5hgUqGzE.js";import{t as ee}from"./client-store-BSqTT-c2.js";import{t as f}from"./usePhoneShell-BSkh5GND.js";import{t as p}from"./createLucideIcon-Cd-3GVxJ.js";import{t as m}from"./app-window-CPNdvYNt.js";import{t as h}from"./blocks-Olsdp5Lp.js";import{t as g}from"./bot-B3TaBp_T.js";import{t as _}from"./brain-qxhnKqYP.js";import{t as v}from"./calendar-clock-VIxTaqqy.js";import{t as y}from"./chevron-right-C3t2Rckj.js";import{t as b}from"./image-BY_c3FYU.js";import{t as x}from"./monitor-smartphone-B1gIjItA.js";import{t as S}from"./plug-BsIeHRwC.js";import{t as C}from"./plus-fQbSqB1n.js";import{t as w}from"./radio-tower-jGQwrFWB.js";import{t as T}from"./rotate-ccw-clock-CO6Bw-sF.js";import{t as E}from"./search-D0mqDaf_.js";import{t as te}from"./server-BgNvmqwJ.js";import{t as ne}from"./sparkles-S_eeuqn9.js";import{t as re}from"./workflow-Bg94dy8I.js";import{t as D}from"./x-07u4-129.js";import{t as O}from"./brand-DIEc3fK8.js";import{i as k}from"./more-pages-D_PnxLN0.js";import{t as A}from"./utils-C8uzG5AZ.js";import{t as j}from"./button-CCcCN8tE.js";import{t as M}from"./kbd-CAufZTkl.js";import{g as ie}from"./events-CrT7ie40.js";import{n as N,r as P}from"./config-search-DdXAm7PX.js";import{s as F}from"./shortcuts-DXHroTTi.js";var I=p(`command`,[[`path`,{d:`M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3`,key:`11bfej`}]]),L=e(t(),1),R=`add:component`;function z(e,{capabilities:t=l,mobileApp:n=!1,components:r=[]}={}){let i=(e,n,r,i)=>s(t,e)?{key:`page:${e}`,label:n,description:r,icon:i,destination:{type:`page`,id:e}}:null,a=e=>c(t,e,{mobileApp:n}),o=a(`remote-access`),u=a(`desktop-pet`),d=[a(`mobile-server`).supported?{key:`config:mobile-server`,label:e(`config:configPage.mobileServer`),description:e(`navigation:more.mobileServerHint`),icon:x,destination:{type:`config`,id:`mobile-server`}}:o.supported?{key:`config:remote-access`,label:e(`config:configPage.remoteAccess`),description:e(`navigation:more.remoteAccessHint`),icon:x,destination:{type:`config`,id:`remote-access`}}:null,u.supported||u.reason===`desktop-only`?{key:`config:desktop-pet`,label:e(`config:configPage.desktopPet`),description:e(`navigation:more.desktopPetHint`),icon:g,destination:{type:`config`,id:`desktop-pet`},...u.supported?{}:{disabledReason:e(`navigation:more.desktopOnly`)}}:null];return[{id:`sessions`,label:e(`navigation:more.groupSessions`),tiles:[i(`chatHistory`,e(`navigation:navigation.chatHistory`),e(`navigation:more.chatHistoryHint`),T),i(`assets`,e(`navigation:navigation.assets`),e(`navigation:more.assetsHint`),b),i(`memory`,e(`navigation:navigation.memory`),e(`navigation:more.memoryHint`),_)]},{id:`automation`,label:e(`navigation:more.groupAutomation`),tiles:[i(`workflows`,e(`navigation:navigation.workflows`),e(`navigation:more.workflowsHint`),re),i(`schedules`,e(`navigation:navigation.schedules`),e(`navigation:more.schedulesHint`),v),i(`channels`,e(`navigation:navigation.channels`),e(`navigation:more.channelsHint`),w)]},{id:`extensions`,label:e(`navigation:more.groupExtensions`),tiles:[i(`plugins`,e(`navigation:navigation.plugins`),e(`navigation:more.pluginsHint`),S),i(`skills`,e(`navigation:navigation.skills`),e(`navigation:more.skillsHint`),ne),i(`mcp`,e(`navigation:navigation.mcp`),e(`navigation:more.mcpHint`),te),{key:`page:components`,label:e(`navigation:shell.components`),description:e(`navigation:more.componentStudioHint`),icon:h,destination:{type:`page`,id:`components`}}]},{id:`devices`,label:e(`navigation:more.groupDevices`),tiles:d},{id:`components`,label:e(`navigation:more.groupComponents`),tiles:[...r.map(t=>({key:`component:${t.id}`,label:t.name,description:t.description||e(`navigation:more.componentHint`),icon:m,destination:{type:`component`,id:t.id}})),{key:R,label:e(`navigation:more.addComponent`),description:e(`navigation:more.addComponentHint`),icon:C,destination:{type:`page`,id:`components`}}]}].map(e=>({id:e.id,label:e.label,tiles:e.tiles.filter(e=>e!==null)})).filter(e=>e.tiles.length>0)}function B(e,t,n){let r=t.trim().toLocaleLowerCase(n);return r?e.map(e=>({...e,tiles:e.tiles.filter(t=>[t.label,t.description,e.label].some(e=>e.toLocaleLowerCase(n).includes(r)))})).filter(e=>e.tiles.length>0):[...e]}var V=new Set([`connected`,`connecting`,`reconnecting`]);function H(e){let t=e&&typeof e==`object`?e.connections:null;if(!t||typeof t!=`object`||Array.isArray(t))throw o();let n=0;for(let e of Object.values(t)){if(!e||typeof e!=`object`)continue;let{enabled:t,status:r}=e;t!==!1&&(typeof r!=`string`||!V.has(r))&&(n+=1)}return n}function U(e){return a(`/api/channels`,{signal:e,parse:H})}function W(e){let t=e&&typeof e==`object`?e.metrics:null,n=t&&typeof t==`object`?t.onlineServices:void 0;if(typeof n!=`number`||!Number.isFinite(n)||n<0)throw o();return Math.floor(n)}function G(e){return a(`/api/mcp?refresh=0`,{signal:e,parse:W})}function K(e){let t=e&&typeof e==`object`?e.tasks:null;if(!Array.isArray(t))throw o();return t.filter(e=>e&&typeof e==`object`&&e.enabled===!0).length}function q(e){return a(`/api/schedules`,{signal:e,parse:K})}function J(e){let t=e&&typeof e==`object`?e.limits:null,n=t&&typeof t==`object`?t.running:void 0;if(typeof n!=`number`||!Number.isFinite(n)||n<0)throw o();return Math.floor(n)}function ae(e){return a(`/api/workflows`,{signal:e,parse:J})}var Y=[{key:`page:workflows`,load:ae,tone:`run`,interval:15e3},{key:`page:schedules`,load:q,tone:`neutral`,interval:6e4},{key:`page:channels`,load:U,tone:`attn`,interval:3e4},{key:`page:mcp`,load:G,tone:`neutral`,interval:6e4}];function X(e,t){return i({queryKey:[`more-tile-badge`,e.key],queryFn:({signal:t})=>e.load(t),enabled:t,staleTime:1e4,refetchInterval:t?e.interval:!1,retry:!1}).data}function oe(e,t){let n=[X(Y[0],t.has(Y[0].key)),X(Y[1],t.has(Y[1].key)),X(Y[2],t.has(Y[2].key)),X(Y[3],t.has(Y[3].key))],r=[t=>e(`navigation:more.badgeRunning`,{count:t}),t=>e(`navigation:more.badgeEnabled`,{count:t}),t=>e(`navigation:more.badgeDisconnected`,{count:t}),t=>e(`navigation:more.badgeOnline`,{count:t})],i=new Map;return Y.forEach((e,a)=>{let o=n[a];typeof o==`number`&&o>0&&t.has(e.key)&&i.set(e.key,{label:r[a](o),tone:e.tone})}),i}var Z=n(),se=6,Q=`[data-more-tile]`,$=``;function ce(e,t){return e?.querySelector(`[data-more-tile="${CSS.escape(t)}"]`)??null}function le({onOpen:e}){let{t,language:n}=r(),i=(0,L.useId)(),[a,o]=(0,L.useState)(``),s=F(`commandPalette`),c=F(`focusSearch`),l=u(e=>e.capabilities),p=ee(e=>e.client===`mobile-app`),m=f(),h=t(`navigation:more.title`),g=d(),_=(0,L.useMemo)(()=>g.items.map(({componentId:e,name:t,description:n})=>({id:e,name:t,description:n})),[g.items]),v=(0,L.useMemo)(()=>z(t,{capabilities:l,mobileApp:p,components:_}),[l,_,p,t]),b=(0,L.useMemo)(()=>B(v,a,n),[v,n,a]),x=oe(t,(0,L.useMemo)(()=>new Set(v.flatMap(e=>e.tiles.map(e=>e.key))),[v])),S=(0,L.useMemo)(()=>a.trim()?P(a,n,{capabilities:l,mobileApp:p}).slice(0,se):[],[l,n,p,a]);(0,L.useEffect)(()=>(document.title=`${h} · ${O}`,()=>{document.title=O}),[h]);let C=t=>{if(t.entry.card===`interface-custom-ui`){e({type:`page`,id:`components`});return}N(t.entry.card,t.entry.section,{targetId:t.entry.targetId,targetText:t.title,expandGroup:t.entry.expandGroup}),e({type:`config`,id:t.entry.section})},w=(0,Z.jsxs)(j,{variant:`outline`,className:`h-auto min-h-11 w-full justify-start gap-2.5 py-2 text-left whitespace-normal`,"data-more-palette-search":!0,onClick:()=>ie(a.trim()),children:[m?(0,Z.jsx)(E,{className:`flex-none`,"aria-hidden":`true`}):(0,Z.jsx)(I,{className:`flex-none`,"aria-hidden":`true`}),(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,Z.jsx)(`span`,{className:`truncate text-sm text-content`,children:t(`navigation:more.searchPalette`,{query:a.trim()})}),(0,Z.jsx)(`span`,{className:`text-xs font-normal text-content-muted`,children:t(`navigation:more.searchPaletteHint`)})]})]}),T=`mb-2 text-[13px] font-medium text-content-muted`;return(0,L.useLayoutEffect)(()=>{let e=document.querySelector(`[data-features-index]`),t=$;$=``;let n=0,r=0,i=!t,a=()=>{let o=ce(e,t);o?(o.focus(),i=!0):(n+=1)<20?r=requestAnimationFrame(a):i=!0};return t&&(r=requestAnimationFrame(a)),()=>{cancelAnimationFrame(r),i||($=t);let n=document.activeElement,a=n instanceof HTMLElement&&e?.contains(n)?n.closest(Q):null;a?.dataset.moreTile&&($=a.dataset.moreTile)}},[]),(0,Z.jsxs)(`div`,{"data-features-index":!0,className:`flex h-full min-h-0 w-full flex-col bg-background`,children:[!m&&(0,Z.jsx)(`div`,{"data-window-drag-region":!0,"aria-hidden":`true`,className:`h-[52px] flex-none`}),(0,Z.jsx)(`div`,{"data-features-scroller":!0,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,onKeyDown:ue,children:(0,Z.jsxs)(`div`,{"data-features-column":!0,className:`mx-auto flex w-full max-w-[808px] flex-col px-6 pb-16 max-[650px]:px-4 max-[650px]:pt-4 max-[650px]:pb-8`,children:[(0,Z.jsxs)(`header`,{"data-focus-region":`header`,className:`flex flex-col`,children:[(0,Z.jsx)(`h1`,{id:i,className:A(`text-2xl leading-8 font-semibold tracking-[-.01em] text-content`,m&&`sr-only`),children:h}),(0,Z.jsx)(`p`,{className:A(`mt-1 text-sm text-content-muted`,m&&`hidden`),children:s&&!m?t(`navigation:more.lede`,{shortcut:s}):t(`navigation:more.ledeNoShortcut`)}),(0,Z.jsxs)(`label`,{className:A(`relative mt-5 flex h-9 w-full items-center gap-2 rounded-[var(--r-md)] border border-control bg-panel px-3 text-content-muted focus-within:border-focus focus-within:ring-3 focus-within:ring-focus-ring max-[650px]:h-11`,m&&`mt-0`),children:[(0,Z.jsx)(E,{className:`size-4 flex-none`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`sr-only`,children:t(`navigation:more.search`)}),(0,Z.jsx)(`input`,{id:k,type:`search`,value:a,placeholder:t(`navigation:more.search`),"aria-keyshortcuts":c||void 0,className:`w-full min-w-0 border-0 bg-transparent text-[length:var(--app-font-size)] text-content caret-focus outline-none max-[650px]:text-[16px] [&::-webkit-search-cancel-button]:hidden`,onChange:e=>o(e.target.value),onKeyDown:e=>{if(e.key===`Escape`&&a)e.preventDefault(),e.stopPropagation(),o(``);else if(e.key===`ArrowDown`){let t=e.currentTarget.closest(`[data-features-scroller]`)?.querySelector(Q);t&&(e.preventDefault(),e.stopPropagation(),t.focus())}}}),a?(0,Z.jsx)(`button`,{type:`button`,className:`grid size-6 flex-none place-items-center rounded-xs text-content-muted hover:bg-surface-hover hover:text-content focus-visible:outline-2 focus-visible:outline-focus pointer-coarse:size-11`,"aria-label":t(`navigation:more.clearSearch`),onClick:()=>o(``),children:(0,Z.jsx)(D,{className:`size-3.5`,"aria-hidden":`true`})}):c&&(0,Z.jsx)(M,{className:`flex-none pointer-coarse:hidden`,children:c})]})]}),b.length===0&&S.length===0?(0,Z.jsxs)(`div`,{role:`status`,"data-features-empty":!0,className:`flex flex-col items-center gap-2 py-16 text-center`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium text-content`,children:t(`navigation:more.noResults`)}),(0,Z.jsx)(`p`,{className:`max-w-sm text-xs text-content-muted`,children:t(`navigation:more.noResultsHint`,{shortcut:s||`⌘K`})}),(0,Z.jsxs)(`div`,{className:`mt-2 flex w-full max-w-sm flex-col gap-2`,children:[w,(0,Z.jsx)(j,{variant:`secondary`,className:`min-h-11`,onClick:()=>o(``),children:t(`navigation:more.clearSearch`)})]})]}):b.map(n=>{let r=`${i}-${n.id}`;return(0,Z.jsxs)(`section`,{"data-more-group":n.id,"aria-labelledby":r,className:`mt-7 flex flex-col`,children:[(0,Z.jsx)(`h2`,{id:r,className:T,children:n.label}),(0,Z.jsx)(`ul`,{className:`grid grid-cols-2 gap-2 max-[650px]:grid-cols-1`,children:n.tiles.map(t=>(0,Z.jsx)(`li`,{className:`min-w-0`,children:(0,Z.jsx)(de,{tile:t,badge:x.get(t.key),onOpen:e})},t.key))}),n.id===`components`&&!a&&g.isLoading&&(0,Z.jsx)(`p`,{role:`status`,className:`mt-2 text-xs text-content-muted`,children:t(`navigation:more.componentsLoading`)}),n.id===`components`&&!a&&!!g.error&&(0,Z.jsxs)(`p`,{role:`alert`,className:`mt-2 flex items-center gap-2 text-xs text-content-muted`,children:[t(`navigation:more.componentsError`),(0,Z.jsx)(j,{variant:`ghost`,size:`xs`,onClick:g.refetch,children:t(`navigation:more.retry`)})]})]},n.id)}),a.trim()&&(b.length>0||S.length>0)&&(0,Z.jsxs)(`section`,{"aria-labelledby":`${i}-search`,className:`mt-7 flex flex-col`,children:[(0,Z.jsx)(`h2`,{id:`${i}-search`,className:T,children:t(`navigation:more.settingsResults`)}),S.length>0&&(0,Z.jsx)(`ul`,{"data-more-settings-results":!0,className:`mb-2 flex flex-col divide-y divide-stroke-soft overflow-hidden rounded-card border border-stroke`,children:S.map(e=>(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(`button`,{type:`button`,className:`flex min-h-11 w-full min-w-0 items-center gap-3 px-3.5 py-2 text-left transition-colors duration-(--d-fast) hover:bg-surface-hover focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus`,onClick:()=>C(e),children:[(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,Z.jsx)(`span`,{className:`truncate text-sm text-content`,children:e.title}),e.sectionTitle!==e.title&&(0,Z.jsx)(`span`,{className:`truncate text-xs text-content-muted`,children:e.sectionTitle})]}),(0,Z.jsx)(y,{className:`size-4 flex-none text-content-muted`,"aria-hidden":`true`})]})},e.entry.id))}),w]})]})})]})}function ue(e){let t=e.target;if(!(t instanceof HTMLElement)||!t.matches(Q)||e.altKey||e.ctrlKey||e.metaKey||e.shiftKey)return;let n=[...e.currentTarget.querySelectorAll(Q)],r=n.indexOf(t);if(r<0)return;let i;if(e.key===`ArrowRight`)i=n[r+1];else if(e.key===`ArrowLeft`)i=n[r-1];else if(e.key===`Home`)i=n[0];else if(e.key===`End`)i=n.at(-1);else if(e.key===`ArrowDown`||e.key===`ArrowUp`){let r=t.getBoundingClientRect(),a=e.key===`ArrowDown`,o=r.left+r.width/2,s=n.map(e=>({tile:e,box:e.getBoundingClientRect()})).filter(({box:e})=>a?e.top>=r.bottom-1:e.bottom<=r.top+1);if(s.length>0){let e=a?Math.min(...s.map(({box:e})=>e.top)):Math.max(...s.map(({box:e})=>e.top));i=s.filter(({box:t})=>Math.abs(t.top-e)<2).sort((e,t)=>Math.abs(e.box.left+e.box.width/2-o)-Math.abs(t.box.left+t.box.width/2-o))[0]?.tile}else if(!a){document.getElementById(k)?.focus(),e.preventDefault();return}}else return;e.preventDefault(),i?.focus()}function de({tile:e,badge:t,onOpen:n}){let{t:i}=r(),a=e.icon,o=!!e.disabledReason,s=e.key===R;return(0,Z.jsxs)(`button`,{type:`button`,"data-more-tile":e.key,"aria-disabled":o||void 0,"aria-label":o?i(`navigation:more.disabledTile`,{label:e.label,reason:e.disabledReason}):void 0,className:A(`flex min-h-16 w-full min-w-0 items-center gap-3 rounded-card border px-3.5 py-2.5 text-left transition-colors duration-(--d-fast) focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus max-[650px]:min-h-14 max-[650px]:py-2`,s?`border-dashed border-stroke-strong`:`border-stroke`,o?`cursor-not-allowed`:`hover:bg-surface-hover`),onClick:()=>{o||($=e.key,n(e.destination))},children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:A(`grid size-[34px] flex-none place-items-center rounded-[var(--r-md)] max-[650px]:size-8`,s?`text-content-muted`:`bg-surface-subtle text-content-secondary`,o&&`text-content-muted`),children:(0,Z.jsx)(a,{className:`size-[18px]`,strokeWidth:1.75})}),(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,Z.jsx)(`span`,{className:A(`truncate text-sm font-medium text-content`,(o||s)&&`text-content-secondary`),children:e.label}),(0,Z.jsx)(`span`,{className:`truncate text-xs text-content-muted`,children:e.disabledReason||e.description})]}),t&&!o&&(0,Z.jsxs)(`span`,{"data-more-badge":t.tone,className:A(`flex max-w-[45%] flex-none items-center gap-1.5 text-xs whitespace-nowrap tabular-nums`,t.tone===`attn`?`font-medium text-st-attn`:`text-content-muted`),children:[t.tone===`attn`&&(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`size-2 flex-none rounded-full bg-st-attn-fill`}),(0,Z.jsx)(`span`,{className:`truncate`,children:t.label})]})]})}export{le as MorePage};
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t,r as n}from"./vendor-react-DwNgTV1j.js";import{t as r}from"./use-i18n-Cyg5th6Z.js";import{u as i}from"./api-m-Yq8n0q.js";import{t as a}from"./folder-open-FIShC5Qk.js";import{i as o}from"./workspace-order-store-DshLVZf8.js";import{t as s}from"./triangle-alert-CE1q54ci.js";import{n as c,t as l}from"./button-CCcCN8tE.js";import{a as u,i as d,l as f,o as p,s as m,t as h}from"./dialog-5MLAAE-f.js";import{t as g}from"./input-CPw-zkYh.js";import{i as _,n as v,r as y,t as b}from"./input-group-h8z63MzW.js";import{t as x}from"./pick-system-directory-ByTVOp-v.js";import{r as S,t as C}from"./folder-paths-CdOS1VLF.js";import{n as w,t as T}from"./alert-firawb0H.js";import{n as E,t as D}from"./field-DoLEb0np.js";var O=e(t(),1),k=n();function A(e,t){switch(e){case`folder_name_required`:return t(`board:folder.error.nameRequired`);case`folder_name_invalid`:return t(`board:folder.error.nameInvalid`);case`folder_parent_missing`:case`folder_parent_invalid`:return t(`board:folder.error.parentMissing`);case`folder_exists_as_file`:return t(`board:folder.error.existsAsFile`);case`folder_permission_denied`:return t(`board:folder.error.permission`);default:return``}}function j({open:e,initialParent:t,onOpenChange:n,onCreated:j,onCloseAutoFocus:M}){let{t:N}=r(),[P,F]=(0,O.useState)(t),[I,L]=(0,O.useState)(``),[R,z]=(0,O.useState)(!1),[B,V]=(0,O.useState)(!1),[H,U]=(0,O.useState)(!1),[W,G]=(0,O.useState)(``),K=(0,O.useRef)(0),q=(0,O.useRef)(!1),J=(0,O.useRef)(null),Y=R||B;(0,O.useEffect)(()=>{K.current+=1,q.current=!1,e&&(F(t),L(``),z(!1),V(!1),U(!1),G(``))},[t,e]);let X=async()=>{if(q.current)return;q.current=!0;let e=K.current;V(!0),G(``);try{let t=await x(P.trim(),N(`board:folder.browseTitle`));if(e!==K.current)return;t.status===`picked`?F(t.path):t.status===`unavailable`&&(U(!0),J.current?.focus())}catch(t){e===K.current&&G(t instanceof Error?t.message:String(t))}finally{e===K.current&&(q.current=!1,V(!1))}},Z=async e=>{if(e.preventDefault(),q.current||!I.trim())return;q.current=!0;let t=K.current;z(!0),G(``);try{let e=await S(P.trim(),I.trim());if(t!==K.current)return;j(e.path),n(!1)}catch(e){if(t!==K.current)return;let n=A(e instanceof i?e.data?.code:void 0,N);G(n||(e instanceof Error&&e.message?N(`board:folder.error.failedWithReason`,{reason:e.message}):N(`board:folder.error.failed`)))}finally{t===K.current&&(q.current=!1,z(!1))}},Q=I.trim()?C(P,I.trim()):``;return(0,k.jsx)(h,{open:e,onOpenChange:e=>!q.current&&n(e),children:(0,k.jsxs)(d,{showCloseButton:!Y,"aria-describedby":`board-new-folder`,onCloseAutoFocus:M,"data-new-folder-dialog":!0,children:[(0,k.jsxs)(m,{children:[(0,k.jsx)(f,{children:N(`board:folder.title`)}),(0,k.jsx)(u,{id:`board-new-folder`,children:N(`board:folder.description`)})]}),(0,k.jsxs)(`form`,{className:`flex min-w-0 flex-col gap-4`,onSubmit:e=>void Z(e),children:[(0,k.jsxs)(E,{variant:`control`,children:[N(`board:folder.parent`),(0,k.jsxs)(b,{className:`max-[650px]:h-11`,children:[(0,k.jsx)(_,{ref:J,className:`font-mono text-xs`,value:P,disabled:Y,placeholder:N(`board:folder.parentPlaceholder`),"data-new-folder-parent":!0,onChange:e=>F(e.target.value)}),(0,k.jsx)(v,{align:`inline-end`,children:(0,k.jsxs)(y,{size:`xs`,disabled:Y,"data-new-folder-browse":!0,onClick:()=>void X(),children:[B?(0,k.jsx)(c,{className:`text-current`}):(0,k.jsx)(a,{}),N(`board:folder.browse`)]})})]})]}),H&&(0,k.jsx)(D,{className:`-mt-2`,children:N(`board:folder.browseUnavailable`)}),(0,k.jsxs)(E,{variant:`control`,children:[N(`board:folder.name`),(0,k.jsx)(g,{autoFocus:!0,className:`max-[650px]:h-11`,value:I,disabled:Y,placeholder:N(`board:folder.namePlaceholder`),autoComplete:`off`,spellCheck:!1,"data-new-folder-name":!0,onChange:e=>{L(e.target.value),W&&G(``)}})]}),Q&&(0,k.jsx)(`p`,{className:`-mt-2 truncate font-mono text-xs text-content-muted`,title:Q,children:N(`board:folder.preview`,{path:Q})}),W&&(0,k.jsxs)(T,{variant:`destructive`,children:[(0,k.jsx)(s,{}),(0,k.jsx)(w,{className:`min-w-0 break-words`,children:W})]}),(0,k.jsxs)(p,{children:[(0,k.jsx)(l,{type:`button`,variant:`secondary`,size:`dialogAction`,disabled:Y,onClick:()=>n(!1),children:N(`common:ui.cancel`)}),(0,k.jsxs)(l,{type:`submit`,size:`dialogAction`,disabled:Y||!I.trim(),children:[R?(0,k.jsx)(c,{className:`text-current`}):(0,k.jsx)(o,{}),N(R?`board:folder.creating`:`board:folder.create`)]})]})]})]})})}export{j as NewFolderDialog};
1
+ import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t,r as n}from"./vendor-react-DwNgTV1j.js";import{t as r}from"./use-i18n-B2p84ZNR.js";import{u as i}from"./api-CIB7ZPX3.js";import{t as a}from"./folder-open-FIShC5Qk.js";import{i as o}from"./workspace-order-store-CK1RETHt.js";import{t as s}from"./triangle-alert-CE1q54ci.js";import{n as c,t as l}from"./button-CCcCN8tE.js";import{a as u,i as d,l as f,o as p,s as m,t as h}from"./dialog-D1TVm0d6.js";import{t as g}from"./input-CPw-zkYh.js";import{i as _,n as v,r as y,t as b}from"./input-group-h8z63MzW.js";import{t as x}from"./pick-system-directory-B8aZR2BS.js";import{r as S,t as C}from"./folder-paths-BuiyvlAk.js";import{n as w,t as T}from"./alert-firawb0H.js";import{n as E,t as D}from"./field-DoLEb0np.js";var O=e(t(),1),k=n();function A(e,t){switch(e){case`folder_name_required`:return t(`board:folder.error.nameRequired`);case`folder_name_invalid`:return t(`board:folder.error.nameInvalid`);case`folder_parent_missing`:case`folder_parent_invalid`:return t(`board:folder.error.parentMissing`);case`folder_exists_as_file`:return t(`board:folder.error.existsAsFile`);case`folder_permission_denied`:return t(`board:folder.error.permission`);default:return``}}function j({open:e,initialParent:t,onOpenChange:n,onCreated:j,onCloseAutoFocus:M}){let{t:N}=r(),[P,F]=(0,O.useState)(t),[I,L]=(0,O.useState)(``),[R,z]=(0,O.useState)(!1),[B,V]=(0,O.useState)(!1),[H,U]=(0,O.useState)(!1),[W,G]=(0,O.useState)(``),K=(0,O.useRef)(0),q=(0,O.useRef)(!1),J=(0,O.useRef)(null),Y=R||B;(0,O.useEffect)(()=>{K.current+=1,q.current=!1,e&&(F(t),L(``),z(!1),V(!1),U(!1),G(``))},[t,e]);let X=async()=>{if(q.current)return;q.current=!0;let e=K.current;V(!0),G(``);try{let t=await x(P.trim(),N(`board:folder.browseTitle`));if(e!==K.current)return;t.status===`picked`?F(t.path):t.status===`unavailable`&&(U(!0),J.current?.focus())}catch(t){e===K.current&&G(t instanceof Error?t.message:String(t))}finally{e===K.current&&(q.current=!1,V(!1))}},Z=async e=>{if(e.preventDefault(),q.current||!I.trim())return;q.current=!0;let t=K.current;z(!0),G(``);try{let e=await S(P.trim(),I.trim());if(t!==K.current)return;j(e.path),n(!1)}catch(e){if(t!==K.current)return;let n=A(e instanceof i?e.data?.code:void 0,N);G(n||(e instanceof Error&&e.message?N(`board:folder.error.failedWithReason`,{reason:e.message}):N(`board:folder.error.failed`)))}finally{t===K.current&&(q.current=!1,z(!1))}},Q=I.trim()?C(P,I.trim()):``;return(0,k.jsx)(h,{open:e,onOpenChange:e=>!q.current&&n(e),children:(0,k.jsxs)(d,{showCloseButton:!Y,"aria-describedby":`board-new-folder`,onCloseAutoFocus:M,"data-new-folder-dialog":!0,children:[(0,k.jsxs)(m,{children:[(0,k.jsx)(f,{children:N(`board:folder.title`)}),(0,k.jsx)(u,{id:`board-new-folder`,children:N(`board:folder.description`)})]}),(0,k.jsxs)(`form`,{className:`flex min-w-0 flex-col gap-4`,onSubmit:e=>void Z(e),children:[(0,k.jsxs)(E,{variant:`control`,children:[N(`board:folder.parent`),(0,k.jsxs)(b,{className:`max-[650px]:h-11`,children:[(0,k.jsx)(_,{ref:J,className:`font-mono text-xs`,value:P,disabled:Y,placeholder:N(`board:folder.parentPlaceholder`),"data-new-folder-parent":!0,onChange:e=>F(e.target.value)}),(0,k.jsx)(v,{align:`inline-end`,children:(0,k.jsxs)(y,{size:`xs`,disabled:Y,"data-new-folder-browse":!0,onClick:()=>void X(),children:[B?(0,k.jsx)(c,{className:`text-current`}):(0,k.jsx)(a,{}),N(`board:folder.browse`)]})})]})]}),H&&(0,k.jsx)(D,{className:`-mt-2`,children:N(`board:folder.browseUnavailable`)}),(0,k.jsxs)(E,{variant:`control`,children:[N(`board:folder.name`),(0,k.jsx)(g,{autoFocus:!0,className:`max-[650px]:h-11`,value:I,disabled:Y,placeholder:N(`board:folder.namePlaceholder`),autoComplete:`off`,spellCheck:!1,"data-new-folder-name":!0,onChange:e=>{L(e.target.value),W&&G(``)}})]}),Q&&(0,k.jsx)(`p`,{className:`-mt-2 truncate font-mono text-xs text-content-muted`,title:Q,children:N(`board:folder.preview`,{path:Q})}),W&&(0,k.jsxs)(T,{variant:`destructive`,children:[(0,k.jsx)(s,{}),(0,k.jsx)(w,{className:`min-w-0 break-words`,children:W})]}),(0,k.jsxs)(p,{children:[(0,k.jsx)(l,{type:`button`,variant:`secondary`,size:`dialogAction`,disabled:Y,onClick:()=>n(!1),children:N(`common:ui.cancel`)}),(0,k.jsxs)(l,{type:`submit`,size:`dialogAction`,disabled:Y||!I.trim(),children:[R?(0,k.jsx)(c,{className:`text-current`}):(0,k.jsx)(o,{}),N(R?`board:folder.creating`:`board:folder.create`)]})]})]})]})})}export{j as NewFolderDialog};
@@ -1 +1 @@
1
- import{r as e}from"./vendor-react-DwNgTV1j.js";import{t}from"./use-i18n-Cyg5th6Z.js";import{t as n}from"./chevron-left-BAtyp3_6.js";import{t as r}from"./square-terminal-BVG6cUT1.js";import{r as i}from"./more-pages-D_PnxLN0.js";import{t as a}from"./utils-C8uzG5AZ.js";import{t as o}from"./button-CCcCN8tE.js";import{s}from"./shortcuts-Cgx6V2jI.js";var c=e();function l({meta:e,page:l,desktopPlatform:u,terminalOpen:d,onToggleTerminal:f,onBackToMore:p,phoneShell:m=!1}){let{t:h}=t(),g=s(`toggleTerminal`),_=!!u,v=i.has(l)||p?h(`navigation:sidebar.features`):``;return(0,c.jsx)(`header`,{"data-focus-region":`header`,"data-window-drag-region":!0,className:a(`@container/page-header relative z-[2] flex flex-none flex-col`,_&&`[-webkit-app-region:drag]`),children:(0,c.jsxs)(`div`,{className:a(`flex min-h-12 items-center gap-2 border-b border-stroke-soft py-1.5 pr-2.5 in-data-[density=compact]:min-h-11 max-[650px]:min-h-0 max-[650px]:flex-wrap max-[650px]:gap-x-2 max-[650px]:gap-y-0 max-[650px]:border-b-0 max-[650px]:px-4 max-[650px]:pt-0 max-[650px]:pb-3`,`pl-[calc(16px+var(--workbench-leading-inset,0px))] max-[650px]:pl-4`,`[[data-custom-titlebar]_&]:pr-[144px]`),children:[(0,c.jsxs)(`div`,{className:a(`mr-auto flex min-w-0 items-center gap-1.5 text-[13px]`,`max-[650px]:h-14 max-[650px]:basis-full max-[650px]:gap-2`,m&&(v&&p?`max-[650px]:h-11`:`max-[650px]:h-0`)),children:[v&&p?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsxs)(`button`,{type:`button`,"data-back-to-more":!0,className:`-ml-1.5 flex h-7 shrink-0 items-center gap-0.5 rounded-sm pr-1.5 pl-1 text-content-muted transition-colors duration-(--d-fast) hover:bg-surface-hover hover:text-content focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus max-[650px]:-ml-3 max-[650px]:h-11 max-[650px]:min-w-11 max-[650px]:pr-2 max-[650px]:text-sm max-[650px]:text-content-secondary`,"aria-label":h(`navigation:shell.backToFeaturesLabel`),onClick:p,children:[(0,c.jsx)(n,{className:`size-4 max-[650px]:size-5`,"aria-hidden":`true`}),(0,c.jsx)(`span`,{children:v})]}),(0,c.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0 text-content-faint max-[650px]:hidden`,children:`/`})]}):v&&(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(`span`,{className:`shrink-0 text-content-muted max-[900px]:hidden`,children:v}),(0,c.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0 text-content-faint max-[900px]:hidden`,children:`/`})]}),(0,c.jsx)(`h1`,{className:a(`max-w-full min-w-[4em] truncate text-[13px] leading-5 font-medium text-content max-[650px]:min-w-0 max-[650px]:text-2xl max-[650px]:leading-8 max-[650px]:font-[650] max-[650px]:tracking-[-.015em]`,m&&`sr-only`),children:e[0]}),e[1]&&!m&&(0,c.jsx)(`p`,{className:`ml-1.5 min-w-0 truncate text-xs text-content-muted max-[900px]:hidden max-[650px]:ml-0 max-[650px]:block max-[650px]:flex-1 max-[650px]:basis-0`,children:e[1]})]}),_&&(0,c.jsx)(`div`,{className:`flex min-w-0 items-center justify-end gap-1.5 [-webkit-app-region:no-drag]`,children:(0,c.jsx)(o,{variant:`ghost`,size:`icon`,className:a(`text-content-muted max-[650px]:hidden`,d&&`bg-surface-hover text-accent-fg`),title:g?`${h(`navigation:pageHeader.toggleTerminal`)} (${g})`:h(`navigation:pageHeader.toggleTerminal`),"aria-label":h(`navigation:pageHeader.toggleTerminal`),"aria-pressed":d,onClick:f,children:(0,c.jsx)(r,{size:16})})})]})})}export{l as PageHeader};
1
+ import{r as e}from"./vendor-react-DwNgTV1j.js";import{t}from"./use-i18n-B2p84ZNR.js";import{t as n}from"./chevron-left-BAtyp3_6.js";import{t as r}from"./square-terminal-BVG6cUT1.js";import{r as i}from"./more-pages-D_PnxLN0.js";import{t as a}from"./utils-C8uzG5AZ.js";import{t as o}from"./button-CCcCN8tE.js";import{s}from"./shortcuts-DXHroTTi.js";var c=e();function l({meta:e,page:l,desktopPlatform:u,terminalOpen:d,onToggleTerminal:f,onBackToMore:p,phoneShell:m=!1}){let{t:h}=t(),g=s(`toggleTerminal`),_=!!u,v=i.has(l)||p?h(`navigation:sidebar.features`):``;return(0,c.jsx)(`header`,{"data-focus-region":`header`,"data-window-drag-region":!0,className:a(`@container/page-header relative z-[2] flex flex-none flex-col`,_&&`[-webkit-app-region:drag]`),children:(0,c.jsxs)(`div`,{className:a(`flex min-h-12 items-center gap-2 border-b border-stroke-soft py-1.5 pr-2.5 in-data-[density=compact]:min-h-11 max-[650px]:min-h-0 max-[650px]:flex-wrap max-[650px]:gap-x-2 max-[650px]:gap-y-0 max-[650px]:border-b-0 max-[650px]:px-4 max-[650px]:pt-0 max-[650px]:pb-3`,`pl-[calc(16px+var(--workbench-leading-inset,0px))] max-[650px]:pl-4`,`[[data-custom-titlebar]_&]:pr-[144px]`),children:[(0,c.jsxs)(`div`,{className:a(`mr-auto flex min-w-0 items-center gap-1.5 text-[13px]`,`max-[650px]:h-14 max-[650px]:basis-full max-[650px]:gap-2`,m&&(v&&p?`max-[650px]:h-11`:`max-[650px]:h-0`)),children:[v&&p?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsxs)(`button`,{type:`button`,"data-back-to-more":!0,className:`-ml-1.5 flex h-7 shrink-0 items-center gap-0.5 rounded-sm pr-1.5 pl-1 text-content-muted transition-colors duration-(--d-fast) hover:bg-surface-hover hover:text-content focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus max-[650px]:-ml-3 max-[650px]:h-11 max-[650px]:min-w-11 max-[650px]:pr-2 max-[650px]:text-sm max-[650px]:text-content-secondary`,"aria-label":h(`navigation:shell.backToFeaturesLabel`),onClick:p,children:[(0,c.jsx)(n,{className:`size-4 max-[650px]:size-5`,"aria-hidden":`true`}),(0,c.jsx)(`span`,{children:v})]}),(0,c.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0 text-content-faint max-[650px]:hidden`,children:`/`})]}):v&&(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(`span`,{className:`shrink-0 text-content-muted max-[900px]:hidden`,children:v}),(0,c.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0 text-content-faint max-[900px]:hidden`,children:`/`})]}),(0,c.jsx)(`h1`,{className:a(`max-w-full min-w-[4em] truncate text-[13px] leading-5 font-medium text-content max-[650px]:min-w-0 max-[650px]:text-2xl max-[650px]:leading-8 max-[650px]:font-[650] max-[650px]:tracking-[-.015em]`,m&&`sr-only`),children:e[0]}),e[1]&&!m&&(0,c.jsx)(`p`,{className:`ml-1.5 min-w-0 truncate text-xs text-content-muted max-[900px]:hidden max-[650px]:ml-0 max-[650px]:block max-[650px]:flex-1 max-[650px]:basis-0`,children:e[1]})]}),_&&(0,c.jsx)(`div`,{className:`flex min-w-0 items-center justify-end gap-1.5 [-webkit-app-region:no-drag]`,children:(0,c.jsx)(o,{variant:`ghost`,size:`icon`,className:a(`text-content-muted max-[650px]:hidden`,d&&`bg-surface-hover text-accent-fg`),title:g?`${h(`navigation:pageHeader.toggleTerminal`)} (${g})`:h(`navigation:pageHeader.toggleTerminal`),"aria-label":h(`navigation:pageHeader.toggleTerminal`),"aria-pressed":d,onClick:f,children:(0,c.jsx)(r,{size:16})})})]})})}export{l as PageHeader};
@@ -1 +1 @@
1
- import{r as e}from"./vendor-react-DwNgTV1j.js";import{t}from"./use-i18n-Cyg5th6Z.js";import{n,t as r}from"./list-T5PqlpS2.js";import{t as i}from"./search-D0mqDaf_.js";import{t as a}from"./settings-QX0oWnVK.js";import{t as o}from"./square-pen-hYbjKh6A.js";import{t as s}from"./utils-C8uzG5AZ.js";import{n as c,o as l,r as u,t as d}from"./sheet-BTaIEX4w.js";import{t as f}from"./sidebar-store-BhEocW8t.js";var p=e(),m=`flex h-11 w-full min-w-0 items-center gap-3 rounded-[var(--r-md)] px-2.5 text-base text-content transition-colors duration-(--d-fast) focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus active:bg-surface-hover`;function h({active:e,onSearch:h,onNewTask:g,onOpenBoard:_,onOpenFeatures:v,onOpenSettings:y,content:b,boardCount:x,update:S}){let{t:C}=t(),w=f(e=>e.drawerOpen),T=f(e=>e.setDrawerOpen),E=e=>()=>{T(!1),e()},D=(t,n,r,i,a)=>(0,p.jsxs)(`button`,{type:`button`,"data-drawer-entry":t,"aria-current":e===t?`page`:void 0,className:s(m,e===t&&`bg-surface-active`),onClick:E(i),children:[(0,p.jsx)(n,{className:`size-[18px] flex-none text-content-secondary`,strokeWidth:1.75,"aria-hidden":`true`}),(0,p.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-left`,children:r}),a]});return(0,p.jsx)(d,{open:w,onOpenChange:T,children:(0,p.jsxs)(c,{side:`left`,showCloseButton:!1,"data-phone-drawer":!0,onCloseAutoFocus:e=>{let t=document.querySelector(`[data-phone-menu]`);t&&(e.preventDefault(),t.focus())},"aria-describedby":void 0,className:`w-[min(320px,85vw)] gap-0 border-stroke-soft bg-sidebar p-0 pt-[var(--pisper-safe-area-top)] pb-[var(--pisper-safe-area-bottom)] pl-[var(--pisper-safe-area-left)] data-[side=left]:w-[min(320px,85vw)] data-[side=left]:max-w-none`,children:[(0,p.jsx)(l,{className:`sr-only`,children:C(`navigation:phone.drawer`)}),(0,p.jsx)(u,{className:`sr-only`,children:C(`navigation:phone.drawerHint`)}),(0,p.jsxs)(`div`,{className:`flex flex-none items-center gap-2 px-3 pt-3 pb-2`,children:[(0,p.jsxs)(`button`,{type:`button`,"data-drawer-search":!0,className:`flex h-11 min-w-0 flex-1 items-center gap-2 rounded-[10px] bg-surface-muted px-3 text-left text-base text-content-muted focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus`,onClick:E(h),children:[(0,p.jsx)(i,{className:`size-[18px] flex-none`,strokeWidth:1.75,"aria-hidden":`true`}),(0,p.jsx)(`span`,{className:`truncate`,children:C(`navigation:sidebar.search`)})]}),(0,p.jsx)(`button`,{type:`button`,"data-drawer-new-task":!0,"aria-label":C(`navigation:shell.newTask`),className:`grid size-11 flex-none place-items-center rounded-[var(--r-md)] text-content-secondary focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus active:bg-surface-hover`,onClick:E(g),children:(0,p.jsx)(o,{className:`size-5`,strokeWidth:1.75,"aria-hidden":`true`})})]}),(0,p.jsxs)(`nav`,{"aria-label":C(`navigation:shell.primaryNavigation`),className:`flex-none px-2 pb-2`,children:[D(`board`,r,C(`navigation:sidebar.allAgents`),_,x?(0,p.jsx)(`span`,{className:`flex-none text-sm text-content-muted tabular-nums`,children:x}):void 0),D(`features`,n,C(`navigation:sidebar.features`),v)]}),(0,p.jsx)(`div`,{"data-drawer-sessions":!0,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain px-2 pt-1`,children:b}),(0,p.jsxs)(`div`,{className:`flex flex-none items-center gap-1 border-t border-stroke-soft px-2 py-2`,children:[(0,p.jsx)(`div`,{className:`min-w-0 flex-1`,children:D(`settings`,a,C(`navigation:navigation.settings`),y)}),S]})]})})}export{h as PhoneDrawer};
1
+ import{r as e}from"./vendor-react-DwNgTV1j.js";import{t}from"./use-i18n-B2p84ZNR.js";import{n,t as r}from"./list-T5PqlpS2.js";import{t as i}from"./search-D0mqDaf_.js";import{t as a}from"./settings-QX0oWnVK.js";import{t as o}from"./square-pen-hYbjKh6A.js";import{t as s}from"./utils-C8uzG5AZ.js";import{n as c,o as l,r as u,t as d}from"./sheet-BTaIEX4w.js";import{t as f}from"./sidebar-store-CbyxBthc.js";var p=e(),m=`flex h-11 w-full min-w-0 items-center gap-3 rounded-[var(--r-md)] px-2.5 text-base text-content transition-colors duration-(--d-fast) focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus active:bg-surface-hover`;function h({active:e,onSearch:h,onNewTask:g,onOpenBoard:_,onOpenFeatures:v,onOpenSettings:y,content:b,boardCount:x,update:S}){let{t:C}=t(),w=f(e=>e.drawerOpen),T=f(e=>e.setDrawerOpen),E=e=>()=>{T(!1),e()},D=(t,n,r,i,a)=>(0,p.jsxs)(`button`,{type:`button`,"data-drawer-entry":t,"aria-current":e===t?`page`:void 0,className:s(m,e===t&&`bg-surface-active`),onClick:E(i),children:[(0,p.jsx)(n,{className:`size-[18px] flex-none text-content-secondary`,strokeWidth:1.75,"aria-hidden":`true`}),(0,p.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-left`,children:r}),a]});return(0,p.jsx)(d,{open:w,onOpenChange:T,children:(0,p.jsxs)(c,{side:`left`,showCloseButton:!1,"data-phone-drawer":!0,onCloseAutoFocus:e=>{let t=document.querySelector(`[data-phone-menu]`);t&&(e.preventDefault(),t.focus())},"aria-describedby":void 0,className:`w-[min(320px,85vw)] gap-0 border-stroke-soft bg-sidebar p-0 pt-[var(--pisper-safe-area-top)] pb-[var(--pisper-safe-area-bottom)] pl-[var(--pisper-safe-area-left)] data-[side=left]:w-[min(320px,85vw)] data-[side=left]:max-w-none`,children:[(0,p.jsx)(l,{className:`sr-only`,children:C(`navigation:phone.drawer`)}),(0,p.jsx)(u,{className:`sr-only`,children:C(`navigation:phone.drawerHint`)}),(0,p.jsxs)(`div`,{className:`flex flex-none items-center gap-2 px-3 pt-3 pb-2`,children:[(0,p.jsxs)(`button`,{type:`button`,"data-drawer-search":!0,className:`flex h-11 min-w-0 flex-1 items-center gap-2 rounded-[10px] bg-surface-muted px-3 text-left text-base text-content-muted focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus`,onClick:E(h),children:[(0,p.jsx)(i,{className:`size-[18px] flex-none`,strokeWidth:1.75,"aria-hidden":`true`}),(0,p.jsx)(`span`,{className:`truncate`,children:C(`navigation:sidebar.search`)})]}),(0,p.jsx)(`button`,{type:`button`,"data-drawer-new-task":!0,"aria-label":C(`navigation:shell.newTask`),className:`grid size-11 flex-none place-items-center rounded-[var(--r-md)] text-content-secondary focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus active:bg-surface-hover`,onClick:E(g),children:(0,p.jsx)(o,{className:`size-5`,strokeWidth:1.75,"aria-hidden":`true`})})]}),(0,p.jsxs)(`nav`,{"aria-label":C(`navigation:shell.primaryNavigation`),className:`flex-none px-2 pb-2`,children:[D(`board`,r,C(`navigation:sidebar.allAgents`),_,x?(0,p.jsx)(`span`,{className:`flex-none text-sm text-content-muted tabular-nums`,children:x}):void 0),D(`features`,n,C(`navigation:sidebar.features`),v)]}),(0,p.jsx)(`div`,{"data-drawer-sessions":!0,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain px-2 pt-1`,children:b}),(0,p.jsxs)(`div`,{className:`flex flex-none items-center gap-1 border-t border-stroke-soft px-2 py-2`,children:[(0,p.jsx)(`div`,{className:`min-w-0 flex-1`,children:D(`settings`,a,C(`navigation:navigation.settings`),y)}),S]})]})})}export{h as PhoneDrawer};
@@ -1 +1 @@
1
- import{r as e}from"./vendor-react-DwNgTV1j.js";import{t}from"./use-i18n-Cyg5th6Z.js";import{t as n}from"./createLucideIcon-Cd-3GVxJ.js";import"./public-CGbDaxd0.js";import{t as r}from"./utils-C8uzG5AZ.js";import{t as i}from"./sidebar-store-BhEocW8t.js";import{t as a}from"./useSidebarModel-uxFT2LRy.js";var o=n(`menu`,[[`path`,{d:`M4 5h16`,key:`1tepv9`}],[`path`,{d:`M4 12h16`,key:`1lakjw`}],[`path`,{d:`M4 19h16`,key:`1djgab`}]]),s=e();function c({className:e}){let{t:n}=t(),{model:c}=a(),l=i(e=>e.drawerOpen),u=i(e=>e.setDrawerOpen),d=c.counts.attention;return(0,s.jsxs)(`button`,{type:`button`,"data-phone-menu":!0,"aria-haspopup":`dialog`,"aria-expanded":l,"aria-label":d>0?n(`navigation:phone.menuAttention`,{count:d}):n(`navigation:phone.menu`),className:r(`flex h-11 min-w-11 flex-none items-center justify-center gap-1.5 rounded-full bg-surface-muted px-2.5 text-content transition-colors duration-(--d-fast) focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus active:bg-surface-hover dark:bg-surface-active`,e),onClick:()=>u(!0),children:[(0,s.jsx)(o,{className:`size-5`,strokeWidth:1.75,"aria-hidden":`true`}),d>0&&(0,s.jsxs)(`span`,{"aria-hidden":`true`,"data-phone-attention":d,className:`flex h-5 items-center gap-1 rounded-full bg-warning-soft px-1.5 text-xs leading-none font-semibold text-warning-strong tabular-nums ring-1 ring-st-attn-border ring-inset`,children:[(0,s.jsx)(`span`,{className:`size-1.5 rounded-full bg-st-attn-fill`}),d>99?`99+`:d]})]})}export{c as t};
1
+ import{r as e}from"./vendor-react-DwNgTV1j.js";import{t}from"./use-i18n-B2p84ZNR.js";import{t as n}from"./createLucideIcon-Cd-3GVxJ.js";import"./public-BZlIDP6h.js";import{t as r}from"./utils-C8uzG5AZ.js";import{t as i}from"./sidebar-store-CbyxBthc.js";import{t as a}from"./useSidebarModel-V_SZjKZH.js";var o=n(`menu`,[[`path`,{d:`M4 5h16`,key:`1tepv9`}],[`path`,{d:`M4 12h16`,key:`1lakjw`}],[`path`,{d:`M4 19h16`,key:`1djgab`}]]),s=e();function c({className:e}){let{t:n}=t(),{model:c}=a(),l=i(e=>e.drawerOpen),u=i(e=>e.setDrawerOpen),d=c.counts.attention;return(0,s.jsxs)(`button`,{type:`button`,"data-phone-menu":!0,"aria-haspopup":`dialog`,"aria-expanded":l,"aria-label":d>0?n(`navigation:phone.menuAttention`,{count:d}):n(`navigation:phone.menu`),className:r(`flex h-11 min-w-11 flex-none items-center justify-center gap-1.5 rounded-full bg-surface-muted px-2.5 text-content transition-colors duration-(--d-fast) focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus active:bg-surface-hover dark:bg-surface-active`,e),onClick:()=>u(!0),children:[(0,s.jsx)(o,{className:`size-5`,strokeWidth:1.75,"aria-hidden":`true`}),d>0&&(0,s.jsxs)(`span`,{"aria-hidden":`true`,"data-phone-attention":d,className:`flex h-5 items-center gap-1 rounded-full bg-warning-soft px-1.5 text-xs leading-none font-semibold text-warning-strong tabular-nums ring-1 ring-st-attn-border ring-inset`,children:[(0,s.jsx)(`span`,{className:`size-1.5 rounded-full bg-st-attn-fill`}),d>99?`99+`:d]})]})}export{c as t};
@@ -1 +1 @@
1
- import{r as e}from"./vendor-react-DwNgTV1j.js";import{t}from"./use-i18n-Cyg5th6Z.js";import{t as n}from"./PhoneMenuButton-CBT0H1Cn.js";import{t as r}from"./search-D0mqDaf_.js";import{t as i}from"./square-pen-hYbjKh6A.js";var a=e(),o=`grid size-11 flex-none place-items-center rounded-full bg-surface-muted text-content focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus active:bg-surface-hover dark:bg-surface-active`;function s({title:e,onNewTask:s,onSearch:c}){let{t:l}=t();return(0,a.jsxs)(`header`,{"data-phone-topbar":!0,"data-focus-region":`header`,className:`relative grid h-14 flex-none grid-cols-[minmax(0,1fr)_auto_minmax(0,1fr)] items-center bg-panel px-3`,children:[(0,a.jsx)(`div`,{className:`flex min-w-0 items-center`,children:(0,a.jsx)(n,{})}),(0,a.jsx)(`p`,{"data-phone-title":!0,"aria-hidden":`true`,className:`max-w-[min(56vw,240px)] truncate text-center text-base leading-6 font-semibold text-content`,children:e}),(0,a.jsxs)(`div`,{className:`flex min-w-0 items-center justify-end gap-2`,children:[c&&(0,a.jsx)(`button`,{type:`button`,"data-phone-search":!0,"aria-label":l(`navigation:sidebar.search`),className:o,onClick:c,children:(0,a.jsx)(r,{className:`size-5`,strokeWidth:1.75,"aria-hidden":`true`})}),(0,a.jsx)(`button`,{type:`button`,"data-phone-new-task":!0,"aria-label":l(`navigation:shell.newTask`),className:o,onClick:s,children:(0,a.jsx)(i,{className:`size-5`,strokeWidth:1.75,"aria-hidden":`true`})})]})]})}export{s as PhoneTopBar};
1
+ import{r as e}from"./vendor-react-DwNgTV1j.js";import{t}from"./use-i18n-B2p84ZNR.js";import{t as n}from"./PhoneMenuButton-BMgvbvez.js";import{t as r}from"./search-D0mqDaf_.js";import{t as i}from"./square-pen-hYbjKh6A.js";var a=e(),o=`grid size-11 flex-none place-items-center rounded-full bg-surface-muted text-content focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus active:bg-surface-hover dark:bg-surface-active`;function s({title:e,onNewTask:s,onSearch:c}){let{t:l}=t();return(0,a.jsxs)(`header`,{"data-phone-topbar":!0,"data-focus-region":`header`,className:`relative grid h-14 flex-none grid-cols-[minmax(0,1fr)_auto_minmax(0,1fr)] items-center bg-panel px-3`,children:[(0,a.jsx)(`div`,{className:`flex min-w-0 items-center`,children:(0,a.jsx)(n,{})}),(0,a.jsx)(`p`,{"data-phone-title":!0,"aria-hidden":`true`,className:`max-w-[min(56vw,240px)] truncate text-center text-base leading-6 font-semibold text-content`,children:e}),(0,a.jsxs)(`div`,{className:`flex min-w-0 items-center justify-end gap-2`,children:[c&&(0,a.jsx)(`button`,{type:`button`,"data-phone-search":!0,"aria-label":l(`navigation:sidebar.search`),className:o,onClick:c,children:(0,a.jsx)(r,{className:`size-5`,strokeWidth:1.75,"aria-hidden":`true`})}),(0,a.jsx)(`button`,{type:`button`,"data-phone-new-task":!0,"aria-label":l(`navigation:shell.newTask`),className:o,onClick:s,children:(0,a.jsx)(i,{className:`size-5`,strokeWidth:1.75,"aria-hidden":`true`})})]})]})}export{s as PhoneTopBar};